fr.inria.infovis.column
Class LayeredColumnProxy

java.lang.Object
  extended byinfovis.column.AbstractColumn
      extended byfr.inria.infovis.column.LayeredColumnProxy
All Implemented Interfaces:
infovis.Column, infovis.metadata.Constants, LayeredColumn, infovis.Metadata, infovis.utils.RowComparator

public class LayeredColumnProxy
extends infovis.column.AbstractColumn
implements LayeredColumn

A proxy Column to handle the layer mechanism (i.e adding another dimension to a standard 1D column).
Principle
This proxy contains a working column. This column is used as a frontend and then interacts directly with the rest of the Infovis classes. Values are dispatched in several layer by using setValueAt(int layer, int index, String element) When restoring a given layer, the working column is first entirely cleared and secondly values of the layers are copied into the column Values storage is based on three structures

Author:
raf

Field Summary
 
Fields inherited from interface infovis.metadata.Constants
CONTRIBUTOR, COVERAGE, CREATOR, DATE, DESCRITION, FORMAT, IDENTIFIER, LANGUAGE, PUBLISHER, RELATION, RIGHTS, SOURCE, SUBJECT, TITLE, TYPE
 
Constructor Summary
LayeredColumnProxy(infovis.column.BasicColumn column)
          Default decorator constructor.
 
Method Summary
 void addChangeListener(javax.swing.event.ChangeListener listener)
          add a change listener for the frontend column.
 void addValue(java.lang.String v)
          This function is part of the standard Column Interface.
 boolean addValueOrNull(java.lang.String v)
          This function is part of the standard Column Interface.
 int capacity()
           
 void clear()
          Clear the contents of the three underlaying structure (backend and frontend columns and the mapping TreeMap)
 int compare(int row1, int row2)
          compare two values at row1 and row2 in the frontend column.
 void disableNotify()
          disable notification for the of the frontend column
 void enableNotify()
          enable notification of the frontend column
 void ensureCapacity(int minCapacity)
          ensure the capacitiy of the frontend column
 boolean equals(java.lang.Object obj)
          Column equalities : comparison with the frontend column
 int firstValidRow()
           
 ValueAggregator getAggregator()
           
 java.util.Map getClientPropery()
           
 infovis.Column getColumn()
          give the "decored" column, i.e. the real column to which the layer mechanism has been externally added
 java.text.Format getFormat()
           
 java.util.Map getMetadata()
           
 java.lang.String getName()
           
 int getRowCount()
           
 java.lang.String getValueAt(int row)
          Return the value of the cell currently set in the frontend column.
 java.lang.Class getValueClass()
           
 boolean isEmpty()
           
 boolean isInternal()
           
 boolean isValueUndefined(int row)
          Check if the value at row is undefined or not
 infovis.utils.RowIterator iterator()
           
 int lastValidRow()
           
 java.lang.String maxValue()
           
 java.lang.String minValue()
           
 void removeChangeListener(javax.swing.event.ChangeListener listener)
          remove a Cahnge listenerfrom the frontend column
 void restoreLayers(int from, int to)
          Restore all the values contained by layers [from,to] in the frontend column.
 void setAggregator(ValueAggregator aggregator)
           
 void setColumn(infovis.column.BasicColumn c)
          Set the frontend column
 void setColumn(infovis.Column c)
          Set the frontend column
 void setFormat(java.text.Format format)
          Set the format for the frontend column
 void setName(java.lang.String name)
          Set the name of the frontend column
 void setValueAt(int layer, int index, java.lang.String element)
          This method set the value of cell in the column into a particular layer.
 void setValueAt(int index, java.lang.String element)
          This function is part of the standard Column Interface.
 void setValueOrNullAt(int layer, int index, java.lang.String element)
          This method set the value of cell in the column into a particular layer.
 boolean setValueOrNullAt(int index, java.lang.String v)
          Set a value in the frontend column
 void setValueUndefined(int i, boolean undef)
          Set as undefined the value at row #i
 java.lang.String toString()
           
 
Methods inherited from class infovis.column.AbstractColumn
fireColumnChanged, getModCount
 
Methods inherited from class java.lang.Object
getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

LayeredColumnProxy

public LayeredColumnProxy(infovis.column.BasicColumn column)
Default decorator constructor. Build a new instance of the layer mecanism attached to the given concrete column.

Parameters:
column - the concrete/frontend column NOTE: If the column already contains values at the creation, values ARE NOT copied into an layer. It is strongly recomended to use this constructor with EMPTY column.
Method Detail

clear

public void clear()
Clear the contents of the three underlaying structure (backend and frontend columns and the mapping TreeMap)

Specified by:
clear in interface infovis.Column
See Also:
Column.clear()

restoreLayers

public void restoreLayers(int from,
                          int to)
Restore all the values contained by layers [from,to] in the frontend column.

setValueAt

public void setValueAt(int index,
                       java.lang.String element)
                throws java.text.ParseException
This function is part of the standard Column Interface. When using the Layer mecanism, it is necessary to give a layer where to add the value. This method is unusable here. So this method does noting else than producing a warning.

Specified by:
setValueAt in interface infovis.Column
Throws:
java.text.ParseException
See Also:
Column.setValueAt(int, java.lang.String)

setValueAt

public void setValueAt(int layer,
                       int index,
                       java.lang.String element)
                throws java.text.ParseException
This method set the value of cell in the column into a particular layer. This value becomnes the current value in the frontend column for the cell #row

Parameters:
layer - the layer concerned by the modification
index - the index of the cell concerned by the modification (in the frontend column)
element - the new value to set in the cell,layer
Throws:
java.text.ParseException - Element is given as a string. It must be parsed to be converted into int,float, etc...depending on the Column type. If the conversion can not be done, this exception is thrown.

setValueOrNullAt

public void setValueOrNullAt(int layer,
                             int index,
                             java.lang.String element)
This method set the value of cell in the column into a particular layer. The difference with setValueAt is the possibilitiy to set a null value.

Parameters:
layer - the layer concerned by the modification
index - index the index of the cell concerned by the modification (in the frontend column)
element - the new value to set in the cell,layer, can be null

getValueAt

public java.lang.String getValueAt(int row)
Return the value of the cell currently set in the frontend column. This value v

Specified by:
getValueAt in interface infovis.Column
See Also:
Column.getValueAt(int)

getAggregator

public ValueAggregator getAggregator()
Returns:
Returns the aggregator for insertion (experimental)

setAggregator

public void setAggregator(ValueAggregator aggregator)
Parameters:
aggregator - The insertion aggregator to set (experimental).

addValue

public void addValue(java.lang.String v)
              throws java.text.ParseException
This function is part of the standard Column Interface. When using the Layer mecanism, it is necessary to give a layer where to add the value. This method is unusable here. So this method does noting else than producing a warning.

Specified by:
addValue in interface infovis.Column
Throws:
java.text.ParseException
See Also:
Column.addValue(java.lang.String)

addValueOrNull

public boolean addValueOrNull(java.lang.String v)
This function is part of the standard Column Interface. When using the Layer mecanism, it is necessary to give a layer where to add the value. This method is unusable here. So this method does noting else than producing a warning.

Specified by:
addValueOrNull in interface infovis.Column
See Also:
Column.addValueOrNull(java.lang.String)

addChangeListener

public void addChangeListener(javax.swing.event.ChangeListener listener)
add a change listener for the frontend column. The backend column has bisabled its notification mechanism.

Specified by:
addChangeListener in interface infovis.Column
Parameters:
listener - the changeListener to add

capacity

public int capacity()
Specified by:
capacity in interface infovis.Column
Returns:
the capapcity of the frontend Column

compare

public int compare(int row1,
                   int row2)
compare two values at row1 and row2 in the frontend column.

Specified by:
compare in interface infovis.utils.RowComparator
Parameters:
row1 -
row2 -
Returns:
the result of the comparision

disableNotify

public void disableNotify()
disable notification for the of the frontend column

Specified by:
disableNotify in interface infovis.Column

enableNotify

public void enableNotify()
enable notification of the frontend column

Specified by:
enableNotify in interface infovis.Column

ensureCapacity

public void ensureCapacity(int minCapacity)
ensure the capacitiy of the frontend column

Specified by:
ensureCapacity in interface infovis.Column
Parameters:
minCapacity - the capacity required

equals

public boolean equals(java.lang.Object obj)
Column equalities : comparison with the frontend column

Parameters:
obj - the object to compare with
See Also:
Object.equals(java.lang.Object)

firstValidRow

public int firstValidRow()
Specified by:
firstValidRow in interface infovis.Column
Returns:
the first valid row of the frontend column

getClientPropery

public java.util.Map getClientPropery()
Specified by:
getClientPropery in interface infovis.Metadata
Returns:
the property map of the frontend column

getFormat

public java.text.Format getFormat()
Specified by:
getFormat in interface infovis.Column
Returns:
the format of the frontend column

getMetadata

public java.util.Map getMetadata()
Specified by:
getMetadata in interface infovis.Metadata
Returns:
the metatdata map of the frontend column

getName

public java.lang.String getName()
Specified by:
getName in interface infovis.Column
Returns:
the name of the frontend column

getRowCount

public int getRowCount()
Specified by:
getRowCount in interface infovis.Column
Returns:
the number of rows in the frontend column

getValueClass

public java.lang.Class getValueClass()
Specified by:
getValueClass in interface infovis.Column
Returns:
the class of object stroed in the frontend column

isEmpty

public boolean isEmpty()
Specified by:
isEmpty in interface infovis.Column
Returns:
if the frontend column is empty

isInternal

public boolean isInternal()
Specified by:
isInternal in interface infovis.Column
Returns:
if the frontend column is an internal column

isValueUndefined

public boolean isValueUndefined(int row)
Check if the value at row is undefined or not

Specified by:
isValueUndefined in interface infovis.Column
Parameters:
row - the cell index intthe the frontend column
Returns:
if the value is defined or not

iterator

public infovis.utils.RowIterator iterator()
Specified by:
iterator in interface infovis.Column
Returns:
an iterator on the rows of the frontend column

lastValidRow

public int lastValidRow()
Specified by:
lastValidRow in interface infovis.Column
Returns:
the last valid row number in the frontend column

maxValue

public java.lang.String maxValue()
Specified by:
maxValue in interface infovis.Column
Returns:
the max value currently stored in the frontend column

minValue

public java.lang.String minValue()
Specified by:
minValue in interface infovis.Column
Returns:
the min value currently stroed in the frontend column

removeChangeListener

public void removeChangeListener(javax.swing.event.ChangeListener listener)
remove a Cahnge listenerfrom the frontend column

Specified by:
removeChangeListener in interface infovis.Column
Parameters:
listener - the listener to remove

setFormat

public void setFormat(java.text.Format format)
Set the format for the frontend column

Specified by:
setFormat in interface infovis.Column
Parameters:
format - the format to set

setName

public void setName(java.lang.String name)
Set the name of the frontend column

Specified by:
setName in interface infovis.Column
Parameters:
name - the name to set

setValueOrNullAt

public boolean setValueOrNullAt(int index,
                                java.lang.String v)
Set a value in the frontend column

Specified by:
setValueOrNullAt in interface infovis.Column
Parameters:
index -
v -
Returns:
if the value has been set IT IS NOT RECOMMENDED TO USE THIS METHOD Use setValueOrNullAt(int layer, int index, String v) instead.

setValueUndefined

public void setValueUndefined(int i,
                              boolean undef)
Set as undefined the value at row #i

Specified by:
setValueUndefined in interface infovis.Column
Parameters:
i - the row to disable/enable
undef - make the value undefined or defined

toString

public java.lang.String toString()
Returns:
a String representing the frontend column
See Also:
Object.toString()

getColumn

public infovis.Column getColumn()
Description copied from interface: LayeredColumn
give the "decored" column, i.e. the real column to which the layer mechanism has been externally added

Specified by:
getColumn in interface LayeredColumn
Returns:
Returns the frontend column

setColumn

public void setColumn(infovis.column.BasicColumn c)
Set the frontend column

Parameters:
c - The column to set.

setColumn

public void setColumn(infovis.Column c)
Set the frontend column

Specified by:
setColumn in interface LayeredColumn
Parameters:
c - The column to set.
See Also:
LayeredColumn.setColumn(infovis.Column)