Package y.view

Examples of y.view.Graph2D


        // } else {
        Node node = getHitInfo(e).getHitNode();
        if (node != null && !getHierarchyManager().isNormalNode(node)) {
            double x = translateX(e.getX());
            double y = translateY(e.getY());
            Graph2D graph = getView().getGraph2D();
            NodeRealizer r = graph.getRealizer(node);
            GroupNodeRealizer gnr = null;
            if (r instanceof GroupNodeRealizer) {
                gnr = (GroupNodeRealizer) r;
            } else if (r instanceof ProxyShapeNodeRealizer
                    && ((ProxyShapeNodeRealizer) r).getRealizerDelegate() instanceof GroupNodeRealizer) {
View Full Code Here


     */
    public Node createNode(AbstractFamixEntity entity) {
        Node node = null;

        if (!this.contains(entity)) {
            Graph2D graph = getGraph(entity);
            if (isContainerEntityNode(entity)) {
                node = getHierarchyManager().createFolderNode(graph);
            } else if (FamixEntityMap.getInstance().containsType(entity.getClass())) {
                node = graph.createNode();
            }

            if (node != null) {
                this.getNodeToFamixMap().set(node, entity);
                this.getFamixToNodeMap().put(entity, node);
View Full Code Here

     * @param entity The entity to check.
     *
     * @return The graph in which the entity is.
     */
    private Graph2D getGraph(AbstractFamixEntity entity) {
        Graph2D graph = null;
        AbstractFamixEntity parent = entity.getParent();
        if (parent == null) {
            // no parent -> return root graph
            graph = this;
        } else {
View Full Code Here

     * to the entity's type.
     *
     * @param node The node to configure.
     */
    private void configureNode(Node node) {
        Graph2D graph = (Graph2D) node.getGraph();
        DependencyGraph rootGraph = (DependencyGraph) graph.getHierarchyManager().getRootGraph();
        AbstractFamixEntity entity = rootGraph.getFamixEntity(node);

        NodeRealizer nr = graph.getRealizer(node);
        NodeRealizer newNodeRealizer = null;
        if (nr instanceof GroupNodeRealizer) {
            newNodeRealizer = new FamixGroupNodeRealizer(nr);
        } else {
            if (entity instanceof FamixAttribute) {
                newNodeRealizer = new FamixAttributeNodeRealizer(nr);
            } else {
                newNodeRealizer = new DefaultFamixNodeRealizer(nr);
            }
        }
        ((IFamixNodeRealizer) newNodeRealizer).initAttributes(entity);
        graph.setRealizer(node, newNodeRealizer);
    }
View Full Code Here

     * Configure high level edge.
     *
     * @param edge the edge
     */
    private void configureHighLevelEdge(Edge edge) {
        Graph2D graph = (Graph2D) edge.getGraph();
        DependencyGraph rootGraph = (DependencyGraph) graph.getHierarchyManager().getRootGraph();

        Class<? extends FamixAssociation> associationType = rootGraph.getEdgeType(edge);
        EdgeRealizer er = graph.getRealizer(edge);
        EdgeRealizer newEdgeRealizer = null;
        if (associationType.equals(FamixInvocation.class)) {
            newEdgeRealizer = new DefaultFamixEdgeRealizer(er);
        } else if (associationType.equals(FamixInheritance.class)) {
            newEdgeRealizer = new DeltaEdgeRealizer(er);
        } else if (associationType.equals(FamixSubtyping.class)) {
            newEdgeRealizer = new DashedDeltaEdgeRealizer(er);
        } else if (associationType.equals(FamixCastTo.class)) {
            newEdgeRealizer = new DefaultFamixEdgeRealizer(er);
        } else if (associationType.equals(FamixCheckInstanceOf.class)) {
            newEdgeRealizer = new DefaultFamixEdgeRealizer(er);
        } else if (associationType.equals(FamixAccess.class)) {
            newEdgeRealizer = new DefaultFamixEdgeRealizer(er);
        } else {
            sLogger.warn("Edgetype of " + associationType + " currently not supported - using default");
            newEdgeRealizer = new DefaultFamixEdgeRealizer(er);
        }

        List<Edge> lowLevelEdges = rootGraph.getLowLevelEdges(edge);
        int nrLowLevelEdges = 1;
        if (lowLevelEdges != null) {
            nrLowLevelEdges = lowLevelEdges.size();
        }

        ((IFamixEdgeRealizer) newEdgeRealizer).initAttributes(associationType, nrLowLevelEdges);
        graph.setRealizer(edge, newEdgeRealizer);
    }
View Full Code Here

     * {@inheritDoc}
     */
    public void execute() {
        setEditResult(new EditResult());

        Graph2D rootGraph = (Graph2D) getGraphLoader().getHierarchyManager().getRootGraph();
        NodeRealizer nr = rootGraph.getRealizer(fSelectedNode);
        if (nr instanceof GroupNodeRealizer) {
            fireGraphPreEvent();

            for (NodeCursor nc = getGraphLoader().getGraph().nodes(); nc.ok(); nc.next()) {
                getEdgeGrouper().reinsertLowLevelEdges(nc.node());
View Full Code Here

*
*/
public class NodePresenter extends AbstractPresenter<Node> {
  @Override
  protected void bind( @NotNull final Node presentation, @NotNull final StructPart struct, @NotNull Lookup lookup ) {
    final Graph2D graph2D = getGraph( presentation );

    lookup.bind( Action.class, new LookupChangeListener<Action>() {
      public void lookupChanged( @NotNull LookupChangeEvent<? extends Action> event ) {
        Action newValue = event.getNewValue();
        if ( newValue != null ) {
          graph2D.getRealizer( presentation ).setLabelText( ( String ) newValue.getValue( Action.NAME ) );
        } else {
          graph2D.getRealizer( presentation ).setLabelText( struct.getName() );
        }
        graph2D.updateViews();
      }
    } );
  }
View Full Code Here

    } );
  }

  @Override
  protected boolean addChildPresentation( @NotNull Node presentation, @NotNull StructPart child, int index ) {
    Graph2D graph2D = getGraph( presentation );
    Node childNode = getChildPresenter( child ).present( child );
    graph2D.createEdge( presentation, childNode );
    Graph2DPresenter.update( getGraph() );
    return true;
  }
View Full Code Here

    return getGraph().createNode();
  }

  @NotNull
  protected Graph2D getGraph( Node presentation ) {
    Graph2D graph = ( Graph2D ) presentation.getGraph();
    Graph2DPresenter.graphLocal.set( graph );
    return graph;
  }
View Full Code Here

  }

  @Override
  @NotNull
  protected Graph2D createPresentation() {
    graphLocal.set( new Graph2D() );
    rootNode = getGraph().createNode();
    return getGraph();
  }
View Full Code Here

TOP

Related Classes of y.view.Graph2D

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.