Java Code Examples for com.google.gwt.user.client.ui.Hidden

The following examples show how to use com.google.gwt.user.client.ui.Hidden. 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: unitime   Source File: CourseNumbersSuggestBox.java    License: Apache License 2.0 6 votes vote down vote up
private String getConfiguration() {
	String conf = iConfiguration;
	for (MatchResult matcher = iRegExp.exec(conf); matcher != null; matcher = iRegExp.exec(conf)) {
		Element element = DOM.getElementById(matcher.getGroup(1));
		String value = "";
		if ("select".equalsIgnoreCase(element.getTagName())) {
			ListBox list = ListBox.wrap(element);
			for (int i = 0; i < list.getItemCount(); i++) {
				if (list.isItemSelected(i))
					value += (value.isEmpty() ? "" : ",") + list.getValue(i);
			}
		} else if ("input".equalsIgnoreCase(element.getTagName())) {
			TextBox text = TextBox.wrap(element);
			value = text.getText();
		} else {
			Hidden hidden = Hidden.wrap(element);
			value = hidden.getValue();
		}
		conf = conf.replace("${" + matcher.getGroup(1) + "}", value);
	}
	return conf;
}
 
Example 2
Source Project: unitime   Source File: InstructorAvailabilityWidget.java    License: Apache License 2.0 5 votes vote down vote up
public void insert(final RootPanel panel) {
	RPC.execute(InstructorAvailabilityRequest.load(null), new AsyncCallback<InstructorAvailabilityModel>() {
		@Override
		public void onFailure(Throwable caught) {
			UniTimeNotifications.error(caught);
		}

		@Override
		public void onSuccess(final InstructorAvailabilityModel model) {
			if (panel.getElement().getFirstChildElement() != null) {
				iPattern = Hidden.wrap(panel.getElement().getFirstChildElement());
				model.setPattern(iPattern.getValue());
			
				addValueChangeHandler(new ValueChangeHandler<RoomInterface.RoomSharingModel>() {
					@Override
					public void onValueChange(ValueChangeEvent<RoomSharingModel> event) {
						iPattern.setValue(event.getValue().toString());
					}
				});
				iEditable = true;
			} else {
				String pattern = panel.getElement().getInnerText().trim();
				panel.getElement().setInnerText(null);
				model.setPattern(pattern);
				iEditable = false;
			}
			
			setModel(model);

			panel.add(InstructorAvailabilityWidget.this);
			panel.setVisible(true);				
		}
	});
}