public class MustDrawer
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
protected FontSpecification |
currentFontSpec |
protected java.awt.Font |
originalFont |
Constructor and Description |
---|
MustDrawer() |
Modifier and Type | Method and Description |
---|---|
protected void |
changeFontIfNew(PrintablePage.PrintableItem printableItem,
java.awt.Graphics graphics) |
java.awt.Image |
getCompletelyLoadedImage(java.awt.Image image)
Waits until image is completely loaded and returns the image - if image could not be loaded, null is returned.
|
java.awt.Image |
getCompletelyLoadedImage(java.lang.String imagePath,
ImageResource imageResource)
Waits until image is completely loaded and returns the image - if image could not be loaded, null is returned.
|
static int |
getPx(double mm)
Converts millimeters to values needed by graphics.drawXxxx coordinates for drawing on printer.
|
static double |
getPxD(double mm)
Converts millimeters to values needed by graphics.drawXxxx coordinates for drawing on printer return the value as double.
|
protected int |
getRightAllignOffset(java.awt.Graphics graphics,
java.lang.String value,
int availableWidth)
Returns the offset where to start later in order to get a value right aligned.
|
protected int |
getRightAllignStartPoint(java.awt.Graphics graphics,
java.lang.String value,
int endPoint)
Returns the x value where to start printing a value that should end at the specified end point.
|
protected static java.lang.String |
limit(java.lang.String textToLimit,
java.awt.Graphics graphics,
int maxPixel)
Limits a text to the specified length if necessary and marks the result with "..."
|
protected java.lang.String |
limit(java.lang.String textToLimit,
int maxLength)
Limits a text to the specified length if necessary and marks the result with "..."
|
protected void |
resetFont(java.awt.Graphics graphics) |
protected void |
setOnBold(java.awt.Graphics graphics) |
protected java.util.Vector<java.lang.String> |
wrap(java.lang.String textToWrap,
java.awt.Graphics graphics,
int maxSpace)
Wraps text (paragraph word wrap) to multiple lines fitting the available space as specified.
|
protected java.awt.Font originalFont
protected FontSpecification currentFontSpec
public static int getPx(double mm)
mm
- millimeterpublic static double getPxD(double mm)
mm
- millimeterpublic java.awt.Image getCompletelyLoadedImage(java.lang.String imagePath, ImageResource imageResource)
imagePath
- the path to the image to be completely loaded.imageResource
- the resource to retrieve the image - if null, awt toolkit is usedpublic java.awt.Image getCompletelyLoadedImage(java.awt.Image image)
image
- the image to be loaded completelyprotected java.lang.String limit(java.lang.String textToLimit, int maxLength)
textToLimit
- the text to be limitedmaxLength
- the max length of the resultprotected static java.lang.String limit(java.lang.String textToLimit, java.awt.Graphics graphics, int maxPixel)
textToLimit
- the text to be limitedgraphics
- the Graphics2D contextmaxPixel
- the maximum of available space in pixelprotected java.util.Vector<java.lang.String> wrap(java.lang.String textToWrap, java.awt.Graphics graphics, int maxSpace)
textToWrap
- the text to word wrapgraphics
- the graphics contextmaxSpace
- the available space for the lineprotected int getRightAllignOffset(java.awt.Graphics graphics, java.lang.String value, int availableWidth)
graphics
- the graphics used for drawing - font is relevantvalue
- the value to be drawnavailableWidth
- the available width to draw the valueprotected int getRightAllignStartPoint(java.awt.Graphics graphics, java.lang.String value, int endPoint)
graphics
- the graphics used for drawing - font is relevantvalue
- the value to be drawnendPoint
- the x value where the value should endprotected void changeFontIfNew(PrintablePage.PrintableItem printableItem, java.awt.Graphics graphics)
protected void setOnBold(java.awt.Graphics graphics)
protected void resetFont(java.awt.Graphics graphics)
Copyright 1998-2023 Christoph Mueller, Kaerntner Str. 56, D-70469 Stuttgart, Germany, https://www.perpus.de