public class WGrid extends FormComponent implements IVaadinContainerDataSourceAdapter.FilterConfigProvider
Modifier and Type | Class and Description |
---|---|
protected class |
WGrid.ColumnResizeListenerImpl
A table column resize listener which delegates the resize event to the
wrapped closure.
|
protected class |
WGrid.RowStyleGeneratorImpl |
static class |
WGrid.WRendererClickListener
Clickable renderer listener.
|
form, INTERNAL_STATE_RECORD_PROPERTY
EMPTY
Constructor and Description |
---|
WGrid() |
Modifier and Type | Method and Description |
---|---|
void |
addColumn(RecordHolder gridColumn)
Registers a new column.
|
void |
clearCellErrors()
Clears any potential cell errors.
|
EnumerationImpl |
columnGetAlignment(RecordHolder column)
Gets the column alignment
|
Decimal |
columnGetExpandRatio(RecordHolder column)
Gets the expand ratio of a grid column.
|
RecordHolder |
columnGetFilterConfig(RecordHolder column)
Gets the filter configuration of a given column.
|
String |
columnGetHeader(RecordHolder column)
Gets the grid column header.
|
EnumerationImpl |
columnGetHeaderAlignment(RecordHolder column)
Gets the column header text alignment.
|
String |
columnGetHeaderStyleName(RecordHolder column)
Gets the column header style name
|
boolean |
columnGetHidable(RecordHolder column)
Gets the column's hidable flag.
|
String |
columnGetHidingToggleCaption(RecordHolder column)
Gets the grid column's hiding toggle caption.
|
Decimal |
columnGetMaximumWidth(RecordHolder column)
Gets a maximum width of a column.
|
Decimal |
columnGetMinimumWidth(RecordHolder column)
Gets the column's minimum width in pixels.
|
Decimal |
columnGetWidth(RecordHolder column)
Gets the grid column's width.
|
boolean |
columnIsFiltrable(RecordHolder column)
Gets the filterable flag of a grid column.
|
boolean |
columnIsHidden(RecordHolder column)
Gets the column's hidden flag.
|
boolean |
columnIsResizable(RecordHolder column)
Gets the value of the resizable flag of a grid column.
|
void |
columnRemove(RecordHolder gridColumn)
Removes the column from the grid.
|
void |
columnSetAlignment(RecordHolder column,
EnumerationImpl alignment)
Sets the column alignment.
|
void |
columnSetExpandRatio(RecordHolder column,
Decimal expandRatio)
Sets expand ratio to a grid column.
|
void |
columnSetFilterConfig(RecordHolder column,
RecordHolder filterConfig)
Sets a filter configuration to a given column.
|
void |
columnSetFiltrable(RecordHolder column,
boolean filtrable)
Sets the filterable flag to a grid column.
|
void |
columnSetHeader(RecordHolder column,
String header)
Sets the grid column header.
|
void |
columnSetHeaderAlignment(RecordHolder column,
EnumerationImpl alignment)
Sets the column header alignment
|
void |
columnSetHeaderStyleName(RecordHolder column,
String styleName) |
void |
columnSetHidable(RecordHolder column,
boolean hidable)
Set's the columns hidable flag.
|
void |
columnSetHidden(RecordHolder column,
boolean hidden)
Sets the column's hidden flag.
|
void |
columnSetHidingToggleCaption(RecordHolder column,
String hidingToggleCaption)
Sets the gird column's hiding toggle caption
|
void |
columnSetMaximumWidth(RecordHolder column,
Decimal pixels)
Sets a maximum width to a grid column.
|
void |
columnSetMinimumWidth(RecordHolder column,
Decimal pixels)
Sets a grid columns minimum width.
|
void |
columnSetResizable(RecordHolder column,
boolean resizable)
Sets the resizable flag of the grid column.
|
void |
columnSetWidth(RecordHolder column,
Decimal pixelWidth)
Sets the width of a grid column.
|
protected com.vaadin.ui.Grid |
createWidget()
Called once, to create the actual Vaadin component.
|
ListHolder |
getColumns()
Gets a list of column definitions of this grid.
|
RecordHolder |
getDataSource()
Gets the definition of the currently used data source.
|
Object |
getFilterId(Object propertyId)
Returns filter id which will be assigned to filters on this property.
|
Decimal |
getFrozenColumnCount()
Gets the number of frozen columns of this grid.
|
Decimal |
getHeightByRows()
Gets the amount of rows in the grid body that are shown if the height mode is ROW.
|
Object |
getRowObjectForItemId(Serializable itemId)
Returns the row object for given row ID.
|
ListHolder |
getSelection()
Gets list of row objects of the selected rows.
|
ClosureHolder |
getSelectionChangeListener()
Gets the the current selection change listener.
|
EnumerationImpl |
getSelectionMode() |
com.vaadin.ui.Grid |
getWidget()
Gets the Vaadin representation of this component.
|
boolean |
isSelectable()
Indicates if the rows in the grids are selectable.
|
void |
preventGC(Set<ValueHolder> set)
Override for all components which are actively using some record holders, not directly linked to the model.
|
void |
refresh()
Refreshes the content.
|
protected void |
restoreInternalState(Map<String,Object> state)
Restores the UI state of this component which was previously written
by
FormComponent.writeInternalState(Map) . |
void |
select(CollectionHolder rowObjects)
Changes grid selection.
|
void |
setColumnResizeListener(ClosureHolder listener)
Sets a column resize listener to this grid.
|
void |
setDataSource(RecordHolder ds)
Sets the data source to this grid.
|
void |
setEditorBuffered(Boolean editorBuffered)
Sets the editor buffered support.
|
void |
setEditorEnabled(Boolean enabled)
Sets the editor support enabled flag.
|
void |
setFrozenColumnCount(Decimal numberOfColumns)
Sets the number of frozen columns of this grid.
|
void |
setHeightByRows(Decimal heightByRows)
Sets the amount of rows in teh grid body that are shown.
|
void |
setRowStyleGenerator(ClosureHolder styleGenerator)
Sets the style generator that is used for generating styles for rows.
|
void |
setSelectable(boolean selectable)
Deprecated.
|
void |
setSelectionChangeListener(ClosureHolder listener)
Sets the selection change listener.
|
void |
setSelectionMode(EnumerationImpl selectionMode)
Sets selection mode.
|
List<ConstraintViolation> |
showCellErrors(Collection<ConstraintViolation> constraintViolations)
Shows cell errors in cells displaying value of a record property
equivalent with the constraint violation record property.
|
protected void |
writeInternalState(Map<String,Object> state)
Writes the UI state of this component to the provided map.
|
addDataErrorMessage, addStyleName, attach, call, clearDataErrorMessages, createEvent, equals, getCaption, getComponentAlignment, getContextClickHandler, getCustomErrorMessage, getDataErrorMessages, getDescription, getExpandRatio, getHasChildrenAdapter, 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 com.vaadin.ui.Grid createWidget()
FormComponent
createWidget
in class FormComponent
public RecordHolder getDataSource()
null
if the currently
used data source is not backed by forms::DataSource
.public void setDataSource(RecordHolder ds)
ds
- a record of type forms::DataSource
representing the data source.public void refresh()
public void addColumn(RecordHolder gridColumn)
gridColumn
- forms::GridColumnpublic void columnRemove(RecordHolder gridColumn)
gridColumn
- the grid to removepublic Object getFilterId(Object propertyId)
IVaadinContainerDataSourceAdapter.FilterConfigProvider
getFilterId
in interface IVaadinContainerDataSourceAdapter.FilterConfigProvider
public Object getRowObjectForItemId(Serializable itemId)
itemId
- Vaadin itemId
.public com.vaadin.ui.Grid getWidget()
FormComponent
getWidget
in class FormComponent
public void setFrozenColumnCount(Decimal numberOfColumns)
numberOfColumns
- public Decimal getFrozenColumnCount()
public void columnSetFiltrable(RecordHolder column, boolean filtrable)
column
- the column definition which identifies the grid columnfiltrable
- public boolean columnIsFiltrable(RecordHolder column)
column
- the column definition which identifies the grid columnpublic void columnSetFilterConfig(RecordHolder column, RecordHolder filterConfig)
column
- the columnfilterConfig
- the filter configurationpublic RecordHolder columnGetFilterConfig(RecordHolder column)
column
- the columnnull
if the column has no filter configurationpublic void columnSetHeader(RecordHolder column, String header)
column
- the column definition which identifies the grid columnheader
- public String columnGetHeader(RecordHolder column)
column
- the column definition which identifies the grid columnpublic String columnGetHidingToggleCaption(RecordHolder column)
column
- the column definition which identifies the grid columnpublic void columnSetHidingToggleCaption(RecordHolder column, String hidingToggleCaption)
column
- the column definition which identifies the grid columnhidingToggleCaption
- the caption to setpublic Decimal columnGetWidth(RecordHolder column)
column
- the column definition which identifies the grid columnpublic void columnSetWidth(RecordHolder column, Decimal pixelWidth)
column
- the column definition which identifies the grid columnpixelWidth
- the width in pixelspublic void columnSetExpandRatio(RecordHolder column, Decimal expandRatio)
column
- the column definition which identifies the grid columnexpandRatio
- the expand ratio to set (integral value)public Decimal columnGetExpandRatio(RecordHolder column)
column
- the column definition which identifies the grid columnpublic void columnSetMinimumWidth(RecordHolder column, Decimal pixels)
column
- the column definition which identifies the grid columnpixels
- the width in pixelspublic Decimal columnGetMinimumWidth(RecordHolder column)
column
- the column definition which identifies the grid columnpublic void columnSetMaximumWidth(RecordHolder column, Decimal pixels)
column
- the column definition which identifies the grid columnpixels
- the maximum width in pixels (integral value)public Decimal columnGetMaximumWidth(RecordHolder column)
column
- the column definition which identifies the grid column@param columnpublic void columnSetHidden(RecordHolder column, boolean hidden)
column
- the column definition which identifies the grid columnhidden
- public boolean columnIsHidden(RecordHolder column)
column
- the column definition which identifies the grid columnpublic void columnSetHidable(RecordHolder column, boolean hidable)
column
- the column definition which identifies the grid columnhidable
- public boolean columnGetHidable(RecordHolder column)
column
- the column definition which identifies the grid columnpublic void columnSetResizable(RecordHolder column, boolean resizable)
column
- the column definition which identifies the grid column@param columnresizable
- public boolean columnIsResizable(RecordHolder column)
column
- the column definition which identifies the grid columnpublic ListHolder getColumns()
public EnumerationImpl columnGetAlignment(RecordHolder column)
column
- the column definition which identifies the grid columnpublic void columnSetAlignment(RecordHolder column, EnumerationImpl alignment)
column
- the column definition which identifies the grid columnalignment
- public EnumerationImpl columnGetHeaderAlignment(RecordHolder column)
column
- the column definition which identifies the grid columnpublic void columnSetHeaderAlignment(RecordHolder column, EnumerationImpl alignment)
column
- the column definition which identifies the grid columnalignment
- the alignmentpublic String columnGetHeaderStyleName(RecordHolder column)
column
- the column definition which identifies the grid columnpublic void columnSetHeaderStyleName(RecordHolder column, String styleName)
column
- the column definition which identifies the grid columnstyleName
- public void setEditorEnabled(Boolean enabled)
enabled
- true
to enable the grid editor supportpublic void setEditorBuffered(Boolean editorBuffered)
editorBuffered
- @Deprecated public void setSelectable(boolean selectable)
selectable
- public void setSelectionMode(EnumerationImpl selectionMode)
selectionMode
- to be setpublic EnumerationImpl getSelectionMode()
public boolean isSelectable()
true
if the grid's row are selectable.public void select(CollectionHolder rowObjects)
rowObjects
argument is non-empty, only one row is selected.rowObjects
argument is non-empty, all objects in it are selected.rowObjects
- new selectionpublic ListHolder getSelection()
public void setSelectionChangeListener(ClosureHolder listener)
listener
- the listener to setpublic ClosureHolder getSelectionChangeListener()
null
if none is installed.public Decimal getHeightByRows()
0
if the grid is not in the ROW height mode.public void setHeightByRows(Decimal heightByRows)
heightByRows
- public List<ConstraintViolation> showCellErrors(Collection<ConstraintViolation> constraintViolations)
constraintViolations
- public void clearCellErrors()
public void setColumnResizeListener(ClosureHolder listener)
listener
- public void setRowStyleGenerator(ClosureHolder styleGenerator)
styleGenerator
- the row style generator to set, or null
to remove
a previously set generatorpublic 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 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)
Copyright © 2007-2018 Whitestein Technologies. All Rights Reserved.