com.miginfocom.ashape
Class SizeRangeVisibility

java.lang.Object
  extended by com.miginfocom.ashape.SizeRangeVisibility
All Implemented Interfaces:
Visibility, java.io.Serializable

public class SizeRangeVisibility
extends java.lang.Object
implements Visibility

An implementation that defines a default visibility and optional size ranges, either horizontal or vertical, that has the opposite (inverted) visibility.

Note! To denote simple on/off visibility use Visibility.FALSE or Visibility.TRUE instead. Those are faster and consumes less memory.

See Also:
BooleanRange, Serialized Form

Field Summary
 
Fields inherited from interface com.miginfocom.ashape.Visibility
FALSE, TRUE
 
Constructor Summary
SizeRangeVisibility(boolean defaultVisibility)
          Constructor.
SizeRangeVisibility(boolean defaultVisibility, java.util.List visibilityRanges)
          Constructor.
 
Method Summary
 void addHorizontalVisibilityRange(int rangeStart, int rangeEnd)
          Adds a horizintal size range that has the inverted visibility compared to the default one supplied in the constructor.
 void addVerticalVisibilityRange(int rangeStart, int rangeEnd)
          Adds a vertical size range that has the inverted visibility compared to the default one supplied in the constructor.
 boolean getDefaultVisibility()
          Returns the default visibility that is returned if no size ranges "hits" the size of the AShape.
 SizeRangeVisibility getInverted()
          Returns a new object that is inverted compared to this.
 java.util.List getVisibilityRanges()
          Returns the current BooleanRanges stored.
 boolean getVisiblity(AShape shape)
          Returns if something with the specified size should be visible.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SizeRangeVisibility

public SizeRangeVisibility(boolean defaultVisibility)
Constructor.

Parameters:
defaultVisibility - If none of the size ranges added is "hit" by the act

SizeRangeVisibility

public SizeRangeVisibility(boolean defaultVisibility,
                           java.util.List visibilityRanges)
Constructor.

Parameters:
defaultVisibility - If none of the size ranges added is "hit" by the act this visibility is returned.
visibilityRanges - A list of BooleanRanges. Never null.
Method Detail

getInverted

public SizeRangeVisibility getInverted()
Returns a new object that is inverted compared to this.

Returns:
A new object that is inverted compared to this.

getVisiblity

public boolean getVisiblity(AShape shape)
Description copied from interface: Visibility
Returns if something with the specified size should be visible.

Specified by:
getVisiblity in interface Visibility
Parameters:
shape - The shape that is decided if it should be visible or not. The bounds should be set since this is probably one of the thing that the implelentation will use to decide.
Returns:
If the shape should be visible or not.

getDefaultVisibility

public boolean getDefaultVisibility()
Returns the default visibility that is returned if no size ranges "hits" the size of the AShape.

Returns:
The default visibility that is returned if no size ranges "hits" the size of the AShape.

addHorizontalVisibilityRange

public void addHorizontalVisibilityRange(int rangeStart,
                                         int rangeEnd)
Adds a horizintal size range that has the inverted visibility compared to the default one supplied in the constructor.

Parameters:
rangeStart - The minimum size inclusive.
rangeEnd - The maximum size inclusive.

addVerticalVisibilityRange

public void addVerticalVisibilityRange(int rangeStart,
                                       int rangeEnd)
Adds a vertical size range that has the inverted visibility compared to the default one supplied in the constructor.

Parameters:
rangeStart - The minimum size inclusive.
rangeEnd - The maximum size inclusive.

getVisibilityRanges

public java.util.List getVisibilityRanges()
Returns the current BooleanRanges stored.

Returns:
The current BooleanRanges stored. Never null.


Copyright © 2009 MiG InfoCom AB. All Rights Reserved.