com.miginfocom.calendar.datearea
Interface DateArea

All Superinterfaces:
DateGridContainer, GridContainer
All Known Implementing Classes:
DefaultDateArea, ThemeDateArea

public interface DateArea
extends DateGridContainer

Teh heart in the com.miginfocom.calendar component. Aggreagtes a lot of other parts like a DateGrid, decorator support, a few date ranges (cisual, selected and so on), Categories, information on the 'structure' of the date grid (so it can be recreated when necessary).


Field Summary
static int SELECTION_TYPE_NONE
          The type of selection that can be made when the mouse is clicked / dragged on the date area surface.
static int SELECTION_TYPE_NORMAL
          The type of selection that can be made when the mouse is clicked / dragged on the date area surface.
 
Method Summary
 void addActivityLayout(ActivityLayout layout)
          Installs a layout that will be queried to layout ActivityViews.
 void addDateChangeListener(DateChangeListener l)
          Adds a listener that gets notified when any date range (mouseOver, pressed, selected, selectable) changes.
 void addDateChangeListener(DateChangeListener l, boolean asWeakRef)
          Adds a listener that gets notified when any date range (mouseOver, pressed, selected, selectable) changes.
 void clearSelectableRange()
          Clears the selected date range.
 void clearSelectedRange()
          Clears the selected date range.
 java.util.List getActivityLayouts()
          Returns the layouts currently installed as a new list.
 Filter getActivityViewFilter()
          Returns the filter currently filtering all shown ActivityViews in the date area.
 java.awt.Rectangle getBoundingRect(long millis, java.util.TimeZone timeZone, int cellSizeMode, boolean forDraw)
          Returns the bounding box for a date in the contained grid.
 javax.swing.JComponent getComponent()
          Returns the component that show the date area.
 DateGrid getDateGrid()
          Returns the current DateGrid object in use in this DateArea.
 MutableDateRange getDateRangeForPoint(java.awt.Point p, boolean onlySelectableDates, boolean singlePIT, boolean lenient)
          Returns the currect range for the point 'p'.
 DateRangeI getDateRangeSelection(int type)
          Returns the selection date range indicated.
 int getPrimaryDimension()
          What dimension time progresses if there was no wrapping.
 int getPrimaryDimensionCellType()
          Returns the type of primDimCellSpanCount.
 int getPrimaryDimensionCellTypeCount()
          Returns how may cells in the primary dimension.
 Filter[] getRowFilters()
          Returns the filters currently in the date area.
 javax.swing.JScrollPane getScrollPane()
          Returns the scroll pane that host the date area if one was created.
 int getSecondaryDimension()
          What dimension that increase it's size when time wraps.
 ImmutableDateRange getSelectableRange()
          Returns the selectable range.
 DateRangeI getSelectedRange()
          Returns the currently selected date range or null if none.
 int getSelectionType()
          Returns the type of selection that can be made when the mouse is clicked / dragged on the date area surface.
 ImmutableDateRange getVisibleDateRange()
          Returns the current visible range has been set.
 ImmutableDateRange getVisibleDateRangeCorrected()
          Returns the visible date range corrected for the fact that the date grid has to have its range even up to the cells.
 java.lang.Integer getWrapBoundary()
          At what date range boundary the date area will wrap.
 int getWrapBoundaryCount()
          The number of wrapBoundary before wrapping.
 boolean isActivitiesSupported()
          Returns whether this date area should support activities.
 boolean isSelectable(DateRangeI dateRange)
          Returns if the whole of 'dateRange' is within the selectable range.
 void removeActivityLayout(ActivityLayout layout)
          Removes a layout for a date area, if it exists.
 void removeDateChangeListener(DateChangeListener l)
          Removes the listener, if it is in the list.
 void setActivitiesSupported(boolean b)
          Set whether this date area should support activities.
 void setActivityLayouts(java.util.List layouts)
          Remove all prior layouts and adds the ones in layouts.
 void setActivityViewFilter(Filter filter)
          Set the filter currently filtering all shown ActivityViews in the date area.
 void setDateRangeSelection(DateRangeI dateRange, int type, boolean fireUpdateEvent)
          Selects a new range in the area and possibly fires an event to tell every listener about it.
 void setPrimaryDimension(int dim)
          Sets the dimension time progresses if there was no wrapping.
 void setPrimaryDimensionCellType(int rangeType)
          Sets the type of primDimCellSpanCount.
 void setPrimaryDimensionCellTypeCount(int count)
          Sets how many primDimCellSpanType a cell spanns in the primary dimension.
 void setRowFilters(Filter[] filters)
          If non null every row in the grid will be divided into subrows that each is specified by one Filter.
 void setSelectableRange(DateRangeI dateRange)
          Sets the range of dates that can be selected.
 void setSelectedRange(DateRangeI dateRange)
          Sets the date range that is considered to be selected in the grid.
 void setSelectionType(int selectionType)
          Sets the type of selection that can be made when the mouse is clicked / dragged on the date area surface.
 void setVisibleDateRange(DateRangeI dateRange)
          Sets the dateArea's visible dates.
 void setWrapBoundary(java.lang.Integer wrapBoundary)
          At what date range boundary the date area will wrap.
 void setWrapBoundaryCount(int count)
          The number of wrapBoundary before wrapping.
 
Methods inherited from interface com.miginfocom.calendar.grid.GridContainer
addGridListener, addGridListener, getGrid, removeGridListener
 

Field Detail

SELECTION_TYPE_NONE

static final int SELECTION_TYPE_NONE
The type of selection that can be made when the mouse is clicked / dragged on the date area surface.

This value denotes no selection can be made. (default)

See Also:
setSelectionType(int), Constant Field Values

SELECTION_TYPE_NORMAL

static final int SELECTION_TYPE_NORMAL
The type of selection that can be made when the mouse is clicked / dragged on the date area surface.

This value denotes normal selection can be made.

See Also:
setSelectionType(int), Constant Field Values
Method Detail

clearSelectableRange

void clearSelectableRange()
Clears the selected date range. Exactly the same as setDateRangeSelection(null, DateChangeEvent.SELECTABLE, true);.


setSelectedRange

void setSelectedRange(DateRangeI dateRange)
Sets the date range that is considered to be selected in the grid. This is exactly the same as:
setDateRangeSelection(dateRange, DateChangeEvent.SELECTED, true);.

Parameters:
dateRange - The new date range. null clears the selection.

getSelectedRange

DateRangeI getSelectedRange()
Returns the currently selected date range or null if none. This is exactly the same as:
getDateRangeSelection(DateChangeEvent.SELECTED);.

Returns:
The currently selected date range or null if none.

clearSelectedRange

void clearSelectedRange()
Clears the selected date range. Exactly the same as setDateRangeSelection(null, DateChangeEvent.SELECTED, true);.


getSelectionType

int getSelectionType()
Returns the type of selection that can be made when the mouse is clicked / dragged on the date area surface.

Returns:
The selection type. E.g. SELECTION_TYPE_NORMAL (SELECTION_TYPE_NONE is default)

setSelectionType

void setSelectionType(int selectionType)
Sets the type of selection that can be made when the mouse is clicked / dragged on the date area surface.

Parameters:
selectionType - The selection type. E.g. SELECTION_TYPE_NORMAL (default)

setSelectableRange

void setSelectableRange(DateRangeI dateRange)
Sets the range of dates that can be selected. Dates outside this range may be visible but not selectable.

Parameters:
dateRange - The new range. null means that all dates are selectable. Cloned locally

getSelectableRange

ImmutableDateRange getSelectableRange()
Returns the selectable range.

Returns:
The selectable range. Can be null which means everything is selectable.

isSelectable

boolean isSelectable(DateRangeI dateRange)
Returns if the whole of 'dateRange' is within the selectable range.

Parameters:
dateRange - The range to check. Not null.
Returns:
If the whole of 'dateRange' is within the selectable range.

setVisibleDateRange

void setVisibleDateRange(DateRangeI dateRange)
Sets the dateArea's visible dates.

Parameters:
dateRange - The range that should be shown. Not changed, cloned locally.
See Also:
getVisibleDateRangeCorrected()

getVisibleDateRange

ImmutableDateRange getVisibleDateRange()
Returns the current visible range has been set. Not that this might not be the exact date range that is shown since the DateGrid must have a date range that evens up to its cells. To get that aske the date grid for the date range instead.

Returns:
The visible range as has been set with setVisibleDateRange(com.miginfocom.util.dates.DateRangeI)

getVisibleDateRangeCorrected

ImmutableDateRange getVisibleDateRangeCorrected()
Returns the visible date range corrected for the fact that the date grid has to have its range even up to the cells. So for instance if evenr weeks are shown the date range is rounded to an even week boundary.

Returns:
The corrected visible range. A new object every time.

getBoundingRect

java.awt.Rectangle getBoundingRect(long millis,
                                   java.util.TimeZone timeZone,
                                   int cellSizeMode,
                                   boolean forDraw)
Returns the bounding box for a date in the contained grid.

Parameters:
millis - The date/time.
timeZone - The time zone to use. null uses the zone for the grid.
cellSizeMode - The size and placement of the returned rectangle. Eg. Grid.SIZE_MODE_INSIDE
forDraw - If true the returned size is for draw-commands. If false it's sized for fill-commands (one pixel bigger).
Returns:
A rectangle of the bounds of the cell

setDateRangeSelection

void setDateRangeSelection(DateRangeI dateRange,
                           int type,
                           boolean fireUpdateEvent)
Selects a new range in the area and possibly fires an event to tell every listener about it.

Parameters:
dateRange - The new selection range or null for no selection. The order is not sorted here, if only sorted ranges should be possible that should be done beforehand. Clones the reference for storing locally.
type - The type of selection that changed. E.g. DateChangeEvent.SELECTED
fireUpdateEvent - Om true fires ett event if the selected range changed.

getDateRangeSelection

DateRangeI getDateRangeSelection(int type)
Returns the selection date range indicated.

Parameters:
type - The type of selection. E.g. DateChangeEvent.MOUSE_OVER
Returns:
A clone of the selection date range indicated or null if that kind of selection is not active. Will always be sorted.
See Also:
DateRangeI.isSorted()

setRowFilters

void setRowFilters(Filter[] filters)
If non null every row in the grid will be divided into subrows that each is specified by one Filter.

Parameters:
filters - The filters to apply to the sub rows. null turns of filtered sub rows. Object is overtaken.

getRowFilters

Filter[] getRowFilters()
Returns the filters currently in the date area.

Returns:
The filters currently in the date area. The live array, so do not change it.

setActivityViewFilter

void setActivityViewFilter(Filter filter)
Set the filter currently filtering all shown ActivityViews in the date area.

Parameters:
filter - The filter currently filtering all shown ActivityViews in the date area. If null no filtering will be done and all activity views will be accepted.

getActivityViewFilter

Filter getActivityViewFilter()
Returns the filter currently filtering all shown ActivityViews in the date area.

Returns:
The filter currently filtering all shown ActivityViews in the date area. May be null.

getDateRangeForPoint

MutableDateRange getDateRangeForPoint(java.awt.Point p,
                                      boolean onlySelectableDates,
                                      boolean singlePIT,
                                      boolean lenient)
Returns the currect range for the point 'p'.

Does NOT take into acount if the dates in the range actually are selectable and of not returns null.

Parameters:
p - The point in the to be translated to a range (see SelectableDates).
onlySelectableDates - If true only date ranges that are enirely within the selectable range are returnen. null will be returned otherwise.
singlePIT - Only Single Point In Time. If true a date range that has the start and end dates set to the exact time the mouse is over, not rounded to cell boundary. Returns null if not over a valid point.
lenient - If true a the date range that makes most sense will be returned if p isn't hitting the dateable area.
Returns:
The date range corresponding to a possition Could be null if invalid.

getWrapBoundary

java.lang.Integer getWrapBoundary()
At what date range boundary the date area will wrap. E.g. DateRangeI.RANGE_TYPE_WEEK

Returns:
The date range type or null for no wrap.

setWrapBoundary

void setWrapBoundary(java.lang.Integer wrapBoundary)
At what date range boundary the date area will wrap. E.g. DateRangeI.RANGE_TYPE_WEEK

Invalidates the date grid so that it will be recreated next validation.

Parameters:
wrapBoundary - The date range type. Only minute, hour, day or week. Can be null which means no wrap.

getWrapBoundaryCount

int getWrapBoundaryCount()
The number of wrapBoundary before wrapping.

Returns:
The number of wrapBoundary before wrapping. Default is 1. Always > 0.

setWrapBoundaryCount

void setWrapBoundaryCount(int count)
The number of wrapBoundary before wrapping.

Invalidates the date grid so that it will be recreated next validation.

Parameters:
count - The count. Default is 1.If < 1 then 1 will be set silently.
Since:
6.0

getPrimaryDimensionCellTypeCount

int getPrimaryDimensionCellTypeCount()
Returns how may cells in the primary dimension. Unly used if wrapBoundary is set.

Returns:
How may cells in the primary dimension. Unly used if wrapBoundary is set.

setPrimaryDimensionCellTypeCount

void setPrimaryDimensionCellTypeCount(int count)
Sets how many primDimCellSpanType a cell spanns in the primary dimension. E.g. 30 (if primDimCellSpanType is minutes).

Parameters:
count - how many primDimCellSpanType a cell spanns in the primary dimension.

getPrimaryDimensionCellType

int getPrimaryDimensionCellType()
Returns the type of primDimCellSpanCount. E.g DateRangeI.RANGE_TYPE_MINUTE

Returns:
The type of primDimCellSpanCount. E.g DateRangeI.RANGE_TYPE_MINUTE

setPrimaryDimensionCellType

void setPrimaryDimensionCellType(int rangeType)
Sets the type of primDimCellSpanCount. E.g DateRangeI.RANGE_TYPE_MINUTE

Parameters:
rangeType - The type of primDimCellSpanCount. E.g DateRangeI.RANGE_TYPE_MINUTE

getPrimaryDimension

int getPrimaryDimension()
What dimension time progresses if there was no wrapping. SwingConstants.HORIZONTAL or SwingConstants.VERTICAL.

Returns:
What dimension time progresses if there was no wrapping.

setPrimaryDimension

void setPrimaryDimension(int dim)
Sets the dimension time progresses if there was no wrapping. SwingConstants.HORIZONTAL or SwingConstants.VERTICAL.

Parameters:
dim - What dimension time progresses if there was no wrapping.

getSecondaryDimension

int getSecondaryDimension()
What dimension that increase it's size when time wraps. This is just the other dimension from getPrimaryDimension(). SwingConstants.HORIZONTAL or SwingConstants.VERTICAL.

Returns:
What dimension that increase it's size when time wraps.

setActivityLayouts

void setActivityLayouts(java.util.List layouts)
Remove all prior layouts and adds the ones in layouts.

Parameters:
layouts - The layouts to add. Not null.
See Also:
addActivityLayout(com.miginfocom.calendar.layout.ActivityLayout)

addActivityLayout

void addActivityLayout(ActivityLayout layout)
Installs a layout that will be queried to layout ActivityViews. The layouts will be interrogated to know which one should be used to layout every ActivityView. The layout is responsible for setting the bounds of the view and then it is up to the renderer of the view to render in those bounds.

Parameters:
layout - The layout to added. Not null.

removeActivityLayout

void removeActivityLayout(ActivityLayout layout)
Removes a layout for a date area, if it exists. Resorts the list.

Parameters:
layout - The layout to remove.
See Also:
addActivityLayout(com.miginfocom.calendar.layout.ActivityLayout)

getActivityLayouts

java.util.List getActivityLayouts()
Returns the layouts currently installed as a new list.

Returns:
The layouts currently installed as a new list. Never null.
See Also:
addActivityLayout(com.miginfocom.calendar.layout.ActivityLayout)

addDateChangeListener

void addDateChangeListener(DateChangeListener l)
Adds a listener that gets notified when any date range (mouseOver, pressed, selected, selectable) changes.

Don't add as weak reference.

Parameters:
l - The listener. Not null

addDateChangeListener

void addDateChangeListener(DateChangeListener l,
                           boolean asWeakRef)
Adds a listener that gets notified when any date range (mouseOver, pressed, selected, selectable) changes.

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.

removeDateChangeListener

void removeDateChangeListener(DateChangeListener l)
Removes the listener, if it is in the list.

Parameters:
l - The listener to remove.

getComponent

javax.swing.JComponent getComponent()
Returns the component that show the date area.

Returns:
The component that show the date area.

getScrollPane

javax.swing.JScrollPane getScrollPane()
Returns the scroll pane that host the date area if one was created.

Returns:
he scroll pane that host the date area. Might be null.

getDateGrid

DateGrid getDateGrid()
Returns the current DateGrid object in use in this DateArea.

Specified by:
getDateGrid in interface DateGridContainer
Returns:
The current DateGrid object in use in this DateArea. Never null.

setActivitiesSupported

void setActivitiesSupported(boolean b)
Set whether this date area should support activities.

Parameters:
b - true turns on.

isActivitiesSupported

boolean isActivitiesSupported()
Returns whether this date area should support activities.

Returns:
Whether this date area should support activities. false is default.


Copyright © 2009 MiG InfoCom AB. All Rights Reserved.