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


Java Widget.getPreferredLocation方法代码示例

本文整理汇总了Java中org.netbeans.api.visual.widget.Widget.getPreferredLocation方法的典型用法代码示例。如果您正苦于以下问题:Java Widget.getPreferredLocation方法的具体用法?Java Widget.getPreferredLocation怎么用?Java Widget.getPreferredLocation使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.netbeans.api.visual.widget.Widget的用法示例。


在下文中一共展示了Widget.getPreferredLocation方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: setResolvedNodeLocation

import org.netbeans.api.visual.widget.Widget; //导入方法依赖的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: VertexWrapper

import org.netbeans.api.visual.widget.Widget; //导入方法依赖的package包/类
public VertexWrapper(N node, UniversalGraph<N, E> graph) {
    this.node = node;
    this.graph = graph;
    final VertexWrapper vertex = this;
    this.slot = new Port() {

        public Vertex getVertex() {
            return vertex;
        }

        public Point getRelativePosition() {
            return new Point((int) (vertex.getSize().getWidth() / 2), (int) (vertex.getSize().getHeight() / 2));
        }
    };

    Widget w = graph.getScene().findWidget(node);
    this.position = w.getPreferredLocation();
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:19,代码来源:HierarchicalGraphLayout.java

示例3: tick

import org.netbeans.api.visual.widget.Widget; //导入方法依赖的package包/类
protected void tick (double progress) {
    for (Map.Entry<Widget, Point> entry : targetLocations.entrySet ()) {
        Widget widget = entry.getKey ();
        Point sourceLocation = sourceLocations.get (widget);
        if (sourceLocation == null) {
            sourceLocation = widget.getPreferredLocation ();
            if (sourceLocation == null) {
                sourceLocation = widget.getLocation ();
                if (sourceLocation == null) {
                    sourceLocation = new Point ();
                }
            }
            sourceLocations.put (widget, sourceLocation);
        }
        Point targetLocation = entry.getValue ();
        if (targetLocation == null)
            continue;
        Point point;
        if (progress >= 1.0)
            point = targetLocation;
        else
            point = new Point (
                    (int) (sourceLocation.x + progress * (targetLocation.x - sourceLocation.x)),
                    (int) (sourceLocation.y + progress * (targetLocation.y - sourceLocation.y)));
        widget.setPreferredLocation (point);
    }
    if (progress >= 1.0) {
        sourceLocations.clear ();
        targetLocations.clear ();
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:32,代码来源:PreferredLocationAnimator.java

示例4: layoutSingleChildAt

import org.netbeans.api.visual.widget.Widget; //导入方法依赖的package包/类
private void layoutSingleChildAt (Point linePoint, ConnectionWidgetLayoutAlignment alignment, ConnectionWidget connectionWidget, Widget childWidget) {
    Rectangle preferredBounds = childWidget.getPreferredBounds ();
    Point referencePoint = getReferencePointForAdjustedAlignment (alignment, preferredBounds);
    Point location = childWidget.getPreferredLocation ();
    if (location != null)
        referencePoint.translate (-location.x, -location.y);
    childWidget.resolveBounds (new Point (linePoint.x - referencePoint.x, linePoint.y - referencePoint.y), preferredBounds);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:9,代码来源:ConnectionWidgetLayout.java

示例5: setNewLocation

import org.netbeans.api.visual.widget.Widget; //导入方法依赖的package包/类
public void setNewLocation(Widget widget, Point location) {
    if (selection.contains(widget)) {
        // move entire selection
        Point originalLocation = getOriginalLocation(widget);
        int xOffset = location.x - originalLocation.x;
        int yOffset = location.y - originalLocation.y;
        for (Widget w : selection) {
            Point p = new Point(w.getPreferredLocation());
            p.translate(xOffset, yOffset);
            w.setPreferredLocation(p);
        }
    } else {
        widget.setPreferredLocation(location);
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:16,代码来源:ControlFlowScene.java

示例6: getOriginalLocation

import org.netbeans.api.visual.widget.Widget; //导入方法依赖的package包/类
@Override public Point getOriginalLocation(Widget widget) {
    return widget.getPreferredLocation ();
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:4,代码来源:DependencyGraphScene.java

示例7: getOriginalLocation

import org.netbeans.api.visual.widget.Widget; //导入方法依赖的package包/类
public Point getOriginalLocation (Widget widget) {
    return widget.getPreferredLocation ();
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:4,代码来源:ActionFactory.java

示例8: getOriginalLocation

import org.netbeans.api.visual.widget.Widget; //导入方法依赖的package包/类
public Point getOriginalLocation(Widget widget) {
    return widget.getPreferredLocation();
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:4,代码来源:ControlFlowScene.java


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