Top Fields Constructors Methods
org.apache.poi.sl.draw

public Class DrawFactory

extends Object
Class Inheritance
Imports
java.awt.Graphics2D, java.awt.font.TextLayout, java.awt.geom.AffineTransform, .Rectangle2D, java.text.AttributedString, org.apache.poi.sl.usermodel.Background, .ConnectorShape, .FreeformShape, .GraphicalFrame, .GroupShape, .MasterSheet, .PictureShape, .PlaceableShape, .Shape, .Sheet, .Slide, .TableShape, .TextBox, .TextParagraph, .TextShape, org.apache.poi.util.ThreadLocalUtil

Field Summary

Modifier and TypeField and Description
private static final ThreadLocal<DrawFactory>

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public void
drawShape(Graphics2D
the graphics context to draw to
graphics
,
Shape<?, ?>
the shape
shape
,
Rectangle2D
the bounds within the graphics context to draw to
bounds
)

Convenience method for drawing single shapes.

public Drawable
getDrawable(Shape<?, ?> shape)

public DrawSlide
getDrawable(Slide<?, ?> sheet)

public DrawSheet
getDrawable(Sheet<?, ?> sheet)

public DrawMasterSheet
getDrawable(MasterSheet<?, ?> sheet)

public DrawTextBox
getDrawable(TextBox<?, ?> shape)

public DrawFreeformShape
public DrawConnectorShape
public DrawTableShape
getDrawable(TableShape<?, ?> shape)

public DrawTextShape
getDrawable(TextShape<?, ?> shape)

public DrawGroupShape
getDrawable(GroupShape<?, ?> shape)

public DrawPictureShape
public DrawGraphicalFrame
public DrawTextParagraph
getDrawable(TextParagraph<?, ?, ?> paragraph)

public DrawBackground
getDrawable(Background<?, ?> shape)

public DrawFontManager

Returns:

the font manager
getFontManager
(Graphics2D
the graphics context holding potentially a font manager
graphics
)

Return a FontManager, either registered beforehand or a default implementation

public static DrawFactory

Returns:

the draw factory
getInstance
(Graphics2D
the current graphics context or null
graphics
)

Returns the DrawFactory, preferably via a graphics instance.

public DrawPaint
getPaint(PlaceableShape<?, ?> shape)

public DrawTextFragment
public static void
setDefaultFactory(DrawFactory
the custom factory or null to reset/remove the default factory
factory
)

Set a custom draw factory for the current thread.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

defaultFactoryback to summary
private static final ThreadLocal<DrawFactory> defaultFactory

Constructor Detail

DrawFactoryback to summary
public DrawFactory()

Method Detail

drawShapeback to summary
public void drawShape(Graphics2D graphics, Shape<?, ?> shape, Rectangle2D bounds)

Convenience method for drawing single shapes. For drawing whole slides, use Slide#draw(Graphics2D)

Parameters
graphics:Graphics2D

the graphics context to draw to

shape:Shape<?, ?>

the shape

bounds:Rectangle2D

the bounds within the graphics context to draw to

getDrawableback to summary
public Drawable getDrawable(Shape<?, ?> shape)
getDrawableback to summary
public DrawSlide getDrawable(Slide<?, ?> sheet)
getDrawableback to summary
public DrawSheet getDrawable(Sheet<?, ?> sheet)
getDrawableback to summary
public DrawMasterSheet getDrawable(MasterSheet<?, ?> sheet)
getDrawableback to summary
public DrawTextBox getDrawable(TextBox<?, ?> shape)
getDrawableback to summary
public DrawFreeformShape getDrawable(FreeformShape<?, ?> shape)
getDrawableback to summary
public DrawConnectorShape getDrawable(ConnectorShape<?, ?> shape)
getDrawableback to summary
public DrawTableShape getDrawable(TableShape<?, ?> shape)
getDrawableback to summary
public DrawTextShape getDrawable(TextShape<?, ?> shape)
getDrawableback to summary
public DrawGroupShape getDrawable(GroupShape<?, ?> shape)
getDrawableback to summary
public DrawPictureShape getDrawable(PictureShape<?, ?> shape)
getDrawableback to summary
public DrawGraphicalFrame getDrawable(GraphicalFrame<?, ?> shape)
getDrawableback to summary
public DrawTextParagraph getDrawable(TextParagraph<?, ?, ?> paragraph)
getDrawableback to summary
public DrawBackground getDrawable(Background<?, ?> shape)
getFontManagerback to summary
public DrawFontManager getFontManager(Graphics2D graphics)

Return a FontManager, either registered beforehand or a default implementation

Parameters
graphics:Graphics2D

the graphics context holding potentially a font manager

Returns:DrawFontManager

the font manager

getInstanceback to summary
public static DrawFactory getInstance(Graphics2D graphics)

Returns the DrawFactory, preferably via a graphics instance. If graphics is null, the current thread local is checked or if it is not set, a new factory is created.

Parameters
graphics:Graphics2D

the current graphics context or null

Returns:DrawFactory

the draw factory

getPaintback to summary
public DrawPaint getPaint(PlaceableShape<?, ?> shape)
getTextFragmentback to summary
public DrawTextFragment getTextFragment(TextLayout layout, AttributedString str)
Annotations
@SuppressWarnings:WeakerAccess
setDefaultFactoryback to summary
public static void setDefaultFactory(DrawFactory factory)

Set a custom draw factory for the current thread. This is a fallback, for operations where usercode can't set a graphics context. Preferably use the rendering hint Drawable#DRAW_FACTORY to set the factory.

Parameters
factory:DrawFactory

the custom factory or null to reset/remove the default factory

Annotations
@SuppressWarnings:unused