net.sf.sdedit.ui
Class Graphics2DPaintDevice

java.lang.Object
  extended by net.sf.sdedit.diagram.PaintDevice
      extended by net.sf.sdedit.ui.Graphics2DPaintDevice
All Implemented Interfaces:
Iterable<Drawable>
Direct Known Subclasses:
Exporter, ImagePaintDevice

public abstract class Graphics2DPaintDevice
extends PaintDevice


Constructor Summary
protected Graphics2DPaintDevice()
           
 
Method Summary
 void close()
          This method is called once when no Drawable object will be added anymore.
protected abstract  Graphics2D createDummyGraphics(boolean bold)
          Creates a small-sized dummy graphics context that is used to gain information about the font metrics (which should be the same as in the final graphics context)
protected abstract  Graphics2D createGraphics()
          Creates a graphics context belonging to a back-end that has a size that suffices to display the whole of the diagram.
 void drawAll()
          Draws all of the diagram's elements into the graphics context created via createGraphics().
 int getTextHeight(boolean bold)
           
 int getTextWidth(String text, boolean bold)
           
 
Methods inherited from class net.sf.sdedit.diagram.PaintDevice
addOtherDrawable, addSequenceElement, announce, clear, computeAxes, computeBounds, getColor, getDiagram, getFont, getHeight, getRightBound, getTextHeight, getTextWidth, getWidth, isEmpty, iterator, reinitialize, setDiagram, writeToStream
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Graphics2DPaintDevice

protected Graphics2DPaintDevice()
Method Detail

createGraphics

protected abstract Graphics2D createGraphics()
Creates a graphics context belonging to a back-end that has a size that suffices to display the whole of the diagram. This method should be called after PaintDevice.computeBounds() has finished and the diagram's dimension is known.

Returns:
a graphics context belonging to a back-end that has a size that suffices to display the whole of the diagram

createDummyGraphics

protected abstract Graphics2D createDummyGraphics(boolean bold)
Creates a small-sized dummy graphics context that is used to gain information about the font metrics (which should be the same as in the final graphics context)

Parameters:
bold - flag denoting if the bold font is set
Returns:
a small-sized dummy graphics context

close

public void close()
Description copied from class: PaintDevice
This method is called once when no Drawable object will be added anymore. Its default implementation is empty.

Overrides:
close in class PaintDevice
See Also:
PaintDevice.close()

drawAll

public void drawAll()
Draws all of the diagram's elements into the graphics context created via createGraphics().


getTextHeight

public int getTextHeight(boolean bold)
Specified by:
getTextHeight in class PaintDevice

getTextWidth

public int getTextWidth(String text,
                        boolean bold)
Specified by:
getTextWidth in class PaintDevice


Copyright © 2011. All Rights Reserved.