org.knime.base.node.viz.aggregation
Class AggregationValSubModel<S extends Shape,H extends Shape>

java.lang.Object
  extended by org.knime.base.node.viz.aggregation.AggregationValSubModel<S,H>
Type Parameters:
S - the shape of this sub model
H - the optional hilite shape
All Implemented Interfaces:
Serializable, AggregationModel<S,H>
Direct Known Subclasses:
BarElementDataModel, PieSubSectionDataModel

public abstract class AggregationValSubModel<S extends Shape,H extends Shape>
extends Object
implements Serializable, AggregationModel<S,H>

This class holds the data of a sub model which represents rows of the same color.

Author:
Tobias Koetter, University of Konstanz
See Also:
Serialized Form

Constructor Summary
protected AggregationValSubModel(Color color)
          Constructor for class AttributeValColorModel.
protected AggregationValSubModel(Color color, boolean supportHiliting)
          Constructor for class AttributeValColorModel.
protected AggregationValSubModel(Color color, boolean supportHiliting, double aggrSum, int valueCounter, int rowCounter)
          Constructor for class AttributeValColorModel (used for cloning).
protected AggregationValSubModel(ConfigRO config)
          Constructor for class AggregationValSubModel.
 
Method Summary
protected  void addDataRow(RowKey rowKey, DataCell aggrValCell)
          Adds the given values to the sub element.
protected  void calculateHilitedShape(HiliteShapeCalculator<S,H> calculator)
          Calculates the hilite rectangle or resets the hilite rectangle to null if no rows are hilited.
protected  void clearHilite()
          Clears the hilite counter.
protected  AggregationValSubModel<S,H> clone()
          
 double getAggregationSum()
          
 double getAggregationValue(AggregationMethod method)
           
 Color getColor()
           
 Set<RowKey> getHilitedKeys()
           
 int getHiliteRowCount()
          Call the AggregationModel.supportsHiliting() method to check if hiliting is supported.
 H getHiliteShape()
          Call the AggregationModel.supportsHiliting() method to check if hiliting is supported.
 Set<RowKey> getKeys()
           
 String getName()
          
 int getRowCount()
          
 S getShape()
           
 int getValueCount()
          
 boolean isEmpty()
          
 boolean isHilited()
           
 boolean isPresentable()
          
 boolean isSelected()
           
protected  boolean removeHilitedKeys(Collection<RowKey> unhilitedKeys, HiliteShapeCalculator<S,H> calculator)
           
 void save2File(ConfigWO config, ExecutionMonitor exec)
           
 boolean selectElement(Point point)
          Selects this element if the element rectangle contains the given point.
 boolean selectElement(Rectangle2D rect)
          Selects this element if the element rectangle intersect the given rectangle.
protected  boolean setHilitedKeys(Collection<RowKey> hilitedKeys, HiliteShapeCalculator<S,H> calculator)
           
protected  void setHiliteShape(H shape)
           
protected  void setPresentable(boolean presentable, HiliteShapeCalculator<S,H> calculator)
           
protected  void setSelected(boolean isSelected)
           
protected  void setShape(S shape, HiliteShapeCalculator<S,H> calculator)
           
 boolean supportsHiliting()
           
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AggregationValSubModel

protected AggregationValSubModel(Color color)
Constructor for class AttributeValColorModel.

Parameters:
color - the color to use for this sub element

AggregationValSubModel

protected AggregationValSubModel(Color color,
                                 boolean supportHiliting)
Constructor for class AttributeValColorModel.

Parameters:
color - the color to use for this sub element
supportHiliting - if hiliting support should be enabled

AggregationValSubModel

protected AggregationValSubModel(Color color,
                                 boolean supportHiliting,
                                 double aggrSum,
                                 int valueCounter,
                                 int rowCounter)
Constructor for class AttributeValColorModel (used for cloning).

Parameters:
color - the color to use for this sub element
supportHiliting - if hiliting should be supported
aggrSum - the sum of the aggregation values
valueCounter - the number of aggregation values
rowCounter - the number of rows incl. missing values

AggregationValSubModel

protected AggregationValSubModel(ConfigRO config)
                          throws InvalidSettingsException
Constructor for class AggregationValSubModel.

Parameters:
config - the config object to use
Throws:
InvalidSettingsException - if the config object is invalid
Method Detail

addDataRow

protected void addDataRow(RowKey rowKey,
                          DataCell aggrValCell)
Adds the given values to the sub element.

Parameters:
rowKey - the rowkey of the row to add
aggrValCell - the value cell of the aggregation column of this sub element

getRowCount

public int getRowCount()

Specified by:
getRowCount in interface AggregationModel<S extends Shape,H extends Shape>
Returns:
the number of rows of this element

getValueCount

public int getValueCount()

Specified by:
getValueCount in interface AggregationModel<S extends Shape,H extends Shape>
Returns:
the number of real values (without missing values)

getAggregationSum

public double getAggregationSum()

Specified by:
getAggregationSum in interface AggregationModel<S extends Shape,H extends Shape>
Returns:
the sum of all aggregation values

getAggregationValue

public double getAggregationValue(AggregationMethod method)
Specified by:
getAggregationValue in interface AggregationModel<S extends Shape,H extends Shape>
Parameters:
method - the AggregationMethod to use
Returns:
the aggregation value of this sub element

getColor

public Color getColor()
Specified by:
getColor in interface AggregationModel<S extends Shape,H extends Shape>
Returns:
the color to use for this sub element

getShape

public S getShape()
Specified by:
getShape in interface AggregationModel<S extends Shape,H extends Shape>
Returns:
the shape

setShape

protected void setShape(S shape,
                        HiliteShapeCalculator<S,H> calculator)
Parameters:
shape - the new shape of this sub element
calculator - the hilite shape calculator

getHiliteShape

public H getHiliteShape()
Call the AggregationModel.supportsHiliting() method to check if hiliting is supported.

Specified by:
getHiliteShape in interface AggregationModel<S extends Shape,H extends Shape>
Returns:
the hilite shape of this element

setHiliteShape

protected void setHiliteShape(H shape)
Parameters:
shape - the new hilite shape

isSelected

public boolean isSelected()
Specified by:
isSelected in interface AggregationModel<S extends Shape,H extends Shape>
Returns:
true if the element is selected

isEmpty

public boolean isEmpty()

Specified by:
isEmpty in interface AggregationModel<S extends Shape,H extends Shape>
Returns:
true if this model contains no rows

isPresentable

public boolean isPresentable()

Specified by:
isPresentable in interface AggregationModel<S extends Shape,H extends Shape>
Returns:
true if the sub elements should be drawn

setPresentable

protected void setPresentable(boolean presentable,
                              HiliteShapeCalculator<S,H> calculator)
Parameters:
presentable - true if this element is presentable
calculator - the hilite shape calculator

getName

public String getName()

Specified by:
getName in interface AggregationModel<S extends Shape,H extends Shape>
Returns:
the optional name of this element (could be null)

supportsHiliting

public boolean supportsHiliting()
Specified by:
supportsHiliting in interface AggregationModel<S extends Shape,H extends Shape>
Returns:
the enableHiliting variable

setSelected

protected void setSelected(boolean isSelected)
Parameters:
isSelected - set to true if the element is selected

selectElement

public boolean selectElement(Point point)
Selects this element if the element rectangle contains the given point.

Parameters:
point - the Point to check
Returns:
true if the element contains the point

selectElement

public boolean selectElement(Rectangle2D rect)
Selects this element if the element rectangle intersect the given rectangle.

Parameters:
rect - the Rectangle2D to check
Returns:
true if the element intersects the rectangle

getKeys

public Set<RowKey> getKeys()
Returns:
the keys of the rows in this element.

isHilited

public boolean isHilited()
Specified by:
isHilited in interface AggregationModel<S extends Shape,H extends Shape>
Returns:
true if at least one row of this element is hilited

getHilitedKeys

public Set<RowKey> getHilitedKeys()
Returns:
the keys of the hilited rows in this element

clearHilite

protected void clearHilite()
Clears the hilite counter.


setHilitedKeys

protected boolean setHilitedKeys(Collection<RowKey> hilitedKeys,
                                 HiliteShapeCalculator<S,H> calculator)
Parameters:
hilitedKeys - the hilited keys
calculator - the hilite shape calculator
Returns:
true if at least one key has been added

removeHilitedKeys

protected boolean removeHilitedKeys(Collection<RowKey> unhilitedKeys,
                                    HiliteShapeCalculator<S,H> calculator)
Parameters:
unhilitedKeys - the keys which should be unhilited
calculator - the hilite shape calculator
Returns:
true if at least one key has been removed

getHiliteRowCount

public int getHiliteRowCount()
Call the AggregationModel.supportsHiliting() method to check if hiliting is supported.

Specified by:
getHiliteRowCount in interface AggregationModel<S extends Shape,H extends Shape>
Returns:
the number of hilited rows in this element

calculateHilitedShape

protected void calculateHilitedShape(HiliteShapeCalculator<S,H> calculator)
Calculates the hilite rectangle or resets the hilite rectangle to null if no rows are hilited.

Parameters:
calculator - the hilite shape calculator

clone

protected AggregationValSubModel<S,H> clone()
                                                                 throws CloneNotSupportedException

Overrides:
clone in class Object
Throws:
CloneNotSupportedException

save2File

public void save2File(ConfigWO config,
                      ExecutionMonitor exec)
               throws CanceledExecutionException
Parameters:
config - the config object to use
exec - the ExecutionMonitor to provide progress messages
Throws:
CanceledExecutionException - if the operation is canceled


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.