Package org.apache.pivot.wtk
Class TablePane
- java.lang.Object
-
- org.apache.pivot.wtk.Component
-
- org.apache.pivot.wtk.Container
-
- org.apache.pivot.wtk.TablePane
-
- All Implemented Interfaces:
java.lang.Iterable<Component>
,Sequence<Component>
,ConstrainedVisual
,Visual
- Direct Known Subclasses:
LinkButtonDataRenderer
,MenuItemDataRenderer
@DefaultProperty("rows") public class TablePane extends Container
Container that arranges components in a two-dimensional grid, optionally spanning multiple rows and columns, much like an HTML<table>
element.Note that unlike an HTML
<tablei>
, components that span multiple rows or columns will not "push" other components out of their way. Instead, the spanning components will simply overlay the cells into which they span. This means that application developers may have to usefiller cells
in the cells that are spanned.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
TablePane.Column
Represents a table pane column.class
TablePane.ColumnSequence
Class that manages a table pane's column list.static class
TablePane.Filler
Component that can be used as filler for empty cells.static class
TablePane.Row
Represents a table pane row.class
TablePane.RowSequence
Class that manages a table pane's row list.static interface
TablePane.Skin
Table pane skin interface.-
Nested classes/interfaces inherited from class org.apache.pivot.wtk.Container
Container.EDTChecker
-
Nested classes/interfaces inherited from class org.apache.pivot.wtk.Component
Component.DecoratorSequence, Component.StyleDictionary, Component.UserDataDictionary
-
Nested classes/interfaces inherited from interface org.apache.pivot.collections.Sequence
Sequence.Tree<T>
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
RELATIVE_SIZE_INDICATOR
-
Constructor Summary
Constructors Constructor Description TablePane()
Creates a newTablePane
with empty row and column sequences.TablePane(Sequence<TablePane.Column> columns)
Creates a newTablePane
with the specified columns.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description Component
getCellComponent(int rowIndex, int columnIndex)
Gets the component at the specified cell in this table pane.int
getColumnAt(int x)
Returns the index of the column at a given location.Bounds
getColumnBounds(int column)
TablePane.ColumnSequence
getColumns()
static int
getColumnSpan(Component component)
int
getRowAt(int y)
Returns the index of the row at a given location.Bounds
getRowBounds(int row)
TablePane.RowSequence
getRows()
Returns the table pane row sequence.static int
getRowSpan(Component component)
ListenerList<TablePaneAttributeListener>
getTablePaneAttributeListeners()
ListenerList<TablePaneListener>
getTablePaneListeners()
Sequence<Component>
remove(int index, int count)
Overrides the base method to check whether or not a cell component is being removed, and fires the appropriate event in that case.static void
setColumnSpan(Component component, int columnSpan)
static void
setRowSpan(Component component, int rowSpan)
protected void
setSkin(Skin skin)
Sets the skin, replacing any previous skin.-
Methods inherited from class org.apache.pivot.wtk.Container
add, assertEventDispatchThread, assertEventDispatchThread, clear, containsFocus, descendantAdded, descendantGainedFocus, descendantLostFocus, descendantRemoved, get, getComponentAt, getContainerListeners, getContainerMouseListeners, getDescendantAt, getFocusTraversalPolicy, getGraphics, getLength, getNamedComponent, indexOf, insert, invalidate, isAncestor, isDoubleBuffered, iterator, layout, load, mouseClick, mouseDown, mouseMove, mouseOut, mouseUp, mouseWheel, move, paint, remove, removeAll, repaint, requestFocus, setDoubleBuffered, setEventDispatchThreadChecker, setFocusTraversalPolicy, setParent, setVisible, store, transferFocus, update
-
Methods inherited from class org.apache.pivot.wtk.Component
checkSkin, clearFocus, contains, copyStyle, copyStyle, getAncestor, getAncestor, getAttribute, getAutomationID, getBaseline, getBaseline, getBounds, getComponentClassListeners, getComponentDataListeners, getComponentDecoratorListeners, getComponentKeyListeners, getComponentListeners, getComponentMouseButtonListeners, getComponentMouseListeners, getComponentMouseWheelListeners, getComponentStateListeners, getComponentStyleListeners, getComponentTooltipListeners, getCursor, getDecoratedBounds, getDecorators, getDisplay, getDragSource, getDropTarget, getFocusedComponent, getHeight, getHeightLimits, getLocation, getMaximumHeight, getMaximumWidth, getMenuHandler, getMinimumHeight, getMinimumWidth, getMouseLocation, getName, getNamedStyles, getParent, getPreferredHeight, getPreferredHeight, getPreferredSize, getPreferredWidth, getPreferredWidth, getScreenBounds, getSize, getSkin, getStyle, getStyle, getStyleBoolean, getStyleBoolean, getStyleColor, getStyleColor, getStyleFont, getStyleFont, getStyleInt, getStyleInt, getStyles, getTextInputMethodListener, getTooltipDelay, getTooltipText, getTooltipWrapText, getTypedStyles, getUserData, getVisibleArea, getVisibleArea, getVisibleArea, getWidth, getWidthLimits, getWindow, getX, getY, indexBoundsCheck, installSkin, isBlocked, isEnabled, isFocusable, isFocused, isMouseOver, isOpaque, isPreferredHeightSet, isPreferredSizeSet, isPreferredWidthSet, isShowing, isValid, isVisible, keyPressed, keyReleased, keyTyped, mapPointFromAncestor, mapPointFromAncestor, mapPointToAncestor, mapPointToAncestor, mouseOver, offsetToScreen, putStyle, putStyle, reenterMouse, repaint, repaint, repaint, repaint, repaint, scrollAreaToVisible, scrollAreaToVisible, setAttribute, setAutomationID, setAutomationID, setCursor, setDragSource, setDropTarget, setEnabled, setFocused, setHeight, setHeightLimits, setHeightLimits, setLocation, setLocation, setMaximumHeight, setMaximumWidth, setMenuHandler, setMinimumHeight, setMinimumWidth, setName, setPreferredHeight, setPreferredSize, setPreferredSize, setPreferredWidth, setSize, setSize, setStyleName, setStyleNames, setStyleNames, setStyles, setStyles, setTooltipDelay, setTooltipText, setTooltipWrapText, setWidth, setWidthLimits, setWidthLimits, setX, setY, toString, transferFocus, validate
-
-
-
-
Field Detail
-
RELATIVE_SIZE_INDICATOR
public static final java.lang.String RELATIVE_SIZE_INDICATOR
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
TablePane
public TablePane()
Creates a newTablePane
with empty row and column sequences.
-
TablePane
public TablePane(Sequence<TablePane.Column> columns)
Creates a newTablePane
with the specified columns.- Parameters:
columns
- The column sequence to use. A copy of this sequence will be made
-
-
Method Detail
-
setSkin
protected void setSkin(Skin skin)
Description copied from class:Component
Sets the skin, replacing any previous skin.
-
getRows
public TablePane.RowSequence getRows()
Returns the table pane row sequence.- Returns:
- The table pane row sequence
-
getRowAt
public int getRowAt(int y)
Returns the index of the row at a given location.- Parameters:
y
- The y-coordinate of the row to identify.- Returns:
- The row index, or
-1
if there is no row at the given y-coordinate.
-
getRowBounds
public Bounds getRowBounds(int row)
- Parameters:
row
- The row index.- Returns:
- The bounds of a given row.
-
getColumns
public TablePane.ColumnSequence getColumns()
- Returns:
- The table pane column sequence
-
getColumnAt
public int getColumnAt(int x)
Returns the index of the column at a given location.- Parameters:
x
- The x-coordinate of the column to identify.- Returns:
- The column index, or
-1
if there is no column at the given x-coordinate.
-
getColumnBounds
public Bounds getColumnBounds(int column)
- Parameters:
column
- The column index.- Returns:
- The bounds of a given column.
-
getCellComponent
public Component getCellComponent(int rowIndex, int columnIndex)
Gets the component at the specified cell in this table pane.- Parameters:
rowIndex
- The row index of the cellcolumnIndex
- The column index of the cell- Returns:
- The component in the specified cell, or
null
if the cell is empty
-
remove
public Sequence<Component> remove(int index, int count)
Overrides the base method to check whether or not a cell component is being removed, and fires the appropriate event in that case.
-
getTablePaneListeners
public ListenerList<TablePaneListener> getTablePaneListeners()
- Returns:
- The table pane listener list.
-
getTablePaneAttributeListeners
public ListenerList<TablePaneAttributeListener> getTablePaneAttributeListeners()
- Returns:
- The table pane attribute listener list.
-
getRowSpan
public static int getRowSpan(Component component)
-
setRowSpan
public static void setRowSpan(Component component, int rowSpan)
-
getColumnSpan
public static int getColumnSpan(Component component)
-
setColumnSpan
public static void setColumnSpan(Component component, int columnSpan)
-
-