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

📄 graphcontroller.java

📁 jawe的最新版本,基于Java的图形化工作流编辑器。图形化工作流编辑器 。使用JAVA语言开发
💻 JAVA
📖 第 1 页 / 共 3 页
字号:
               l.add(info);               GraphUtilities.adjustPackageOnUndoableChangeEvent(l);            }         }      }            adjustActions();   }      protected List getAllWorkflowProcessesAndActivitySetsForAdjustment (List pkgs) {      List l=new ArrayList();      Iterator it=pkgs.iterator();      while (it.hasNext()) {         Package pkg=(Package)it.next();         if (pkg.isReadOnly()) continue;         l.addAll(pkg.getWorkflowProcesses().toElements());         Iterator itWPs=pkg.getWorkflowProcesses().toElements().iterator();         while(itWPs.hasNext()) {            WorkflowProcess wp=(WorkflowProcess)itWPs.next();            l.addAll(wp.getActivitySets().toElements());         }               }      return l;   }   protected Map getAllPackageParticipants (List pkgs) {      Map m=new HashMap();      Iterator it=pkgs.iterator();      while (it.hasNext()) {         Package pkg=(Package)it.next();         Iterator itPars=pkg.getParticipants().toElements().iterator();         while (itPars.hasNext()) {            Participant par=(Participant)itPars.next();            String parId=par.getId();            if (!m.containsKey(parId)) {               m.put(parId,par);            }         }      }      return m;         }         protected GraphControllerPanel createPanel () {      GraphControllerPanel p=new GraphControllerPanel (this);      p.configure();      p.init();      return p;   }      public GraphMarqueeHandler getGraphMarqueeHandler () {      return graphMarqueeHandler;   }   public GraphObjectFactory getGraphObjectFactory () {      return graphObjectFactory;   }   public GraphObjectRendererFactory getGraphObjectRendererFactory () {      return graphObjectRendererFactory;   }      public XMLCollectionElement getDisplayedXPDLObject () {      if (selectedGraph!=null)          return selectedGraph.getXPDLObject();                  return null;         }      public void createGraph (WorkflowProcess wp) {      if (graphMap.get(wp)!=null) return;      Graph g=new Graph(this,new JaWEGraphModel(),graphMarqueeHandler,wp);      g.addGraphSelectionListener(this);      graphMap.put(wp,g);      g.clearSelection();      ToolTipManager.sharedInstance().registerComponent(g);//      selectedGraph=g;//      panel.graphAdded(g);   }   public void createGraph (ActivitySet as) {      if (graphMap.get(as)!=null) return;      Graph g=new Graph(this,new JaWEGraphModel(),graphMarqueeHandler,as);      g.addGraphSelectionListener(this);      graphMap.put(as,g);      g.clearSelection();      ToolTipManager.sharedInstance().registerComponent(g);//      selectedGraph=g;//      panel.graphSelected(selectedGraph);   }   // TODO: handle exception   protected Graph createGraph () {      try {         String gmhc = settings.getGraphClass();         Constructor c=Class.forName(gmhc).getConstructor(new Class[] {this.getClass(),JaWEGraphModel.class,GraphMarqueeHandler.class});         return (Graph)c.newInstance(new Object[]{this,createGraphModel(),graphMarqueeHandler});      } catch (Exception ex) {         return null;      }   }      protected JaWEGraphModel createGraphModel () {      try {         String gm = settings.getGraphModelClass();         return (JaWEGraphModel)Class.forName(gm).newInstance();      } catch (Exception ex) {         return null;      }   }      public Graph getSelectedGraph () {      return selectedGraph;   }   public Graph getGraph (XMLCollectionElement wpOrAs) {      return (Graph)graphMap.get(wpOrAs);   }   protected void setSelectedGraph (Graph graph) {      Graph current=selectedGraph;      if (selectedGraph != null)          selectedGraph.clearSelection();      selectedGraph=graph;            panel.graphSelected(selectedGraph);      if (selectedGraph != null) {         getGraphMarqueeHandler().setSelectionMode();      }      if (overview!=null) {         overview.displayGraph();      }      if (hm!=null) {         hm.addToHistory((current!=null) ? current.getXPDLObject():null,(graph!=null) ? graph.getXPDLObject():null);      }      adjustActions();   }   public void selectGraphForElement (XMLCollectionElement cel) {      Graph current=selectedGraph;      Graph graph=(Graph)graphMap.get(cel);      selectedGraph=graph;      panel.graphSelected(selectedGraph);      if (selectedGraph != null) {         JaWEManager.getInstance().getJaWEController().getSelectionManager()               .setSelection(selectedGraph.getXPDLObject(), true);                  getGraphMarqueeHandler().setSelectionMode();                  if (overview != null) {            overview.displayGraph();         }      }           if (hm!=null) {         hm.addToHistory((current!=null) ? current.getXPDLObject():null,(graph!=null) ? graph.getXPDLObject():null);      }      adjustActions();   }   protected void removeGraph (XMLCollectionElement wpOrAs) {      Graph g=(Graph)graphMap.remove(wpOrAs);//System.out.println("Graph "+g+" for "+wpOrAs.getId()+" will be removed!");      ToolTipManager.sharedInstance().unregisterComponent(g);      g.removeGraphSelectionListener(this);//      g.clearSelection();//      Object[] elem = JaWEGraphModel.getAll(g.getModel());//      g.getModel().remove(elem);//      g.getGraphLayoutCache().removeCells(elem);            if (selectedGraph==g) {         selectedGraph=null;         panel.graphSelected(selectedGraph);      }      g.clearXPDLObjectReferences();      if (copyOrCutInfo!=null) {         copyOrCutInfo.removeGraphInfo(g);      }      if (overview!=null) {         overview.displayGraph();      }            if (hm!=null) {         hm.removeFromHistory(wpOrAs);      }      adjustActions();   }   public void displayPreviousGraph () {      if (hm!=null && hm.canGoBack()) {         XMLCollectionElement el=(XMLCollectionElement)hm.getPrevious((selectedGraph!=null) ? selectedGraph.getXPDLObject():null);         Graph g=getGraph(el);         if (g!=selectedGraph) {            selectedGraph=g;                  panel.graphSelected(selectedGraph);            if (selectedGraph != null) {               getGraphMarqueeHandler().setSelectionMode();            }            if (overview!=null) {               overview.displayGraph();            }                        if (g!=null) {               JaWEManager.getInstance().getJaWEController().getSelectionManager().setSelection(g.getXPDLObject(), true);            }         }      }      adjustActions();   }   public void displayNextGraph () {      if (hm!=null && hm.canGoForward()) {         XMLCollectionElement el=(XMLCollectionElement)hm.getNext((selectedGraph!=null) ? selectedGraph.getXPDLObject():null);         Graph g=getGraph(el);         if (g!=selectedGraph) {            selectedGraph=g;                  panel.graphSelected(selectedGraph);            if (selectedGraph != null) {               getGraphMarqueeHandler().setSelectionMode();            }            if (overview!=null) {               overview.displayGraph();            }                        if (g!=null) {               JaWEManager.getInstance().getJaWEController().getSelectionManager().setSelection(g.getXPDLObject(), true);            }         }      }      adjustActions();   }   protected void insertPackage (Package pkg) {      Iterator it=pkg.getWorkflowProcesses().toElements().iterator();      boolean isRO=pkg.isReadOnly();      while (it.hasNext()) {         WorkflowProcess wp=(WorkflowProcess)it.next();         createGraph(wp);         if (settings.performAutomaticLayoutOnInsertion()) {                        if(isRO) {               wp.setReadOnly(false);            }            SimpleGraphLayout.layoutGraph(this, getGraph(wp));            if(isRO) {               wp.setReadOnly(true);            }         }         Iterator asi=wp.getActivitySets().toElements().iterator();         while (asi.hasNext()) {            ActivitySet as=(ActivitySet)asi.next();            createGraph(as);            if (settings.performAutomaticLayoutOnInsertion()) {               if(isRO) {                  wp.setReadOnly(false);               }               SimpleGraphLayout.layoutGraph(this, getGraph(as));               if(isRO) {                  wp.setReadOnly(true);               }            }         }      }   }   protected void removePackage (Package pkg) {      Iterator it=pkg.getWorkflowProcesses().toElements().iterator();      while (it.hasNext()) {         WorkflowProcess wp=(WorkflowProcess)it.next();         removeGraph(wp);         Iterator asi=wp.getActivitySets().toElements().iterator();         while (asi.hasNext()) {            ActivitySet as=(ActivitySet)asi.next();            removeGraph(as);         }      }   }   protected XPDLElementChangeInfo createInfo(XMLElement main,List elements, int action) {            XPDLElementChangeInfo info=new XPDLElementChangeInfo();      info.setChangedElement(main);      if (elements.size() != 0)          info.setChangedElement((XMLElement)elements.iterator().next());      info.setChangedSubElements(elements);      info.setAction(action);      info.setSource(this);      return info;   }      public void setUpdateInProgress(boolean isInProgress) {      updateInProgress = isInProgress;   }      public boolean isUpdateInProgress() {      return updateInProgress;   }      public CopyOrCutInfo getCopyOrCutInfo () {      return copyOrCutInfo;   }      public GraphOverview getOverview() {      return overview;   }   public HistoryManager getHistoryManager () {      return hm;   }      protected void adjustActions() {      settings.adjustActions();            panel.enableDisableButtons();   }   }

⌨️ 快捷键说明

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