org.knime.core.node
Class NodeView<T extends NodeModel>

java.lang.Object
  extended by org.knime.core.node.AbstractNodeView<T>
      extended by org.knime.core.node.NodeView<T>
Type Parameters:
T - the implementation of the NodeModel this node view is based on
All Implemented Interfaces:
EventListener, NodeModelWarningListener
Direct Known Subclasses:
AccuracyScorerNodeView, BasisFunctionLearnerNodeView, BinModelNodeView, BitVectorGeneratorView, BoxPlotNodeView, ClusterNodeView, ConditionalBoxPlotNodeView, DecTreeNodeView, DecTreePredictorNodeView, DefaultVisualizationNodeView, EnrichmentPlotterView, EntropyNodeView, ExtToolOutputNodeView, FixedColumnHistogramNodeView, FuzzyClusterNodeView, HiLiteCollectorNodeView, HistogramNodeView, InterruptibleNodeView, LiftChartNodeView, LinRegLearnerNodeView, NaiveBayesLearnerNodeView, PieNodeView, PMCCNodeView, PolyRegCoefficientView, PolyRegLineNodeView, ROCNodeView, RPropNodeView, SotaNodeView, Statistics2NodeView, SVMLearnerNodeView, TableNodeView

public abstract class NodeView<T extends NodeModel>
extends AbstractNodeView<T>
implements NodeModelWarningListener

Node view class that displays the view content in an AWT-frame. The part specific to the special purpose node view must be implemented in the derived class and must be placed in a panel. This panel is registered in this base class (method setComponent(Component)and will be displayed in the JFrame provided and handled by this class.

Author:
Thomas Gabriel, University of Konstanz

Field Summary
static Color COLOR_BACKGROUND
          Default background color.
static String PROP_CHANGE_CLOSE
          This class sends property events when the status changes.
 
Constructor Summary
protected NodeView(T nodeModel)
          Create a new view for a given (non-null) model.
 
Method Summary
 void callCloseView()
          Called by the node when it is deleted or by the "close" button.
(package private)  void callModelChanged()
          Called from the model that something has changed.
(package private)  void callOpenView(String title)
          Direct(!) subclasses override this method and open the view or frame.
 void closeView()
          Deprecated. Will be removed without replacement in future versions of KNIME. Sub-classes should not be required to programmatically close views.
 JFrame createFrame(String viewTitle)
          Deprecated. This method will be removed without replacement in future versions of KNIME as client code should not be required to open views.
protected  Component getComponent()
          Returns the underlying content pane's panel placed at the center of the view.
 JMenuBar getJMenuBar()
          Returns menu bar of the accompanying frame.
 String getViewTitle()
           
protected  boolean isOpen()
           
protected abstract  void onClose()
          Invoked when the window is about to be closed.
protected abstract  void onOpen()
          Invoked when the window has been opened.
 Component openViewComponent()
          Deprecated. Will be removed without replacement in future versions of KNIME.
protected  void setComponent(Component comp)
          Sets the panel of the view's content pane center area.
protected  void setShowNODATALabel(boolean showIt)
          Sets the property if the "no data" label is shown when the underlying node is not executed but the view is shown (replaces whatever has been set by #setComponent(Component).
protected  void setViewTitleSuffix(String suffix)
          Append this suffix to the current view name.
 void warningChanged(String warning)
          Called when the NodeModel warning changes.
 
Methods inherited from class org.knime.core.node.AbstractNodeView
getLogger, getNodeModel, getViewName, modelChanged, openView, updateModel
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

COLOR_BACKGROUND

public static final Color COLOR_BACKGROUND
Default background color.


PROP_CHANGE_CLOSE

public static final String PROP_CHANGE_CLOSE
This class sends property events when the status changes.

See Also:
Constant Field Values
Constructor Detail

NodeView

protected NodeView(T nodeModel)
Create a new view for a given (non-null) model. Subclasses will initialize all view components in the their constructor and set it by calling setComponent(Component).

This constructor creates the frame and the default menu bar.

Parameters:
nodeModel - The underlying node model.
Throws:
NullPointerException - If the nodeModel is null.
See Also:
setComponent(Component)
Method Detail

setShowNODATALabel

protected final void setShowNODATALabel(boolean showIt)
Sets the property if the "no data" label is shown when the underlying node is not executed but the view is shown (replaces whatever has been set by #setComponent(Component). Once the node is executed the user panel is shown again.

Parameters:
showIt - true for replace the current view, false always show the real view.

callModelChanged

final void callModelChanged()
Called from the model that something has changed. It calls the abstract method AbstractNodeView.modelChanged().

This method is called when the node makes state transitions that affect the node model content, i.e. after execute or reset or when the highlight handler has changed.

Overrides:
callModelChanged in class AbstractNodeView<T extends NodeModel>

onClose

protected abstract void onClose()
Invoked when the window is about to be closed. Unregister HiLiteListeners. Dispose internal members.
This method is the first to be called on a close request (right after the view is unregistered from the NodeModel


onOpen

protected abstract void onOpen()
Invoked when the window has been opened. Register property listeners.
This method is called last on view construction - right before the components are made visible. It is not called on re-opening.


getJMenuBar

public final JMenuBar getJMenuBar()
Returns menu bar of the accompanying frame.

Returns:
menu bar.

callOpenView

final void callOpenView(String title)
Direct(!) subclasses override this method and open the view or frame. This method is called from AbstractNodeView.openView(String) and is called at most once.

Specified by:
callOpenView in class AbstractNodeView<T extends NodeModel>
Parameters:
title - the default title of the view. It should be shown in the view title bar (if at all possible).

closeView

@Deprecated
public final void closeView()
Deprecated. Will be removed without replacement in future versions of KNIME. Sub-classes should not be required to programmatically close views.

Closes the view programmatically. Sub-classes should not call this method as view closing is task of the framework. This method is public for historical reasons and will be removed in upcoming versions.

Overrides:
closeView in class AbstractNodeView<T extends NodeModel>

callCloseView

public final void callCloseView()
Called by the node when it is deleted or by the "close" button. Disposes the frame.

Calls the onClose method and unregisters this view from the model. If you derive this class, do not call this method. It's being used by the framework (if views are shown within a JFrame) or by eclipse (if available, i.e. when views are embedded in eclipse).

Specified by:
callCloseView in class AbstractNodeView<T extends NodeModel>

openViewComponent

@Deprecated
public final Component openViewComponent()
Deprecated. Will be removed without replacement in future versions of KNIME.

Initializes all view components and returns the view's content pane. If you derive this class, do not call this method. It's being used by the framework (if views are shown within a JFrame) or by eclipse (if available, i.e. when views are embedded in eclipse)

Returns:
The view's content pane.
See Also:
getComponent()

createFrame

@Deprecated
public final JFrame createFrame(String viewTitle)
Deprecated. This method will be removed without replacement in future versions of KNIME as client code should not be required to open views.

Opens the new view. Subclasses should not be required to open views programmatically. Opening is done via the framework and dedicated user actions.

Parameters:
viewTitle - the tile for this view
Returns:
a JFrame with an initialized NodeView

isOpen

protected final boolean isOpen()
Returns:
Checks whether the view is open or not.

setViewTitleSuffix

protected final void setViewTitleSuffix(String suffix)
Append this suffix to the current view name. If suffix is null the title does not change.

Parameters:
suffix - append this suffix to the current view name

getViewTitle

public final String getViewTitle()
Returns:
The current view's title.

getComponent

protected final Component getComponent()
Returns the underlying content pane's panel placed at the center of the view.

Returns:
panel of the view's center area.

setComponent

protected final void setComponent(Component comp)
Sets the panel of the view's content pane center area. Register your Component that implements the functionality of the derived class with this function. The foreground and background colors of your panel are set to the default colors defined in this class.

Parameters:
comp - Component to set in the center of the view.

warningChanged

public void warningChanged(String warning)
Called when the NodeModel warning changes.

Specified by:
warningChanged in interface NodeModelWarningListener
Parameters:
warning - new warning


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.