@Override public Element render( final Node node, final String domID, final Tree.Joint joint, final int depth) { // Initialize HTML elements. final Element rootContainer = super.render(node, domID, joint, depth); final Element nodeContainer = rootContainer.getFirstChildElement(); final Element checkBoxElement = new CheckBox().getElement(); final InputElement checkBoxInputElement = (InputElement) checkBoxElement.getElementsByTagName("input").getItem(0); final Path nodePath = node instanceof ChangedFileNode ? Path.valueOf(node.getName()) : ((ChangedFolderNode) node).getPath(); setCheckBoxState(nodePath, checkBoxInputElement); setCheckBoxClickHandler(nodePath, checkBoxElement, checkBoxInputElement.isChecked()); // Paste check-box element to node container. nodeContainer.insertAfter(checkBoxElement, nodeContainer.getFirstChild()); return rootContainer; }
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); } } } }
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); } } } } }
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); } } } } }
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; }
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); }
@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())); for (Map.Entry<String, 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; }
/** * @param title The text that will appear on the button face. * @param alertStyle the dependent style suffix that will be appended to the default GWT style when the user is to be alerted. */ public AlertButton(String title, String alertStyle) { button = new PushButton(title); button.addStyleDependentName("SMALLER"); panel = new HorizontalPanel(); panel.setBorderWidth(1); checkBox = new CheckBox(); panel.add(button); button.setSize("66", "21"); panel.add(checkBox); checkBox.setSize("20", "20"); ClientFactory cf = GWT.create(ClientFactory.class); eventBus = cf.getEventBus(); this.alertStyle = alertStyle; eventBus.addHandler(WidgetSelectionChangeEvent.TYPE, updateNeededEventHandler); eventBus.addHandler(VariableSelectionChangeEvent.TYPE, variableChangedEventHandler); eventBus.addHandler(UpdateFinishedEvent.TYPE, updateFinishedHandler); eventBus.addHandler(MapChangeEvent.TYPE, mapChangeHandler); initWidget(panel); panel.setSize("90", "23"); this.ensureDebugId("AlertButton"); }
@Override public void onResponseReceived(Request request, Response response) { String text = response.getText(); PopupPanel popup = new PopupPanel(true); popup.add(new HTML("<strong>Saved edits for:<p></p></strong>"+text+"<p></p>Click outside box to dismiss.")); popup.setPopupPosition(200, Window.getClientHeight()/3); popup.show(); CellFormatter formatter = datatable.getCellFormatter(); for (Iterator dirtyIt = dirtyrows.keySet().iterator(); dirtyIt.hasNext();) { Integer widgetrow = (Integer) dirtyIt.next(); for (int i = 0; i < headers.length; i++) { formatter.removeStyleName(widgetrow, i, "dirty"); } CheckBox box = (CheckBox) datatable.getWidget(widgetrow, 0); box.setValue(false); } dirtyrows.clear(); }
public FacetPanel(FacetSerializable facet) { List<FacetMember> members = facet.getMembers(); for ( Iterator memberIt = members.iterator(); memberIt.hasNext(); ) { FacetMember member = (FacetMember) memberIt.next(); String name = member.getName(); int count = member.getCount(); CheckBox check = new CheckBox(name+" ("+count+")"); check.setFormValue(facet.getName()); check.setName(name); check.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent click) { CheckBox source = (CheckBox) click.getSource(); eventBus.fireEventFromSource(new FacetChangeEvent(), source); } }); panel.add(check); } mainPanel.add(panel); initWidget(mainPanel); }
/** * 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; }
/** * 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; }
/** * 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; }
/** * 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; }
/** * 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; }
/** * 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; }
private List<Record> setFieldsList(List<TableColumnInfoDTO> fields) { List<Record> recordList = new LinkedList<Record>(); for (final TableColumnInfoDTO tcInfoDTO : fields) { Record record = new Record(tcInfoDTO.getIdentifier()); CheckBox isRequired = new CheckBox(); CheckBox isMandatory = new CheckBox(); isRequired.setValue(tcInfoDTO.isRequired()); isRequired.setEnabled(false); isMandatory.setValue(tcInfoDTO.isMandatory()); isMandatory.setEnabled(false); record.addWidget(tableColumnInfoListView.betweenLeft, new Label(tcInfoDTO.getBetweenLeft())); record.addWidget(tableColumnInfoListView.betweenRight, new Label(tcInfoDTO.getBetweenRight())); record.addWidget(tableColumnInfoListView.columnName, new Label(tcInfoDTO.getColumnName())); record.addWidget(tableColumnInfoListView.columnHeaderPattern, new Label(tcInfoDTO.getColumnHeaderPattern())); record.addWidget(tableColumnInfoListView.columnStartCoord, new Label(tcInfoDTO.getColumnStartCoordinate())); record.addWidget(tableColumnInfoListView.columnEndCoord, new Label(tcInfoDTO.getColumnEndCoordinate())); record.addWidget(tableColumnInfoListView.columnPattern, new Label(tcInfoDTO.getColumnPattern())); record.addWidget(tableColumnInfoListView.isRequired, isRequired); record.addWidget(tableColumnInfoListView.isMandatory, isMandatory); recordList.add(record); } return recordList; }
private void addHeaderColumns(final List<Column> columnList, final FlexTable flexTable) { tableNameVsCheckBoxMap.get(selectedDataTableName).clear(); int columnNumber = 0; for (Column headerColumn : columnList) { HorizontalPanel headerRowPanel = new HorizontalPanel(); Label headerText = new Label(headerColumn.getName()); headerRowPanel.add(headerText); headerRowPanel.setWidth("80px"); CheckBox validationCheckBox = new CheckBox(); validationCheckBox.setVisible(Boolean.FALSE); headerRowPanel.add(validationCheckBox); headerRowPanel.setCellVerticalAlignment(validationCheckBox, HasVerticalAlignment.ALIGN_MIDDLE); tableNameVsCheckBoxMap.get(selectedDataTableName).add(validationCheckBox); flexTable.setWidget(0, columnNumber, headerRowPanel); flexTable.getCellFormatter().addStyleName(0, columnNumber, "wordWrap"); columnNumber++; } }
private void insertFileRow(final FileWrapper file) { int numRows = folderDisplayTable.getRowCount(); CheckBox checkBox = new CheckBox(); final String fileName = file.getName(); FolderTableRow fileTableRow = new FolderTableRow(checkBox, file); folderTableRows.add(fileTableRow); folderDisplayTable.setWidget(numRows, 0, checkBox); HTML fileIconedName = getFileIconedName(fileName, file.getKind()); fileIconedName.addStyleName(FolderManagementConstants.CURSOR_HAND); addHandlersToFileIconedName(file, fileName, fileIconedName); folderDisplayTable.setWidget(numRows, 1, fileIconedName); folderDisplayTable.setText(numRows, 2, file.getModified()); folderDisplayTable.setText(numRows, 3, file.getKind().toString()); folderDisplayTable.getCellFormatter().addStyleName(numRows, 0, FolderManagementConstants.FILES_TABLE_SMALL_COLUMN); folderDisplayTable.getCellFormatter().addStyleName(numRows, 1, FolderManagementConstants.TOP_LINKS); folderDisplayTable.getCellFormatter().addStyleName(numRows, 2, FolderManagementConstants.TOP_LINKS); folderDisplayTable.getCellFormatter().addStyleName(numRows, 3, FolderManagementConstants.TOP_LINKS); if (numRows % 2 != 0) { folderDisplayTable.getRowFormatter().addStyleName(numRows, FolderManagementConstants.FILES_TABLE_ODD); } }
@Inject public GitHubAuthenticatorViewImpl( DialogFactory dialogFactory, GitHubLocalizationConstant locale, ProductInfoDataProvider productInfoDataProvider) { this.dialogFactory = dialogFactory; this.locale = locale; isGenerateKeys = new CheckBox(locale.authGenerateKeyLabel()); isGenerateKeys.setValue(true); contentPanel = new DockLayoutPanel(Style.Unit.PX); contentPanel.addNorth( new InlineHTML(locale.authorizationDialogText(productInfoDataProvider.getName())), 20); contentPanel.addNorth(isGenerateKeys, 20); }
private void checkParentState(TreeItem treeItem, Boolean value) { TreeItem parentItem = treeItem.getParentItem(); if (parentItem == null) { return; } if (!(parentItem.getWidget() instanceof FlowPanel)) { return; } FlowPanel parentChangeContainer = (FlowPanel) parentItem.getWidget(); if (!(parentChangeContainer.getWidget(0) instanceof CheckBox)) { return; } CheckBox parentCheckBox = (CheckBox) parentChangeContainer.getWidget(0); if (value && !parentCheckBox.getValue()) { parentCheckBox.setValue(true); checkParentState(parentItem, true); } }
private void checkChildrenState(TreeItem treeItem, Boolean value) { int childCount = treeItem.getChildCount(); if (childCount == 0) { return; } for (int i = 0; i < childCount; i++) { TreeItem childItem = treeItem.getChild(i); if (!(childItem.getWidget() instanceof FlowPanel)) { return; } FlowPanel childItemContainer = (FlowPanel) childItem.getWidget(); if (!(childItemContainer.getWidget(0) instanceof CheckBox)) { return; } CheckBox childCheckBox = (CheckBox) childItemContainer.getWidget(0); childCheckBox.setValue(value); checkChildrenState(childItem, value); } }
public Widget getWidget(Object data) { if (!(data instanceof GWT_CiBean)) { return(new Label("getChildCount(Object data): Not a correct data object!")); } final GWT_CiBean bean = (GWT_CiBean)data; HorizontalPanel hpanel = new HorizontalPanel(); if (selectInstances() && (!bean.isTemplate())) { final CheckBox cb = new CheckBox(); cb.setChecked(isChecked(bean)); hpanel.add(cb); cb.addClickListener(new ClickListener() { public void onClick(Widget sender) { addChecked(bean, cb.isChecked()); } }); } hpanel.add(new Image(OneCMDBUtils.getIconForCI(bean))); Label label = new Label(bean.getDisplayName()); hpanel.add(label); return(hpanel); }
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); } }
private void applyChanges() { ensureSelectAllCB(); DefaultTableDefinition<TableData.Row> tdef = (DefaultTableDefinition<TableData.Row>) table.getTable().getTableDefinition(); boolean reloadNeeded = false; for (ColDef col : checkBoxes.keySet()) { CheckBox cb = checkBoxes.get(col); if (tdef.isColumnVisible(col) != cb.getValue()) { col.getColumn().setVisible(cb.getValue()); tdef.setColumnVisible(col, cb.getValue()); reloadNeeded = true; } } if (reloadNeeded) { String vcols = getVisibleColStr(table.getTable()); if (vcols.equals(defVisibleCols)) { Preferences.set(table.getName() + VISI_COL_PREF, null); } else { Preferences.set(table.getName() + VISI_COL_PREF, vcols); } // table.getTable().clearHiddenFilters(); table.redrawTable(); } }
private CheckBox renderCheckBox(LabeledWidgetsGrid g, ConfigParameterInfo param) { CheckBox checkBox = new CheckBox(getDisplayName(param)); checkBox.setValue(Boolean.parseBoolean(param.value())); HorizontalPanel p = new HorizontalPanel(); p.add(checkBox); if (param.description() != null) { Image infoImg = new Image(Gerrit.RESOURCES.info()); infoImg.setTitle(param.description()); p.add(infoImg); } if (param.warning() != null) { Image warningImg = new Image(Gerrit.RESOURCES.warning()); warningImg.setTitle(param.warning()); p.add(warningImg); } g.add((String) null, p); saveEnabler.listenTo(checkBox); return checkBox; }
private void addOneKey(GpgKeyInfo k) { int row = table.getRowCount(); table.insertRow(row); applyDataRowStyle(row); CheckBox sel = new CheckBox(); sel.addValueChangeHandler(updateDeleteHandler); table.setWidget(row, 0, sel); table.setWidget(row, 1, new CopyableLabel(k.id())); table.setText(row, 2, k.fingerprint()); VerticalPanel userIds = new VerticalPanel(); for (int i = 0; i < k.userIds().length(); i++) { userIds.add(new InlineLabel(k.userIds().get(i))); } table.setWidget(row, 3, userIds); FlexCellFormatter fmt = table.getFlexCellFormatter(); fmt.addStyleName(row, 0, Gerrit.RESOURCES.css().iconCell()); fmt.addStyleName(row, 1, Gerrit.RESOURCES.css().dataCell()); fmt.addStyleName(row, 2, Gerrit.RESOURCES.css().dataCell()); fmt.addStyleName(row, 3, Gerrit.RESOURCES.css().dataCell()); setRowItem(row, k); }
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); }
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")); }
public Boolean isInstructorSelected(int row) { Widget w = getWidget(row, 0); if (w != null && w instanceof CheckBox) { return ((CheckBox)w).getValue(); } else { return null; } }
public CheckBox getInstructorSelection(int row) { Widget w = getWidget(row, 0); if (w != null && w instanceof CheckBox) { return (CheckBox)w; } else { return null; } }
public Boolean isRoomSelected(int row) { Widget w = getWidget(row, 0); if (w != null && w instanceof CheckBox) { return ((CheckBox)w).getValue(); } else { return null; } }
public CheckBox getRoomSelection(int row) { Widget w = getWidget(row, 0); if (w != null && w instanceof CheckBox) { return (CheckBox)w; } else { return null; } }
protected String generateAlsoUpdateMessage() { if (!iProperties.hasFutureSessions()) return null; List<String> ret = new ArrayList<String>(); for (AcademicSessionInterface session: iProperties.getFutureSessions()) { CheckBox ch = iFutureSessionsToggles.get(session.getId()); if (ch != null && ch.getValue()) { ret.add(session.getLabel()); } } if (!ret.isEmpty()) return ToolBox.toString(ret); return null; }
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); } } } }