|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.approximatrix.charting.render.AbstractRenderer
public abstract class AbstractRenderer
The AbstractRenderer provides default implementations for the set and get methods of every Renderer. Especially it provides a default mechanism for scaling Renderer instances whose actual bounds are smaller than their preferred size. As a consequence, every Renderer instance only needs to implement paintDefault() which has to render the object from coordinates 0,0 onwards using the preferred size.
| Field Summary | |
|---|---|
(package private) java.awt.Rectangle |
bounds
The bounds within which this object should be rendered. |
private static boolean |
DirectRender
Flag which indicates whether rendering should be performed directly to the Graphics2D. |
protected javax.swing.event.EventListenerList |
listener
The listener list. |
| Constructor Summary | |
|---|---|
AbstractRenderer()
Creates new AbstractRenderer |
|
| Method Summary | |
|---|---|
void |
addRenderChangeListener(RenderChangeListener l)
Adds a RenderChangeListener. |
void |
clearRenderChangeListeners()
Clears all RenderChangeListeners from the object |
private void |
directRender(java.awt.Graphics2D g)
Calls the paintDefault method, passing directly the Graphics2D object on which to paint. |
void |
fireRenderChangeEvent()
Protected function that fires a render change event, notifying any listeners that this renderable component needs to be redrawn. |
java.awt.Rectangle |
getBounds()
Gets the bounds for this renderer. |
static boolean |
getDirectRender()
Returns the current state of the direct rendering flag. |
protected boolean |
isDifferentBounds(java.awt.Rectangle nb)
Returns whether a new bounds Rectangle is the same object or equal to another Rectangle |
abstract void |
paintDefault(java.awt.Graphics2D g)
This method is called by the paint method to do the actual painting. |
void |
removeRenderChangeListener(RenderChangeListener l)
Removes a RenderChangeListener. |
void |
render(java.awt.Graphics2D g)
Renders the Object in the Graphics object. |
void |
setBounds(java.awt.Rectangle bounds)
Sets the bounds the layout manager has assigned to this renderer. |
static void |
setDirectRender(boolean value)
Sets the direct rendering flag appropriately. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface com.approximatrix.charting.render.Renderer |
|---|
getPreferredSize |
| Field Detail |
|---|
private static boolean DirectRender
protected javax.swing.event.EventListenerList listener
java.awt.Rectangle bounds
| Constructor Detail |
|---|
public AbstractRenderer()
| Method Detail |
|---|
public static void setDirectRender(boolean value)
value - true enables direct rendering the the Grpahics2D object, false uses a buffer imagepublic static boolean getDirectRender()
public void setBounds(java.awt.Rectangle bounds)
setBounds in interface Rendererbounds - the new bounds for the renderer.public java.awt.Rectangle getBounds()
getBounds in interface RenderersetBounds has not
been called before, the bounds computed from
getPreferredSize is returned.private void directRender(java.awt.Graphics2D g)
render() method, this
method does no scaling and does not adhere to bounds. However, Java
AWT is safe enough thatthis shouldn't cause a problem.
g - the Graphics2D object in which to renderpublic void render(java.awt.Graphics2D g)
paintDefault
is called to perform a standard painting in the Graphics object.
If the bounds and the preferred size don't match the image is
scaled afterwards.
render in interface Rendererg - the Graphics2D object in which to renderpublic abstract void paintDefault(java.awt.Graphics2D g)
g - the Graphics2D object to paint in.public void fireRenderChangeEvent()
fireRenderChangeEvent in interface Rendererpublic void removeRenderChangeListener(RenderChangeListener l)
removeRenderChangeListener in interface Rendererl - the RenderChangeListenerpublic void addRenderChangeListener(RenderChangeListener l)
addRenderChangeListener in interface Rendererl - the RenderChangeListenerpublic void clearRenderChangeListeners()
clearRenderChangeListeners in interface Rendererprotected boolean isDifferentBounds(java.awt.Rectangle nb)
nb - the new bounds to compare to the current bounds
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||