org.apache.poi.hslf.usermodel
Class HSLFSimpleShape

java.lang.Object
  extended by org.apache.poi.hslf.usermodel.HSLFShape
      extended by org.apache.poi.hslf.usermodel.HSLFSimpleShape
All Implemented Interfaces:
IAdjustableShape, PlaceableShape<HSLFShape,HSLFTextParagraph>, Shape<HSLFShape,HSLFTextParagraph>, SimpleShape<HSLFShape,HSLFTextParagraph>
Direct Known Subclasses:
HSLFConnectorShape, HSLFPictureShape, HSLFTextShape

public abstract class HSLFSimpleShape
extends HSLFShape
implements SimpleShape<HSLFShape,HSLFTextParagraph>

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.usermodel.HSLFShape
_escherContainer, _fill, _parent, _sheet, logger
 
Constructor Summary
protected HSLFSimpleShape(EscherContainerRecord escherRecord, ShapeContainer<HSLFShape,HSLFTextParagraph> parent)
          Create a SimpleShape object and initialize it from the supplied Record container.
 
Method Summary
protected  EscherContainerRecord createSpContainer(boolean isChild)
          Create a new Shape
 Guide getAdjustValue(java.lang.String name)
           
protected
<T extends Record>
T
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.
 CustomGeometry getGeometry()
           
 java.awt.Color getLineColor()
           
 StrokeStyle.LineCompound getLineCompound()
          Gets the line compound style
 StrokeStyle.LineDash getLineDashing()
          Gets line dashing.
 LineDecoration getLineDecoration()
           
 double getLineWidth()
          Returns width of the line in in points
 Shadow<HSLFShape,HSLFTextParagraph> getShadow()
           
 double getShadowAngle()
           
 java.awt.Color getShadowColor()
           
 double getShadowDistance()
           
 StrokeStyle getStrokeStyle()
          Returns line style.
 void setFillColor(java.awt.Color color)
          The color used to fill this shape.
 void setHyperlink(HSLFHyperlink link)
           
 void setLineColor(java.awt.Color color)
          Sets the color of line
 void setLineCompound(StrokeStyle.LineCompound style)
          Sets the line compound style
 void setLineDashing(StrokeStyle.LineDash pen)
          Sets line dashing.
 void setLineWidth(double width)
          Sets the width of line in in points
protected  void updateClientData()
           
 
Methods inherited from class org.apache.poi.hslf.usermodel.HSLFShape
afterInsert, draw, getAnchor, getEscherChild, getEscherChild, getEscherOptRecord, getEscherProperty, getEscherProperty, getEscherProperty, getFill, getFillStyle, getFlipHorizontal, getFlipVertical, getHyperlink, getParent, getRotation, getShapeId, getShapeName, getShapeType, getSheet, getSpContainer, isPlaceholder, moveTo, setAnchor, setEscherProperty, setEscherProperty, setFlipHorizontal, setFlipVertical, setRotation, setShapeId, setShapeType, setSheet
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.apache.poi.sl.usermodel.SimpleShape
getFillStyle, getShapeType, isPlaceholder
 
Methods inherited from interface org.apache.poi.sl.usermodel.Shape
getAnchor, getParent, getSheet
 
Methods inherited from interface org.apache.poi.sl.usermodel.PlaceableShape
getAnchor, getFlipHorizontal, getFlipVertical, getParent, getRotation, setAnchor, setFlipHorizontal, setFlipVertical, setRotation
 

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

HSLFSimpleShape

protected HSLFSimpleShape(EscherContainerRecord escherRecord,
                          ShapeContainer<HSLFShape,HSLFTextParagraph> 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 HSLFShape
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 StrokeStyle.LineDash getLineDashing()
Gets line dashing.

Returns:
dashing of the line.

setLineDashing

public void setLineDashing(StrokeStyle.LineDash pen)
Sets line dashing.

Parameters:
pen - new style of the line.

getLineCompound

public StrokeStyle.LineCompound getLineCompound()
Gets the line compound style

Returns:
the compound style of the line.

setLineCompound

public void setLineCompound(StrokeStyle.LineCompound style)
Sets the line compound style

Parameters:
style - new compound style of the line.

getStrokeStyle

public StrokeStyle getStrokeStyle()
Returns line style. One of the constants defined in this class.

Specified by:
getStrokeStyle in interface SimpleShape<HSLFShape,HSLFTextParagraph>
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

getClientDataRecord

protected <T extends Record> T 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(HSLFHyperlink link)

getAdjustValue

public Guide getAdjustValue(java.lang.String name)
Specified by:
getAdjustValue in interface IAdjustableShape
Parameters:
name - name of a adjust value, e.g. adj1
Returns:
adjust guide defined in the shape or null

getGeometry

public CustomGeometry getGeometry()
Specified by:
getGeometry in interface SimpleShape<HSLFShape,HSLFTextParagraph>

getShadowAngle

public double getShadowAngle()

getShadowDistance

public double getShadowDistance()

getShadowColor

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

getShadow

public Shadow<HSLFShape,HSLFTextParagraph> getShadow()
Specified by:
getShadow in interface SimpleShape<HSLFShape,HSLFTextParagraph>

getLineDecoration

public LineDecoration getLineDecoration()
Specified by:
getLineDecoration in interface SimpleShape<HSLFShape,HSLFTextParagraph>


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