com.swfm.mica.widgets
Class MiVirtualTable

java.lang.Object
  extended bycom.swfm.mica.widgets.MiVirtualTable
All Implemented Interfaces:
MiiActionHandler, MiiScrollableData, MiiSelectableTableContentSupplier, MiiVirtualTableRowColumnLocationSupplier
Direct Known Subclasses:
MiVirtualTreeTable

public class MiVirtualTable
extends java.lang.Object
implements MiiActionHandler, MiiScrollableData, MiiSelectableTableContentSupplier, MiiVirtualTableRowColumnLocationSupplier

This class supports the 'virtual' table, which is called virtual by virtue of it building only the visible rows of the table at one time - instead of the whole table at once - which scales better and is more efficient, though less flexible.

Version:
%I% %G%
Author:
Michael L. Davis

Field Summary
   
Constructor Summary
MiVirtualTable(MiTable table, MiScrolledBox scrolledBox, MiiVirtualTableRowSource dataSource)
           
 
Method Summary
 void addFilter(MiiVirtualTableFilter filter)
           
 void addHighlighter(MiiVirtualTableHighlighter highlighter)
           
 void addOrderer(MiiVirtualTableRowColumnOrderer orderer)
           
 void addReporter(MiiVirtualTableReporter reporter)
           
 int getAbsoluteColumnNumber(int column)
           
 int getAbsoluteRowNumber(int row)
          Implements MiiVirtualTableRowColumnLocationSupplier
 MiTableCell getCell(int row, int column)
           
 MiTableCells getContentsCells()
           
 double getEstimateOfColumnWidth(int columnNumber)
           
 double getNormalizedHorizontalAmountVisible()
          Gets the normalized (between 0.0 and 1.0 inclusive) horizontal size of the data (0.0 indicates none of the data is visible and 1.0 indicates all of the data's width is visible).
 double getNormalizedHorizontalPosition()
          Gets the normalized (between 0.0 and 1.0 inclusive) horizontal position of the data (0.0 is the left side and 1.0 is the right side).
 double getNormalizedVerticalAmountVisible()
          Gets the normalized (between 0.0 and 1.0 inclusive) vertical size of the data (0.0 indicates none of the data is visible and 1.0 indicates all of the data's height is visible).
 double getNormalizedVerticalPosition()
          Gets the normalized (between 0.0 and 1.0 inclusive) vertical position of the data (0.0 is the left side and 1.0 is the right side).
 int getNumberOfColumns()
           
 int getNumberOfRows()
           
 int getNumberOfVisibleRows()
           
 int getRelativeColumnNumber(int column)
           
 int getRelativeRowNumber(int row)
           
 java.util.ArrayList getRows()
           
 MiTable getTable()
           
 MiTableCells getTableRow(int rowNumber, int targetDisplayRow, MiBounds rowBounds, int[] rowHeightInCells)
           
 int getTopVisibleRow()
           
 boolean isCellVisible(MiTableCell cell)
           
 boolean isHandlingScrollingDiscreteAmountsLocally()
          Gets whether actions like scrollLineDown is handled in this interfaces implementation or whether these type of methods are merely to be notified of the scrolling calculated elsewhere and executed by calling scrollToNormalizedVerticalPosition.
 boolean isSelectable(int row, int column)
          Implements MiiSelectableTableContentSupplier
 boolean processAction(MiiAction action)
          Process the given action.
 void rebuild()
           
 void redisplay()
           
 void removeAllHighlighters()
           
 void removeAllOrderers()
           
 void removeFilter(MiiVirtualTableFilter filter)
           
 void removeHighlighter(MiiVirtualTableHighlighter highlighter)
           
 void removeOrderer(MiiVirtualTableRowColumnOrderer orderer)
           
 void removeReporter(MiiVirtualTableReporter reporter)
           
 void scrollChunkDown()
          Scrolls one chunk down (conversely, move the data one chunk up).
 void scrollChunkLeft()
          Scrolls one chunk left (conversely, move the data one chunk right).
 void scrollChunkRight()
          Scrolls one chunk right (conversely, move the data one chunk left).
 void scrollChunkUp()
          Scrolls one chunk up (conversely, move the data one chunk down).
 void scrollLineDown()
          Scrolls one line down (conversely, move the data one line up).
 void scrollLineLeft()
          Scrolls one line left (conversely, move the data one line right).
 void scrollLineRight()
          Scrolls one line right (conversely, move the data one line left).
 void scrollLineUp()
          Scrolls one line up (conversely, move the data one line down).
 void scrollPageDown()
          Scrolls one page down (conversely, move the data one page up).
 void scrollPageLeft()
          Scrolls one page left (conversely, move the data one page right).
 void scrollPageRight()
          Scrolls one page right (conversely, move the data one page left).
 void scrollPageUp()
          Scrolls one page up (conversely, move the data one page down).
 void scrollToBottom()
          Scrolls to the bottom of the data.
 void scrollToLeftSide()
          Scrolls to the left side of the data.
 void scrollToNormalizedHorizontalPosition(double normalizedPosition)
          Scrolls to the given normalized (between 0.0 and 1.0) vertical position.
 void scrollToNormalizedVerticalPosition(double normalizedPosition)
          Scrolls to the given normalized (between 0.0 and 1.0) horizontal position.
 void scrollToRightSide()
          Scrolls to the right side of the data.
 void scrollToTop()
          Scrolls to the top of the data.
 void selectItem(int absoluteRow, int absoluteColumn)
           
 void setAutoRebuildEnabled(boolean flag)
           
 void setRows(java.util.ArrayList rows)
           
 void setTopVisibleRow(int row)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MiVirtualTable

public MiVirtualTable(MiTable table,
                      MiScrolledBox scrolledBox,
                      MiiVirtualTableRowSource dataSource)
Method Detail

addReporter

public void addReporter(MiiVirtualTableReporter reporter)

removeReporter

public void removeReporter(MiiVirtualTableReporter reporter)

addFilter

public void addFilter(MiiVirtualTableFilter filter)

removeFilter

public void removeFilter(MiiVirtualTableFilter filter)

addHighlighter

public void addHighlighter(MiiVirtualTableHighlighter highlighter)

removeHighlighter

public void removeHighlighter(MiiVirtualTableHighlighter highlighter)

removeAllHighlighters

public void removeAllHighlighters()

addOrderer

public void addOrderer(MiiVirtualTableRowColumnOrderer orderer)

removeOrderer

public void removeOrderer(MiiVirtualTableRowColumnOrderer orderer)

removeAllOrderers

public void removeAllOrderers()

getTable

public MiTable getTable()

getRows

public java.util.ArrayList getRows()

setRows

public void setRows(java.util.ArrayList rows)

getEstimateOfColumnWidth

public double getEstimateOfColumnWidth(int columnNumber)

setTopVisibleRow

public void setTopVisibleRow(int row)

getTopVisibleRow

public int getTopVisibleRow()

getNumberOfVisibleRows

public int getNumberOfVisibleRows()

redisplay

public void redisplay()

setAutoRebuildEnabled

public void setAutoRebuildEnabled(boolean flag)

getTableRow

public MiTableCells getTableRow(int rowNumber,
                                int targetDisplayRow,
                                MiBounds rowBounds,
                                int[] rowHeightInCells)

rebuild

public void rebuild()

selectItem

public void selectItem(int absoluteRow,
                       int absoluteColumn)

processAction

public boolean processAction(MiiAction action)
Process the given action.

Specified by:
processAction in interface MiiActionHandler
Parameters:
action - the action to process.
Returns:
true if can propogate the action to other handlers.

getAbsoluteRowNumber

public int getAbsoluteRowNumber(int row)
Implements MiiVirtualTableRowColumnLocationSupplier

Specified by:
getAbsoluteRowNumber in interface MiiVirtualTableRowColumnLocationSupplier

getAbsoluteColumnNumber

public int getAbsoluteColumnNumber(int column)
Specified by:
getAbsoluteColumnNumber in interface MiiVirtualTableRowColumnLocationSupplier

getRelativeRowNumber

public int getRelativeRowNumber(int row)
Specified by:
getRelativeRowNumber in interface MiiVirtualTableRowColumnLocationSupplier

getRelativeColumnNumber

public int getRelativeColumnNumber(int column)
Specified by:
getRelativeColumnNumber in interface MiiVirtualTableRowColumnLocationSupplier

isSelectable

public boolean isSelectable(int row,
                            int column)
Implements MiiSelectableTableContentSupplier

Specified by:
isSelectable in interface MiiSelectableTableContentSupplier

getCell

public MiTableCell getCell(int row,
                           int column)
Specified by:
getCell in interface MiiSelectableTableContentSupplier

getNumberOfColumns

public int getNumberOfColumns()
Specified by:
getNumberOfColumns in interface MiiSelectableTableContentSupplier

getNumberOfRows

public int getNumberOfRows()
Specified by:
getNumberOfRows in interface MiiSelectableTableContentSupplier

getContentsCells

public MiTableCells getContentsCells()
Specified by:
getContentsCells in interface MiiSelectableTableContentSupplier

isCellVisible

public boolean isCellVisible(MiTableCell cell)
Specified by:
isCellVisible in interface MiiSelectableTableContentSupplier

isHandlingScrollingDiscreteAmountsLocally

public boolean isHandlingScrollingDiscreteAmountsLocally()
Gets whether actions like scrollLineDown is handled in this interfaces implementation or whether these type of methods are merely to be notified of the scrolling calculated elsewhere and executed by calling scrollToNormalizedVerticalPosition.

Specified by:
isHandlingScrollingDiscreteAmountsLocally in interface MiiScrollableData
Returns:
true if minor scrolling is implemented here

getNormalizedHorizontalPosition

public double getNormalizedHorizontalPosition()
Gets the normalized (between 0.0 and 1.0 inclusive) horizontal position of the data (0.0 is the left side and 1.0 is the right side).

Specified by:
getNormalizedHorizontalPosition in interface MiiScrollableData
Returns:
the horizontal position

getNormalizedVerticalPosition

public double getNormalizedVerticalPosition()
Gets the normalized (between 0.0 and 1.0 inclusive) vertical position of the data (0.0 is the left side and 1.0 is the right side).

Specified by:
getNormalizedVerticalPosition in interface MiiScrollableData
Returns:
the vertical position

getNormalizedHorizontalAmountVisible

public double getNormalizedHorizontalAmountVisible()
Gets the normalized (between 0.0 and 1.0 inclusive) horizontal size of the data (0.0 indicates none of the data is visible and 1.0 indicates all of the data's width is visible).

Specified by:
getNormalizedHorizontalAmountVisible in interface MiiScrollableData
Returns:
the amount of data visible

getNormalizedVerticalAmountVisible

public double getNormalizedVerticalAmountVisible()
Gets the normalized (between 0.0 and 1.0 inclusive) vertical size of the data (0.0 indicates none of the data is visible and 1.0 indicates all of the data's height is visible).

Specified by:
getNormalizedVerticalAmountVisible in interface MiiScrollableData
Returns:
the amount of data visible

scrollLineUp

public void scrollLineUp()
Scrolls one line up (conversely, move the data one line down). If already at the top of the data then this does nothing. It is up to the implementation of this interface to determine what a 'line' is.

Specified by:
scrollLineUp in interface MiiScrollableData

scrollLineDown

public void scrollLineDown()
Scrolls one line down (conversely, move the data one line up). If already at the bottom of the data then this does nothing. It is up to the implementation of this interface to determine what a 'line' is.

Specified by:
scrollLineDown in interface MiiScrollableData

scrollLineLeft

public void scrollLineLeft()
Scrolls one line left (conversely, move the data one line right). If already at the left of the data then this does nothing. It is up to the implementation of this interface to determine what a 'line' is.

Specified by:
scrollLineLeft in interface MiiScrollableData

scrollLineRight

public void scrollLineRight()
Scrolls one line right (conversely, move the data one line left). If already at the right of the data then this does nothing. It is up to the implementation of this interface to determine what a 'line' is.

Specified by:
scrollLineRight in interface MiiScrollableData

scrollChunkUp

public void scrollChunkUp()
Scrolls one chunk up (conversely, move the data one chunk down). If already at the top of the data then this does nothing. It is up to the implementation of this interface to determine what a 'chunk' is.

Specified by:
scrollChunkUp in interface MiiScrollableData

scrollChunkDown

public void scrollChunkDown()
Scrolls one chunk down (conversely, move the data one chunk up). If already at the bottom of the data then this does nothing. It is up to the implementation of this interface to determine what a 'chunk' is.

Specified by:
scrollChunkDown in interface MiiScrollableData

scrollChunkLeft

public void scrollChunkLeft()
Scrolls one chunk left (conversely, move the data one chunk right). If already at the left of the data then this does nothing. It is up to the implementation of this interface to determine what a 'chunk' is.

Specified by:
scrollChunkLeft in interface MiiScrollableData

scrollChunkRight

public void scrollChunkRight()
Scrolls one chunk right (conversely, move the data one chunk left). If already at the right of the data then this does nothing. It is up to the implementation of this interface to determine what a 'chunk' is.

Specified by:
scrollChunkRight in interface MiiScrollableData

scrollPageUp

public void scrollPageUp()
Scrolls one page up (conversely, move the data one page down). If already at the top of the data then this does nothing. It is up to the implementation of this interface to determine what a 'page' is.

Specified by:
scrollPageUp in interface MiiScrollableData

scrollPageDown

public void scrollPageDown()
Scrolls one page down (conversely, move the data one page up). If already at the bottom of the data then this does nothing. It is up to the implementation of this interface to determine what a 'page' is.

Specified by:
scrollPageDown in interface MiiScrollableData

scrollPageLeft

public void scrollPageLeft()
Scrolls one page left (conversely, move the data one page right). If already at the left of the data then this does nothing. It is up to the implementation of this interface to determine what a 'page' is.

Specified by:
scrollPageLeft in interface MiiScrollableData

scrollPageRight

public void scrollPageRight()
Scrolls one page right (conversely, move the data one page left). If already at the right of the data then this does nothing. It is up to the implementation of this interface to determine what a 'page' is.

Specified by:
scrollPageRight in interface MiiScrollableData

scrollToTop

public void scrollToTop()
Scrolls to the top of the data.

Specified by:
scrollToTop in interface MiiScrollableData

scrollToBottom

public void scrollToBottom()
Scrolls to the bottom of the data.

Specified by:
scrollToBottom in interface MiiScrollableData

scrollToLeftSide

public void scrollToLeftSide()
Scrolls to the left side of the data.

Specified by:
scrollToLeftSide in interface MiiScrollableData

scrollToRightSide

public void scrollToRightSide()
Scrolls to the right side of the data.

Specified by:
scrollToRightSide in interface MiiScrollableData

scrollToNormalizedVerticalPosition

public void scrollToNormalizedVerticalPosition(double normalizedPosition)
Scrolls to the given normalized (between 0.0 and 1.0) horizontal position.

Specified by:
scrollToNormalizedVerticalPosition in interface MiiScrollableData
Parameters:
normalizedPosition - the new horizontal position

scrollToNormalizedHorizontalPosition

public void scrollToNormalizedHorizontalPosition(double normalizedPosition)
Scrolls to the given normalized (between 0.0 and 1.0) vertical position.

Specified by:
scrollToNormalizedHorizontalPosition in interface MiiScrollableData
Parameters:
normalizedPosition - the new vertical position