Java Code Examples for com.google.gwt.user.client.ui.CheckBox#setValue()

The following examples show how to use com.google.gwt.user.client.ui.CheckBox#setValue() . 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: 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 2
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 3
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 4
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 5
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 6
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 7
Source File: ExtendedScrollTable.java    From document-management-system with GNU General Public License v2.0 5 votes vote down vote up
/**
 * selectAllMassive
 */
public void selectAllMassive() {
	massiveSelected = new ArrayList<Integer>();
	for (int i = 0; dataTable.getRowCount() > i; i++) {
		CheckBox checkBox = (CheckBox) dataTable.getWidget(i, colMassiveIndex);
		checkBox.setValue(true);
		massiveSelected.add(Integer.parseInt(dataTable.getText(i, colDataIndex)));
	}
	evaluateMergePdf();
}
 
Example 8
Source File: DebugOptions.java    From incubator-retired-wave 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 9
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 10
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 11
Source File: RoomFeatureEdit.java    From unitime with Apache License 2.0 5 votes vote down vote up
public void setProperties(RoomPropertiesInterface properties) {
	iProperties = properties;
	iRooms.setProperties(properties);
	
	iForm.getRowFormatter().setVisible(iTypeRow, !iProperties.getFeatureTypes().isEmpty());
	iType.clear();
	if (!iProperties.getFeatureTypes().isEmpty()) {
		iType.addItem(MESSAGES.itemNoFeatureType(), "-1");
		for (FeatureTypeInterface type: iProperties.getFeatureTypes())
			iType.addItem(type.getLabel(), type.getId().toString());
	}

	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 12
Source File: ExtendedScrollTable.java    From document-management-system with GNU General Public License v2.0 5 votes vote down vote up
/**
 * removeAllMassive
 */
public void removeAllMassive() {
	massiveSelected = new ArrayList<Integer>();
	for (int i = 0; dataTable.getRowCount() > i; i++) {
		CheckBox checkBox = (CheckBox) dataTable.getWidget(i, colMassiveIndex);
		checkBox.setValue(false);
	}
	evaluateMergePdf();
}
 
Example 13
Source File: ExtendedScrollTable.java    From document-management-system with GNU General Public License v2.0 5 votes vote down vote up
/**
 * selectAllMailsMassive
 */
public void selectAllMailsMassive() {
	massiveSelected = new ArrayList<Integer>();
	for (int i = 0; dataTable.getRowCount() > i; i++) {
		if (data.get(Integer.parseInt(dataTable.getText(i, colDataIndex))) instanceof GWTMail) {
			CheckBox checkBox = (CheckBox) dataTable.getWidget(i, colMassiveIndex);
			checkBox.setValue(true);
			massiveSelected.add(Integer.parseInt(dataTable.getText(i, colDataIndex)));
		}
	}
}
 
Example 14
Source File: ExtendedScrollTable.java    From document-management-system with GNU General Public License v2.0 5 votes vote down vote up
/**
 * selectAllDocumentsMassive
 */
public void selectAllDocumentsMassive() {
	massiveSelected = new ArrayList<Integer>();
	for (int i = 0; dataTable.getRowCount() > i; i++) {
		if (data.get(Integer.parseInt(dataTable.getText(i, colDataIndex))) instanceof GWTDocument) {
			CheckBox checkBox = (CheckBox) dataTable.getWidget(i, colMassiveIndex);
			checkBox.setValue(true);
			massiveSelected.add(Integer.parseInt(dataTable.getText(i, colDataIndex)));
		}
	}
	evaluateMergePdf();
}
 
Example 15
Source File: ExtendedScrollTable.java    From document-management-system with GNU General Public License v2.0 5 votes vote down vote up
/**
 * selectAllFoldersMassive
 */
public void selectAllFoldersMassive() {
	massiveSelected = new ArrayList<Integer>();
	for (int i = 0; dataTable.getRowCount() > i; i++) {
		if (data.get(Integer.parseInt(dataTable.getText(i, colDataIndex))) instanceof GWTFolder) {
			CheckBox checkBox = (CheckBox) dataTable.getWidget(i, colMassiveIndex);
			checkBox.setValue(true);
			massiveSelected.add(Integer.parseInt(dataTable.getText(i, colDataIndex)));
		}
	}
}
 
Example 16
Source File: CourseFinderMultipleCourses.java    From unitime with Apache License 2.0 4 votes vote down vote up
public boolean setCheckedCourses(List<RequestedCourse> checkedCourses) {
	iLastDetails = null;
	iCheckedCourses = checkedCourses;
	iSelectedMethods.clear();
	if (iRequired != null) iRequired.setValue(false);
	if (iDetails != null)
		for (CourseFinderCourseDetails detail: iDetails)
			detail.setValue(null);
	if (iCourses.getSelectedRow() >= 0)
		iCourses.setSelected(iCourses.getSelectedRow(), false);
	if (!iCheckedCourses.isEmpty()) {
		RequestedCourse value = iCheckedCourses.get(0);
		if (value != null && value.hasSelectedIntructionalMethods())
			for (Preference id: iCheckedCourses.get(0).getSelectedIntructionalMethods()) {
				iSelectedMethods.add(id);
				if (id.isRequired() && iRequired != null) iRequired.setValue(true);
			}
		if (value != null && value.hasSelectedClasses())
			for (Preference p: value.getSelectedClasses())
				if (p.isRequired() && iRequired != null) iRequired.setValue(true);
		if (iDetails != null)
			for (CourseFinderCourseDetails d: iDetails)
				if (d instanceof CourseFinderClasses) {
					Set<Preference> classes = ((CourseFinderClasses)d).getAllSelectedClasses();
					classes.clear();
					for (RequestedCourse rc: iCheckedCourses)
						if (rc.hasSelectedClasses())
							classes.addAll(rc.getSelectedClasses());
				}
	}
	int checked = 0;
	for (int r = 0; r < iCourses.getRowCount(); r++) {
		CourseAssignment ca = iCourses.getData(r);
		if (iCourses.getWidget(r, 0) instanceof CheckBox && ca != null) {
			CheckBox c = (CheckBox)iCourses.getWidget(r, 0);
			int idx = iCheckedCourses.indexOf(new RequestedCourse(ca, CONSTANTS.showCourseTitle()));
			c.setValue(idx >= 0);
			c.setText(idx >= 0 ? String.valueOf(idx + 1) : "");
			if (idx >= 0) checked++;
			if (!iCheckedCourses.isEmpty() && iCheckedCourses.get(0).equals(ca)) {
				iCourses.setSelected(r, true);
			}
		}
	}
	scrollToSelectedRow();
	updateCourseDetails();
	return (checked == checkedCourses.size());
}
 
Example 17
Source File: SubsetJSONPropertyEditor.java    From appinventor-extensions with Apache License 2.0 4 votes vote down vote up
private void loadComponents(JSONObject jsonObj) {
  // TODO: Review JSON format. There has to be a better way to store and retrieve this info.
  JSONObject shownComponents = jsonObj.get("shownComponentTypes").isObject();
  JSONObject shownComponentBlocks = jsonObj.get("shownBlockTypes").isObject().get("ComponentBlocks").isObject();
  for (int i = 0; i < componentTree.getItemCount(); ++i) {
    TreeItem componentCatItem = componentTree.getItem(i);
    CheckBox componentCatCb = (CheckBox)componentCatItem.getWidget();
    String catName = componentCatCb.getName().toUpperCase();
    if (shownComponents.containsKey(catName)) {
      JSONArray jsonComponentCat = shownComponents.get(catName).isArray();
      if (jsonComponentCat.size() > 0) {
        componentCatCb.setValue(true, false);
        HashMap<String, String> jsonComponentHash = new HashMap<String, String>();
        for (int j = 0; j < jsonComponentCat.size(); ++j) {
          JSONValue jsonComponentHashCat = jsonComponentCat.get(j);
          if (jsonComponentHashCat != null) {
            jsonComponentHash.put(jsonComponentHashCat.isObject().get("type").isString().stringValue(), "type");
          }
        }
        for (int j = 0; j < componentCatItem.getChildCount(); ++j) {
          TreeItem componentItem = componentCatItem.getChild(j);
          CheckBox componentCb = (CheckBox) componentItem.getWidget();
          if (jsonComponentHash.get(componentCb.getName()) != null) {
            componentCb.setValue(true, false);
            JSONArray jsonComponentBlockProps = shownComponentBlocks.get(componentCb.getName()).isArray();
            HashMap<String, String> componentPropHash = new HashMap<String, String>();
            for (int k = 0; k < jsonComponentBlockProps.size(); ++k) {
              JSONObject jsonComponentBlockType = jsonComponentBlockProps.get(k).isObject();
              String componentBlockType = jsonComponentBlockType.get("type").isString().stringValue();
              if ("component_set_get".equals(componentBlockType)) {
                componentPropHash.put(jsonComponentBlockType.get("mutatorNameToValue").isObject().get("property_name").isString().stringValue(), "PROP");
              } else if ("component_event".equals(componentBlockType)) {
                JSONValue mutatorValue = jsonComponentBlockType.get("mutatorNameToValue");
                JSONValue event_name = mutatorValue.isObject().get("event_name");
                componentPropHash.put(event_name.isString().stringValue(), "EVENT");
              } else if ("component_method".equals(componentBlockType)) {
                componentPropHash.put(jsonComponentBlockType.get("mutatorNameToValue").isObject().get("method_name").isString().stringValue(), "METHOD");
              }
            }
            for (int k = 0; k < componentItem.getChildCount(); ++k) {
              TreeItem componentPropItem = componentItem.getChild(k);
              CheckBox componentPropCb = (CheckBox) componentPropItem.getWidget();
              if (componentPropHash.get(componentPropCb.getText()) != null) {
                componentPropCb.setValue(true, false);
              } else {
                componentPropCb.setValue(false, false);
              }
            }

          } else {
            componentCb.setValue(false, false);
            toggleChildren(componentItem, false);
          }
        }
      } else {
        componentCatCb.setValue(false, false);
        toggleChildren(componentCatItem, false);
      }
    } else {
      componentCatCb.setValue(false, false);
      toggleChildren(componentCatItem, false);
    }
  }
}