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:de.swm.commons.mobile.client.widgets.SlidePanel.java
License:Apache License
/** * Moves to the previous slide without boundary checks. *//*from w w w .j av a 2s. co m*/ protected void movePrevious() { Slide to = getSlide(myCurrent); Slide from = (Slide) contentPanel.getWidget(0); Transition transition = Transition.SLIDE; ValueChangeEvent.fire(this, false); transition.start(from, to, contentPanel, true); }
From source file:de.swm.commons.mobile.client.widgets.Slider.java
License:Apache License
/** * Sets the value.//from w ww . j a v a 2 s .c om * * @param value * the value */ public void setValue(Integer value) { if (value != null && myValue != value) { myValue = value; updateSliderPosition(); ValueChangeEvent.fire(this, myValue); } }
From source file:edu.caltech.ipac.firefly.ui.ActiveTabPane.java
public ActiveTabPane() { tp = new TabPane(); initWidget(tp);//from w w w . j ava 2 s. c om tp.addSelectionHandler(new SelectionHandler<Integer>() { public void onSelection(SelectionEvent<Integer> integerSelectionEvent) { ValueChangeEvent.fire(ActiveTabPane.this, 0); } }); }
From source file:edu.caltech.ipac.firefly.ui.input.CheckBoxGroupInputField.java
public CheckBoxGroupInputField(EnumFieldDef fieldDef) { _fieldDef = fieldDef;/*from w w w .java 2 s.c o m*/ if (fieldDef.getOrientation().equals(EnumFieldDef.Orientation.Vertical)) { _panel = new VerticalPanel(); _fieldWidgetPanel = new VerticalPanel(); } else { _panel = new HorizontalPanel(); _fieldWidgetPanel = new HorizontalPanel(); } initWidget(_fieldWidgetPanel); _panel.setSpacing(5); _panel.setTitle(_fieldDef.getShortDesc()); //list box setup _items = ((EnumFieldDef) _fieldDef).getEnumValues(); _cbs = new ArrayList<CheckBox>(_items.size()); CheckBox cb; int idx = 0; for (EnumFieldDef.Item item : _items) { cb = new CheckBox(" " + item.getTitle(), true); _cbs.add(cb); _panel.add(cb); if (item.getName().equals(ALL)) { _idxOfAll = idx; } idx++; } // add warning area _warningArea.setWidth("16px"); _warningArea.setHeight("16px"); DOM.setStyleAttribute(_warningArea.getElement(), "padding", "3px"); ErrorHandler eh = new ErrorHandler(); _warningArea.addFocusHandler(eh); _warningArea.addBlurHandler(eh); _warningArea.addMouseDownHandler(eh); _warningArea.addMouseOverHandler(eh); _warningArea.addMouseOutHandler(eh); _fieldWidgetPanel.add(_panel); _fieldWidgetPanel.add(_warningArea); _fieldWidgetPanel.setCellHorizontalAlignment(_warningArea, HasHorizontalAlignment.ALIGN_CENTER); _fieldWidgetPanel.setCellVerticalAlignment(_warningArea, HasVerticalAlignment.ALIGN_MIDDLE); // add click listeners for (idx = 0; idx < _cbs.size(); idx++) { final CheckBox current = _cbs.get(idx); final int currentIdx = idx; current.addClickHandler(new ClickHandler() { public void onClick(ClickEvent ev) { if ((currentIdx == _idxOfAll) && current.getValue()) { //uncheck all other for (int i = 0; i < _cbs.size(); i++) { if (i != _idxOfAll) { _cbs.get(i).setValue(true); } } } else if ((currentIdx == _idxOfAll) && !current.getValue()) { //all is unchecked so uncheck all that were checked for (int i = 0; i < _cbs.size(); i++) { if (i != _idxOfAll) { _cbs.get(i).setValue(false); } } } else if (_idxOfAll >= 0) { // uncheck _all_ unless all other checkboxes are checked CheckBox all = null; int nChecked = 0; for (int i = 0; i < _cbs.size(); i++) { if (i == _idxOfAll) { all = _cbs.get(i); } else { if (_cbs.get(i).getValue()) { nChecked++; } } } assert (all != null); // all checkboxes are checked if (nChecked == _cbs.size() - 1) { all.setValue(true); for (int i = 0; i < _cbs.size(); i++) { if (i != _idxOfAll) { _cbs.get(i).setValue(true); } } } else { all.setValue(false); } } ValueChangeEvent.fire(CheckBoxGroupInputField.this, getValue()); } }); } reset(); addValueChangeHandler(new ValueChangeHandler<String>() { public void onValueChange(ValueChangeEvent valueChangeEvent) { if (validate()) { } } }); // label setup }
From source file:edu.caltech.ipac.firefly.ui.input.CheckBoxGroupInputField.java
public void setValue(String value) { if (!getValue().equals(value)) { String[] checked;/* w w w . j a va 2s .c om*/ if (value.equals(NONE)) { // uncheck all for (CheckBox cb : _cbs) { cb.setValue(false); } } else if (value.contains(ALL)) { // check all for (CheckBox cb : _cbs) { cb.setValue(true); } } else { checked = value.split(MULTI_FIELD_SEPARATOR); String name; boolean shouldBeSelected; int idx = 0; for (EnumFieldDef.Item item : _items) { name = item.getName(); shouldBeSelected = false; for (String n : checked) { if (n.equals(name)) { shouldBeSelected = true; } } _cbs.get(idx).setValue(shouldBeSelected); idx++; } } ValueChangeEvent.fire(CheckBoxGroupInputField.this, value); } }
From source file:edu.caltech.ipac.firefly.ui.input.DegreeInputField.java
private void changeUnits(int unitsIdx) { switch (unitsIdx) { case DEGREE_IDX: setUnits(DegreeFieldDef.Units.DEGREE); break;/* w w w.j a v a 2 s. c o m*/ case ARCMIN_IDX: setUnits(DegreeFieldDef.Units.ARCMIN); break; case ARCSEC_IDX: setUnits(DegreeFieldDef.Units.ARCSEC); break; default: WebAssert.tst(false, "unknown unit index"); break; } ValueChangeEvent.fire(DegreeInputField.this, unitsIdx + ""); }
From source file:edu.caltech.ipac.firefly.ui.input.ListBoxInputField.java
public ListBoxInputField(EnumFieldDef fieldDef) { _fieldDef = fieldDef;//w ww .ja va2 s. com initWidget(_listBox); //list box setup _items = ((EnumFieldDef) _fieldDef).getEnumValues(); for (EnumFieldDef.Item item : _items) { _listBox.addItem(item.getTitle()); } _listBox.setTitle(_fieldDef.getShortDesc()); reset(); _listBox.addChangeHandler(new ChangeHandler() { public void onChange(ChangeEvent event) { _selectedIdx = _listBox.getSelectedIndex(); ValueChangeEvent.fire(ListBoxInputField.this, _selectedIdx + ""); updatePref(); } }); // label setup }
From source file:edu.caltech.ipac.firefly.ui.input.ListBoxInputField.java
public void setValue(String v) { int cnt = 0;//w w w . ja va2 s .com for (EnumFieldDef.Item item : _items) { if (v.equals(item.getName())) { int oldSelectedIdx = _selectedIdx; _selectedIdx = cnt; _listBox.setSelectedIndex(_selectedIdx); if (oldSelectedIdx != _selectedIdx) { ValueChangeEvent.fire(ListBoxInputField.this, _selectedIdx + ""); } updatePref(); } cnt++; } }
From source file:edu.caltech.ipac.firefly.ui.input.TextAreaInputField.java
private void checkForChange() { String sval = getValue();//from w w w . j a v a2s .com boolean isDefault = StringUtils.areEqual(sval, getFieldDef().getDefaultValueAsString()); // do not validate default if (isDefault || validate()) { if (!ComparisonUtil.equals(_lastInput, sval)) { ValueChangeEvent.fire(this, sval); _lastInput = sval; } } }
From source file:edu.caltech.ipac.firefly.ui.input.TextBoxInputField.java
private void checkForChange(boolean hardValidate) { String sval = getValue();/*ww w . jav a 2 s .c o m*/ boolean isDefault = StringUtils.areEqual(sval, getFieldDef().getDefaultValueAsString()); // do not validate default boolean valid = hardValidate ? validate() : validateSoft(); if (isDefault || valid) { if (!ComparisonUtil.equals(_lastInput, sval)) { _lastInput = sval; ValueChangeEvent.fire(this, sval); } } }