Class RelatedItemColumn
java.lang.Object
net.sf.basedb.clients.web.extensions.list.AbstractListColumnBean<Annotatable,Object>
net.sf.basedb.clients.web.extensions.list.RelatedItemColumn
- All Implemented Interfaces:
ListColumnAction<Annotatable,Object>
,Action
- Direct Known Subclasses:
RelatedItemAnnotationColumn
,RelatedItemErrorColumn
,RelatedItemExtensionColumn
,RelatedItemListColumn
,RelatedItemMultiHopColumn
,RelatedItemPropertyColumn
public abstract class RelatedItemColumn extends AbstractListColumnBean<Annotatable,Object>
A column action implementation that finds a parent or child item of a given
subtype and then get an annotation or other property value from it.
- Since:
- 3.16, 3.17
- Author:
- nicklas
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
RelatedItemColumn.Specification
Represents a specification for loading a related parent or child item. -
Field Summary
Fields Modifier and Type Field Description private RelatedItemHelper
helper
private int
index
private RelatedItemColumn.Specification
spec
private SourceItemTransformer
transformer
-
Constructor Summary
Constructors Constructor Description RelatedItemColumn(DbControl dc, int index, RelatedItemColumn.Specification spec, RelatedItemHelper helper)
-
Method Summary
Modifier and Type Method Description static RelatedItemColumn
create(DbControl dc, int index, RelatedItemColumn.Specification spec, RelatedItemHelper helper)
For now, we assume that 'expr' is one of: /DIRECTION/ITEMTYPE/subtype-id/#annotationtype-id /DIRECTION/ITEMTYPE/subtype-id/!protected Object
getExportValue(RelatedItemHelper helper, Annotatable item, SourceItemTransformer preTransform)
Alternate implementation for loading data.Object
getExportValue(DbControl dc, Annotatable item)
We finalize this implementation to make sure that the helper implementation always get a chance to re-cycle transactions.private String
getProxyTag(Annotatable item)
Generate a proxy tag that is returned instead of actual data.protected Set<Annotatable>
getRelatedItems(Annotatable item, SourceItemTransformer preTransform)
Get all parent or child items to the requested item that matches the specified filter.protected RelatedItemColumn.Specification
getSpecification()
Get the specification for this column.protected SourceItemTransformer
getTransformer()
Get the transformer implementation that is used to turn source item into target items.protected abstract Object
getValue(RelatedItemHelper helper, Annotatable item, SourceItemTransformer preTransform)
Alternate implementation for loading data.Object
getValue(DbControl dc, Annotatable item)
We finalize this implementation to make sure that the helper implementation always get a chance to re-cycle transactions.protected boolean
isLazy()
Is this column lazy-loaded?Methods inherited from class net.sf.basedb.clients.web.extensions.list.AbstractListColumnBean
getCellClass, getCellStyle, getClazz, getCollectionFormatter, getDisableOverflowCheck, getEnumeration, getExportFormatter, getExportProperty, getFilterProperty, getFormatter, getId, getProperty, getSortProperty, getStyle, getSubtitle, getTitle, getTooltip, getValueType, isExportable, isFilterable, isSortable, setCellClass, setCellStyle, setClazz, setCollectionFormatter, setDisableOverflowCheck, setEnumeration, setExportable, setExportFormatter, setExportProperty, setFilterable, setFilterProperty, setFormatter, setId, setProperty, setSortable, setSortProperty, setStyle, setSubtitle, setTitle, setTooltip, setValueType
-
Field Details
-
index
private final int index -
spec
-
helper
-
transformer
-
-
Constructor Details
-
RelatedItemColumn
RelatedItemColumn(DbControl dc, int index, RelatedItemColumn.Specification spec, RelatedItemHelper helper)
-
-
Method Details
-
create
public static RelatedItemColumn create(DbControl dc, int index, RelatedItemColumn.Specification spec, RelatedItemHelper helper)For now, we assume that 'expr' is one of: /DIRECTION/ITEMTYPE/subtype-id/#annotationtype-id /DIRECTION/ITEMTYPE/subtype-id/!extension-id#action-id /DIRECTION/ITEMTYPE/subtype-id/property DIRECTION=CHILD|PARENT (PARENT is assumed if not specified) 'subtype-id' can also be the rawdatatype-id if the ITEMTYPE=Item.RAWBIOASSAY -
isLazy
protected boolean isLazy()Is this column lazy-loaded? The default implementation use the requested laza flag from the helper instance.- Since:
- 3.19.4
-
getTransformer
Get the transformer implementation that is used to turn source item into target items.- Since:
- 3.19.4
-
getSpecification
Get the specification for this column.- Since:
- 3.19.5
-
getValue
We finalize this implementation to make sure that the helper implementation always get a chance to re-cycle transactions. Subclasses should implementgetValue(RelatedItemHelper, Annotatable, SourceItemTransformer)
to return the requested value from the item and use the DbControl fromRelatedItemHelper.dc
.- Parameters:
dc
- An open DbControl than can be used to query the databaseitem
- The current item- Returns:
- The value that should be displayed
-
getProxyTag
Generate a proxy tag that is returned instead of actual data. A JavaScript in 'lazy-parent-items.js' will scan the table and inject the actual data in batches. -
getExportValue
We finalize this implementation to make sure that the helper implementation always get a chance to re-cycle transactions. Subclasses should overridegetExportValue(RelatedItemHelper, Annotatable, SourceItemTransformer)
to return the requested value from the item and use the DbControl fromRelatedItemHelper.dc
.- Specified by:
getExportValue
in interfaceListColumnAction<Annotatable,Object>
- Overrides:
getExportValue
in classAbstractListColumnBean<Annotatable,Object>
- Parameters:
dc
- An open DbControl than can be used to query the databaseitem
- The current item- Returns:
- The value that should be exported
-
getValue
protected abstract Object getValue(RelatedItemHelper helper, Annotatable item, SourceItemTransformer preTransform)Alternate implementation for loading data. The item is normally an item of the expected source type, but if a preTransform is present, the item may be of different type and must be processed with theSourceItemTransformer.transform(net.sf.basedb.util.listable.TransformContext, Set)
method first. In most cases, implementation should simply callgetRelatedItems(Annotatable, SourceItemTransformer)
to load the final target items. -
getExportValue
protected Object getExportValue(RelatedItemHelper helper, Annotatable item, SourceItemTransformer preTransform)Alternate implementation for loading data. The default implementation simply call thegetValue(RelatedItemHelper, Annotatable, SourceItemTransformer)
method.- Since:
- 3.19.4
-
getRelatedItems
Get all parent or child items to the requested item that matches the specified filter.
-