public class TopComponent extends JComponent implements Externalizable, Accessible, HelpCtx.Provider, Lookup.Provider
Modifier and Type | Class and Description |
---|---|
static interface |
TopComponent.Cloneable
Each top component that wishes to be cloned should implement
this interface, so CloneAction can check it and call the cloneComponent
method.
|
static interface |
TopComponent.Description
Provides basic information about the persistence of a
TopComponent . |
static class |
TopComponent.NodeName
Deprecated.
Please do not use. This support class does nothing much
useful. If you need to synchronize display name of your TopComponent
with some Node's display name, we recommend you to do it manually in
your client's code.
|
static interface |
TopComponent.OpenActionRegistration
Creates an action that can open the component.
|
static interface |
TopComponent.Registration
Registers
TopComponent into specified location among
existing window system modes . |
static interface |
TopComponent.Registry
Registry of all top components.
|
static class |
TopComponent.SubComponent
Representation of a visual sub-component displayed in a TopComponent,
for example sub-tabs in a multiview window.
|
JComponent.AccessibleJComponent
Container.AccessibleAWTContainer
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy
Modifier and Type | Field and Description |
---|---|
static int |
CLOSE_EACH
Deprecated.
Do not use. It is redundant since workspaces are not supported anymore.
|
static int |
CLOSE_LAST
Deprecated.
Do not use. It is redundant since workspaces are not supported anymore.
|
static int |
PERSISTENCE_ALWAYS
Persistence type of TopComponent instance.
|
static int |
PERSISTENCE_NEVER
Persistence type of TopComponent instance.
|
static int |
PERSISTENCE_ONLY_OPENED
Persistence type of TopComponent instance.
|
static String |
PROP_CLOSING_DISABLED
Name of TopComponent's Boolean client property which removes close button
from TopComponent's header and disables its 'Close Window' action when set to Boolean.TRUE.
|
static String |
PROP_DND_COPY_DISABLED
Name of TopComponent's Boolean client property which disables 'copy' drag and drop action
of this TopComponent when set to Boolean.TRUE.
|
static String |
PROP_DRAGGING_DISABLED
Name of TopComponent's Boolean client property which disables drag and drop
when set to Boolean.TRUE.
|
static String |
PROP_KEEP_PREFERRED_SIZE_WHEN_SLIDED_IN
Name of TopComponent's Boolean client property which forces the window system
to respect TopComponent's preferred size when it is slided-in from left/right/bottom
sliding bar when set to Boolean.TRUE.
|
static String |
PROP_MAXIMIZATION_DISABLED
Name of TopComponent's Boolean client property which disables TopComponent
maximization by double-clicking its header when set to Boolean.TRUE.
|
static String |
PROP_SLIDING_DISABLED
Name of TopComponent's Boolean client property which removes 'minimized' button
from TopComponent's header and disables its 'Minimize Window' action when
set to Boolean.TRUE.
|
static String |
PROP_UNDOCKING_DISABLED
Name of TopComponent's Boolean client property which disables TopComponent's
'Undock Window' action when set to Boolean.TRUE.
|
listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
accessibleContext, BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
Constructor and Description |
---|
TopComponent()
Create a top component.
|
TopComponent(Lookup lookup)
Creates a top component for a provided lookup that will delegate
take and synchronize activated nodes and ActionMap from a provided
lookup.
|
Modifier and Type | Method and Description |
---|---|
void |
addNotify() |
protected void |
associateLookup(Lookup lookup)
Associates the provided lookup with the component.
|
List<Mode> |
availableModes(List<Mode> modes)
Allows top component to specify list of modes into which can be docked
by end user.
|
void |
cancelRequestAttention()
Cause this TopComponent's tab to stop flashing if it was flashing.
|
boolean |
canClose()
This method is called when this
TopComponent is about to close. |
boolean |
canClose(Workspace workspace,
boolean last)
Deprecated.
Do not use anymore. Use
canClose() instead.
Both parameters are redundant since workspaces are not supported anymore. |
boolean |
close()
Closes this
TopComponent . |
boolean |
close(Workspace workspace)
Deprecated.
Use
close() instead. |
protected void |
closeNotify()
Deprecated.
Use
componentClosed() instead. |
protected void |
componentActivated()
Called when this component is activated.
|
protected void |
componentClosed()
Called only when top component was closed so that now it is closed
on all workspaces in the system.
|
protected void |
componentDeactivated()
Called when this component is deactivated.
|
protected void |
componentHidden()
Called when
TopComponent was hidden. |
protected void |
componentOpened()
Called only when top component was closed on all workspaces before and
now is opened for the first time on some workspace.
|
protected void |
componentShowing()
Called when
TopComponent is about to be shown. |
AccessibleContext |
getAccessibleContext() |
Action[] |
getActions()
Gets the actions which will appear in the popup menu of this component.
|
Node[] |
getActivatedNodes()
Get the set of activated nodes in this component.
|
int |
getCloseOperation()
Deprecated.
Do not use. It is redundant since workspaces are not supported anymore.
|
String |
getDisplayName()
Gets localized display name of this
TopComponent . |
HelpCtx |
getHelpCtx()
Get the help context for this component.
|
String |
getHtmlDisplayName()
Gets localized display name of this
TopComponent with added
html tags for text coloring and/or font style. |
Image |
getIcon()
Rather than overriding this method, consider using
TopComponent.Description . |
Lookup |
getLookup()
Gets a lookup which represents the "selection" of this component.
|
int |
getPersistenceType()
Rather than overriding this method, consider using
TopComponent.Description . |
static TopComponent.Registry |
getRegistry()
Getter for class that allows obtaining of information about components.
|
String |
getShortName()
Short version of TopComponent's name that doesn't include the name of
activated Node.
|
TopComponent.SubComponent[] |
getSubComponents()
Retrieves sub-components this TopComponent contains.
|
SystemAction[] |
getSystemActions()
Deprecated.
Use
getActions() instead. |
int |
getTabPosition()
Gives position index of opened TopComponent in the mode.
|
UndoRedo |
getUndoRedo()
Get the undo/redo support for this component.
|
boolean |
isOpened()
Indicates whether this
TopComponent is opened. |
boolean |
isOpened(Workspace workspace)
Deprecated.
Use
isOpened() instead. |
void |
makeBusy(boolean busy)
Notify the user that some (possibly lengthy) process is being run in this
window.
|
void |
open()
Shows this
TopComponent . |
void |
open(Workspace workspace)
Deprecated.
Use
open() instead. |
static Action |
openAction(TopComponent component,
String displayName,
String iconBase,
boolean noIconInMenu)
Creates an action that opens and activates given
TopComponent ,
when invoked. |
void |
openAtTabPosition(int position)
Opens TopComponent at given position in the mode.
|
protected void |
openNotify()
Deprecated.
Use
componentOpened() instead. |
protected String |
preferredID()
Rather than overriding this method, consider using
TopComponent.Description . |
protected boolean |
processKeyBinding(KeyStroke ks,
KeyEvent e,
int condition,
boolean pressed)
Overrides superclass method, adds possible additional handling of global keystrokes
in case this
TopComoponent is ancestor of focused component. |
void |
readExternal(ObjectInput in)
Deserialize this top component.
|
void |
requestActive()
Activates this
TopComponent if it is opened. |
void |
requestAttention(boolean brief)
Cause this TopComponent's tab to flash or otherwise draw attention to
itself.
|
void |
requestFocus()
Request focus for the window holding this top component.
|
boolean |
requestFocusInWindow()
Request focus for the top component inside focused window.
|
void |
requestVisible()
Selects this
TopComponent , if it is opened, but does not activate it
unless it is in active mode already. |
void |
setActivatedNodes(Node[] activatedNodes)
Set the set of activated nodes in this component.
|
void |
setAttentionHighlight(boolean highlight)
Permanently highlights this TopComponent's tab until user activates it.
|
void |
setCloseOperation(int closeOperation)
Deprecated.
Do not use. It is redundant since workspaces are not supported anymore.
|
void |
setDisplayName(String displayName)
Sets localized display name of this
TopComponent . |
void |
setHtmlDisplayName(String htmlDisplayName)
Sets localized html display name of this
TopComponent . |
void |
setIcon(Image icon)
Set the icon of this top component.
|
void |
setName(String name)
Set the name of this top component.
|
void |
setToolTipText(String toolTip)
Sets toolTip for this
TopComponent , adds notification
about the change to its WindowManager.TopComponentManager . |
void |
toFront()
Attempts to bring the parent
Window or Frame
of this TopComponent to front of other windows. |
void |
writeExternal(ObjectOutput out)
Serialize this top component.
|
protected Object |
writeReplace()
Delegates instance of replacer class to be serialized instead
of top component itself.
|
addAncestorListener, 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, getUIClassID, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, hide, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingOrigin, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, paramString, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, 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, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update, updateUI
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, transferFocusDownCycle, validate, validateTree
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, 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, setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
@Deprecated public static final int CLOSE_EACH
close()
is called.
This is appropriate for top components such as Editor panes which
the user expects to really close (and prompt to save) when closed
in any@Deprecated public static final int CLOSE_LAST
close()
.
Appropriate for components containing no user data, for which closing
the component is only likely to result from the user's wanting to remove
it from active view (on the current workspace).public static final int PERSISTENCE_ALWAYS
public static final int PERSISTENCE_ONLY_OPENED
public static final int PERSISTENCE_NEVER
public static final String PROP_KEEP_PREFERRED_SIZE_WHEN_SLIDED_IN
public static final String PROP_CLOSING_DISABLED
public static final String PROP_SLIDING_DISABLED
public static final String PROP_UNDOCKING_DISABLED
public static final String PROP_DRAGGING_DISABLED
public static final String PROP_MAXIMIZATION_DISABLED
public static final String PROP_DND_COPY_DISABLED
public TopComponent()
public TopComponent(Lookup lookup)
getLookup()
method,
if not overriden.lookup
- the lookup to associate withpublic void addNotify()
addNotify
in class JComponent
public static final TopComponent.Registry getRegistry()
public final Node[] getActivatedNodes()
null
, null
means such component does not change TopComponent.Registry.getActivatedNodes()
just
TopComponent.Registry.getCurrentNodes()
when this component gets activatedpublic final void setActivatedNodes(Node[] activatedNodes)
activatedNodes
- activated nodes for this componentpublic int getPersistenceType()
TopComponent.Description
.
Overwrite when you want to change default persistence type. Default
persistence type is PERSISTENCE_ALWAYS.
Return value should be constant over a given TC's lifetime.public UndoRedo getUndoRedo()
public void open()
TopComponent
.
Note: This method only makes it visible, but does not
activates it.requestActive()
@Deprecated public void open(Workspace workspace)
open()
instead.TopComponent
in current workspace.
Node: Currently workspaces are not supported. The method has the same effect
like open()
.public final void openAtTabPosition(int position)
position
- Index of the requested position.public final int getTabPosition()
public final boolean isOpened()
TopComponent
is opened.@Deprecated public final boolean isOpened(Workspace workspace)
isOpened()
instead.TopComponent
is opened in current workspace.
Node: Currently workspaces are not supported. The method has the same effect
like isOpened()
.public final boolean close()
TopComponent
.@Deprecated public final boolean close(Workspace workspace)
close()
instead.TopComponent
in current workspace.
Node: Currently workspaces are not supported. The method has the same effect
like close()
.public boolean canClose()
TopComponent
is about to close.
Allows subclasses to decide if TopComponent
is ready to close.@Deprecated public boolean canClose(Workspace workspace, boolean last)
canClose()
instead.
Both parameters are redundant since workspaces are not supported anymore.workspace
- the workspace on which we are about to close or
null which means that component will be closed
on all workspaces where it is opened (CLOSE_EACH mode)last
- true if this is last workspace where top component is
opened, false otherwise. If close operation is set to
CLOSE_EACH, then this param is always true@Deprecated protected void openNotify()
componentOpened()
instead.@Deprecated protected void closeNotify()
componentClosed()
instead.@Deprecated public SystemAction[] getSystemActions()
getActions()
instead.public Action[] getActions()
Subclasses are encouraged to override this method to specify their own sets of actions.
Remember to call the super method when overriding and add your actions to the superclass' ones (in some order), because the default implementation provides support for standard component actions like save, close, and clone.
public static Action openAction(TopComponent component, String displayName, String iconBase, boolean noIconInMenu)
TopComponent
,
when invoked. This method can also be used from
XML Layer
directly by following XML definition:
<file name="your-pkg-action-id.instance"> <attr name="instanceCreate" methodvalue="org.openide.windows.TopComponent.openAction"/> <attr name="component" methodvalue="your.pkg.YourComponent.factoryMethod"/> <attr name="displayName" bundlevalue="your.pkg.Bundle#key"/> <attr name="iconBase" stringvalue="your/pkg/YourComponent.png"/> <!-- if desired: <attr name="noIconInMenu" boolvalue="false"/> --> <!-- if desired: <attr name="preferredID" stringvalue="id.of.your.tc"/> --> </file>The
preferredID
attribute is supported since version
6.37. If specified the action first seeks for existing preferredID
component and if found, it opens and activates it.
Rather than doing all this in XML, consider using TopComponent.OpenActionRegistration
.
component
- the component to opendisplayName
- the display name of the actionimage
- the image to associated with the actionnoIconInMenu
- true if this icon shall not have an item in menuTopComponent.OpenActionRegistration
@Deprecated public final void setCloseOperation(int closeOperation)
closeOperation
- one of CLOSE_EACH
or CLOSE_LAST
IllegalArgumentException
- if an unrecognized close mode was suppliedclose()
@Deprecated public final int getCloseOperation()
CLOSE_EACH
or CLOSE_LAST
protected String preferredID()
TopComponent.Description
.
Subclasses are encouraged to override this method to provide preferred value
for unique TopComponent ID returned by WindowManager.findTopComponentID(org.openide.windows.TopComponent)
.
Returned value should be a String, preferably describing semantics of
TopComponent subclass, such as "PieChartViewer" or "HtmlEditor" etc.
Value is then used by window system as prefix value for creating unique
TopComponent ID.
Returned String value should be preferably unique, but need not be.protected void componentOpened()
protected void componentClosed()
protected void componentShowing()
TopComponent
is about to be shown.
Shown here means the component is selected or resides in it own cell
in container in its Mode
. The container is visible and not minimized.
Note: component is considered to be shown, even its container window is overlapped by another window.
protected void componentHidden()
TopComponent
was hidden. Nore:
Note: Beside typical situations when component is hidden,
it is considered to be hidden even in that case
the component is in Mode
container hierarchy,
the cointainer is visible, not minimized,
but the component is neither selected nor in its own cell,
i.e. it has it's own tab, but is not the selected one.
protected void componentActivated()
protected void componentDeactivated()
public void requestFocus()
opened
first
if it is not already.
Subclasses should override this method to transfer focus to desired
focusable component. TopComponent
itself is not focusable.
See for example text.CloneableEditor
.
Note: Use requestActive()
instead to make TopComponent active
in the window system (not only focused). This method should be considered deprecated
for calling from outside; but it may be overridden (inside of which you may call super).
requestFocus
in class JComponent
public boolean requestFocusInWindow()
opened
first
if it is not already.
Subclasses should override this method to transfer focus to desired
focusable component. TopComponent
itself is not focusable.
See for example text.CloneableEditor
.
Note: Use requestActive()
instead to make TopComponent active
in the window system (not only focused). This method should be considered deprecated
for calling from outside; but it may be overridden (inside of which you may call super).
requestFocusInWindow
in class JComponent
public void requestActive()
TopComponent
if it is opened.public void toFront()
Window
or Frame
of this TopComponent
to front of other windows.public void requestVisible()
TopComponent
, if it is opened, but does not activate it
unless it is in active mode already.public final void requestAttention(boolean brief)
It will remain flashing until either cancelRequestAttention
is called, the component becomes selected or its activated state changes,
unless the brief
argument is true, in which case it will stop
after a few second.
brief
- True if the tab should blink a few times and stoppublic final void makeBusy(boolean busy)
True
- to start 'busy' notification, 'false' to stop it.WindowManager.topComponentMakeBusy(org.openide.windows.TopComponent, boolean)
public final void cancelRequestAttention()
public final void setAttentionHighlight(boolean highlight)
highlight
- True to highlight the tab, false to switch the highlight off.requestAttention(boolean)
public void setName(String name)
public void setDisplayName(String displayName)
TopComponent
.displayName
- localized display name which is setpublic String getDisplayName()
TopComponent
.null
if there is nonepublic String getShortName()
public void setHtmlDisplayName(String htmlDisplayName)
TopComponent
.
Hmtl name usually contains basic html tags for text coloring and style.
Html name may be null if not needed.
Must apparently begin with <html>
.htmlDisplayName
- localized html display name which is setpublic String getHtmlDisplayName()
TopComponent
with added
html tags for text coloring and/or font style. May return null.
Must apparently begin with <html>
.null
if there is nonepublic void setToolTipText(String toolTip)
TopComponent
, adds notification
about the change to its WindowManager.TopComponentManager
.setToolTipText
in class JComponent
public void setIcon(Image icon)
icon
- New components' icon.public Image getIcon()
TopComponent.Description
.public HelpCtx getHelpCtx()
getHelpCtx
in interface HelpCtx.Provider
public List<Mode> availableModes(List<Mode> modes)
So for example, by returning empty list, top component refuses to be docked anywhere.
Default implementation allows docking anywhere by returning input list unchanged.
modes
- list of Mode
which represent all modes of current
workspace, can contain nulls. Items are structured in logical groups
separated by null entries. Input array also contains special constant modes for docking into newly created frames. Their names are "SingleNewMode", "MultiNewMode", "SplitNewMode", can be used for their recognition. Please note that names and existence of special modes can change in future releases.
Mode
which are available for dock, can contain nullsprotected boolean processKeyBinding(KeyStroke ks, KeyEvent e, int condition, boolean pressed)
TopComoponent
is ancestor of focused component.processKeyBinding
in class JComponent
public void writeExternal(ObjectOutput out) throws IOException
writeExternal
in interface Externalizable
out
- the stream to serialize toIOException
public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException
readExternal
in interface Externalizable
in
- the stream to deserialize fromIOException
ClassNotFoundException
protected Object writeReplace() throws ObjectStreamException
ObjectStreamException
public AccessibleContext getAccessibleContext()
getAccessibleContext
in interface Accessible
getAccessibleContext
in class Component
public Lookup getLookup()
By default the lookup includes all nodes from getActivatedNodes()
,
all objects from those nodes' own lookups (excepting the nodes themselves),
and also the component's ActionMap
.
This is useful for components with explorer views.
The default implementation also has a special behavior when you look up
Node.class
: if getActivatedNodes()
is null (as opposed to
an empty array), the result will contain an extra item whose
Lookup.Item.getId()
is none
and whose Lookup.Item.getInstance()
is null.
This can be used by (say) node-sensitive actions to differentiate
between a component with an explorer view that currently happens to have no
selected nodes (zero-length array so no Lookup.Item<Node>
),
vs. a component with no explorer view that would never have a node selection
(null so one dummy Lookup.Item<Node>
);
in either case Lookup.Result.allInstances()
would return an empty collection.
In particular, NodeAction
relies on this behavior to avoid disabling
an action just because focus is transferred from a component with a (potential)
node selection to a component that does not have node selections.
If you override the method in your subclass, the default activatedNodes<->lookup synchronization
will not be performed. That can influence functionality that relies on activated Nodes being present
in the TopComponent's lookup. If you want to preserve the synchronization, use associateLookup(org.openide.util.Lookup)
instead.
getLookup
in interface Lookup.Provider
ContextAwareAction
,
Utilities.actionsToPopup(Action[], Lookup)
protected final void associateLookup(Lookup lookup)
getLookup()
method. When used, make sure
the provided Lookup
contains objects needed by other subsystems.
For example, if callback actions
are about to search their actions in this TopComponent
,
it is good idea to include this.getActionMap()
in
the lookup.lookup
- the lookup to associateIllegalStateException
- if there already is a lookup registered
with this componentpublic TopComponent.SubComponent[] getSubComponents()
Built on June 4 2024. | Copyright © 2017-2024 Apache Software Foundation. All Rights Reserved.