KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > oddjob > monitor > model > JobOption


1 /*
2  * (c) Rob Gordon 2005
3  */

4 package org.oddjob.monitor.model;
5
6 import java.util.Observable JavaDoc;
7
8
9 /**
10  * The interface for an something which can happen
11  * to a job when it's selected.
12  *
13  * @author Rob Gordon.
14  *
15  */

16 abstract public class JobOption extends Observable JavaDoc {
17
18     /**
19      * Get the name for the option. This will typically
20      * be used as a menu item name.
21      *
22      * @return The name for the action.
23      */

24     abstract public String JavaDoc getName();
25
26     /**
27      * Called when a job node is selected.
28      *
29      * @param component The node selected.
30      * @param explorerContext The ExplorerContext
31      */

32     public final void optionSelect(Object JavaDoc component, ExplorerContext explorerContext) {
33         if (component == null) {
34             deSelect();
35         } else {
36             select(component, explorerContext);
37         }
38         setChanged();
39         notifyObservers();
40     }
41         
42     /**
43      * This method will be called when a component
44      * is selected.
45      *
46      * @param component The selected component.
47      * @param eContext the ExplorerContext for the current
48      * node.
49      */

50     abstract protected void select(Object JavaDoc component, ExplorerContext eContext);
51
52     /**
53      * Called when a node is unselected.
54      *
55      */

56     abstract protected void deSelect();
57     
58     /**
59      * Is this action currently enabled?
60      *
61      * @return true if this action is enabled, false if it isn't.
62      */

63     abstract public boolean enabled();
64     
65     /**
66      * Support the Visitor pattern.
67      *
68      * @param processor A JobOptionProcessor.
69      */

70     abstract public void process(JobOptionProcessor processor);
71 }
72
Popular Tags