com.miginfocom.calendar.activity.renderer
Class AShapeRenderer

java.lang.Object
  extended by com.miginfocom.calendar.activity.renderer.AShapeRenderer
All Implemented Interfaces:
ActivityViewRenderer

public class AShapeRenderer
extends java.lang.Object
implements ActivityViewRenderer

A renderer that paints an RootAShape for every reference bounds that the activity view have.
It vill use the ActivityView as context to get the RootAShape from the DefaultAShapeProvider.


Constructor Summary
AShapeRenderer()
          Creates a painter with a DefaultAShapeProvider as the factory
AShapeRenderer(DefaultAShapeProvider shapeProvider)
          Creates a painter
 
Method Summary
 void addChangeListener(javax.swing.event.ChangeListener l)
          Adds a listener that gets notified when something changes in this renderer.
 void addChangeListener(javax.swing.event.ChangeListener l, boolean asWeakRef)
          Adds a listener that gets notified when something changes in this renderer.
 java.lang.String getDefaultPaintContext()
          Property: The default paint context that will be used to get an AShape to paint with.
 java.awt.Insets getRepaintMargin()
          During the paint phase the maximum repaint padding is accumulated and returned here.
 DefaultAShapeProvider getShapeProvider()
          Returns the shape provider that provides the shape to paint for every activity view.
 void paint(java.awt.Graphics2D g2, java.awt.Rectangle bounds, TimeSpanList activityViewList)
          Paints the activity views in the List.
 void removeChangeListener(javax.swing.event.ChangeListener l)
          Removes the listener, if it is in the list.
 void setDefaultPaintContext(java.lang.String ctx)
          Property: The default paint context that will be used to get an AShape to paint with.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AShapeRenderer

public AShapeRenderer()
Creates a painter with a DefaultAShapeProvider as the factory


AShapeRenderer

public AShapeRenderer(DefaultAShapeProvider shapeProvider)
Creates a painter

Parameters:
shapeProvider - The factory to ask for shapes for views that has no shape istalled yet.
Method Detail

getShapeProvider

public DefaultAShapeProvider getShapeProvider()
Returns the shape provider that provides the shape to paint for every activity view.

Returns:
The shape provider that provides the shape to paint for every activity view.

getRepaintMargin

public java.awt.Insets getRepaintMargin()
Description copied from interface: ActivityViewRenderer
During the paint phase the maximum repaint padding is accumulated and returned here.

Specified by:
getRepaintMargin in interface ActivityViewRenderer
Returns:
The extra margin around. Positive values or 0. Not null. Always at least 1 for the margin to compensate for anti-aliasing, strokes and such. Could be a shared object so do not change it, consider read-only!
See Also:
RootAShape.getRepaintPadding()

paint

public void paint(java.awt.Graphics2D g2,
                  java.awt.Rectangle bounds,
                  TimeSpanList activityViewList)
Description copied from interface: ActivityViewRenderer
Paints the activity views in the List. The bounds of the activity views should already be set to the correct values, for instance by a ActivityLayout.

Specified by:
paint in interface ActivityViewRenderer
Parameters:
g2 - the Graphics object to paint in.
bounds - The bounds of the container to draw within. The clip can be smaller. Not null.
activityViewList - The activities to paint/draw. Should be ActivityView objects.

getDefaultPaintContext

public java.lang.String getDefaultPaintContext()
Property: The default paint context that will be used to get an AShape to paint with. This is the default context to use (null is default) if it is not set on the activity directly with AbstractActivity.setPaintContext(String).

Returns:
The context. Might be null.
Since:
6.0

setDefaultPaintContext

public void setDefaultPaintContext(java.lang.String ctx)
Property: The default paint context that will be used to get an AShape to paint with. This is the default context to use (null is default) if it is not set on the activity directly with AbstractActivity.setPaintContext(String).

Parameters:
ctx - The context. Might be null.
Since:
6.0

addChangeListener

public void addChangeListener(javax.swing.event.ChangeListener l)
Description copied from interface: ActivityViewRenderer
Adds a listener that gets notified when something changes in this renderer. Will be added as strong reference.

Specified by:
addChangeListener in interface ActivityViewRenderer
Parameters:
l - The listener. Not null

addChangeListener

public void addChangeListener(javax.swing.event.ChangeListener l,
                              boolean asWeakRef)
Description copied from interface: ActivityViewRenderer
Adds a listener that gets notified when something changes in this renderer.

Specified by:
addChangeListener in interface ActivityViewRenderer
Parameters:
l - The listener. Not null
asWeakRef - If the listener should be added wrapped in a WeakReference. This defers memory leak problems since the garbage collector can collect the listener if it is only referenced from this list.
Note! This (weak reference) can not be used with listeners that doesn't have another real (a.k.a Strong) reference to it, as for instance an annonymous inner class. If one such listener is added it will be removed almost immediately by the garbage collector.

removeChangeListener

public void removeChangeListener(javax.swing.event.ChangeListener l)
Description copied from interface: ActivityViewRenderer
Removes the listener, if it is in the list.

Specified by:
removeChangeListener in interface ActivityViewRenderer
Parameters:
l - The listener to remove, not null.


Copyright © 2009 MiG InfoCom AB. All Rights Reserved.