Exemplo n.º 1
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());
       }
     }
   }
 }
Exemplo n.º 2
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());
     }
   }
 }