Search in sources :

Example 36 with Label

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

the class VersionControlPage method onAddWidgets.

@Override
protected void onAddWidgets() {
    NewProjectResources.Styles styles = NewProjectResources.INSTANCE.styles();
    VerticalPanel urlPanel = new VerticalPanel();
    urlPanel.addStyleName(styles.wizardMainColumn());
    Label urlLabel = new Label("Repository URL:");
    urlLabel.addStyleName(styles.wizardTextEntryLabel());
    urlPanel.add(urlLabel);
    txtRepoUrl_ = new TextBox();
    txtRepoUrl_.addDomHandler(new KeyDownHandler() {

        public void onKeyDown(KeyDownEvent event) {
            handleAutoFillCheckoutDir();
        }
    }, KeyDownEvent.getType());
    txtRepoUrl_.setWidth("100%");
    urlPanel.add(txtRepoUrl_);
    addWidget(urlPanel);
    addSpacer();
    txtUsername_ = new TextBox();
    txtUsername_.setWidth("100%");
    if (includeCredentials()) {
        VerticalPanel usernamePanel = new VerticalPanel();
        usernamePanel.addStyleName(styles.wizardMainColumn());
        Label usernameLabel = new Label("Username (if required for this repository URL):");
        usernameLabel.addStyleName(styles.wizardTextEntryLabel());
        usernamePanel.add(usernameLabel);
        usernamePanel.add(txtUsername_);
        addWidget(usernamePanel);
        addSpacer();
    }
    Label dirNameLabel = new Label("Project directory name:");
    dirNameLabel.addStyleName(styles.wizardTextEntryLabel());
    addWidget(dirNameLabel);
    txtDirName_ = new TextBox();
    txtDirName_.addValueChangeHandler(new ValueChangeHandler<String>() {

        @Override
        public void onValueChange(ValueChangeEvent<String> event) {
            if (!event.getValue().equals(guessRepoDir()))
                suppressDirNameDetection_ = true;
        }
    });
    txtDirName_.addStyleName(styles.wizardMainColumn());
    addWidget(txtDirName_);
    addSpacer();
    existingRepoDestDir_ = new DirectoryChooserTextBox("Create project as subdirectory of:", txtRepoUrl_);
    addWidget(existingRepoDestDir_);
}
Also used : VerticalPanel(com.google.gwt.user.client.ui.VerticalPanel) KeyDownEvent(com.google.gwt.event.dom.client.KeyDownEvent) KeyDownHandler(com.google.gwt.event.dom.client.KeyDownHandler) Label(com.google.gwt.user.client.ui.Label) TextBox(com.google.gwt.user.client.ui.TextBox) DirectoryChooserTextBox(org.rstudio.core.client.widget.DirectoryChooserTextBox) DirectoryChooserTextBox(org.rstudio.core.client.widget.DirectoryChooserTextBox)

Example 37 with Label

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

the class ProjectCompilePdfPreferencesPane method addHeader.

private void addHeader(String caption) {
    PreferencesDialogBaseResources baseRes = PreferencesDialogBaseResources.INSTANCE;
    Label pdfCompilationLabel = new Label(caption);
    pdfCompilationLabel.addStyleName(baseRes.styles().headerLabel());
    nudgeRight(pdfCompilationLabel);
    add(pdfCompilationLabel);
}
Also used : Label(com.google.gwt.user.client.ui.Label) PreferencesDialogBaseResources(org.rstudio.core.client.prefs.PreferencesDialogBaseResources)

Example 38 with Label

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

the class ProjectPackratPreferencesPane method initialize.

@Override
protected void initialize(RProjectOptions options) {
    Styles styles = RES.styles();
    Label label = new Label("Packrat is a dependency management tool that makes your " + "R code more isolated, portable, and reproducible by " + "giving your project its own privately managed package " + "library.");
    spaced(label);
    add(label);
    PackratContext context = options.getPackratContext();
    RProjectPackratOptions packratOptions = options.getPackratOptions();
    chkUsePackrat_ = new CheckBox("Use packrat with this project");
    chkUsePackrat_.setValue(context.isPackified());
    chkUsePackrat_.addValueChangeHandler(new ValueChangeHandler<Boolean>() {

        @Override
        public void onValueChange(ValueChangeEvent<Boolean> event) {
            if (event.getValue())
                verifyPrerequisites();
            else
                manageUI(false);
        }
    });
    spaced(chkUsePackrat_);
    add(chkUsePackrat_);
    chkAutoSnapshot_ = new CheckBox("Automatically snapshot local changes");
    chkAutoSnapshot_.setValue(packratOptions.getAutoSnapshot());
    lessSpaced(chkAutoSnapshot_);
    add(chkAutoSnapshot_);
    String vcsName = session_.getSessionInfo().getVcsName();
    chkVcsIgnoreLib_ = new CheckBox(vcsName + " ignore packrat library");
    chkVcsIgnoreLib_.setValue(packratOptions.getVcsIgnoreLib());
    lessSpaced(chkVcsIgnoreLib_);
    add(chkVcsIgnoreLib_);
    chkVcsIgnoreSrc_ = new CheckBox(vcsName + " ignore packrat sources");
    chkVcsIgnoreSrc_.setValue(packratOptions.getVcsIgnoreSrc());
    lessSpaced(chkVcsIgnoreSrc_);
    add(chkVcsIgnoreSrc_);
    chkUseCache_ = new CheckBox("Use global cache for installed packages");
    chkUseCache_.setValue(packratOptions.getUseCache());
    spaced(chkUseCache_);
    add(chkUseCache_);
    panelExternalPackages_ = new VerticalPanel();
    panelExternalPackages_.add(new LabelWithHelp("External packages (comma separated):", "packrat_external_packages", false));
    taExternalPackages_ = new FixedTextArea(3);
    taExternalPackages_.addStyleName(styles.externalPackages());
    taExternalPackages_.setText(StringUtil.join(Arrays.asList(JsUtil.toStringArray(packratOptions.getExternalPackages())), ", "));
    taExternalPackages_.getElement().getStyle().setMarginBottom(8, Unit.PX);
    panelExternalPackages_.add(taExternalPackages_);
    add(panelExternalPackages_);
    widgetLocalRepos_ = new LocalRepositoriesWidget();
    String[] localRepos = JsUtil.toStringArray(packratOptions.getLocalRepos());
    for (int i = 0; i < localRepos.length; ++i) {
        widgetLocalRepos_.addItem(localRepos[i]);
    }
    add(widgetLocalRepos_);
    manageUI(context.isPackified());
    HelpLink helpLink = new HelpLink("Learn more about Packrat", "packrat", false);
    helpLink.getElement().getStyle().setMarginTop(15, Unit.PX);
    nudgeRight(helpLink);
    add(helpLink);
}
Also used : RProjectPackratOptions(org.rstudio.studio.client.projects.model.RProjectPackratOptions) LabelWithHelp(org.rstudio.core.client.widget.LabelWithHelp) Label(com.google.gwt.user.client.ui.Label) VerticalPanel(com.google.gwt.user.client.ui.VerticalPanel) CheckBox(com.google.gwt.user.client.ui.CheckBox) FixedTextArea(org.rstudio.core.client.widget.FixedTextArea) LocalRepositoriesWidget(org.rstudio.core.client.widget.LocalRepositoriesWidget) HelpLink(org.rstudio.studio.client.common.HelpLink) PackratContext(org.rstudio.studio.client.packrat.model.PackratContext)

Example 39 with Label

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

the class PresentationPane method zoom.

@Override
public void zoom(String title, String url, final Command onClosed) {
    // create the titlebar (no title for now)
    HorizontalPanel titlePanel = new HorizontalPanel();
    ThemeStyles styles = ThemeResources.INSTANCE.themeStyles();
    Label titleLabel = new Label(title);
    titleLabel.addStyleName(styles.fullscreenCaptionLabel());
    titlePanel.add(titleLabel);
    // create the frame
    AnchorableFrame frame = new PresentationFrame(true);
    frame.setSize("100%", "100%");
    // create the popup panel & add close handler 
    activeZoomPanel_ = new FullscreenPopupPanel(titlePanel, frame, false);
    activeZoomPanel_.addCloseHandler(new CloseHandler<PopupPanel>() {

        @Override
        public void onClose(CloseEvent<PopupPanel> event) {
            activeZoomPanel_ = null;
            onClosed.execute();
        }
    });
    // load the frame and show the zoom panel
    frame.navigate(url);
    activeZoomPanel_.center();
}
Also used : FullscreenPopupPanel(org.rstudio.core.client.widget.FullscreenPopupPanel) HorizontalPanel(com.google.gwt.user.client.ui.HorizontalPanel) ThemeStyles(org.rstudio.core.client.theme.res.ThemeStyles) Label(com.google.gwt.user.client.ui.Label) PopupPanel(com.google.gwt.user.client.ui.PopupPanel) FullscreenPopupPanel(org.rstudio.core.client.widget.FullscreenPopupPanel) AnchorableFrame(org.rstudio.core.client.widget.AnchorableFrame)

Example 40 with Label

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

the class RPubsUploadDialog method createMainWidget.

@Override
protected Widget createMainWidget() {
    Styles styles = RESOURCES.styles();
    SimplePanel mainPanel = new SimplePanel();
    mainPanel.addStyleName(styles.mainWidget());
    VerticalPanel verticalPanel = new VerticalPanel();
    HorizontalPanel headerPanel = new HorizontalPanel();
    headerPanel.addStyleName(styles.headerPanel());
    headerPanel.add(new Image(new ImageResource2x(RESOURCES.publishLarge2x())));
    Label headerLabel = new Label("Publish to RPubs");
    headerLabel.addStyleName(styles.headerLabel());
    headerPanel.add(headerLabel);
    headerPanel.setCellVerticalAlignment(headerLabel, HasVerticalAlignment.ALIGN_MIDDLE);
    verticalPanel.add(headerPanel);
    String msg;
    if (!isPublished_ && uploadId_.isEmpty()) {
        msg = "RPubs is a free service from RStudio for sharing " + "documents on the web. Click Publish to get " + "started.";
    } else {
        msg = "This document has already been published on RPubs. You can " + "choose to either update the existing RPubs document, or " + "create a new one.";
    }
    Label descLabel = new Label(msg);
    descLabel.addStyleName(styles.descLabel());
    verticalPanel.add(descLabel);
    // if we have a generator then show title and comment UI
    if (htmlGenerator_ != null) {
        Label titleLabel = new Label("Title (optional):");
        titleLabel.addStyleName(styles.fieldLabel());
        verticalPanel.add(titleLabel);
        titleTextBox_ = new TextBox();
        titleTextBox_.addStyleName(styles.titleTextBox());
        titleTextBox_.getElement().setAttribute("spellcheck", "false");
        verticalPanel.add(titleTextBox_);
        Label commentLabel = new Label("Comment (optional):");
        commentLabel.addStyleName(styles.fieldLabel());
        verticalPanel.add(commentLabel);
        commentTextArea_ = new FixedTextArea(6);
        commentTextArea_.addStyleName(styles.commentTextArea());
        verticalPanel.add(commentTextArea_);
        // not using either for now
        titleLabel.setVisible(false);
        titleTextBox_.setVisible(false);
        commentLabel.setVisible(false);
        commentTextArea_.setVisible(false);
        previewButton_ = new ThemedButton("Preview");
        previewButton_.addClickHandler(new ClickHandler() {

            @Override
            public void onClick(ClickEvent event) {
                htmlGenerator_.generateStaticHtml(titleTextBox_.getText().trim(), commentTextArea_.getText().trim(), new CommandWithArg<String>() {

                    @Override
                    public void execute(String rpubsFile) {
                        globalDisplay_.showHtmlFile(rpubsFile);
                    }
                });
            }
        });
        addLeftButton(previewButton_);
    }
    HTML warningLabel = new HTML("<strong>IMPORTANT: All documents published to RPubs are " + "publicly visible.</strong> You should " + "only publish documents that you wish to share publicly.");
    warningLabel.addStyleName(styles.warningLabel());
    verticalPanel.add(warningLabel);
    ThemedButton cancelButton = createCancelButton(new Operation() {

        @Override
        public void execute() {
            // if an upload is in progress then terminate it
            if (uploader_.isUploadInProgress()) {
                uploader_.terminateUpload();
            }
        }
    });
    continueButton_ = new ThemedButton("Publish", new ClickHandler() {

        @Override
        public void onClick(ClickEvent event) {
            performUpload(false);
        }
    });
    updateButton_ = new ThemedButton("Update Existing", new ClickHandler() {

        @Override
        public void onClick(ClickEvent event) {
            performUpload(true);
        }
    });
    createButton_ = new ThemedButton("Create New", new ClickHandler() {

        @Override
        public void onClick(ClickEvent event) {
            performUpload(false);
        }
    });
    if (!isPublished_ && uploadId_.isEmpty()) {
        addOkButton(continueButton_);
        addCancelButton(cancelButton);
    } else {
        addOkButton(updateButton_);
        addButton(createButton_);
        addCancelButton(cancelButton);
    }
    mainPanel.setWidget(verticalPanel);
    return mainPanel;
}
Also used : ClickEvent(com.google.gwt.event.dom.client.ClickEvent) Label(com.google.gwt.user.client.ui.Label) SimplePanel(com.google.gwt.user.client.ui.SimplePanel) HTML(com.google.gwt.user.client.ui.HTML) TextBox(com.google.gwt.user.client.ui.TextBox) CommandWithArg(org.rstudio.core.client.CommandWithArg) Operation(org.rstudio.core.client.widget.Operation) Image(com.google.gwt.user.client.ui.Image) ProgressImage(org.rstudio.core.client.widget.ProgressImage) ThemedButton(org.rstudio.core.client.widget.ThemedButton) VerticalPanel(com.google.gwt.user.client.ui.VerticalPanel) ClickHandler(com.google.gwt.event.dom.client.ClickHandler) FixedTextArea(org.rstudio.core.client.widget.FixedTextArea) HorizontalPanel(com.google.gwt.user.client.ui.HorizontalPanel) ImageResource2x(org.rstudio.core.client.resources.ImageResource2x)

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