Class RelatedItemColumn
java.lang.Object
net.sf.basedb.clients.web.extensions.DynamicActionAttributeSupport
net.sf.basedb.clients.web.extensions.list.AbstractListColumnBean<Annotatable,Object>
net.sf.basedb.clients.web.extensions.list.RelatedItemColumn
- All Implemented Interfaces:
DynamicActionAttributes
,ListColumnAction<Annotatable,
,Object> Action
- Direct Known Subclasses:
RelatedItemAnnotationColumn
,RelatedItemErrorColumn
,RelatedItemExtensionColumn
,RelatedItemListColumn
,RelatedItemMultiHopColumn
,RelatedItemPropertyColumn
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
Modifier and TypeClassDescriptionstatic class
Represents a specification for loading a related parent or child item. -
Field Summary
Modifier and TypeFieldDescriptionprivate final RelatedItemHelper
private final int
private final RelatedItemColumn.Specification
private final SourceItemTransformer
-
Constructor Summary
ConstructorDescriptionRelatedItemColumn
(DbControl dc, int index, RelatedItemColumn.Specification spec, RelatedItemHelper helper) -
Method Summary
Modifier and TypeMethodDescriptionstatic 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.final 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
Get the specification for this column.protected SourceItemTransformer
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.final 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, getExportTitle, getFilterClass, getFilterProperty, getFilterText, getFormatter, getId, getProperty, getSortProperty, getStyle, getSubtitle, getTitle, getTooltip, getValueType, isExportable, isFilterable, isSortable, setCellClass, setCellStyle, setClazz, setCollectionFormatter, setDisableOverflowCheck, setEnumeration, setExportable, setExportFormatter, setExportProperty, setExportTitle, setFilterable, setFilterClass, setFilterProperty, setFilterText, setFormatter, setId, setProperty, setSortable, setSortProperty, setStyle, setSubtitle, setTitle, setTooltip, setValueType
Methods inherited from class net.sf.basedb.clients.web.extensions.DynamicActionAttributeSupport
addAttributes, getAttributesString, getDynamicActionAttributes, setDynamicActionAttributesSource, setDynamicAttribute
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface net.sf.basedb.clients.web.extensions.list.ListColumnAction
getDynamicActionAttributes
-
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 'subtype-id' can also include an extra filter for a single annotationt type or an item list: - 'subtype-id&annotationtype-id=value' - 'subtype-id&list=list-id -
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.
-