Search in sources :

Example 26 with CheckBox

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

the class CheckBoxTest method title.

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

Example 27 with CheckBox

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

the class CheckBoxTest method click_disabled.

@Test
public void click_disabled() {
    // Given
    CheckBox cb = new CheckBox();
    cb.setEnabled(false);
    // When
    Browser.click(cb);
    // Then
    assertThat(cb.getValue()).isFalse();
    assertThat(errorStringBuilder).startsWith("Cannot dispatch 'mouseover' event : the targeted element has to be enabled : <span class=\"gwt-CheckBox gwt-CheckBox-disabled\"><input type=\"checkbox\"");
}
Also used : CheckBox(com.google.gwt.user.client.ui.CheckBox) Test(org.junit.Test)

Example 28 with CheckBox

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

the class TreeTest method beforeTreeTest.

@Before
public void beforeTreeTest() {
    // Create a tree with a few items in it.
    parent = new TreeItem(new SafeHtmlBuilder().appendEscaped("parent").toSafeHtml());
    item0 = parent.addItem(new SafeHtmlBuilder().appendEscaped("item0").toSafeHtml());
    item1 = parent.addItem(new SafeHtmlBuilder().appendEscaped("item1").toSafeHtml());
    // Add a CheckBox to the tree
    item2 = new TreeItem(new CheckBox("item2"));
    parent.addItem(item2);
    tree = new Tree();
    tree.addItem(parent);
    // Add it to the root panel.
    RootPanel.get().add(tree);
    assertThat(tree.isVisible()).isTrue();
    clickedTreeItem = null;
}
Also used : TreeItem(com.google.gwt.user.client.ui.TreeItem) CheckBox(com.google.gwt.user.client.ui.CheckBox) Tree(com.google.gwt.user.client.ui.Tree) SafeHtmlBuilder(com.google.gwt.safehtml.shared.SafeHtmlBuilder) Before(org.junit.Before)

Example 29 with CheckBox

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

the class BuildToolsPanel method checkBox.

protected CheckBox checkBox(String caption) {
    CheckBox chk = new CheckBox(caption);
    chk.addStyleName(RES.styles().buildToolsCheckBox());
    return chk;
}
Also used : CheckBox(com.google.gwt.user.client.ui.CheckBox)

Example 30 with CheckBox

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

CheckBox (com.google.gwt.user.client.ui.CheckBox)36 VerticalPanel (com.google.gwt.user.client.ui.VerticalPanel)9 Test (org.junit.Test)9 ClickEvent (com.google.gwt.event.dom.client.ClickEvent)7 ClickHandler (com.google.gwt.event.dom.client.ClickHandler)7 Label (com.google.gwt.user.client.ui.Label)7 FlowPanel (com.google.gwt.user.client.ui.FlowPanel)6 ListBox (com.google.gwt.user.client.ui.ListBox)5 TreeItem (com.google.gwt.user.client.ui.TreeItem)4 JsArrayString (com.google.gwt.core.client.JsArrayString)3 Button (com.google.gwt.user.client.ui.Button)3 Grid (com.google.gwt.user.client.ui.Grid)3 HTML (com.google.gwt.user.client.ui.HTML)3 HorizontalPanel (com.google.gwt.user.client.ui.HorizontalPanel)3 TextBox (com.google.gwt.user.client.ui.TextBox)3 GerritCallback (com.google.gerrit.client.rpc.GerritCallback)2 OnEditEnabler (com.google.gerrit.client.ui.OnEditEnabler)2 ChangeEvent (com.google.gwt.event.dom.client.ChangeEvent)2 ChangeHandler (com.google.gwt.event.dom.client.ChangeHandler)2 ScrollPanel (com.google.gwt.user.client.ui.ScrollPanel)2