M
- grid model object typeI
- row/item model object typepublic abstract class AbstractColumn<M,I,S> extends Object implements IGridColumn<M,I,S>
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 FormConstructor and Description |
---|
AbstractColumn(String columnId,
org.apache.wicket.model.IModel<String> headerModel)
Creates instance with specified column id and header model
|
AbstractColumn(String columnId,
org.apache.wicket.model.IModel<String> headerModel,
S sortProperty)
Creates instance with specified column id, header model and sort property.
|
Modifier and Type | Method and Description |
---|---|
boolean |
cellClicked(org.apache.wicket.model.IModel<I> rowModel)
Allows to override default behavior when a row is clicked.
|
void |
detach() |
String |
getCellCssClass(org.apache.wicket.model.IModel<I> rowModel,
int rowNum)
Returns the cell specified by rowModel.
|
int |
getColSpan(org.apache.wicket.model.IModel<I> rowModel)
Returns the spanning value for cell specified by rowModel.
|
AbstractGrid<M,I,S> |
getGrid()
Returns the grid instance associated with this column.
|
String |
getHeaderCssClass()
Returns the CSS class for this column header.
|
org.apache.wicket.model.IModel<String> |
getHeaderModel()
Returns the model for header (caption)
|
org.apache.wicket.model.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.
|
S |
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(org.apache.wicket.model.IModel<I> rowModel)
Returns whether this column is uses a component for cell in given row (not lightweight) or an
IRenderable implementation. |
boolean |
isReorderable()
|
boolean |
isResizable()
Returns whether user will be able to resize this column.
|
IRenderable<I> |
newCell(org.apache.wicket.model.IModel<I> rowModel)
Creates a new
IRenderable instance that is used to render to render the output of
cell for given row. |
abstract org.apache.wicket.Component |
newCell(org.apache.wicket.markup.html.WebMarkupContainer parent,
String componentId,
org.apache.wicket.model.IModel<I> rowModel)
Creates a new cell component.
|
org.apache.wicket.Component |
newHeader(String componentId)
Creates a new component for column header.
|
void |
setGrid(AbstractGrid<M,I,S> grid)
Invoked before the first render of the grid.
|
AbstractColumn<M,I,S> |
setHeaderTooltipModel(org.apache.wicket.model.IModel<String> headerTooltipModel)
Sets the model for header tooltip.
|
AbstractColumn<M,I,S> |
setInitialSize(int initialSize)
Sets the initial size for this column.
|
AbstractColumn<M,I,S> |
setMaxSize(int maxSize)
Sets the maximal size of this column.
|
AbstractColumn<M,I,S> |
setMinSize(int minSize)
Sets the minimal size of this column.
|
AbstractColumn<M,I,S> |
setReorderable(boolean reorderable)
Sets whether the user will be able to drag and reorder this column (true by default).
|
AbstractColumn<M,I,S> |
setResizable(boolean resizable)
Sets whether the user will be able to resize this column (true by default).
|
AbstractColumn<M,I,S> |
setSizeUnit(SizeUnit sizeUnit)
Sets the size unit for this column.
|
AbstractColumn<M,I,S> |
setWrapText(boolean wrapText)
Sets whether the text in column will be wrapped when it is too long to fit the column (
false by default). |
public AbstractColumn(String columnId, org.apache.wicket.model.IModel<String> headerModel, S 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 sortedpublic AbstractColumn<M,I,S> setHeaderTooltipModel(org.apache.wicket.model.IModel<String> headerTooltipModel)
headerTooltipModel
- model for header tooltipthis
(useful for method chaining)public org.apache.wicket.model.IModel<String> getHeaderTooltipModel()
public org.apache.wicket.model.IModel<String> getHeaderModel()
public String getCellCssClass(org.apache.wicket.model.IModel<I> rowModel, int rowNum)
getCellCssClass
in interface IGridColumn<M,I,S>
rowModel
- model for given rowrowNum
- index of row for DataGrid
, -1 for TreeGrid
null
public int getColSpan(org.apache.wicket.model.IModel<I> rowModel)
getColSpan
in interface IGridColumn<M,I,S>
rowModel
- model for given rowpublic String getHeaderCssClass()
getHeaderCssClass
in interface IGridColumn<M,I,S>
null
public String getId()
getId
in interface IGridColumn<M,I,S>
public AbstractColumn<M,I,S> setInitialSize(int initialSize)
setSizeUnit(SizeUnit)
. By
default the unit is pixels.initialSize
- initial size of the columnthis
(useful for method chaining)public int getInitialSize()
IGridColumn.getSizeUnit()
.getInitialSize
in interface IGridColumn<M,I,S>
public AbstractColumn<M,I,S> setSizeUnit(SizeUnit sizeUnit)
SizeUnit.PX
.sizeUnit
- this
(useful for method chaining)public SizeUnit getSizeUnit()
SizeUnit.PX
.getSizeUnit
in interface IGridColumn<M,I,S>
public AbstractColumn<M,I,S> setMaxSize(int maxSize)
SizeUnit.PX
(pixels).maxSize
- maximal column sizethis
(useful for method chaining)public int getMaxSize()
getMaxSize
in interface IGridColumn<M,I,S>
public AbstractColumn<M,I,S> setMinSize(int minSize)
SizeUnit.PX
(pixels).minSize
- minimal column sizethis
(useful for method chaining)public int getMinSize()
getMinSize
in interface IGridColumn<M,I,S>
public S getSortProperty()
IGridSortState
.getSortProperty
in interface IGridColumn<M,I,S>
null
if the column is not sortableIGridSortState.ISortStateColumn.getPropertyName()
public AbstractColumn<M,I,S> setReorderable(boolean reorderable)
reorderable
- true
if the column will be reorderable, false
otherwisethis
(useful for method chaining)public boolean isReorderable()
isReorderable
in interface IGridColumn<M,I,S>
true
if the column is reorderable, false
otherwisepublic AbstractColumn<M,I,S> setResizable(boolean resizable)
SizeUnit.PX
.resizable
- true
if the column will be resizable, false
otherwisethis
(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,S>
true
if the column is resizable, false
otherwise.public boolean isLightWeight(org.apache.wicket.model.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 footprintisLightWeight
in interface IGridColumn<M,I,S>
rowModel
- model for given rowtrue
if the cell is lightweight, false
otherwisepublic abstract org.apache.wicket.Component newCell(org.apache.wicket.markup.html.WebMarkupContainer parent, String componentId, org.apache.wicket.model.IModel<I> rowModel)
IGridColumn.isLightWeight(IModel)
returns false ).newCell
in interface IGridColumn<M,I,S>
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 rowpublic IRenderable<I> newCell(org.apache.wicket.model.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,S>
rowModel
- model for given rowIRenderable
instancepublic org.apache.wicket.Component newHeader(String componentId)
newHeader
in interface IGridColumn<M,I,S>
componentId
- required id that the component must havepublic void detach()
detach
in interface org.apache.wicket.model.IDetachable
public void setGrid(AbstractGrid<M,I,S> grid)
setGrid
in interface IGridColumn<M,I,S>
grid
- grid that contains this columnpublic AbstractGrid<M,I,S> getGrid()
public AbstractColumn<M,I,S> setWrapText(boolean wrapText)
false
by default).wrapText
- true if the text will be wrapped, false
otherwise.
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,S>
public boolean cellClicked(org.apache.wicket.model.IModel<I> rowModel)
true
the default
behavior will be suppressed.cellClicked
in interface IGridColumn<M,I,S>
rowModel
- Model for clicked rowtrue
if the default behavior when row is clicked should be supressed,
false
otherwise.Copyright © 2015. All rights reserved.