jimm.datavision.gui
Class SectionResizer

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 jimm.datavision.gui.SectionResizer
All Implemented Interfaces:
java.awt.event.MouseListener, java.awt.event.MouseMotionListener, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, java.util.EventListener, javax.accessibility.Accessible, javax.swing.event.MouseInputListener

 class SectionResizer
extends javax.swing.JPanel
implements javax.swing.event.MouseInputListener

A section resizer is a bar that the user can drag to resize a section.

Author:
Jim Menard, jimm@io.com

Nested Class Summary
 
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.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
 
Field Summary
protected static java.awt.Color BEVEL_HILIGHT
           
protected static java.awt.Color BEVEL_SHADOW
           
protected  javax.swing.JPanel dragGhost
           
protected static java.awt.Color GHOST_COLOR
           
static int HEIGHT
           
protected  int localY
           
protected  int minY
           
protected  java.awt.Point mousePos
           
protected  javax.swing.JLayeredPane parentWhileDragging
           
protected  int parentWhileDraggingScreenY
           
protected  SectionResizeCommand sectionResizeCommand
           
protected static boolean someoneDragging
           
protected static java.awt.Color SPLITTER_COLOR
           
protected  java.awt.Point start
           
protected  SectionWidget target
           
 
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, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
SectionResizer(SectionWidget target, javax.swing.JLayeredPane parentWhileDragging)
          Constructor.
 
Method Summary
 void mouseClicked(java.awt.event.MouseEvent e)
          Handles mouse clicks.
 void mouseDragged(java.awt.event.MouseEvent e)
          Handles mouse drag events by moving this resizer.
 void mouseEntered(java.awt.event.MouseEvent e)
          Handles mouse entered events by changing the cursor.
 void mouseExited(java.awt.event.MouseEvent e)
          Handles mouse exited events by changing the cursor.
 void mouseMoved(java.awt.event.MouseEvent e)
          Handles mouse moved events.
 void mousePressed(java.awt.event.MouseEvent e)
          Handles mouse presses by starting to drag.
 void mouseReleased(java.awt.event.MouseEvent e)
          Handles mouse released events by repositioning self and asking the target section widget to resize itself.
 
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, getBaseline, getBaselineResizeBehavior, 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, isPaintingForPrint, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, 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

HEIGHT

public static final int HEIGHT
See Also:
Constant Field Values

BEVEL_HILIGHT

protected static final java.awt.Color BEVEL_HILIGHT

SPLITTER_COLOR

protected static final java.awt.Color SPLITTER_COLOR

BEVEL_SHADOW

protected static final java.awt.Color BEVEL_SHADOW

GHOST_COLOR

protected static final java.awt.Color GHOST_COLOR

someoneDragging

protected static boolean someoneDragging

target

protected SectionWidget target

start

protected java.awt.Point start

minY

protected int minY

mousePos

protected java.awt.Point mousePos

dragGhost

protected javax.swing.JPanel dragGhost

localY

protected int localY

parentWhileDragging

protected javax.swing.JLayeredPane parentWhileDragging

parentWhileDraggingScreenY

protected int parentWhileDraggingScreenY

sectionResizeCommand

protected SectionResizeCommand sectionResizeCommand
Constructor Detail

SectionResizer

SectionResizer(SectionWidget target,
               javax.swing.JLayeredPane parentWhileDragging)
Constructor.

Parameters:
target - the section widget we will be resizing
parentWhileDragging - the widget that will be our parent while we are being dragged
Method Detail

mouseClicked

public void mouseClicked(java.awt.event.MouseEvent e)
Handles mouse clicks. Nothing to do.

Specified by:
mouseClicked in interface java.awt.event.MouseListener
Parameters:
e - a mouse event

mouseEntered

public void mouseEntered(java.awt.event.MouseEvent e)
Handles mouse entered events by changing the cursor.

Specified by:
mouseEntered in interface java.awt.event.MouseListener
Parameters:
e - a mouse event

mouseExited

public void mouseExited(java.awt.event.MouseEvent e)
Handles mouse exited events by changing the cursor.

Specified by:
mouseExited in interface java.awt.event.MouseListener
Parameters:
e - a mouse event

mouseMoved

public void mouseMoved(java.awt.event.MouseEvent e)
Handles mouse moved events. Nothing to do.

Specified by:
mouseMoved in interface java.awt.event.MouseMotionListener
Parameters:
e - a mouse event

mousePressed

public void mousePressed(java.awt.event.MouseEvent e)
Handles mouse presses by starting to drag.

Specified by:
mousePressed in interface java.awt.event.MouseListener
Parameters:
e - a mouse event

mouseDragged

public void mouseDragged(java.awt.event.MouseEvent e)
Handles mouse drag events by moving this resizer.

Specified by:
mouseDragged in interface java.awt.event.MouseMotionListener
Parameters:
e - a mouse event

mouseReleased

public void mouseReleased(java.awt.event.MouseEvent e)
Handles mouse released events by repositioning self and asking the target section widget to resize itself.

Specified by:
mouseReleased in interface java.awt.event.MouseListener
Parameters:
e - a mouse event