public abstract class WAbstractTable extends FormComponent implements IVaadinContainerDataSourceAdapter.FilterConfigProvider
Modifier and Type | Class and Description |
---|---|
protected class |
WAbstractTable.Column
A table column representation.
|
protected class |
WAbstractTable.ColumnResizeListenerImpl
A table column resize listener which delegates the resize event to the
wrapped closure.
|
protected class |
WAbstractTable.ValueChangeListenerImpl |
form, INTERNAL_STATE_RECORD_PROPERTY
EMPTY
Constructor and Description |
---|
WAbstractTable() |
Modifier and Type | Method and Description |
---|---|
abstract void |
addColumn(RecordHolder column)
Adds a column to this table.
|
protected void |
addColumn(WAbstractTable.Column column) |
EnumerationImpl |
columnGetAlignment(RecordHolder column)
Gets table column content alignment.
|
Decimal |
columnGetExpandRatio(RecordHolder column)
Gets expand ratio of a table column.
|
String |
columnGetHeader(RecordHolder column)
Gets the column header.
|
EnumerationImpl |
columnGetHeaderAlignmnet(RecordHolder column)
Gets a table column's header alignment.
|
String |
columnGetHeaderStyleName(RecordHolder column)
Gets a column's header style name.
|
Decimal |
columnGetWidth(RecordHolder column)
Gets table column width.
|
boolean |
columnIsCollapsed(RecordHolder column)
Returns the collapsed state of a table column.
|
boolean |
columnIsCollapsible(RecordHolder column)
Gets value of the collapsible flag of a table column.
|
void |
columnSetAlignment(RecordHolder column,
EnumerationImpl alignment)
Sets table column content alignment.
|
void |
columnSetCollapsed(RecordHolder column,
boolean collapsed)
Sets the collapsed state of a table column.
|
void |
columnSetCollapsible(RecordHolder column,
boolean collapsible)
Sets the collapsible flag for a table column.
|
void |
columnSetExpandRatio(RecordHolder column,
Decimal expandRatio)
Sets expand ratio to a table column.
|
void |
columnSetHeader(RecordHolder column,
String header)
Sets a header caption to the table column.
|
void |
columnSetHeaderAlignment(RecordHolder column,
EnumerationImpl alignment)
Sets a table column's header alignment
|
void |
columnSetHeaderStyleName(RecordHolder column,
String styleName)
Sets a column's header style name.
|
void |
columnSetWidth(RecordHolder column,
Decimal width)
Sets table column width.
|
protected WAbstractTable.Column |
getColumn(RecordHolder gridColumn) |
protected WAbstractTable.Column |
getColumn(Variant.RecordVariant propertyId)
Gets the table column for the given property.
|
ListHolder |
getColumns()
Gets a list of table columns.
|
Decimal |
getComponentCount()
Returns the number of contained components in this table.
|
ListHolder |
getComponents()
Gets a list of components contained by this table.
|
Object |
getFilterId(Object propertyId)
Returns filter id which will be assigned to filters on this column.
|
Type |
getFilterValueType(Object propertyId)
Returns the expected value type which will be present to the filter.
|
IHasChildren |
getHasChildrenAdapter()
Provides an adapter of this component which allows easily invoke methods on
the
forms::HasChildren interface. |
Decimal |
getPageLength()
Gets the current page length.
|
abstract Object |
getSelection()
Gets the current selection.
|
protected Collection<WAbstractTable.Column> |
getTableColumns() |
protected List<com.whitestein.lsps.vaadin.forms.TableColumnState> |
getTableColumnStates() |
Type |
getValueType(Object propertyId)
Returns the expected value type which will be present in this column.
|
com.vaadin.ui.CustomTable |
getWidget()
Gets the Vaadin representation of this component.
|
boolean |
isColumnCollapsingAllowed()
Checks if column collapsing is allowed.
|
boolean |
isColumnReorderingAllowed()
Checks if column reordering is allowed.
|
boolean |
isFilteringEnabled()
Checks whether the filtering is enabled on this table.
|
protected boolean |
isSafeToSetDefaultFilterValues(com.vaadin.ui.CustomTable table) |
boolean |
isSelectable()
Getter for property selectable.
|
protected void |
onResetFilters(com.vaadin.ui.CustomTable table) |
void |
preventGC(Set<ValueHolder> set)
Override for all components which are actively using some record holders, not directly linked to the model.
|
abstract void |
refresh()
Refreshes the content.
|
protected void |
resetFilters() |
protected void |
restoreColumnState(RecordHolder column,
com.whitestein.lsps.vaadin.forms.TableColumnState state)
Restores column state.
|
protected void |
restoreInternalState(Map<String,Object> state)
Restores the UI state of this component which was previously written
by
FormComponent.writeInternalState(Map) . |
abstract void |
select(Object rowObject)
Selects the given row.
|
void |
setColumnCollapsingAllowed(boolean collapsingAllowed)
Sets whether column collapsing is allowed or not.
|
void |
setColumnReorderingAllowed(boolean columnReorderingAllowed)
Sets whether column reordering is allowed or not.
|
void |
setColumnResizeListener(ClosureHolder listener)
Sets a column resize listener to this table.
|
void |
setFilteringEnabled(boolean enabled)
Enables/disables the filtering functionality of the table.
|
void |
setPageLength(Decimal pageLength)
Sets the current page length.
|
void |
setSelectable(boolean selectable)
Setter for property selectable.
|
void |
setSelectionChangeListener(ClosureHolder onChange)
Sets a listener for the seletion changes.
|
protected void |
setWidgetPageLength(com.vaadin.ui.CustomTable table,
int pageLength)
Sets the table page length.
|
protected void |
updateFilterFieldVisibilities()
resetFilters() clears the filter field visibility...
|
protected void |
writeInternalState(Map<String,Object> state)
Writes the UI state of this component to the provided map.
|
addDataErrorMessage, addStyleName, attach, call, clearDataErrorMessages, createEvent, createWidget, equals, getCaption, getComponentAlignment, getContextClickHandler, getCustomErrorMessage, getDataErrorMessages, getDescription, getExpandRatio, getHeight, getIcon, getModelingId, getNamespace, getStyleName, getTabIndex, getWidth, hashCode, isEnabled, isReadOnly, isVisible, localize, markAsDirty, removeStyleName, restoreState, saveState, setCaption, setComponentAlignment, setContextClickHandler, setContextMenuItems, setCustomErrorMessage, setDescription, setEnabled, setExpandRatio, setHeight, setIcon, setReadOnly, setStyleName, setTabIndex, setVisible, setWidth, toString
protected final Collection<WAbstractTable.Column> getTableColumns()
public Type getValueType(Object propertyId)
propertyId
- the column id, not null.public Object getFilterId(Object propertyId)
getFilterId
in interface IVaadinContainerDataSourceAdapter.FilterConfigProvider
public Type getFilterValueType(Object propertyId)
propertyId
- the column id, not null.protected final WAbstractTable.Column getColumn(RecordHolder gridColumn)
protected final WAbstractTable.Column getColumn(Variant.RecordVariant propertyId)
propertyId
- the property identifierpublic abstract void addColumn(RecordHolder column)
column
- the column to add, not null.protected final void addColumn(WAbstractTable.Column column)
public com.vaadin.ui.CustomTable getWidget()
FormComponent
getWidget
in class FormComponent
public ListHolder getColumns()
public void columnSetHeader(RecordHolder column, String header)
column
- the column definition which identifies the table columnheader
- the caption to setpublic String columnGetHeader(RecordHolder column)
column
- the column definition which identifies the table columnpublic void columnSetHeaderAlignment(RecordHolder column, EnumerationImpl alignment)
column
- the column definition which identifies the table columnalignment
- public EnumerationImpl columnGetHeaderAlignmnet(RecordHolder column)
column
- the column definition which identifies the table columnpublic void columnSetAlignment(RecordHolder column, EnumerationImpl alignment)
column
- the column definition which identifies the table columnalignment
- public EnumerationImpl columnGetAlignment(RecordHolder column)
column
- the column definition which identifies the table columnpublic void columnSetHeaderStyleName(RecordHolder column, String styleName)
column
- the column definition which identifies the table columnstyleName
- public String columnGetHeaderStyleName(RecordHolder column)
column
- the column definition which identifies the table columnpublic void columnSetCollapsed(RecordHolder column, boolean collapsed)
column
- the column definition which identifies the table columncollapsed
- public boolean columnIsCollapsed(RecordHolder column)
column
- the column definition which identifies the table columnpublic void columnSetCollapsible(RecordHolder column, boolean collapsible)
column
- the column definition which identifies the table columncollapsible
- public boolean columnIsCollapsible(RecordHolder column)
column
- the column definition which identifies the table columnpublic void columnSetWidth(RecordHolder column, Decimal width)
column
- the column definition which identifies the table columnwidth
- public Decimal columnGetWidth(RecordHolder column)
column
- the column definition which identifies the table columnpublic void columnSetExpandRatio(RecordHolder column, Decimal expandRatio)
column
- the column definition which identifies the table columnexpandRatio
- public Decimal columnGetExpandRatio(RecordHolder column)
column
- the column definition which identifies the table columnpublic abstract Object getSelection()
null
if there is no selection.public void setSelectionChangeListener(ClosureHolder onChange)
onChange
- public Decimal getPageLength()
public void setPageLength(Decimal pageLength)
pageLength
- protected void setWidgetPageLength(com.vaadin.ui.CustomTable table, int pageLength)
table
- - widget to be modifiedpageLength
- - page lengthprotected void resetFilters()
protected void updateFilterFieldVisibilities()
public void setFilteringEnabled(boolean enabled)
enabled
- public boolean isFilteringEnabled()
true
if the filtering is enabled.protected boolean isSafeToSetDefaultFilterValues(com.vaadin.ui.CustomTable table)
protected void onResetFilters(com.vaadin.ui.CustomTable table)
table
- public void setColumnResizeListener(ClosureHolder listener)
listener
- public Decimal getComponentCount()
null
public ListHolder getComponents()
public IHasChildren getHasChildrenAdapter()
FormComponent
forms::HasChildren
interface. If this component does not implement the interface then
and adapter returning no children is returned.getHasChildrenAdapter
in class FormComponent
IHasChildren
interface, never null
.public void preventGC(Set<ValueHolder> set)
FormComponent
WTabSheet
maintains a set of opened tabs. These tab records are not referenced
directly from forms::TabSheet and will therefore be garbage-collected. We however need those records to not to be GCed as the user
may ask for them simply by calling getTab(Integer).
Please note that the component definition records (e.g. forms::Button) are already GC-protected and they do not need to be added to this set.
Also, any child components currently attached to the UI are automatically protected and are not required to be registered in the set.preventGC
in class FormComponent
set
- a set of records which are to be GC-prevented, never null. The component should add any records here.
Default implementation does nothing.protected List<com.whitestein.lsps.vaadin.forms.TableColumnState> getTableColumnStates()
protected void restoreColumnState(RecordHolder column, com.whitestein.lsps.vaadin.forms.TableColumnState state)
column
- forms::TableColumn
state
- the state to be restoredprotected void writeInternalState(Map<String,Object> state)
FormComponent
Many UI attributes such as size, caption, etc. are not held in the records but are stored exclusively in the Vaadin components. In the records the getter/setter methods of such attributes directly delegate to the underlying component. For the purposes of the Save Document/Todo use case the state of such attributes has to be preserved.
Subclasses should override this method. The overriding method should call
super.writeInternalState(state)
to store the state form the super
class as well. The attributes should be written to the provided state
parameter. The type of the values written to the state
can only by
Java representation of LSPS types. That is java.util.Date
,
java.lang.String
, Decimal
, RecordHolder
,
ListHolder
, ... The name of the attributes stored in the map
should be unique and should not collide with the names used by any
of the superclass. It is the responsibility of the overridden method to ensure
that.
Subclasses overriding this method should also override
FormComponent.restoreInternalState(Map)
and restore the state written
by this method.
writeInternalState
in class FormComponent
state
- a map to which this method should write the component's UI state.FormComponent.restoreInternalState(Map)
,
FormComponent.saveState()
protected void restoreInternalState(Map<String,Object> state)
FormComponent
FormComponent.writeInternalState(Map)
.
Subclasses should override and call super.restoreInternalState(state);
restoreInternalState
in class FormComponent
state
- a map of attributes and their valuesFormComponent.writeInternalState(Map)
public boolean isColumnCollapsingAllowed()
public void setColumnCollapsingAllowed(boolean collapsingAllowed)
collapsingAllowed
- specifies whether column collapsing is allowed.public boolean isColumnReorderingAllowed()
public void setColumnReorderingAllowed(boolean columnReorderingAllowed)
columnReorderingAllowed
- specifies whether column reordering is allowed.public boolean isSelectable()
The table is not selectable by default.
public void setSelectable(boolean selectable)
The table is not selectable by default.
selectable
- the New value of property selectable.public abstract void refresh()
public abstract void select(Object rowObject)
rowObject
- the row object which identifies the table rowCopyright © 2007-2018 Whitestein Technologies. All Rights Reserved.