Package vg.core.graph

Examples of vg.core.graph.GraphNode


    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

  //-------------------------------------------------------------------------
  public SimpleNavigator(final PluginParameter parameter) {
    super("Navigator", null);
    this.parameter = parameter;
    //create tree
    this.rootNode = new GraphNode(ENodeType.DEF_NONE, -1,"Graphs", "Graphs");
    this.tree = new JTree(this.rootNode);
    NavigatorTreeRenderer renderer = new NavigatorTreeRenderer();
    this.tree.setCellRenderer(renderer);
    this.scrollPane = new JScrollPane(this.tree);
    this.nodeManager = new NodeManager(this.tree, this.parameter);
View Full Code Here

              break;
            }
            case DEF_RENAME_TAB:
            {
              UIEventRenameTab bufEvent = (UIEventRenameTab)event;
              GraphNode tabNode = SimpleNavigator.this.rootNode.getNode(bufEvent.getTabId(), ENodeType.DEF_TAB);
              if(tabNode != null) {
                tabNode.setName(bufEvent.getNewName());
              } else {
                VisualGraph.log.printError("[" + this.getClass().getName()+".update] [BAD] Renaming of tab.");
              }
              break;
            }
View Full Code Here

      if (resultSubGraph != null &&  !resultSubGraph.isEmpty()) {
        int db_id_sg = (Integer)resultSubGraph.get(0).get(0);
        request.append("select * from vertex s1 where s1.db_id_inner_graph = ");
        request.append(db_id_sg);
        request.append(";");
        GraphNode gn = new GraphNode(ENodeType.DEF_TAB, tabId, tabName,
            tabName);
        List<List<Object>> result = this.parameter.model
            .executeSQLRequest(request.toString());
        if (result != null && !result.isEmpty()) {
          int db_id_vertex = (Integer)result.get(0).get(0);
          // create new node for navigator
          GraphNode rgn = this.rootNode.getNode(db_id_vertex,
              ENodeType.DEF_VERTEX);
          if (rgn != null) {
            rgn.add(gn);
          } else {
            VisualGraph.log.printError("[" + this.getClass().getName() + ".addTabInNavigator] [BAD] Get root graph node = null. Can't adds this tab in navigator.");
          }
        } else {
          // adds graph node in graph
          for (int i = 0; i < this.rootNode.getChildCount(); i++) {
            GraphNode rgn = (GraphNode) this.rootNode.getChildAt(i);
            if (rgn.getNode(db_id_sg, ENodeType.DEF_ROOT_SUBGRAPH) != null) {
              rgn.add(gn);
              break;
            }
          }
        }
      } else {
View Full Code Here

  /**
   * This method adds new graph in navigator.
   * @param graphId - id of graph.
   */
  private void addGraph(final int graphId) {
    final GraphNode node = this.parameter.model.getGraphSkeleton(graphId);
    if (node != null) {
      SwingUtilities.invokeLater(new Runnable() {
        public void run() {
          SimpleNavigator.this.rootNode.add(node);
          SimpleNavigator.this.tree.updateUI();
View Full Code Here

  public SQLite4JavaModel() throws CoreException {
    createModel();
  }
  public synchronized void addStorableGraph(StorableGraph sg, ArrayList<Integer> subgraphIDs)  {
    this.dataBase.addStorableGraph(sg, subgraphIDs);
    GraphNode node = new GraphNode(ENodeType.DEF_ROOT_SUBGRAPH, sg.getRootSubGraphId(), null, sg.getName());
    node.setInnerGraph(sg.getRootSubGraphId());
    this.graphSkeletons.put(sg.getStorableId(), node);
    setInnerGraph(node);
    for(Integer buf : subgraphIDs) {
      this.waitGraphNodes.remove(buf);
    }
View Full Code Here

        if(name != null && name.equals("name")) {
          valueAttr = bufAttr.getValue();
          break;
        }
      }
      GraphNode node = new GraphNode(ENodeType.DEF_VERTEX, buf.getStorableId(), buf.getId(), valueAttr);
      node.setInnerGraph(buf.getInnerGraph());
      array.add(node);
    }
    this.waitGraphNodes.put(ssg.getStorableId(), array);
  }
View Full Code Here

  }
  public synchronized List<List<Object>> executeSQLRequest(final String request) {
    return(this.dataBase.executeSQLRequest(request));
  }
  public synchronized GraphNode getGraphSkeleton(final int graphId) {   
    GraphNode node = this.graphSkeletons.get(graphId);
    if(node != null) {
      return(node.clone());
    }
    return(null)
  }
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.