|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectde.matthiasmann.twl.Widget
de.matthiasmann.twl.TableBase
public abstract class TableBase
Base class for Table and TreeTable.
It does not have a TableSelectionManager by default. To make the
table entries selectable you need to install a selection manager:
setSelectionManager(de.matthiasmann.twl.TableSelectionManager) or
setDefaultSelectionManager()
Table,
TreeTable| Nested Class Summary | |
|---|---|
static interface |
TableBase.Callback
|
static interface |
TableBase.CellRenderer
IMPORTANT: Widgets implementing CellRenderer should not call Widget.invalidateLayout() or Widget.invalidateLayoutLocally()
. |
static interface |
TableBase.CellWidgetCreator
|
protected class |
TableBase.ColumnHeader
|
protected class |
TableBase.ColumnSizeSequence
|
static interface |
TableBase.DragListener
|
static interface |
TableBase.KeyboardSearchHandler
|
static class |
TableBase.StringCellRenderer
|
| Nested classes/interfaces inherited from class de.matthiasmann.twl.Widget |
|---|
Widget.OffscreenMouseAdjustments, Widget.RenderOffscreen |
| Fields inherited from class de.matthiasmann.twl.Widget |
|---|
STATE_DISABLED, STATE_HAS_FOCUSED_CHILD, STATE_HAS_OPEN_POPUPS, STATE_KEYBOARD_FOCUS |
| Constructor Summary | |
|---|---|
protected |
TableBase()
|
| Method Summary | |
|---|---|
void |
addCallback(TableBase.Callback callback)
|
void |
adjustScrollPosition(int row)
|
protected void |
applyCellRendererTheme(TableBase.CellRenderer cellRenderer)
|
protected void |
applyTheme(ThemeInfo themeInfo)
Apply the given theme. |
protected void |
applyThemeMouseCursor(ThemeInfo themeInfo)
|
protected void |
applyThemeTableBase(ThemeInfo themeInfo)
|
protected void |
autoSizeAllRows()
|
protected boolean |
autoSizeRow(int row)
|
protected void |
cancelDragging()
|
protected void |
checkColumnIndex(int column)
|
protected void |
checkColumnRange(int idx,
int count)
|
protected void |
checkRowIndex(int row)
|
protected void |
checkRowRange(int idx,
int count)
|
protected void |
childAdded(Widget child)
A new child has been added. |
protected void |
childRemoved(Widget exChild)
A child has been removed. |
protected int |
clampColumnWidth(int width)
|
void |
clearDropMarker()
|
protected void |
columnHeaderClicked(int column)
|
protected int |
computePreferredColumnWidth(int index)
|
protected int |
computeRowHeight(int row)
|
protected TableBase.ColumnHeader |
createColumnHeader(int column)
|
int |
getAutoScrollDirection(Event evt,
int autoScrollArea)
Returns the auto scroll direction for the specified mouse event. |
protected abstract java.lang.Object |
getCellData(int row,
int column,
TreeTableNode node)
|
protected TableBase.CellRenderer |
getCellRenderer(int row,
int col,
TreeTableNode node)
|
protected TableBase.CellRenderer |
getCellRenderer(java.lang.Object data,
int col)
|
protected TableBase.CellRenderer |
getCellRendererNoDefault(java.lang.Object data)
|
TableBase.CellRenderer |
getColumnDefaultCellRenderer(int column)
Returns the default cell renderer for the specified column |
int |
getColumnEndPosition(int column)
|
int |
getColumnFromPosition(int x)
|
AnimationState |
getColumnHeaderAnimationState(int column)
|
protected DialogLayout.Gap |
getColumnMPM(int column)
|
protected int |
getColumnSeparatorUnderMouse(int x)
|
int |
getColumnStartPosition(int column)
|
protected int |
getColumnUnderMouse(int x)
|
int |
getColumnWidth(int column)
|
protected TableBase.CellRenderer |
getDefaultCellRenderer(int col)
|
TableBase.DragListener |
getDragListener()
|
int |
getDropMarkerRow()
|
TableBase.KeyboardSearchHandler |
getKeyboardSearchHandler()
|
int |
getMinHeight()
Returns the minimum height of the widget. |
MouseCursor |
getMouseCursor(Event evt)
Returns the mouse cursor which should be used for the given mouse coordinates and modifiers. |
protected abstract TreeTableNode |
getNodeFromRow(int row)
|
int |
getNumColumns()
|
int |
getNumRows()
|
int |
getNumVisibleRows()
|
protected int |
getOffsetX()
|
protected int |
getOffsetY()
|
int |
getPageSizeX(int availableWidth)
Computes the horizontal page size based on the available width. |
int |
getPageSizeY(int availableHeight)
Computes the vertical page size based on the available height. |
int |
getPreferredInnerHeight()
Computes the preferred inner height (the size of the widget without the border) The default implementation uses the current position of the children. |
int |
getPreferredInnerWidth()
Computes the preferred inner width (the size of the widget without the border) The default implementation uses the current position of the children. |
int |
getRowEndPosition(int row)
|
int |
getRowFromPosition(int y)
|
int |
getRowHeight(int row)
|
int |
getRowStartPosition(int row)
|
protected int |
getRowUnderMouse(int y)
|
TableSelectionManager |
getSelectionManager()
|
protected java.lang.Object |
getTooltipContentAt(int mouseX,
int mouseY)
Automatic tooltip support. |
protected abstract java.lang.Object |
getTooltipContentFromRow(int row,
int column)
|
protected boolean |
handleDragEvent(Event evt)
|
protected boolean |
handleEvent(Event evt)
Called when an event occurred that this widget could be interested in. |
protected boolean |
handleKeyStrokeAction(java.lang.String action,
Event event)
Called when a key stroke was found in the inputMap. |
protected boolean |
handleMouseEvent(Event evt)
|
protected void |
insertCellRenderer(Widget widget)
|
protected boolean |
isCellSelected(int row,
int column)
|
boolean |
isDropMarkerBeforeRow()
|
boolean |
isFixedWidthMode()
|
protected boolean |
isMouseInColumnHeader(int y)
|
protected boolean |
isRowSelected(int row)
|
boolean |
isVariableRowHeight()
|
protected void |
layout()
Called when the layoutInvalid flag is set. |
protected void |
modelAllChanged()
|
protected void |
modelCellChanged(int row,
int column)
|
protected void |
modelColumnHeaderChanged(int column)
|
protected void |
modelColumnsDeleted(int column,
int count)
|
protected void |
modelColumnsInserted(int column,
int count)
|
protected void |
modelRowChanged(int row)
|
protected void |
modelRowsChanged(int idx,
int count)
|
protected void |
modelRowsDeleted(int row,
int count)
|
protected void |
modelRowsInserted(int row,
int count)
|
protected void |
paintWidget(GUI gui)
Called by Widget.paint(de.matthiasmann.twl.GUI) after painting the
background and before painting all children. |
protected void |
positionChanged()
Called when the position of this widget was changed. |
void |
registerCellRenderer(java.lang.Class<?> dataClass,
TableBase.CellRenderer cellRenderer)
|
protected void |
removeAllCellWidgets()
|
void |
removeAllChildren()
Removes all children of this widget. |
void |
removeCallback(TableBase.Callback callback)
|
protected void |
removeCellWidget(Widget widget)
|
void |
scrollToRow(int row)
|
void |
setColumnDefaultCellRenderer(int column,
TableBase.CellRenderer cellRenderer)
Sets the default cell renderer for the specified column The column numbers are not affected by model changes. |
void |
setColumnSortOrderAnimationState(int sortColumn,
SortOrder sortOrder)
Sets the sort order animation state for all column headers. |
void |
setColumnWidth(int column,
int width)
|
void |
setDefaultSelectionManager()
Installs a multi row selection manager. |
void |
setDragListener(TableBase.DragListener dragListener)
|
boolean |
setDropMarker(Event evt)
|
void |
setDropMarker(int row,
boolean beforeRow)
|
void |
setKeyboardSearchHandler(TableBase.KeyboardSearchHandler keyboardSearchHandler)
|
void |
setScrollPosition(int scrollPosX,
int scrollPosY)
Called when the content is scrolled either by a call to ScrollPane.setScrollPositionX(int),
ScrollPane.setScrollPositionY(int) or
through one of the scrollbars. |
void |
setSelectionManager(TableSelectionManager selectionManager)
|
void |
setVaribleRowHeight(boolean varibleRowHeight)
|
protected void |
sizeChanged()
Called when the size of this widget has changed. |
protected void |
updateAll()
|
protected void |
updateAllCellWidgets()
|
protected void |
updateAllColumnWidth()
|
protected void |
updateCellWidget(int row,
int column)
|
protected void |
updateColumnHeader(int column)
|
protected void |
updateColumnHeaderNumbers()
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final AnimationState.StateKey STATE_FIRST_COLUMNHEADER
public static final AnimationState.StateKey STATE_LAST_COLUMNHEADER
public static final AnimationState.StateKey STATE_ROW_SELECTED
public static final AnimationState.StateKey STATE_ROW_HOVER
public static final AnimationState.StateKey STATE_ROW_DROPTARGET
public static final AnimationState.StateKey STATE_ROW_ODD
public static final AnimationState.StateKey STATE_LEAD_ROW
public static final AnimationState.StateKey STATE_SELECTED
public static final AnimationState.StateKey STATE_SORT_ASCENDING
public static final AnimationState.StateKey STATE_SORT_DESCENDING
protected final TypeMapping<TableBase.CellRenderer> cellRenderers
protected final SparseGrid widgetGrid
protected final TableBase.ColumnSizeSequence columnModel
protected TableColumnHeaderModel columnHeaderModel
protected SizeSequence rowModel
protected boolean hasCellWidgetCreators
protected TableBase.ColumnHeader[] columnHeaders
protected TableBase.CellRenderer[] columnDefaultCellRenderer
protected TableSelectionManager selectionManager
protected TableBase.KeyboardSearchHandler keyboardSearchHandler
protected TableBase.DragListener dragListener
protected TableBase.Callback[] callbacks
protected Image imageColumnDivider
protected Image imageRowBackground
protected Image imageRowOverlay
protected Image imageRowDropMarker
protected ThemeInfo tableBaseThemeInfo
protected int columnHeaderHeight
protected int columnDividerDragableDistance
protected MouseCursor columnResizeCursor
protected MouseCursor normalCursor
protected MouseCursor dragNotPossibleCursor
protected boolean ensureColumnHeaderMinWidth
protected int numRows
protected int numColumns
protected int rowHeight
protected int defaultColumnWidth
protected boolean autoSizeAllRows
protected boolean updateAllCellWidgets
protected boolean updateAllColumnWidth
protected int scrollPosX
protected int scrollPosY
protected int firstVisibleRow
protected int firstVisibleColumn
protected int lastVisibleRow
protected int lastVisibleColumn
protected boolean firstRowPartialVisible
protected boolean lastRowPartialVisible
protected int dropMarkerRow
protected boolean dropMarkerBeforeRow
protected static final int LAST_MOUSE_Y_OUTSIDE
protected int lastMouseY
protected int lastMouseRow
protected int lastMouseColumn
protected static final int DRAG_INACTIVE
protected static final int DRAG_COLUMN_HEADER
protected static final int DRAG_USER
protected static final int DRAG_IGNORE
protected int dragActive
protected int dragColumn
protected int dragStartX
protected int dragStartColWidth
protected int dragStartSumWidth
protected MouseCursor dragCursor
| Constructor Detail |
|---|
protected TableBase()
| Method Detail |
|---|
public TableSelectionManager getSelectionManager()
public void setSelectionManager(TableSelectionManager selectionManager)
public void setDefaultSelectionManager()
TableRowSelectionManager,
DefaultTableSelectionModelpublic TableBase.KeyboardSearchHandler getKeyboardSearchHandler()
public void setKeyboardSearchHandler(TableBase.KeyboardSearchHandler keyboardSearchHandler)
public TableBase.DragListener getDragListener()
public void setDragListener(TableBase.DragListener dragListener)
public boolean isDropMarkerBeforeRow()
public int getDropMarkerRow()
public void setDropMarker(int row,
boolean beforeRow)
public boolean setDropMarker(Event evt)
public void clearDropMarker()
public void addCallback(TableBase.Callback callback)
public void removeCallback(TableBase.Callback callback)
public boolean isVariableRowHeight()
public void setVaribleRowHeight(boolean varibleRowHeight)
public int getNumRows()
public int getNumColumns()
public int getRowFromPosition(int y)
public int getRowStartPosition(int row)
public int getRowHeight(int row)
public int getRowEndPosition(int row)
public int getColumnFromPosition(int x)
public int getColumnStartPosition(int column)
public int getColumnWidth(int column)
public int getColumnEndPosition(int column)
public void setColumnWidth(int column,
int width)
public AnimationState getColumnHeaderAnimationState(int column)
public void setColumnSortOrderAnimationState(int sortColumn,
SortOrder sortOrder)
sortColumn - This column gets sort order indicators, all other columns notsortOrder - Which sort order. Can be null to disable the indicatorspublic void scrollToRow(int row)
public int getNumVisibleRows()
public int getMinHeight()
Widget
getMinHeight in class Widgetpublic int getPreferredInnerWidth()
Widget
getPreferredInnerWidth in class Widgetpublic int getPreferredInnerHeight()
Widget
getPreferredInnerHeight in class Widget
public void registerCellRenderer(java.lang.Class<?> dataClass,
TableBase.CellRenderer cellRenderer)
public void setScrollPosition(int scrollPosX,
int scrollPosY)
ScrollPane.ScrollableScrollPane.setScrollPositionX(int),
ScrollPane.setScrollPositionY(int) or
through one of the scrollbars.
setScrollPosition in interface ScrollPane.ScrollablescrollPosX - the new horizontal scroll position. Always >= 0.scrollPosY - the new vertical scroll position. Always >= 0.public void adjustScrollPosition(int row)
public int getAutoScrollDirection(Event evt,
int autoScrollArea)
ScrollPane.AutoScrollable
getAutoScrollDirection in interface ScrollPane.AutoScrollableevt - the mouse event which could trigger an auto scrollautoScrollArea - the size of the auto scroll area.
This is a theme parameter of the ScrollPane
ScrollPane.checkAutoScroll(de.matthiasmann.twl.Event)public int getPageSizeX(int availableWidth)
ScrollPane.CustomPageSize
getPageSizeX in interface ScrollPane.CustomPageSizeavailableWidth - the available width (the visible area)
public int getPageSizeY(int availableHeight)
ScrollPane.CustomPageSize
getPageSizeY in interface ScrollPane.CustomPageSizeavailableHeight - the available height (the visible area)
public boolean isFixedWidthMode()
protected final void checkRowIndex(int row)
protected final void checkColumnIndex(int column)
protected final void checkRowRange(int idx,
int count)
protected final void checkColumnRange(int idx,
int count)
protected void applyTheme(ThemeInfo themeInfo)
Widget
applyTheme in class WidgetthemeInfo - The theme info for this widgetprotected void applyThemeTableBase(ThemeInfo themeInfo)
protected void applyThemeMouseCursor(ThemeInfo themeInfo)
applyThemeMouseCursor in class Widgetprotected void applyCellRendererTheme(TableBase.CellRenderer cellRenderer)
public void removeAllChildren()
Widget
removeAllChildren in class WidgetWidget.allChildrenRemoved()protected void childAdded(Widget child)
Widget
childAdded in class Widgetchild - the new childWidget.invalidateLayout()protected void childRemoved(Widget exChild)
Widget
childRemoved in class WidgetexChild - the removed widget - no longer a childWidget.invalidateLayout()protected int getOffsetX()
protected int getOffsetY()
protected void positionChanged()
Widget
positionChanged in class Widgetprotected void sizeChanged()
Widget
sizeChanged in class WidgetWidget.invalidateLayoutLocally()
protected java.lang.Object getTooltipContentAt(int mouseX,
int mouseY)
WidgetgetTooltipContent
if it is non null, otherwise the result from getThemeTooltipContent
is returned.
This method is not called if the tooltip is already open and the mouse is
moved but does not leave this widget. If the tooltip depends on the mouse
position then updateTooltip must be called from handleEvent.
getTooltipContentAt in class WidgetmouseX - the mouse X coordinatemouseY - the mouse Y coordinate
Widget.updateTooltip()protected void layout()
Widget
layout in class Widgetprotected void paintWidget(GUI gui)
WidgetWidget.paint(de.matthiasmann.twl.GUI) after painting the
background and before painting all children.
This should be overwritten instead of paint if normal themeable
painting is desired by the subclass.
The default implementation does nothing.
paintWidget in class Widgetgui - the GUI object - it's the same as getGUI()protected void insertCellRenderer(Widget widget)
protected abstract TreeTableNode getNodeFromRow(int row)
protected abstract java.lang.Object getCellData(int row,
int column,
TreeTableNode node)
protected abstract java.lang.Object getTooltipContentFromRow(int row,
int column)
protected boolean isRowSelected(int row)
protected boolean isCellSelected(int row,
int column)
public void setColumnDefaultCellRenderer(int column,
TableBase.CellRenderer cellRenderer)
column - the column, must eb >= 0cellRenderer - the CellRenderer to use or null to restore the global defaultpublic TableBase.CellRenderer getColumnDefaultCellRenderer(int column)
column - the column, must eb >= 0
protected TableBase.CellRenderer getCellRendererNoDefault(java.lang.Object data)
protected TableBase.CellRenderer getDefaultCellRenderer(int col)
protected TableBase.CellRenderer getCellRenderer(java.lang.Object data,
int col)
protected TableBase.CellRenderer getCellRenderer(int row,
int col,
TreeTableNode node)
protected int computeRowHeight(int row)
protected int clampColumnWidth(int width)
protected int computePreferredColumnWidth(int index)
protected boolean autoSizeRow(int row)
protected void autoSizeAllRows()
protected void removeCellWidget(Widget widget)
protected void updateCellWidget(int row,
int column)
protected void updateAllCellWidgets()
protected void removeAllCellWidgets()
protected DialogLayout.Gap getColumnMPM(int column)
protected TableBase.ColumnHeader createColumnHeader(int column)
protected void updateColumnHeader(int column)
protected void updateColumnHeaderNumbers()
protected boolean isMouseInColumnHeader(int y)
protected int getColumnSeparatorUnderMouse(int x)
protected int getRowUnderMouse(int y)
protected int getColumnUnderMouse(int x)
protected boolean handleEvent(Event evt)
WidgetThe default implementation handles only keyboard events and delegates
them to the child widget which has keyboard focus.
If focusKey handling is enabled then this widget cycles the keyboard
focus through it's children.
If the key was not consumed by a child or focusKey and an inputMap is
specified then the event is translated by the InputMap and
handleKeyStrokeAction is called when a mapping was found.
If the widget wants to receive mouse events then it must return true for all mouse events except for MOUSE_WHEEL (which is optional) event. Otherwise the following mouse event are not send. Before mouse movement or button events are send a MOUSE_ENTERED event is send first.
handleEvent in class Widgetevt - The event - do not store this object - it may be reused
Widget.setFocusKeyEnabled(boolean),
Widget.handleKeyStrokeAction(java.lang.String, de.matthiasmann.twl.Event),
Widget.setInputMap(de.matthiasmann.twl.InputMap)
protected boolean handleKeyStrokeAction(java.lang.String action,
Event event)
Widget
handleKeyStrokeAction in class Widgetaction - the action associated with the key strokeevent - the event which caused the action
Widget.setInputMap(de.matthiasmann.twl.InputMap)protected void cancelDragging()
protected boolean handleDragEvent(Event evt)
protected boolean handleMouseEvent(Event evt)
public MouseCursor getMouseCursor(Event evt)
WidgetWidget.getMouseCursor()
getMouseCursor in class Widgetevt - only Event.getMouseX(), Event.getMouseY() and Event.getModifiers() are valid.
protected void columnHeaderClicked(int column)
protected void updateAllColumnWidth()
protected void updateAll()
protected void modelAllChanged()
protected void modelRowChanged(int row)
protected void modelRowsChanged(int idx,
int count)
protected void modelCellChanged(int row,
int column)
protected void modelRowsInserted(int row,
int count)
protected void modelRowsDeleted(int row,
int count)
protected void modelColumnsInserted(int column,
int count)
protected void modelColumnsDeleted(int column,
int count)
protected void modelColumnHeaderChanged(int column)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||