1 package org.enhydra.shark.swingclient.workflowadmin.instantiation; 2 3 import java.awt.*; 4 import java.awt.event.*; 5 import javax.swing.*; 6 import javax.swing.border.*; 7 import javax.swing.event.*; 8 9 import org.enhydra.jawe.JaWE; 10 import org.enhydra.jawe.ProcessEditor; 11 import org.enhydra.jawe.xml.elements.*; 12 import org.enhydra.shark.swingclient.*; 13 import org.enhydra.shark.swingclient.workflowadmin.monitoring.actions.*; 14 15 21 public class ProcessDefinitionUpdater extends ActionPanel { 22 23 private boolean isCanceled=false; 24 25 private ProcessEditor processEditor; 26 27 public ProcessDefinitionUpdater (Window parent,ProcessEditor ped) { 28 super(); 29 this.processEditor=ped; 30 try { 31 ped.getToolbarComponent("HideWindow").setVisible(false); 32 } catch (Exception ex) {} 33 super.init(); 34 super.initDialog(parent, 36 ResourceManager.getLanguageDependentString("DialogUpdateProcessDefinition"), 37 true,true); 38 myDialog.setResizable(true); 39 myDialog.setDefaultCloseOperation(JDialog.DO_NOTHING_ON_CLOSE); 40 myDialog.getRootPane().getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW) 41 .put(KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE,0,false),"Cancel"); 42 myDialog.getRootPane().getActionMap().put("Cancel", new AbstractAction() { 43 public void actionPerformed(ActionEvent e) { 44 cancelChanges(); 45 } 46 }); 47 myDialog.addWindowListener(new WindowAdapter() { 48 public void windowClosing(WindowEvent e) { 49 cancelChanges(); 50 } 51 }); 52 53 } 54 55 protected void createActions () {} 56 57 60 protected Component createCenterComponent() { 61 return processEditor; 62 } 63 64 protected void applyChanges () { 65 if (processEditor.getGraph().checkConnections(false) && 66 processEditor.getGraph().checkGraphConformance(false) && 67 processEditor.getGraph().checkLogic(false)) { 68 myDialog.dispose(); 69 } else { 70 JOptionPane.showMessageDialog(myDialog,"", 71 SharkClient.getAppTitle(),JOptionPane.ERROR_MESSAGE); 72 } 73 } 74 75 protected void cancelChanges () { 76 isCanceled=true; 77 myDialog.dispose(); 78 } 79 80 public boolean isCanceled () { 81 return isCanceled; 82 } 83 84 } 85 | Popular Tags |