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

The following examples show how to use org.netbeans.api.visual.widget.Widget#getClientArea() . 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: AlignWithMoveStrategyProvider.java    From netbeans with Apache License 2.0 6 votes vote down vote up
public Point locationSuggested (Widget widget, Point originalLocation, Point suggestedLocation) {
    Point widgetLocation = widget.getLocation ();
    Rectangle widgetBounds = outerBounds ? widget.getBounds () : widget.getClientArea ();
    Rectangle bounds = widget.convertLocalToScene (widgetBounds);
    bounds.translate (suggestedLocation.x - widgetLocation.x, suggestedLocation.y - widgetLocation.y);
    Insets insets = widget.getBorder ().getInsets ();
    if (! outerBounds) {
        suggestedLocation.x += insets.left;
        suggestedLocation.y += insets.top;
    }
    Point point = super.locationSuggested (widget, bounds, widget.getParentWidget().convertLocalToScene(suggestedLocation), true, true, true, true);
    if (! outerBounds) {
        point.x -= insets.left;
        point.y -= insets.top;
    }
    return widget.getParentWidget ().convertSceneToLocal (point);
}
 
Example 2
Source File: DefaultAnchorShapeResolver.java    From netbeans with Apache License 2.0 5 votes vote down vote up
private Rectangle getSourceBounds()
{
    Widget source = connection.getSourceAnchor().getRelatedWidget();
         
    if(source != null)
    {
        Point sourceLocation = source.getLocation();
        Rectangle clientArea = source.getClientArea();
        return new Rectangle(sourceLocation, clientArea.getSize());
    }
    
    return null;
}
 
Example 3
Source File: DefaultAnchorShapeResolver.java    From netbeans with Apache License 2.0 5 votes vote down vote up
private Rectangle getTargetBounds()
{
    Widget target = connection.getTargetAnchor().getRelatedWidget();
            
    if(target != null)
    {
        Point targetLocation = target.getLocation();
        Rectangle targetArea = target.getClientArea();
        return new Rectangle(targetLocation, targetArea.getSize());
    }
    
    return null;
}
 
Example 4
Source File: ConnectionWidgetLayout.java    From netbeans with Apache License 2.0 5 votes vote down vote up
private Rectangle getSourceBounds(ConnectionWidget connectionWidget) {
    Widget source = connectionWidget.getSourceAnchor().getRelatedWidget();
    if (source == null)
        return null;

    Point sourceLocation = source.getLocation();
    Rectangle clientArea = source.getClientArea();
    return new Rectangle(sourceLocation, clientArea.getSize());
}
 
Example 5
Source File: ConnectionWidgetLayout.java    From netbeans with Apache License 2.0 5 votes vote down vote up
private Rectangle getTargetBounds(ConnectionWidget connectionWidget) {
    Widget target = connectionWidget.getTargetAnchor().getRelatedWidget();
    if (target == null)
        return null;

    Point targetLocation = target.getLocation();
    Rectangle targetArea = target.getClientArea();
    return new Rectangle(targetLocation, targetArea.getSize());
}
 
Example 6
Source File: OverlayLayout.java    From netbeans with Apache License 2.0 5 votes vote down vote up
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 ());
        }
    }
}