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
public abstract class PrintElement extends Object implements ImageObserver, Serializable
Print Element- Version:
- $Id: PrintElement.java,v 1.2 2006/07/30 00:53:02 jjanke Exp $
- Author:
- Jorg Janke
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static Color
LINK_COLOR
Link Colorprotected CLogger
log
Loggerprotected String
p_FieldAlignmentType
Field Align Typeprotected float
p_height
protected float
p_maxHeight
protected float
p_maxWidth
Max Size of Elementprotected Point2D.Double
p_pageLocation
Location on Pageprotected boolean
p_sizeCalculated
protected float
p_width
Calculated Size of Element-
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
PrintElement()
Constructor
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected abstract boolean
calculateSize()
Layout and Calculate Size Set p_width and p_heightprotected Point2D.Double
getAbsoluteLocation(Point2D pageStart)
Return Absolute PositionRectangle
getBounds()
Get relative Bounds of Elementprotected Page
getCurrentPage()
protected String
getDetailInfo()
Get Detail Info from Sub-ClassMQuery
getDrillAcross(Point relativePoint, int pageNo)
Get Drill Across valueMQuery
getDrillDown(Point relativePoint, int pageNo)
Get Drill Down valuefloat
getHeight()
Get Calculated Heightfloat
getHeight(int pageNo)
Get Calculated Height on pagePoint2D
getLocation()
Get Location within pageint
getPageCount()
Get number of pagesString
getPageLogic()
PrintData
getPrintData()
int
getRowIndex()
float
getWidth()
Get Calculated Widthboolean
imageUpdate(Image img, int infoflags, int x, int y, int width, int height)
Image Observerboolean
isTranslated()
Content is translatedvoid
layout(float maxWidth, float maxHeight, boolean isHeightOneLine, String FieldAlignmentType)
Layout Elementabstract void
paint(Graphics2D g2D, int pageNo, Point2D pageStart, Properties ctx, boolean isView)
Paint/Print.void
setCurrentPage(Page page)
void
setLocation(Point2D pageLocation)
Set Location within page.void
setMaxHeight(float maxHeight)
Set Maximum Heightvoid
setMaxWidth(float maxWidth)
Set Maximum Widthvoid
setPageLogic(String displayLogic)
void
setPrintData(PrintData printData)
void
setRowIndex(int row)
String
toString()
String Representationvoid
translate(Properties ctx)
Translate Context if required.boolean
waitForLoad(Image image)
Wait until Image is loaded.
-
-
-
Field Detail
-
LINK_COLOR
public static final Color LINK_COLOR
Link Color
-
p_width
protected float p_width
Calculated Size of Element
-
p_height
protected float p_height
-
p_sizeCalculated
protected boolean p_sizeCalculated
-
p_maxWidth
protected float p_maxWidth
Max Size of Element
-
p_maxHeight
protected float p_maxHeight
-
p_FieldAlignmentType
protected String p_FieldAlignmentType
Field Align Type
-
p_pageLocation
protected Point2D.Double p_pageLocation
Location on Page
-
log
protected CLogger log
Logger
-
-
Method Detail
-
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 Set p_width and p_height- 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
public void setLocation(Point2D pageLocation)
Set Location within page. Called from LayoutEngine.layoutForm(), lauout(), createStandardFooterHeader()- Parameters:
pageLocation
- location within page
-
getLocation
public Point2D getLocation()
Get Location within page- Returns:
- location within page
-
getAbsoluteLocation
protected Point2D.Double getAbsoluteLocation(Point2D pageStart)
Return Absolute Position- Parameters:
pageStart
- start of page- Returns:
- absolite position
-
getBounds
public Rectangle getBounds()
Get relative Bounds of Element- Returns:
- bounds relative position on page
-
getDrillDown
public MQuery getDrillDown(Point relativePoint, int pageNo)
Get Drill Down value- Parameters:
relativePoint
- relative PointpageNo
- page number- Returns:
- null (subclasses overwrite)
-
getDrillAcross
public MQuery getDrillAcross(Point relativePoint, int pageNo)
Get Drill Across value- Parameters:
relativePoint
- relative PointpageNo
- page number- Returns:
- null (subclasses overwrite)
-
translate
public void translate(Properties ctx)
Translate Context 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
public boolean imageUpdate(Image img, int infoflags, int x, int y, int width, int height)
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
public boolean waitForLoad(Image image)
Wait until Image is loaded.- Parameters:
image
- image- Returns:
- true if loaded
-
getDetailInfo
protected String getDetailInfo()
Get Detail Info from Sub-Class- Returns:
- detail info
-
toString
public String toString()
String Representation
-
setCurrentPage
public void setCurrentPage(Page page)
-
getCurrentPage
protected Page getCurrentPage()
-
setPrintData
public void setPrintData(PrintData printData)
-
getPrintData
public PrintData getPrintData()
-
setRowIndex
public void setRowIndex(int row)
-
getRowIndex
public int getRowIndex()
-
setPageLogic
public void setPageLogic(String displayLogic)
-
getPageLogic
public String getPageLogic()
-
-