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   Source Code and License 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   Source Code and License 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   Source Code and License 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   Source Code and License 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   Source Code and License 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   Source Code and License 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   Source Code and License 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   Source Code and License 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   Source Code and License 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   Source Code and License 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   Source Code and License 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   Source Code and License 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   Source Code and License 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   Source Code and License 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   Source Code and License 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   Source Code and License 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   Source Code and License 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   Source Code and License 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   Source Code and License 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   Source Code and License 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   Source Code and License 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   Source Code and License 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   Source Code and License 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   Source Code and License 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   Source Code and License 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   Source Code and License 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   Source Code and License 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   Source Code and License 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   Source Code and License 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   Source Code and License 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   Source Code and License 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   Source Code and License 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   Source Code and License 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   Source Code and License 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   Source Code and License 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   Source Code and License 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   Source Code and License 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   Source Code and License 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   Source Code and License 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   Source Code and License 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;
}
 
Example 41
Project: gerrit   File: ReplyBox.java   Source Code and License 6 votes vote down vote up
private void renderCheckBox(int row, LabelAndValues lv) {
  ApprovalInfo self =
      Gerrit.isSignedIn() ? lv.info.forUser(Gerrit.getUserAccount().getId().get()) : null;

  final String id = lv.info.name();
  final CheckBox b = new CheckBox();
  b.setText(id);
  b.setEnabled(lv.permitted.contains((short) 1));
  if (self != null && self.value() == 1) {
    b.setValue(true);
  }
  b.addValueChangeHandler(
      new ValueChangeHandler<Boolean>() {
        @Override
        public void onValueChange(ValueChangeEvent<Boolean> event) {
          in.label(id, event.getValue() ? (short) 1 : (short) 0);
        }
      });
  b.setStyleName(style.label_name());
  labelsTable.setWidget(row, 0, b);

  CellFormatter fmt = labelsTable.getCellFormatter();
  fmt.setStyleName(row, labelHelpColumn, style.label_help());
  labelsTable.setText(row, labelHelpColumn, lv.info.valueText("+1"));
}
 
Example 42
Project: gerrit   File: ProjectBranchesScreen.java   Source Code and License 6 votes vote down vote up
BranchesTable() {
  table.setWidth("");
  table.setText(0, 2, AdminConstants.I.columnBranchName());
  table.setText(0, 3, AdminConstants.I.columnBranchRevision());

  final FlexCellFormatter fmt = table.getFlexCellFormatter();
  fmt.addStyleName(0, 1, Gerrit.RESOURCES.css().iconHeader());
  fmt.addStyleName(0, 2, Gerrit.RESOURCES.css().dataHeader());
  fmt.addStyleName(0, 3, Gerrit.RESOURCES.css().dataHeader());
  fmt.addStyleName(0, 4, Gerrit.RESOURCES.css().dataHeader());

  updateDeleteHandler =
      new ValueChangeHandler<Boolean>() {
        @Override
        public void onValueChange(ValueChangeEvent<Boolean> event) {
          updateDeleteButton();
        }
      };
}
 
Example 43
Project: gerrit   File: AccessSectionEditor.java   Source Code and License 6 votes vote down vote up
public AccessSectionEditor(ProjectAccess access) {
  projectAccess = access;
  permissionSelector = new ValueListBox<>(new PermissionNameRenderer(access.getCapabilities()));
  permissionSelector.addValueChangeHandler(
      new ValueChangeHandler<String>() {
        @Override
        public void onValueChange(ValueChangeEvent<String> event) {
          if (!AdminConstants.I.addPermission().equals(event.getValue())) {
            onAddPermission(event.getValue());
          }
        }
      });

  initWidget(uiBinder.createAndBindUi(this));
  permissions = ListEditor.of(new PermissionEditorSource());
}
 
Example 44
Project: gerrit   File: ProjectTagsScreen.java   Source Code and License 6 votes vote down vote up
TagsTable() {
  table.setWidth("");
  table.setText(0, 2, AdminConstants.I.columnTagName());
  table.setText(0, 3, AdminConstants.I.columnTagRevision());

  FlexCellFormatter fmt = table.getFlexCellFormatter();
  fmt.addStyleName(0, 1, Gerrit.RESOURCES.css().iconHeader());
  fmt.addStyleName(0, 2, Gerrit.RESOURCES.css().dataHeader());
  fmt.addStyleName(0, 3, Gerrit.RESOURCES.css().dataHeader());
  fmt.addStyleName(0, 4, Gerrit.RESOURCES.css().dataHeader());

  updateDeleteHandler =
      new ValueChangeHandler<Boolean>() {
        @Override
        public void onValueChange(ValueChangeEvent<Boolean> event) {
          updateDeleteButton();
        }
      };
}
 
Example 45
Project: gerrit   File: MyIdentitiesScreen.java   Source Code and License 6 votes vote down vote up
IdTable() {
  table.setWidth("");
  table.setText(0, 2, Util.C.webIdStatus());
  table.setText(0, 3, Util.C.webIdEmail());
  table.setText(0, 4, Util.C.webIdIdentity());

  final FlexCellFormatter fmt = table.getFlexCellFormatter();
  fmt.addStyleName(0, 1, Gerrit.RESOURCES.css().iconHeader());
  fmt.addStyleName(0, 2, Gerrit.RESOURCES.css().dataHeader());
  fmt.addStyleName(0, 3, Gerrit.RESOURCES.css().dataHeader());
  fmt.addStyleName(0, 4, Gerrit.RESOURCES.css().dataHeader());

  updateDeleteHandler =
      new ValueChangeHandler<Boolean>() {
        @Override
        public void onValueChange(ValueChangeEvent<Boolean> event) {
          updateDeleteButton();
        }
      };
}
 
Example 46
Project: gerrit   File: SshPanel.java   Source Code and License 6 votes vote down vote up
SshKeyTable() {
  table.setWidth("");
  table.setText(0, 2, Util.C.sshKeyStatus());
  table.setText(0, 3, Util.C.sshKeyAlgorithm());
  table.setText(0, 4, Util.C.sshKeyKey());
  table.setText(0, 5, Util.C.sshKeyComment());

  final FlexCellFormatter fmt = table.getFlexCellFormatter();
  fmt.addStyleName(0, 1, Gerrit.RESOURCES.css().iconHeader());
  fmt.addStyleName(0, 2, Gerrit.RESOURCES.css().dataHeader());
  fmt.addStyleName(0, 3, Gerrit.RESOURCES.css().dataHeader());
  fmt.addStyleName(0, 4, Gerrit.RESOURCES.css().dataHeader());
  fmt.addStyleName(0, 5, Gerrit.RESOURCES.css().dataHeader());

  updateDeleteHandler =
      new ValueChangeHandler<Boolean>() {
        @Override
        public void onValueChange(ValueChangeEvent<Boolean> event) {
          updateDeleteButton();
        }
      };
}
 
Example 47
Project: empiria.player   File: AccessibleCheckBox.java   Source Code and License 5 votes vote down vote up
@Override
public HandlerRegistration addValueChangeHandler(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 48
Project: unitimes   File: InstructorAvailabilityWidget.java   Source Code and License 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);				
		}
	});
}
 
Example 49
Project: unitimes   File: WebTable.java   Source Code and License 5 votes vote down vote up
public CheckboxCell(boolean check, String ariaLabel, final String onTitle, final String offTitle) {
	this(check, null, ariaLabel);
	iCheck.setTitle(iCheck.getValue() ? onTitle : offTitle);
	iCheck.addValueChangeHandler(new ValueChangeHandler<Boolean>() {
		@Override
		public void onValueChange(ValueChangeEvent<Boolean> event) {
			iCheck.setTitle(event.getValue() ? onTitle : offTitle);
		}
	});
}
 
Example 50
Project: unitimes   File: WebTable.java   Source Code and License 5 votes vote down vote up
public LockCell(boolean check, String ariaLabel, final String onTitle, final String offTitle) {
	this(check, null, ariaLabel);
	getWidget().setTitle(iCheck.getValue() ? onTitle : offTitle);
	iCheck.addValueChangeHandler(new ValueChangeHandler<Boolean>() {
		@Override
		public void onValueChange(ValueChangeEvent<Boolean> event) {
			getWidget().setTitle(event.getValue() ? onTitle : offTitle);
		}
	});
}
 
Example 51
Project: unitimes   File: SingleDateSelector.java   Source Code and License 5 votes vote down vote up
@Override
public HandlerRegistration addValueChangeHandler(ValueChangeHandler<Date> handler) {
	return addHandler(handler, ValueChangeEvent.getType());
}
 
Example 52
Project: unitimes   File: SingleDateSelector.java   Source Code and License 5 votes vote down vote up
public static SingleDateSelector insert(RootPanel panel) {
	String format = panel.getElement().getAttribute("format");
	final String onchange = panel.getElement().getAttribute("onchange");
	String error = panel.getElement().getAttribute("error");
	AriaTextBox text = new AriaTextBox(panel.getElement().getFirstChildElement());
	SingleDateSelector selector = new SingleDateSelector(text, null, false);
	if (format != null)
		selector.iFormat = DateTimeFormat.getFormat(format);
	if (onchange != null)
		selector.addValueChangeHandler(new ValueChangeHandler<Date>() {
			@Override
			public void onValueChange(ValueChangeEvent<Date> event) {
				ToolBox.eval(onchange);
			}
		});
	if (text.getText() != null && !text.getText().isEmpty()) {
		Date date = null;
		try {
			date = selector.iFormat.parse(text.getText());
		} catch (IllegalArgumentException e) {}
		if (date != null)
			selector.setValue(date);
	}
	if (error != null && !error.isEmpty())
		selector.setErrorHint(error);
	panel.add(selector);
	return selector;
}
 
Example 53
Project: unitimes   File: StartEndTimeSelector.java   Source Code and License 5 votes vote down vote up
@Override
public HandlerRegistration addValueChangeHandler(ValueChangeHandler<StartEndTime> handler) {
	return addHandler(handler, ValueChangeEvent.getType());
}
 
Example 54
Project: unitimes   File: UniTimeBack.java   Source Code and License 5 votes vote down vote up
public UniTimeBack() {
	History.addValueChangeHandler(new ValueChangeHandler<String>() {
		@Override
		public void onValueChange(ValueChangeEvent<String> event) {
			if (event.getValue() == null || event.getValue().isEmpty() || "back".equals(event.getValue())) {
				open(GWT.getHostPageBaseURL() + "back.do?uri=" + iBackUrl);
			} else {
				String uri = token2uri(event.getValue().replace("%20", " "));
				if (uri != null)
					open(GWT.getHostPageBaseURL() + "back.do?uri=" + uri);
			}
		}
	});
}
 
Example 55
Project: sig-seguimiento-vehiculos   File: BasicToolBarTool.java   Source Code and License 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 56
Project: sig-seguimiento-vehiculos   File: DeleteTool.java   Source Code and License 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 57
Project: sig-seguimiento-vehiculos   File: MapToolTipTool.java   Source Code and License 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 58
Project: sig-seguimiento-vehiculos   File: ToggleTool.java   Source Code and License 5 votes vote down vote up
protected ValueChangeHandler<Boolean> getSelectChangeHandler() {
	return new ValueChangeHandler<Boolean>() {
		@Override
		public void onValueChange(final ValueChangeEvent<Boolean> event) {

			if (event.getValue()) {
				activeControls(controls);
			} else {
				deactiveControls(controls);
			}
		}
	};
}
 
Example 59
Project: sig-seguimiento-vehiculos   File: LockCurrentExtentTool.java   Source Code and License 5 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()) {
				confirmSetMaxExtent(event.getValue());
			} else {
				confirmClearMaxExtent(event.getValue());
			}
		}
	};
}
 
Example 60
Project: sig-seguimiento-vehiculos   File: ColorPicker.java   Source Code and License 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());
			}
		}
	});
}