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


Java Widget.getChildren方法代码示例

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


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

示例1: resolveReplacementWidgetCoreDive

import org.netbeans.api.visual.widget.Widget; //导入方法依赖的package包/类
private boolean resolveReplacementWidgetCoreDive (Widget[] result, Widget widget, Point parentLocation) {
    if (widget == connectionWidget)
        return false;

    Point widgetLocation = widget.getLocation ();
    Point location = new Point (parentLocation.x - widgetLocation.x, parentLocation.y - widgetLocation.y);

    if (! widget.getBounds ().contains (location))
        return false;

    java.util.List<Widget> children = widget.getChildren ();
    for (int i = children.size () - 1; i >= 0; i --) {
        if (resolveReplacementWidgetCoreDive (result, children.get (i), location))
            return true;
    }

    if (! widget.isHitAt (location))
        return false;

    ConnectorState state = provider.isReplacementWidget (connectionWidget, widget, reconnectingSource);
    if (state == ConnectorState.REJECT)
        return false;
    if (state == ConnectorState.ACCEPT)
        result[0] = widget;
    return true;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:27,代码来源:ReconnectAction.java

示例2: resolveTargetWidgetCoreDive

import org.netbeans.api.visual.widget.Widget; //导入方法依赖的package包/类
private boolean resolveTargetWidgetCoreDive (Widget[] result, Widget widget, Point parentLocation) {
    if (interractionLayer.equals (widget))
        return false;
    Point widgetLocation = widget.getLocation ();
    Point location = new Point (parentLocation.x - widgetLocation.x, parentLocation.y - widgetLocation.y);

    if (! widget.getBounds ().contains (location))
        return false;

    java.util.List<Widget> children = widget.getChildren ();
    for (int i = children.size () - 1; i >= 0; i --) {
        if (resolveTargetWidgetCoreDive (result, children.get (i), location))
            return true;
    }

    if (! widget.isHitAt (location))
        return false;

    ConnectorState state = provider.isTargetWidget (sourceWidget, widget);
    if (state == ConnectorState.REJECT)
        return false;
    if (state == ConnectorState.ACCEPT)
        result[0] = widget;
    return true;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:26,代码来源:ConnectAction.java

示例3: getAllNodeWidgets

import org.netbeans.api.visual.widget.Widget; //导入方法依赖的package包/类
private static List<Widget> getAllNodeWidgets(Widget widget, List<Widget> widgetList) {
    if (widgetList == null) {
        widgetList = new ArrayList<Widget>();
    }

    if (widget instanceof LayerWidget && widget.getChildren().size() > 0) //widget has children
    {
        widgetList.addAll(widget.getChildren());

        for (Widget child : widget.getChildren()) {
            getAllNodeWidgets(child, widgetList);
        }
    }

    return widgetList;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:17,代码来源:ScenePrinter.java

示例4: findWidget

import org.netbeans.api.visual.widget.Widget; //导入方法依赖的package包/类
/**
 * Finds index-th widget specified by WidgetChooser under given parent
 * widget. Firstly siblings are inspected, then their children.
 *
 * @param parentWidget parent Widget
 * @param widgetChooser WidgetChooser implementation
 * @param index index to be found
 * @param conter shared counter for indexes
 * @return Widget instance or null if not found
 */
private static Widget findWidget(Widget parentWidget, WidgetChooser widgetChooser, int index, Counter counter) {
    List<Widget> children = parentWidget.getChildren();
    for (Iterator<Widget> it = children.iterator(); it.hasNext();) {
        Widget child = it.next();
        // test this child
        if (widgetChooser == null || widgetChooser.checkWidget(child)) {
            if (index == counter.getValue()) {
                // found index-th match
                return child;
            } else {
                // increase counter and contnue searching
                counter.increase();
            }
        }
    }
    for (Iterator<Widget> it = children.iterator(); it.hasNext();) {
        Widget found = findWidget(it.next(), widgetChooser, index, counter);
        if (found != null) {
            return found;
        }
    }
    return null;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:34,代码来源:WidgetOperator.java

示例5: findShedWidget

import org.netbeans.api.visual.widget.Widget; //导入方法依赖的package包/类
private ShedWidget findShedWidget(Widget searchedEnvelope, Point scenePoint) {
    for (Widget searchedEnvelopeChild : searchedEnvelope.getChildren()) {
        ShedWidget foundWidget = findShedWidget(searchedEnvelopeChild, scenePoint);
        if (foundWidget != null) {
            return foundWidget;
        }
    }

    Rectangle localSearchedBounds = searchedEnvelope.getBounds();
    Rectangle sceneSearchedBounds = searchedEnvelope.convertLocalToScene(localSearchedBounds);

    if (sceneSearchedBounds.contains(scenePoint) && (searchedEnvelope instanceof ShedWidget)) {
        return (ShedWidget) searchedEnvelope;
    }
    return null;
}
 
开发者ID:kefik,项目名称:Pogamut3,代码行数:17,代码来源:ShedScene.java

示例6: layout

import org.netbeans.api.visual.widget.Widget; //导入方法依赖的package包/类
public void layout (Widget widget) {
    Collection<Widget> children = widget.getChildren ();
    for (Widget child : children) {
        if (child.isVisible ())
            child.resolveBounds (child.getPreferredLocation (), null);
        else
            child.resolveBounds (null, new Rectangle ());
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:10,代码来源:AbsoluteLayout.java

示例7: justify

import org.netbeans.api.visual.widget.Widget; //导入方法依赖的package包/类
public void justify (Widget widget) {
    Rectangle clientArea = widget.getClientArea ();
    for (Widget child : widget.getChildren ()) {
        if (child.isVisible ()) {
            Point location = child.getPreferredBounds ().getLocation ();
            child.resolveBounds (new Point (clientArea.x - location.x, clientArea.y - location.y), new Rectangle (location, clientArea.getSize ()));
        } else {
            child.resolveBounds (clientArea.getLocation (), new Rectangle ());
        }
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:12,代码来源:OverlayLayout.java

示例8: findComponent

import org.netbeans.api.visual.widget.Widget; //导入方法依赖的package包/类
QBNodeComponent findComponent(Widget widget) {
List<Widget> widgets = widget.getChildren();
for (Widget w : widgets) {
    if (w instanceof ComponentWidget)
	return (QBNodeComponent)((ComponentWidget)w).getComponent();
}
return null;
   }
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:9,代码来源:QueryBuilderGraphFrame.java

示例9: getFocusedWidgets

import org.netbeans.api.visual.widget.Widget; //导入方法依赖的package包/类
/**
 * Get all {@link ObjectState#isObjectFocused() focused} widgets in the
 * widget (eithger children or the widget itself).
 *
 * @param rootWidget Root widget whose tree we are searching
 */
private Set<Widget> getFocusedWidgets(Widget rootWidget) {
    Set<Widget> focusedWidgets = new HashSet<Widget>();
    if (rootWidget.getState().isObjectFocused()) {
        focusedWidgets.add(rootWidget);
    }
    for (Widget child : rootWidget.getChildren()) {
        focusedWidgets.addAll(getFocusedWidgets(child));
    }
    return focusedWidgets;
}
 
开发者ID:kefik,项目名称:Pogamut3,代码行数:17,代码来源:FocusActionFactory.java

示例10: revalidateBranch

import org.netbeans.api.visual.widget.Widget; //导入方法依赖的package包/类
private void revalidateBranch(Widget branchRoot) {
    for (Widget child : branchRoot.getChildren()) {
        revalidateBranch(child);
        //child.revalidate();
    }
    branchRoot.revalidate();
}
 
开发者ID:kefik,项目名称:Pogamut3,代码行数:8,代码来源:ShedScene.java

示例11: getSubtreeInfo

import org.netbeans.api.visual.widget.Widget; //导入方法依赖的package包/类
private String getSubtreeInfo(Widget subroot, int prefixLength) {
    StringBuilder sb = new StringBuilder();
    for (int prefixIndex = 0; prefixIndex < prefixLength; ++prefixIndex) {
        sb.append(' ');
    }
    sb.append(subroot.getClass().getSimpleName());
    sb.append(": ");
    sb.append(subroot);
    sb.append('\n');
    int childPrefixLength = prefixLength + 2;
    for (Widget child : subroot.getChildren()) {
        sb.append(getSubtreeInfo(child, childPrefixLength));
    }
    return sb.toString();
}
 
开发者ID:kefik,项目名称:Pogamut3,代码行数:16,代码来源:ShedScene.java

示例12: getSubtreeWidgets

import org.netbeans.api.visual.widget.Widget; //导入方法依赖的package包/类
private Set<Widget> getSubtreeWidgets(Widget subroot) {
    Set<Widget> allChildren = new HashSet<Widget>();

    allChildren.add(subroot);
    for (Widget child : subroot.getChildren()) {
        allChildren.addAll(getSubtreeWidgets(child));
    }
    return allChildren;
}
 
开发者ID:kefik,项目名称:Pogamut3,代码行数:10,代码来源:ShedWidgetFactory.java

示例13: 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.getChildren方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。