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.bonitasoft.console.client.view.identity.RolesListEditorView.java

License:Open Source License

private Widget buildSelectAllSelector() {
    final CheckBox theSelectAllCheckBox = new CheckBox();
    theSelectAllCheckBox.addClickHandler(new ClickHandler() {

        public void onClick(ClickEvent aEvent) {
            if (aEvent.getSource() instanceof CheckBox) {
                CheckBox theCheckBox = (CheckBox) aEvent.getSource();
                selectAllRows(theCheckBox.getValue());
                aEvent.stopPropagation();
            }/*from ww  w  . j av a  2 s.c  o m*/
        }
    });
    final CustomMenuBar theSelector = new CustomMenuBar();
    theSelector.addItem(theSelectAllCheckBox, new Command() {
        public void execute() {
            boolean theNewValue = !theSelectAllCheckBox.getValue();
            theSelectAllCheckBox.setValue(theNewValue, true);
            selectAllRows(theNewValue);
        }
    });
    return theSelector;
}

From source file:org.bonitasoft.console.client.view.identity.UserMembershipsEditorPanel.java

License:Open Source License

/**
 * @param row//from   w  w w . jav  a 2  s  .  co m
 */
private Widget buildItemSelector(final int row) {
    final CheckBox theSelectItemCheckBox = new CheckBox();
    theSelectItemCheckBox.addClickHandler(new ClickHandler() {

        public void onClick(ClickEvent aEvent) {
            if (aEvent.getSource() instanceof CheckBox) {
                CheckBox theCheckBox = (CheckBox) aEvent.getSource();
                if (theCheckBox.getValue()) {
                    myMembershipRowSelection.add(row);
                } else {
                    myMembershipRowSelection.remove(row);
                }
            }
        }
    });
    return theSelectItemCheckBox;
}

From source file:org.bonitasoft.console.client.view.identity.UserMembershipsEditorPanel.java

License:Open Source License

private Widget buildSelectAllSelector() {
    final CheckBox theSelectAllCheckBox = new CheckBox();
    theSelectAllCheckBox.addClickHandler(new ClickHandler() {

        public void onClick(ClickEvent aEvent) {
            if (aEvent.getSource() instanceof CheckBox) {
                CheckBox theCheckBox = (CheckBox) aEvent.getSource();
                selectAllRows(theCheckBox.getValue());
            }/*from  ww w. ja  v  a 2s  .  c o  m*/

        }
    });
    return theSelectAllCheckBox;
}

From source file:org.bonitasoft.console.client.view.processes.AdminProcessMenuBarWidget.java

License:Open Source License

/**
 * Default constructor./*w  w  w. j a  va2s .  c om*/
 * 
 * @param aProcessDataSource
 * @param aProcessSelection
 * @param aPosition
 */
public AdminProcessMenuBarWidget(final MessageDataSource aMessageDataSource,
        ProcessDataSource aProcessDataSource, ProcessSelection aProcessSelection) {
    super();
    myMessageDataSource = aMessageDataSource;
    myProcessDataSource = aProcessDataSource;
    myProcessSelection = aProcessSelection;

    // Create the Selector Widget
    myItemSelector = new ProcessSelectorWidget(myProcessDataSource);

    final UserRightsManager theUserRightsManager = UserRightsManager.getInstance();
    if (theUserRightsManager.isAdmin() || theUserRightsManager.isAllowed(RuleType.PROCESS_INSTALL)) {
        myDirectActionMenu.addItem(constants.install(), new Command() {
            public void execute() {
                showInstallPopup();
            }
        });
    }
    MenuChoicesPanel theSubMenu = new MenuChoicesPanel();
    myOpenProcessDesignActionLink = theSubMenu.new MenuChoice(new Label(OPEN_DESIGN_BUTTON_TITLE),
            new Command() {
                public void execute() {
                    displayDesignOfSelectedProcesses();
                }
            });

    myDeleteAllInstancesActionLink = theSubMenu.new MenuChoice(new HTML(DELETE_ALL_INSTANCES_TITLE),
            new Command() {
                public void execute() {
                    //add a ConfirmationDialogbox when you delete processes cases.
                    if (myProcessSelection.getSize() > 0) {
                        confirmationDialogbox = new ConfirmationDialogbox(
                                constants.deleteProcessesCasesDialogbox(),
                                patterns.deleteProcessesCasesWarn(myProcessSelection.getSelectedItems().size()),
                                constants.okButton(), constants.cancelButton());
                        final CheckBox deleteAttachmentsCheckBox = new CheckBox(
                                constants.deleteAttachmentsCheckBox());
                        confirmationDialogbox.addWidgetToDialogboxBody(deleteAttachmentsCheckBox);
                        confirmationDialogbox.addCloseHandler(new CloseHandler<PopupPanel>() {
                            public void onClose(CloseEvent<PopupPanel> event) {
                                if (confirmationDialogbox.getConfirmation()) {
                                    deleteAllCasesOfSelectedProcesses(deleteAttachmentsCheckBox.getValue());
                                }
                            }
                        });
                    }
                }
            });

    myEnableProcessActionLink = theSubMenu.new MenuChoice(new HTML(ENABLE_BUTTON_TITLE), new Command() {
        public void execute() {
            //add a ConfirmationDialogbox when you enable processes
            if (myProcessSelection.getSize() > 0) {
                confirmationDialogbox = new ConfirmationDialogbox(constants.enableProcess(),
                        patterns.enableProcessesExplanations(myProcessSelection.getSelectedItems().size()),
                        constants.okButton(), constants.cancelButton());
                confirmationDialogbox.addCloseHandler(new CloseHandler<PopupPanel>() {
                    public void onClose(CloseEvent<PopupPanel> event) {
                        if (confirmationDialogbox.getConfirmation()) {
                            enableSelectedProcesses();
                        }
                    }
                });
            }
        }
    });

    myDisableProcessActionLink = theSubMenu.new MenuChoice(new HTML(DISABLE_BUTTON_TITLE), new Command() {
        public void execute() {
            //add a ConfirmationDialogbox when you disable processes
            if (myProcessSelection.getSize() > 0) {
                confirmationDialogbox = new ConfirmationDialogbox(constants.disableProcessesDialogbox(),
                        patterns.disableProcessesExplanations(myProcessSelection.getSelectedItems().size()),
                        constants.okButton(), constants.cancelButton());
                confirmationDialogbox.addCloseHandler(new CloseHandler<PopupPanel>() {
                    public void onClose(CloseEvent<PopupPanel> event) {
                        if (confirmationDialogbox.getConfirmation()) {
                            disableSelectedProcesses();
                        }
                    }
                });
            }
        }
    });

    myArchiveProcessActionLink = theSubMenu.new MenuChoice(new HTML(ARCHIVE_BUTTON_TITLE), new Command() {
        public void execute() {
            //add a ConfirmationDialogbox when you archive processes
            if (myProcessSelection.getSize() > 0) {
                confirmationDialogbox = new ConfirmationDialogbox(constants.archiveProcessesDialogbox(),
                        patterns.archiveProcessesWarn(myProcessSelection.getSelectedItems().size()),
                        constants.okButton(), constants.cancelButton());
                confirmationDialogbox.addCloseHandler(new CloseHandler<PopupPanel>() {
                    public void onClose(CloseEvent<PopupPanel> event) {
                        if (confirmationDialogbox.getConfirmation()) {
                            archiveSelectedProcesses();
                        }
                    }
                });
            }
        }
    });

    myDeleteProcessActionLink = theSubMenu.new MenuChoice(new HTML(DELETE_BUTTON_TITLE), new Command() {
        public void execute() {
            //add a ConfirmationDialogbox when you remove processes
            if (myProcessSelection.getSize() > 0) {
                confirmationDialogbox = new ConfirmationDialogbox(constants.removeProcessesDialogbox(),
                        patterns.removeProcessesWarn(myProcessSelection.getSelectedItems().size()),
                        constants.okButton(), constants.cancelButton());
                final CheckBox deleteAttachmentsCheckBox = new CheckBox(constants.deleteAttachmentsCheckBox());
                confirmationDialogbox.addWidgetToDialogboxBody(deleteAttachmentsCheckBox);
                confirmationDialogbox.addCloseHandler(new CloseHandler<PopupPanel>() {
                    public void onClose(CloseEvent<PopupPanel> event) {
                        if (confirmationDialogbox.getConfirmation()) {
                            deleteSelectedProcesses(deleteAttachmentsCheckBox.getValue());
                        }
                    }
                });
            }
        }
    });

    // Enable / disable action links depending on selection content.
    myProcessSelection.addModelChangeListener(ProcessSelection.ITEM_SELECTION_PROPERTY,
            new ModelChangeListener() {

                public void modelChange(ModelChangeEvent aEvt) {
                    updateActionLinksState();
                }
            });

    theSubMenu.addChoice(myOpenProcessDesignActionLink);
    theSubMenu.addChoice(myDeleteAllInstancesActionLink);
    theSubMenu.addChoice(myEnableProcessActionLink);
    theSubMenu.addChoice(myDisableProcessActionLink);
    theSubMenu.addChoice(myArchiveProcessActionLink);
    theSubMenu.addChoice(myDeleteProcessActionLink);
    myMoreActionMenu.addItem(constants.moreActions(), theSubMenu);

    // Ensure links state.
    updateActionLinksState();

    myRefreshLabel = new Label(REFRESH_TITLE);
    myRefreshLabel.setStyleName(CSSClassManager.LINK_LABEL);
    myRefreshLabel.addClickHandler(new ClickHandler() {

        /*
         * (non-Javadoc)
         * 
         * @see
         * com.google.gwt.event.dom.client.ClickHandler#onClick(com.google
         * .gwt.event.dom.client.ClickEvent)
         */
        public void onClick(ClickEvent aArg0) {
            reloadProcesses();
        }

    });

    // Finally layout widgets
    myOuterPanel.add(myItemSelector);
    myOuterPanel.add(myDirectActionMenu);
    myOuterPanel.add(myMoreActionMenu);
    myOuterPanel.add(myRefreshLabel);

    this.initWidget(myOuterPanel);
}

From source file:org.bonitasoft.console.client.view.steps.EventsListEditorView.java

License:Open Source License

private Widget buildItemSelector(final int row) {
    final CheckBox theSelectItemCheckBox = new CheckBox();
    theSelectItemCheckBox.addClickHandler(new ClickHandler() {

        public void onClick(ClickEvent aEvent) {
            if (aEvent.getSource() instanceof CheckBox) {
                CheckBox theCheckBox = (CheckBox) aEvent.getSource();
                if (theCheckBox.getValue()) {
                    myItemRowSelection.clear();
                    myItemRowSelection.add(row);
                    final EventItem theEvent = myRowItem.get(row);
                    if (theEvent != null) {
                        myDateBox.setValue(theEvent.getExecutionDate());
                    }//from   ww  w.ja v  a  2 s .  co  m
                } else {
                    myItemRowSelection.remove(row);
                    myDateBox.setValue(null);
                }
            }
        }
    });
    return theSelectItemCheckBox;
}

From source file:org.bonitasoft.console.client.view.steps.StepsDefinitionListEditorView.java

License:Open Source License

private Widget buildSelectAllSelector() {
    final CheckBox theSelectAllCheckBox = new CheckBox();
    theSelectAllCheckBox.addClickHandler(new ClickHandler() {

        public void onClick(ClickEvent aEvent) {
            if (aEvent.getSource() instanceof CheckBox) {
                CheckBox theCheckBox = (CheckBox) aEvent.getSource();
                selectAllRows(theCheckBox.getValue());
            }//from  w  w  w . j av  a  2s  .  c om
        }
    });
    return theSelectAllCheckBox;
}

From source file:org.bonitasoft.forms.client.view.widget.CheckboxGroupWidget.java

License:Open Source License

/**
 * @return the List of String value of the slected checkboxes of the group
 *//*from  ww w.  j ava 2s  .  c  om*/
public List<String> getValue() {

    final List<String> values = new ArrayList<String>();

    final Iterator<Widget> iterator = groupWidgets.iterator();
    while (iterator.hasNext()) {
        final CheckBox checkBox = (CheckBox) iterator.next();
        if (checkBox.getValue()) {
            values.add(checkBox.getFormValue());
        }
    }
    return values;
}

From source file:org.bonitasoft.forms.client.view.widget.FormFieldWidget.java

License:Open Source License

/**
 * Retrieve the value of the field under the form of a {@link FormFieldValue} object. This conversion is needed because RPC
 * calls do not support the type 'Object'.
 *
 * @return a {@link FormFieldValue} object
 *///from w  ww .  j a v  a  2  s  . com
@SuppressWarnings("unchecked")
public FormFieldValue getValue() {

    long attachmentId = -1;
    String attachmentName = null;
    Serializable value = null;
    String valueType = null;
    String format = null;
    String displayedValue = null;
    switch (widgetType) {
    case TEXTBOX:
        final TextBox textBox = (TextBox) fieldWidget;
        value = textBox.getValue();
        valueType = SupportedFieldTypes.JAVA_STRING_CLASSNAME;
        break;
    case TEXTAREA:
        final TextArea textArea = (TextArea) fieldWidget;
        value = textArea.getValue();
        valueType = SupportedFieldTypes.JAVA_STRING_CLASSNAME;
        break;
    case TEXT:
        final HTML text = (HTML) fieldWidget;
        value = text.getHTML();
        valueType = SupportedFieldTypes.JAVA_STRING_CLASSNAME;
        break;
    case RICH_TEXTAREA:
        final RichTextWidget richTextWidget = (RichTextWidget) fieldWidget;
        value = richTextWidget.getValue();
        valueType = SupportedFieldTypes.JAVA_STRING_CLASSNAME;
        break;
    case PASSWORD:
        final PasswordTextBox passwordTextBox = (PasswordTextBox) fieldWidget;
        value = passwordTextBox.getValue();
        valueType = SupportedFieldTypes.JAVA_STRING_CLASSNAME;
        break;
    case CHECKBOX:
        final CheckBox checkBox = (CheckBox) fieldWidget;
        value = checkBox.getValue();
        valueType = SupportedFieldTypes.JAVA_BOOLEAN_CLASSNAME;
        break;
    case RADIOBUTTON_GROUP:
        final RadioButtonGroupWidget radioButtonGroupWidget = (RadioButtonGroupWidget) fieldWidget;
        value = radioButtonGroupWidget.getValue();
        valueType = SupportedFieldTypes.JAVA_STRING_CLASSNAME;
        break;
    case LISTBOX_SIMPLE:
        final ListBox listBox = (ListBox) fieldWidget;
        final int index = listBox.getSelectedIndex();
        if (index > -1) {
            value = listBox.getValue(index);
        }
        valueType = SupportedFieldTypes.JAVA_STRING_CLASSNAME;
        break;
    case LISTBOX_MULTIPLE:
        value = new ArrayList<String>();
        final ListBox listBoxMulti = (ListBox) fieldWidget;
        for (int i = 0; i < listBoxMulti.getItemCount(); i++) {
            if (listBoxMulti.isItemSelected(i)) {
                ((List<String>) value).add(listBoxMulti.getValue(i));
            }
        }
        valueType = SupportedFieldTypes.JAVA_COLLECTION_CLASSNAME;
        break;
    case SUGGESTBOX:
        final SuggestBox suggestBox = (SuggestBox) fieldWidget;
        displayedValue = suggestBox.getValue();
        value = suggestionsMap.get(displayedValue);
        if (value == null) {
            value = displayedValue;
        }
        valueType = SupportedFieldTypes.JAVA_STRING_CLASSNAME;
        break;
    case SUGGESTBOX_ASYNC:
        final AsyncSuggestBoxWidget formAsyncSuggestBoxWidget = (AsyncSuggestBoxWidget) fieldWidget;
        value = formAsyncSuggestBoxWidget.getValue();
        valueType = SupportedFieldTypes.JAVA_STRING_CLASSNAME;
        break;
    case CHECKBOX_GROUP:
        value = new ArrayList<String>();
        final CheckboxGroupWidget checkboxGroupWidget = (CheckboxGroupWidget) fieldWidget;
        for (final String checkboxGroupValue : checkboxGroupWidget.getValue()) {
            ((List<String>) value).add(checkboxGroupValue);
        }
        valueType = SupportedFieldTypes.JAVA_COLLECTION_CLASSNAME;
        break;
    case DATE:
        final DateBox dateBox = (DateBox) fieldWidget;
        final String strValue = dateBox.getTextBox().getValue();
        final Date dtValue = dateBox.getValue();
        if (strValue != null && strValue.length() > 0 && dtValue == null) {
            value = strValue;
            valueType = SupportedFieldTypes.JAVA_STRING_CLASSNAME;
        } else {
            value = dtValue;
            valueType = SupportedFieldTypes.JAVA_DATE_CLASSNAME;
        }
        break;
    case DURATION:
        final DurationWidget duration = (DurationWidget) fieldWidget;
        value = duration.getValue();
        valueType = SupportedFieldTypes.JAVA_LONG_CLASSNAME;
        break;
    case FILEUPLOAD:
        final FileUploadWidget fileUpload = (FileUploadWidget) fieldWidget;
        attachmentName = fileUpload.getAttachmentName();
        attachmentId = fileUpload.getAttachmentId();
        value = fileUpload.getValue();
        displayedValue = fileUpload.getDisplayedValue();
        valueType = fileUpload.getValueType();
        break;
    case TABLE:
        final TableWidget table = (TableWidget) fieldWidget;
        value = (Serializable) table.getValue();
        valueType = SupportedFieldTypes.JAVA_COLLECTION_CLASSNAME;
        break;
    case EDITABLE_GRID:
        final EditableGridWidget grid = (EditableGridWidget) fieldWidget;
        value = (Serializable) grid.getValue();
        valueType = SupportedFieldTypes.JAVA_COLLECTION_CLASSNAME;
        break;
    case HIDDEN:
        final Hidden hidden = (Hidden) fieldWidget;
        value = hidden.getValue();
        valueType = SupportedFieldTypes.JAVA_STRING_CLASSNAME;
        break;
    default:
        break;
    }
    if (displayFormat != null) {
        format = displayFormat.getPattern();
    } else {
        format = DateTimeFormat.getFormat(PredefinedFormat.DATE_LONG).getPattern();
    }
    final FormFieldValue formFieldValue = new FormFieldValue(value, valueType, format, fieldOutputType);
    if (WidgetType.FILEUPLOAD.equals(widgetType)) {
        formFieldValue.setDocumentName(attachmentName);
        formFieldValue.setDocumentId(attachmentId);
        formFieldValue.setDisplayedValue(displayedValue);
        formFieldValue.setDocument(true);
    }
    return formFieldValue;
}

From source file:org.clevermore.monitor.client.servers.ServerStatsPopup.java

License:Apache License

public ServerStatsPopup(final Integer serverCode) {
    this.serverCode = serverCode;
    setAnimationEnabled(true);//  www  .j ava  2s  .  c  o  m
    setModal(true);
    setSize("760px", "450px");
    setGlassEnabled(true);

    service.getConnectedServer(serverCode, new AsyncCallback<ConnectedServer>() {

        public void onSuccess(ConnectedServer cs) {
            fp.add(new HTML("<h1>Server:" + cs.getServerCode() + ", " + cs.getName() + "</h1>"));

            fp.add(new HTML(
                    "<h2>Up Time:" + ClientStringFormatter.formatMilisecondsToHours(cs.getUpTime()) + "</h2>"));

            String gcs = "";
            for (Double gch : cs.getGcHistories()) {
                gcs += ClientStringFormatter.formatMillisShort(gch) + ";";
            }
            HTML tech = new HTML(
                    "<h2>Memory:" + ClientStringFormatter.formatMBytes(cs.getMemoryUsage().getUsed()) + " of "
                            + ClientStringFormatter.formatMBytes(cs.getMemoryUsage().getMax()) + " MB, Usage:"
                            + ClientStringFormatter.formatMillisShort(cs.getMemoryUsage().getPercentage())
                            + "%, GC Time:" + gcs + "</h2>");

            fp.add(tech);

            HTML info = new HTML("<h2>" + cs.getMoreInfo() + "</h2");
            fp.add(info);

            fp.getElement().setId("xxx");
            setWidget(fp);

            memoryChart.setStyleName("serverPopupChart");
            memory.add(memoryChart);

            memoryDetailsChart.setStyleName("serverPopupChart");
            final CheckBox heap = new CheckBox("Show Heap");
            heap.setValue(true);
            heap.addClickHandler(new ClickHandler() {

                @Override
                public void onClick(ClickEvent event) {
                    showHeap = heap.getValue();
                    if (memoryUsages != null) {
                        updateMemoryDetailsChart(memoryUsages);
                    }
                }
            });
            memoryDetails.add(heap);
            memoryDetails.add(memoryDetailsChart);

            cpuChart.setStyleName("serverPopupChart");
            cpu.add(cpuChart);

            sysLoadChart.setStyleName("serverPopupChart");
            sysLoad.add(sysLoadChart);

            loadSecondPart();

        };

        @Override
        public void onFailure(Throwable caught) {
            Window.alert("Error loading server:" + caught.getMessage());
            Log.error("Error loading server:" + serverCode + ", Error:" + caught.getMessage(), caught);
            hide();
        }
    });

}

From source file:org.clevermore.monitor.client.servers.ServersWidget.java

License:Apache License

public ServersWidget() {
    super("Servers", 20000, (ServerWidgetServiceAsync) GWT.create(ServerWidgetService.class));

    addStyleName("serversWidget");
    serversList.setStyleName("serversWidgetInternal");
    getDataPanel().add(serversList);/*w  w  w. ja  va 2 s  .c o m*/
    sp.setSize("100%", "100%");
    serversList.add(sp);

    title.setStyleName("serversHeader");
    setTitleWidget(title);
    title.add(serversLabel);
    final CheckBox chkShowOffline = new CheckBox("Show Offline");
    chkShowOffline.setValue(true);
    title.add(chkShowOffline);
    title.add(new Label("Filter:"));
    title.add(filter);

    Style style = certs.getElement().getStyle();
    style.setPadding(0, Unit.PX);
    title.add(certs);
    title.add(getRefProg());

    certs.addClickHandler(new ClickHandler() {

        @Override
        public void onClick(ClickEvent event) {
            getService().getCertificates(new AsyncCallback<HashMap<String, List<Certificate>>>() {

                @Override
                public void onSuccess(HashMap<String, List<Certificate>> result) {
                    new CertificatesPopup(result);
                }

                @Override
                public void onFailure(Throwable caught) {
                    Window.alert(caught.getMessage());
                }
            });
        }
    });

    String filterText = LocalStorage.readStoredItem(SERVERS_FILTER);
    if (filterText != null) {
        filter.setText(filterText.trim().toLowerCase());
    }

    filter.addKeyPressHandler(new KeyPressHandler() {

        @Override
        public void onKeyPress(KeyPressEvent event) {
            Log.debug("Key:" + event.getNativeEvent().getKeyCode());
            if (event.getNativeEvent().getKeyCode() == KeyCodes.KEY_ENTER) {
                updateServersTable();
            }
        }
    });

    String showOff = LocalStorage.readStoredItem(SERVERS_SHOW_OFF);
    if (showOff != null && (showOff.equals("1") || showOff.equals("0"))) {
        chkShowOffline.setValue(showOff.equals("1"));
        showOffline = showOff.equals("1");
    }

    chkShowOffline.addClickHandler(new ClickHandler() {

        @Override
        public void onClick(ClickEvent event) {
            showOffline = chkShowOffline.getValue();
            LocalStorage.storeItem(SERVERS_SHOW_OFF, showOffline ? "1" : "0");
        }
    });

}