|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.inmethod.grid.column.AbstractColumn<M,I>
M - grid model object typeI - row/item model object typepublic abstract class AbstractColumn<M,I>
Convenience implementation of IGridColumn. This class should be used as base for
non-lightweight columns.
Contains getters and setters for most properties and takes care of the header component. The only
method necessary to implement is newCell(WebMarkupContainer, String, IModel).
AbstractLightWeightColumn,
Serialized Form| Constructor Summary | |
|---|---|
AbstractColumn(String columnId,
IModel<String> headerModel)
Creates instance with specified column id and header model |
|
AbstractColumn(String columnId,
IModel<String> headerModel,
String sortProperty)
Creates instance with specified column id, header model and sort property. |
|
| Method Summary | |
|---|---|
boolean |
cellClicked(IModel<I> rowModel)
Allows to override default behavior when a row is clicked. |
void |
detach()
|
String |
getCellCssClass(IModel<I> rowModel,
int rowNum)
Returns the cell specified by rowModel. |
int |
getColSpan(IModel<I> rowModel)
Returns the spanning value for cell specified by rowModel. |
AbstractGrid<M,I> |
getGrid()
Returns the grid instance associated with this column. |
String |
getHeaderCssClass()
Returns the CSS class for this column header. |
IModel<String> |
getHeaderModel()
Returns the model for header (caption) |
IModel<String> |
getHeaderTooltipModel()
Returns the model for header tooltip |
String |
getId()
Returns the column id. |
int |
getInitialSize()
Returns the initial size of column. |
int |
getMaxSize()
Returns the maximal size of resizable column. |
int |
getMinSize()
Returns the minimal size of resizable column. |
SizeUnit |
getSizeUnit()
Returns the unit in which sizes are specified. |
String |
getSortProperty()
Result of this method determines whether the column is sortable and in case it is, also determines the sort property. |
boolean |
getWrapText()
Determines the behavior when there is more text in cell than it fits in it. |
boolean |
isLightWeight(IModel<I> rowModel)
Returns whether this column is uses a component for cell in given row (not lightweight) or an IRenderable implementation. |
boolean |
isReorderable()
#see IGridColumn.isReorderable() |
boolean |
isResizable()
Returns whether user will be able to resize this column. |
IRenderable<I> |
newCell(IModel<I> rowModel)
Creates a new IRenderable instance that is used to render to render the output of
cell for given row. |
abstract Component |
newCell(WebMarkupContainer parent,
String componentId,
IModel<I> rowModel)
Creates a new cell component. |
Component |
newHeader(String componentId)
Creates a new component for column header. |
void |
setGrid(AbstractGrid<M,I> grid)
Invoked before the first render of the grid. |
AbstractColumn<M,I> |
setHeaderTooltipModel(IModel<String> headerTooltipModel)
Sets the model for header tooltip. |
AbstractColumn<M,I> |
setInitialSize(int initialSize)
Sets the initial size for this column. |
AbstractColumn<M,I> |
setMaxSize(int maxSize)
Sets the maximal size of this column. |
AbstractColumn<M,I> |
setMinSize(int minSize)
Sets the minimal size of this column. |
AbstractColumn<M,I> |
setReorderable(boolean reorderable)
Sets whether the user will be able to drag and reorder this column (true by default). |
AbstractColumn<M,I> |
setResizable(boolean resizable)
Sets whether the user will be able to resize this column (true by default). |
AbstractColumn<M,I> |
setSizeUnit(SizeUnit sizeUnit)
Sets the size unit for this column. |
AbstractColumn<M,I> |
setWrapText(boolean wrapText)
Sets whether the text in column will be wrapped when it is too long to fit the column ( false by default). |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public AbstractColumn(String columnId,
IModel<String> headerModel,
String sortProperty)
columnId - column identifier - must be unique within the gridheaderModel - model for column titlesortProperty - optional string that will be returned by ISortState to indicate that the
column is being sorted
public AbstractColumn(String columnId,
IModel<String> headerModel)
columnId - column identifier - must be unique within the gridheaderModel - model for column title| Method Detail |
|---|
public AbstractColumn<M,I> setHeaderTooltipModel(IModel<String> headerTooltipModel)
headerTooltipModel - model for header tooltip
this (useful for method chaining)public IModel<String> getHeaderTooltipModel()
public IModel<String> getHeaderModel()
public String getCellCssClass(IModel<I> rowModel,
int rowNum)
getCellCssClass in interface IGridColumn<M,I>rowModel - model for given rowrowNum - index of row for DataGrid, -1 for TreeGrid
nullpublic int getColSpan(IModel<I> rowModel)
getColSpan in interface IGridColumn<M,I>rowModel - model for given row
public String getHeaderCssClass()
getHeaderCssClass in interface IGridColumn<M,I>nullpublic String getId()
getId in interface IGridColumn<M,I>public AbstractColumn<M,I> setInitialSize(int initialSize)
setSizeUnit(SizeUnit). By
default the unit is pixels.
initialSize - initial size of the column
this (useful for method chaining)public int getInitialSize()
IGridColumn.getSizeUnit().
getInitialSize in interface IGridColumn<M,I>public AbstractColumn<M,I> setSizeUnit(SizeUnit sizeUnit)
SizeUnit.PX.
sizeUnit -
this (useful for method chaining)public SizeUnit getSizeUnit()
SizeUnit.PX.
getSizeUnit in interface IGridColumn<M,I>public AbstractColumn<M,I> setMaxSize(int maxSize)
SizeUnit.PX (pixels).
maxSize - maximal column size
this (useful for method chaining)public int getMaxSize()
getMaxSize in interface IGridColumn<M,I>public AbstractColumn<M,I> setMinSize(int minSize)
SizeUnit.PX (pixels).
minSize - minimal column size
this (useful for method chaining)public int getMinSize()
getMinSize in interface IGridColumn<M,I>public String getSortProperty()
IGridSortState.
getSortProperty in interface IGridColumn<M,I>null if the column is not sortableIGridSortState.ISortStateColumn.getPropertyName()public AbstractColumn<M,I> setReorderable(boolean reorderable)
reorderable - true if the column will be reorderable, false otherwise
this (useful for method chaining)public boolean isReorderable()
IGridColumn.isReorderable()
isReorderable in interface IGridColumn<M,I>true if the column is reorderable, false otherwisepublic AbstractColumn<M,I> setResizable(boolean resizable)
SizeUnit.PX.
resizable - true if the column will be resizable, false otherwise
this (useful for method chaining)setSizeUnit(SizeUnit)public boolean isResizable()
IGridColumn.getSizeUnit() must return SizeUnit.PX, otherwise an
IllegalStateException will be thrown.
isResizable in interface IGridColumn<M,I>true if the column is resizable, false otherwise.public boolean isLightWeight(IModel<I> rowModel)
IRenderable implementation. Generally, if the cell is non-interactive (label only),
it's better to use an IRenderable implementation, as it has zero memory footprint
isLightWeight in interface IGridColumn<M,I>rowModel - model for given row
true if the cell is lightweight, false otherwise
public abstract Component newCell(WebMarkupContainer parent,
String componentId,
IModel<I> rowModel)
IGridColumn.isLightWeight(IModel) returns false ).
newCell in interface IGridColumn<M,I>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
public IRenderable<I> newCell(IModel<I> rowModel)
IRenderable instance that is used to render to render the output of
cell for given row. This method is called for rows that are lightweight (
IGridColumn.isLightWeight(IModel) returns true ).
newCell in interface IGridColumn<M,I>rowModel - model for given row
IRenderable instancepublic Component newHeader(String componentId)
newHeader in interface IGridColumn<M,I>componentId - required id that the component must have
public void detach()
detach in interface IDetachablepublic void setGrid(AbstractGrid<M,I> grid)
setGrid in interface IGridColumn<M,I>grid - grid that contains this columnpublic AbstractGrid<M,I> getGrid()
public AbstractColumn<M,I> setWrapText(boolean wrapText)
false by default).
wrapText - true if the text will be wrapped, false otherwise.
- Returns:
this (useful for method chaining)public boolean getWrapText()
true, the text will be wrapped and row height increased. If the method
returns false, the remaining part of text will be hidden.
getWrapText in interface IGridColumn<M,I>public boolean cellClicked(IModel<I> rowModel)
true the default
behavior will be suppressed.
cellClicked in interface IGridColumn<M,I>rowModel - Model for clicked row
true if the default behavior when row is clicked should be supressed,
false otherwise.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||