Java Code Examples for com.google.gwt.event.logical.shared.ValueChangeHandler

The following examples show how to use com.google.gwt.event.logical.shared.ValueChangeHandler. These examples are extracted from open source projects. 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 want to check out the right sidebar which shows the related API usage.
Example 1
Source Project: appinventor-extensions   Source File: GalleryPage.java    License: 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 2
private TreeItem createCascadeCheckboxItem(CheckBox cb) {
  final TreeItem newItem = new TreeItem();
  cb.addValueChangeHandler(new ValueChangeHandler<Boolean>() {
    @Override
    public void onValueChange(ValueChangeEvent<Boolean> valueChangeEvent) {
      if (newItem.getChildCount() > 0) {
        toggleChildren(newItem, valueChangeEvent.getValue());
      }
      if (valueChangeEvent.getValue() == true) {
        TreeItem parentItem = newItem.getParentItem();
        while (parentItem != null) {
          ((CheckBox)parentItem.getWidget()).setValue(true, false);
          parentItem = parentItem.getParentItem();
        }
      }
    }
  });
  newItem.setWidget(cb);
  return newItem;
}
 
Example 3
Source Project: geowe-core   Source File: W3wTool.java    License: GNU General Public License v3.0 6 votes vote down vote up
@Override
protected ValueChangeHandler<Boolean> getSelectChangeHandler() {
	return new ValueChangeHandler<Boolean>() {
		@Override
		public void onValueChange(final ValueChangeEvent<Boolean> event) {

			if (event.getValue()) {
				setActive(true);
				basicToolBar.setAnchorVisible(true);
				basicToolBar.setAnchorColor(GREEN);
				basicToolBar.setWhat3Words("");
				createW3wLayer();
			} else {
				setActive(false);
				basicToolBar.setAnchorVisible(false);
				basicToolBar.setAnchorColor(RED);
			}
		}
	};
}
 
Example 4
public void initializeWMTSFields() {
	urlWMTSField.setEmptyText("http://...");
	nameWMTSField.setEmptyText(UIMessages.INSTANCE
			.lrasterdLayerNameField("WMTS"));
	formatWMTSField.setEmptyText("image/png, image/jpg...");
	tileMatrixSetField.setEmptyText("matrix set identifier");
	styleField.setEmptyText(UIMessages.INSTANCE.vlswHeading());
	
	urlWMTSField.addValueChangeHandler(new ValueChangeHandler<String>() {
		@Override
		public void onValueChange(ValueChangeEvent<String> event) {
			if (!event.getValue().startsWith("http")) {
				showAlert("URL");
			}
		}
	});
}
 
Example 5
private VerticalPanel getFoot() {
	slider.setWidth("290px");
	slider.disable();
	slider.setIncrement(1);

	slider.addValueChangeHandler(new ValueChangeHandler<Integer>() {

		@Override
		public void onValueChange(final ValueChangeEvent<Integer> event) {
			final Layer layer = getSelectedLayer(getSelectedTabName());
			layer.setOpacity((float) (event.getValue().intValue() / 100.0));
		}

	});

	final VerticalPanel panel = new VerticalPanel();
	panel.setWidth("300px");
	panel.addStyleName(ThemeStyles.get().style().borderTop());
	panel.add(new HTML(UIMessages.INSTANCE.lmOpacityHtmlLabel()));
	panel.add(slider);

	panel.add(statusBar);
	return panel;
}
 
Example 6
Source Project: unitime   Source File: TeachingAssignmentsWidget.java    License: Apache License 2.0 6 votes vote down vote up
public TeachingAssignmentsWidget() {
	iHeader = new UniTimeHeaderPanel(MESSAGES.sectTeachingAssignments());
	iHeader.addCollapsibleHandler(new ValueChangeHandler<Boolean>() {
		@Override
		public void onValueChange(ValueChangeEvent<Boolean> event) {
			InstructorCookie.getInstance().setShowTeachingAssignments(event.getValue());
			if (iTable != null) {
				iTable.setVisible(event.getValue());
			} else if (event.getValue()) {
				refresh();
			}
		}
	});
	iHeader.setCollapsible(InstructorCookie.getInstance().isShowTeachingAssignments());
	iHeader.setTitleStyleName("unitime3-HeaderTitle");
	removeStyleName("unitime-NotPrintableBottomLine");
	
	addHeaderRow(iHeader);
	iHeader.getElement().getStyle().setMarginTop(10, Unit.PX);
}
 
Example 7
Source Project: unitime   Source File: InstructorAttributeEdit.java    License: Apache License 2.0 6 votes vote down vote up
public void setInstructors(List<InstructorInterface> instructors) {
	iInstructors.clearTable(1);
	iInstructors.resetVisibility();
	iHeader.clearMessage();
	ValueChangeHandler<Boolean> clearErrorMessage = new ValueChangeHandler<Boolean>() {
		@Override
		public void onValueChange(ValueChangeEvent<Boolean> event) {
			iHeader.clearMessage();
		}
	};
	if (instructors != null)
		for (InstructorInterface i: instructors) {
			int row = iInstructors.addInstructor(i);
			boolean selected = i.hasAttribute(iAttribute.getId());
			iInstructors.selectInstructor(row, selected);
			iInstructors.setSelected(row, selected);
			iInstructors.getInstructorSelection(row).addValueChangeHandler(clearErrorMessage);
		}
	int sort = InstructorCookie.getInstance().getSortInstructorsBy();
	if (sort != 0)
		iInstructors.setSortBy(sort);
	iInstructors.setVisible(iInstructors.getRowCount() > 1);
}
 
Example 8
public TimeFilterConfig() {
  grid = new Grid(2, 4);
  grid.setWidget(0, 0, createFormLabel("Start"));
  grid.setWidget(0, 1, startDate = createTextBox(12));
  grid.setWidget(0, 2, createComment("hh:mm:ss.SSS"));
  grid.setWidget(0, 3, createNowLink(startDate));
  grid.setWidget(1, 0, createFormLabel("End"));
  grid.setWidget(1, 1, endDate = createTextBox(12));
  grid.setWidget(1, 2, createComment("hh:mm:ss.SSS"));
  grid.setWidget(1, 3, createNowLink(endDate));
  addValueChangeHandler(new ValueChangeHandler<Config>() {
    //@Override
    public void onValueChange(ValueChangeEvent<Config> event) {
      Date date = getStart();
      startDate.setText(date == null ? "" : FORMAT.format(date));
      date = getEnd();
      endDate.setText(date == null ? "" : FORMAT.format(date));
    }
  });
}
 
Example 9
Source Project: unitime   Source File: RoomDepartmentsEdit.java    License: Apache License 2.0 6 votes vote down vote up
public void setRooms(List<Entity> rooms, Integer sortBy) {
	iRooms.clearTable(1);
	iHeader.clearMessage();
	ValueChangeHandler<Boolean> clearErrorMessage = new ValueChangeHandler<Boolean>() {
		@Override
		public void onValueChange(ValueChangeEvent<Boolean> event) {
			iHeader.clearMessage();
		}
	};
	for (Entity e: rooms) {
		RoomDetailInterface room = (RoomDetailInterface)e;
		int row = iRooms.addRoom(room);
		boolean selected = false;
		if (iDepartment != null) {
			selected = (room.getDepartment(iDepartment.getId()) != null);
		} else if (iExamType != null) {
			selected = (room.getExamType(iExamType.getId()) != null);
		}
		iRooms.selectRoom(row, selected);
		iRooms.setSelected(row, selected);
		iRooms.getRoomSelection(row).addValueChangeHandler(clearErrorMessage);
	}
	if (sortBy != null)
		iRooms.setSortBy(sortBy);
}
 
Example 10
Source Project: unitime   Source File: PeriodPreferencesWidget.java    License: 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 11
Source Project: unitime   Source File: PageFilter.java    License: Apache License 2.0 6 votes vote down vote up
public PageFilter() {
	addStyleName("unitime-PageFilter");
	iHeader = new UniTimeHeaderPanel(MESSAGES.sectFilter());
	iHeader.setCollapsible(true);
	iHeader.addCollapsibleHandler(new ValueChangeHandler<Boolean>() {
		@Override
		public void onValueChange(ValueChangeEvent<Boolean> event) {
			for (int row: iCollapsibleRows) {
				getRowFormatter().setVisible(row, event.getValue());
			}
		}
	});
	iFilterHeaderRow = addHeaderRow(iHeader);
	iFilterLastRow = iFilterHeaderRow;
	iFooter = iHeader.clonePanel(null);
}
 
Example 12
Source Project: unitime   Source File: ConflictsWidget.java    License: Apache License 2.0 6 votes vote down vote up
public ConflictsWidget(SuggestionsPageContext context) {
	super();
	iContext = context;
	iHeader = new UniTimeHeaderPanel(MESSAGES.headerConflicts());
	iHeader.setCollapsible(SolverCookie.getInstance().isShowConflicts());
	iHeader.addCollapsibleHandler(new ValueChangeHandler<Boolean>() {
		@Override
		public void onValueChange(ValueChangeEvent<Boolean> event) {
			SolverCookie.getInstance().setShowConflicts(event.getValue());
			if (event.getValue()) {
				showConflicts();
			} else {
				hideConflicts();
			}
		}
	});
	removeStyleName("unitime-NotPrintableBottomLine");
}
 
Example 13
Source Project: unitime   Source File: AdvisorCourseRequestsPage.java    License: Apache License 2.0 6 votes vote down vote up
private void addCourseLine() {
	int i = iCourses.size();
	final AdvisorCourseRequestLine line = new AdvisorCourseRequestLine(iSession, i, false, null, iSpecRegCx, iStudentId);
	iCourses.add(line);
	AdvisorCourseRequestLine prev = iCourses.get(i - 1);
	prev.getCourses().get(0).setHint("");
	line.getCourses().get(0).setHint(MESSAGES.courseRequestsHint8());
	AdvisorCourseRequestLine next = (iAlternatives.isEmpty() ? null : iAlternatives.get(0));
	line.setPrevious(prev); prev.setNext(line);
	if (next != null) {
		line.setNext(next); next.setPrevious(line);
	}
	line.insert(this, insertRow(8 + iCourses.size()));
	line.addValueChangeHandler(new ValueChangeHandler<CourseRequestInterface.Request>() {
		@Override
		public void onValueChange(ValueChangeEvent<Request> event) {
			if (event.getValue() != null && iCourses.indexOf(line) + 1 == iCourses.size())
				addCourseLine();
			updateTotalCredits();
		}
	});
}
 
Example 14
Source Project: incubator-retired-wave   Source File: DebugOptions.java    License: Apache License 2.0 6 votes vote down vote up
public void refresh() {
  final EditorUpdateEventImpl updates = editor.debugGetUpdateEventImpl();
  updateEventsPanel.clear();
  updates.debugGetAllUpdateEventNames().each(new Proc() {
    @Override
    public void apply(final String element) {
      addCheckBox(updateEventsPanel, element,
          !updates.debugGetSuppressedUpdateEventNames().contains(element),
          new ValueChangeHandler<Boolean>() {
            @Override
            public void onValueChange(ValueChangeEvent<Boolean> event) {
              updates.debugSuppressUpdateEvent(element, !event.getValue());
            }
          });
    }
  });
}
 
Example 15
Source Project: unitime   Source File: Lookup.java    License: Apache License 2.0 6 votes vote down vote up
public static void peopleLookup(String query, final JavaScriptObject callback, String options) {
	final Lookup lookup = new Lookup();
	if (query != null && !query.trim().isEmpty())
		lookup.setQuery(query);
	lookup.addValueChangeHandler(new ValueChangeHandler<PersonInterface>() {
		@Override
		public void onValueChange(ValueChangeEvent<PersonInterface> event) {
			if (event.getValue() != null)
				lookup.fireCallback(callback,
					event.getValue().getId(),
					event.getValue().getFirstName(),
					event.getValue().getMiddleName(),
					event.getValue().getLastName(),
					event.getValue().getEmail(),
					event.getValue().getPhone(),
					event.getValue().getAcademicTitle(),
					event.getValue().getName());
		}
	});
	lookup.setOptions(options);
	lookup.center();
}
 
Example 16
Source Project: unitime   Source File: EventAdd.java    License: Apache License 2.0 6 votes vote down vote up
public RequestedServiceToggle(EventServiceProviderInterface provider) {
	super("toggle");
	iProvider = provider;
	iCheckbox = new CheckBox(provider.getLabel());
	add(iCheckbox);
	if (provider.hasMessage()) {
		iDescription = new P("description");
		iDescription.setHTML(provider.getMessage());
		iCheckbox.addValueChangeHandler(new ValueChangeHandler<Boolean>() {
			@Override
			public void onValueChange(ValueChangeEvent<Boolean> event) {
				iDescription.setVisible(event.getValue());
			}
		});
		iDescription.setVisible(false);
		add(iDescription);
	}
}
 
Example 17
Source Project: unitime   Source File: CourseRequestsTable.java    License: Apache License 2.0 6 votes vote down vote up
private void addCourseLine() {
	int i = iCourses.size();
	final CourseRequestLine line = new CourseRequestLine(iOnline, iSessionProvider, i, false, iCheckForDuplicities, iSectioning, iSpecReg);
	iCourses.add(line);
	CourseRequestLine prev = iCourses.get(i - 1);
	prev.getCourses().get(0).setHint("");
	line.getCourses().get(0).setHint(MESSAGES.courseRequestsHint8());
	CourseRequestLine next = (iAlternatives.isEmpty() ? null : iAlternatives.get(0));
	line.setPrevious(prev); prev.setNext(line);
	if (next != null) {
		line.setNext(next); next.setPrevious(line);
	}
	line.setArrowsVisible(iArrowsVisible);
	line.setWaitListVisible(iCanWaitList);
	insert(line, 1 + 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 && iCourses.indexOf(line) + 1 == iCourses.size())
				addCourseLine();
		}
	});
}
 
Example 18
Source Project: gwt-traction   Source File: UTCDateBoxImplHtml5.java    License: 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 19
Source Project: demo-gwt-springboot   Source File: DemoGwtWebApp.java    License: Apache License 2.0 5 votes vote down vote up
private void setupHistory() {
	History.newItem(HISTORY_MAIN);

	// Add history listener
	History.addValueChangeHandler(new ValueChangeHandler<String>() {
		@Override
		public void onValueChange(ValueChangeEvent<String> event) {
			String token = event.getValue();
			if (!token.equals(HISTORY_MAIN)) {
				History.newItem(HISTORY_MAIN);
			}
		}
	});
}
 
Example 20
Source Project: dashbuilder   Source File: NumberParameterEditorView.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public void init(final NumberParameterEditor presenter) {
    this.presenter = presenter;
    input.addValueChangeHandler(new ValueChangeHandler<String>() {
        public void onValueChange(ValueChangeEvent<String> event) {
            form.setValidationState(ValidationState.NONE);
            presenter.valueChanged();
        }
    });
}
 
Example 21
Source Project: gwt-material   Source File: BaseCheckBox.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public HandlerRegistration addValueChangeHandler(
        final ValueChangeHandler<Boolean> handler) {
    // Is this the first value change handler? If so, time to add handlers
    if (!valueChangeHandlerInitialized) {
        ensureDomEventHandlers();
        valueChangeHandlerInitialized = true;
    }
    return addHandler(handler, ValueChangeEvent.getType());
}
 
Example 22
Source Project: gwt-material   Source File: MaterialValueBox.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public HandlerRegistration addValueChangeHandler(final ValueChangeHandler<T> handler) {
    return valueBoxBase.addValueChangeHandler(event -> {
        if (isEnabled()) {
            handler.onValueChange(event);
        }
    });
}
 
Example 23
@Override
public void addRefreshEnabledButtonHandler(final Command handler) {
    
    if (handlerRegistration != null) {
        handlerRegistration.removeHandler();
    }
    
    handlerRegistration = refreshEnabled.addValueChangeHandler(new ValueChangeHandler<Boolean>() {
        @Override
        public void onValueChange(final ValueChangeEvent<Boolean> event) {
            handler.execute();;
        }
    });
    
}
 
Example 24
Source Project: geowe-core   Source File: BasicToolBarTool.java    License: GNU General Public License v3.0 5 votes vote down vote up
@Override
protected ValueChangeHandler<Boolean> getSelectChangeHandler() {
	return new ValueChangeHandler<Boolean>() {
		@Override
		public void onValueChange(ValueChangeEvent<Boolean> event) {
			basicToolBar.asWidget().getElement().<FxElement> cast()
			.fadeToggle();
		}
	};
}
 
Example 25
Source Project: geowe-core   Source File: DeleteTool.java    License: 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 26
Source Project: geowe-core   Source File: MapToolTipTool.java    License: GNU General Public License v3.0 5 votes vote down vote up
@Override
protected ValueChangeHandler<Boolean> getSelectChangeHandler() {
	return new ValueChangeHandler<Boolean>() {
		@Override
		public void onValueChange(ValueChangeEvent<Boolean> event) {
			featureToolTipShowListener
					.setEnableMapToolTip(event.getValue());
			selectionTool.setValue(event.getValue(), true);
		}
	};
}
 
Example 27
@Override
protected ValueChangeHandler<Boolean> getSelectChangeHandler() {
	return new ValueChangeHandler<Boolean>() {
		@Override
		public void onValueChange(final ValueChangeEvent<Boolean> event) {

			if (event.getValue()) {
				confirmSetMaxExtent(event.getValue());
			} else {
				confirmClearMaxExtent(event.getValue());
			}
		}
	};
}
 
Example 28
@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 29
Source Project: geowe-core   Source File: ColorPicker.java    License: GNU General Public License v3.0 5 votes vote down vote up
private void initListener() {
	this.addValueChangeHandler(new ValueChangeHandler<String>() {
		@Override
		public void onValueChange(ValueChangeEvent<String> event) {
			for(SelectedColorChangedListener listener : listeners) {
				listener.onSelectedColorChanged("#" + getValue());
			}
		}
	});
}
 
Example 30
public void initializeTMSFields() {
	urlTMSField.setEmptyText("http://...");
	nameTMSField.setEmptyText(UIMessages.INSTANCE
			.lrasterdLayerNameField(" "));
	formatTMSField.setEmptyText("png, jpg...");

	urlTMSField.addValueChangeHandler(new ValueChangeHandler<String>() {
		@Override
		public void onValueChange(ValueChangeEvent<String> event) {
			if (!event.getValue().startsWith("http")) {
				showAlert("URL");
			}
		}
	});
}