ca.sqlpower.wabit.report
Class Layout

java.lang.Object
  extended by ca.sqlpower.object.AbstractSPObject
      extended by ca.sqlpower.wabit.AbstractWabitObject
          extended by ca.sqlpower.wabit.report.Layout
All Implemented Interfaces:
ca.sqlpower.object.SPObject, WabitObject, java.awt.print.Pageable, java.awt.print.Printable
Direct Known Subclasses:
Report, Template

public abstract class Layout
extends AbstractWabitObject
implements java.awt.print.Pageable, java.awt.print.Printable


Nested Class Summary
 class Layout.LayoutVarContext
           
 
Field Summary
protected  Page page
          The page size and margin info.
static java.lang.String PAGE_NUMBER
          A property that defines which page is currently being printed.
static java.lang.String PROPERTY_ZOOM
           
 Layout.LayoutVarContext varContext
           
 
Fields inherited from class ca.sqlpower.object.AbstractSPObject
uuid
 
Fields inherited from interface java.awt.print.Pageable
UNKNOWN_NUMBER_OF_PAGES
 
Fields inherited from interface java.awt.print.Printable
NO_SUCH_PAGE, PAGE_EXISTS
 
Constructor Summary
Layout(Page page)
           
Layout(java.lang.String uuid)
           
Layout(java.lang.String uuid, Page page)
           
 
Method Summary
protected  void addChildImpl(ca.sqlpower.object.SPObject child, int index)
           
 boolean allowsChildren()
           
 int childPositionOffset(java.lang.Class<? extends ca.sqlpower.object.SPObject> childType)
           
 boolean compareAndSetCurrentlyPrinting(boolean expected, boolean updateValue)
           
 java.util.List<java.lang.Class<? extends ca.sqlpower.object.SPObject>> getAllowedChildTypes()
           
 java.util.List<Page> getChildren()
           
 java.util.List<WabitObject> getDependencies()
           
 int getNumberOfPages()
          Before getting the page count the currentlyPrinting flag should be set.
 Page getPage()
           
 java.awt.print.PageFormat getPageFormat(int pageIndex)
           
 java.awt.print.Printable getPrintable(int pageIndex)
           
 Layout.LayoutVarContext getVarContext()
           
 int getZoomLevel()
           
 boolean isCurrentlyPrinting()
           
 int print(java.awt.Graphics graphics, java.awt.print.PageFormat pageFormat, int pageIndex)
          Prints a page of this report to the given graphics context.
protected  boolean removeChildImpl(ca.sqlpower.object.SPObject child)
           
 void removeDependency(ca.sqlpower.object.SPObject dependency)
           
 void setPage(Page page)
           
 void setVariable(java.lang.String name, java.lang.Object value)
           
 void setZoomLevel(int zoomLevel)
           
 java.lang.String toString()
           
protected  void updateBuiltinVariables()
           
 
Methods inherited from class ca.sqlpower.wabit.AbstractWabitObject
cleanup, commit, equals, generateNewUUID, getParent, getSession, isForegroundThread, removeChild, rollback, runInBackground, runInForeground
 
Methods inherited from class ca.sqlpower.object.AbstractSPObject
addChild, addSPListener, begin, fireChildAdded, fireChildRemoved, firePropertyChange, firePropertyChange, firePropertyChange, fireTransactionEnded, fireTransactionRollback, fireTransactionStarted, getChildren, getName, getUUID, removeSPListener, setName, setParent, setUUID
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface ca.sqlpower.object.SPObject
addChild, addSPListener, begin, getChildren, getName, getUUID, removeSPListener, setName, setParent, setUUID
 

Field Detail

PROPERTY_ZOOM

public static final java.lang.String PROPERTY_ZOOM
See Also:
Constant Field Values

PAGE_NUMBER

public static final java.lang.String PAGE_NUMBER
A property that defines which page is currently being printed.

See Also:
Constant Field Values

varContext

public Layout.LayoutVarContext varContext

page

protected Page page
The page size and margin info.

TODO: In future versions, a Layout can have many pages so you can accomplish left and right masters, cover pages, and so on. For now, a Layout can only have one arrangement of page content, and this is it.

Constructor Detail

Layout

public Layout(java.lang.String uuid)

Layout

public Layout(Page page)

Layout

public Layout(java.lang.String uuid,
              Page page)
Method Detail

getVarContext

public Layout.LayoutVarContext getVarContext()

updateBuiltinVariables

protected void updateBuiltinVariables()

getPage

public Page getPage()

setPage

public void setPage(Page page)

setVariable

public void setVariable(java.lang.String name,
                        java.lang.Object value)

childPositionOffset

public int childPositionOffset(java.lang.Class<? extends ca.sqlpower.object.SPObject> childType)
Specified by:
childPositionOffset in interface ca.sqlpower.object.SPObject

getChildren

public java.util.List<Page> getChildren()
Specified by:
getChildren in interface ca.sqlpower.object.SPObject

removeChildImpl

protected boolean removeChildImpl(ca.sqlpower.object.SPObject child)
Specified by:
removeChildImpl in class ca.sqlpower.object.AbstractSPObject

addChildImpl

protected void addChildImpl(ca.sqlpower.object.SPObject child,
                            int index)
Overrides:
addChildImpl in class ca.sqlpower.object.AbstractSPObject

allowsChildren

public boolean allowsChildren()
Specified by:
allowsChildren in interface ca.sqlpower.object.SPObject

print

public int print(java.awt.Graphics graphics,
                 java.awt.print.PageFormat pageFormat,
                 int pageIndex)
          throws java.awt.print.PrinterException
Prints a page of this report to the given graphics context. Before printing the currentlyPrinting flag should be set.

Specified by:
print in interface java.awt.print.Printable
Parameters:
pageIndex - the zero-based page number to print
Throws:
java.awt.print.PrinterException

getNumberOfPages

public int getNumberOfPages()
Before getting the page count the currentlyPrinting flag should be set.

Specified by:
getNumberOfPages in interface java.awt.print.Pageable

getPageFormat

public java.awt.print.PageFormat getPageFormat(int pageIndex)
                                        throws java.lang.IndexOutOfBoundsException
Specified by:
getPageFormat in interface java.awt.print.Pageable
Throws:
java.lang.IndexOutOfBoundsException

getPrintable

public java.awt.print.Printable getPrintable(int pageIndex)
                                      throws java.lang.IndexOutOfBoundsException
Specified by:
getPrintable in interface java.awt.print.Pageable
Throws:
java.lang.IndexOutOfBoundsException

setZoomLevel

public void setZoomLevel(int zoomLevel)

getZoomLevel

public int getZoomLevel()

compareAndSetCurrentlyPrinting

public boolean compareAndSetCurrentlyPrinting(boolean expected,
                                              boolean updateValue)

isCurrentlyPrinting

public boolean isCurrentlyPrinting()

getDependencies

public java.util.List<WabitObject> getDependencies()
Specified by:
getDependencies in interface ca.sqlpower.object.SPObject

removeDependency

public void removeDependency(ca.sqlpower.object.SPObject dependency)
Specified by:
removeDependency in interface ca.sqlpower.object.SPObject

toString

public java.lang.String toString()
Overrides:
toString in class AbstractWabitObject

getAllowedChildTypes

public java.util.List<java.lang.Class<? extends ca.sqlpower.object.SPObject>> getAllowedChildTypes()


Copyright © 2009. All Rights Reserved.