com.miginfocom.calendar.decorators
Class OccupiedDecorator

java.lang.Object
  extended by com.miginfocom.calendar.decorators.AbstractGridDecorator
      extended by com.miginfocom.calendar.decorators.AbstractDateGridDecorator
          extended by com.miginfocom.calendar.decorators.OccupiedDecorator
All Implemented Interfaces:
Decorator, GridDecorator, java.lang.Comparable

public class OccupiedDecorator
extends AbstractDateGridDecorator

A decorator that draws a shape for all time in a grid that is overlapping an activity view. Can for instance be used to draw something that looks like the blue thick line on the left side in Outlook's work week view.

The painted shape will only be used for painting, no interactivity is possible with this shape.


Field Summary
static int DEFAULT_SIZE
           
 
Constructor Summary
OccupiedDecorator(DefaultDateArea dateArea, int layerIndex, java.awt.Paint occFill, java.awt.Paint notOccFill, java.awt.Paint occOutline, java.awt.Paint notOccOutline, PlaceRect placeRect, boolean mergeOverlapping)
          Constructor that tunes the default shapes, which can be compated to the blue bar to the left in Outlook's work week view.
OccupiedDecorator(DefaultDateArea dateArea, int layerIndex, java.awt.Paint occFill, java.awt.Paint notOccFill, java.awt.Paint outline, PlaceRect placeRect, boolean mergeOverlapping)
          Constructor that tunes the default shapes, which can be compated to the blue bar to the left in Outlook's work week view.
OccupiedDecorator(DefaultDateArea dateArea, int layerIndex, RootAShape occAShape, RootAShape notOccAShape, boolean mergeOverlapping)
          Constructor.
 
Method Summary
static RootAShape createDefaultNotOccupiedShape(int secDim, java.awt.Paint fill, java.awt.Paint outline, PlaceRect placeRect)
          Create the shape.
static RootAShape createDefaultOccupiedShape(int secDim, java.awt.Paint fill, java.awt.Paint outline, PlaceRect placeRect)
          Create the shape.
 void doPaint(java.awt.Graphics2D g2, java.awt.Rectangle bounds)
          Paint what should be painted.
 Filter getFilter()
          Returns the filter used to filter which occupied activity views to concider.
 boolean getMergeOverlapping()
          Returns if overlapping activity views date ranges should be merged (and thus only one range painted) or not.
 RootAShape getNotOccupiedShape()
          Returns the shape to use for painting the whole range.
 RootAShape getOccupiedShape()
          Returns the shape to use for painting the occupied ranges.
 java.lang.Integer getRoundToRangeType()
          Returns how (if) to round the occupied ranges.
 void gridChanged(java.beans.PropertyChangeEvent e)
          Called when the grid changes.
 void setFilter(Filter filter)
          Sets the filter used to filter which occupied activity views to concider.
 void setMergeOverlapping(boolean merge)
          Sets if overlapping activity views date ranges should be merged (and thus only one range painted) or not.
 void setNotOccupiedShape(RootAShape notOccAShape)
          Sets the shape to use for painting the whole range.
 void setOccupiedShape(RootAShape occAShape)
          Sets the shape to use for painting the occupied ranges.
 void setRoundToRangeType(java.lang.Integer roundToRangeType)
          Sets how (if) to round the occupied ranges.
 
Methods inherited from class com.miginfocom.calendar.decorators.AbstractDateGridDecorator
getDateGrid, getDateGridContainer
 
Methods inherited from class com.miginfocom.calendar.decorators.AbstractGridDecorator
compareTo, dispose, getGrid, getGridContainer, getInvalidEnd, getInvalidStart, getLayerIndex, hasInvalidCells, invalidateCells, processEvent, setCellsValid, setLayerIndex
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_SIZE

public static final int DEFAULT_SIZE
See Also:
Constant Field Values
Constructor Detail

OccupiedDecorator

public OccupiedDecorator(DefaultDateArea dateArea,
                         int layerIndex,
                         RootAShape occAShape,
                         RootAShape notOccAShape,
                         boolean mergeOverlapping)
Constructor.

Parameters:
dateArea - The date area to decorate.
layerIndex - The intex for this layer. Bigger value means painted on top.
occAShape - The shape to use for painting the occupied ranges. No interactor or broker will be assigned to it by this class. May be null in which case it will not be painted.
notOccAShape - The shape first painted for the whole of the date range. Will be overwritten by the occupied shape for occupied ranges. May be null in which case it will not be painted. No interactor or broker will be assigned to it by this class.
mergeOverlapping - If overlapping activity views date ranges should be merged (en thus only one range painted) or not.

OccupiedDecorator

public OccupiedDecorator(DefaultDateArea dateArea,
                         int layerIndex,
                         java.awt.Paint occFill,
                         java.awt.Paint notOccFill,
                         java.awt.Paint outline,
                         PlaceRect placeRect,
                         boolean mergeOverlapping)
Constructor that tunes the default shapes, which can be compated to the blue bar to the left in Outlook's work week view.

Parameters:
dateArea - Teh date area to decorate.
layerIndex - The intex for this layer. Bigger value means painted on top.
occFill - Fill for the duration that are occupied. If null nothing is painted.
notOccFill - Fill for the duration that are not occupied. Will be painted first and for the whole date grid's date range. If null nothing is painted.
outline - The paint for the ouline. Normally a Color. If null no outline is painted. Will be used for both the not occupied (free) outline as well as for the occupied outline.
placeRect - The where within the bounds to place the decoration. If null a default placing with size DEFAULT_SIZE is created.
mergeOverlapping - If overlapping activity views' date ranges should be merged (and thus only one range painted) or not.

OccupiedDecorator

public OccupiedDecorator(DefaultDateArea dateArea,
                         int layerIndex,
                         java.awt.Paint occFill,
                         java.awt.Paint notOccFill,
                         java.awt.Paint occOutline,
                         java.awt.Paint notOccOutline,
                         PlaceRect placeRect,
                         boolean mergeOverlapping)
Constructor that tunes the default shapes, which can be compated to the blue bar to the left in Outlook's work week view.

Parameters:
dateArea - Teh date area to decorate.
layerIndex - The intex for this layer. Bigger value means painted on top.
occFill - Fill for the duration that are occupied. If null nothing is painted.
notOccFill - Fill for the duration that are not occupied. Will be painted first and for the whole date grid's date range. If null nothing is painted.
occOutline - The paint for the ouline. Normally a Color. If null no outline is painted.
placeRect - The where within the bounds to place the decoration. If null a default placing with size DEFAULT_SIZE is created.
mergeOverlapping - If overlapping activity views' date ranges should be merged (and thus only one range painted) or not.
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.

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.

getRoundToRangeType

public java.lang.Integer getRoundToRangeType()
Returns how (if) to round the occupied ranges. If not null all occupied date ranges will be rounded to this range type. Can be used to, for instance, make the decorated range type span a full day.

Returns:
The date range or null. E.g. DateRangeI.RANGE_TYPE_DAY.

setRoundToRangeType

public void setRoundToRangeType(java.lang.Integer roundToRangeType)
Sets how (if) to round the occupied ranges. If not null all occupied date ranges will be rounded to this range type. Can be used to, for instance, make the decorated range type span a full day.

Parameters:
roundToRangeType - The date range or null. E.g. DateRangeI.RANGE_TYPE_DAY.

getOccupiedShape

public RootAShape getOccupiedShape()
Returns the shape to use for painting the occupied ranges.

Returns:
The shape to use for painting the occupied ranges. May be null.

setOccupiedShape

public void setOccupiedShape(RootAShape occAShape)
Sets the shape to use for painting the occupied ranges.

Parameters:
occAShape - The shape to use for painting the occupied ranges. May be null.

getNotOccupiedShape

public RootAShape getNotOccupiedShape()
Returns the shape to use for painting the whole range. Will be overwritten by the occupied shape for occupied ranges.

Returns:
The shape to use for painting the occupied ranges. May be null.

setNotOccupiedShape

public void setNotOccupiedShape(RootAShape notOccAShape)
Sets the shape to use for painting the whole range. Will be overwritten by the occupied shape for occupied ranges.

Parameters:
notOccAShape - The shape to use for painting the occupied ranges. May be null.

getMergeOverlapping

public boolean getMergeOverlapping()
Returns if overlapping activity views date ranges should be merged (and thus only one range painted) or not.

Returns:
If overlapping activity views date ranges should be merged or not.

setMergeOverlapping

public void setMergeOverlapping(boolean merge)
Sets if overlapping activity views date ranges should be merged (and thus only one range painted) or not.

Parameters:
merge - If overlapping activity views date ranges should be merged or not.

getFilter

public Filter getFilter()
Returns the filter used to filter which occupied activity views to concider.

Returns:
The filter used to filter which occupied activity views to concider. May be null.

setFilter

public void setFilter(Filter filter)
Sets the filter used to filter which occupied activity views to concider. For every ActivityView Filter.accept(Object actView) will be called if if it returns false that view's date range will not be painted.

Parameters:
filter - The filter used to filter which occupied activity views to concider. May be null in which case all avtivity views are accepted.

createDefaultOccupiedShape

public static RootAShape createDefaultOccupiedShape(int secDim,
                                                    java.awt.Paint fill,
                                                    java.awt.Paint outline,
                                                    PlaceRect placeRect)
Create the shape.

Parameters:
secDim - Which dimension is the date area's secondary dimension. SwingConstants.HORIZONTAL or SwingConstants.VERTICAL.
fill - Fill for the shape. May be null.
outline - The paint for the outline. Normally a Color. May be null.
placeRect - The where within the bounds to place the decoration. If null a default placing with size DEFAULT_SIZE is created. May be null.
Returns:
A newly created shape or null if both fill and outline is null.

createDefaultNotOccupiedShape

public static RootAShape createDefaultNotOccupiedShape(int secDim,
                                                       java.awt.Paint fill,
                                                       java.awt.Paint outline,
                                                       PlaceRect placeRect)
Create the shape.

Parameters:
secDim - Which dimension is the date area's secondary dimension. SwingConstants.HORIZONTAL or SwingConstants.VERTICAL.
fill - Fill for the shape. May be null.
outline - The paint for the outline. Normally a Color. May be null.
placeRect - The where within the bounds to place the decoration. If null a default placing with size DEFAULT_SIZE is created. May be null.
Returns:
A newly created shape or null if both fill and outline is null.

gridChanged

public void gridChanged(java.beans.PropertyChangeEvent e)
Description copied from class: AbstractGridDecorator
Called when the grid changes.

Specified by:
gridChanged in class AbstractGridDecorator
Parameters:
e - The event.


Copyright © 2009 MiG InfoCom AB. All Rights Reserved.