public abstract class JIPipeGraphNode extends AbstractJIPipeParameterCollection implements JIPipeValidatable, JIPipeFunctionallyComparable, JIPipeParameterCollection.ParameterChangedEventListener, JIPipeParameterCollection.ParameterUIChangedEventListener, JIPipeParameterCollection.ParameterStructureChangedEventListener, JIPipeSlotConfiguration.SlotConfigurationChangedEventListener
JIPipeGraph
.
The workload of this node is considered optional (this means it can have an empty workload),
which is important for structural graphs like the compartment graph.
Use JIPipeAlgorithm
as base class to indicate a non-optional workload.Modifier and Type | Class and Description |
---|---|
static class |
JIPipeGraphNode.BaseDirectoryChangedEvent
Triggered when the base directory of a project or algorithm was changed
|
static class |
JIPipeGraphNode.BaseDirectoryChangedEventEmitter |
static interface |
JIPipeGraphNode.BaseDirectoryChangedEventListener |
static class |
JIPipeGraphNode.NodeSlotsChangedEvent
Triggered when an algorithm's slots change
|
static class |
JIPipeGraphNode.NodeSlotsChangedEventEmitter |
static interface |
JIPipeGraphNode.NodeSlotsChangedEventListener |
static class |
JIPipeGraphNode.Serializer
Serializes an
JIPipeGraphNode instance |
JIPipeParameterCollection.ParameterChangedEvent, JIPipeParameterCollection.ParameterChangedEventEmitter, JIPipeParameterCollection.ParameterChangedEventListener, JIPipeParameterCollection.ParameterStructureChangedEvent, JIPipeParameterCollection.ParameterStructureChangedEventEmitter, JIPipeParameterCollection.ParameterStructureChangedEventListener, JIPipeParameterCollection.ParameterUIChangedEvent, JIPipeParameterCollection.ParameterUIChangedEventEmitter, JIPipeParameterCollection.ParameterUIChangedEventListener
Constructor and Description |
---|
JIPipeGraphNode(JIPipeGraphNode other)
Copies the input algorithm's properties into this algorithm
|
JIPipeGraphNode(JIPipeNodeInfo info)
Initializes a new node type instance
|
JIPipeGraphNode(JIPipeNodeInfo info,
JIPipeSlotConfiguration slotConfiguration)
Initializes this algorithm with a custom provided slot configuration
|
Modifier and Type | Method and Description |
---|---|
void |
archiveTo(JIPipeWriteDataStorage projectStorage,
JIPipeWriteDataStorage wrappedExternalStorage,
JIPipeProgressInfo progressInfo,
Path originalBaseDirectory)
Called when the node is being archived into the specified storage.
|
boolean |
canUserDelete()
Returns true if a user can delete this algorithm
|
void |
clearLocations()
Removes all location information added via setLocationWithin()
|
void |
clearSlotData(boolean force,
JIPipeProgressInfo progressInfo)
Clears all data slots
|
protected JIPipeSlotConfiguration |
copySlotConfiguration(JIPipeGraphNode other)
Copies the slot configuration from the other algorithm to this algorithm
Override this method for special configuration cases
|
void |
createUIInputSlotIconDescriptionMenuItems(String slotName,
List<ViewOnlyMenuItem> target)
Explanations added to the slot menu
Can be null
|
JIPipeGraphNode |
duplicate()
Copies the algorithm.
|
void |
emitNodeSlotsChangedEvent()
Triggers an event that indicates that the slots have changed
|
void |
fromJson(com.fasterxml.jackson.databind.JsonNode node,
JIPipeValidationReportContext context,
JIPipeValidationReport issues,
JIPipeNotificationInbox notifications)
Loads this algorithm from JSON
Please do not override this method if absolutely necessary.
|
boolean |
functionallyEquals(Object other)
Returns true if this node and the other node are functionally equal (i.e. they have the same functional parameters).
|
String |
getAliasIdInParentGraph()
Returns the alias ID of this node.
|
Path |
getBaseDirectory()
Returns the current work directory of this algorithm.
|
JIPipeGraphNode.BaseDirectoryChangedEventEmitter |
getBaseDirectoryChangedEventEmitter() |
JIPipeNodeTypeCategory |
getCategory()
Gets the algorithm category
|
String |
getCompartmentDisplayName()
Returns a display name for the compartment
|
String |
getCompartmentUUIDInGraphAsString()
Returns the compartment UUID in the graph as string.
|
UUID |
getCompartmentUUIDInParentGraph()
Returns the compartment UUID within the current graph.
|
HTMLText |
getCustomDescription()
Returns the custom description that is set by the user
|
String |
getCustomName()
The current custom (user-defined) name
|
List<JIPipeInputDataSlot> |
getDataInputSlots()
Method that can be overwritten by child classes.
|
Set<JIPipeDependency> |
getDependencies()
Returns a list of all dependencies this algorithm currently has.
|
String |
getDisplayName()
Returns a name that provides human-readable information about the name and compartment
|
void |
getEnvironmentDependencies(List<JIPipeEnvironment> target)
Gathers all known external environments
|
JIPipeInputDataSlot |
getFirstInputSlot()
Returns the first input slot according to the slot order.
|
JIPipeOutputDataSlot |
getFirstOutputSlot()
Returns the first output slot according to the slot order.
|
JIPipeNodeInfo |
getInfo()
Returns the
JIPipeNodeInfo that describes this algorithm |
JIPipeInputDataSlot |
getInputSlot(String name)
Returns the input slot with the specified name.
|
Map<String,JIPipeInputDataSlot> |
getInputSlotMap()
Gets all input slot instances
|
List<String> |
getInputSlotOrder()
Gets the input slot order
|
List<JIPipeInputDataSlot> |
getInputSlots()
Returns all input slots ordered by the slot order
|
List<JIPipeInputDataSlot> |
getInputSlotsWithRole(JIPipeDataSlotRole role)
Gets all input slots that have the specified role
|
Path |
getInternalStoragePath()
Returns the internal storage path relative to the output folder.
|
JIPipeInputDataSlot |
getLastInputSlot()
Returns the last input slot according to the slot order.
|
JIPipeOutputDataSlot |
getLastOutputSlot()
Returns the last output slot according to the slot order.
|
String |
getName()
Returns the algorithm name
|
Path |
getNewScratch()
Returns a new scratch directory that is unique and based on the alias ID of this node
|
JIPipeGraphNode.NodeSlotsChangedEventEmitter |
getNodeSlotsChangedEventEmitter() |
Map<String,Map<String,Point>> |
getNodeUILocationPerViewModePerCompartment()
Gets the location map (writable) as map from compartment UUID to visual mode to location
|
Point |
getNodeUILocationWithin(String compartment,
String visualMode)
Returns the location within the specified compartment or null if none is set
|
List<JIPipeInputDataSlot> |
getOpenInputSlots()
Returns all input slots that do not have data set.
|
JIPipeOutputDataSlot |
getOutputSlot(String name)
Returns the output slot with the specified name.
|
Map<String,JIPipeOutputDataSlot> |
getOutputSlotMap()
Gets all output slot instances
|
List<JIPipeOutputDataSlot> |
getOutputSlots()
Returns all output slots ordered by the slot order
|
List<JIPipeOutputDataSlot> |
getOutputSlotsWithRole(JIPipeDataSlotRole role)
Gets all input slots that have the specified role
|
JIPipeGraph |
getParentGraph()
Returns the graph this algorithm is located in.
|
JIPipeProject |
getProject() |
JIPipeProjectCompartment |
getProjectCompartment()
Gets the project compartment instance of this node.
|
Map<String,Path> |
getProjectDataDirs()
Returns the currently accessible project data directories
|
Path |
getProjectDirectory()
Returns the current project directory.
|
JIPipeProject |
getRuntimeProject()
Returns the current project associated with the current run
|
Path |
getScratchBaseDirectory()
Gets the scratch directory of the current run associated to this algorithm.
|
JIPipeSlotConfiguration |
getSlotConfiguration()
Gets the slot configuration
|
Path |
getStoragePath()
The storage path is used in
JIPipeGraphRun to indicate where output data is written
This is only used internally |
void |
getTextDescription(StringBuilder stringBuilder)
Gets a description of the node as text
|
ImageIcon |
getUIInputSlotIcon(String slotName)
An icon that is displayed on the right-hand side of the input slot
Can be null
|
Dimension |
getUIInputSlotIconBaseDimensions(String slotName)
Size of the icon returned by getUIInputSlotIcon
Should be at most 16x16
Defaults to 12x12
|
UUID |
getUUIDInParentGraph()
Returns the UUID within the current graph.
|
boolean |
hasInputSlot(String slotName)
Returns true if the algorithm contains an input slot with given name.
|
boolean |
hasOutputSlot(String slotName)
Returns true if the algorithm contains an output slot with given name.
|
boolean |
isBookmarked() |
boolean |
isParameterUIVisible(JIPipeParameterTree tree,
JIPipeParameterAccess access)
Allows to override the visibility of parameters inside the UI
|
boolean |
isUiLocked() |
boolean |
isVisibleIn(UUID compartmentUUIDInGraph) |
protected void |
onDeserialized(com.fasterxml.jackson.databind.JsonNode node,
JIPipeValidationReport issues,
JIPipeNotificationInbox notifications)
Override this method to add operations to be run after deserialization from JSON
|
void |
onParameterChanged(JIPipeParameterCollection.ParameterChangedEvent event)
Triggered when a parameter is changed within the slot configuration.
|
void |
onSlotConfigurationChanged(JIPipeSlotConfiguration.SlotConfigurationChangedEvent event)
Should be triggered when a slot is added to the slot configuration
|
boolean |
renderInputSlots()
Controls whether to render input slots.
|
boolean |
renderOutputSlots()
Controls whether to render output slots.
|
abstract void |
run(JIPipeGraphNodeRunContext runContext,
JIPipeProgressInfo progressInfo)
Runs the workload
|
void |
setBaseDirectory(Path baseDirectory)
Sets the current work directory of this algorithm.
|
void |
setBookmarked(boolean bookmarked) |
void |
setCustomDescription(HTMLText customDescription)
Sets a custom description.
|
void |
setCustomName(String customName)
Sets a custom name.
|
void |
setInfo(JIPipeNodeInfo info)
Sets the
JIPipeNodeInfo that describes this algorithm. |
void |
setInternalStoragePath(Path internalStoragePath)
Sets the internal storage path relative to the output folder.
|
void |
setNodeUILocationPerViewModePerCompartment(Map<String,Map<String,Point>> nodeUILocationPerViewModePerCompartment)
Sets the location map.
|
void |
setNodeUILocationWithin(String compartment,
Point location,
String visualMode)
Sets the UI location of this algorithm within the specified compartment
|
void |
setNodeUILocationWithin(UUID compartment,
Point location,
String visualMode)
Sets the UI location of this algorithm within the specified compartment
|
void |
setParentGraph(JIPipeGraph parentGraph)
Sets the graph this algorithm is location in.
|
void |
setProjectDirectory(Path projectDirectory)
Sets the project directory.
|
void |
setRuntimeProject(JIPipeProject runtimeProject)
Sets the current project associated with the current run
|
void |
setScratchBaseDirectory(Path scratchBaseDirectory)
Sets the scratch base directory of the current run.
|
void |
setSlotConfiguration(JIPipeSlotConfiguration slotConfiguration) |
void |
setStoragePath(Path storagePath)
Sets the storage path.
|
void |
setUiLocked(boolean uiLocked) |
void |
toggleSlot(JIPipeDataSlotInfo info,
boolean toggle)
Toggles a slot with given info on/off.
|
void |
toJson(com.fasterxml.jackson.core.JsonGenerator jsonGenerator)
Saves this algorithm to JSON.
|
void |
updateGraphNodeSlots()
Synchronizes the slots with the slot definition
|
getParameterChangedEventEmitter, getParameterStructureChangedEventEmitter, getParameterUIChangedEventEmitter, onParameterStructureChanged, onParameterUIChanged, registerSubParameter, registerSubParameters
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
generateValidityReport, reportValidity
onParameterUIChanged
onParameterStructureChanged
deserializeFromJsonNode, emitParameterChangedEvent, emitParameterStructureChangedEvent, emitParameterUIChangedEvent, getContextActions, getParameter, getParameterAccess, installUIOverrideParameterEditor, installUIParameterOptions, isParameterUIVisible, serializeToJsonFile, serializeToJsonGenerator, serializeToJsonString, setParameter
public JIPipeGraphNode(JIPipeNodeInfo info, JIPipeSlotConfiguration slotConfiguration)
info
- Contains algorithm metadataslotConfiguration
- if null, generate the slot configuration automatically. Prefers the creation of slots via annotations. Alternatively, slots can also be created via the node infopublic JIPipeGraphNode(JIPipeNodeInfo info)
info
- The algorithm infopublic JIPipeGraphNode(JIPipeGraphNode other)
other
- Copied algorithmpublic JIPipeGraphNode.NodeSlotsChangedEventEmitter getNodeSlotsChangedEventEmitter()
public JIPipeGraphNode.BaseDirectoryChangedEventEmitter getBaseDirectoryChangedEventEmitter()
public void updateGraphNodeSlots()
protected JIPipeSlotConfiguration copySlotConfiguration(JIPipeGraphNode other)
other
- Copied slot configurationpublic abstract void run(JIPipeGraphNodeRunContext runContext, JIPipeProgressInfo progressInfo)
runContext
- the context of the run processprogressInfo
- progress passed from the runnerpublic String getName()
public boolean isUiLocked()
public void setUiLocked(boolean uiLocked)
public String getCustomName()
public void setCustomName(String customName)
customName
- custom namepublic boolean isParameterUIVisible(JIPipeParameterTree tree, JIPipeParameterAccess access)
JIPipeParameterCollection
isParameterUIVisible
in interface JIPipeParameterCollection
tree
- the parameter tree that is used to access this parameteraccess
- the parameterpublic boolean isBookmarked()
public void setBookmarked(boolean bookmarked)
public JIPipeNodeTypeCategory getCategory()
public JIPipeSlotConfiguration getSlotConfiguration()
public void setSlotConfiguration(JIPipeSlotConfiguration slotConfiguration)
public Map<String,JIPipeInputDataSlot> getInputSlotMap()
public Map<String,JIPipeOutputDataSlot> getOutputSlotMap()
public List<String> getInputSlotOrder()
public List<JIPipeInputDataSlot> getInputSlots()
public List<JIPipeInputDataSlot> getDataInputSlots()
public List<JIPipeOutputDataSlot> getOutputSlots()
public void onParameterChanged(JIPipeParameterCollection.ParameterChangedEvent event)
JIPipeGraphNode.NodeSlotsChangedEvent
onParameterChanged
in interface JIPipeParameterCollection.ParameterChangedEventListener
onParameterChanged
in class AbstractJIPipeParameterCollection
event
- generated eventpublic void onSlotConfigurationChanged(JIPipeSlotConfiguration.SlotConfigurationChangedEvent event)
onSlotConfigurationChanged
in interface JIPipeSlotConfiguration.SlotConfigurationChangedEventListener
event
- The eventpublic boolean functionallyEquals(Object other)
JIPipeNodeInfo
is equalfunctionallyEquals
in interface JIPipeFunctionallyComparable
other
- the other nodepublic Map<String,Map<String,Point>> getNodeUILocationPerViewModePerCompartment()
public void setNodeUILocationPerViewModePerCompartment(Map<String,Map<String,Point>> nodeUILocationPerViewModePerCompartment)
nodeUILocationPerViewModePerCompartment
- map from compartment UUID to visual mode to locationpublic Point getNodeUILocationWithin(String compartment, String visualMode)
compartment
- The compartment ID. Set to empty string for no compartment.visualMode
- Used to differentiate between different visual modespublic void setNodeUILocationWithin(String compartment, Point location, String visualMode)
compartment
- The compartment ID. Set to empty string for no compartment.location
- The UI location. Can be null to reset the locationvisualMode
- Used to differentiate between different visual modespublic void setNodeUILocationWithin(UUID compartment, Point location, String visualMode)
compartment
- The compartment IDlocation
- The UI location. Can be null to reset the locationvisualMode
- Used to differentiate between different visual modespublic void toJson(com.fasterxml.jackson.core.JsonGenerator jsonGenerator) throws IOException, com.fasterxml.jackson.core.JsonProcessingException
jsonGenerator
- the JSON generatorcom.fasterxml.jackson.core.JsonProcessingException
- thrown by JSON methodsIOException
public void fromJson(com.fasterxml.jackson.databind.JsonNode node, JIPipeValidationReportContext context, JIPipeValidationReport issues, JIPipeNotificationInbox notifications)
node
- The JSON data to load fromcontext
- the contextissues
- issues during deserializing. these should be severe issues (missing parameters etc.). if you want to notify the user about potential issues that can be acted upon, use the notification inboxnotifications
- additional notifications for the user. these can be acted uponprotected void onDeserialized(com.fasterxml.jackson.databind.JsonNode node, JIPipeValidationReport issues, JIPipeNotificationInbox notifications)
node
- the JSON node where the data was loadedissues
- issues during deserialization. if you want to notify the user about potential issues that can be acted upon, use the notification inboxnotifications
- additional notifications for the user. these can be acted uponpublic Path getStoragePath()
JIPipeGraphRun
to indicate where output data is written
This is only used internallypublic void setStoragePath(Path storagePath)
JIPipeGraphRun
storagePath
- Storage pathpublic Path getInternalStoragePath()
JIPipeGraphRun
public void setInternalStoragePath(Path internalStoragePath)
JIPipeGraphRun
internalStoragePath
- Path relative to the output folderpublic JIPipeNodeInfo getInfo()
JIPipeNodeInfo
that describes this algorithmpublic void setInfo(JIPipeNodeInfo info)
JIPipeNodeInfo
that describes this algorithm.
Please note that this function can be very dangerous and break everything.
This will affect how JIPipe (and especially the UI) handles this algorithm.
A use case is to convert algorithms from internal representations to their public variants (e.g. JIPipeProjectCompartmentOutput
to IOInterfaceAlgorithm
info
- the infopublic JIPipeOutputDataSlot getOutputSlot(String name)
NullPointerException
if the slot does not exist and IllegalArgumentException
if the slot is not an outputname
- Slot namepublic JIPipeInputDataSlot getInputSlot(String name)
NullPointerException
if the slot does not exist and IllegalArgumentException
if the slot is not an inputname
- Slot namepublic List<JIPipeInputDataSlot> getOpenInputSlots()
public List<JIPipeInputDataSlot> getInputSlotsWithRole(JIPipeDataSlotRole role)
role
- the rolepublic List<JIPipeOutputDataSlot> getOutputSlotsWithRole(JIPipeDataSlotRole role)
role
- the rolepublic JIPipeOutputDataSlot getFirstOutputSlot()
IndexOutOfBoundsException
if there is no output slot.public JIPipeInputDataSlot getFirstInputSlot()
IndexOutOfBoundsException
if there is no input slot.public JIPipeOutputDataSlot getLastOutputSlot()
IndexOutOfBoundsException
if there is no output slot.public JIPipeInputDataSlot getLastInputSlot()
IndexOutOfBoundsException
if there is no input slot.public JIPipeGraph getParentGraph()
public void setParentGraph(JIPipeGraph parentGraph)
parentGraph
- Graph instance or nullpublic UUID getUUIDInParentGraph()
public UUID getCompartmentUUIDInParentGraph()
public void clearLocations()
public HTMLText getCustomDescription()
public void setCustomDescription(HTMLText customDescription)
customDescription
- Description stringpublic JIPipeProject getRuntimeProject()
public void setRuntimeProject(JIPipeProject runtimeProject)
runtimeProject
- the projectpublic Path getProjectDirectory()
public void setProjectDirectory(Path projectDirectory)
projectDirectory
- the project directory. can be null.public Path getBaseDirectory()
public void setBaseDirectory(Path baseDirectory)
JIPipeGraphNode.BaseDirectoryChangedEvent
that can be received by JIPipeDataSlot
instances to adapt to the work directory.baseDirectory
- The work directory. Can be nullpublic void archiveTo(JIPipeWriteDataStorage projectStorage, JIPipeWriteDataStorage wrappedExternalStorage, JIPipeProgressInfo progressInfo, Path originalBaseDirectory)
projectStorage
- the storage where the data will be archived. storage where the project itself is located.wrappedExternalStorage
- storage where wrapped external files are putprogressInfo
- the progress infooriginalBaseDirectory
- current project directorypublic Path getScratchBaseDirectory()
public void setScratchBaseDirectory(Path scratchBaseDirectory)
scratchBaseDirectory
- the scratch base directorypublic Path getNewScratch()
public void emitNodeSlotsChangedEvent()
public Set<JIPipeDependency> getDependencies()
public void clearSlotData(boolean force, JIPipeProgressInfo progressInfo)
force
- if true, close all data storesprogressInfo
- the progress infopublic JIPipeGraphNode duplicate()
public boolean canUserDelete()
public boolean hasInputSlot(String slotName)
slotName
- the slot namepublic boolean hasOutputSlot(String slotName)
slotName
- the slot namepublic boolean renderInputSlots()
public boolean renderOutputSlots()
public boolean isVisibleIn(UUID compartmentUUIDInGraph)
public String getCompartmentDisplayName()
public String getDisplayName()
public String getCompartmentUUIDInGraphAsString()
public void getEnvironmentDependencies(List<JIPipeEnvironment> target)
target
- the list where the external environments will be gatheredpublic String getAliasIdInParentGraph()
public JIPipeProjectCompartment getProjectCompartment()
public void toggleSlot(JIPipeDataSlotInfo info, boolean toggle)
JIPipeMutableSlotConfiguration
info
- the slot infotoggle
- if the slot should be presentpublic ImageIcon getUIInputSlotIcon(String slotName)
slotName
- the slot namepublic void createUIInputSlotIconDescriptionMenuItems(String slotName, List<ViewOnlyMenuItem> target)
slotName
- the slot nametarget
- the list of menu itemspublic Map<String,Path> getProjectDataDirs()
public Dimension getUIInputSlotIconBaseDimensions(String slotName)
slotName
- the slot namepublic void getTextDescription(StringBuilder stringBuilder)
stringBuilder
- the string builderpublic JIPipeProject getProject()
Copyright © 2020–2025 Leibniz Institute for Natural Product Research and Infection Biology - Hans Knöll Institute (HKI). All rights reserved.