use of com.github.bordertech.wcomponents.WButton in project wcomponents by BorderTech.
the class WTabAndCollapsibleExample method newVisibilityToggleForTab.
/**
* Creates a button to toggle the visibility of a tab.
*
* @param idx the index of the tab.
* @return a button which toggles the visibility of the tab.
*/
private WButton newVisibilityToggleForTab(final int idx) {
WButton toggleButton = new WButton("Toggle visibility of tab " + (idx + 1));
toggleButton.setAction(new Action() {
@Override
public void execute(final ActionEvent event) {
boolean tabVisible = tabset.isTabVisible(idx);
tabset.setTabVisible(idx, !tabVisible);
}
});
return toggleButton;
}
use of com.github.bordertech.wcomponents.WButton in project wcomponents by BorderTech.
the class WDialogExample_Test method testModalDialog.
@Test
public void testModalDialog() {
// Launch the web browser to the LDE
WebDriver driver = getDriver();
WDialogExample example = (WDialogExample) getUi();
String expectedText = example.getModalText();
final WButton testButton = example.getModalButton();
// Display the modal dialog
driver.findElement(byWComponent(testButton)).click();
Assert.assertTrue("Should be displaying the dialog", driver.getPageSource().contains(expectedText));
}
use of com.github.bordertech.wcomponents.WButton in project wcomponents by BorderTech.
the class WDialogExample_Test method testModalDialogSearch.
@Test
public void testModalDialogSearch() {
// Launch the web browser to the LDE
SeleniumWComponentsWebDriver driver = getDriver();
WDialogExample example = (WDialogExample) getUi();
final WButton testButton = example.getModalButton();
// Display the modal dialog
driver.findElement(byWComponent(testButton)).click();
driver.findWTextField(byWComponentPath("WDialogExample$SelectPersonPanel/WTextField[0]")).sendKeys("First");
driver.findWTextField(byWComponentPath("WDialogExample$SelectPersonPanel/WTextField[1]")).sendKeys("Last");
driver.findElement(byWComponentPath("WDialogExample$SelectPersonPanel/WButton[1]")).click();
driver.findElement(byWComponentPath("WDialogExample$SelectPersonPanel/WRadioButtonSelect", "Last, First")).click();
driver.findElement(byWComponentPath("WDialogExample$SelectPersonPanel/WButton[1]")).click();
String message = driver.findElementImmediate(byWComponentPath("WMessageBox")).getText();
Assert.assertTrue("Incorrect message text", message.contains("Selected: Last, First"));
}
use of com.github.bordertech.wcomponents.WButton in project wcomponents by BorderTech.
the class WDialogExample_Test method testModelessDialog.
@Test
public void testModelessDialog() {
// Launch the web browser to the LDE
WebDriver driver = getDriver();
WDialogExample example = (WDialogExample) getUi();
String expectedText = example.getNonModalText();
final WButton testButton = example.getNonModalButton();
// Display the modeless dialog
driver.findElement(byWComponent(testButton)).click();
Assert.assertTrue("Should not be displaying the dialog", driver.getPageSource().contains(expectedText));
}
use of com.github.bordertech.wcomponents.WButton in project wcomponents by BorderTech.
the class WTableRenderer method paintTableActions.
/**
* Paints the table actions of the table.
*
* @param table the table to paint the table actions for.
* @param renderContext the RenderContext to paint to.
*/
private void paintTableActions(final WTable table, final WebXmlRenderContext renderContext) {
XmlStringBuilder xml = renderContext.getWriter();
List<WButton> tableActions = table.getActions();
if (!tableActions.isEmpty()) {
boolean hasActions = false;
for (WButton button : tableActions) {
if (!button.isVisible()) {
continue;
}
if (!hasActions) {
hasActions = true;
xml.appendTag("ui:actions");
}
xml.appendTag("ui:action");
List<WTable.ActionConstraint> constraints = table.getActionConstraints(button);
if (constraints != null) {
for (WTable.ActionConstraint constraint : constraints) {
int minRows = constraint.getMinSelectedRowCount();
int maxRows = constraint.getMaxSelectedRowCount();
String message = constraint.getMessage();
String type = constraint.isError() ? "error" : "warning";
xml.appendTagOpen("ui:condition");
xml.appendOptionalAttribute("minSelectedRows", minRows > 0, minRows);
xml.appendOptionalAttribute("maxSelectedRows", maxRows > 0, maxRows);
xml.appendAttribute("selectedOnOther", this.selectedOnOther);
xml.appendAttribute("type", type);
xml.appendAttribute("message", I18nUtilities.format(null, message));
xml.appendEnd();
}
}
button.paint(renderContext);
xml.appendEndTag("ui:action");
}
if (hasActions) {
xml.appendEndTag("ui:actions");
}
}
}
Aggregations