List of usage examples for com.google.gwt.user.client.ui CheckBox getValue
@Override
public Boolean getValue()
From source file:asquare.gwt.tkdemo.client.demos.DebugPanel.java
License:Apache License
private Widget createCheckBoxes() { // can't use HashMap because it does not preserve order final ArrayList<EventToMask> eventToMask = new ArrayList<EventToMask>(); eventToMask.add(new EventToMask("onfocus", Event.ONFOCUS)); eventToMask.add(new EventToMask("onblur", Event.ONBLUR)); eventToMask.add(new EventToMask("onchange", Event.ONCHANGE)); eventToMask.add(new EventToMask("onkeydown", Event.ONKEYDOWN)); eventToMask.add(new EventToMask("onkeypress", Event.ONKEYPRESS)); eventToMask.add(new EventToMask("onkeyup", Event.ONKEYUP)); eventToMask.add(new EventToMask("onscroll", Event.ONSCROLL)); eventToMask.add(new EventToMask("onmousemove", Event.ONMOUSEMOVE)); eventToMask.add(new EventToMask("onmouseover", Event.ONMOUSEOVER)); eventToMask.add(new EventToMask("onmouseout", Event.ONMOUSEOUT)); eventToMask.add(new EventToMask("onmousedown", Event.ONMOUSEDOWN)); eventToMask.add(new EventToMask("onmouseup", Event.ONMOUSEUP)); eventToMask.add(new EventToMask("onclick", Event.ONCLICK)); eventToMask.add(new EventToMask("ondblclick", Event.ONDBLCLICK)); eventToMask.add(new EventToMask("onerror", Event.ONERROR)); ClickHandler checkBoxController = new ClickHandler() { public void onClick(ClickEvent event) { CheckBox cb = (CheckBox) event.getSource(); String eventText = cb.getText(); EventToMask mapping = null;//from w w w. j a va 2 s .c o m for (int i = 0, size = eventToMask.size(); i < size; i++) { EventToMask candidate = eventToMask.get(i); if (candidate.m_eventString.equals(eventText)) { mapping = candidate; break; } } int traceEventMask = m_eventListener.getEventMask(); if (cb.getValue()) { traceEventMask |= mapping.m_eventMask; } else { traceEventMask &= ~mapping.m_eventMask; } m_eventListener.setEventMask(traceEventMask); } }; ColumnPanel panel = new ColumnPanel(); for (int i = 0; i < eventToMask.size(); i++) { if (i == 0 || i == 7) { panel.addCell(); } EventToMask mapping = eventToMask.get(i); addCheckBox(panel, mapping.m_eventString, mapping.m_eventMask, checkBoxController); } return panel; }
From source file:burrito.client.widgets.panels.table.Table.java
License:Apache License
/** * Gets all selected rows//from w ww.j av a2 s. c o m * * @return */ public List<T> getSelectedRows() { List<T> result = new ArrayList<T>(); for (int row = 1; row < currentModel.size() + 1; row++) { CheckBox cb = (CheckBox) table.getWidget(row, 0); if (cb.getValue()) { result.add(currentModel.get(row - 1)); } } return result; }
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);/*ww w . j a v a 2s . 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:ch.heftix.mailxel.client.ChangeGTDCommand.java
License:Open Source License
public void execute() { popupPanel.hide();//from w w w . j av a 2 s. co m final StatusItem si = mailxelPanel.statusStart("updating categories on selected messages"); List<Integer> ids = new ArrayList<Integer>(); for (int i = 0; i < envelopes.size(); i++) { CheckBox cb = checkboxes.get(i); if (cb.getValue()) { Envelope env = envelopes.get(i); ids.add(env.id); } } mailxelService.updateCategories(ids, gtd, new AsyncCallback<Void>() { public void onFailure(Throwable caught) { si.error(caught); } public void onSuccess(Void result) { si.done(); } }); }
From source file:ch.heftix.mailxel.client.MarkAsDeletedCommand.java
License:Open Source License
public void execute() { popupPanel.hide();// w w w .jav a2 s . c o m final StatusItem si = mailxelPanel.statusStart("marking selected messages as deleted"); List<Integer> ids = new ArrayList<Integer>(); for (int i = 0; i < envelopes.size(); i++) { CheckBox cb = checkboxes.get(i); if (cb.getValue()) { Envelope env = envelopes.get(i); ids.add(env.id); } } mailxelService.markAsDeleted(ids, new AsyncCallback<Void>() { public void onFailure(Throwable caught) { si.error(caught); } public void onSuccess(Void result) { si.done(); } }); }
From source file:com.achow101.bittipaddr.client.bittipaddr.java
License:Open Source License
/** * This is the entry point method./*from w ww .ja v a2s .co m*/ */ public void onModuleLoad() { // Add textboxes TextBox unitLookupBox = new TextBox(); TextBox unitPassBox = new TextBox(); TextBox xpubBox = new TextBox(); xpubBox.setWidth("600"); TextArea addrsArea = new TextArea(); addrsArea.setWidth("300"); addrsArea.setHeight("300"); // Checkbox to enable editing with lookup CheckBox submitEdit = new CheckBox("Submit changes after clicking button"); CheckBox allowEdit = new CheckBox("Allow editing the unit"); // Add text elements HTML output = new HTML(); // Create Button Button submitBtn = new Button("Submit"); submitBtn.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { // Clear previous output output.setHTML(""); // Get entered data and some prelim checking String xpub = xpubBox.getText(); String pass = unitPassBox.getText(); String unit = unitLookupBox.getText(); String[] addrs = addrsArea.getText().split("\n"); if (!xpub.isEmpty() && !addrs[0].isEmpty() && unit.isEmpty() && pass.isEmpty()) { output.setHTML("<p style=\"color:red;\">Cannot set both xpub and a list of addresses</p>"); return; } // Send to server AddrReq req = new AddrReq(); if (!unit.isEmpty()) { req.setId(unit); req.setPassword(pass); req.setEditable(allowEdit.getValue()); if (edited) { if (xpub.isEmpty()) { output.setHTML( "<p style=\"color:red;\">Must have an xpub. Set as \"NONE\" (without quotes) if no xpub</p>"); return; } req.setEdited(); req.setAddresses(addrs); req.setXpub(xpub.isEmpty() ? "NONE" : xpub); } } else if (!xpub.isEmpty()) { req = new AddrReq(xpub); } else if (addrs.length != 0) { req = new AddrReq(addrs); } bittipaddrService.App.getInstance().addAddresses(req, new AddAddrAsyncCallback(output, xpubBox, addrsArea)); } }); // Add to html RootPanel.get("submitBtn").add(submitBtn); RootPanel.get("unitLookup").add(unitLookupBox); RootPanel.get("unitPass").add(unitPassBox); RootPanel.get("enterxpub").add(xpubBox); RootPanel.get("enterAddrList").add(addrsArea); RootPanel.get("completedReqOutput").add(output); RootPanel.get("edit").add(submitEdit); RootPanel.get("allowEdit").add(allowEdit); }
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. *//*from w w w . j a va 2s .c o m*/ 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.areahomeschoolers.baconbits.client.widgets.UserAgreementDialog.java
License:Open Source License
@Override public void show() { if (vp.getWidgetCount() > 0) { super.show(); return;/*w ww . j ava 2 s. c o m*/ } String msg = "Hello,<br><br>Our site policies have changed. To continue using our site, please review them, then check the box below and continue on to your privacy settings."; HTML h = new HTML(msg); h.addStyleName("mediumText heavyPadding"); vp.add(h); String txt = "I agree to the site "; txt += "<a href=\"" + Constants.TOS_URL + "&noTitle=true\" target=\"_blank\">terms of service</a> "; txt += "and <a href=\"" + Constants.PRIVACY_POLICY_URL + "&noTitle=true\" target=\"_blank\">privacy policy</a> "; final CheckBox scb = new CheckBox(txt, true); scb.addStyleName("heavyPadding"); vp.add(scb); ButtonPanel bp = new ButtonPanel(); final Button settings = new Button("Continue to Privacy Settings"); settings.setEnabled(false); settings.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { if (!scb.getValue()) { scb.addStyleName("gwt-TextBoxError"); return; } settings.setEnabled(false); User u = Application.getCurrentUser(); u.setShowUserAgreement(false); u.setDirectoryOptOut(false); // this will ensure that the kids settings are synchronized with the parent's userService.savePrivacyPreference(u.getPrivacyPreference(PrivacyPreferenceType.FAMILY), new Callback<PrivacyPreference>() { @Override protected void doOnSuccess(PrivacyPreference result) { } }); userService.save(u, new Callback<ServerResponseData<User>>() { @Override protected void doOnSuccess(ServerResponseData<User> result) { } }); } }); bp.addCenterButton(settings); scb.addValueChangeHandler(new ValueChangeHandler<Boolean>() { @Override public void onValueChange(ValueChangeEvent<Boolean> event) { settings.setEnabled(event.getValue()); } }); vp.add(bp); UserAgreementDialog.super.show(); Scheduler.get().scheduleDeferred(new ScheduledCommand() { @Override public void execute() { UserAgreementDialog.super.center(); } }); }
From source file:com.databasepreservation.visualization.client.common.search.SearchFieldPanel.java
private boolean valid(CheckBox input) { return input.getValue(); }
From source file:com.edgenius.wiki.gwt.client.user.ContactPanel.java
License:Open Source License
/** * Only valid at editing mode// www . jav a2s. co m * @return */ public UserModel getUserModel() { UserModel user = new UserModel(); user.setUid(userUid); user.setFullname(fullname.getText()); user.setEmail(email.getText()); LinkedHashMap<String, LinkedHashMap<String, String>> contacts = new LinkedHashMap<String, LinkedHashMap<String, String>>(); //group doesn't matter when send back to server. just create a dummy one LinkedHashMap<String, String> group = new LinkedHashMap<String, String>(); contacts.put("dummy", group); user.setContacts(contacts); for (CheckBox box : checkboxList) { group.put(box.getName(), box.getValue().toString()); } for (FormTextBox box : textboxList) { group.put(box.getName(), box.getText()); } return user; }