List of usage examples for com.google.gwt.user.client.ui CheckBox setValue
@Override public void setValue(Boolean value)
From source file:ar.com.kyol.jet.client.wrappers.CheckBoxWrapper.java
License:Open Source License
public CheckBoxWrapper(ObjectSetter objSetter, CheckBox checkBox, boolean useValueAsString) { super(useValueAsString); this.objSetter = objSetter; this.checkBox = checkBox; if (useValueAsString) { if (objSetter.getValue() != null) { checkBox.setValue(new Boolean((String) objSetter.getValue())); }//from ww w .j a v a 2 s. c o m } else { checkBox.setValue((Boolean) objSetter.getValue()); } checkBox.addValueChangeHandler(new ValueChangeHandler<Boolean>() { @Override public void onValueChange(ValueChangeEvent<Boolean> arg0) { setProperty(arg0.getValue()); } }); initWidget(checkBox); }
From source file:asquare.gwt.tkdemo.client.demos.DebugPanel.java
License:Apache License
private void addCheckBox(ColumnPanel parent, String label, int mask, ClickHandler listener) { CheckBox cb = new CheckBox(label); DomUtil.setStyleAttribute(cb, "display", "block"); DomUtil.setStyleAttribute(cb, "whiteSpace", "nowrap"); cb.setValue((m_eventListener.getEventMask() & mask) != 0); cb.addClickHandler(listener);//from w w w . j av a 2 s .c o m parent.addWidget(cb, false); }
From source file:burrito.client.widgets.panels.table.Table.java
License:Apache License
public void selectAll(boolean all) { for (int row = 1; row < currentModel.size() + 1; row++) { CheckBox cb = (CheckBox) table.getWidget(row, 0); if (all) { cb.setValue(true); table.getRowFormatter().addStyleName(row, "k5-Table-row-selected"); } else {//from w w w. j av a 2 s .c o m cb.setValue(false); table.getRowFormatter().removeStyleName(row, "k5-Table-row-selected"); } } }
From source file:cc.alcina.framework.gwt.client.widget.complex.FastROBoundTable.java
License:Apache License
@Override protected void addRow(final SourcesPropertyChangeEvents o) { int row = table.getRowCount(); final CheckBox handle; int startColumn = 0; final List<CheckBox> handles = this.rowHandles; if ((this.masks & BoundTableExt.ROW_HANDLE_MASK) > 0) { handle = new CheckBox(); handle.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { setActive(true);/*from ww w .j ava 2 s .c o m*/ List newSelected = null; if ((masks & BoundTableExt.MULTIROWSELECT_MASK) > 0) { newSelected = new ArrayList(getSelectedObjects()); } else { for (CheckBox cb : handles) { if (cb != handle) { cb.setValue(false); } } newSelected = new ArrayList(); } if (!handle.getValue()) { newSelected.remove(o); } else { newSelected.add(o); } setSelected(newSelected); setSelectedObjects(newSelected); } }); startColumn++; this.rowHandles.add(handle); this.table.setWidget(row, 0, handle); } else { handle = null; } for (int col = 0; col < this.columns.length; col++) { Widget widget = (Widget) createCellWidget(col, o); if (this.columns[col].getWidgetStyleName() != null) { widget.addStyleName(this.columns[col].getWidgetStyleName()); } table.setWidget(row, col + startColumn, widget); if (this.columns[col].getStyleName() != null) { table.getCellFormatter().setStyleName(row, col + startColumn, this.columns[col].getStyleName()); } } if ((this.masks & BoundTableExt.END_ROW_BUTTON) > 0) { EndRowButton endRowButton = new EndRowButton(); table.setWidget(row, this.columns.length + startColumn, endRowButton); int f_row = row; endRowButton.addClickHandler(e -> { EndRowButtonClickedEvent.fire(FastROBoundTable.this, f_row, o); }); } boolean odd = (this.calculateRowToObjectOffset(new Integer(row)).intValue() % 2) != 0; this.table.getRowFormatter().setStyleName(row, odd ? "odd" : "even"); }
From source file:com.ait.toolkit.ace.examples.client.AceDemo.java
License:Open Source License
/** * This method builds the UI. It creates UI widgets that exercise most/all of the AceEditor methods, so it's a bit of a kitchen sink. *//* ww w . j a va2 s. c om*/ private void buildUI() { VerticalPanel mainPanel = new VerticalPanel(); mainPanel.setWidth("100%"); mainPanel.add(new Label("Label above!")); mainPanel.add(editor1); // Label to display current row/column rowColLabel = new InlineLabel(""); mainPanel.add(rowColLabel); // Create some buttons for testing various editor APIs HorizontalPanel buttonPanel = new HorizontalPanel(); // Add button to insert text at current cursor position Button insertTextButton = new Button("Insert"); insertTextButton.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { // Window.alert("Cursor at: " + editor1.getCursorPosition()); editor1.insertAtCursor("inserted text!"); } }); buttonPanel.add(insertTextButton); // Add check box to enable/disable soft tabs final CheckBox softTabsBox = new CheckBox("Soft tabs"); softTabsBox.setValue(true); // I think soft tabs is the default softTabsBox.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { editor1.setUseSoftTabs(softTabsBox.getValue()); } }); buttonPanel.add(softTabsBox); // add text box and button to set tab size final TextBox tabSizeTextBox = new TextBox(); tabSizeTextBox.setWidth("4em"); Button setTabSizeButton = new Button("Set tab size"); setTabSizeButton.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { editor1.setTabSize(Integer.parseInt(tabSizeTextBox.getText())); } }); buttonPanel.add(new InlineLabel("Tab size: ")); buttonPanel.add(tabSizeTextBox); buttonPanel.add(setTabSizeButton); // add text box and button to go to a given line final TextBox gotoLineTextBox = new TextBox(); gotoLineTextBox.setWidth("4em"); Button gotoLineButton = new Button("Go to line"); gotoLineButton.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { editor1.gotoLine(Integer.parseInt(gotoLineTextBox.getText())); } }); buttonPanel.add(new InlineLabel("Go to line: ")); buttonPanel.add(gotoLineTextBox); buttonPanel.add(gotoLineButton); // checkbox to set whether or not horizontal scrollbar is always visible final CheckBox hScrollBarAlwaysVisibleBox = new CheckBox("H scrollbar: "); hScrollBarAlwaysVisibleBox.setValue(true); hScrollBarAlwaysVisibleBox.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { editor1.setHScrollBarAlwaysVisible(hScrollBarAlwaysVisibleBox.getValue()); } }); buttonPanel.add(hScrollBarAlwaysVisibleBox); // checkbox to show/hide gutter final CheckBox showGutterBox = new CheckBox("Show gutter: "); showGutterBox.setValue(true); showGutterBox.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { editor1.setShowGutter(showGutterBox.getValue()); } }); buttonPanel.add(showGutterBox); // checkbox to set/unset readonly mode final CheckBox readOnlyBox = new CheckBox("Read only: "); readOnlyBox.setValue(false); readOnlyBox.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { editor1.setReadOnly(readOnlyBox.getValue()); } }); buttonPanel.add(readOnlyBox); // checkbox to show/hide print margin final CheckBox showPrintMarginBox = new CheckBox("Show print margin: "); showPrintMarginBox.setValue(true); showPrintMarginBox.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { editor1.setShowPrintMargin(showPrintMarginBox.getValue()); } }); buttonPanel.add(showPrintMarginBox); mainPanel.add(buttonPanel); mainPanel.add(editor2); mainPanel.add(new Label("Label below!")); RootPanel.get().add(mainPanel); }
From source file:com.calclab.emite.example.pingpong.client.PingPongWidget.java
License:Open Source License
public PingPongWidget() { maxOutput = 500;//from ww w .ja va 2 s . c om hideEvents = true; header = new VerticalPanel(); add(header); currentUser = new Label("no user yet."); sessionStatus = new Label("no session status yet."); final FlowPanel status = new FlowPanel(); status.add(currentUser); status.add(sessionStatus); add(status); login = new Button("Login"); logout = new Button("Logout"); clear = new Button("Clear"); final CheckBox hideEventsCheck = new CheckBox("Hide events"); buttons = new FlowPanel(); buttons.add(login); buttons.add(logout); buttons.add(clear); buttons.add(hideEventsCheck); add(buttons); output = new VerticalPanel(); add(output); hideEventsCheck.addValueChangeHandler(new ValueChangeHandler<Boolean>() { @Override public void onValueChange(final ValueChangeEvent<Boolean> event) { hideEvents = event.getValue(); final int widgetCount = output.getWidgetCount(); for (int index = 0; index < widgetCount; index++) { final Widget w = output.getWidget(index); if (isEventWidget(w)) { w.setVisible(!hideEvents); } } } }); hideEventsCheck.setValue(hideEvents); }
From source file:com.edgenius.wiki.gwt.client.user.ContactPanel.java
License:Open Source License
public void setUser(UserModel model) { //clean table first this.removeAllRows(); int row = 0;/* w ww . j a va2s.c o m*/ this.getColumnFormatter().setStyleName(0, Css.NOWRAP); this.getColumnFormatter().setWidth(0, "1%"); this.getColumnFormatter().setWidth(1, "98%"); this.getColumnFormatter().setWidth(2, "1%"); this.setCellPadding(3); this.setWidth("100%"); if (editing) { textboxList = new ArrayList<FormTextBox>(); checkboxList = new ArrayList<CheckBox>(); userUid = model.getUid(); fullname = new FormTextBox(); fullname.setName("user.fullname"); fullname.valid(Msg.consts.full_name(), true, 0, PersonalProfile.LOGIN_FULLNAME_LEN, null); fullname.setStyleName(Css.FORM_INPUT); fullname.setText(model.getFullname()); Label fullnameLabel = new Label(Msg.consts.full_name()); fullnameLabel.setStyleName(Css.FORM_LABEL); this.setWidget(row, 0, fullnameLabel); this.setWidget(row, 1, fullname); row++; } for (Entry<String, LinkedHashMap<String, String>> entry : model.getContacts().entrySet()) { LinkedHashMap<String, String> values = entry.getValue(); if (values == null || values.size() == 0) { //E.g., if user public profile page, "Contact" group is hidden, so its title won't display as well. continue; } Label cTitle = new Label(entry.getKey()); cTitle.setStyleName(Css.HEADING2); cTitle.addStyleName(Css.UNDERLINE); this.setWidget(row, 0, cTitle); this.getFlexCellFormatter().setColSpan(row, 0, editing ? 2 : 3); row++; //get linked flag - although we know only Twitter has linked attribute so far, we still use this common way for future. //see comments on UserUtil.copyUserContactToModel(); Map<String, Boolean> linked = new HashMap<String, Boolean>(); for (String key : values.keySet()) { if (key.endsWith("_linked")) { String name = key.substring(0, key.length() - 7); linked.put(name, BooleanUtil.toBoolean(values.get(key))); } } for (Entry<String, String> contact : values.entrySet()) { String name = contact.getKey(); if (name.endsWith("_linked")) { continue; } Label lb = new Label(name); lb.setStyleName(Css.FORM_LABEL); this.setWidget(row, 0, lb); if (editing) { //email FormTextBox text = new FormTextBox(); if (SharedConstants.USERSETTING_PROP_NAME_EMAIL.equalsIgnoreCase(name)) { email = text; text.valid(Msg.consts.email(), true, 0, PersonalProfile.LOGIN_EMAIL_LEN, this); } else { textboxList.add(text); } text.setName(name); text.setText(contact.getValue()); text.setStyleName(Css.FORM_INPUT); this.setWidget(row, 1, text); if (linked.containsKey(name)) { row++; CheckBox box = new CheckBox(Msg.consts.linked()); box.setName(name + "_linked"); box.setValue(linked.get(name)); this.setWidget(row, 1, box); checkboxList.add(box); } } else { if (contact.getValue() != null) { Label info = new Label(contact.getValue()); this.setWidget(row, 1, info); } else { //just a placeholder this.setWidget(row, 1, new Label(" ")); } if (linked.containsKey(name) && linked.get(name)) { //show linked image Image linkedImg = new Image(IconBundle.I.get().connect()); linkedImg.setTitle(Msg.consts.linked()); this.setWidget(row, 2, linkedImg); } else { //just a placeholder this.setWidget(row, 2, new Label(" ")); } } row++; } } }
From source file:com.ephesoft.dcma.gwt.admin.bm.client.view.batch.BatchClassView.java
License:Open Source License
/** * To set Document Type List./* w ww . j a v a 2 s. c o m*/ * * @param documentTypeDTOs Collection<DocumentTypeDTO> * @return List<Record> */ public List<Record> setDocumentTypeList(Collection<DocumentTypeDTO> documentTypeDTOs) { List<Record> recordList = new LinkedList<Record>(); for (final DocumentTypeDTO documentTypeDTO : documentTypeDTOs) { if (!documentTypeDTO.getName().equalsIgnoreCase(AdminConstants.DOCUMENT_TYPE_UNKNOWN)) { CheckBox isHidden = new CheckBox(); isHidden.setValue(documentTypeDTO.isHidden()); isHidden.setEnabled(false); Record record = new Record(documentTypeDTO.getIdentifier()); record.addWidget(docTypeListView.name, new Label(documentTypeDTO.getName())); record.addWidget(docTypeListView.description, new Label(documentTypeDTO.getDescription())); record.addWidget(docTypeListView.isHidden, isHidden); recordList.add(record); } } return recordList; }
From source file:com.ephesoft.dcma.gwt.admin.bm.client.view.batch.ImportBatchClassView.java
License:Open Source License
private void createUI(final boolean isMandatory, final CheckBox checkBox, final Node newNode, final TreeItem childTree) { if (newNode.getParent().getLabel().getKey().equals("BatchClassModules") || newNode.getLabel().getKey().equals("BatchClassModules")) { checkBox.setEnabled(Boolean.FALSE); checkBox.setValue(Boolean.TRUE); newNode.getLabel().setMandatory(Boolean.TRUE); } else {// w w w. j av a 2s .co m if (isMandatory) { checkBox.setEnabled(Boolean.TRUE); checkBox.setValue(Boolean.FALSE); } else { if (importExisting.getValue().equalsIgnoreCase(TRUE)) { checkBox.setEnabled(Boolean.TRUE); checkBox.setValue(Boolean.FALSE); newNode.getLabel().setMandatory(Boolean.FALSE); } else if (importExisting.getValue().equalsIgnoreCase(FALSE)) { checkBox.setEnabled(Boolean.FALSE); checkBox.setValue(Boolean.TRUE); newNode.getLabel().setMandatory(Boolean.TRUE); } } if (checkBox != null && checkBox.isEnabled()) { checkBox.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { boolean checked = ((CheckBox) event.getSource()).getValue(); newNode.getLabel().setMandatory(checked); setParentItemsUI(childTree.getParentItem(), checked, newNode); setChildItemsUI(childTree, checked, newNode); } }); } } }
From source file:com.ephesoft.dcma.gwt.admin.bm.client.view.batch.ImportBatchClassView.java
License:Open Source License
private void setParentItemsUI(TreeItem parentItem, boolean checked, Node childNode) { Node parentNode = childNode.getParent(); if (!checked && parentNode.getParent() != null) { CheckBox checkBox = (CheckBox) parentItem.getWidget(); if (checkBox.isEnabled()) { checkBox.setValue(checked); parentNode.getLabel().setMandatory(checked); }/*from w ww . j a va2 s . co m*/ setParentItemsUI(parentItem.getParentItem(), checked, parentNode); } }