Package com.inmethod.grid.column
Class WicketColumnAdapter<M,I,S>
- java.lang.Object
-
- com.inmethod.grid.column.AbstractColumn<M,I,S>
-
- com.inmethod.grid.column.WicketColumnAdapter<M,I,S>
-
- Type Parameters:
M- grid model object typeI- row/item model object type
- All Implemented Interfaces:
IGridColumn<M,I,S>,Serializable,IDetachable,IClusterable
public class WicketColumnAdapter<M,I,S> extends AbstractColumn<M,I,S>
Adapter that allows usingDataTablecolumns from wicket extensions in anAbstractGrid.Note that due to different internal structure of
AbstractGridandDataTablethis adapter might not work for everyIColumnimplementation. Basically if the implementation relies on the parent instance given inICellPopulator.populateItem(Item, String, IModel)it will probably not work properly with this adapter, as the parent instance this adapter uses is only temporary.- Author:
- Matej Knopp
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description WicketColumnAdapter(String columnId, IColumn<I,S> column)Constructor
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description StringgetCellCssClass(IModel<I> rowModel, int rowNum)Returns the cell specified by rowModel.SgetSortProperty()Result of this method determines whether the column is sortable and in case it is, also determines the sort property.ComponentnewCell(WebMarkupContainer parent, String componentId, IModel<I> rowModel)Creates a new cell component.ComponentnewHeader(String componentId)Creates a new component for column header.static <M,I,S>
List<IGridColumn<M,I,S>>wrapColumns(List<IColumn<I,S>> columns)Returns the specifiedIColumnlist as list ofWicketColumnAdapters that can be given to anAbstractGrid.static <T,M,I,S>
List<IGridColumn<M,I,S>>wrapColumns(IColumn<I,S>[] columns)Returns the specifiedIColumnarray as list ofWicketColumnAdapters that can be given to anAbstractGrid.-
Methods inherited from class com.inmethod.grid.column.AbstractColumn
cellClicked, detach, getColSpan, getGrid, getHeaderCssClass, getHeaderModel, getHeaderTooltipModel, getId, getInitialSize, getMaxSize, getMinSize, getSizeUnit, getWrapText, isLightWeight, isReorderable, isResizable, newCell, setGrid, setHeaderTooltipModel, setInitialSize, setMaxSize, setMinSize, setReorderable, setResizable, setSizeUnit, setWrapText
-
-
-
-
Method Detail
-
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:
newCellin interfaceIGridColumn<M,I,S>- Specified by:
newCellin classAbstractColumn<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
-
newHeader
public Component newHeader(String componentId)
Creates a new component for column header.- Specified by:
newHeaderin interfaceIGridColumn<M,I,S>- Overrides:
newHeaderin classAbstractColumn<M,I,S>- Parameters:
componentId- required id that the component must have- Returns:
- Component representing a column header
-
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:
getCellCssClassin interfaceIGridColumn<M,I,S>- Overrides:
getCellCssClassin classAbstractColumn<M,I,S>- Parameters:
rowModel- model for given rowrowNum- index of row forDataGrid, -1 forTreeGrid- Returns:
- cell style class or
null
-
getSortProperty
public S getSortProperty()
Result of this method determines whether the column is sortable and in case it is, also determines the sort property. If the column is sortable and user sorts by it, the sort property can then be obtained throughIGridSortState.- Specified by:
getSortPropertyin interfaceIGridColumn<M,I,S>- Overrides:
getSortPropertyin classAbstractColumn<M,I,S>- Returns:
- sort property or
nullif the column is not sortable - See Also:
IGridSortState.ISortStateColumn.getPropertyName()
-
wrapColumns
public static <T,M,I,S> List<IGridColumn<M,I,S>> wrapColumns(IColumn<I,S>[] columns)
Returns the specifiedIColumnarray as list ofWicketColumnAdapters that can be given to anAbstractGrid. The column identifiers are generated.- Parameters:
columns- array ofIColumns- Returns:
- list of
IGridColumns
-
wrapColumns
public static <M,I,S> List<IGridColumn<M,I,S>> wrapColumns(List<IColumn<I,S>> columns)
Returns the specifiedIColumnlist as list ofWicketColumnAdapters that can be given to anAbstractGrid. The column identifiers are generated.- Parameters:
columns- list ofIColumns- Returns:
- list of
IGridColumns
-
-