org.knime.base.node.io.filereader
Class VariableFileReaderNodeDialog

java.lang.Object
  extended by org.knime.core.node.NodeDialogPane
      extended by org.knime.base.node.io.filereader.VariableFileReaderNodeDialog
All Implemented Interfaces:
ItemListener, EventListener

public class VariableFileReaderNodeDialog
extends NodeDialogPane
implements ItemListener

Author:
ohl, University of Konstanz

Constructor Summary
VariableFileReaderNodeDialog()
          Creates a new file reader dialog pane.
 
Method Summary
protected  void advancedSettings()
          Called when the user presses the "Advanced Settings..." button.
protected  void analyzeAction()
          triggers analysis.
protected  void analyzeDataFileAndUpdatePreview(boolean forceAnalyze)
          Updates the preview table, if a new and valid URL was specified in the data file name text field or the force parameter is set true.
protected  void colHeadersSettingsChanged()
          Reads the settings of the 'fileHasColHeaders' checkbox and transfers them into the internal settings object.
protected  void commentSettingsChanged()
          Called whenever the Java-Style comment box is clickered.
protected  void delimSettingsChanged()
          Reads the settings of the column delimiter box and transfers them into the internal settings object.
protected  void ignoreWSChanged()
          The item changed listener to the 'ignore whitespaces' check box.
 void itemStateChanged(ItemEvent e)
          This dialog implements the ItemListener for the file selection combo box.
protected  void loadSettingsFrom(NodeSettingsRO settings, PortObjectSpec[] specs)
          Invoked before the dialog window is opened.
protected  void rowHeadersSettingsChanged()
          Reads the settings of the 'fileHasRowHeaders' checkbox and transfers them into the internal settings object.
protected  void saveSettingsTo(NodeSettingsWO settings)
          Invoked when the settings need to be applied.
protected  void setNewUserSettingsForColumn(int colIdx)
          Pops open the dialog of the columnProperties object of the specified column.
(package private) static URL textToURL(String url)
          Tries to create an URL from the passed string.
protected  void waitForAnalyzeAction()
          If no analysis is running it triggers one and waits until its done, otherwise it just waits for the running analysis to finish.
 
Methods inherited from class org.knime.core.node.NodeDialogPane
addJobMgrTab, addTab, addTabAt, createFlowVariableModel, createFlowVariableModel, createFlowVariableModel, finishEditingAndSaveSettingsTo, getAvailableFlowVariables, getPanel, getTab, getTabIndex, internalLoadSettingsFrom, loadSettingsFrom, loadSettingsFrom, onCancel, onClose, onOpen, removeTab, renameTab, saveSettingsTo, setEnabled, setSelected
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

VariableFileReaderNodeDialog

VariableFileReaderNodeDialog()
Creates a new file reader dialog pane.

Method Detail

itemStateChanged

public void itemStateChanged(ItemEvent e)
This dialog implements the ItemListener for the file selection combo box. This way we can remove it when we load the file history in the drop down list (because this triggers a useless event), and add it afterwards again.

Specified by:
itemStateChanged in interface ItemListener
Parameters:
e - the event
See Also:
#itemStateChanged(java.awt.event.ItemEvent)

rowHeadersSettingsChanged

protected void rowHeadersSettingsChanged()
Reads the settings of the 'fileHasRowHeaders' checkbox and transfers them into the internal settings object.


colHeadersSettingsChanged

protected void colHeadersSettingsChanged()
Reads the settings of the 'fileHasColHeaders' checkbox and transfers them into the internal settings object.


ignoreWSChanged

protected void ignoreWSChanged()
The item changed listener to the 'ignore whitespaces' check box.


delimSettingsChanged

protected void delimSettingsChanged()
Reads the settings of the column delimiter box and transfers them into the internal settings object.


commentSettingsChanged

protected void commentSettingsChanged()
Called whenever the Java-Style comment box is clickered.


setNewUserSettingsForColumn

protected void setNewUserSettingsForColumn(int colIdx)
Pops open the dialog of the columnProperties object of the specified column. This will allow the user to enter new column name, type and missing value. Also changes the domain and 'read from file' flag.

Parameters:
colIdx - the index of the column to get new user settings for

loadSettingsFrom

protected void loadSettingsFrom(NodeSettingsRO settings,
                                PortObjectSpec[] specs)
                         throws NotConfigurableException
Invoked before the dialog window is opened. The settings object passed, contains the current settings of the corresponding node model. The model and the dialog must agree on a mutual contract on how settings are stored in the spec. I.e. they must able to read each other's settings.

The implementation must be able to handle invalid or incomplete settings as the model may not have any reasonable values yet (for example when the dialog is opened for the first time). When an empty/invalid settings object is passed the dialog should set default values in its components.

Overrides:
loadSettingsFrom in class NodeDialogPane
Parameters:
settings - The settings to load into the dialog. Could be an empty object or contain invalid settings. But will never be null.
specs - The input data table specs. Items of the array could be null if no spec is available from the corresponding input port.
Throws:
NotConfigurableException - if the dialog cannot be opened because of real invalid settings or if any preconditions are not fulfilled, e.g. no predecessor node, no nominal column in input table, etc.
See Also:
NodeModel.loadSettingsFrom(NodeSettingsRO)

saveSettingsTo

protected void saveSettingsTo(NodeSettingsWO settings)
                       throws InvalidSettingsException
Invoked when the settings need to be applied. The implementation should write the current user settings from its components into the passed object. It should not check consistency or completeness of the settings - this is part of the model's load method. The only situation this method would throw an exception is when a component contains an invalid value that can't be stored in the settings object.
The settings must be written in a way the model is able to load in, i.e. with the model's keys.

Specified by:
saveSettingsTo in class NodeDialogPane
Parameters:
settings - The settings object to write into.
Throws:
InvalidSettingsException - If the settings are not applicable to the model.
See Also:
NodeModel.loadSettingsFrom(NodeSettingsRO)

analyzeDataFileAndUpdatePreview

protected void analyzeDataFileAndUpdatePreview(boolean forceAnalyze)
Updates the preview table, if a new and valid URL was specified in the data file name text field or the force parameter is set true. It overrides all current settings with the settings from the file analyzer - except when the URL didn't changed and the user has explicitly set some values. For big files, it just shows a button to trigger analysis. The analysis runs in the background, and if it finishes it shows the new content of the file.

NOTE: May change the global settings object completely.

Parameters:
forceAnalyze - forces the analysis of the datafile even though it might be the one set in the global settings (and thus already being analyzed).

waitForAnalyzeAction

protected void waitForAnalyzeAction()
If no analysis is running it triggers one and waits until its done, otherwise it just waits for the running analysis to finish.


analyzeAction

protected void analyzeAction()
triggers analysis.


advancedSettings

protected void advancedSettings()
Called when the user presses the "Advanced Settings..." button.


textToURL

static URL textToURL(String url)
              throws MalformedURLException
Tries to create an URL from the passed string.

Parameters:
url - the string to transform into an URL
Returns:
URL if entered value could be properly tranformed, or
Throws:
MalformedURLException - if the value passed was invalid


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.