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:com.google.gerrit.client.admin.AccountGroupInfoScreen.java

License:Apache License

private void initGroupOptions() {
    final VerticalPanel groupOptionsPanel = new VerticalPanel();

    final VerticalPanel vp = new VerticalPanel();
    vp.setStyleName(Gerrit.RESOURCES.css().groupOptionsPanel());
    vp.add(new SmallHeading(Util.C.headingGroupOptions()));

    visibleToAllCheckBox = new CheckBox(Util.C.isVisibleToAll());
    vp.add(visibleToAllCheckBox);//from  w w w .  j a va2s.c  o m
    groupOptionsPanel.add(vp);

    saveGroupOptions = new Button(Util.C.buttonSaveGroupOptions());
    saveGroupOptions.setEnabled(false);
    saveGroupOptions.addClickHandler(new ClickHandler() {
        @Override
        public void onClick(final ClickEvent event) {
            GroupApi.setGroupOptions(getGroupUUID(), visibleToAllCheckBox.getValue(),
                    new GerritCallback<VoidResult>() {
                        public void onSuccess(final VoidResult result) {
                            saveGroupOptions.setEnabled(false);
                        }
                    });
        }
    });
    groupOptionsPanel.add(saveGroupOptions);

    add(groupOptionsPanel);

    final OnEditEnabler enabler = new OnEditEnabler(saveGroupOptions);
    enabler.listenTo(visibleToAllCheckBox);
}

From source file:com.google.gerrit.client.admin.AccountGroupScreen.java

License:Apache License

private void initGroupOptions() {
    groupOptionsPanel = new VerticalPanel();
    groupOptionsPanel.add(new SmallHeading(Util.C.headingGroupOptions()));

    visibleToAllCheckBox = new CheckBox(Util.C.isVisibleToAll());
    groupOptionsPanel.add(visibleToAllCheckBox);

    emailOnlyAuthors = new CheckBox(Util.C.emailOnlyAuthors());

    final VerticalPanel vp = new VerticalPanel();
    vp.add(new Label(Util.C.descriptionNotifications()));
    vp.add(emailOnlyAuthors);//w ww .j av a 2 s .c  o  m
    groupOptionsPanel.add(vp);

    saveGroupOptions = new Button(Util.C.buttonSaveGroupOptions());
    saveGroupOptions.setEnabled(false);
    saveGroupOptions.addClickHandler(new ClickHandler() {
        @Override
        public void onClick(final ClickEvent event) {
            final GroupOptions groupOptions = new GroupOptions(visibleToAllCheckBox.getValue(),
                    emailOnlyAuthors.getValue());
            Util.GROUP_SVC.changeGroupOptions(groupId, groupOptions, new GerritCallback<VoidResult>() {
                public void onSuccess(final VoidResult result) {
                    saveGroupOptions.setEnabled(false);
                }
            });
        }
    });
    groupOptionsPanel.add(saveGroupOptions);

    add(groupOptionsPanel);

    final OnEditEnabler enabler = new OnEditEnabler(saveGroupOptions);
    enabler.listenTo(visibleToAllCheckBox);
    enabler.listenTo(emailOnlyAuthors);
}

From source file:com.google.gerrit.client.admin.CreateProjectScreen.java

License:Apache License

private void addCreateProjectPanel() {
    final VerticalPanel fp = new VerticalPanel();
    fp.setStyleName(Gerrit.RESOURCES.css().createProjectPanel());

    initCreateButton();//w  w w.  j a  va  2  s.  co  m
    initCreateTxt();
    initParentBox();

    addGrid(fp);

    emptyCommit = new CheckBox(Util.C.checkBoxEmptyCommit());
    permissionsOnly = new CheckBox(Util.C.checkBoxPermissionsOnly());
    fp.add(emptyCommit);
    fp.add(permissionsOnly);
    fp.add(create);
    VerticalPanel vp = new VerticalPanel();
    vp.add(fp);
    initSuggestedParents();
    vp.add(suggestedParentsTab);
    add(vp);
}

From source file:com.google.gerrit.client.auth.openid.OpenIdSignInDialog.java

License:Apache License

private void createIdentBox() {
    boolean remember = mode == SignInMode.SIGN_IN || mode == SignInMode.REGISTER;

    final FlowPanel group = new FlowPanel();
    group.setStyleName(OpenIdResources.I.css().loginLine());

    final FlowPanel line1 = new FlowPanel();
    group.add(line1);//www  .ja v  a  2  s . co m

    providerId = new NpTextBox();
    providerId.setVisibleLength(60);
    providerId.setStyleName(OpenIdResources.I.css().identifier());
    providerId.setTabIndex(0);
    providerId.addKeyPressHandler(new KeyPressHandler() {
        @Override
        public void onKeyPress(final KeyPressEvent event) {
            if (event.getNativeEvent().getKeyCode() == KeyCodes.KEY_ENTER) {
                event.preventDefault();
                form.submit();
            }
        }
    });
    line1.add(providerId);

    login = new Button();
    switch (mode) {
    case LINK_IDENTIY:
        login.setText(OpenIdUtil.C.buttonLinkId());
        break;
    case REGISTER:
        login.setText(OpenIdUtil.C.buttonRegister());
        break;
    case SIGN_IN:
    default:
        login.setText(OpenIdUtil.C.buttonSignIn());
        break;
    }
    login.addClickHandler(new ClickHandler() {
        @Override
        public void onClick(final ClickEvent event) {
            form.submit();
        }
    });
    login.setTabIndex(remember ? 2 : 1);
    line1.add(login);

    Button close = new Button(Gerrit.C.signInDialogClose());
    close.addClickHandler(new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            hide();
        }
    });
    close.setTabIndex(remember ? 3 : 2);
    line1.add(close);

    if (remember) {
        rememberId = new CheckBox(OpenIdUtil.C.rememberMe());
        rememberId.setTabIndex(1);
        group.add(rememberId);

        String last = Cookies.getCookie(OpenIdUrls.LASTID_COOKIE);
        if (last != null && !"".equals(last)) {
            if (last.startsWith("\"") && last.endsWith("\"")) {
                // Dequote the value. We shouldn't have to do this, but
                // something is causing some Google Account tokens to get
                // wrapped up in double quotes when obtained from the cookie.
                //
                last = last.substring(1, last.length() - 2);
            }
            providerId.setText(last);
            rememberId.setValue(true);
        }
    }

    formBody.add(group);
}

From source file:com.google.gerrit.client.patches.ReviewedPanels.java

License:Apache License

private CheckBox createReviewedCheckbox() {
    final CheckBox checkBox = new CheckBox(PatchUtil.C.reviewedAnd() + " ");
    checkBox.addValueChangeHandler(new ValueChangeHandler<Boolean>() {
        @Override/*from   w w w.j  a  va  2s.  c o m*/
        public void onValueChange(ValueChangeEvent<Boolean> event) {
            final boolean value = event.getValue();
            setReviewedByCurrentUser(value);
            if (checkBoxTop.getValue() != value) {
                checkBoxTop.setValue(value);
            }
            if (checkBoxBottom.getValue() != value) {
                checkBoxBottom.setValue(value);
            }
        }
    });
    return checkBox;
}

From source file:com.google.gerrit.client.ui.RebaseDialog.java

License:Apache License

public RebaseDialog(final String project, final String branch, final Change.Id changeId,
        final boolean sendEnabled) {
    super(Util.C.rebaseTitle(), null);
    this.sendEnabled = sendEnabled;
    sendButton.setText(Util.C.buttonRebaseChangeSend());

    // Create the suggestion box to filter over a list of recent changes
    // open on the same branch. The list of candidates is primed by the
    // changeParent CheckBox (below) getting enabled by the user.
    base = new SuggestBox(new HighlightSuggestOracle() {
        @Override//from   ww w  . j  a  v a 2  s  .co m
        protected void onRequestSuggestions(Request request, Callback done) {
            String query = request.getQuery().toLowerCase();
            List<ChangeSuggestion> suggestions = new ArrayList<>();
            for (ChangeInfo ci : candidateChanges) {
                if (changeId.equals(ci.legacyId())) {
                    continue; // do not suggest current change
                }
                String id = String.valueOf(ci.legacyId().get());
                if (id.contains(query) || ci.subject().toLowerCase().contains(query)) {
                    suggestions.add(new ChangeSuggestion(ci));
                    if (suggestions.size() >= 50) { // limit to 50 suggestions
                        break;
                    }
                }
            }
            done.onSuggestionsReady(request, new Response(suggestions));
        }
    });
    base.getElement().setAttribute("placeholder", Util.C.rebasePlaceholderMessage());
    base.setStyleName(Gerrit.RESOURCES.css().rebaseSuggestBox());

    // The changeParent checkbox must be clicked to load into browser memory
    // a list of open changes from the same project and same branch that this
    // change may rebase onto.
    changeParent = new CheckBox(Util.C.rebaseConfirmMessage());
    changeParent.addClickHandler(new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            if (changeParent.getValue()) {
                ChangeList.query(
                        PageLinks.projectQuery(new Project.NameKey(project)) + " "
                                + PageLinks.op("branch", branch) + " is:open -age:90d",
                        Collections.<ListChangesOption>emptySet(), new GerritCallback<ChangeList>() {
                            @Override
                            public void onSuccess(ChangeList result) {
                                candidateChanges = Natives.asList(result);
                                updateControls(true);
                            }

                            @Override
                            public void onFailure(Throwable err) {
                                updateControls(false);
                                changeParent.setValue(false);
                                super.onFailure(err);
                            }
                        });
            } else {
                updateControls(false);
            }
        }
    });

    // add the checkbox and suggestbox widgets to the content panel
    contentPanel.add(changeParent);
    contentPanel.add(base);
    contentPanel.setStyleName(Gerrit.RESOURCES.css().rebaseContentPanel());
}

From source file:com.google.gwt.demos.fasttree.client.FastTreeDemo.java

License:Apache License

protected Widget basicTree() {
    FastTree t = new FastTree();
    FastTreeItem a = t.addItem("A root tree item");
    a.addItem("A child");
    FastTreeItem aXb = a.addItem("Another child");
    aXb.addItem("a grand child");
    FastTreeItem widgetBranch = a.addItem(new CheckBox("A checkbox child"));
    FastTreeItem textBoxParent = widgetBranch.addItem("A TextBox parent");
    textBoxParent.addItem(new TextBox());
    textBoxParent.addItem("and another one...");
    textBoxParent.addItem(new TextArea());

    ListBox lb = new ListBox();
    for (int i = 0; i < 100; i++) {
        lb.addItem(i + "");
    }//w ww .  j a  v a2 s.c  o m
    widgetBranch.addItem("A ListBox parent").addItem(lb);
    return t;
}

From source file:com.google.gwt.demos.fasttree.client.FastTreeDemo.java

License:Apache License

protected Widget stubbornTree() {
    StubbornTree t = new StubbornTree();
    FastTreeItem a = t.addItem("A root tree item");
    a.addItem("A child");
    FastTreeItem aXb = a.addItem("Another child");
    aXb.addItem("a grand child");
    FastTreeItem widgetBranch = a.addItem(new CheckBox("A checkbox child"));
    FastTreeItem textBoxParent = widgetBranch.addItem("A TextBox parent");
    textBoxParent.addItem(new TextBox());
    textBoxParent.addItem("and another one...");
    textBoxParent.addItem(new TextArea());

    ListBox lb = new ListBox();
    for (int i = 0; i < 100; i++) {
        lb.addItem(i + "");
    }// w ww.j a  va2  s  .  com
    widgetBranch.addItem("A ListBox parent").addItem(lb);
    return t;
}

From source file:com.google.gwt.demos.fasttree.client.FastTreeDemo.java

License:Apache License

private FastTreeItem profileAdd(FastTreeItem parent, TreeType type) {
    if (type == TreeType.TEXT) {
        FastTreeItem text = new FastTreeItem();
        text.setText("item");
        parent.addItem(text);/*from w ww  .j  a v  a 2 s. c o  m*/
        return text;
    } else if (type == TreeType.HTML) {
        FastTreeItem item = new FastTreeItem("<h1>html</h1>");
        parent.addItem(item);
        return item;
    } else if (type == TreeType.CHECKBOX) {
        return parent.addItem(new CheckBox("myBox"));
    } else {
        throw new RuntimeException("What?");
    }
}

From source file:com.google.gwt.demos.fasttree.client.FastTreeDemo.java

License:Apache License

private TreeItem profileAdd(TreeItem parent, TreeType type) {
    if (type == TreeType.TEXT) {
        TreeItem item = new TreeItem();
        item.setText("text");
        parent.addItem(item);//w ww.j  a  va 2s.c o m
        return item;
    } else if (type == TreeType.HTML) {
        TreeItem item = new TreeItem("<h1>html</h1>");
        parent.addItem(item);
        return item;
    } else if (type == TreeType.CHECKBOX) {
        return parent.addItem(new CheckBox("myBox"));
    } else {
        throw new RuntimeException("What?");
    }
}