Package snap.view
Class TableView<T>
java.lang.Object
snap.props.PropObject
snap.view.View
snap.view.ParentView
snap.view.TableView<T>
- All Implemented Interfaces:
PropChange.DoChange
,Selectable<T>
,XMLArchiver.Archivable
A View subclass to show a table of items.
-
Field Summary
Modifier and TypeFieldDescriptionstatic final String
static final int
static final String
static final String
static final String
static final String
Fields inherited from class snap.view.ParentView
_children, Child_Prop, NeedsLayout_Prop
Fields inherited from class snap.view.View
_align, _borderRadius, _effect, _font, _margin, _padding, _repaintRect, _showing, _spacing, _vertical, Action, Align_Prop, Border_Prop, BorderRadius_Prop, Clip_Prop, Cursor_Prop, DEFAULT_ALIGN, DEFAULT_MARGIN, DEFAULT_PADDING, DEFAULT_SPACING, Disabled_Prop, DragEvents, Effect_Prop, Fill_Prop, Focusable_Prop, Focused_Prop, FocusWhenPressed_Prop, Font_Prop, GrowHeight_Prop, GrowWidth_Prop, Height_Prop, KeyEvents, KeyPress, KeyRelease, KeyType, LeanX_Prop, LeanY_Prop, Managed_Prop, Margin_Prop, MaxHeight_Prop, MaxWidth_Prop, MinHeight_Prop, MinWidth_Prop, MouseDrag, MouseEnter, MouseEvents, MouseExit, MouseMove, MousePress, MouseRelease, Name_Prop, Opacity_Prop, Padding_Prop, Paintable_Prop, Parent_Prop, Pickable_Prop, PrefHeight_Prop, PrefWidth_Prop, Rotate_Prop, ScaleX_Prop, ScaleY_Prop, Scroll, Showing_Prop, Spacing_Prop, Text_Prop, ToolTip_Prop, TransX_Prop, TransY_Prop, Vertical_Prop, Visible_Prop, Width_Prop, X_Prop, Y_Prop
Fields inherited from class snap.props.PropObject
_pcs, EMPTY_OBJECT
Fields inherited from interface snap.util.Selectable
Items_Prop, SelIndex_Prop, SelItem_Prop
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Adds a TableCol.protected void
cellEditingChanged
(ListCell<T> aCell) Called when cell editing starts.void
Called to edit given cell.void
Called to stop editing a cell.protected void
fromXMLChildren
(XMLArchiver anArchiver, XMLElement anElement) XML unarchival for shape children.void
fromXMLView
(XMLArchiver anArchiver, XMLElement anElement) XML unarchival.getCell
(int aRow, int aCol) Returns the cell at given row and col.Called to set method to configure cell for rendering.getCellForXY
(double aX, double aY) Returns the cell at given Y coord.Returns the cell padding.getCol
(int anIndex) Returns the column at given index.int
Returns the number of columns.getColForX
(double aX) Returns the column at given X coord.int
getColIndexForX
(double aX) Returns the col index for given X.getCols()
Returns the column at given index.Returns the default border.Returns the cell currently editing.Override to forward to table.Override to forward to table.Returns grid color.Returns the header col.Returns the HeaderView.Returns the items.protected double
getPrefHeightImpl
(double aW) Returns the preferred height.protected double
getPrefWidthImpl
(double aH) Returns the preferred width.int
Returns the number of rows.double
Returns the row height.int
getRowIndexForY
(double aY) Returns the row index for given Y.Returns the ScrollGroup.Returns the ScrollView.getSel()
Returns the selection.getSel2D()
Returns the selection.Returns the selected cell.int
Returns the selected column.int
Returns the selected index.Returns the selected item.protected ImageBox
getSelRectImage
(Rect aRect) A fuzzy cell border image to highlight cell.int
Returns the selected row.Returns a mapped property name.boolean
Returns whether table cells are editable.boolean
Returns whether list allows multiple selections.boolean
Returns whether row height has been explicitly set.boolean
Returns whether to show horizontal grid lines.boolean
Returns whether to show vertical grid lines.boolean
Returns whether to show header.boolean
Returns whether to show header.protected void
Override to layout children with VBox layout.protected void
paintAbove
(Painter aPntr) Override to paint highlight for selected cell.protected void
Called when PickList changes selection.protected void
processEvent
(ViewEvent anEvent) Handle events.protected void
processEventFilters
(ViewEvent anEvent) Override to catch KeyPress (tab or enter) for TableView or cells (when editing).removeCol
(int anIndex) Remove's the TableCol at the given index from this Table's children list.int
Removes the given TableCol from this table's children list.void
Selects down in the table.void
Selects right in the table.void
Selects right in the table.void
selectUp()
Selects up in the table.void
setCellConfigure
(Consumer<ListCell<T>> aCC) Called to set method to configure cell for rendering.void
setCellPadding
(Insets aPad) Sets the cell padding.void
setEditable
(boolean aValue) Sets whether table cells are editable.protected void
setEditingCell
(ListCell<T> aCell) Sets the cell currently editing.protected void
setFocused
(boolean aValue) Override to clear focus image.void
setGridColor
(Color aValue) Sets grid color.void
setHeight
(double aValue) Override to reset cells.void
Sets the items.void
setItemsList
(List<T> theItems) Sets the items.void
setMultiSel
(boolean aValue) Sets whether list allows multiple selections.void
setRowHeight
(double aValue) Sets the row height.void
Sets the table selection.void
Sets the table selection.void
setSelIndex
(int anIndex) Sets the selected index.void
setSelItem
(T anItem) Sets the selected index.void
setSelRowColIndex
(int aRow, int aCol) Returns the selected cell.void
setShowGridX
(boolean aValue) Sets whether to show horizontal grid lines.void
setShowGridY
(boolean aValue) Sets whether to show vertical grid lines.void
setShowHeader
(boolean aValue) Sets whether to show header.void
setShowHeaderCol
(boolean aValue) Sets whether to show header.protected void
toXMLChildren
(XMLArchiver anArchiver, XMLElement anElement) XML archival of children.toXMLView
(XMLArchiver anArchiver) XML archival.void
updateItem
(T anItem) Tell table to update given item.void
Tell table to update visible items.void
updateItems
(T[] theItems) Tell table to update given items.Methods inherited from class snap.view.ParentView
addChild, addChild, addDeepChangeListener, childDidDeepChange, childDidPropChange, fromXML, getChild, getChildAt, getChildAt, getChildCount, getChildCountManaged, getChildForClass, getChildForName, getChildLast, getChildren, getChildrenForClass, getChildrenInPaintOrder, getChildrenManaged, getFocusNext, getFocusPrev, getPropValue, getViewList, getViewProxy, indexOfChild, initProps, intersectsShape, isInLayout, isNeedsLayout, isNeedsLayoutDeep, isNeedsRepaintDeep, layout, layoutDeep, layoutDeepImpl, layoutFloatingViews, paintAll, paintChildren, parentFontChanged, processPropChange, relayout, removeChild, removeChild, removeChildren, removeDeepChangeListener, setChildren, setFont, setNeedsLayout, setNeedsLayoutDeep, setNeedsRepaintDeep, setOwner, setOwnerChildren, setPropValue, setShowing, themeChanged, toXML
Methods inherited from class snap.view.View
addBinding, addEventFilter, addEventHandler, clone, contains, contains, containsShape, createActionEvent, disableEvents, enableEvents, fireActionEvent, getAlign, getAlignX, getAlignY, getAnim, getAnimCleared, getAnimTimeDeep, getBestHeight, getBestSize, getBestWidth, getBinding, getBinding, getBindingCount, getBindings, getBorder, getBorderRadius, getBounds, getBoundsLocal, getBoundsParent, getBoundsShape, getBoundsShapeParent, getClip, getClipAll, getClipAllBounds, getClipBounds, getClippedRect, getCursor, getDefaultFill, getDefaultFont, getEffect, getEnv, getEventAdapter, getFill, getFillColor, getFont, getHeight, getHost, getInsetsAll, getLean, getLeanX, getLeanY, getLocalToParent, getLocalToParent, getMargin, getMaxHeight, getMaxSize, getMaxWidth, getMaxX, getMaxY, getMidX, getMidY, getMinHeight, getMinHeightImpl, getMinSize, getMinWidth, getMinWidthImpl, getName, getOpacity, getOpacityAll, getOwner, getOwner, getPadding, getParent, getParent, getParentCount, getParentToLocal, getParentToLocal, getPhysics, getPhysics, getPrefHeight, getPrefHeight, getPrefSize, getPrefWidth, getPrefWidth, getProp, getPropDefault, getProps, getRealClassName, getRepaintRect, getRepaintRectExpanded, getRootView, getRotate, getScale, getScaleX, getScaleY, getSize, getSpacing, getText, getToolTip, getToolTip, getTransX, getTransY, getUpdater, getVisRect, getWidth, getWindow, getX, getXY, getY, indexInHost, indexInParent, isActionable, isAncestor, isClipToBounds, isDisabled, isEnabled, isFocusable, isFocused, isFocusKeysEnabled, isFocusPainted, isFocusWhenPressed, isFontSet, isGrowHeight, isGrowWidth, isGuest, isHorizontal, isLocalToParentSimple, isManaged, isManagedVisible, isMaxHeightSet, isMaxWidthSet, isMinHeightSet, isMinWidthSet, isMouseDown, isMouseOver, isNeedsRepaint, isPaintable, isPickable, isPickableVisible, isPrefHeightSet, isPrefWidthSet, isShowing, isToolTipEnabled, isVertical, isVisible, localToParent, localToParent, localToParent, localToParent, localToScreen, paintBack, paintFront, parentToLocal, parentToLocal, parentToLocal, parentToLocal, playAnimDeep, processEventAll, processEventHandlers, relayoutParent, removeBinding, removeBinding, removeEventFilter, removeEventHandler, repaint, repaint, repaint, repaintInParent, requestFocus, runDelayed, runIntervals, runLater, scrollToVisible, setActionable, setAlign, setAlignX, setAlignY, setAnimProps, setAnimString, setAnimTimeDeep, setBorder, setBorder, setBorderRadius, setBounds, setBounds, setBoundsLocal, setClip, setClipToBounds, setCursor, setDisabled, setEffect, setEnabled, setFill, setFocusable, setFocusKeysEnabled, setFocusPainted, setFocusWhenPressed, setGrowHeight, setGrowWidth, setLean, setLeanX, setLeanY, setManaged, setMargin, setMargin, setMaxHeight, setMaxSize, setMaxSize, setMaxWidth, setMinHeight, setMinSize, setMinSize, setMinWidth, setName, setOpacity, setPadding, setPadding, setPaintable, setParent, setPickable, setPrefHeight, setPrefSize, setPrefSize, setPrefWidth, setProp, setRealClassName, setRotate, setScale, setScaleX, setScaleY, setSize, setSize, setSizeLocal, setSizeToBestSize, setSizeToPrefSize, setSpacing, setText, setToolTip, setToolTipEnabled, setTransX, setTransY, setVertical, setVisible, setWidth, setX, setXY, setXYLocal, setY, stopAnimDeep, stopIntervals, toStringProps
Methods inherited from class snap.props.PropObject
addPropChangeListener, addPropChangeListener, firePropChange, firePropChange, firePropChange, getPropForName, getPropParent, getPropSet, getPropsForArchival, getPropsForArchivalExtra, getPropsString, isPropDefault, removePropChangeListener, removePropChangeListener, setPropsString, setPropValues, toString
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface snap.util.Selectable
removeItem, removeItemAndUpdateSel
-
Field Details
-
CellPadding_Prop
- See Also:
-
Editable_Prop
- See Also:
-
EditingCell_Prop
- See Also:
-
RowHeight_Prop
- See Also:
-
ShowHeader_Prop
- See Also:
-
DIVIDER_SPAN
public static final int DIVIDER_SPAN- See Also:
-
-
Constructor Details
-
TableView
public TableView()Creates a new TableView.
-
-
Method Details
-
getScrollGroup
Returns the ScrollGroup. -
getScrollView
Returns the ScrollView. -
getItemsList
Returns the items.- Specified by:
getItemsList
in interfaceSelectable<T>
-
setItemsList
Sets the items.- Specified by:
setItemsList
in interfaceSelectable<T>
-
setItems
Sets the items.- Specified by:
setItems
in interfaceSelectable<T>
-
isMultiSel
public boolean isMultiSel()Returns whether list allows multiple selections. -
setMultiSel
public void setMultiSel(boolean aValue) Sets whether list allows multiple selections. -
getSel
Returns the selection. -
setSel
Sets the table selection. -
getSel2D
Returns the selection. -
setSel2D
Sets the table selection. -
getSelIndex
public int getSelIndex()Returns the selected index.- Specified by:
getSelIndex
in interfaceSelectable<T>
-
setSelIndex
public void setSelIndex(int anIndex) Sets the selected index.- Specified by:
setSelIndex
in interfaceSelectable<T>
-
getSelRowIndex
public int getSelRowIndex()Returns the selected row. -
getSelColIndex
public int getSelColIndex()Returns the selected column. -
setSelRowColIndex
public void setSelRowColIndex(int aRow, int aCol) Returns the selected cell. -
getSelCell
Returns the selected cell. -
getSelItem
Returns the selected item.- Specified by:
getSelItem
in interfaceSelectable<T>
-
setSelItem
Sets the selected index.- Specified by:
setSelItem
in interfaceSelectable<T>
-
selectUp
public void selectUp()Selects up in the table. -
selectDown
public void selectDown()Selects down in the table. -
selectRight
public void selectRight()Selects right in the table. -
selectLeft
public void selectLeft()Selects right in the table. -
pickListPropChange
Called when PickList changes selection. -
updateItem
Tell table to update given item. -
updateItems
public void updateItems()Tell table to update visible items. -
updateItems
Tell table to update given items. -
getColCount
public int getColCount()Returns the number of columns. -
getCol
Returns the column at given index. -
getCols
Returns the column at given index. -
addCol
Adds a TableCol. -
removeCol
Remove's the TableCol at the given index from this Table's children list. -
removeCol
Removes the given TableCol from this table's children list. -
getRowCount
public int getRowCount()Returns the number of rows. -
isShowHeader
public boolean isShowHeader()Returns whether to show header. -
setShowHeader
public void setShowHeader(boolean aValue) Sets whether to show header. -
getHeaderView
Returns the HeaderView. -
isShowHeaderCol
public boolean isShowHeaderCol()Returns whether to show header. -
setShowHeaderCol
public void setShowHeaderCol(boolean aValue) Sets whether to show header. -
getHeaderCol
Returns the header col. -
isShowGridX
public boolean isShowGridX()Returns whether to show horizontal grid lines. -
setShowGridX
public void setShowGridX(boolean aValue) Sets whether to show horizontal grid lines. -
isShowGridY
public boolean isShowGridY()Returns whether to show vertical grid lines. -
setShowGridY
public void setShowGridY(boolean aValue) Sets whether to show vertical grid lines. -
getGridColor
Returns grid color. -
setGridColor
Sets grid color. -
isRowHeightSet
public boolean isRowHeightSet()Returns whether row height has been explicitly set. -
getRowHeight
public double getRowHeight()Returns the row height. -
setRowHeight
public void setRowHeight(double aValue) Sets the row height. -
getCellPadding
Returns the cell padding. -
setCellPadding
Sets the cell padding. -
getCellConfigure
Called to set method to configure cell for rendering. -
setCellConfigure
Called to set method to configure cell for rendering. -
getCell
Returns the cell at given row and col. -
getColIndexForX
public int getColIndexForX(double aX) Returns the col index for given X. -
getRowIndexForY
public int getRowIndexForY(double aY) Returns the row index for given Y. -
getColForX
Returns the column at given X coord. -
getCellForXY
Returns the cell at given Y coord. -
getPrefWidthImpl
protected double getPrefWidthImpl(double aH) Returns the preferred width.- Overrides:
getPrefWidthImpl
in classView
-
getPrefHeightImpl
protected double getPrefHeightImpl(double aW) Returns the preferred height.- Overrides:
getPrefHeightImpl
in classView
-
layoutImpl
protected void layoutImpl()Override to layout children with VBox layout.- Overrides:
layoutImpl
in classParentView
-
processEvent
Handle events.- Overrides:
processEvent
in classView
-
processEventFilters
Override to catch KeyPress (tab or enter) for TableView or cells (when editing).- Overrides:
processEventFilters
in classView
-
paintAbove
Override to paint highlight for selected cell.- Overrides:
paintAbove
in classParentView
-
getSelRectImage
A fuzzy cell border image to highlight cell. -
isEditable
public boolean isEditable()Returns whether table cells are editable. -
setEditable
public void setEditable(boolean aValue) Sets whether table cells are editable. -
getEditingCell
Returns the cell currently editing. -
setEditingCell
Sets the cell currently editing. -
editCell
Called to edit given cell. -
editCellStop
public void editCellStop()Called to stop editing a cell. -
cellEditingChanged
Called when cell editing starts. -
setHeight
public void setHeight(double aValue) Override to reset cells. -
getFocusNext
Override to forward to table.- Overrides:
getFocusNext
in classView
-
getFocusPrev
Override to forward to table.- Overrides:
getFocusPrev
in classView
-
setFocused
protected void setFocused(boolean aValue) Override to clear focus image.- Overrides:
setFocused
in classView
-
getValuePropName
Returns a mapped property name.- Overrides:
getValuePropName
in classView
-
getDefaultBorder
Returns the default border.- Overrides:
getDefaultBorder
in classView
-
toXMLView
XML archival.- Overrides:
toXMLView
in classParentView
-
fromXMLView
XML unarchival.- Overrides:
fromXMLView
in classParentView
-
toXMLChildren
XML archival of children.- Overrides:
toXMLChildren
in classParentView
-
fromXMLChildren
XML unarchival for shape children.- Overrides:
fromXMLChildren
in classParentView
-