Search in sources :

Example 71 with WTextField

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

Example 72 with WTextField

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

Example 73 with WTextField

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));
}
Also used : Action(com.github.bordertech.wcomponents.Action) WAjaxControl(com.github.bordertech.wcomponents.WAjaxControl) ActionEvent(com.github.bordertech.wcomponents.ActionEvent) WTextField(com.github.bordertech.wcomponents.WTextField) WButton(com.github.bordertech.wcomponents.WButton) WHeading(com.github.bordertech.wcomponents.WHeading) WCheckBoxSelect(com.github.bordertech.wcomponents.WCheckBoxSelect) WLabel(com.github.bordertech.wcomponents.WLabel)

Example 74 with WTextField

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);
}
Also used : FlowLayout(com.github.bordertech.wcomponents.layout.FlowLayout) WPanel(com.github.bordertech.wcomponents.WPanel) ExplanatoryText(com.github.bordertech.wcomponents.examples.common.ExplanatoryText) WTextField(com.github.bordertech.wcomponents.WTextField) WHeading(com.github.bordertech.wcomponents.WHeading) Margin(com.github.bordertech.wcomponents.Margin) WLabel(com.github.bordertech.wcomponents.WLabel)

Example 75 with WTextField

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));
}
Also used : ValidatingAction(com.github.bordertech.wcomponents.validation.ValidatingAction) Action(com.github.bordertech.wcomponents.Action) WAjaxControl(com.github.bordertech.wcomponents.WAjaxControl) FlowLayout(com.github.bordertech.wcomponents.layout.FlowLayout) ActionEvent(com.github.bordertech.wcomponents.ActionEvent) WPanel(com.github.bordertech.wcomponents.WPanel) WRadioButtonSelect(com.github.bordertech.wcomponents.WRadioButtonSelect) WTextField(com.github.bordertech.wcomponents.WTextField) WButton(com.github.bordertech.wcomponents.WButton) WHeading(com.github.bordertech.wcomponents.WHeading) WLabel(com.github.bordertech.wcomponents.WLabel)

Aggregations

WTextField (com.github.bordertech.wcomponents.WTextField)117 Test (org.junit.Test)90 SubordinateTarget (com.github.bordertech.wcomponents.SubordinateTarget)21 WCheckBox (com.github.bordertech.wcomponents.WCheckBox)21 WContainer (com.github.bordertech.wcomponents.WContainer)21 Equal (com.github.bordertech.wcomponents.subordinate.Equal)16 GreaterThanOrEqual (com.github.bordertech.wcomponents.subordinate.GreaterThanOrEqual)15 LessThanOrEqual (com.github.bordertech.wcomponents.subordinate.LessThanOrEqual)15 NotEqual (com.github.bordertech.wcomponents.subordinate.NotEqual)15 Rule (com.github.bordertech.wcomponents.subordinate.Rule)15 WSubordinateControl (com.github.bordertech.wcomponents.subordinate.WSubordinateControl)15 SubordinateTrigger (com.github.bordertech.wcomponents.SubordinateTrigger)14 WTextArea (com.github.bordertech.wcomponents.WTextArea)14 WComponentGroup (com.github.bordertech.wcomponents.WComponentGroup)12 WDropdown (com.github.bordertech.wcomponents.WDropdown)12 WButton (com.github.bordertech.wcomponents.WButton)11 WFieldLayout (com.github.bordertech.wcomponents.WFieldLayout)11 WHeading (com.github.bordertech.wcomponents.WHeading)10 WLabel (com.github.bordertech.wcomponents.WLabel)10 Hide (com.github.bordertech.wcomponents.subordinate.Hide)10