Search in sources :

Example 11 with Button

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

the class ButtonTest method beforeButtonTest.

@Before
public void beforeButtonTest() {
    // create the button in a standard JVM
    b = new Button();
    // needs to be attached
    RootPanel.get().add(b);
}
Also used : Button(com.google.gwt.user.client.ui.Button) Before(org.junit.Before)

Example 12 with Button

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

the class SimplePanelTest method remove.

@Test
public void remove() {
    // Given
    SimplePanel panel = new SimplePanel();
    Button b = new Button();
    panel.add(b);
    // When & Then
    assertThat(panel.remove(b)).isTrue();
}
Also used : Button(com.google.gwt.user.client.ui.Button) SimplePanel(com.google.gwt.user.client.ui.SimplePanel) Test(org.junit.Test)

Example 13 with Button

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

the class DebugIdDisabledTest method ensureDebugId_Disabled.

@Test
public void ensureDebugId_Disabled() {
    // Given
    Button b = new Button();
    // When
    b.ensureDebugId("myDebugId");
    // Then
    assertThat(b.getElement().getId()).isEqualTo("");
}
Also used : Button(com.google.gwt.user.client.ui.Button) Test(org.junit.Test)

Example 14 with Button

use of com.google.gwt.user.client.ui.Button in project gerrit by GerritCodeReview.

the class MyWatchedProjectsScreen method createWidgets.

protected void createWidgets() {
    nameBox = new RemoteSuggestBox(new ProjectNameSuggestOracle());
    nameBox.setVisibleLength(50);
    nameBox.setHintText(Util.C.defaultProjectName());
    nameBox.addSelectionHandler(new SelectionHandler<String>() {

        @Override
        public void onSelection(SelectionEvent<String> event) {
            doAddNew();
        }
    });
    filterTxt = new HintTextBox();
    filterTxt.setVisibleLength(50);
    filterTxt.setHintText(Util.C.defaultFilter());
    filterTxt.addKeyPressHandler(new KeyPressHandler() {

        @Override
        public void onKeyPress(KeyPressEvent event) {
            if (event.getNativeEvent().getKeyCode() == KeyCodes.KEY_ENTER) {
                doAddNew();
            }
        }
    });
    addNew = new Button(Util.C.buttonWatchProject());
    addNew.addClickHandler(new ClickHandler() {

        @Override
        public void onClick(final ClickEvent event) {
            doAddNew();
        }
    });
    browse = new Button(Util.C.buttonBrowseProjects());
    browse.addClickHandler(new ClickHandler() {

        @Override
        public void onClick(final ClickEvent event) {
            // under page header
            int top = grid.getAbsoluteTop() - 50;
            // Try to place it to the right of everything else, but not
            // right justified
            int left = 5 + Math.max(grid.getAbsoluteLeft() + grid.getOffsetWidth(), watchesTab.getAbsoluteLeft() + watchesTab.getOffsetWidth());
            projectsPopup.setPreferredCoordinates(top, left);
            projectsPopup.displayPopup();
        }
    });
    watchesTab = new MyWatchesTable();
    delSel = new Button(Util.C.buttonDeleteSshKey());
    delSel.addClickHandler(new ClickHandler() {

        @Override
        public void onClick(final ClickEvent event) {
            watchesTab.deleteChecked();
        }
    });
}
Also used : HintTextBox(com.google.gerrit.client.ui.HintTextBox) ClickEvent(com.google.gwt.event.dom.client.ClickEvent) KeyPressHandler(com.google.gwt.event.dom.client.KeyPressHandler) ClickHandler(com.google.gwt.event.dom.client.ClickHandler) KeyPressEvent(com.google.gwt.event.dom.client.KeyPressEvent) Button(com.google.gwt.user.client.ui.Button) ProjectNameSuggestOracle(com.google.gerrit.client.ui.ProjectNameSuggestOracle) RemoteSuggestBox(com.google.gerrit.client.ui.RemoteSuggestBox)

Example 15 with Button

use of com.google.gwt.user.client.ui.Button in project gerrit by GerritCodeReview.

the class AccountGroupInfoScreen method initOwner.

private void initOwner() {
    final VerticalPanel ownerPanel = new VerticalPanel();
    ownerPanel.setStyleName(Gerrit.RESOURCES.css().groupOwnerPanel());
    ownerPanel.add(new SmallHeading(AdminConstants.I.headingOwner()));
    final AccountGroupSuggestOracle accountGroupOracle = new AccountGroupSuggestOracle();
    ownerTxt = new RemoteSuggestBox(accountGroupOracle);
    ownerTxt.setStyleName(Gerrit.RESOURCES.css().groupOwnerTextBox());
    ownerTxt.setVisibleLength(60);
    ownerPanel.add(ownerTxt);
    saveOwner = new Button(AdminConstants.I.buttonChangeGroupOwner());
    saveOwner.setEnabled(false);
    saveOwner.addClickHandler(new ClickHandler() {

        @Override
        public void onClick(final ClickEvent event) {
            final String newOwner = ownerTxt.getText().trim();
            if (newOwner.length() > 0) {
                AccountGroup.UUID ownerUuid = accountGroupOracle.getUUID(newOwner);
                String ownerId = ownerUuid != null ? ownerUuid.get() : newOwner;
                GroupApi.setGroupOwner(getGroupUUID(), ownerId, new GerritCallback<GroupInfo>() {

                    @Override
                    public void onSuccess(final GroupInfo result) {
                        updateOwnerGroup(result);
                        saveOwner.setEnabled(false);
                    }
                });
            }
        }
    });
    ownerPanel.add(saveOwner);
    add(ownerPanel);
}
Also used : AccountGroupSuggestOracle(com.google.gerrit.client.ui.AccountGroupSuggestOracle) SmallHeading(com.google.gerrit.client.ui.SmallHeading) GerritCallback(com.google.gerrit.client.rpc.GerritCallback) VerticalPanel(com.google.gwt.user.client.ui.VerticalPanel) ClickHandler(com.google.gwt.event.dom.client.ClickHandler) Button(com.google.gwt.user.client.ui.Button) GroupInfo(com.google.gerrit.client.info.GroupInfo) ClickEvent(com.google.gwt.event.dom.client.ClickEvent) RemoteSuggestBox(com.google.gerrit.client.ui.RemoteSuggestBox)

Aggregations

Button (com.google.gwt.user.client.ui.Button)50 ClickEvent (com.google.gwt.event.dom.client.ClickEvent)30 ClickHandler (com.google.gwt.event.dom.client.ClickHandler)30 FlowPanel (com.google.gwt.user.client.ui.FlowPanel)14 Test (org.junit.Test)14 SmallHeading (com.google.gerrit.client.ui.SmallHeading)7 VerticalPanel (com.google.gwt.user.client.ui.VerticalPanel)7 Grid (com.google.gwt.user.client.ui.Grid)6 GerritCallback (com.google.gerrit.client.rpc.GerritCallback)5 OnEditEnabler (com.google.gerrit.client.ui.OnEditEnabler)5 NpTextBox (com.google.gwtexpui.globalkey.client.NpTextBox)5 GwtTestTest (com.googlecode.gwt.test.GwtTestTest)5 ActionButton (com.google.gerrit.client.actions.ActionButton)4 Style (com.google.gwt.dom.client.Style)4 KeyPressEvent (com.google.gwt.event.dom.client.KeyPressEvent)4 KeyPressHandler (com.google.gwt.event.dom.client.KeyPressHandler)4 ComplexPanel (com.google.gwt.user.client.ui.ComplexPanel)4 VoidResult (com.google.gerrit.client.VoidResult)3 NativeString (com.google.gerrit.client.rpc.NativeString)3 HintTextBox (com.google.gerrit.client.ui.HintTextBox)3