Search in sources :

Example 1 with DirectoryChooserTextBox

use of org.rstudio.core.client.widget.DirectoryChooserTextBox 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 2 with DirectoryChooserTextBox

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

the class ExistingDirectoryPage method onAddWidgets.

@Override
protected void onAddWidgets() {
    existingProjectDir_ = new DirectoryChooserTextBox("Project working directory:", null);
    addWidget(existingProjectDir_);
}
Also used : DirectoryChooserTextBox(org.rstudio.core.client.widget.DirectoryChooserTextBox)

Example 3 with DirectoryChooserTextBox

use of org.rstudio.core.client.widget.DirectoryChooserTextBox 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)

Aggregations

DirectoryChooserTextBox (org.rstudio.core.client.widget.DirectoryChooserTextBox)3 Label (com.google.gwt.user.client.ui.Label)2 TextBox (com.google.gwt.user.client.ui.TextBox)2 VerticalPanel (com.google.gwt.user.client.ui.VerticalPanel)2 KeyDownEvent (com.google.gwt.event.dom.client.KeyDownEvent)1 KeyDownHandler (com.google.gwt.event.dom.client.KeyDownHandler)1 CheckBox (com.google.gwt.user.client.ui.CheckBox)1 HorizontalPanel (com.google.gwt.user.client.ui.HorizontalPanel)1 SessionInfo (org.rstudio.studio.client.workbench.model.SessionInfo)1 UIPrefs (org.rstudio.studio.client.workbench.prefs.model.UIPrefs)1