com.miginfocom.ashape.shapes
Class DividerAShape

java.lang.Object
  extended by com.miginfocom.ashape.shapes.AbstractAShape
      extended by com.miginfocom.ashape.shapes.DividerAShape
All Implemented Interfaces:
AShape, PropertyProvider

public class DividerAShape
extends AbstractAShape

A very simple shape that just acts as a rectangular divider with a certain thickness and paint. Note that it is still up to the container that contains this divider to give it the correct referencial bounds.


Field Summary
 
Fields inherited from class com.miginfocom.ashape.shapes.AbstractAShape
hitShape, RETURN_LIVE_ATTR_MAP, SIZE_CONV_MAP
 
Fields inherited from interface com.miginfocom.ashape.shapes.AShape
A_ALIGN_X, A_ALIGN_Y, A_ANTI_ALIAS, A_BORDER, A_CLIP_TYPE, A_COMPOSITE, A_CROP, A_CROP_TO_VISIBILITY_BOUNDS, A_FONT, A_HIT_AREA_Z, A_ICON, A_IMAGE, A_INHERIT, A_LAYOUT, A_MAXIMUM_HEIGHT, A_MAXIMUM_WIDTH, A_MINIMUM_HEIGHT, A_MINIMUM_WIDTH, A_MOUSE_CURSOR, A_PAINT, A_PAINT_LAYER, A_PLACE_RECT, A_PREFERRED_HEIGHT, A_PREFERRED_WIDTH, A_REPORT_HIT_AREA, A_SHADOW_TARGET_PAINT, A_SHAPE, A_SHAPES, A_STROKE, A_SUB_SHAPE_SORTER, A_TEXT, A_TEXTURE_PAINT_ANCHOR, A_UNDERLINE_HEIGHT, A_VISIBILITY, A_WRAPPED_ASHAPE, CLIP_PARENT_BOUNDS, CLIP_PARENT_SHAPE
 
Constructor Summary
DividerAShape()
          Empty constructor for XML builders.
DividerAShape(int orientation, java.lang.Integer size, java.awt.Paint paint)
          Constructor.
DividerAShape(java.awt.Paint paint)
          Constructor.
DividerAShape(PlaceRect placeRect, int orientation, java.lang.Integer size, java.awt.Paint paint)
          Constructor.
DividerAShape(PlaceRect placeRect, java.awt.Paint paint)
          Constructor.
 
Method Summary
 java.awt.Shape getHitBounds(boolean forceCalcualte)
          Returns the bounds that this attributed shape's actual content spans.
 java.awt.Dimension getNaturalSize()
          Returns the size that the shape finds most natural.
 java.awt.Shape paintShape(java.awt.Graphics2D g2, java.awt.Shape clip, java.awt.Rectangle visibilityRect)
          Paints this shape only.
 
Methods inherited from class com.miginfocom.ashape.shapes.AbstractAShape
addAttributes, addSubShape, addSubShape, addToHitShapeList, containsProperty, getAttribute, getAttributes, getClipShape, getDoubleAttribute, getFloatAttribute, getHitShape, getIntAttribute, getLayout, getLayoutSize, getLongAttribute, getModCount, getName, getPaintLayer, getParent, getProperty, getReferenceBounds, getRoot, getShapeBounds, getSubShapeDeep, getSubShapes, getSubShapesImpl, hasAttribute, increaseModCount, isRoot, isVisible, layout, paintBorder, paintSubTree, removeAttribute, removeSubShape, setAttribute, setAttributeDeep, setAttributes, setHitShape, setName, setParent, setReferenceBounds, setReferenceBounds, setSubShapes
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DividerAShape

public DividerAShape()
Empty constructor for XML builders.


DividerAShape

public DividerAShape(java.awt.Paint paint)
Constructor. Basically just fills the bounds it gets with the paint.

Parameters:
paint - The paint (Color is a paint) used to draw the shape. If null nothing will be painted but the divider will still occupy space.

DividerAShape

public DividerAShape(PlaceRect placeRect,
                     java.awt.Paint paint)
Constructor. Basically just fills the bounds, corrected with the place rect, it gets with the paint.

Parameters:
placeRect - A place rect to place the divider within the reference bounds it get.
paint - The paint (Color is a paint) used to draw the shape. If null nothing will be painted but the divider will still occupy space.

DividerAShape

public DividerAShape(int orientation,
                     java.lang.Integer size,
                     java.awt.Paint paint)
Constructor. Does not clone any of the objects sent in, the references is kept.

Parameters:
size - The absolute size that this shape will get. If null no layout sizes are forced.
paint - The paint (Color is a paint) used to draw the shape. If null nothing will be painted but the divider will still occupy space.

DividerAShape

public DividerAShape(PlaceRect placeRect,
                     int orientation,
                     java.lang.Integer size,
                     java.awt.Paint paint)
Constructor. Does not clone any of the objects sent in, the references is kept.

Parameters:
placeRect - A place rect to place the divider within the reference bounds it get.
orientation - SwingUtilities.HORIZONTAL (laying) or SwingUtilities.VERTICAL (standing)
size - The absolute size that this shape will get. If null no layout sizes are forced.
paint - The paint (Color is a paint) used to draw the shape. If null nothing will be painted but the divider will still occupy space.
Method Detail

paintShape

public java.awt.Shape paintShape(java.awt.Graphics2D g2,
                                 java.awt.Shape clip,
                                 java.awt.Rectangle visibilityRect)
Description copied from interface: AShape
Paints this shape only. Called by AShape.paintSubTree(java.awt.Graphics2D, java.awt.Shape, java.awt.Rectangle, Integer).

Parameters:
g2 - The object to draw in. Settings won't change. May be null in which case only the hit shape should be returned. This can be ued to get the layout size/shape.
clip - The shape to clip the graphics with. This shape is not already added to the clip if the Grahpics2D object sent in since this shape will also possible reduce the interaction area (hit area) that the shape presents. The Grahpics2D object's clip will not however since it may only be repainting a part of the shape. Can be null.
The difference to AShape.paintSubTree(java.awt.Graphics2D, java.awt.Shape, java.awt.Rectangle, java.lang.Integer)'s clip is that this clip should be obeyed blindly since paintAll has already filtered it depending on the values of attreibutes AShape.A_CROP_TO_VISIBILITY_BOUNDS and AShape.A_CLIP_TYPE.
visibilityRect - Possibly outlines what is the outer bounds that is visible to the user. This might be for instance the bounds of the component. May be null.
Returns:
The shape of the content spanned. null if nothing was spanned. The returned shape can be the one sent in as well as a privately used shape. Do not change this shape. The sub shapes of this shape will relate to this returned shape.
See Also:
AShape.A_CROP_TO_VISIBILITY_BOUNDS, AShape.A_CLIP_TYPE

getHitBounds

public java.awt.Shape getHitBounds(boolean forceCalcualte)
Description copied from interface: AShape
Returns the bounds that this attributed shape's actual content spans.

For instance for a TextAShape this is the text's exact bounds. Its shape's bounds is the container in which the text is positioned.

Note that the returned rectangle might be expensive to calculate and usually means that for instance a text shape must do much if its work twise (once when calling this, which is usually during layout, and once again during paint). Caching of the bounds should be possible for implementing classes.

Parameters:
forceCalcualte - If true the hit bounds will always be recaclulated and no caches used.
Returns:
A new Rectangle representing bounds that this attributed shape's actual content spans.

getNaturalSize

public java.awt.Dimension getNaturalSize()
Description copied from interface: AShape
Returns the size that the shape finds most natural. For instance an image shape would return the size of the image and a vector shape would return the bound's size of the Shape it has.

Returns:
The size or if indeteminable null.


Copyright © 2009 MiG InfoCom AB. All Rights Reserved.