com.inmethod.grid.column.editable
Class EditablePropertyTreeColumn<T extends TreeModel & Serializable,I extends TreeNode & Serializable,P,S>

java.lang.Object
  extended by com.inmethod.grid.column.AbstractColumn<T,I,S>
      extended by com.inmethod.grid.treegrid.BaseTreeColumn<T,I,S>
          extended by com.inmethod.grid.column.tree.AbstractTreeColumn<T,I,S>
              extended by com.inmethod.grid.column.tree.PropertyTreeColumn<T,I,P,S>
                  extended by com.inmethod.grid.column.editable.EditablePropertyTreeColumn<T,I,P,S>
All Implemented Interfaces:
IGridColumn<T,I,S>, Serializable, IDetachable, IClusterable

public class EditablePropertyTreeColumn<T extends TreeModel & Serializable,I extends TreeNode & Serializable,P,S>
extends PropertyTreeColumn<T,I,P,S>

Tree column that allows to edit the property when item is selected.

Author:
Matej Knopp
See Also:
Serialized Form

Constructor Summary
EditablePropertyTreeColumn(IModel<String> headerModel, String propertyExpression)
          Constructor.
EditablePropertyTreeColumn(IModel<String> headerModel, String propertyExpression, S sortProperty)
          Constructor.
EditablePropertyTreeColumn(String columnId, IModel<String> headerModel, String propertyExpression)
          Constructor.
EditablePropertyTreeColumn(String columnId, IModel<String> headerModel, String propertyExpression, S sortProperty)
          Constructor.
 
Method Summary
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()
           
protected  EditableCellPanel<T,I,P,S> newCellPanel(String componentId, IModel<I> rowModel, IModel<P> cellModel)
           
protected  Component newNodeComponent(String id, IModel<I> model)
          Creates the node component.
 
Methods inherited from class com.inmethod.grid.column.tree.PropertyTreeColumn
getPropertyExpression
 
Methods inherited from class com.inmethod.grid.column.tree.AbstractTreeColumn
getIcon, newCell, newCell
 
Methods inherited from class com.inmethod.grid.treegrid.BaseTreeColumn
getTreeGrid, setGrid
 
Methods inherited from class com.inmethod.grid.column.AbstractColumn
detach, getColSpan, getGrid, getHeaderCssClass, getHeaderModel, getHeaderTooltipModel, getId, getInitialSize, getMaxSize, getMinSize, getSizeUnit, getSortProperty, getWrapText, isLightWeight, isReorderable, isResizable, newHeader, setHeaderTooltipModel, setInitialSize, setMaxSize, setMinSize, setReorderable, setResizable, setSizeUnit, setWrapText
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

EditablePropertyTreeColumn

public EditablePropertyTreeColumn(String columnId,
                                  IModel<String> headerModel,
                                  String propertyExpression,
                                  S sortProperty)
Constructor.

Parameters:
columnId - column identified (must be unique within the grid)
headerModel - model for column header
propertyExpression - property expression used to get the displayed value for row object
sortProperty - optional string that will be returned by ISortState to indicate that the column is being sorted

EditablePropertyTreeColumn

public EditablePropertyTreeColumn(String columnId,
                                  IModel<String> headerModel,
                                  String propertyExpression)
Constructor.

Parameters:
columnId - column identified (must be unique within the grid)
headerModel - model for column header
propertyExpression - property expression used to get the displayed value for row object

EditablePropertyTreeColumn

public EditablePropertyTreeColumn(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 header
propertyExpression - property expression used to get the displayed value for row object
sortProperty - optional string that will be returned by ISortState to indicate that the column is being sorted

EditablePropertyTreeColumn

public EditablePropertyTreeColumn(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 header
propertyExpression - property expression used to get the displayed value for row object
Method Detail

newNodeComponent

protected Component newNodeComponent(String id,
                                     IModel<I> model)
Creates the node component.

Overrides:
newNodeComponent in class PropertyTreeColumn<T extends TreeModel & Serializable,I extends TreeNode & Serializable,P,S>
Parameters:
id - component id
model - model used to access the TreeNode
Returns:
newly created component instance

addValidators

protected void addValidators(FormComponent<P> component)

getFieldModel

protected IModel<P> getFieldModel(IModel<I> rowModel)

newCellPanel

protected EditableCellPanel<T,I,P,S> newCellPanel(String componentId,
                                                  IModel<I> rowModel,
                                                  IModel<P> cellModel)

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 interface IGridColumn<T extends TreeModel & Serializable,I extends TreeNode & Serializable,S>
Overrides:
getCellCssClass in class AbstractColumn<T extends TreeModel & Serializable,I extends TreeNode & Serializable,S>
Parameters:
rowModel - model for given row
rowNum - index of row for DataGrid, -1 for TreeGrid
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 returns true the default behavior will be suppressed.

Specified by:
cellClicked in interface IGridColumn<T extends TreeModel & Serializable,I extends TreeNode & Serializable,S>
Overrides:
cellClicked in class AbstractColumn<T extends TreeModel & Serializable,I extends TreeNode & Serializable,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()


Copyright © 2007–2014 inMethod s.r.o.. All rights reserved.