org.apache.poi.hslf.model
Class SimpleShape

java.lang.Object
  extended by org.apache.poi.hslf.model.Shape
      extended by org.apache.poi.hslf.model.SimpleShape
Direct Known Subclasses:
Line, Picture, TextShape

public abstract class SimpleShape
extends Shape

An abstract simple (non-group) shape. This is the parent class for all primitive shapes like Line, Rectangle, etc.

Author:
Yegor Kozlov

Field Summary
protected  EscherClientDataRecord _clientData
           
protected  Record[] _clientRecords
          Records stored in EscherClientDataRecord
static double DEFAULT_LINE_WIDTH
           
 
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
protected SimpleShape(EscherContainerRecord escherRecord, Shape parent)
          Create a SimpleShape object and initialize it from the supplied Record container.
 
Method Summary
protected  EscherContainerRecord createSpContainer(boolean isChild)
          Create a new Shape
 void draw(java.awt.Graphics2D graphics)
           
protected  Record getClientDataRecord(int recordType)
          Find a record in the underlying EscherClientDataRecord
protected  Record[] getClientRecords()
          Search for EscherClientDataRecord, if found, convert its contents into an array of HSLF records
 java.awt.Color getFillColor()
          The color used to fill this shape.
 boolean getFlipHorizontal()
          Whether the shape is horizontally flipped
 boolean getFlipVertical()
          Whether the shape is vertically flipped
 java.awt.Color getLineColor()
           
 int getLineDashing()
          Gets line dashing.
 int getLineStyle()
          Returns line style.
 double getLineWidth()
          Returns width of the line in in points
 java.awt.geom.Rectangle2D getLogicalAnchor2D()
           
 int getRotation()
          Rotation angle in degrees
 void setFillColor(java.awt.Color color)
          The color used to fill this shape.
 void setHyperlink(Hyperlink link)
           
 void setLineColor(java.awt.Color color)
          Sets the color of line
 void setLineDashing(int pen)
          Sets line dashing.
 void setLineStyle(int style)
          Sets line style.
 void setLineWidth(double width)
          Sets the width of line in in points
 void setRotation(int theta)
          Rotate this shape
protected  void updateClientData()
           
 
Methods inherited from class org.apache.poi.hslf.model.Shape
afterInsert, getAnchor, getAnchor2D, getEscherChild, getEscherProperty, getEscherProperty, getEscherProperty, getFill, getHyperlink, getOutline, getParent, getShapeId, getShapeName, getShapeType, 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
 

Field Detail

DEFAULT_LINE_WIDTH

public static final double DEFAULT_LINE_WIDTH
See Also:
Constant Field Values

_clientRecords

protected Record[] _clientRecords
Records stored in EscherClientDataRecord


_clientData

protected EscherClientDataRecord _clientData
Constructor Detail

SimpleShape

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

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

createSpContainer

protected EscherContainerRecord createSpContainer(boolean isChild)
Create a new Shape

Specified by:
createSpContainer in class Shape
Parameters:
isChild - true if the Line is inside a group, false otherwise
Returns:
the record container which holds this shape

getLineWidth

public double getLineWidth()
Returns width of the line in in points


setLineWidth

public void setLineWidth(double width)
Sets the width of line in in points

Parameters:
width - the width of line in in points

setLineColor

public void setLineColor(java.awt.Color color)
Sets the color of line

Parameters:
color - new color of the line

getLineColor

public java.awt.Color getLineColor()
Returns:
color of the line. If color is not set returns java.awt.Color.black

getLineDashing

public int getLineDashing()
Gets line dashing. One of the PEN_* constants defined in this class.

Returns:
dashing of the line.

setLineDashing

public void setLineDashing(int pen)
Sets line dashing. One of the PEN_* constants defined in this class.

Parameters:
pen - new style of the line.

setLineStyle

public void setLineStyle(int style)
Sets line style. One of the constants defined in this class.

Parameters:
style - new style of the line.

getLineStyle

public int getLineStyle()
Returns line style. One of the constants defined in this class.

Returns:
style of the line.

getFillColor

public java.awt.Color getFillColor()
The color used to fill this shape.


setFillColor

public void setFillColor(java.awt.Color color)
The color used to fill this shape.

Parameters:
color - the background color

getFlipHorizontal

public boolean getFlipHorizontal()
Whether the shape is horizontally flipped

Returns:
whether the shape is horizontally flipped

getFlipVertical

public boolean getFlipVertical()
Whether the shape is vertically flipped

Returns:
whether the shape is vertically flipped

getRotation

public int getRotation()
Rotation angle in degrees

Returns:
rotation angle in degrees

setRotation

public void setRotation(int theta)
Rotate this shape

Parameters:
theta - the rotation angle in degrees

getLogicalAnchor2D

public java.awt.geom.Rectangle2D getLogicalAnchor2D()
Overrides:
getLogicalAnchor2D in class Shape
Returns:
'absolute' anchor of this shape relative to the parent sheet

draw

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

getClientDataRecord

protected Record getClientDataRecord(int recordType)
Find a record in the underlying EscherClientDataRecord

Parameters:
recordType - type of the record to search

getClientRecords

protected Record[] getClientRecords()
Search for EscherClientDataRecord, if found, convert its contents into an array of HSLF records

Returns:
an array of HSLF records contained in the shape's EscherClientDataRecord or null

updateClientData

protected void updateClientData()

setHyperlink

public void setHyperlink(Hyperlink link)


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