?? workflow_flowtree.java
字號:
tree.setRowHeight(25);
String filename = path0 + (String) cell.getUserObject() +
".gxl";
file = new File(filename);
if (file.isFile() && file.exists()) {
fr = new workflow_FileImportGXL(filename);
try {
workflow_GraphEd gdx = new workflow_GraphEd("");
gdx.newgraph(gdx.graph);
wtp.addTab( (String) cell.getUserObject(), gdx);
fr.parseGXLFileInto(filename, gdx.graph);
}
catch (Exception ex) {
// JOptionPane.showMessageDialog(null, "顯示未提交流程圖異常" );
System.out.println(ex);
}
}
else {
fr = new workflow_FileImportGXL(path2 +
(String) cell.getUserObject() +
".actioned"
);
try {
workflow_GraphEd gdx = new workflow_GraphEd("");
gdx.newgraph(gdx.graph);
wtp.addTab(cell.getUserObject().toString(), gdx);
fr.parseGXLFileInto(path2 +
(String) cell.getUserObject() +
".actioned"
, gdx.graph);
}
catch (Exception ex) {
JOptionPane.showMessageDialog(null, "顯示已經提交流程圖異常" + ex);
// System.out.println("顯示已經提交流程圖異常" + ex);
}
}
tree.setRowHeight(25);
}
});
}
////////////將已經提交入庫的流程圖進行運行狀態標記////////////////////
if (!tree.isSelectionEmpty() && cell.getParent().toString().equals("已提交工作流")) {
menu.addSeparator();
menu.add(new AbstractAction("開始運行該流程") {
public void actionPerformed(ActionEvent e) {
tree.setRowHeight(25);
// 調用運行激活流程方法
java.util.Date date = new java.util.Date();
currentDateTime = wudt.getCurrentDate(date);
smn = new workflow_StepMain(cell.getUserObject().toString());
if (JOptionPane.showConfirmDialog(null, "是否開始運行該流程?") == 0) {
if (smn.start_flow(cell.getUserObject().toString(), currentDateTime)) {
JOptionPane.showMessageDialog(null, "該流程的狀態已經被設置為開始運行");
}
/////修改已經設置為開始運行的節點狀態////
DefaultMutableTreeNode selectNode = (DefaultMutableTreeNode) tree.
getLastSelectedPathComponent();
if (selectNode.isLeaf()) {
selectNode.add(new DefaultMutableTreeNode("流程狀態監控"));
}
createnode2(cell.toString());
tree.updateUI();
tree.setRowHeight(25);
tree.updateUI();
tree.setRowHeight(25);
}
}
});
}
if (!tree.isSelectionEmpty() && cell.getParent().toString().equals("已提交工作流")) {
menu.addSeparator();
menu.add(new AbstractAction("終止運行該流程") {
public void actionPerformed(ActionEvent e) {
tree.setRowHeight(25);
///// 調用運行激活流程方法////
if (JOptionPane.showConfirmDialog(null, "是否終止運行該流程?") == 0) {
smn = new workflow_StepMain(cell.getUserObject().toString());
if (smn.suspend_flow(cell.getUserObject().toString())) {
JOptionPane.showMessageDialog(null, "該流程已經被停止運行");
}
// smn.
DefaultMutableTreeNode selectNode = (DefaultMutableTreeNode) tree.
getLastSelectedPathComponent();
if (!selectNode.isLeaf()) {
selectNode.removeAllChildren();
}
tree.setRowHeight(25);
tree.updateUI();
tree.setRowHeight(25);
}
}
});
}
///////////////////調用workflow_RTCView()類顯示流程圖的運行狀態///////////////
/*
目前使用的是靜態流程圖的還原顯示方法調用,通過監測數據庫中的節點的狀態來表示
圖中的節點ICON..
*/
if (!tree.isSelectionEmpty() && cell.getParent().toString().equals("已提交工作流")) {
menu.addSeparator();
menu.add(new AbstractAction("查看流程運行狀態") {
public void actionPerformed(ActionEvent e) {
try {
workflow_GraphEd gdx = new workflow_GraphEd("disable");
gdx.newgraph(gdx.graph);
gdx.graph.setEditable(false);
gdx.graph.setDragEnabled(false);
gdx.graph.setDropEnabled(false);
gdx.graph.setConnectable(false);
gdx.graph.setMoveable(false);
gdx.graph.setCloneable(false);
gdx.graph.setFocusable(false);
gdx.graph.setGridEnabled(true);
gdx.graph.setPortsVisible(false);
gdx.graph.setDisconnectOnMove(false);
gdx.graph.setAntiAliased(true);
gdx.graph.setBendable(false);
wtp.addTab(cell.getUserObject().toString() + "的處理狀態", gdx);
wrtc.parseGXLFileInto_RTC(path2 +
(String) cell.getUserObject() +
".actioned"
, gdx.graph,
cell.getUserObject().toString());
}
catch (Exception ex) {
JOptionPane.showMessageDialog(null, "查看流程運行狀態異常" + ex);
// System.out.println("顯示已經提交流程圖異常" + ex);
}
}
});
}
/////////////////////////////刪除流程圖//////////////////////////////////
if (!tree.isSelectionEmpty() && cell.getParent().toString().equals("未提交工作流")) {
menu.addSeparator();
menu.add(new AbstractAction("刪除未提交流程圖") {
public void actionPerformed(ActionEvent e) {
if (JOptionPane.showConfirmDialog(null, "是否刪除該流程圖?") == 0) {
cell.removeFromParent();
tree.setRowHeight(25);
tree.updateUI();
file = new File(path0 + (String) cell.getUserObject() +
".gxl");
if (file.isFile() && file.exists()) {
file.delete();
}
tree.setRowHeight(25);
}
}
});
}
/////////////////////////編輯已經入庫的流程圖的活動屬性/////////////////
if (!tree.isSelectionEmpty() && cell.getParent().toString().equals("已提交工作流")) {
menu.addSeparator();
menu.add(new AbstractAction("編輯流程活動屬性") {
public void actionPerformed(ActionEvent e) {
waa = new workflow_AddStepActive(wul, cell.getUserObject().toString());
waa.setTitle("為" + cell.getUserObject().toString() + "添加活動屬性");
waa.setSize(400, 335);
waa.setLocationRelativeTo(null);
// waa.setDefaultCloseOperation(waa.EXIT_ON_CLOSE);
waa.show();
}
});
}
return menu;
}
// 串行化方法,保存樹型目錄的狀態和數據,方便下次運行的時候顯示以前保留的狀態
///////////////// 寫文件////////////////////////
public void serializableNode(DefaultMutableTreeNode node) {
try {
java.io.FileOutputStream objfile = new java.io.FileOutputStream(
"FLOWTREE.OBJ");
java.io.ObjectOutputStream p = new java.io.ObjectOutputStream(objfile);
p.writeObject(node);
p.flush();
objfile.close();
}
catch (java.io.IOException e) {
System.out.println(e.toString());
}
}
///////////////////// 串行方法讀文件///////////////////////
public DefaultMutableTreeNode readNode() {
FileInputStream objfile = null;
try {
objfile = new java.io.FileInputStream("FLOWTREE.OBJ");
ObjectInputStream q = new ObjectInputStream(objfile);
root = (DefaultMutableTreeNode) q.readObject();
}
catch (Exception e) {
// System.out.println(e);
// JOptionPane.showMessageDialog(null,"系統第一次運行");
root = new DefaultMutableTreeNode(depname1 + "工作流列表");
node1 = new DefaultMutableTreeNode("未提交工作流");
node2 = new DefaultMutableTreeNode("已提交工作流");
node3 = new DefaultMutableTreeNode("正在運行的流程");
node4 = new DefaultMutableTreeNode("運行完畢的流程");
root.add(node1);
root.add(node2);
root.add(node3);
root.add(node4);
}
return root;
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -