|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectjavax.swing.plaf.ComponentUI
org.jdesktop.jxlayer.plaf.LayerUI<V>
org.jdesktop.jxlayer.plaf.AbstractLayerUI<V>
org.jdesktop.jxlayer.plaf.AbstractBufferedLayerUI<V>
org.jdesktop.jxlayer.plaf.BufferedLayerUI<V>
org.jdesktop.jxlayer.plaf.ext.LockableLayerUI<V>
public class LockableLayerUI<V extends javax.swing.JComponent>
An implementation of the BufferedLayerUI which provides
a lightweight disabling for the content of its JXLayer.
This allows temporarily blocking a part of the interface
with all it subcomponents, it is also useful when some kind of action
is in progress, e.g. reading data from a database.
true is passed to the setLocked(boolean),
the JXLayer of this LockableLayerUI becomes "locked".
It sets the "wait" mouse cursor and stops reacting
on mouse, keyboard and focus events.
If setLocked(boolean) is called with false parameter
after that, the JXLayer, together with all its subcomponents,
gets back to live.
Subclasses usually override paintLayer(Graphics2D, JXLayer) or
BufferedLayerUI.getLayerEffects(JXLayer) to implement some visual effects
when JXLayer is in locked state.
Here is an example of using LockableLayerUI:
JComponent myComponent = getMyComponent(); // just any component LockableLayerUI<JComponent> lockableUI = new LockableLayerUI<JComponent>(); JXLayer<JComponent> layer = new JXLayer<JComponent>(myComponent, lockableUI); // locking the layer, use lockableUI.setLocked(false) to unlock lockableUI.setLocked(true); // add the layer to a frame or a panel, like any other component frame.add(layer);The LockableDemo is available
| Constructor Summary | |
|---|---|
LockableLayerUI()
|
|
| Method Summary | |
|---|---|
java.awt.Cursor |
getLockedCursor()
Returns the mouse cursor to be used by this LockableLayerUI when it locked state. |
void |
installUI(javax.swing.JComponent c)
Configures the specified JXLayer appropriate for this AbstractLayerUI.
This method is invoked when the LayerUI instance is being installed
as the UI delegate on the specified JXLayer.
Subclasses can install any listeners to the passed JXLayer,
configure its glassPane or do any other setting up.
The default implementation registers the passed JXLayer
as a LayerItemListener for this AbstractLayerUI.
Note: Subclasses can safely cast the passed component
to the JXLayer<V>
This implementation saves the passed JXLayer instance
and adds itself to it as the PropertyChangeListener |
protected boolean |
isIncrementalUpdate(JXLayer<V> l)
If this method returns false and AbstractLayerUI.isDirty returns false
and the cached image exists and matches the size of painted JXLayer
then the existing image will be used during the painting.
This implementation returns the incremental update flag
set using BufferedLayerUI.setIncrementalUpdate(boolean)
If a BufferedLayerUI provides more extensive API
to support incremental updated depending on its state
or on the state of the passed JXLayer,
this method should be overridden. |
boolean |
isLocked()
Returns true if this LockableLayerUI
is in locked state and all JXLayer's mouse, keyboard and focuse events
are temporarily blocked, otherwise returns false. |
protected void |
paintLayer(java.awt.Graphics2D g2,
JXLayer<V> l)
Subclasses should implement this method and perform custom painting operations here. |
void |
setLocked(boolean isLocked)
If isLocked is true then all mouse, keyboard and focuse events
from the JXLayer of this LockableLayerUI
will be temporarily blocked. |
void |
setLockedCursor(java.awt.Cursor lockedCursor)
Sets the mouse cursor to be used by this LockableLayerUI when it locked state. |
void |
uninstallUI(javax.swing.JComponent c)
Reverses configuration which was done on the specified component during installUI(JComponent). This method is invoked when this
LayerUI instance is being removed as the UI delegate
for the specified JXLayer.
uninstallUI(JComponent) should undo the
configuration performed in installUI(JComponent), being careful to
leave the JXLayer instance in a clean state
(e.g. all previously set listeners must be removed in this method).
The default implementation removes the passed JXLayer
from the LayerItemListener's list of this AbstractLayerUI.
Note: Subclasses can safely cast the passed component
to the JXLayer<V>
This method removes itself from the JXLayer's
PropertyChangeListener's list and nullify
the previously saved JXLayer value. |
void |
updateUI(JXLayer<V> l)
Invoked when JXLayer.updateUI() is called
from the JXLayer this LayerUI is set to. |
| Methods inherited from class org.jdesktop.jxlayer.plaf.BufferedLayerUI |
|---|
getAlpha, getClip, getClip, getComposite, getComposite, getLayer, getLayerEffects, getLayerEffects, getRenderingHints, getRenderingHints, getTransform, getTransform, isIncrementalUpdate, layerItemChanged, propertyChange, setAlpha, setClip, setComposite, setIncrementalUpdate, setLayerEffects, setRenderingHints, setTransform |
| Methods inherited from class org.jdesktop.jxlayer.plaf.AbstractBufferedLayerUI |
|---|
applyLayerEffects, createBuffer, getBuffer, isBufferContentValid, isBufferFormatValid, paint, setBuffer |
| Methods inherited from class org.jdesktop.jxlayer.plaf.AbstractLayerUI |
|---|
addLayerItemListener, configureGraphics, eventDispatched, fireLayerItemChanged, fireLayerItemChanged, getLayerItemListeners, isDirty, isEnabled, processFocusEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, removeLayerItemListener, setDirty, setEnabled |
| Methods inherited from class org.jdesktop.jxlayer.plaf.LayerUI |
|---|
getAccessibleChild, getAccessibleChildrenCount, getMaximumSize, getMinimumSize, getPreferredSize, update |
| Methods inherited from class javax.swing.plaf.ComponentUI |
|---|
contains, createUI |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public LockableLayerUI()
| Method Detail |
|---|
public void installUI(javax.swing.JComponent c)
JXLayer appropriate for this AbstractLayerUI.
This method is invoked when the LayerUI instance is being installed
as the UI delegate on the specified JXLayer.
Subclasses can install any listeners to the passed JXLayer,
configure its glassPane or do any other setting up.
The default implementation registers the passed JXLayer
as a LayerItemListener for this AbstractLayerUI.
Note: Subclasses can safely cast the passed component
to the JXLayer<V>
This implementation saves the passed JXLayer instance
and adds itself to it as the PropertyChangeListener
installUI in class BufferedLayerUI<V extends javax.swing.JComponent>c - the JXLayer where this UI delegate is being installedBufferedLayerUI.uninstallUI(JComponent),
BufferedLayerUI.getLayer()public void uninstallUI(javax.swing.JComponent c)
installUI(JComponent). This method is invoked when this
LayerUI instance is being removed as the UI delegate
for the specified JXLayer.
uninstallUI(JComponent) should undo the
configuration performed in installUI(JComponent), being careful to
leave the JXLayer instance in a clean state
(e.g. all previously set listeners must be removed in this method).
The default implementation removes the passed JXLayer
from the LayerItemListener's list of this AbstractLayerUI.
Note: Subclasses can safely cast the passed component
to the JXLayer<V>
This method removes itself from the JXLayer's
PropertyChangeListener's list and nullify
the previously saved JXLayer value.
uninstallUI in class BufferedLayerUI<V extends javax.swing.JComponent>c - the JXLayer where this UI delegate is being installedBufferedLayerUI.installUI(JComponent),
BufferedLayerUI.getLayer()public boolean isLocked()
true if this LockableLayerUI
is in locked state and all JXLayer's mouse, keyboard and focuse events
are temporarily blocked, otherwise returns false.
true if this LockableLayerUI
is in locked state and all JXLayer's mouse, keyboard and focuse events
are temporarily blocked, otherwise returns falsepublic void setLocked(boolean isLocked)
isLocked is true then all mouse, keyboard and focuse events
from the JXLayer of this LockableLayerUI
will be temporarily blocked.
isLocked - if true then all mouse, keyboard and focuse events
from the JXLayer of this LockableLayerUI will be temporarily blockedprotected boolean isIncrementalUpdate(JXLayer<V> l)
BufferedLayerUIfalse and AbstractLayerUI.isDirty returns false
and the cached image exists and matches the size of painted JXLayer
then the existing image will be used during the painting.
It helps to skip unnecessary painting and save a lot of time,
especially if ImageOpEffects are used.
true the cache image will be updated on every painting.
The default implementation returns false
Note: if you need AbstractBufferedLayerUI to update its
cache on every painting, override #isIncrementalUpdate(JXLayer)
to return true
This implementation returns the incremental update flag
set using BufferedLayerUI.setIncrementalUpdate(boolean)
If a BufferedLayerUI provides more extensive API
to support incremental updated depending on its state
or on the state of the passed JXLayer,
this method should be overridden.
isIncrementalUpdate in class BufferedLayerUI<V extends javax.swing.JComponent>l - the JXLayer being painted
true if the cache image should be updated on every painting,
otherwise returns falseBufferedLayerUI.setIncrementalUpdate(boolean),
BufferedLayerUI.isIncrementalUpdate()
protected void paintLayer(java.awt.Graphics2D g2,
JXLayer<V> l)
AbstractLayerUIJXLayer as is.
paintLayer in class AbstractLayerUI<V extends javax.swing.JComponent>g2 - the Graphics2D context in which to paintl - the JXLayer being paintedpublic void updateUI(JXLayer<V> l)
LayerUIJXLayer.updateUI() is called
from the JXLayer this LayerUI is set to.
updateUI in class LayerUI<V extends javax.swing.JComponent>l - the JXLayer which UI is updatedpublic java.awt.Cursor getLockedCursor()
LockableLayerUI when it locked state.
LockableLayerUI when it locked stategetLockedCursor(),
setLocked(boolean)public void setLockedCursor(java.awt.Cursor lockedCursor)
LockableLayerUI when it locked state.
lockedCursor - the mouse cursor to be used
by this LockableLayerUI when it locked state
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||