use of com.github.bordertech.wcomponents.subordinate.AbstractCompare.CompareType in project wcomponents by BorderTech.
the class SubordinateControlOptionsExample method createCondition.
/**
* @return the condition for the subordinate control.
*/
private Condition createCondition() {
// Compare value
Object value;
switch((TriggerType) drpTriggerType.getSelected()) {
case DateField:
value = dateCompareValue.getValue();
break;
case NumberField:
value = numberCompareValue.getValue();
break;
default:
value = comboCompareValue.getValue();
break;
}
// Create condition
Condition condition;
switch((CompareType) drpCompareType.getSelected()) {
case EQUAL:
condition = new Equal(trigger, value);
break;
case NOT_EQUAL:
condition = new NotEqual(trigger, value);
break;
case LESS_THAN:
condition = new LessThan(trigger, value);
break;
case LESS_THAN_OR_EQUAL:
condition = new LessThanOrEqual(trigger, value);
break;
case GREATER_THAN:
condition = new GreaterThan(trigger, value);
break;
case GREATER_THAN_OR_EQUAL:
condition = new GreaterThanOrEqual(trigger, value);
break;
case MATCH:
condition = new Match(trigger, (String) value);
break;
default:
throw new SystemException("Compare type not valid");
}
return condition;
}
Aggregations