List of usage examples for com.google.gwt.event.logical.shared ValueChangeEvent fire
public static <T> void fire(HasValueChangeHandlers<T> source, T value)
From source file:com.dianaui.universal.core.client.ui.DateTimePicker.java
License:Apache License
@Override public void setValue(final Date value, final boolean fireEvents) { setValue(value);//from www .ja v a 2 s . c om if (fireEvents) ValueChangeEvent.fire(this, value); }
From source file:com.dianaui.universal.core.client.ui.gwt.RichTextArea.java
License:Apache License
@Override public HandlerRegistration addValueChangeHandler(final ValueChangeHandler<String> handler) { // Initialization code if (!valueChangeHandlerInitialized) { valueChangeHandlerInitialized = true; addChangeHandler(new ChangeHandler() { public void onChange(ChangeEvent event) { ValueChangeEvent.fire(RichTextArea.this, getValue()); }/* w w w . j av a2 s .c o m*/ }); } return addHandler(handler, ValueChangeEvent.getType()); }
From source file:com.dianaui.universal.core.client.ui.SimplePagination.java
License:Apache License
@Override public void setValue(Integer value, boolean fireEvents) { if (pagesCount < value || value < 0) { throw new RuntimeException("New page is wrong: " + value); }/* ww w . j av a 2s. c o m*/ if (value.equals(this.value)) { return; } int index = previousLink != null ? value + 1 : value; for (int i = 0; i < getWidgetCount(); i++) { ((AnchorListItem) getWidget(i)).setActive(i == index ? true : false); } if (previousLink != null) previousLink.setEnabled(index == 1 ? false : true); if (nextLink != null) nextLink.setEnabled(index == pagesCount ? false : true); this.value = value; if (fireEvents) { ValueChangeEvent.fire(this, value); } }
From source file:com.dreamskiale.client.history.CustomHistorian.java
License:Apache License
/** * Method invoked whenever history gets updated */ protected void onHistoryChange() { ValueChangeEvent.fire(this, getToken()); }
From source file:com.dreamskiale.client.history.CustomHistorian.java
License:Apache License
@Override public final void newItem(String token, boolean issueEvent) { if (getToken().equals(token)) { return;//from w w w .j ava 2s . c om } goTo(fromGwtPlaceTokenToUrl(token)); if (issueEvent) { ValueChangeEvent.fire(this, getToken()); } }
From source file:com.eas.widgets.boxes.DateTimeBox.java
public DateTimeBox(DateTimePicker aPicker, Date date, DateBox.Format format) { initWidget(container);/*from w ww .j a va 2s . com*/ datePicker = aPicker; timePicker = aPicker.getTimePicker(); container.getElement().getStyle().setDisplay(Style.Display.INLINE_BLOCK); container.getElement().getStyle().setPosition(Style.Position.RELATIVE); container.getElement().addClassName("date-time-field"); field = new CustomDateBox(datePicker, date, format); field.setFireNullValues(true); field.setStyleName("form-control"); box = field.getTextBox(); box.getElement().getStyle().setOutlineStyle(Style.OutlineStyle.NONE); field.addValueChangeHandler(new ValueChangeHandler<Date>() { @Override public void onValueChange(ValueChangeEvent<Date> event) { Date newValue = event.getValue(); if (value == null ? newValue != null : !value.equals(newValue)) { value = newValue; timePicker.setValue(value, false); datePicker.setValue(value, false); ValueChangeEvent.fire(DateTimeBox.this, newValue); } } }); datePicker.addValueChangeHandler(new ValueChangeHandler<Date>() { @Override public void onValueChange(ValueChangeEvent<Date> event) { Date datePart = event.getValue(); Date timePart = timePicker.getValue(); if (value == null && (new Date(0)).equals(timePart)) { Date currentTime = new Date(); Date currentDate = new Date(currentTime.getTime()); CalendarUtil.resetTime(currentDate); timePart = new Date(currentTime.getTime() - currentDate.getTime()); } Date newValue; if (timePart == null) { newValue = datePart; } else { newValue = new Date(datePart.getTime() + timePart.getTime()); } if (value == null ? newValue != null : !value.equals(newValue)) { value = newValue; field.setValue(value, false); timePicker.setValue(value, false); ValueChangeEvent.fire(DateTimeBox.this, newValue); } } }); timePicker.addValueChangeHandler(new ValueChangeHandler<Date>() { @Override public void onValueChange(ValueChangeEvent<Date> event) { Date timePart = timePicker.getValue(); Date datePart = field.getValue(); CalendarUtil.resetTime(datePart); value = new Date(datePart.getTime() + timePart.getTime()); field.setValue(value, false); datePicker.setValue(value, false); ValueChangeEvent.fire(DateTimeBox.this, value); } }); CommonResources.INSTANCE.commons().ensureInjected(); field.getElement().addClassName(CommonResources.INSTANCE.commons().borderSized()); field.getElement().getStyle().setDisplay(Style.Display.INLINE_BLOCK); field.getElement().getStyle().setPosition(Style.Position.ABSOLUTE); field.getElement().getStyle().setTop(0, Style.Unit.PX); field.getElement().getStyle().setHeight(100, Style.Unit.PCT); field.getElement().getStyle().setBottom(0, Style.Unit.PX); field.getElement().getStyle().setLeft(0, Style.Unit.PX); field.getElement().getStyle().setWidth(100, Style.Unit.PCT); field.getElement().getStyle().setMargin(0, Style.Unit.PX); field.getElement().getStyle().setBackgroundColor("inherit"); field.getElement().getStyle().setColor("inherit"); field.getElement().addClassName("date-time-box"); right.getElement().addClassName("date-select"); right.getElement().getStyle().setDisplay(Style.Display.INLINE_BLOCK); right.getElement().getStyle().setHeight(100, Style.Unit.PCT); right.getElement().getStyle().setPosition(Style.Position.RELATIVE); CommonResources.INSTANCE.commons().ensureInjected(); right.getElement().addClassName(CommonResources.INSTANCE.commons().unselectable()); popup.setStyleName("date-box-popup"); popup.setAutoHideEnabled(true); container.add(field); container.add(right); right.addDomHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { if (!isReadonly()) { datePicker.setCurrentMonth(value != null ? value : new Date()); popup.setWidget(datePicker); popup.showRelativeTo(right); } } }, ClickEvent.getType()); redecorate(); getElement().<XElement>cast().addResizingTransitionEnd(this); if (field.getTextBox() instanceof HasKeyDownHandlers) { ((HasKeyDownHandlers) field.getTextBox()).addKeyDownHandler(new KeyDownHandler() { @Override public void onKeyDown(KeyDownEvent event) { KeyDownEvent.fireNativeEvent(event.getNativeEvent(), DateTimeBox.this); } }); } if (field.getTextBox() instanceof HasKeyUpHandlers) { ((HasKeyUpHandlers) field.getTextBox()).addKeyUpHandler(new KeyUpHandler() { @Override public void onKeyUp(KeyUpEvent event) { KeyUpEvent.fireNativeEvent(event.getNativeEvent(), DateTimeBox.this); } }); } if (field.getTextBox() instanceof HasKeyPressHandlers) { ((HasKeyPressHandlers) field.getTextBox()).addKeyPressHandler(new KeyPressHandler() { @Override public void onKeyPress(KeyPressEvent event) { KeyPressEvent.fireNativeEvent(event.getNativeEvent(), DateTimeBox.this); } }); } if (field.getTextBox() instanceof HasFocusHandlers) { ((HasFocusHandlers) field.getTextBox()).addFocusHandler(new FocusHandler() { @Override public void onFocus(FocusEvent event) { FocusEvent.fireNativeEvent(event.getNativeEvent(), DateTimeBox.this); } }); } if (field.getTextBox() instanceof HasBlurHandlers) { ((HasBlurHandlers) field.getTextBox()).addBlurHandler(new BlurHandler() { @Override public void onBlur(BlurEvent event) { BlurEvent.fireNativeEvent(event.getNativeEvent(), DateTimeBox.this); } }); } changeViewPresentation(); }
From source file:com.eas.widgets.boxes.DateTimeBox.java
@Override public void setValue(Date aValue, boolean fireEvents) { if (value == null ? aValue != null : !value.equals(aValue)) { value = aValue;//from w ww.j a v a 2 s . c om field.setValue(aValue, false); timePicker.setValue(value, false); datePicker.setValue(value, false); if (fireEvents) { ValueChangeEvent.fire(DateTimeBox.this, value); } } }
From source file:com.eas.widgets.boxes.ImageToggleButton.java
@Override public void setValue(Boolean aValue, boolean fireEvents) { if (aValue == null) { aValue = Boolean.FALSE;/* ww w .j av a 2s . co m*/ } Boolean oldValue = getValue(); selected = aValue; setStyleDependentName("active", selected); setStyleDependentName("default", !selected); if (fireEvents && !aValue.equals(oldValue)) { ValueChangeEvent.fire(this, aValue); } }
From source file:com.eas.widgets.boxes.SpinnerBox.java
public SpinnerBox(ValueBox<T> aField) { initWidget(container);//from ww w. j a v a 2 s .c om container.getElement().getStyle().setDisplay(Style.Display.INLINE_BLOCK); container.getElement().getStyle().setPosition(Style.Position.RELATIVE); container.getElement().addClassName("spin-field"); field = aField; field.setStyleName("form-control"); field.addValueChangeHandler(new ValueChangeHandler<T>() { @Override public void onValueChange(ValueChangeEvent<T> event) { ValueChangeEvent.fire(SpinnerBox.this, getValue()); } }); if (field instanceof HasKeyDownHandlers) { ((HasKeyDownHandlers) field).addKeyDownHandler(new KeyDownHandler() { @Override public void onKeyDown(KeyDownEvent event) { KeyDownEvent.fireNativeEvent(event.getNativeEvent(), SpinnerBox.this); } }); } if (field instanceof HasKeyUpHandlers) { ((HasKeyUpHandlers) field).addKeyUpHandler(new KeyUpHandler() { @Override public void onKeyUp(KeyUpEvent event) { KeyUpEvent.fireNativeEvent(event.getNativeEvent(), SpinnerBox.this); } }); } if (field instanceof HasKeyPressHandlers) { ((HasKeyPressHandlers) field).addKeyPressHandler(new KeyPressHandler() { @Override public void onKeyPress(KeyPressEvent event) { KeyPressEvent.fireNativeEvent(event.getNativeEvent(), SpinnerBox.this); } }); } if (field instanceof HasFocusHandlers) { ((HasFocusHandlers) field).addFocusHandler(new FocusHandler() { @Override public void onFocus(FocusEvent event) { FocusEvent.fireNativeEvent(event.getNativeEvent(), SpinnerBox.this); } }); } if (field instanceof HasBlurHandlers) { ((HasBlurHandlers) field).addBlurHandler(new BlurHandler() { @Override public void onBlur(BlurEvent event) { BlurEvent.fireNativeEvent(event.getNativeEvent(), SpinnerBox.this); } }); } left.getElement().addClassName("spin-left"); left.getElement().getStyle().setDisplay(Style.Display.INLINE_BLOCK); left.getElement().getStyle().setTop(0, Style.Unit.PX); left.getElement().getStyle().setHeight(100, Style.Unit.PCT); left.getElement().getStyle().setPosition(Style.Position.RELATIVE); CommonResources.INSTANCE.commons().ensureInjected(); field.getElement().getStyle().setDisplay(Style.Display.INLINE_BLOCK); field.getElement().getStyle().setPosition(Style.Position.ABSOLUTE); field.getElement().getStyle().setTop(0, Style.Unit.PX); field.getElement().getStyle().setHeight(100, Style.Unit.PCT); field.getElement().getStyle().setLeft(0, Style.Unit.PX); field.getElement().getStyle().setWidth(100, Style.Unit.PCT); field.getElement().getStyle().setMargin(0, Style.Unit.PX); field.getElement().getStyle().setBackgroundColor("inherit"); field.getElement().getStyle().setColor("inherit"); field.getElement().addClassName(CommonResources.INSTANCE.commons().borderSized()); right.getElement().addClassName("spin-right"); right.getElement().getStyle().setDisplay(Style.Display.INLINE_BLOCK); right.getElement().getStyle().setTop(0, Style.Unit.PX); right.getElement().getStyle().setHeight(100, Style.Unit.PCT); right.getElement().getStyle().setPosition(Style.Position.RELATIVE); CommonResources.INSTANCE.commons().ensureInjected(); left.getElement().addClassName(CommonResources.INSTANCE.commons().unselectable()); right.getElement().addClassName(CommonResources.INSTANCE.commons().unselectable()); container.add(field); container.add(left); container.add(right); left.addDomHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { if (!isReadonly()) { decrement(); } } }, ClickEvent.getType()); right.addDomHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { if (!isReadonly()) { increment(); } } }, ClickEvent.getType()); redecorate(); getElement().<XElement>cast().addResizingTransitionEnd(this); }
From source file:com.ephesoft.dcma.gwt.admin.bm.client.view.kvextraction.advancedkvextraction.AdvancedKVExtractionView.java
License:Open Source License
/** * To set Key Pattern.// ww w . j a va2s. c o m * * @param keyPattern String */ public void setKeyPattern(final String keyPattern) { ValueChangeEvent.fire(useExistingKey, isUseExistingKey()); presenter.setKeyPatternFields(); if (isUseExistingKey()) { setKeyField(keyPattern); } else { setKeyPatternText(keyPattern); } }