Search in sources :

Example 1 with CheckBox

use of com.google.gwt.user.client.ui.CheckBox in project opentsdb by OpenTSDB.

the class MetricForm method addTag.

private void addTag(final String default_tagname, final String default_value, final boolean is_groupby) {
    final int row = tagtable.getRowCount();
    final ValidatedTextBox tagname = new ValidatedTextBox();
    final SuggestBox suggesttagk = RemoteOracle.newSuggestBox("tagk", tagname);
    final ValidatedTextBox tagvalue = new ValidatedTextBox();
    final SuggestBox suggesttagv = RemoteOracle.newSuggestBox("tagv", tagvalue);
    final CheckBox groupby = new CheckBox();
    groupby.setValue(is_groupby);
    groupby.setTitle("Group by");
    groupby.addClickHandler(events_handler);
    tagname.setValidationRegexp(TSDB_ID_RE);
    tagvalue.setValidationRegexp(TSDB_TAGVALUE_RE);
    tagname.setWidth("100%");
    tagvalue.setWidth("100%");
    tagname.addBlurHandler(recompact_tagtable);
    tagname.addBlurHandler(events_handler);
    tagname.addKeyPressHandler(events_handler);
    tagvalue.addBlurHandler(recompact_tagtable);
    tagvalue.addBlurHandler(events_handler);
    tagvalue.addKeyPressHandler(events_handler);
    tagtable.setWidget(row, 1, suggesttagk);
    tagtable.setWidget(row, 2, suggesttagv);
    tagtable.setWidget(row, 3, groupby);
    if (row > 2) {
        final Button remove = new Button("x");
        remove.addClickHandler(removetag);
        tagtable.setWidget(row - 1, 0, remove);
    }
    if (default_tagname != null) {
        tagname.setText(default_tagname);
        if (default_value == null) {
            tagvalue.setFocus(true);
        }
    }
    if (default_value != null) {
        tagvalue.setText(default_value);
    }
}
Also used : SuggestBox(com.google.gwt.user.client.ui.SuggestBox) Button(com.google.gwt.user.client.ui.Button) CheckBox(com.google.gwt.user.client.ui.CheckBox)

Example 2 with CheckBox

use of com.google.gwt.user.client.ui.CheckBox in project rstudio by rstudio.

the class RSConnectDeploy method setPrimaryFile.

private void setPrimaryFile(String path) {
    if (fileChecks_ == null)
        return;
    for (int i = 0; i < fileChecks_.size(); i++) {
        CheckBox fileCheck = fileChecks_.get(i);
        if (fileCheck.getText().equals(path)) {
            // don't allow the user to unselect the primary file
            fileCheck.setEnabled(false);
            // make this bold and move it to the top
            fileCheck.getElement().getStyle().setFontWeight(FontWeight.BOLD);
            fileListPanel_.remove(fileCheck);
            fileListPanel_.insert(fileCheck, 0);
        }
    }
}
Also used : CheckBox(com.google.gwt.user.client.ui.CheckBox)

Example 3 with CheckBox

use of com.google.gwt.user.client.ui.CheckBox in project rstudio by rstudio.

the class RSConnectDeploy method checkUncheckAll.

private void checkUncheckAll() {
    allChecked_ = !allChecked_;
    for (CheckBox box : fileChecks_) {
        // don't toggle state for disabled boxes, or common Shiny .R filenames
        String file = box.getText().toLowerCase();
        if (box.isEnabled() && file != "ui.r" && file != "server.r" && file != "app.r") {
            box.setValue(allChecked_);
        }
    }
    checkUncheckAllButton_.setText(allChecked_ ? "Uncheck All" : "Check All");
}
Also used : CheckBox(com.google.gwt.user.client.ui.CheckBox)

Example 4 with CheckBox

use of com.google.gwt.user.client.ui.CheckBox in project rstudio by rstudio.

the class RSConnectDeploy method addFile.

private void addFile(String path, boolean checked) {
    CheckBox fileCheck = new CheckBox(path);
    fileCheck.setValue(checked);
    fileListPanel_.add(fileCheck);
    fileChecks_.add(fileCheck);
}
Also used : CheckBox(com.google.gwt.user.client.ui.CheckBox)

Example 5 with CheckBox

use of com.google.gwt.user.client.ui.CheckBox in project rstudio by rstudio.

the class UnsavedChangesDialog method createMainWidget.

@Override
protected Widget createMainWidget() {
    // create cell table
    targetsCellTable_ = new CellTable<UnsavedChangesTarget>(15, UnsavedChangesCellTableResources.INSTANCE, KEY_PROVIDER);
    selectionModel_ = new MultiSelectionModel<UnsavedChangesTarget>(KEY_PROVIDER);
    targetsCellTable_.setSelectionModel(selectionModel_, DefaultSelectionEventManager.<UnsavedChangesTarget>createCheckboxManager());
    targetsCellTable_.setWidth("100%", true);
    // add columns
    addSelectionColumn();
    addIconColumn();
    addNameAndPathColumn();
    // hook-up data provider 
    dataProvider_ = new ListDataProvider<UnsavedChangesTarget>();
    dataProvider_.setList(targets_);
    dataProvider_.addDataDisplay(targetsCellTable_);
    targetsCellTable_.setPageSize(targets_.size());
    // select all by default
    for (UnsavedChangesTarget editingTarget : dataProvider_.getList()) selectionModel_.setSelected(editingTarget, true);
    // enclose cell table in scroll panel
    ScrollPanel scrollPanel = new ScrollPanel();
    scrollPanel.setStylePrimaryName(RESOURCES.styles().targetScrollPanel());
    scrollPanel.setWidget(targetsCellTable_);
    if (dataProvider_.getList().size() > 4)
        scrollPanel.setHeight("280px");
    // always save check box (may not be shown)
    chkAlwaysSave_ = new CheckBox(alwaysSaveOption_);
    // main widget
    VerticalPanel panel = new VerticalPanel();
    Label captionLabel = new Label("The following files have unsaved changes:");
    captionLabel.setStylePrimaryName(RESOURCES.styles().captionLabel());
    panel.add(captionLabel);
    panel.add(scrollPanel);
    if (!StringUtil.isNullOrEmpty(alwaysSaveOption_)) {
        panel.add(chkAlwaysSave_);
        panel.setCellHeight(chkAlwaysSave_, "30px");
        panel.setCellVerticalAlignment(chkAlwaysSave_, HasVerticalAlignment.ALIGN_MIDDLE);
    }
    return panel;
}
Also used : VerticalPanel(com.google.gwt.user.client.ui.VerticalPanel) UnsavedChangesTarget(org.rstudio.studio.client.workbench.model.UnsavedChangesTarget) CheckBox(com.google.gwt.user.client.ui.CheckBox) Label(com.google.gwt.user.client.ui.Label) ScrollPanel(com.google.gwt.user.client.ui.ScrollPanel)

Aggregations

CheckBox (com.google.gwt.user.client.ui.CheckBox)36 VerticalPanel (com.google.gwt.user.client.ui.VerticalPanel)9 Test (org.junit.Test)9 ClickEvent (com.google.gwt.event.dom.client.ClickEvent)7 ClickHandler (com.google.gwt.event.dom.client.ClickHandler)7 Label (com.google.gwt.user.client.ui.Label)7 FlowPanel (com.google.gwt.user.client.ui.FlowPanel)6 ListBox (com.google.gwt.user.client.ui.ListBox)5 TreeItem (com.google.gwt.user.client.ui.TreeItem)4 JsArrayString (com.google.gwt.core.client.JsArrayString)3 Button (com.google.gwt.user.client.ui.Button)3 Grid (com.google.gwt.user.client.ui.Grid)3 HTML (com.google.gwt.user.client.ui.HTML)3 HorizontalPanel (com.google.gwt.user.client.ui.HorizontalPanel)3 TextBox (com.google.gwt.user.client.ui.TextBox)3 GerritCallback (com.google.gerrit.client.rpc.GerritCallback)2 OnEditEnabler (com.google.gerrit.client.ui.OnEditEnabler)2 ChangeEvent (com.google.gwt.event.dom.client.ChangeEvent)2 ChangeHandler (com.google.gwt.event.dom.client.ChangeHandler)2 ScrollPanel (com.google.gwt.user.client.ui.ScrollPanel)2