use of com.github.bordertech.wcomponents.WNumberField 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);
}
use of com.github.bordertech.wcomponents.WNumberField in project wcomponents by BorderTech.
the class NotEqual_Test method testDoCompare.
@Test
public void testDoCompare() {
WNumberField trigger = new WNumberField();
// ------------------------------
// Setup NOT EQUAL - with value
NotEqual compare = new NotEqual(trigger, EQ_VALUE);
trigger.setNumber(null);
Assert.assertTrue("Not Equal - Compare for null value should be true", compare.execute());
trigger.setNumber(LT_VALUE);
Assert.assertTrue("Not Equal - Compare for less value should be true", compare.execute());
trigger.setNumber(EQ_VALUE);
Assert.assertFalse("Not Equal - Compare for equal value should be false", compare.execute());
trigger.setNumber(GT_VALUE);
Assert.assertTrue("Not Equal - Compare for greater value should be true", compare.execute());
// ------------------------------
// Setup NOT EQUAL - with null value
compare = new NotEqual(trigger, null);
trigger.setNumber(null);
Assert.assertFalse("Not Equal With Null Value - Compare for null value should be false", compare.execute());
trigger.setNumber(EQ_VALUE);
Assert.assertTrue("Not Equal With Null Value - Compare for value should be true", compare.execute());
}
use of com.github.bordertech.wcomponents.WNumberField in project wcomponents by BorderTech.
the class Equal_Test method testDoCompare.
@Test
public void testDoCompare() {
WNumberField trigger = new WNumberField();
// ------------------------------
// Setup EQUAL - with value
Equal compare = new Equal(trigger, EQ_VALUE);
trigger.setNumber(null);
Assert.assertFalse("Equal Type - Compare for null value should be false", compare.execute());
trigger.setNumber(LT_VALUE);
Assert.assertFalse("Equal Type - Compare for less value should be false", compare.execute());
trigger.setNumber(EQ_VALUE);
Assert.assertTrue("Equal Type - Compare for equal value should be true", compare.execute());
trigger.setNumber(GT_VALUE);
Assert.assertFalse("Equal Type - Compare for greater value should be false", compare.execute());
// ------------------------------
// Setup EQUAL - with null value
compare = new Equal(trigger, null);
trigger.setNumber(null);
Assert.assertTrue("Equal Type With Null Value - Compare for null value should be true", compare.execute());
trigger.setNumber(EQ_VALUE);
Assert.assertFalse("Equal Type With Null Value - Compare for value should be false", compare.execute());
}
use of com.github.bordertech.wcomponents.WNumberField in project wcomponents by BorderTech.
the class LessThan_Test method testDoCompare.
@Test
public void testDoCompare() {
WNumberField trigger = new WNumberField();
// ------------------------------
// Setup LESS THAN - with value
LessThan compare = new LessThan(trigger, EQ_VALUE);
trigger.setNumber(null);
Assert.assertFalse("Less Than - Compare for null value should be false", compare.execute());
trigger.setNumber(LT_VALUE);
Assert.assertTrue("Less Than - Compare for less value should be true", compare.execute());
trigger.setNumber(EQ_VALUE);
Assert.assertFalse("Less Than - Compare for equal value should be false", compare.execute());
trigger.setNumber(GT_VALUE);
Assert.assertFalse("Less Than - Compare for greater value should be false", compare.execute());
// ------------------------------
// Setup LESS THAN - with null value
compare = new LessThan(trigger, null);
trigger.setNumber(null);
Assert.assertFalse("Less Than With Null Value - Compare for null value should be false", compare.execute());
trigger.setNumber(EQ_VALUE);
Assert.assertFalse("Less Than With Null Value - Compare for value should be false", compare.execute());
}
use of com.github.bordertech.wcomponents.WNumberField in project wcomponents by BorderTech.
the class GreaterThanOrEqual_Test method testDoCompare.
@Test
public void testDoCompare() {
WNumberField trigger = new WNumberField();
// ------------------------------
// Setup GREATER THAN OR EQUAL - with value
GreaterThanOrEqual compare = new GreaterThanOrEqual(trigger, EQ_VALUE);
trigger.setNumber(null);
Assert.assertFalse("Greater Than Or Equal - Compare for null value should be false", compare.execute());
trigger.setNumber(LT_VALUE);
Assert.assertFalse("Greater Than Or Equal - Compare for less value should be false", compare.execute());
trigger.setNumber(EQ_VALUE);
Assert.assertTrue("Greater Than Or Equal - Compare for equal value should be true", compare.execute());
trigger.setNumber(GT_VALUE);
Assert.assertTrue("Greater Than Or Equal - Compare for greater value should be true", compare.execute());
// ------------------------------
// Setup GREATER THAN - with null value
compare = new GreaterThanOrEqual(trigger, null);
trigger.setNumber(null);
Assert.assertTrue("Greater Than Or Equal With Null Value - Compare for null value should be true", compare.execute());
trigger.setNumber(EQ_VALUE);
Assert.assertFalse("Greater Than Or Equal With Null Value - Compare for value should be false", compare.execute());
}
Aggregations