org.knime.core.node.workflow
Class NodeUIInformation

java.lang.Object
  extended by org.knime.core.node.workflow.NodeUIInformation
All Implemented Interfaces:
Cloneable, UIInformation

public class NodeUIInformation
extends Object
implements UIInformation

Special NodeExtraInfo object used by the workflow editor. Basically this stores the visual bounds of the node in the workflow editor pane. Note: To be independent of draw2d/GEF this doesn't use the "natural" Rectangle object, but simply stores an int[]. TODO This needs to be in "core", as by now the WFM tries to make instances of this class while load()ing. see org.eclipse.draw2d.geometry.Rectangle

Author:
Florian Georg, University of Konstanz

Constructor Summary
NodeUIInformation()
          Creates new object, the bounds to be set are assumed to be absolute (m_isInitialized is true).
NodeUIInformation(int x, int y, int width, int height, boolean absoluteCoords)
          Inits new node figure with given coordinates.
 
Method Summary
 NodeUIInformation clone()
          UIInformation objects are cloneable without further restriction.
 NodeUIInformation createNewWithOffsetPosition(int[] moveDist)
          Changes the position by setting the bounds left top corner according to the given moving distance.
 int[] getBounds()
           
 boolean hasAbsoluteCoordinates()
           
 boolean isFilledProperly()
          Returns if the loaded UI information is complete.
 void load(NodeSettingsRO conf)
          Reads the information from the NodeSettings object.
 void save(NodeSettingsWO config)
          Stores all contained information into the given configuration.
 void setNodeLocation(int x, int y, int w, int h)
          Sets the location.
 String toString()
          
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

NodeUIInformation

public NodeUIInformation()
Creates new object, the bounds to be set are assumed to be absolute (m_isInitialized is true).


NodeUIInformation

public NodeUIInformation(int x,
                         int y,
                         int width,
                         int height,
                         boolean absoluteCoords)
Inits new node figure with given coordinates.

Parameters:
x - x coordinate
y - y coordinate
width - width of figure
height - height of figure
absoluteCoords - If the coordinates are absolute.
Method Detail

save

public void save(NodeSettingsWO config)
Stores all contained information into the given configuration.

Specified by:
save in interface UIInformation
Parameters:
config - The configuration to write the current settings into.
See Also:
UIInformation.load(org.knime.core.node.NodeSettingsRO)

load

public void load(NodeSettingsRO conf)
          throws InvalidSettingsException
Reads the information from the NodeSettings object.

Specified by:
load in interface UIInformation
Parameters:
conf - Retrieve the data from.
Throws:
InvalidSettingsException - If the required keys are not available in the NodeSettings.
See Also:
UIInformation.save(org.knime.core.node.NodeSettingsWO)

isFilledProperly

public boolean isFilledProperly()
Returns if the loaded UI information is complete.

Returns:
true if it is filled properly, false otherwise

hasAbsoluteCoordinates

public boolean hasAbsoluteCoordinates()
Returns:
the hasAbsoluteCoordinates (transient) field

setNodeLocation

public void setNodeLocation(int x,
                            int y,
                            int w,
                            int h)
Sets the location. *

Parameters:
x - x-coordinate
y - y-coordinate
w - width
h - height

getBounds

public int[] getBounds()
Returns:
Returns a clone of the bounds.

createNewWithOffsetPosition

public NodeUIInformation createNewWithOffsetPosition(int[] moveDist)
Changes the position by setting the bounds left top corner according to the given moving distance.

Parameters:
moveDist - the distance to change the left top corner
Returns:
A clone of this ui information, whereby its x,y coordinates are shifted by the argument values.

clone

public NodeUIInformation clone()
UIInformation objects are cloneable without further restriction.

Specified by:
clone in interface UIInformation
Overrides:
clone in class Object
Returns:
a clone of this object

toString

public String toString()

Overrides:
toString 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.