KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > enhydra > shark > swingclient > worklisthandler > SharksWorklistHandler


1 package org.enhydra.shark.swingclient.worklisthandler;
2
3 import java.awt.*;
4
5 import javax.swing.*;
6
7
8
9 import org.enhydra.shark.api.client.wfmodel.*;
10 import org.enhydra.shark.swingclient.*;
11 import org.enhydra.shark.swingclient.worklist.*;
12
13 /**
14  * An implementation of client application that realizes worklist handler.
15  *
16  * @author Sasa Bojanic
17  * @version 1.0
18  */

19 public class SharksWorklistHandler extends SharkClient {
20
21    private Worklist worklist;
22
23
24    //************************** CONSTRUCTOR ***********************
25
/** Creates instance of main application class. */
26    public SharksWorklistHandler (JFrame frame) {
27       super(frame);
28    }
29    //************************* END OF WORKLISTHANDLER CONSTRUCTOR *****************
30

31    protected Component createCenterComponent () {
32       worklist = new Worklist(this,false);
33       return worklist;
34    }
35
36    public synchronized void refresh (boolean mandatoryRefreshing) {
37       if (worklist.getResource()==null) {
38          try {
39             WfResource res=workflowService.getResourceObject();
40             worklist.setResource(res);
41          } catch (Exception JavaDoc ex) {}
42       } else {
43          worklist.refresh();
44       }
45    }
46
47    protected String JavaDoc getAppTitleResourceString() {
48       return "WorklistHandlerTitle";
49    }
50
51    protected String JavaDoc getLogoResourceString() {
52       return "worklisthandlerLogo";
53    }
54
55    protected String JavaDoc getIconResourceString() {
56       return "worklisthandlerIcon";
57    }
58
59    protected String JavaDoc getMenubarResourceString() {
60       return "worklisthandlermainmenubar";
61    }
62
63    protected String JavaDoc getRefreshingRateString () {
64       return "RefreshingRateInSecondsForWorklistHandler";
65    }
66
67    public void clearComponents() {
68       try {
69          setTitle();
70          // THIS IS PRECAUTION - the thread that refreshes admin can be
71
// running, so we wait until the refresher thread to finishs it's
72
// work, and then we clear the components
73
while (isRefresherActive());
74          worklist.clear();
75       } catch (Exception JavaDoc ex) {ex.printStackTrace();}
76    }
77
78    public Worklist getWorklist () {
79       return worklist;
80    }
81
82    /** Main method. */
83    public static void main(String JavaDoc[] args) {
84       // Checks if java version is >= 1.4
85
String JavaDoc vers = System.getProperty("java.version");
86       if (vers.compareTo("1.4") < 0) {
87          System.out.println("!!!WARNING: Shark Worklist Handler must be run with a " +
88                "1.4 or higher version VM!!!");
89          System.exit(1);
90       }
91
92       new SharksWorklistHandler(new JFrame());
93    }
94
95 }
96
97
Popular Tags