KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > enhydra > shark > swingclient > workflowadmin > repository > RepositoryManagement


1 package org.enhydra.shark.swingclient.workflowadmin.repository;
2
3 import java.awt.*;
4 import java.util.*;
5
6 import javax.swing.*;
7
8
9 import org.enhydra.shark.api.client.wfbase.*;
10 import org.enhydra.jawe.xml.elements.*;
11 import org.enhydra.shark.swingclient.*;
12 import org.enhydra.shark.swingclient.workflowadmin.*;
13 import org.enhydra.shark.swingclient.workflowadmin.repository.actions.*;
14
15 /**
16  * Implements the user interface and program logic to manage engine's
17  * package repository.
18  *
19  * @author Sasa Bojanic
20  * @version 1.0
21  */

22 public class RepositoryManagement extends ActionPanel {
23    private SharkAdmin workflowAdmin;
24
25    JList packagesFiles;
26    JScrollPane scrollPackages;
27
28    public RepositoryManagement (SharkAdmin wa) {
29       super();
30       this.workflowAdmin=wa;
31       super.init();
32    }
33
34    protected void createActions () {
35       defaultActions=new Action[] {
36          new UploadPackage(this),
37          new DeletePackage(this)
38       };
39    }
40
41    protected Component createCenterComponent() {
42       scrollPackages=new JScrollPane();
43       packagesFiles=new JList();
44       packagesFiles.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
45       scrollPackages.setViewportView(packagesFiles);
46       return scrollPackages;
47    }
48
49    public synchronized void refresh (boolean mandatoryRefreshing) {
50       if (mandatoryRefreshing || isShowing()) {
51          try {
52             String JavaDoc[] allPkgFiles=null;
53             try {
54                allPkgFiles=SharkAdmin.getRepositoryManager().getPackagePaths();
55             } catch (BaseException be){
56                return;
57             }
58
59             packagesFiles=new JList(allPkgFiles);
60             packagesFiles.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
61             scrollPackages.setViewportView(packagesFiles);
62          } catch (Exception JavaDoc ex){}
63       }
64    }
65
66    public SharkAdmin getWorkflowAdmin () {
67       return workflowAdmin;
68    }
69
70    public void clear () {
71    }
72
73    public String JavaDoc getSelectedPackagePath () {
74       try {
75          return (String JavaDoc)packagesFiles.getSelectedValue();
76       } catch (Exception JavaDoc ex) {
77          return "";
78       }
79    }
80
81 }
82
Popular Tags