org.knime.core.node.defaultnodesettings
Class SettingsModelColumnName

java.lang.Object
  extended by org.knime.core.node.defaultnodesettings.SettingsModel
      extended by org.knime.core.node.defaultnodesettings.SettingsModelString
          extended by org.knime.core.node.defaultnodesettings.SettingsModelColumnName

public class SettingsModelColumnName
extends SettingsModelString

Extends the SettingsModelString to provide the useRowID() method to check if the RowID should be used instead of a column.

Author:
Tobias Koetter, University of Konstanz

Constructor Summary
SettingsModelColumnName(String configName, String defaultValue)
          Creates a new object holding a column name if the useRowID method returns false.
 
Method Summary
protected  SettingsModelColumnName createClone()
          
 String getColumnName()
           
protected  String getConfigName()
          
protected  void loadSettingsForDialog(NodeSettingsRO settings, PortObjectSpec[] specs)
          Read the value(s) of this settings model from configuration object.
protected  void loadSettingsForModel(NodeSettingsRO settings)
          Read value(s) of this settings model from the configuration object.
protected  void saveSettingsForDialog(NodeSettingsWO settings)
          Write value(s) of this component model to configuration object.
protected  void saveSettingsForModel(NodeSettingsWO settings)
          Write value(s) of this settings model to configuration object.
NOTE: Don't call this method directly, rather call saveSettingsTo.
 void setSelection(String columnName, boolean useRowID)
           
 boolean useRowID()
           
protected  void validateSettingsForModel(NodeSettingsRO settings)
          Read the expected values from the settings object, without assigning them to the internal variables! (Is not called when the model was disabled at the time the settings were saved.)
 
Methods inherited from class org.knime.core.node.defaultnodesettings.SettingsModelString
getModelTypeID, getStringValue, setStringValue, toString
 
Methods inherited from class org.knime.core.node.defaultnodesettings.SettingsModel
addChangeListener, createCloneWithValidatedValue, dlgLoadSettingsFrom, dlgSaveSettingsTo, isEnabled, loadSettingsFrom, notifyChangeListeners, prependChangeListener, removeChangeListener, saveSettingsTo, setEnabled, validateSettings
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

SettingsModelColumnName

public SettingsModelColumnName(String configName,
                               String defaultValue)
Creates a new object holding a column name if the useRowID method returns false. If the useRowID method returns true the user has selected the RowID.

Parameters:
configName - the identifier the value is stored with in the NodeSettings object
defaultValue - the initial value
Method Detail

createClone

protected SettingsModelColumnName createClone()

Overrides:
createClone in class SettingsModelString
Returns:
a new instance of the same object with identical state and value(s).

getConfigName

protected String getConfigName()

Overrides:
getConfigName in class SettingsModelString
Returns:
the name provided at settings model construction time. The id associated with the value.

setSelection

public void setSelection(String columnName,
                         boolean useRowID)
Parameters:
columnName - the selected column name
useRowID - true if the RowID should be used instead of a column

useRowID

public boolean useRowID()
Returns:
true if the RowID should be used instead of a column

getColumnName

public String getColumnName()
Returns:
the name of the column or null if the none column or the RowID column was selected. To check if the RowID column was selected call the useRowID() method.

validateSettingsForModel

protected void validateSettingsForModel(NodeSettingsRO settings)
                                 throws InvalidSettingsException
Read the expected values from the settings object, without assigning them to the internal variables! (Is not called when the model was disabled at the time the settings were saved.)

Overrides:
validateSettingsForModel in class SettingsModelString
Parameters:
settings - the object to read the value(s) from
Throws:
InvalidSettingsException - if the value(s) in the settings object are invalid.

saveSettingsForDialog

protected void saveSettingsForDialog(NodeSettingsWO settings)
                              throws InvalidSettingsException
Write value(s) of this component model to configuration object. Called only from within the components using this model.
NOTE: Don't call this method directly, rather use dlgSaveSettingsTo.

Overrides:
saveSettingsForDialog in class SettingsModelString
Parameters:
settings - The NodeSettings to read from.
Throws:
InvalidSettingsException - if the user has entered wrong values.

saveSettingsForModel

protected void saveSettingsForModel(NodeSettingsWO settings)
Write value(s) of this settings model to configuration object.
NOTE: Don't call this method directly, rather call saveSettingsTo.

Overrides:
saveSettingsForModel in class SettingsModelString
Parameters:
settings - The NodeSettings to write into.

loadSettingsForDialog

protected void loadSettingsForDialog(NodeSettingsRO settings,
                                     PortObjectSpec[] specs)
                              throws NotConfigurableException
Read the value(s) of this settings model from configuration object. If the value is not stored in the config, the objects value must remain unchanged. Called only from within the components using this model. If the model is disabled it should not throw the exception.
This method must always notify change listeners!!
NOTE: Do not call this method directly, rather call dlgLoadSettingsFrom

Overrides:
loadSettingsForDialog in class SettingsModelString
Parameters:
settings - The NodeSettings to read from.
specs - The input specs.
Throws:
NotConfigurableException - if the specs are not good enough to

loadSettingsForModel

protected void loadSettingsForModel(NodeSettingsRO settings)
                             throws InvalidSettingsException
Read value(s) of this settings model from the configuration object. If the value is not stored in the config, an exception will be thrown.
NOTE: Don't call this method directly, rather call loadSettingsFrom.

Overrides:
loadSettingsForModel in class SettingsModelString
Parameters:
settings - The NodeSettings to read from.
Throws:
InvalidSettingsException - if load fails.


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.