Пример #1
0
 /**
  * @param model
  * @param layouter
  */
 private static void setDockingPoints(ProcessModel model, SugiyamaLayoutAlgorithm layouter) {
   if ("1"
       .equals(Configuration.getInstance().getProperty(LayoutHelper.CONF_SET_CONNECTION_POINTS))) {
     // correcting points directly at node
     for (ProcessEdge edge : model.getEdges()) {
       LayoutHelper.setDockingPointOffset(edge, layouter.getTopToBottom());
     }
   }
 }
Пример #2
0
 @Override
 public void addContext(ProcessModel context) {
   super.addContext(context);
   if (f_parent == null) {
     f_parent = (Tool) context.getNodeById(getProperty(PROP_PARENT_ID));
     if (f_parent != null) // can happen with legacy models
     f_parent.setErrorConnector(this, getNumber());
   }
 }
Пример #3
0
 /**
  * works recursively
  *
  * @param f
  */
 private void importAndLayout(File f, List<Class<? extends ProcessModel>> modelTypes) {
   if (f.isDirectory()) {
     for (File child : f.listFiles()) {
       importAndLayout(child, modelTypes);
     }
   } else {
     try {
       List<ProcessModel> _models = ConverterHelper.importModels(f);
       for (ProcessModel pm : _models) {
         if (pm != null) {
           try {
             boolean _doLayout = false;
             if (modelTypes == null) {
               _doLayout = true;
             } else {
               for (Class<? extends ProcessModel> cl : modelTypes) {
                 if (pm.getClass().isAssignableFrom(cl)) {
                   _doLayout = true;
                 }
               }
             }
             if (_doLayout) {
               System.out.println("Layouting " + f.getName());
               f_layouter.layoutModel(ProcessUtils.getAdapter(pm));
             }
           } catch (Exception e) {
             e.printStackTrace();
             fail("Error while Layouting " + f.getAbsolutePath());
           }
         }
       }
     } catch (Exception e) {
       System.out.println("Could not import " + f.getName());
     }
   }
 }
Пример #4
0
 public static void postProcess(ProcessLayouter layouter, ProcessModel model) {
   // special handling for certain model types
   if (layouter instanceof SugiyamaLayoutAlgorithm && model instanceof ClassModel) {
     SugiyamaLayoutAlgorithm _layouter = (SugiyamaLayoutAlgorithm) layouter;
     setDockingPoints(model, _layouter);
   }
   List<EdgeInterface> _edgesToRoute = layouter.getUnroutedEdges();
   if (_edgesToRoute != null) {
     for (EdgeInterface edge : _edgesToRoute) {
       if (edge instanceof ProcessEdgeAdapter) {
         ProcessEdge _e = ((ProcessEdgeAdapter) edge).getEdge();
         model.getUtils().getRoutingPointLayouter().optimizeRoutingPoints(_e, _e.getSource());
       }
     }
   }
 }