Search in sources :

Example 1 with CaptionWithHelp

use of org.rstudio.core.client.widget.CaptionWithHelp in project rstudio by rstudio.

the class InstallPackageDialog method createMainWidget.

@Override
protected Widget createMainWidget() {
    // vertical panel
    VerticalPanel mainPanel = new VerticalPanel();
    mainPanel.setSpacing(2);
    mainPanel.setStylePrimaryName(RESOURCES.styles().mainWidget());
    // source type
    reposCaption_ = new CaptionWithHelp("Install from:", "Configuring Repositories", "configuring_repositories");
    reposCaption_.setIncludeVersionInfo(false);
    reposCaption_.setWidth("100%");
    mainPanel.add(reposCaption_);
    packageSourceListBox_ = new ListBox();
    packageSourceListBox_.setStylePrimaryName(RESOURCES.styles().packageSourceListBox());
    packageSourceListBox_.addStyleName(RESOURCES.styles().extraBottomPad());
    JsArrayString repos = installContext_.selectedRepositoryNames();
    if (repos.length() == 1) {
        packageSourceListBox_.addItem("Repository (" + repos.get(0) + ")");
    } else {
        StringBuilder reposItem = new StringBuilder();
        reposItem.append("Repository (");
        for (int i = 0; i < repos.length(); i++) {
            if (i != 0)
                reposItem.append(", ");
            reposItem.append(repos.get(i));
        }
        reposItem.append(")");
        packageSourceListBox_.addItem(reposItem.toString());
    }
    packageSourceListBox_.addItem("Package Archive File (" + installContext_.packageArchiveExtension() + ")");
    mainPanel.add(packageSourceListBox_);
    // source panel container
    sourcePanel_ = new SimplePanel();
    sourcePanel_.setStylePrimaryName(RESOURCES.styles().packageSourcePanel());
    // repos source panel
    reposSourcePanel_ = new FlowPanel();
    Label packagesLabel = new Label("Packages (separate multiple with space or comma):");
    packagesLabel.setStylePrimaryName(RESOURCES.styles().packagesLabel());
    reposSourcePanel_.add(packagesLabel);
    packagesTextBox_ = new MultipleItemSuggestTextBox();
    packagesSuggestBox_ = new SuggestBox(new PackageOracle(), packagesTextBox_);
    packagesSuggestBox_.setWidth("100%");
    packagesSuggestBox_.setLimit(20);
    packagesSuggestBox_.addStyleName(RESOURCES.styles().extraBottomPad());
    reposSourcePanel_.add(packagesSuggestBox_);
    sourcePanel_.setWidget(reposSourcePanel_);
    mainPanel.add(sourcePanel_);
    // archive source panel
    packageArchiveFile_ = new TextBoxWithButton("Package archive:", "Browse...", browseForArchiveClickHandler_);
    // create check box here because manageUIState accesses it
    installDependenciesCheckBox_ = new CheckBox();
    if (defaultInstallOptions_.getInstallFromRepository())
        packageSourceListBox_.setSelectedIndex(0);
    else
        packageSourceListBox_.setSelectedIndex(1);
    manageUIState();
    packageSourceListBox_.addChangeHandler(new ChangeHandler() {

        @Override
        public void onChange(ChangeEvent event) {
            manageUIState();
            if (!installFromRepository())
                packageArchiveFile_.click();
        }
    });
    mainPanel.add(new Label("Install to Library:"));
    // library list box
    libraryListBox_ = new ListBox();
    libraryListBox_.setWidth("100%");
    libraryListBox_.addStyleName(RESOURCES.styles().extraBottomPad());
    JsArrayString libPaths = installContext_.getWriteableLibraryPaths();
    int selectedIndex = 0;
    for (int i = 0; i < libPaths.length(); i++) {
        String libPath = libPaths.get(i);
        if (!installContext_.isDevModeOn()) {
            if (defaultInstallOptions_.getLibraryPath().equals(libPath))
                selectedIndex = i;
        }
        if (libPath.equals(installContext_.getDefaultLibraryPath()))
            libPath = libPath + " [Default]";
        libraryListBox_.addItem(libPath);
    }
    libraryListBox_.setSelectedIndex(selectedIndex);
    mainPanel.add(libraryListBox_);
    // install dependencies check box
    installDependenciesCheckBox_.addStyleName(RESOURCES.styles().installDependenciesCheckBox());
    installDependenciesCheckBox_.setText("Install dependencies");
    installDependenciesCheckBox_.setValue(defaultInstallOptions_.getInstallDependencies());
    mainPanel.add(installDependenciesCheckBox_);
    mainPanel.add(new HTML("<br/>"));
    return mainPanel;
}
Also used : MultipleItemSuggestTextBox(org.rstudio.core.client.widget.MultipleItemSuggestTextBox) Label(com.google.gwt.user.client.ui.Label) SimplePanel(com.google.gwt.user.client.ui.SimplePanel) HTML(com.google.gwt.user.client.ui.HTML) JsArrayString(com.google.gwt.core.client.JsArrayString) JsArrayString(com.google.gwt.core.client.JsArrayString) VerticalPanel(com.google.gwt.user.client.ui.VerticalPanel) SuggestBox(com.google.gwt.user.client.ui.SuggestBox) ChangeEvent(com.google.gwt.event.dom.client.ChangeEvent) TextBoxWithButton(org.rstudio.core.client.widget.TextBoxWithButton) ChangeHandler(com.google.gwt.event.dom.client.ChangeHandler) CheckBox(com.google.gwt.user.client.ui.CheckBox) FlowPanel(com.google.gwt.user.client.ui.FlowPanel) CaptionWithHelp(org.rstudio.core.client.widget.CaptionWithHelp) ListBox(com.google.gwt.user.client.ui.ListBox)

Example 2 with CaptionWithHelp

use of org.rstudio.core.client.widget.CaptionWithHelp in project rstudio by rstudio.

the class CreateKeyDialog method createMainWidget.

@Override
protected Widget createMainWidget() {
    Styles styles = RESOURCES.styles();
    VerticalPanel panel = new VerticalPanel();
    panel.addStyleName(styles.mainWidget());
    VerticalPanel namePanel = new VerticalPanel();
    namePanel.setWidth("100%");
    // path
    CaptionWithHelp pathCaption = new CaptionWithHelp("The RSA key will be created at:", "SSH/RSA key management", "rsa_key_help");
    pathCaption.setIncludeVersionInfo(false);
    pathCaption.setWidth("100%");
    namePanel.add(pathCaption);
    TextBox txtKeyPath = new TextBox();
    txtKeyPath.addStyleName(styles.keyPathTextBox());
    txtKeyPath.setReadOnly(true);
    txtKeyPath.setText(rsaSshKeyPath_.getPath());
    txtKeyPath.setWidth("100%");
    namePanel.add(txtKeyPath);
    panel.add(namePanel);
    HorizontalPanel passphrasePanel = new HorizontalPanel();
    passphrasePanel.addStyleName(styles.newSection());
    VerticalPanel passphrasePanel1 = new VerticalPanel();
    Label passphraseLabel1 = new Label("Passphrase (optional):");
    passphraseLabel1.addStyleName(styles.entryLabel());
    passphrasePanel1.add(passphraseLabel1);
    txtPassphrase_ = new PasswordTextBox();
    txtPassphrase_.addStyleName(styles.passphrase());
    passphrasePanel1.add(txtPassphrase_);
    passphrasePanel.add(passphrasePanel1);
    VerticalPanel passphrasePanel2 = new VerticalPanel();
    passphrasePanel2.addStyleName(styles.lastSection());
    Label passphraseLabel2 = new Label("Confirm:");
    passphraseLabel2.addStyleName(styles.entryLabel());
    passphrasePanel2.add(passphraseLabel2);
    txtConfirmPassphrase_ = new PasswordTextBox();
    txtConfirmPassphrase_.addStyleName(styles.passphraseConfirm());
    passphrasePanel2.add(txtConfirmPassphrase_);
    passphrasePanel.add(passphrasePanel2);
    panel.add(passphrasePanel);
    return panel;
}
Also used : VerticalPanel(com.google.gwt.user.client.ui.VerticalPanel) HorizontalPanel(com.google.gwt.user.client.ui.HorizontalPanel) Label(com.google.gwt.user.client.ui.Label) CaptionWithHelp(org.rstudio.core.client.widget.CaptionWithHelp) TextBox(com.google.gwt.user.client.ui.TextBox) PasswordTextBox(com.google.gwt.user.client.ui.PasswordTextBox) PasswordTextBox(com.google.gwt.user.client.ui.PasswordTextBox)

Aggregations

Label (com.google.gwt.user.client.ui.Label)2 VerticalPanel (com.google.gwt.user.client.ui.VerticalPanel)2 CaptionWithHelp (org.rstudio.core.client.widget.CaptionWithHelp)2 JsArrayString (com.google.gwt.core.client.JsArrayString)1 ChangeEvent (com.google.gwt.event.dom.client.ChangeEvent)1 ChangeHandler (com.google.gwt.event.dom.client.ChangeHandler)1 CheckBox (com.google.gwt.user.client.ui.CheckBox)1 FlowPanel (com.google.gwt.user.client.ui.FlowPanel)1 HTML (com.google.gwt.user.client.ui.HTML)1 HorizontalPanel (com.google.gwt.user.client.ui.HorizontalPanel)1 ListBox (com.google.gwt.user.client.ui.ListBox)1 PasswordTextBox (com.google.gwt.user.client.ui.PasswordTextBox)1 SimplePanel (com.google.gwt.user.client.ui.SimplePanel)1 SuggestBox (com.google.gwt.user.client.ui.SuggestBox)1 TextBox (com.google.gwt.user.client.ui.TextBox)1 MultipleItemSuggestTextBox (org.rstudio.core.client.widget.MultipleItemSuggestTextBox)1 TextBoxWithButton (org.rstudio.core.client.widget.TextBoxWithButton)1