Java 类com.google.gwt.event.logical.shared.HasValueChangeHandlers 实例源码

项目:platypus-js    文件:EventsExecutor.java   
public void setValueChanged(JavaScriptObject aValue) {
    if (valueChanged != aValue) {
        if (valueChangedReg != null) {
            valueChangedReg.removeHandler();
            valueChangedReg = null;
        }
        valueChanged = aValue;
        if (component instanceof HasValueChangeHandlers<?>) {
            valueChangedReg = ((HasValueChangeHandlers<Object>) component).addValueChangeHandler(new ValueChangeHandler<Object>() {

                @Override
                public void onValueChange(ValueChangeEvent<Object> event) {
                    JavaScriptObject published = ((HasPublished) event.getSource()).getPublished();
                    executeEvent(valueChanged, EventsPublisher.publishSourcedEvent(published));
                }
            });

        }
    }
}
项目:qafe-platform    文件:RendererHelper.java   
private static void addChangeListenerForWindowModified(final ComponentGVO vo, UIObject ui, final String uuid) {
    if (ui != null) {
        if (ui instanceof HasValueChangeHandlers) {
            HasValueChangeHandlers hasValueChangeHandlers = (HasValueChangeHandlers) ui;
            hasValueChangeHandlers.addValueChangeHandler(new ValueChangeHandler() {

                public void onValueChange(ValueChangeEvent event) {
                    WindowPanel window = ClientApplicationContext.getInstance().getWindow(vo.getWindow(), uuid);
                    if (window != null && window instanceof QWindowPanel) {
                        ((QWindowPanel) window).setModified(true);
                    }
                }
            });
        }
    }

}
项目:qafe-platform    文件:RendererHelper.java   
private static void addChangeListenerForWindowModified(final ComponentGVO vo, UIObject ui, final String uuid) {
        if (ui != null) {
            if (ui instanceof HasValueChangeHandlers) {
                HasValueChangeHandlers hasValueChangeHandlers = (HasValueChangeHandlers) ui;
                hasValueChangeHandlers.addValueChangeHandler(new ValueChangeHandler() {

                    public void onValueChange(ValueChangeEvent event) {
//                      WindowPanel window = ClientApplicationContext.getInstance().getWindow(vo.getWindow(), uuid);
//                      if (window != null && window instanceof QWindowPanel) {
//                          ((QWindowPanel) window).setModified(true);
//                      }
                    }
                });
            }
        }

    }
项目:gwt-bean-validators    文件:BeanValidationInitializer.java   
/**
 * initialize one editor.
 *
 * @param editor editor to initialize
 */
@SuppressWarnings({"rawtypes", "unchecked"})
public void initializeEditors(final Object editor) {
  if (editor instanceof HasValueChangeHandlers && this.valueChangeHandler != null) {
    ((HasValueChangeHandlers) editor).addValueChangeHandler(this.valueChangeHandler);
    // if widget has a value change handler, validate on change
    if (this.validateOnVueChangeHandler != null) {
      ((HasValueChangeHandlers) editor).addValueChangeHandler(this.validateOnVueChangeHandler);
    }
  }
  // if widget has a key up handler, validate on key up
  if (editor instanceof HasKeyUpHandlers && this.validateOnKeyUpHandler != null) {
    ((HasKeyUpHandlers) editor).addKeyUpHandler(this.validateOnKeyUpHandler);
  }
  // try to submit form on return
  if (editor instanceof HasKeyPressHandlers && this.commitOnReturnHandler != null) {
    ((HasKeyPressHandlers) editor).addKeyPressHandler(this.commitOnReturnHandler);
  }
}
项目:gwt-material    文件:WidgetTestCase.java   
public static <H extends HasValueChangeHandlers & HasValue & HasEnabled & HasAttachHandlers> void checkValueChangeEvent(
        H widget, Object value, Object secondValue) {
    assertNotSame(value, secondValue);
    // Widget must be enabled before firing the event
    widget.setEnabled(true);
    assertTrue(widget.isEnabled());
    // Ensure the widget is attached to the root panel
    assertTrue(widget.isAttached());
    // Register value change handler that listens when the widget
    // set the value
    final boolean[] isValueChanged = {false};
    widget.addValueChangeHandler(event -> isValueChanged[0] = true);
    // By default setValue(boolean) will not fire the value change event.
    widget.setValue(value);
    assertEquals(value, widget.getValue());
    // Expected result : false
    assertFalse(isValueChanged[0]);
    // Calling setValue(value, fireEvents) with fireEvents set to false
    widget.setValue(secondValue, false);
    // Expected result : secondValue
    assertEquals(secondValue, widget.getValue());
    // Expected result : false
    assertFalse(isValueChanged[0]);
    // Calling setValue(value, fireEvents) with fireEvents set to true
    widget.setValue(value, true);
    // Expected result : true
    assertTrue(isValueChanged[0]);
    // Expected result : value
    assertEquals(value, widget.getValue());
}
项目:r01fb    文件:GWTWidgets.java   
/**
 * Sets the ValueChange() event handler in many widgets
 * @param handler the handler
 * @param widgets the widgets
 */
public static <T> void addValueChangeHandler(final ValueChangeHandler<T> handler,final HasValueChangeHandlers<T>... widgets) {
    if (handler != null && widgets != null && widgets.length > 0) {
        for (HasValueChangeHandlers<T> w : widgets) {
            if (w != null) w.addValueChangeHandler(handler);
        }
    }
}
项目:qafe-platform    文件:QChoiceHelper.java   
public void registerItemValueChangeHandler(final Widget item) {
    if (item instanceof HasValueChangeHandlers) {
        HasValueChangeHandlers<Boolean> hasValueChangeHandlers = (HasValueChangeHandlers<Boolean>)item;
        hasValueChangeHandlers.addValueChangeHandler(new ValueChangeHandler<Boolean>() {
            public void onValueChange(ValueChangeEvent<Boolean> event) {
                doItemValueChange(event);
            }
        });
    }
}
项目:gwt-bean-validators    文件:AbstractDecorator.java   
@SuppressWarnings("unchecked")
@Override
public final HandlerRegistration addValueChangeHandler(final ValueChangeHandler<T> phandler) {
  if (this.contents.getWidget() instanceof HasValueChangeHandlers<?>) {
    return ((HasValueChangeHandlers<T>) this.contents.getWidget())
        .addValueChangeHandler(phandler);
  } else {
    return null;
  }
}
项目:test-analytics-ng    文件:CapabilitiesGridWidget.java   
private ClickHandler cellClickHandler(final int row, final int column) {
  final HasValueChangeHandlers<Pair<Component, Attribute>> self = this;
  return new ClickHandler() {
    @Override
    public void onClick(ClickEvent event) {
      cellClicked(row, column);
    }
  };
}
项目:autorest    文件:ExampleEntryPoint.java   
public static <T> Observable<ValueChangeEvent<T>> valueChange(HasValueChangeHandlers<T> source) {
    return Observable.create(s -> register(s, source.addValueChangeHandler(s::onNext)));
}
项目:qafe-platform    文件:LabeledTextAreaFieldWidget.java   
public HandlerRegistration addValueChangeHandler(ValueChangeHandler handler) {
    if (uiObject instanceof HasValueChangeHandlers) {
        return ((HasValueChangeHandlers)uiObject).addValueChangeHandler(handler);
    }
    return null;
}
项目:qafe-platform    文件:LabeledTextFieldWidget.java   
public HandlerRegistration addValueChangeHandler(ValueChangeHandler handler) {
    if (textbox instanceof HasValueChangeHandlers) {
        return ((HasValueChangeHandlers)textbox).addValueChangeHandler(handler);
    } 
    return null;
}
项目:gwt-bean-validators    文件:AbstractDecorator.java   
/**
 * add a change handler to clear error state on value change.
 *
 * @param pwidget widget to set the handler to
 */
protected void addValueChangeHandler(final HasValueChangeHandlers<T> pwidget) {
  pwidget.addValueChangeHandler(event -> AbstractDecorator.this.clearErrors());
}
项目:PortlandStateJava    文件:DivisionPresenterTest.java   
/**
 * Fires a {@link ValueChangeEvent} to a given handler
 *
 * @param value   The value that is changing
 * @param handler The handler that will receive the event
 */
private <T> void fireValueChangeEvent(T value, ValueChangeHandler<T> handler) {
  HasValueChangeHandlers<T> mock = new MockHasValueChangeHandlers<T>();
  mock.addValueChangeHandler(handler);
  ValueChangeEvent.fire(mock, value);
}