Class EditablePropertyColumn<M,I,P,S>
- java.lang.Object
-
- com.inmethod.grid.column.AbstractColumn<M,I,S>
-
- com.inmethod.grid.column.AbstractLightWeightColumn<M,I,S>
-
- com.inmethod.grid.column.PropertyColumn<M,I,P,S>
-
- com.inmethod.grid.column.editable.EditablePropertyColumn<M,I,P,S>
-
- All Implemented Interfaces:
IGridColumn<M,I,S>
,Serializable
,IDetachable
,IClusterable
- Direct Known Subclasses:
DropDownChoiceColumn
,EditableCheckBoxColumn
,EditableLocalDateColumn
public class EditablePropertyColumn<M,I,P,S> extends PropertyColumn<M,I,P,S>
Property column that uses aTextFieldPanel
as cell component when the item is selected.- Author:
- Matej Knopp
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description EditablePropertyColumn(String columnId, IModel<String> headerModel, String propertyExpression)
Constructor.EditablePropertyColumn(String columnId, IModel<String> headerModel, String propertyExpression, S sortProperty)
Constructor.EditablePropertyColumn(IModel<String> headerModel, String propertyExpression)
Constructor.EditablePropertyColumn(IModel<String> headerModel, String propertyExpression, S sortProperty)
Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
addValidators(FormComponent<P> component)
boolean
cellClicked(IModel<I> rowModel)
Allows to override default behavior when a row is clicked.String
getCellCssClass(IModel<I> rowModel, int rowNum)
Returns the cell specified by rowModel.protected IModel<P>
getFieldModel(IModel<I> rowModel)
protected boolean
isClickToEdit()
boolean
isLightWeight(IModel<I> rowModel)
Returns whether this column is uses a component for cell in given row (not lightweight) or anIRenderable
implementation.Component
newCell(WebMarkupContainer parent, String componentId, IModel<I> rowModel)
Creates a new cell component.protected EditableCellPanel<M,I,P,S>
newCellPanel(String componentId, IModel<I> rowModel, IModel<P> cellModel)
-
Methods inherited from class com.inmethod.grid.column.PropertyColumn
convertToString, getConverter, getLocale, getModelObject, getProperty, getPropertyExpression, isEscapeMarkup, newCell, setEscapeMarkup
-
Methods inherited from class com.inmethod.grid.column.AbstractColumn
detach, getColSpan, getGrid, getHeaderCssClass, getHeaderModel, getHeaderTooltipModel, getId, getInitialSize, getMaxSize, getMinSize, getSizeUnit, getSortProperty, getWrapText, isReorderable, isResizable, newHeader, setGrid, setHeaderTooltipModel, setInitialSize, setMaxSize, setMinSize, setReorderable, setResizable, setSizeUnit, setWrapText
-
-
-
-
Constructor Detail
-
EditablePropertyColumn
public EditablePropertyColumn(String columnId, IModel<String> headerModel, String propertyExpression, S sortProperty)
Constructor.- Parameters:
columnId
- column identified (must be unique within the grid)headerModel
- model for column headerpropertyExpression
- property expression used to get the displayed value for row objectsortProperty
- optional string that will be returned byISortState
to indicate that the column is being sorted
-
EditablePropertyColumn
public EditablePropertyColumn(String columnId, IModel<String> headerModel, String propertyExpression)
Constructor.- Parameters:
columnId
- column identified (must be unique within the grid)headerModel
- model for column headerpropertyExpression
- property expression used to get the displayed value for row object
-
EditablePropertyColumn
public EditablePropertyColumn(IModel<String> headerModel, String propertyExpression, S sortProperty)
Constructor. The column id is omitted in this constructor, because the property expression is used as column id.- Parameters:
headerModel
- model for column headerpropertyExpression
- property expression used to get the displayed value for row objectsortProperty
- optional string that will be returned byISortState
to indicate that the column is being sorted
-
EditablePropertyColumn
public EditablePropertyColumn(IModel<String> headerModel, String propertyExpression)
Constructor. The column id is omitted in this constructor, because the property expression is used as column id.- Parameters:
headerModel
- model for column headerpropertyExpression
- property expression used to get the displayed value for row object
-
-
Method Detail
-
isLightWeight
public boolean isLightWeight(IModel<I> rowModel)
Returns whether this column is uses a component for cell in given row (not lightweight) or anIRenderable
implementation. Generally, if the cell is non-interactive (label only), it's better to use anIRenderable
implementation, as it has zero memory footprint- Specified by:
isLightWeight
in interfaceIGridColumn<M,I,P>
- Overrides:
isLightWeight
in classAbstractLightWeightColumn<M,I,S>
- Parameters:
rowModel
- model for given row- Returns:
true
if the cell is lightweight,false
otherwise
-
newCellPanel
protected EditableCellPanel<M,I,P,S> newCellPanel(String componentId, IModel<I> rowModel, IModel<P> cellModel)
-
newCell
public Component newCell(WebMarkupContainer parent, String componentId, IModel<I> rowModel)
Creates a new cell component. This method is called for rows that are not lightweight (IGridColumn.isLightWeight(IModel)
returns false ).- Specified by:
newCell
in interfaceIGridColumn<M,I,P>
- Overrides:
newCell
in classAbstractLightWeightColumn<M,I,S>
- Parameters:
parent
- Parent component. This is passed in only for convenience, the method implementation is not supposed to add the newly created component to the parent.componentId
- required id of newly created componentsrowModel
- model for given row- Returns:
- new cell component
-
addValidators
protected void addValidators(FormComponent<P> component)
-
getCellCssClass
public String getCellCssClass(IModel<I> rowModel, int rowNum)
Returns the cell specified by rowModel. The class is applied to the appropriate <td> element in the grid.- Specified by:
getCellCssClass
in interfaceIGridColumn<M,I,P>
- Overrides:
getCellCssClass
in classAbstractColumn<M,I,S>
- Parameters:
rowModel
- model for given rowrowNum
- index of row forDataGrid
, -1 forTreeGrid
- Returns:
- cell style class or
null
-
cellClicked
public boolean cellClicked(IModel<I> rowModel)
Description copied from class:AbstractColumn
Allows to override default behavior when a row is clicked. Depending on grid settings the default behavior can select the item. If this method returnstrue
the default behavior will be suppressed.- Specified by:
cellClicked
in interfaceIGridColumn<M,I,P>
- Overrides:
cellClicked
in classAbstractColumn<M,I,S>
- Parameters:
rowModel
- Model for clicked row- Returns:
true
if the default behavior when row is clicked should be supressed,false
otherwise.
-
isClickToEdit
protected boolean isClickToEdit()
-
-