Example #1
0
 /**
  * Adjust the given treenode's display coordinates. If given tree node is null or the root, will
  * simply ignore.
  *
  * @param treeNode the tree node
  * @param oldAttributeMap the existing attribute on the graph associated with the given tree node
  * @return the oldAttributeMap after applying the newly calculated attribute.
  */
 private AttributeMap adjustToNewPosition(
     DefaultMutableTreeNode treeNode, AttributeMap oldAttributeMap) {
   if (treeNode != null
       && !treeNode
           .isRoot()) { // change the render value if and only if neither it is null nor a root.
     boolean isFromSourceTree = UIHelper.isDataFromSourceTree(treeNode);
     int sourceYpos = -1;
     AttributeMap newTreeNodeAttribute = null;
     if (isFromSourceTree) {
       // Find the Y position for the source for this mappingNode.
       // find the # of pixels hidden. For example : 30
       sourceYpos =
           getGraphController()
               .calculateScrolledDistanceOnY(mappingPanel.getSourceScrollPane(), treeNode, true);
       // To hide the vertex body from the graph
       newTreeNodeAttribute =
           UIHelper.getDefaultInvisibleVertexBounds(new Point(0, sourceYpos), true);
     } else {
       sourceYpos =
           getGraphController()
               .calculateScrolledDistanceOnY(mappingPanel.getTargetScrollPane(), treeNode, true);
       newTreeNodeAttribute =
           UIHelper.getDefaultInvisibleVertexBounds(
               new Point((int) graphScrollPane.getVisibleRect().getWidth() - 5, sourceYpos),
               false);
     }
     if (oldAttributeMap == null) { // never return null.
       oldAttributeMap = new AttributeMap();
     }
     oldAttributeMap.applyMap(newTreeNodeAttribute);
   }
   return oldAttributeMap;
 }
Example #2
0
 public MiddlePanelJGraphController getGraphController() {
   return mappingPanel.getGraphController(); // graphController;
 }