Class TextPiece
- java.lang.Object
-
- org.eclipse.nebula.paperclips.core.text.internal.TextPiece
-
- All Implemented Interfaces:
PrintPiece,TextPrintPiece
public class TextPiece extends java.lang.Object implements TextPrintPiece
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voiddispose()Disposes the system resources allocated by this PrintPiece.intgetAscent()Returns the ascent of the first line of text, in pixels.private intgetHorzAlignmentOffset(int align, int lineWidth, int totalWidth)org.eclipse.swt.graphics.PointgetSize()Returns the dimensions of this PrintPiece, in pixels.private booleaninitGC(org.eclipse.swt.graphics.GC gc)private booleaninitGCBackground(org.eclipse.swt.graphics.GC gc)private voidinitGCFont(org.eclipse.swt.graphics.GC gc)private voidinitGCForeground(org.eclipse.swt.graphics.GC gc)voidpaint(org.eclipse.swt.graphics.GC gc, int x, int y)Draws this PrintPiece on the given graphics device, at the given coordinates.private voidrestoreGC(org.eclipse.swt.graphics.GC gc, org.eclipse.swt.graphics.Font font, org.eclipse.swt.graphics.Color foreground, org.eclipse.swt.graphics.Color background)
-
-
-
Field Detail
-
size
private final org.eclipse.swt.graphics.Point size
-
lines
private final java.lang.String[] lines
-
style
private final TextStyle style
-
ascent
private final int ascent
-
resources
private final ResourcePool resources
-
-
Constructor Detail
-
TextPiece
public TextPiece(org.eclipse.swt.graphics.Device device, TextStyle style, java.lang.String[] text, org.eclipse.swt.graphics.Point size, int ascent)
-
-
Method Detail
-
getSize
public org.eclipse.swt.graphics.Point getSize()
Description copied from interface:PrintPieceReturns the dimensions of this PrintPiece, in pixels.- Specified by:
getSizein interfacePrintPiece- Returns:
- the dimensions of this PrintPiece, in pixels.
-
getAscent
public int getAscent()
Description copied from interface:TextPrintPieceReturns the ascent of the first line of text, in pixels.- Specified by:
getAscentin interfaceTextPrintPiece- Returns:
- the ascent of the first line of text, in pixels.
-
paint
public void paint(org.eclipse.swt.graphics.GC gc, int x, int y)Description copied from interface:PrintPieceDraws this PrintPiece on the given graphics device, at the given coordinates.- Specified by:
paintin interfacePrintPiece- Parameters:
gc- a graphics context for the graphics device.x- the x coordinate where this PrintPiece will be drawn.y- the x coordinate where this PrintPiece will be drawn.
-
initGC
private boolean initGC(org.eclipse.swt.graphics.GC gc)
-
restoreGC
private void restoreGC(org.eclipse.swt.graphics.GC gc, org.eclipse.swt.graphics.Font font, org.eclipse.swt.graphics.Color foreground, org.eclipse.swt.graphics.Color background)
-
getHorzAlignmentOffset
private int getHorzAlignmentOffset(int align, int lineWidth, int totalWidth)
-
initGCBackground
private boolean initGCBackground(org.eclipse.swt.graphics.GC gc)
-
initGCForeground
private void initGCForeground(org.eclipse.swt.graphics.GC gc)
-
initGCFont
private void initGCFont(org.eclipse.swt.graphics.GC gc)
-
dispose
public void dispose()
Description copied from interface:PrintPieceDisposes the system resources allocated by this PrintPiece. The dispose method is not a permanent disposal of a PrintPiece. It is intended to reclaim system resources, however future calls to paint(GC,int,int) may require that the resources be allocated again.- Specified by:
disposein interfacePrintPiece
-
-