org.netbeans.api.visual.layout.SceneLayout Java Examples

The following examples show how to use org.netbeans.api.visual.layout.SceneLayout. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: AbegoTreeLayoutForNetbeansDemo.java    From treelayout with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
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();
}
 
Example #2
Source File: AbegoTreeLayoutForNetbeansDemo.java    From treelayout with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
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();
}
 
Example #3
Source File: TgdDepSceneGenerator.java    From Llunatic with GNU General Public License v3.0 5 votes vote down vote up
@Override
public Scene createScene(Dependency dependency) {
    LunaticDepScene scene = new LunaticDepScene();
    SceneLayout sceneLayout = LayoutFactory.createSceneGraphLayout(scene, graphLayout);
    scene.setSceneLayout(sceneLayout);
    populateScene(dependency, scene);
    return scene;
}
 
Example #4
Source File: EgdSceneGenerator.java    From Llunatic with GNU General Public License v3.0 5 votes vote down vote up
@Override
public Scene createScene(Dependency dependency) {
    LunaticDepScene scene = new LunaticDepScene();
    SceneLayout sceneLayout = LayoutFactory.createSceneGraphLayout(scene, graphLayout);
    scene.setSceneLayout(sceneLayout);
    populateScene(dependency, scene);
    return scene;
}
 
Example #5
Source File: topologyEditorTopComponent.java    From opensim-gui with Apache License 2.0 4 votes vote down vote up
private void populateDefault() {
        currentModel = OpenSimDB.getInstance().getCurrentModel();
        if (currentModel == null) return;
        scene.addNode("ground");
        GraphLayoutSupport.setTreeGraphLayoutRootNode (graphLayout, "ground");
        final SceneLayout sceneGraphLayout = LayoutFactory.createSceneGraphLayout (scene, graphLayout);
        WidgetAction editAction = ActionFactory.createEditAction (new MyEditProvider (sceneGraphLayout));
        scene.getActions().addAction (editAction);
        JointSet jnts = currentModel.getJointSet();
        int numJoints = jnts.getSize();
        for (int j=0; j<numJoints; j++ ){
            Joint jnt = jnts.get(j);
            String childFrameName = jnt.getChildFrame().findBaseFrame().getName();
            String parentFrameName = jnt.getParentFrame().findBaseFrame().getName();
            //LabelWidget bodyWidget= new LabelWidget(scene, "Body:"+bod.getName());
            Widget bodyWidget = scene.addNode(childFrameName);
            //bodyWidget.setPreferredLocation (new Point (b*30, b*50));
            bodyWidget.getActions().addAction (editAction);
            Widget jntWidget = scene.addNode(jnt.getName());
            jntWidget.setBorder(ModelGraphScene.getBORDER_0());
            //String edgeID = bod.getJoint().getName();
            String jntToParent = parentFrameName+ "_"+jnt.getName();
            scene.addEdge(jntToParent);
            scene.setEdgeSource (jntToParent, parentFrameName);
            scene.setEdgeTarget (jntToParent, jnt.getName());
            String jntToChild = childFrameName+ "_"+jnt.getName();
            scene.addEdge(jntToChild);
            scene.setEdgeSource (jntToChild, jnt.getName());
            scene.setEdgeTarget (jntToChild, childFrameName);
    }
        scene.validate();
        
        
        //add(scene.createSatelliteView(), BorderLayout.EAST); 
        sceneGraphLayout.invokeLayoutImmediately ();
        scene.validate();
        scene.getActions ().addAction (ActionFactory.createEditAction (new EditProvider() {
            public void edit (Widget widget) {
                // new implementation
                sceneGraphLayout.invokeLayoutImmediately ();
                // old implementation
//                new TreeGraphLayout<String, String> (TreeGraphLayoutTest.this, 100, 100, 50, 50, true).layout ("root");
            }
        }));

    }
 
Example #6
Source File: topologyEditorTopComponent.java    From opensim-gui with Apache License 2.0 4 votes vote down vote up
MyEditProvider(SceneLayout sceneGraphLayout){
    this.sceneGraphLayout = sceneGraphLayout;
}
 
Example #7
Source File: LunaticDepScene.java    From Llunatic with GNU General Public License v3.0 4 votes vote down vote up
public void setSceneLayout(SceneLayout sceneLayout) {
    this.sceneLayout = sceneLayout;
    layout();
}