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);
}
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();
}
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("");
}
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();
}
});
}
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);
}
Aggregations