|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.eclipse.swt.widgets.Widget org.eclipse.swt.widgets.Control org.eclipse.swt.widgets.Scrollable org.eclipse.swt.widgets.Composite org.eclipse.swt.widgets.Canvas de.jaret.util.ui.table.JaretTable
public class JaretTable
Custom drawn table widget for the SWT Toolkit. Always consider using the native table widget!
The JaretTable features:
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 |
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 |
---|
public static final java.lang.String PROPERTYNAME_HEADERHEIGHT
public static final java.lang.String PROPERTYNAME_FIRSTROWIDX
public static final java.lang.String PROPERTYNAME_FIRSTROWPIXELOFFSET
public static final java.lang.String PROPERTYNAME_ROWSORTER
public static final java.lang.String PROPERTYNAME_ROWFILTER
public static final java.lang.String PROPERTYNAME_SORTING
public static final java.lang.String PROPERTYNAME_FILTERING
public static final java.lang.String PROPERTYNAME_AUTOFILTERENABLE
protected int _firstRowIdx
protected int _firstRowPixelOffset
protected int _firstColIdx
protected int _firstColPixelOffset
protected int _fixedColumns
protected int _fixedRows
protected java.util.Map<IColumn,ICellRenderer> _colCellRendererMap
protected java.util.Map<java.lang.Class<?>,ICellRenderer> _colClassRendererMap
protected java.util.Map<IColumn,ICellEditor> _colCellEditorMap
protected java.util.Map<java.lang.Class<?>,ICellEditor> _colClassEditorMap
protected boolean _supportFillDragging
protected IFillDragStrategy _fillDragStrategy
protected ICCPStrategy _ccpStrategy
protected IJaretTableModel _model
protected IHierarchicalJaretTableModel _hierarchicalModel
protected ITableViewState _tvs
protected java.util.List<IRow> _rows
protected IRowFilter _rowFilter
protected IRowSorter _rowSorter
protected java.util.List<IColumn> _cols
protected org.eclipse.swt.graphics.Rectangle _headerRect
protected int _headerHeight
protected int _minHeaderHeight
protected boolean _drawHeader
protected org.eclipse.swt.graphics.Rectangle _tableRect
protected ITableHeaderRenderer _headerRenderer
protected org.eclipse.swt.graphics.Rectangle _fixedColRect
protected org.eclipse.swt.graphics.Rectangle _fixedRowRect
protected org.eclipse.swt.graphics.Rectangle _dragMarkerRect
protected org.eclipse.swt.graphics.Rectangle _autoFilterRect
protected boolean _autoFilterEnabled
protected de.jaret.util.ui.table.JaretTable.AutoFilter _autoFilter
protected java.util.Map<IColumn,IAutoFilter> _autoFilterMap
protected java.util.Map<java.lang.Class<?>,java.lang.Class<? extends IAutoFilter>> _autoFilterClassMap
protected java.util.Map<IColumn,java.lang.Class<? extends IAutoFilter>> _autoFilterColumnMap
protected boolean _resizeRestriction
protected boolean _excludeFixedRowsFromSorting
protected boolean _allowSorting
protected IRow _focussedRow
protected IColumn _focussedColumn
protected java.util.List<ITableFocusListener> _tableFocusListeners
protected IJaretTableSelectionModel _selectionModel
protected ICellEditor _editor
protected org.eclipse.swt.widgets.Control _editorControl
protected IRow _editorRow
protected org.eclipse.swt.widgets.Menu _headerContextMenu
protected org.eclipse.swt.widgets.Menu _rowContextMenu
protected java.beans.PropertyChangeSupport _propertyChangeSupport
protected java.util.List<JaretTable.RowInfo> _rowInfoCache
protected java.util.List<JaretTable.ColInfo> _colInfoCache
protected JaretTable.RowInfo _heightDraggedRowInfo
protected JaretTable.ColInfo _widthDraggedColumn
protected boolean _headerDragged
protected int _firstCellSelectX
protected int _firstCellSelectY
protected int _lastCellSelectX
protected int _lastCellSelectY
protected boolean _isFillDrag
protected int _firstColSelectIdx
protected int _lastColSelectIdx
protected int _firstRowSelectIdx
protected int _lastRowSelectIdx
protected org.eclipse.swt.graphics.Point _lastKeySelect
protected org.eclipse.swt.graphics.Point _firstKeySelect
protected de.jaret.util.ui.table.JaretTable.SelectType _lastSelectType
protected java.util.Collection<IRow> _rowsToOptimize
Constructor Detail |
---|
public JaretTable(org.eclipse.swt.widgets.Composite parent, int style)
parent
- parent compositestyle
- style bits (use HSCROLL, VSCROLL)Method Detail |
---|
public void registerCellRenderer(java.lang.Class<?> clazz, ICellRenderer cellRenderer)
clazz
- class the renderer should be applied forcellRenderer
- renderer to use for clazzpublic void registerCellRenderer(IColumn column, ICellRenderer cellRenderer)
column
- column the renderer should be used oncellRenderer
- renderer to useprotected ICellRenderer getCellRenderer(IRow row, IColumn column)
row
- row row of the cellcolumn
- column column of the cell
public void registerCellEditor(java.lang.Class<?> clazz, ICellEditor cellEditor)
clazz
- class of objeects the editor should be used forcellEditor
- editor to usepublic void registerCellEditor(IColumn column, ICellEditor cellEditor)
column
- column the editor should be used forcellEditor
- editor to usepublic void registerAutoFilterForClass(java.lang.Class<?> clazz, java.lang.Class<? extends IAutoFilter> autoFilterClass)
clazz
- content clazz thet triggers the use of the filterautoFilterClass
- class implementing the IAutoFilter interface that will be usedpublic void registerAutoFilterForColumn(IColumn column, java.lang.Class<? extends IAutoFilter> autoFilterClass)
column
- columnautoFilterClass
- class of autofilter that will be usedprotected java.lang.Class<? extends IAutoFilter> getAutoFilterClass(IColumn column)
column
- column
null
if none could be determinedpublic boolean isHierarchyColumn(IRow row, IColumn col)
row
- rowcol
- column
public boolean isHierarchyColumn(IColumn column)
column
- column to check
true
if the column is the hierarchy columnpublic IJaretTableCell getFocussedCell()
null
if no cell is focussedpublic org.eclipse.swt.graphics.Point getFocussedCellIdx()
null
if no cell is focussedpublic org.eclipse.swt.graphics.Point getCellDisplayIdx(IJaretTableCell cell)
cell
- cell to get he coordinates for
public void setValue(int colIdx, int rowIdx, java.lang.Object value)
colIdx
- column indexrowIdx
- row indexvalue
- value to setpublic boolean setFocus()
setFocus
in class org.eclipse.swt.widgets.Composite
public void focusLeft()
public void focusRight()
public void focusUp()
public void focusDown()
public boolean isEditing()
public void startEditing(IRow row, IColumn col, char typedKey)
row
- rowcol
- columntypedKey
- key typedpublic void stopEditing(boolean storeValue)
storeValue
- if true the value of the editor is stored.public void optimizeHeight(IRow row)
row
- row to optimize height forpublic void optimizeHeight(java.util.List<IRow> rows)
rows
- list of rows to optimizepublic void scrollToVisible(IRow row, IColumn column)
row
- row of the cellcolumn
- column of the cellpublic boolean isDisplayed(IRow row)
row
- row to check
public boolean isDisplayed(IColumn column)
column
- column to check
protected JaretTable.RowInfo getRowInfo(IRow row)
row
- row to get the info for
null
public org.eclipse.swt.graphics.Rectangle getCellBounds(IRow row, IColumn column)
row
- row of the cellcolumn
- column of the cell
null
if the cell is not visiblepublic org.eclipse.swt.graphics.Rectangle getColumnBounds(IColumn column)
column
- column
null
if the column is not visibleprotected void updateScrollBars()
public void updateYScrollBar()
public int getAbsBeginXForColIdx(int colIdx)
colIdx
- index of the column (in the displayed columns)
public int getAbsBeginXForColumn(IColumn column)
column
- the column
public int getColIdxForAbsX(int absX)
absX
- absolute x coordinate
public IColumn getColumnForAbsX(int absX)
absX
- absolute x coordinate
public int getRowIdxForAbsY(int absY)
absY
- absolute y position (thought on the full table height)
public IRow rowForY(int y)
y
- y
null
if no row could be determined.public IColumn colForX(int x)
x
- x
null
if none could be determinedpublic IJaretTableCell getCell(int x, int y)
x
- pixel coordinate xy
- pixel coordinate y
null
if no cell can be foundpublic IJaretTableCell getCellForIdx(int colIdx, int rowIdx)
colIdx
- column index (X)rowIdx
- row index (Y)
public void setTableModel(IJaretTableModel model)
model
- the table model to be displayed.public void setTableModel(IHierarchicalJaretTableModel hmodel)
hmodel
- hierarchical model to displaypublic IHierarchicalJaretTableModel getHierarchicalModel()
null
public IJaretTableModel getTableModel()
public void addColumn(IColumn column)
column
- column to be addedpublic int getInternalRowIndex(IRow row)
row
- row to retrieve the index for
public void updateColumnList()
public void paint(org.eclipse.swt.graphics.GC gc, int width, int height)
gc
- GCwidth
- width of the controlheight
- height of the controlpublic boolean isSelected(IRow row, IColumn column)
row
- row of the cellcolumn
- column of the cell
public void setHeaderHeight(int newHeight)
newHeight
- height in pixel.public int getHeaderHeight()
public int getTotalHeight()
public int getTotalHeight(int numRows)
numRows
- number of rows to sum up the heights of
public int getTotalWidth()
public int getTotalWidth(int n)
n
- number of colums to take into account
public int getWidth()
public int getHeight()
public ITableViewState getTableViewState()
public void setTableViewState(ITableViewState tvs)
tvs
- The tvs to set.public void rowHeightChanged(IRow row, int newHeight)
rowHeightChanged
in interface ITableViewStateListener
row
- rownewHeight
- new heightpublic void rowHeightModeChanged(IRow row, ITableViewState.RowHeightMode newHeightMode)
rowHeightModeChanged
in interface ITableViewStateListener
row
- rownewHeightMode
- new height modepublic void columnWidthChanged(IColumn column, int newWidth)
columnWidthChanged
in interface ITableViewStateListener
column
- columnnewWidth
- new widthpublic void columnWidthsChanged()
columnWidthsChanged
in interface ITableViewStateListener
public void columnVisibilityChanged(IColumn column, boolean visible)
columnVisibilityChanged
in interface ITableViewStateListener
column
- columnvisible
- true column is now visible false otherwisepublic void sortingChanged()
sortingChanged
in interface ITableViewStateListener
public void columnOrderChanged()
columnOrderChanged
in interface ITableViewStateListener
public void cellStyleChanged(IRow row, IColumn column, ICellStyle style)
cellStyleChanged
in interface ITableViewStateListener
row
- rowcolumn
- columnstyle
- new or changed cell stylepublic void setAutoFilterEnable(boolean enable)
enable
- true for enabling the autofilterpublic boolean getAutoFilterEnable()
public boolean getDrawHeader()
public void setDrawHeader(boolean drawHeader)
drawHeader
- true: draw the headerpublic ITableHeaderRenderer getHeaderRenderer()
public void setHeaderRenderer(ITableHeaderRenderer headerRenderer)
headerRenderer
- The headerRenderer to set.public boolean isColumnResizeAllowed()
public void setColumnResizeAllowed(boolean columnResizeAllowed)
columnResizeAllowed
- true for allowing col resizing.public boolean isHeaderResizeAllowed()
public void setHeaderResizeAllowed(boolean headerResizeAllowed)
headerResizeAllowed
- The headerResizeAllowed to set.public boolean isRowResizeAllowed()
public void setRowResizeAllowed(boolean rowResizeAllowed)
rowResizeAllowed
- The rowResizeAllowed to set.public void setFirstRow(int idx, int pixeloffset)
idx
- index of the first row to be displayed.pixeloffset
- the pixeloffset of the first rowpublic void displayHeaderContextMenu(int x, int y)
x
- x coordinatey
- y coordinatepublic void displayRowContextMenu(int x, int y)
x
- x coordinatey
- y coordinatepublic void setHeaderContextMenu(org.eclipse.swt.widgets.Menu headerCtxMenu)
headerCtxMenu
- menu to display on the header or null
to disablepublic org.eclipse.swt.widgets.Menu getHeaderContextMenu()
null
public void setRowContextMenu(org.eclipse.swt.widgets.Menu rowCtxMenu)
rowCtxMenu
- context menu or null
to disablepublic org.eclipse.swt.widgets.Menu getRowContextMenu()
null
public int getFixedColumns()
public void setFixedColumns(int fixedColumns)
fixedColumns
- The fixedColumns to set.public int getFixedRows()
public void setFixedRows(int fixedRows)
fixedRows
- The fixedRows to set.public void rowChanged(IRow row)
rowChanged
in interface IJaretTableModelListener
row
- row that changed.public void rowRemoved(IRow row)
rowRemoved
in interface IJaretTableModelListener
row
- removed row.public void rowAdded(int idx, IRow row)
rowAdded
in interface IJaretTableModelListener
idx
- index of the added row.row
- row that has been added.public void columnAdded(int idx, IColumn column)
columnAdded
in interface IJaretTableModelListener
idx
- index of the new column.column
- the new column.public void columnRemoved(IColumn column)
columnRemoved
in interface IJaretTableModelListener
column
- the removed row.public void columnChanged(IColumn column)
columnChanged
in interface IJaretTableModelListener
column
- changed column.public void cellChanged(IRow row, IColumn column)
cellChanged
in interface IJaretTableModelListener
row
- of the cellcolumn
- of the cellpublic void tableDataChanged()
tableDataChanged
in interface IJaretTableModelListener
public boolean getExcludeFixedRowsFromSorting()
public void setExcludeFixedRowsFromSorting(boolean excludeFixedRowsFromSorting)
excludeFixedRowsFromSorting
- true for exclude fixed rows from sorting.public boolean getResizeRestriction()
public void setResizeRestriction(boolean resizeRestriction)
resizeRestriction
- The resizeRestriction to set.public void rowSelectionAdded(IRow row)
rowSelectionAdded
in interface IJaretTableSelectionModelListener
row
- row added.public void rowSelectionRemoved(IRow row)
rowSelectionRemoved
in interface IJaretTableSelectionModelListener
row
- row removed.public void cellSelectionAdded(IJaretTableCell cell)
cellSelectionAdded
in interface IJaretTableSelectionModelListener
cell
- cell addedpublic void cellSelectionRemoved(IJaretTableCell cell)
cellSelectionRemoved
in interface IJaretTableSelectionModelListener
cell
- cell removedpublic void columnSelectionAdded(IColumn column)
columnSelectionAdded
in interface IJaretTableSelectionModelListener
column
- column addedpublic void columnSelectionRemoved(IColumn column)
columnSelectionRemoved
in interface IJaretTableSelectionModelListener
column
- column removedpublic IJaretTableSelectionModel getSelectionModel()
public void setSelectionModel(IJaretTableSelectionModel jts)
jts
- the selection model to be used (usually the default implementation)public int getColumnCount()
public IColumn getColumn(int idx)
idx
- display idx
public IColumn getColumn(java.lang.String id)
id
- id of the column
null
public int getRowCount()
public IRow getRow(int idx)
idx
- index in the list of displayed rows.
public IRowFilter getRowFilter()
public void setRowFilter(IRowFilter rowFilter)
rowFilter
- The rowFilter to set.public IRowSorter getRowSorter()
public void setRowSorter(IRowSorter rowSorter)
rowSorter
- The rowSorter to set.public void addTableFocusListener(ITableFocusListener tfl)
tfl
- listenerpublic void remTableFocusListener(ITableFocusListener tfl)
tfl
- listenerpublic void propertyChange(java.beans.PropertyChangeEvent evt)
propertyChange
in interface java.beans.PropertyChangeListener
public IFillDragStrategy getFillDragStrategy()
public void setFillDragStrategy(IFillDragStrategy fillDragStrategy)
fillDragStrategy
- the fillDragStrategy to set. Must be non null.public boolean isSupportFillDragging()
public void setSupportFillDragging(boolean supportFillDragging)
supportFillDragging
- the supportFillDragging to setpublic ICCPStrategy getCcpStrategy()
public void setCcpStrategy(ICCPStrategy ccpStrategy)
null
causes
deactivation of ccp.
ccpStrategy
- the iccpStrategy to set or null
to deactivat ccppublic void cut()
public void copy()
public void paste()
public void selectAll()
public boolean getOptimizeScrolling()
public void setOptimizeScrolling(boolean optimizeScrolling)
optimizeScrolling
- true for optimizingpublic int getAutoFilterHeight()
public void addPropertyChangeListener(java.beans.PropertyChangeListener listener)
addPropertyChangeListener
in interface de.jaret.util.misc.PropertyObservable
public void removePropertyChangeListener(java.beans.PropertyChangeListener listener)
removePropertyChangeListener
in interface de.jaret.util.misc.PropertyObservable
public void firePropertyChange(java.lang.String propName, java.lang.Object oldVal, java.lang.Object newVal)
public int getFirstRowPixelOffset()
public int getFirstRowIdx()
public boolean getAllowSorting()
public void setAllowSorting(boolean allowSorting)
allowSorting
- true to allow sortingpublic java.util.List<IRow> getInternalRowList()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |