oodt-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mattm...@apache.org
Subject [47/53] [partial] oodt git commit: Record change for OODT-836, OODT-837.
Date Sun, 16 Jul 2017 16:16:03 GMT
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/app/weditor/src/main/java/org/apache/oodt/cas/workflow/gui/perspective/view/impl/GraphView.java
----------------------------------------------------------------------
diff --git a/app/weditor/src/main/java/org/apache/oodt/cas/workflow/gui/perspective/view/impl/GraphView.java b/app/weditor/src/main/java/org/apache/oodt/cas/workflow/gui/perspective/view/impl/GraphView.java
deleted file mode 100644
index 64cf0a1..0000000
--- a/app/weditor/src/main/java/org/apache/oodt/cas/workflow/gui/perspective/view/impl/GraphView.java
+++ /dev/null
@@ -1,1140 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.oodt.cas.workflow.gui.perspective.view.impl;
-
-//JDK imports
-import org.apache.oodt.cas.workflow.gui.model.ModelGraph;
-import org.apache.oodt.cas.workflow.gui.model.ModelNode;
-import org.apache.oodt.cas.workflow.gui.perspective.view.View;
-import org.apache.oodt.cas.workflow.gui.perspective.view.ViewChange;
-import org.apache.oodt.cas.workflow.gui.perspective.view.ViewState;
-import org.apache.oodt.cas.workflow.gui.util.GuiUtils;
-import org.apache.oodt.cas.workflow.gui.util.IconLoader;
-import org.apache.oodt.cas.workflow.gui.util.Line;
-
-import com.jgraph.layout.JGraphFacade;
-import com.jgraph.layout.hierarchical.JGraphHierarchicalLayout;
-
-import org.jgraph.JGraph;
-import org.jgraph.graph.AttributeMap;
-import org.jgraph.graph.DefaultEdge;
-import org.jgraph.graph.DefaultGraphCell;
-import org.jgraph.graph.GraphConstants;
-
-import java.awt.BorderLayout;
-import java.awt.Color;
-import java.awt.Cursor;
-import java.awt.Graphics2D;
-import java.awt.MenuItem;
-import java.awt.Point;
-import java.awt.PopupMenu;
-import java.awt.Rectangle;
-import java.awt.Toolkit;
-import java.awt.datatransfer.DataFlavor;
-import java.awt.datatransfer.Transferable;
-import java.awt.datatransfer.UnsupportedFlavorException;
-import java.awt.dnd.DnDConstants;
-import java.awt.dnd.DragGestureEvent;
-import java.awt.dnd.DragGestureListener;
-import java.awt.dnd.DragSource;
-import java.awt.dnd.DragSourceDragEvent;
-import java.awt.dnd.DragSourceDropEvent;
-import java.awt.dnd.DragSourceEvent;
-import java.awt.dnd.DragSourceListener;
-import java.awt.event.ActionEvent;
-import java.awt.event.ActionListener;
-import java.awt.event.MouseEvent;
-import java.awt.event.MouseListener;
-import java.awt.event.MouseMotionListener;
-import java.awt.event.MouseWheelListener;
-import java.awt.geom.Point2D;
-import java.awt.geom.Rectangle2D;
-import java.awt.image.BufferedImage;
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.Comparator;
-import java.util.concurrent.ConcurrentHashMap;
-import java.util.Hashtable;
-import java.util.List;
-import java.util.Map;
-import java.util.Map.Entry;
-import java.util.Vector;
-
-import javax.swing.JScrollPane;
-import javax.swing.SwingConstants;
-import javax.swing.border.LineBorder;
-import javax.swing.tree.DefaultMutableTreeNode;
-
-import edu.uci.ics.jung.graph.DirectedSparseGraph;
-import edu.uci.ics.jung.graph.ObservableGraph;
-
-//JGraph imports
-//Jung imports
-//OODT imports
-
-/**
- * 
- * This is where the money happens. The Graph visualization of OODT CAS
- * workflows is displayed via this view, which magically integrates JGraph,
- * Jung, and OODT.
- * 
- * @author bfoster
- * @author mattmann
- * 
- */
-public class GraphView extends DefaultTreeView {
-
-  private static final long serialVersionUID = 5935578385254884387L;
-
-  private JungJGraphModelAdapter m_jgAdapter;
-  private JGraph jgraph;
-  private ObservableGraph<ModelNode, IdentifiableEdge> directedGraph;
-
-  private MyGraphListener myGraphListener;
-
-  private static final String VIEW_REF_WORKFLOW = "View Referrenced";
-  private static final String ACTIONS_POP_MENU_NAME = "Actions";
-  private static final String NEW_SUB_POP_MENU_NAME = "New";
-  private static final String NEW_TASK_ITEM_NAME = "Task";
-  private static final String NEW_CONDITION_ITEM_NAME = "Condition";
-  private static final String NEW_PARALLEL_ITEM_NAME = "Parallel";
-  private static final String NEW_SEQUENTIAL_ITEM_NAME = "Sequential";
-  private static final String EDGES_SUB_POP_MENU_NAME = "Edges";
-  private static final String TASK_LEVEL = "Task Level";
-  private static final String WORKFLOW_LEVEL = "Workflow Level";
-  private static final String DELETE_ITEM_NAME = "Delete";
-  private static final String FORMAT_ITEM_NAME = "Format";
-  private static final String ORDER_SUB_POP_MENU_NAME = "Order";
-  private static final String TO_FRONT_ITEM_NAME = "Move To Front";
-  private static final String TO_BACK_ITEM_NAME = "Move To Back";
-  private static final String FORWARD_ITEM_NAME = "Move Forward";
-  private static final String BACKWARDS_ITEM_NAME = "Move Backwards";
-
-  private ConcurrentHashMap<String, Pair> edgeMap;
-
-  private static final String SCALE = "GraphView/scale";
-  private static final String EDGE_DISPLAY_MODE = "GraphView/EdgeDisplay/Mode";
-  private static final String TASK_MODE = "Task";
-  private static final String WORKFLOW_MODE = "Workflow";
-
-  private boolean scrollSelectedToVisible = false;
-
-  public GraphView(String name) {
-    super(name);
-  }
-
-  @Override
-  public void refreshView(final ViewState state) {
-    this.removeAll();
-    this.myGraphListener = new MyGraphListener(state);
-
-    Rectangle visible = null;
-    if (jgraph != null) {
-      visible = jgraph.getVisibleRect();
-    }
-
-    Cursor cursor = null;
-    if (jgraph != null) {
-      cursor = jgraph.getCursor();
-    }
-
-    this.edgeMap = new ConcurrentHashMap<String, Pair>();
-
-    directedGraph = new ObservableGraph<ModelNode, IdentifiableEdge>(
-        new DirectedSparseGraph<ModelNode, IdentifiableEdge>());
-    m_jgAdapter = new JungJGraphModelAdapter(directedGraph);
-
-    jgraph = new JGraph(m_jgAdapter);
-    for (MouseListener ml : jgraph.getMouseListeners()) {
-      jgraph.removeMouseListener(ml);
-    }
-    for (MouseMotionListener ml : jgraph.getMouseMotionListeners()) {
-      jgraph.removeMouseMotionListener(ml);
-    }
-    for (MouseWheelListener ml : jgraph.getMouseWheelListeners()) {
-      jgraph.removeMouseWheelListener(ml);
-    }
-    jgraph.setBackground(Color.white);
-    jgraph.setAntiAliased(true);
-    jgraph.setMoveable(false);
-    String scale = state.getFirstPropertyValue(SCALE);
-    if (scale == null) {
-      state.setProperty(SCALE, scale = "1.0");
-    }
-    jgraph.setScale(Double.parseDouble(scale));
-
-    DragSource dragSource = DragSource.getDefaultDragSource();
-    dragSource.createDefaultDragGestureRecognizer(this.jgraph,
-        DnDConstants.ACTION_MOVE, new DragGestureListener() {
-
-          DefaultGraphCell moveCell = null;
-          ModelGraph moveGraph = null;
-
-          public void dragGestureRecognized(final DragGestureEvent dge) {
-            if (state.getMode() == View.Mode.MOVE
-                || state.getMode() == View.Mode.EDIT) {
-              Object moveOverCell = jgraph.getFirstCellForLocation(dge
-                  .getDragOrigin().getX(), dge.getDragOrigin().getY());
-              if (moveOverCell != null) {
-                if (moveOverCell instanceof DefaultEdge) {
-                  moveCell = null;
-                } else if (moveOverCell instanceof DefaultGraphCell) {
-                  moveCell = (DefaultGraphCell) moveOverCell;
-                  moveGraph = GuiUtils.find(state.getGraphs(),
-                      ((ModelNode) ((DefaultGraphCell) moveCell)
-                          .getUserObject()).getId());
-
-                  if (state.getMode() == View.Mode.MOVE) {
-                    moveCell = GraphView.this.m_jgAdapter
-                        .getVertexCell((moveGraph = moveGraph.getRootParent())
-                            .getModel());
-                  } else if (GuiUtils.isDummyNode(moveGraph.getModel())) {
-                    moveCell = GraphView.this.m_jgAdapter
-                        .getVertexCell((moveGraph = moveGraph.getParent())
-                            .getModel());
-                  } else if (moveGraph.getModel().isRef()) {
-                    while (moveGraph.getParent() != null
-                        && moveGraph.getParent().getModel().isRef()) {
-                      moveGraph = moveGraph.getParent();
-                    }
-                    moveCell = GraphView.this.m_jgAdapter
-                        .getVertexCell(moveGraph.getModel());
-                  }
-                  final double scale = Double.parseDouble(state
-                      .getFirstPropertyValue(SCALE));
-                  final Rectangle2D bounds = (Rectangle2D) GraphView.this.jgraph
-                      .getAttributes(moveCell).get(GraphConstants.BOUNDS);
-                  Point offset = new Point(
-                      (int) (bounds.getX() * scale - dge.getDragOrigin().getX()),
-                      (int) (bounds.getY() * scale - dge.getDragOrigin().getY()));
-                  BufferedImage image = new BufferedImage((int) (bounds
-                      .getWidth() * scale), (int) (bounds.getHeight() * scale),
-                      BufferedImage.TYPE_INT_ARGB);
-                  Graphics2D g2d = image.createGraphics();
-                  g2d.setColor(Color.black);
-                  g2d.drawRect((int) (2 * scale), (int) (2 * scale),
-                      (int) ((bounds.getWidth() - 4) * scale),
-                      (int) ((bounds.getHeight() - 4) * scale));
-                  dge.startDrag(GraphView.this.getCursor(), image, offset,
-                      new Transferable() {
-
-                        public Object getTransferData(DataFlavor flavor)
-                            throws UnsupportedFlavorException, IOException {
-                          if (flavor.getHumanPresentableName().equals(
-                              DefaultGraphCell.class.getSimpleName())) {
-                            return this;
-                          } else {
-                            throw new UnsupportedFlavorException(flavor);
-                          }
-                        }
-
-                        public DataFlavor[] getTransferDataFlavors() {
-                          return new DataFlavor[] { new DataFlavor(
-                              DefaultGraphCell.class, DefaultGraphCell.class
-                                  .getSimpleName()) };
-                        }
-
-                        public boolean isDataFlavorSupported(DataFlavor flavor) {
-                          return flavor.getHumanPresentableName().equals(
-                              DefaultGraphCell.class.getSimpleName());
-                        }
-
-                      }, new DragSourceListener() {
-
-                        private ModelGraph mouseOverGraph;
-                        private DefaultGraphCell mouseOverCell;
-
-                        public void dragDropEnd(DragSourceDropEvent dsde) {
-                          System.out.println("DRAG END!!!!");
-                          if (moveCell == null) {
-                            return;
-                          }
-                          Point dropPoint = new Point(dsde.getX()
-                              - jgraph.getLocationOnScreen().x, dsde.getY()
-                              - jgraph.getLocationOnScreen().y);
-                          DefaultGraphCell endCell = (DefaultGraphCell) GraphView.this.jgraph
-                              .getSelectionCell();
-                          if (endCell != null) {
-                            ModelGraph endGraph = GuiUtils.find(
-                                state.getGraphs(),
-                                ((ModelNode) endCell.getUserObject()).getId());
-                            if (!endGraph.getModel().isParentType()
-                                || GuiUtils.isSubGraph(moveGraph, endGraph)) {
-                              return;
-                            }
-                            if (moveGraph.getParent() == null) {
-                              state.removeGraph(moveGraph);
-                            } else {
-                              GuiUtils.removeNode(state.getGraphs(),
-                                  moveGraph.getModel());
-                            }
-                            GraphView.this.removeShift(state, moveGraph);
-                            GuiUtils.addChild(state.getGraphs(), endGraph
-                                .getModel().getId(), moveGraph);
-                            GraphView.this.notifyListeners();
-                          } else {
-                            if (moveGraph.getParent() != null) {
-                              GuiUtils.removeNode(state.getGraphs(),
-                                  moveGraph.getModel());
-                              state.addGraph(moveGraph);
-                            }
-                            Point shiftPoint = new Point(
-                                (int) ((dropPoint.x - (dge.getDragOrigin().x - (bounds
-                                    .getX() * scale))) / scale),
-                                (int) ((dropPoint.y - (dge.getDragOrigin().y - (bounds
-                                    .getY() * scale))) / scale));
-                            GraphView.this.setShift(state, moveGraph,
-                                shiftPoint);
-                            GraphView.this.notifyListeners();
-                          }
-                        }
-
-                        public void dragEnter(DragSourceDragEvent dsde) {
-                          mouseOverCell = (DefaultGraphCell) GraphView.this.jgraph
-                              .getFirstCellForLocation(
-                                  dsde.getX() - jgraph.getLocationOnScreen().x,
-                                  dsde.getY() - jgraph.getLocationOnScreen().y);
-                          mouseOverGraph = GuiUtils.find(state.getGraphs(),
-                              ((ModelNode) mouseOverCell.getUserObject())
-                                  .getId());
-                        }
-
-                        public void dragExit(DragSourceEvent dse) {
-                          System.out.println("DRAG EXIT!!!!");
-                        }
-
-                        public void dragOver(DragSourceDragEvent dsde) {
-                          if (state.getMode().equals(Mode.EDIT)) {
-                            if (mouseOverCell != null) {
-                              Rectangle2D currentBounds = (Rectangle2D) mouseOverCell
-                                  .getAttributes().get(GraphConstants.BOUNDS);
-                              Point currentPoint = new Point(dsde.getX()
-                                  - jgraph.getLocationOnScreen().x, dsde.getY()
-                                  - jgraph.getLocationOnScreen().y);
-                              if (currentBounds.contains(currentPoint)) {
-                                for (ModelGraph child : mouseOverGraph
-                                    .getChildren()) {
-                                  DefaultGraphCell mouseOverCellLoc = GraphView.this.m_jgAdapter
-                                      .getVertexCell(child.getModel());
-                                  currentBounds = (Rectangle2D) mouseOverCellLoc
-                                      .getAttributes().get(
-                                          GraphConstants.BOUNDS);
-                                  if (currentBounds.contains(currentPoint)) {
-                                    mouseOverCell = mouseOverCellLoc;
-                                    mouseOverGraph = child;
-                                    break;
-                                  }
-                                }
-                              } else {
-                                if (mouseOverGraph.getParent() != null
-                                    && (!mouseOverGraph.isCondition() || (mouseOverGraph
-                                        .isCondition() && mouseOverGraph
-                                        .getParent().isCondition()))) {
-                                  mouseOverCell = GraphView.this.m_jgAdapter
-                                      .getVertexCell((mouseOverGraph = mouseOverGraph
-                                          .getParent()).getModel());
-                                  currentBounds = (Rectangle2D) mouseOverCell
-                                      .getAttributes().get(
-                                          GraphConstants.BOUNDS);
-                                } else {
-                                  mouseOverCell = null;
-                                  mouseOverGraph = null;
-                                }
-                              }
-                            } else {
-                              mouseOverCell = (DefaultGraphCell) GraphView.this.jgraph
-                                  .getFirstCellForLocation(
-                                      dsde.getX()
-                                          - jgraph.getLocationOnScreen().x,
-                                      dsde.getY()
-                                          - jgraph.getLocationOnScreen().y);
-                              if (mouseOverCell != null) {
-                                mouseOverGraph = GuiUtils.find(state
-                                    .getGraphs(), ((ModelNode) mouseOverCell
-                                    .getUserObject()).getId());
-                              } else {
-                                mouseOverGraph = null;
-                              }
-                            }
-                            if (mouseOverGraph != null) {
-                              if (GuiUtils.isDummyNode(mouseOverGraph
-                                  .getModel())) {
-                                mouseOverGraph = mouseOverGraph.getParent();
-                              } else {
-                                while (mouseOverGraph != null
-                                    && mouseOverGraph.getModel().isRef()) {
-                                  mouseOverGraph = mouseOverGraph.getParent();
-                                }
-                              }
-                              if (mouseOverGraph != null) {
-                                mouseOverCell = GraphView.this.m_jgAdapter
-                                    .getVertexCell(mouseOverGraph.getModel());
-                              } else {
-                                mouseOverCell = null;
-                              }
-                            }
-                            GraphView.this.jgraph
-                                .setSelectionCells(new Object[] { mouseOverCell });
-                          }
-                        }
-
-                        public void dropActionChanged(DragSourceDragEvent dsde) {
-                          System.out.println("DRAG CHANGE!!!!");
-                        }
-
-                      });
-                }
-              }
-            }
-          }
-
-        });
-
-    List<Line> lines = GuiUtils.findLines(state.getGraphs());
-    for (Line line : lines) {
-      if (!this.directedGraph.containsVertex(line.getFromModel())) {
-        this.directedGraph.addVertex(line.getFromModel());
-      }
-
-      if (line.getToModel() != null) {
-        if (!this.directedGraph.containsVertex(line.getToModel())) {
-          this.directedGraph.addVertex(line.getToModel());
-        }
-        IdentifiableEdge edge = new IdentifiableEdge(line.getFromModel(), line.getToModel());
-        directedGraph.addEdge(edge, line.getFromModel(), line.getToModel());
-        this.edgeMap.put(edge.id, new Pair(line.getFromModel() != null ? line
-            .getFromModel().getId() : null, line.getToModel().getId()));
-      }
-    }
-
-    JGraphFacade facade = new JGraphFacade(jgraph);
-    facade.setIgnoresUnconnectedCells(false);
-    JGraphHierarchicalLayout layout = new JGraphHierarchicalLayout();
-    layout.setOrientation(SwingConstants.WEST);
-    layout.setIntraCellSpacing(70.0);
-    layout.setLayoutFromSinks(false);
-    layout.run(facade);
-    Map nested = facade.createNestedMap(true, true);
-    if (nested != null) {
-      this.hideDummyNodes(nested);
-      this.addGroups(state.getGraphs(), nested, state);
-      this.ensureNoOverlap(nested, state);
-      nested = this.shiftMap(nested, state);
-      jgraph.getGraphLayoutCache().edit(nested);
-    }
-
-    String edgeDisplayMode = state.getFirstPropertyValue(EDGE_DISPLAY_MODE);
-    if (edgeDisplayMode == null) {
-      state.setProperty(EDGE_DISPLAY_MODE, edgeDisplayMode = WORKFLOW_MODE);
-    }
-    if (edgeDisplayMode.equals(WORKFLOW_MODE)) {
-      this.edgeMap = new ConcurrentHashMap<String, Pair>();
-      removeAllEdges(this.directedGraph);
-      lines = GuiUtils.findSequentialLines(state.getGraphs());
-      for (Line line : lines) {
-        IdentifiableEdge edge = new IdentifiableEdge(line.getFromModel(), line.getToModel());
-        directedGraph.addEdge(edge, line.getFromModel(), line.getToModel());
-        this.edgeMap.put(edge.id, new Pair(line.getFromModel() != null ? line
-            .getFromModel().getId() : null, line.getToModel().getId()));
-      }
-    }
-
-    if (state.getSelected() != null) {
-      ModelGraph graph = GuiUtils.find(state.getGraphs(), state.getSelected()
-          .getModel().getId());
-      if (graph != null) {
-        DefaultGraphCell cell = this.m_jgAdapter
-            .getVertexCell(graph.getModel());
-        if (cell != null) {
-          this.jgraph.setSelectionCells(new Object[] { cell });
-        } else {
-          this.jgraph.setSelectionCells(new Object[] {});
-        }
-      } else {
-        this.jgraph.setSelectionCells(new Object[] {});
-      }
-    } else {
-      this.jgraph.setSelectionCells(new Object[] {});
-    }
-
-    jgraph.addMouseListener(this.myGraphListener);
-
-    this.setLayout(new BorderLayout());
-    this.add(new JScrollPane(jgraph, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,
-        JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS), BorderLayout.CENTER);
-
-    if (scrollSelectedToVisible && state.getSelected() != null) {
-      this.jgraph.scrollCellToVisible(GraphView.this.m_jgAdapter
-          .getVertexCell(state.getSelected().getModel()));
-      scrollSelectedToVisible = false;
-    } else if (visible != null) {
-      this.jgraph.scrollRectToVisible(visible);
-    }
-
-    if (cursor != null) {
-      this.jgraph.setCursor(cursor);
-    }
-
-    this.revalidate();
-  }
-
-  private void hideDummyNodes(Map nested) {
-    for (Object cell : nested.keySet()) {
-      if (cell instanceof DefaultEdge) {
-        // do nothing
-      } else if (cell instanceof DefaultGraphCell) {
-        if (GuiUtils.isDummyNode((ModelNode) ((DefaultGraphCell) cell)
-            .getUserObject())) {
-          ((Map<Object, Object>) nested.get(cell)).put("opaque", false);
-          ((Map<Object, Object>) nested.get(cell)).put("backgroundColor",
-              Color.white);
-        }
-      }
-    }
-  }
-
-  private Map shiftMap(Map nested, ViewState state) {
-    Map shiftedNested = new Hashtable(nested);
-    for (Object obj : shiftedNested.entrySet()) {
-      Entry entry = (Entry) obj;
-      if (entry.getKey() instanceof DefaultEdge) {
-        ArrayList<Point2D.Double> points = (ArrayList<Point2D.Double>) ((Map<Object, Object>) entry
-            .getValue()).get("points");
-        ArrayList<Point2D.Double> newPoints = new ArrayList<Point2D.Double>();
-        Point shift = this.getShift(state, (DefaultGraphCell) entry.getKey(),
-            nested);
-        for (Point2D.Double point : points) {
-          newPoints
-              .add(new Point2D.Double(point.x + shift.x, point.y + shift.y));
-        }
-        ((Map<Object, Object>) entry.getValue()).put("points", newPoints);
-      } else if (entry.getKey() instanceof DefaultGraphCell) {
-        DefaultGraphCell cell = (DefaultGraphCell) entry.getKey();
-        Rectangle2D bounds = (Rectangle2D) ((Map<Object, Object>) entry
-            .getValue()).get("bounds");
-        Point shift = this.getShift(state, cell, nested);
-        AttributeMap.SerializableRectangle2D newBounds = new AttributeMap.SerializableRectangle2D(
-            bounds.getX() + shift.x, bounds.getY() + shift.y,
-            bounds.getWidth(), bounds.getHeight());
-        Map<Object, Object> newMap = new Hashtable<Object, Object>(
-            (Map<Object, Object>) entry.getValue());
-        newMap.put("bounds", newBounds);
-        shiftedNested.put(cell, newMap);
-      }
-    }
-    return shiftedNested;
-  }
-
-  private void ensureNoOverlap(Map nested, ViewState state) {
-    boolean changed;
-    do {
-      changed = false;
-      for (int i = 0; i < state.getGraphs().size(); i++) {
-        ModelGraph currentGraph = state.getGraphs().get(i);
-        if (this.ensureNoInternalOverlap(currentGraph, nested)) {
-          changed = true;
-        }
-        DefaultGraphCell currentCell = this.m_jgAdapter
-            .getVertexCell(currentGraph.getModel());
-        Rectangle2D currentBounds = (Rectangle2D) ((Map) nested
-            .get(currentCell)).get(GraphConstants.BOUNDS);
-        Point currentShift = this.getShift(state, currentCell, nested);
-        Rectangle currentShiftBounds = new Rectangle(
-            (int) (currentBounds.getX() + currentShift.getX()),
-            (int) (currentBounds.getY() + currentShift.getY()),
-            (int) currentBounds.getWidth(), (int) currentBounds.getHeight());
-        for (int j = 0; j < state.getGraphs().size(); j++) {
-          if (i == j) {
-            continue;
-          }
-          ModelGraph graph = state.getGraphs().get(j);
-          DefaultGraphCell cell = this.m_jgAdapter.getVertexCell(graph
-              .getModel());
-          Rectangle2D bounds = (Rectangle2D) ((Map) nested.get(cell))
-              .get(GraphConstants.BOUNDS);
-          Point shift = this.getShift(state, cell, nested);
-          Rectangle shiftBounds = new Rectangle(
-              (int) (bounds.getX() + shift.getX()),
-              (int) (bounds.getY() + shift.getY()), (int) bounds.getWidth(),
-              (int) bounds.getHeight());
-          if (currentShiftBounds.intersects(shiftBounds)) {
-            changed = true;
-            if (currentShiftBounds.getY() < shiftBounds.getY()) {
-              Rectangle intersection = currentShiftBounds
-                  .intersection(shiftBounds);
-              if (currentShiftBounds.getY() + currentShiftBounds.getHeight() > shiftBounds
-                  .getY() + shiftBounds.getHeight()) {
-                this.setShift(state, graph,
-                    new Point((int) (currentShiftBounds.getX()
-                        + currentShiftBounds.getWidth() + 20.0),
-                        (int) shiftBounds.getY()));
-              } else {
-                this.setShift(
-                    state,
-                    graph,
-                    new Point((int) shiftBounds.getX(), (int) (shiftBounds
-                        .getY() + intersection.getHeight() + 20.0)));
-              }
-            } else {
-              Rectangle intersection = shiftBounds
-                  .intersection(currentShiftBounds);
-              if (shiftBounds.getY() + shiftBounds.getHeight() > currentShiftBounds
-                  .getY() + currentShiftBounds.getHeight()) {
-                this.setShift(
-                    state,
-                    currentGraph,
-                    new Point((int) (shiftBounds.getX()
-                        + shiftBounds.getWidth() + 20.0),
-                        (int) currentShiftBounds.getY()));
-              } else {
-                this.setShift(
-                    state,
-                    currentGraph,
-                    new Point((int) currentShiftBounds.getX(),
-                        (int) (currentShiftBounds.getY()
-                            + intersection.getHeight() + 20.0)));
-              }
-
-              currentShift = this.getShift(state, currentCell, nested);
-              currentShiftBounds = new Rectangle(
-                  (int) (currentBounds.getX() + currentShift.getX()),
-                  (int) (currentBounds.getY() + currentShift.getY()),
-                  (int) currentBounds.getWidth(),
-                  (int) currentBounds.getHeight());
-            }
-          }
-        }
-      }
-    } while (changed);
-  }
-
-  private boolean ensureNoInternalOverlap(final ModelGraph graph,
-      final Map nested) {
-    boolean changed = false;
-    if (graph.getChildren().size() > 1) {
-      List<ModelGraph> sortedChildren = new Vector<ModelGraph>(
-          graph.getChildren());
-      Collections.sort(sortedChildren, new Comparator<ModelGraph>() {
-
-        public int compare(ModelGraph o1, ModelGraph o2) {
-          DefaultGraphCell child1Cell = GraphView.this.m_jgAdapter
-              .getVertexCell(o1.getModel());
-          DefaultGraphCell child2Cell = GraphView.this.m_jgAdapter
-              .getVertexCell(o2.getModel());
-          Rectangle2D child1Bounds = (Rectangle2D) ((Map) nested
-              .get(child1Cell)).get(GraphConstants.BOUNDS);
-          Rectangle2D child2Bounds = (Rectangle2D) ((Map) nested
-              .get(child2Cell)).get(GraphConstants.BOUNDS);
-          if (graph.getModel().getExecutionType().equals("parallel")) {
-            return Double.compare(child1Bounds.getMaxY(),
-                child2Bounds.getMaxY());
-          } else {
-            return Double.compare(child1Bounds.getX(), child2Bounds.getX());
-          }
-        }
-
-      });
-      changed = ensureNoInternalOverlap(sortedChildren.get(0), nested);
-      Rectangle2D graphRectangle = (Rectangle2D) ((Map) nested
-          .get(this.m_jgAdapter.getVertexCell(sortedChildren.get(0).getModel())))
-          .get(GraphConstants.BOUNDS);
-      for (int i = 1; i < sortedChildren.size(); i++) {
-        ModelGraph child2 = sortedChildren.get(i);
-        if (ensureNoInternalOverlap(child2, nested)) {
-          changed = true;
-        }
-        DefaultGraphCell child2Cell = this.m_jgAdapter.getVertexCell(child2
-            .getModel());
-        for (int j = i - 1; j >= 0; j--) {
-          ModelGraph child1 = sortedChildren.get(j);
-          DefaultGraphCell child1Cell = this.m_jgAdapter.getVertexCell(child1
-              .getModel());
-          Rectangle2D child1Bounds = (Rectangle2D) ((Map) nested
-              .get(child1Cell)).get(GraphConstants.BOUNDS);
-          Rectangle2D child2Bounds = (Rectangle2D) ((Map) nested
-              .get(child2Cell)).get(GraphConstants.BOUNDS);
-          if (child1Bounds.intersects(child2Bounds)) {
-            changed = true;
-            if (graph.getModel().getExecutionType().equals("parallel")) {
-              ((Map) nested.get(child2Cell)).put(GraphConstants.BOUNDS,
-                  new AttributeMap.SerializableRectangle2D(child2Bounds.getX(),
-                      child1Bounds.getMaxY() + 20.0, child2Bounds.getWidth(),
-                      child2Bounds.getHeight()));
-              this.shift(child2.getChildren(), nested, 0,
-                  child1Bounds.getMaxY() + 20.0 - child2Bounds.getY());
-            } else {
-              ((Map) nested.get(child2Cell)).put(
-                  GraphConstants.BOUNDS,
-                  new AttributeMap.SerializableRectangle2D(child1Bounds
-                      .getMaxX() + 20.0, child2Bounds.getY(), child2Bounds
-                      .getWidth(), child2Bounds.getHeight()));
-              this.shift(child2.getChildren(), nested, child1Bounds.getMaxX()
-                  + 20.0 - child2Bounds.getX(), 0);
-            }
-          }
-        }
-        graphRectangle = graphRectangle.createUnion((Rectangle2D) ((Map) nested
-            .get(child2Cell)).get(GraphConstants.BOUNDS));
-      }
-      ((Map) nested.get(this.m_jgAdapter.getVertexCell(graph.getModel()))).put(
-          GraphConstants.BOUNDS, new AttributeMap.SerializableRectangle2D(
-              graphRectangle.getX() - 5, graphRectangle.getY() - 20,
-              graphRectangle.getWidth() + 10, graphRectangle.getHeight() + 25));
-    }
-    return changed;
-  }
-
-  private void shift(List<ModelGraph> graphs, Map nested, double x, double y) {
-    for (ModelGraph graph : graphs) {
-      DefaultGraphCell cell = this.m_jgAdapter.getVertexCell(graph.getModel());
-      Rectangle2D bounds = (Rectangle2D) ((Map) nested.get(cell))
-          .get(GraphConstants.BOUNDS);
-      ((Map) nested.get(cell)).put(
-          GraphConstants.BOUNDS,
-          new AttributeMap.SerializableRectangle2D(bounds.getX() + x, bounds
-                                                                          .getY() + y, bounds.getWidth(),
-              bounds.getHeight()));
-      this.shift(graph.getChildren(), nested, x, y);
-    }
-  }
-
-  private void addGroups(List<ModelGraph> modelGraphs, Map nested,
-      ViewState state) {
-    for (ModelGraph modelGraph : modelGraphs) {
-      this.addGroups(modelGraph, nested, state);
-    }
-  }
-
-  private DefaultGraphCell addGroups(ModelGraph modelGraph, Map nested,
-      ViewState state) {
-    if (modelGraph.getModel().isParentType()) {
-      double top_x = Double.MAX_VALUE, top_y = Double.MAX_VALUE, bottom_x = 0.0, bottom_y = 0.0;
-      this.directedGraph.addVertex(modelGraph.getModel());
-      DefaultGraphCell modelCell = this.m_jgAdapter.getVertexCell(modelGraph
-          .getModel());
-
-
-      ConcurrentHashMap<Object, Object> map = new ConcurrentHashMap<Object, Object>();
-      for (int i = 0; i < modelGraph.getChildren().size(); i++) {
-        ModelGraph child = modelGraph.getChildren().get(i);
-        DefaultGraphCell curCell = addGroups(child, nested, state);
-        Rectangle2D bounds = (Rectangle2D) ((Map<Object, Object>) nested
-            .get(curCell)).get("bounds");
-        if (bounds.getX() < top_x) {
-          top_x = bounds.getX();
-        }
-        if (bounds.getY() < top_y) {
-          top_y = bounds.getY();
-        }
-        if (bounds.getMaxX() > bottom_x) {
-          bottom_x = bounds.getMaxX();
-        }
-        if (bounds.getMaxY() > bottom_y) {
-          bottom_y = bounds.getMaxY();
-        }
-      }
-
-      map.put(GraphConstants.BOUNDS, new AttributeMap.SerializableRectangle2D(
-          top_x - 5, top_y - 20, bottom_x - top_x + 10, bottom_y - top_y + 25));
-      map.put(GraphConstants.FOREGROUND, Color.black);
-      if (modelGraph.getModel().isRef()) {
-        map.put(GraphConstants.BACKGROUND, Color.lightGray);
-      } else {
-        map.put(GraphConstants.BACKGROUND, Color.white);
-      }
-      if (modelGraph.isExcused()) {
-        map.put(GraphConstants.GRADIENTCOLOR, Color.gray);
-      }
-      map.put(GraphConstants.HORIZONTAL_ALIGNMENT, SwingConstants.LEFT);
-      map.put(GraphConstants.VERTICAL_ALIGNMENT, SwingConstants.TOP);
-      map.put(GraphConstants.BORDER, new LineBorder(modelGraph.getModel()
-          .getColor(), 1));
-      jgraph.getGraphLayoutCache().toBack(new Object[] { modelCell });
-      nested.put(modelCell, map);
-      return modelCell;
-    }
-    DefaultGraphCell cell = this.m_jgAdapter.getVertexCell(modelGraph
-        .getModel());
-    ((Map<Object, Object>) nested.get(cell)).put(GraphConstants.FOREGROUND,
-        Color.black);
-    if (modelGraph.isExcused()) {
-      ((Map<Object, Object>) nested.get(cell)).put(
-          GraphConstants.GRADIENTCOLOR, Color.gray);
-    } else {
-      ((Map<Object, Object>) nested.get(cell)).put(
-          GraphConstants.GRADIENTCOLOR, Color.white);
-    }
-    if (!((ModelNode) ((DefaultGraphCell) cell).getUserObject()).isRef()) {
-      ((Map<Object, Object>) nested.get(cell)).put(GraphConstants.BACKGROUND,
-          modelGraph.getModel().getColor());
-    } else {
-      ((Map<Object, Object>) nested.get(cell)).put(GraphConstants.BACKGROUND,
-          Color.lightGray);
-    }
-    return cell;
-  }
-  
-  private void removeAllEdges(ObservableGraph<ModelNode, IdentifiableEdge> graph){
-    List<IdentifiableEdge> edges = new Vector<IdentifiableEdge>();
-    
-    for(IdentifiableEdge edge: graph.getEdges()){
-       edges.add(edge);
-     }
-    
-    for(IdentifiableEdge edge: edges){
-       graph.removeEdge(edge);
-    }
-  }
-  
-
-  private class Pair {
-    String first, second;
-
-    public Pair(String first, String second) {
-      this.first = first;
-      this.second = second;
-    }
-
-    public String getFirst() {
-      return this.first;
-    }
-
-    public String getSecond() {
-      return this.second;
-    }
-  }
-
-  public class MyGraphListener implements MouseListener, ActionListener {
-
-    private Point curPoint;
-    private ViewState state;
-
-    public MyGraphListener(ViewState state) {
-      this.state = state;
-    }
-
-    public void mouseClicked(MouseEvent e) {
-      curPoint = e.getPoint();
-      if (e.getButton() == MouseEvent.BUTTON3) {
-        Object mouseOverCell = GraphView.this.jgraph.getFirstCellForLocation(
-            e.getX(), e.getY());
-        ModelGraph mouseOverGraph;
-        if (mouseOverCell != null) {
-          mouseOverGraph = (GuiUtils.find(state.getGraphs(),
-              ((ModelNode) ((DefaultMutableTreeNode) mouseOverCell)
-                  .getUserObject()).getId()));
-          if (mouseOverGraph != null) {
-            if (GuiUtils.isDummyNode(mouseOverGraph.getModel())) {
-              mouseOverGraph = mouseOverGraph.getParent();
-            } else {
-              while (mouseOverGraph != null
-                  && mouseOverGraph.getParent() != null
-                  && mouseOverGraph.getParent().getModel().isRef()) {
-                mouseOverGraph = mouseOverGraph.getParent();
-              }
-            }
-            if (mouseOverGraph != null) {
-              mouseOverCell = GraphView.this.m_jgAdapter
-                  .getVertexCell(mouseOverGraph.getModel());
-            }
-          }
-          state.setSelected(mouseOverGraph);
-        } else {
-          state.setSelected(null);
-        }
-        PopupMenu actionsMenu = createActionMenu(state);
-        GraphView.this.notifyListeners();
-        GraphView.this.jgraph.add(actionsMenu);
-        actionsMenu.show(GraphView.this.jgraph, e.getPoint().x, e.getPoint().y);
-      } else if (e.getButton() == MouseEvent.BUTTON1) {
-        if (state.getMode() == View.Mode.ZOOM_IN) {
-          state.setProperty(SCALE, Double.toString(Double.parseDouble(state
-              .getFirstPropertyValue(SCALE)) + 0.1));
-          state.setSelected(null);
-          GraphView.this.notifyListeners();
-        } else if (state.getMode() == View.Mode.ZOOM_OUT) {
-          state.setProperty(SCALE, Double.toString(Double.parseDouble(state
-              .getFirstPropertyValue(SCALE)) - 0.1));
-          state.setSelected(null);
-          GraphView.this.notifyListeners();
-        } else if (state.getMode() == View.Mode.EDIT) {
-          Object cell = GraphView.this.jgraph.getFirstCellForLocation(e.getX(),
-              e.getY());
-          if (cell != null) {
-            if (cell instanceof DefaultEdge) {
-            } else if (cell instanceof DefaultGraphCell) {
-              ModelGraph graph = GuiUtils.find(state.getGraphs(),
-                  ((ModelNode) ((DefaultGraphCell) cell).getUserObject())
-                      .getId());
-              if (graph.getModel().isRef()) {
-                while (graph.getParent() != null
-                       && graph.getParent().getModel().isRef()) {
-                  graph = graph.getParent();
-                }
-              }
-              if (GuiUtils.isDummyNode(graph.getModel())) {
-                graph = graph.getParent();
-              }
-              state.setSelected(graph);
-              GraphView.this.notifyListeners();
-            }
-          } else if (cell == null && state.getSelected() != null) {
-            state.setSelected(null);
-            GraphView.this.notifyListeners();
-          }
-        } else if (state.getMode() == View.Mode.DELETE
-            && e.getClickCount() == 2) {
-          Object cell = GraphView.this.jgraph.getFirstCellForLocation(e.getX(),
-              e.getY());
-          if (cell != null) {
-            if (cell instanceof DefaultEdge) {
-              // do nothing
-            } else if (cell instanceof DefaultGraphCell) {
-              ModelGraph graph = GuiUtils.removeNode(state.getGraphs(),
-                  (ModelNode) ((DefaultGraphCell) cell).getUserObject());
-              GraphView.this.notifyListeners();
-            }
-          }
-        }
-      }
-    }
-
-    public void mouseEntered(MouseEvent e) {
-      if (state.getMode() == View.Mode.ZOOM_IN
-          || state.getMode() == View.Mode.ZOOM_OUT) {
-        Toolkit toolkit = Toolkit.getDefaultToolkit();
-        try {
-          GraphView.this.jgraph.setCursor(toolkit.createCustomCursor(
-              IconLoader.getIcon(IconLoader.ZOOM_CURSOR), new Point(0, 0),
-              "img"));
-        } catch (Exception e1) {
-          e1.printStackTrace();
-        }
-      } else if (state.getMode() == Mode.MOVE) {
-        GraphView.this.jgraph.setCursor(new Cursor(Cursor.HAND_CURSOR));
-      } else {
-        GraphView.this.jgraph.setCursor(new Cursor(Cursor.DEFAULT_CURSOR));
-      }
-    }
-
-    public void mouseExited(MouseEvent e) {
-    }
-
-    public void mousePressed(MouseEvent e) {
-    }
-
-    public void mouseReleased(MouseEvent e) {
-    }
-
-    public void actionPerformed(ActionEvent e) {
-      this.createNewGraph(e.getActionCommand());
-    }
-
-    private void createNewGraph(String actionCommand) {
-      ModelGraph newGraph;
-      if (actionCommand.equals(NEW_TASK_ITEM_NAME)) {
-        newGraph = new ModelGraph(new ModelNode(state.getFile(),
-            GuiUtils.createUniqueName()));
-      } else if (actionCommand.equals(NEW_PARALLEL_ITEM_NAME)) {
-        ModelNode node = new ModelNode(state.getFile(),
-            GuiUtils.createUniqueName());
-        node.setExecutionType("parallel");
-        newGraph = new ModelGraph(node);
-      } else if (actionCommand.equals(NEW_SEQUENTIAL_ITEM_NAME)) {
-        ModelNode node = new ModelNode(state.getFile(),
-            GuiUtils.createUniqueName());
-        node.setExecutionType("sequential");
-        newGraph = new ModelGraph(node);
-      } else {
-        return;
-      }
-      Object cell = GraphView.this.jgraph.getSelectionCell();
-      if (cell != null) {
-        if (cell instanceof DefaultGraphCell) {
-          ModelGraph graph = GuiUtils.find(state.getGraphs(),
-              ((ModelNode) ((DefaultGraphCell) cell).getUserObject()).getId());
-          if (graph != null) {
-            graph.addChild(newGraph);
-          }
-        }
-      } else {
-        state.addGraph(newGraph);
-        GraphView.this.setShift(state, newGraph, curPoint);
-      }
-      GraphView.this.notifyListeners();
-    }
-
-  }
-
-  public void setShift(ViewState state, ModelGraph modelGraph, Point point) {
-    state.setProperty(modelGraph.getModel().getId() + "/Shift/x",
-        Integer.toString(point.x));
-    state.setProperty(modelGraph.getModel().getId() + "/Shift/y",
-        Integer.toString(point.y));
-  }
-
-  public void removeShift(ViewState state, ModelGraph modelGraph) {
-    state.removeProperty(modelGraph.getModel().getId() + "/Shift");
-  }
-
-  public Point getShift(ViewState state, DefaultGraphCell cell, Map nested) {
-    ModelGraph graph;
-    if (cell instanceof DefaultEdge) {
-      IdentifiableEdge edge = (IdentifiableEdge) cell.getUserObject();
-      Pair pair = GraphView.this.edgeMap.get(edge.id);
-      graph = GuiUtils.find(state.getGraphs(), pair.getFirst());
-    } else {
-      graph = GuiUtils.find(state.getGraphs(),
-          ((ModelNode) cell.getUserObject()).getId());
-    }
-    ModelGraph parent = GuiUtils.findRoot(state.getGraphs(), graph);
-    Point shiftPoint = null;
-    if (state.containsProperty(parent.getModel().getId() + "/Shift")) {
-      shiftPoint = new Point(Integer.parseInt(state
-          .getFirstPropertyValue(parent.getModel().getId() + "/Shift/x")),
-          Integer.parseInt(state.getFirstPropertyValue(parent.getModel()
-                                                             .getId() + "/Shift/y")));
-    }
-    if (shiftPoint == null) {
-      shiftPoint = new Point(100, 100);
-      this.setShift(state, parent, shiftPoint);
-      return shiftPoint;
-    } else {
-      Rectangle2D bounds = (Rectangle2D) ((Map<Object, Object>) nested
-          .get(GraphView.this.m_jgAdapter.getVertexCell(parent.getModel())))
-          .get(GraphConstants.BOUNDS);
-      return new Point(shiftPoint.x - (int) bounds.getX(), shiftPoint.y
-          - (int) bounds.getY());
-    }
-  }
-
-
-  private PopupMenu createActionMenu(final ViewState state) {
-    PopupMenu actionsMenu = new PopupMenu(ACTIONS_POP_MENU_NAME);
-    PopupMenu newSubMenu = new PopupMenu(NEW_SUB_POP_MENU_NAME);
-    MenuItem taskItem = new MenuItem(NEW_TASK_ITEM_NAME);
-    MenuItem condItem = new MenuItem(NEW_CONDITION_ITEM_NAME);
-    newSubMenu.add(taskItem);
-    newSubMenu.add(condItem);
-    newSubMenu.add(new MenuItem(NEW_PARALLEL_ITEM_NAME));
-    newSubMenu.add(new MenuItem(NEW_SEQUENTIAL_ITEM_NAME));
-    newSubMenu.addActionListener(this.myGraphListener);
-    actionsMenu.add(newSubMenu);
-    MenuItem viewReferrencedWorkflow = new MenuItem(VIEW_REF_WORKFLOW);
-    actionsMenu.add(viewReferrencedWorkflow);
-    MenuItem deleteItem = new MenuItem(DELETE_ITEM_NAME);
-    actionsMenu.add(deleteItem);
-    MenuItem formatItem = new MenuItem(FORMAT_ITEM_NAME);
-    actionsMenu.add(formatItem);
-
-    PopupMenu orderSubMenu = new PopupMenu(ORDER_SUB_POP_MENU_NAME);
-
-    ModelGraph modelGraph = state.getSelected();
-    newSubMenu.setEnabled(modelGraph == null
-        || modelGraph.getModel().isParentType());
-    deleteItem.setEnabled(modelGraph != null);
-    formatItem.setEnabled(true);
-    if (modelGraph != null) {
-      viewReferrencedWorkflow.setEnabled(modelGraph.getModel().isRef());
-      taskItem.setEnabled(!modelGraph.isCondition());
-      condItem.setEnabled(modelGraph.isCondition());
-      orderSubMenu.setEnabled(modelGraph.getParent() != null
-          && !(modelGraph.isCondition() && !modelGraph.getParent()
-              .isCondition()));
-    } else {
-      boolean isCondition = false;
-      if (state.getGraphs().size() > 0) {
-        isCondition = state.getGraphs().get(0).isCondition();
-      }
-      viewReferrencedWorkflow.setEnabled(false);
-      taskItem.setEnabled(!isCondition);
-      condItem.setEnabled(isCondition);
-    }
-
-    actionsMenu.addActionListener(new ActionListener() {
-      public void actionPerformed(ActionEvent e) {
-        if (e.getActionCommand().equals(DELETE_ITEM_NAME)) {
-          GuiUtils.removeNode(state.getGraphs(), state.getSelected().getModel());
-          state.setSelected(null);
-          GraphView.this.notifyListeners();
-        } else if (e.getActionCommand().equals(FORMAT_ITEM_NAME)) {
-          GraphView.this.refreshView(state);
-        } else if (e.getActionCommand().equals(VIEW_REF_WORKFLOW)) {
-          scrollSelectedToVisible = true;
-          GraphView.this.notifyListeners(new ViewChange.VIEW_MODEL(state
-              .getSelected().getModel().getModelId(), GraphView.this));
-        }
-      }
-    });
-    PopupMenu edgesSubMenu = new PopupMenu(EDGES_SUB_POP_MENU_NAME);
-    edgesSubMenu.add(new MenuItem(TASK_LEVEL));
-    edgesSubMenu.add(new MenuItem(WORKFLOW_LEVEL));
-    actionsMenu.add(edgesSubMenu);
-    edgesSubMenu.addActionListener(new ActionListener() {
-
-      public void actionPerformed(ActionEvent e) {
-        if (e.getActionCommand().equals(TASK_LEVEL)) {
-          state.setProperty(EDGE_DISPLAY_MODE, TASK_MODE);
-        } else if (e.getActionCommand().equals(WORKFLOW_LEVEL)) {
-          state.setProperty(EDGE_DISPLAY_MODE, WORKFLOW_MODE);
-        }
-        GraphView.this.refreshView(state);
-      }
-
-    });
-    actionsMenu.add(orderSubMenu);
-    orderSubMenu.add(new MenuItem(TO_FRONT_ITEM_NAME));
-    orderSubMenu.add(new MenuItem(TO_BACK_ITEM_NAME));
-    orderSubMenu.add(new MenuItem(FORWARD_ITEM_NAME));
-    orderSubMenu.add(new MenuItem(BACKWARDS_ITEM_NAME));
-    orderSubMenu.addActionListener(new ActionListener() {
-
-      public void actionPerformed(ActionEvent e) {
-        ModelGraph graph = state.getSelected();
-        ModelGraph parent = graph.getParent();
-        if (e.getActionCommand().equals(TO_FRONT_ITEM_NAME)) {
-          if (parent.getChildren().remove(graph)) {
-            parent.getChildren().add(0, graph);
-          }
-        } else if (e.getActionCommand().equals(TO_BACK_ITEM_NAME)) {
-          if (parent.getChildren().remove(graph)) {
-            parent.getChildren().add(graph);
-          }
-        } else if (e.getActionCommand().equals(FORWARD_ITEM_NAME)) {
-          int index = parent.getChildren().indexOf(graph);
-          if (index != -1) {
-            parent.getChildren().remove(index);
-            parent.getChildren().add(
-                Math.min(parent.getChildren().size(), index + 1), graph);
-          }
-        } else if (e.getActionCommand().equals(BACKWARDS_ITEM_NAME)) {
-          int index = parent.getChildren().indexOf(graph);
-          if (index != -1) {
-            parent.getChildren().remove(index);
-            parent.getChildren().add(Math.max(0, index - 1), graph);
-          }
-        }
-        GraphView.this.notifyListeners();
-      }
-
-    });
-    return actionsMenu;
-  }
-
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/app/weditor/src/main/java/org/apache/oodt/cas/workflow/gui/perspective/view/impl/IdentifiableEdge.java
----------------------------------------------------------------------
diff --git a/app/weditor/src/main/java/org/apache/oodt/cas/workflow/gui/perspective/view/impl/IdentifiableEdge.java b/app/weditor/src/main/java/org/apache/oodt/cas/workflow/gui/perspective/view/impl/IdentifiableEdge.java
deleted file mode 100644
index c14175b..0000000
--- a/app/weditor/src/main/java/org/apache/oodt/cas/workflow/gui/perspective/view/impl/IdentifiableEdge.java
+++ /dev/null
@@ -1,92 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.oodt.cas.workflow.gui.perspective.view.impl;
-
-//JDK imports
-import java.util.UUID;
-
-import org.apache.oodt.cas.workflow.gui.model.ModelNode;
-
-/**
- * 
- * An ID'ed edge identified by {@link UUID#randomUUID()}.
- * 
- * @author bfoster
- * @author mattmann
- * 
- */
-public class IdentifiableEdge {
-
-  String id;
-  
-  ModelNode from;
-  
-  ModelNode to;
-
-  public IdentifiableEdge(ModelNode from, ModelNode to) {
-    id = UUID.randomUUID().toString();
-    this.from = from;
-    this.to = to;
-  }
-
-  public String toString() {
-    return "";
-  }
-
-  /**
-   * @return the id
-   */
-  public String getId() {
-    return id;
-  }
-
-  /**
-   * @param id the id to set
-   */
-  public void setId(String id) {
-    this.id = id;
-  }
-
-  /**
-   * @return the from
-   */
-  public ModelNode getFrom() {
-    return from;
-  }
-
-  /**
-   * @param from the from to set
-   */
-  public void setFrom(ModelNode from) {
-    this.from = from;
-  }
-
-  /**
-   * @return the to
-   */
-  public ModelNode getTo() {
-    return to;
-  }
-
-  /**
-   * @param to the to to set
-   */
-  public void setTo(ModelNode to) {
-    this.to = to;
-  }
-}

http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/app/weditor/src/main/java/org/apache/oodt/cas/workflow/gui/perspective/view/impl/JungJGraphModelAdapter.java
----------------------------------------------------------------------
diff --git a/app/weditor/src/main/java/org/apache/oodt/cas/workflow/gui/perspective/view/impl/JungJGraphModelAdapter.java b/app/weditor/src/main/java/org/apache/oodt/cas/workflow/gui/perspective/view/impl/JungJGraphModelAdapter.java
deleted file mode 100644
index 71a6cf5..0000000
--- a/app/weditor/src/main/java/org/apache/oodt/cas/workflow/gui/perspective/view/impl/JungJGraphModelAdapter.java
+++ /dev/null
@@ -1,246 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.oodt.cas.workflow.gui.perspective.view.impl;
-
-//JDK imports
-import java.awt.Color;
-import java.awt.Font;
-import java.awt.geom.Rectangle2D;
-import java.util.concurrent.ConcurrentHashMap;
-import java.util.Map;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-import javax.swing.BorderFactory;
-
-//OODT imports
-import org.apache.oodt.cas.workflow.gui.model.ModelNode;
-
-//JGraph imports
-import org.jgraph.event.GraphModelEvent;
-import org.jgraph.event.GraphModelListener;
-import org.jgraph.graph.AttributeMap;
-import org.jgraph.graph.ConnectionSet;
-import org.jgraph.graph.DefaultEdge;
-import org.jgraph.graph.DefaultGraphCell;
-import org.jgraph.graph.DefaultGraphModel;
-import org.jgraph.graph.DefaultPort;
-import org.jgraph.graph.GraphConstants;
-
-//Jung imports
-import edu.uci.ics.jung.graph.ObservableGraph;
-import edu.uci.ics.jung.graph.event.GraphEvent;
-import edu.uci.ics.jung.graph.event.GraphEventListener;
-
-/**
- * 
- * This class integrates OODT, Jung and JGraph.
- * 
- * Not necessarily in that order. It acts as a facade, wrapping a Jung graph
- * (and its modifications) and then using that to update the current state of
- * the associated JGraph model.
- * 
- * @author mattmann
- * 
- */
-public class JungJGraphModelAdapter extends DefaultGraphModel {
-
-  private static final long serialVersionUID = 205647349848965651L;
-
-  private ObservableGraph<ModelNode, IdentifiableEdge> jungGraph;
-
-  private Map<String, DefaultGraphCell> cellMap;
-
-  private static final Logger LOG = Logger
-      .getLogger(JungJGraphModelAdapter.class.getName());
-
-  public JungJGraphModelAdapter(
-      final ObservableGraph<ModelNode, IdentifiableEdge> jungGraph) {
-    this.jungGraph = jungGraph;
-    this.jungGraph.addGraphEventListener(new WorkflowChangeListener(this));
-    this.cellMap = new ConcurrentHashMap<String, DefaultGraphCell>();
-    this.addGraphModelListener(new GraphModelListener() {
-
-      @Override
-      public void graphChanged(GraphModelEvent e) {
-        Object[] added = e.getChange().getInserted();
-        Object[] removed = e.getChange().getRemoved();
-        Object[] changed = e.getChange().getChanged();
-
-        if (added != null && added.length > 0) {
-          for (Object a : added) {
-            LOG.log(Level.FINE, "Jgraph notification of object added: ["
-                + a.getClass().getName() + "]");
-
-            if (a instanceof org.jgraph.graph.DefaultEdge) {
-              LOG.log(Level.FINE, "Edge added to jgraph");
-              org.jgraph.graph.DefaultEdge edge = (org.jgraph.graph.DefaultEdge) a;
-              if (!jungGraph.getEdges().contains(edge.getUserObject())) {
-                jungGraph.addEdge(
-                    new IdentifiableEdge((ModelNode) edge.getSource(),
-                        (ModelNode) edge.getTarget()), (ModelNode) edge
-                        .getSource(), (ModelNode) edge.getTarget());
-              }
-            } else if (a instanceof org.jgraph.graph.DefaultGraphCell) {
-              LOG.log(Level.FINE, "Vertex added to jgraph");
-              org.jgraph.graph.DefaultGraphCell cell = (org.jgraph.graph.DefaultGraphCell) a;
-
-              if (!jungGraph.getVertices().contains(cell.getUserObject())) {
-                jungGraph.addVertex((ModelNode) cell.getUserObject());
-              }
-            }
-          }
-        }
-
-        if (removed != null && removed.length > 0) {
-          for (Object r : removed) {
-            LOG.log(Level.FINE, "Jgraph notification of object removed: ["
-                + r.getClass().getName() + "]");
-
-            if (r instanceof org.jgraph.graph.DefaultEdge) {
-              LOG.log(Level.FINE, "Edge removed from jgraph");
-              org.jgraph.graph.DefaultEdge edge = (org.jgraph.graph.DefaultEdge) r;
-              if (jungGraph.getEdges().contains(edge.getUserObject())) {
-                jungGraph.removeEdge((IdentifiableEdge) edge.getUserObject());
-              }
-            } else if (r instanceof org.jgraph.graph.DefaultGraphCell) {
-              LOG.log(Level.FINE, "Vertex removed from jgraph");
-              org.jgraph.graph.DefaultGraphCell cell = (org.jgraph.graph.DefaultGraphCell) r;
-
-              if (jungGraph.getVertices().contains(cell.getUserObject())) {
-                jungGraph.removeVertex((ModelNode) cell.getUserObject());
-              }
-            }
-          }
-        }
-
-      }
-    });
-
-  }
-
-  public DefaultGraphCell getVertexCell(ModelNode node) {
-    if (cellMap.get(node.getId()) != null) {
-      return cellMap.get(node.getId());
-    }
-
-    DefaultGraphCell cell = new DefaultGraphCell(node);
-    cell.add(new DefaultPort());
-    return cell;
-  }
-
-  private AttributeMap getEdgeAttributes(DefaultEdge edge) {
-    AttributeMap eMap = new AttributeMap();
-    GraphConstants.setLineEnd(eMap, GraphConstants.ARROW_TECHNICAL);
-    GraphConstants.setEndFill(eMap, true);
-    GraphConstants.setEndSize(eMap, 10);
-    GraphConstants.setForeground(eMap, Color.decode("#25507C"));
-    GraphConstants.setFont(eMap,
-        GraphConstants.DEFAULTFONT.deriveFont(Font.BOLD, 12));
-    GraphConstants.setLineColor(eMap, Color.decode("#7AA1E6"));
-    AttributeMap map = new AttributeMap();
-    map.put(edge, eMap);
-    return map;
-  }
-
-  private AttributeMap getVertexAttributes(DefaultGraphCell cell) {
-    AttributeMap vMap = new AttributeMap();
-
-    Color c = Color.decode("#FF9900");
-    GraphConstants.setBounds(vMap, new Rectangle2D.Double(50, 50, 90, 30));
-    GraphConstants.setBorder(vMap, BorderFactory.createRaisedBevelBorder());
-    GraphConstants.setBackground(vMap, c);
-    GraphConstants.setForeground(vMap, Color.white);
-    GraphConstants.setFont(vMap,
-        GraphConstants.DEFAULTFONT.deriveFont(Font.BOLD, 12));
-    GraphConstants.setOpaque(vMap, true);
-
-    AttributeMap map = new AttributeMap();
-    map.put(cell, vMap);
-    return map;
-  }
-
-  private class WorkflowChangeListener implements
-      GraphEventListener<ModelNode, IdentifiableEdge> {
-
-    private JungJGraphModelAdapter adapter;
-
-    public WorkflowChangeListener(JungJGraphModelAdapter adapter) {
-      this.adapter = adapter;
-
-    }
-
-    /*
-     * (non-Javadoc)
-     * 
-     * @see
-     * edu.uci.ics.jung.graph.event.GraphEventListener#handleGraphEvent(edu.
-     * uci.ics.jung.graph.event.GraphEvent)
-     */
-    @Override
-    public void handleGraphEvent(GraphEvent<ModelNode, IdentifiableEdge> e) {
-      if (e.getType().equals(GraphEvent.Type.EDGE_ADDED)) {
-        LOG.log(Level.FINE, "EDGE ADDED!");
-        GraphEvent.Edge<ModelNode, IdentifiableEdge> event = (GraphEvent.Edge<ModelNode, IdentifiableEdge>) e;
-        addJGraphEdge(event.getEdge());
-      } else if (e.getType().equals(GraphEvent.Type.EDGE_REMOVED)) {
-        LOG.log(Level.FINE, "EDGE REMOVED!");
-      } else if (e.getType().equals(GraphEvent.Type.VERTEX_ADDED)) {
-        LOG.log(Level.FINE, "VERTEX ADDED!");
-        GraphEvent.Vertex<ModelNode, IdentifiableEdge> event = (GraphEvent.Vertex<ModelNode, IdentifiableEdge>) e;
-        addJGraphVertex(event.getVertex());
-      } else if (e.getType().equals(GraphEvent.Type.VERTEX_REMOVED)) {
-        LOG.log(Level.FINE, "VERTEX REMOVED!");
-      }
-
-    }
-
-  }
-
-  private void addJGraphVertex(ModelNode node) {
-    DefaultGraphCell cell = new DefaultGraphCell(node);
-    cell.add(new DefaultPort());
-    insert(new Object[] { cell }, getVertexAttributes(cell), null, null, null);
-    cellMap.put(node.getId(), cell);
-  }
-
-  private void addJGraphEdge(IdentifiableEdge e) {
-    ConnectionSet set = new ConnectionSet();
-    DefaultEdge theEdge = new DefaultEdge(e);
-    DefaultGraphCell from;
-    DefaultGraphCell to;
-    String fromVertexId = e.getFrom().getId();
-    String toVertexId = e.getTo().getId();
-    if (!cellMap.containsKey(fromVertexId)) {
-      addJGraphVertex(e.getFrom());
-    }
-    from = cellMap.get(fromVertexId);
-
-    if (!cellMap.containsKey(toVertexId)) {
-      addJGraphVertex(e.getTo());
-    }
-
-    to = cellMap.get(toVertexId);
-
-    set.connect(theEdge, (DefaultPort) from.getChildAt(0),
-        (DefaultPort) to.getChildAt(0));
-    insert(new Object[] { theEdge }, getEdgeAttributes(theEdge), set, null,
-        null);
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/app/weditor/src/main/java/org/apache/oodt/cas/workflow/gui/perspective/view/impl/TreeProjectView.java
----------------------------------------------------------------------
diff --git a/app/weditor/src/main/java/org/apache/oodt/cas/workflow/gui/perspective/view/impl/TreeProjectView.java b/app/weditor/src/main/java/org/apache/oodt/cas/workflow/gui/perspective/view/impl/TreeProjectView.java
deleted file mode 100644
index 3f7bd5f..0000000
--- a/app/weditor/src/main/java/org/apache/oodt/cas/workflow/gui/perspective/view/impl/TreeProjectView.java
+++ /dev/null
@@ -1,155 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.oodt.cas.workflow.gui.perspective.view.impl;
-
-//JDK imports
-import java.awt.BorderLayout;
-import java.awt.event.MouseEvent;
-import java.awt.event.MouseListener;
-import java.util.List;
-import javax.swing.JLabel;
-import javax.swing.JScrollPane;
-import javax.swing.JTree;
-import javax.swing.border.EtchedBorder;
-import javax.swing.event.TreeModelEvent;
-import javax.swing.event.TreeModelListener;
-import javax.swing.tree.DefaultMutableTreeNode;
-import javax.swing.tree.TreePath;
-
-//OODT imports
-import org.apache.oodt.cas.workflow.gui.perspective.view.MultiStateView;
-import org.apache.oodt.cas.workflow.gui.perspective.view.ViewChange;
-import org.apache.oodt.cas.workflow.gui.perspective.view.ViewState;
-
-/**
- * 
- * 
- * Shows the files/workflows associated with a project in the Workflow Editor
- * GUI.
- * 
- * @author bfoster
- * @author mattmann
- * 
- */
-public class TreeProjectView extends MultiStateView {
-
-  private static final long serialVersionUID = 1867428699533484861L;
-
-  private JTree tree;
-
-  private ViewState selectedState;
-
-  public TreeProjectView(String name) {
-    super(name);
-    this.setLayout(new BorderLayout());
-  }
-
-  @Override
-  public void refreshView(final ViewState activeState,
-      final List<ViewState> states) {
-    this.removeAll();
-    this.selectedState = activeState;
-    DefaultMutableTreeNode selected = null;
-    DefaultMutableTreeNode root = new DefaultMutableTreeNode("Projects");
-    for (ViewState state : states) {
-      if (selectedState != null
-          && state.getFile().equals(selectedState.getFile())) {
-        root.add(selected = new DefaultMutableTreeNode(state.getFile()
-                                                            .getName()));
-      } else {
-        root.add(new DefaultMutableTreeNode(state.getFile().getName()));
-      }
-    }
-
-    tree = new JTree(root);
-    tree.setEditable(true);
-    tree.getModel().addTreeModelListener(new TreeModelListener() {
-
-      public void treeNodesChanged(TreeModelEvent e) {
-        //TODO: something with the view nodes here
-      }
-
-      public void treeNodesInserted(TreeModelEvent e) {
-      }
-
-      public void treeNodesRemoved(TreeModelEvent e) {
-      }
-
-      public void treeStructureChanged(TreeModelEvent e) {
-      }
-
-    });
-    tree.addMouseListener(new MouseListener() {
-
-      public void mouseClicked(MouseEvent e) {
-        if (e.getButton() == MouseEvent.BUTTON1) {
-          if (tree.getSelectionPath() != null) {
-            DefaultMutableTreeNode selectedComp = (DefaultMutableTreeNode) tree
-                .getSelectionPath().getLastPathComponent();
-            String stateName = (String) ((DefaultMutableTreeNode) selectedComp)
-                .getUserObject();
-            for (ViewState state : states) {
-              if (state.getFile().getName().equals(stateName)) {
-                selectedState = state;
-                if (e.getClickCount() == 2) {
-                  TreeProjectView.this
-                      .notifyListeners(new ViewChange.NEW_ACTIVE_STATE(
-                          selectedState, TreeProjectView.this));
-                }
-                break;
-              }
-            }
-          }
-        }
-      }
-
-      public void mouseEntered(MouseEvent e) {
-      }
-
-      public void mouseExited(MouseEvent e) {
-      }
-
-      public void mousePressed(MouseEvent e) {
-      }
-
-      public void mouseReleased(MouseEvent e) {
-      }
-
-    });
-    if (selected != null) {
-      tree.setSelectionPath(new TreePath(new DefaultMutableTreeNode[] { root,
-          selected }));
-    } else if (states.size() > 0) {
-      tree.setSelectionPath(new TreePath(new DefaultMutableTreeNode[] { root,
-          (DefaultMutableTreeNode) root.getChildAt(0) }));
-    }
-
-    tree.setRootVisible(false);
-    this.setBorder(new EtchedBorder());
-    JLabel panelName = new JLabel("Workspace Explorer");
-    panelName.setBorder(new EtchedBorder());
-    this.add(panelName, BorderLayout.NORTH);
-    JScrollPane scrollPane = new JScrollPane(tree,
-        JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,
-        JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);
-    this.add(scrollPane, BorderLayout.CENTER);
-
-    this.revalidate();
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/app/weditor/src/main/java/org/apache/oodt/cas/workflow/gui/toolbox/Tool.java
----------------------------------------------------------------------
diff --git a/app/weditor/src/main/java/org/apache/oodt/cas/workflow/gui/toolbox/Tool.java b/app/weditor/src/main/java/org/apache/oodt/cas/workflow/gui/toolbox/Tool.java
deleted file mode 100644
index 4e471bf..0000000
--- a/app/weditor/src/main/java/org/apache/oodt/cas/workflow/gui/toolbox/Tool.java
+++ /dev/null
@@ -1,125 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.oodt.cas.workflow.gui.toolbox;
-
-//JDK imports
-import java.awt.BorderLayout;
-import java.awt.Dimension;
-import java.awt.Image;
-import java.awt.event.MouseEvent;
-import java.awt.event.MouseListener;
-import javax.swing.ImageIcon;
-import javax.swing.JLabel;
-import javax.swing.JPanel;
-
-/**
- * 
- * 
- * One of the tool buttons at the top of the Workflow Editor GUI.
- * 
- * @author bfoster
- * @author mattmann
- * 
- */
-public abstract class Tool extends JPanel {
-
-  private static final long serialVersionUID = -373351385009724404L;
-
-  private Image image, selectedImage;
-  private boolean selected = false;
-  private ToolBox toolBox;
-
-  public Tool() {
-    this("?");
-  }
-
-  public Tool(String text) {
-    super();
-    this.setLayout(new BorderLayout());
-    this.add(new JLabel(text), BorderLayout.CENTER);
-    this.setup();
-  }
-
-  public Tool(Image image, Image selectedImage) {
-    super();
-    this.setLayout(new BorderLayout());
-    this.add(new JLabel(new ImageIcon(image)), BorderLayout.CENTER);
-    this.image = image;
-    this.selectedImage = selectedImage;
-    this.setup();
-  }
-
-  public void setToolBox(ToolBox toolBox) {
-    this.toolBox = toolBox;
-  }
-
-  public boolean isSelected() {
-    return this.selected;
-  }
-
-  public void setSelected(boolean selected) {
-    if (image != null) {
-      Tool.this.removeAll();
-      if (this.selected = selected) {
-        Tool.this.add(new JLabel(new ImageIcon(selectedImage)),
-            BorderLayout.CENTER);
-      } else {
-        Tool.this.add(new JLabel(new ImageIcon(image)), BorderLayout.CENTER);
-      }
-      Tool.this.revalidate();
-    }
-  }
-
-  private void setup() {
-    this.setPreferredSize(new Dimension(30, 30));
-    this.addMouseListener(new MouseListener() {
-
-      public void mouseClicked(MouseEvent e) {
-        Tool.this.onClick();
-        Tool.this.toolBox.setSelected(Tool.this);
-      }
-
-      public void mouseEntered(MouseEvent e) {
-        if (!selected && selectedImage != null) {
-          Tool.this.removeAll();
-          Tool.this.add(new JLabel(new ImageIcon(selectedImage)),
-              BorderLayout.CENTER);
-          Tool.this.revalidate();
-        }
-      }
-
-      public void mouseExited(MouseEvent e) {
-        if (!selected && image != null) {
-          Tool.this.removeAll();
-          Tool.this.add(new JLabel(new ImageIcon(image)), BorderLayout.CENTER);
-          Tool.this.revalidate();
-        }
-      }
-
-      public void mousePressed(MouseEvent e) {
-      }
-
-      public void mouseReleased(MouseEvent e) {
-      }
-
-    });
-  }
-
-  public abstract void onClick();
-
-}

http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/app/weditor/src/main/java/org/apache/oodt/cas/workflow/gui/toolbox/ToolBox.java
----------------------------------------------------------------------
diff --git a/app/weditor/src/main/java/org/apache/oodt/cas/workflow/gui/toolbox/ToolBox.java b/app/weditor/src/main/java/org/apache/oodt/cas/workflow/gui/toolbox/ToolBox.java
deleted file mode 100644
index 1f0d943..0000000
--- a/app/weditor/src/main/java/org/apache/oodt/cas/workflow/gui/toolbox/ToolBox.java
+++ /dev/null
@@ -1,76 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.oodt.cas.workflow.gui.toolbox;
-
-//JDK imports
-import java.awt.FlowLayout;
-import java.util.List;
-import javax.swing.JLabel;
-import javax.swing.JPanel;
-import javax.swing.border.EtchedBorder;
-
-/**
- * 
- * 
- * The box button and its panel that wrap the {@link Tool}.
- * 
- * @author bfoster
- * @author mattmann
- * 
- */
-public class ToolBox extends JPanel {
-
-  private static final long serialVersionUID = -2671454524968238519L;
-
-  private JPanel titlePanel;
-  private JPanel boxPanel;
-  private List<Tool> tools;
-  private Tool selectedTool;
-
-  public ToolBox(List<Tool> tools) {
-    super();
-    this.tools = tools;
-    this.titlePanel = new JPanel();
-    this.titlePanel.setBorder(new EtchedBorder());
-    this.titlePanel.add(new JLabel("Toolbox"));
-
-    this.boxPanel = new JPanel();
-    this.boxPanel.setBorder(new EtchedBorder());
-    this.boxPanel.setLayout(new FlowLayout(FlowLayout.LEADING));
-    for (Tool tool : tools) {
-      tool.setToolBox(this);
-      this.boxPanel.add(tool);
-    }
-    this.add(this.boxPanel);
-  }
-
-  public void setSelected(Tool selectedTool) {
-    this.selectedTool = selectedTool;
-    this.selectedTool.setSelected(true);
-    for (Tool tool : tools) {
-      if (!this.selectedTool.equals(tool)) {
-        tool.setSelected(false);
-      }
-    }
-  }
-
-  public Tool getSelected() {
-    return this.selectedTool;
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/app/weditor/src/main/java/org/apache/oodt/cas/workflow/gui/util/GuiUtils.java
----------------------------------------------------------------------
diff --git a/app/weditor/src/main/java/org/apache/oodt/cas/workflow/gui/util/GuiUtils.java b/app/weditor/src/main/java/org/apache/oodt/cas/workflow/gui/util/GuiUtils.java
deleted file mode 100644
index 2faffb3..0000000
--- a/app/weditor/src/main/java/org/apache/oodt/cas/workflow/gui/util/GuiUtils.java
+++ /dev/null
@@ -1,377 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.oodt.cas.workflow.gui.util;
-
-//OODT imports
-import org.apache.oodt.cas.workflow.gui.model.ModelGraph;
-import org.apache.oodt.cas.workflow.gui.model.ModelNode;
-import org.apache.oodt.cas.workflow.gui.perspective.view.ViewState;
-
-//JDK imports
-import java.io.File;
-import java.util.List;
-import java.util.Set;
-import java.util.Stack;
-import java.util.Vector;
-import java.util.concurrent.atomic.AtomicInteger;
-
-/**
- * 
- * 
- * Generic utility functions helpful for the Workflow Editor GUI.
- * 
- * @author bfoster
- * @author mattmann
- * 
- */
-public class GuiUtils {
-
-  protected static AtomicInteger untitledIter = new AtomicInteger(0);
-  protected static AtomicInteger dummyUntitledIter = new AtomicInteger(0);
-
-  public static boolean isSubGraph(ModelGraph graph, ModelGraph subGraph) {
-    if (graph.equals(subGraph)) {
-      return true;
-    }
-    for (ModelGraph child : graph.getChildren()) {
-      if (isSubGraph(child, subGraph)) {
-        return true;
-      }
-    }
-    if (graph.getPreConditions() != null) {
-      if (isSubGraph(graph.getPreConditions(), subGraph)) {
-        return true;
-      }
-    }
-    if (graph.getPostConditions() != null) {
-      if (isSubGraph(graph.getPostConditions(), subGraph)) {
-        return true;
-      }
-    }
-    return false;
-  }
-
-  public static void updateGraphModelId(ViewState state, String id,
-      String newModelId) {
-    ModelGraph graph = find(state.getGraphs(), id);
-    if (graph.getParent() != null
-        && graph.getParent().getModel().getExcusedSubProcessorIds()
-            .contains(graph.getModel().getModelId())) {
-      graph.getParent().getModel().getExcusedSubProcessorIds()
-          .remove(graph.getModel().getModelId());
-      graph.getParent().getModel().getExcusedSubProcessorIds().add(newModelId);
-    }
-    graph.getModel().setModelId(newModelId);
-  }
-
-  public static void addChild(List<ModelGraph> graphs, String parentId,
-      ModelGraph child) {
-    ModelGraph parent = find(graphs, parentId);
-    if (parent != null) {
-      parent.addChild(child);
-    }
-  }
-
-  public static List<ModelGraph> findRootGraphs(List<ModelGraph> graphs) {
-    List<ModelGraph> rootGraphs = new Vector<ModelGraph>();
-    for (ModelGraph graph : graphs) {
-      if (rootGraphs.size() == 0) {
-        rootGraphs.add(graph);
-      } else {
-        if (find(rootGraphs, graph.getModel().getModelId()) == null) {
-          rootGraphs.add(graph);
-        }
-      }
-    }
-    for (int i = 0; i < rootGraphs.size(); i++) {
-      ModelGraph rootGraph = rootGraphs.get(i);
-      for (int j = 0; j < rootGraphs.size(); j++) {
-        if (i != j
-            && rootGraphs.get(j).recursiveFind(
-                rootGraph.getModel().getModelId()) != null) {
-          rootGraphs.remove(i--);
-          break;
-        }
-      }
-
-    }
-    return rootGraphs;
-  }
-
-  public static ModelGraph findRoot(List<ModelGraph> rootGraphs,
-      ModelGraph graph) {
-    for (ModelGraph rootGraph : rootGraphs) {
-      if (graph.equals(rootGraph)) {
-        return rootGraph;
-      } else if (graph.getParent() != null) {
-        ModelGraph root = findRoot(rootGraphs, graph.getParent());
-        if (root != null) {
-          return root;
-        }
-      }
-    }
-    return null;
-  }
-
-  public static List<ModelGraph> find(List<ModelGraph> graphs, Set<String> ids) {
-    Vector<ModelGraph> foundGraphs = new Vector<ModelGraph>();
-    for (String id : ids) {
-      ModelGraph graph = find(graphs, id);
-      if (graph != null) {
-        foundGraphs.add(graph);
-      }
-    }
-    return foundGraphs;
-  }
-
-  public static ModelGraph find(List<ModelGraph> graphs, String id) {
-    for (ModelGraph graph : graphs) {
-      ModelGraph found = graph.recursiveFind(id);
-      if (found != null) {
-        return found;
-      }
-    }
-    return null;
-  }
-
-  public static ModelGraph removeNode(List<ModelGraph> graphs, ModelNode node) {
-    for (int i = 0; i < graphs.size(); i++) {
-      if (graphs.get(i).getModel().equals(node)) {
-        return graphs.remove(i);
-      } else {
-        ModelGraph graph = removeNode(graphs.get(i), node);
-        if (graph != null) {
-          return graph;
-        }
-      }
-    }
-    return null;
-  }
-
-  public static ModelGraph removeNode(ModelGraph graph, ModelNode node) {
-    Stack<ModelGraph> stack = new Stack<ModelGraph>();
-    stack.add(graph);
-    while (!stack.empty()) {
-      ModelGraph curGraph = stack.pop();
-      if (curGraph.getModel().equals(node)) {
-        curGraph.setParent(null);
-        return curGraph;
-      } else {
-        stack.addAll(curGraph.getChildren());
-        if (curGraph.getPreConditions() != null) {
-          stack.add(curGraph.getPreConditions());
-        }
-        if (curGraph.getPostConditions() != null) {
-          stack.add(curGraph.getPostConditions());
-        }
-      }
-    }
-    return null;
-  }
-
-  public static List<Line> findSequentialLines(List<ModelGraph> graphs) {
-    Vector<Line> lines = new Vector<Line>();
-    for (ModelGraph graph : graphs) {
-      lines.addAll(findSequentialLines(graph));
-    }
-    return lines;
-  }
-
-  public static List<Line> findSequentialLines(final ModelGraph graph) {
-    Vector<Line> lines = new Vector<Line>();
-    if (graph.getChildren().size() > 0) {
-      Stack<ModelGraph> stack = new Stack<ModelGraph>();
-      stack.add(graph);
-      while (!stack.empty()) {
-        ModelGraph curGraph = stack.pop();
-        if (curGraph.getModel().getExecutionType().equals("sequential")) {
-          for (int i = 0; i < curGraph.getChildren().size() - 1; i++) {
-            lines.add(new Line(curGraph.getChildren().get(i).getModel(),
-                curGraph.getChildren().get(i + 1).getModel()));
-          }
-        }
-        stack.addAll(curGraph.getChildren());
-      }
-    }
-    return lines;
-  }
-
-  public static List<Line> findLines(final List<ModelGraph> graphs) {
-    Vector<Line> lines = new Vector<Line>();
-    for (ModelGraph graph : graphs) {
-      lines.addAll(findLines(graph));
-    }
-    return lines;
-  }
-
-  public static List<Line> findLines(final ModelGraph graph) {
-    Vector<Line> lines = new Vector<Line>();
-    if (graph.getChildren().size() > 0) {
-      Stack<ModelGraph> graphs = new Stack<ModelGraph>();
-      graphs.add(graph);
-      while (!graphs.empty()) {
-        ModelGraph curGraph = graphs.pop();
-        if (curGraph.getModel().isParentType()) {
-
-          if (curGraph.getChildren().size() == 0) {
-            curGraph.addChild(new ModelGraph(createDummyNode()));
-          }
-
-          List<Line> relaventLines = getRelaventLines(lines, curGraph
-              .getModel().getId());
-          for (Line relaventLine : relaventLines) {
-            int index = lines.indexOf(relaventLine);
-            if (curGraph.getModel().getExecutionType().toLowerCase()
-                .equals("sequential")) {
-              lines.remove(index);
-              if (curGraph.getChildren().size() > 0) {
-                if (relaventLine.getFromModel().equals(curGraph.getModel())) {
-                  lines.add(new Line(curGraph.getChildren()
-                                             .get(curGraph.getChildren().size() - 1).getModel(),
-                      relaventLine.getToModel()));
-                } else {
-                  lines.add(new Line(relaventLine.getFromModel(), curGraph
-                      .getChildren().get(0).getModel()));
-                }
-              }
-            } else if (curGraph.getModel().getExecutionType().toLowerCase()
-                .equals("parallel")) {
-              lines.remove(index);
-              if (relaventLine.getFromModel().equals(curGraph.getModel())) {
-                for (ModelGraph child : curGraph.getChildren()) {
-                  lines.add(new Line(child.getModel(), relaventLine
-                      .getToModel()));
-                }
-              } else {
-                for (ModelGraph child : curGraph.getChildren()) {
-                  lines.add(new Line(relaventLine.getFromModel(), child
-                      .getModel()));
-                }
-              }
-            }
-          }
-
-          if (curGraph.getModel().getExecutionType().toLowerCase()
-              .equals("sequential")) {
-            for (int i = 0; i < curGraph.getChildren().size(); i++) {
-              if (i == curGraph.getChildren().size() - 1) {
-                lines.add(new Line(curGraph.getChildren().get(i).getModel(),
-                    null));
-              } else {
-                lines.add(new Line(curGraph.getChildren().get(i).getModel(),
-                    curGraph.getChildren().get(i + 1).getModel()));
-              }
-            }
-          } else if (curGraph.getModel().getExecutionType().toLowerCase()
-              .equals("parallel")) {
-            for (int i = 0; i < curGraph.getChildren().size(); i++) {
-              lines
-                  .add(new Line(curGraph.getChildren().get(i).getModel(), null));
-            }
-          }
-          graphs.addAll(curGraph.getChildren());
-        }
-      }
-    } else {
-      lines.add(new Line(graph.getModel(), null));
-    }
-    return lines;
-  }
-
-  public static boolean isDummyNode(ModelNode node) {
-    return node.getModelId().startsWith("DUMMY-");
-  }
-
-  public static ModelNode createDummyNode() {
-    ModelNode dummy = new ModelNode(null, "DUMMY-"
-        + dummyUntitledIter.getAndIncrement());
-    dummy.setTextVisible(false);
-    return dummy;
-  }
-
-  public static List<ModelGraph> getGraphsInFile(File file,
-      List<ModelGraph> graphs) {
-    List<ModelGraph> graphsInFile = new Vector<ModelGraph>();
-    for (ModelGraph graph : graphs) {
-      if (graph.getModel().getFile().equals(file)) {
-        graphsInFile.add(graph);
-      } else {
-        graphsInFile.addAll(getGraphsInFile(file, graph.getChildren()));
-      }
-    }
-    return graphsInFile;
-  }
-
-  public static String createUniqueName() {
-    return "Untitled-" + untitledIter.getAndIncrement();
-  }
-
-  public static Line getLine(List<Line> lines, ModelNode fromModel,
-      ModelNode toModel) {
-    for (Line line : lines) {
-      if (line.getFromModel().equals(fromModel)
-          && line.getToModel().equals(toModel)) {
-        return line;
-      }
-    }
-    return null;
-  }
-
-  public static List<Line> getRelaventLines(List<Line> lines, String id) {
-    List<Line> relaventLines = new Vector<Line>();
-    for (Line line : lines) {
-      if ((line.getFromModel() != null && line.getFromModel().getId()
-                                              .equals(id))
-          || (line.getToModel() != null && line.getToModel().getId().equals(id))) {
-        relaventLines.add(line);
-      }
-    }
-    return relaventLines;
-  }
-
-  public static List<Line> getChildrenLines(List<Line> lines, String id) {
-    List<Line> relaventLines = new Vector<Line>();
-    for (Line line : lines) {
-      if (line.getFromModel().getId().equals(id)) {
-        relaventLines.add(line);
-      }
-    }
-    return relaventLines;
-  }
-
-  public static List<Line> getParentLines(List<Line> lines, String id) {
-    List<Line> relaventLines = new Vector<Line>();
-    for (Line line : lines) {
-      if (line.getToModel().getId().equals(id)) {
-        relaventLines.add(line);
-      }
-    }
-    return relaventLines;
-  }
-
-  public static List<Line> getStartingLines(List<Line> lines) {
-    Vector<Line> startingLines = new Vector<Line>();
-    for (Line line : lines) {
-      if (getParentLines(lines, line.getFromModel().getId()).size() == 0) {
-        startingLines.add(line);
-      }
-    }
-    return startingLines;
-  }
-
-}


Mime
View raw message