|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectinfovis.utils.ChangeManager
infovis.column.AbstractColumn
infovis.column.ColumnProxy
infovis.table.TableProxy
infovis.visualization.DefaultVisualization
public class DefaultVisualization
Base class for concrete visualizations.
This class implements a set of services useful for all the concrete visualizations.
A DefaultVisualization
needs a Table
. It
implements a visualization technique and manages the rendering and
interaction with the items.
It interfaces with four subsystems:
By default, the Layout
is specific to the concrete class.
The getLayout()
method returns the used Layout
object or null
if the visualization doesn't need one.
For example, ScatterPlotVisualization
has no Layout
associated whereas TreemapVisualization
uses one. Specifying the Layout
is visualization specific.
Item Renderers are used to render each visualized items. They form a tree described in
ItemRenderer
. This tree can be specified in the constructor of a
visualization or is created through an ItemRendererFactory
.
Item Renderers passed to a visualization can be prototypes or instances (see
ItemRenderer.isPrototype()
. When a prototype is passed, it is instantiated
by the visualization. Otherwise, it is used as it is.
The interaction subsystem is meant to associate a
VisualizationInteractor
to a visualization. These objects manage the standard
event management of the visualizations. When no VisualInteractor
is associated with the visualization,
then it has no interaction (at least through this mechanism).
The Rulers subsystem provides a mechanism to associate tick marks, rulers and labels to visualizations.
Each visualization has to maintain this association when it makes sense. Scatter plots use it to define the axes
rulers. The method getRulerTable()
returns a Table
containing the items to visualize
as rulers, as described in RulerTable
.
Nested Class Summary |
---|
Nested classes/interfaces inherited from interface infovis.visualization.magicLens.LabeledComponent |
---|
LabeledComponent.LabeledItem |
Field Summary |
---|
Fields inherited from class infovis.column.AbstractColumn |
---|
MODIFIED_ALL, MODIFIED_NONE |
Fields inherited from interface infovis.Visualization |
---|
PROPERTY_INTERACTOR, PROPERTY_ITEM_RENDERER, PROPERTY_LAYOUT, PROPERTY_ORIENTATION, PROPERTY_PARENT, PROPERTY_PERMUTATION, PROPERTY_RULERS, VC_DESCRIPTOR_PROPERTY_PREFIX, VISUAL_ALPHA, VISUAL_COLOR, VISUAL_FILTER, VISUAL_HOVER, VISUAL_LABEL, VISUAL_SELECTION, VISUAL_SHAPE, VISUAL_SIZE |
Fields inherited from interface infovis.visualization.Orientable |
---|
DIRECTION, NAME, ORIENTATION_CENTER, ORIENTATION_EAST, ORIENTATION_INVALID, ORIENTATION_NORTH, ORIENTATION_SOUTH, ORIENTATION_WEST, SQRT2 |
Fields inherited from interface javax.swing.SwingConstants |
---|
BOTTOM, CENTER, EAST, HORIZONTAL, LEADING, LEFT, NEXT, NORTH, NORTH_EAST, NORTH_WEST, PREVIOUS, RIGHT, SOUTH, SOUTH_EAST, SOUTH_WEST, TOP, TRAILING, VERTICAL, WEST |
Fields inherited from interface infovis.Table |
---|
FILTER_COLUMN, INTERNAL_PREFIX, NIL, SELECTION_COLUMN |
Fields inherited from interface infovis.metadata.Constants |
---|
CONTRIBUTOR, COVERAGE, CREATOR, DATE, DESCRITION, FORMAT, IDENTIFIER, LANGUAGE, PUBLISHER, RELATION, RIGHTS, SOURCE, SUBJECT, TITLE, TYPE |
Constructor Summary | |
---|---|
DefaultVisualization(Table table)
Creates a new Visualization for a specified table. |
|
DefaultVisualization(Table table,
ItemRenderer ir)
Creates a new DefaultVisualization for a specified Table using the specified
ItemRenderer for rendering. |
Method Summary | |
---|---|
void |
addPropertyChangeListener(PropertyChangeListener l)
Adds a PropertyChangeListener to the listener list. |
void |
addPropertyChangeListener(String propertyName,
PropertyChangeListener listener)
Add a PropertyChangeListener for a specific property. |
IntPair |
computeMinMax(Column c)
Computes the indexes of the min and max values of a specified column taking into account the current permutation. |
IntPair |
computeMinMaxFiltered(Column c)
Computes the indexes of the min and max values of a specified column taking into account the current permutation and filter. |
void |
computeShapes(Rectangle2D bounds)
Computes the shapes associated with the rows, and store them with setShapeAt. |
LabeledComponent.LabeledItem |
createLabelItem(int row)
Returns the LabeledComponent.LabeledItem for a specified row. |
void |
dispose()
Releases all the resources used by the visualization. |
Rectangle2D.Float |
findRectAt(int row)
Returns a rectangle for the specified row, allocating it if needed. |
Visualization |
findVisualization(Class cls)
Returns the sub-visualization of the specified class or null. |
void |
firePropertyChange(String property,
boolean oldV,
boolean newV)
Fires a property change given a property name, the old and new values of the property. |
void |
firePropertyChange(String property,
int oldV,
int newV)
Fires a property change given a property name, the old and new values of the property. |
void |
firePropertyChange(String property,
Object oldV,
Object newV)
Fires a property change given a property name, the old and new values of the property. |
void |
fireVisualColumnDescriptorChanged(String name)
Triggers a notification from a changed ItemRenderer given its name. |
void |
freeRectAt(int row)
Returns the rectangle at the specified row to the rectangle pool. |
Rectangle2D |
getBounds()
Returns the last bounds allocated to this visualization. |
JComponent |
getComponent()
Returns the JComponent managing this LabeledCompent |
FilterColumn |
getFilter()
Returns the filter. |
Fisheye |
getFisheye()
Returns the installed Fisheye or null . |
VisualizationInteractor |
getInteractor()
Returns the VisualizationInteractor associated with
this Visualization or null if no
interaction is managed. |
ItemRenderer |
getItemRenderer()
Returns the root ItemRenderer responsible for
rendering the items of this visualization. |
ItemRenderer |
getItemRenderer(String name)
Returns an ItemRenderer, given its name. |
static ItemRenderer |
getItemRenderer(String name,
ItemRenderer root)
Returns an ItemRenderer given its name and its root ItemRenderer. |
Layout |
getLayout()
Returns the layout object managed by this visualization or null if the visualization computes the layout by itself. |
short |
getOrientation()
Returns the orientation. |
JComponent |
getParent()
Returns the owning VisualizationPanel. |
Permutation |
getPermutation()
Returns the permutation. |
Dimension |
getPreferredSize()
Returns the preferred dimension of the Visualization or null if the Visualization can adapt to any dimension. |
Rectangle2D.Float |
getRectAt(int row)
Returns the rectangle at a specified row. |
int |
getRowAtIndex(int index)
Returns the row at a specified permuted index. |
int |
getRowCount()
Returns the number of rows in the table. |
int |
getRowIndex(int row)
Returns the index at a specified permuted row. |
Table |
getRulerTable()
Returns a table of Rulers. |
BooleanColumn |
getSelection()
Returns the current ListSelectionModel of this pickable. |
Shape |
getShapeAt(int row)
Returns the shape of stored for a specified row or null if none is store. |
Rectangle2D |
getShapeBoundsAt(int row)
Returns the bounds around the visual representation of a specified row. |
ShapeColumn |
getShapes()
Returns the ObjectColumn containing the shapes. |
Table |
getTable()
Returns the Table. |
Column |
getVisualColumn(String name)
Returns the column associated with a specified visual dimension or null . |
VisualColumnDescriptor |
getVisualColumnDescriptor(String name)
Returns the VisualColumnDescriptor associated
with a specified visual dimension. |
Iterator |
getVisualColumnIterator()
Returns an Iterator on the names of all the
visual columns defined by this visualization. |
Visualization |
getVisualization(int index)
Returns a dependent Visualization used by this Visualization in its stack. |
Rectangle2D |
getVisualizationBounds(int index,
Rectangle2D.Float bounds)
Returns the bounds of a specified visualization, given the bounds of the current visualization. |
void |
invalidate()
Invalidates the contents of the Visualization. |
void |
invalidate(Column c)
Invalidates the contents of the Visualization if the column has requested so. |
boolean |
isFiltered(int row)
Returns true if the row is filtered. |
boolean |
isInvalidateColumn(Column c)
Returns true if modifying this column triggers a
recomputation of the visualization. |
boolean |
isInvalidated()
Returns true if the visualization is already invalited. |
RowIterator |
iterator()
Returns a RowIterator taking the permutation into
account. |
void |
paint(Graphics2D graphics,
Rectangle2D bounds)
Method for painting the visualization. |
void |
paintItem(Graphics2D graphics,
int row)
Draw the shape of a specified row onto the specified graphics. |
void |
paintItems(Graphics2D graphics,
Rectangle2D bounds)
Method for filtering and painting the items. |
void |
paintVisualizations(Graphics2D graphics,
Rectangle2D bounds)
Paints the sub-visualizations. |
IntArrayList |
pickAll(Rectangle2D hitBox,
Rectangle2D bounds,
IntArrayList pick)
Pick all the items under a rectangle. |
Set |
pickAll(Rectangle2D hitBox,
Rectangle2D bounds,
Set pick)
Returns a list of LabeledItems under a specified Rectangle. |
boolean |
pickItem(Rectangle2D hitBox,
Rectangle2D bounds,
Shape s,
int row)
Returns true of an item is picked by the specified bounds. |
int |
pickTop(double x,
double y,
Rectangle2D bounds)
Pick the top item. |
int |
pickTop(Rectangle2D hitBox,
Rectangle2D bounds)
Pick the top item. |
void |
print(Graphics2D graphics,
Rectangle2D bounds)
Prints the visualization on the specified graphics. |
void |
removePropertyChangeListener(PropertyChangeListener l)
Remove a PropertyChangeListener from the listener list. |
void |
removePropertyChangeListener(String propertyName,
PropertyChangeListener listener)
Remove a PropertyChangeListener for a specific property. |
void |
repaint()
Trigger a repaint on the visualization pane. |
void |
repaint(int row)
Triggers a repaint for the specified row. |
RowIterator |
reverseIterator()
Returns an iterator over the columns of this table in reverse order. |
void |
setFisheye(Fisheye fisheye)
Sets the fisheyes. |
void |
setInteractor(VisualizationInteractor interactor)
Sets the VisualizationInteractor associated with
this Visualization or null if no
interaction is desired. |
void |
setItemRenderer(ItemRenderer root)
Sets the root ItemRenderer responsible for
rendering the items of this visualization. |
void |
setOrientation(short orientation)
Sets the orientation. |
void |
setParent(JComponent parent)
Sets the owning VisualizationPanel. |
void |
setPermutation(Permutation perm)
Sets the permutation. |
void |
setShapeAt(int row,
Shape s)
Associate a shape with a specified row. |
boolean |
setVisualColumn(String name,
Column newC)
Associate a column to a visual dimension. |
void |
stateChanged(ChangeEvent e)
|
void |
tableChanged(TableModelEvent e)
|
void |
validateShapes(Rectangle2D bounds)
Checks whether the shapes should be recomputed and call updateShapes then. |
Methods inherited from class infovis.table.TableProxy |
---|
addColumn, addTableModelListener, clear, getColumn, getColumnAt, getColumnClass, getColumnCount, getColumnName, getLastRow, getValueAt, indexOf, indexOf, isCellEditable, isRowValid, removeColumn, removeTableModelListener, setColumnAt, setValueAt |
Methods inherited from class infovis.column.ColumnProxy |
---|
addValue, addValueOrNull, capacity, compare, ensureCapacity, getClientProperty, getFormat, getMaxIndex, getMetadata, getMinIndex, getName, getValueAt, getValueClass, hasUndefinedValue, isEmpty, isInternal, isValueUndefined, setFormat, setName, setSize, setValueAt, setValueOrNullAt, setValueUndefined, size |
Methods inherited from class infovis.column.AbstractColumn |
---|
addChangeListener, compareValues, computeValueMap, computeValueMap, equalObj, equals, getLastModifiedRow, toString |
Methods inherited from class infovis.utils.ChangeManager |
---|
disableNotify, enableNotify, getModCount, removeChangeListener |
Methods inherited from class java.lang.Object |
---|
getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface infovis.Column |
---|
addChangeListener, addValue, addValueOrNull, capacity, disableNotify, enableNotify, ensureCapacity, getFormat, getMaxIndex, getMinIndex, getName, getValueAt, getValueClass, hasUndefinedValue, isEmpty, isInternal, isValueUndefined, removeChangeListener, setFormat, setName, setSize, setValueAt, setValueOrNullAt, setValueUndefined, size |
Methods inherited from interface infovis.Metadata |
---|
getClientProperty, getMetadata |
Methods inherited from interface cern.colt.function.IntComparator |
---|
compare, equals |
Constructor Detail |
---|
public DefaultVisualization(Table table)
table
- The table.public DefaultVisualization(Table table, ItemRenderer ir)
Table
using the specified
ItemRenderer
for rendering.
table
- the Tableir
- the ItemRenderer or null
Method Detail |
---|
public Visualization getVisualization(int index)
getVisualization
in interface Visualization
index
- the index of the dependent visualization
public Rectangle2D getVisualizationBounds(int index, Rectangle2D.Float bounds)
index
- the visualization indexbounds
- the bounds of the current visualization.
public Visualization findVisualization(Class cls)
findVisualization
in interface Visualization
cls
- the visualization class to find
public void fireVisualColumnDescriptorChanged(String name)
fireVisualColumnDescriptorChanged
in interface Visualization
name
- the name of the ItemRendererpublic VisualColumnDescriptor getVisualColumnDescriptor(String name)
VisualColumnDescriptor
associated
with a specified visual dimension.
getVisualColumnDescriptor
in interface Visualization
name
- the name of the visual dimension
VisualColumnDescriptor
associated
with a specified visual dimension.public Iterator getVisualColumnIterator()
Iterator
on the names of all the
visual columns defined by this visualization.
getVisualColumnIterator
in interface Visualization
Iterator
on the names of all the
visual columns defined by this visualization.public boolean isInvalidateColumn(Column c)
true
if modifying this column triggers a
recomputation of the visualization.
c
- the Column.
true
if modifying this column triggers a
recomputation of the visualization.public boolean setVisualColumn(String name, Column newC)
vis.setVisualColumn("color", dateColumn)
setVisualColumn
in interface Visualization
name
- The name of the visual dimensionnewC
- the column associated with the visual dimension
or null
.
true
is the visualization has been changed.public Column getVisualColumn(String name)
null
.
getVisualColumn
in interface Visualization
name
- the name of the visual dimension
null
.public void setItemRenderer(ItemRenderer root)
ItemRenderer
responsible for
rendering the items of this visualization.
If the specified ItemRenderer
is not instanciated,
it will be instantiated by this method.
setItemRenderer
in interface Visualization
root
- the root ItemRenderer
responsible for
rendering the items of this visualization.public ItemRenderer getItemRenderer()
ItemRenderer
responsible for
rendering the items of this visualization.
getItemRenderer
in interface Visualization
ItemRenderer
responsible for
rendering the items managed by this visualization.public ItemRenderer getItemRenderer(String name)
name
- the name
public static ItemRenderer getItemRenderer(String name, ItemRenderer root)
name
- the nameroot
- the root
public void dispose()
dispose
in interface Visualization
dispose
in class ColumnProxy
public Table getTable()
getTable
in interface Table
getTable
in interface Visualization
getTable
in class TableProxy
public Rectangle2D getBounds()
getBounds
in interface Visualization
public JComponent getParent()
getParent
in interface Visualization
public void setParent(JComponent parent)
setParent
in interface Visualization
parent
- owning VisualizationPanel.public void invalidate(Column c)
invalidate
in interface Visualization
c
- the Column triggering the invalidate/repaint.public Rectangle2D getShapeBoundsAt(int row)
row
- the row
public void invalidate()
invalidate
in interface Visualization
public boolean isInvalidated()
public void repaint()
repaint
in interface Visualization
public void repaint(int row)
row
- the rowpublic BooleanColumn getSelection()
getSelection
in interface Visualization
public FilterColumn getFilter()
getFilter
in interface Visualization
public boolean isFiltered(int row)
true
if the row is filtered.
isFiltered
in interface Visualization
row
- the row.
true
if the row is filtered.public short getOrientation()
getOrientation
in interface Orientable
public void setOrientation(short orientation)
setOrientation
in interface Orientable
orientation
- The orientation to setpublic void paintItem(Graphics2D graphics, int row)
graphics
- the graphics.row
- the row.public final void computeShapes(Rectangle2D bounds)
This method should not be overriden lightly. It
install and desintalls several pieces carfuly. Implementing
the Layout
interface is the
standard way of defining a new visualization algorithm.
bounds
- the bounding box of the visualization.public Layout getLayout()
public void paint(Graphics2D graphics, Rectangle2D bounds)
paint
in interface Visualization
graphics
- the graphics.bounds
- the bounding box of the visualization.public void paintVisualizations(Graphics2D graphics, Rectangle2D bounds)
graphics
- the graphics.bounds
- the bounding box of the visualization.public void print(Graphics2D graphics, Rectangle2D bounds)
print
in interface Visualization
graphics
- the graphics.bounds
- the bounding box of the visualization.public void paintItems(Graphics2D graphics, Rectangle2D bounds)
graphics
- the graphics.bounds
- the bounding box of the visualization.public void validateShapes(Rectangle2D bounds)
validateShapes
in interface Visualization
bounds
- the Visualization bounds.public ShapeColumn getShapes()
public Shape getShapeAt(int row)
getShapeAt
in interface Visualization
row
- the row.
public Rectangle2D.Float getRectAt(int row)
row
- the row
public Rectangle2D.Float findRectAt(int row)
row
- the row
public void freeRectAt(int row)
row
- the row of the rectangle.public void setShapeAt(int row, Shape s)
setShapeAt
in interface Visualization
row
- the row.s
- the shape.public int pickTop(double x, double y, Rectangle2D bounds)
pickTop
in interface Visualization
x
- the X coordinate.y
- the Y coordinate.bounds
- the bounding box of the visualization.
public int pickTop(Rectangle2D hitBox, Rectangle2D bounds)
pickTop
in interface Visualization
hitBox
- the bounds where the top item is searched.bounds
- the total bounds where the visualization is displayed.
public IntArrayList pickAll(Rectangle2D hitBox, Rectangle2D bounds, IntArrayList pick)
pickAll
in interface Visualization
hitBox
- the bounds where the top item is searched.bounds
- the total bounds where the visualization is displayed.pick
- an IntArrayList that will contain each row of items
intersecting the hitBox.
public boolean pickItem(Rectangle2D hitBox, Rectangle2D bounds, Shape s, int row)
hitBox
- the bounds of the pickbounds
- the bounds of the visualizations
- the item shaperow
- the item row
public Permutation getPermutation()
getPermutation
in interface Visualization
public void setPermutation(Permutation perm)
setPermutation
in interface Visualization
perm
- The permutation to setpublic int getRowCount()
getRowCount
in interface Table
getRowCount
in interface Visualization
getRowCount
in interface TableModel
getRowCount
in class TableProxy
public int getRowAtIndex(int index)
getRowAtIndex
in interface Visualization
index
- the index.
public int getRowIndex(int row)
getRowIndex
in interface Visualization
row
- the row.
public RowIterator iterator()
RowIterator
taking the permutation into
account.
iterator
in interface Column
iterator
in interface Visualization
iterator
in class ColumnProxy
RowIterator
taking the permutation into
account.public RowIterator reverseIterator()
reverseIterator
in interface Table
reverseIterator
in interface Visualization
reverseIterator
in class TableProxy
public IntPair computeMinMax(Column c)
c
- the column
public IntPair computeMinMaxFiltered(Column c)
c
- the column
public void stateChanged(ChangeEvent e)
stateChanged
in interface ChangeListener
stateChanged
in class ColumnProxy
public void tableChanged(TableModelEvent e)
tableChanged
in interface TableModelListener
tableChanged
in class TableProxy
public Fisheye getFisheye()
null
.
null
.public void setFisheye(Fisheye fisheye)
fisheye
- The fisheyes to setpublic LabeledComponent.LabeledItem createLabelItem(int row)
LabeledComponent.LabeledItem
for a specified row.
createLabelItem
in interface Visualization
row
- the row
LabeledComponent.LabeledItem
for a specified row.public Set pickAll(Rectangle2D hitBox, Rectangle2D bounds, Set pick)
pickAll
in interface LabeledComponent
hitBox
- the rectangle that the items should intersectbounds
- the bounds of the visualizationpick
- an Set to use or null if a new one has be be allocated.
public JComponent getComponent()
getComponent
in interface LabeledComponent
public void addPropertyChangeListener(PropertyChangeListener l)
addPropertyChangeListener
in interface Visualization
l
- The PropertyChangeListener to be addedpublic void addPropertyChangeListener(String propertyName, PropertyChangeListener listener)
addPropertyChangeListener
in interface Visualization
propertyName
- The name of the property to listen on.listener
- The PropertyChangeListener to be addedpublic void removePropertyChangeListener(PropertyChangeListener l)
removePropertyChangeListener
in interface Visualization
l
- The PropertyChangeListener to be removedpublic void removePropertyChangeListener(String propertyName, PropertyChangeListener listener)
removePropertyChangeListener
in interface Visualization
propertyName
- The name of the property that was listened on.listener
- The PropertyChangeListener to be removedpublic void firePropertyChange(String property, Object oldV, Object newV)
property
- the property nameoldV
- the old valuenewV
- the new valuepublic void firePropertyChange(String property, int oldV, int newV)
property
- the property nameoldV
- the old valuenewV
- the new valuepublic void firePropertyChange(String property, boolean oldV, boolean newV)
property
- the property nameoldV
- the old valuenewV
- the new valuepublic Dimension getPreferredSize()
null
if the Visualization can adapt to any dimension.
getPreferredSize
in interface Visualization
null
if the Visualization can adapt to any dimension.public VisualizationInteractor getInteractor()
VisualizationInteractor
associated with
this Visualization
or null
if no
interaction is managed.
getInteractor
in interface Visualization
VisualizationInteractor
associated with
this Visualization
or null
if no
interaction is managed.public void setInteractor(VisualizationInteractor interactor)
VisualizationInteractor
associated with
this Visualization
or null
if no
interaction is desired.
setInteractor
in interface Visualization
interactor
- the VisualizationInteractor
to set.public Table getRulerTable()
getRulerTable
in interface Visualization
null
if the visualization doesn't support rulers.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |