001: package org.osbl.agent.gui;
002:
003: import org.osbl.client.wings.shell.*;
004: import org.osbl.client.wings.form.*;
005: import org.osbl.client.wings.concern.TaskEditor;
006: import org.osbl.client.wings.concern.SubjectEditor;
007: import org.osbl.client.web.WebModule;
008: import org.osbl.plugin.PluginManager;
009: import org.osbl.plugin.Extension;
010: import org.wings.SPanel;
011: import org.wings.SComponent;
012:
013: public class AgentWebModule implements WebModule {
014: PluginManager pluginManager;
015:
016: public void setPluginManager(PluginManager pluginManager) {
017: this .pluginManager = pluginManager;
018: }
019:
020: public void initialize() {
021: pluginManager.registerExtension(new Extension("Agent Tool",
022: "org.osbl.client.wings.form.editorTools",
023: ObjectAgentTool.class));
024: pluginManager.registerExtension(new Extension("Agent Tool",
025: "org.osbl.client.wings.form.taskEditorTools",
026: TaskAgentTool.class));
027: pluginManager.registerExtension(new Extension("Agent Tool",
028: "org.osbl.client.wings.form.subjectEditorTools",
029: SubjectAgentTool.class));
030: }
031:
032: public static class ObjectAgentTool extends AbstractTool implements
033: EditorTool {
034: private SPanel panel;
035: private ObjectEditor objectEditor;
036:
037: public ObjectAgentTool() {
038: putValue(Tool.NAME, Client.getInstance()
039: .getResourceProvider().getMessage(
040: "org.osbl.agents.gui.agents"));
041: putValue(KEY, "org.osbl.agents.gui.agents");
042: }
043:
044: public SComponent getComponent() {
045: if (panel == null) {
046: ObjectDesignContext designContext = new ObjectDesignContext(
047: objectEditor);
048: panel = designContext.getAgentSidePanel();
049: }
050: return panel;
051: }
052:
053: public void setEditor(ObjectEditor objectEditor) {
054: this .objectEditor = objectEditor;
055: putValue(KEY, "Agent: "
056: + System.identityHashCode(objectEditor));
057: }
058: }
059:
060: public static class TaskAgentTool extends AbstractTool implements
061: EditorTool {
062: private SPanel panel;
063: private TaskEditor objectEditor;
064:
065: public TaskAgentTool() {
066: putValue(Tool.NAME, Client.getInstance()
067: .getResourceProvider().getMessage(
068: "org.osbl.agents.gui.agents"));
069: }
070:
071: public SComponent getComponent() {
072: if (panel == null) {
073: TaskDesignContext designContext = new TaskDesignContext(
074: objectEditor);
075: panel = designContext.getAgentSidePanel();
076: }
077: return panel;
078: }
079:
080: public void setEditor(ObjectEditor objectEditor) {
081: this .objectEditor = (TaskEditor) objectEditor;
082: putValue(KEY, "Agent: "
083: + System.identityHashCode(objectEditor));
084: }
085: }
086:
087: public static class SubjectAgentTool extends AbstractTool implements
088: EditorTool {
089: private SPanel panel;
090: private SubjectEditor objectEditor;
091:
092: public SubjectAgentTool() {
093: putValue(Tool.NAME, Client.getInstance()
094: .getResourceProvider().getMessage(
095: "org.osbl.agents.gui.agents"));
096: putValue(KEY, "org.osbl.agents.gui.agents");
097: }
098:
099: public SComponent getComponent() {
100: if (panel == null) {
101: SubjectDesignContext designContext = new SubjectDesignContext(
102: objectEditor);
103: panel = designContext.getAgentSidePanel();
104: }
105: return panel;
106: }
107:
108: public void setEditor(ObjectEditor objectEditor) {
109: this .objectEditor = (SubjectEditor) objectEditor;
110: putValue(KEY, "Agent: "
111: + System.identityHashCode(objectEditor));
112: }
113: }
114: }
|