Search in sources :

Example 21 with WDateField

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;
}
Also used : WTableColumn(com.github.bordertech.wcomponents.WTableColumn) WDataTable(com.github.bordertech.wcomponents.WDataTable) WDateField(com.github.bordertech.wcomponents.WDateField) WTextField(com.github.bordertech.wcomponents.WTextField)

Example 22 with WDateField

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");
}
Also used : WTableColumn(com.github.bordertech.wcomponents.WTableColumn) WDateField(com.github.bordertech.wcomponents.WDateField) WTextField(com.github.bordertech.wcomponents.WTextField)

Example 23 with WDateField

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);
}
Also used : WTableColumn(com.github.bordertech.wcomponents.WTableColumn) SimpleBeanBoundTableModel(com.github.bordertech.wcomponents.SimpleBeanBoundTableModel) WDateField(com.github.bordertech.wcomponents.WDateField) WTextField(com.github.bordertech.wcomponents.WTextField) LevelDetails(com.github.bordertech.wcomponents.SimpleBeanBoundTableModel.LevelDetails)

Example 24 with WDateField

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")));
}
Also used : WTableColumn(com.github.bordertech.wcomponents.WTableColumn) WText(com.github.bordertech.wcomponents.WText) WDateField(com.github.bordertech.wcomponents.WDateField) WTextField(com.github.bordertech.wcomponents.WTextField)

Example 25 with WDateField

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);
}
Also used : WFieldSet(com.github.bordertech.wcomponents.WFieldSet) FlowLayout(com.github.bordertech.wcomponents.layout.FlowLayout) Equal(com.github.bordertech.wcomponents.subordinate.Equal) WPanel(com.github.bordertech.wcomponents.WPanel) WSubordinateControl(com.github.bordertech.wcomponents.subordinate.WSubordinateControl) WDateField(com.github.bordertech.wcomponents.WDateField) Enable(com.github.bordertech.wcomponents.subordinate.Enable) Rule(com.github.bordertech.wcomponents.subordinate.Rule) WHeading(com.github.bordertech.wcomponents.WHeading) Disable(com.github.bordertech.wcomponents.subordinate.Disable) WLabel(com.github.bordertech.wcomponents.WLabel)

Aggregations

WDateField (com.github.bordertech.wcomponents.WDateField)27 Test (org.junit.Test)11 WTextField (com.github.bordertech.wcomponents.WTextField)8 WTableColumn (com.github.bordertech.wcomponents.WTableColumn)7 Date (java.util.Date)7 SimpleDateFormat (java.text.SimpleDateFormat)5 WDataTable (com.github.bordertech.wcomponents.WDataTable)4 WNumberField (com.github.bordertech.wcomponents.WNumberField)4 WFieldLayout (com.github.bordertech.wcomponents.WFieldLayout)3 WHeading (com.github.bordertech.wcomponents.WHeading)3 WLabel (com.github.bordertech.wcomponents.WLabel)3 WText (com.github.bordertech.wcomponents.WText)3 SystemException (com.github.bordertech.wcomponents.util.SystemException)3 ArrayList (java.util.ArrayList)3 AbstractWSelectList (com.github.bordertech.wcomponents.AbstractWSelectList)2 RadioButtonGroup (com.github.bordertech.wcomponents.RadioButtonGroup)2 TableTreeNode (com.github.bordertech.wcomponents.TableTreeNode)2 WCheckBox (com.github.bordertech.wcomponents.WCheckBox)2 WCheckBoxSelect (com.github.bordertech.wcomponents.WCheckBoxSelect)2 WFieldSet (com.github.bordertech.wcomponents.WFieldSet)2