当前位置: 首页>>代码示例>>Java>>正文


Java GraphScene类代码示例

本文整理汇总了Java中org.netbeans.api.visual.graph.GraphScene的典型用法代码示例。如果您正苦于以下问题:Java GraphScene类的具体用法?Java GraphScene怎么用?Java GraphScene使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


GraphScene类属于org.netbeans.api.visual.graph包,在下文中一共展示了GraphScene类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: HierarchicalLayout

import org.netbeans.api.visual.graph.GraphScene; //导入依赖的package包/类
public HierarchicalLayout(GraphScene<N, E> scene, boolean animate,
        boolean inverted, int xOffset, int layerOffset) {

    dummyWidth = DUMMY_WIDTH;

    // scene is not used yet. It will be used when the container agnostic feature
    // is put into the NBVL
    this.animate = animate;

    if (xOffset > 0) {
        this.xOffset = xOffset;
    } else {
        this.xOffset = X_OFFSET;
    }

    if (layerOffset > 0) {
        this.layerOffset = layerOffset;
    } else {
        this.layerOffset = LAYER_OFFSET;
    }
    
    this.invert = inverted;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:24,代码来源:HierarchicalLayout.java

示例2: getAllContainedEdges

import org.netbeans.api.visual.graph.GraphScene; //导入依赖的package包/类
public static Collection<ConnectionWidget> getAllContainedEdges(Widget widget) {
    HashSet<ConnectionWidget> set = new HashSet<ConnectionWidget>();
    Scene scene = widget.getScene();
    if (scene instanceof GraphScene) {
        GraphScene gs = (GraphScene) scene;

        List<Object> nodeChildren = getAllNodeChildren(widget);
        for (Object obj : nodeChildren) {
            Collection edges = gs.findNodeEdges(obj, true, true);
            for (Object e : edges) {
                Object source = gs.getEdgeSource(e);
                Object target = gs.getEdgeTarget(e);
                if (nodeChildren.contains(source) && nodeChildren.contains(target)) {
                    set.add((ConnectionWidget) gs.findWidget(e));
                }
            }
        }
    }
    return set;
}
 
开发者ID:jeddict,项目名称:NBModeler,代码行数:21,代码来源:NBModelerUtil.java

示例3: isOwnerSelected

import org.netbeans.api.visual.graph.GraphScene; //导入依赖的package包/类
private boolean isOwnerSelected(Object o,
        Set<?> selected,
        GraphScene gscene) {
    boolean retVal = false;

    Widget widget = gscene.findWidget(o);
    if (widget != null) {
        Widget parent = widget.getParentWidget();
        Object parentObj = gscene.findObject(parent);

        if (parentObj != null) {
            if (selected.contains(parentObj) == true) {
                retVal = true;
            } else {
                retVal = isOwnerSelected(parentObj, selected, gscene);
            }
        }
    }

    return retVal;
}
 
开发者ID:jeddict,项目名称:NBModeler,代码行数:22,代码来源:TransAlignWithMoveStrategyProvider.java

示例4: DirectedGraph

import org.netbeans.api.visual.graph.GraphScene; //导入依赖的package包/类
/**
 * Creates a new instance of DirectedGraph
 */
protected DirectedGraph(UniversalGraph<N, E> uGraph, GraphScene scene) {
    this.uGraph = uGraph;
    this.scene = scene;
    this.nodes = uGraph.getNodes();
    this.edges = uGraph.getEdges();

    vertexMap = new HashMap<N, Vertex>();
    edgeMap = new LinkedHashMap<E, Edge>();
    rootVertices = new ArrayList<Vertex>();
    vertices = new ArrayList<Vertex>();
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:15,代码来源:DirectedGraph.java

示例5: MixedGraph

import org.netbeans.api.visual.graph.GraphScene; //导入依赖的package包/类
/** Creates a new instance of UndirectedGraph */
private MixedGraph(UniversalGraph<N, E> uGraph, GraphScene scene) {
    this.uGraph = uGraph;
    this.scene = scene;
    this.nodes = uGraph.getNodes();
    this.edges = uGraph.getEdges() ;

    vertexMap = new HashMap<N, Vertex>();
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:10,代码来源:MixedGraph.java

示例6: MGraph

import org.netbeans.api.visual.graph.GraphScene; //导入依赖的package包/类
/**
 * 
 * @param uGraph
 * @param scene
 */
protected MGraph(UniversalGraph<N, E> uGraph, GraphScene scene) {
    this.uGraph = uGraph;
    this.scene = scene;
    this.nodes = uGraph.getNodes();

    vertexMap = new HashMap<N, Vertex>();
    edgeMap = new LinkedHashMap<E, Edge>();
    vertices = new ArrayList<Vertex>();

    DummyVertex.resetCounter();
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:17,代码来源:MGraph.java

示例7: createSceneGraphLayout

import org.netbeans.api.visual.graph.GraphScene; //导入依赖的package包/类
/**
 * Creates a scene layout which performs a specified graph-oriented layout on a specified GraphScene.
 * @param graphScene the graph scene
 * @param graphLayout the graph layout
 * @return the scene layout
 */
public static <N,E> SceneLayout createSceneGraphLayout (final GraphScene<N,E> graphScene, final GraphLayout<N,E> graphLayout) {
    assert graphScene != null  &&  graphLayout != null;
    return new SceneLayout(graphScene) {
        protected void performLayout () {
            graphLayout.layoutGraph (graphScene);
        }
    };
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:15,代码来源:LayoutFactory.java

示例8: getAllNodeChildren

import org.netbeans.api.visual.graph.GraphScene; //导入依赖的package包/类
public static List<Object> getAllNodeChildren(Widget widget) {
    if (!(widget.getScene() instanceof GraphScene)) {
        return new ArrayList<Object>();
    }

    return getAllNodeChildrenRecursive(new ArrayList<Object>(), widget);
}
 
开发者ID:jeddict,项目名称:NBModeler,代码行数:8,代码来源:NBModelerUtil.java

示例9: getAllNodeChildrenRecursive

import org.netbeans.api.visual.graph.GraphScene; //导入依赖的package包/类
private static List<Object> getAllNodeChildrenRecursive(List<Object> list, Widget widget) {
    for (Widget child : widget.getChildren()) {
        Object pe = ((GraphScene) widget.getScene()).findObject(child);
        if (((GraphScene) widget.getScene()).isNode(pe)) {
            list.add(pe);
        }

        list = getAllNodeChildrenRecursive(list, child);
    }
    return list;
}
 
开发者ID:jeddict,项目名称:NBModeler,代码行数:12,代码来源:NBModelerUtil.java

示例10: getNodeWidget

import org.netbeans.api.visual.graph.GraphScene; //导入依赖的package包/类
/**
 * A connection widget can not be moved. Therefore if the focused widget is
 * a connection widget get one of the ends and base the movement on the
 * nodes. A node widget will only returned if one of the nodes are selected.
 *
 * @param widget The target of the key event.
 * @return The node widget. If no node widget is selected, then null is
 * returned.
 */
private Widget getNodeWidget(Widget widget) {
    Widget retVal = widget;

    if (widget instanceof ConnectionWidget) {
        retVal = null;

        ConnectionWidget connection = (ConnectionWidget) widget;
        Widget source = connection.getSourceAnchor().getRelatedWidget();
        if ((source != null) && (source.getState().isSelected() == true)) {
            retVal = source;
        } else {
            Widget target = connection.getTargetAnchor().getRelatedWidget();
            if ((target != null) && (target.getState().isSelected() == true)) {
                retVal = target;
            }
        }

        if (retVal == null) {
            if (widget.getScene() instanceof GraphScene) {
                GraphScene scene = (GraphScene) widget.getScene();
                for (Object select : scene.getSelectedObjects()) {
                    if (scene.isNode(select) == true) {
                        retVal = scene.findWidget(select);
                        break;
                    } else {
                        //we have an edge label selected here..
                        retVal = scene.findWidget(select);
                        if (retVal instanceof ConnectionWidget) {
                            // The only widget that is selected is an edge.
                            retVal = null;
                        }
                    }
                }
            }
        }
    }

    return getTopmostWidget(retVal);
}
 
开发者ID:jeddict,项目名称:NBModeler,代码行数:49,代码来源:MoveNodeKeyAction.java

示例11: createConnection

import org.netbeans.api.visual.graph.GraphScene; //导入依赖的package包/类
@Override
public void createConnection(Widget source, Widget target) {
    EdgeWidgetInfo edge = new EdgeWidgetInfo();
    edge.setId("_" + NBModelerUtil.getAutoGeneratedId().toString());
    edge.setName("");
    edge.setSource(((NodeWidget) source).getNodeWidgetInfo().getId());
    edge.setTarget(((NodeWidget) target).getNodeWidgetInfo().getId());

    ((GraphScene) scene).addEdge(edge);
    ((GraphScene) scene).setEdgeSource(edge, ((NodeWidget) source).getNodeWidgetInfo());
    ((GraphScene) scene).setEdgeTarget(edge, ((NodeWidget) target).getNodeWidgetInfo());
}
 
开发者ID:jeddict,项目名称:NBModeler,代码行数:13,代码来源:SequenceFlowConnectionProvider.java

示例12: getElement

import org.netbeans.api.visual.graph.GraphScene; //导入依赖的package包/类
private INodeWidget getElement(Widget widget) {
    INodeWidget retVal = null;

    Scene widgetScene = widget.getScene();
    if (widgetScene instanceof GraphScene) {
        GraphScene objScene = (GraphScene) widgetScene;
        Object value = objScene.findObject(widget);
        if (value instanceof INodeWidget) {
            retVal = findNode(objScene, (INodeWidget) value);
        }
    }

    return retVal;
}
 
开发者ID:jeddict,项目名称:NBModeler,代码行数:15,代码来源:SceneConnectProvider.java

示例13: keyReleased

import org.netbeans.api.visual.graph.GraphScene; //导入依赖的package包/类
@Override
public State keyReleased(Widget widget, WidgetKeyEvent event) {
    if (event.getKeyCode() == KeyEvent.VK_DELETE) {
        GraphScene s = (GraphScene) widget.getScene();
        if (widget instanceof NodeWidget) {
            s.removeNode(s.findObject(widget));
            return State.CONSUMED;
        } else if (widget instanceof EdgeWidget) {
            widget.removeFromParent();
            return State.CONSUMED;
        }
    }

    return State.REJECTED;
}
 
开发者ID:jeddict,项目名称:NBModeler,代码行数:16,代码来源:KeyEventLoggerAction.java

示例14: layoutScene

import org.netbeans.api.visual.graph.GraphScene; //导入依赖的package包/类
private static void layoutScene(GraphScene<String, String> scene,
		String root) {
	AbegoTreeLayoutForNetbeans<String, String> graphLayout = new AbegoTreeLayoutForNetbeans<String, String>(
			root, 100, 100, 50, 50, true);
	SceneLayout sceneLayout = LayoutFactory.createSceneGraphLayout(scene,
			graphLayout);
	sceneLayout.invokeLayoutImmediately();
}
 
开发者ID:abego,项目名称:treelayout,代码行数:9,代码来源:AbegoTreeLayoutForNetbeansDemo.java

示例15: layoutScene_NetbeansStyle

import org.netbeans.api.visual.graph.GraphScene; //导入依赖的package包/类
private static void layoutScene_NetbeansStyle(
		GraphScene<String, String> scene, String root) {
	GraphLayout<String, String> graphLayout = GraphLayoutFactory
			.createTreeGraphLayout(100, 100, 50, 50, true);
	GraphLayoutSupport.setTreeGraphLayoutRootNode(graphLayout, root);
	SceneLayout sceneLayout = LayoutFactory.createSceneGraphLayout(scene,
			graphLayout);
	sceneLayout.invokeLayoutImmediately();
}
 
开发者ID:abego,项目名称:treelayout,代码行数:10,代码来源:AbegoTreeLayoutForNetbeansDemo.java


注:本文中的org.netbeans.api.visual.graph.GraphScene类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。