|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.miginfocom.calendar.layout.ActivityLayout
com.miginfocom.calendar.layout.TimeBoundsLayout
public class TimeBoundsLayout
A layout that lays out ActivityViews in a rectangular shape exactly as big as the time it occupies. This layout always
returns at least 0 in getLayoutPriority(com.miginfocom.calendar.activity.view.ActivityView) so it should
be last in the DateArea and effectively becomes the "fall back" layout alternative.
Since the algorithm is quite extensive this layout is not suited for laing out an extremely larget amount activity views. Performance is decreased exponentionally since all activity view have to be check if they overlap any other. A thousand or so should be ok though.
Note that this layout can round the visual bounds with a DateRangeRounder. This means that it can also be used to create
a list, much like the month view in Outlook or iCal, just round it to day boundary with:
layout.setVisualDateRangeRounder(new BoundaryRounder(DateRangeI.RANGE_TYPE_DAY, true, true, false));
| Constructor Summary | |
|---|---|
TimeBoundsLayout()
Constructor for a general gap of two pixels |
|
TimeBoundsLayout(AtRefNumber shapeGap,
AtRefRangeNumber primStart,
AtRefRangeNumber primEnd,
AtRefRangeNumber secStart,
AtRefRangeNumber secEnd,
int categoryGap,
AtRefNumber prefSize,
AtRefNumber minSize,
AtRefNumber maxSize,
java.lang.String[] layoutContexts,
DateRangeRounder rounder)
Constructor. |
|
TimeBoundsLayout(AtRefNumber shapeGap,
AtRefRangeNumber start,
AtRefRangeNumber end,
int categoryGap)
Constructor for no specifiec size constraints of the laid out rectangles. |
|
TimeBoundsLayout(AtRefNumber shapeGap,
AtRefRangeNumber start,
AtRefRangeNumber end,
int categoryGap,
AtRefNumber prefSize,
AtRefNumber minSize,
AtRefNumber maxSize)
Constructor. |
|
TimeBoundsLayout(AtRefNumber shapeGap,
AtRefRangeNumber start,
AtRefRangeNumber end,
int categoryGap,
AtRefNumber prefSize,
AtRefNumber minSize,
AtRefNumber maxSize,
java.lang.String[] layoutContexts,
DateRangeRounder rounder)
Constructor. |
|
| Method Summary | |
|---|---|
boolean |
equals(java.lang.Object o)
|
int |
getCategoryGap()
Returns the gap in pixels between category grid lines and the bounds of the text rects. |
java.lang.String[] |
getDefaultContexts()
Returns the contexts this layout will report a higher priority to layout. |
AtRefRangeNumber |
getEnd()
Returns where to end layout activity views within the cells. |
int |
getLayoutPriority(ActivityView actView)
Returns in which degree this layout accepts responsibility for laying out this ActivityView. |
AtRefNumber |
getMaximumRectangleSize()
Returns the maximum size for the laid out rectangles. If != null this is the preferred size (height or width) of the rect. |
AtRefNumber |
getMinimumRectangleSize()
Returns the minimum size for the laid out rectangles. If != null this is the preferred size (height or width) of the rect. |
AtRefNumber |
getPreferredRectangleSize()
Returns the preferred size for the laid out rectangles. If != null this is the preferred size (height or width) of the rect. |
AtRefRangeNumber |
getPrimaryDimCellEnd()
Returns the cell insets for the end in the primary dimension. |
AtRefRangeNumber |
getPrimaryDimCellStart()
Returns the cell insets for the start in the primary dimension. |
AtRefNumber |
getShapeGap()
Returns the internal gap between the different shapes. |
AtRefRangeNumber |
getStart()
Returns where to start layout activity views within the cells. |
DateRangeRounder |
getVisualDateRangeRounder()
Returns the rounder used for rounding of the laid out activity view's date ranges. |
TimeSpanList |
layout(DateGrid dateGrid,
TimeSpanList actViewList,
java.util.ArrayList occupiedRects,
ImmutableDateRange onlyRange)
Layout the activities within the bounds. |
void |
setCategoryGap(int catGap)
Sets the gap in pixels between category grid lines and the bounds of the text rects. |
void |
setEnd(AtRefRangeNumber end)
Sets where to end layout activity views within the cells. |
void |
setMaximumRectangleSize(AtRefNumber maxSize)
Sets the maximum size for the laid out rectangles. |
void |
setMinimumRectangleSize(AtRefNumber minSize)
Sets the minimum size for the laid out rectangles. |
void |
setPreferredRectangleSize(AtRefNumber prefSize)
Sets the preferred size for the laid out rectangles. |
void |
setPrimaryDimCellEnd(AtRefRangeNumber s)
Returns the cell insets for the end in the primary dimension. |
void |
setPrimaryDimCellStart(AtRefRangeNumber s)
Returns the cell insets for the start in the primary dimension. |
void |
setShapeGap(AtRefNumber shapeGap)
Sets the internal gap between the different shapes. |
void |
setStart(AtRefRangeNumber start)
Sets where to start layout activity views within the cells. |
void |
setVisualDateRangeRounder(DateRangeRounder rounder)
Sets the rounder used for rounding of the laid out activity view's date ranges. |
| Methods inherited from class com.miginfocom.calendar.layout.ActivityLayout |
|---|
getLayoutContexts, isInContexts, setLayoutContexts, toString |
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public TimeBoundsLayout()
public TimeBoundsLayout(AtRefNumber shapeGap,
AtRefRangeNumber start,
AtRefRangeNumber end,
int categoryGap)
shapeGap - The internal gap between the different shapes. Negative values makes the text rects overlap. In reference to row size.start - The gap in pixels between cell grid line before and the bounds of the text rects.end - The gap in pixels between cell grid line after and the bounds of the text rects.categoryGap - The gap in pixels between category grid lines and the bounds of the text rects.AtFixed,
AtFraction
public TimeBoundsLayout(AtRefNumber shapeGap,
AtRefRangeNumber start,
AtRefRangeNumber end,
int categoryGap,
AtRefNumber prefSize,
AtRefNumber minSize,
AtRefNumber maxSize)
shapeGap - The internal gap between the different shapes. Negative values makes the text rects overlap. In reference to row size.start - The gap in pixels between cell grid line before and the bounds of the text rects.end - The gap in pixels between cell grid line after and the bounds of the text rects.categoryGap - The gap in pixels between category grid lines and the bounds of the text rects.prefSize - The preferred size for the laid out rectangles. null means "fill to bounds".minSize - The minimum size for the laid out rectangles. null means no minimum size.maxSize - The maximum size for the laid out rectangles.null means no maximum size.AtFixed,
AtFraction
public TimeBoundsLayout(AtRefNumber shapeGap,
AtRefRangeNumber start,
AtRefRangeNumber end,
int categoryGap,
AtRefNumber prefSize,
AtRefNumber minSize,
AtRefNumber maxSize,
java.lang.String[] layoutContexts,
DateRangeRounder rounder)
shapeGap - The internal gap between the different shapes. Negative values makes the text rects overlap. In reference to row size.start - The gap between cell grid line before and the bounds of the text rects.end - The gap between cell grid line after and the bounds of the text rects.categoryGap - The gap in pixels between category grid lines and the bounds of the text rects.prefSize - The preferred size for the laid out rectangles. null means "fill to bounds".minSize - The minimum size for the laid out rectangles. null means no minimum size.maxSize - The maximum size for the laid out rectangles.null means no maximum size.layoutContexts - The layout contexts this layout should react to. If null the default one {"TimeBounds"} is used.rounder - The rounder (e.g. BoundaryRounder) to round the visual appearance. null means no rounding.AtFixed,
AtFraction
public TimeBoundsLayout(AtRefNumber shapeGap,
AtRefRangeNumber primStart,
AtRefRangeNumber primEnd,
AtRefRangeNumber secStart,
AtRefRangeNumber secEnd,
int categoryGap,
AtRefNumber prefSize,
AtRefNumber minSize,
AtRefNumber maxSize,
java.lang.String[] layoutContexts,
DateRangeRounder rounder)
shapeGap - The internal gap between the different shapes. Negative values makes the text rects overlap. In reference to row size.primStart - The cell insets for the start in the primary dimension. Not null.primEnd - The cell insets for the end in the primary dimension. Not null.secStart - The gap between cell grid line before and the bounds of the text rects.secEnd - The gap between cell grid line after and the bounds of the text rects.categoryGap - The gap in pixels between category grid lines and the bounds of the text rects.prefSize - The preferred size for the laid out rectangles. null means "fill to bounds".minSize - The minimum size for the laid out rectangles. null means no minimum size.maxSize - The maximum size for the laid out rectangles.null means no maximum size.layoutContexts - The layout contexts this layout should react to. If null the default one {"TimeBounds"} is used.rounder - The rounder (e.g. BoundaryRounder) to round the visual appearance. null means no rounding.AtFixed,
AtFraction| Method Detail |
|---|
public int getLayoutPriority(ActivityView actView)
ActivityLayoutActivityView. Activity.getLayoutContext() and the duration is normally used to determine this. The installed layout with the highest
priority will get the chance to layout the actView later on. TimeBoundsLayout will always return 0 so returning a negative value will make
sure that this layout won't be called to layout that actView (that is if TimeBoundsLayout is installed in the DateArea.
Should normally be < 10.
getLayoutPriority in class ActivityLayoutactView - The view that is to be laid out
ActivityView.public java.lang.String[] getDefaultContexts()
getDefaultContexts in class ActivityLayoutnew String[] {"TimeBounds"}
public TimeSpanList layout(DateGrid dateGrid,
TimeSpanList actViewList,
java.util.ArrayList occupiedRects,
ImmutableDateRange onlyRange)
ActivityLayoutbounds. All activities that couldn't fit for some reason should have their bounds set to null.
layout in class ActivityLayoutdateGrid - The Grid to layout the activities withinactViewList - A number of ActivityView objects to layout. Will not be "changed". The individual views should
be sorted in the preferred order to paint the activities later.occupiedRects - The areas (Rectangle2D) that currently are not free. They may or may not be within the bounds. They
also may or may not be ignored, but if they are ignored, they will possibly be painted over or paint over something else. Not null.onlyRange - The layout range that actually need to be laid out. If null all in actViewList should be laid out. This argument
is mostly for optimizing. Since the container can't know which dates translates to what pixels this optimization is up to the atcivity layout.
DateRangeIs representing time spands that couldn't be laid out due to shortage of free space. Not null and it
should be a newly created list that can be overtaken by the caller of this method.public AtRefRangeNumber getPrimaryDimCellStart()
null.getStart()public void setPrimaryDimCellStart(AtRefRangeNumber s)
s - The cell insets for the start in the primary dimension. Not null.setStart(com.miginfocom.util.gfx.geometry.numbers.AtRefRangeNumber)public AtRefRangeNumber getPrimaryDimCellEnd()
null.getEnd()public void setPrimaryDimCellEnd(AtRefRangeNumber s)
s - The cell insets for the end in the primary dimension. Not null.setEnd(com.miginfocom.util.gfx.geometry.numbers.AtRefRangeNumber)public AtRefNumber getShapeGap()
Float or Double: -1 to "MAX". The gap in a percentage of the available bounds. Negative values makes the text rects
overlap. -1f means fully overlap, 0f means side by side.
public void setShapeGap(AtRefNumber shapeGap)
shapeGap - The internal gap between the different shapes.getShapeGap()public AtRefRangeNumber getStart()
Note that this is for the Secondary dimension.
null.public void setStart(AtRefRangeNumber start)
new AtStart(2) to start two pixels in.
Note that this is for the Secondary dimension.
start - Where to start layout activity views within the cells. Not null.public AtRefRangeNumber getEnd()
Note that this is for the Secondary dimension.
null.public void setEnd(AtRefRangeNumber end)
new AtEnd(-2) to end two pixels from the cell's end.
Note that this is for the Secondary dimension.
end - Where to end layout activity views within the cells. Not null.public int getCategoryGap()
public void setCategoryGap(int catGap)
catGap - The gap in pixels between category grid lines and the bounds of the text rects.public AtRefNumber getPreferredRectangleSize()
!= null this is the preferred size (height or width) of the rect. If the grid's primaryDimension
is HORIZONTAL it's the height, and vice versa. null means "fill to bounds". Can be of two types:Float: 0f to 1f. The size is a percentage of the bounds in the laid out dimension.Integer: The size is in absolute pixels.
public void setPreferredRectangleSize(AtRefNumber prefSize)
prefSize - The preferred size for the laid out rectangles.getPreferredRectangleSize()public AtRefNumber getMinimumRectangleSize()
!= null this is the preferred size (height or width) of the rect. If the grid's primaryDimension
is HORIZONTAL it's the height, and vice versa. null means no minimum size. Can be of two types:Float: 0f to 1f. The size is a percentage of the bounds in the laid out dimension.Integer: The size is in absolute pixels.
public void setMinimumRectangleSize(AtRefNumber minSize)
minSize - The minimum size for the laid out rectangles.getMinimumRectangleSize()public AtRefNumber getMaximumRectangleSize()
!= null this is the preferred size (height or width) of the rect. If the grid's primaryDimension
is HORIZONTAL it's the height, and vice versa. null means no maximum size. Can be of two types:Float: 0f to 1f. The size is a percentage of the bounds in the laid out dimension.Integer: The size is in absolute pixels.
public void setMaximumRectangleSize(AtRefNumber maxSize)
maxSize - The maximum size for the laid out rectangles.getMaximumRectangleSize()public DateRangeRounder getVisualDateRangeRounder()
null.setVisualDateRangeRounder(com.miginfocom.util.dates.DateRangeRounder)public void setVisualDateRangeRounder(DateRangeRounder rounder)
null for no rounding.
rounder - The rounder that should be used for rounding of the laid out activity view's date ranges. May be null.public boolean equals(java.lang.Object o)
equals in class java.lang.Object
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||