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

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

Introduction

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

Prototype

protected CheckBox(Element elem) 

Source Link

Usage

From source file:org.ebayopensource.turmeric.policy.adminui.client.view.policy.PolicySubjectAssignmentWidget.java

License:Open Source License

/**
* Creates the subject type xb.//from  w w w.  ja  va2  s . co m
*/
protected void createSubjectTypeXB() {
    selectAllSubjectsXB = new CheckBox(PolicyAdminUIUtil.policyAdminConstants.selectAllSubjects() + " "
            + PolicyAdminUIUtil.policyAdminConstants.selectAllsubjectsAlert());
}

From source file:org.eclipse.che.ide.ext.github.client.authenticator.GitHubAuthenticatorViewImpl.java

License:Open Source License

@Inject
public GitHubAuthenticatorViewImpl(DialogFactory dialogFactory, GitHubLocalizationConstant locale,
        ProductInfoDataProvider productInfoDataProvider) {
    this.dialogFactory = dialogFactory;
    this.locale = locale;

    isGenerateKeys = new CheckBox(locale.authGenerateKeyLabel());
    isGenerateKeys.setValue(true);/*w  w  w .  j av  a2  s . c  o m*/

    contentPanel = new DockLayoutPanel(Style.Unit.PX);
    contentPanel.addNorth(new InlineHTML(locale.authorizationDialogText(productInfoDataProvider.getName())),
            20);
    contentPanel.addNorth(isGenerateKeys, 20);
}

From source file:org.eclipse.che.ide.processes.runtime.CellTableRuntimeInfoWidgetFactory.java

License:Open Source License

@Override
public Widget create(String machineName, List<RuntimeInfo> runtimeList) {
    VerticalPanel panel = new VerticalPanel();
    panel.ensureDebugId("runtimeInfoVerticalPanel");
    panel.setWidth("100%");

    Label caption = new Label(locale.cellTableCaption(machineName));
    caption.ensureDebugId("runtimeInfoCellTableCaption");
    caption.addStyleName(resources.cellTableStyle().cellTableCaption());

    HorizontalPanel hPanel = new HorizontalPanel();
    hPanel.setWidth("100%");
    hPanel.ensureDebugId("runtimeInfoCellTableHeaderWrapper");
    hPanel.add(caption);/*from   ww  w . ja va 2  s .  c om*/

    ListDataProvider<RuntimeInfo> dataProvider = new ListDataProvider<>(runtimeList);

    CheckBox hideCheckBox = new CheckBox("Hide internal servers");
    hideCheckBox.addValueChangeHandler(event -> {
        if (event.getValue()) { // if hide = true
            dataProvider.setList(
                    runtimeList.stream().filter(info -> !isNullOrEmpty(info.getPort())).collect(toList()));
        } else {
            dataProvider.setList(runtimeList);
        }
        dataProvider.refresh();
    });
    hideCheckBox.addStyleName(resources.cellTableStyle().cellTableHideServersCheckBox());
    hideCheckBox.ensureDebugId("runtimeInfoHideServersCheckBox");

    hPanel.add(hideCheckBox);

    panel.add(hPanel);
    panel.add(createCellTable(dataProvider));

    return new ScrollPanel(panel);
}

From source file:org.eobjects.datacleaner.monitor.shared.widgets.DefineMetricPanel.java

License:Open Source License

public DefineMetricPanel(final TenantIdentifier tenant, final JobMetrics jobMetrics,
        final MetricIdentifier existingMetric, final boolean formulaOnly) {
    super();//  w  w w  . j  a v a2s  .c o  m
    addStyleName("DefineMetricPanel");

    final boolean formulaBased = (formulaOnly ? true
            : (existingMetric == null ? false : existingMetric.isFormulaBased()));

    _tenant = tenant;
    _jobMetrics = jobMetrics;
    _selectMetricPanels = new ArrayList<SelectMetricPanel>();

    _formulaAddMetricButton = new Button();
    _formulaAddMetricButton.addStyleName("AddMetricButton");
    _formulaAddMetricButton.setVisible(formulaBased);
    _formulaRemoveMetricButton = new Button();
    _formulaRemoveMetricButton.addStyleName("RemoveMetricButton");
    _formulaRemoveMetricButton.setVisible(formulaBased);

    _formulaTextBox = new TextBox();
    _formulaTextBox.addStyleName("FormulaTextBox");
    _formulaTextBox.setVisible(formulaBased);
    // provide an example template, which makes it convenient to do a
    // percentage calculation
    _formulaTextBox.setText("A * 100 / B");

    _formulaCheckBox = new CheckBox("Metric formula?");
    _formulaCheckBox.addStyleName("FormulaCheckBox");
    _formulaCheckBox
            .setTitle("Let this metric be a formula, comprising multiple child metrics in a calculation?");
    _formulaCheckBox.setValue(formulaBased);

    _formulaCheckBox.addValueChangeHandler(new ValueChangeHandler<Boolean>() {
        @Override
        public void onValueChange(ValueChangeEvent<Boolean> event) {
            final boolean formulaBased = event.getValue();
            _formulaTextBox.setVisible(formulaBased);
            _formulaAddMetricButton.setVisible(formulaBased);
            _formulaRemoveMetricButton.setVisible(formulaBased);
        }
    });

    if (!formulaOnly) {
        add(_formulaCheckBox);
    }
    add(_formulaTextBox);
    add(_formulaAddMetricButton);
    add(_formulaRemoveMetricButton);

    if (formulaBased) {
        if (existingMetric == null) {
            // a new formula is being defined
            updateFormulaState(true);
        } else {
            // an existing formula is being recreated
            _formulaTextBox.setText(existingMetric.getFormula());
            final List<MetricIdentifier> children = existingMetric.getChildren();
            for (MetricIdentifier child : children) {
                addSelection(createSelectMetricPanel(child, formulaBased));
            }
        }
    } else {
        addSelection(createSelectMetricPanel(existingMetric, formulaBased));
    }

    // add listener for limiting amount of metric selections
    _formulaCheckBox.addValueChangeHandler(new ValueChangeHandler<Boolean>() {
        @Override
        public void onValueChange(ValueChangeEvent<Boolean> event) {
            final boolean formulaBased = event.getValue();
            updateFormulaState(formulaBased);
        }
    });

    _formulaAddMetricButton.addClickHandler(new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            final SelectMetricPanel panel = createSelectMetricPanel(null, true);
            addSelection(panel);
        }
    });
    _formulaRemoveMetricButton.addClickHandler(new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            if (_selectMetricPanels.size() > 1) {
                removeSelection();
            }
        }
    });
}

From source file:org.eurekastreams.web.client.ui.common.dialog.tos.TermsOfServiceDialogContent.java

License:Apache License

/**
 * Constructor./*from   w w w  . j  a  va2 s. c om*/
 *
 * @param inTos
 *            the terms of service.
 * @param readOnly
 *            if the TOS modal is read only.
 */
public TermsOfServiceDialogContent(final TermsOfServiceDTO inTos, final boolean readOnly) {
    tos = inTos;

    HTML tosText = new HTML(tos.getTermsOfService());
    tosText.addStyleName(StaticResourceBundle.INSTANCE.coreCss().tosBody());

    Label tosExplanation = new Label("Please confirm below you have read and understand the terms of service.");
    tosExplanation.addStyleName(StaticResourceBundle.INSTANCE.coreCss().explanation());
    Label tosHeader = new Label("Terms of Service");
    tosHeader.addStyleName(StaticResourceBundle.INSTANCE.coreCss().header());

    body.add(tosExplanation);
    body.add(tosHeader);
    body.add(tosText);

    acceptTos = new Hyperlink("Accept", History.getToken());
    acceptTos.addStyleName(StaticResourceBundle.INSTANCE.coreCss().agreeButton());
    acceptTos.addStyleName(StaticResourceBundle.INSTANCE.coreCss().agreeButtonDisabled());
    cancelTos = new Anchor("Cancel", "http://www.eurekastreams.org");
    cancelTos.addStyleName(StaticResourceBundle.INSTANCE.coreCss().disagreeButton());

    confirmCheckBox = new CheckBox("I have read and understand the terms of service.");
    confirmCheckBox.addStyleName(StaticResourceBundle.INSTANCE.coreCss().confirmCheckbox());

    if (!readOnly) {
        body.add(confirmCheckBox);
        body.add(acceptTos);
        body.add(cancelTos);
    } else {
        body.addStyleName(StaticResourceBundle.INSTANCE.coreCss().readOnlyTos());
    }

    final TermsOfServiceDialogModel model = new TermsOfServiceDialogModel(Session.getInstance(),
            EventBus.getInstance());
    new TermsOfServiceDialogController(this, model, EventBus.getInstance());
}

From source file:org.eurekastreams.web.client.ui.common.form.elements.BasicCheckBoxFormElement.java

License:Apache License

/**
 * Creates a basic text area form element.
 * //  www  .j a v  a2  s. c  o  m
 * @param labelVal
 *            the label (i.e. "Quote").
 * @param inKey
 *            the key in the model (i.e. lastName).
 * @param inCheckBoxText
 *            the instructions to show under it.
 * @param inInstructions
 *            the form element instructions.            
 * @param required
 *            if the element is required.
 * @param checked
 *            default value of checked.
 */
public BasicCheckBoxFormElement(final String labelVal, final String inKey, final String inCheckBoxText,
        final String inInstructions, final boolean required, final boolean checked) {
    if (required) {
        requiredLabel.addStyleName(StaticResourceBundle.INSTANCE.coreCss().requiredFormLabel());
        requiredLabel.setText("(required)");
    }
    body = new FlowPanel();
    key = inKey;
    label.setText(labelVal);
    label.addStyleName(StaticResourceBundle.INSTANCE.coreCss().formLabel());
    body.addStyleName(StaticResourceBundle.INSTANCE.coreCss().formCheckBox());

    instructions.addStyleName(StaticResourceBundle.INSTANCE.coreCss().formInstructions());
    instructions.setText(inInstructions);

    // Fix IE bug, shows empty divs
    instructions.setVisible(instructions.getText().length() > 0);

    cb = new CheckBox(inCheckBoxText);
    cb.setValue(checked);
    this.add(label);
    this.add(instructions);
    this.add(body);
    body.add(cb);
    this.add(requiredLabel);
}

From source file:org.eurekastreams.web.client.ui.common.stream.FollowDialogContent.java

License:Apache License

/**
 * Default constructor./*from ww w . j  a va 2  s .  c  o  m*/
 *
 * @param inStreamName
 *            the stream name.
 * @param streamRequest
 *            the stream request.
 * @param inStreamId
 *            the stream id.
 * @param inSubscribeModel
 *            Model for subscribing to activity on the stream.
 * @param inEntityUniqueId
 *            Unique ID of entity owning the stream.
 * @param streamType
 *            Type of entity of the stream.
 */
public FollowDialogContent(final String inStreamName, final String streamRequest, final Long inStreamId,
        final EntityType streamType, final BaseActivitySubscriptionModel inSubscribeModel,
        final String inEntityUniqueId) {
    Label saveButton = new Label("");
    Label closeButton = new Label("No Thanks");

    closeButton.addClickHandler(new ClickHandler() {
        public void onClick(final ClickEvent event) {
            close();
        }
    });

    body.add(new Label("You are now following the:"));

    Label streamTitle = new Label(inStreamName + " Stream");
    streamTitle.addStyleName(StaticResourceBundle.INSTANCE.coreCss().title());

    body.add(streamTitle);

    body.add(new Label("Below are additional ways to subscribe:"));

    FlowPanel options = new FlowPanel();
    options.addStyleName(StaticResourceBundle.INSTANCE.coreCss().followDialogOptions());

    final CheckBox addToStartPage = new CheckBox("Add this Stream to my Start Page");
    final CheckBox bookmarkStream = new CheckBox("Bookmark this stream");
    final CheckBox notifyViaEmail = new CheckBox("Notify me via Email");

    saveButton.addClickHandler(new ClickHandler() {
        public void onClick(final ClickEvent event) {
            if (addToStartPage.getValue()) {
                // For the app's location, use the current URL minus a few parameters we know we don't want. (They
                // are used by other lists, but get left in the URL when switching tabs.)
                // We don't build the URL from the stream id, since that doesn't take search terms into account.
                HashMap<String, String> params = new HashMap<String, String>();
                params.put("listId", null);
                params.put("listFilter", null);
                params.put("listSort", null);
                params.put("startIndex", null);
                params.put("endIndex", null);
                String url = Session.getInstance().generateUrl(new CreateUrlRequest(params));

                String prefs = "{\"streamQuery\":"
                        + WidgetJSNIFacadeImpl
                                .makeJsonString(STREAM_URL_TRANSFORMER.getUrl(null, streamRequest))
                        + ",\"gadgetTitle\":" + WidgetJSNIFacadeImpl.makeJsonString(inStreamName)
                        + ",\"streamLocation\":" + WidgetJSNIFacadeImpl.makeJsonString(url) + "}";

                GadgetModel.getInstance()
                        .insert(new AddGadgetToStartPageRequest("{d7a58391-5375-4c76-b5fc-a431c42a7555}", null,
                                STREAM_URL_TRANSFORMER.getUrl(null, prefs)));
            }

            if (bookmarkStream.getValue()) {
                StreamBookmarksModel.getInstance().insert(inStreamId);
            }

            if (notifyViaEmail.getValue()) {
                inSubscribeModel.update(inEntityUniqueId, true,
                        EntityType.GROUP == streamType ? subscribeCoordButton.getValue() : false);
            }

            close();
        }
    });

    options.add(addToStartPage);
    options.add(bookmarkStream);

    if (EntityType.GROUP == streamType) {
        Panel panel = new FlowPanel();
        panel.add(notifyViaEmail);
        subscribeAllButton = new RadioButton("whichPosts", "All posts to this stream");
        subscribeAllButton.setValue(true);
        subscribeAllButton.setEnabled(false);
        subscribeCoordButton = new RadioButton("whichPosts", "Only posts from coordinators of this stream");
        subscribeCoordButton.setEnabled(false);
        panel.add(subscribeAllButton);
        panel.add(subscribeCoordButton);
        options.add(panel);

        notifyViaEmail.addClickHandler(new ClickHandler() {
            public void onClick(final ClickEvent inEvent) {
                boolean checked = notifyViaEmail.getValue();
                subscribeAllButton.setEnabled(checked);
                subscribeCoordButton.setEnabled(checked);
            }
        });
    } else {
        options.add(notifyViaEmail);
    }

    body.add(options);

    FlowPanel buttonPanel = new FlowPanel();
    buttonPanel.addStyleName(StaticResourceBundle.INSTANCE.coreCss().followDialogButtonPanel());

    saveButton.addStyleName(StaticResourceBundle.INSTANCE.coreCss().saveChangesButton());
    buttonPanel.add(saveButton);
    buttonPanel.add(closeButton);

    body.add(buttonPanel);

    container.add(body);

    Label tipsTitle = new Label("Tips");
    tips.add(tipsTitle);

    tips.add(new Label(
            "These options allow you to have control over how to access the activity of this stream."));
    tips.add(new Label(
            "Don't worry, these selections are not permanent.  You can always change them in the future."));

    container.add(tips);

    body.addStyleName(StaticResourceBundle.INSTANCE.coreCss().followDialogBody());
    tips.addStyleName(StaticResourceBundle.INSTANCE.coreCss().followDialogTips());

}

From source file:org.fao.fenix.web.modules.metadataeditor.client.view.ColumnDefinitionPanel.java

License:Open Source License

public HorizontalPanel buildDescriptorPanel(String headerValue, String dataTypeValue, boolean isKey,
        List<OptionVO> options, boolean isEditable) {

    HorizontalPanel descriptorPanel = new HorizontalPanel();
    descriptorPanel.setSpacing(10);/*ww w  .  jav  a2 s.c o m*/
    descriptorPanel.setWidth("700px");

    CheckBox keyCheck = new CheckBox("Key");
    keyCheck.setChecked(isKey);
    keyCheck.setEnabled(isEditable);

    HTML headerLabel = new HTML("<b><font color='" + RED + "'>" + BabelFish.print().header() + ":</font></b>");
    TextField<String> header = new TextField<String>();
    header.setAllowBlank(false);
    header.setWidth("100px");
    header.setFieldLabel("<b>Header: </b>");
    header.setValue(headerValue);
    header.setReadOnly(!isEditable);

    HTML typeLabel = new HTML("<b><font color='" + RED + "'>" + BabelFish.print().dataType() + ":</font></b>");
    typeLabel.setWidth("75px");
    ComboBox<DataTypeModelData> typeList = new ComboBox<DataTypeModelData>();
    typeList.setTriggerAction(TriggerAction.ALL);
    ListStore<DataTypeModelData> typeStore = new ListStore<DataTypeModelData>();
    typeList.setStore(typeStore);
    typeList.setDisplayField("dataType");
    typeList.setReadOnly(!isEditable);

    IconButton addOptionButton = new IconButton("mapAddDataset");
    addOptionButton.setTitle(BabelFish.print().addOption());
    addOptionButton.addListener(Events.OnClick, MEController.addOption(this, columnKey, "", "", isEditable));
    addOptionButton.setEnabled(isEditable);

    Button removeColumnButton = new Button(BabelFish.print().removeColumn());
    removeColumnButton.addSelectionListener(MEController.removeColumn(this, columnKey));
    removeColumnButton.setEnabled(isEditable);

    descriptorPanel.add(keyCheck);
    descriptorPanel.add(headerLabel);
    descriptorPanel.add(header);
    descriptorPanel.add(typeLabel);
    descriptorPanel.add(typeList);
    descriptorPanel.add(addOptionButton);
    descriptorPanel.add(removeColumnButton);

    descriptorPanel.setData("dataTypeComboBox", typeList);
    descriptorPanel.setData("header", header);
    descriptorPanel.setData("dataType", typeList);
    descriptorPanel.setData("isKey", keyCheck);

    MEController.fillDataTypeComboBox(descriptorPanel, dataTypeValue);

    return descriptorPanel;
}

From source file:org.freemedsoftware.gwt.client.screen.ACLScreen.java

License:Open Source License

public void addACLGroupPermissions(final HashMap<String, String[]> data) {

    int row = groupAddTable.getFlexTable().getRowCount();
    Iterator<String> iterator = data.keySet().iterator();
    while (iterator.hasNext()) {
        final String section = iterator.next();
        final String[] values = data.get(section);
        HorizontalPanel temPanel = new HorizontalPanel();
        temPanel.setWidth("100%");
        for (int i = 0; i < values.length; i++) {
            final String value = values[i];
            final CheckBox checkBox = new CheckBox(value);
            temPanel.add(checkBox);//from   w  ww.  j a  va2 s. c o m
            aclPermissionsMap.put(section + ":" + value, checkBox);
        }

        CustomButton clearSubLink = new CustomButton(_("None"), AppConstants.ICON_SELECT_NONE);
        clearSubLink.addClickHandler(new ClickHandler() {
            @Override
            public void onClick(ClickEvent arg0) {
                for (int i = 0; i < values.length; i++) {
                    final String value = values[i];
                    aclPermissionsMap.get(section + ":" + value).setValue(false);
                }
            }
        });
        temPanel.add(clearSubLink);

        CustomButton selectAllSubLink = new CustomButton(_("All"), AppConstants.ICON_SELECT_ALL);
        selectAllSubLink.addClickHandler(new ClickHandler() {
            @Override
            public void onClick(ClickEvent arg0) {
                for (int i = 0; i < values.length; i++) {
                    final String value = values[i];
                    aclPermissionsMap.get(section + ":" + value).setValue(true);
                }
            }
        });
        temPanel.add(selectAllSubLink);

        Label label = new Label(section);
        label.setStyleName(AppConstants.STYLE_LABEL_LARGE_BOLD);
        groupAddTable.getFlexTable().setWidget(row, 0, label);

        groupAddTable.getFlexTable().setWidget(row, 1, temPanel);
        row++;
    }
}

From source file:org.freemedsoftware.gwt.client.screen.CallInScreen.java

License:Open Source License

protected void initSearchPopup() {
    if (searchDialogBox == null) {
        searchDialogBox = new CustomDialogBox();
        FlexTable flexTable = new FlexTable();

        int row = 0;

        final Label firstLastNameLabel = new Label(_("Name (Last, First)") + ":");
        flexTable.setWidget(row, 0, firstLastNameLabel);
        final TextBox lastName = new TextBox();
        flexTable.setWidget(row, 1, lastName);
        final TextBox firstName = new TextBox();
        flexTable.setWidget(row, 2, firstName);

        row++;//from w  ww  .  jav  a2 s . co  m

        final Label fullNameLabel = new Label(_("Call-In Patient") + ":");
        flexTable.setWidget(row, 0, fullNameLabel);
        final SupportModuleWidget fullName = new SupportModuleWidget("Callin");
        flexTable.setWidget(row, 1, fullName);

        final CheckBox showArchived = new CheckBox(_("Include Archived") + ":");
        flexTable.setWidget(row, 2, showArchived);
        showArchived.addValueChangeHandler(new ValueChangeHandler<Boolean>() {
            @Override
            public void onValueChange(ValueChangeEvent<Boolean> event) {
                if (event.getValue()) {
                    HashMap<String, String> args = new HashMap<String, String>();
                    args.put("ciarchive", "1");
                    fullName.setAdditionalParameters(args);
                } else
                    fullName.setAdditionalParameters(null);
            }
        });

        row++;

        final CustomButton searchBTN = new CustomButton(_("Search"), AppConstants.ICON_SEARCH);
        flexTable.setWidget(row, 1, searchBTN);
        searchCriteria = null;
        searchBTN.addClickHandler(new ClickHandler() {

            @Override
            public void onClick(ClickEvent event) {
                searchCriteria = new HashMap<String, String>();
                if (lastName.getText().trim().length() > 0)
                    searchCriteria.put("cilname", lastName.getText());
                if (firstName.getText().trim().length() > 0)
                    searchCriteria.put("cifname", firstName.getText());
                if (fullName.getValue() > 0)
                    searchCriteria.put("id", fullName.getValue().toString());
                if (showArchived.getValue())
                    searchCriteria.put("ciarchive", showArchived.getValue() ? "1" : "0");
                populate(searchCriteria);

                searchDialogBox.hide();
            }

        });

        searchDialogBox.setContent(flexTable);
    }
    searchDialogBox.show();
    searchDialogBox.center();

}