Search in sources :

Example 1 with TextArea

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

the class ShowPublicKeyDialog method createMainWidget.

@Override
protected Widget createMainWidget() {
    VerticalPanel panel = new VerticalPanel();
    int mod = BrowseCap.hasMetaKey() ? KeyboardShortcut.META : KeyboardShortcut.CTRL;
    String cmdText = new KeyboardShortcut(mod, 'C').toString(true);
    HTML label = new HTML("Press " + cmdText + " to copy the key to the clipboard");
    label.addStyleName(RES.styles().viewPublicKeyLabel());
    panel.add(label);
    textArea_ = new TextArea();
    textArea_.setReadOnly(true);
    textArea_.setText(publicKey_);
    textArea_.addStyleName(RES.styles().viewPublicKeyContent());
    textArea_.setSize("400px", "250px");
    textArea_.getElement().setAttribute("spellcheck", "false");
    FontSizer.applyNormalFontSize(textArea_.getElement());
    panel.add(textArea_);
    return panel;
}
Also used : VerticalPanel(com.google.gwt.user.client.ui.VerticalPanel) KeyboardShortcut(org.rstudio.core.client.command.KeyboardShortcut) TextArea(com.google.gwt.user.client.ui.TextArea) HTML(com.google.gwt.user.client.ui.HTML)

Example 2 with TextArea

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

the class TextAreaTest method title.

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

Example 3 with TextArea

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

the class TextAreaTest method text.

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

Example 4 with TextArea

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

the class TextAreaTest method visible.

@Test
public void visible() {
    // Given
    TextArea t = new TextArea();
    // Preconditions
    assertThat(t.isVisible()).isEqualTo(true);
    // When
    t.setVisible(false);
    // Then
    assertThat(t.isVisible()).isEqualTo(false);
}
Also used : TextArea(com.google.gwt.user.client.ui.TextArea) Test(org.junit.Test)

Example 5 with TextArea

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

the class TextAreaTest method getCursorPos.

@Test
public void getCursorPos() {
    // Given
    TextArea t = new TextArea();
    t.setText("myText");
    GwtReflectionUtils.setPrivateFieldValue(t, "attached", true);
    // When
    t.setCursorPos(2);
    // Then
    assertThat(t.getCursorPos()).isEqualTo(2);
}
Also used : TextArea(com.google.gwt.user.client.ui.TextArea) Test(org.junit.Test)

Aggregations

TextArea (com.google.gwt.user.client.ui.TextArea)9 Test (org.junit.Test)7 ChangeEvent (com.google.gwt.event.dom.client.ChangeEvent)1 ChangeHandler (com.google.gwt.event.dom.client.ChangeHandler)1 ClickEvent (com.google.gwt.event.dom.client.ClickEvent)1 ClickHandler (com.google.gwt.event.dom.client.ClickHandler)1 Grid (com.google.gwt.user.client.ui.Grid)1 HTML (com.google.gwt.user.client.ui.HTML)1 Label (com.google.gwt.user.client.ui.Label)1 TextBox (com.google.gwt.user.client.ui.TextBox)1 TextBoxBase (com.google.gwt.user.client.ui.TextBoxBase)1 VerticalPanel (com.google.gwt.user.client.ui.VerticalPanel)1 ArrayList (java.util.ArrayList)1 HashMap (java.util.HashMap)1 KeyboardShortcut (org.rstudio.core.client.command.KeyboardShortcut)1 ThemedButton (org.rstudio.core.client.widget.ThemedButton)1