public class Table extends Container
Modifier and Type | Field and Description |
---|---|
static int |
INNER_BORDERS_ALL
Constant denoting that inner borders should be drawn fully
|
static int |
INNER_BORDERS_COLS
Constant denoting that only inner borders columns should be drawn
|
static int |
INNER_BORDERS_NONE
Constant denoting that inner borders should not be drawn at all
|
static int |
INNER_BORDERS_ROWS
Constant denoting that only inner borders rows should be drawn
|
BASELINE, BOTTOM, BRB_CENTER_OFFSET, BRB_CONSTANT_ASCENT, BRB_CONSTANT_DESCENT, BRB_OTHER, CENTER, DRAG_REGION_LIKELY_DRAG_X, DRAG_REGION_LIKELY_DRAG_XY, DRAG_REGION_LIKELY_DRAG_Y, DRAG_REGION_NOT_DRAGGABLE, DRAG_REGION_POSSIBLE_DRAG_X, DRAG_REGION_POSSIBLE_DRAG_XY, DRAG_REGION_POSSIBLE_DRAG_Y, LEFT, RIGHT, TOP
Constructor and Description |
---|
Table()
Constructor for usage by GUI builder and automated tools, normally one
should use the version that accepts the model
|
Table(TableModel model)
Create a table with a new model
|
Table(TableModel model,
boolean includeHeader)
Create a table with a new model
|
Modifier and Type | Method and Description |
---|---|
protected Component |
createCell(Object value,
int row,
int column,
boolean editable)
Creates a cell based on the given value
|
protected TableLayout.Constraint |
createCellConstraint(Object value,
int row,
int column)
Creates the table cell constraint for the given cell, this method can be overriden for
the purposes of modifying the table constraints.
|
void |
deinitialize()
Invoked to indicate that the component initialization is being reversed
since the component was detached from the container hierarchy.
|
int |
getCellAlignment()
Indicates the alignment of the cells see label alignment for details
|
int |
getCellColumn(Component cell)
Returns the column in which the given cell is placed
|
int |
getCellRow(Component cell)
Returns the row in which the given cell is placed
|
int |
getInnerBorderMode()
Returns the current inner border mode
|
TableModel |
getModel()
Returns the model instance
|
String[] |
getPropertyNames()
A component may expose mutable property names for a UI designer to manipulate, this
API is designed for usage internally by the GUI builder code
|
String[] |
getPropertyTypeNames()
This method is here to workaround an XMLVM array type bug where property types aren't
identified properly, it returns the names of the types using the following type names:
String,int,double,long,byte,short,char,String[],String[][],byte[],Image,Image[],Object[],ListModel,ListCellRenderer
|
Class[] |
getPropertyTypes()
Matches the property names method (see that method for further details).
|
Object |
getPropertyValue(String name)
Returns the current value of the property name, this method is used by the GUI builder
|
int |
getSelectedColumn()
Returns the selected column in the table
|
int |
getSelectedRow()
Returns the selected row in the table
|
int |
getTitleAlignment()
Indicates the alignment of the title see label alignment for details
|
void |
initComponent()
Allows subclasses to bind functionality that relies on fully initialized and
"ready for action" component state
|
boolean |
isDrawBorder()
Indicates whether the table border should be drawn
|
boolean |
isIncludeHeader()
Indicates whether the table should render a table header as the first row
|
protected void |
paintGlass(Graphics g)
This method can be overriden by a component to draw on top of itself or its children
after the component or the children finished drawing in a similar way to the glass
pane but more refined per component
|
void |
setBorderSpacing(int horizontal,
int vertical)
Sets the spacing of cells border (relevant only for separate borders and not for collapsed)
|
void |
setCellAlignment(int cellAlignment)
Indicates the alignment of the cells see label alignment for details
|
void |
setCollapseBorder(boolean collapseBorder)
Indicates whether the borders of the cells should collapse to form a one line border
|
void |
setDrawBorder(boolean drawBorder)
Indicates whether the table border should be drawn
|
void |
setDrawEmptyCellsBorder(boolean drawEmptyCellsBorder)
Indicates whether empty cells should have borders (relevant only for separate borders and not for collapsed)
|
void |
setIncludeHeader(boolean includeHeader)
Indicates whether the table should render a table header as the first row
|
void |
setInnerBorderMode(int innerBorder)
Sets how to draw the inner border (All of it, only rows/columns, none, groups)
Note that setting to any mode other than NONE/ALL will result in the border drawing as collapsed whether this is a collpased border or not
|
void |
setModel(TableModel model)
Replaces the underlying model
|
String |
setPropertyValue(String name,
Object value)
Sets a new value to the given property, returns an error message if failed
and null if successful.
|
void |
setTitleAlignment(int titleAlignment)
Indicates the alignment of the title see label alignment for details
|
protected boolean |
shouldDrawInnerBorderAfterRow(int row)
Returns whether an inner border should be drawn after the specified row.
|
addComponent, addComponent, addComponent, addComponent, animateHierarchy, animateHierarchyAndWait, animateHierarchyFade, animateHierarchyFadeAndWait, animateLayout, animateLayoutAndWait, animateLayoutFade, animateLayoutFadeAndWait, animateUnlayout, animateUnlayoutAndWait, applyRTL, calcPreferredSize, cancelRepaints, clearClientProperties, contains, createAnimateMotion, dragInitiated, drop, findFirstFocusable, fireClicked, flushReplace, forceRevalidate, getBottomGap, getClosestComponentTo, getComponentAt, getComponentAt, getComponentCount, getComponentIndex, getGridPosX, getGridPosY, getLayout, getLayoutHeight, getLayoutWidth, getLeadComponent, getLeadParent, getScrollIncrement, getSideGap, getUIManager, initLaf, invalidate, isEnabled, isScrollableX, isScrollableY, isSelectableInteraction, keyPressed, keyReleased, layoutContainer, morph, morphAndWait, paint, paintComponentBackground, paramString, pointerHover, pointerPressed, refreshTheme, removeAll, removeComponent, replace, replace, replaceAndWait, replaceAndWait, replaceAndWait, revalidate, scrollComponentToVisible, setCellRenderer, setEnabled, setLayout, setLeadComponent, setScrollable, setScrollableX, setScrollableY, setScrollIncrement, setShouldCalcPreferredSize, setShouldLayout, setUIManager
addDragOverListener, addDropListener, addFocusListener, addPointerDraggedListener, addPointerPressedListener, addPointerReleasedListener, addPullToRefresh, addScrollListener, animate, bindProperty, calcScrollSize, contains, deinitializeCustomStyle, dragEnter, dragExit, draggingOver, drawDraggedImage, focusGained, focusLost, getAbsoluteX, getAbsoluteY, getBaseline, getBaselineResizeBehavior, getBindablePropertyNames, getBindablePropertyTypes, getBorder, getBoundPropertyValue, getBounds, getClientProperty, getCloudBoundProperty, getCloudDestinationProperty, getComponentForm, getComponentState, getDirtyRegion, getDisabledStyle, getDraggedx, getDraggedy, getDragImage, getDragRegionStatus, getDragSpeed, getHeight, getLabelForComponent, getName, getNextFocusDown, getNextFocusLeft, getNextFocusRight, getNextFocusUp, getParent, getPreferredH, getPreferredSize, getPreferredW, getPressedStyle, getSameHeight, getSameWidth, getScrollable, getScrollAnimationSpeed, getScrollDimension, getScrollOpacity, getScrollOpacityChangeSpeed, getScrollX, getScrollY, getSelectCommandText, getSelectedRect, getSelectedStyle, getStyle, getTensileLength, getUIID, getUnselectedStyle, getVisibleBounds, getWidth, getX, getY, growShrink, handlesInput, hasFocus, initCustomStyle, installDefaultPainter, isAlwaysTensile, isCellRenderer, isDragActivated, isDragAndDropOperation, isDraggable, isDragRegion, isDropTarget, isFlatten, isFocusable, isGrabsPointerEvents, isHideInPortrait, isInClippingRegion, isInitialized, isRTL, isScrollable, isScrollVisible, isSmoothScrolling, isSnapToGrid, isStickyDrag, isTactileTouch, isTactileTouch, isTensileDragEnabled, isVisible, keyRepeated, laidOut, longKeyPress, longPointerPress, onScrollX, onScrollY, paintBackground, paintBackgrounds, paintBorder, paintComponent, paintComponent, paintLock, paintLockRelease, paintScrollbars, paintScrollbarX, paintScrollbarY, pinch, pointerDragged, pointerDragged, pointerHoverPressed, pointerHoverReleased, pointerPressed, pointerReleased, pointerReleased, putClientProperty, refreshTheme, refreshTheme, removeDragOverListener, removeDropListener, removeFocusListener, removePointerDraggedListener, removePointerPressedListener, removePointerReleasedListener, removeScrollListener, repaint, repaint, requestFocus, resetFocusable, scrollRectToVisible, scrollRectToVisible, setAlwaysTensile, setBoundPropertyValue, setCloudBoundProperty, setCloudDestinationProperty, setComponentState, setDirtyRegion, setDisabledStyle, setDraggable, setDropTarget, setFlatten, setFocus, setFocusable, setGrabsPointerEvents, setHandlesInput, setHeight, setHideInPortrait, setInitialized, setIsScrollVisible, setLabelForComponent, setName, setNextFocusDown, setNextFocusLeft, setNextFocusRight, setNextFocusUp, setPreferredH, setPreferredSize, setPreferredW, setPressedStyle, setRTL, setSameHeight, setSameWidth, setScrollAnimationSpeed, setScrollOpacityChangeSpeed, setScrollSize, setScrollVisible, setScrollX, setScrollY, setSelectCommandText, setSelectedStyle, setSize, setSmoothScrolling, setSnapToGrid, setTactileTouch, setTensileDragEnabled, setTensileLength, setUIID, setUnselectedStyle, setVisible, setWidth, setX, setY, shouldBlockSideSwipe, styleChanged, toString, unbindProperty
public static final int INNER_BORDERS_NONE
public static final int INNER_BORDERS_ROWS
public static final int INNER_BORDERS_COLS
public static final int INNER_BORDERS_ALL
public Table()
public Table(TableModel model)
model
- the model underlying this tablepublic Table(TableModel model, boolean includeHeader)
model
- the model underlying this tableincludeHeader
- Indicates whether the table should render a table header as the first rowpublic int getSelectedRow()
public int getSelectedColumn()
protected void paintGlass(Graphics g)
Container
paintGlass
in class Container
g
- the graphics contextprotected Component createCell(Object value, int row, int column, boolean editable)
value
- the new value objectrow
- row number, -1 for the header rowscolumn
- column numbereditable
- true if the cell is editablepublic void initComponent()
Component
initComponent
in class Component
public void deinitialize()
Component
deinitialize
in class Component
public void setModel(TableModel model)
model
- the new modelpublic TableModel getModel()
public boolean isDrawBorder()
public void setDrawBorder(boolean drawBorder)
drawBorder
- the drawBorder to setpublic void setInnerBorderMode(int innerBorder)
innerBorder
- one of the INNER_BORDER_* constantspublic int getInnerBorderMode()
protected boolean shouldDrawInnerBorderAfterRow(int row)
row
- The row in questionpublic void setCollapseBorder(boolean collapseBorder)
collapseBorder
- true to collapse (default), false for separate borderspublic void setDrawEmptyCellsBorder(boolean drawEmptyCellsBorder)
drawEmptyCellsBorder
- - true to draw (default), false otherwisepublic void setBorderSpacing(int horizontal, int vertical)
horizontal
- - The horizontal spacingvertical
- - The vertical spacingpublic int getTitleAlignment()
Label.setAlignment(int)
public void setTitleAlignment(int titleAlignment)
titleAlignment
- the title alignmentLabel.setAlignment(int)
public int getCellColumn(Component cell)
cell
- the component representing the cell placed in the tablepublic int getCellRow(Component cell)
cell
- the component representing the cell placed in the tablepublic int getCellAlignment()
Label.setAlignment(int)
public void setCellAlignment(int cellAlignment)
cellAlignment
- the table cell alignmentLabel.setAlignment(int)
public boolean isIncludeHeader()
public void setIncludeHeader(boolean includeHeader)
includeHeader
- the includeHeader to setprotected TableLayout.Constraint createCellConstraint(Object value, int row, int column)
value
- the value of the cellrow
- the table rowcolumn
- the table columnpublic String[] getPropertyNames()
Component
getPropertyNames
in class Component
public Class[] getPropertyTypes()
Component
getPropertyTypes
in class Component
public String[] getPropertyTypeNames()
Component
getPropertyTypeNames
in class Component
public Object getPropertyValue(String name)
Component
getPropertyValue
in class Component
name
- the name of the propertypublic String setPropertyValue(String name, Object value)
Component
setPropertyValue
in class Component
name
- the name of the propertyvalue
- new value for the property