net.refractions.udig.printing.model
Interface BoxPrinter

All Known Implementing Classes:
AbstractBoxPrinter

public interface BoxPrinter

Draws the preview for a box and prints the contents of a box. Must have a default constructor.

Since:
1.1.0
Author:
Jesse

Method Summary
 void createPreview(java.awt.Graphics2D graphics, IProgressMonitor monitor)
          This method is called by the frame work when it is time to display itself on the screen.
 void draw(java.awt.Graphics2D graphics, IProgressMonitor monitor)
          This method will be called by Page when the actual printing is being performed.
 Box getBox()
          Returns the box the box set when the setBox method is called.
 java.lang.String getExtensionPointID()
          Must return the id of the extension point where you registered this box printer.
 boolean isNewPreviewNeeded()
          Returns true if a the preview has changed since last call of createPreview(Graphics2D, IProgressMonitor) This method must NOT always return true because as long as it returns true createPreview is called and the screen is not updated.
 void load(IMemento value)
           
 void save(IMemento memento)
          Passes in a memento object so that the printer can be saved.
 void setBox(Box box)
          Sets the owning box.
 

Method Detail

save

void save(IMemento memento)
Passes in a memento object so that the printer can be saved.

See Also:
AbstractBox

load

void load(IMemento value)
Parameters:
value - the new value of the 'IMemento' attribute.
See Also:
save(IMemento)

draw

void draw(java.awt.Graphics2D graphics,
          IProgressMonitor monitor)
This method will be called by Page when the actual printing is being performed. The graphics object passed in will have its appropriate clipping set, so the drawing code can only draw inside this clip.

Parameters:
graphics - A Graphics2D object to perform the drawing on
monitor -
See Also:
Page

createPreview

void createPreview(java.awt.Graphics2D graphics,
                   IProgressMonitor monitor)
This method is called by the frame work when it is time to display itself on the screen. It does not have to be a perfect representation of the actual printed value because It is not called during printing. It is recommended that caching be used for the preview as much as possible. This method may take as long as necessary, it is not run in the display thread.

Parameters:
graphics - A Graphics2D object to perform the drawing on.
monitor -

isNewPreviewNeeded

boolean isNewPreviewNeeded()
Returns true if a the preview has changed since last call of createPreview(Graphics2D, IProgressMonitor) This method must NOT always return true because as long as it returns true createPreview is called and the screen is not updated. When it returns false the results of the last createPreview is drawn onto the screen.

Returns:
Returns true if a the preview has changed since last call of createPreview(Graphics2D, IProgressMonitor)

getExtensionPointID

java.lang.String getExtensionPointID()
Must return the id of the extension point where you registered this box printer.

Each box printer has to be registered in an extension to the extension point "net.refractions.udig.printing.ui.boxprinter".
Say you have registered the extension with the id "myPrintBoxes" in the plugin "net.refractions.example.plugin": this method should then return the extension id "net.refractions.example.plugin.myPrintBoxes".

Failure to properly configure the extension point id will be noted on the console logs, no user interface notification will be performed.

Returns:
the id of the extension point that is used to load the BoxPrinter

getBox

Box getBox()
Returns the box the box set when the setBox method is called.

Returns:
the box the box set when the setBox method is called.

setBox

void setBox(Box box)
Sets the owning box. getBox() should return the same box.

Parameters:
box - The box that owns this BoxPrinter.