com.google.gwt.event.logical.shared.ValueChangeEvent Java Examples

The following examples show how to use com.google.gwt.event.logical.shared.ValueChangeEvent. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: GalleryPage.java    From appinventor-extensions with Apache License 2.0 6 votes vote down vote up
/**
 * Helper method called by constructor to initialize the app's title section
 * @param container   The container that title resides
 */
private void initAppTitle(Panel container) {
  if (newOrUpdateApp()) {
    // GUI for editable title container
    if (editStatus==NEWAPP) {
      // If it's new app, give a textual hint telling user this is title
      titleText.setText(app.getTitle());
    } else if (editStatus==UPDATEAPP) {
      // If it's not new, just set whatever's in the data field already
      titleText.setText(app.getTitle());
    }
    titleText.addValueChangeHandler(new ValueChangeHandler<String>() {
      @Override
      public void onValueChange(ValueChangeEvent<String> event) {
        app.setTitle(titleText.getText());
      }
    });
    titleText.addStyleName("app-desc-textarea");
    container.add(titleText);
    container.addStyleName("app-title-container");
  } else {
    Label title = new Label(app.getTitle());
    title.addStyleName("app-title");
    container.add(title);
  }
}
 
Example #2
Source File: PeriodPreferencesWidget.java    From unitime with Apache License 2.0 6 votes vote down vote up
public PeriodPreferencesWidget(boolean editable) {
	iEditable = editable;

	iPanel = new AbsolutePanel();
	
	iHorizontal = new CheckBox(MESSAGES.periodPreferenceHorizontal());
	iHorizontal.addValueChangeHandler(new ValueChangeHandler<Boolean>() {
		@Override
		public void onValueChange(ValueChangeEvent<Boolean> event) {
			RoomCookie.getInstance().setHorizontal(iHorizontal.getValue());
			render();
		}
	});
	
	initWidget(iPanel);
}
 
Example #3
Source File: InputMultiSelect.java    From putnami-web-toolkit with GNU Lesser General Public License v3.0 6 votes vote down vote up
@Override
public void onItemClick(T item) {
	if (this.selectedItems == null) {
		this.selectedItems = new ArrayList<T>();
	}
	boolean selectItem = !this.selectedItems.contains(item);
	this.selectItem(item, selectItem);
	if (selectItem) {
		this.selectedItems.add(item);
	} else {
		this.selectedItems.remove(item);
		if (this.selectedItems.isEmpty()) {
			this.selectedItems = null;
		}
	}
	this.highlightByIndex(InputMultiSelect.this.getOrderedItems().indexOf(item));
	ValueChangeEvent.fire(InputMultiSelect.this, this.selectedItems);
}
 
Example #4
Source File: InfiniteDataTableView.java    From gwt-material-demo with Apache License 2.0 6 votes vote down vote up
@UiHandler("cbCategories")
void onCategories(ValueChangeEvent<Boolean> e) {
    if(e.getValue()) {
        GWT.log("Categories checked");

        table.setUseCategories(true);
        table.clearRowsAndCategories(true);
        loadCategories();
    } else {
        GWT.log("Categories not checked");

        table.setUseCategories(false);
        table.getView().setRedraw(true);
        table.getView().refresh();
    }
}
 
Example #5
Source File: CheckBoxView.java    From gwt-material-demo with Apache License 2.0 6 votes vote down vote up
@UiHandler("cbBoxAll")
void onCheckAll(ValueChangeEvent<Boolean> e) {
    if(e.getValue()) {
        cbBlue.setValue(true);
        cbRed.setValue(true);
        cbCyan.setValue(true);
        cbGreen.setValue(true);
        cbBrown.setValue(true);
    } else {
        cbBlue.setValue(false);
        cbRed.setValue(false);
        cbCyan.setValue(false);
        cbGreen.setValue(false);
        cbBrown.setValue(false);
    }
}
 
Example #6
Source File: BaseCheckBox.java    From gwt-material with Apache License 2.0 6 votes vote down vote up
/**
 * Checks or unchecks the check box, firing {@link ValueChangeEvent} if
 * appropriate.
 * <p>
 * Note that this <em>does not</em> set the value property of the checkbox
 * input element wrapped by this widget. For access to that property, see
 * {@link #setFormValue(String)}
 *
 * @param value      true to check, false to uncheck; null value implies false
 * @param fireEvents If true, and value has changed, fire a
 *                   {@link ValueChangeEvent}
 */
@Override
public void setValue(Boolean value, boolean fireEvents) {
    if (value == null) {
        value = Boolean.FALSE;
    }

    Boolean oldValue = getValue();
    inputElem.setChecked(value);
    inputElem.setDefaultChecked(value);
    if (value.equals(oldValue)) {
        return;
    }
    if (fireEvents) {
        ValueChangeEvent.fire(this, value);
    }
}
 
Example #7
Source File: InputSelect.java    From putnami-web-toolkit with GNU Lesser General Public License v3.0 6 votes vote down vote up
@Override
public void setSelection(T selection, boolean fireEvents) {
	T oldValue = this.selectedItem;
	NavLink currentSelection = InputSelect.this.getItemsLinks().get(this.selectedItem);
	if (currentSelection != null) {
		currentSelection.setActive(false);
	}
	NavLink newSelection = InputSelect.this.getItemsLinks().get(selection);
	if (newSelection != null) {
		newSelection.setActive(true);
	}
	this.selectedItem = selection;
	this.scrollToSelected();
	if (fireEvents) {
		ValueChangeEvent.fireIfNotEqual(InputSelect.this, oldValue, selection);
	}
}
 
Example #8
Source File: Html5Camera.java    From gwt-material-addins with Apache License 2.0 6 votes vote down vote up
protected void captureToDataURL() {
    File file =  toFile(imageFileInput.getElement());

    FileReader reader = new FileReader();
    $(reader).on("load", e -> {
        imageUrl = reader.result;
        ValueChangeEvent.fire(this, imageUrl);
        return true;
    });

    if (file != null) {
        reader.readAsDataURL(file);
    } else {
        GWT.log("Please provide a file before reading the file.", new NullPointerException());
    }
}
 
Example #9
Source File: PlaceServiceTest.java    From mvp4g with Apache License 2.0 6 votes vote down vote up
@Test
public void testNavigationConfirmationForHistory() {
  String historyName = "historyName";
  placeServiceDefault.addConverter(historyName,
                                   buildHistoryConverter(true));

  MyTestNavigationConfirmation navConf = new MyTestNavigationConfirmation();
  placeServiceDefault.setNavigationConfirmation(navConf);

  ValueChangeEvent<String> event = new ValueChangeEventStub<String>(historyName);
  placeServiceDefault.onValueChange(event);
  eventBus.assertEvent(null,
                       null);

  navConf.getEvent()
         .execute();
  eventBus.assertEvent(historyName,
                       new Object[] { null });

}
 
Example #10
Source File: GalleryPage.java    From appinventor-extensions with Apache License 2.0 6 votes vote down vote up
/**
 * Helper method called by constructor to initialize the app's description
 * @param c1   The container that description resides (editable state)
 * @param c2   The container that description resides (public state)
 */
private void initAppDesc(Panel c1, Panel c2) {
  desc.getElement().setPropertyString("placeholder", MESSAGES.galleryDescriptionHint());
  if (newOrUpdateApp()) {
    desc.addValueChangeHandler(new ValueChangeHandler<String>() {
      @Override
      public void onValueChange(ValueChangeEvent<String> event) {
        app.setDescription(desc.getText());
      }
    });
    if(editStatus==UPDATEAPP){
      desc.setText(app.getDescription());
    }
    desc.addStyleName("app-desc-textarea");
    c1.add(desc);
  } else {
    Label description = new Label(app.getDescription());
    c2.add(description);
    c2.addStyleName("app-description");
  }
}
 
Example #11
Source File: AriaToggleButton.java    From unitime with Apache License 2.0 5 votes vote down vote up
@Override
public void setValue(Boolean value, boolean fireEvents) {
	if (value == null) value = false;
	iValue = value;
	setResource(iValue ? iCheckedFace : iUncheckedFace);
	Roles.getCheckboxRole().setAriaCheckedState(getElement(), iValue ? CheckedValue.TRUE : CheckedValue.FALSE);
	if (fireEvents)
		ValueChangeEvent.fire(this, getValue());
}
 
Example #12
Source File: InputRadio.java    From putnami-web-toolkit with GNU Lesser General Public License v3.0 5 votes vote down vote up
@Override
public void setSelection(T selection, boolean fireEvents) {
	T oldValue = this.selectedItem;
	RadioContainer newSelection = InputRadio.this.itemsContainer.get(selection);
	if (newSelection != null) {
		newSelection.select();
	}
	this.selectedItem = selection;
	if (fireEvents) {
		ValueChangeEvent.fireIfNotEqual(InputRadio.this, oldValue, selection);
	}
}
 
Example #13
Source File: GwtDebugPanelFilters.java    From core with GNU Lesser General Public License v2.1 5 votes vote down vote up
public RpcFilterConfig() {
  panel = new HorizontalPanel();
  panel.add(createFormLabel("RPC Pattern"));
  panel.add(textbox = createTextBox(20));
  addValueChangeHandler(new ValueChangeHandler<Config>() {
    //@Override
    public void onValueChange(ValueChangeEvent<Config> event) {
      textbox.setText(getPattern());
    }
  });
}
 
Example #14
Source File: CourseRequestsTable.java    From unitime with Apache License 2.0 5 votes vote down vote up
private void addAlternativeLine() {
	if (iAlternatives.isEmpty()) {
		iAltHeader = new P("alt-header");
		iAltHeaderTitle = new P("title"); iAltHeaderTitle.setText(MESSAGES.courseRequestsAlternatives());
		iAltHeaderNote = new P("note"); iAltHeaderNote.setText(MESSAGES.courseRequestsAlternativesNote());
		iAltHeader.add(iAltHeaderTitle);
		iAltHeader.add(iAltHeaderNote);
		add(iAltHeader);
	}
	int i = iAlternatives.size();
	final CourseRequestLine line = new CourseRequestLine(iOnline, iSessionProvider, i, true, iCheckForDuplicities, iSectioning, iSpecReg);
	iAlternatives.add(line);
	CourseRequestLine prev = (i == 0 ? iCourses.get(iCourses.size() - 1) : iAlternatives.get(i - 1));
	if (prev != null) {
		line.setPrevious(prev); prev.setNext(line);
	}
	line.setArrowsVisible(iArrowsVisible);
	insert(line, 3 + iCourses.size() + i);
	line.addValueChangeHandler(new ValueChangeHandler<CourseRequestInterface.Request>() {
		@Override
		public void onValueChange(ValueChangeEvent<Request> event) {
			if (iLastCheck != null)
				for (CourseSelectionBox box: line.getCourses()) setErrors(box, iLastCheck);
			ValueChangeEvent.fire(CourseRequestsTable.this, getValue());
			if (event.getValue() != null && iAlternatives.indexOf(line) + 1 == iAlternatives.size())
				addAlternativeLine();
		}
	});
}
 
Example #15
Source File: AbstractButton.java    From gwt-material with Apache License 2.0 5 votes vote down vote up
@Override
public void setValue(String value, boolean fireEvent) {
    if (value != null) {
        setText(value);
    }

    if (fireEvent) {
        ValueChangeEvent.fire(this, value);
    }
}
 
Example #16
Source File: SpringPage.java    From putnami-web-toolkit with GNU Lesser General Public License v3.0 5 votes vote down vote up
@UiHandler("switchBuild")
void onSwitch(ValueChangeEvent<String> event) {
	if ("MAVEN".equals(event.getValue())) {
		this.buildGradlePanel.setVisible(false);
		this.buildMavenPanel.setVisible(true);

	} else {
		this.buildGradlePanel.setVisible(true);
		this.buildMavenPanel.setVisible(false);
	}
}
 
Example #17
Source File: DeleteTool.java    From geowe-core with GNU General Public License v3.0 5 votes vote down vote up
private ValueChangeHandler<Boolean> getMultiDeletionHandler() {
	return new ValueChangeHandler<Boolean>() {
		@Override
		public void onValueChange(ValueChangeEvent<Boolean> event) {

			if (event.getValue()) {
				VectorLayer layer = (VectorLayer) getLayer();

				if (layer.getSelectedFeatures() != null) {
					confirm(Arrays.asList(layer.getSelectedFeatures()));
				}
			}
		}
	};
}
 
Example #18
Source File: PlaceServiceTest.java    From mvp4g with Apache License 2.0 5 votes vote down vote up
@Test
public void testConverterCrawlable() {
  String historyName = "historyName";
  placeServiceDefault.addConverter(historyName,
                                   buildHistoryConverter(true));
  ValueChangeEvent<String> event = new ValueChangeEventStub<String>("!" + historyName);
  placeServiceDefault.onValueChange(event);
  eventBus.assertEvent(historyName,
                       new Object[] { null });
}
 
Example #19
Source File: ColorThemingStyleTab.java    From geowe-core with GNU General Public License v3.0 5 votes vote down vote up
@Override
protected void initializePanel() {
	String fieldWidth = "125px";

	attributeTheming = new FeatureAttributeComboBox(fieldWidth);
	attributeTheming.setEnabled(false);
	enableTheming = new CheckBox();
	enableTheming.setBoxLabel(UIMessages.INSTANCE.enableColorTheming());
	enableTheming.setValue(false);
	enableTheming.addValueChangeHandler(new ValueChangeHandler<Boolean>() {
		@Override
		public void onValueChange(ValueChangeEvent<Boolean> event) {
			attributeTheming.setEnabled(event.getValue());
			enableLegend.setValue(event.getValue());
			enableLegend.setEnabled(event.getValue());

			if(event.getValue() && isFeatureStyleApplied(selectedLayer)) {
				showColorThemingStyleWarning();
			}
		}
	});

	enableLegend = new CheckBox();
	enableLegend.setBoxLabel(UIMessages.INSTANCE.colorThemingShowLegend());
	enableLegend.setValue(false);
	enableLegend.setEnabled(false);

	VerticalLayoutContainer vlc = new VerticalLayoutContainer();
	vlc.add(enableTheming, new VerticalLayoutData(-18, -1));
	vlc.add(new FieldLabel(attributeTheming, UIMessages.INSTANCE
			.vlswLabelAttribute()), new VerticalLayoutData(-18, -1));
	vlc.add(enableLegend, new VerticalLayoutData(-18, -1));

	panel.setSpacing(5);
	panel.add(vlc);
}
 
Example #20
Source File: FreeTimePicker.java    From unitime with Apache License 2.0 5 votes vote down vote up
@Override
public void setValue(List<FreeTime> value, boolean fireEvents) {
	if (value == null || value.isEmpty()) {
		for (int d=0; d<CONSTANTS.freeTimeDays().length; d++)
			for (int p=0; p<CONSTANTS.freeTimePeriods().length - 1; p++) {
				iSelected[d][p] = false;
				td(d, p).getStyle().setBackgroundColor(bg(d, p));
				setHTML(1 + d, 1 + p, "&nbsp;");
			}
	} else {
		for (int d=0; d<CONSTANTS.freeTimeDays().length; d++)
			for (int p=0; p<CONSTANTS.freeTimePeriods().length - 1; p++)
				iSelected[d][p] = false;
		for (CourseRequestInterface.FreeTime f: value) {
			for (int day: f.getDays()) {
				if (day < CONSTANTS.freeTimeDays().length) {
					for (int p = toPeriod(f.getStart()); p < toPeriod(f.getStart() + f.getLength()); p++)
						iSelected[day][p] = true;
				}
			}
		}
		generatePriorities();
		update();
	}
	if (fireEvents)
		ValueChangeEvent.fire(this, getValue());
}
 
Example #21
Source File: ValueBoxEditorView.java    From dashbuilder with Apache License 2.0 5 votes vote down vote up
@Override
public void setValueBox(final ValueBoxBase<T> widget) {
    this.widget = widget;
    widget.addValueChangeHandler(new ValueChangeHandler<T>() {
        @Override
        public void onValueChange(final ValueChangeEvent<T> event) {
            presenter.onValueChanged(event.getValue());
        }
    });
    contents.add(widget);
}
 
Example #22
Source File: StandardDataTableView.java    From gwt-material-demo with Apache License 2.0 5 votes vote down vote up
@UiHandler("cbCategories")
void onCategories(ValueChangeEvent<Boolean> e) {
    if (e.getValue()) {
        table.setUseCategories(true);
    } else {
        table.setUseCategories(false);
    }
    table.getView().setRedraw(true);
    table.getView().refresh();
}
 
Example #23
Source File: ImageCropperView.java    From gwt-material-demo with Apache License 2.0 5 votes vote down vote up
@UiHandler("comboShape")
void setComboShape(ValueChangeEvent<List<Shape>> event) {
    cropper.setShape(comboShape.getSingleValue());
    cropper.setEnableResize(false);
    enableResize.setValue(false);
    cropper.reload();
}
 
Example #24
Source File: SingleListBox.java    From gwt-traction with Apache License 2.0 5 votes vote down vote up
protected SingleListBox(boolean addMissingValue, boolean isMultipleSelect) {
super(isMultipleSelect);
setAddMissingValue(addMissingValue);

// Listen to our own change events and broadcast as
// ValueChangeEvent<String>
addChangeHandler(new ChangeHandler() {
           @Override
           public void onChange(ChangeEvent event) {
               ValueChangeEvent.fire(SingleListBox.this, getValue());
           }
});        
   }
 
Example #25
Source File: RoomSharingWidget.java    From unitime with Apache License 2.0 5 votes vote down vote up
public void setOption(RoomSharingOption option) {
	if (!isEditable(iDay, iSlot)) return;
	iModel.setOption(iDay, iSlot, iMode.getStep(), option);
	if (option == null) {
		getElement().getStyle().clearBackgroundColor();
		setHTML("");
		setTitle("");
	} else {
		getElement().getStyle().setBackgroundColor(option.getColor());
		setHTML(option.getCode() == null ? "" : option.getCode());
		setTitle(CONSTANTS.longDays()[iDay] + " " + slot2short(iSlot) + " - " + slot2short(iSlot + iMode.getStep()) + ": " + option.getName());
	}
	ValueChangeEvent.fire(RoomSharingWidget.this, getValue());
}
 
Example #26
Source File: MaterialSignaturePad.java    From gwt-material-addins with Apache License 2.0 5 votes vote down vote up
public SignaturePad getSignaturePad() {
    if (signaturePad == null) {
        options.onBegin = () -> SignatureStartEvent.fire(this);
        options.onEnd = () -> {
            SignatureEndEvent.fire(this);
            ValueChangeEvent.fire(this, getSignaturePad().toDataURL());
        };
        signaturePad = new SignaturePad(getElement(), options);
    }
    return signaturePad;
}
 
Example #27
Source File: UTCDateBoxImplHtml5.java    From gwt-traction with Apache License 2.0 5 votes vote down vote up
public UTCDateBoxImplHtml5() {
    widget = new InputWidget("date");
    setDateFormat(dateInputFormat);
    
    widget.addValueChangeHandler(new ValueChangeHandler() {

        @Override
        public void onValueChange(ValueChangeEvent event) {
            fireValueChangeEvent(getValue());
        }
        
    });
    
    initWidget(widget);        
}
 
Example #28
Source File: EventAdd.java    From unitime with Apache License 2.0 5 votes vote down vote up
@Override
public void setValue(List<RelatedObjectInterface> value, boolean fireEvents) {
	iLastChange = null;
	clearTable(1);
	if (value != null)
		for (RelatedObjectInterface line: value)
			addLine(line);
	addLine(null);
	addLine(null);
	if (fireEvents)
		ValueChangeEvent.fire(CourseRelatedObjectsTable.this, getValue());
}
 
Example #29
Source File: ToggleSwitchBase.java    From gwtbootstrap3-extras with Apache License 2.0 5 votes vote down vote up
@Override
public void setValue(final Boolean value, final boolean fireEvents) {
    Boolean oldValue = getValue();
    if (isAttached()) {
        switchState(getElement(), value, true);
    } else {
        element.setChecked(value);
    }
    if (fireEvents) {
        ValueChangeEvent.fireIfNotEqual(ToggleSwitchBase.this, oldValue, value);
    }
}
 
Example #30
Source File: LanguageSelector.java    From gwt-material-addins with Apache License 2.0 5 votes vote down vote up
@Override
public void setValue(Language language, boolean fireEvents) {
    this.language = language;

    if (getType() == LanguageSelectorType.TEXT) {
        textActivator.setText(language.getName());
    } else {
        imageActivator.setUrl(language.getImage());
    }

    if (fireEvents) {
        ValueChangeEvent.fire(this, language);
    }
}