JIDE 3.5.15

com.jidesoft.margin
Class TableRowMarginSupport

java.lang.Object
  extended by com.jidesoft.margin.AbstractMarginSupport
      extended by com.jidesoft.margin.AbstractRowMarginSupport
          extended by com.jidesoft.margin.TableRowMarginSupport
All Implemented Interfaces:
MarginSupport, RowMarginSupport
Direct Known Subclasses:
TreeTableRowMarginSupport

public class TableRowMarginSupport
extends AbstractRowMarginSupport

TableRowMarginSupport provides the margin support for JTable and its subclasses.


Nested Class Summary
 
Nested classes/interfaces inherited from interface com.jidesoft.margin.MarginSupport
MarginSupport.ModelChangedCallback, MarginSupport.RepaintCallback
 
Field Summary
protected  JTable _table
           
 
Fields inherited from class com.jidesoft.margin.AbstractMarginSupport
_listener, _scrollPane
 
Constructor Summary
TableRowMarginSupport(JTable table, JScrollPane scrollPane)
           
 
Method Summary
 int getBaselineAdjustment()
          Gets the baseline adjustment so that the text on the margin aligns properly with the text on the component.
 int getRowCount()
          Gets the total row count in the component.
 int getRowHeight(int row)
          Gets the row height.
 JTable getTable()
           
 void installListeners(MarginSupport.RepaintCallback repaintCallback, MarginSupport.ModelChangedCallback modelChangedCallback)
          Installs the listener to the component so that the RepaintCallback will be triggered when a repaint is needed, and the ModelChangedCallback will be triggered when the model is changed.
 int positionToRow(int position)
          Gets the actual row index corresponding to the position the margin.
 int rowToPosition(int row)
          Gets the position on the margin corresponding to the actual row index.
 void scrollTo(int beginRow, int endRow, boolean select)
          Selects the rows.
 void uninstallListeners(MarginSupport.RepaintCallback repaintCallback, MarginSupport.ModelChangedCallback modelChangedCallback)
          Uninstalls all the listeners installed in MarginSupport.installListeners(com.jidesoft.margin.MarginSupport.RepaintCallback, com.jidesoft.margin.MarginSupport.ModelChangedCallback).
 
Methods inherited from class com.jidesoft.margin.AbstractRowMarginSupport
actualRowToVisualRow, visualRowToActualRow
 
Methods inherited from class com.jidesoft.margin.AbstractMarginSupport
getViewPosition, getViewSize
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.jidesoft.margin.MarginSupport
getViewPosition, getViewSize
 

Field Detail

_table

protected JTable _table
Constructor Detail

TableRowMarginSupport

public TableRowMarginSupport(JTable table,
                             JScrollPane scrollPane)
Method Detail

getTable

public JTable getTable()

getRowCount

public int getRowCount()
Description copied from interface: RowMarginSupport
Gets the total row count in the component.

Returns:
the total row count.

scrollTo

public void scrollTo(int beginRow,
                     int endRow,
                     boolean select)
Description copied from interface: RowMarginSupport
Selects the rows. Note the beginning row index is not always less than the ending index. It depends on the mouse dragging direction. If user presses and drags upward on the margin, the end index will be smaller than the beginning index. In the implementation of this method, it should try to make the end index visible so that the dragging on the margin will auto-scroll when dragging outside the boundary.

Parameters:
beginRow - the beginning row index
endRow - the end row index
select - to select the rows. True to select the row. False to scroll the rows visible only without selecting them.

getRowHeight

public int getRowHeight(int row)
Description copied from interface: RowMarginSupport
Gets the row height.

Parameters:
row - the row index.
Returns:
the row height.

positionToRow

public int positionToRow(int position)
Description copied from interface: RowMarginSupport
Gets the actual row index corresponding to the position the margin.

Parameters:
position - the position on the margin.
Returns:
the row index corresponding to the position the margin.

rowToPosition

public int rowToPosition(int row)
Description copied from interface: RowMarginSupport
Gets the position on the margin corresponding to the actual row index.

Parameters:
row - the actual row index
Returns:
the position on the margin corresponding to the row index. Integer.MIN_VALUE if the row is not visible.

getBaselineAdjustment

public int getBaselineAdjustment()
Description copied from interface: RowMarginSupport
Gets the baseline adjustment so that the text on the margin aligns properly with the text on the component. You can override it to adjust the value if you notice the texts don't align.

Specified by:
getBaselineAdjustment in interface RowMarginSupport
Overrides:
getBaselineAdjustment in class AbstractRowMarginSupport
Returns:
the baseline adjustment.

installListeners

public void installListeners(MarginSupport.RepaintCallback repaintCallback,
                             MarginSupport.ModelChangedCallback modelChangedCallback)
Description copied from interface: MarginSupport
Installs the listener to the component so that the RepaintCallback will be triggered when a repaint is needed, and the ModelChangedCallback will be triggered when the model is changed.

Specified by:
installListeners in interface MarginSupport
Overrides:
installListeners in class AbstractMarginSupport
Parameters:
repaintCallback - the callback when a repaint is needed.
modelChangedCallback - the callback when the model of the component is changed. By default, the parameter is null unless the MarginComponent overrides the AbstractMargin.createModelChangedCallback() method is overridden to return a valid callback.

uninstallListeners

public void uninstallListeners(MarginSupport.RepaintCallback repaintCallback,
                               MarginSupport.ModelChangedCallback modelChangedCallback)
Description copied from interface: MarginSupport
Uninstalls all the listeners installed in MarginSupport.installListeners(com.jidesoft.margin.MarginSupport.RepaintCallback, com.jidesoft.margin.MarginSupport.ModelChangedCallback).

Specified by:
uninstallListeners in interface MarginSupport
Overrides:
uninstallListeners in class AbstractMarginSupport
Parameters:
repaintCallback - the callback when a repaint is needed.
modelChangedCallback - the callback when the model of the component is changed. By default, the parameter is null unless the MarginComponent overrides the AbstractMargin.createModelChangedCallback() method is overridden to return a valid callback.

JIDE 3.5.15