01: package org.osbl.agent.gui.condition;
02:
03: import java.util.List;
04:
05: import org.osbl.agent.model.condition.PropertyCondition;
06: import org.wings.SComponent;
07: import org.wings.STextField;
08:
09: /**
10: * The class FieldConditionController models the FieldCondition by presenting the user
11: * an input-field in which the value to compare the property against can be entered.
12: *
13: * As a subclass of PropertyConditionController it shows a combo-box of operators.
14: *
15: * It is used for fields not specific enough to fit any of its subclasses.
16: *
17: * @author Sebastian Nozzi.
18: */
19: public class FieldConditionController extends
20: PropertyConditionController {
21:
22: /** The input field. */
23: private STextField inputField;
24:
25: /**
26: * Instantiates a new field condition controller.
27: */
28: public FieldConditionController() {
29: super ();
30:
31: // inputField letting the user type the value to compare against.
32: inputField = new STextField("");
33: }
34:
35: /*
36: * (non-Javadoc)
37: *
38: * @see agent.controller.OperationController#getComponents()
39: */
40: protected void populateComponentList(List<SComponent> componentList) {
41:
42: super .populateComponentList(componentList);
43:
44: componentList.add(inputField);
45: }
46:
47: /* (non-Javadoc)
48: * @see org.osbl.agent.gui.condition.PropertyConditionController#getValueToCompareTo()
49: */
50: public Object getValueToCompareTo() {
51: return inputField.getText();
52: }
53:
54: /* (non-Javadoc)
55: * @see org.osbl.agent.gui.condition.PropertyConditionController#setValueToCompareTo(org.osbl.agent.model.condition.PropertyCondition)
56: */
57: public void setValueToCompareTo(PropertyCondition condition) {
58: // Set the text in the inputField to the value set in the condition.
59: inputField.setText((String) condition.getValueToCompareTo());
60: }
61:
62: }
|