List of usage examples for com.google.gwt.user.client.ui CheckBox getText
@Override
public String getText()
From source file:asquare.gwt.tk.demo.client.DebugPanel.java
License:Apache License
private Widget createCheckBoxes() { // can't use HashMap because it does not preserve order final Vector eventToMask = new Vector(); 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)); ClickListener checkBoxController = new ClickListener() { public void onClick(Widget sender) { CheckBox cb = (CheckBox) sender; EventToMask mapping = (EventToMask) eventToMask.get(eventToMask.indexOf(cb.getText())); int traceEventMask = m_eventListener.getEventMask(); if (cb.isChecked()) { traceEventMask |= mapping.m_mask; } else { traceEventMask &= ~mapping.m_mask; }// ww w .ja v a 2 s . co m m_eventListener.setEventMask(traceEventMask); } }; FlowPanel panel = new FlowPanel(); for (int i = 0; i < eventToMask.size(); i++) { EventToMask mapping = (EventToMask) eventToMask.get(i); addCheckBox(panel, mapping.m_event, mapping.m_mask, checkBoxController); } return panel; }
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 ww w .java 2s .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:com.edgenius.wiki.gwt.client.user.ContactPanel.java
License:Open Source License
/** * Only valid at editing mode/*w w w .j a v a 2s . c om*/ * @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; }
From source file:edu.colorado.csdms.wmt.client.ui.menu.LabelsOpenModelMenu.java
License:Open Source License
/** * Makes an ArrayList of label ids that are selected in the labelPanel. * /*w w w .j a v a 2 s . c om*/ * Note: If the "public" or username labels are not selected, then clear the * list of ids, regardless of whether other labels are selected; i.e., either * the "public" or username label must be selected. */ private void makeSelectedLabelIdsList() { selectedLabelIds.clear(); Boolean isPublicOrUserLabelSelected = false; for (int i = 0; i < labelPanel.getWidgetCount(); i++) { CheckBox labelBox = (CheckBox) labelPanel.getWidget(i); if (labelBox.getValue()) { if (labelBox.getText().matches("public") || labelBox.getText().matches(data.security.getWmtUsername())) { isPublicOrUserLabelSelected = true; } LabelJSO jso = data.modelLabels.get(labelBox.getText()); selectedLabelIds.add(jso.getId()); } } if (!isPublicOrUserLabelSelected) { selectedLabelIds.clear(); } }
From source file:es.upm.fi.dia.oeg.map4rdf.client.widget.FacetWidget.java
License:Open Source License
private List<CheckBox> getSortedSelections() { List<CheckBox> sortedList = new ArrayList<CheckBox>(selectionOptions.values()); Collections.sort(sortedList, new Comparator<CheckBox>() { @Override//from w w w . java 2 s .c o m public int compare(CheckBox o1, CheckBox o2) { return o1.getText().compareTo(o2.getText()); } }); return sortedList; }
From source file:gov.nih.nci.ncicb.tcgaportal.level4.gwt.anomalysearch.client.results.ResultsTable.java
protected String makeListFromCheckedRows() { StringBuilder ret = new StringBuilder(); for (int irow = 0, max = results.getActualRowCount(); irow < max; irow++) { Widget w = getWidget(irow + 1, 0); if (w instanceof CheckBox) { CheckBox tableItem = (CheckBox) w; if (tableItem.isChecked()) { if (ret.length() != 0) { ret.append(", "); }/*from w ww. j a va2s. c om*/ ret.append(tableItem.getText()); tableItem.setChecked(false); } } } //and the top check box Widget w = getWidget(0, 0); if (w instanceof SortingLinkWithCheckbox) { ((SortingLinkWithCheckbox) w).setChecked(false); } return ret.toString(); }
From source file:org.ednovo.gooru.client.mvp.home.SearchHomeFilterVc.java
License:Open Source License
/** * Get selected filters//from w w w . j av a2s . com * @param filterFlowPanel to get selected filters * @return selected filter name as string */ private String getSelectedFilter(FlowPanel filterFlowPanel) { String selectedFilter = ""; for (Widget filterWidget : filterFlowPanel) { if (filterWidget instanceof CheckBox) { CheckBox filterCheckBox = (CheckBox) filterWidget; if (filterCheckBox != null && filterCheckBox.getValue()) { if (!selectedFilter.isEmpty()) { selectedFilter += ","; } selectedFilter += filterCheckBox.getText(); } } } return selectedFilter; }
From source file:org.freemedsoftware.gwt.client.screen.ACLScreen.java
License:Open Source License
public HashMap<String, List> populateAllPermissions() { HashMap<String, List> allPermiHashMap = new HashMap<String, List>(); final Iterator<String> aclPermissionsMapItr = aclPermissionsMap.keySet().iterator(); int permissionAddedCounter = 0; while (aclPermissionsMapItr.hasNext()) { String sectionWithValue = aclPermissionsMapItr.next(); CheckBox checkBox = aclPermissionsMap.get(sectionWithValue); if (checkBox.getValue()) { String section = sectionWithValue.substring(0, sectionWithValue.indexOf(":")); List sectionValues = allPermiHashMap.get(section); if (sectionValues == null) sectionValues = new ArrayList(); sectionValues.add(checkBox.getText()); allPermiHashMap.put(section, sectionValues); permissionAddedCounter++;//from w w w. ja v a 2s . com } } return allPermiHashMap; }
From source file:org.freemedsoftware.gwt.client.screen.ModuleFieldCheckerTypeEntryScreen.java
License:Open Source License
public String getFields() { String selectedModuleFields = ""; for (int i = 0; i < fieldsList.size(); i++) { CheckBox ch = fieldsList.get(i); if (ch.getValue()) selectedModuleFields += ch.getText() + ","; }// ww w.jav a2 s . c o m return selectedModuleFields; }
From source file:org.onesocialweb.gwt.client.ui.widget.ListSelector.java
License:Apache License
public void addCheckbox(String list, Boolean value) { final CheckBox checkbox = new CheckBox(list); StyledFlowPanel fix = new StyledFlowPanel("fix"); checkbox.addStyleName("checkbox"); // manage checks and unchecks checkbox.addValueChangeHandler(new ValueChangeHandler<Boolean>() { @Override/*from www.j av a 2 s. c o m*/ public void onValueChange(ValueChangeEvent<Boolean> event) { // is the item is checked? if (event.getValue() == true && !listed.contains(checkbox.getText()) && checkbox.getText() != null && checkbox.getText().length() != 0) { // set the values listed.add(checkbox.getText()); rosterItem.setGroups(listed); // disable during processing checkbox.setEnabled(false); // show task final DefaultTaskInfo task = new DefaultTaskInfo("Adding person to the list", false); TaskMonitor.getInstance().addTask(task); // save new state rosterItem.save(new RequestCallback<RosterItem>() { @Override public void onFailure() { // return to original state and notify user checkbox.setEnabled(true); checkbox.setValue(true); task.complete("Could not add person to list.", Status.failure); } @Override public void onSuccess(RosterItem result) { // enable the checkbox again checkbox.setEnabled(true); task.complete("", Status.succes); } }); } else if (event.getValue() == false && listed.contains(checkbox.getText())) { // set the values listed.remove(checkbox.getText()); rosterItem.setGroups(listed); // disable during processing checkbox.setEnabled(false); // show task final DefaultTaskInfo task = new DefaultTaskInfo("Removing person from the list", false); TaskMonitor.getInstance().addTask(task); // save new state rosterItem.save(new RequestCallback<RosterItem>() { @Override public void onFailure() { // return to original state and notify user checkbox.setEnabled(true); checkbox.setValue(true); task.complete("Could not remove person from the list.", Status.failure); } @Override public void onSuccess(RosterItem result) { // enable the checkbox again checkbox.setEnabled(true); task.complete("", Status.succes); } }); } } }); // if this person is already on the list make sure the checkbox is // checked if (listed != null && list.length() > 0 && listed.contains(list)) { checkbox.setValue(true); } else if (value == true) { // if a new checkbox is added automatically check it and fire a // change event checkbox.setValue(true); checkbox.fireEvent(new ValueChangeEvent<Boolean>(true) { }); } if (checkbox.getText() != null && checkbox.getText().length() != 0) { wrapper.add(checkbox); wrapper.add(fix); } }