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

java.lang.Object
  extended by org.knime.core.node.AbstractNodeView<T>
Type Parameters:
T - the implementation of the NodeModel this node view is based on
Direct Known Subclasses:
ExternalApplicationNodeView, NodeView

public abstract class AbstractNodeView<T extends NodeModel>
extends Object

Abstract implementation of a node view. A node view is the visual component to a node, displaying a computed result (or the ongoing computation).

Note:Concrete implementations do not inherit from this class directly but extend from NodeView. Nodes that open an external application extend from ExternalApplicationNodeView.

Author:
Bernd Wiswedel, University of Konstanz

Constructor Summary
AbstractNodeView(T nodeModel)
          Creates new view.
 
Method Summary
(package private) abstract  void callCloseView()
          Called from closeView() to close the view and release all allocated resources.
(package private)  void callModelChanged()
          Called from the model that something has changed.
(package private) abstract  void callOpenView(String title)
          Direct(!) subclasses override this method and open the view or frame.
(package private)  void closeView()
          Closes the view and disposes all allocated resources.
 NodeLogger getLogger()
          Get reference to logger, never null.
protected  T getNodeModel()
          Get reference to underlying NodeModel, never null.
(package private)  String getViewName()
           
protected abstract  void modelChanged()
          Method is invoked when the underlying NodeModel has changed.
(package private)  void openView(String title)
          Called from the framework to open a new view or bring an existing view to front.
protected  void updateModel(Object arg)
          This method can be overridden by views that want to receive events from their assigned models via the NodeModel.notifyViews(Object) method.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractNodeView

AbstractNodeView(T nodeModel)
Creates new view. This constructor keeps the node model reference and instantiates the logger.

Parameters:
nodeModel - The underlying node model.
Throws:
NullPointerException - If the nodeModel is null.
Method Detail

getNodeModel

protected T getNodeModel()
Get reference to underlying NodeModel, never null.

Returns:
NodeModel reference.

getLogger

public NodeLogger getLogger()
Get reference to logger, never null. The logger is customized with an appropriate name (currently the runtime class of the view).

Returns:
reference to logger

callModelChanged

void callModelChanged()
Called from the model that something has changed. It calls the abstract method 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.


modelChanged

protected abstract void modelChanged()
Method is invoked when the underlying NodeModel has changed. Also the HiLightHandler have changed. Note, the NodeModel content may be not available. Be sure to modify GUI components in the EventDispatchThread only.


updateModel

protected void updateModel(Object arg)
This method can be overridden by views that want to receive events from their assigned models via the NodeModel.notifyViews(Object) method. Can be used to iteratively update the view during execute.

Parameters:
arg - The argument that is provided in the notifyViews method.

openView

final void openView(String title)
Called from the framework to open a new view or bring an existing view to front. The title serves as default view name and should be shown in the view title bar if possible. This method must be called at most once per view instance!

Parameters:
title - The view title.
See Also:
closeView()

callOpenView

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

Parameters:
title - the default title of the view. It should be shown in the view title bar (if at all possible).

closeView

void closeView()
Closes the view and disposes all allocated resources. The view is not meant to be opened again. This method is the counterpart to openView(String). (Core) Sub-classes may widen the scope of this method.


callCloseView

abstract void callCloseView()
Called from closeView() to close the view and release all allocated resources. The view will not be opened again.


getViewName

String getViewName()
Returns:
the viewName as set in the openView(String) method.


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.