Class StringElement

java.lang.Object
org.compiere.print.layout.PrintElement
org.compiere.print.layout.StringElement
All Implemented Interfaces:
ImageObserver, Serializable

public class StringElement extends PrintElement
String Print ELement.
The input can be multiple lines. The first tab is expanded.
Version:
$Id: StringElement.java,v 1.2 2006/07/30 00:53:02 jjanke Exp $
Author:
Jorg Janke
See Also:
  • Constructor Details

    • StringElement

      public StringElement(String inText, Font font, Paint paint, NamePair ID, boolean translateText)
      Standard Field Constructor.
      Created in LayoutEngine.
      Parameters:
      inText - text
      font - font
      paint - paint
      ID - optional ID (null if document)
      translateText - if true, check for optional text translation
    • StringElement

      public StringElement(AttributedString string)
      Attributed String Constructor
      Parameters:
      string - attributed string
    • StringElement

      public StringElement(Object content, Font font, Paint paint, NamePair ID, String label, String labelSuffix)
      Field Constructor.
      Created in LayoutEngine.
      Parameters:
      content - text or boolean
      font - font
      paint - paint
      ID - optional ID (null if document)
      label - optional label
      labelSuffix - optional label suffix
  • Method Details

    • getID

      public NamePair getID()
      Get optional ID
      Returns:
      ID or null
    • getOriginalString

      public String getOriginalString()
      Get Original String
      Returns:
      original (may be null)
    • translate

      public void translate(Properties ctx)
      Translate Content if required.
      If content is translated, the element needs to stay in the bounds of the originally calculated size and need to align the field.
      Overrides:
      translate in class PrintElement
      Parameters:
      ctx - context
    • calculateSize

      protected boolean calculateSize()
      Layout and Calculate Size.
      Set p_width and p_height.
      Specified by:
      calculateSize in class PrintElement
      Returns:
      Size
    • getDrillDown

      public MQuery getDrillDown(Point relativePoint, int pageNo)
      Get Drill Down Query
      Overrides:
      getDrillDown in class PrintElement
      Parameters:
      relativePoint - point to find print element
      pageNo - page number (ignored)
      Returns:
      drill down query or null
    • getDrillAcross

      public MQuery getDrillAcross(Point relativePoint, int pageNo)
      Get Drill Across Query
      Overrides:
      getDrillAcross in class PrintElement
      Parameters:
      relativePoint - relative Point
      pageNo - page number (ignored)
      Returns:
      null - not implemented
    • paint

      public void paint(Graphics2D g2D, int pageNo, Point2D pageStart, Properties ctx, boolean isView)
      Paint/Print.
      Calculate actual Size.
      The text is printed in the topmost left position - i.e. the leading is below the line.
      Specified by:
      paint in class PrintElement
      Parameters:
      g2D - Graphics
      pageStart - top left Location of page
      pageNo - page number for multi page support (0 = header/footer) - ignored
      ctx - print context
      isView - true if online view (IDs are links)
    • toString

      public String toString()
      String Representation
      Overrides:
      toString in class PrintElement
      Returns:
      info