quoggles.representation
Class DefaultBoxRepresentation

java.lang.Object
  |
  +--quoggles.representation.DefaultBoxRepresentation
All Implemented Interfaces:
IBoxRepresentation
Direct Known Subclasses:
Algorithm_Rep, Arithmetic_Rep, AttributeFilter_Rep, AttributeFilter_Rep, BooleanOp_Rep, BoolPredicateEnd_Rep, ChangeAttribute_Rep, ChangeAttributes_Rep, Check_Rep, CompareTwoValues_Rep, ComplexFilter_Rep, Constant_Rep, ConvertFromParam_Rep, ConvertToParam_Rep, CreateParam_Rep, GetAttributeValue_Rep, GetGraphElements_Rep, GetProperty_Rep, IsInstanceof_Rep, Listify_Rep, ListOperations1_Rep, ListOperations2_Rep, MakeDistinct_Rep, MakeTrue_Rep, Neighborhood_Rep, NormalOutput_Rep, OneOneConnector_Rep, Sort_Rep, SortBy_Rep, SubQuery_Rep, TwoSplitConnector_Rep, ValueCompare_Rep, ValueFilter_Rep, ValueFilter_Rep

public class DefaultBoxRepresentation
extends java.lang.Object
implements IBoxRepresentation


Field Summary
protected  IBox box
          The IBox this class represents.
protected  javax.swing.JLabel classLabel
           
protected  BoxRepresentation graphicalRep
           
protected  javax.swing.JLabel inputLabel
           
protected  java.lang.String INPUTLABEL
           
protected  java.awt.geom.Point2D[] inputsPos
           
protected  javax.swing.JLabel outputLabel
           
protected  java.lang.String OUTPUTLABEL
           
protected  java.awt.geom.Point2D[] outputsPos
           
protected  org.graffiti.plugin.parameter.Parameter[] parameters
           
 
Constructor Summary
DefaultBoxRepresentation(IBox representedBox)
          This constructor resets graphicalRep, uses getParameters() to get the parameters and finally calls updateGraphicalRep().
 
Method Summary
 BoxRepresentation createStandardPanel(BoxRepresentation boxRep)
           
 IBox getIBox()
          Returns the IBox it represents.
 java.awt.geom.Point2D[] getRelInputsPos()
          Relative position of inputs, measured from top left corner, values between 0 and 1.
 java.awt.geom.Point2D[] getRelOutputsPos()
          Relative position of outputs, measured from top left corner, values between 0 and 1.
 BoxRepresentation getRepresentation()
          Gets a representation that can be added to the visual system.
 void repaintBoxRep(java.awt.event.ActionEvent e)
          Used to make the system repaint the box representation, for example after the number of inputs / outputs has changed.
 void setParameters(org.graffiti.plugin.parameter.Parameter[] params, boolean fromBox)
          According to the value of the second parameter tells the box about the change or not.
 BoxRepresentation standardizeBoxRep(BoxRepresentation panel, javax.swing.JComponent boxContents)
          Makes all boxes look similar: Adds input and output specifications, sets background color, sizes, etc.
 void updateGraphicalRep()
          Default implementation; uses createStandardPanel(BoxRepresentation)
 void updateId()
          Called when the ID changed (e.g. the box number).
protected  void updateInputOutput()
          After a change in the parameters, the input / output type may have changed.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

INPUTLABEL

protected final java.lang.String INPUTLABEL
See Also:
Constant Field Values

OUTPUTLABEL

protected final java.lang.String OUTPUTLABEL
See Also:
Constant Field Values

box

protected IBox box
The IBox this class represents.


graphicalRep

protected BoxRepresentation graphicalRep

parameters

protected org.graffiti.plugin.parameter.Parameter[] parameters

inputsPos

protected java.awt.geom.Point2D[] inputsPos

outputsPos

protected java.awt.geom.Point2D[] outputsPos

inputLabel

protected javax.swing.JLabel inputLabel

outputLabel

protected javax.swing.JLabel outputLabel

classLabel

protected javax.swing.JLabel classLabel
Constructor Detail

DefaultBoxRepresentation

public DefaultBoxRepresentation(IBox representedBox)
This constructor resets graphicalRep, uses getParameters() to get the parameters and finally calls updateGraphicalRep().

Parameters:
representedBox -
Method Detail

updateGraphicalRep

public void updateGraphicalRep()
Default implementation; uses createStandardPanel(BoxRepresentation)

Specified by:
updateGraphicalRep in interface IBoxRepresentation
See Also:
IBoxRepresentation.updateGraphicalRep(), createStandardPanel(BoxRepresentation)

setParameters

public void setParameters(org.graffiti.plugin.parameter.Parameter[] params,
                          boolean fromBox)
According to the value of the second parameter tells the box about the change or not. Calls updateInputOutput().

Specified by:
setParameters in interface IBoxRepresentation
Parameters:
params -
fromBox -

createStandardPanel

public final BoxRepresentation createStandardPanel(BoxRepresentation boxRep)

standardizeBoxRep

public final BoxRepresentation standardizeBoxRep(BoxRepresentation panel,
                                                 javax.swing.JComponent boxContents)
Makes all boxes look similar: Adds input and output specifications, sets background color, sizes, etc. Adds small components representing input and output places. The given BoxRepresentation is cleared, modified and returned.

Parameters:
panel - BoxRepresentation that will be enriched with content
boxContents - the contents that will appear in the center of the box
Returns:
the (modified) panel

updateId

public void updateId()
Description copied from interface: IBoxRepresentation
Called when the ID changed (e.g. the box number).

Specified by:
updateId in interface IBoxRepresentation
See Also:
IBoxRepresentation.updateId()

updateInputOutput

protected void updateInputOutput()
After a change in the parameters, the input / output type may have changed. This method takes care of changing the labels in the box.


getRepresentation

public BoxRepresentation getRepresentation()
Description copied from interface: IBoxRepresentation
Gets a representation that can be added to the visual system.

Specified by:
getRepresentation in interface IBoxRepresentation
See Also:
IBoxRepresentation.getRepresentation()

getIBox

public IBox getIBox()
Description copied from interface: IBoxRepresentation
Returns the IBox it represents.

Specified by:
getIBox in interface IBoxRepresentation
Returns:
See Also:
IBoxRepresentation.getIBox()

getRelOutputsPos

public java.awt.geom.Point2D[] getRelOutputsPos()
Description copied from interface: IBoxRepresentation
Relative position of outputs, measured from top left corner, values between 0 and 1. Only used if the box has several outputs.

Specified by:
getRelOutputsPos in interface IBoxRepresentation
See Also:
quoggles.representation.IBoxRepresentation#getOtherRelOutputPos()

getRelInputsPos

public java.awt.geom.Point2D[] getRelInputsPos()
Description copied from interface: IBoxRepresentation
Relative position of inputs, measured from top left corner, values between 0 and 1. Only used if the box has several inputs.

Specified by:
getRelInputsPos in interface IBoxRepresentation
See Also:
quoggles.representation.IBoxRepresentation#getOtherRelInputPos()

repaintBoxRep

public final void repaintBoxRep(java.awt.event.ActionEvent e)
Used to make the system repaint the box representation, for example after the number of inputs / outputs has changed.

Parameters:
e - an event whose data is used to generate other events