Search in sources :

Example 76 with Label

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

the class ProjectTemplateWidget method textInput.

private ProjectTemplateWidgetItem textInput(final ProjectTemplateWidgetDescription description) {
    final TextBox primaryWidget = new TextBox();
    primaryWidget.setWidth("180px");
    String defaultValue = description.getDefault();
    if (!StringUtil.isNullOrEmpty(defaultValue))
        primaryWidget.setText(defaultValue);
    Grid grid = new Grid(1, 2);
    primaryWidget.getElement().setAttribute("spellcheck", "false");
    grid.setWidget(0, 0, new Label(ensureEndsWithColon(description.getLabel())));
    grid.setWidget(0, 1, primaryWidget);
    return new ProjectTemplateWidgetItem(grid, new Collector() {

        @Override
        public void collectInput(JsObject receiver) {
            String value = primaryWidget.getValue();
            receiver.setString(description.getParameter(), value);
        }
    });
}
Also used : JsObject(org.rstudio.core.client.js.JsObject) Grid(com.google.gwt.user.client.ui.Grid) Label(com.google.gwt.user.client.ui.Label) TextBox(com.google.gwt.user.client.ui.TextBox) FileChooserTextBox(org.rstudio.core.client.widget.FileChooserTextBox) JsArrayString(com.google.gwt.core.client.JsArrayString)

Example 77 with Label

use of com.google.gwt.user.client.ui.Label 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 78 with Label

use of com.google.gwt.user.client.ui.Label 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)

Example 79 with Label

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

the class RmdTemplateOptionsWidget method addFormatOptions.

private void addFormatOptions(RmdTemplateFormat format) {
    if (format.getNotes().length() > 0 && allowFormatChange_) {
        labelFormatNotes_.setText(format.getNotes());
        labelFormatNotes_.setVisible(true);
    } else {
        labelFormatNotes_.setVisible(false);
    }
    optionWidgets_ = new ArrayList<RmdFormatOption>();
    JsArrayString options = format.getOptions();
    for (int i = 0; i < options.length(); i++) {
        RmdFormatOption optionWidget;
        RmdTemplateFormatOption option = findOption(format.getName(), options.get(i));
        if (option == null)
            continue;
        String initialValue = option.getDefaultValue();
        // check to see whether a value for this format and option were
        // specified in the front matter
        String frontMatterValue = getFrontMatterDefault(format.getName(), option.getName());
        if (frontMatterValue != null)
            initialValue = frontMatterValue;
        optionWidget = createWidgetForOption(option, initialValue);
        if (optionWidget == null)
            continue;
        optionWidget.asWidget().addStyleName(style.optionWidget());
        FlowPanel panel = null;
        String category = option.getCategory();
        if (tabs_.containsKey(category)) {
            panel = tabs_.get(category);
        } else {
            ScrollPanel scrollPanel = new ScrollPanel();
            panel = new FlowPanel();
            scrollPanel.add(panel);
            optionsTabs_.add(scrollPanel, new Label(category));
            tabs_.put(category, panel);
        }
        panel.add(optionWidget);
        optionWidgets_.add(optionWidget);
    }
    // we need to center the tabs and overlay them on the top edge of the
    // content; to do this, it is necessary to nuke a couple of the inline
    // styles used by the default GWT tab panel. 
    Element tabOuter = (Element) optionsTabs_.getElement().getChild(1);
    tabOuter.getStyle().setOverflow(Overflow.VISIBLE);
    Element tabInner = (Element) tabOuter.getFirstChild();
    tabInner.getStyle().clearWidth();
}
Also used : RmdTemplateFormatOption(org.rstudio.studio.client.rmarkdown.model.RmdTemplateFormatOption) Element(com.google.gwt.dom.client.Element) FlowPanel(com.google.gwt.user.client.ui.FlowPanel) Label(com.google.gwt.user.client.ui.Label) JsArrayString(com.google.gwt.core.client.JsArrayString) JsArrayString(com.google.gwt.core.client.JsArrayString) ScrollPanel(com.google.gwt.user.client.ui.ScrollPanel)

Example 80 with Label

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

the class BrowseAddinsDialog method emptyTableLabel.

private Label emptyTableLabel(String caption) {
    Label label = new Label(caption);
    label.getElement().getStyle().setMarginTop(20, Unit.PX);
    label.getElement().getStyle().setColor("#888");
    return label;
}
Also used : Label(com.google.gwt.user.client.ui.Label)

Aggregations

Label (com.google.gwt.user.client.ui.Label)106 HorizontalPanel (com.google.gwt.user.client.ui.HorizontalPanel)22 Test (org.junit.Test)19 VerticalPanel (com.google.gwt.user.client.ui.VerticalPanel)17 ClickEvent (com.google.gwt.event.dom.client.ClickEvent)11 ClickHandler (com.google.gwt.event.dom.client.ClickHandler)11 SimplePanel (com.google.gwt.user.client.ui.SimplePanel)10 ArrayList (java.util.ArrayList)10 FlowPanel (com.google.gwt.user.client.ui.FlowPanel)9 TextBox (com.google.gwt.user.client.ui.TextBox)9 Image (com.google.gwt.user.client.ui.Image)8 ChangeEvent (com.google.gwt.event.dom.client.ChangeEvent)7 ChangeHandler (com.google.gwt.event.dom.client.ChangeHandler)7 CheckBox (com.google.gwt.user.client.ui.CheckBox)7 NpTextBox (com.google.gwtexpui.globalkey.client.NpTextBox)7 HTML (com.google.gwt.user.client.ui.HTML)6 JsArrayString (com.google.gwt.core.client.JsArrayString)5 Element (com.google.gwt.dom.client.Element)5 KeyUpEvent (com.google.gwt.event.dom.client.KeyUpEvent)5 KeyUpHandler (com.google.gwt.event.dom.client.KeyUpHandler)5