UIX 2.2.15

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, CompositeButtonPainter, 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.


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
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 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.
java.awt.Dimension getPreferredSize(PaintContext context)
Returns the preferred size of the AbstractBorderPainter.
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
getWrappedPainter

Methods inherited from class oracle.cabo.image.painter.AbstractPainter
getData, getDataKey

Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

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.

Method Detail

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.

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)

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)

UIX 2.2.15