org.pbjar.jxlayer.plaf.misc
Class AbstractTransparentMouseUI<V extends JComponent,S>

java.lang.Object
  extended by javax.swing.plaf.ComponentUI
      extended by org.jdesktop.jxlayer.plaf.LayerUI<V>
          extended by org.jdesktop.jxlayer.plaf.AbstractLayerUI<V>
              extended by org.pbjar.jxlayer.plaf.misc.GeneralLayerUI<V,S>
                  extended by org.pbjar.jxlayer.plaf.misc.AbstractTransparentMouseUI<V,S>
Type Parameters:
V - JXLayer's view
S - A state object
All Implemented Interfaces:
Serializable

public abstract class AbstractTransparentMouseUI<V extends JComponent,S>
extends GeneralLayerUI<V,S>

Manages mouse events for JXLayer. Mouse events targeted at the glass pane are dispatched to the glass pane itself and to the children in the component hierarchy. Other mouse events are dispatched only to the children.

Sub classes may apply transformations in order to select a different child component than the component associated with the event..

The AbstractTransparentMouseUI class is not designed for shared use, but shared use may work. I just didn't test it.

Author:
Piet Blok
See Also:
Serialized Form

Constructor Summary
AbstractTransparentMouseUI()
          Construct a new UI with AWTEventListener disabled.
AbstractTransparentMouseUI(boolean enableAWTEventListener)
          Construct a new UI.
 
Method Summary
 void eventDispatched(AWTEvent event, org.jdesktop.jxlayer.JXLayer<V> layer)
          Overridden to allow for re dispatching of mouse events to their intended (visual) recipients, rather than to the components according to their bounds.
 long getLayerEventMask()
          Overridden to only get the following event types: AWTEvent.MOUSE_EVENT_MASK, AWTEvent.MOUSE_MOTION_EVENT_MASK and AWTEvent.MOUSE_WHEEL_EVENT_MASK.
protected abstract  Component getTopLevelUserComponent(org.jdesktop.jxlayer.JXLayer<V> layer)
          Return some component in this hierarchy that serves as the start for a search for deeper components.
protected abstract  Point transformPoint(org.jdesktop.jxlayer.JXLayer<V> layer, Point point)
          When transformations are used, transform a point in device space to a point in component space.
 
Methods inherited from class org.pbjar.jxlayer.plaf.misc.GeneralLayerUI
cleanupStateObject, createStateObject, getActions, getActions, getName, getStateObject, installUI, isAWTEventListenerEnabled, processMouseWheelEvent, uninstallUI
 
Methods inherited from class org.jdesktop.jxlayer.plaf.AbstractLayerUI
configureGraphics, eventDispatched, getClip, getComposite, getRenderingHints, getTransform, handlePropertyChangeEvent, isDirty, paint, paintLayer, processFocusEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, setDirty
 
Methods inherited from class org.jdesktop.jxlayer.plaf.LayerUI
addPropertyChangeListener, addPropertyChangeListener, contains, firePropertyChange, getPreferredScrollableViewportSize, getPropertyChangeListeners, getPropertyChangeListeners, getScrollableBlockIncrement, getScrollableTracksViewportHeight, getScrollableTracksViewportWidth, getScrollableUnitIncrement, removePropertyChangeListener, removePropertyChangeListener, updateUI
 
Methods inherited from class javax.swing.plaf.ComponentUI
createUI, getAccessibleChild, getAccessibleChildrenCount, getBaseline, getBaselineResizeBehavior, getMaximumSize, getMinimumSize, getPreferredSize, update
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractTransparentMouseUI

public AbstractTransparentMouseUI()
Construct a new UI with AWTEventListener disabled.


AbstractTransparentMouseUI

public AbstractTransparentMouseUI(boolean enableAWTEventListener)
Construct a new UI.

Parameters:
enableAWTEventListener - if true, AWTEventListener will be enabled. Specifying true solves a problem with non editable JTextComponents.
Throws:
SecurityException - when enableAWTEventListener is true and if a security manager exists and its checkPermission method doesn't allow the operation.
See Also:
Toolkit.addAWTEventListener(AWTEventListener, long)
Method Detail

eventDispatched

public void eventDispatched(AWTEvent event,
                            org.jdesktop.jxlayer.JXLayer<V> layer)
Overridden to allow for re dispatching of mouse events to their intended (visual) recipients, rather than to the components according to their bounds.


getLayerEventMask

public long getLayerEventMask()
Overridden to only get the following event types: AWTEvent.MOUSE_EVENT_MASK, AWTEvent.MOUSE_MOTION_EVENT_MASK and AWTEvent.MOUSE_WHEEL_EVENT_MASK.

Overrides:
getLayerEventMask in class org.jdesktop.jxlayer.plaf.AbstractLayerUI<V extends JComponent>

getTopLevelUserComponent

protected abstract Component getTopLevelUserComponent(org.jdesktop.jxlayer.JXLayer<V> layer)
Return some component in this hierarchy that serves as the start for a search for deeper components.

Parameters:
layer - The layer
Returns:
a component

transformPoint

protected abstract Point transformPoint(org.jdesktop.jxlayer.JXLayer<V> layer,
                                        Point point)
When transformations are used, transform a point in device space to a point in component space.

Parameters:
layer - The layer
point - A point
Returns:
a transformed point