Package vg.core.graph

Examples of vg.core.graph.GraphNode


      TreeModel tm = this.tree.getModel();
      if(tm == null) {
        VisualGraph.log.printDebug("[" + this.getClass().getName()+".actionPerformed] [BAD] Openning of subgraph in new tab(from navigator). Model = null.");
        return;
      } else {
        GraphNode node = ((GraphNode)tm.getRoot()).getNode(p[0]);
        if(node.getInnerGraph() != null) {
          StorableSubGraph ssg = this.model.getStorableSubGraph(node.getInnerGraph());
          IGraphView igv = GraphView.newGraphView(ssg, this.userInterface);
          UIRequestOpenSubGraph req = new UIRequestOpenSubGraph(igv, null);
          this.userInterface.addRequest(req);
        } else {
          VisualGraph.windowMessage.warningMessage("Selection should be subgraph, if you want to open subgraph in new tab", "Opening of subgraph");       
View Full Code Here


    if(this.tree != null) {
      TreePath[] p = this.tree.getSelectionPaths();
      if(p != null && p.length == 1) {
        TreeModel tm = this.tree.getModel();
        if(tm != null) {
          GraphNode node = ((GraphNode)tm.getRoot()).getNode(p[0]);
          if(node.getInnerGraph() != null) {
            return(true);
          }
        }
      }
    }
View Full Code Here

        VisualGraph.log.printDebug("[" + this.getClass().getName()+".actionPerformed] [BAD] Openning of composition of vertexes in new tab(from navigator). Model = null.");
        return;
      } else {
        ArrayList<Integer>vertexes = new ArrayList<Integer>();
        for(int i = 0 ; i < p.length ; i++) {
          GraphNode node = ((GraphNode)tm.getRoot()).getNode(p[i]);
          if(node.getType() == ENodeType.DEF_VERTEX) {
            int db_id = node.getStorableId();
            vertexes.add(db_id);
          } else {
            VisualGraph.log.printDebug("[" + this.getClass().getName()+".actionPerformed] [BAD] Openning of composition of vertexes in new tab(from navigator). Type of node is not DEF_VERTEX.");
            VisualGraph.windowMessage.warningMessage("Warning: Elements aren't vertex of graph(May be it is tab or tabs).", "Opening of vertexes");
            return;
View Full Code Here

      TreePath[] p = this.tree.getSelectionPaths();
      if(p != null) {
        if(p.length == 1) {
          TreeModel tm = this.tree.getModel();
          if(tm != null) {
            GraphNode node = ((GraphNode)tm.getRoot()).getNode(p[0]);
            if(node != null && node.getType() == ENodeType.DEF_VERTEX) {
              return(true);
            }
          }
        } else if(p.length > 0) {
          TreePath path = p[0].getParentPath();
          if(path != null) {
            TreeModel tm = this.tree.getModel();
            if(tm != null) {
              String s = path.toString();
              boolean check = false; // check all selected nodes, that they have one parent
              for(int i = 0 ; i < p.length ; i++) {
                GraphNode node = ((GraphNode)tm.getRoot()).getNode(p[i]);
                if(!s.equals(p[i].getParentPath().toString()) || node == null || node.getType() != ENodeType.DEF_VERTEX) {
                  check = true;
                  break;
                }
              }
              return(!check);
View Full Code Here

                TreePath tp3 = SearchTree.this.tree.getSelectionPath();
                if(tp3 == null) return(false);
                TreePath tp2 = tp3.getParentPath();
                if(tp2 == null) return(false);
                TreePath tp1 = tp2.getParentPath();
                GraphNode node3 = SearchTree.this.currNode.getNode(tp3);
                GraphNode node2 = SearchTree.this.currNode.getNode(tp2);
                GraphNode node1 = SearchTree.this.currNode.getNode(tp1);
                boolean workDone = false;
                for(int i = 0; i < node2.getChildCount(); i++) {
                  GraphNode buf = (GraphNode)node2.getChildAt(i);
                  if(buf == node3) {
                    if(i < node2.getChildCount() - 1) {
                      buf = (GraphNode)node2.getChildAt(i+1);
                      Object[] newPath = new Object[tp2.getPathCount() + 1];
                      System.arraycopy(tp2.getPath(), 0, newPath, 0, tp2.getPathCount());
                      newPath[tp2.getPathCount()] = buf;
                      TreePath newTP = new TreePath(newPath);
                      SearchTree.this.tree.setSelectionPath(newTP);
                      workDone = true;
                    }
                    break;
                  }
                }
                if(!workDone && node1 != null) {
                  for(int i = 0; i < node1.getChildCount() - 1; i++) {
                    GraphNode buf = (GraphNode)node1.getChildAt(i);
                    if(buf == node2) {
                      for(int j = i+1; j < node1.getChildCount(); j++) {
                        buf = (GraphNode)node1.getChildAt(j);
                        if(!buf.isLeaf()) {
                          GraphNode bufInner = (GraphNode)buf.getChildAt(0);
                          Object[] newPath = new Object[tp1.getPathCount() + 2];
                          System.arraycopy(tp1.getPath(), 0, newPath, 0, tp1.getPathCount());
                          newPath[tp1.getPathCount()] = buf;
                          newPath[tp1.getPathCount() + 1] = bufInner;
                          TreePath newTP = new TreePath(newPath);
                          SearchTree.this.tree.setSelectionPath(newTP);
                          break;
                        }
                      }
                      break;
                    }
                  }                   
                }
              }
            }
            return(true);
          } else if(e.getID() == KeyEvent.KEY_PRESSED && e.getKeyCode() == KeyEvent.VK_UP) {
            synchronized (SearchTree.this.theMutexObject) {
              if(SearchTree.this.currNode != null) {
                TreePath tp3 = SearchTree.this.tree.getSelectionPath();
                if(tp3 == null) return(false);
                TreePath tp2 = tp3.getParentPath();
                if(tp2 == null) return(false);
                TreePath tp1 = tp2.getParentPath();
                GraphNode node3 = SearchTree.this.currNode.getNode(tp3);
                GraphNode node2 = SearchTree.this.currNode.getNode(tp2);
                GraphNode node1 = SearchTree.this.currNode.getNode(tp1);
                boolean workDone = false;
                for(int i = 0; i < node2.getChildCount(); i++) {
                  GraphNode buf = (GraphNode)node2.getChildAt(i);
                  if(buf == node3) {
                    if(i > 0) {
                      buf = (GraphNode)node2.getChildAt(i-1);
                      Object[] newPath = new Object[tp2.getPathCount() + 1];
                      System.arraycopy(tp2.getPath(), 0, newPath, 0, tp2.getPathCount());
                      newPath[tp2.getPathCount()] = buf;
                      TreePath newTP = new TreePath(newPath);
                      SearchTree.this.tree.setSelectionPath(newTP);
                      workDone = true;
                    }
                    break;
                  }
                }
                if(!workDone && node1 != null) {
                  for(int i = 1; i < node1.getChildCount(); i++) {
                    GraphNode buf = (GraphNode)node1.getChildAt(i);
                    if(buf == node2) {
                      for(int j = i-1; j >= 0; j--) {
                        buf = (GraphNode)node1.getChildAt(j);
                        if(!buf.isLeaf()) {
                          GraphNode bufInner = (GraphNode)buf.getChildAt(buf.getChildCount() - 1);
                          Object[] newPath = new Object[tp1.getPathCount() + 2];
                          System.arraycopy(tp1.getPath(), 0, newPath, 0, tp1.getPathCount());
                          newPath[tp1.getPathCount()] = buf;
                          newPath[tp1.getPathCount() + 1] = bufInner;
                          TreePath newTP = new TreePath(newPath);
View Full Code Here

      TreeModel tm = this.tree.getModel();
      if(tm == null) {
        VisualGraph.log.printDebug("[" + this.getClass().getName()+".actionPerformed] [BAD] Select tab(from navigator). Model = null.");
        return;
      } else {
        GraphNode node = ((GraphNode)tm.getRoot()).getNode(p[0]);
        if(node.getType() == ENodeType.DEF_TAB) {
          UIRequestSelectTab request = new UIRequestSelectTab(node.getStorableId(), null);
          this.userInterface.addRequest(request);
        } else {
          VisualGraph.windowMessage.warningMessage("Selection should be tab, if you want to select this tab", "Select tab");       
        }
      }
View Full Code Here

    if(this.tree != null) {
      TreePath[] p = this.tree.getSelectionPaths();
      if(p != null && p.length == 1) {
        TreeModel tm = this.tree.getModel();
        if(tm != null) {
          GraphNode node = ((GraphNode)tm.getRoot()).getNode(p[0]);
          if(node.getType() == ENodeType.DEF_TAB) {
            return(true);
          }
        }
      }
    }
View Full Code Here

    Component returnValue = delegate.getTreeCellRendererComponent(tree, value, selected, expanded, leaf, row, hasFocus);
    if (delegate instanceof JLabel)
    {
      JLabel renderer = (JLabel) delegate;
      if ((value != null) && (value instanceof GraphNode)) {
        GraphNode node = (GraphNode)value;
        switch(node.getType()) {
          case DEF_VERTEX:
          {
            if(!node.isLeaf()) {
              renderer.setIcon(this.routineIcon);
            } else {
              renderer.setIcon(this.vertexIcon);
            }
            renderer.addMouseListener(new MouseAdapter() {
View Full Code Here

    TreeCellRenderer delegate = new JTree().getCellRenderer();
    Component returnValue = delegate.getTreeCellRendererComponent(tree, value, selected, expanded, leaf, row, hasFocus);
    if (delegate instanceof JLabel) {
      JLabel renderer = (JLabel) delegate;
      if ((value != null) && (value instanceof GraphNode)) {
        GraphNode node = (GraphNode)value;
        switch(node.getType()) {
          case DEF_VERTEX:
          {
            if(!node.isLeaf()) {
              renderer.setIcon(this.routineIcon);
            } else {
              if(!array.contains(node.getStorableId())) {
                renderer.setIcon(this.iconDelete);
              } else {
                renderer.setIcon(this.vertexIcon);
              }
            }
View Full Code Here

      TreeModel tm = this.tree.getModel();
      if(tm == null) {
        VisualGraph.log.printDebug("[" + this.getClass().getName()+".actionPerformed] [BAD] Openning of subgraph in new tab(from navigator). Model = null.");
        return;
      } else {
        GraphNode node = ((GraphNode)tm.getRoot()).getNode(p[0]);
        if(node.getInnerGraph() != null) {
          StorableSubGraph ssg = this.parameter.model.getStorableSubGraph(node.getInnerGraph());
          IGraphView igv = GraphView.newGraphView(ssg, this.parameter.userInterface);
          showAdditionalAttribute(igv);
          if(this.model.getActionMode() == SearchPanelModel.DEF_ACTION_MODE_1) {
            UIRequestOpenSubGraph req = new UIRequestOpenSubGraph(igv, null);
            this.parameter.userInterface.addRequest(req);
View Full Code Here

TOP

Related Classes of vg.core.graph.GraphNode

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.