KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > oddjob > monitor > action > ScheduleMenu


1 package org.oddjob.monitor.action;
2
3 import org.apache.log4j.Logger;
4 import org.oddjob.designer.elements.scheduling.ScheduleListDE;
5 import org.oddjob.monitor.model.ExplorerContext;
6 import org.oddjob.monitor.model.JobMenu;
7 import org.oddjob.monitor.model.JobOption;
8 import org.oddjob.scheduling.OddjobScheduler;
9
10 /**
11  * An action that sets a property on a job.
12  *
13  * @author Rob Gordon
14  */

15
16 public class ScheduleMenu extends JobMenu {
17     private static final Logger logger = Logger.getLogger(ScheduleMenu.class);
18     
19     private boolean enabled;
20     
21     private JobOption[] options;
22     
23     private OddjobScheduler oddjobScheduler;
24     
25     public ScheduleMenu(OddjobScheduler oddjobScheduler) {
26         this.oddjobScheduler = oddjobScheduler;
27         String JavaDoc[] types = new ScheduleListDE().supportedTypes();
28         options = new JobOption[types.length];
29         for (int i = 0; i < types.length; ++i) {
30             options[i] = new ScheduleAction(oddjobScheduler, types[i]);
31         }
32     }
33     
34     /**
35      * Get the name of the action.
36      */

37     public String JavaDoc getName() {
38         return oddjobScheduler.toString();
39     }
40
41     public void select(Object JavaDoc component, ExplorerContext eContext) {
42         enabled = true;
43         for (int i = 0; i < options.length; ++i) {
44             options[i].optionSelect(component, eContext);
45         }
46     }
47     
48     public void deSelect() {
49         enabled = false;
50     }
51     
52     public boolean enabled() {
53         return enabled;
54     }
55     
56     public JobOption[] options() {
57         return options;
58     }
59
60 }
61
Popular Tags