Oracle UIX API Reference
Release 2.1.22.0.0
B12196-01

oracle.cabo.image.painter
Class AbstractBorderPainter

java.lang.Object
  |
  +--oracle.cabo.image.painter.AbstractPainter
        |
        +--oracle.cabo.image.painter.AbstractWrappingPainter
              |
              +--oracle.cabo.image.painter.AbstractBorderPainter
All Implemented Interfaces:
BorderPainter, Painter
Direct Known Subclasses:
AdjustableBorderPainter, ButtonPainter, DirectionalBorderPainter, GlobalButtonPainter

public abstract class AbstractBorderPainter
extends AbstractWrappingPainter
implements BorderPainter

Abstract baseclass combining a BorderPainter with the ability to wrap other components. Most BorderPainters are subclasses of this class.


Fields inherited from interface oracle.cabo.image.painter.Painter
STATE_ACTIVE_CHANGED, STATE_ARMED_CHANGED, STATE_BACKGROUND_CHANGED, STATE_ENABLED_CHANGED, STATE_FOCUSED_CHANGED, STATE_FONT_CHANGED, STATE_FOREGROUND_CHANGED, STATE_ISDEFAULT_CHANGED, STATE_MOUSE_OVER_CHANGED, STATE_READING_DIRECTION_CHANGED, STATE_SELECTED_CHANGED, STATE_SET_CHANGED, STATE_SIZE_CHANGED, STATE_XALIGNMENT_CHANGED, STATE_YALIGNMENT_CHANGED
 
Constructor Summary
AbstractBorderPainter()
          Creates an AbstractBorderPainter.
AbstractBorderPainter(Painter wrappedPainter)
          Creates an AbstractBorderPainter wrapping the wrappedPainter
AbstractBorderPainter(Painter wrappedPainter, boolean alwaysAddInsets)
          Creates an AbstractBorderPainter wrapping the wrappedPainter and using alwaysAddInsets to determine whether to add the border's insets when computing its size.
 
Method Summary
 boolean borderContains(PaintContext context, int availableWidth, int availableHeight, int x, int y)
          Returns true if the specified x, y location is inside the border portion of the BorderPainter.
 boolean contentContains(PaintContext context, int availableWidth, int availableHeight, int x, int y)
          Returns true if the specified x, y location is inside the content portion of the BorderPainter.
protected  Painter getBorderPainterAt(PaintContext context, int availableWidth, int availableHeight, int x, int y, Painter proxyPainter)
          Returns the Painter inside the ContentPainter at location x,y of the available size.
protected  Painter getContentPainterAt(PaintContext context, int availableWidth, int availableHeight, int x, int y, Painter proxyPainter)
          Returns the Painter inside the ContentPainter at location x,y of the available size.
 ImmInsets getFillInsets(PaintContext context)
          Returns the amount of space by which fills should be inset.
 ImmInsets getInsets(PaintContext context)
          Returns the insets of this stack of BorderPainters.
 java.awt.Dimension getMaximumSize(PaintContext context)
          Returns the maximum size of the AbstractBorderPainter.
 java.awt.Dimension getMinimumSize(PaintContext context)
          Returns the minimum size of the AbstractBorderPainter.
protected  ImmInsets getOwnFillInsets(PaintContext context)
          Returns the amount of space by which fills should be inset for this BorderPainter.
protected  ImmInsets getOwnInsets(PaintContext context)
          Returns the insets of just this BorderPainter, as opposed to the entire nested stack of BorderPainters like getInsets does.
 Painter getPainterAt(PaintContext context, int availableWidth, int availableHeight, int x, int y, Painter proxyPainter)
          Returns the Painter inside this Painter at location x,y of the available size.
 java.awt.Dimension getPreferredSize(PaintContext context)
          Returns the preferred size of the AbstractBorderPainter.
 java.awt.Dimension getSize(PaintContext context, int width, int height)
          Returns the size of the AbstractBorderPainter for the specified amount of availableWidth and availableHeight.
protected abstract  boolean isBorderTransparent(PaintContext context)
          Returns true if the border itself is transparent.
 boolean isTransparent(PaintContext context)
          Returns whether the Painter is transparent.
 void paint(PaintContext context, java.awt.Graphics g, int x, int y, int width, int height)
          Paints the Painter wrapped by the AbstractBorderPainter with the AbstractBorderPainter painted around it.
protected  void paintBorder(PaintContext context, java.awt.Graphics g, int x, int y, int width, int height)
          Paint just the border of the BorderPainter.
 
Methods inherited from class oracle.cabo.image.painter.AbstractWrappingPainter
getInvalidateFlags, getRepaintFlags, getWrappedPainter
 
Methods inherited from class oracle.cabo.image.painter.AbstractPainter
contains, getData, getDataKey
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface oracle.cabo.image.painter.Painter
contains, getInvalidateFlags, getRepaintFlags
 

Constructor Detail

AbstractBorderPainter

public AbstractBorderPainter()
Creates an AbstractBorderPainter.

AbstractBorderPainter

public AbstractBorderPainter(Painter wrappedPainter)
Creates an AbstractBorderPainter wrapping the wrappedPainter

Parameters:
wrappedPainter - Painter to wrap this border around.

AbstractBorderPainter

public AbstractBorderPainter(Painter wrappedPainter,
                             boolean alwaysAddInsets)
Creates an AbstractBorderPainter wrapping the wrappedPainter and using alwaysAddInsets to determine whether to add the border's insets when computing its size.

Parameters:
wrappedPainter - Painter to wrap this border around.
alwaysAddInsets - True if the border should always add its insets to the size of the wrapped painter when computing its size, even if the wrapped painter's size is zero.

See Also:
getSize(oracle.cabo.image.painter.PaintContext, int, int)
Method Detail

getSize

public final java.awt.Dimension getSize(PaintContext context,
                                        int width,
                                        int height)
Returns the size of the AbstractBorderPainter for the specified amount of availableWidth and availableHeight. Most Painters will simply return the availableWidth and availableHeight.

Specified by:
getSize in interface Painter
Overrides:
getSize in class AbstractWrappingPainter
Parameters:
context - Context for deterimining the size.
availableWidth - Amount of width available to the Painter.
availableHeight - Amount of height available to the Painter.

Returns:
The size of the Painter.

getPreferredSize

public java.awt.Dimension getPreferredSize(PaintContext context)
Returns the preferred size of the AbstractBorderPainter.

In general, BorderPainters should not need to override this method, since it already accounts for the Border's insets.

Specified by:
getPreferredSize in interface Painter
Overrides:
getPreferredSize in class AbstractWrappingPainter
Parameters:
context - Context for determining the preferred size.

Returns:
The preferred size of the Painter.

getMinimumSize

public java.awt.Dimension getMinimumSize(PaintContext context)
Returns the minimum size of the AbstractBorderPainter.

In general, BorderPainters should not need to override this method, since it already accounts for the Border's insets.

Specified by:
getMinimumSize in interface Painter
Overrides:
getMinimumSize in class AbstractWrappingPainter
Parameters:
context - Context for determining the minimum size.

Returns:
The minimum size of the Painter.

getMaximumSize

public java.awt.Dimension getMaximumSize(PaintContext context)
Returns the maximum size of the AbstractBorderPainter.

In general, BorderPainters should not need to override this method, since it already accounts for the Border's insets.

Specified by:
getMaximumSize in interface Painter
Overrides:
getMaximumSize in class AbstractWrappingPainter
Parameters:
context - Context for determining the maximum size.

Returns:
The maximum size of the Painter.

paint

public final void paint(PaintContext context,
                        java.awt.Graphics g,
                        int x,
                        int y,
                        int width,
                        int height)
Paints the Painter wrapped by the AbstractBorderPainter with the AbstractBorderPainter painted around it. Subclassers that wish to override the way the border paints itself should override paintBorder rather than this method.

Painters that modify the Graphics context are responsible for returning it to its initial state when done painting. Further Painters that paint outside the bounds of x, y, width, and height are responsible for clipping themselves to the bounds.

Specified by:
paint in interface Painter
Overrides:
paint in class AbstractWrappingPainter
Parameters:
context - PaintContext to use when painting
g - Graphics context to use when painting
x - x coordinate to begin painting at
y - y coordinate to begin painting at
width - width of area to paint
height - height of area to paint

See Also:
paintBorder(oracle.cabo.image.painter.PaintContext, java.awt.Graphics, int, int, int, int)

getPainterAt

public final Painter getPainterAt(PaintContext context,
                                  int availableWidth,
                                  int availableHeight,
                                  int x,
                                  int y,
                                  Painter proxyPainter)
Returns the Painter inside this Painter at location x,y of the available size. If no Painter is at that location, this method returns null.

Specified by:
getPainterAt in interface Painter
Overrides:
getPainterAt in class AbstractWrappingPainter
Parameters:
context - Context for determining containership.
availableWidth - Amount of width available to the Painter.
availableHeight - Amount of height available to the Painter.
x - X location to test for containership in this Painter.
y - Y location to test for containership in this Painter.
proxyPainter - Painter to return instead of child painters

Returns:
The Painter at the specified loaction, or null if none.

getInsets

public final ImmInsets getInsets(PaintContext context)
Returns the insets of this stack of BorderPainters. Subclasses of AbstractBorderPainter that wish to modify the insets of their border should override getOwnInsets rather than this method.

Specified by:
getInsets in interface BorderPainter
Parameters:
context - PaintContext to use when getting the insets

Returns:
The insets of this stack of BorderPainters

See Also:
getOwnInsets(oracle.cabo.image.painter.PaintContext)

getFillInsets

public final ImmInsets getFillInsets(PaintContext context)
Returns the amount of space by which fills should be inset. By default, just returns getInsets().

Specified by:
getFillInsets in interface BorderPainter
Parameters:
context - the context for painting

getOwnInsets

protected ImmInsets getOwnInsets(PaintContext context)
Returns the insets of just this BorderPainter, as opposed to the entire nested stack of BorderPainters like getInsets does.

Parameters:
context - PaintContext to use when getting our own Insets

Returns:
The insets of just this BorderPainter.

See Also:
getInsets(oracle.cabo.image.painter.PaintContext)

getOwnFillInsets

protected ImmInsets getOwnFillInsets(PaintContext context)
Returns the amount of space by which fills should be inset for this BorderPainter. By default, returns this BorderPainter's insets.

Parameters:
context - the context for painting

See Also:
getFillInsets(oracle.cabo.image.painter.PaintContext)

paintBorder

protected void paintBorder(PaintContext context,
                           java.awt.Graphics g,
                           int x,
                           int y,
                           int width,
                           int height)
Paint just the border of the BorderPainter. Subclasses should override this method rather than paint when modifying the manner in which the border is painted

Painters that modify the Graphics context are responsible for returning it to its initial state when done painting. Further Painters that paint outside the bounds of x, y, width, and height or inside the area inset by their insets are responsible for clipping themselves.

Parameters:
context - PaintContext to use when painting the Border
g - Graphics context to use when painting
x - x coordinate to begin painting at
y - y coordinate to begin painting at
width - width of area to paint
height - height of area to paint

Returns:
The insets of just this BorderPainter.

See Also:
paint(oracle.cabo.image.painter.PaintContext, java.awt.Graphics, int, int, int, int)

isTransparent

public final boolean isTransparent(PaintContext context)
Returns whether the Painter is transparent. Subclasses must override isBorderTransparent to specify whether they themselves are transparent

Specified by:
isTransparent in interface Painter
Overrides:
isTransparent in class AbstractWrappingPainter
Parameters:
context - PaintContext to use when determining transparency.

Returns:
true if this Painter is transparent.

See Also:
isBorderTransparent(oracle.cabo.image.painter.PaintContext)

getContentPainterAt

protected Painter getContentPainterAt(PaintContext context,
                                      int availableWidth,
                                      int availableHeight,
                                      int x,
                                      int y,
                                      Painter proxyPainter)
Returns the Painter inside the ContentPainter at location x,y of the available size. If no Painter is at that location, this method returns null. This is the method that subclasses should override if they want to affect containership tests on the content.

Parameters:
context - Context for determining containership.
availableWidth - Amount of width available to the Painter.
availableHeight - Amount of height available to the Painter.
x - X location to test for containership in this Painter.
y - Y location to test for containership in this Painter.
proxyPainter - Painter to return instead of child painters

Returns:
The Painter at the specified loaction, or null if none.

#getPainterAt


getBorderPainterAt

protected Painter getBorderPainterAt(PaintContext context,
                                     int availableWidth,
                                     int availableHeight,
                                     int x,
                                     int y,
                                     Painter proxyPainter)
Returns the Painter inside the ContentPainter at location x,y of the available size. If no Painter is at that location, this method returns null. This is the method that subclasses should override if they want to affect containership tests on the border area of this painter.

Parameters:
context - Context for determining containership.
availableWidth - Amount of width available to the Painter.
availableHeight - Amount of height available to the Painter.
x - X location to test for containership in this Painter.
y - Y location to test for containership in this Painter.
proxyPainter - Painter to return instead of child painters

Returns:
The Painter at the specified loaction, or null if none.

See Also:
getPainterAt(oracle.cabo.image.painter.PaintContext, int, int, int, int, oracle.cabo.image.painter.Painter)

contentContains

public final boolean contentContains(PaintContext context,
                                     int availableWidth,
                                     int availableHeight,
                                     int x,
                                     int y)
Returns true if the specified x, y location is inside the content portion of the BorderPainter.

Parameters:
context - Context for determining containership.
availableWidth - Amount of width available to the Painter.
availableHeight - Amount of height available to the Painter.
x - X location to test for containership in this Painter.
y - Y location to test for containership in this Painter.

Returns:
True if the specified location is inside the content area of the borderPainter.

See Also:
Painter.contains(oracle.cabo.image.painter.PaintContext, int, int, int, int), getContentPainterAt(oracle.cabo.image.painter.PaintContext, int, int, int, int, oracle.cabo.image.painter.Painter)

borderContains

public final boolean borderContains(PaintContext context,
                                    int availableWidth,
                                    int availableHeight,
                                    int x,
                                    int y)
Returns true if the specified x, y location is inside the border portion of the BorderPainter.

Parameters:
context - Context for determining containership.
availableWidth - Amount of width available to the Painter.
availableHeight - Amount of height available to the Painter.
x - X location to test for containership in this Painter.
y - Y location to test for containership in this Painter.

Returns:
True if the specified location is inside the border area of the borderPainter.

See Also:
Painter.contains(oracle.cabo.image.painter.PaintContext, int, int, int, int), getBorderPainterAt(oracle.cabo.image.painter.PaintContext, int, int, int, int, oracle.cabo.image.painter.Painter)

isBorderTransparent

protected abstract boolean isBorderTransparent(PaintContext context)
Returns true if the border itself is transparent.

Parameters:
context - PaintContext to use when determining transparency.

Returns:
true if this BorderPainter is transparent.

See Also:
isTransparent(oracle.cabo.image.painter.PaintContext)

Oracle UIX API Reference
Release 2.1.22.0.0
B12196-01

Copyright © 2002,2003, Oracle. All Rights Reserved.