com.google.gwt.user.client.ui.CheckBox Java Examples

The following examples show how to use com.google.gwt.user.client.ui.CheckBox. 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: RoomEdit.java    From unitime with Apache License 2.0 6 votes vote down vote up
protected String generateAlsoUpdateMessage(boolean includeWhenNoFlags) {
	if ((iRoom.getUniqueId() == null && iProperties.hasFutureSessions()) || iRoom.hasFutureRooms()) {
		List<String> ret = new ArrayList<String>();
		for (int i = 1; i < iApplyTo.getRowCount(); i++) {
			CheckBox ch = (CheckBox)iApplyTo.getWidget(i, 0);
			if (ch.getValue()) {
				int flags = 0;
				for (FutureOperation op: FutureOperation.values()) {
					CheckBox x = (CheckBox)iApplyTo.getWidget(i, 6 + op.ordinal());
					if (x.getValue())
						flags = op.set(flags);
				}
				if (flags == 0 && !includeWhenNoFlags) continue;
				ret.add(iApplyTo.getData(i).getSession().getLabel());
			}
		}
		if (!ret.isEmpty())
			return ToolBox.toString(ret);
	}
	return null;
}
 
Example #2
Source File: CourseFinderCourses.java    From unitime with Apache License 2.0 6 votes vote down vote up
@Override
public RequestedCourse getValue() {
	int row = iCourses.getSelectedRow();
	if (iCourses.getSelectedRow() < 0) return null;
	CourseAssignment record = iCourses.getData(row);
	if (record == null) return null;
	RequestedCourse rc = new RequestedCourse();
	rc.setCourseId(record.getCourseId());
	rc.setCourseName(MESSAGES.courseName(record.getSubject(), record.getCourseNbr()));
	if (record.hasTitle() && (!record.hasUniqueName() || iShowCourseTitles))
		rc.setCourseName(MESSAGES.courseNameWithTitle(record.getSubject(), record.getCourseNbr(), record.getTitle()));
	rc.setCourseTitle(record.getTitle());
	rc.setCredit(record.guessCreditRange());
	for (Map.Entry<Preference, CheckBox> e: iInstructionalMethods.entrySet())
		if (e.getValue().isEnabled() && e.getValue().getValue())
			rc.setSelectedIntructionalMethod(e.getKey(), true);
	if (iDetails != null)
		for (CourseFinderCourseDetails d: iDetails)
			d.onGetValue(rc);
	return rc;
}
 
Example #3
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 #4
Source File: CourseFinderClasses.java    From unitime with Apache License 2.0 6 votes vote down vote up
@Override
public void onSetValue(RequestedCourse course) {
	iSelectedClasses.clear();
	if (course != null && course.hasSelectedClasses()) {
		iSelectedClasses.addAll(course.getSelectedClasses());
		for (Preference p: course.getSelectedClasses())
			if (p.isRequired() && iRequired != null) iRequired.setValue(true);
	}
	for (int row = 1; row < getRowCount(); row++) {
		ClassAssignment a = getData(row);
		CheckBox ch = getClassSelection(row);
		if (ch != null && a != null) {
			ch.setValue(iSelectedClasses.contains(getSelection(a)));
			setSelected(row, iSelectedClasses.contains(getSelection(a)));
		}
	}
}
 
Example #5
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 #6
Source File: ExtendedScrollTable.java    From document-management-system with GNU General Public License v2.0 6 votes vote down vote up
/**
 * getAllSelectedPaths
 *
 * @return
 */
public List<String> getAllSelectedPaths() {
	List<String> paths = new ArrayList<String>();
	for (int i = 0; dataTable.getRowCount() > i; i++) {
		CheckBox checkBox = (CheckBox) dataTable.getWidget(i, colMassiveIndex);
		if (checkBox.getValue()) {
			Object obj = data.get(Integer.parseInt(dataTable.getText(i, colDataIndex)));
			if (obj instanceof GWTDocument) {
				paths.add(((GWTDocument) obj).getPath());
			} else if (obj instanceof GWTFolder) {
				paths.add(((GWTFolder) obj).getPath());
			} else if (obj instanceof GWTMail) {
				paths.add(((GWTMail) obj).getPath());
			}
		}
	}
	return paths;
}
 
Example #7
Source File: ExtendedScrollTable.java    From document-management-system with GNU General Public License v2.0 6 votes vote down vote up
/**
 * getAllSelectedDocumentsUUIDs
 */
public List<String> getAllSelectedDocumentsUUIDs() {
	List<String> uuidList = new ArrayList<String>();

	for (int i = 0; dataTable.getRowCount() > i; i++) {
		CheckBox checkBox = (CheckBox) dataTable.getWidget(i, colMassiveIndex);

		if (checkBox.getValue()) {
			Object obj = data.get(Integer.parseInt(dataTable.getText(i, colDataIndex)));
			if (obj instanceof GWTDocument) {
				uuidList.add(((GWTDocument) obj).getUuid());
			}
		}
	}

	return uuidList;
}
 
Example #8
Source File: ExtendedScrollTable.java    From document-management-system with GNU General Public License v2.0 6 votes vote down vote up
/**
 * getAllSelectedUUIDs
 */
public List<String> getAllSelectedUUIDs() {
	List<String> uuidList = new ArrayList<String>();

	for (int i = 0; dataTable.getRowCount() > i; i++) {
		CheckBox checkBox = (CheckBox) dataTable.getWidget(i, colMassiveIndex);

		if (checkBox.getValue()) {
			Object obj = data.get(Integer.parseInt(dataTable.getText(i, colDataIndex)));
			if (obj instanceof GWTDocument) {
				uuidList.add(((GWTDocument) obj).getUuid());
			} else if (obj instanceof GWTFolder) {
				uuidList.add(((GWTFolder) obj).getUuid());
			} else if (obj instanceof GWTMail) {
				uuidList.add(((GWTMail) obj).getUuid());
			}
		}
	}

	return uuidList;
}
 
Example #9
Source File: ExtendedScrollTable.java    From document-management-system with GNU General Public License v2.0 6 votes vote down vote up
/**
 * getAllSelectedDocumentsPaths
 */
public List<String> getAllSelectedDocumentsPaths() {
	List<String> pathList = new ArrayList<String>();

	for (int i = 0; dataTable.getRowCount() > i; i++) {
		CheckBox checkBox = (CheckBox) dataTable.getWidget(i, colMassiveIndex);

		if (checkBox.getValue()) {
			Object obj = data.get(Integer.parseInt(dataTable.getText(i, colDataIndex)));
			if (obj instanceof GWTDocument) {
				pathList.add(((GWTDocument) obj).getPath());
			}
		}
	}

	return pathList;
}
 
Example #10
Source File: ExtendedScrollTable.java    From document-management-system with GNU General Public License v2.0 6 votes vote down vote up
/**
 * getAllSelectedPdfDocuments
 *
 * @return
 */
public List<GWTDocument> getAllSelectedPdfDocuments() {
	List<GWTDocument> docs = new ArrayList<GWTDocument>();
	for (int i = 0; dataTable.getRowCount() > i; i++) {
		CheckBox checkBox = (CheckBox) dataTable.getWidget(i, colMassiveIndex);
		if (checkBox.getValue()) {
			Object obj = data.get(Integer.parseInt(dataTable.getText(i, colDataIndex)));
			if (obj instanceof GWTDocument) {
				GWTDocument doc = (GWTDocument) obj;
				if (doc.getMimeType().equals("application/pdf")) {
					docs.add(doc);
				}
			}
		}
	}
	return docs;
}
 
Example #11
Source File: SettingsPanel.java    From swcv with MIT License 6 votes vote down vote up
private Widget createCheckboxStopwords()
{
    final CheckBox box = new CheckBox();
    box.setValue(setting.isRemoveStopwords());

    box.addClickHandler(new ClickHandler()
    {
        @Override
        public void onClick(ClickEvent event)
        {
            setting.setRemoveStopwords(box.getValue());
        }
    });

    box.setTitle("Exclude common stop words from the result\ne.g., 'the', 'is', 'at', 'which', 'on' etc");
    return box;
}
 
Example #12
Source File: ExtendedScrollTable.java    From document-management-system with GNU General Public License v2.0 6 votes vote down vote up
/**
 * getAllSelectedMailUUIDs
 */
public List<String> getAllSelectedMailUUIDs() {
	List<String> uuidList = new ArrayList<String>();

	for (int i = 0; dataTable.getRowCount() > i; i++) {
		CheckBox checkBox = (CheckBox) dataTable.getWidget(i, colMassiveIndex);

		if (checkBox.getValue()) {
			Object obj = data.get(Integer.parseInt(dataTable.getText(i, colDataIndex)));
			if (obj instanceof GWTMail) {
				uuidList.add(((GWTMail) obj).getUuid());
			}
		}
	}

	return uuidList;
}
 
Example #13
Source File: RoomFeatureEdit.java    From unitime with Apache License 2.0 6 votes vote down vote up
protected void fillFutureFlags(UpdateRoomFeatureRequest request) {
	if (iProperties.hasFutureSessions()) {
		for (AcademicSessionInterface session: iProperties.getFutureSessions()) {
			CheckBox ch = iFutureSessionsToggles.get(session.getId());
			if (ch != null) {
				Integer flags = RoomCookie.getInstance().getFutureFlags(session.getId());
				if (ch.getValue()) {
					request.addFutureSession(session.getId());
					if (flags == null)
						RoomCookie.getInstance().setFutureFlags(session.getId(), FutureOperation.getFlagDefaultsEnabled());
				} else {
					if (flags != null)
						RoomCookie.getInstance().setFutureFlags(session.getId(), null);
				}
			}
		}
	}
}
 
Example #14
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 #15
Source File: RoomGroupEdit.java    From unitime with Apache License 2.0 6 votes vote down vote up
protected void fillFutureFlags(UpdateRoomGroupRequest request) {
	if (iProperties.hasFutureSessions()) {
		for (AcademicSessionInterface session: iProperties.getFutureSessions()) {
			CheckBox ch = iFutureSessionsToggles.get(session.getId());
			if (ch != null) {
				Integer flags = RoomCookie.getInstance().getFutureFlags(session.getId());
				if (ch.getValue()) {
					request.addFutureSession(session.getId());
					if (flags == null)
						RoomCookie.getInstance().setFutureFlags(session.getId(), FutureOperation.getFlagDefaultsEnabled());
				} else {
					if (flags != null)
						RoomCookie.getInstance().setFutureFlags(session.getId(), null);
				}
			}
		}
	}
}
 
Example #16
Source File: SettingsPanel.java    From swcv with MIT License 6 votes vote down vote up
private Widget createCheckboxRemoveNumbers()
{
    final CheckBox box = new CheckBox();
    box.setValue(setting.isRemoveNumbers());

    box.addClickHandler(new ClickHandler()
    {
        @Override
        public void onClick(ClickEvent event)
        {
            setting.setRemoveNumbers(box.getValue());
        }
    });

    box.setTitle("Remove numbers and punctuation characters from the result");
    return box;
}
 
Example #17
Source File: RoomGroupEdit.java    From unitime with Apache License 2.0 6 votes vote down vote up
public void setProperties(RoomPropertiesInterface properties) {
	iProperties = properties;
	iRooms.setProperties(properties);
	
	iFutureSessions.clear();
	iForm.getRowFormatter().setVisible(iFutureSessionsRow, iProperties.hasFutureSessions());
	if (iProperties.hasFutureSessions()) {
		CheckBox current = new CheckBox(iProperties.getAcademicSessionName());
		current.setValue(true); current.setEnabled(false);
		current.addStyleName("future-session");
		iFutureSessions.add(current);
		for (AcademicSessionInterface session: iProperties.getFutureSessions()) {
			if (session.isCanAddGlobalRoomGroup() || session.isCanAddDepartmentalRoomGroup()) {
				CheckBox ch = new CheckBox(session.getLabel());
				iFutureSessionsToggles.put(session.getId(), ch);
				ch.addStyleName("future-session");
				iFutureSessions.add(ch);
			}
		}
	}
}
 
Example #18
Source File: CourseFinderMultipleCourses.java    From unitime with Apache License 2.0 6 votes vote down vote up
@Override
public RequestedCourse getValue() {
	int row = iCourses.getSelectedRow();
	if (iCourses.getSelectedRow() < 0) return null;
	CourseAssignment record = iCourses.getData(row);
	if (record == null) return null;
	RequestedCourse rc = new RequestedCourse();
	rc.setCourseId(record.getCourseId());
	rc.setCourseName(MESSAGES.courseName(record.getSubject(), record.getCourseNbr()));
	if (record.hasTitle() && (!record.hasUniqueName() || iShowCourseTitles))
		rc.setCourseName(MESSAGES.courseNameWithTitle(record.getSubject(), record.getCourseNbr(), record.getTitle()));
	rc.setCourseTitle(record.getTitle());
	rc.setCredit(record.guessCreditRange());
	for (Map.Entry<Preference, CheckBox> e: iInstructionalMethods.entrySet())
		if (e.getValue().isEnabled() && e.getValue().getValue())
			rc.setSelectedIntructionalMethod(e.getKey(), true);
	if (iDetails != null)
		for (CourseFinderCourseDetails d: iDetails)
			d.onGetValue(rc);
	if (iCheckedCourses.contains(rc))
		iCheckedCourses.set(iCheckedCourses.indexOf(rc), rc);
	return rc;
}
 
Example #19
Source File: SettingsPanel.java    From swcv with MIT License 6 votes vote down vote up
private Widget createCheckboxStem()
{
    final CheckBox box = new CheckBox();
    box.setValue(setting.isStemWords());

    box.addClickHandler(new ClickHandler()
    {
        @Override
        public void onClick(ClickEvent event)
        {
            setting.setStemWords(box.getValue());
        }
    });

    box.setTitle("Combine similar words\ne.g., 'dance', 'dancer', 'danced', 'dancing' -> 'dance'");
    return box;
}
 
Example #20
Source File: CourseFinderMultipleCourses.java    From unitime with Apache License 2.0 6 votes vote down vote up
public boolean selectCourse(CourseAssignment course) {
	for (int r = 0; r < iCourses.getRowCount(); r++) {
		CourseAssignment ca = iCourses.getData(r);
		if (iCourses.getWidget(r, 0) instanceof CheckBox && ca != null && course.equals(ca)) {
			CheckBox c = (CheckBox)iCourses.getWidget(r, 0);
			boolean changed = false;
			if (!c.getValue()) {
				c.setValue(true, true);
				changed = true;
			}
			if (iCourses.getSelectedRow() < 0) {
				iCourses.setSelected(r, true);
				updateCourseDetails();
			}
			return changed;
		}
	}
	return false;
}
 
Example #21
Source File: EventMeetingTable.java    From unitime with Apache License 2.0 5 votes vote down vote up
public boolean hasSelection() {
	for (int row = 1; row < getRowCount(); row++) {
		Widget w =  getWidget(row, 0);
		if (w != null && w instanceof CheckBox) {
			CheckBox ch = (CheckBox)w;
			if (ch.getValue()) return true;
		}
	}
	return false;
}
 
Example #22
Source File: PageFilter.java    From unitime with Apache License 2.0 5 votes vote down vote up
public void setValue(String name, String value) {
	Widget w = iWidgets.get(name);
	FilterParameterInterface param = iFilter.getParameter(name);
	if (param != null) param.setValue(value);
	if (w == null) return;
	if (w instanceof CheckBox) {
		((CheckBox)w).setValue("1".equals(value));
	} else if (w instanceof ListBox) {
		ListBox list = (ListBox)w;
		if (param != null && param.isMultiSelect()) {
			for (int i = 0; i < list.getItemCount(); i++) {
				boolean selected = false;
				for (String val: value.split(","))
					if (val.equalsIgnoreCase(list.getValue(i))) selected = true;
				list.setItemSelected(i, selected);
			}
		} else {
			for (int i = 0; i < list.getItemCount(); i++) {
				if (value.equalsIgnoreCase(list.getValue(i))) {
					list.setSelectedIndex(i); break;
				}
			}
		}
	} else if (w instanceof HasText) {
		((HasText)w).setText(value);
	}
}
 
Example #23
Source File: ChangeGradeModesDialog.java    From unitime with Apache License 2.0 5 votes vote down vote up
protected void submitUpdateEnabled() {
	for (CheckBox ch: iDisclaimers)
		if (!ch.getValue()) {
			iButtons.setEnabled("submit", false, true);
			return;
		}
	iButtons.setEnabled("submit", true, true);
}
 
Example #24
Source File: DebugOptions.java    From swellrt with Apache License 2.0 5 votes vote down vote up
private void addCheckBox(Panel panel, String caption, boolean initValue,
    ValueChangeHandler<Boolean> handler) {
  CheckBox box = new CheckBox(caption);
  box.setValue(initValue);
  box.addValueChangeHandler(handler);
  panel.add(box);
}
 
Example #25
Source File: CourseFinderClasses.java    From unitime with Apache License 2.0 5 votes vote down vote up
public Boolean isClassSelected(int row) {
	Widget w = getWidget(row, 0);
	if (w != null && w instanceof CheckBox) {
		return ((CheckBox)w).getValue();
	} else {
		return null;
	}
}
 
Example #26
Source File: StudentStatusDialog.java    From unitime with Apache License 2.0 5 votes vote down vote up
public void sendStudentEmail(Command command, String optionalToggleCaption, boolean optionalToggleDefault) {
	iCommand = command;
	iForm.clear();
	iForm.addRow(MESSAGES.emailSubject(), iSubject);
	if (iSubject.getText().isEmpty() || iSubject.getText().equals(MESSAGES.defaulSubjectMassCancel())) {
		iSubject.setText(MESSAGES.defaulSubject());
		if (SectioningStatusCookie.getInstance().hasEmailSubject())
			iSubject.setText(SectioningStatusCookie.getInstance().getEmailSubject());
	}
	iForm.addRow(MESSAGES.emailCC(), iCC);
	iForm.addRow(MESSAGES.emailBody(), iMessage);
	P panel = new P();
	panel.add(iAdvisorRequests); panel.add(iCourseRequests); panel.add(iClassSchedule);
	iForm.addRow(MESSAGES.emailInclude(), panel);
	
	if (optionalToggleCaption != null && !optionalToggleCaption.isEmpty()) {
		iOptionalEmailToggle = new CheckBox(optionalToggleCaption, true);
		iOptionalEmailToggle.setValue(SectioningStatusCookie.getInstance().isOptionalEmailToggle(optionalToggleDefault));
		iForm.addRow(MESSAGES.emailCustom(), iOptionalEmailToggle);
	} else {
		iOptionalEmailToggle = null;
	}
	
	iForm.addBottomRow(iButtons);
	iButtons.setEnabled("set-note", false);
	iButtons.setEnabled("send-email", true);
	iButtons.setEnabled("mass-cancel", false);
	iButtons.setEnabled("set-status", false);
	setText(MESSAGES.sendStudentEmail());
	center();
	iSubject.focus();
}
 
Example #27
Source File: CourseFinderClasses.java    From unitime with Apache License 2.0 5 votes vote down vote up
public void selectClass(int row, boolean value) {
	Widget w = getWidget(row, 0);
	if (w != null && w instanceof CheckBox) {
		((CheckBox)w).setValue(value);
		ClassAssignment a = getData(row);
		if (value)
			iSelectedClasses.add(getSelection(a));
		else
			iSelectedClasses.remove(getSelection(a));
	}
}
 
Example #28
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 #29
Source File: CourseFinderClasses.java    From unitime with Apache License 2.0 5 votes vote down vote up
public CheckBox getClassSelection(int row) {
	Widget w = getWidget(row, 0);
	if (w != null && w instanceof CheckBox) {
		return (CheckBox)w;
	} else {
		return null;
	}
}
 
Example #30
Source File: CourseFinderClasses.java    From unitime with Apache License 2.0 5 votes vote down vote up
@Override
public void onGetValue(RequestedCourse course) {
	course.setSelectedClasses(null);
	for (int row = 1; row < getRowCount(); row++) {
		ClassAssignment clazz = getData(row);
		if (clazz == null) continue;
		Widget w = getWidget(row, 0);
		if (w != null && w instanceof CheckBox && ((CheckBox)w).getValue())
			course.setSelectedClass(getSelection(clazz), true);
	}
}