com.miginfocom.calendar.grid
Class GridSegment

java.lang.Object
  extended by com.miginfocom.calendar.grid.GridSegment
All Implemented Interfaces:
java.io.Serializable

public class GridSegment
extends java.lang.Object
implements java.io.Serializable

A number of rows/columns in a grid that shares the same size and size restrictions.

See Also:
GridSegmentSpec, Serialized Form

Constructor Summary
GridSegment(int cellCount, AtNumber min, AtRefNumber preferred, AtNumber max)
          Constructor.
GridSegment(int cellCount, SizeSpec size)
          Constructor.
 
Method Summary
 boolean equals(java.lang.Object o)
           
 int getCellCount()
          Returns the number of cells
 AtNumber getMaxCellSize()
          Return the maximum size for a cell.
 int getMaxCellSizeI()
          Returns max as int.
 AtNumber getMinCellSize()
          Return the minimum size for a cell.
 int getMinCellSizeI()
          Returns min as int.
 AtRefNumber getPreferredCellSize()
          Return the preferred size for a cell.
 int getPreferredCellSizeI()
          Return preferred size as an absolute int.
 AtRefNumber[] getSegmentSizes()
          Returns the size constraints for this segment.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

GridSegment

public GridSegment(int cellCount,
                   AtNumber min,
                   AtRefNumber preferred,
                   AtNumber max)
Constructor.

Parameters:
cellCount - The number of cells
min - The minimum size for one cell. Can be null which mean 0.
preferred - The preferred size for one cell (row/column). Can be null. If non-null this hints the object that lays out this grid segments that the size should be set so the grid fills the countainers bounds. Obeying max and min of course.
max - The maximum size for one cell. Can be null which means MigUtil.BIG_INT.

GridSegment

public GridSegment(int cellCount,
                   SizeSpec size)
Constructor.

Parameters:
cellCount - The number of cells
size - The min, preferred and max size. Not null.
Method Detail

getCellCount

public int getCellCount()
Returns the number of cells

Returns:
The number of cells

getMinCellSize

public AtNumber getMinCellSize()
Return the minimum size for a cell. Can be null.

Returns:
The minimum size for a cell. Can be null.

getPreferredCellSize

public AtRefNumber getPreferredCellSize()
Return the preferred size for a cell. Can be null. If non-null this hints the object that lays out this grid segments that the size should be set so the grid fills the countainers bounds. Obeying max and min of course.

Returns:
The preferredsize for a cell. Can be null.

getMaxCellSize

public AtNumber getMaxCellSize()
Return the maximum size for a cell. Can be null.

Returns:
The maximum size for a cell. Can be null.

getMinCellSizeI

public int getMinCellSizeI()
Returns min as int. 0 if no minimum value.

Returns:
min as int. 0 if no minimum value.

getPreferredCellSizeI

public int getPreferredCellSizeI()
Return preferred size as an absolute int. If preferred size isn't set or a relative value (E.g. AtFraction) -1 is returned.

Returns:
Preferred size as an absolute int.

getMaxCellSizeI

public int getMaxCellSizeI()
Returns max as int. MigUtil.BIG_INT if no maximum value.

Returns:
max as int. MigUtil.BIG_INT if no maximum value.

getSegmentSizes

public AtRefNumber[] getSegmentSizes()
Returns the size constraints for this segment. It is same for every cell but multiplied with cellCount. [MIN, PREFERRED, MAX].
The arrays is shared and must not be changed!

Returns:
The size constraints for this segment.

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

equals

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


Copyright © 2009 MiG InfoCom AB. All Rights Reserved.