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


Java Widget.getParentWidget方法代码示例

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


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

示例1: removeBranch

import org.netbeans.api.visual.widget.Widget; //导入方法依赖的package包/类
/**
 * Method for removing branches from the shed scene.
 *
 * @param removedBranchRoot
 */
public final void removeBranch(Widget removedBranchRoot) {
    Widget[] children = removedBranchRoot.getChildren().toArray(new Widget[0]);
    for (Widget child : children) {
        removeBranch(child);
    }

    List<Widget> widgetsToRemove = findArrows(removedBranchRoot);
    connectionLayer.removeChildren(widgetsToRemove);

    if (removedBranchRoot instanceof IPresentedWidget) {
        IPresentedWidget presentedWidget = (IPresentedWidget) removedBranchRoot;
        IPresenter branchRootPresenter = presentedWidget.getPresenter();
        branchRootPresenter.unregister();
    }
    Widget rootParentWidget = removedBranchRoot.getParentWidget();
    rootParentWidget.removeChild(removedBranchRoot);
}
 
开发者ID:kefik,项目名称:Pogamut3,代码行数:23,代码来源:ShedScene.java

示例2: findObject

import org.netbeans.api.visual.widget.Widget; //导入方法依赖的package包/类
/**
 * Returns an object which is assigned to a widget.
 * If the widget is not mapped to any object then the method recursively searches for an object of the parent widget.
 * @param widget the widget
 * @return the mapped object; null if no object is assigned to a widget or any of its parent widgets
 */
public final Object findObject (Widget widget) {
    while (widget != null) {
        Object o = widget2object.get (widget);
        if (o != null)
            return o;
        widget = widget.getParentWidget ();
    }
    return null;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:16,代码来源:ObjectScene.java

示例3: findArtifactW

import org.netbeans.api.visual.widget.Widget; //导入方法依赖的package包/类
private NodeWidget findArtifactW (Widget w) {
    while (w != null && !(w instanceof NodeWidget)) {
        w = w.getParentWidget();
    }
    return (NodeWidget)w;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:7,代码来源:DependencyGraphScene.java

示例4: layout

import org.netbeans.api.visual.widget.Widget; //导入方法依赖的package包/类
public void layout (Widget widget) {
    ConnectionWidget connectionWidget = (ConnectionWidget) widget;

    connectionWidget.calculateRouting ();
    java.util.List<Point> controlPoints = connectionWidget.getControlPoints ();
    boolean empty = controlPoints == null  ||  controlPoints.size () <= 0;

    double totalDistance = 0.0;
    double[] distances = new double[empty ? 0 : controlPoints.size () - 1];
    for (int i = 0; i < distances.length; i ++)
        distances[i] = totalDistance += GeomUtil.distanceSq (controlPoints.get (i), controlPoints.get (i + 1));

    ArrayList<Widget> childrenToResolve = new ArrayList<Widget> (widget.getChildren());
    for (Map.Entry<Placement,ArrayList<Widget>> entry : reverse.entrySet()) {
        Placement placement = entry.getKey ();
        ArrayList<Widget> currentlyResolving = null;
        for (Widget childWidget : entry.getValue()) {
            if (childWidget.getParentWidget() == widget  &&  childWidget.isVisible()) {
                if (currentlyResolving == null)
                    currentlyResolving = new ArrayList<Widget>();
                currentlyResolving.add(childWidget);
            }
        }
        if (currentlyResolving == null)
            continue;
        Point point;
        if (empty) {
            point = new Point();
        } else if (placement.isPercentage) {
            float percentage = placement.placementInPercentage;
            if (percentage <= 0.0)
                point = connectionWidget.getFirstControlPoint ();
            else if (percentage >= 1.0)
                point = connectionWidget.getLastControlPoint ();
            else
                point = getLinePointAtPercentage (distances, (int) (percentage * totalDistance), controlPoints);
        } else {
            int distance = placement.placementAtDistance;
            if (distance < 0)
                point = getLinePointAtPercentage (distances, distance + (int) totalDistance, controlPoints);
            else
                point = getLinePointAtPercentage (distances, distance, controlPoints);
        }
        layoutChildrenAt (point, placement.alignment, connectionWidget, currentlyResolving);
        childrenToResolve.removeAll (currentlyResolving);
    }
    if (! childrenToResolve.isEmpty())
        layoutChildrenAt (new Point (), null, connectionWidget, childrenToResolve);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:50,代码来源:ConnectionWidgetLayout.java


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