use of com.github.bordertech.wcomponents.WTextField in project wcomponents by BorderTech.
the class TableLoadPerformance method setupWDataTable.
/**
* Setup WTable.
*/
private void setupWDataTable() {
WTextField col1 = new WTextField();
col1.setIdName("my1");
col1.setReadOnly(true);
WTextField col2 = new WTextField();
col2.setIdName("my2");
col2.setReadOnly(true);
WDateField col3 = new WDateField();
col3.setIdName("my3");
col3.setReadOnly(true);
datatable.addColumn(new WTableColumn("COL1", col1));
datatable.addColumn(new WTableColumn("COL2", col2));
datatable.addColumn(new WTableColumn("COL3", col3));
datatable.setExpandMode(WDataTable.ExpandMode.CLIENT);
datatable.setIdName("wdt");
}
use of com.github.bordertech.wcomponents.WTextField in project wcomponents by BorderTech.
the class WTableOptionsExample method addColumns.
/**
* @param table the table to add columns
*/
private void addColumns(final WTable table) {
// Column - First name
WTextField textField = new WTextField();
textField.setToolTip("First name");
table.addColumn(new WTableColumn("First name", textField));
// Column - Last name
textField = new WTextField();
textField.setToolTip("Last name");
table.addColumn(new WTableColumn("Last name", textField));
// Column - Date field
WDateField dateField = new WDateField();
dateField.setToolTip("Date of birth");
table.addColumn(new WTableColumn("Date of birth", dateField));
}
use of com.github.bordertech.wcomponents.WTextField in project wcomponents by BorderTech.
the class WCheckBoxSelectExample method addExampleUsingLookupTable.
/**
* This example creates the WCheckBoxSelect using an a look up table. All other optional properties are in their default state.
* <p>Note for Framework devs: the unit tests for this Example are used to test the Selenium WebElement extension and this example is expected
* to be: the first WCheckBoxSelect in the example; and to be interactive; and to have the 9 options of the "australian_state" lookup table.
*/
private void addExampleUsingLookupTable() {
add(new WHeading(HeadingLevel.H3, "WCheckBoxSelect created using a lookup table"));
final WCheckBoxSelect select = new WCheckBoxSelect("australian_state");
final WTextField text = new WTextField();
text.setReadOnly(true);
text.setText(NO_SELECTION);
WButton update = new WButton("Select");
update.setAction(new Action() {
@Override
public void execute(final ActionEvent event) {
String output = select.getSelected().isEmpty() ? NO_SELECTION : "The selected states are: " + select.getSelected();
text.setText(output);
}
});
select.setDefaultSubmitButton(update);
add(new WLabel("Select a state or territory", select));
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 WLabelExample method addNestedFieldExamples.
/**
* Examples showing WLabel with a nested input control WComponent.
* This is VERY dangerous as only a very few WComponents are valid for this scenario. If you go down this route: stop!!
* These are really here for framework testing, not as examples as to how to do things.
*/
private void addNestedFieldExamples() {
add(new WHeading(HeadingLevel.H2, "Label nesting which is technically OK"));
/* Just because it is OK to do this does not mean you should! So these "examples" have far fewer comments. */
WPanel errorLayoutPanel = new WPanel();
errorLayoutPanel.setLayout(new FlowLayout(FlowLayout.VERTICAL, Size.LARGE));
errorLayoutPanel.setMargin(new Margin(null, null, Size.XL, null));
add(errorLayoutPanel);
errorLayoutPanel.add(new ExplanatoryText("This example shows WLabels with a single nested simple form control WTextField." + " This is not a contravention of the HTML specification but you should not do it."));
WLabel outerLabel = new WLabel("Label with nested WTextField and not 'for' anything");
errorLayoutPanel.add(outerLabel);
outerLabel.add(new WTextField());
WTextField innerField = new WTextField();
outerLabel = new WLabel("Label 'for' nested WTextField", innerField);
errorLayoutPanel.add(outerLabel);
outerLabel.add(innerField);
}
use of com.github.bordertech.wcomponents.WTextField in project wcomponents by BorderTech.
the class WRadioButtonSelectExample method makeSimpleExample.
/**
* Make a simple editable example. The label for this example is used to get the example for use in the unit tests.
*/
private void makeSimpleExample() {
add(new WHeading(HeadingLevel.H3, "Simple WRadioButtonSelect"));
WPanel examplePanel = new WPanel();
examplePanel.setLayout(new FlowLayout(FlowLayout.VERTICAL, Size.MEDIUM));
add(examplePanel);
/**
* The radio button select.
*/
final WRadioButtonSelect rbSelect = new WRadioButtonSelect("australian_state");
final WTextField text = new WTextField();
text.setReadOnly(true);
text.setText(NO_SELECTION);
WButton update = new WButton("Update");
update.setAction(new Action() {
@Override
public void execute(final ActionEvent event) {
text.setText("The selected item is: " + rbSelect.getSelected());
}
});
// setting the default submit button improves usability. It can be set on a WPanel or the WRadioButtonSelect directly
examplePanel.setDefaultSubmitButton(update);
examplePanel.add(new WLabel("Select a state or territory", rbSelect));
examplePanel.add(rbSelect);
examplePanel.add(text);
examplePanel.add(update);
add(new WAjaxControl(update, text));
}
Aggregations