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

The following examples show how to use com.google.gwt.event.logical.shared.ValueChangeHandler. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: CourseRequestsTable.java    From unitime with 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 #2
Source File: SubsetJSONPropertyEditor.java    From appinventor-extensions with Apache License 2.0 6 votes vote down vote up
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 File: W3wTool.java    From geowe-core with 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
Source File: LoadRasterLayerDialog.java    From geowe-core with GNU General Public License v3.0 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");
	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
Source File: LayerManagerWidget.java    From geowe-core with GNU General Public License v3.0 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 #6
Source File: TeachingAssignmentsWidget.java    From unitime with 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 File: InstructorAttributeEdit.java    From unitime with 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
Source File: GwtDebugPanelFilters.java    From core with GNU Lesser General Public License v2.1 6 votes vote down vote up
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 File: RoomDepartmentsEdit.java    From unitime with 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 File: PageFilter.java    From unitime with 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 #11
Source File: ConflictsWidget.java    From unitime with 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 #12
Source File: AdvisorCourseRequestsPage.java    From unitime with 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 #13
Source File: DebugOptions.java    From incubator-retired-wave with 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 #14
Source File: Lookup.java    From unitime with 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 #15
Source File: EventAdd.java    From unitime with 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 #16
Source File: PeriodPreferencesWidget.java    From unitime with 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 #17
Source File: GalleryPage.java    From appinventor-extensions with 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 #18
Source File: EditorHarness.java    From swellrt with Apache License 2.0 5 votes vote down vote up
private CheckBox createEditToggleCheckBox(final Editor editor) {
  CheckBox check = new CheckBox("Toggle edit");
  check.addValueChangeHandler(new ValueChangeHandler<Boolean>() {
    @Override
    public void onValueChange(ValueChangeEvent<Boolean> event) {
      setEditing(editor, event.getValue());
    }
  });
  return check;
}
 
Example #19
Source File: ComboPicker.java    From core with GNU Lesser General Public License v2.1 5 votes vote down vote up
@Override
public HandlerRegistration addValueChangeHandler(final ValueChangeHandler<String> handler) {

    changeHandlers.add(handler);

    return new HandlerRegistration() {
        @Override
        public void removeHandler() {
            changeHandlers.remove(handler);
        }
    };
}
 
Example #20
Source File: SingleDateSelector.java    From unitime with Apache License 2.0 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");
	String disabled = panel.getElement().getAttribute("disabled");
	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);
	if (disabled != null && "true".equalsIgnoreCase(disabled))
		selector.setEnabled(false);
	panel.add(selector);
	return selector;
}
 
Example #21
Source File: UTCDateBoxImplHtml5.java    From gwt-traction with 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 #22
Source File: TextParameterEditorView.java    From dashbuilder with Apache License 2.0 5 votes vote down vote up
@Override
public void init(final TextParameterEditor presenter) {
    this.presenter = presenter;
    input.addValueChangeHandler(new ValueChangeHandler<String>() {
        public void onValueChange(ValueChangeEvent<String> event) {
            form.setValidationState(ValidationState.NONE);
            presenter.valueChanged();
        }
    });
}
 
Example #23
Source File: EditorHarness.java    From incubator-retired-wave with Apache License 2.0 5 votes vote down vote up
private CheckBox createEditToggleCheckBox(final Editor editor) {
  CheckBox check = new CheckBox("Toggle edit");
  check.addValueChangeHandler(new ValueChangeHandler<Boolean>() {
    @Override
    public void onValueChange(ValueChangeEvent<Boolean> event) {
      setEditing(editor, event.getValue());
    }
  });
  return check;
}
 
Example #24
Source File: BaseCheckBox.java    From gwt-material with 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 #25
Source File: MapToolTipTool.java    From geowe-core with 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 #26
Source File: HostSelector.java    From core with GNU Lesser General Public License v2.1 5 votes vote down vote up
public Widget asWidget() {

        VerticalPanel layout = new VerticalPanel();
        layout.getElement().setId("host_selection");
        layout.getElement().setAttribute("title", Console.CONSTANTS.pleaseChoseHost());
        layout.setStyleName("fill-layout-width");
        layout.addStyleName("lhs-selector");
        layout.getElement().setAttribute("style", "padding:4px;");

        hosts = new ComboPicker();
        hosts.addValueChangeHandler(new ValueChangeHandler<String>() {
            @Override
            public void onValueChange(final ValueChangeEvent<String> event) {
                if (!event.getValue().isEmpty()) {
                    Scheduler.get().scheduleDeferred(
                            new Scheduler.ScheduledCommand() {
                                @Override
                                public void execute() {
                                    Console.getCircuit().dispatch(new HostSelection(hosts.getSelectedValue()));
                                }
                            }
                    );
                }
            }
        });

        Label hostLabel = new Label("Host:");
        hostLabel.setStyleName("header-label");
        layout.add(hostLabel);
        Widget hWidget = hosts.asWidget();
        hWidget.getElement().addClassName("table-picker");
        layout.add(hWidget);

        // combo box use all available space
        hWidget.getElement().getParentElement().setAttribute("width", "100%");

        return layout;
    }
 
Example #27
Source File: MaterialValueBox.java    From gwt-material with 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 #28
Source File: MultiSelect.java    From unitime with Apache License 2.0 5 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 #29
Source File: InstructorAvailabilityWidget.java    From unitime with 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);				
		}
	});
}
 
Example #30
Source File: WebTable.java    From unitime with Apache License 2.0 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);
		}
	});
}