com.miginfocom.ashape.shapes
Class ContainerAShape

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

public class ContainerAShape
extends AbstractAShape

A shape that does nothing except hold other shapes and spans an area.

The following attibutes is currently used by this shape:
AShape.A_PLACE_RECT
AShape.A_CROP_TO_VISIBILITY_BOUNDS
Note that any attributes used by AbstractAShape will also be adhered to.


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
ContainerAShape()
          Empty constructor for XML builders.
ContainerAShape(java.lang.String name, PlaceRect placeRect)
          Constructor.
ContainerAShape(java.lang.String name, PlaceRect placeRect, AShapeLayout layout)
          Constructor.
 
Method Summary
 java.awt.Shape getHitBounds(boolean forceCalculate)
          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 visRect)
          Layout itself with the place rect, possibly cut it with AShape.A_CROP_TO_VISIBILITY_BOUNDS and adds the resulting rectangle to AbstractAShape.setHitShape(java.awt.Shape, java.awt.Shape).
 
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

ContainerAShape

public ContainerAShape()
Empty constructor for XML builders.


ContainerAShape

public ContainerAShape(java.lang.String name,
                       PlaceRect placeRect)
Constructor.

Parameters:
name - The name (ID) of this shape.
placeRect - How this shape relates to the reference bounds given. May be null.

ContainerAShape

public ContainerAShape(java.lang.String name,
                       PlaceRect placeRect,
                       AShapeLayout layout)
Constructor.

Parameters:
name - The name (ID) of this shape.
placeRect - How this shape relates to the reference bounds given. May be null.
layout - The layout used to layout this container.
Method Detail

paintShape

public java.awt.Shape paintShape(java.awt.Graphics2D g2,
                                 java.awt.Shape clip,
                                 java.awt.Rectangle visRect)
Layout itself with the place rect, possibly cut it with AShape.A_CROP_TO_VISIBILITY_BOUNDS and adds the resulting rectangle to AbstractAShape.setHitShape(java.awt.Shape, java.awt.Shape).

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.
visRect - 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 forceCalculate)
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:
forceCalculate - 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.