Search in sources :

Example 16 with TextBox

use of com.google.gwt.user.client.ui.TextBox in project gwt-test-utils by gwt-test-utils.

the class TextBoxTest method value.

@Test
public void value() {
    // Given
    TextBox t = new TextBox();
    // Preconditions
    assertThat(t.getValue()).isEqualTo("");
    // When
    t.setValue("value");
    // Then
    assertThat(t.getValue()).isEqualTo("value");
}
Also used : TextBox(com.google.gwt.user.client.ui.TextBox) Test(org.junit.Test)

Example 17 with TextBox

use of com.google.gwt.user.client.ui.TextBox in project gwt-test-utils by gwt-test-utils.

the class TextBoxTest method selectAll.

@Test
public void selectAll() {
    // Given
    TextBox t = new TextBox();
    t.setValue("0123456789");
    RootPanel.get().add(t);
    // When
    t.selectAll();
    // Then
    assertThat(t.getSelectionLength()).isEqualTo(10);
    assertThat(t.getSelectedText()).isEqualTo("0123456789");
}
Also used : TextBox(com.google.gwt.user.client.ui.TextBox) Test(org.junit.Test)

Example 18 with TextBox

use of com.google.gwt.user.client.ui.TextBox in project gwt-test-utils by gwt-test-utils.

the class TextBoxTest method name.

@Test
public void name() {
    // Given
    TextBox t = new TextBox();
    // Preconditions
    assertThat(t.getName()).isEqualTo("");
    // When
    t.setName("name");
    // Then
    assertThat(t.getName()).isEqualTo("name");
}
Also used : TextBox(com.google.gwt.user.client.ui.TextBox) Test(org.junit.Test)

Example 19 with TextBox

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

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

TextBox (com.google.gwt.user.client.ui.TextBox)32 Test (org.junit.Test)10 Label (com.google.gwt.user.client.ui.Label)9 VerticalPanel (com.google.gwt.user.client.ui.VerticalPanel)7 ClickEvent (com.google.gwt.event.dom.client.ClickEvent)6 ClickHandler (com.google.gwt.event.dom.client.ClickHandler)6 HorizontalPanel (com.google.gwt.user.client.ui.HorizontalPanel)6 Grid (com.google.gwt.user.client.ui.Grid)4 HashMap (java.util.HashMap)3 ChangeEvent (com.google.gwt.event.dom.client.ChangeEvent)2 ChangeHandler (com.google.gwt.event.dom.client.ChangeHandler)2 KeyPressEvent (com.google.gwt.event.dom.client.KeyPressEvent)2 KeyPressHandler (com.google.gwt.event.dom.client.KeyPressHandler)2 CheckBox (com.google.gwt.user.client.ui.CheckBox)2 FlexTable (com.google.gwt.user.client.ui.FlexTable)2 HTML (com.google.gwt.user.client.ui.HTML)2 PasswordTextBox (com.google.gwt.user.client.ui.PasswordTextBox)2 AttributeDefinition (cz.metacentrum.perun.webgui.model.AttributeDefinition)2 ThemedButton (org.rstudio.core.client.widget.ThemedButton)2 StringListPanel (com.google.gerrit.client.StringListPanel)1