⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 graphcontroller.java

📁 jawe的最新版本,基于Java的图形化工作流编辑器。图形化工作流编辑器 。使用JAVA语言开发
💻 JAVA
📖 第 1 页 / 共 3 页
字号:
      return true;   }   public boolean canDuplicateElement(XMLCollection col, XMLElement el) {      if (el==null) return true;      ExtendedAttribute ea=null;      if (el instanceof ExtendedAttribute) {         ea=(ExtendedAttribute)el;      } else if (el.getParent() instanceof ExtendedAttribute) {         ea=(ExtendedAttribute)el.getParent();      }      if (ea!=null) {         return !GraphUtilities.isMyKindOfExtendedAttribute(ea);      } else if (el instanceof FreeTextExpressionParticipant || el instanceof CommonExpressionParticipant) {         return false;      }      return true;   }   public boolean canRepositionElement(XMLCollection col, XMLElement el) {      if (el==null) return true;      ExtendedAttribute ea=null;            if (el instanceof ExtendedAttribute) {         ea=(ExtendedAttribute)el;      } else if (el.getParent() instanceof ExtendedAttribute) {         ea=(ExtendedAttribute)el.getParent();      }      if (ea!=null) {         return !GraphUtilities.isMyKindOfExtendedAttribute(ea);      } else if (el instanceof FreeTextExpressionParticipant || el instanceof CommonExpressionParticipant) {         return false;      }      return true;   }      // **********************            // **********************  ChoiceButtonListener   public void selectionChanged(ChoiceButton cbutton,Object change) {      if (updateInProgress) return;      if (getSelectedGraph()==null) return;      if (cbutton.getChoiceType()==Participant.class) {         Participant par=(Participant)change;                  setUpdateInProgress(true);                            JaWEManager.getInstance().getJaWEController().startUndouableChange();         List vo = GraphUtilities.getParticipantVisualOrder(getSelectedGraph().getXPDLObject());         vo.add(par.getId());         GraphUtilities.setParticipantVisualOrder(getSelectedGraph().getXPDLObject(), vo);         getSelectedGraph().getGraphManager().insertParticipantAndArrangeParticipants(par);         List toSelect=new ArrayList();         toSelect.add(par);         JaWEManager.getInstance().getJaWEController().endUndouableChange(toSelect);         selectedGraph.selectParticipant(par);                  setUpdateInProgress(false);                        adjustActions();         //         List vo=GraphUtilities.getParticipantVisualOrder(selectedGraph.getXPDLObject());//         vo.add(par.getId());//         GraphUtilities.setParticipantVisualOrder(selectedGraph.getXPDLObject(),vo);//         getSelectedGraph().getGraphManager().insertParticipantAndArrangeParticipants(par);      } else if (cbutton.getChoiceType() == ActivitySet.class) {         ActivitySet aset = (ActivitySet)change;         setSelectedGraph(getGraph(aset));                  JaWEManager.getInstance().getJaWEController().getSelectionManager().setSelection(aset, true);      }   }   public Object getSelectedObject (ChoiceButton cbutton) {      if (cbutton.getChoiceType()==Participant.class)          return null;            return null;         }   public List getChoices(ChoiceButton cbutton) {      List choices=new ArrayList();      if (selectedGraph==null) return choices;      if (cbutton.getChoiceType()==Participant.class) {               WorkflowProcess wp=selectedGraph.getWorkflowProcess();         SequencedHashMap choiceMap=XMLUtil.getPossibleParticipants(wp, JaWEManager.getInstance().getXPDLHandler());         choiceMap.put(FreeTextExpressionParticipant.getInstance().getName(),FreeTextExpressionParticipant.getInstance());         List toRemove=selectedGraph.getGraphManager().getDisplayedParticipants();            Iterator it=choiceMap.entrySet().iterator();         while (it.hasNext()) {            Map.Entry me=(Map.Entry)it.next();            if (toRemove.contains(me.getValue())) {               it.remove();            }         }            choices.addAll(choiceMap.values());      } else if (cbutton.getChoiceType() == ActivitySet.class) {         WorkflowProcess wp=selectedGraph.getWorkflowProcess();                           choices = wp.getActivitySets().toElements();      }            return choices;   }      // **********************         // ********************** GraphSelectionListener   public void valueChanged(GraphSelectionEvent e) {      if (updateInProgress) return;      Object[] selectedCells = getSelectedGraph().getSelectionCells();      Participant par = null;      List selectedElements = new ArrayList();      if (selectedCells != null) {         for (int i = 0; i < selectedCells.length; i++) {            if (selectedCells[i] instanceof WorkflowElement) {               WorkflowElement we = (WorkflowElement) selectedCells[i];               XMLElement el = we.getPropertyObject();               if (el != null) {                  if (el instanceof Participant) {                     par = (Participant)el;                  }                  selectedElements.add(el);               }            }         }               }               if (selectedElements.size() != 0) {         if (par!=null) {//            if (par instanceof FreeTextExpressionParticipant || par instanceof CommonExpressionParticipant) {//               setUpdateInProgress(true);//               JaWEManager.getInstance().getJaWEController().getSelectionManager().setSelection((XMLElement)null, false);//               setUpdateInProgress(false);//               adjustActions();//            } else {               JaWEManager.getInstance().getJaWEController().getSelectionManager().setSelection(selectedElements, false);//            }         }         else {            JaWEManager.getInstance().getJaWEController().getSelectionManager().setSelection(selectedElements, true);         }      } else {         JaWEManager.getInstance().getJaWEController().getSelectionManager().setSelection(selectedGraph.getXPDLObject(), true);//            JaWEManager.getInstance().getJaWEController().getSelectionManager().setSelection((XMLElement)null, false);//            if (freeOrCommon==null) {//               JaWEManager.getInstance().getJaWEController().getSelectionManager().setSelection(selectedElements);//            }      }         }      // **********************           protected void init () throws Exception {      panel=createPanel();            adjustActions();   }      public GraphSettings getGraphSettings() {      return settings;   }      public void update (XPDLElementChangeInfo info) {      XMLElement changedElement = info.getChangedElement();      List changedElements = info.getChangedSubElements();      int action = info.getAction();      // ********************************* START OF SELECTION EVENT      if (action == XPDLElementChangeInfo.SELECTED) {         // clean old selection         if (selectedGraph != null) {            if (overview != null) {               if (overview.getGraph() != null) {                  overview.getGraph().clearSelection();               }            }            selectedGraph.clearSelection();         }         if (changedElement != null) {            // ***************************** find graph            Graph g = null;            XMLElement lastSel = changedElement;            if (changedElements.size() > 0) {               lastSel = (XMLElement) changedElements.get(changedElements.size() - 1);            }            if (graphMap.containsKey(lastSel)) {               g = getGraph((XMLCollectionElement) lastSel);            }            if (g == null && selectedGraph != null) {               if (lastSel instanceof Participant                     && selectedGraph.getGraphManager().getGraphParticipant((Participant) lastSel) != null) {                  g = selectedGraph;               } else if (lastSel instanceof ExtendedAttribute                     && selectedGraph.getGraphManager().getBubble((ExtendedAttribute) lastSel) != null) {                  g = selectedGraph;               } else if (lastSel instanceof Activity                     && selectedGraph.getGraphManager().getGraphActivity((Activity) lastSel) != null) {                  g = selectedGraph;               } else if (lastSel instanceof Transition                     && selectedGraph.getGraphManager().getGraphTransition((Transition) lastSel) != null) {                  g = selectedGraph;               }            }                        if (g == null) {               XMLElement parent = lastSel;               do {                  parent = parent.getParent();               } while (parent != null && !(parent instanceof ActivitySet || parent instanceof WorkflowProcess));               if (parent != null) {                  g = getGraph((XMLCollectionElement) parent);               } else {                  if (selectedGraph != null) {                     if (XMLUtil.getPackage(lastSel) == XMLUtil.getPackage(selectedGraph.getXPDLObject()))                        g = selectedGraph;                  }               }            }                        if (g == null) {               Package sp = XMLUtil.getPackage(lastSel);               if (sp != null) {                  List wps = sp.getWorkflowProcesses().toElements();                  if (wps.size() != 0) {                     g = getGraph((XMLCollectionElement) wps.get(0));                  }               }            }                        if (g != selectedGraph) {               setSelectedGraph(g);            }                        if (selectedGraph != null)               selectedGraph.clearSelection();            // ***************************** end of find graph                        // **************************** select elements            WorkflowElement selectedElement = null;            WorkflowElement lastSelected=null;                        if (selectedGraph != null) {               List selectedElements = new ArrayList();               List overviewElements = new ArrayList();               List toCheck=new ArrayList();               if (changedElements==null || changedElements.size()==0) {                  toCheck.add(changedElement);               } else {                  toCheck.addAll(changedElements);               }               for (Iterator it = toCheck.iterator(); it.hasNext();) {                  XMLElement el = (XMLElement) it.next();                  selectedElement = selectedGraph.getGraphInterface(el);                  if (overview != null && selectedElement != null                        && !(selectedElement instanceof GraphTransitionInterface)) {                     overviewElements.add(selectedElement);                  }                  if (selectedElement != null) {                     lastSelected = selectedElement;                     selectedElements.add(selectedElement);                  }               }               selectedGraph.selectElements(selectedElements.toArray(), true, true);               if (overview != null)                  overview.getGraph().selectElements(overviewElements.toArray(), true, true);            }                        if (lastSelected != null) {               selectedGraph.scrollCellToVisible(lastSelected);            }                     }         // ********************************* END OF SELECTION EVENT      } else {         if (changedElement instanceof Package && (action==XMLElementChangeInfo.INSERTED || action==XMLElementChangeInfo.REMOVED)) {            List toHandle=new ArrayList();            if (changedElements!=null) {               toHandle.addAll(changedElements);            }            if (changedElements.size()==0) {               toHandle.add(changedElement);            }            Package mainPkg=JaWEManager.getInstance().getJaWEController().getMainPackage();            boolean adjustOtherPkgs=mainPkg!=null && !(toHandle.contains(mainPkg));                        for (int i=0; i<changedElements.size(); i++) {               Package pkg = (Package) changedElements.get(i);               if (action == XMLElementChangeInfo.INSERTED) {                                    insertPackage(pkg);               } else if (action == XMLElementChangeInfo.REMOVED) {//System.err.println("Removing package "+pkg.getId());                  removePackage(pkg);               }            }//            System.err.println("ADJ OTHER PKGs="+adjustOtherPkgs);            if (adjustOtherPkgs) {               XPDLHandler xpdlh=JaWEManager.getInstance().getXPDLHandler();               List allPkgs=new ArrayList(xpdlh.getAllPackages());               allPkgs.removeAll(changedElements);               Map allExtPkgPars=getAllPackageParticipants(changedElements);               List allGraphElements=getAllWorkflowProcessesAndActivitySetsForAdjustment(allPkgs);               //               System.err.println("AIPLGPARS="+allExtPkgPars);//               System.err.println("ALLGETUPD="+allGraphElements);               Iterator it=allGraphElements.iterator();               while (it.hasNext()) {                  XMLCollectionElement wpOrAs=(XMLCollectionElement)it.next();//                  System.err.println("ADJUSTING WPORAS "+wpOrAs.getId()+" AFTER EPCHANGE");                  GraphUtilities.adjustWorkflowProcessOrActivitySetOnUndoableChangeEvent(new ArrayList(), wpOrAs,allExtPkgPars,action==XMLElementChangeInfo.INSERTED);               }            }         } else {            if (action == XMLElementChangeInfo.INSERTED || action == XMLElementChangeInfo.REMOVED                  || action == XMLElementChangeInfo.UPDATED) {               List l = new ArrayList();

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -