org.knime.core.node.port
Class AbstractSimplePortObjectSpec

java.lang.Object
  extended by org.knime.core.node.port.AbstractSimplePortObjectSpec
All Implemented Interfaces:
PortObjectSpec
Direct Known Subclasses:
NaiveBayesPortObjectSpec, SotaPortObjectSpec

public abstract class AbstractSimplePortObjectSpec
extends Object
implements PortObjectSpec

Abstract implementation of basic port object specs that save and load themselves from ModelContentRO objects. This class should be used in cases where the content of a model can be easily broke up into basic types (such as String, int, double, ...) and array of those.

Subclasses must provide an empty no-arg constructor with public scope (which will be used to restore the content). The do not need to provide a static serializer method as required by the interface PortObjectSpec.

Author:
Bernd Wiswedel, University of Konstanz

Nested Class Summary
 
Nested classes/interfaces inherited from interface org.knime.core.node.port.PortObjectSpec
PortObjectSpec.PortObjectSpecSerializer<T extends PortObjectSpec>
 
Constructor Summary
AbstractSimplePortObjectSpec()
          Public no-arg constructor.
 
Method Summary
 boolean equals(Object ospec)
          
static PortObjectSpec.PortObjectSpecSerializer<AbstractSimplePortObjectSpec> getPortObjectSpecSerializer()
          Abstract serializer method as required by interface PortObjectSpec.
 JComponent[] getViews()
          The returned views are displayed in the out port view of the referring node.
 int hashCode()
          
protected abstract  void load(ModelContentRO model)
          Loads the content into the freshly instantiated object.
protected abstract  void save(ModelContentWO model)
          Saves this object to model content object.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractSimplePortObjectSpec

public AbstractSimplePortObjectSpec()
Public no-arg constructor. Subclasses must also provide such a constructor in order to allow the serializer to instantiate them using reflection.

Method Detail

getPortObjectSpecSerializer

public static final PortObjectSpec.PortObjectSpecSerializer<AbstractSimplePortObjectSpec> getPortObjectSpecSerializer()
Abstract serializer method as required by interface PortObjectSpec.

Returns:
A serializer that reads/writes any implementation of this class.

save

protected abstract void save(ModelContentWO model)
Saves this object to model content object.

Parameters:
model - To save to.

load

protected abstract void load(ModelContentRO model)
                      throws InvalidSettingsException
Loads the content into the freshly instantiated object. This method is called at most once in the life time of the object (after the serializer has created a new object using the public no-arg constructor.)

Parameters:
model - To load from.
Throws:
InvalidSettingsException - If settings are incomplete/deficient.

getViews

public JComponent[] getViews()
The returned views are displayed in the out port view of the referring node. Each component is displayed in an extra tab. The name of the component is used as the title for the tab. It is important that no external members are kept in the component so it can be deleted, when the port object is deleted. If the port object has no view return an empty array.

Specified by:
getViews in interface PortObjectSpec
Returns:
an array of views for the port object spec, each displayed as a tab in the out port view

equals

public boolean equals(Object ospec)

Overrides:
equals in class Object

hashCode

public int hashCode()

Overrides:
hashCode in class Object


Copyright, 2003 - 2010. All rights reserved.
University of Konstanz, Germany.
Chair for Bioinformatics and Information Mining, Prof. Dr. Michael R. Berthold.
You may not modify, publish, transmit, transfer or sell, reproduce, create derivative works from, distribute, perform, display, or in any way exploit any of the content, in whole or in part, except as otherwise expressly permitted in writing by the copyright owner or as specified in the license file distributed with this product.