KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > enhydra > shark > swingclient > workflowadmin > monitoring > actions > TerminateActivity


1 package org.enhydra.shark.swingclient.workflowadmin.monitoring.actions;
2
3 import java.awt.event.*;
4
5
6
7 import org.enhydra.shark.api.client.wfmodel.*;
8 import org.enhydra.shark.swingclient.*;
9 import org.enhydra.shark.swingclient.workflowadmin.*;
10 import org.enhydra.shark.swingclient.workflowadmin.monitoring.*;
11 import javax.swing.*;
12 import org.enhydra.jawe.xml.elements.*;
13
14 /**
15  * Terminates selected activity.
16  *
17  * @author Sasa Bojanic
18  * @version 1.0
19  */

20 public class TerminateActivity extends ActionBase {
21
22    public TerminateActivity (ManageActivities ma) {
23       super(ma);
24    }
25
26    public void actionPerformed(ActionEvent e) {
27       ManageActivities ma=(ManageActivities)actionPanel;
28       Activity act=ma.getSelectedActivity();
29       try {
30          WfActivity lastActivityForDefinition=ma.getLastActivityForDefinition(act,"open",1);
31          lastActivityForDefinition.terminate();
32          ma.updateListDisplay(act);
33          ma.updateProcessView();
34          JOptionPane.showMessageDialog(ma.getWindow(),
35             lastActivityForDefinition.name()+": "+
36             ResourceManager.getLanguageDependentString(
37             "MessageActivityIsTerminated"),
38             SharkClient.getAppTitle(),JOptionPane.WARNING_MESSAGE);
39          ma.updateProcessView();
40       } catch (Exception JavaDoc ex) {
41          JOptionPane.showMessageDialog(ma.getWindow(),
42             ResourceManager.getLanguageDependentString(
43             "MessageActivityCannotBeTerminated"),
44             SharkClient.getAppTitle(),JOptionPane.WARNING_MESSAGE);
45       }
46    }
47
48 }
49
50
Popular Tags