|
org.netbeans.modules.editor.lib2/1 1.43.1 10 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.netbeans.api.editor.EditorRegistry
public final class EditorRegistry
Registry maintaining JTextComponent
s in most-recently-used order.
The particular text component needs to register itself first (to avoid dealing
with all the JTextFields etc.). Then the registry will attach
a focus listener to the text component and once the component gains
the focus it will move to the head of the components list.
The registry will also fire a change in case a document property
of the focused component changes (by calling component.setDocument()).
Field Summary | |
---|---|
static String |
COMPONENT_REMOVED_PROPERTY
Fired when a component (returned previously from componentList() )
is removed from component hierarchy (so it's likely that the component will be released completely
and garbage-collected). |
static String |
FOCUS_GAINED_PROPERTY
Fired when focus was delivered to a registered text component. |
static String |
FOCUS_LOST_PROPERTY
Fired when a registered focused component has lost the focus. |
static String |
FOCUSED_DOCUMENT_PROPERTY
Fired when document property of the focused component changes i.e. |
static String |
LAST_FOCUSED_REMOVED_PROPERTY
Fired when the last focused component (returned previously from lastFocusedComponent() )
was removed from component hierarchy (so it's likely that the component will be released completely
and garbage-collected). |
Method Summary | |
---|---|
static void |
addPropertyChangeListener(PropertyChangeListener l)
Add a property change listener for either of the following properties: FOCUS_GAINED_PROPERTY
FOCUS_LOST_PROPERTY
FOCUSED_DOCUMENT_PROPERTY
. |
static List<? extends JTextComponent> |
componentList()
Get list of all components present in the registry starting with the most active and ending with least active component. |
static JTextComponent |
focusedComponent()
Return the last focused component if it currently has a focus or return null if none of the registered components currently have the focus. |
static JTextComponent |
lastFocusedComponent()
Return last focused text component (from the ones included in the registry). |
static void |
removePropertyChangeListener(PropertyChangeListener l)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final String FOCUS_GAINED_PROPERTY
PropertyChangeEvent.getOldValue()
will be a component
losing the focus FocusEvent.getOppositeComponent()
.
The PropertyChangeEvent.getNewValue()
will be the text component gaining the focus.
public static final String FOCUS_LOST_PROPERTY
PropertyChangeEvent.getOldValue()
will be the text component
losing the focus and the PropertyChangeEvent.getNewValue()
will be the component gaining the focus FocusEvent.getOppositeComponent()
.
public static final String FOCUSED_DOCUMENT_PROPERTY
JTextComponent.setDocument(Document)
.
PropertyChangeEvent.getOldValue()
will be the original document
of the focused text component and the PropertyChangeEvent.getNewValue()
will be the new document set to the focused text component.
public static final String COMPONENT_REMOVED_PROPERTY
componentList()
)
is removed from component hierarchy (so it's likely that the component will be released completely
and garbage-collected).
componentList()
or lastFocusedComponent()
.
PropertyChangeEvent.getOldValue()
will be the removed
component.
PropertyChangeEvent.getNewValue()
returns null
public static final String LAST_FOCUSED_REMOVED_PROPERTY
lastFocusedComponent()
)
was removed from component hierarchy (so it's likely that the component will be released completely
and garbage-collected).
componentList()
or lastFocusedComponent()
.
PropertyChangeEvent.getOldValue()
will be the removed
last focused component and the PropertyChangeEvent.getNewValue()
will be the component that would currently be returned from lastFocusedComponent()
.
PropertyChangeEvent.getNewValue()
returns null
then there are no longer any registered components
(componentList()
would return empty list). If the client
holds per-last-focused-component data it should clear them.
Method Detail |
---|
public static JTextComponent lastFocusedComponent()
public static JTextComponent focusedComponent()
public static List<? extends JTextComponent> componentList()
public static void addPropertyChangeListener(PropertyChangeListener l)
l
- non-null listener to add.public static void removePropertyChangeListener(PropertyChangeListener l)
|
org.netbeans.modules.editor.lib2/1 1.43.1 10 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |