Java Code Examples for com.google.gwt.event.logical.shared.ValueChangeEvent#fire()

The following examples show how to use com.google.gwt.event.logical.shared.ValueChangeEvent#fire() . 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: FilterBox.java    From unitime with Apache License 2.0 6 votes vote down vote up
private SuggestionMenuItem(final Suggestion suggestion) {
	super(suggestion.getDisplayString() == null
			? suggestion.getChip().getLabel() + " <span class='item-command'>" + suggestion.getChip().getTranslatedCommand() + "</span>"
			: SafeHtmlUtils.htmlEscape(suggestion.getDisplayString()) + (suggestion.getHint() == null ? "" : " " + suggestion.getHint()),
		true,
		new Command() {
			@Override
			public void execute() {
				hideSuggestions();
				setStatus(ARIA.suggestionSelected(suggestion.toAriaString(FilterBox.this)));
				applySuggestion(suggestion);
				iLastValue = getValue();
				setAriaLabel(toAriaString());
				fireSelectionEvent(suggestion);
				ValueChangeEvent.fire(FilterBox.this, getValue());
			}
		});
	setStyleName("item");
	getElement().setAttribute("whiteSpace", "nowrap");
	iSuggestion = suggestion;
}
 
Example 2
Source File: InputCheckbox.java    From gwt-jackson with Apache License 2.0 6 votes vote down vote up
@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 3
Source File: CourseRequestBox.java    From unitime with Apache License 2.0 6 votes vote down vote up
@Override
public void addChip(Chip chip, boolean fireEvents) {
	final ChipPanel panel = new ChipPanel(chip, getChipColor(chip));
	panel.addClickHandler(new ClickHandler() {
		@Override
		public void onClick(ClickEvent event) {
			remove(panel);
			resizeFilterIfNeeded();
			setAriaLabel(toAriaString());
			ValueChangeEvent.fire(CourseRequestFilterBox.this, getValue());
		}
	});
	insert(panel, getWidgetIndex(iFilterFinder));
	resizeFilterIfNeeded();
	setAriaLabel(toAriaString());
	if (fireEvents)
		ValueChangeEvent.fire(this, getValue());
}
 
Example 4
Source File: CourseFinderDialog.java    From unitime with Apache License 2.0 5 votes vote down vote up
@Override
public void setValue(final RequestedCourse value, boolean fireEvents) {
	iFilter.setValue(value == null ? "" : value.toString(CONSTANTS), false);
	iLastFilter = iFilter.getValue();
	if (fireEvents)
		ValueChangeEvent.fire(this, value);
}
 
Example 5
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 6
Source File: PeriodPreferencesWidget.java    From unitime with Apache License 2.0 5 votes vote down vote up
public void setOption(PreferenceInterface preference) {
	if (!isEditable() || iPeriod == null) return;
	iModel.setPreference(iDay, iSlot, preference);
	if (preference == null) {
		getElement().getStyle().clearBackgroundColor();
		setTitle("");
	} else {
		getElement().getStyle().setBackgroundColor(preference.getColor());
		setTitle(DateTimeFormat.getFormat(CONSTANTS.examPeriodDateFormat()).format(iDate) + " " + slot2short(iSlot) + " - " + slot2short(iSlot + iPeriod.getLength()) + ": " + preference.getName());
	}
	ValueChangeEvent.fire(PeriodPreferencesWidget.this, getValue());
}
 
Example 7
Source File: SingleDateSelector.java    From unitime with Apache License 2.0 5 votes vote down vote up
@Override
public void setValue(Date value, boolean fireEvents) {
	if (value == null) {
		iPicker.setText("");
		iMonth.setValue(null);
	} else {
		iPicker.setText(iFormat.format(value));
		iMonth.setValue(value);
	}
	if (fireEvents)
		ValueChangeEvent.fire(this, value);
}
 
Example 8
Source File: DatePickerBase.java    From gwtbootstrap3-extras with Apache License 2.0 5 votes vote down vote up
/** {@inheritDoc} */
@Override
public void setValue(final Date value, final boolean fireEvents) {
    errorHandlerMixin.clearErrors();
    textBox.setValue(value != null ? dateTimeFormat.format(value) : null);
    update(textBox.getElement());

    if (fireEvents) {
        ValueChangeEvent.fire(DatePickerBase.this, value);
    }
}
 
Example 9
Source File: EventMeetingTable.java    From unitime with Apache License 2.0 5 votes vote down vote up
@Override
public void setValue(List<EventMeetingRow> value, boolean fireEvents) {
	clearTable(1);
	resetColumnVisibility();
	if (value != null)
		for (EventMeetingRow row: value)
			add(row);
	sort();
	if (fireEvents)
		ValueChangeEvent.fire(this, value);
}
 
Example 10
Source File: MobilePageLabelImpl.java    From unitime with Apache License 2.0 5 votes vote down vote up
@Override
public void setValue(PageNameInterface value, boolean fireEvents) {
	iUrl = value.getHelpUrl();
	iHelp.setVisible(iUrl != null && !iUrl.isEmpty());
	setText(value.getName());
	if (fireEvents)
		ValueChangeEvent.fire(this, value);
}
 
Example 11
Source File: OpenCloseSectionImage.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) return;
	iValue = value;
	setResource(iValue ? RESOURCES.treeOpen() : RESOURCES.treeClosed());
	if (fireEvents)
		ValueChangeEvent.fire(this, iValue);
}
 
Example 12
Source File: InstructorDetails.java    From unitime with Apache License 2.0 5 votes vote down vote up
@Override
public void setValue(Integer value, boolean fireEvents) {
	if (value == null) {
		int row = iRequestsTable.getSelectedRow();
		if (row >= 0) iRequestsTable.setSelected(row, false);
	} else {
		iRequestsTable.setSelected(value + 1, true);
	}
	if (fireEvents)
		ValueChangeEvent.fire(this, getValue());
}
 
Example 13
Source File: MultiSelect.java    From unitime with Apache License 2.0 5 votes vote down vote up
@Override
public void setValue(List<T> value, boolean fireEvents) {
	for (Item item: iItems)
		item.setValue(value.contains(item.getId()));
	if (fireEvents)
		ValueChangeEvent.fire(this, getValue());
}
 
Example 14
Source File: RoomSharingWidget.java    From unitime with Apache License 2.0 4 votes vote down vote up
@Override
public void setValue(RoomSharingModel value, boolean fireEvents) {
	setModel(value);
	if (fireEvents)
		ValueChangeEvent.fire(this, getValue());
}
 
Example 15
Source File: UniTimeFilterBox.java    From unitime with Apache License 2.0 4 votes vote down vote up
protected void fireValueChangeEvent() {
	ValueChangeEvent.fire(iFilter.getWidget(), iFilter.getWidget().getValue());
}
 
Example 16
Source File: InputSwitch.java    From putnami-web-toolkit with GNU Lesser General Public License v3.0 4 votes vote down vote up
@Override
public void onItemClick(T item) {
	this.selectedItem = item;
	ValueChangeEvent.fire(InputSwitch.this, this.selectedItem);
	InputSwitch.this.resetSlider(item);
}
 
Example 17
Source File: GwtDebugPanelFilters.java    From core with GNU Lesser General Public License v2.1 4 votes vote down vote up
protected void setTime(Date start, Date end) {
  this.start = start;
  this.end = end;
  ValueChangeEvent.fire(config, config);
}
 
Example 18
Source File: FreeTimePicker.java    From unitime with Apache License 2.0 4 votes vote down vote up
private void processMouseEvent(int eventType, int day, int period) {
	if (!isEnabled()) return;
    switch (eventType) {
	case Event.ONMOUSEDOWN:
		iDownDay = day; iDownPeriod = period; iOverDay = day; iOverPeriod = period;
		break;
	case Event.ONMOUSEUP:
		if (iDownDay>=0 && iOverDay>=0) {
			int d0 = (iDownDay < iOverDay ? iDownDay : iOverDay);
			int d1 = (iDownDay < iOverDay ? iOverDay : iDownDay);
			int p0 = (iDownPeriod < iOverPeriod ? iDownPeriod : iOverPeriod);
			int p1 = (iDownPeriod < iOverPeriod ? iOverPeriod : iDownPeriod);
			boolean allSelected = true;
			boolean mwfDown = (iDownDay % 2 == 0);
			all: for (int d=d0; d<=d1; d++) {
				if (d1 - d0 <= 0 || (d % 2 == 0) == mwfDown) {
					for (int p=p0; p<=p1; p++)
						if (!iSelected[d][p]) {
							allSelected = false; break all;
						}
				}
			}
			long ts = iTime++;
			for (int d=d0; d<=d1; d++) {
				if (d1 - d0 <= 1 || (d % 2 == 0) == mwfDown) {
					for (int p=p0; p<=p1; p++) {
						iSelected[d][p] = !allSelected;
						iLastSelectedTime[d][p] = ts;
					}
				}
			}
		}
		iDownDay = -1; iDownPeriod = -1; iOverDay = -1; iOverPeriod = -1;
		generatePriorities();
		ValueChangeEvent.fire(this, getValue());
		break;
	case Event.ONMOUSEOVER:
		iOverDay = day; iOverPeriod = period;
		break;
	case Event.ONMOUSEOUT:
		iOverDay = -1; iOverPeriod = -1;
		break;
	}
	update();
}
 
Example 19
Source File: PeriodPreferencesWidget.java    From unitime with Apache License 2.0 4 votes vote down vote up
@Override
public void setValue(PeriodPreferenceModel value, boolean fireEvents) {
	setModel(value);
	if (fireEvents)
		ValueChangeEvent.fire(this, getValue());
}
 
Example 20
Source File: SliderBase.java    From gwtbootstrap3-extras with Apache License 2.0 2 votes vote down vote up
/**
 * Fires a {@link ValueChangeEvent} event.
 *
 * @param value the new slide value
 */
protected void fireChangeEvent(final T value) {
    ValueChangeEvent.fire(this, value);
}