Package com.storedobject.ui
Class ObjectTable<T extends StoredObject>
java.lang.Object
com.vaadin.flow.component.Component
com.vaadin.flow.component.HtmlComponent
org.vaadin.stefan.table.Table
com.storedobject.ui.ObjectTable<T>
- Type Parameters:
T
- Type of the data object.
- All Implemented Interfaces:
FilterMethods<T>
,ObjectLoader<T>
,com.vaadin.flow.component.AttachNotifier
,com.vaadin.flow.component.DetachNotifier
,com.vaadin.flow.component.HasElement
,com.vaadin.flow.component.HasSize
,com.vaadin.flow.component.HasStyle
,Serializable
,org.vaadin.stefan.table.TableRowContainer
public class ObjectTable<T extends StoredObject>
extends org.vaadin.stefan.table.Table
implements ObjectLoader<T>
ObjectTable is similar to
ObjectGrid
but instead of the Grid
, it
uses Table
to render the rows.
Note: Please note that ObjectTable
is not a View
but is a
Component
. So, you set it as a Component
to a View
like View.setComponent(Component)
.
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionObjectTable
(Class<T> objectClass) Constructor.ObjectTable
(Class<T> objectClass, boolean any) Constructor.ObjectTable
(Class<T> objectClass, Iterable<String> columns) Constructor.ObjectTable
(Class<T> objectClass, Iterable<String> columns, boolean any) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionprotected void
This method is invoked just before adding an object-row.void
This method is called whenever a filter predicate is changed.void
clear()
Clear - remove all entries.protected void
customizeCell
(String columnName, T object, org.vaadin.stefan.table.TableDataCell cell) This method is invoked to customize the currently added cell.protected String
customizeCellValue
(String columnName, T object, String cellValue) This method is invoked to get the customized value for a cell.protected void
customizeHeaderCell
(String columnName, org.vaadin.stefan.table.TableHeaderCell cell) This method is invoked to customize the header cell.getColumnCaption
(String columnName) Get the caption for the column.final int
Get column count.getColumnFunction
(String columnName) Get the function to obtain the cell value for the column.Get the load filter.Get the object class.final int
Get the row-count.void
load
(ObjectIterator<T> objectIterator) Load the given instances.protected void
This method is invoked just after an object-row is added.final int
size()
Get the number of object instances rendered.Methods inherited from class org.vaadin.stefan.table.Table
addBodies, addBody, addRow, addRows, addRows, getBodies, getBody, getBody, getCaption, getColumnGroup, getFoot, getHead, insertRow, insertRows, removeAllRows, removeBodies, removeBody, removeBody, removeCaption, removeColumnGroup, removeFoot, removeHead, removeRow, removeRows, replaceRow, setRow, streamRows
Methods inherited from class com.vaadin.flow.component.HtmlComponent
getTitle, setTitle
Methods inherited from class com.vaadin.flow.component.Component
addListener, findAncestor, fireEvent, from, get, getChildren, getElement, getEventBus, getId, getListeners, getLocale, getParent, getTranslation, getTranslation, getTranslation, getTranslation, getTranslation, getTranslation, getUI, hasListener, isAttached, isTemplateMapped, isVisible, onAttach, onDetach, onEnabledStateChanged, removeFromParent, scrollIntoView, scrollIntoView, set, setElement, setId, setVisible
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.vaadin.flow.component.AttachNotifier
addAttachListener
Methods inherited from interface com.vaadin.flow.component.DetachNotifier
addDetachListener
Methods inherited from interface com.storedobject.core.FilterMethods
getEffectiveCondition, getFilterCondition, setFilter, setFilter, setFilter, setFilter, setFilter, setFilter, setLoadFilter, setLoadFilter, setViewFilter, setViewFilter
Methods inherited from interface com.vaadin.flow.component.HasElement
getElement
Methods inherited from interface com.vaadin.flow.component.HasSize
getHeight, getHeightUnit, getMaxHeight, getMaxWidth, getMinHeight, getMinWidth, getWidth, getWidthUnit, setHeight, setHeight, setHeightFull, setMaxHeight, setMaxHeight, setMaxWidth, setMaxWidth, setMinHeight, setMinHeight, setMinWidth, setMinWidth, setSizeFull, setSizeUndefined, setWidth, setWidth, setWidthFull
Methods inherited from interface com.vaadin.flow.component.HasStyle
addClassName, addClassNames, getClassName, getClassNames, getStyle, hasClassName, removeClassName, removeClassNames, setClassName, setClassName
Methods inherited from interface com.storedobject.core.ObjectLoader
applyFilter, canContain, getAllowAny, getLinkType, getMaster, getOrderBy, isAllowAny, load, load, load, load, load, load, load, load, load, load, load, load, load, load, load, load, load, load, load, load, load, load, reload, setLinkType, setLinkType, setMaster, setMaster, setOrderBy, setOrderBy
Methods inherited from interface org.vaadin.stefan.table.TableRowContainer
getChildren, getRow, getRows
-
Constructor Details
-
ObjectTable
-
ObjectTable
-
ObjectTable
-
ObjectTable
-
-
Method Details
-
getColumnCaption
-
getObjectClass
Get the object class.- Specified by:
getObjectClass
in interfaceObjectLoader<T extends StoredObject>
- Returns:
- Object class.
-
getColumnFunction
-
getColumnCount
public final int getColumnCount()Get column count.- Returns:
- Colum count.
-
size
public final int size()Get the number of object instances rendered. The actual row-count may be different if extra rows are inserted. To get the actual row-count you may usegetRowCount()
.- Specified by:
size
in interfaceObjectLoader<T extends StoredObject>
- Returns:
- Count of the object instances currently rendered.
-
getRowCount
public final int getRowCount()Get the row-count.- Returns:
- Number of rows.
-
clear
public void clear()Description copied from interface:ObjectLoader
Clear - remove all entries.- Specified by:
clear
in interfaceObjectLoader<T extends StoredObject>
-
load
Description copied from interface:ObjectLoader
Load the given instances. Current "load filter" if set will be applied. However,ObjectLoader.getOrderBy()
result will be ignored. Also, the value returned byObjectLoader.getAllowAny()
will determine whether instanced of the subclasses to be restricted or not.- Specified by:
load
in interfaceObjectLoader<T extends StoredObject>
- Parameters:
objectIterator
- Objects to be loaded.
-
applyFilterPredicate
public void applyFilterPredicate()Description copied from interface:FilterMethods
This method is called whenever a filter predicate is changed. Methods with default implementation already invoke this method. If any of those methods are overridden, make sure that it invokes this method so that logic to handle filter changes can be coded here.Note: This method is used to show the filtered result of the existing entries
- Specified by:
applyFilterPredicate
in interfaceFilterMethods<T extends StoredObject>
-
getLoadFilter
Description copied from interface:FilterMethods
Get the load filter.- Specified by:
getLoadFilter
in interfaceFilterMethods<T extends StoredObject>
- Returns:
- Current load filter.
-
addingRow
This method is invoked just before adding an object-row.- Parameters:
object
- Object to add.
-
rowAdded
This method is invoked just after an object-row is added.- Parameters:
object
- Object added.
-
customizeCellValue
-
customizeCell
-
customizeHeaderCell
This method is invoked to customize the header cell.- Parameters:
columnName
- Column name.cell
- Header cell that is currently added.
-