at.tuwien.ifs.somtoolbox.apps.viewer
Class GeneralUnitPNode

java.lang.Object
  extended by edu.umd.cs.piccolo.PNode
      extended by at.tuwien.ifs.somtoolbox.apps.viewer.GeneralUnitPNode
All Implemented Interfaces:
Printable, Serializable, Cloneable

public class GeneralUnitPNode
extends edu.umd.cs.piccolo.PNode

The graphical representation of one SOM Unit, including labels, data items and class pie charts. This class makes use of the Piccolo framework and is the top PNode for all unit-level visualisations. This PNode has one of the four child nodes, depending on the current zoom level of the SOMViewer application - DETAIL_LEVEL_NO, DETAIL_LEVEL_LOW, DETAIL_LEVEL_MEDIUM and DETAIL_LEVEL_HIGH. Each of the four different PNodes represents four different levels of information details displayed. Each those detail nodes has potentially other child nodes:

Version:
$Id: GeneralUnitPNode.java 3969 2010-12-15 13:17:22Z mayer $
Author:
Michael Dittenbach, Rudolf Mayer
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class edu.umd.cs.piccolo.PNode
edu.umd.cs.piccolo.PNode.PSceneGraphDelegate
 
Field Summary
private  ArrayList<ArrowPNode> arrowsFromThisUnit
           
private  Rectangle2D border
           
private  Color borderColor
           
private  BasicStroke borderStroke
           
private  SOMLibClassInformation classInfo
           
private  boolean classInfoSelectionChanged
           
private  int currentDetailLevel
           
private  double currentScale
           
static int DATA_DISPLAY_VARIANT_INPUTOBJECT
           
static int DATA_DISPLAY_VARIANT_INPUTOBJECTSHIFTED
           
static int DATA_DISPLAY_VARIANT_TEXT
           
static int DATA_DISPLAY_VARIANTS
           
private  edu.umd.cs.piccolo.PNode[] dataCountDetail
           
private  edu.umd.cs.piccolo.PNode[][][] dataDetail
          Data input nodes for different levels, length of NUMBER_OF_DETAIL_LEVELS, contains a PText at DATA_DISPLAY_VARIANT_TEXT, and InputPNodes at DATA_DISPLAY_VARIANT_INPUTOBJECT and DATA_DISPLAY_VARIANT_INPUTOBJECTSHIFTED.
private  SOMLibDataInformation dataInfo
           
static int DETAIL_LEVEL_HIGH
           
static int DETAIL_LEVEL_LOW
           
static int DETAIL_LEVEL_MEDIUM
           
static int DETAIL_LEVEL_NO
           
static String[] detailLevelNames
          Names for the different zoom/scale levels, corresponding to DETAIL_LEVEL_NO, DETAIL_LEVEL_LOW, ..
private  edu.umd.cs.piccolo.PNode[] detailNodes
          Nodes for details at different levels
private  boolean drawBorder
           
private static int[] FONT_SIZE_DATA
           
private static int[] FONT_SIZE_LABELS
           
private  double height
           
private  edu.umd.cs.piccolo.PNode[] labelDetailNodes
          Label nodes for different levels
private  Point[][] locations
           
private static int[] MAX_LABEL_LENGTH
           
private static int[] NUMBER_OF_COLUMNS
           
static int NUMBER_OF_DETAIL_LEVELS
           
private static int[] NUMBER_OF_LABELS
           
private  double oldScale
           
private  PieChartPNode[] pieChartDetailNodes
          PieChart nodes for different levels
private  edu.umd.cs.piccolo.nodes.PPath queryResultMarker
           
private  boolean selected
           
private  int[] selectedClassIndices
           
private  edu.umd.cs.piccolo.nodes.PPath selectionMarker
           
private static long serialVersionUID
           
private  boolean showOnlySelectedClasses
           
private  CommonSOMViewerStateData state
           
private  Unit u
           
private  double width
           
private  double X
           
private  double Y
           
 
Fields inherited from class edu.umd.cs.piccolo.PNode
PROPERTY_BOUNDS, PROPERTY_CHILDREN, PROPERTY_CHILDREN_PICKABLE, PROPERTY_CLIENT_PROPERTIES, PROPERTY_CODE_BOUNDS, PROPERTY_CODE_CHILDREN, PROPERTY_CODE_CHILDREN_PICKABLE, PROPERTY_CODE_CLIENT_PROPERTIES, PROPERTY_CODE_FULL_BOUNDS, PROPERTY_CODE_PAINT, PROPERTY_CODE_PARENT, PROPERTY_CODE_PICKABLE, PROPERTY_CODE_TRANSFORM, PROPERTY_CODE_TRANSPARENCY, PROPERTY_CODE_VISIBLE, PROPERTY_FULL_BOUNDS, PROPERTY_PAINT, PROPERTY_PARENT, PROPERTY_PICKABLE, PROPERTY_TRANSFORM, PROPERTY_TRANSPARENCY, PROPERTY_VISIBLE, SCENE_GRAPH_DELEGATE
 
Fields inherited from interface java.awt.print.Printable
NO_SUCH_PAGE, PAGE_EXISTS
 
Constructor Summary
GeneralUnitPNode(int x, int y, double width, double height)
          Constructor for mnemonic (sparse) SOMs.
GeneralUnitPNode(Unit u, CommonSOMViewerStateData state, SOMLibClassInformation classInfo, SOMLibDataInformation dataInfo, double width, double height)
           
GeneralUnitPNode(Unit u, CommonSOMViewerStateData state, SOMLibClassInformation classInfo, SOMLibDataInformation dataInfo, Point[][] locations, double width, double height)
           
GeneralUnitPNode(Unit u, GeneralUnitPNode clone)
           
 
Method Summary
 void addArrow(ArrowPNode arrow)
           
private  void addDataChildren()
           
private  void detailChanged()
          Updates child nodes to display upon change in detail level
 ArrayList<ArrowPNode> getArrows()
           
 Color getClassLegendColorFast(int index)
          This implementation does not check for the pie charts (pieChartDetailNodes to be initialised and should therefore be only used if it is for sure != null.
 PieChartPNode getClassPieChart(int width, int height)
           
 int getDataInputVariant()
           
 Label[] getLabels(String type)
           
 Point[] getLocations()
           
 String[] getMappedDataNames()
           
 MapPNode getMapPNode()
           
 Point getPostion()
           
 boolean getShowOnlySelectedClasses()
           
 Unit getUnit()
          Returns the associtated SOM unit for this node
 boolean hasPieCharts()
           
 void initClassPieCharts(Unit u, SOMLibClassInformation classInfo, double width, double height)
           
private  edu.umd.cs.piccolo.PNode[] initData(int threshold, int fontSize, double yInOffset, int detailLevel, int variant)
          Initializes textual details
private  void initDetails()
          Initializes the details node.
private  void initDetails(int level)
           
private  edu.umd.cs.piccolo.PNode initLabels(int numLabels, int numCol, int fontSize, int length)
          Initializes text labels for this node.
private  void initPNodeProperties(double width, double height)
          Initializes common properties for unit PNodes and empty PNodes
 boolean isSelected()
           
protected  void paint(edu.umd.cs.piccolo.util.PPaintContext paintContext)
           
 void reInitUnitDetails()
           
 void reInitUnitDetails(int detailLevel)
           
private  void removeDetailNodes()
          remove currently added detail levels.
 void removeQueryHit()
           
 void resetArrows()
           
 void setArrows(ArrayList<ArrowPNode> arrows)
           
 boolean setBounds(double x, double y, double width, double height)
           
 void setClassColor(int index, Color color)
           
 void setClassColors(Color[] colors)
           
 void setQueryHit()
           
 void setSelected(boolean sel)
           
 void setShowOnlySelectedClasses(boolean showOnlySelectedClasses)
           
 String toString()
           
 void updateClassPieCharts()
          Updates the class pie chart visibility.
 void updateClassSelection(int[] indices)
           
 void updateDetailsAfterMoving()
          Updates the units displayed info by removing & re-creating them.
private  Object writeReplace()
           
 
Methods inherited from class edu.umd.cs.piccolo.PNode
addActivity, addAttribute, addChild, addChild, addChildren, addClientProperty, addInputEventListener, addPropertyChangeListener, addPropertyChangeListener, animateToBounds, animateToColor, animateToPositionScaleRotation, animateToTransform, animateToTransparency, animateTransformToBounds, centerBoundsOnPoint, centerFullBoundsOnPoint, clone, computeFullBounds, endResizeBounds, findIntersectingNodes, fireChildPropertyChange, firePropertyChange, fullIntersects, fullPaint, fullPick, getAllNodes, getAllNodes, getAttribute, getAttribute, getBooleanAttribute, getBounds, getBoundsChanged, getBoundsReference, getBoundsVolatile, getChild, getChildBoundsInvalid, getChildBoundsVolatile, getChildPaintInvalid, getChildrenCount, getChildrenIterator, getChildrenPickable, getChildrenReference, getClientProperties, getClientProperty, getClientPropertyKeysEnumeration, getClientPropertyKeysIterator, getDoubleAttribute, getFullBounds, getFullBoundsInvalid, getFullBoundsReference, getGlobalBounds, getGlobalFullBounds, getGlobalRotation, getGlobalScale, getGlobalToLocalTransform, getGlobalTranslation, getHeight, getIntegerAttribute, getInverseTransform, getListenerList, getLocalToGlobalTransform, getOccluded, getOffset, getPaint, getPaintInvalid, getParent, getPickable, getPropertyChangeParentMask, getRoot, getRotation, getScale, getTransform, getTransformReference, getTransparency, getUnionOfChildrenBounds, getVisible, getWidth, getX, getXOffset, getY, getYOffset, globalToLocal, globalToLocal, globalToLocal, indexOfChild, internalUpdateBounds, intersects, invalidateFullBounds, invalidateLayout, invalidatePaint, isAncestorOf, isDescendentOf, isDescendentOfRoot, isOpaque, layoutChildren, lerp, localToGlobal, localToGlobal, localToGlobal, localToParent, localToParent, localToParent, moveInBackOf, moveInFrontOf, moveToBack, moveToFront, offset, paintAfterChildren, paramString, parentBoundsChanged, parentToLocal, parentToLocal, parentToLocal, pick, pickAfterChildren, position, print, print, removeAllChildren, removeChild, removeChild, removeChildren, removeFromParent, removeInputEventListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaintFrom, reparent, replaceWith, resetBounds, rotate, rotateAboutPoint, rotateAboutPoint, rotateInPlace, scale, scaleAboutPoint, scaleAboutPoint, setBounds, setBoundsChanged, setChildBoundsInvalid, setChildBoundsVolatile, setChildPaintInvalid, setChildrenPickable, setFullBoundsInvalid, setGlobalRotation, setGlobalScale, setGlobalTranslation, setHeight, setOccluded, setOffset, setOffset, setPaint, setPaintInvalid, setParent, setPickable, setPropertyChangeParentMask, setRotation, setScale, setTransform, setTransparency, setVisible, setWidth, setX, setY, signalBoundsChanged, startResizeBounds, toImage, toImage, toImage, transformBy, translate, validateFullBounds, validateFullPaint
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

serialVersionUID

private static final long serialVersionUID
See Also:
Constant Field Values

DETAIL_LEVEL_NO

public static final int DETAIL_LEVEL_NO
See Also:
Constant Field Values

DETAIL_LEVEL_LOW

public static final int DETAIL_LEVEL_LOW
See Also:
Constant Field Values

DETAIL_LEVEL_MEDIUM

public static final int DETAIL_LEVEL_MEDIUM
See Also:
Constant Field Values

DETAIL_LEVEL_HIGH

public static final int DETAIL_LEVEL_HIGH
See Also:
Constant Field Values

NUMBER_OF_DETAIL_LEVELS

public static final int NUMBER_OF_DETAIL_LEVELS
See Also:
Constant Field Values

detailLevelNames

public static final String[] detailLevelNames
Names for the different zoom/scale levels, corresponding to DETAIL_LEVEL_NO, DETAIL_LEVEL_LOW, ..


DATA_DISPLAY_VARIANT_INPUTOBJECT

public static final int DATA_DISPLAY_VARIANT_INPUTOBJECT
See Also:
Constant Field Values

DATA_DISPLAY_VARIANT_INPUTOBJECTSHIFTED

public static final int DATA_DISPLAY_VARIANT_INPUTOBJECTSHIFTED
See Also:
Constant Field Values

DATA_DISPLAY_VARIANT_TEXT

public static final int DATA_DISPLAY_VARIANT_TEXT
See Also:
Constant Field Values

DATA_DISPLAY_VARIANTS

public static final int DATA_DISPLAY_VARIANTS
See Also:
Constant Field Values

NUMBER_OF_LABELS

private static int[] NUMBER_OF_LABELS

NUMBER_OF_COLUMNS

private static int[] NUMBER_OF_COLUMNS

FONT_SIZE_LABELS

private static int[] FONT_SIZE_LABELS

MAX_LABEL_LENGTH

private static int[] MAX_LABEL_LENGTH

FONT_SIZE_DATA

private static int[] FONT_SIZE_DATA

currentDetailLevel

private int currentDetailLevel

u

private Unit u

X

private double X

Y

private double Y

width

private double width

height

private double height

drawBorder

private boolean drawBorder

border

private Rectangle2D border

borderColor

private final Color borderColor

borderStroke

private final BasicStroke borderStroke

selectedClassIndices

private int[] selectedClassIndices

showOnlySelectedClasses

private boolean showOnlySelectedClasses

selected

private boolean selected

selectionMarker

private edu.umd.cs.piccolo.nodes.PPath selectionMarker

arrowsFromThisUnit

private ArrayList<ArrowPNode> arrowsFromThisUnit

oldScale

private double oldScale

currentScale

private double currentScale

detailNodes

private edu.umd.cs.piccolo.PNode[] detailNodes
Nodes for details at different levels


dataDetail

private edu.umd.cs.piccolo.PNode[][][] dataDetail
Data input nodes for different levels, length of NUMBER_OF_DETAIL_LEVELS, contains a PText at DATA_DISPLAY_VARIANT_TEXT, and InputPNodes at DATA_DISPLAY_VARIANT_INPUTOBJECT and DATA_DISPLAY_VARIANT_INPUTOBJECTSHIFTED.


dataCountDetail

private edu.umd.cs.piccolo.PNode[] dataCountDetail

labelDetailNodes

private edu.umd.cs.piccolo.PNode[] labelDetailNodes
Label nodes for different levels


pieChartDetailNodes

private PieChartPNode[] pieChartDetailNodes
PieChart nodes for different levels


classInfo

private SOMLibClassInformation classInfo

dataInfo

private SOMLibDataInformation dataInfo

classInfoSelectionChanged

private boolean classInfoSelectionChanged

queryResultMarker

private edu.umd.cs.piccolo.nodes.PPath queryResultMarker

locations

private Point[][] locations

state

private CommonSOMViewerStateData state
Constructor Detail

GeneralUnitPNode

public GeneralUnitPNode(int x,
                        int y,
                        double width,
                        double height)
Constructor for mnemonic (sparse) SOMs. Initialises an empty cell with no unit attached.


GeneralUnitPNode

public GeneralUnitPNode(Unit u,
                        CommonSOMViewerStateData state,
                        SOMLibClassInformation classInfo,
                        SOMLibDataInformation dataInfo,
                        double width,
                        double height)

GeneralUnitPNode

public GeneralUnitPNode(Unit u,
                        CommonSOMViewerStateData state,
                        SOMLibClassInformation classInfo,
                        SOMLibDataInformation dataInfo,
                        Point[][] locations,
                        double width,
                        double height)

GeneralUnitPNode

public GeneralUnitPNode(Unit u,
                        GeneralUnitPNode clone)
Method Detail

addDataChildren

private void addDataChildren()

reInitUnitDetails

public void reInitUnitDetails()

reInitUnitDetails

public void reInitUnitDetails(int detailLevel)

removeDetailNodes

private void removeDetailNodes()
remove currently added detail levels.


initPNodeProperties

private void initPNodeProperties(double width,
                                 double height)
Initializes common properties for unit PNodes and empty PNodes


initClassPieCharts

public void initClassPieCharts(Unit u,
                               SOMLibClassInformation classInfo,
                               double width,
                               double height)

initLabels

private edu.umd.cs.piccolo.PNode initLabels(int numLabels,
                                            int numCol,
                                            int fontSize,
                                            int length)
Initializes text labels for this node. The labels are displayed in a virtual table like structure.

Parameters:
numLabels - Number of labels to be shown. If '-1' the limit is set to the number of labels in unit description file.
numCol - Number of table columns. Setting to '1' means row table.
fontSize - Font size to use for drawing labels
length - Maximum label length, longer labels will be trunkated

getMapPNode

public MapPNode getMapPNode()

initData

private edu.umd.cs.piccolo.PNode[] initData(int threshold,
                                            int fontSize,
                                            double yInOffset,
                                            int detailLevel,
                                            int variant)
Initializes textual details

Parameters:
threshold - Displays description of mapped inputs below certain threshold (count), otherwise a count is displayed.
fontSize - Text size
yInOffset - Positional offset

initDetails

private void initDetails()
Initializes the details node. A pie chart is generated if class info is available (except DETAIL_LEVEL_HIGH, quality measure info is added for DETAIL_LEVEL_HIGH.


initDetails

private void initDetails(int level)

updateDetailsAfterMoving

public void updateDetailsAfterMoving()
Updates the units displayed info by removing & re-creating them.


paint

protected void paint(edu.umd.cs.piccolo.util.PPaintContext paintContext)
Overrides:
paint in class edu.umd.cs.piccolo.PNode
See Also:
PNode.paint(edu.umd.cs.piccolo.util.PPaintContext)

setBounds

public boolean setBounds(double x,
                         double y,
                         double width,
                         double height)
Overrides:
setBounds in class edu.umd.cs.piccolo.PNode
See Also:
PNode.setBounds(double, double, double, double)

updateClassPieCharts

public void updateClassPieCharts()
Updates the class pie chart visibility.


getDataInputVariant

public int getDataInputVariant()

detailChanged

private void detailChanged()
Updates child nodes to display upon change in detail level


hasPieCharts

public boolean hasPieCharts()

getClassLegendColorFast

public Color getClassLegendColorFast(int index)
This implementation does not check for the pie charts (pieChartDetailNodes to be initialised and should therefore be only used if it is for sure != null.


setClassColor

public void setClassColor(int index,
                          Color color)

setClassColors

public void setClassColors(Color[] colors)

updateClassSelection

public void updateClassSelection(int[] indices)

getMappedDataNames

public String[] getMappedDataNames()

isSelected

public boolean isSelected()

setSelected

public void setSelected(boolean sel)

getLabels

public Label[] getLabels(String type)

setQueryHit

public void setQueryHit()

removeQueryHit

public void removeQueryHit()

getUnit

public Unit getUnit()
Returns the associtated SOM unit for this node


getClassPieChart

public PieChartPNode getClassPieChart(int width,
                                      int height)

writeReplace

private Object writeReplace()
                     throws ObjectStreamException
Throws:
ObjectStreamException

getArrows

public ArrayList<ArrowPNode> getArrows()

setArrows

public void setArrows(ArrayList<ArrowPNode> arrows)

addArrow

public void addArrow(ArrowPNode arrow)

resetArrows

public void resetArrows()

getLocations

public Point[] getLocations()

getPostion

public Point getPostion()

getShowOnlySelectedClasses

public boolean getShowOnlySelectedClasses()

setShowOnlySelectedClasses

public void setShowOnlySelectedClasses(boolean showOnlySelectedClasses)

toString

public String toString()
Overrides:
toString in class edu.umd.cs.piccolo.PNode