Class AnnotationUtils

  • public class AnnotationUtils
    extends Object
    Helper methods for annotations.
    fracpete (fracpete at waikato dot ac dot nz)
    • Constructor Detail

      • AnnotationUtils

        public AnnotationUtils()
    • Method Detail

      • applyFormatOptions

        public static String applyFormatOptions​(String value,
                                                String format)
        Applies further format options. Does nothing if format or value are empty.
        value - the value to format
        format - the format to apply
        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.
        object - the object to use as basis
        typeSuffix - the meta-data key for the type
        labelFormat - the label format to use
        the generated label
      • calcStringDimenions

        public static Dimension calcStringDimenions​(Graphics g,
                                                    Font f,
                                                    String s)
        Calculates the string dimensions in pixels.
        g - the graphics context
        f - the font to use
        s - the string to measure
        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.
        g - the graphics context
        rect - the reference for the anchor
        anchor - the anchor to use
        label - the label to draw
        offsetX - the X offset from the anchor
        offsetY - the Y offset from the anchor
        font - the font to use