rangesearch
Class RangeView

java.lang.Object
  extended byjava.awt.Component
      extended byjava.awt.Container
          extended byjavax.swing.JComponent
              extended byjavax.swing.JPanel
                  extended byrangesearch.RangeView
All Implemented Interfaces:
javax.accessibility.Accessible, java.util.EventListener, java.awt.image.ImageObserver, java.awt.MenuContainer, ModelChangedListener, java.awt.event.MouseListener, java.awt.event.MouseMotionListener, java.io.Serializable

public class RangeView
extends javax.swing.JPanel
implements java.awt.event.MouseListener, java.awt.event.MouseMotionListener, ModelChangedListener

Manages the display of and user interaction with a RangeModel (a set of points plus a range).

See Also:
Serialized Form

Nested Class Summary
 
Nested classes inherited from class javax.swing.JPanel
javax.swing.JPanel.AccessibleJPanel
 
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  boolean m_draggingRange
           
protected  javax.swing.event.EventListenerList m_listenerList
           
protected  RangeModel m_model
           
protected  jdsl.geomobj.api.Point2D m_rangePoint1
           
protected  jdsl.core.api.Sequence m_resultPoints
           
protected  int m_selPoint
           
protected  int m_toolMode
           
static int TOOL_NONE
           
static int TOOL_POINT
           
static int TOOL_RANGE
           
 
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
RangeView()
           
 
Method Summary
 void addToolChangedListener(ToolChangedListener l)
          Adds a listener for the ToolChangedEvent.
protected  void drawPoints(java.awt.Graphics2D g2)
          Draws the points in the model.
protected  void drawRange(java.awt.Graphics2D g2)
          Draws the model's range.
protected  void drawResultPoints(java.awt.Graphics2D g2)
          Draws the view's result points.
protected  void drawSelPoint(java.awt.Graphics2D g2)
          Draws the currently selected point.
protected  void fireToolChanged()
          Notifies all listeners that the current tool has changed.
 RangeModel getModel()
          Returns the view's current RangeModel.
 jdsl.core.api.Sequence getResultPoints()
          Returns the collection of result points.
 int getToolMode()
          Returns the current tool identifier.
 void modelChanged(ModelChangedEvent e)
          Handles model changed events.
 void mouseClicked(java.awt.event.MouseEvent e)
          Empty function for MouseListener.
 void mouseDragged(java.awt.event.MouseEvent e)
          Method for handling clicked mouse movement.
 void mouseEntered(java.awt.event.MouseEvent e)
          Empty function for MouseMotionListener.
 void mouseExited(java.awt.event.MouseEvent e)
          Empty function for MouseMotionListener.
 void mouseMoved(java.awt.event.MouseEvent e)
          Method for handling unclicked mouse movement.
 void mousePressed(java.awt.event.MouseEvent e)
          Method for handling mouse presses.
 void mouseReleased(java.awt.event.MouseEvent e)
          Method for handling mouse releases.
protected  void paintComponent(java.awt.Graphics g)
          Displays the graph.
protected  void recalcSelPoint(int x, int y)
          Finds the closest point to the given coordinates and sets it to be selected.
 void removeToolChangedListener(ToolChangedListener l)
          Removes a listener for the ToolChangedEvent.
 void setModel(RangeModel model)
          Sets the view's RangeModel.
 void setResultPoints(jdsl.core.api.Sequence resultPoints)
          Sets the collection of result points.
 void setToolMode(int toolMode)
          Sets the current tool identifier.
 
Methods inherited from class javax.swing.JPanel
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI
 
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, 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, paintImmediately, paintImmediately, 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, invalidate, 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
 

Field Detail

m_toolMode

protected int m_toolMode

m_listenerList

protected javax.swing.event.EventListenerList m_listenerList

m_model

protected RangeModel m_model

m_selPoint

protected int m_selPoint

m_draggingRange

protected boolean m_draggingRange

m_resultPoints

protected jdsl.core.api.Sequence m_resultPoints

m_rangePoint1

protected jdsl.geomobj.api.Point2D m_rangePoint1

TOOL_NONE

public static final int TOOL_NONE
See Also:
Constant Field Values

TOOL_POINT

public static final int TOOL_POINT
See Also:
Constant Field Values

TOOL_RANGE

public static final int TOOL_RANGE
See Also:
Constant Field Values
Constructor Detail

RangeView

public RangeView()
Method Detail

setModel

public void setModel(RangeModel model)
Sets the view's RangeModel.


getModel

public RangeModel getModel()
Returns the view's current RangeModel.


setResultPoints

public void setResultPoints(jdsl.core.api.Sequence resultPoints)
Sets the collection of result points.


getResultPoints

public jdsl.core.api.Sequence getResultPoints()
Returns the collection of result points.


addToolChangedListener

public void addToolChangedListener(ToolChangedListener l)
Adds a listener for the ToolChangedEvent.


removeToolChangedListener

public void removeToolChangedListener(ToolChangedListener l)
Removes a listener for the ToolChangedEvent.


fireToolChanged

protected void fireToolChanged()
Notifies all listeners that the current tool has changed.


setToolMode

public void setToolMode(int toolMode)
Sets the current tool identifier.


getToolMode

public int getToolMode()
Returns the current tool identifier.


paintComponent

protected void paintComponent(java.awt.Graphics g)
Displays the graph.


drawPoints

protected void drawPoints(java.awt.Graphics2D g2)
Draws the points in the model.


drawResultPoints

protected void drawResultPoints(java.awt.Graphics2D g2)
Draws the view's result points.


drawSelPoint

protected void drawSelPoint(java.awt.Graphics2D g2)
Draws the currently selected point.


drawRange

protected void drawRange(java.awt.Graphics2D g2)
Draws the model's range.


recalcSelPoint

protected void recalcSelPoint(int x,
                              int y)
Finds the closest point to the given coordinates and sets it to be selected.


modelChanged

public void modelChanged(ModelChangedEvent e)
Handles model changed events.

Specified by:
modelChanged in interface ModelChangedListener

mouseClicked

public void mouseClicked(java.awt.event.MouseEvent e)
Empty function for MouseListener.

Specified by:
mouseClicked in interface java.awt.event.MouseListener

mouseEntered

public void mouseEntered(java.awt.event.MouseEvent e)
Empty function for MouseMotionListener.

Specified by:
mouseEntered in interface java.awt.event.MouseListener

mouseExited

public void mouseExited(java.awt.event.MouseEvent e)
Empty function for MouseMotionListener.

Specified by:
mouseExited in interface java.awt.event.MouseListener

mousePressed

public void mousePressed(java.awt.event.MouseEvent e)
Method for handling mouse presses.

Specified by:
mousePressed in interface java.awt.event.MouseListener

mouseReleased

public void mouseReleased(java.awt.event.MouseEvent e)
Method for handling mouse releases.

Specified by:
mouseReleased in interface java.awt.event.MouseListener

mouseDragged

public void mouseDragged(java.awt.event.MouseEvent e)
Method for handling clicked mouse movement.

Specified by:
mouseDragged in interface java.awt.event.MouseMotionListener

mouseMoved

public void mouseMoved(java.awt.event.MouseEvent e)
Method for handling unclicked mouse movement. Finds the closest point to the cursor and selects it, as appropriate to the current tool mode.

Specified by:
mouseMoved in interface java.awt.event.MouseMotionListener