use of com.github.bordertech.wcomponents.WTextField in project wcomponents by BorderTech.
the class WRadioButtonSelectExample method addColumnSelectExample.
/**
* adds a WRadioButtonSelect with LAYOUT_COLUMN in 3 columns.
*/
private void addColumnSelectExample() {
add(new WHeading(HeadingLevel.H3, "WRadioButtonSelect laid out in three columns"));
add(new ExplanatoryText("Setting the layout to COLUMN will make the radio buttons be rendered in 'n' columns. The number of columns is" + " determined by the layoutColumnCount property."));
final WRadioButtonSelect select = new WRadioButtonSelect("australian_state");
select.setButtonLayout(WRadioButtonSelect.LAYOUT_COLUMNS);
select.setButtonColumns(3);
add(new WLabel("Three column selection", select));
add(select);
add(new WHeading(HeadingLevel.H3, "Options equal to columns"));
String[] options = new String[] { "Dog", "Cat", "Bird" };
final WRadioButtonSelect select2 = new WRadioButtonSelect(options);
select2.setButtonColumns(3);
final WTextField text = new WTextField();
text.setReadOnly(true);
text.setText(NO_SELECTION);
WButton update = new WButton("Select Animals");
update.setAction(new Action() {
@Override
public void execute(final ActionEvent event) {
String output = select2.getSelected() == null ? NO_SELECTION : "The selected animal is: " + select2.getSelected();
text.setText(output);
}
});
select2.setDefaultSubmitButton(update);
add(new WLabel("Three columns and three options", select2));
add(select2);
add(update);
add(text);
add(new WAjaxControl(update, text));
}
use of com.github.bordertech.wcomponents.WTextField in project wcomponents by BorderTech.
the class DisableInGroup_Test method testActionType.
@Test
public void testActionType() {
SubordinateTarget target = new WTextField();
WComponentGroup<SubordinateTarget> group = new WComponentGroup<>();
group.addToGroup(target);
DisableInGroup action = new DisableInGroup(target, group);
Assert.assertEquals("Incorrect Action Type", action.getActionType(), AbstractAction.ActionType.DISABLEIN);
}
use of com.github.bordertech.wcomponents.WTextField in project wcomponents by BorderTech.
the class HideInGroup_Test method testActionType.
@Test
public void testActionType() {
SubordinateTarget target = new WTextField();
WComponentGroup<SubordinateTarget> group = new WComponentGroup<>();
group.addToGroup(target);
HideInGroup action = new HideInGroup(target, group);
Assert.assertEquals("Incorrect Action Type", action.getActionType(), AbstractAction.ActionType.HIDEIN);
}
use of com.github.bordertech.wcomponents.WTextField in project wcomponents by BorderTech.
the class ShowInGroup_Test method testActionType.
@Test
public void testActionType() {
SubordinateTarget target = new WTextField();
WComponentGroup<SubordinateTarget> group = new WComponentGroup<>();
group.addToGroup(target);
ShowInGroup action = new ShowInGroup(target, group);
Assert.assertEquals("Incorrect Action Type", action.getActionType(), AbstractAction.ActionType.SHOWIN);
}
use of com.github.bordertech.wcomponents.WTextField in project wcomponents by BorderTech.
the class WSubordinateControl_Test method testToString.
@Test
public void testToString() {
WCheckBox box = new WCheckBox();
SubordinateTarget target = new WTextField();
Rule rule = new Rule();
rule.setCondition(new Equal(box, Boolean.TRUE));
rule.addActionOnTrue(new Hide(target));
rule.addActionOnFalse(new Show(target));
WSubordinateControl control = new WSubordinateControl();
control.addRule(rule);
Assert.assertEquals("Incorrect toString for control", "RULE: if (WCheckBox=\"true\")\nthen\n [hide WTextField]\nelse\n [show WTextField]\n", control.toString());
}
Aggregations