public class JIPipeDatatypeRegistry extends Object
JIPipeData
types, and associates them to their respective JIPipeDataSlot
.Modifier and Type | Class and Description |
---|---|
static class |
JIPipeDatatypeRegistry.DataConverterEdge
Edge between
JIPipeDataInfo instances that indicate a conversion |
Constructor and Description |
---|
JIPipeDatatypeRegistry(JIPipe jiPipe)
Creates a new instance
|
Modifier and Type | Method and Description |
---|---|
<T extends JIPipeData> |
convert(JIPipeData inputData,
Class<T> outputDataType,
JIPipeProgressInfo progressInfo)
Converts the input data to the output data type
|
void |
convertDisplayOperationsToImportOperations()
Converts all registered
JIPipeDataDisplayOperation entries into JIPipeDataImportOperation |
List<Class<? extends JIPipeData>> |
findDataTypes(Predicate<Class<?>> predicate)
Returns all
JIPipeData classes that satisfy the provided predicate |
List<Class<? extends JIPipeData>> |
findDataTypesByInterfaces(Class<?>... interfaces)
Returns all
JIPipeData classes that satisfy the provided interfaces |
Map<String,JIPipeDataDisplayOperation> |
getAllRegisteredDisplayOperations(String dataTypeId) |
Map<String,JIPipeDataImportOperation> |
getAllRegisteredImportOperations(String dataTypeId) |
Class<? extends JIPipeData> |
getById(String id)
Returns the data class with specified ID
|
JIPipeResultDataSlotPreview |
getCellRendererFor(JIPipeProjectWorkbench workbench,
JTable table,
JIPipeDataSlot slot,
JIPipeDataTableMetadataRow row,
JIPipeExportedDataAnnotation dataAnnotation)
Returns a cell renderer for dataslot result table
|
int |
getConversionDistance(Class<? extends JIPipeData> inputDataType,
Class<? extends JIPipeData> outputDataType)
Returns the number of conversion steps.
|
Map<String,Set<Class<? extends JIPipeData>>> |
getDataTypesByMenuPaths()
Gets the registered data types, grouped by their menu paths
|
Set<JIPipeDataInfo> |
getDeclaredBy(JIPipeDependency dependency)
Returns all data infos added by the dependency
|
ImageIcon |
getIconFor(Class<? extends JIPipeData> klass)
Returns the icon for a datatype
|
URL |
getIconURLFor(Class<? extends JIPipeData> klass) |
URL |
getIconURLFor(JIPipeDataInfo info) |
String |
getIdOf(Class<? extends JIPipeData> dataClass)
Gets the ID of the data type
|
JIPipe |
getJIPipe() |
Map<String,Class<? extends JIPipeData>> |
getRegisteredDataTypes()
Gets all registered data types
|
List<JIPipeDataDisplayOperation> |
getSortedDisplayOperationsFor(String id)
Gets all import operations for a data type ID
|
List<JIPipeDataImportOperation> |
getSortedImportOperationsFor(String id)
Gets all import operations for a data type ID
|
JIPipeDependency |
getSourceOf(Class<? extends JIPipeData> dataClass)
Returns the source that registered that data type
|
JIPipeDependency |
getSourceOf(String id)
Returns the source that registered that data type
|
JIPipeResultDataSlotRowUI |
getUIForResultSlot(JIPipeProjectWorkbench workbenchUI,
JIPipeDataSlot slot,
JIPipeDataTableMetadataRow row)
Generates a UI for a result data slot
|
Map<String,Class<? extends JIPipeData>> |
getUnhiddenRegisteredDataTypes()
Gets all data types that are not hidden
|
boolean |
hasDataType(Class<? extends JIPipeData> dataClass)
Returns true if the specified data type class is registered
|
boolean |
hasDatatypeWithId(String id)
Returns true if there is a data type with given ID
|
boolean |
isConvertible(Class<? extends JIPipeData> inputDataType,
Class<? extends JIPipeData> outputDataType)
Returns true if the input data type can be converted into the output data type.
|
boolean |
isHidden(String id)
Returns true if the data type with given ID is hidden
|
boolean |
isRegistered(Class<? extends JIPipeData> klass) |
static boolean |
isTriviallyConvertible(Class<? extends JIPipeData> inputDataType,
Class<? extends JIPipeData> outputDataType)
Returns true if the input data type can be trivially converted into the output data type.
|
void |
register(String id,
Class<? extends JIPipeData> klass,
JIPipeDependency source)
Registers a data type
|
void |
registerConversion(JIPipeDataConverter converter)
Registers a data converter that allows implicit conversion between data types
|
void |
registerDisplayOperation(String dataTypeId,
JIPipeDataDisplayOperation operation)
Registers an operation that will be available to users in the cache view
|
void |
registerIcon(Class<? extends JIPipeData> klass,
URL resourcePath)
Registers a custom icon for a datatype
|
void |
registerImportOperation(String dataTypeId,
JIPipeDataImportOperation operation)
Registers an operation that will be available to users in the results view (after runs).
|
void |
registerResultSlotUI(Class<? extends JIPipeData> klass,
Class<? extends JIPipeResultDataSlotRowUI> uiClass)
Registers a custom UI for a result data slot
|
void |
registerResultTableCellUI(Class<? extends JIPipeData> klass,
Class<? extends JIPipeResultDataSlotPreview> renderer)
Registers a custom renderer for the data displayed in the dataslot result table
|
public JIPipeDatatypeRegistry(JIPipe jiPipe)
jiPipe
- the JIPipe instancepublic static boolean isTriviallyConvertible(Class<? extends JIPipeData> inputDataType, Class<? extends JIPipeData> outputDataType)
inputDataType
- the input data typeoutputDataType
- the output data typepublic List<Class<? extends JIPipeData>> findDataTypesByInterfaces(Class<?>... interfaces)
JIPipeData
classes that satisfy the provided interfacesinterfaces
- the list of interfaces. if empty, all data types are returnedpublic List<Class<? extends JIPipeData>> findDataTypes(Predicate<Class<?>> predicate)
JIPipeData
classes that satisfy the provided predicatepredicate
- the predicatepublic void registerConversion(JIPipeDataConverter converter)
converter
- the converterpublic boolean isRegistered(Class<? extends JIPipeData> klass)
public <T extends JIPipeData> T convert(JIPipeData inputData, Class<T> outputDataType, JIPipeProgressInfo progressInfo)
inputData
- the input dataoutputDataType
- the output data typeprogressInfo
- the progress infopublic int getConversionDistance(Class<? extends JIPipeData> inputDataType, Class<? extends JIPipeData> outputDataType)
inputDataType
- the input data typeoutputDataType
- the output data typepublic boolean isConvertible(Class<? extends JIPipeData> inputDataType, Class<? extends JIPipeData> outputDataType)
JIPipeData
inputDataType
- the input data typeoutputDataType
- the output data typepublic void register(String id, Class<? extends JIPipeData> klass, JIPipeDependency source)
id
- The datatype IDklass
- The data classsource
- The dependency that registers the datapublic void registerImportOperation(String dataTypeId, JIPipeDataImportOperation operation)
dataTypeId
- data type id. if empty, the operation applies to all data types.operation
- the operationpublic void registerDisplayOperation(String dataTypeId, JIPipeDataDisplayOperation operation)
dataTypeId
- data type id. if empty, the operation applies to all data types.operation
- the operationpublic Map<String,JIPipeDataDisplayOperation> getAllRegisteredDisplayOperations(String dataTypeId)
public Map<String,JIPipeDataImportOperation> getAllRegisteredImportOperations(String dataTypeId)
public List<JIPipeDataImportOperation> getSortedImportOperationsFor(String id)
id
- the idpublic List<JIPipeDataDisplayOperation> getSortedDisplayOperationsFor(String id)
id
- the idpublic Map<String,Class<? extends JIPipeData>> getRegisteredDataTypes()
public Map<String,Class<? extends JIPipeData>> getUnhiddenRegisteredDataTypes()
public String getIdOf(Class<? extends JIPipeData> dataClass)
dataClass
- The data classpublic boolean hasDatatypeWithId(String id)
id
- The data type IDpublic boolean isHidden(String id)
id
- The data type IDpublic Class<? extends JIPipeData> getById(String id)
id
- The data type IDpublic Map<String,Set<Class<? extends JIPipeData>>> getDataTypesByMenuPaths()
public JIPipeDependency getSourceOf(String id)
id
- Data type idpublic JIPipeDependency getSourceOf(Class<? extends JIPipeData> dataClass)
dataClass
- The data classpublic boolean hasDataType(Class<? extends JIPipeData> dataClass)
dataClass
- The data classpublic Set<JIPipeDataInfo> getDeclaredBy(JIPipeDependency dependency)
dependency
- The dependencypublic void registerIcon(Class<? extends JIPipeData> klass, URL resourcePath)
klass
- data classresourcePath
- icon resourcepublic void registerResultSlotUI(Class<? extends JIPipeData> klass, Class<? extends JIPipeResultDataSlotRowUI> uiClass)
klass
- data classuiClass
- slot uipublic void registerResultTableCellUI(Class<? extends JIPipeData> klass, Class<? extends JIPipeResultDataSlotPreview> renderer)
klass
- data classrenderer
- cell rendererpublic ImageIcon getIconFor(Class<? extends JIPipeData> klass)
klass
- data classpublic JIPipeResultDataSlotRowUI getUIForResultSlot(JIPipeProjectWorkbench workbenchUI, JIPipeDataSlot slot, JIPipeDataTableMetadataRow row)
workbenchUI
- workbench UIslot
- data slotrow
- table rowpublic JIPipeResultDataSlotPreview getCellRendererFor(JIPipeProjectWorkbench workbench, JTable table, JIPipeDataSlot slot, JIPipeDataTableMetadataRow row, JIPipeExportedDataAnnotation dataAnnotation)
workbench
- the workbenchtable
- the table that owns the rendererslot
- the slotrow
- the data rowdataAnnotation
- the data annotation (optional)public URL getIconURLFor(Class<? extends JIPipeData> klass)
klass
- data classpublic URL getIconURLFor(JIPipeDataInfo info)
info
- data infopublic JIPipe getJIPipe()
public void convertDisplayOperationsToImportOperations()
JIPipeDataDisplayOperation
entries into JIPipeDataImportOperation
Copyright © 2020–2024 Leibniz Institute for Natural Product Research and Infection Biology - Hans Knöll Institute (HKI). All rights reserved.