sonification.dataimport.visbards_resourcetoolkit.resources
Class RangeControllerView

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by javax.swing.JComponent
              extended by javax.swing.JPanel
                  extended by sonification.dataimport.visbards_resourcetoolkit.resources.RangeControllerView
All Implemented Interfaces:
java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, java.util.EventListener, javax.accessibility.Accessible, DatasetContainerListener, RangeControllerListener

public class RangeControllerView
extends javax.swing.JPanel
implements RangeControllerListener, DatasetContainerListener

A GUI component representing a bounded range. The component allows the user to select a portion of the range.

See Also:
Serialized Form

Nested Class Summary
 class RangeControllerView.SelectionPoints
          for testing only
 
Nested classes/interfaces inherited from class javax.swing.JPanel
javax.swing.JPanel.AccessibleJPanel
 
Nested classes/interfaces inherited from class javax.swing.JComponent
javax.swing.JComponent.AccessibleJComponent
 
Nested classes/interfaces inherited from class java.awt.Container
java.awt.Container.AccessibleAWTContainer
 
Nested classes/interfaces inherited from class java.awt.Component
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
 
Field Summary
protected  java.awt.event.ComponentAdapter fComponentListener
           
protected  double fHPadding
           
protected  double fLabelPadding
           
protected  RangeControllerModel fModel
           
protected  java.awt.event.MouseAdapter fMouseListener
           
protected  java.awt.event.MouseMotionAdapter fMouseMotionListener
           
protected  BackdropPainter fPainter
           
protected  double fTextPadding
           
protected  double fVPadding
           
 
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
RangeControllerView()
          constructor
RangeControllerView(DatasetContainer container)
           
RangeControllerView(RangeModel rangeModel)
          constructor
 
Method Summary
protected  void checkEnabeled()
           
 void datasetAdded(DatasetContainer source, Dataset set)
          Indicates that a dataset has been added to the container.
 void datasetRemoved(DatasetContainer source, Dataset set)
          Indicates that a dataset has been removed from the container.
 void delete()
          this method is called when a view is about to be deleted is used to unregister from models and do other clean up.
protected  void drawImage(java.awt.Graphics2D g2, int x, int y, int width, int height)
          Draw the backdrop image into the selection area.
protected  void drawLowerLabels(java.awt.Graphics2D g2, java.awt.FontMetrics fontMetrics, int panelWidth, int y)
           
protected  RangeControllerView.SelectionPoints drawSelectionRect(java.awt.Graphics g, int x, int y, int width, int height)
           
protected  void drawUpperLabels(java.awt.Graphics2D g2, java.awt.FontMetrics fontMetrics, int minX, int startPos, int extPos, int maxX, int y)
           
protected  void enableListeners(boolean enable)
          this helper initializes the OverView
 void encompasingTimeRangesChanged(DatasetContainer source)
          Indicates that time ranges of some datasets have changed.
 BackdropPainter getBackdropPainter()
          Return the BackdropPainter.
 int getHorizontalPadding()
          returns the horizontal padding of the overview
 RangeControllerModel getRangeControllerModel()
          returns the range controller for this view
 java.awt.geom.Rectangle2D.Double getRangeRectangle()
          returns the range rectangle for extended classes that need to manip
 int getSelectionMarginOfError()
          returns the margin of error when selecting with the cursor
 int getVerticalPadding()
          returns the vertical padding of the overview
protected  void handleMouseDrag(java.awt.event.MouseEvent evt)
          this helper method handles mouse drag events
protected  void handleMouseMove(java.awt.event.MouseEvent evt)
          this helper method handles mouse move events
protected  void handleMousePress(java.awt.event.MouseEvent evt)
          this helper method handles mouse presses
protected  void handleMouseRelease(java.awt.event.MouseEvent evt)
          this helper method handles mouse releases
 boolean isUpdatesContinuous()
          returns true if continuous updates or made, false otherwise
 void paintComponent(java.awt.Graphics g)
          this method draws the actual component
 void rangeControllerChanged(RangeControllerEvent event)
          Indicates that the range controller changed.
 void selectedGlyphChanged(DatasetContainer source, Dataset set)
          Indicates that selected glyph has changed in one of the attached datasets.
 void setBackdropPainter(BackdropPainter painter)
          Set a new BackdropPainter to paint the images that appear behind the selection indicator.
 void setHorizontalPadding(int padding)
          sets the horizontal padding of the overview
 void setRangeModel(RangeModel rangeModel)
          sets the range controller model for this view
 void setSelectionMarginOfError(int pixels)
          sets the margin of error when selecting with the cursor
 void setUpdatesContinuous(boolean continuous)
          indicates whether continous updates should be made or not, i.e.
 void setVerticalPadding(int padding)
          sets the vertical padding of the overview
protected  void updateMinExtent()
          updates the minimum extent based on the current size of the range controller and the model's min/max values
 
Methods inherited from class javax.swing.JPanel
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, 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, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, 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, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, 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, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, 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
 

Field Detail

fModel

protected RangeControllerModel fModel

fHPadding

protected double fHPadding

fVPadding

protected double fVPadding

fTextPadding

protected double fTextPadding

fLabelPadding

protected double fLabelPadding

fPainter

protected BackdropPainter fPainter

fMouseListener

protected java.awt.event.MouseAdapter fMouseListener

fMouseMotionListener

protected java.awt.event.MouseMotionAdapter fMouseMotionListener

fComponentListener

protected java.awt.event.ComponentAdapter fComponentListener
Constructor Detail

RangeControllerView

public RangeControllerView()
constructor


RangeControllerView

public RangeControllerView(RangeModel rangeModel)
constructor

Parameters:
rangeModel - the range model for this view

RangeControllerView

public RangeControllerView(DatasetContainer container)
Method Detail

checkEnabeled

protected void checkEnabeled()

enableListeners

protected void enableListeners(boolean enable)
this helper initializes the OverView


delete

public void delete()
this method is called when a view is about to be deleted is used to unregister from models and do other clean up.


setRangeModel

public void setRangeModel(RangeModel rangeModel)
sets the range controller model for this view


getRangeControllerModel

public RangeControllerModel getRangeControllerModel()
returns the range controller for this view


setHorizontalPadding

public void setHorizontalPadding(int padding)
sets the horizontal padding of the overview


getHorizontalPadding

public int getHorizontalPadding()
returns the horizontal padding of the overview


setVerticalPadding

public void setVerticalPadding(int padding)
sets the vertical padding of the overview


getVerticalPadding

public int getVerticalPadding()
returns the vertical padding of the overview


setSelectionMarginOfError

public void setSelectionMarginOfError(int pixels)
sets the margin of error when selecting with the cursor


getSelectionMarginOfError

public int getSelectionMarginOfError()
returns the margin of error when selecting with the cursor


rangeControllerChanged

public void rangeControllerChanged(RangeControllerEvent event)
Indicates that the range controller changed.

Specified by:
rangeControllerChanged in interface RangeControllerListener

paintComponent

public void paintComponent(java.awt.Graphics g)
this method draws the actual component

Overrides:
paintComponent in class javax.swing.JComponent

drawImage

protected void drawImage(java.awt.Graphics2D g2,
                         int x,
                         int y,
                         int width,
                         int height)
Draw the backdrop image into the selection area.


drawSelectionRect

protected RangeControllerView.SelectionPoints drawSelectionRect(java.awt.Graphics g,
                                                                int x,
                                                                int y,
                                                                int width,
                                                                int height)

drawUpperLabels

protected void drawUpperLabels(java.awt.Graphics2D g2,
                               java.awt.FontMetrics fontMetrics,
                               int minX,
                               int startPos,
                               int extPos,
                               int maxX,
                               int y)

drawLowerLabels

protected void drawLowerLabels(java.awt.Graphics2D g2,
                               java.awt.FontMetrics fontMetrics,
                               int panelWidth,
                               int y)

handleMouseMove

protected void handleMouseMove(java.awt.event.MouseEvent evt)
this helper method handles mouse move events


handleMouseDrag

protected void handleMouseDrag(java.awt.event.MouseEvent evt)
this helper method handles mouse drag events


handleMousePress

protected void handleMousePress(java.awt.event.MouseEvent evt)
this helper method handles mouse presses


handleMouseRelease

protected void handleMouseRelease(java.awt.event.MouseEvent evt)
this helper method handles mouse releases


setUpdatesContinuous

public void setUpdatesContinuous(boolean continuous)
indicates whether continous updates should be made or not, i.e. if events should be fired while the user is manipulating the controller


isUpdatesContinuous

public boolean isUpdatesContinuous()
returns true if continuous updates or made, false otherwise


updateMinExtent

protected void updateMinExtent()
updates the minimum extent based on the current size of the range controller and the model's min/max values


setBackdropPainter

public void setBackdropPainter(BackdropPainter painter)
Set a new BackdropPainter to paint the images that appear behind the selection indicator.


getBackdropPainter

public BackdropPainter getBackdropPainter()
Return the BackdropPainter.


getRangeRectangle

public java.awt.geom.Rectangle2D.Double getRangeRectangle()
returns the range rectangle for extended classes that need to manip


datasetAdded

public void datasetAdded(DatasetContainer source,
                         Dataset set)
Indicates that a dataset has been added to the container.

Specified by:
datasetAdded in interface DatasetContainerListener

datasetRemoved

public void datasetRemoved(DatasetContainer source,
                           Dataset set)
Indicates that a dataset has been removed from the container.

Specified by:
datasetRemoved in interface DatasetContainerListener

encompasingTimeRangesChanged

public void encompasingTimeRangesChanged(DatasetContainer source)
Indicates that time ranges of some datasets have changed.

Specified by:
encompasingTimeRangesChanged in interface DatasetContainerListener

selectedGlyphChanged

public void selectedGlyphChanged(DatasetContainer source,
                                 Dataset set)
Indicates that selected glyph has changed in one of the attached datasets.

Specified by:
selectedGlyphChanged in interface DatasetContainerListener