Example usage for com.google.gwt.user.client.ui CheckBox getValue

List of usage examples for com.google.gwt.user.client.ui CheckBox getValue

Introduction

In this page you can find the example usage for com.google.gwt.user.client.ui CheckBox getValue.

Prototype

@Override
public Boolean getValue() 

Source Link

Document

Determines whether this check box is currently checked.

Usage

From source file:org.openxdata.designer.client.widget.skiprule.ValueWidget.java

public void onClose(CloseEvent<PopupPanel> event) {
    String value = "";
    VerticalPanel panel = (VerticalPanel) popup.getWidget();
    int count = panel.getWidgetCount();
    for (int i = 0; i < count; i++) {
        CheckBox checkbox = (CheckBox) panel.getWidget(i);
        if (checkbox.getValue() == true) {
            if (value.length() > 0)
                value += LIST_SEPARATOR;
            value += checkbox.getText();
        }/*from ww  w  .  ja v a2s  .  co m*/
    }
    if (value.length() == 0)
        value = EMPTY_VALUE;
    valueAnchor.setText(value);
}

From source file:org.openxdata.querybuilder.client.widget.ValueWidget.java

public void onClose(CloseEvent<PopupPanel> event) {
    String value = "";
    VerticalPanel panel = (VerticalPanel) popup.getWidget();
    int count = panel.getWidgetCount();
    for (int i = 0; i < count; i++) {
        CheckBox checkbox = (CheckBox) panel.getWidget(i);
        if (checkbox.getValue() == true) {
            if (value.length() > 0)
                value += LIST_SEPARATOR;
            value += checkbox.getText();
        }//ww  w.j  av  a 2 s  .com
    }
    if (value.length() == 0)
        value = EMPTY_VALUE;
    valueHyperlink.setText(value);
}

From source file:org.otalo.ao.client.search.AuthorFilterCriteria.java

License:Apache License

@Override
public void onClick(ClickEvent event) {
    CheckBox sender = (CheckBox) event.getSource();
    if (AoAPI.SearchConstants.AuthorConstants.ANY.equalsIgnoreCase(sender.getName())) {
        //if its any then first disable all others and removing all of them from selected status queue
        setResetAny();/*  ww  w  .j  av a  2  s. co m*/
        selectedFieldsQuery.clear();
    } else {
        if (sender.getValue())
            selectedFieldsQuery.add(sender.getName());
        else
            selectedFieldsQuery.remove(sender.getName());
    }
}

From source file:org.otalo.ao.client.search.MsgStatusFilterCriteria.java

License:Apache License

@Override
public void onClick(ClickEvent event) {
    CheckBox sender = (CheckBox) event.getSource();
    if (AoAPI.SearchConstants.StausConstants.STATUS_ANY.equalsIgnoreCase(sender.getName())) {
        //if its any then first disable all others and removing all of them from selected status queue
        setResetAny();//ww  w.  jav  a2  s  .c o  m
        selectedStatusQuery.clear();
    } else {
        if (sender.getValue())
            selectedStatusQuery.add(sender.getName());
        else
            selectedStatusQuery.remove(sender.getName());
    }
}

From source file:org.pentaho.mantle.client.solutionbrowser.fileproperties.GeneralPanel.java

License:Open Source License

/**
 * Accept metadata response object and parse for use in General panel
 * /*from  w  ww.j a v a2  s.  c  o  m*/
 * @param response
 */
protected void setMetadataResponse(Response response) {
    JSONObject json = (JSONObject) JSONParser.parseLenient(response.getText());
    if (json != null) {
        JSONArray arr = (JSONArray) json.get("stringKeyStringValueDto");
        for (int i = 0; i < arr.size(); i++) {
            JSONValue arrVal = arr.get(i);
            String key = arrVal.isObject().get("key").isString().stringValue();
            if (key != null && SolutionBrowserPanel.getInstance().isAdministrator()) {
                if (key.equals(org.pentaho.platform.api.repository2.unified.RepositoryFile.SCHEDULABLE_KEY)
                        && !fileSummary.isFolder()
                        || key.equals(org.pentaho.platform.api.repository2.unified.RepositoryFile.HIDDEN_KEY)) {
                    String value = arrVal.isObject().get("value").isString().stringValue();
                    if (key.startsWith(METADATA_PERM_PREFIX)) {
                        JSONObject nv = new JSONObject();
                        nv.put(key, new JSONString(value));
                        metadataPerms.add(nv);
                    }
                }
            }
        }
        for (final JSONObject nv : metadataPerms) {
            Set<String> keys = nv.keySet();
            for (final String key : keys) {
                if (key != null && SolutionBrowserPanel.getInstance().isAdministrator()) {
                    if (key.equals(org.pentaho.platform.api.repository2.unified.RepositoryFile.SCHEDULABLE_KEY)
                            && !fileSummary.isFolder()
                            || key.equals(
                                    org.pentaho.platform.api.repository2.unified.RepositoryFile.HIDDEN_KEY)) {
                        final CheckBox cb = new CheckBox(
                                Messages.getString(key.substring(METADATA_PERM_PREFIX.length()).toLowerCase()));
                        cb.setWordWrap(false);
                        cb.setValue(Boolean.parseBoolean(nv.get(key).isString().stringValue()));
                        cb.addClickHandler(new ClickHandler() {
                            @Override
                            public void onClick(ClickEvent event) {
                                dirty = true;
                                nv.put(key, new JSONString(cb.getValue().toString()));
                            }
                        });
                        metadataPermsPanel.add(cb);
                    }
                }
            }
        }
    }
}

From source file:org.pepstock.jem.gwt.client.panels.resources.inspector.widgets.CheckBoxesFieldPanel.java

License:Open Source License

@Override
public boolean checkMandatory() {
    if (getDescriptor().isMandatory()) {
        for (CheckBox cb : checkBoxes) {
            if (cb.getValue()) {
                return true;
            }//from  ww w.  j  a v  a 2 s . c o m
        }
        return false;
    }
    return true;
}

From source file:org.pepstock.jem.gwt.client.panels.resources.inspector.widgets.CheckBoxesFieldPanel.java

License:Open Source License

@Override
public String[] getSelectedValue() {
    Set<String> selected = new HashSet<String>();
    for (CheckBox cb : checkBoxes) {
        if (cb.getValue()) {
            selected.add(cb.getText());/*from  w ww  .  j a  v  a  2s .  com*/
        }
    }
    return selected.toArray(new String[0]);
}

From source file:org.roda.wui.client.process.CreateDefaultJob.java

public void configurePlugins() {
    List<String> categoriesOnListBox = new ArrayList<>();

    if (plugins != null) {
        PluginUtils.sortByName(plugins);

        for (int p = 0; p < plugins.size(); p++) {
            PluginInfo pluginInfo = plugins.get(p);

            if (pluginInfo != null) {
                List<String> pluginCategories = pluginInfo.getCategories();

                if (pluginCategories != null
                        && !pluginCategories.contains(RodaConstants.PLUGIN_CATEGORY_NOT_LISTABLE)) {
                    for (String category : pluginCategories) {
                        if (!categoriesOnListBox.contains(category)) {

                            CheckBox box = new CheckBox();
                            box.setText(messages.showPluginCategories(category));
                            box.setName(category);
                            box.addStyleName("form-checkbox-job");

                            box.addValueChangeHandler(new ValueChangeHandler<Boolean>() {

                                @Override
                                public void onValueChange(ValueChangeEvent<Boolean> event) {
                                    workflowList.clear();
                                    boolean noChecks = true;

                                    if (plugins != null) {
                                        PluginUtils.sortByName(plugins);
                                        List<String> pluginsAdded = new ArrayList<>();

                                        for (int p = 0; p < plugins.size(); p++) {
                                            PluginInfo pluginInfo = plugins.get(p);
                                            if (pluginInfo != null) {
                                                List<String> categories = pluginInfo.getCategories();

                                                if (categories != null) {
                                                    for (int i = 0; i < workflowCategoryList
                                                            .getWidgetCount(); i++) {
                                                        CheckBox checkbox = (CheckBox) workflowCategoryList
                                                                .getWidget(i);

                                                        if (checkbox.getValue().booleanValue()) {
                                                            noChecks = false;

                                                            if (categories.contains(checkbox.getName())
                                                                    && !categories.contains(
                                                                            RodaConstants.PLUGIN_CATEGORY_NOT_LISTABLE)
                                                                    && !pluginsAdded
                                                                            .contains(pluginInfo.getId())) {
                                                                Widget pluginItem = addPluginItemWidgetToWorkflowList(
                                                                        pluginInfo);
                                                                if (pluginsAdded.isEmpty()) {
                                                                    CreateDefaultJob.this.selectedPlugin = lookupPlugin(
                                                                            pluginInfo.getId());
                                                                    pluginItem.addStyleName(
                                                                            "plugin-list-item-selected");
                                                                }
                                                                pluginsAdded.add(pluginInfo.getId());
                                                            }
                                                        }
                                                    }

                                                    if (noChecks) {
                                                        if (!pluginInfo.getCategories().contains(
                                                                RodaConstants.PLUGIN_CATEGORY_NOT_LISTABLE)) {
                                                            Widget pluginItem = addPluginItemWidgetToWorkflowList(
                                                                    pluginInfo);
                                                            if (p == 0) {
                                                                CreateDefaultJob.this.selectedPlugin = lookupPlugin(
                                                                        pluginInfo.getId());
                                                                pluginItem.addStyleName(
                                                                        "plugin-list-item-selected");
                                                            }
                                                        }
                                                    }
                                                }
                                            }
                                        }
                                    }/*from w w w  . j a v  a2  s  .  co  m*/

                                    updateWorkflowOptions();
                                }
                            });

                            workflowCategoryList.add(box);
                            categoriesOnListBox.add(category);
                        }
                    }

                    if (!pluginCategories.contains(RodaConstants.PLUGIN_CATEGORY_NOT_LISTABLE)) {
                        Widget pluginItem = addPluginItemWidgetToWorkflowList(pluginInfo);
                        if (p == 0) {
                            CreateDefaultJob.this.selectedPlugin = lookupPlugin(pluginInfo.getId());
                            pluginItem.addStyleName("plugin-list-item-selected");
                        }
                    }
                }

            }
        }

        updateWorkflowOptions();
    }
}

From source file:org.roda.wui.client.process.CreateSelectedJob.java

public void configurePlugins(final String selectedClass) {
    List<String> categoriesOnListBox = new ArrayList<>();

    if (plugins != null) {
        PluginUtils.sortByName(plugins);

        int pluginAdded = 0;
        for (PluginInfo pluginInfo : plugins) {

            if (pluginInfo != null) {
                List<String> pluginCategories = pluginInfo.getCategories();

                if (pluginCategories != null) {
                    for (String category : pluginCategories) {
                        if (!categoriesOnListBox.contains(category)
                                && !category.equals(RodaConstants.PLUGIN_CATEGORY_NOT_LISTABLE)
                                && ((!isSelectedEmpty() && pluginInfo.hasObjectClass(selectedClass))
                                        || (isSelectedEmpty()
                                                && pluginInfo.hasObjectClass(listSelectedClass)))) {

                            CheckBox box = new CheckBox();
                            box.setText(messages.showPluginCategories(category));
                            box.setName(category);
                            box.addStyleName("form-checkbox-job");

                            box.addValueChangeHandler(new ValueChangeHandler<Boolean>() {

                                @Override
                                public void onValueChange(ValueChangeEvent<Boolean> event) {
                                    workflowList.clear();
                                    boolean noChecks = true;

                                    if (plugins != null) {
                                        PluginUtils.sortByName(plugins);
                                        List<String> pluginsAdded = new ArrayList<>();

                                        for (PluginInfo pluginInfo : plugins) {
                                            if (pluginInfo != null) {
                                                List<String> categories = pluginInfo.getCategories();

                                                if (categories != null) {
                                                    for (int i = 0; i < workflowCategoryList
                                                            .getWidgetCount(); i++) {
                                                        CheckBox checkbox = (CheckBox) workflowCategoryList
                                                                .getWidget(i);

                                                        if (checkbox.getValue()) {
                                                            noChecks = false;

                                                            if (categories.contains(checkbox.getName())
                                                                    && !categories.contains(
                                                                            RodaConstants.PLUGIN_CATEGORY_NOT_LISTABLE)
                                                                    && ((!isSelectedEmpty() && pluginInfo
                                                                            .hasObjectClass(selectedClass))
                                                                            || (isSelectedEmpty() && pluginInfo
                                                                                    .hasObjectClass(
                                                                                            listSelectedClass)))
                                                                    && !pluginsAdded
                                                                            .contains(pluginInfo.getId())) {
                                                                Widget pluginItem = addPluginItemWidgetToWorkflowList(
                                                                        pluginInfo);

                                                                if (pluginsAdded.isEmpty()) {
                                                                    CreateSelectedJob.this.selectedPlugin = lookupPlugin(
                                                                            pluginInfo.getId());
                                                                    pluginItem.addStyleName(
                                                                            "plugin-list-item-selected");
                                                                }

                                                                pluginsAdded.add(pluginInfo.getId());
                                                            }

                                                        }
                                                    }

                                                    if (noChecks) {
                                                        if (!pluginInfo.getCategories().contains(
                                                                RodaConstants.PLUGIN_CATEGORY_NOT_LISTABLE)
                                                                && ((!isSelectedEmpty() && pluginInfo
                                                                        .hasObjectClass(selectedClass))
                                                                        || (isSelectedEmpty()
                                                                                && pluginInfo.hasObjectClass(
                                                                                        listSelectedClass)))) {
                                                            Widget pluginItem = addPluginItemWidgetToWorkflowList(
                                                                    pluginInfo);
                                                            if (pluginsAdded.isEmpty()) {
                                                                CreateSelectedJob.this.selectedPlugin = lookupPlugin(
                                                                        pluginInfo.getId());
                                                                pluginItem.addStyleName(
                                                                        "plugin-list-item-selected");
                                                            }

                                                            pluginsAdded.add(pluginInfo.getId());
                                                        }
                                                    }
                                                }
                                            }
                                        }
                                    }/* w w w  .  j a va 2  s  .c o  m*/

                                    updateWorkflowOptions();
                                }

                            });

                            workflowCategoryList.add(box);
                            categoriesOnListBox.add(category);
                        }
                    }

                    if (!pluginCategories.contains(RodaConstants.PLUGIN_CATEGORY_NOT_LISTABLE)
                            && ((!isSelectedEmpty() && pluginInfo.hasObjectClass(selectedClass))
                                    || (isSelectedEmpty() && pluginInfo.hasObjectClass(listSelectedClass)))) {
                        Widget pluginItem = addPluginItemWidgetToWorkflowList(pluginInfo);
                        if (pluginAdded == 0) {
                            CreateSelectedJob.this.selectedPlugin = lookupPlugin(pluginInfo.getId());
                            pluginItem.addStyleName("plugin-list-item-selected");
                            pluginAdded++;
                        }
                    }
                }

            }
        }

        updateWorkflowOptions();
    }
}

From source file:org.rstudio.core.client.widget.CheckboxLabel.java

License:Open Source License

public CheckboxLabel(final CheckBox checkbox, String label) {
    label_ = new Label(label);

    label_.getElement().getStyle().setCursor(Cursor.DEFAULT);
    label_.addClickHandler(new ClickHandler() {
        @Override//w  w w  .ja v  a 2s.c  o  m
        public void onClick(ClickEvent event) {
            event.preventDefault();

            checkbox.setValue(!checkbox.getValue(), true);
        }
    });
}