Ejemplo n.º 1
0
 public void pack() {
   BufferedImage _bi = new BufferedImage(100, 100, BufferedImage.TYPE_INT_RGB);
   Graphics g = _bi.getGraphics();
   Rectangle _bounds =
       ProcessUtils.drawText(
           (Graphics2D) g, 0, 0, this.getSize().width, this.getText(), Orientation.CENTER);
   this.setSize(this.getSize().width, _bounds.height + 10);
 }
Ejemplo 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());
     }
   }
 }