com.miginfocom.calendar.layout
Class HideLayout

java.lang.Object
  extended by com.miginfocom.calendar.layout.ActivityLayout
      extended by com.miginfocom.calendar.layout.HideLayout
All Implemented Interfaces:
java.io.Serializable

public class HideLayout
extends ActivityLayout

An activity layout that is hiding activity views depending on the time is spans. Can, for instance, hide a view if:

See Also:
Serialized Form

Constructor Summary
HideLayout()
          Constructor that hides nothing.
HideLayout(RangeCount hideBelow, RangeCount hideAbove)
          Constructor.
HideLayout(RangeCount hideBelow, RangeCount hideAbove, java.lang.String[] layoutContexts)
          Constructor.
 
Method Summary
 boolean equals(java.lang.Object o)
           
 java.lang.String[] getDefaultContexts()
          Returns the contexts this layout will report a higher priority to layout.
 RangeCount getHideAbove()
          Returns the upper boundary.
 RangeCount getHideBelow()
          Returns the lower boundary.
 int getLayoutPriority(ActivityView actView)
          Returns in which degree this layout accepts responsibility for laying out this ActivityView.
 TimeSpanList layout(DateGrid dateGrid, TimeSpanList actViewList, java.util.ArrayList occupiedRects, ImmutableDateRange onlyRange)
          Layout the activities within the bounds.
 void setHideAbove(RangeCount hideAbove)
          Sets the upper range count.
 void setHideBelow(RangeCount hideBelow)
          Sets the lower range count.
 
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

HideLayout

public HideLayout()
Constructor that hides nothing.


HideLayout

public HideLayout(RangeCount hideBelow,
                  RangeCount hideAbove)
Constructor.

Parameters:
hideBelow - Hides all activity views which size is less than the size the hideBelow specifies. null means no hideing.
hideAbove - Hides all activity views which size is larger than the size the hideAbove specifies. null means no hideing.

HideLayout

public HideLayout(RangeCount hideBelow,
                  RangeCount hideAbove,
                  java.lang.String[] layoutContexts)
Constructor.

Parameters:
hideBelow - Hides all activity views which size is less than the size the hideBelow specifies. null means no hideing.
hideAbove - Hides all activity views which size is larger than the size the hideAbove specifies. null means no hideing.
layoutContexts - The layout contexts this layout should react to. If null the default one {"FlexGrid"} is used.
Method Detail

getHideBelow

public RangeCount getHideBelow()
Returns the lower boundary.

Returns:
The lower boundary or null if none.

setHideBelow

public void setHideBelow(RangeCount hideBelow)
Sets the lower range count. Activity views which size is less than this will be hidden.

Parameters:
hideBelow - Sets the lower range count or null for no lower range count.

getHideAbove

public RangeCount getHideAbove()
Returns the upper boundary.

Returns:
The upper boundary or null if none.

setHideAbove

public void setHideAbove(RangeCount hideAbove)
Sets the upper range count. Activity views which size is less than this will be hidden.

Parameters:
hideAbove - Sets the upper range count or null for no lower range count.

getLayoutPriority

public int getLayoutPriority(ActivityView actView)
Description copied from class: ActivityLayout
Returns in which degree this layout accepts responsibility for laying out this ActivityView.
The 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.

Specified by:
getLayoutPriority in class ActivityLayout
Parameters:
actView - The view that is to be laid out
Returns:
If this layout accepts responsibility for laying out this ActivityView.

getDefaultContexts

public java.lang.String[] getDefaultContexts()
Returns the contexts this layout will report a higher priority to layout.

Specified by:
getDefaultContexts in class ActivityLayout
Returns:
new String[] {"Hide"}

layout

public TimeSpanList layout(DateGrid dateGrid,
                           TimeSpanList actViewList,
                           java.util.ArrayList occupiedRects,
                           ImmutableDateRange onlyRange)
Description copied from class: ActivityLayout
Layout the activities within the bounds. All activities that couldn't fit for some reason should have their bounds set to null.

Specified by:
layout in class ActivityLayout
Parameters:
dateGrid - The Grid to layout the activities within
actViewList - 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.
Returns:
A list with DateRangeIs representing time spans 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.

equals

public boolean equals(java.lang.Object o)
Overrides:
equals in class java.lang.Object


Copyright © 2009 MiG InfoCom AB. All Rights Reserved.