de.jaret.util.ui.table
Class JaretTable

java.lang.Object
  extended by org.eclipse.swt.widgets.Widget
      extended by org.eclipse.swt.widgets.Control
          extended by org.eclipse.swt.widgets.Scrollable
              extended by org.eclipse.swt.widgets.Composite
                  extended by org.eclipse.swt.widgets.Canvas
                      extended by de.jaret.util.ui.table.JaretTable
All Implemented Interfaces:
de.jaret.util.misc.PropertyObservable, IJaretTableModelListener, IJaretTableSelectionModelListener, ITableViewStateListener, java.beans.PropertyChangeListener, java.util.EventListener, org.eclipse.swt.graphics.Drawable

public class JaretTable
extends org.eclipse.swt.widgets.Canvas
implements ITableViewStateListener, IJaretTableModelListener, IJaretTableSelectionModelListener, java.beans.PropertyChangeListener, de.jaret.util.misc.PropertyObservable

Custom drawn table widget for the SWT Toolkit. Always consider using the native table widget!

The JaretTable features:

Keyboard controls
Key Function
Shift+Click Move focus
Arrows Move focus
Shift-Arrow Select Current cell, shift focus and select newly focussed cell and the rectangle of cells between first and current cell

Version:
$Id: JaretTable.java 1076 2010-12-05 13:34:42Z kliem $
Author:
Peter Kliem

Nested Class Summary
 class JaretTable.ColInfo
          Simple struct for storing column information.
 class JaretTable.RowComparator
          Comparator based on the sorting settings of the columns.
 class JaretTable.RowInfo
          Simple struct for storing row information.
 
Field Summary
protected  boolean _allowSorting
          global flag for allowing sorting of the table.
protected  de.jaret.util.ui.table.JaretTable.AutoFilter _autoFilter
          Instance of the interbal RowFilter that makes up the autofilter.
protected  java.util.Map<java.lang.Class<?>,java.lang.Class<? extends IAutoFilter>> _autoFilterClassMap
          map containing the autofilter classes to use for dedicated content classes.
protected  java.util.Map<IColumn,java.lang.Class<? extends IAutoFilter>> _autoFilterColumnMap
          map containing teh autofiletr classes to use for specified columns.
protected  boolean _autoFilterEnabled
          if true autofilters are enabled and present.
protected  java.util.Map<IColumn,IAutoFilter> _autoFilterMap
          map containing the actual instantiated autofilters for the different columns.
protected  org.eclipse.swt.graphics.Rectangle _autoFilterRect
          Rectangle the autofilter elements (combos) are placed.
protected  ICCPStrategy _ccpStrategy
          Strategy for handling cut copy paste.
protected  java.util.Map<IColumn,ICellEditor> _colCellEditorMap
          cell editor map for columns.
protected  java.util.Map<IColumn,ICellRenderer> _colCellRendererMap
          cell renderer map for columns.
protected  java.util.Map<java.lang.Class<?>,ICellEditor> _colClassEditorMap
          cell editor map for classes.
protected  java.util.Map<java.lang.Class<?>,ICellRenderer> _colClassRendererMap
          cell renderer map for classes.
protected  java.util.List<JaretTable.ColInfo> _colInfoCache
          column information cache.
protected  java.util.List<IColumn> _cols
          List of columns actually displayed.
protected  org.eclipse.swt.graphics.Rectangle _dragMarkerRect
          cache for the drag marker location.
protected  boolean _drawHeader
          if true headers will be drawn.
protected  ICellEditor _editor
          cell editor used to edit a cell. will be nun null when editiing.
protected  org.eclipse.swt.widgets.Control _editorControl
          control of the editor.
protected  IRow _editorRow
          row that is edited.
protected  boolean _excludeFixedRowsFromSorting
          if true fixed rows will not be affected by sorting operations.
protected  IFillDragStrategy _fillDragStrategy
          fill drag strategy
protected  int _firstCellSelectX
           
protected  int _firstCellSelectY
           
protected  int _firstColIdx
          Index of the first row displayed.
protected  int _firstColPixelOffset
          pixel offset of the firs displayed column.
protected  int _firstColSelectIdx
          first col selected in drag.
protected  org.eclipse.swt.graphics.Point _firstKeySelect
          first cell idx selected by shift-arrow.
protected  int _firstRowIdx
          Index of the first row displayed (may be only a half display).
protected  int _firstRowPixelOffset
          Pixel offset of the display of the first row.
protected  int _firstRowSelectIdx
          first row selected in drag.
protected  org.eclipse.swt.graphics.Rectangle _fixedColRect
          Rectangle in which the fixed columns will be painted.
protected  int _fixedColumns
          number of fixed columns.
protected  org.eclipse.swt.graphics.Rectangle _fixedRowRect
          Rectangle in which the fixed rows will be painted.
protected  int _fixedRows
          number of fixed rows.
protected  IColumn _focussedColumn
          column of the focussed cell or null.
protected  IRow _focussedRow
          row of the focussed cell or null.
protected  org.eclipse.swt.widgets.Menu _headerContextMenu
          context menu used on table headers.
protected  boolean _headerDragged
          true if the header height is beeing dragged.
protected  int _headerHeight
          height of the headers.
protected  org.eclipse.swt.graphics.Rectangle _headerRect
          Rectangle the headers are painted in.
protected  ITableHeaderRenderer _headerRenderer
          Renderer used to render the headers.
protected  JaretTable.RowInfo _heightDraggedRowInfo
          currently dragged row (dragging height).
protected  IHierarchicalJaretTableModel _hierarchicalModel
          hierarchical table model if used.
protected  boolean _isFillDrag
          marker flag for drag operation: fill drag.
protected  int _lastCellSelectX
           
protected  int _lastCellSelectY
           
protected  int _lastColSelectIdx
          last col selected in drag or as standard col selection.
protected  org.eclipse.swt.graphics.Point _lastKeySelect
          last cell idx selected by shift-arrow.
protected  int _lastRowSelectIdx
          last row selected in drag.
protected  de.jaret.util.ui.table.JaretTable.SelectType _lastSelectType
          type of the last selection, used for handling keyboard selection.
protected  int _minHeaderHeight
          minimal height for the header.
protected  IJaretTableModel _model
          table model.
protected  java.beans.PropertyChangeSupport _propertyChangeSupport
          Delegate to handle property change listener support.
protected  boolean _resizeRestriction
          If true, resizing is only allowed in header and fixed columns (for rows) and the leftmost SELDELTA pixels of eachrow.
protected  org.eclipse.swt.widgets.Menu _rowContextMenu
          context menu used for rows.
protected  IRowFilter _rowFilter
          row filter.
protected  java.util.List<JaretTable.RowInfo> _rowInfoCache
          row information cache.
protected  java.util.List<IRow> _rows
          List of rows actually diplayed (filtered and ordered).
protected  IRowSorter _rowSorter
          row sorter.
protected  java.util.Collection<IRow> _rowsToOptimize
          list of rows that will be optimized before the next drawing using the gc at hand.
protected  IJaretTableSelectionModel _selectionModel
          selection model used by the table.
protected  boolean _supportFillDragging
          configuration: support fill dragging.
protected  java.util.List<ITableFocusListener> _tableFocusListeners
          Listz of listeners interested in changes of the focussed cell.
protected  org.eclipse.swt.graphics.Rectangle _tableRect
          rectangle the main table is drawn into (withou fixedcolRect and without fixedRowRect!).
protected  ITableViewState _tvs
          table viewstate.
protected  JaretTable.ColInfo _widthDraggedColumn
          currently dragged (width) column or null.
static java.lang.String PROPERTYNAME_AUTOFILTERENABLE
          name of the bound property.
static java.lang.String PROPERTYNAME_FILTERING
          Pseudo propertyname on which property change is fired whenever the filtering changes.
static java.lang.String PROPERTYNAME_FIRSTROWIDX
          name of the bound property.
static java.lang.String PROPERTYNAME_FIRSTROWPIXELOFFSET
          name of the bound property.
static java.lang.String PROPERTYNAME_HEADERHEIGHT
          name of the bound property.
static java.lang.String PROPERTYNAME_ROWFILTER
          name of the bound property.
static java.lang.String PROPERTYNAME_ROWSORTER
          name of the bound property.
static java.lang.String PROPERTYNAME_SORTING
          Pseudo propertyname on which property change is fired whenever the sorting changes.
 
Fields inherited from class org.eclipse.swt.widgets.Control
handle
 
Constructor Summary
JaretTable(org.eclipse.swt.widgets.Composite parent, int style)
          Constructor for a new JaretTable widget.
 
Method Summary
 void addColumn(IColumn column)
          Add a column to the underlying table model.
 void addPropertyChangeListener(java.beans.PropertyChangeListener listener)
          
 void addTableFocusListener(ITableFocusListener tfl)
          Add a listener to listen for focus changes in the table (focussed cell).
 void cellChanged(IRow row, IColumn column)
          The value of the specified cell changed.
 void cellSelectionAdded(IJaretTableCell cell)
          Called whenever a cell has been added to a selection.
 void cellSelectionRemoved(IJaretTableCell cell)
          Called whenever a cell has been removed from the selection.
 void cellStyleChanged(IRow row, IColumn column, ICellStyle style)
          Called whenever a cellstyle has been changed.
 IColumn colForX(int x)
          Retrieve the column corresponding to a x coordinate.
 void columnAdded(int idx, IColumn column)
          Called when a column has been added to the table model.
 void columnChanged(IColumn column)
          Called when a column changed.
 void columnOrderChanged()
          Called when the ordering of the columns changed.
 void columnRemoved(IColumn column)
          Called when a column has been removed from the model.
 void columnSelectionAdded(IColumn column)
          Called whenever a column has been added to a selection.
 void columnSelectionRemoved(IColumn column)
          Called whenever a column has been removed from the selection.
 void columnVisibilityChanged(IColumn column, boolean visible)
          Called when the visibility of a column changed.
 void columnWidthChanged(IColumn column, int newWidth)
          Column width changed.
 void columnWidthsChanged()
          Called when more than one column width has changed.
 void copy()
          Do a copy operation.
 void cut()
          Do a cut operation.
 void displayHeaderContextMenu(int x, int y)
          If a header context is present, display it at x,y.
 void displayRowContextMenu(int x, int y)
          If a row context is present, display it at x,y.
 void firePropertyChange(java.lang.String propName, java.lang.Object oldVal, java.lang.Object newVal)
          
 void focusDown()
          Move the focus down.
 void focusLeft()
          Move the focus left.
 void focusRight()
          Move the focus right.
 void focusUp()
          Move the focus up.
 int getAbsBeginXForColIdx(int colIdx)
          Get the absolute begin x for a column.
 int getAbsBeginXForColumn(IColumn column)
          Get the absolute begin x for a column.
 boolean getAllowSorting()
          Check whether sorting the table is allowed.
protected  java.lang.Class<? extends IAutoFilter> getAutoFilterClass(IColumn column)
          Get the autofiletr class to be used on a column.
 boolean getAutoFilterEnable()
          Retrieve the autofilter state.
 int getAutoFilterHeight()
          Retrieve the height used to render the autofilters.
 ICCPStrategy getCcpStrategy()
           
 IJaretTableCell getCell(int x, int y)
          Retrieve TableXCell for given pixel coordinates.
 org.eclipse.swt.graphics.Rectangle getCellBounds(IRow row, IColumn column)
          Get the bounding rectangle for a cell.
 org.eclipse.swt.graphics.Point getCellDisplayIdx(IJaretTableCell cell)
          Retrieve the display coordinates for a table cell.
 IJaretTableCell getCellForIdx(int colIdx, int rowIdx)
          Retrieve a table cell for given index coordinates.
protected  ICellRenderer getCellRenderer(IRow row, IColumn column)
          Retrieve the cell renderer for a cell.
 int getColIdxForAbsX(int absX)
          Return the (internal) index of the column corresponding to the given x coordinate value (absolute value taking all visible columns into account).
 IColumn getColumn(int idx)
          Retrieve column by the display idx.
 IColumn getColumn(java.lang.String id)
          Convenience method to retrieve a column by it's id from the model.
 org.eclipse.swt.graphics.Rectangle getColumnBounds(IColumn column)
          Get the bounding rect for a column.
 int getColumnCount()
          Current number of displayed columns.
 IColumn getColumnForAbsX(int absX)
          Return the column for an absolute x coordinate.
 boolean getDrawHeader()
          Retrieve the state of header drawing.
 boolean getExcludeFixedRowsFromSorting()
          Retrieve the flag controlling whether fixed rows are excluded from sorting.
 IFillDragStrategy getFillDragStrategy()
          Retrieve the used startegy when performing a fill drag.
 int getFirstRowIdx()
          Retrive the index of the first row displayed in the scrolled area of the table.
 int getFirstRowPixelOffset()
          Retrieve the pixel offset the first row is scrolled.
 int getFixedColumns()
           
 int getFixedRows()
           
 IJaretTableCell getFocussedCell()
          Retrieve the currently focussed cell.
 org.eclipse.swt.graphics.Point getFocussedCellIdx()
          Retrieve the indizes of the currently focussed cell (idx in the filtered, sorted or whatever table).
 org.eclipse.swt.widgets.Menu getHeaderContextMenu()
          Retrieve a context menu that has been set on the header.
 int getHeaderHeight()
          Retrieve the header height.
 ITableHeaderRenderer getHeaderRenderer()
           
 int getHeight()
          Retrieve the height of the control.
 IHierarchicalJaretTableModel getHierarchicalModel()
          Retrieve a hierarchical model if set.
 int getInternalRowIndex(IRow row)
          Get the index of the given row in the internal, fileterd list of rows.
 java.util.List<IRow> getInternalRowList()
          Get access to the internal row list.
 boolean getOptimizeScrolling()
          Retrieve whether scroll opotimizations are active.
 boolean getResizeRestriction()
          Get the state of the resize restriction flag.
 IRow getRow(int idx)
          Get a row by the display idx.
 org.eclipse.swt.widgets.Menu getRowContextMenu()
          Retrieve a context menu that has been set for the rows.
 int getRowCount()
          Get the number of displayed rows (after filtering!).
 IRowFilter getRowFilter()
           
 int getRowIdxForAbsY(int absY)
          Get row index for an absolute y coordinate (thought on the full height table with all rows).
protected  JaretTable.RowInfo getRowInfo(IRow row)
          Retrieve the row info for a row.
 IRowSorter getRowSorter()
           
 IJaretTableSelectionModel getSelectionModel()
          Retrieve the selectionmodel used by the table.
 IJaretTableModel getTableModel()
          Retrieve the displayed table model.
 ITableViewState getTableViewState()
          Retrieve the table viewstate.
 int getTotalHeight()
          Total height of all possibly displayed rows (filter applied!).
 int getTotalHeight(int numRows)
          Total height of the first n rows.
 int getTotalWidth()
          Retrieve total width of all possibly displayed columns.
 int getTotalWidth(int n)
          Retrieve total width of the first n columns.
 int getWidth()
          Retrieve the width of the control.
 boolean isColumnResizeAllowed()
           
 boolean isDisplayed(IColumn column)
          Check whether a column is currently displayed.
 boolean isDisplayed(IRow row)
          Check whether a row is currently displayed.
 boolean isEditing()
          Check whether editing of a cell is in progress.
 boolean isHeaderResizeAllowed()
           
 boolean isHierarchyColumn(IColumn column)
          Check whether a column is the hierarchy column.
 boolean isHierarchyColumn(IRow row, IColumn col)
          Determine whether the column is the hierrarchy column.
 boolean isRowResizeAllowed()
           
 boolean isSelected(IRow row, IColumn column)
          Convenience method to check whether a certain cell is selected.
 boolean isSupportFillDragging()
          Retrieve whether fill dragging is activated.
 void optimizeHeight(IRow row)
          Register a row for height optimization in the next redrwa (redraw triggered by this method).
 void optimizeHeight(java.util.List<IRow> rows)
          Register a list of rows for heigt optimization.
 void paint(org.eclipse.swt.graphics.GC gc, int width, int height)
          The main paint method.
 void paste()
          Do a paste operation.
 void propertyChange(java.beans.PropertyChangeEvent evt)
           The table eitselflistens for prop changes of the rowSorter and the rowFilter.
 void registerAutoFilterForClass(java.lang.Class<?> clazz, java.lang.Class<? extends IAutoFilter> autoFilterClass)
          Register an autofilter implementing class to be used on columns that announce a specific content class.
 void registerAutoFilterForColumn(IColumn column, java.lang.Class<? extends IAutoFilter> autoFilterClass)
          Regsiter an autofilter implementing class for use with a specific column.
 void registerCellEditor(java.lang.Class<?> clazz, ICellEditor cellEditor)
          Register a cell editor for objects of class clazz.
 void registerCellEditor(IColumn column, ICellEditor cellEditor)
          Register a cell editor for a column.
 void registerCellRenderer(java.lang.Class<?> clazz, ICellRenderer cellRenderer)
          Register a cell renderer for rendering objects of class clazz.
 void registerCellRenderer(IColumn column, ICellRenderer cellRenderer)
          Register a cell renderer for a column.
 void removePropertyChangeListener(java.beans.PropertyChangeListener listener)
          
 void remTableFocusListener(ITableFocusListener tfl)
          Remove a registered listener.
 void rowAdded(int idx, IRow row)
          Called when a row has been added to the model.
 void rowChanged(IRow row)
          Called if there has been a change in the row data.
 IRow rowForY(int y)
          Retrieve the row corresponding to a specified y coordinate.
 void rowHeightChanged(IRow row, int newHeight)
          Height of row changed.
 void rowHeightModeChanged(IRow row, ITableViewState.RowHeightMode newHeightMode)
          Row height mode changed.
 void rowRemoved(IRow row)
          Called when a row has been removed from the model.
 void rowSelectionAdded(IRow row)
          Called whenever a row has been added to a selection.
 void rowSelectionRemoved(IRow row)
          Called whenever a row has been removed from the selection.
 void scrollToVisible(IRow row, IColumn column)
          Scroll the addressed cell so, that is it completely visible.
 void selectAll()
          Select all cells by selectiong all displayed (not filtered) columns.
 void setAllowSorting(boolean allowSorting)
          Set the global allowance for sorting.
 void setAutoFilterEnable(boolean enable)
          Set the enabled state for the autofilter.
 void setCcpStrategy(ICCPStrategy ccpStrategy)
          Set the strategy to perform cut, copy, paste operations.
 void setColumnResizeAllowed(boolean columnResizeAllowed)
          Set whether column resizing is allowed.
 void setDrawHeader(boolean drawHeader)
          If set to true, the header row will be drawn.
 void setExcludeFixedRowsFromSorting(boolean excludeFixedRowsFromSorting)
          If set to true, fixed rows are exluded from sorting.
 void setFillDragStrategy(IFillDragStrategy fillDragStrategy)
          Set the strategy used when perfoming a fill drag.
 void setFirstRow(int idx, int pixeloffset)
          Set the first row displayed.
 void setFixedColumns(int fixedColumns)
          Set the numerb of fixed columns.
 void setFixedRows(int fixedRows)
          Set the number of rows to be fixed (excluded from scrolling and autofiltering; optionally from sorting).
 boolean setFocus()
           will get call to transfer focus to the table.
 void setHeaderContextMenu(org.eclipse.swt.widgets.Menu headerCtxMenu)
          Set a context menu to be displayed on the header area.
 void setHeaderHeight(int newHeight)
          Set the header drawing height.
 void setHeaderRenderer(ITableHeaderRenderer headerRenderer)
          Set a header renderer.
 void setHeaderResizeAllowed(boolean headerResizeAllowed)
           
 void setOptimizeScrolling(boolean optimizeScrolling)
          Set whether to use optimized scrolling by copying content.
 void setResizeRestriction(boolean resizeRestriction)
          If set to true resizing of columns will only be allowed in the header area.
 void setRowContextMenu(org.eclipse.swt.widgets.Menu rowCtxMenu)
          Set a context menu to be displayed on rows.
 void setRowFilter(IRowFilter rowFilter)
          Set a row filter on the table.
 void setRowResizeAllowed(boolean rowResizeAllowed)
           
 void setRowSorter(IRowSorter rowSorter)
          Set a row sorter.
 void setSelectionModel(IJaretTableSelectionModel jts)
          Set the selection model to be used by the table.
 void setSupportFillDragging(boolean supportFillDragging)
          Set fill drag activation.
 void setTableModel(IHierarchicalJaretTableModel hmodel)
          Set a hierarchical table model.
 void setTableModel(IJaretTableModel model)
          Set a table model to be displayed by the jaret table.
 void setTableViewState(ITableViewState tvs)
          Set a TableViewState.
 void setValue(int colIdx, int rowIdx, java.lang.Object value)
          Convenience method for setting a value at a displayed position in the table.
 void sortingChanged()
          Called when the sorting order for rows indicated on columns changed.
 void startEditing(IRow row, IColumn col, char typedKey)
          Start editing of a specified cell if it is editable.
 void stopEditing(boolean storeValue)
          Stop editing if in progress.
 void tableDataChanged()
          All table data has been invalidated.
 void updateColumnList()
          Update the internal column list.
protected  void updateScrollBars()
          Update the scrollbars.
 void updateYScrollBar()
          Update the vertical scrollbar if present.
 
Methods inherited from class org.eclipse.swt.widgets.Canvas
drawBackground, getCaret, scroll, setCaret, setFont
 
Methods inherited from class org.eclipse.swt.widgets.Composite
changed, checkSubclass, computeSize, getBackgroundMode, getChildren, getLayout, getLayoutDeferred, getTabList, isLayoutDeferred, layout, layout, layout, layout, setBackgroundMode, setLayout, setLayoutDeferred, setTabList
 
Methods inherited from class org.eclipse.swt.widgets.Scrollable
computeTrim, getClientArea, getHorizontalBar, getVerticalBar
 
Methods inherited from class org.eclipse.swt.widgets.Control
addControlListener, addFocusListener, addHelpListener, addKeyListener, addMouseListener, addMouseMoveListener, addMouseTrackListener, addPaintListener, addTraverseListener, computeSize, forceFocus, getAccessible, getBackground, getBackgroundImage, getBorderWidth, getBounds, getEnabled, getFont, getForeground, getLayoutData, getLocation, getMenu, getMonitor, getParent, getShell, getSize, getToolTipText, getVisible, internal_dispose_GC, internal_new_GC, isEnabled, isFocusControl, isReparentable, isVisible, moveAbove, moveBelow, pack, pack, redraw, redraw, removeControlListener, removeFocusListener, removeHelpListener, removeKeyListener, removeMouseListener, removeMouseMoveListener, removeMouseTrackListener, removePaintListener, removeTraverseListener, setBackground, setBackgroundImage, setBounds, setBounds, setCapture, setCursor, setEnabled, setForeground, setLayoutData, setLocation, setLocation, setMenu, setParent, setRedraw, setSize, setSize, setToolTipText, setVisible, toControl, toControl, toDisplay, toDisplay, traverse, update
 
Methods inherited from class org.eclipse.swt.widgets.Widget
addDisposeListener, addListener, checkWidget, dispose, getData, getData, getDisplay, getStyle, isDisposed, isListening, notifyListeners, removeDisposeListener, removeListener, removeListener, setData, setData, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

PROPERTYNAME_HEADERHEIGHT

public static final java.lang.String PROPERTYNAME_HEADERHEIGHT
name of the bound property.

See Also:
Constant Field Values

PROPERTYNAME_FIRSTROWIDX

public static final java.lang.String PROPERTYNAME_FIRSTROWIDX
name of the bound property.

See Also:
Constant Field Values

PROPERTYNAME_FIRSTROWPIXELOFFSET

public static final java.lang.String PROPERTYNAME_FIRSTROWPIXELOFFSET
name of the bound property.

See Also:
Constant Field Values

PROPERTYNAME_ROWSORTER

public static final java.lang.String PROPERTYNAME_ROWSORTER
name of the bound property.

See Also:
Constant Field Values

PROPERTYNAME_ROWFILTER

public static final java.lang.String PROPERTYNAME_ROWFILTER
name of the bound property.

See Also:
Constant Field Values

PROPERTYNAME_SORTING

public static final java.lang.String PROPERTYNAME_SORTING
Pseudo propertyname on which property change is fired whenever the sorting changes.

See Also:
Constant Field Values

PROPERTYNAME_FILTERING

public static final java.lang.String PROPERTYNAME_FILTERING
Pseudo propertyname on which property change is fired whenever the filtering changes.

See Also:
Constant Field Values

PROPERTYNAME_AUTOFILTERENABLE

public static final java.lang.String PROPERTYNAME_AUTOFILTERENABLE
name of the bound property.

See Also:
Constant Field Values

_firstRowIdx

protected int _firstRowIdx
Index of the first row displayed (may be only a half display).


_firstRowPixelOffset

protected int _firstRowPixelOffset
Pixel offset of the display of the first row.


_firstColIdx

protected int _firstColIdx
Index of the first row displayed.


_firstColPixelOffset

protected int _firstColPixelOffset
pixel offset of the firs displayed column.


_fixedColumns

protected int _fixedColumns
number of fixed columns.


_fixedRows

protected int _fixedRows
number of fixed rows.


_colCellRendererMap

protected java.util.Map<IColumn,ICellRenderer> _colCellRendererMap
cell renderer map for columns.


_colClassRendererMap

protected java.util.Map<java.lang.Class<?>,ICellRenderer> _colClassRendererMap
cell renderer map for classes.


_colCellEditorMap

protected java.util.Map<IColumn,ICellEditor> _colCellEditorMap
cell editor map for columns.


_colClassEditorMap

protected java.util.Map<java.lang.Class<?>,ICellEditor> _colClassEditorMap
cell editor map for classes.


_supportFillDragging

protected boolean _supportFillDragging
configuration: support fill dragging.


_fillDragStrategy

protected IFillDragStrategy _fillDragStrategy
fill drag strategy. *


_ccpStrategy

protected ICCPStrategy _ccpStrategy
Strategy for handling cut copy paste.


_model

protected IJaretTableModel _model
table model.


_hierarchicalModel

protected IHierarchicalJaretTableModel _hierarchicalModel
hierarchical table model if used.


_tvs

protected ITableViewState _tvs
table viewstate.


_rows

protected java.util.List<IRow> _rows
List of rows actually diplayed (filtered and ordered).


_rowFilter

protected IRowFilter _rowFilter
row filter.


_rowSorter

protected IRowSorter _rowSorter
row sorter.


_cols

protected java.util.List<IColumn> _cols
List of columns actually displayed.


_headerRect

protected org.eclipse.swt.graphics.Rectangle _headerRect
Rectangle the headers are painted in.


_headerHeight

protected int _headerHeight
height of the headers.


_minHeaderHeight

protected int _minHeaderHeight
minimal height for the header.


_drawHeader

protected boolean _drawHeader
if true headers will be drawn.


_tableRect

protected org.eclipse.swt.graphics.Rectangle _tableRect
rectangle the main table is drawn into (withou fixedcolRect and without fixedRowRect!).


_headerRenderer

protected ITableHeaderRenderer _headerRenderer
Renderer used to render the headers.


_fixedColRect

protected org.eclipse.swt.graphics.Rectangle _fixedColRect
Rectangle in which the fixed columns will be painted.


_fixedRowRect

protected org.eclipse.swt.graphics.Rectangle _fixedRowRect
Rectangle in which the fixed rows will be painted.


_dragMarkerRect

protected org.eclipse.swt.graphics.Rectangle _dragMarkerRect
cache for the drag marker location.


_autoFilterRect

protected org.eclipse.swt.graphics.Rectangle _autoFilterRect
Rectangle the autofilter elements (combos) are placed.


_autoFilterEnabled

protected boolean _autoFilterEnabled
if true autofilters are enabled and present.


_autoFilter

protected de.jaret.util.ui.table.JaretTable.AutoFilter _autoFilter
Instance of the interbal RowFilter that makes up the autofilter.


_autoFilterMap

protected java.util.Map<IColumn,IAutoFilter> _autoFilterMap
map containing the actual instantiated autofilters for the different columns.


_autoFilterClassMap

protected java.util.Map<java.lang.Class<?>,java.lang.Class<? extends IAutoFilter>> _autoFilterClassMap
map containing the autofilter classes to use for dedicated content classes.


_autoFilterColumnMap

protected java.util.Map<IColumn,java.lang.Class<? extends IAutoFilter>> _autoFilterColumnMap
map containing teh autofiletr classes to use for specified columns.


_resizeRestriction

protected boolean _resizeRestriction
If true, resizing is only allowed in header and fixed columns (for rows) and the leftmost SELDELTA pixels of eachrow.


_excludeFixedRowsFromSorting

protected boolean _excludeFixedRowsFromSorting
if true fixed rows will not be affected by sorting operations.


_allowSorting

protected boolean _allowSorting
global flag for allowing sorting of the table.


_focussedRow

protected IRow _focussedRow
row of the focussed cell or null.


_focussedColumn

protected IColumn _focussedColumn
column of the focussed cell or null.


_tableFocusListeners

protected java.util.List<ITableFocusListener> _tableFocusListeners
Listz of listeners interested in changes of the focussed cell.


_selectionModel

protected IJaretTableSelectionModel _selectionModel
selection model used by the table.


_editor

protected ICellEditor _editor
cell editor used to edit a cell. will be nun null when editiing.


_editorControl

protected org.eclipse.swt.widgets.Control _editorControl
control of the editor.


_editorRow

protected IRow _editorRow
row that is edited.


_headerContextMenu

protected org.eclipse.swt.widgets.Menu _headerContextMenu
context menu used on table headers.


_rowContextMenu

protected org.eclipse.swt.widgets.Menu _rowContextMenu
context menu used for rows.


_propertyChangeSupport

protected java.beans.PropertyChangeSupport _propertyChangeSupport
Delegate to handle property change listener support.


_rowInfoCache

protected java.util.List<JaretTable.RowInfo> _rowInfoCache
row information cache.


_colInfoCache

protected java.util.List<JaretTable.ColInfo> _colInfoCache
column information cache.


_heightDraggedRowInfo

protected JaretTable.RowInfo _heightDraggedRowInfo
currently dragged row (dragging height).


_widthDraggedColumn

protected JaretTable.ColInfo _widthDraggedColumn
currently dragged (width) column or null.


_headerDragged

protected boolean _headerDragged
true if the header height is beeing dragged.


_firstCellSelectX

protected int _firstCellSelectX

_firstCellSelectY

protected int _firstCellSelectY

_lastCellSelectX

protected int _lastCellSelectX

_lastCellSelectY

protected int _lastCellSelectY

_isFillDrag

protected boolean _isFillDrag
marker flag for drag operation: fill drag.


_firstColSelectIdx

protected int _firstColSelectIdx
first col selected in drag.


_lastColSelectIdx

protected int _lastColSelectIdx
last col selected in drag or as standard col selection.


_firstRowSelectIdx

protected int _firstRowSelectIdx
first row selected in drag.


_lastRowSelectIdx

protected int _lastRowSelectIdx
last row selected in drag.


_lastKeySelect

protected org.eclipse.swt.graphics.Point _lastKeySelect
last cell idx selected by shift-arrow.


_firstKeySelect

protected org.eclipse.swt.graphics.Point _firstKeySelect
first cell idx selected by shift-arrow.


_lastSelectType

protected de.jaret.util.ui.table.JaretTable.SelectType _lastSelectType
type of the last selection, used for handling keyboard selection.


_rowsToOptimize

protected java.util.Collection<IRow> _rowsToOptimize
list of rows that will be optimized before the next drawing using the gc at hand.

Constructor Detail

JaretTable

public JaretTable(org.eclipse.swt.widgets.Composite parent,
                  int style)
Constructor for a new JaretTable widget.

Parameters:
parent - parent composite
style - style bits (use HSCROLL, VSCROLL)
Method Detail

registerCellRenderer

public void registerCellRenderer(java.lang.Class<?> clazz,
                                 ICellRenderer cellRenderer)
Register a cell renderer for rendering objects of class clazz.

Parameters:
clazz - class the renderer should be applied for
cellRenderer - renderer to use for clazz

registerCellRenderer

public void registerCellRenderer(IColumn column,
                                 ICellRenderer cellRenderer)
Register a cell renderer for a column.

Parameters:
column - column the renderer should be used on
cellRenderer - renderer to use

getCellRenderer

protected ICellRenderer getCellRenderer(IRow row,
                                        IColumn column)
Retrieve the cell renderer for a cell.

Parameters:
row - row row of the cell
column - column column of the cell
Returns:
cell renderer

registerCellEditor

public void registerCellEditor(java.lang.Class<?> clazz,
                               ICellEditor cellEditor)
Register a cell editor for objects of class clazz.

Parameters:
clazz - class of objeects the editor should be used for
cellEditor - editor to use

registerCellEditor

public void registerCellEditor(IColumn column,
                               ICellEditor cellEditor)
Register a cell editor for a column.

Parameters:
column - column the editor should be used for
cellEditor - editor to use

registerAutoFilterForClass

public void registerAutoFilterForClass(java.lang.Class<?> clazz,
                                       java.lang.Class<? extends IAutoFilter> autoFilterClass)
Register an autofilter implementing class to be used on columns that announce a specific content class.

Parameters:
clazz - content clazz thet triggers the use of the filter
autoFilterClass - class implementing the IAutoFilter interface that will be used

registerAutoFilterForColumn

public void registerAutoFilterForColumn(IColumn column,
                                        java.lang.Class<? extends IAutoFilter> autoFilterClass)
Regsiter an autofilter implementing class for use with a specific column.

Parameters:
column - column
autoFilterClass - class of autofilter that will be used

getAutoFilterClass

protected java.lang.Class<? extends IAutoFilter> getAutoFilterClass(IColumn column)
Get the autofiletr class to be used on a column.

Parameters:
column - column
Returns:
class or null if none could be determined

isHierarchyColumn

public boolean isHierarchyColumn(IRow row,
                                 IColumn col)
Determine whether the column is the hierrarchy column. This is accomplished by looking at the cell renderer class.

Parameters:
row - row
col - column
Returns:
true if hte adressed cell is part of the hierarchy column

isHierarchyColumn

public boolean isHierarchyColumn(IColumn column)
Check whether a column is the hierarchy column.

Parameters:
column - column to check
Returns:
true if the column is the hierarchy column

getFocussedCell

public IJaretTableCell getFocussedCell()
Retrieve the currently focussed cell.

Returns:
the focussed cell or null if no cell is focussed

getFocussedCellIdx

public org.eclipse.swt.graphics.Point getFocussedCellIdx()
Retrieve the indizes of the currently focussed cell (idx in the filtered, sorted or whatever table).

Returns:
Point x = column, y = row or null if no cell is focussed

getCellDisplayIdx

public org.eclipse.swt.graphics.Point getCellDisplayIdx(IJaretTableCell cell)
Retrieve the display coordinates for a table cell.

Parameters:
cell - cell to get he coordinates for
Returns:
Point x = colIdx, y = rowIdx

setValue

public void setValue(int colIdx,
                     int rowIdx,
                     java.lang.Object value)
Convenience method for setting a value at a displayed position in the table. NOTE: this method does call the the set method of the model directly, so be aware that the model may protest by throwing a runtime exception or just ignore the new value.

Parameters:
colIdx - column index
rowIdx - row index
value - value to set

setFocus

public boolean setFocus()
will get call to transfer focus to the table. The mthod will focus the left/uppermost cell displayed. If no rows and columns are present no cell will get the focus.

Overrides:
setFocus in class org.eclipse.swt.widgets.Composite

focusLeft

public void focusLeft()
Move the focus left.


focusRight

public void focusRight()
Move the focus right.


focusUp

public void focusUp()
Move the focus up.


focusDown

public void focusDown()
Move the focus down.


isEditing

public boolean isEditing()
Check whether editing of a cell is in progress.

Returns:
true when editing a cell

startEditing

public void startEditing(IRow row,
                         IColumn col,
                         char typedKey)
Start editing of a specified cell if it is editable.

Parameters:
row - row
col - column
typedKey - key typed

stopEditing

public void stopEditing(boolean storeValue)
Stop editing if in progress.

Parameters:
storeValue - if true the value of the editor is stored.

optimizeHeight

public void optimizeHeight(IRow row)
Register a row for height optimization in the next redrwa (redraw triggered by this method).

Parameters:
row - row to optimize height for

optimizeHeight

public void optimizeHeight(java.util.List<IRow> rows)
Register a list of rows for heigt optimization.

Parameters:
rows - list of rows to optimize

scrollToVisible

public void scrollToVisible(IRow row,
                            IColumn column)
Scroll the addressed cell so, that is it completely visible.

Parameters:
row - row of the cell
column - column of the cell

isDisplayed

public boolean isDisplayed(IRow row)
Check whether a row is currently displayed.

Parameters:
row - row to check
Returns:
true if the row is displayed.

isDisplayed

public boolean isDisplayed(IColumn column)
Check whether a column is currently displayed.

Parameters:
column - column to check
Returns:
true if the column is displayed.

getRowInfo

protected JaretTable.RowInfo getRowInfo(IRow row)
Retrieve the row info for a row.

Parameters:
row - row to get the info for
Returns:
info or null

getCellBounds

public org.eclipse.swt.graphics.Rectangle getCellBounds(IRow row,
                                                        IColumn column)
Get the bounding rectangle for a cell.

Parameters:
row - row of the cell
column - column of the cell
Returns:
the bounding rectangle or null if the cell is not visible

getColumnBounds

public org.eclipse.swt.graphics.Rectangle getColumnBounds(IColumn column)
Get the bounding rect for a column.

Parameters:
column - column
Returns:
bounding rect or null if the column is not visible

updateScrollBars

protected void updateScrollBars()
Update the scrollbars.


updateYScrollBar

public void updateYScrollBar()
Update the vertical scrollbar if present.


getAbsBeginXForColIdx

public int getAbsBeginXForColIdx(int colIdx)
Get the absolute begin x for a column.

Parameters:
colIdx - index of the column (in the displayed columns)
Returns:
the absolute x coordinate

getAbsBeginXForColumn

public int getAbsBeginXForColumn(IColumn column)
Get the absolute begin x for a column.

Parameters:
column - the column
Returns:
the absolute x coordinate

getColIdxForAbsX

public int getColIdxForAbsX(int absX)
Return the (internal) index of the column corresponding to the given x coordinate value (absolute value taking all visible columns into account).

Parameters:
absX - absolute x coordinate
Returns:
the column index in the internal list of columns (or -1 if none could be determined)

getColumnForAbsX

public IColumn getColumnForAbsX(int absX)
Return the column for an absolute x coordinate.

Parameters:
absX - absolute x coordinate
Returns:
the column for the coordinate

getRowIdxForAbsY

public int getRowIdxForAbsY(int absY)
Get row index for an absolute y coordinate (thought on the full height table with all rows).

Parameters:
absY - absolute y position (thought on the full table height)
Returns:
index of the corresponding row

rowForY

public IRow rowForY(int y)
Retrieve the row corresponding to a specified y coordinate.

Parameters:
y - y
Returns:
row for that y ycoordinate or null if no row could be determined.

colForX

public IColumn colForX(int x)
Retrieve the column corresponding to a x coordinate.

Parameters:
x - x
Returns:
the corresponding column or null if none could be determined

getCell

public IJaretTableCell getCell(int x,
                               int y)
Retrieve TableXCell for given pixel coordinates.

Parameters:
x - pixel coordinate x
y - pixel coordinate y
Returns:
table cel if found or null if no cell can be found

getCellForIdx

public IJaretTableCell getCellForIdx(int colIdx,
                                     int rowIdx)
Retrieve a table cell for given index coordinates.

Parameters:
colIdx - column index (X)
rowIdx - row index (Y)
Returns:
table cell

setTableModel

public void setTableModel(IJaretTableModel model)
Set a table model to be displayed by the jaret table.

Parameters:
model - the table model to be displayed.

setTableModel

public void setTableModel(IHierarchicalJaretTableModel hmodel)
Set a hierarchical table model. This will internally create a StdHierrahicalTableModel that is a normal TbaleModel including only the expanded rows.

Parameters:
hmodel - hierarchical model to display

getHierarchicalModel

public IHierarchicalJaretTableModel getHierarchicalModel()
Retrieve a hierarchical model if set.

Returns:
hierarchical model or null

getTableModel

public IJaretTableModel getTableModel()
Retrieve the displayed table model.

Returns:
the table model

addColumn

public void addColumn(IColumn column)
Add a column to the underlying table model. Model has to be set for that operation or an IllegalStateException will be thrown.

Parameters:
column - column to be added

getInternalRowIndex

public int getInternalRowIndex(IRow row)
Get the index of the given row in the internal, fileterd list of rows.

Parameters:
row - row to retrieve the index for
Returns:
index of the row or -1 if the row is not in filtered list of rows

updateColumnList

public void updateColumnList()
Update the internal column list. Should be called whenever a column changes visibility or the column order has been changed.


paint

public void paint(org.eclipse.swt.graphics.GC gc,
                  int width,
                  int height)
The main paint method.

Parameters:
gc - GC
width - width of the control
height - height of the control

isSelected

public boolean isSelected(IRow row,
                          IColumn column)
Convenience method to check whether a certain cell is selected.

Parameters:
row - row of the cell
column - column of the cell
Returns:
true if the cell is selected (by itself, a row of a column selection)

setHeaderHeight

public void setHeaderHeight(int newHeight)
Set the header drawing height.

Parameters:
newHeight - height in pixel.

getHeaderHeight

public int getHeaderHeight()
Retrieve the header height.

Returns:
header height (pixel)

getTotalHeight

public int getTotalHeight()
Total height of all possibly displayed rows (filter applied!).

Returns:
sum of all rowheigths

getTotalHeight

public int getTotalHeight(int numRows)
Total height of the first n rows.

Parameters:
numRows - number of rows to sum up the heights of
Returns:
sum of the first first n rowheights

getTotalWidth

public int getTotalWidth()
Retrieve total width of all possibly displayed columns.

Returns:
sum of colwidhts

getTotalWidth

public int getTotalWidth(int n)
Retrieve total width of the first n columns.

Parameters:
n - number of colums to take into account
Returns:
sum of the first n column withs

getWidth

public int getWidth()
Retrieve the width of the control.

Returns:
width in pixel

getHeight

public int getHeight()
Retrieve the height of the control.

Returns:
height in pixel

getTableViewState

public ITableViewState getTableViewState()
Retrieve the table viewstate.

Returns:
the tvs.

setTableViewState

public void setTableViewState(ITableViewState tvs)
Set a TableViewState.

Parameters:
tvs - The tvs to set.

rowHeightChanged

public void rowHeightChanged(IRow row,
                             int newHeight)
Height of row changed.

Specified by:
rowHeightChanged in interface ITableViewStateListener
Parameters:
row - row
newHeight - new height

rowHeightModeChanged

public void rowHeightModeChanged(IRow row,
                                 ITableViewState.RowHeightMode newHeightMode)
Row height mode changed.

Specified by:
rowHeightModeChanged in interface ITableViewStateListener
Parameters:
row - row
newHeightMode - new height mode

columnWidthChanged

public void columnWidthChanged(IColumn column,
                               int newWidth)
Column width changed.

Specified by:
columnWidthChanged in interface ITableViewStateListener
Parameters:
column - column
newWidth - new width

columnWidthsChanged

public void columnWidthsChanged()
Called when more than one column width has changed.

Specified by:
columnWidthsChanged in interface ITableViewStateListener

columnVisibilityChanged

public void columnVisibilityChanged(IColumn column,
                                    boolean visible)
Called when the visibility of a column changed.

Specified by:
columnVisibilityChanged in interface ITableViewStateListener
Parameters:
column - column
visible - true column is now visible false otherwise

sortingChanged

public void sortingChanged()
Called when the sorting order for rows indicated on columns changed.

Specified by:
sortingChanged in interface ITableViewStateListener

columnOrderChanged

public void columnOrderChanged()
Called when the ordering of the columns changed.

Specified by:
columnOrderChanged in interface ITableViewStateListener

cellStyleChanged

public void cellStyleChanged(IRow row,
                             IColumn column,
                             ICellStyle style)
Called whenever a cellstyle has been changed.

Specified by:
cellStyleChanged in interface ITableViewStateListener
Parameters:
row - row
column - column
style - new or changed cell style

setAutoFilterEnable

public void setAutoFilterEnable(boolean enable)
Set the enabled state for the autofilter.

Parameters:
enable - true for enabling the autofilter

getAutoFilterEnable

public boolean getAutoFilterEnable()
Retrieve the autofilter state.

Returns:
true for anabled autofilter

getDrawHeader

public boolean getDrawHeader()
Retrieve the state of header drawing.

Returns:
true when headers are drawn.

setDrawHeader

public void setDrawHeader(boolean drawHeader)
If set to true, the header row will be drawn.

Parameters:
drawHeader - true: draw the header

getHeaderRenderer

public ITableHeaderRenderer getHeaderRenderer()
Returns:
Returns the headerRenderer.

setHeaderRenderer

public void setHeaderRenderer(ITableHeaderRenderer headerRenderer)
Set a header renderer.

Parameters:
headerRenderer - The headerRenderer to set.

isColumnResizeAllowed

public boolean isColumnResizeAllowed()
Returns:
Returns the columnResizeAllowed.

setColumnResizeAllowed

public void setColumnResizeAllowed(boolean columnResizeAllowed)
Set whether column resizing is allowed.

Parameters:
columnResizeAllowed - true for allowing col resizing.

isHeaderResizeAllowed

public boolean isHeaderResizeAllowed()
Returns:
Returns the headerResizeAllowed.

setHeaderResizeAllowed

public void setHeaderResizeAllowed(boolean headerResizeAllowed)
Parameters:
headerResizeAllowed - The headerResizeAllowed to set.

isRowResizeAllowed

public boolean isRowResizeAllowed()
Returns:
Returns the rowResizeAllowed.

setRowResizeAllowed

public void setRowResizeAllowed(boolean rowResizeAllowed)
Parameters:
rowResizeAllowed - The rowResizeAllowed to set.

setFirstRow

public void setFirstRow(int idx,
                        int pixeloffset)
Set the first row displayed.

Parameters:
idx - index of the first row to be displayed.
pixeloffset - the pixeloffset of the first row

displayHeaderContextMenu

public void displayHeaderContextMenu(int x,
                                     int y)
If a header context is present, display it at x,y.

Parameters:
x - x coordinate
y - y coordinate

displayRowContextMenu

public void displayRowContextMenu(int x,
                                  int y)
If a row context is present, display it at x,y.

Parameters:
x - x coordinate
y - y coordinate

setHeaderContextMenu

public void setHeaderContextMenu(org.eclipse.swt.widgets.Menu headerCtxMenu)
Set a context menu to be displayed on the header area.

Parameters:
headerCtxMenu - menu to display on the header or null to disable

getHeaderContextMenu

public org.eclipse.swt.widgets.Menu getHeaderContextMenu()
Retrieve a context menu that has been set on the header.

Returns:
context menu or null

setRowContextMenu

public void setRowContextMenu(org.eclipse.swt.widgets.Menu rowCtxMenu)
Set a context menu to be displayed on rows.

Parameters:
rowCtxMenu - context menu or null to disable

getRowContextMenu

public org.eclipse.swt.widgets.Menu getRowContextMenu()
Retrieve a context menu that has been set for the rows.

Returns:
context menu or null

getFixedColumns

public int getFixedColumns()
Returns:
Returns the fixedColumns.

setFixedColumns

public void setFixedColumns(int fixedColumns)
Set the numerb of fixed columns. Fixed columns are excluded from vertial scrolling. Row resizing can be restricted to the area of the fixed columns.

Parameters:
fixedColumns - The fixedColumns to set.

getFixedRows

public int getFixedRows()
Returns:
Returns the fixedRows.

setFixedRows

public void setFixedRows(int fixedRows)
Set the number of rows to be fixed (excluded from scrolling and autofiltering; optionally from sorting).

Parameters:
fixedRows - The fixedRows to set.

rowChanged

public void rowChanged(IRow row)
Called if there has been a change in the row data.

Specified by:
rowChanged in interface IJaretTableModelListener
Parameters:
row - row that changed.

rowRemoved

public void rowRemoved(IRow row)
Called when a row has been removed from the model.

Specified by:
rowRemoved in interface IJaretTableModelListener
Parameters:
row - removed row.

rowAdded

public void rowAdded(int idx,
                     IRow row)
Called when a row has been added to the model.

Specified by:
rowAdded in interface IJaretTableModelListener
Parameters:
idx - index of the added row.
row - row that has been added.

columnAdded

public void columnAdded(int idx,
                        IColumn column)
Called when a column has been added to the table model.

Specified by:
columnAdded in interface IJaretTableModelListener
Parameters:
idx - index of the new column.
column - the new column.

columnRemoved

public void columnRemoved(IColumn column)
Called when a column has been removed from the model.

Specified by:
columnRemoved in interface IJaretTableModelListener
Parameters:
column - the removed row.

columnChanged

public void columnChanged(IColumn column)
Called when a column changed.

Specified by:
columnChanged in interface IJaretTableModelListener
Parameters:
column - changed column.

cellChanged

public void cellChanged(IRow row,
                        IColumn column)
The value of the specified cell changed.

Specified by:
cellChanged in interface IJaretTableModelListener
Parameters:
row - of the cell
column - of the cell

tableDataChanged

public void tableDataChanged()
All table data has been invalidated.

Specified by:
tableDataChanged in interface IJaretTableModelListener

getExcludeFixedRowsFromSorting

public boolean getExcludeFixedRowsFromSorting()
Retrieve the flag controlling whether fixed rows are excluded from sorting.

Returns:
if true fixed rows will not be affected by sorting operations

setExcludeFixedRowsFromSorting

public void setExcludeFixedRowsFromSorting(boolean excludeFixedRowsFromSorting)
If set to true, fixed rows are exluded from sorting.

Parameters:
excludeFixedRowsFromSorting - true for exclude fixed rows from sorting.

getResizeRestriction

public boolean getResizeRestriction()
Get the state of the resize restriction flag. If true, resizing is only allowed in header and fixed columns (for rows) and the leftmost SELDELTA pixels of eachrow.

Returns:
Returns the resizeRestriction.

setResizeRestriction

public void setResizeRestriction(boolean resizeRestriction)
If set to true resizing of columns will only be allowed in the header area. Row resizing will be allowed on fixed columns and on the first SEL_DELTA pixels of the leftmost column when restricted.

Parameters:
resizeRestriction - The resizeRestriction to set.

rowSelectionAdded

public void rowSelectionAdded(IRow row)
Called whenever a row has been added to a selection.

Specified by:
rowSelectionAdded in interface IJaretTableSelectionModelListener
Parameters:
row - row added.

rowSelectionRemoved

public void rowSelectionRemoved(IRow row)
Called whenever a row has been removed from the selection.

Specified by:
rowSelectionRemoved in interface IJaretTableSelectionModelListener
Parameters:
row - row removed.

cellSelectionAdded

public void cellSelectionAdded(IJaretTableCell cell)
Called whenever a cell has been added to a selection.

Specified by:
cellSelectionAdded in interface IJaretTableSelectionModelListener
Parameters:
cell - cell added

cellSelectionRemoved

public void cellSelectionRemoved(IJaretTableCell cell)
Called whenever a cell has been removed from the selection.

Specified by:
cellSelectionRemoved in interface IJaretTableSelectionModelListener
Parameters:
cell - cell removed

columnSelectionAdded

public void columnSelectionAdded(IColumn column)
Called whenever a column has been added to a selection.

Specified by:
columnSelectionAdded in interface IJaretTableSelectionModelListener
Parameters:
column - column added

columnSelectionRemoved

public void columnSelectionRemoved(IColumn column)
Called whenever a column has been removed from the selection.

Specified by:
columnSelectionRemoved in interface IJaretTableSelectionModelListener
Parameters:
column - column removed

getSelectionModel

public IJaretTableSelectionModel getSelectionModel()
Retrieve the selectionmodel used by the table.

Returns:
the selection model

setSelectionModel

public void setSelectionModel(IJaretTableSelectionModel jts)
Set the selection model to be used by the table.

Parameters:
jts - the selection model to be used (usually the default implementation)

getColumnCount

public int getColumnCount()
Current number of displayed columns.

Returns:
number of displayed columns

getColumn

public IColumn getColumn(int idx)
Retrieve column by the display idx.

Parameters:
idx - display idx
Returns:
column

getColumn

public IColumn getColumn(java.lang.String id)
Convenience method to retrieve a column by it's id from the model.

Parameters:
id - id of the column
Returns:
column or null

getRowCount

public int getRowCount()
Get the number of displayed rows (after filtering!).

Returns:
number of displayed rows

getRow

public IRow getRow(int idx)
Get a row by the display idx.

Parameters:
idx - index in the list of displayed rows.
Returns:
row

getRowFilter

public IRowFilter getRowFilter()
Returns:
Returns the rowFilter.

setRowFilter

public void setRowFilter(IRowFilter rowFilter)
Set a row filter on the table.

Parameters:
rowFilter - The rowFilter to set.

getRowSorter

public IRowSorter getRowSorter()
Returns:
Returns the rowSorter.

setRowSorter

public void setRowSorter(IRowSorter rowSorter)
Set a row sorter. A row sorter will be overruled by sorting setup on columns.

Parameters:
rowSorter - The rowSorter to set.

addTableFocusListener

public void addTableFocusListener(ITableFocusListener tfl)
Add a listener to listen for focus changes in the table (focussed cell).

Parameters:
tfl - listener

remTableFocusListener

public void remTableFocusListener(ITableFocusListener tfl)
Remove a registered listener.

Parameters:
tfl - listener

propertyChange

public void propertyChange(java.beans.PropertyChangeEvent evt)
The table eitselflistens for prop changes of the rowSorter and the rowFilter.

Specified by:
propertyChange in interface java.beans.PropertyChangeListener

getFillDragStrategy

public IFillDragStrategy getFillDragStrategy()
Retrieve the used startegy when performing a fill drag.

Returns:
the fillDragStrategy

setFillDragStrategy

public void setFillDragStrategy(IFillDragStrategy fillDragStrategy)
Set the strategy used when perfoming a fill drag.

Parameters:
fillDragStrategy - the fillDragStrategy to set. Must be non null.

isSupportFillDragging

public boolean isSupportFillDragging()
Retrieve whether fill dragging is activated.

Returns:
the supportFillDragging

setSupportFillDragging

public void setSupportFillDragging(boolean supportFillDragging)
Set fill drag activation.

Parameters:
supportFillDragging - the supportFillDragging to set

getCcpStrategy

public ICCPStrategy getCcpStrategy()
Returns:
the iccpStrategy

setCcpStrategy

public void setCcpStrategy(ICCPStrategy ccpStrategy)
Set the strategy to perform cut, copy, paste operations. Setting the strategy to null causes deactivation of ccp.

Parameters:
ccpStrategy - the iccpStrategy to set or null to deactivat ccp

cut

public void cut()
Do a cut operation. Implementation is supplied by the CCPStrategy.


copy

public void copy()
Do a copy operation. Implementation is supplied by the CCPStrategy.


paste

public void paste()
Do a paste operation. Implementation is supplied by the CCPStrategy.


selectAll

public void selectAll()
Select all cells by selectiong all displayed (not filtered) columns.


getOptimizeScrolling

public boolean getOptimizeScrolling()
Retrieve whether scroll opotimizations are active.

Returns:
true if scrolling is done optimized

setOptimizeScrolling

public void setOptimizeScrolling(boolean optimizeScrolling)
Set whether to use optimized scrolling by copying content. Defaults to false (since it causes trouble when running on Linux or OSX).

Parameters:
optimizeScrolling - true for optimizing

getAutoFilterHeight

public int getAutoFilterHeight()
Retrieve the height used to render the autofilters.

Returns:
height of the autofilter rectangle

addPropertyChangeListener

public void addPropertyChangeListener(java.beans.PropertyChangeListener listener)

Specified by:
addPropertyChangeListener in interface de.jaret.util.misc.PropertyObservable

removePropertyChangeListener

public void removePropertyChangeListener(java.beans.PropertyChangeListener listener)

Specified by:
removePropertyChangeListener in interface de.jaret.util.misc.PropertyObservable

firePropertyChange

public void firePropertyChange(java.lang.String propName,
                               java.lang.Object oldVal,
                               java.lang.Object newVal)


getFirstRowPixelOffset

public int getFirstRowPixelOffset()
Retrieve the pixel offset the first row is scrolled.

Returns:
pixel ofset of the first row

getFirstRowIdx

public int getFirstRowIdx()
Retrive the index of the first row displayed in the scrolled area of the table.

Returns:
index of the first row displayed

getAllowSorting

public boolean getAllowSorting()
Check whether sorting the table is allowed.

Returns:
true if sorting is allowed

setAllowSorting

public void setAllowSorting(boolean allowSorting)
Set the global allowance for sorting. This defaults to true.

Parameters:
allowSorting - true to allow sorting

getInternalRowList

public java.util.List<IRow> getInternalRowList()
Get access to the internal row list. This is for special purposes (like synchronizing models) only. Use with care!

Returns:
the internal list of rows


Copyright © 2012. All Rights Reserved.