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

The following examples show how to use org.netbeans.api.visual.action.ActionFactory. 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: ControlFlowScene.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
public ControlFlowScene() {
    selection = new HashSet<BlockWidget>();

    this.getInputBindings().setZoomActionModifiers(0);
    this.setLayout(LayoutFactory.createAbsoluteLayout());

    mainLayer = new LayerWidget(this);
    this.addChild(mainLayer);

    edgeLayer = new LayerWidget(this);
    this.addChild(edgeLayer);

    selectLayer = new LayerWidget(this);
    this.addChild(selectLayer);

    this.getActions().addAction(hoverAction);
    this.getActions().addAction(selectAction);
    this.getActions().addAction(ActionFactory.createRectangularSelectAction(this, selectLayer, this));
    this.getActions().addAction(ActionFactory.createMouseCenteredZoomAction(1.1));
}
 
Example #2
Source File: ControlFlowScene.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
public ControlFlowScene() {
    selection = new HashSet<BlockWidget>();

    this.getInputBindings().setZoomActionModifiers(0);
    this.setLayout(LayoutFactory.createAbsoluteLayout());

    mainLayer = new LayerWidget(this);
    this.addChild(mainLayer);

    edgeLayer = new LayerWidget(this);
    this.addChild(edgeLayer);

    selectLayer = new LayerWidget(this);
    this.addChild(selectLayer);

    this.getActions().addAction(hoverAction);
    this.getActions().addAction(selectAction);
    this.getActions().addAction(ActionFactory.createRectangularSelectAction(this, selectLayer, this));
    this.getActions().addAction(ActionFactory.createMouseCenteredZoomAction(1.1));
}
 
Example #3
Source File: ControlFlowScene.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
public ControlFlowScene() {
    selection = new HashSet<BlockWidget>();

    this.getInputBindings().setZoomActionModifiers(0);
    this.setLayout(LayoutFactory.createAbsoluteLayout());

    mainLayer = new LayerWidget(this);
    this.addChild(mainLayer);

    edgeLayer = new LayerWidget(this);
    this.addChild(edgeLayer);

    selectLayer = new LayerWidget(this);
    this.addChild(selectLayer);

    this.getActions().addAction(hoverAction);
    this.getActions().addAction(selectAction);
    this.getActions().addAction(ActionFactory.createRectangularSelectAction(this, selectLayer, this));
    this.getActions().addAction(ActionFactory.createMouseCenteredZoomAction(1.1));
}
 
Example #4
Source File: ControlFlowScene.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
public ControlFlowScene() {
    selection = new HashSet<BlockWidget>();

    this.getInputBindings().setZoomActionModifiers(0);
    this.setLayout(LayoutFactory.createAbsoluteLayout());

    mainLayer = new LayerWidget(this);
    this.addChild(mainLayer);

    edgeLayer = new LayerWidget(this);
    this.addChild(edgeLayer);

    selectLayer = new LayerWidget(this);
    this.addChild(selectLayer);

    this.getActions().addAction(hoverAction);
    this.getActions().addAction(selectAction);
    this.getActions().addAction(ActionFactory.createRectangularSelectAction(this, selectLayer, this));
    this.getActions().addAction(ActionFactory.createMouseCenteredZoomAction(1.1));
}
 
Example #5
Source File: ControlFlowScene.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
public ControlFlowScene() {
    selection = new HashSet<BlockWidget>();

    this.getInputBindings().setZoomActionModifiers(0);
    this.setLayout(LayoutFactory.createAbsoluteLayout());

    mainLayer = new LayerWidget(this);
    this.addChild(mainLayer);

    edgeLayer = new LayerWidget(this);
    this.addChild(edgeLayer);

    selectLayer = new LayerWidget(this);
    this.addChild(selectLayer);

    this.getActions().addAction(hoverAction);
    this.getActions().addAction(selectAction);
    this.getActions().addAction(ActionFactory.createRectangularSelectAction(this, selectLayer, this));
    this.getActions().addAction(ActionFactory.createMouseCenteredZoomAction(1.1));
}
 
Example #6
Source File: VMDGraphScene.java    From netbeans with Apache License 2.0 6 votes vote down vote up
/**
 * Creates a VMD graph scene with a specific color scheme.
 * @param scheme the color scheme
 */
public VMDGraphScene (VMDColorScheme scheme) {
    this.scheme = scheme;
    setKeyEventProcessingType (EventProcessingType.FOCUSED_WIDGET_AND_ITS_PARENTS);

    addChild (backgroundLayer);
    addChild (mainLayer);
    addChild (connectionLayer);
    addChild (upperLayer);

    router = RouterFactory.createOrthogonalSearchRouter (mainLayer, connectionLayer);

    getActions ().addAction (ActionFactory.createZoomAction ());
    getActions ().addAction (ActionFactory.createPanAction ());
    getActions ().addAction (ActionFactory.createRectangularSelectAction (this, backgroundLayer));

    sceneLayout = LayoutFactory.createSceneGraphLayout (this, new GridGraphLayout<String, String> ().setChecker (true));
}
 
Example #7
Source File: ControlFlowScene.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
public ControlFlowScene() {
    selection = new HashSet<BlockWidget>();

    this.getInputBindings().setZoomActionModifiers(0);
    this.setLayout(LayoutFactory.createAbsoluteLayout());

    mainLayer = new LayerWidget(this);
    this.addChild(mainLayer);

    edgeLayer = new LayerWidget(this);
    this.addChild(edgeLayer);

    selectLayer = new LayerWidget(this);
    this.addChild(selectLayer);

    this.getActions().addAction(hoverAction);
    this.getActions().addAction(selectAction);
    this.getActions().addAction(ActionFactory.createRectangularSelectAction(this, selectLayer, this));
    this.getActions().addAction(ActionFactory.createMouseCenteredZoomAction(1.1));
}
 
Example #8
Source File: ControlFlowScene.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
public ControlFlowScene() {
    selection = new HashSet<BlockWidget>();

    this.getInputBindings().setZoomActionModifiers(0);
    this.setLayout(LayoutFactory.createAbsoluteLayout());

    mainLayer = new LayerWidget(this);
    this.addChild(mainLayer);

    edgeLayer = new LayerWidget(this);
    this.addChild(edgeLayer);

    selectLayer = new LayerWidget(this);
    this.addChild(selectLayer);

    this.getActions().addAction(hoverAction);
    this.getActions().addAction(selectAction);
    this.getActions().addAction(ActionFactory.createRectangularSelectAction(this, selectLayer, this));
    this.getActions().addAction(ActionFactory.createMouseCenteredZoomAction(1.1));
}
 
Example #9
Source File: Utils.java    From netbeans with Apache License 2.0 6 votes vote down vote up
public TestScene() {
    addChild(mainLayer);
    addChild(connectionLayer);
    addChild(interractionLayer);
    getActions().addAction(createAction);
    //mainLayer.addChild(new LabelWidget(this, "Click on background to create a node. Drag a node to create a connection."));
    // do not change label nor location because it is hard coded in test cases
    //addNode("Label 0").setPreferredLocation(new Point(100, 100));
    Widget label0Widget = addNode("Label 0");
    label0Widget.setPreferredLocation(new Point(100, 100));
    label0Widget.getActions().addAction(ActionFactory.createPopupMenuAction(new MyPopupProvider()));
    label0Widget.getActions().addAction(new LabelAction());
    Widget label1Widget = addNode("Label 1");
    label1Widget.setPreferredLocation(new Point(300, 100));
    LabelWidget movableWidget = new LabelWidget(this, "Movable Widget");
    movableWidget.setPreferredLocation(new Point(100, 150));
    movableWidget.getActions().addAction(moveAction);
    addChild(movableWidget);
}
 
Example #10
Source File: ControlFlowScene.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
public ControlFlowScene() {
    selection = new HashSet<BlockWidget>();

    this.getInputBindings().setZoomActionModifiers(0);
    this.setLayout(LayoutFactory.createAbsoluteLayout());

    mainLayer = new LayerWidget(this);
    this.addChild(mainLayer);

    edgeLayer = new LayerWidget(this);
    this.addChild(edgeLayer);

    selectLayer = new LayerWidget(this);
    this.addChild(selectLayer);

    this.getActions().addAction(hoverAction);
    this.getActions().addAction(selectAction);
    this.getActions().addAction(ActionFactory.createRectangularSelectAction(this, selectLayer, this));
    this.getActions().addAction(ActionFactory.createMouseCenteredZoomAction(1.1));
}
 
Example #11
Source File: OperationWidget.java    From netbeans with Apache License 2.0 6 votes vote down vote up
/**
 * Creates a new instance of OperationWidget
 * @param scene
 * @param operation
 */
public OperationWidget(ObjectScene scene, ServiceModel serviceModel, 
        ProjectService service, MethodModel operation) 
{
    super(scene,RADIUS,RADIUS,RADIUS/2,BORDER_COLOR);
    this.service = service;
    this.operation=operation;
    this.serviceModel = serviceModel;
    
    removeAction = new RemoveOperationAction(service);
    removeAction.setWorkingSet(Collections.singleton(operation));
    getActions().addAction(ActionFactory.createPopupMenuAction(
            new DesignViewPopupProvider(new Action [] {
        new GotoSourceAction(operation, serviceModel.getImplementationClass()),
        removeAction
    })));
    createContent();
}
 
Example #12
Source File: QBGraphScene.java    From netbeans with Apache License 2.0 5 votes vote down vote up
public QBGraphScene(QueryBuilderGraphFrame qbGF) {
    qbGF._firstTableInserted = false;
    mainLayer = new LayerWidget(this);
    connectionLayer = new LayerWidget(this);
    addChild(mainLayer);
    addChild(connectionLayer);
    
    router = RouterFactory.createOrthogonalSearchRouter(mainLayer, connectionLayer);
    getActions().addAction(mouseHoverAction);
    // getActions().addAction(ActionFactory.createZoomAction());
    // ToDo: qbGF has been passed in only to support the menu; eventually, merge QBGF into this
    getActions().addAction(ActionFactory.createPopupMenuAction(qbGF));
}
 
Example #13
Source File: LunaticDepScene.java    From Llunatic with GNU General Public License v3.0 5 votes vote down vote up
public LunaticDepScene(VMDColorScheme scheme) {
    this.scheme = scheme;
    setKeyEventProcessingType(EventProcessingType.FOCUSED_WIDGET_AND_ITS_PARENTS);
    addChild(backgroundLayer);
    addChild(mainLayer);
    addChild(connectionLayer);
    addChild(upperLayer);
    orthoRouter = RouterFactory.createOrthogonalSearchRouter(mainLayer, connectionLayer);
    getActions().addAction(ActionFactory.createZoomAction());
    getActions().addAction(ActionFactory.createPanAction());
    getActions().addAction(ActionFactory.createRectangularSelectAction(this, backgroundLayer));
}
 
Example #14
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 #15
Source File: DB_VMDGraph.java    From BART with MIT License 5 votes vote down vote up
private void createTable(ITable table)   {
    VMDNodeWidget tableWidget = (VMDNodeWidget)scene.addNode(table.getName());
    tableWidget.setNodeProperties(ImageUtilities.loadImage(R.IMAGE_NODE_DBMS), 
                                  table.getName(), 
                                  "TABLE", null);
    tableWidget.setToolTipText("Double click for View Table data");
    tableWidget.getActions().addAction(ActionFactory.createEditAction(
                                    new TableEditProvider(topCompName, table)));
    for(Attribute attribute : table.getAttributes())   {
        if(attribute.getName().equalsIgnoreCase("oid"))continue;
        createAttribute(table.getName(),attribute);
    }
}
 
Example #16
Source File: PageFlowScene.java    From netbeans with Apache License 2.0 5 votes vote down vote up
/**
 * Creates a VMD graph scene.
 * @param pageFlowView or TopComponent/container.
 */
public PageFlowScene(PageFlowView view) {
    super();
    refPageFlowView = new WeakReference<PageFlowView>(view);

    setOpaque(true);
    setBackground(PAINT_BACKGROUND);

    setKeyEventProcessingType(EventProcessingType.FOCUSED_WIDGET_AND_ITS_PARENTS);

    addChild(backgroundLayer);
    addChild(mainLayer);
    addChild(connectionLayer);
    addChild(upperLayer);

    router = RouterFactory.createOrthogonalSearchRouter(mainLayer, connectionLayer);

    Chain actions = getActions();
    actions.addAction(ActionFactory.createZoomAction());
    actions.addAction(ActionFactory.createPanAction());
    actions.addAction(ActionFactory.createRectangularSelectAction(this, backgroundLayer));
    /*** POPUP_HACK: I have no access to PopupAction so I can't look through the actions and determine which one is a popup.
     * In order to added accessibility to popup I need access to this provider unless an API is created
     * to figure this out another means.
     **/
    actions.addAction(pagePopupAction);
    actions.addAction(createActionMap());
    pfObjectSceneListener = new PFObjectSceneListener();
    addObjectSceneListener(pfObjectSceneListener, ObjectSceneEventType.OBJECT_SELECTION_CHANGED);


    /* Temporary workaround  ISSUE# 107506 Still an issue. */
    //InputMap inputMap = MapActionUtility.initInputMap();
    //ActionMap actionMap = MapActionUtility.initActionMap();
    //actions.addAction(ActionFactory.createActionMapAction(inputMap, actionMap));
    //MyActionMapAction action = new MyActionMapAction(null, null);
    fpnl = new FreePlaceNodesLayouter(this, view.getVisibleRect());
    
}
 
Example #17
Source File: ButtonWidget.java    From netbeans with Apache License 2.0 5 votes vote down vote up
/**
 *
 * @param scene
 * @param icon
 * @param text
 */
public ButtonWidget(Scene scene, Image image, String text) {
    super(scene, image ,text);
    setRoundedBorder(BORDER_RADIUS,0,0,null);
    getActions().addAction(ActionFactory.createSelectAction(ButtonSelectProvider.DEFAULT));
    getActions().addAction(scene.createWidgetHoverAction());
}
 
Example #18
Source File: Scene.java    From netbeans with Apache License 2.0 5 votes vote down vote up
/**
 * Creates a widget-specific hover action.
 * @return the widget-specific hover action
 */
public WidgetAction createWidgetHoverAction () {
    if (widgetHoverAction == null) {
        widgetHoverAction = ActionFactory.createHoverAction (new WidgetHoverAction ());
        getActions ().addAction (widgetHoverAction);
    }
    return widgetHoverAction;
}
 
Example #19
Source File: ScrollWidget.java    From netbeans with Apache License 2.0 5 votes vote down vote up
/**
 * Creates a scroll widget.
 * @param scene
 */
public ScrollWidget (Scene scene) {
    super (scene);

    setLayout (new ScrollLayout ());
    setCheckClipping (true);

    viewport = new Widget (scene);
    viewport.setCheckClipping (true);
    addChild (viewport);

    addChild (upArrow = createUpArrow ());
    addChild (verticalSlider = createVerticalSlider ());
    addChild (downArrow = createDownArrow ());

    addChild (leftArrow = createLeftArrow ());
    addChild (horizontalSlider = createHorizontalSlider ());
    addChild (rightArrow = createRightArrow ());

    upArrow.getActions ().addAction (ActionFactory.createSelectAction (new UnitScrollProvider (0, -16)));
    downArrow.getActions ().addAction (ActionFactory.createSelectAction (new UnitScrollProvider (0, 16)));
    leftArrow.getActions ().addAction (ActionFactory.createSelectAction (new UnitScrollProvider (-16, 0)));
    rightArrow.getActions ().addAction (ActionFactory.createSelectAction (new UnitScrollProvider (16, 0)));

    horizontalSlider.getActions ().addAction (new BlockScrollAction (horizontalSlider, - 64, 0));
    verticalSlider.getActions ().addAction (new BlockScrollAction (verticalSlider, 0, - 64));
    horizontalSlider.getActions ().addAction (new SliderAction (horizontalSlider));
    verticalSlider.getActions ().addAction (new SliderAction (verticalSlider));
}
 
Example #20
Source File: ImageLabelWidget.java    From netbeans with Apache License 2.0 5 votes vote down vote up
public final void setLabelEditor(TextFieldInplaceEditor editor) {
    if (this.editor!=null) {
        throw new IllegalStateException("An editor is already specified.");
    }
    this.editor = editor;
    getActions().addAction(ActionFactory.createInplaceEditorAction(editor));
}
 
Example #21
Source File: ExtendedSelectAction.java    From openjdk-8-source with GNU General Public License v2.0 4 votes vote down vote up
public ExtendedSelectAction(SelectProvider provider) {
    innerAction = ActionFactory.createSelectAction(provider);
    panel = new JPanel();
}
 
Example #22
Source File: ExtendedSelectAction.java    From TencentKona-8 with GNU General Public License v2.0 4 votes vote down vote up
public ExtendedSelectAction(SelectProvider provider) {
    innerAction = ActionFactory.createSelectAction(provider);
    panel = new JPanel();
}
 
Example #23
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 #24
Source File: DiagramScene.java    From jdk8u60 with GNU General Public License v2.0 4 votes vote down vote up
public DiagramScene(Action[] actions, DiagramViewModel model) {
    this.actions = actions;
    selectedWidgets = new ArrayList<FigureWidget>();
    content = new InstanceContent();
    lookup = new AbstractLookup(content);
    this.setCheckClipping(true);
    this.getInputBindings().setZoomActionModifiers(0);

    JComponent comp = this.createView();
    comp.setDoubleBuffered(true);
    comp.setBackground(Color.WHITE);
    comp.setOpaque(true);

    this.setBackground(Color.WHITE);
    this.setOpaque(true);
    scrollPane = new JScrollPane(comp);
    scrollPane.setBackground(Color.WHITE);
    scrollPane.getVerticalScrollBar().setUnitIncrement(SCROLL_UNIT_INCREMENT);
    scrollPane.getVerticalScrollBar().setBlockIncrement(SCROLL_BLOCK_INCREMENT);
    scrollPane.getHorizontalScrollBar().setUnitIncrement(SCROLL_UNIT_INCREMENT);
    scrollPane.getHorizontalScrollBar().setBlockIncrement(SCROLL_BLOCK_INCREMENT);
    scrollPane.getViewport().addChangeListener(scrollChangeListener);
    hoverAction = this.createWidgetHoverAction();

    blockLayer = new LayerWidget(this);
    this.addChild(blockLayer);

    startLayer = new LayerWidget(this);
    this.addChild(startLayer);
    // TODO: String startLabelString = "Loading graph with " + originalDiagram.getFigures().size() + " figures and " + originalDiagram.getConnections().size() + " connections...";
    String startLabelString = "";
    LabelWidget w = new LabelWidget(this, startLabelString);
    scrollChangeListener.register(w, new Point(10, 10));
    w.setAlignment(LabelWidget.Alignment.CENTER);
    startLabel = w;
    startLayer.addChild(w);

    mainLayer = new LayerWidget(this);
    this.addChild(mainLayer);

    topLeft = new Widget(this);
    topLeft.setPreferredLocation(new Point(-BORDER_SIZE, -BORDER_SIZE));
    this.addChild(topLeft);


    bottomRight = new Widget(this);
    bottomRight.setPreferredLocation(new Point(-BORDER_SIZE, -BORDER_SIZE));
    this.addChild(bottomRight);

    slotLayer = new LayerWidget(this);
    this.addChild(slotLayer);

    connectionLayer = new LayerWidget(this);
    this.addChild(connectionLayer);

    LayerWidget selectionLayer = new LayerWidget(this);
    this.addChild(selectionLayer);

    this.setLayout(LayoutFactory.createAbsoluteLayout());

    this.getActions().addAction(hoverAction);
    zoomAction = new BoundedZoomAction(1.1, false);
    zoomAction.setMaxFactor(ZOOM_MAX_FACTOR);
    zoomAction.setMinFactor(ZOOM_MIN_FACTOR);
    this.getActions().addAction(ActionFactory.createMouseCenteredZoomAction(1.1));
    panAction = new ExtendedPanAction();
    this.getActions().addAction(panAction);
    this.getActions().addAction(ActionFactory.createPopupMenuAction(popupMenuProvider));

    LayerWidget selectLayer = new LayerWidget(this);
    this.addChild(selectLayer);
    this.getActions().addAction(ActionFactory.createRectangularSelectAction(rectangularSelectDecorator, selectLayer, rectangularSelectProvider));

    blockWidgets = new HashMap<InputBlock, BlockWidget>();

    boolean b = this.getUndoRedoEnabled();
    this.setUndoRedoEnabled(false);
    this.setNewModel(model);
    this.setUndoRedoEnabled(b);
}
 
Example #25
Source File: ExtendedSelectAction.java    From jdk8u60 with GNU General Public License v2.0 4 votes vote down vote up
public ExtendedSelectAction(SelectProvider provider) {
    innerAction = ActionFactory.createSelectAction(provider);
    panel = new JPanel();
}
 
Example #26
Source File: DiagramScene.java    From openjdk-jdk8u with GNU General Public License v2.0 4 votes vote down vote up
public DiagramScene(Action[] actions, DiagramViewModel model) {
    this.actions = actions;
    selectedWidgets = new ArrayList<FigureWidget>();
    content = new InstanceContent();
    lookup = new AbstractLookup(content);
    this.setCheckClipping(true);
    this.getInputBindings().setZoomActionModifiers(0);

    JComponent comp = this.createView();
    comp.setDoubleBuffered(true);
    comp.setBackground(Color.WHITE);
    comp.setOpaque(true);

    this.setBackground(Color.WHITE);
    this.setOpaque(true);
    scrollPane = new JScrollPane(comp);
    scrollPane.setBackground(Color.WHITE);
    scrollPane.getVerticalScrollBar().setUnitIncrement(SCROLL_UNIT_INCREMENT);
    scrollPane.getVerticalScrollBar().setBlockIncrement(SCROLL_BLOCK_INCREMENT);
    scrollPane.getHorizontalScrollBar().setUnitIncrement(SCROLL_UNIT_INCREMENT);
    scrollPane.getHorizontalScrollBar().setBlockIncrement(SCROLL_BLOCK_INCREMENT);
    scrollPane.getViewport().addChangeListener(scrollChangeListener);
    hoverAction = this.createWidgetHoverAction();

    blockLayer = new LayerWidget(this);
    this.addChild(blockLayer);

    startLayer = new LayerWidget(this);
    this.addChild(startLayer);
    // TODO: String startLabelString = "Loading graph with " + originalDiagram.getFigures().size() + " figures and " + originalDiagram.getConnections().size() + " connections...";
    String startLabelString = "";
    LabelWidget w = new LabelWidget(this, startLabelString);
    scrollChangeListener.register(w, new Point(10, 10));
    w.setAlignment(LabelWidget.Alignment.CENTER);
    startLabel = w;
    startLayer.addChild(w);

    mainLayer = new LayerWidget(this);
    this.addChild(mainLayer);

    topLeft = new Widget(this);
    topLeft.setPreferredLocation(new Point(-BORDER_SIZE, -BORDER_SIZE));
    this.addChild(topLeft);


    bottomRight = new Widget(this);
    bottomRight.setPreferredLocation(new Point(-BORDER_SIZE, -BORDER_SIZE));
    this.addChild(bottomRight);

    slotLayer = new LayerWidget(this);
    this.addChild(slotLayer);

    connectionLayer = new LayerWidget(this);
    this.addChild(connectionLayer);

    LayerWidget selectionLayer = new LayerWidget(this);
    this.addChild(selectionLayer);

    this.setLayout(LayoutFactory.createAbsoluteLayout());

    this.getActions().addAction(hoverAction);
    zoomAction = new BoundedZoomAction(1.1, false);
    zoomAction.setMaxFactor(ZOOM_MAX_FACTOR);
    zoomAction.setMinFactor(ZOOM_MIN_FACTOR);
    this.getActions().addAction(ActionFactory.createMouseCenteredZoomAction(1.1));
    panAction = new ExtendedPanAction();
    this.getActions().addAction(panAction);
    this.getActions().addAction(ActionFactory.createPopupMenuAction(popupMenuProvider));

    LayerWidget selectLayer = new LayerWidget(this);
    this.addChild(selectLayer);
    this.getActions().addAction(ActionFactory.createRectangularSelectAction(rectangularSelectDecorator, selectLayer, rectangularSelectProvider));

    blockWidgets = new HashMap<InputBlock, BlockWidget>();

    boolean b = this.getUndoRedoEnabled();
    this.setUndoRedoEnabled(false);
    this.setNewModel(model);
    this.setUndoRedoEnabled(b);
}
 
Example #27
Source File: ExtendedSelectAction.java    From openjdk-8 with GNU General Public License v2.0 4 votes vote down vote up
public ExtendedSelectAction(SelectProvider provider) {
    innerAction = ActionFactory.createSelectAction(provider);
    panel = new JPanel();
}
 
Example #28
Source File: DiagramScene.java    From openjdk-8 with GNU General Public License v2.0 4 votes vote down vote up
public DiagramScene(Action[] actions, DiagramViewModel model) {
    this.actions = actions;
    selectedWidgets = new ArrayList<FigureWidget>();
    content = new InstanceContent();
    lookup = new AbstractLookup(content);
    this.setCheckClipping(true);
    this.getInputBindings().setZoomActionModifiers(0);

    JComponent comp = this.createView();
    comp.setDoubleBuffered(true);
    comp.setBackground(Color.WHITE);
    comp.setOpaque(true);

    this.setBackground(Color.WHITE);
    this.setOpaque(true);
    scrollPane = new JScrollPane(comp);
    scrollPane.setBackground(Color.WHITE);
    scrollPane.getVerticalScrollBar().setUnitIncrement(SCROLL_UNIT_INCREMENT);
    scrollPane.getVerticalScrollBar().setBlockIncrement(SCROLL_BLOCK_INCREMENT);
    scrollPane.getHorizontalScrollBar().setUnitIncrement(SCROLL_UNIT_INCREMENT);
    scrollPane.getHorizontalScrollBar().setBlockIncrement(SCROLL_BLOCK_INCREMENT);
    scrollPane.getViewport().addChangeListener(scrollChangeListener);
    hoverAction = this.createWidgetHoverAction();

    blockLayer = new LayerWidget(this);
    this.addChild(blockLayer);

    startLayer = new LayerWidget(this);
    this.addChild(startLayer);
    // TODO: String startLabelString = "Loading graph with " + originalDiagram.getFigures().size() + " figures and " + originalDiagram.getConnections().size() + " connections...";
    String startLabelString = "";
    LabelWidget w = new LabelWidget(this, startLabelString);
    scrollChangeListener.register(w, new Point(10, 10));
    w.setAlignment(LabelWidget.Alignment.CENTER);
    startLabel = w;
    startLayer.addChild(w);

    mainLayer = new LayerWidget(this);
    this.addChild(mainLayer);

    topLeft = new Widget(this);
    topLeft.setPreferredLocation(new Point(-BORDER_SIZE, -BORDER_SIZE));
    this.addChild(topLeft);


    bottomRight = new Widget(this);
    bottomRight.setPreferredLocation(new Point(-BORDER_SIZE, -BORDER_SIZE));
    this.addChild(bottomRight);

    slotLayer = new LayerWidget(this);
    this.addChild(slotLayer);

    connectionLayer = new LayerWidget(this);
    this.addChild(connectionLayer);

    LayerWidget selectionLayer = new LayerWidget(this);
    this.addChild(selectionLayer);

    this.setLayout(LayoutFactory.createAbsoluteLayout());

    this.getActions().addAction(hoverAction);
    zoomAction = new BoundedZoomAction(1.1, false);
    zoomAction.setMaxFactor(ZOOM_MAX_FACTOR);
    zoomAction.setMinFactor(ZOOM_MIN_FACTOR);
    this.getActions().addAction(ActionFactory.createMouseCenteredZoomAction(1.1));
    panAction = new ExtendedPanAction();
    this.getActions().addAction(panAction);
    this.getActions().addAction(ActionFactory.createPopupMenuAction(popupMenuProvider));

    LayerWidget selectLayer = new LayerWidget(this);
    this.addChild(selectLayer);
    this.getActions().addAction(ActionFactory.createRectangularSelectAction(rectangularSelectDecorator, selectLayer, rectangularSelectProvider));

    blockWidgets = new HashMap<InputBlock, BlockWidget>();

    boolean b = this.getUndoRedoEnabled();
    this.setUndoRedoEnabled(false);
    this.setNewModel(model);
    this.setUndoRedoEnabled(b);
}
 
Example #29
Source File: ExtendedSelectAction.java    From openjdk-jdk8u with GNU General Public License v2.0 4 votes vote down vote up
public ExtendedSelectAction(SelectProvider provider) {
    innerAction = ActionFactory.createSelectAction(provider);
    panel = new JPanel();
}
 
Example #30
Source File: DiagramScene.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 4 votes vote down vote up
public DiagramScene(Action[] actions, DiagramViewModel model) {
    this.actions = actions;
    selectedWidgets = new ArrayList<FigureWidget>();
    content = new InstanceContent();
    lookup = new AbstractLookup(content);
    this.setCheckClipping(true);
    this.getInputBindings().setZoomActionModifiers(0);

    JComponent comp = this.createView();
    comp.setDoubleBuffered(true);
    comp.setBackground(Color.WHITE);
    comp.setOpaque(true);

    this.setBackground(Color.WHITE);
    this.setOpaque(true);
    scrollPane = new JScrollPane(comp);
    scrollPane.setBackground(Color.WHITE);
    scrollPane.getVerticalScrollBar().setUnitIncrement(SCROLL_UNIT_INCREMENT);
    scrollPane.getVerticalScrollBar().setBlockIncrement(SCROLL_BLOCK_INCREMENT);
    scrollPane.getHorizontalScrollBar().setUnitIncrement(SCROLL_UNIT_INCREMENT);
    scrollPane.getHorizontalScrollBar().setBlockIncrement(SCROLL_BLOCK_INCREMENT);
    scrollPane.getViewport().addChangeListener(scrollChangeListener);
    hoverAction = this.createWidgetHoverAction();

    blockLayer = new LayerWidget(this);
    this.addChild(blockLayer);

    startLayer = new LayerWidget(this);
    this.addChild(startLayer);
    // TODO: String startLabelString = "Loading graph with " + originalDiagram.getFigures().size() + " figures and " + originalDiagram.getConnections().size() + " connections...";
    String startLabelString = "";
    LabelWidget w = new LabelWidget(this, startLabelString);
    scrollChangeListener.register(w, new Point(10, 10));
    w.setAlignment(LabelWidget.Alignment.CENTER);
    startLabel = w;
    startLayer.addChild(w);

    mainLayer = new LayerWidget(this);
    this.addChild(mainLayer);

    topLeft = new Widget(this);
    topLeft.setPreferredLocation(new Point(-BORDER_SIZE, -BORDER_SIZE));
    this.addChild(topLeft);


    bottomRight = new Widget(this);
    bottomRight.setPreferredLocation(new Point(-BORDER_SIZE, -BORDER_SIZE));
    this.addChild(bottomRight);

    slotLayer = new LayerWidget(this);
    this.addChild(slotLayer);

    connectionLayer = new LayerWidget(this);
    this.addChild(connectionLayer);

    LayerWidget selectionLayer = new LayerWidget(this);
    this.addChild(selectionLayer);

    this.setLayout(LayoutFactory.createAbsoluteLayout());

    this.getActions().addAction(hoverAction);
    zoomAction = new BoundedZoomAction(1.1, false);
    zoomAction.setMaxFactor(ZOOM_MAX_FACTOR);
    zoomAction.setMinFactor(ZOOM_MIN_FACTOR);
    this.getActions().addAction(ActionFactory.createMouseCenteredZoomAction(1.1));
    panAction = new ExtendedPanAction();
    this.getActions().addAction(panAction);
    this.getActions().addAction(ActionFactory.createPopupMenuAction(popupMenuProvider));

    LayerWidget selectLayer = new LayerWidget(this);
    this.addChild(selectLayer);
    this.getActions().addAction(ActionFactory.createRectangularSelectAction(rectangularSelectDecorator, selectLayer, rectangularSelectProvider));

    blockWidgets = new HashMap<InputBlock, BlockWidget>();

    boolean b = this.getUndoRedoEnabled();
    this.setUndoRedoEnabled(false);
    this.setNewModel(model);
    this.setUndoRedoEnabled(b);
}