Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

org::openide::windows::TopComponent Class Reference

Collaboration diagram for org::openide::windows::TopComponent:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 TopComponent ()
final Node[] getActivatedNodes ()
final void setActivatedNodes (Node[] nodes)
UndoRedo getUndoRedo ()
void open ()
void open (Workspace workspace)
final boolean isOpened ()
final boolean isOpened (Workspace workspace)
void addNotify ()
final boolean close ()
final boolean close (Workspace workspace)
boolean canClose (Workspace workspace, boolean last)
SystemAction[] getSystemActions ()
javax.swing.Action[] getActions ()
final void setCloseOperation (final int closeOperation)
final int getCloseOperation ()
void requestFocus ()
void requestVisible ()
void setName (final String name)
void setToolTipText (String toolTip)
void setIcon (final Image icon)
Image getIcon ()
HelpCtx getHelpCtx ()
List availableModes (List modes)
void writeExternal (ObjectOutput out) throws IOException
void readExternal (ObjectInput in) throws IOException, ClassNotFoundException
AccessibleContext getAccessibleContext ()
Lookup getLookup ()

Static Public Member Functions

final Registry getRegistry ()

Static Public Attributes

final int CLOSE_EACH = 0
final int CLOSE_LAST = 1

Protected Member Functions

void openNotify ()
void closeNotify ()
void componentOpened ()
void componentClosed ()
void componentShowing ()
void componentHidden ()
void componentActivated ()
void componentDeactivated ()
Object writeReplace () throws ObjectStreamException

Package Functions

final WindowManager.Component getManager ()

Package Attributes

short serialVersion = 1

Static Package Attributes

final long serialVersionUID = -3022538025284122942L

Private Attributes

java.lang.ref.Reference defaultLookupRef = new WeakReference(null)
NodeName nodeName
final WindowManager.Component manager
int closeOperation = CLOSE_LAST

Static Private Attributes

final Log log = LogFactory.getLog(TopComponent.class)
SystemAction[] DEFAULT_ACTIONS
Object defaultLookupLock = new Object ()

Detailed Description

Embeddable visual component to be displayed in the IDE. This is the basic unit of display in the IDE--windows should not be created directly, but rather use this class. A top component may correspond to a single window, but may also be a tab (e.g.) in a window. It may be docked or undocked, have selected nodes, supply actions, etc.

Important serialization note: Serialization of this TopComponent is designed in a way that it's not desired to override writeReplace method. If you would like to resolve to something, please implement readResolve() method directly on your top component.

Author:
Jaroslav Tulach, Petr Hamernik, Jan Jancura


Constructor & Destructor Documentation

org::openide::windows::TopComponent::TopComponent  )  [inline]
 

Create a top component.


Member Function Documentation

void org::openide::windows::TopComponent::addNotify  )  [inline]
 

List org::openide::windows::TopComponent::availableModes List  modes  )  [inline]
 

Allows top component to specify list of modes into which can be docked by end user. Subclasses should override this method if they want to alter docking policy of top component.

So for example, by returning empty list, top component refuses to be docked anywhere.

Default implementation allows docking anywhere by returning input list unchanged.

Parameters:
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.

Returns:
list of Mode which are available for dock, can contain nulls
Since:
2.14

boolean org::openide::windows::TopComponent::canClose Workspace  workspace,
boolean  last
[inline]
 

This method is called when top component is about to close. Allows subclasses to decide if top component is ready for closing or not.
Default implementation always return true.

Parameters:
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
Returns:
true if top component is ready to close, false otherwise.

final boolean org::openide::windows::TopComponent::close Workspace  workspace  )  [inline]
 

Closes the top component on given workspace, if closeOperation is set to CLOSE_LAST. If it is set to CLOSE_EACH, given parameter will be ignored and component will be closed on all workspaces at once.

Parameters:
workspace Workspace on which component should be closed.
Returns:
true if top component was succesfully closed, false if top component for some reason refused to close.

final boolean org::openide::windows::TopComponent::close  )  [inline]
 

Closes the top component on current workspace. First asks canClose() method to see if it is possible to close now. If canClose() returns false, component will not be closed. Semantics of this method depends on top component's closeOperation state. If closeOperation is set to CLOSE_LAST (default), top component will be closed only on current workspace. If it is set to CLOSE_EACH, if will be closed on all workspaces at once.

Returns:
true if top component was succesfully closed, false if top component for some reason refused to close.

void org::openide::windows::TopComponent::closeNotify  )  [inline, protected]
 

Called only when top component was closed so that now it is closed on all workspaces in the system. The intent is to provide subclasses information about TopComponent's life cycle across workspaces. Subclasses will usually perform cleaning tasks here.

Deprecated:
Use componentClosed instead.

void org::openide::windows::TopComponent::componentActivated  )  [inline, protected]
 

Called when this component is activated. This happens when the parent window of this component gets focus (and this component is the preferred one in it), or when this component is selected in its window (and its window was already focussed). Remember to call the super method. The default implementation does nothing.

void org::openide::windows::TopComponent::componentClosed  )  [inline, protected]
 

Called only when top component was closed so that now it is closed on all workspaces in the system. The intent is to provide subclasses information about TopComponent's life cycle across workspaces. Subclasses will usually perform cleaning tasks here.

Since:
2.18

void org::openide::windows::TopComponent::componentDeactivated  )  [inline, protected]
 

Called when this component is deactivated. This happens when the parent window of this component loses focus (and this component is the preferred one in the parent), or when this component loses preference in the parent window (and the parent window is focussed). Remember to call the super method. The default implementation does nothing.

void org::openide::windows::TopComponent::componentHidden  )  [inline, protected]
 

Called when 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.

Since:
2.18

void org::openide::windows::TopComponent::componentOpened  )  [inline, protected]
 

Called only when top component was closed on all workspaces before and now is opened for the first time on some workspace. The intent is to provide subclasses information about TopComponent's life cycle across all existing workspaces. Subclasses will usually perform initializing tasks here.

Since:
2.18

void org::openide::windows::TopComponent::componentShowing  )  [inline, protected]
 

Called when 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.

Since:
2.18

AccessibleContext org::openide::windows::TopComponent::getAccessibleContext  )  [inline]
 

javax.swing.Action [] org::openide::windows::TopComponent::getActions  )  [inline]
 

Gets the actions which will appear in the popup menu of this component.

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.

Returns:
array of actions for this component
Since:
3.32

final Node [] org::openide::windows::TopComponent::getActivatedNodes  )  [inline]
 

Get the set of activated nodes in this component.

Returns:
the activated nodes for this component

final int org::openide::windows::TopComponent::getCloseOperation  )  [inline]
 

Get the current close mode for this component.

Returns:
one of CLOSE_EACH or CLOSE_LAST

HelpCtx org::openide::windows::TopComponent::getHelpCtx  )  [inline]
 

Get the help context for this component. Subclasses should generally override this to return specific help.

Returns:
the help context

Image org::openide::windows::TopComponent::getIcon  )  [inline]
 

Returns:
The icon of the top component

Lookup org::openide::windows::TopComponent::getLookup  )  [inline]
 

Gets lookup which represents context of this component. By default the lookup delegates to result of getActivatedNodes method and result of this component ActionMap delegate.

Returns:
a lookup with designates context of this component
See also:
org.openide.util.ContextAwareAction

org.openide.util.Utilities#actionsToPopup(Action[], Lookup)

Since:
3.29

final WindowManager.Component org::openide::windows::TopComponent::getManager  )  [inline, package]
 

Getter for manager for this component. This manager allows to control where is the component shown can be used to destroy and show the component, etc.

final Registry org::openide::windows::TopComponent::getRegistry  )  [inline, static]
 

Getter for class that allows obtaining of information about components. It allows to find out which component is selected, which nodes are currently or has been activated and list of all components.

Returns:
the registry of components

SystemAction [] org::openide::windows::TopComponent::getSystemActions  )  [inline]
 

Gets the system actions which will appear in the popup menu of this component.

Returns:
array of system actions for this component
Deprecated:
Use getActions() instead.

UndoRedo org::openide::windows::TopComponent::getUndoRedo  )  [inline]
 

Get the undo/redo support for this component. The default implementation returns a dummy support that cannot undo anything.

Returns:
undoable edit for this component

final boolean org::openide::windows::TopComponent::isOpened Workspace  workspace  )  [inline]
 

Finds out whether this top component is opened or not on specified workspace.

Returns:
true if given top component is opened on given workspace, false otherwise

final boolean org::openide::windows::TopComponent::isOpened  )  [inline]
 

Finds out if this top component is opened at least on one workspace.

Returns:
true if given top component is opened on at least one workspace, false otherwise

void org::openide::windows::TopComponent::open Workspace  workspace  )  [inline]
 

Show the component on given workspace. If given workspace is not active, component will be shown only after given workspace will become visible. Note that this method only makes it visible, but does not give it focus.

Parameters:
workspace Workspace on which component should be opened. Parameter can be null -> means current workspace.
See also:
requestFocus

void org::openide::windows::TopComponent::open  )  [inline]
 

Show the component on current workspace. Note that this method only makes it visible, but does not give it focus. Implemented via call to open(null).

See also:
requestFocus

void org::openide::windows::TopComponent::openNotify  )  [inline, protected]
 

Called only when top component was closed on all workspaces before and now is opened for the first time on some workspace. The intent is to provide subclasses information about TopComponent's life cycle across all existing workspaces. Subclasses will usually perform initializing tasks here.

Deprecated:
Use componentOpened instead.

void org::openide::windows::TopComponent::readExternal ObjectInput  in  )  throws IOException, ClassNotFoundException [inline]
 

Deserialize this top component. Subclasses wishing to store state must call the super method, then read from the stream.

Parameters:
in the stream to deserialize from

void org::openide::windows::TopComponent::requestFocus  )  [inline]
 

Request focus for the window holding this top component. Also makes the component preferred in that window. The component will not be automatically 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 org.openide.text.CloneableEditor#requestFocus.

void org::openide::windows::TopComponent::requestVisible  )  [inline]
 

Set this component visible but not selected or focused if possible. If focus is in other container (multitab) or other pane (split) in the same container it makes this component only visible eg. it selects tab with this component. If focus is in the same container (multitab) or in the same pane (split) it has the same effect as requestFocus().

final void org::openide::windows::TopComponent::setActivatedNodes Node[]  nodes  )  [inline]
 

Set the set of activated nodes in this component.

Parameters:
nodes activated nodes for this component

final void org::openide::windows::TopComponent::setCloseOperation final int  closeOperation  )  [inline]
 

Set the close mode for the component.

Parameters:
closeOperation one of CLOSE_EACH or CLOSE_LAST
Exceptions:
IllegalArgumentException if an unrecognized close mode was supplied
See also:
close()

void org::openide::windows::TopComponent::setIcon final Image  icon  )  [inline]
 

Set the icon of this top component. The icon will be used for the component's representation on the screen, e.g. in a multiwindow's tab. The default implementation just notifies the window manager.

Parameters:
icon New components' icon.

void org::openide::windows::TopComponent::setName final String  name  )  [inline]
 

Set the name of this top component. The default implementation just notifies the window manager.

Parameters:
name the new display name

void org::openide::windows::TopComponent::setToolTipText String  toolTip  )  [inline]
 

Sets toolTip for this TopComponent, adds notification about the change to its WindowManager.TopComponentManager.

void org::openide::windows::TopComponent::writeExternal ObjectOutput  out  )  throws IOException [inline]
 

Serialize this top component. Subclasses wishing to store state must call the super method, then write to the stream.

Parameters:
out the stream to serialize to

Object org::openide::windows::TopComponent::writeReplace  )  throws ObjectStreamException [inline, protected]
 

Delegates instance of replacer class to be serialized instead of top component itself. Replacer class calls writeExternal and constructor, readExternal and readResolve methods properly, so 8 any top component can behave like any other externalizable object. Subclasses can override this method to perform their serialization differentrly


Member Data Documentation

final int org::openide::windows::TopComponent::CLOSE_EACH = 0 [static]
 

Behavior in which a top component closed (by the user) in one workspace will be removed from every workspace. Also, 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 workspace.

final int org::openide::windows::TopComponent::CLOSE_LAST = 1 [static]
 

Behavior in which a top component closed (by the user) in one workspace may be left in other workspaces. Only when the last remaining manifestation in any workspace is closed will the object be deleted using 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).

int org::openide::windows::TopComponent::closeOperation = CLOSE_LAST [private]
 

constant for desired close operation

SystemAction [] org::openide::windows::TopComponent::DEFAULT_ACTIONS [static, private]
 

a set of actions of this component

Object org::openide::windows::TopComponent::defaultLookupLock = new Object () [static, private]
 

a lock for operations in default impl of getLookup

java.lang.ref.Reference org::openide::windows::TopComponent::defaultLookupRef = new WeakReference(null) [private]
 

reference to Lookup with default implementation for the component

final Log org::openide::windows::TopComponent::log = LogFactory.getLog(TopComponent.class) [static, private]
 

final WindowManager.Component org::openide::windows::TopComponent::manager [private]
 

manager for the component

NodeName org::openide::windows::TopComponent::nodeName [private]
 

Listener to the data object's node or null

short org::openide::windows::TopComponent::serialVersion = 1 [package]
 

identification of serialization version Used in CloneableTopComponent readObject method.

final long org::openide::windows::TopComponent::serialVersionUID = -3022538025284122942L [static, package]
 

generated Serialized Version UID


The documentation for this class was generated from the following file:
Generated on Thu Apr 30 03:14:04 2009 for ACS Java API by doxygen 1.3.8