org.netbeans.api.visual.action.EditProvider Java Examples

The following examples show how to use org.netbeans.api.visual.action.EditProvider. 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: RuleScene.java    From jlibs with Apache License 2.0 5 votes vote down vote up
public RuleScene(TwoStateHoverProvider hoverProvider, EditProvider edgeEditProvider){
    addChild(nodes);
    addChild(connections);
    addChild(interactionLayer);

    this.hoverProvider = hoverProvider;
    hoverAction = ActionFactory.createHoverAction(new Highlighter(hoverProvider));
    editAction = ActionFactory.createEditAction(edgeEditProvider);

    getActions().addAction(hoverAction);
    getActions().addAction(ActionFactory.createPopupMenuAction(new ScenePopupProvider(this)));
    getActions().addAction(ActionFactory.createWheelPanAction());
}
 
Example #2
Source File: EditAction.java    From netbeans with Apache License 2.0 4 votes vote down vote up
public EditAction (EditProvider provider) {
    this.provider = provider;
}
 
Example #3
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");
            }
        }));

    }