org.apache.poi.hslf.model
Class ShapeGroup

java.lang.Object
  extended by org.apache.poi.hslf.model.Shape
      extended by org.apache.poi.hslf.model.ShapeGroup
Direct Known Subclasses:
Table

public class ShapeGroup
extends Shape

Represents a group of shapes.

Author:
Yegor Kozlov

Field Summary
 
Fields inherited from class org.apache.poi.hslf.model.Shape
_escherContainer, _fill, _parent, _sheet, EMU_PER_CENTIMETER, EMU_PER_INCH, EMU_PER_POINT, logger, MASTER_DPI, PIXEL_DPI, POINT_DPI
 
Constructor Summary
  ShapeGroup()
          Create a new ShapeGroup.
protected ShapeGroup(EscherContainerRecord escherRecord, Shape parent)
          Create a ShapeGroup object and initilize it from the supplied Record container.
 
Method Summary
 void addShape(Shape shape)
          Add a shape to this group.
protected  EscherContainerRecord createSpContainer(boolean isChild)
          Create a new ShapeGroup and create an instance of EscherSpgrContainer which represents a group of shapes
 void draw(java.awt.Graphics2D graphics)
           
 java.awt.geom.Rectangle2D getAnchor2D()
          Returns the anchor (the bounding box rectangle) of this shape group.
 java.awt.geom.Rectangle2D getCoordinates()
          Gets the coordinate space of this group.
 Hyperlink getHyperlink()
          Returns null - shape groups can't have hyperlinks
 Shape[] getShapes()
           
 int getShapeType()
          Return type of the shape.
 void moveTo(int x, int y)
          Moves this ShapeGroup to the specified location.
 void setAnchor(java.awt.Rectangle anchor)
          Sets the anchor (the bounding box rectangle) of this shape.
 void setCoordinates(java.awt.geom.Rectangle2D anchor)
          Sets the coordinate space of this group.
 
Methods inherited from class org.apache.poi.hslf.model.Shape
afterInsert, getAnchor, getEscherChild, getEscherProperty, getEscherProperty, getEscherProperty, getFill, getLogicalAnchor2D, getOutline, getParent, getShapeId, getShapeName, getSheet, getSpContainer, moveTo, setAnchor, setEscherProperty, setEscherProperty, setShapeId, setShapeType, setSheet
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ShapeGroup

public ShapeGroup()
Create a new ShapeGroup. This constructor is used when a new shape is created.


ShapeGroup

protected ShapeGroup(EscherContainerRecord escherRecord,
                     Shape parent)
Create a ShapeGroup object and initilize it from the supplied Record container.

Parameters:
escherRecord - EscherSpContainer container which holds information about this shape
parent - the parent of the shape
Method Detail

getShapes

public Shape[] getShapes()
Returns:
the shapes contained in this group container

setAnchor

public void setAnchor(java.awt.Rectangle anchor)
Sets the anchor (the bounding box rectangle) of this shape. All coordinates should be expressed in Master units (576 dpi).

Parameters:
anchor - new anchor

setCoordinates

public void setCoordinates(java.awt.geom.Rectangle2D anchor)
Sets the coordinate space of this group. All children are constrained to these coordinates.

Parameters:
anchor - the coordinate space of this group

getCoordinates

public java.awt.geom.Rectangle2D getCoordinates()
Gets the coordinate space of this group. All children are constrained to these coordinates.

Returns:
the coordinate space of this group

createSpContainer

protected EscherContainerRecord createSpContainer(boolean isChild)
Create a new ShapeGroup and create an instance of EscherSpgrContainer which represents a group of shapes

Specified by:
createSpContainer in class Shape

addShape

public void addShape(Shape shape)
Add a shape to this group.

Parameters:
shape - - the Shape to add

moveTo

public void moveTo(int x,
                   int y)
Moves this ShapeGroup to the specified location.

Parameters:
x - the x coordinate of the top left corner of the shape in new location
y - the y coordinate of the top left corner of the shape in new location

getAnchor2D

public java.awt.geom.Rectangle2D getAnchor2D()
Returns the anchor (the bounding box rectangle) of this shape group. All coordinates are expressed in points (72 dpi).

Overrides:
getAnchor2D in class Shape
Returns:
the anchor of this shape group

getShapeType

public int getShapeType()
Return type of the shape. In most cases shape group type is ShapeTypes.NotPrimitive

Overrides:
getShapeType in class Shape
Returns:
type of the shape.
See Also:
RecordTypes

getHyperlink

public Hyperlink getHyperlink()
Returns null - shape groups can't have hyperlinks

Overrides:
getHyperlink in class Shape
Returns:
null.

draw

public void draw(java.awt.Graphics2D graphics)
Overrides:
draw in class Shape


Copyright 2012 The Apache Software Foundation or its licensors, as applicable.