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
,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
-
-
Field Summary
Fields Modifier and Type Field Description private Filter<Annotatable>
filter
private RelatedItemHelper
helper
private int
index
private static Map<String,String>
pathTitles
private Item
sourceType
private Item
targetType
private SourceItemTransformer
transformer
private SourceItemTransformerFactory
transformerFactory
-
Constructor Summary
Constructors Constructor Description RelatedItemColumn(int index, String id, Item sourceType, Item targetType, SyncFilter.SourceItemTransform direction, Filter<Annotatable> filter, RelatedItemHelper helper)
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description static RelatedItemColumn
create(DbControl dc, int index, Item sourceType, String expr, RelatedItemHelper helper)
For now, we assume that 'expr' is /DIRECTION/ITEMTYPE/subtype-id/#annotationtype-id or /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.RAWBIOASSAYObject
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)
Get all parent or child items to the requested item that matches the specified filter.protected abstract Object
getValue(RelatedItemHelper helper, Annotatable item)
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.private static String
pathToTitle(String path)
Convert some paths to a more user-friendly title instead.-
Methods inherited from class net.sf.basedb.clients.web.extensions.list.AbstractListColumnBean
getClazz, getEnumeration, getExportFormatter, getExportProperty, getFilterProperty, getFormatter, getId, getProperty, getSortProperty, getStyle, getTitle, getTooltip, getValueType, isExportable, isFilterable, isSortable, setClazz, setEnumeration, setExportable, setExportFormatter, setExportProperty, setFilterable, setFilterProperty, setFormatter, setId, setProperty, setSortable, setSortProperty, setStyle, setTitle, setTooltip, setValueType
-
-
-
-
Field Detail
-
index
private final int index
-
sourceType
private final Item sourceType
-
targetType
private final Item targetType
-
filter
private final Filter<Annotatable> filter
-
helper
private final RelatedItemHelper helper
-
transformerFactory
private final SourceItemTransformerFactory transformerFactory
-
transformer
private final SourceItemTransformer transformer
-
-
Constructor Detail
-
RelatedItemColumn
RelatedItemColumn(int index, String id, Item sourceType, Item targetType, SyncFilter.SourceItemTransform direction, Filter<Annotatable> filter, RelatedItemHelper helper)
-
-
Method Detail
-
create
public static RelatedItemColumn create(DbControl dc, int index, Item sourceType, String expr, RelatedItemHelper helper)
For now, we assume that 'expr' is /DIRECTION/ITEMTYPE/subtype-id/#annotationtype-id or /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
-
pathToTitle
private static String pathToTitle(String path)
Convert some paths to a more user-friendly title instead.
-
getValue
public 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. Subclasses should implementgetValue(RelatedItemHelper, Annotatable)
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
private String getProxyTag(Annotatable item)
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
public 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. Subclasses should implementgetValue(RelatedItemHelper, Annotatable)
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)
Alternate implementation for loading data.
-
getRelatedItems
protected Set<Annotatable> getRelatedItems(Annotatable item)
Get all parent or child items to the requested item that matches the specified filter.
-
-