com.miginfocom.ashape.shapes
Interface AShape

All Superinterfaces:
PropertyProvider
All Known Implementing Classes:
AbstractAShape, ContainerAShape, DividerAShape, DrawAShape, FeatherAShape, FillAShape, FilterAShape, FittingTextAShape, ImageAShape, JComponentAShape, RootAShape, SlicedImageAShape, TextAShape, VectorAShape

public interface AShape
extends PropertyProvider

Th interface that describe an AShape. For inforamtion about AShapes (the framework) see the AShape Developer's Manual.


Field Summary
static PropertyKey A_ALIGN_X
          Value type: AtRefRangeNumber.
static PropertyKey A_ALIGN_Y
          Value type: AtRefRangeNumber.
static PropertyKey A_ANTI_ALIAS
          Value type: Integer.
static PropertyKey A_BORDER
          Value type: Border.
static PropertyKey A_CLIP_TYPE
          Value type: String.
static PropertyKey A_COMPOSITE
          Value type: Composite or null.
static PropertyKey A_CROP
          Value type: Insets.
static PropertyKey A_CROP_TO_VISIBILITY_BOUNDS
          Value type: Boolean or String.
static PropertyKey A_FONT
          Value type: Font.
static PropertyKey A_HIT_AREA_Z
          Value type: Integer or null.
static PropertyKey A_ICON
          Value type: Icon.
static PropertyKey A_IMAGE
          Value type: Image.
static java.lang.Object A_INHERIT
          A special marker object that tells the attribute lookup algorithm to use the parents attribute value for this attribute.
static PropertyKey A_LAYOUT
          Value type: AShapeLayout.
static PropertyKey A_MAXIMUM_HEIGHT
          Value type: Integer or null.
static PropertyKey A_MAXIMUM_WIDTH
          Value type: Integer or null.
static PropertyKey A_MINIMUM_HEIGHT
          Value type: Integer or null.
static PropertyKey A_MINIMUM_WIDTH
          Value type: Integer or null.
static PropertyKey A_MOUSE_CURSOR
          Value type: Cursor, String, Integer or null.
static PropertyKey A_PAINT
          Value type: Paint.
static PropertyKey A_PAINT_LAYER
          Value type: Integer or null, where null means level 0 (default).
static PropertyKey A_PLACE_RECT
          Value type: AbsRect.
static PropertyKey A_PREFERRED_HEIGHT
          Value type: Integer or null.
static PropertyKey A_PREFERRED_WIDTH
          Value type: Integer or null.
static PropertyKey A_REPORT_HIT_AREA
          Value type: Boolean, String or null.
static PropertyKey A_SHADOW_TARGET_PAINT
          Value type: Paint.
static PropertyKey A_SHAPE
          Value type: Shape.
static PropertyKey A_SHAPES
          Value type: Shape[].
static PropertyKey A_STROKE
          Value type: Stroke.
static PropertyKey A_SUB_SHAPE_SORTER
          Value type: Comparator or null.
static PropertyKey A_TEXT
          Value type: String.
static PropertyKey A_TEXTURE_PAINT_ANCHOR
          Value type: AbsRect.
static PropertyKey A_UNDERLINE_HEIGHT
          Value type: Integer.
static PropertyKey A_VISIBILITY
          Value type: Visibility, which includes SizeRangeVisibility.
static PropertyKey A_WRAPPED_ASHAPE
          Value Type: AShape.
static java.lang.String CLIP_PARENT_BOUNDS
          Clipping hint.
static java.lang.String CLIP_PARENT_SHAPE
          Clipping hint.
 
Method Summary
 void addSubShape(AShape aShape)
          Add a shape to this shape as a sub-shape
 void addSubShape(AShape aShape, int index)
          Add a shape to this shape as a sub-shape at index-
 java.lang.Object getAttribute(PropertyKey key)
          Returns an attribute.
 java.awt.Shape getHitBounds(boolean forceCalculate)
          Returns the bounds that this attributed shape's actual content spans.
 java.lang.Integer getLayoutSize(int type, int dim, java.lang.Integer otherDimSizeHint)
          Returns the min, max or preferred size in the horizontal or vertical dimension.
 int getModCount()
          How many time the shape has been changed.
 java.lang.String getName()
          Returns the name for this shape.
 java.awt.Dimension getNaturalSize()
          Returns the size that the shape finds most natural.
 java.lang.Integer getPaintLayer()
          Returns the attribute value for A_PAINT_LAYER but exchanges null for Integer(0).
 AShape getParent()
          Returns the current parent.
 java.lang.Object getProperty(PropertyKey key)
          This is a method that should be dispatched to getAttribute(PropertyKey).
 java.awt.Rectangle getReferenceBounds()
          Returns the bounds set with setReferenceBounds(java.awt.Rectangle).
 RootAShape getRoot()
          Returns the root shape or null if the top of the tree isn't a RootAShape.
 java.awt.Rectangle getShapeBounds()
          Returns the bounds that this attributed shape would span using the current bounds.
 AShape getSubShapeDeep(java.lang.String name)
          Traverses the tree of shapes and returns the first one with the name name.
 AShape[] getSubShapes()
          Returns the live array of sub shapes.
 boolean hasAttribute(PropertyKey key)
          Returns if the attribute exists and has a mapping.
 void increaseModCount()
          Increases the modecount which noramlly invalidates any caches.
 boolean isVisible()
          Returns if THIS shape is visible.
 void layout()
          Lays out the children, if any bu calling setBounds() on them and then call .layout().
Layout also clears the 'hit shape'.
 java.awt.Shape paintShape(java.awt.Graphics2D g2, java.awt.Shape clip, java.awt.Rectangle visibilityRect)
          Paints this shape only.
 void paintSubTree(java.awt.Graphics2D g2, java.awt.Shape clip, java.awt.Rectangle visBounds, java.lang.Integer layer)
          Paints the shape, if it it visible, and then the sub shapes with the appropriate clip.
 void removeAttribute(PropertyKey key)
          Removes a attribute if it exist.
 void removeSubShape(AShape attributedShape)
          removes a sub-shape if it exist.
 void setAttribute(PropertyKey key, java.lang.Object value)
          Sets a attribute object.
 void setAttributeDeep(PropertyKey key, java.lang.Object value, int maxLevels)
          Convenience method for setting an attributeon this shape and recursively down the sub shape tree.
 void setName(java.lang.String name)
          Sets the name.
 void setParent(AShape parent)
          Sets the parent shape.
 void setReferenceBounds(int x, int y, int w, int h)
          Sets the bounds that this shape should relate to with it's (AbsRect) placeRect.
 void setReferenceBounds(java.awt.Rectangle bounds)
          Sets the bounds that this shape should relate to with it's (AbsRect) placeRect.
 
Methods inherited from interface com.miginfocom.util.PropertyProvider
containsProperty
 

Field Detail

A_INHERIT

static final java.lang.Object A_INHERIT
A special marker object that tells the attribute lookup algorithm to use the parents attribute value for this attribute. Not that normally this object can't be specified directly in the constructor since it won't match types.
Uses shape.setAttribute(A_xxxx, AShape.A_INHERIT); instead, setting any value (null?) in the construcor.


A_LAYOUT

static final PropertyKey A_LAYOUT
Value type: AShapeLayout.

The layout manager for the internals of the shape. If null a default layout manager will be used. E.g. DefaultAShapeLayout.


A_PAINT

static final PropertyKey A_PAINT
Value type: Paint.

The paint for the shape.


A_TEXTURE_PAINT_ANCHOR

static final PropertyKey A_TEXTURE_PAINT_ANCHOR
Value type: AbsRect.

If A_PAINT is a TexturePaint the anchor can be changed with this attribute. null will just paint it without intervention. A AbsRect can be specified to produce a rectangle that overrides the anchor in the texture paint.


A_SHAPE

static final PropertyKey A_SHAPE
Value type: Shape.

The actual Shape contained in the AShape. If A_SHAPES are null than this is the main shape, if not this is the "paper" that outlines the coordinate system and will not actually be draw/painted.


A_SHAPES

static final PropertyKey A_SHAPES
Value type: Shape[].

Shapes that are defined in the same coordinate systems a A_SHAPE. The will all be drawn/painted with the same properties (E.g. paint, stroke and such).


A_ANTI_ALIAS

static final PropertyKey A_ANTI_ALIAS
Value type: Integer. Representing the GfxUtil.AA_HINT_xxx. null is same as GfxUtil.AA_HINT_INHERIT.

E.g. GfxUtil.AA_HINT_ON


A_STROKE

static final PropertyKey A_STROKE
Value type: Stroke.

The stroke to use for drawing the shape.


A_UNDERLINE_HEIGHT

static final PropertyKey A_UNDERLINE_HEIGHT
Value type: Integer.

The underline width for underlining the text in a text shape. null means no underline.


A_IMAGE

static final PropertyKey A_IMAGE
Value type: Image.

The image to draw in an image oriented shape.


A_ICON

static final PropertyKey A_ICON
Value type: Icon.

The icon to draw in an icon/image oriented shape.


A_TEXT

static final PropertyKey A_TEXT
Value type: String.

The text to paint in the shape. Can be a template text.


A_FONT

static final PropertyKey A_FONT
Value type: Font.

The font used for the shape.


A_BORDER

static final PropertyKey A_BORDER
Value type: Border.

The border painted around the shape. Will not reduce the size and will be painted last (on top).


A_PLACE_RECT

static final PropertyKey A_PLACE_RECT
Value type: AbsRect.

Where to be relative to the parent shape. Can be null and then the interpretation of the placement is up to the implementation.


A_ALIGN_X

static final PropertyKey A_ALIGN_X
Value type: AtRefRangeNumber.

The horizontal/length wise alignment.

See Also:
AtRefRangeNumber, AtStart, AtEnd, AtFraction

A_ALIGN_Y

static final PropertyKey A_ALIGN_Y
Value type: AtRefRangeNumber.

The vertical/height wise alignment.

See Also:
AtRefRangeNumber, AtStart, AtEnd, AtFraction

A_CROP

static final PropertyKey A_CROP
Value type: Insets.

A clip to crop of edges of a shape. The crop can for instance make a toombstone-like shape of a RoundRectangle. The cropping is made in the painting coordinate system, which usually means pixels. If cropping in the shape's coordinates system, consider using the methods in Area instead. Note that for instance cropping of the bottom part can be made relative to the bottom OR the top depending on the sign of the value sent in. See GfxUtil.cropRect(java.awt.Rectangle, java.awt.Insets) for further details.


A_WRAPPED_ASHAPE

static final PropertyKey A_WRAPPED_ASHAPE
Value Type: AShape.

Contained in this shape. For use by filter shapes that actually filters other shapes. For instance FilterAShape.


A_SHADOW_TARGET_PAINT

static final PropertyKey A_SHADOW_TARGET_PAINT
Value type: Paint.

The paint to which the shadow will be blurred to. Normally new Color(255, 255, 255, 0). which means towards transparent white.


A_VISIBILITY

static final PropertyKey A_VISIBILITY
Value type: Visibility, which includes SizeRangeVisibility.

The constraint that decides if the shape should be visible or not. null means always visible. Can be set to Visibility.FALSE or Visibility.TRUE for instance.

Implement Visibility with a concrete implementation to make more dynamic resize behaviour, depending of the bounds or some property for instance.

If a shape is not visible, neither will its sub shapes.


A_CROP_TO_VISIBILITY_BOUNDS

static final PropertyKey A_CROP_TO_VISIBILITY_BOUNDS
Value type: Boolean or String.

true means that the shape should crop the shape using the visiblityRect.
This can be useful for instance if you want to always center text on the visible part of a rectangle and the rectangle is sometimes painted outside the visible bounds.

Note! This is done in the paint cycle, right before this shape is painted, and will thus not affect any shapes but this one. It will for instance not affect any sub shapes or sibling shapes. The AShape subclasses need specific support for this property to work. Currently this is in TextAShape and ImageAShape.


A_CLIP_TYPE

static final PropertyKey A_CLIP_TYPE
Value type: String. null means that there will be no clipping. I.e. the shape is free to paint itself to whatever bounds it like. Values are CLIP_PARENT_BOUNDS and CLIP_PARENT_SHAPE
Note that the parent attributed shape must be in the same layer to be able to be used as a clip.

See Also:
CLIP_PARENT_BOUNDS, CLIP_PARENT_SHAPE, A_PAINT_LAYER

A_HIT_AREA_Z

static final PropertyKey A_HIT_AREA_Z
Value type: Integer or null. If non-null manually sets the z-level at which the registered hitareas is registered in the MouseKeyInteractor.

Leaving this to null sorts the hit areas in the order that they are painted, which means their visual appearence on screen.


A_PAINT_LAYER

static final PropertyKey A_PAINT_LAYER
Value type: Integer or null, where null means level 0 (default). Layer with lower number will be painted first. In every layer the hierarchy is traversed depth first (like the row number in a fully expanded JTree) and painted.
AttributedShapes are painted in layers, but the layout will always happend before the first layer is beeing painted, and layout is not layered.


A_PREFERRED_WIDTH

static final PropertyKey A_PREFERRED_WIDTH
Value type: Integer or null. The preferred width.

This value is normally only used by layouts. E.g. RowAShapeLayout.

See Also:
getLayoutSize(int, int, Integer)

A_PREFERRED_HEIGHT

static final PropertyKey A_PREFERRED_HEIGHT
Value type: Integer or null. The preferred height.

This value is normally only used by layouts. E.g. RowAShapeLayout.

See Also:
getLayoutSize(int, int, Integer)

A_MINIMUM_WIDTH

static final PropertyKey A_MINIMUM_WIDTH
Value type: Integer or null. The minimum width.

This value is normally only used by layouts. E.g. RowAShapeLayout.

See Also:
getLayoutSize(int, int, Integer)

A_MINIMUM_HEIGHT

static final PropertyKey A_MINIMUM_HEIGHT
Value type: Integer or null. The minimum height.

This value is normally only used by layouts. E.g. RowAShapeLayout.

See Also:
getLayoutSize(int, int, Integer)

A_MAXIMUM_WIDTH

static final PropertyKey A_MAXIMUM_WIDTH
Value type: Integer or null. The maximum width.

This value is normally only used by layouts. E.g. RowAShapeLayout.

See Also:
getLayoutSize(int, int, Integer)

A_MAXIMUM_HEIGHT

static final PropertyKey A_MAXIMUM_HEIGHT
Value type: Integer or null. The maximum height.

This value is normally only used by layouts. E.g. RowAShapeLayout.

See Also:
getLayoutSize(int, int, Integer)

A_SUB_SHAPE_SORTER

static final PropertyKey A_SUB_SHAPE_SORTER
Value type: Comparator or null.

If != null the sub shapes (direct children) will be temporarily resorted before usage. This may be used to temporarily change the paint / event ordering, such as for a tabbed shape (like JTabbedPane that has one tab first.

Note that moving to last will make it show on top.

See Also:
FirstOrLastComparator

A_REPORT_HIT_AREA

static final PropertyKey A_REPORT_HIT_AREA
Value type: Boolean, String or null.

Only if evaluated to true will a hit shape be reported. If not (default) no mouse interaction can exist for this shape since no hit shape area is being reported.

Note! If not set to true no mouse interactions will be possible!

See Also:
AbstractAShape.getHitShape(), MigUtil.isTrue(java.lang.Object)

A_MOUSE_CURSOR

static final PropertyKey A_MOUSE_CURSOR
Value type: Cursor, String, Integer or null.

Contains the cursor for this shape.

Note! The shape will not set the cursor, it is just a data holder to be read by some interaction object that can set it on the JComponent.

A_REPORT_HIT_SHAPE will have to be set to Boolean.TRUE so that the shape reports it's hit area. Otherwise there will be no way to know what shape bounds this shape has.

Note! You will have to call AShapeUtil.enableMouseOverCursor(rootAShape); as well to enable cursor switches.

See Also:
A_REPORT_HIT_AREA, AShapeUtil.enableMouseOverCursor(RootAShape)

A_COMPOSITE

static final PropertyKey A_COMPOSITE
Value type: Composite or null.

The Composite used for painting this shape and all sub shapes (unless they specify a Composite of their own). null means to inherite the composite from the parent shape.

This property can for instance be used to paint the whole AShape translucent (partly transparent). See AlphaComposite.


CLIP_PARENT_BOUNDS

static final java.lang.String CLIP_PARENT_BOUNDS
Clipping hint. Clips by the rectangular bounds of the shape that the parent sends down as a clip.

See Also:
A_CLIP_TYPE, Constant Field Values

CLIP_PARENT_SHAPE

static final java.lang.String CLIP_PARENT_SHAPE
Clipping hint. Clips exactly to the shape that the parent sends down as a clip when painting. NOTE that this can be very slow since clipping is done in software without hardware support currently. (JRE 1.4.2 and JRE 5.0)

See Also:
A_CLIP_TYPE, Constant Field Values
Method Detail

getModCount

int getModCount()
How many time the shape has been changed. May be used to validate caches.

Returns:
How many time the shape has been changed

increaseModCount

void increaseModCount()
Increases the modecount which noramlly invalidates any caches. All operations in the implementing classes that change anything that affects something should call this method.


paintSubTree

void paintSubTree(java.awt.Graphics2D g2,
                  java.awt.Shape clip,
                  java.awt.Rectangle visBounds,
                  java.lang.Integer layer)
Paints the shape, if it it visible, and then the sub shapes with the appropriate clip. This method should normally not be called by client code.

Parameters:
g2 - The object to draw in. Settings won't change
clip - The shape to clip the graphics with. This shape is not already added to the clip in the Grahpics2D object sent in since this shape will also possibly 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.
visBounds - The bounds of the container that holds this shape. Used for determining the "visual" bounds to, for instance, move text within these bounds in certain cases. Can be null.
layer - The level that is currently being painted. May be null. Only shapes in this level should paint themselves.
See Also:
A_CROP_TO_VISIBILITY_BOUNDS, A_CLIP_TYPE, A_PAINT_LAYER

paintShape

java.awt.Shape paintShape(java.awt.Graphics2D g2,
                          java.awt.Shape clip,
                          java.awt.Rectangle visibilityRect)
Paints this shape only. Called by 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 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 A_CROP_TO_VISIBILITY_BOUNDS and 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:
A_CROP_TO_VISIBILITY_BOUNDS, A_CLIP_TYPE

getName

java.lang.String getName()
Returns the name for this shape.

Returns:
The name for this shape. Not null !

setName

void setName(java.lang.String name)
Sets the name.

Parameters:
name - The name. Not null !

addSubShape

void addSubShape(AShape aShape)
Add a shape to this shape as a sub-shape

Parameters:
aShape - The AShape to add

addSubShape

void addSubShape(AShape aShape,
                 int index)
Add a shape to this shape as a sub-shape at index-

Parameters:
aShape - The AShape to add
index - The index to add. If larger than array it will always be added last.

removeSubShape

void removeSubShape(AShape attributedShape)
removes a sub-shape if it exist.

Parameters:
attributedShape - The shape to remove

getSubShapes

AShape[] getSubShapes()
Returns the live array of sub shapes. Should not be changed.

Returns:
The live array of sub shapes. Not null.

getSubShapeDeep

AShape getSubShapeDeep(java.lang.String name)
Traverses the tree of shapes and returns the first one with the name name.

Parameters:
name - The name.
Returns:
The first found or null if name was not found.

getShapeBounds

java.awt.Rectangle getShapeBounds()
Returns the bounds that this attributed shape would span using the current bounds.

Basically bounds is transformed though the contained AbsRect.

Note that this can be an expensive call for certain attributed shape types.

Returns:
A new Rectangle representing the bounds or null if, for any reason, the shape can't or wont paint itself within these bounds.

getHitBounds

java.awt.Shape getHitBounds(boolean forceCalculate)
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.

setReferenceBounds

void setReferenceBounds(java.awt.Rectangle bounds)
Sets the bounds that this shape should relate to with it's (AbsRect) placeRect.

Parameters:
bounds - The bounds. Not null. The object's values are copied and the reference is not kept.

setReferenceBounds

void setReferenceBounds(int x,
                        int y,
                        int w,
                        int h)
Sets the bounds that this shape should relate to with it's (AbsRect) placeRect.

Parameters:
x - X
y - Y
w - Width
h - Height

getReferenceBounds

java.awt.Rectangle getReferenceBounds()
Returns the bounds set with setReferenceBounds(java.awt.Rectangle). Note that this is just the "relative bounds", the real on-screen shape bounds can be retrieved with getShapeBounds().

READ_ONLY! Not cloned since this might be read thousands of times per frame.

Returns:
The contained bounds object, to avoid object creation, so it's read-only or stange bugs will appear.

getNaturalSize

java.awt.Dimension getNaturalSize()
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.

getLayoutSize

java.lang.Integer getLayoutSize(int type,
                                int dim,
                                java.lang.Integer otherDimSizeHint)
Returns the min, max or preferred size in the horizontal or vertical dimension. For instance a text shape would want to have a reference width to be able to calculate the preferred height. Also usable for shapes that want's to maintain some static aspect ratio or span a certain area.
This information is normally used by a AShapeLayout.
If no layout size is available for the shape, or any of its sub shape, and the preferred size is asked for, the natural size (for instance via getNaturalSize()) of the shape may be returned.

Parameters:
type - The type of size to get. E.g. Distributor.MIN
dim - The dimension for which to return the layout size. E.g. SwingConstants.VERTICAL.
otherDimSizeHint - If the width/height layout size is interconnected is any way and the size in that other dimension is known already, that size if entered here.
Returns:
The size or null if there was no preference by any of the sub shapes.
See Also:
A_PREFERRED_WIDTH

layout

void layout()
Lays out the children, if any bu calling setBounds() on them and then call .layout().
Layout also clears the 'hit shape'. The hit shape is set again when the shape is painted, which normally happens right after it is laid out.


getAttribute

java.lang.Object getAttribute(PropertyKey key)
Returns an attribute. The current Interactors are first asked whether it has an override for this attribute, and of so, returns that object.

Parameters:
key - The key/name that it was stored under. E.g. A_PAINT, but can be anything.
Returns:
The object. null if null is stored or key doesn't exist.

getProperty

java.lang.Object getProperty(PropertyKey key)
This is a method that should be dispatched to getAttribute(PropertyKey). It is called getProperty only to satisfy the interface PropertyProvider.

Specified by:
getProperty in interface PropertyProvider
Parameters:
key - The key/name that it was stored under. E.g. A_FONT but can be anything.
Returns:
The object. null if null is stored or key doesn't exist.
See Also:
getAttribute(PropertyKey)

setAttribute

void setAttribute(PropertyKey key,
                  java.lang.Object value)
Sets a attribute object.

Parameters:
key - The key/name that it is to be stored under. E.g. A_PAINT
value - The value to store.

setAttributeDeep

void setAttributeDeep(PropertyKey key,
                      java.lang.Object value,
                      int maxLevels)
Convenience method for setting an attributeon this shape and recursively down the sub shape tree.

Parameters:
key - The key/name that it is to be stored under. E.g. A_PAINT
value - The value to store.
maxLevels - Only recursively add to this level. 1 will only add to this shape's sub subshapes.

removeAttribute

void removeAttribute(PropertyKey key)
Removes a attribute if it exist.

Parameters:
key - The key/name that it was stored under. E.g. A_PAINT

hasAttribute

boolean hasAttribute(PropertyKey key)
Returns if the attribute exists and has a mapping. Note that is can still be null.

Parameters:
key - The key/name that is to be tested. E.g. A_PAINT
Returns:
If the attribute exists

getParent

AShape getParent()
Returns the current parent.

Returns:
The current parent. null for root parent.

setParent

void setParent(AShape parent)
Sets the parent shape. Handled automatically for added subshapes.

Parameters:
parent - The parent. The root shape has a null parent.

getRoot

RootAShape getRoot()
Returns the root shape or null if the top of the tree isn't a RootAShape. Iterates every time.

Returns:
The root shape or this if the top of the tree isn't a RootAShape.

getPaintLayer

java.lang.Integer getPaintLayer()
Returns the attribute value for A_PAINT_LAYER but exchanges null for Integer(0).

Returns:
The paint layer for this shape. Not null.

isVisible

boolean isVisible()
Returns if THIS shape is visible. Doesn't take parent's visibility into acount. If A_VISIBILITY is non-null that value will be returned. If null true will be returned.
The bounds should be correct before calling this methid since the bounds might be a criteria on which to decide.

Returns:
If THIS shape is visible or not, not checking the parent shape.


Copyright © 2009 MiG InfoCom AB. All Rights Reserved.