use of com.github.bordertech.wcomponents.WTextField in project wcomponents by BorderTech.
the class TableCellWithActionExample method createTable.
/**
* Creates and configures the table to be used by the example. The table is configured with global rather than user
* data. Although this is not a realistic scenario, it will suffice for this example.
*
* @return a new configured table.
*/
private WDataTable createTable() {
WDataTable table = new WDataTable();
table.addColumn(new WTableColumn("First name", new WTextField()));
table.addColumn(new WTableColumn("Last name", new WTextField()));
table.addColumn(new WTableColumn("DOB", new WDateField()));
table.addColumn(new WTableColumn("Action", new ExampleButton()));
table.setExpandMode(ExpandMode.CLIENT);
table.setDataModel(createTableModel());
return table;
}
use of com.github.bordertech.wcomponents.WTextField in project wcomponents by BorderTech.
the class TreeTableExample method createTable.
/**
* Creates and configures the table to be used by the example. The table is configured with global rather than user
* data. Although this is not a realistic scenario, it will suffice for this example.
*
* @return a new configured table.
*/
private WDataTable createTable() {
WDataTable tbl = new WDataTable();
tbl.addColumn(new WTableColumn("First name", new WTextField()));
tbl.addColumn(new WTableColumn("Last name", new WTextField()));
tbl.addColumn(new WTableColumn("DOB", new WDateField()));
tbl.setExpandMode(ExpandMode.CLIENT);
TableTreeNode root = createTree();
tbl.setDataModel(new ExampleTreeTableModel(root));
return tbl;
}
use of com.github.bordertech.wcomponents.WTextField in project wcomponents by BorderTech.
the class SubordinateControlOptionsExample method setupTrigger.
/**
* Setup the trigger for the subordinate control.
*/
private void setupTrigger() {
String label = drpTriggerType.getSelected() + " Trigger";
WFieldLayout layout = new WFieldLayout();
layout.setLabelWidth(LABEL_WIDTH);
buildControlPanel.add(layout);
switch((TriggerType) drpTriggerType.getSelected()) {
case RadioButtonGroup:
trigger = new RadioButtonGroup();
WFieldSet rbSet = new WFieldSet("Select an option");
RadioButtonGroup group = (RadioButtonGroup) trigger;
WRadioButton rb1 = group.addRadioButton("A");
WRadioButton rb2 = group.addRadioButton("B");
WRadioButton rb3 = group.addRadioButton("C");
rbSet.add(group);
rbSet.add(rb1);
rbSet.add(new WLabel("A", rb1));
rbSet.add(new WText("\u00a0"));
rbSet.add(rb2);
rbSet.add(new WLabel("B", rb2));
rbSet.add(new WText("\u00a0"));
rbSet.add(rb3);
rbSet.add(new WLabel("C", rb3));
layout.addField(label, rbSet);
return;
case CheckBox:
trigger = new WCheckBox();
break;
case CheckBoxSelect:
trigger = new WCheckBoxSelect(LOOKUP_TABLE_NAME);
break;
case DateField:
trigger = new WDateField();
break;
case Dropdown:
trigger = new WDropdown(new TableWithNullOption(LOOKUP_TABLE_NAME));
break;
case EmailField:
trigger = new WEmailField();
break;
case MultiSelect:
trigger = new WMultiSelect(LOOKUP_TABLE_NAME);
break;
case MultiSelectPair:
trigger = new WMultiSelectPair(LOOKUP_TABLE_NAME);
break;
case NumberField:
trigger = new WNumberField();
break;
case PartialDateField:
trigger = new WPartialDateField();
break;
case PasswordField:
trigger = new WPasswordField();
break;
case PhoneNumberField:
trigger = new WPhoneNumberField();
break;
case RadioButtonSelect:
trigger = new WRadioButtonSelect(LOOKUP_TABLE_NAME);
break;
case SingleSelect:
trigger = new WSingleSelect(LOOKUP_TABLE_NAME);
break;
case TextArea:
trigger = new WTextArea();
((WTextArea) trigger).setMaxLength(1000);
break;
case TextField:
trigger = new WTextField();
break;
default:
throw new SystemException("Trigger type not valid");
}
layout.addField(label, trigger);
}
use of com.github.bordertech.wcomponents.WTextField in project wcomponents by BorderTech.
the class WCheckBoxSelectExample method addExampleUsingArrayList.
/**
* This example creates the WCheckBoxSelect from a List of CarOptions.
*/
private void addExampleUsingArrayList() {
add(new WHeading(HeadingLevel.H3, "WCheckBoxSelect created using an array list of options"));
List<CarOption> options = new ArrayList<>();
options.add(new CarOption("1", "Ferrari", "F-360"));
options.add(new CarOption("2", "Mercedez Benz", "amg"));
options.add(new CarOption("3", "Nissan", "Skyline"));
options.add(new CarOption("5", "Toyota", "Prius"));
final WCheckBoxSelect select = new WCheckBoxSelect(options);
select.setToolTip("Cars");
final WTextField text = new WTextField();
text.setReadOnly(true);
text.setText(NO_SELECTION);
WButton update = new WButton("Select Cars");
update.setAction(new Action() {
@Override
public void execute(final ActionEvent event) {
String output = select.getSelected().isEmpty() ? NO_SELECTION : "The selected cars are: " + select.getSelected();
text.setText(output);
}
});
select.setDefaultSubmitButton(update);
add(select);
add(update);
add(text);
add(new WAjaxControl(update, text));
}
use of com.github.bordertech.wcomponents.WTextField in project wcomponents by BorderTech.
the class WCheckBoxSelectExample method addColumnSelectExample.
/**
* adds a WCheckBoxSelect with LAYOUT_COLUMN in 2 columns.
*/
private void addColumnSelectExample() {
add(new WHeading(HeadingLevel.H3, "WCheckBoxSelect laid out in columns"));
add(new ExplanatoryText("Setting the layout to COLUMN will make the check boxes be rendered in 'n' columns. The number of columns is" + " determined by the layoutColumnCount property."));
final WCheckBoxSelect select = new WCheckBoxSelect("australian_state");
select.setToolTip("Make a selection");
select.setButtonLayout(WCheckBoxSelect.LAYOUT_COLUMNS);
select.setButtonColumns(2);
add(select);
add(new WHeading(HeadingLevel.H3, "Options equal to columns"));
String[] options = new String[] { "Dog", "Cat", "Bird" };
final WCheckBoxSelect select2 = new WCheckBoxSelect(options);
select2.setToolTip("Animals");
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().isEmpty() ? NO_SELECTION : "The selected animals are: " + select2.getSelected();
text.setText(output);
}
});
select2.setDefaultSubmitButton(update);
add(select2);
add(update);
add(text);
add(new WAjaxControl(update, text));
}
Aggregations