use of com.github.bordertech.wcomponents.WDateField in project wcomponents by BorderTech.
the class DataTableBeanExample method createTable.
/**
* Creates and configures the table to be used by the 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()));
return tbl;
}
use of com.github.bordertech.wcomponents.WDateField 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.WDateField in project wcomponents by BorderTech.
the class TableLoadPerformance method setupWTable.
/**
* Setup WTable.
*/
private void setupWTable() {
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);
table.addColumn(new WTableColumn("COL1", col1));
table.addColumn(new WTableColumn("COL2", col2));
table.addColumn(new WTableColumn("COL3", col3));
table.setExpandMode(WTable.ExpandMode.CLIENT);
table.setIdName("wt");
LevelDetails level = new LevelDetails("documents", TravelDocPanel.class, true);
SimpleBeanBoundTableModel model = new SimpleBeanBoundTableModel(new String[] { "firstName", "lastName", "dateOfBirth" }, level);
table.setTableModel(model);
}
use of com.github.bordertech.wcomponents.WDateField 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, new WText("Footer 1")));
// Column - Last name
textField = new WTextField();
textField.setToolTip("Last name");
table.addColumn(new WTableColumn("Last name", textField, new WText("Footer 2")));
// Column - Date field
WDateField dateField = new WDateField();
dateField.setToolTip("Date of birth");
table.addColumn(new WTableColumn("Date of birth", dateField, new WText("Footer 3")));
}
use of com.github.bordertech.wcomponents.WDateField in project wcomponents by BorderTech.
the class WDateFieldExample method addDateRangeExample.
/**
* Add date range example.
*/
private void addDateRangeExample() {
add(new WHeading(HeadingLevel.H2, "Example of a date range component"));
WFieldSet dateRange = new WFieldSet("Enter the expected arrival and departure dates.");
add(dateRange);
WPanel dateRangePanel = new WPanel();
dateRangePanel.setLayout(new FlowLayout(FlowLayout.LEFT, Size.MEDIUM));
dateRange.add(dateRangePanel);
final WDateField arrivalDate = new WDateField();
final WDateField departureDate = new WDateField();
// One could add some validation rules around this so that "arrival" was always earlier than or equal to "departure"
WLabel arrivalLabel = new WLabel("Arrival", arrivalDate);
arrivalLabel.setHint("dd MMM yyyy");
WLabel departureLabel = new WLabel("Departure", departureDate);
departureLabel.setHint("dd MMM yyyy");
dateRangePanel.add(arrivalLabel);
dateRangePanel.add(arrivalDate);
dateRangePanel.add(departureLabel);
dateRangePanel.add(departureDate);
// subordinate control to ensure that the departure date is only enabled if the arrival date is populated
WSubordinateControl control = new WSubordinateControl();
add(control);
Rule rule = new Rule(new Equal(arrivalDate, null));
control.addRule(rule);
rule.addActionOnTrue(new Disable(departureDate));
rule.addActionOnFalse(new Enable(departureDate));
control.addRule(rule);
}
Aggregations