Class AnnotationUtils
- java.lang.Object
-
- adams.gui.visualization.object.objectannotations.AnnotationUtils
-
public class AnnotationUtils extends Object
Helper methods for annotations.- Author:
- fracpete (fracpete at waikato dot ac dot nz)
-
-
Constructor Summary
Constructors Constructor Description AnnotationUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static String
applyFormatOptions(String value, String format)
Applies further format options.static String
applyLabelFormat(LocatedObject object, String typeSuffix, String labelFormat)
Applies the label format to the object to generate a display string.static Dimension
calcStringDimenions(Graphics g, Font f, String s)
Calculates the string dimensions in pixels.static void
drawString(Graphics g, Rectangle rect, ImageAnchor anchor, String label, int offsetX, int offsetY, Font font)
Draws the string at the specified position.
-
-
-
Method Detail
-
applyFormatOptions
public static String applyFormatOptions(String value, String format)
Applies further format options. Does nothing if format or value are empty.- Parameters:
value
- the value to formatformat
- the format to apply- Returns:
- the processed value
-
applyLabelFormat
public static String applyLabelFormat(LocatedObject object, String typeSuffix, String labelFormat)
Applies the label format to the object to generate a display string.- Parameters:
object
- the object to use as basistypeSuffix
- the meta-data key for the typelabelFormat
- the label format to use- Returns:
- the generated label
-
calcStringDimenions
public static Dimension calcStringDimenions(Graphics g, Font f, String s)
Calculates the string dimensions in pixels.- Parameters:
g
- the graphics contextf
- the font to uses
- the string to measure- Returns:
- the dimensions in pixels
-
drawString
public static void drawString(Graphics g, Rectangle rect, ImageAnchor anchor, String label, int offsetX, int offsetY, Font font)
Draws the string at the specified position.- Parameters:
g
- the graphics contextrect
- the reference for the anchoranchor
- the anchor to uselabel
- the label to drawoffsetX
- the X offset from the anchoroffsetY
- the Y offset from the anchorfont
- the font to use
-
-