JIDE 3.5.15

com.jidesoft.grid
Class RowHeights

java.lang.Object
  extended by com.jidesoft.grid.RowHeights
Direct Known Subclasses:
HierarchicalRowHeights

public class RowHeights
extends Object

RowHeights is wrapper around a SizeSequence object. It can fire RowHeightChangeEvent when row height changes.

RowHeights is nothing but a data structure to hold row heights information. The row used in this class is the row that appears on the table which has nothing to do with underlying row index such as the actualRow in the case of TableModelWrapper.


Field Summary
protected  int _rowCount
           
protected  SizeSequence _sizeSequence
           
protected  EventListenerList listenerList
           
 
Constructor Summary
RowHeights()
          Creates a new RowHeights object that contains no rows .
RowHeights(int numRows)
          Creates a new RowHeights object that contains the specified number of rows, all initialized to have size 0.
RowHeights(int[] heights)
          Creates a new RowHeights object that contains the specified heights.
RowHeights(int numRows, int value)
          Creates a new RowHeights object that contains the specified number of rows, all initialized to have size value.
 
Method Summary
 void addRowHeightChangeListener(RowHeightChangeListener l)
          Adds a listener to the list that's notified each time a change to the row model occurs.
 void fireRowHeightChanged(RowHeightChangeEvent e)
          Forwards the given notification event to all RowModelListeners that registered themselves as listeners for this row model.
 int getRowHeight(int index)
          Returns the row height of the specified row.
 RowHeightChangeListener[] getRowHeightChangeListeners()
          Returns an array of all the row model listeners registered on this model.
 int[] getRowHeights()
          Returns the row height of all rows.
 int getRowIndex(int position)
          Returns the index of the row that corresponds to the specified position.
 int getRowPosition(int index)
          Returns the start y position for the specified row.
 void insertRows(int start, int length, int value)
          Adds a contiguous group of row heights to this RowHeights.
 void removeRowHeightChangeListener(RowHeightChangeListener l)
          Removes a listener from the list that's notified each time a change to the row model occurs.
 void removeRows(int start, int length)
          Removes a contiguous group of entries from this RowHeights.
 void setRowHeight(int index, int height)
          Sets the height of the specified row.
 void setRowHeights(int[] rowHeights)
          Resets this RowHeights object, using the data in the rowHeights argument.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

listenerList

protected EventListenerList listenerList

_sizeSequence

protected SizeSequence _sizeSequence

_rowCount

protected int _rowCount
Constructor Detail

RowHeights

public RowHeights()
Creates a new RowHeights object that contains no rows . To add rows, you can use insertRows or setHeights.

See Also:
insertRows(int, int, int), setRowHeights(int[])

RowHeights

public RowHeights(int numRows)
Creates a new RowHeights object that contains the specified number of rows, all initialized to have size 0.

Parameters:
numRows - the number of row heights to track
Throws:
NegativeArraySizeException - if numRows < 0

RowHeights

public RowHeights(int numRows,
                  int value)
Creates a new RowHeights object that contains the specified number of rows, all initialized to have size value.

Parameters:
numRows - the number of rows to track
value - the initial value of each size

RowHeights

public RowHeights(int[] heights)
Creates a new RowHeights object that contains the specified heights.

Parameters:
heights - the array of heights to be contained in the SizeSequence
Method Detail

setRowHeights

public void setRowHeights(int[] rowHeights)
Resets this RowHeights object, using the data in the rowHeights argument. This method re-initializes this object so that it contains as many rows as the rowHeights array. Each row height is initialized to the value of the corresponding item in rowHeights.

Parameters:
rowHeights - the array of rowHeights to be contained in this RowHeights

getRowHeights

public int[] getRowHeights()
Returns the row height of all rows.

Returns:
a new array containing the row heights in this object

getRowPosition

public int getRowPosition(int index)
Returns the start y position for the specified row.

Note that if index is greater than length the value returned may be meaningless.

Parameters:
index - the index of the row whose y position is desired
Returns:
the starting y position of the specified entry

getRowIndex

public int getRowIndex(int position)
Returns the index of the row that corresponds to the specified position. For example, getRowIndex(0) is 0, since the first row always starts at position 0.

Parameters:
position - the position of the row
Returns:
the index of the row that occupies the specified position

getRowHeight

public int getRowHeight(int index)
Returns the row height of the specified row. If index is out of the range (0 <= index < getRowHeights().length) the behavior is unspecified.

Parameters:
index - the index corresponding to the row
Returns:
the height of the row

setRowHeight

public void setRowHeight(int index,
                         int height)
Sets the height of the specified row. Note that if the value of index does not fall in the range: (0 <= index < getRowHeights().length) the behavior is unspecified.

Parameters:
index - the index corresponding to the row
height - the height of the row

insertRows

public void insertRows(int start,
                       int length,
                       int value)
Adds a contiguous group of row heights to this RowHeights. Note that the values of start and length must satisfy the following conditions: (0 <= start < getRowHeights().length) AND (length >= 0). If these conditions are not met, the behavior is unspecified and an exception may be thrown.

Parameters:
start - the index to be assigned to the first row in the group
length - the number of rows in the group
value - the size to be assigned to each new row
Throws:
ArrayIndexOutOfBoundsException - if the parameters are outside of the range: (0 <= start < (getRowHeights().length)) AND (length >= 0)

removeRows

public void removeRows(int start,
                       int length)
Removes a contiguous group of entries from this RowHeights. Note that the values of start and length must satisfy the following conditions: (0 <= start < getRowHeights().length) AND (length >= 0). If these conditions are not met, the behavior is unspecified and an exception may be thrown.

Parameters:
start - the index of the first row to be removed
length - the number of rows to be removed

addRowHeightChangeListener

public void addRowHeightChangeListener(RowHeightChangeListener l)
Adds a listener to the list that's notified each time a change to the row model occurs.

Parameters:
l - the RowHeightChangeListener

removeRowHeightChangeListener

public void removeRowHeightChangeListener(RowHeightChangeListener l)
Removes a listener from the list that's notified each time a change to the row model occurs.

Parameters:
l - the RowHeightChangeListener

getRowHeightChangeListeners

public RowHeightChangeListener[] getRowHeightChangeListeners()
Returns an array of all the row model listeners registered on this model.

Returns:
all of this model's RowHeightChangeListeners or an empty array if no row model listeners are currently registered
See Also:
addRowHeightChangeListener(com.jidesoft.grid.RowHeightChangeListener), removeRowHeightChangeListener(com.jidesoft.grid.RowHeightChangeListener)

fireRowHeightChanged

public void fireRowHeightChanged(RowHeightChangeEvent e)
Forwards the given notification event to all RowModelListeners that registered themselves as listeners for this row model.

Parameters:
e - the event to be forwarded
See Also:
addRowHeightChangeListener(com.jidesoft.grid.RowHeightChangeListener), RowHeightChangeEvent, EventListenerList

JIDE 3.5.15