com.miginfocom.calendar.datearea
Class DefaultDateArea.ActivityViewDecorator

java.lang.Object
  extended by com.miginfocom.calendar.datearea.DefaultDateArea.ActivityViewDecorator
All Implemented Interfaces:
Decorator, GridDecorator, java.lang.Comparable
Enclosing class:
DefaultDateArea

public class DefaultDateArea.ActivityViewDecorator
extends java.lang.Object
implements GridDecorator

A class that draws the activities that this date area holds. Will have a default layer index of 100 when created by this DefaultDateArea
Add an instance by: dateArea.addDecorator(dateArea.new ActivityViewDecorator(100));


Constructor Summary
DefaultDateArea.ActivityViewDecorator()
           
DefaultDateArea.ActivityViewDecorator(int layerIndex)
           
 
Method Summary
 int compareTo(java.lang.Object o)
          Sorts according to layer index.
 void dispose()
          Clean up and deregister listeners.
 void doPaint(java.awt.Graphics2D g2, java.awt.Rectangle bounds)
          Paint what should be painted.
 GridContainer getGridContainer()
          Returns the container of the grid.
 int getLayerIndex()
          Returns a number to indicate the order in which to paint something.
 void processEvent(java.awt.AWTEvent e)
          A callback method that lets this decorator intercept any AWTEvent (such and KeyEvents and MouseEvents).
 void setLayerIndex(int layerIndex)
          Sets a number to indicate the order in which to paint something.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultDateArea.ActivityViewDecorator

public DefaultDateArea.ActivityViewDecorator()

DefaultDateArea.ActivityViewDecorator

public DefaultDateArea.ActivityViewDecorator(int layerIndex)
Method Detail

doPaint

public void doPaint(java.awt.Graphics2D g2,
                    java.awt.Rectangle bounds)
Description copied from interface: Decorator
Paint what should be painted. Color, paints, fonts, hints and similar should be same as when called.

Specified by:
doPaint in interface Decorator
Parameters:
g2 - The graphics object to paint in
bounds - The bounds to stay within (a must). If width and/or height is 0 that dimension is not scaled to fit and should be ignored.

compareTo

public int compareTo(java.lang.Object o)
Description copied from interface: Decorator
Sorts according to layer index. Code normally looks like this:
return getLayerIndex() - ((Decorator) o).getLayerIndex();.

Specified by:
compareTo in interface Decorator
Specified by:
compareTo in interface java.lang.Comparable
Parameters:
o - Another Decorator
Returns:
getLayerIndex() - ((Decorator) o).getLayerIndex().

getGridContainer

public GridContainer getGridContainer()
Description copied from interface: GridDecorator
Returns the container of the grid.

Specified by:
getGridContainer in interface GridDecorator
Returns:
The container of the grid. Can be null in which case nothing should be painted.

getLayerIndex

public int getLayerIndex()
Description copied from interface: Decorator
Returns a number to indicate the order in which to paint something. The number is interpreted by the object that invokes Decorator.doPaint(java.awt.Graphics2D, java.awt.Rectangle).

Specified by:
getLayerIndex in interface Decorator
Returns:
A number to indicate the order in which to paint something. Lower if painted before. I.e. under.

setLayerIndex

public void setLayerIndex(int layerIndex)
Description copied from interface: Decorator
Sets a number to indicate the order in which to paint something. The number is interpreted by the object that invokes Decorator.doPaint(java.awt.Graphics2D, java.awt.Rectangle).

Specified by:
setLayerIndex in interface Decorator
Parameters:
layerIndex - A number to indicate the order in which to paint something. Lower if painted before. I.e. under.

processEvent

public void processEvent(java.awt.AWTEvent e)
Description copied from interface: Decorator
A callback method that lets this decorator intercept any AWTEvent (such and KeyEvents and MouseEvents). The target that this decorator is installed on will manually have to call this method though, but for instance DefaultDateArea does so.

If only events that aren't consumed should be caught the normaly process of adding the appropriate listener to the target is adviced. This method is for catching the event before it is precessed by the target.

If the event is a InputEvent and the 'consumed' flag is set to true no more decorators are notified, neither is the normal event handling dispatching for the target. A notable amount of events can come this way so processing should be very fast.

Specified by:
processEvent in interface Decorator
Parameters:
e - The event.

dispose

public void dispose()
Description copied from interface: Decorator
Clean up and deregister listeners. Should be called when a Decorator isn't needed any more.

Specified by:
dispose in interface Decorator


Copyright © 2009 MiG InfoCom AB. All Rights Reserved.