ca.sqlpower.wabit.report
Class ImageRenderer

java.lang.Object
  extended by ca.sqlpower.wabit.AbstractWabitObject
      extended by ca.sqlpower.wabit.report.ImageRenderer
All Implemented Interfaces:
ReportContentRenderer, WabitObjectReportRenderer, WabitObject

public class ImageRenderer
extends AbstractWabitObject
implements WabitObjectReportRenderer

This class will let users import an image into their layout.


Nested Class Summary
 
Nested classes/interfaces inherited from interface ca.sqlpower.wabit.report.ReportContentRenderer
ReportContentRenderer.BackgroundColours
 
Constructor Summary
ImageRenderer()
           
ImageRenderer(ImageRenderer imageRenderer)
          Copy constructor
 
Method Summary
 boolean allowsChildren()
          Returns true if this object may contain children.
 int childPositionOffset(java.lang.Class<? extends WabitObject> childType)
          Returns the position in the list that would be returned by getChildren() that the first object of type childClass is, or where it would be if there were any children of that type.
 java.awt.Color getBackgroundColour()
           
 java.util.List<? extends WabitObject> getChildren()
          Returns an unmodifiable list of the children in this WabitObject.
 WabitObject getContent()
          Returns the WabitObject that this is rendering
 java.util.List<WabitObject> getDependencies()
          Returns a list of all WabitObjects that this Wabit object is dependent on.
 HorizontalAlignment getHAlign()
           
 WabitImage getImage()
           
 VerticalAlignment getVAlign()
           
 boolean isPreserveAspectRatioWhenResizing()
           
 boolean isPreservingAspectRatio()
           
 void refresh()
          Refreshes the data being rendered by this ReportContentRenderer so that it has the most recent data.
protected  boolean removeChildImpl(WabitObject child)
          This is the object specific implementation of removeChild.
 void removeDependency(WabitObject dependency)
          Removes the given object as a dependency of this object.
 boolean renderReportContent(java.awt.Graphics2D g, ContentBox contentBox, double scaleFactor, int pageIndex, boolean printing)
          Renders as much report content as will fit within the bounds of the given content box.
 void resetToFirstPage()
          Tells this content renderer that the next call to #renderReportContent(Graphics2D, ContentBox, double) should produce the first page of output again.
 void setHAlign(HorizontalAlignment hAlign)
           
 void setImage(WabitImage image)
           
 void setParent(WabitObject parent)
          Sets the parent of this object to the given object.
 void setPreserveAspectRatioWhenResizing(boolean preserveAspectRatioWhenResizing)
           
 void setPreservingAspectRatio(boolean preservingAspectRatio)
           
 void setVAlign(VerticalAlignment vAlign)
           
 
Methods inherited from class ca.sqlpower.wabit.AbstractWabitObject
addChild, addChildImpl, addWabitListener, begin, beginTransaction, cleanup, commit, commitTransaction, equals, fireChildAdded, fireChildRemoved, firePropertyChange, firePropertyChange, firePropertyChange, fireTransactionEnded, fireTransactionRollback, fireTransactionStarted, generateNewUUID, getChildren, getName, getParent, getSession, getUUID, isForegroundThread, removeChild, removeWabitListener, rollback, rollbackTransaction, runInBackground, runInForeground, setName, setUUID, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface ca.sqlpower.wabit.WabitObject
addChild, addWabitListener, begin, cleanup, commit, generateNewUUID, getChildren, getName, getParent, getUUID, removeChild, removeWabitListener, rollback, setName, setUUID
 

Constructor Detail

ImageRenderer

public ImageRenderer()

ImageRenderer

public ImageRenderer(ImageRenderer imageRenderer)
Copy constructor

Method Detail

getContent

public WabitObject getContent()
Description copied from interface: WabitObjectReportRenderer
Returns the WabitObject that this is rendering

Specified by:
getContent in interface WabitObjectReportRenderer

getBackgroundColour

public java.awt.Color getBackgroundColour()
Specified by:
getBackgroundColour in interface ReportContentRenderer

renderReportContent

public boolean renderReportContent(java.awt.Graphics2D g,
                                   ContentBox contentBox,
                                   double scaleFactor,
                                   int pageIndex,
                                   boolean printing)
Description copied from interface: ReportContentRenderer
Renders as much report content as will fit within the bounds of the given content box.

Report content renderers can be implemented in two different ways:


resetToFirstPage

public void resetToFirstPage()
Description copied from interface: ReportContentRenderer
Tells this content renderer that the next call to #renderReportContent(Graphics2D, ContentBox, double) should produce the first page of output again.

Specified by:
resetToFirstPage in interface ReportContentRenderer

allowsChildren

public boolean allowsChildren()
Description copied from interface: WabitObject
Returns true if this object may contain children. Not all types of WabitObjects can be a child to any WabitObject.

Specified by:
allowsChildren in interface WabitObject
See Also:
WabitObject.childPositionOffset(Class)

childPositionOffset

public int childPositionOffset(java.lang.Class<? extends WabitObject> childType)
Description copied from interface: WabitObject
Returns the position in the list that would be returned by getChildren() that the first object of type childClass is, or where it would be if there were any children of that type.

Specified by:
childPositionOffset in interface WabitObject

getChildren

public java.util.List<? extends WabitObject> getChildren()
Description copied from interface: WabitObject
Returns an unmodifiable list of the children in this WabitObject. If there are no children in this WabitObject an empty list should be returned.

Specified by:
getChildren in interface WabitObject

getImage

public WabitImage getImage()

setImage

public void setImage(WabitImage image)

getDependencies

public java.util.List<WabitObject> getDependencies()
Description copied from interface: WabitObject
Returns a list of all WabitObjects that this Wabit object is dependent on. Children of a WabitObject are not dependencies and will not be returned in this list. If there are no objects this Wabit object is dependent on an empty list should be returned. These are only the immediate dependencies of this object. If you want to find the dependencies of this object's dependencies as well it may be useful to look at WorkspaceGraphModel to make a full graph of all of the dependencies.

Specified by:
getDependencies in interface WabitObject

removeDependency

public void removeDependency(WabitObject dependency)
Description copied from interface: WabitObject
Removes the given object as a dependency of this object. For this object to no longer be dependent on the given dependency all of its children must also not be dependent on the given dependency when this method returns. This may remove this object from its parent if necessary.

Specified by:
removeDependency in interface WabitObject

setParent

public void setParent(WabitObject parent)
Description copied from interface: WabitObject
Sets the parent of this object to the given object. This should only be done when this object is being added as a child to another object.

Specified by:
setParent in interface WabitObject
Overrides:
setParent in class AbstractWabitObject
Parameters:
parent - The new parent of this object.

setPreserveAspectRatioWhenResizing

public void setPreserveAspectRatioWhenResizing(boolean preserveAspectRatioWhenResizing)

isPreserveAspectRatioWhenResizing

public boolean isPreserveAspectRatioWhenResizing()

setPreservingAspectRatio

public void setPreservingAspectRatio(boolean preservingAspectRatio)

isPreservingAspectRatio

public boolean isPreservingAspectRatio()

refresh

public void refresh()
Description copied from interface: ReportContentRenderer
Refreshes the data being rendered by this ReportContentRenderer so that it has the most recent data. If the data this renderer renders is static, then it doesn't need to do anything (no-op).

Specified by:
refresh in interface ReportContentRenderer

setHAlign

public void setHAlign(HorizontalAlignment hAlign)

getHAlign

public HorizontalAlignment getHAlign()

setVAlign

public void setVAlign(VerticalAlignment vAlign)

getVAlign

public VerticalAlignment getVAlign()

removeChildImpl

protected boolean removeChildImpl(WabitObject child)
Description copied from class: AbstractWabitObject
This is the object specific implementation of removeChild. There are checks in the removeChild method to ensure the child being removed has no dependencies and is a child of this object.

Specified by:
removeChildImpl in class AbstractWabitObject
See Also:
AbstractWabitObject.removeChild(WabitObject)


Copyright © 2009. All Rights Reserved.