List of usage examples for com.google.gwt.user.client.ui CheckBox getValue
@Override
public Boolean getValue()
From source file:org.gss_project.gss.admin.client.ui.PermissionsList.java
License:Open Source License
public void updatePermissionsAccordingToInput() { int i = 1;//from w w w .j a va2 s . c o m for (PermissionDTO dto : permissions) { /*if(dto.getId() == null) hasChanges =true;*/ CheckBox r = (CheckBox) permTable.getWidget(i, 1); CheckBox w = (CheckBox) permTable.getWidget(i, 2); CheckBox m = (CheckBox) permTable.getWidget(i, 3); if (dto.getRead() != r.getValue() || dto.getWrite() != w.getValue() || dto.getModifyACL() != m.getValue()) hasChanges = true; dto.setRead(r.getValue()); dto.setWrite(w.getValue()); dto.setModifyACL(m.getValue()); i++; } }
From source file:org.gss_project.gss.web.client.PermissionsList.java
License:Open Source License
public void updatePermissionsAccordingToInput() { int i = 1;//from w w w . j a v a 2 s.c o m for (PermissionHolder dto : permissions) { /*if(dto.getId() == null) hasChanges =true;*/ CheckBox r = (CheckBox) permTable.getWidget(i, 1); CheckBox w = (CheckBox) permTable.getWidget(i, 2); CheckBox m = (CheckBox) permTable.getWidget(i, 3); r.getElement().setId("permissionList.read"); w.getElement().setId("permissionList.write"); m.getElement().setId("permissionList.modify"); if (dto.isRead() != r.getValue() || dto.isWrite() != w.getValue() || dto.isModifyACL() != m.getValue()) hasChanges = true; dto.setRead(r.getValue()); dto.setWrite(w.getValue()); dto.setModifyACL(m.getValue()); i++; } }
From source file:org.gwtlib.samples.table.client.ui.PagingTableEntryPoint.java
License:Apache License
private Grid createGrid() { final Grid grid = new Grid(3, 1); final PagingTable table = createTable(); table.setSize("100%", "100%"); grid.setWidget(0, 0, table);//from www. j av a 2 s . co m grid.getRowFormatter().setVerticalAlign(0, HasVerticalAlignment.ALIGN_TOP); grid.getCellFormatter().setWidth(0, 0, "100%"); grid.getCellFormatter().setHeight(0, 0, "100%"); HorizontalPanel hpanel = new HorizontalPanel(); hpanel.add(new Label("Show Column:")); for (int i = 0; i < table.getColumnLayout().getTotalColumnCount(); ++i) { final CheckBox checkbox = new CheckBox(String.valueOf(i)); checkbox.setValue(true); hpanel.add(checkbox); final int ii = i; checkbox.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { table.show(ii, checkbox.getValue()); table.update(); } }); } grid.setWidget(1, 0, hpanel); hpanel = new HorizontalPanel(); hpanel.add(new Button("Clear", new ClickHandler() { public void onClick(ClickEvent event) { table.clear(); } })); hpanel.add(new Button("Reset", new ClickHandler() { public void onClick(ClickEvent event) { table.reset(); } })); hpanel.add(new Button("Simulate Failure", new ClickHandler() { public void onClick(ClickEvent event) { table.onFailure(null); } })); grid.setWidget(2, 0, hpanel); grid.setSize("100%", "100%"); return grid; }
From source file:org.gwtlib.samples.table.client.ui.PagingTableEntryPoint.java
License:Apache License
private PagingTable createTable() { // Set up the columns we want to be displayed final CheckBox checkAll = new CheckBox(); final Column[] columns = { new Column(0, false, checkAll, "20", new CheckBoxRenderer()), new Column(1, true, "Text (StringRenderer)", "10%"), new Column(2, false, "Date (StringRenderer)", "10%"), new Column(3, false, "Number (StringRenderer)", "10%"), new Column(4, true, "Date (DateTimeRenderer)", "10%", new DateTimeRenderer(DateTimeFormat.getFormat("yyyy-MM-dd"))), new Column(5, true, "Number (NumberRenderer)", "10%", new NumberRenderer(NumberFormat.getDecimalFormat())), new Column(6, false, "(ListBoxRenderer)", "10%", new ListBoxRenderer(new String[] { "One", "Two", "Three" }, "Select an item")), new Column(7, false, "(ButtonRenderer)", "10%", new ButtonRenderer("Click here")), new Column(8, false, "(TextBoxRenderer)", "10%", new TextBoxRenderer(50, 5, "Enter your message")), new Column(9, false, "(HyperlinkRenderer)", "10%", new HyperlinkRenderer("A Hyperlink")), new Column(10, false, "(ImageRenderer)", "10%", new ImageRenderer("An Image")), }; // Generate some semi-random data for our example final Row[] rows = new Row[TOTAL_SIZE]; for (int i = 0; i < rows.length; ++i) { Boolean check = new Boolean(false); StringBuffer label = new StringBuffer(); for (int j = 0; j < 25; ++j) label.append((char) ('a' + i)); Date date = new Date(NOW.getTime() + Random.nextInt(365 * 24 * 3600 * 1000)); Integer number = new Integer(Random.nextInt(10000)); rows[i] = new Row(i, new Object[] { check, label.toString(), date, number, date, number, "One", number.toString(), number.toString(), "Hyperlink", "img/down.gif" }); }/*from w w w .j a v a 2 s . c om*/ // Now configure the table ColumnLayout layout = new ColumnLayout(columns); final PagingTable table = new PagingTable(layout, new PagingBar(0, TOTAL_SIZE, 10, new int[] { 5, 10, 20, 50, 100 })); ContentProvider provider = new ContentProvider() { // Simulate retrieval of sample data, in requested sort order public void load(int begin, int end, final int sortId, boolean ascending) { final int sign = ascending ? 1 : -1; Row[] tmp = new Row[rows.length]; for (int i = 0; i < rows.length; ++i) tmp[i] = rows[i]; switch (sortId) { case 1: Arrays.sort(tmp, new Comparator<Row>() { public int compare(Row o1, Row o2) { String v1 = (String) o1.getValue(sortId); String v2 = (String) o2.getValue(sortId); return sign * (v1.compareTo(v2)); } }); break; case 4: Arrays.sort(tmp, new Comparator<Row>() { public int compare(Row o1, Row o2) { Date v1 = (Date) o1.getValue(sortId); Date v2 = (Date) o2.getValue(sortId); return sign * (v1.compareTo(v2)); } }); break; case 5: Arrays.sort(tmp, new Comparator<Row>() { public int compare(Row o1, Row o2) { int v1 = ((Integer) o1.getValue(sortId)).intValue(); int v2 = ((Integer) o2.getValue(sortId)).intValue(); return sign * (v1 < v2 ? -1 : (v1 == v2 ? 0 : 1)); } }); break; default: break; } Row[] srows = new Row[Math.min(end - begin, tmp.length - begin)]; for (int i = 0; i < srows.length; ++i) srows[i] = tmp[begin + i]; table.onSuccess(new Rows(srows, begin, sortId, ascending)); } }; table.setContentProvider(provider); table.addTableListener(new TableListenerAdapter() { public void onCellClicked(SourcesTableEvents sender, Row row, Column column) { for (int i = 0; i < columns.length; ++i) columns[i].setState(Column.State.NONE); column.setState(Column.State.SELECT); } public void onRowClicked(SourcesTableEvents sender, Row row) { GWT.log("Row clicked (id " + row.getId() + ")", null); for (int i = 0; i < rows.length; ++i) rows[i].setState(Row.State.NONE); row.setState(Row.State.SELECT); table.refreshRowState(); } public void onClick(SourcesTableEvents sender, Row row, Column column, Widget widget) { GWT.log("Renderer widget clicked", null); if (widget instanceof CheckBox) { row.setValue(0, new Boolean(((CheckBox) widget).getValue())); } else if (widget instanceof Button) { Window.alert(((Button) widget).getHTML()); } else if (widget instanceof Hyperlink) { Window.alert(((Hyperlink) widget).getHTML()); } else if (widget instanceof Image) { Window.alert(((Image) widget).getUrl()); } } public void onChange(SourcesTableEvents sender, Row row, Column column, Widget widget) { GWT.log("Renderer widget changed", null); if (widget instanceof ListBox) { ListBox listBox = (ListBox) widget; row.setValue(6, listBox.getValue(listBox.getSelectedIndex())); } else if (widget instanceof TextBox) { row.setValue(8, ((TextBox) widget).getText()); } } }); checkAll.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { for (int i = 0; i < rows.length; ++i) rows[i].setValue(0, new Boolean(checkAll.getValue())); table.update(); } }); table.update(); return table; }
From source file:org.gwtportlets.portlet.client.ui.MenuPortlet.java
License:Open Source License
public void configure() { final TextBox path = new TextBox(); path.setVisibleLength(30);// w w w . j av a 2 s . c om path.setTitle("Any content served from the web application " + "(JSP pages, static HTML etc.)"); path.setText(getPath()); final CheckBox vertical = new CheckBox("Vertical menu bar"); vertical.setTitle("Open first level sub menus to the right (true) or " + "below (false)"); vertical.setValue(isVertical()); FormBuilder b = new FormBuilder(); b.label("Menu template path").field(path).endRow(); b.field(vertical).colspan(2).endRow(); final Dialog dlg = new Dialog(); dlg.setText("Configure " + getWidgetName()); dlg.setWidget(b.getForm()); dlg.addButton(new CssButton("OK", new ClickHandler() { public void onClick(ClickEvent event) { dlg.hide(); setPath(path.getText().trim()); setVertical(vertical.getValue()); refresh(); } })); dlg.addCloseButton("Cancel"); dlg.showNextTo(this); }
From source file:org.jahia.ajax.gwt.client.widget.contentengine.ContentTabItem.java
License:Open Source License
/** * Get the list of checked languages checkboxes. * @return the list of checked languages checkboxes if they are available or * null if they are not present based on invalidLanguagesAvailableForTypes. *//*from w w w .j a va 2s. c om*/ public List<CheckBox> getCheckedLanguagesCheckBox() { List<CheckBox> values = new ArrayList<CheckBox>(); if (invalidLanguagesCheckBoxes != null) { for (CheckBox check : invalidLanguagesCheckBoxes) { if (check.getValue()) { values.add(check); } } return values; } return null; }
From source file:org.jboss.ci.tracker.client.widgets.CustomWidgets.java
License:Open Source License
public static DialogBox filterDialogBox(final ResultList resultList, List<CategorizationDto> categorizations, List<CategoryDto> categories, List<PossibleResultDto> possibleResults, FilterDto oldFilter) { final DialogBox box = new DialogBox(); final VerticalPanel panel = new VerticalPanel(); panel.setSize("20em", "20em"); box.setText("Filter results"); // ----------------------- Possible results final Label resultsLabel = new Label("Results"); panel.add(resultsLabel);/*from w w w . j a va 2s .com*/ for (PossibleResultDto possibleResult : possibleResults) { final CheckBox checkBox = new CheckBox(possibleResult.getName()); checkBox.setName(POSSIBLE_RESULT_SEPARATOR_PREFIX + possibleResult.getId().toString()); panel.add(checkBox); } // ----------------------- Categorizations and categories for (CategorizationDto categorization : categorizations) { final Label categorizationLabel = new Label(categorization.getName()); panel.add(categorizationLabel); for (CategoryDto category : categories) { if (category.getCategorizationId().equals(categorization.getId())) { final CheckBox checkBox = new CheckBox(category.getName()); checkBox.setName(CATEGORY_SEPARATOR_PREFIX + category.getId().toString()); panel.add(checkBox); } } } // ----------------------- Date from final DateTimeFormat dateTimeFormat = DateTimeFormat.getFormat("d.M.yyyy"); final DateBox dateBoxFrom = new DateBox(); dateBoxFrom.setFormat(new DateBox.DefaultFormat(dateTimeFormat)); dateBoxFrom.getDatePicker().setYearArrowsVisible(true); panel.add(new Label("From")); dateBoxFrom.setTitle("Midnight of the day, i.e. time 00:00"); panel.add(dateBoxFrom); // ----------------------- Date to final DateBox dateBoxTo = new DateBox(); dateBoxTo.setFormat(new DateBox.DefaultFormat(dateTimeFormat)); dateBoxTo.getDatePicker().setYearArrowsVisible(true); panel.add(new Label("To")); dateBoxTo.setTitle("Midnight of the day, i.e. time 00:00"); panel.add(dateBoxTo); // ----------------------- Set widgets according to filter setWidgetValues(panel, oldFilter, dateBoxFrom, dateBoxTo); // ----------------------- Filter button final Button buttonFilter = new Button("OK", new ClickHandler() { @Override public void onClick(final ClickEvent event) { FilterDto filter = new FilterDto(); Iterator<Widget> arrayOfWidgets = panel.iterator(); while (arrayOfWidgets.hasNext()) { Widget widget = arrayOfWidgets.next(); if (widget instanceof CheckBox) { CheckBox checkBox = (CheckBox) widget; if (checkBox.getValue()) { if (checkBox.getName().startsWith(CATEGORY_SEPARATOR_PREFIX)) { filter.addCategoryId(Integer.parseInt( checkBox.getName().substring(CATEGORY_SEPARATOR_PREFIX.length()))); } else if (checkBox.getName().startsWith(POSSIBLE_RESULT_SEPARATOR_PREFIX)) { filter.addPossibleResultId(Integer.parseInt( checkBox.getName().substring(POSSIBLE_RESULT_SEPARATOR_PREFIX.length()))); } } } } filter.setDateFrom(dateBoxFrom.getValue()); filter.setDateTo(dateBoxTo.getValue()); resultList.filterResults(filter); box.hide(); } }); buttonFilter.setWidth("5em"); panel.add(buttonFilter); panel.setCellHorizontalAlignment(buttonFilter, HasAlignment.ALIGN_RIGHT); // ----------------------- Show all results button final Button buttonShowAll = new Button("Clear", new ClickHandler() { @Override public void onClick(final ClickEvent event) { resultList.filterResults(null); box.hide(); } }); buttonShowAll.setWidth("5em"); panel.add(buttonShowAll); panel.setCellHorizontalAlignment(buttonShowAll, HasAlignment.ALIGN_RIGHT); // ----------------------- Cancel button final Button buttonCancel = new Button("Cancel", new ClickHandler() { @Override public void onClick(final ClickEvent event) { box.hide(); } }); buttonCancel.setWidth("5em"); panel.add(buttonCancel); panel.setCellHorizontalAlignment(buttonCancel, HasAlignment.ALIGN_RIGHT); box.add(panel); return box; }
From source file:org.jboss.errai.cdi.demo.mvp.client.local.view.ContactsView.java
License:Apache License
public List<Integer> getSelectedRows() { List<Integer> selectedRows = new ArrayList<Integer>(); for (int i = 0; i < contactsTable.getRowCount(); ++i) { CheckBox checkBox = (CheckBox) contactsTable.getWidget(i, 0); if (checkBox.getValue()) { selectedRows.add(i);// w w w.j a v a2 s . c o m } } return selectedRows; }
From source file:org.kie.guvnor.guided.dtable.client.widget.ActionInsertFactPopup.java
License:Apache License
private Widget doInsertLogical() { HorizontalPanel hp = new HorizontalPanel(); final CheckBox cb = new CheckBox(); cb.setValue(editingCol.isInsertLogical()); cb.setText(""); cb.setEnabled(!isReadOnly);// w w w . j a v a 2 s . c o m if (!isReadOnly) { cb.addClickHandler(new ClickHandler() { public void onClick(ClickEvent arg0) { if (oracle.isGlobalVariable(editingCol.getBoundName())) { cb.setEnabled(false); editingCol.setInsertLogical(false); } else { editingCol.setInsertLogical(cb.getValue()); } } }); } hp.add(cb); hp.add(new InfoPopup(Constants.INSTANCE.LogicallyInsertANewFact(), Constants.INSTANCE.LogicallyAssertAFactTheFactWillBeRetractedWhenTheSupportingEvidenceIsRemoved())); return hp; }
From source file:org.kie.guvnor.guided.dtable.client.widget.ActionSetFieldPopup.java
License:Apache License
private Widget doUpdate() { HorizontalPanel hp = new HorizontalPanel(); final CheckBox cb = new CheckBox(); cb.setValue(editingCol.isUpdate());// w w w .j av a 2s.c o m cb.setText(""); cb.setEnabled(!isReadOnly); if (!isReadOnly) { cb.addClickHandler(new ClickHandler() { public void onClick(ClickEvent arg0) { if (oracle.isGlobalVariable(editingCol.getBoundName())) { cb.setEnabled(false); editingCol.setUpdate(false); } else { editingCol.setUpdate(cb.getValue()); } } }); } hp.add(cb); hp.add(new InfoPopup(Constants.INSTANCE.UpdateFact(), Constants.INSTANCE.UpdateDescription())); return hp; }