Search in sources :

Example 31 with CheckBox

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

the class NewDirectoryPage method onAddWidgets.

@Override
protected void onAddWidgets() {
    NewProjectResources.Styles styles = NewProjectResources.INSTANCE.styles();
    HorizontalPanel panel = new HorizontalPanel();
    panel.addStyleName(styles.wizardMainColumn());
    // create the dir name label
    dirNameLabel_ = new Label("Directory name:");
    dirNameLabel_.addStyleName(styles.wizardTextEntryLabel());
    // top panel widgets
    onAddTopPanelWidgets(panel);
    // dir name
    VerticalPanel namePanel = new VerticalPanel();
    namePanel.addStyleName(styles.newProjectDirectoryName());
    namePanel.add(dirNameLabel_);
    txtProjectName_ = new TextBox();
    txtProjectName_.setWidth("100%");
    txtProjectName_.getElement().setAttribute("spellcheck", "false");
    namePanel.add(txtProjectName_);
    panel.add(namePanel);
    addWidget(panel);
    onAddBodyWidgets();
    addSpacer();
    // project dir
    newProjectParent_ = new DirectoryChooserTextBox("Create project as subdirectory of:", txtProjectName_);
    addWidget(newProjectParent_);
    // if git is available then add git init
    UIPrefs uiPrefs = RStudioGinjector.INSTANCE.getUIPrefs();
    SessionInfo sessionInfo = RStudioGinjector.INSTANCE.getSession().getSessionInfo();
    HorizontalPanel optionsPanel = null;
    if (getOptionsSideBySide())
        optionsPanel = new HorizontalPanel();
    chkGitInit_ = new CheckBox("Create a git repository");
    chkGitInit_.addStyleName(styles.wizardCheckbox());
    if (sessionInfo.isVcsAvailable(VCSConstants.GIT_ID)) {
        chkGitInit_.setValue(uiPrefs.newProjGitInit().getValue());
        chkGitInit_.getElement().getStyle().setMarginRight(7, Unit.PX);
        if (optionsPanel != null) {
            optionsPanel.add(chkGitInit_);
        } else {
            addSpacer();
            addWidget(chkGitInit_);
        }
    }
    // Initialize project with packrat
    chkPackratInit_ = new CheckBox("Use packrat with this project");
    chkPackratInit_.setValue(uiPrefs.newProjUsePackrat().getValue());
    if (!sessionInfo.getPackratAvailable()) {
        chkPackratInit_.setValue(false);
        chkPackratInit_.setVisible(false);
    }
    if (optionsPanel != null) {
        optionsPanel.add(chkPackratInit_);
    } else {
        addSpacer();
        addWidget(chkPackratInit_);
    }
    if (optionsPanel != null) {
        addSpacer();
        addWidget(optionsPanel);
    }
}
Also used : VerticalPanel(com.google.gwt.user.client.ui.VerticalPanel) CheckBox(com.google.gwt.user.client.ui.CheckBox) HorizontalPanel(com.google.gwt.user.client.ui.HorizontalPanel) Label(com.google.gwt.user.client.ui.Label) SessionInfo(org.rstudio.studio.client.workbench.model.SessionInfo) TextBox(com.google.gwt.user.client.ui.TextBox) DirectoryChooserTextBox(org.rstudio.core.client.widget.DirectoryChooserTextBox) DirectoryChooserTextBox(org.rstudio.core.client.widget.DirectoryChooserTextBox) UIPrefs(org.rstudio.studio.client.workbench.prefs.model.UIPrefs)

Example 32 with CheckBox

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

the class PreferencesPane method checkboxPref.

protected CheckBox checkboxPref(String label, final PrefValue<Boolean> prefValue, String title) {
    final CheckBox checkBox = new CheckBox(label, false);
    lessSpaced(checkBox);
    checkBox.setValue(prefValue.getGlobalValue());
    if (title != null)
        checkBox.setTitle(title);
    onApplyCommands_.add(new Command() {

        public void execute() {
            prefValue.setGlobalValue(checkBox.getValue());
        }
    });
    return checkBox;
}
Also used : Command(com.google.gwt.user.client.Command) CheckBox(com.google.gwt.user.client.ui.CheckBox)

Example 33 with CheckBox

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

the class ChooseEncodingDialog method createMainWidget.

@Override
protected Widget createMainWidget() {
    listBox_ = new ListBox();
    listBox_.setMultipleSelect(true);
    listBox_.setVisibleItemCount(15);
    listBox_.setWidth("350px");
    setEncodings(commonEncodings_, currentEncoding_);
    CheckBox showAll = new CheckBox("Show all encodings");
    showAll.addValueChangeHandler(new ValueChangeHandler<Boolean>() {

        public void onValueChange(ValueChangeEvent<Boolean> e) {
            if (e.getValue())
                setEncodings(allEncodings_, currentEncoding_);
            else
                setEncodings(commonEncodings_, currentEncoding_);
        }
    });
    setCheckBoxMargins(showAll, 8, 12);
    VerticalPanel panel = new VerticalPanel();
    panel.add(listBox_);
    panel.add(showAll);
    if (includeSaveAsDefault_) {
        saveAsDefault_ = new CheckBox("Set as default encoding for " + "source files");
        setCheckBoxMargins(showAll, 8, 0);
        setCheckBoxMargins(saveAsDefault_, 3, 12);
        panel.add(saveAsDefault_);
    }
    return panel;
}
Also used : VerticalPanel(com.google.gwt.user.client.ui.VerticalPanel) CheckBox(com.google.gwt.user.client.ui.CheckBox) ListBox(com.google.gwt.user.client.ui.ListBox)

Example 34 with CheckBox

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

the class MyWatchesTable method addNotifyButton.

protected void addNotifyButton(final ProjectWatchInfo.Type type, final ProjectWatchInfo info, final int row, final int col) {
    final CheckBox cbox = new CheckBox();
    cbox.addClickHandler(new ClickHandler() {

        @Override
        public void onClick(final ClickEvent event) {
            final Boolean oldVal = info.notify(type);
            info.notify(type, cbox.getValue());
            cbox.setEnabled(false);
            AccountApi.updateWatchedProject("self", info, new GerritCallback<JsArray<ProjectWatchInfo>>() {

                @Override
                public void onSuccess(JsArray<ProjectWatchInfo> watchedProjects) {
                    cbox.setEnabled(true);
                }

                @Override
                public void onFailure(Throwable caught) {
                    cbox.setEnabled(true);
                    info.notify(type, oldVal);
                    cbox.setValue(oldVal);
                    super.onFailure(caught);
                }
            });
        }
    });
    cbox.setValue(info.notify(type));
    table.setWidget(row, col, cbox);
}
Also used : GerritCallback(com.google.gerrit.client.rpc.GerritCallback) ClickHandler(com.google.gwt.event.dom.client.ClickHandler) JsArray(com.google.gwt.core.client.JsArray) CheckBox(com.google.gwt.user.client.ui.CheckBox) ClickEvent(com.google.gwt.event.dom.client.ClickEvent)

Example 35 with CheckBox

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

the class MyWatchesTable method populate.

protected void populate(final int row, final ProjectWatchInfo info) {
    final FlowPanel fp = new FlowPanel();
    fp.add(new ProjectLink(info.project(), new Project.NameKey(info.project())));
    if (info.filter() != null) {
        Label filter = new Label(info.filter());
        filter.setStyleName(Gerrit.RESOURCES.css().watchedProjectFilter());
        fp.add(filter);
    }
    table.setWidget(row, 1, new CheckBox());
    table.setWidget(row, 2, fp);
    addNotifyButton(ProjectWatchInfo.Type.NEW_CHANGES, info, row, 3);
    addNotifyButton(ProjectWatchInfo.Type.NEW_PATCHSETS, info, row, 4);
    addNotifyButton(ProjectWatchInfo.Type.ALL_COMMENTS, info, row, 5);
    addNotifyButton(ProjectWatchInfo.Type.SUBMITTED_CHANGES, info, row, 6);
    addNotifyButton(ProjectWatchInfo.Type.ABANDONED_CHANGES, info, row, 7);
    final FlexCellFormatter fmt = table.getFlexCellFormatter();
    fmt.addStyleName(row, 1, Gerrit.RESOURCES.css().iconCell());
    fmt.addStyleName(row, 2, Gerrit.RESOURCES.css().dataCell());
    fmt.addStyleName(row, 3, Gerrit.RESOURCES.css().dataCell());
    fmt.addStyleName(row, 4, Gerrit.RESOURCES.css().dataCell());
    fmt.addStyleName(row, 5, Gerrit.RESOURCES.css().dataCell());
    fmt.addStyleName(row, 6, Gerrit.RESOURCES.css().dataCell());
    fmt.addStyleName(row, 7, Gerrit.RESOURCES.css().dataCell());
    setRowItem(row, info);
}
Also used : ProjectLink(com.google.gerrit.client.ui.ProjectLink) CheckBox(com.google.gwt.user.client.ui.CheckBox) FlexCellFormatter(com.google.gwt.user.client.ui.FlexTable.FlexCellFormatter) FlowPanel(com.google.gwt.user.client.ui.FlowPanel) Label(com.google.gwt.user.client.ui.Label)

Aggregations

CheckBox (com.google.gwt.user.client.ui.CheckBox)37 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