• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java ObjectScene类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: setResolvedNodeLocation

import org.netbeans.api.visual.model.ObjectScene; //导入依赖的package包/类
/**
 * Should be called to set a new resolved preferred location of a node.
 * @param graph the universal graph
 * @param node the node with resolved location
 * @param newPreferredLocation the new resolved location
 */
protected final void setResolvedNodeLocation (UniversalGraph<N,E> graph, N node, Point newPreferredLocation) {
    ObjectScene scene = graph.getScene ();

    Widget widget = scene.findWidget (node);
    if (widget == null)
        return;

    Point previousPreferredLocation = widget.getPreferredLocation ();

    if (animated)
        scene.getSceneAnimator ().animatePreferredLocation (widget, newPreferredLocation);
    else
        widget.setPreferredLocation (newPreferredLocation);

    GraphLayoutListener<N,E>[] listeners = createListenersCopy ();

    for (GraphLayoutListener<N,E> listener : listeners)
        listener.nodeLocationChanged (graph, node, previousPreferredLocation, newPreferredLocation);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:26,代码来源:GraphLayout.java


示例2: select

import org.netbeans.api.visual.model.ObjectScene; //导入依赖的package包/类
@Override
public void select(Widget widget, Point localLocation, boolean invertSelection) {
    ObjectScene scene = (ObjectScene) widget.getScene();
    INodeWidget nodeWidget = (INodeWidget) widget;
    Object object = scene.findObject(widget);
    if (object != null) {// bug if removed then widget does not move
        if (scene.getSelectedObjects().contains(object)) {
            return;
        }
        scene.userSelectionSuggested(Collections.singleton(object), invertSelection);
    } else {
        scene.userSelectionSuggested(Collections.emptySet(), invertSelection);
    }
    NBModelerUtil.showContextPalette(nodeWidget.getModelerScene(), nodeWidget);
    nodeWidget.exploreProperties();

}
 
开发者ID:jeddict,项目名称:NBModeler,代码行数:18,代码来源:NodeWidgetSelectProvider.java


示例3: GraphSceneGlassPane

import org.netbeans.api.visual.model.ObjectScene; //导入依赖的package包/类
public GraphSceneGlassPane() {
    this.scene = new ObjectScene();
    this.scene.setOpaque(false);
    this.mainLayer = new LayerWidget(this.scene);
    this.connectionLayer = new LayerWidget(this.scene);
    this.constraintsLayer = new LayerWidget(this.scene);
    this.jScroolPane = new JScrollPane();
    this.jScroolPane.setOpaque(false);
    this.scene.addChild(Costanti.INDEX_MAIN_LAYER,this.mainLayer);
    this.scene.addChild(Costanti.INDEX_CONNECTION_LAYER,this.connectionLayer);
    this.scene.addChild(Costanti.INDEX_CONSTRAINTS_LAYER,this.constraintsLayer);
    this.view = scene.createView();
    this.view.setVisible(true);
    this.view.setOpaque(false);
    this.setLayout(new BorderLayout());
    this.add(this.view, BorderLayout.CENTER);
}
 
开发者ID:dbunibas,项目名称:spicy,代码行数:18,代码来源:GraphSceneGlassPane.java


示例4: performGraphLayout

import org.netbeans.api.visual.model.ObjectScene; //导入依赖的package包/类
/**
 * Performs the grid graph layout on an universal graph.
 *
 * @param graph the universal graph
 */
@Override
protected void performGraphLayout(UniversalGraph<GraphNode, EdgeNode> graph) {
    ObjectScene scene = graph.getScene();
    List<GraphNode> leftNodes = new ArrayList<GraphNode>();
    List<GraphNode> rightNodes = new ArrayList<GraphNode>();
    for (GraphNode node : graph.getNodes()) {
        Integer rightAlign = (Integer) node.getValue(LAYOUT_NODE_LOCATION);
        if (rightAlign != null && rightAlign == LOCATION_RIGHT) {
            rightNodes.add(node);
        } else {
            leftNodes.add(node);
        }
    }
    List<GraphLocation> leftWidgets = createRelativeLocations(scene, leftNodes, Align.LEFT);
    List<GraphLocation> rightWidgets = createRelativeLocations(scene, rightNodes, Align.LEFT);
    Rectangle leftBoundMax = findMaxBound(leftWidgets);
    Point leftStart = new Point(LEFT_SPACING, TOP_SPACING);
    Point rightStart = new Point(RIGHT_START_X, TOP_SPACING);
    if (RIGHT_START_X < (LEFT_SPACING + leftBoundMax.width + horizontalGap)) {
        rightStart = new Point(LEFT_SPACING + leftBoundMax.width + horizontalGap, TOP_SPACING);
    }
    resolveNodeLocations(graph, leftWidgets, leftStart);
    resolveNodeLocations(graph, rightWidgets, rightStart);
}
 
开发者ID:donatellosantoro,项目名称:Llunatic,代码行数:30,代码来源:GraphBiLayout.java


示例5: createRelativeLocations

import org.netbeans.api.visual.model.ObjectScene; //导入依赖的package包/类
private List<GraphLocation> createRelativeLocations(ObjectScene scene, List<GraphNode> nodes, Align align) {
    List<GraphLocation> widgetLocations = new ArrayList<GraphLocation>();
    int startY = 0;
    for (GraphNode node : nodes) {
        Widget widget = scene.findWidget(node);
        if (widget == null) {
            continue;
        }
        Rectangle bounds = widget.getBounds();
        if (bounds == null) {
            continue;
        }
        int startX = 0;
        if ( align == Align.RIGHT){
            startX = -bounds.width;
        }
        widgetLocations.add(new GraphLocation(node, startX, startY,bounds));
        startY += bounds.height + verticalGap;
        
    }
    return widgetLocations;
}
 
开发者ID:donatellosantoro,项目名称:Llunatic,代码行数:23,代码来源:GraphBiLayout.java


示例6: setDefaultPosition

import org.netbeans.api.visual.model.ObjectScene; //导入依赖的package包/类
@Override
public void setDefaultPosition() {
    ObjectScene scene = (ObjectScene) getConnector().getScene();
    if (connector instanceof IEdgeWidget) {
        labelMoveSupport.setAnchorLocation(0.5f);
    } else if (connector instanceof INodeWidget) {
        INodeWidget nodeWidget = (INodeWidget) connector;
        Rectangle rec = nodeWidget.getSceneViewBound();
        Point point = new Point((int) (rec.getX()), (int) (rec.getY() + rec.getHeight() + 5));
        Rectangle new_rec = getLabelConnectionWidget().getPreferredBounds();
        point = new Point((int) (point.getX() + (rec.getWidth() - new_rec.getWidth()) / 2), (int) (point.getY()));
        getLabelConnectionWidget().setPreferredLocation(point);
    }
    scene.validate();
}
 
开发者ID:jeddict,项目名称:NBModeler,代码行数:16,代码来源:AbstractLabelManager.java


示例7: getTopmostWidget

import org.netbeans.api.visual.model.ObjectScene; //导入依赖的package包/类
/**
 * Checks if an parent widget is also selected. If the parent widget is also
 * selected the parent will be returned.
 *
 * @param movingWidget The widget that is being checked.
 * @return The correct widget that should be the moves target widget.
 */
private Widget getTopmostWidget(Widget movingWidget) {
    Widget retVal = null;

    if (movingWidget != null) {
        if (movingWidget.getScene() instanceof ObjectScene) {
            ObjectScene scene = (ObjectScene) movingWidget.getScene();
            Set selected = scene.getSelectedObjects();
            Object data = scene.findObject(movingWidget);
            if (movingWidget == scene.findWidget(data)) {
                if ((selected != null) && (selected.contains(data) == true)) {
                    retVal = movingWidget;
                }
            }
        } else {
            if (movingWidget.getState().isSelected() == true) {
                retVal = movingWidget;
            }
        }

        if (movingWidget.getParentWidget() != null) {
            Widget newWidget = getTopmostWidget(movingWidget.getParentWidget());
            if (newWidget != null) {
                retVal = newWidget;
            }
        }
    }
    return retVal;
}
 
开发者ID:jeddict,项目名称:NBModeler,代码行数:36,代码来源:MoveNodeKeyAction.java


示例8: setModelerSceneAction

import org.netbeans.api.visual.model.ObjectScene; //导入依赖的package包/类
@Override
    public void setModelerSceneAction() {
        file.getModelerScene().getActions().addAction(ActionFactory.createWheelPanAction());
        file.getModelerScene().getActions().addAction(ActionFactory.createMouseCenteredZoomAction(1.5));
        WidgetAction acceptAction = ActionFactory.createAcceptAction(new CustomAcceptProvider(file.getModelerScene()));
        WidgetAction.Chain selectTool = file.getModelerScene().createActions(DesignerTools.SELECT);
        selectTool.addAction(new LockSelectionAction());//12  sec
        selectTool.addAction(ActionFactory.createSelectAction(new ModelerSceneSelectProvider(), true));
        selectTool.addAction(ActionFactory.createRectangularSelectAction((ObjectScene) file.getModelerScene(), file.getModelerScene().getBackgroundLayer()));//2 sec
        selectTool.addAction(ActionFactory.createZoomAction());
        selectTool.addAction(file.getModelerScene().createWidgetHoverAction());//2 sec
        selectTool.addAction(acceptAction);
        selectTool.addAction(ActionFactory.createPopupMenuAction(file.getModelerScene().getPopupMenuProvider())); //2190 seec
        selectTool.addAction(new WidgetAction.Adapter() {
            @Override
            public WidgetAction.State mouseMoved(Widget widget, WidgetAction.WidgetMouseEvent event) {
//                if (positionLabel != null) {
//                    Point point = widget.convertLocalToScene(event.getPoint());
//                    positionLabel.setText("[" + point.x + "," + point.y + "]");
//                }
                return WidgetAction.State.REJECTED;
            }
        });
        WidgetAction.Chain panTool = file.getModelerScene().createActions(DesignerTools.PAN);
        panTool.addAction(new PanAction());
        panTool.addAction(ActionFactory.createZoomAction());
        WidgetAction.Chain interactiveZoomTool = file.getModelerScene().createActions(DesignerTools.INTERACTIVE_ZOOM);
        interactiveZoomTool.addAction(new InteractiveZoomAction());
        interactiveZoomTool.addAction(ActionFactory.createZoomAction());
        WidgetAction.Chain contextPalette = file.getModelerScene().createActions(DesignerTools.CONTEXT_PALETTE);
        contextPalette.addAction(acceptAction);

    }
 
开发者ID:jeddict,项目名称:NBModeler,代码行数:34,代码来源:ModelerDiagramEngine.java


示例9: mousePressed

import org.netbeans.api.visual.model.ObjectScene; //导入依赖的package包/类
public State mousePressed (Widget widget, WidgetMouseEvent event) {

        if (isLocked ())
            return State.createLocked (widget, this);
        if (event.getButton ()  ==  MouseEvent.BUTTON1 ||  event.getButton () == MouseEvent.BUTTON3)
        {

            rightButton = event.getButton () == MouseEvent.BUTTON3;
            widget.getScene().getView().requestFocus();

            invertSelection = (event.getModifiersEx () & MouseEvent.CTRL_DOWN_MASK) != 0;
            Point localLocation = event.getPoint ();
            if (provider.isSelectionAllowed (widget, localLocation, invertSelection)) {
                aiming = provider.isAimingAllowed (widget, localLocation, invertSelection);
                if (aiming) {
                    updateState (widget, localLocation);
                    return State.createLocked (widget, this);
                } else {
                    provider.select (widget, localLocation, invertSelection);
                    // check if the widget is still selected...
                    Object object = null;
                    if (widget instanceof SelectionWidget)
                    {
                         object = ((ObjectScene)widget.getScene()).findObject ( ((SelectionWidget)widget).getRealWidget() );
                    }
                    else
                    {
                        object = ((ObjectScene)widget.getScene()).findObject (widget);
                    }
                    
                    if (!((ObjectScene)widget.getScene()).getSelectedObjects().contains (object))
                    {
                        return State.CONSUMED;
                    }
                    return State.CHAIN_ONLY;
                }
            }
        }
        return State.REJECTED;
    }
 
开发者ID:JockiHendry,项目名称:ireport-fork,代码行数:41,代码来源:SelectAction.java


示例10: switchPreviousFocus

import org.netbeans.api.visual.model.ObjectScene; //导入依赖的package包/类
public boolean switchPreviousFocus (Widget widget) {
    Scene scene = widget.getScene ();
    return scene instanceof ObjectScene  &&  switchFocus ((ObjectScene) scene, false);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:5,代码来源:CycleObjectSceneFocusProvider.java


示例11: switchNextFocus

import org.netbeans.api.visual.model.ObjectScene; //导入依赖的package包/类
public boolean switchNextFocus (Widget widget) {
    Scene scene = widget.getScene ();
    return scene instanceof ObjectScene  &&  switchFocus ((ObjectScene) scene, true);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:5,代码来源:CycleObjectSceneFocusProvider.java


示例12: ObjectSceneRectangularSelectProvider

import org.netbeans.api.visual.model.ObjectScene; //导入依赖的package包/类
public ObjectSceneRectangularSelectProvider (ObjectScene scene) {
    this.scene = scene;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:4,代码来源:ObjectSceneRectangularSelectProvider.java


示例13: switchPreviousFocus

import org.netbeans.api.visual.model.ObjectScene; //导入依赖的package包/类
@Override
public boolean switchPreviousFocus(Widget widget) {
    Scene scene = widget.getScene();
    return scene instanceof ObjectScene && switchFocus((ObjectScene) scene, false);
}
 
开发者ID:jeddict,项目名称:NBModeler,代码行数:6,代码来源:CyclePinFocusProvider.java


示例14: switchNextFocus

import org.netbeans.api.visual.model.ObjectScene; //导入依赖的package包/类
@Override
public boolean switchNextFocus(Widget widget) {
    Scene scene = widget.getScene();
    return scene instanceof ObjectScene && switchFocus((ObjectScene) scene, true);
}
 
开发者ID:jeddict,项目名称:NBModeler,代码行数:6,代码来源:CyclePinFocusProvider.java


示例15: init

import org.netbeans.api.visual.model.ObjectScene; //导入依赖的package包/类
public void init(final String name) {
    ObjectScene scene = (ObjectScene) getConnector().getScene();

    labelConnectionWidget = new LabelConnectionWidget(scene, name);
    labelMoveSupport = new EdgeLabelMoveSupport(connector);

    //Action for LabelWidget
    WidgetAction.Chain chain = getLabelConnectionWidget().createActions(DesignerTools.SELECT);
    chain.addAction(scene.createSelectAction());
    chain.addAction(ActionFactory.createMoveAction(labelMoveSupport, labelMoveSupport));
    chain.addAction(new MoveNodeKeyAction(labelMoveSupport, labelMoveSupport));
    chain.addAction(new WidgetAction.Adapter() {
        @Override
        public WidgetAction.State keyPressed(Widget widget,
                WidgetAction.WidgetKeyEvent event) {
            WidgetAction.State retVal = WidgetAction.State.REJECTED;

            if (widget.getState().isSelected() && (event.getKeyCode() == KeyEvent.VK_DELETE || event.getKeyCode() == KeyEvent.VK_BACK_SPACE)) {
                hideLabel();
                retVal = WidgetAction.State.CONSUMED;
            }

            return retVal;
        }
    });

    label.setVisible(true);

    if (connector instanceof IEdgeWidget) {
        IEdgeWidget edgeWidget = (IEdgeWidget) connector;
        edgeWidget.addChild((Widget) getLabelConnectionWidget());
        edgeWidget.setConstraint((Widget) getLabelConnectionWidget(),
                getDefaultAlignment(name, LabelType.EDGE),
                0.5f);

    } else if (connector instanceof INodeWidget) {
        INodeWidget nodeWidget = (INodeWidget) connector;
        nodeWidget.getModelerScene().getLabelLayer().addChild((Widget) getLabelConnectionWidget());
    }

    scene.validate();
    setDefaultPosition();
}
 
开发者ID:jeddict,项目名称:NBModeler,代码行数:44,代码来源:AbstractLabelManager.java


示例16: DiagramSceneRectangularSelectProvider

import org.netbeans.api.visual.model.ObjectScene; //导入依赖的package包/类
public DiagramSceneRectangularSelectProvider(ObjectScene scene) {
    this.scene = scene;
}
 
开发者ID:jeddict,项目名称:NBModeler,代码行数:4,代码来源:DiagramSceneRectangularSelectProvider.java


示例17: resolve

import org.netbeans.api.visual.model.ObjectScene; //导入依赖的package包/类
private Widget resolve(Widget widget){
    ObjectScene scene = (ObjectScene)widget.getScene();
    return scene.findWidget(scene.findObject(widget));
}
 
开发者ID:santhosh-tekuri,项目名称:jlibs,代码行数:5,代码来源:Highlighter.java


示例18: model

import org.netbeans.api.visual.model.ObjectScene; //导入依赖的package包/类
public static Object model(Widget widget){
    return ((ObjectScene)widget.getScene()).findObject(widget);
}
 
开发者ID:santhosh-tekuri,项目名称:jlibs,代码行数:4,代码来源:Util.java


示例19: createRectangularSelectAction

import org.netbeans.api.visual.model.ObjectScene; //导入依赖的package包/类
/**
 * Creates a rectangular select action for a specified object scene with a default decorator.
 * @param scene the object scene which the selection will be controlled by the action
 * @param interractionLayer the interraction layer where the selection rectangle will be visualized
 * @return the rectangular select action
 */
public static WidgetAction createRectangularSelectAction (ObjectScene scene, LayerWidget interractionLayer) {
    assert scene != null;
    return createRectangularSelectAction (ActionFactory.createDefaultRectangularSelectDecorator (scene), interractionLayer, ActionFactory.createObjectSceneRectangularSelectProvider (scene));
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:11,代码来源:ActionFactory.java


示例20: createObjectSceneRectangularSelectProvider

import org.netbeans.api.visual.model.ObjectScene; //导入依赖的package包/类
/**
 * Creates a rectangular select provider which controls a selection of an object scene.
 * @param scene the object scene where an action is used
 * @return the rectangular select provider
 */
public static RectangularSelectProvider createObjectSceneRectangularSelectProvider (ObjectScene scene) {
    assert scene != null;
    return new ObjectSceneRectangularSelectProvider (scene);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:10,代码来源:ActionFactory.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java Examples类代码示例发布时间:2022-05-23
下一篇:
Java JFXPasswordField类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap