Java Code Examples for org.netbeans.api.visual.widget.Widget#isHitAt()

The following examples show how to use org.netbeans.api.visual.widget.Widget#isHitAt() . 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: ReconnectAction.java    From netbeans with Apache License 2.0 6 votes vote down vote up
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;
}
 
Example 2
Source File: ConnectAction.java    From netbeans with Apache License 2.0 6 votes vote down vote up
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;
}
 
Example 3
Source File: SelectAction.java    From netbeans with Apache License 2.0 5 votes vote down vote up
private void updateState (Widget widget, Point localLocation) {
    if (widget != null  &&  ! widget.isHitAt (localLocation))
        widget = null;
    if (widget == aimedWidget)
        return;
    if (aimedWidget != null)
        aimedWidget.setState (aimedWidget.getState ().deriveWidgetAimed (false));
    aimedWidget = widget;
    if (aimedWidget != null)
        aimedWidget.setState (aimedWidget.getState ().deriveWidgetAimed (true));
}
 
Example 4
Source File: ButtonWidget.java    From netbeans with Apache License 2.0 4 votes vote down vote up
public boolean isAimingAllowed(Widget widget, Point localLocation, boolean invertSelection) {
    return widget instanceof ButtonWidget && ((ButtonWidget)widget).
            isAimingAllowed() && widget.isHitAt(localLocation);
}
 
Example 5
Source File: ButtonWidget.java    From netbeans with Apache License 2.0 4 votes vote down vote up
public boolean isSelectionAllowed(Widget widget, Point localLocation, boolean invertSelection) {
    return widget instanceof ButtonWidget && widget.isHitAt(localLocation);
}