de.matthiasmann.twl
Class TableBase

java.lang.Object
  extended by de.matthiasmann.twl.Widget
      extended by de.matthiasmann.twl.TableBase
All Implemented Interfaces:
ScrollPane.AutoScrollable, ScrollPane.CustomPageSize, ScrollPane.Scrollable
Direct Known Subclasses:
Table, TreeTable

public abstract class TableBase
extends Widget
implements ScrollPane.Scrollable, ScrollPane.AutoScrollable, ScrollPane.CustomPageSize

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()

See Also:
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
 
Field Summary
protected  boolean autoSizeAllRows
           
protected  TableBase.Callback[] callbacks
           
protected  TypeMapping<TableBase.CellRenderer> cellRenderers
           
protected  TableBase.CellRenderer[] columnDefaultCellRenderer
           
protected  int columnDividerDragableDistance
           
protected  int columnHeaderHeight
           
protected  TableColumnHeaderModel columnHeaderModel
           
protected  TableBase.ColumnHeader[] columnHeaders
           
protected  TableBase.ColumnSizeSequence columnModel
           
protected  MouseCursor columnResizeCursor
           
protected  int defaultColumnWidth
           
protected static int DRAG_COLUMN_HEADER
           
protected static int DRAG_IGNORE
           
protected static int DRAG_INACTIVE
           
protected static int DRAG_USER
           
protected  int dragActive
           
protected  int dragColumn
           
protected  MouseCursor dragCursor
           
protected  TableBase.DragListener dragListener
           
protected  MouseCursor dragNotPossibleCursor
           
protected  int dragStartColWidth
           
protected  int dragStartSumWidth
           
protected  int dragStartX
           
protected  boolean dropMarkerBeforeRow
           
protected  int dropMarkerRow
           
protected  boolean ensureColumnHeaderMinWidth
           
protected  boolean firstRowPartialVisible
           
protected  int firstVisibleColumn
           
protected  int firstVisibleRow
           
protected  boolean hasCellWidgetCreators
           
protected  Image imageColumnDivider
           
protected  Image imageRowBackground
           
protected  Image imageRowDropMarker
           
protected  Image imageRowOverlay
           
protected  TableBase.KeyboardSearchHandler keyboardSearchHandler
           
protected static int LAST_MOUSE_Y_OUTSIDE
           
protected  int lastMouseColumn
           
protected  int lastMouseRow
           
protected  int lastMouseY
           
protected  boolean lastRowPartialVisible
           
protected  int lastVisibleColumn
           
protected  int lastVisibleRow
           
protected  MouseCursor normalCursor
           
protected  int numColumns
           
protected  int numRows
           
protected  int rowHeight
           
protected  SizeSequence rowModel
           
protected  int scrollPosX
           
protected  int scrollPosY
           
protected  TableSelectionManager selectionManager
           
static AnimationState.StateKey STATE_FIRST_COLUMNHEADER
           
static AnimationState.StateKey STATE_LAST_COLUMNHEADER
           
static AnimationState.StateKey STATE_LEAD_ROW
           
static AnimationState.StateKey STATE_ROW_DROPTARGET
           
static AnimationState.StateKey STATE_ROW_HOVER
           
static AnimationState.StateKey STATE_ROW_ODD
           
static AnimationState.StateKey STATE_ROW_SELECTED
           
static AnimationState.StateKey STATE_SELECTED
           
static AnimationState.StateKey STATE_SORT_ASCENDING
           
static AnimationState.StateKey STATE_SORT_DESCENDING
           
protected  ThemeInfo tableBaseThemeInfo
           
protected  boolean updateAllCellWidgets
           
protected  boolean updateAllColumnWidth
           
protected  SparseGrid widgetGrid
           
 
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 de.matthiasmann.twl.Widget
add, addActionMapping, addPropertyChangeListener, addPropertyChangeListener, adjustSize, afterAddToGUI, allChildrenRemoved, applyThemeBackground, applyThemeBorder, applyThemeInputMap, applyThemeMaxSize, applyThemeMinSize, applyThemeOffscreenExtra, applyThemeOverlay, applyThemeTooltip, beforeRemoveFromGUI, borderChanged, canAcceptKeyboardFocus, childInvalidateLayout, childVisibilityChanged, computeSize, destroy, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, focusFirstChild, focusLastChild, focusNextChild, focusPrevChild, getActionMap, getAnimationState, getBackground, getBorderBottom, getBorderHorizontal, getBorderLeft, getBorderRight, getBorderTop, getBorderVertical, getBottom, getChild, getChildAt, getChildIndex, getGUI, getHeight, getInnerBottom, getInnerHeight, getInnerRight, getInnerWidth, getInnerX, getInnerY, getInputMap, getKeyboardFocusOrder, getMaxHeight, getMaxWidth, getMinWidth, getMouseCursor, getNumChildren, getOffscreenExtraBottom, getOffscreenExtraLeft, getOffscreenExtraRight, getOffscreenExtraTop, getOrCreateActionMap, getOverlay, getParent, getPreferredHeight, getPreferredWidth, getRenderOffscreen, getRight, getRootWidget, getTheme, getThemePath, getThemeTooltipContent, getTintAnimator, getTooltipContent, getWidgetAt, getWidth, getX, getY, giveupKeyboardFocus, hasKeyboardFocus, hasOpenPopups, hasSharedAnimationState, insertChild, invalidateLayout, invalidateLayoutLocally, isAbsoluteTheme, isClip, isDepthFocusTraversal, isEnabled, isFocusKeyEnabled, isInside, isLocallyEnabled, isMouseInside, isVisible, keyboardFocusChildChanged, keyboardFocusGained, keyboardFocusGained, keyboardFocusLost, layoutChildFullInnerArea, layoutChildrenFullInnerArea, moveChild, paint, paintBackground, paintChild, paintChildren, paintDragOverlay, paintOverlay, reapplyTheme, removeChild, removeChild, removePropertyChangeListener, removePropertyChangeListener, requestKeyboardFocus, requestKeyboardFocus, resetTooltip, setActionMap, setBackground, setBorderSize, setBorderSize, setBorderSize, setBorderSize, setCanAcceptKeyboardFocus, setClip, setDepthFocusTraversal, setEnabled, setFocusKeyEnabled, setInnerSize, setInputMap, setMaxSize, setMinSize, setMouseCursor, setOffscreenExtra, setOffscreenExtra, setOverlay, setPosition, setRenderOffscreen, setSize, setTheme, setTintAnimator, setTooltipContent, setVisible, updateTintAnimation, updateTooltip, validateLayout, widgetDisabled
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

STATE_FIRST_COLUMNHEADER

public static final AnimationState.StateKey STATE_FIRST_COLUMNHEADER

STATE_LAST_COLUMNHEADER

public static final AnimationState.StateKey STATE_LAST_COLUMNHEADER

STATE_ROW_SELECTED

public static final AnimationState.StateKey STATE_ROW_SELECTED

STATE_ROW_HOVER

public static final AnimationState.StateKey STATE_ROW_HOVER

STATE_ROW_DROPTARGET

public static final AnimationState.StateKey STATE_ROW_DROPTARGET

STATE_ROW_ODD

public static final AnimationState.StateKey STATE_ROW_ODD

STATE_LEAD_ROW

public static final AnimationState.StateKey STATE_LEAD_ROW

STATE_SELECTED

public static final AnimationState.StateKey STATE_SELECTED

STATE_SORT_ASCENDING

public static final AnimationState.StateKey STATE_SORT_ASCENDING

STATE_SORT_DESCENDING

public static final AnimationState.StateKey STATE_SORT_DESCENDING

cellRenderers

protected final TypeMapping<TableBase.CellRenderer> cellRenderers

widgetGrid

protected final SparseGrid widgetGrid

columnModel

protected final TableBase.ColumnSizeSequence columnModel

columnHeaderModel

protected TableColumnHeaderModel columnHeaderModel

rowModel

protected SizeSequence rowModel

hasCellWidgetCreators

protected boolean hasCellWidgetCreators

columnHeaders

protected TableBase.ColumnHeader[] columnHeaders

columnDefaultCellRenderer

protected TableBase.CellRenderer[] columnDefaultCellRenderer

selectionManager

protected TableSelectionManager selectionManager

keyboardSearchHandler

protected TableBase.KeyboardSearchHandler keyboardSearchHandler

dragListener

protected TableBase.DragListener dragListener

callbacks

protected TableBase.Callback[] callbacks

imageColumnDivider

protected Image imageColumnDivider

imageRowBackground

protected Image imageRowBackground

imageRowOverlay

protected Image imageRowOverlay

imageRowDropMarker

protected Image imageRowDropMarker

tableBaseThemeInfo

protected ThemeInfo tableBaseThemeInfo

columnHeaderHeight

protected int columnHeaderHeight

columnDividerDragableDistance

protected int columnDividerDragableDistance

columnResizeCursor

protected MouseCursor columnResizeCursor

normalCursor

protected MouseCursor normalCursor

dragNotPossibleCursor

protected MouseCursor dragNotPossibleCursor

ensureColumnHeaderMinWidth

protected boolean ensureColumnHeaderMinWidth

numRows

protected int numRows

numColumns

protected int numColumns

rowHeight

protected int rowHeight

defaultColumnWidth

protected int defaultColumnWidth

autoSizeAllRows

protected boolean autoSizeAllRows

updateAllCellWidgets

protected boolean updateAllCellWidgets

updateAllColumnWidth

protected boolean updateAllColumnWidth

scrollPosX

protected int scrollPosX

scrollPosY

protected int scrollPosY

firstVisibleRow

protected int firstVisibleRow

firstVisibleColumn

protected int firstVisibleColumn

lastVisibleRow

protected int lastVisibleRow

lastVisibleColumn

protected int lastVisibleColumn

firstRowPartialVisible

protected boolean firstRowPartialVisible

lastRowPartialVisible

protected boolean lastRowPartialVisible

dropMarkerRow

protected int dropMarkerRow

dropMarkerBeforeRow

protected boolean dropMarkerBeforeRow

LAST_MOUSE_Y_OUTSIDE

protected static final int LAST_MOUSE_Y_OUTSIDE
See Also:
Constant Field Values

lastMouseY

protected int lastMouseY

lastMouseRow

protected int lastMouseRow

lastMouseColumn

protected int lastMouseColumn

DRAG_INACTIVE

protected static final int DRAG_INACTIVE
See Also:
Constant Field Values

DRAG_COLUMN_HEADER

protected static final int DRAG_COLUMN_HEADER
See Also:
Constant Field Values

DRAG_USER

protected static final int DRAG_USER
See Also:
Constant Field Values

DRAG_IGNORE

protected static final int DRAG_IGNORE
See Also:
Constant Field Values

dragActive

protected int dragActive

dragColumn

protected int dragColumn

dragStartX

protected int dragStartX

dragStartColWidth

protected int dragStartColWidth

dragStartSumWidth

protected int dragStartSumWidth

dragCursor

protected MouseCursor dragCursor
Constructor Detail

TableBase

protected TableBase()
Method Detail

getSelectionManager

public TableSelectionManager getSelectionManager()

setSelectionManager

public void setSelectionManager(TableSelectionManager selectionManager)

setDefaultSelectionManager

public void setDefaultSelectionManager()
Installs a multi row selection manager.

See Also:
TableRowSelectionManager, DefaultTableSelectionModel

getKeyboardSearchHandler

public TableBase.KeyboardSearchHandler getKeyboardSearchHandler()

setKeyboardSearchHandler

public void setKeyboardSearchHandler(TableBase.KeyboardSearchHandler keyboardSearchHandler)

getDragListener

public TableBase.DragListener getDragListener()

setDragListener

public void setDragListener(TableBase.DragListener dragListener)

isDropMarkerBeforeRow

public boolean isDropMarkerBeforeRow()

getDropMarkerRow

public int getDropMarkerRow()

setDropMarker

public void setDropMarker(int row,
                          boolean beforeRow)

setDropMarker

public boolean setDropMarker(Event evt)

clearDropMarker

public void clearDropMarker()

addCallback

public void addCallback(TableBase.Callback callback)

removeCallback

public void removeCallback(TableBase.Callback callback)

isVariableRowHeight

public boolean isVariableRowHeight()

setVaribleRowHeight

public void setVaribleRowHeight(boolean varibleRowHeight)

getNumRows

public int getNumRows()

getNumColumns

public int getNumColumns()

getRowFromPosition

public int getRowFromPosition(int y)

getRowStartPosition

public int getRowStartPosition(int row)

getRowHeight

public int getRowHeight(int row)

getRowEndPosition

public int getRowEndPosition(int row)

getColumnFromPosition

public int getColumnFromPosition(int x)

getColumnStartPosition

public int getColumnStartPosition(int column)

getColumnWidth

public int getColumnWidth(int column)

getColumnEndPosition

public int getColumnEndPosition(int column)

setColumnWidth

public void setColumnWidth(int column,
                           int width)

getColumnHeaderAnimationState

public AnimationState getColumnHeaderAnimationState(int column)

setColumnSortOrderAnimationState

public void setColumnSortOrderAnimationState(int sortColumn,
                                             SortOrder sortOrder)
Sets the sort order animation state for all column headers.

Parameters:
sortColumn - This column gets sort order indicators, all other columns not
sortOrder - Which sort order. Can be null to disable the indicators

scrollToRow

public void scrollToRow(int row)

getNumVisibleRows

public int getNumVisibleRows()

getMinHeight

public int getMinHeight()
Description copied from class: Widget
Returns the minimum height of the widget. Layout manager will allocate atleast the minimum height to a widget even when the container is not big enough. The default implementation will not return values smaller then the current border width.

Overrides:
getMinHeight in class Widget
Returns:
the minimum height of the widget

getPreferredInnerWidth

public int getPreferredInnerWidth()
Description copied from class: Widget
Computes the preferred inner width (the size of the widget without the border) The default implementation uses the current position of the children. It is highly recommended to override this method as the default implementation lead to unstable layouts. The default behavior might change in the future to provide a better default behavior.

Overrides:
getPreferredInnerWidth in class Widget
Returns:
the preferred inner width

getPreferredInnerHeight

public int getPreferredInnerHeight()
Description copied from class: Widget
Computes the preferred inner height (the size of the widget without the border) The default implementation uses the current position of the children. It is highly recommended to override this method as the default implementation lead to unstable layouts. The default behavior might change in the future to provide a better default behavior.

Overrides:
getPreferredInnerHeight in class Widget
Returns:
the preferred inner height

registerCellRenderer

public void registerCellRenderer(java.lang.Class<?> dataClass,
                                 TableBase.CellRenderer cellRenderer)

setScrollPosition

public void setScrollPosition(int scrollPosX,
                              int scrollPosY)
Description copied from interface: ScrollPane.Scrollable
Called when the content is scrolled either by a call to ScrollPane.setScrollPositionX(int), ScrollPane.setScrollPositionY(int) or through one of the scrollbars.

Specified by:
setScrollPosition in interface ScrollPane.Scrollable
Parameters:
scrollPosX - the new horizontal scroll position. Always >= 0.
scrollPosY - the new vertical scroll position. Always >= 0.

adjustScrollPosition

public void adjustScrollPosition(int row)

getAutoScrollDirection

public int getAutoScrollDirection(Event evt,
                                  int autoScrollArea)
Description copied from interface: ScrollPane.AutoScrollable
Returns the auto scroll direction for the specified mouse event.

Specified by:
getAutoScrollDirection in interface ScrollPane.AutoScrollable
Parameters:
evt - the mouse event which could trigger an auto scroll
autoScrollArea - the size of the auto scroll area. This is a theme parameter of the ScrollPane
Returns:
the auto scroll direction. -1 for upwards 0 for no auto scrolling +1 for downwards
See Also:
ScrollPane.checkAutoScroll(de.matthiasmann.twl.Event)

getPageSizeX

public int getPageSizeX(int availableWidth)
Description copied from interface: ScrollPane.CustomPageSize
Computes the horizontal page size based on the available width.

Specified by:
getPageSizeX in interface ScrollPane.CustomPageSize
Parameters:
availableWidth - the available width (the visible area)
Returns:
the page size. Must be > 0 and <= availableWidth

getPageSizeY

public int getPageSizeY(int availableHeight)
Description copied from interface: ScrollPane.CustomPageSize
Computes the vertical page size based on the available height.

Specified by:
getPageSizeY in interface ScrollPane.CustomPageSize
Parameters:
availableHeight - the available height (the visible area)
Returns:
the page size. Must be > 0 and <= availableHeight

isFixedWidthMode

public boolean isFixedWidthMode()

checkRowIndex

protected final void checkRowIndex(int row)

checkColumnIndex

protected final void checkColumnIndex(int column)

checkRowRange

protected final void checkRowRange(int idx,
                                   int count)

checkColumnRange

protected final void checkColumnRange(int idx,
                                      int count)

applyTheme

protected void applyTheme(ThemeInfo themeInfo)
Description copied from class: Widget
Apply the given theme. This method also calls invalidateLayout()

Overrides:
applyTheme in class Widget
Parameters:
themeInfo - The theme info for this widget

applyThemeTableBase

protected void applyThemeTableBase(ThemeInfo themeInfo)

applyThemeMouseCursor

protected void applyThemeMouseCursor(ThemeInfo themeInfo)
Overrides:
applyThemeMouseCursor in class Widget

applyCellRendererTheme

protected void applyCellRendererTheme(TableBase.CellRenderer cellRenderer)

removeAllChildren

public void removeAllChildren()
Description copied from class: Widget
Removes all children of this widget. The position of the all removed children is changed to the relative position to this widget. Calls allChildrenRemoved after removing all children.

Overrides:
removeAllChildren in class Widget
See Also:
Widget.allChildrenRemoved()

childAdded

protected void childAdded(Widget child)
Description copied from class: Widget
A new child has been added. The default implementation calls invalidateLayout.

Overrides:
childAdded in class Widget
Parameters:
child - the new child
See Also:
Widget.invalidateLayout()

childRemoved

protected void childRemoved(Widget exChild)
Description copied from class: Widget
A child has been removed. The default implementation calls invalidateLayout.

Overrides:
childRemoved in class Widget
Parameters:
exChild - the removed widget - no longer a child
See Also:
Widget.invalidateLayout()

getOffsetX

protected int getOffsetX()

getOffsetY

protected int getOffsetY()

positionChanged

protected void positionChanged()
Description copied from class: Widget
Called when the position of this widget was changed. The default implementation does nothing. Child positions are already updated to retain the absolute coordinate system. This has the side effect of firing child's positionChanged before the parent's.

Overrides:
positionChanged in class Widget

sizeChanged

protected void sizeChanged()
Description copied from class: Widget
Called when the size of this widget has changed. The default implementation calls invalidateLayoutLocally. As size changes are normally the result of the parent's layout() function.

Overrides:
sizeChanged in class Widget
See Also:
Widget.invalidateLayoutLocally()

getTooltipContentAt

protected java.lang.Object getTooltipContentAt(int mouseX,
                                               int mouseY)
Description copied from class: Widget
Automatic tooltip support. This function is called when the mouse is idle over the widget for a certain time. The default implementation returns the result from getTooltipContent 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.

Overrides:
getTooltipContentAt in class Widget
Parameters:
mouseX - the mouse X coordinate
mouseY - the mouse Y coordinate
Returns:
the tooltip message or null if no tooltip is specified.
See Also:
Widget.updateTooltip()

layout

protected void layout()
Description copied from class: Widget
Called when the layoutInvalid flag is set. The default implementation does nothing.

Overrides:
layout in class Widget

paintWidget

protected void paintWidget(GUI gui)
Description copied from class: Widget
Called by Widget.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.

Overrides:
paintWidget in class Widget
Parameters:
gui - the GUI object - it's the same as getGUI()

insertCellRenderer

protected void insertCellRenderer(Widget widget)

getNodeFromRow

protected abstract TreeTableNode getNodeFromRow(int row)

getCellData

protected abstract java.lang.Object getCellData(int row,
                                                int column,
                                                TreeTableNode node)

getTooltipContentFromRow

protected abstract java.lang.Object getTooltipContentFromRow(int row,
                                                             int column)

isRowSelected

protected boolean isRowSelected(int row)

isCellSelected

protected boolean isCellSelected(int row,
                                 int column)

setColumnDefaultCellRenderer

public 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.

Parameters:
column - the column, must eb >= 0
cellRenderer - the CellRenderer to use or null to restore the global default

getColumnDefaultCellRenderer

public TableBase.CellRenderer getColumnDefaultCellRenderer(int column)
Returns the default cell renderer for the specified column

Parameters:
column - the column, must eb >= 0
Returns:
the previously set CellRenderer or null if non was set

getCellRendererNoDefault

protected TableBase.CellRenderer getCellRendererNoDefault(java.lang.Object data)

getDefaultCellRenderer

protected TableBase.CellRenderer getDefaultCellRenderer(int col)

getCellRenderer

protected TableBase.CellRenderer getCellRenderer(java.lang.Object data,
                                                 int col)

getCellRenderer

protected TableBase.CellRenderer getCellRenderer(int row,
                                                 int col,
                                                 TreeTableNode node)

computeRowHeight

protected int computeRowHeight(int row)

clampColumnWidth

protected int clampColumnWidth(int width)

computePreferredColumnWidth

protected int computePreferredColumnWidth(int index)

autoSizeRow

protected boolean autoSizeRow(int row)

autoSizeAllRows

protected void autoSizeAllRows()

removeCellWidget

protected void removeCellWidget(Widget widget)

updateCellWidget

protected void updateCellWidget(int row,
                                int column)

updateAllCellWidgets

protected void updateAllCellWidgets()

removeAllCellWidgets

protected void removeAllCellWidgets()

getColumnMPM

protected DialogLayout.Gap getColumnMPM(int column)

createColumnHeader

protected TableBase.ColumnHeader createColumnHeader(int column)

updateColumnHeader

protected void updateColumnHeader(int column)

updateColumnHeaderNumbers

protected void updateColumnHeaderNumbers()

isMouseInColumnHeader

protected boolean isMouseInColumnHeader(int y)

getColumnSeparatorUnderMouse

protected int getColumnSeparatorUnderMouse(int x)

getRowUnderMouse

protected int getRowUnderMouse(int y)

getColumnUnderMouse

protected int getColumnUnderMouse(int x)

handleEvent

protected boolean handleEvent(Event evt)
Description copied from class: Widget
Called when an event occurred that this widget could be interested in.

The 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.

Overrides:
handleEvent in class Widget
Parameters:
evt - The event - do not store this object - it may be reused
Returns:
true if the widget handled this event
See Also:
Widget.setFocusKeyEnabled(boolean), Widget.handleKeyStrokeAction(java.lang.String, de.matthiasmann.twl.Event), Widget.setInputMap(de.matthiasmann.twl.InputMap)

handleKeyStrokeAction

protected boolean handleKeyStrokeAction(java.lang.String action,
                                        Event event)
Description copied from class: Widget
Called when a key stroke was found in the inputMap.

Overrides:
handleKeyStrokeAction in class Widget
Parameters:
action - the action associated with the key stroke
event - the event which caused the action
Returns:
true if the action was handled
See Also:
Widget.setInputMap(de.matthiasmann.twl.InputMap)

cancelDragging

protected void cancelDragging()

handleDragEvent

protected boolean handleDragEvent(Event evt)

handleMouseEvent

protected boolean handleMouseEvent(Event evt)

getMouseCursor

public MouseCursor getMouseCursor(Event evt)
Description copied from class: Widget
Returns the mouse cursor which should be used for the given mouse coordinates and modifiers. The default implementation calls Widget.getMouseCursor()

Overrides:
getMouseCursor in class Widget
Parameters:
evt - only Event.getMouseX(), Event.getMouseY() and Event.getModifiers() are valid.
Returns:
the mouse cursor or null when no mouse cursor is defined for this widget

columnHeaderClicked

protected void columnHeaderClicked(int column)

updateAllColumnWidth

protected void updateAllColumnWidth()

updateAll

protected void updateAll()

modelAllChanged

protected void modelAllChanged()

modelRowChanged

protected void modelRowChanged(int row)

modelRowsChanged

protected void modelRowsChanged(int idx,
                                int count)

modelCellChanged

protected void modelCellChanged(int row,
                                int column)

modelRowsInserted

protected void modelRowsInserted(int row,
                                 int count)

modelRowsDeleted

protected void modelRowsDeleted(int row,
                                int count)

modelColumnsInserted

protected void modelColumnsInserted(int column,
                                    int count)

modelColumnsDeleted

protected void modelColumnsDeleted(int column,
                                   int count)

modelColumnHeaderChanged

protected void modelColumnHeaderChanged(int column)