edu.psu.geovista.app.parvis.gui
Class ParallelDisplay

java.lang.Object
  extended byjava.awt.Component
      extended byjava.awt.Container
          extended byjavax.swing.JComponent
              extended byedu.psu.geovista.app.parvis.gui.ParallelDisplay
All Implemented Interfaces:
javax.swing.event.ChangeListener, java.util.EventListener, ExcentricLabelClient, java.awt.image.ImageObserver, edu.psu.geovista.ui.event.IndicationListener, java.awt.MenuContainer, edu.psu.geovista.ui.event.SelectionListener, java.io.Serializable

public class ParallelDisplay
extends javax.swing.JComponent
implements javax.swing.event.ChangeListener, edu.psu.geovista.ui.event.IndicationListener, edu.psu.geovista.ui.event.SelectionListener, ExcentricLabelClient

The swing GUI Component for displaying a parallel coordinate visualisation. Note that the actual rendering is done by the UI delegate, ParallelDisplayUI (with its single subclass BasiParallelDisplayUI). This class is used to store the state of the component and interact with the environment.

Version:
0.1
Author:
Flo Ledermann flo@subnet.at
See Also:
Serialized Form

Nested Class Summary
 
Nested classes inherited from class javax.swing.JComponent
javax.swing.JComponent.AccessibleJComponent
 
Nested classes inherited from class java.awt.Container
java.awt.Container.AccessibleAWTContainer
 
Nested classes inherited from class java.awt.Component
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
 
Field Summary
protected  int[] axisOrder
          axis -> dimension linking.
static int BRUSH
           
protected  java.awt.Color brushedColor
           
protected  float[] brushValues
          brushed values of records
 boolean deepRepaint
          Whether we have to redraw the whole background.
protected  int editMode
          The mode of interaction we are in.
 int indication
           
static int INVERT
          used to invert axis orientation
protected  java.awt.Color recordColor
           
static int REORDER
           
static int SCALE
           
static int TRANSLATE
           
 
Fields inherited from class javax.swing.JComponent
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
ParallelDisplay()
          Creates a new ParallelDisplay.
ParallelDisplay(ParallelSpaceModel model)
          Creates a new ParallelDisplay with the given model.
 
Method Summary
 void addIndicationListener(edu.psu.geovista.ui.event.IndicationListener l)
          adds an IndicationListener
 void addProgressListener(ProgressListener l)
           
 void addSelectionListener(edu.psu.geovista.ui.event.SelectionListener l)
          adds an SelectionListener
 int[] findSelection()
           
 void fireIndicationChanged(int newIndication)
          Notify all listeners that have registered interest for notification on this event type.
 void fireProgressEvent(ProgressEvent e)
           
 void fireSelectionChanged()
          Notify all listeners that have registered interest for notification on this event type.
protected  int getAxis(int order)
          Returns the dimension associated with the given axis.
 java.lang.String getAxisLabel(int num)
          Returns a String label for a specific axis.
 float getAxisOffset(int num)
          Returns the current offset (translation in axis units) for the axis.
 float getAxisScale(int num)
          Returns the current scale (visible region in axis units) for the axis.
 boolean getBoolPreference(java.lang.String key)
           
 java.awt.Color getBrushedColor()
           
 int getBrushedCount()
           
 float getBrushValue(int num)
           
 int getEditMode()
          Returns the currently active interaction mode.
 float getFloatPreference(java.lang.String key)
           
protected  ParallelSpaceModel getModel()
          Returns the model.
 int getNumAxes()
          Returns the number of axes to display.
 int getNumRecords()
          Returns the number of Records in the model.
 java.lang.String getObservationLabel(int i)
           
 java.awt.Color getRecordColor()
           
 java.lang.String getRecordLabel(int num)
           
 int[] getRecordsByValueRange(int axisnum, float min, float max)
           
 java.awt.Shape getShapeAt(int i)
           
 ParallelDisplayUI getUI()
           
 java.lang.String getUIClassID()
          Swing method.
 float getValue(int recordNum, int axisNum)
           
 void indicationChanged(edu.psu.geovista.ui.event.IndicationEvent e)
          Added by Frank Hardisty 19 July 2002
protected  void init(ParallelSpaceModel model)
          Initializes the component with the given model.
 void invalidate()
          Invalidates the component and causes a complete repaint.
 void minMaxAbsScale()
          Configures (scales, translates) all axes to show values between zero (or the nagative minimum of all axes) and the maximum value of all axes on a maximum scale.
 void minMaxScale()
          Configures (scales, translates) all axes to show all values between its minimum and its maximum on a maximum scale.
 int[] pickAll(java.awt.geom.Rectangle2D hitBox)
           
 void removeIndicationListener(edu.psu.geovista.ui.event.IndicationListener l)
          removes an IndicationListener from the component
 void removeProgressListener(ProgressListener l)
           
 void removeSelectionListener(edu.psu.geovista.ui.event.SelectionListener l)
          removes an SelectionListener from the component
 void selectionChanged(edu.psu.geovista.ui.event.SelectionEvent e)
           
 void setAxisOffset(int axis, float offset)
          Sets the offset (translation in axis units) for the axis.
 void setAxisOrder(int[] order)
          Sets up the axis -> dimension assignment.
 void setAxisScale(int axis, float scale)
          Sets the scale (visible region in axis units) for the axis.
 void setBoolPreference(java.lang.String key, boolean val)
           
 void setBrushValue(int num, float val)
           
 void setDefaultPreferences()
           
 void setEditMode(int mode)
          Sets the mode for user interaction with the display.
 void setFloatPreference(java.lang.String key, float val)
           
 void setModel(ParallelSpaceModel model)
          Sets the model to display.
 void setUI(ParallelDisplayUI ui)
          Sets the user interface delegate for the component.
 void stateChanged(javax.swing.event.ChangeEvent e)
          Invoked when the model has changed its state.
 void swapAxes(int axis1, int axis2)
          Swaps two axes.
 void updateUI()
          Swing method.
 void varMinMaxScale(int var)
          Configures (scales, translates) all axes to show all values between the minimum and its maximum of the given variable.
 void zeroMaxScale()
          Configures (scales, translates) all axes to show all values between zero and its maximum on a maximum scale.
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addPropertyChangeListener, addPropertyChangeListener, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getAccessibleContext, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBorder, getBounds, getClientProperty, getComponentGraphics, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getGraphics, getHeight, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPreferredSize, getPropertyChangeListeners, getPropertyChangeListeners, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isPreferredSizeSet, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, paramString, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFont, setForeground, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, insets, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setFocusCycleRoot, setFocusTraversalKeys, setFocusTraversalPolicy, setLayout, transferFocusBackward, transferFocusDownCycle, validate, validateTree
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMouseWheelListeners, getName, getParent, getPeer, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface edu.psu.geovista.ui.ExcentricLabelClient
repaint
 

Field Detail

axisOrder

protected int[] axisOrder
axis -> dimension linking.


brushValues

protected float[] brushValues
brushed values of records


recordColor

protected java.awt.Color recordColor

brushedColor

protected java.awt.Color brushedColor

editMode

protected int editMode
The mode of interaction we are in.


REORDER

public static final int REORDER
See Also:
Constant Field Values

SCALE

public static final int SCALE
See Also:
Constant Field Values

TRANSLATE

public static final int TRANSLATE
See Also:
Constant Field Values

INVERT

public static final int INVERT
used to invert axis orientation

See Also:
Constant Field Values

BRUSH

public static final int BRUSH
See Also:
Constant Field Values

deepRepaint

public boolean deepRepaint
Whether we have to redraw the whole background. This is usually only needed if the model changes.


indication

public int indication
Constructor Detail

ParallelDisplay

public ParallelDisplay()
Creates a new ParallelDisplay.


ParallelDisplay

public ParallelDisplay(ParallelSpaceModel model)
Creates a new ParallelDisplay with the given model.

Parameters:
model - The model to display.
Method Detail

init

protected void init(ParallelSpaceModel model)
Initializes the component with the given model.

Parameters:
model - The model to use.

getAxis

protected int getAxis(int order)
Returns the dimension associated with the given axis. Note that the assignment axisNumber (in the display) => dimensionNumber (in the model) is only the default setting, the axes might be reordered, or some dimensions may even be left out or displayed twice. So be sure to always call this function before querying the model to "convert" the axis number to the right deímension value.

Parameters:
order - The number of the axis to get the dimension number for.
Returns:
The number of the dimnesion to display on the given axis.

getNumAxes

public int getNumAxes()
Returns the number of axes to display. Note that this is not necessarily equal to the number of dimensions in the model (see above: getAxis()).

Returns:
The number of axes to display.

swapAxes

public void swapAxes(int axis1,
                     int axis2)
Swaps two axes. This means the dimensions assigned to the two axes are swapped.

Parameters:
axis1 - The first axis.
axis2 - The second axis.

setAxisOrder

public void setAxisOrder(int[] order)
Sets up the axis -> dimension assignment. See above: getAxis();

Parameters:
order - An array containing the int ids of the dimensions to be displayed on the axes.

setModel

public void setModel(ParallelSpaceModel model)
Sets the model to display.

Parameters:
model - The model to display.

setEditMode

public void setEditMode(int mode)
Sets the mode for user interaction with the display.

Parameters:
mode - The interaction mode to use.

getEditMode

public int getEditMode()
Returns the currently active interaction mode.

Returns:
The currently active interaction mode.

getModel

protected ParallelSpaceModel getModel()
Returns the model. Actually the model should be hidden, because of the confusion that might occur by mistaking axes and dimensions (see above: getAxis()). This requires a rewrite of some parts of the code, so this is marked to do!

Returns:
The model that is currently displayed ba the component.

getNumRecords

public int getNumRecords()
Returns the number of Records in the model.


getRecordLabel

public java.lang.String getRecordLabel(int num)

getValue

public float getValue(int recordNum,
                      int axisNum)

findSelection

public int[] findSelection()

getBrushValue

public float getBrushValue(int num)

setBrushValue

public void setBrushValue(int num,
                          float val)

getBrushedCount

public int getBrushedCount()

getRecordsByValueRange

public int[] getRecordsByValueRange(int axisnum,
                                    float min,
                                    float max)

getRecordColor

public java.awt.Color getRecordColor()

getBrushedColor

public java.awt.Color getBrushedColor()

setUI

public void setUI(ParallelDisplayUI ui)
Sets the user interface delegate for the component.


getUI

public ParallelDisplayUI getUI()

invalidate

public void invalidate()
Invalidates the component and causes a complete repaint.


updateUI

public void updateUI()
Swing method.


getUIClassID

public java.lang.String getUIClassID()
Swing method.


stateChanged

public void stateChanged(javax.swing.event.ChangeEvent e)
Invoked when the model has changed its state.

Specified by:
stateChanged in interface javax.swing.event.ChangeListener
Parameters:
e - A ChangeEvent object

indicationChanged

public void indicationChanged(edu.psu.geovista.ui.event.IndicationEvent e)
Added by Frank Hardisty 19 July 2002

Specified by:
indicationChanged in interface edu.psu.geovista.ui.event.IndicationListener

selectionChanged

public void selectionChanged(edu.psu.geovista.ui.event.SelectionEvent e)
Specified by:
selectionChanged in interface edu.psu.geovista.ui.event.SelectionListener

getAxisOffset

public float getAxisOffset(int num)
Returns the current offset (translation in axis units) for the axis.

Parameters:
num - The axis number.
Returns:
The offset value.

getAxisScale

public float getAxisScale(int num)
Returns the current scale (visible region in axis units) for the axis.

Parameters:
num - The axis number.
Returns:
The scale value.

getAxisLabel

public java.lang.String getAxisLabel(int num)
Returns a String label for a specific axis.

Parameters:
num - The axis number.
Returns:
A Human-readable label for the axis.

setAxisOffset

public void setAxisOffset(int axis,
                          float offset)
Sets the offset (translation in axis units) for the axis.

Parameters:
axis - The axis number.
offset - The offset value.

setAxisScale

public void setAxisScale(int axis,
                         float scale)
Sets the scale (visible region in axis units) for the axis.

Parameters:
axis - The axis number.
scale - The scale value.

minMaxScale

public void minMaxScale()
Configures (scales, translates) all axes to show all values between its minimum and its maximum on a maximum scale.


varMinMaxScale

public void varMinMaxScale(int var)
Configures (scales, translates) all axes to show all values between the minimum and its maximum of the given variable.


zeroMaxScale

public void zeroMaxScale()
Configures (scales, translates) all axes to show all values between zero and its maximum on a maximum scale.


minMaxAbsScale

public void minMaxAbsScale()
Configures (scales, translates) all axes to show values between zero (or the nagative minimum of all axes) and the maximum value of all axes on a maximum scale.


addProgressListener

public void addProgressListener(ProgressListener l)

removeProgressListener

public void removeProgressListener(ProgressListener l)

fireProgressEvent

public void fireProgressEvent(ProgressEvent e)

setDefaultPreferences

public void setDefaultPreferences()

setFloatPreference

public void setFloatPreference(java.lang.String key,
                               float val)

setBoolPreference

public void setBoolPreference(java.lang.String key,
                              boolean val)

getBoolPreference

public boolean getBoolPreference(java.lang.String key)

getFloatPreference

public float getFloatPreference(java.lang.String key)

getObservationLabel

public java.lang.String getObservationLabel(int i)
Specified by:
getObservationLabel in interface ExcentricLabelClient

getShapeAt

public java.awt.Shape getShapeAt(int i)
Specified by:
getShapeAt in interface ExcentricLabelClient

pickAll

public int[] pickAll(java.awt.geom.Rectangle2D hitBox)
Specified by:
pickAll in interface ExcentricLabelClient

addIndicationListener

public void addIndicationListener(edu.psu.geovista.ui.event.IndicationListener l)
adds an IndicationListener


removeIndicationListener

public void removeIndicationListener(edu.psu.geovista.ui.event.IndicationListener l)
removes an IndicationListener from the component


fireIndicationChanged

public void fireIndicationChanged(int newIndication)
Notify all listeners that have registered interest for notification on this event type. The event instance is lazily created using the parameters passed into the fire method.

See Also:
EventListenerList

addSelectionListener

public void addSelectionListener(edu.psu.geovista.ui.event.SelectionListener l)
adds an SelectionListener


removeSelectionListener

public void removeSelectionListener(edu.psu.geovista.ui.event.SelectionListener l)
removes an SelectionListener from the component


fireSelectionChanged

public void fireSelectionChanged()
Notify all listeners that have registered interest for notification on this event type. The event instance is lazily created using the parameters passed into the fire method.

See Also:
EventListenerList


Copyright © 1996-2003 GeoVista Center. All Rights Reserved.