Package org.compiere.print.layout
Class PrintElement
java.lang.Object
org.compiere.print.layout.PrintElement
- All Implemented Interfaces:
ImageObserver
,Serializable
- Direct Known Subclasses:
BarcodeElement
,BoxElement
,GraphElement
,GridElement
,HTMLElement
,ImageElement
,StringElement
,TableElement
Abstract base class for Print Element
- Version:
- $Id: PrintElement.java,v 1.2 2006/07/30 00:53:02 jjanke Exp $
- Author:
- Jorg Janke
- See Also:
-
Field Summary
Modifier and TypeFieldDescriptionstatic final Color
Link Colorprotected CLogger
Loggerprotected String
Field Align Typeprotected float
protected float
protected float
Max Size of Elementprotected Point2D.Double
Location on Pageprotected boolean
protected float
Calculated Size of ElementFields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected abstract boolean
Layout and Calculate Sizeprotected Point2D.Double
getAbsoluteLocation
(Point2D pageStart) Return Absolute PositionGet relative Bounds of Elementprotected Page
Get current pageprotected String
Get Detail InfogetDrillAcross
(Point relativePoint, int pageNo) Get Drill Across QuerygetDrillDown
(Point relativePoint, int pageNo) Get Drill Down Queryfloat
Get Calculated Heightfloat
getHeight
(int pageNo) Get Calculated Height on pageGet Location within pageint
Get number of pagesGet page logic expressionGet print dataint
Get row indexfloat
getWidth()
Get Calculated Widthboolean
imageUpdate
(Image img, int infoflags, int x, int y, int width, int height) Image Observerboolean
Content is translatedvoid
Layout Elementabstract void
paint
(Graphics2D g2D, int pageNo, Point2D pageStart, Properties ctx, boolean isView) Paint/Print.void
setCurrentPage
(Page page) Set current pagevoid
setLocation
(Point2D pageLocation) Set Location within page.
Called from LayoutEngine.layoutForm(), layout(), createStandardFooterHeader()void
setMaxHeight
(float maxHeight) Set Maximum Heightvoid
setMaxWidth
(float maxWidth) Set Maximum Widthvoid
setPageLogic
(String displayLogic) Set page logic expressionvoid
setPrintData
(PrintData printData) Set print datavoid
setRowIndex
(int row) Set row indextoString()
String Representationvoid
translate
(Properties ctx) Translate Content if required.boolean
waitForLoad
(Image image) Wait until Image is loaded.
-
Field Details
-
LINK_COLOR
Link Color -
p_width
protected float p_widthCalculated Size of Element -
p_height
protected float p_height -
p_sizeCalculated
protected boolean p_sizeCalculated -
p_maxWidth
protected float p_maxWidthMax Size of Element -
p_maxHeight
protected float p_maxHeight -
p_FieldAlignmentType
Field Align Type -
p_pageLocation
Location on Page -
log
Logger
-
-
Constructor Details
-
PrintElement
protected PrintElement()Constructor
-
-
Method Details
-
getWidth
public float getWidth()Get Calculated Width- Returns:
- Width
-
getHeight
public float getHeight()Get Calculated Height- Returns:
- Height
-
getHeight
public float getHeight(int pageNo) Get Calculated Height on page- Parameters:
pageNo
- page number- Returns:
- Height
-
getPageCount
public int getPageCount()Get number of pages- Returns:
- page count (1)
-
calculateSize
protected abstract boolean calculateSize()Layout and Calculate Size- Returns:
- true if calculated
-
layout
public void layout(float maxWidth, float maxHeight, boolean isHeightOneLine, String FieldAlignmentType) Layout Element- Parameters:
maxWidth
- max widthmaxHeight
- max heightisHeightOneLine
- just one lineFieldAlignmentType
- alignment type (MPrintFormatItem.FIELD_ALIGN_*)
-
setMaxHeight
public void setMaxHeight(float maxHeight) Set Maximum Height- Parameters:
maxHeight
- maximum height (0) is no limit
-
setMaxWidth
public void setMaxWidth(float maxWidth) Set Maximum Width- Parameters:
maxWidth
- maximum width (0) is no limit
-
setLocation
Set Location within page.
Called from LayoutEngine.layoutForm(), layout(), createStandardFooterHeader()- Parameters:
pageLocation
- location within page
-
getLocation
Get Location within page- Returns:
- location within page
-
getAbsoluteLocation
Return Absolute Position- Parameters:
pageStart
- start of page- Returns:
- absolute position
-
getBounds
Get relative Bounds of Element- Returns:
- bounds
-
getDrillDown
Get Drill Down Query- Parameters:
relativePoint
- point to find print elementpageNo
- page number- Returns:
- null (subclass to overwrite)
-
getDrillAcross
Get Drill Across Query- Parameters:
relativePoint
- point to find print elementpageNo
- page number- Returns:
- null (subclass to overwrite)
-
translate
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.- Parameters:
ctx
- context
-
isTranslated
public boolean isTranslated()Content is translated- Returns:
- false
-
paint
public abstract void paint(Graphics2D g2D, int pageNo, Point2D pageStart, Properties ctx, boolean isView) Paint/Print.- Parameters:
g2D
- GraphicspageNo
- page number for multi page support (0 = header/footer)pageStart
- top left Location of pagectx
- contextisView
- true if online view (IDs are links)
-
imageUpdate
Image Observer- Specified by:
imageUpdate
in interfaceImageObserver
- Parameters:
img
- imageinfoflags
- Observer flagsx
- x coordinatey
- y coordinatewidth
- image widthheight
- image height- Returns:
- false if the infoflags indicate that the image is completely loaded; true otherwise
-
waitForLoad
Wait until Image is loaded.- Parameters:
image
- image- Returns:
- true if loaded
-
getDetailInfo
Get Detail Info- Returns:
- detail info (empty string, subclass to overwrite)
-
toString
String Representation -
setCurrentPage
Set current page- Parameters:
page
-
-
getCurrentPage
Get current page- Returns:
- page
-
setPrintData
Set print data- Parameters:
printData
-
-
getPrintData
Get print data- Returns:
- print data
-
setRowIndex
public void setRowIndex(int row) Set row index- Parameters:
row
-
-
getRowIndex
public int getRowIndex()Get row index- Returns:
- row index
-
setPageLogic
Set page logic expression- Parameters:
displayLogic
-
-
getPageLogic
Get page logic expression- Returns:
- page logic expression
-