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

The following are top voted examples for showing how to use com.google.gwt.event.logical.shared.ValueChangeHandler. These examples are extracted from open source projects. You can vote up the examples you like and your votes will be used in our system to generate more good examples.
Example 1
Project: che   File: MoveViewImpl.java   View source code 8 votes vote down vote up
@Inject
public MoveViewImpl(
    JavaLocalizationConstant locale,
    CellTreeResources cellTreeResources,
    JavaResources resources) {
  this.locale = locale;
  this.cellTreeResources = cellTreeResources;
  this.resources = resources;

  setTitle(locale.moveDialogTitle());

  setWidget(UI_BINDER.createAndBindUi(this));

  createButtons(locale);

  updateFullNames.addValueChangeHandler(
      new ValueChangeHandler<Boolean>() {
        @Override
        public void onValueChange(ValueChangeEvent<Boolean> event) {
          patternField.setEnabled(event.getValue());
        }
      });
}
 
Example 2
Project: unitimes   File: TeachingAssignmentsWidget.java   View source code 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 3
Project: unitimes   File: InstructorAttributeEdit.java   View source code 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 4
Project: unitimes   File: MultiSelect.java   View source code 6 votes vote down vote up
Item(T id, String name, boolean asHTML) {
	super(name, asHTML);
	iId = id;
	addStyleName("item");
	addValueChangeHandler(new ValueChangeHandler<Boolean>() {
		@Override
		public void onValueChange(ValueChangeEvent<Boolean> event) {
			ValueChangeEvent.fire(MultiSelect.this, MultiSelect.this.getValue());
		}
	});
}
 
Example 5
Project: unitimes   File: RoomGroupEdit.java   View source code 6 votes vote down vote up
public void setRooms(List<Entity> rooms) {
	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 = room.hasGroup(iGroup.getId());
		iRooms.selectRoom(row, selected);
		iRooms.setSelected(row, selected);
		iRooms.getRoomSelection(row).addValueChangeHandler(clearErrorMessage);
	}
	int sort = RoomCookie.getInstance().getRoomsSortBy();
	if (sort != 0)
		iRooms.setSortBy(sort);
}
 
Example 6
Project: unitimes   File: RoomFeatureEdit.java   View source code 6 votes vote down vote up
public void setRooms(List<Entity> rooms) {
	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 = room.hasFeature(iFeature.getId());
		iRooms.selectRoom(row, selected);
		iRooms.setSelected(row, selected);
		iRooms.getRoomSelection(row).addValueChangeHandler(clearErrorMessage);
	}
	int sort = RoomCookie.getInstance().getRoomsSortBy();
	if (sort != 0)
		iRooms.setSortBy(sort);
}
 
Example 7
Project: unitimes   File: RoomDepartmentsEdit.java   View source code 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 8
Project: unitimes   File: PeriodPreferencesWidget.java   View source code 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 9
Project: unitimes   File: PageFilter.java   View source code 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 10
Project: unitimes   File: CourseNumbersSuggestBox.java   View source code 6 votes vote down vote up
public static AriaSuggestBox insert(RootPanel panel) {
	String config = panel.getElement().getAttribute("configuration");
	final String onchange = panel.getElement().getAttribute("onchange");
	AriaTextBox text = new AriaTextBox(panel.getElement().getFirstChildElement());
	text.getElement().setAttribute("autocomplete", "off");
	AriaSuggestBox box = new AriaSuggestBox(text, new CourseNumbersSuggestBox(config));
	if (onchange != null)
		box.addValueChangeHandler(new ValueChangeHandler<String>() {
			@Override
			public void onValueChange(ValueChangeEvent<String> event) {
				ToolBox.eval(onchange);
			}
		});
	panel.add(box);
	return box;
}
 
Example 11
Project: unitimes   File: Lookup.java   View source code 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 12
Project: unitimes   File: CourseRequestsTable.java   View source code 6 votes vote down vote up
private void addCourseLine() {
	int i = iCourses.size();
	final CourseRequestLine line = new CourseRequestLine(iSessionProvider, i, false, iCheckForDuplicities);
	iCourses.add(line);
	CourseRequestLine prev = iCourses.get(i - 1);
	prev.getCourses().get(0).setHint("");
	line.getCourses().get(0).setHint(MESSAGES.courseRequestsHint8());
	CourseRequestLine next = iAlternatives.get(0);
	line.setPrevious(prev); prev.setNext(line);
	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 (event.getValue() != null && iCourses.indexOf(line) + 1 == iCourses.size())
				addCourseLine();
		}
	});
}
 
Example 13
Project: unitimes   File: CourseRequestsTable.java   View source code 6 votes vote down vote up
private void addAlternativeLine() {
	int i = iAlternatives.size();
	final CourseRequestLine line = new CourseRequestLine(iSessionProvider, i, true, iCheckForDuplicities);
	iAlternatives.add(line);
	CourseRequestLine prev = iAlternatives.get(i - 1);
	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 (event.getValue() != null && iAlternatives.indexOf(line) + 1 == iAlternatives.size())
				addAlternativeLine();
		}
	});
}
 
Example 14
Project: sig-seguimiento-vehiculos   File: W3wTool.java   View source code 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 15
Project: sig-seguimiento-vehiculos   File: LoadRasterLayerDialog.java   View source code 6 votes vote down vote up
public void initializeWMTSFields() {
	urlWMTSField.setEmptyText("http://...");
	nameWMTSField.setEmptyText(UIMessages.INSTANCE
			.lrasterdLayerNameField("WMTS"));
	formatWMTSField.setEmptyText("image/png, image/jpg...");
	tileMatrixSetField.setEmptyText("matrix set identifier");

	urlWMTSField.addValueChangeHandler(new ValueChangeHandler<String>() {
		@Override
		public void onValueChange(ValueChangeEvent<String> event) {
			if (!event.getValue().startsWith("http")) {
				showAlert("URL");
			}
		}
	});
}
 
Example 16
Project: sig-seguimiento-vehiculos   File: LayerManagerWidget.java   View source code 6 votes vote down vote up
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 17
Project: appinventor-extensions   File: GalleryPage.java   View source code 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 18
Project: appinventor-extensions   File: GalleryPage.java   View source code 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 19
Project: LAS   File: LASAnnotationsButtonPanelImpl.java   View source code 6 votes vote down vote up
public LASAnnotationsButtonPanelImpl(String outputPanelID) {
    setName(outputPanelID);
    String moduleBaseURL = GWT.getModuleBaseURL();
    String upImageURL = moduleBaseURL + "../images/i_off.png";
    Image upImage = new Image(upImageURL);
    String downImageURL = moduleBaseURL + "../images/i_on.png";
    Image downImage = new Image(downImageURL);
    button = new ToggleButton(
            upImage,
            downImage);
    button.setTitle("Plot Annotations");
    button.setStylePrimaryName("OL_MAP-ToggleButton");
    button.addStyleDependentName("WIDTH");

    button.addValueChangeHandler(new ValueChangeHandler<Boolean>() {
        public void onValueChange(ValueChangeEvent<Boolean> event) {
            annotations.setVisible(button.isDown());
        }
    });

    initWidget(button);
}
 
Example 20
Project: Wiab.pro   File: HistoryChangeListener.java   View source code 6 votes vote down vote up
/**
 * Commonly we start to listen history changes when webclient starts calling this
 * method. If you are using wave client integrated with other different GWT application
 * and with a different History management, you can avoid to use this and just
 * call to the {@link WaveSelectionEvent} events (for example) or other uses.
 */
public static void init() {
  History.addValueChangeHandler(
      new ValueChangeHandler<String>() {
        
        @Override
        public void onValueChange(ValueChangeEvent<String> event) {
          String encodedToken = event.getValue();
          if (encodedToken == null || encodedToken.length() == 0) {
            return;
          }
          WaveRef waveRef;
          try {
            waveRef = GwtWaverefEncoder.decodeWaveRefFromPath(encodedToken);
          } catch (InvalidWaveRefException e) {
            LOG.error().log("History token contains invalid path: " + encodedToken);
            return;
          }
          LOG.trace().log("Changing selected wave based on history event to " + waveRef.toString());
          ClientEvents.get().fireEvent(
              new WaveSelectionEvent(waveRef, false, false));
        }
      });
}
 
Example 21
Project: Wiab.pro   File: DebugOptions.java   View source code 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 22
Project: ephesoft   File: KV_PP_EditView.java   View source code 6 votes vote down vote up
/**
 * To add Text Box.
 * 
 * @param row int
 * @param value String
 * @param dataType DataType
 * @param readOnly boolean
 * @return ValidatableWidget<TextBox>
 */
public ValidatableWidget<TextBox> addTextBox(int row, String value, DataType dataType, boolean readOnly) {
	TextBox fieldValue = new TextBox();
	fieldValue.setReadOnly(readOnly);
	fieldValue.setText(value);
	final ValidatableWidget<TextBox> validatableTextBox = new ValidatableWidget<TextBox>(fieldValue);
	if (!readOnly) {
		validatableTextBox.addValidator((Validator) ValidatorFactory.getValidator(dataType, fieldValue));
		validatableTextBox.getWidget().addValueChangeHandler(new ValueChangeHandler<String>() {

			@Override
			public void onValueChange(ValueChangeEvent<String> event) {
				validatableTextBox.toggleValidDateBox();
			}
		});
		validatableTextBox.toggleValidDateBox();
	}

	return validatableTextBox;
}
 
Example 23
Project: unitime   File: PageFilter.java   View source code 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 24
Project: ephesoft   File: AdvancedKVExtractionView.java   View source code 6 votes vote down vote up
private void setKeyPatternPanelView() {
	keyPatternText = new TextBox();
	keyPatternText.addStyleName(AdminConstants.GWT_ADVANCED_KV_TEXT_BOX);
	keyPatternField = new ListBox();
	keyPatternField.setWidth("98%");
	keyPatternPanel.add(keyPatternText);
	useExistingKey.setValue(Boolean.FALSE);
	useExistingKey.addValueChangeHandler(new ValueChangeHandler<Boolean>() {

		@Override
		public void onValueChange(ValueChangeEvent<Boolean> arg0) {
			if (arg0.getValue().equals(Boolean.TRUE)) {
				keyPatternValidateButton.setEnabled(Boolean.FALSE);
				keyPatternPanel.remove(keyPatternText);
				keyPatternPanel.add(keyPatternField);
			} else {
				keyPatternValidateButton.setEnabled(Boolean.TRUE);
				keyPatternPanel.remove(keyPatternField);
				keyPatternPanel.add(keyPatternText);
			}
		}
	});
}
 
Example 25
Project: google-apis-explorer   File: FieldsEditor.java   View source code 6 votes vote down vote up
public FieldsEditor(ApiService service, String key) {
  super("");

  this.service = service;
  this.key = key;
  root = new CheckBox(key.isEmpty() ? "Select all/none" : key);
  root.setValue(false);
  root.addValueChangeHandler(new ValueChangeHandler<Boolean>() {
    @Override
    public void onValueChange(ValueChangeEvent<Boolean> event) {
      for (HasValue<Boolean> checkBox : children.values()) {
        checkBox.setValue(event.getValue(), true);
      }
    }
  });
  add(root);
}
 
Example 26
Project: sandbox-frame   File: FilterPanel.java   View source code 6 votes vote down vote up
public FilterPanel(String title) {
    super();
    addStyleName(Utils.sandboxStyle.navPrimary());

    UnorderedList headerUl = new UnorderedList();
    headerUl.addStyleName(Utils.sandboxStyle.nav());
    add(headerUl);
    
    headerItem = new FilterItem<T>(null, Utils.resources.collapse(), null, title);
    headerItem.addStyleName(Utils.sandboxStyle.primary());
    headerItem.setValue(false);
    headerUl.add(headerItem);
    headerItem.addValueChangeHandler(new ValueChangeHandler<Boolean>() {
        @Override
        public void onValueChange(ValueChangeEvent<Boolean> event) {
            sendAnalytic();
            setExpanded(event.getValue());
        }
    });
    itemsUl = new UnorderedList();
    itemsUl.addStyleName(Utils.sandboxStyle.nav());
    headerItem.add(itemsUl);
}
 
Example 27
Project: unitime   File: PeriodPreferencesWidget.java   View source code 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 28
Project: unitime   File: Lookup.java   View source code 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 29
Project: fullmetalgalaxy   File: WgtEditInitialHolds.java   View source code 6 votes vote down vote up
private WgtTokenQty createWgt(final TokenType p_tokenType)
{
  WgtTokenQty wgt = new WgtTokenQty( p_tokenType, GameEngine.model().getGame()
      .getInitialHolds().get( p_tokenType ) );

  wgt.setEnabled( true );
  wgt.addValueChangeHandler( new ValueChangeHandler<Integer>()
  {
    @Override
    public void onValueChange(ValueChangeEvent<Integer> p_event)
    {
      GameEngine.model().getGame().setInitialHoldsQty( p_tokenType, p_event.getValue() );
    }
  } );
  return wgt;
}
 
Example 30
Project: unitime   File: InstructorAttributeEdit.java   View source code 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 31
Project: listmaker   File: EnumListBox.java   View source code 6 votes vote down vote up
@Override
public HandlerRegistration addValueChangeHandler(ValueChangeHandler<T> handler)
{
	// Initialization code
	if (!valueChangeHandlerInitialized)
	{
		valueChangeHandlerInitialized = true;
		super.addChangeHandler(new ChangeHandler()
		{
			public void onChange(ChangeEvent event)
			{
				ValueChangeEvent.fire(EnumListBox.this, getValue());
			}
		});
	}
	return addHandler(handler, ValueChangeEvent.getType());
}
 
Example 32
Project: listmaker   File: SelectOneListBox.java   View source code 6 votes vote down vote up
@Override
public HandlerRegistration addValueChangeHandler(ValueChangeHandler<T> handler)
{
	// Initialization code
	if (!valueChangeHandlerInitialized)
	{
		valueChangeHandlerInitialized = true;
		super.addChangeHandler(new ChangeHandler()
		{
			public void onChange(ChangeEvent event)
			{
				ValueChangeEvent.fire(SelectOneListBox.this, getValue());
			}
		});
	}
	return addHandler(handler, ValueChangeEvent.getType());
}
 
Example 33
Project: unitime   File: EventAdd.java   View source code 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 34
Project: geowe-core   File: W3wTool.java   View source code 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 35
Project: unitime   File: RoomGroupEdit.java   View source code 6 votes vote down vote up
public void setRooms(List<Entity> rooms) {
	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 = room.hasGroup(iGroup.getId());
		iRooms.selectRoom(row, selected);
		iRooms.setSelected(row, selected);
		iRooms.getRoomSelection(row).addValueChangeHandler(clearErrorMessage);
	}
	int sort = RoomCookie.getInstance().getRoomsSortBy();
	if (sort != 0)
		iRooms.setSortBy(sort);
}
 
Example 36
Project: geowe-core   File: LoadRasterLayerDialog.java   View source code 6 votes vote down vote up
public void initializeWMTSFields() {
	urlWMTSField.setEmptyText("http://...");
	nameWMTSField.setEmptyText(UIMessages.INSTANCE
			.lrasterdLayerNameField("WMTS"));
	formatWMTSField.setEmptyText("image/png, image/jpg...");
	tileMatrixSetField.setEmptyText("matrix set identifier");

	urlWMTSField.addValueChangeHandler(new ValueChangeHandler<String>() {
		@Override
		public void onValueChange(ValueChangeEvent<String> event) {
			if (!event.getValue().startsWith("http")) {
				showAlert("URL");
			}
		}
	});
}
 
Example 37
Project: appformer   File: BooleanField.java   View source code 6 votes vote down vote up
@Override
public Widget widget(final PropertyEditorFieldInfo property) {
    final PropertyEditorCheckBox checkBox = GWT.create(PropertyEditorCheckBox.class);
    checkBox.setValue(Boolean.parseBoolean(property.getCurrentStringValue()));
    checkBox.addValueChangeHandler(new ValueChangeHandler<Boolean>() {
        @Override
        public void onValueChange(ValueChangeEvent<Boolean> event) {

            if (validate(property,
                         checkBox.getValue().toString())) {
                checkBox.clearOldValidationErrors();
                property.setCurrentStringValue(checkBox.getValue().toString());
                propertyEditorChangeEventEvent.fire(new PropertyEditorChangeEvent(property,
                                                                                  checkBox.getValue().toString()));
            } else {
                checkBox.setValidationError(getValidatorErrorMessage(property,
                                                                     checkBox.getValue().toString()));
                checkBox.setValue(Boolean.valueOf(property.getCurrentStringValue()));
            }
        }
    });

    return checkBox;
}
 
Example 38
Project: unitime   File: RoomDepartmentsEdit.java   View source code 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 39
Project: firefly   File: SpacialSelectUI.java   View source code 6 votes vote down vote up
private void reinitSingleSearchMethod(Set <SpacialType> spacialTypes) {
    singleSearchMethodWrapper.clear();
    String prevValue= singleSearchMethod!=null ? singleSearchMethod.getValue() : null;
    EnumFieldDef fd= (EnumFieldDef)FieldDefCreator.makeFieldDef(_prop.makeBase("singleTargetMethod"));
    if (!spacialTypes.contains(Cone)) {
        fd.removeItem(CONE_KEY);
        if (CONE_KEY.equals(prevValue)) prevValue= null;
    }
    if (!spacialTypes.contains(Box)) {
        fd.removeItem(BOX_KEY);
        if (BOX_KEY.equals(prevValue)) prevValue= null;
    }
    if (!spacialTypes.contains(Elliptical)) {
        fd.removeItem(ELLIPTICAL_KEY);
        if (ELLIPTICAL_KEY.equals(prevValue)) prevValue= null;
    }

    singleSearchMethod = SimpleInputField.createByDef(fd, new SimpleInputField.Config("1px"), false);
    singleSearchMethod.getField().addValueChangeHandler(new ValueChangeHandler<String>() {
        public void onValueChange(ValueChangeEvent ev) {
            updateSingleTargetDisplay();
        }
    });
    singleSearchMethodWrapper.setWidget(singleSearchMethod);
    if (prevValue!=null) singleSearchMethod.setValue(prevValue);
}
 
Example 40
Project: appformer   File: ColorField.java   View source code 6 votes vote down vote up
@Override
public Widget widget(final PropertyEditorFieldInfo property) {
    final PropertyEditorColorPicker colorPicker = GWT.create(PropertyEditorColorPicker.class);
    colorPicker.setValue(property.getCurrentStringValue());
    colorPicker.addChangeHandler(
            new ValueChangeHandler<String>() {
                public void onValueChange(ValueChangeEvent event) {
                    String color = colorPicker.getValue();
                    if (validate(property,
                                 color)) {
                        colorPicker.clearOldValidationErrors();
                        property.setCurrentStringValue(color);
                        propertyEditorChangeEvent.fire(new PropertyEditorChangeEvent(property,
                                                                                     color));
                    } else {
                        colorPicker.setValidationError(getValidatorErrorMessage(property,
                                                                                color));
                        colorPicker.setValue(property.getCurrentStringValue());
                    }
                }
            });
    return colorPicker;
}