net.sf.jeppers.grid
Class DefaultRulerModel

java.lang.Object
  |
  +--net.sf.jeppers.grid.AbstractRulerModel
        |
        +--net.sf.jeppers.grid.DefaultRulerModel
All Implemented Interfaces:
ResizableGrid, RulerModel

public class DefaultRulerModel
extends AbstractRulerModel
implements ResizableGrid

Default implementation of RulerModel. Uses javax.swing.SizeSequence as underlying data structure.

Author:
Cameron Zemek

Field Summary
 
Fields inherited from class net.sf.jeppers.grid.AbstractRulerModel
listenerList
 
Constructor Summary
DefaultRulerModel(int numEntries, int defaultSize, int orientation)
           
 
Method Summary
 int getCount()
          Returns the number of entries.
 int getIndex(int position)
          Returns the index of the entry that contains the specified position.
 int getPosition(int index)
          Returns the start position for the specified entry.
 int getSize(int index)
          Returns the size of the specified entry.
 int getTotalSize()
          Returns the total size of the entries.
 void insertColumns(int column, int columnCount)
          Insert columnCount columns at column.
 void insertRows(int row, int rowCount)
          Insert rowCount rows at row.
 void removeColumns(int column, int columnCount)
          Remove columnCount columns at column.
 void removeRows(int row, int rowCount)
          Remove rowCount rows at row.
 void setSize(int index, int size)
          Sets the size of the specified entry.
 
Methods inherited from class net.sf.jeppers.grid.AbstractRulerModel
addRulerModelListener, fireIndexChanged, fireIntervalChanged, fireRulerChanged, getListeners, removeRulerModelListener
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultRulerModel

public DefaultRulerModel(int numEntries,
                         int defaultSize,
                         int orientation)
Method Detail

getSize

public int getSize(int index)
Description copied from interface: RulerModel
Returns the size of the specified entry.

Specified by:
getSize in interface RulerModel
Parameters:
index - the index corresponding to the entry
Returns:
the size of the entry

getIndex

public int getIndex(int position)
Description copied from interface: RulerModel
Returns the index of the entry that contains the specified position.

Specified by:
getIndex in interface RulerModel
Parameters:
position - the position of the entry
Returns:
the index of the entry that occupies the specified position

getPosition

public int getPosition(int index)
Description copied from interface: RulerModel
Returns the start position for the specified entry.

Specified by:
getPosition in interface RulerModel
Parameters:
index - the index of the entry whose position is desired
Returns:
the starting position of the specified entry

getCount

public int getCount()
Description copied from interface: RulerModel
Returns the number of entries.

Specified by:
getCount in interface RulerModel
Returns:
number of entries

setSize

public void setSize(int index,
                    int size)
Description copied from interface: RulerModel
Sets the size of the specified entry.

Specified by:
setSize in interface RulerModel
Parameters:
index - the index corresponding to the entry
size - the size of the entry

getTotalSize

public int getTotalSize()
Description copied from interface: RulerModel
Returns the total size of the entries.

Specified by:
getTotalSize in interface RulerModel
Returns:
the total size of the entries

insertRows

public void insertRows(int row,
                       int rowCount)
Description copied from interface: ResizableGrid
Insert rowCount rows at row.

Specified by:
insertRows in interface ResizableGrid
Parameters:
row - the row to insert at
rowCount - the number of rows to insert

removeRows

public void removeRows(int row,
                       int rowCount)
Description copied from interface: ResizableGrid
Remove rowCount rows at row.

Specified by:
removeRows in interface ResizableGrid
Parameters:
row - the row to remove from
rowCount - the number of rows to remove

insertColumns

public void insertColumns(int column,
                          int columnCount)
Description copied from interface: ResizableGrid
Insert columnCount columns at column.

Specified by:
insertColumns in interface ResizableGrid
Parameters:
column - the column to insert at
columnCount - the number of columns to insert

removeColumns

public void removeColumns(int column,
                          int columnCount)
Description copied from interface: ResizableGrid
Remove columnCount columns at column.

Specified by:
removeColumns in interface ResizableGrid
Parameters:
column - the column to remove from
columnCount - the number of columns to remove