use of com.github.bordertech.wcomponents.examples.common.ExampleLookupTable.TableWithNullOption 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);
}
Aggregations