01: package org.osbl.agent.gui;
02:
03: import java.util.List;
04:
05: import org.osbl.agent.model.Action;
06:
07: /**
08: * The class ActionPanel represents the ability to visually manipulate an Action in the
09: * RuleEditorPanel.
10: *
11: * It shows a list of available Action(Controllers) and its correspoding parameters.
12: *
13: * @author Sebastian Nozzi.
14: */
15: public class ActionPanel extends OperationPanel {
16:
17: /**
18: * Instantiates a new ActionPanel in the given Rule Editor.
19: *
20: * @param ruleEditorPanel the RuleEditorPanel this panel will be used in.
21: */
22: public ActionPanel(RuleEditorPanel ruleEditorPanel) {
23: this (ruleEditorPanel, null);
24: }
25:
26: /**
27: * Instantiates a new ActionPanel, setting the given ActionController
28: * as the selected item.
29: *
30: * @param ruleEditorPanel the RuleEditorPanel to which this panel belongs.
31: * @param preferredController the ActionController to be used as the selected item.
32: */
33: public ActionPanel(RuleEditorPanel ruleEditorPanel,
34: ActionController preferredController) {
35: super (ruleEditorPanel, preferredController);
36: }
37:
38: /**
39: * Get an Action instance corresponding to the selected ActionController and
40: * the state of its parameters.
41: *
42: * @return the Action instance currently reflected by this panel.
43: */
44: public Action getAction() {
45: // Ask the currently selected (in the UI) ActionController for its
46: // corresponding Action and return it.
47: return ((ActionController) controllerCombo.getSelectedItem())
48: .getAction();
49: }
50:
51: /* (non-Javadoc)
52: * @see org.osbl.agent.gui.OperationPanel#getControllers()
53: */
54: protected List<OperationController> getControllers() {
55: return ruleEditorPanel.getDesignContext()
56: .getActionControllers();
57: }
58:
59: }
|