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

Inheritance diagram for org::openide::windows::TopComponent:
Inheritance graph
[legend]
Collaboration diagram for org::openide::windows::TopComponent:
Collaboration graph
[legend]

List of all members.

Classes

interface  Cloneable
class  NodeName
interface  Registry
class  Replacer

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

static final Registry getRegistry ()

Static Public Attributes

static final int CLOSE_EACH = 0
static 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

static 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

static final Log log = LogFactory.getLog(TopComponent.class)
static SystemAction[] DEFAULT_ACTIONS
static 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.

References log, and manager.


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.

Reimplemented in cern::laser::guiplatform::windows::login::AlarmConsoleLoginWindow.

Referenced by close().

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.

References canClose(), CLOSE_EACH, CLOSE_LAST, closeOperation, and getManager().

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.

Referenced by cern::laser::guiplatform::windows::search::SearchWindow::cancelButtonActionPerformed(), cern::laser::guiplatform::windows::search::CategorySelectorWindow::cancelButtonActionPerformed(), cern::laser::guiplatform::windows::login::AlarmConsoleLoginWindow::cancelButtonActionPerformed(), cern::laser::guiplatform::windowmanager::AcWindowManager::closeAllTopComponents(), cern::laser::guiplatform::windows::alarms::AlarmTimestampsPanel::closeButtonActionPerformed(), cern::laser::guiplatform::windowmanager::AcWindowManager::closeComponent(), cern::laser::guiplatform::windowmanager::AcWindowManager::closeComponents(), cern::laser::guiplatform::windows::configuration::ConsoleConfigurationPanel::initComponents(), cern::laser::guiplatform::windows::login::AlarmConsoleLoginWindow::login(), cern::laser::guiplatform::windows::search::ProgressDialog::onSearchException(), cern::laser::guiplatform::windows::search::SearchWindow::searchButtonActionPerformed(), cern::laser::guiplatform::windows::search::CategorySelectorWindow::searchButtonActionPerformed(), and cern::laser::guiplatform::windows::search::ProgressDialog::searchFinished().

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.

Referenced by componentClosed().

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

Reimplemented in cern::laser::guiplatform::windows::configuration::ConsoleConfigurationWindow, and cern::laser::guiplatform::windows::login::AlarmConsoleLoginWindow.

References closeNotify().

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

References openNotify().

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

References getSystemActions().

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

Get the set of activated nodes in this component.

Returns:
the activated nodes for this component

References getManager().

Referenced by org::openide::windows::DummyWindowManager::R::getCurrentNodes(), and org::openide::windows::DummyWindowManager::R::setActive().

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

Get the current close mode for this component.

Returns:
one of CLOSE_EACH or CLOSE_LAST

References closeOperation.

Referenced by cern::laser::guiplatform::windowmanager::AcWindowManager::printAllComponents().

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

Reimplemented in cern::laser::guiplatform::windows::search::SearchWindow.

Image org::openide::windows::TopComponent::getIcon (  )  [inline]
Returns:
The icon of the top component

References getManager().

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

References defaultLookupLock, and defaultLookupRef.

Referenced by cern::laser::test::ExplorerIssue::actionForComp(), cern::gp::actions::support::ActionUtils::actionForComp(), and cern::laser::guiplatform::util::actions::ActionUtils::createActionForComp().

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

Overrides superclass method, adds possible additional handling of global keystrokes in case this TopComoponent is ancestor of focused component. 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.

References manager.

Referenced by close(), getActivatedNodes(), getIcon(), isOpened(), open(), requestFocus(), requestVisible(), setActivatedNodes(), setIcon(), setName(), and setToolTipText().

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

Create a top component associated with a data object. Currently the data object is used to set the component's name (which will be updated according to the object's node delegate) by installing NodeName inner class and attaching it to the node delegate.

Parameters:
obj the data object 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.

References DEFAULT_ACTIONS.

Referenced by getActions().

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

References getManager().

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

References getManager().

Referenced by cern::laser::guiplatform::windowmanager::AcWindowManager::isOpened().

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

References getManager().

void org::openide::windows::TopComponent::open (  )  [inline]
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.

Referenced by componentOpened().

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

Referenced by org::openide::windows::TopComponent::Replacer::readObject().

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.

References getManager().

Referenced by cern::laser::test::GPMainTests::main(), cern::laser::test::GPMainTest::main(), cern::gp::windows::WindowUtils::openInMode(), cern::laser::guiplatform::windowmanager::AcWindowManager::openInMode(), and cern::laser::guiplatform::actions::configuration::ConfigurationWindowAction::performAction().

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().

References getManager().

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

References getManager().

Referenced by org::openide::windows::TopComponent::NodeName::attach().

final void org::openide::windows::TopComponent::setCloseOperation ( final int  closeOperation  )  [inline]
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.

References getManager().

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

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

References getManager().

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

References closeOperation, org::openide::windows::TopComponent::NodeName::node, nodeName, and serialVersion.

Referenced by org::openide::windows::TopComponent::Replacer::writeObject().

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

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.

Referenced by close(), and setCloseOperation().

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).

Referenced by cern::laser::guiplatform::windows::alarms::AlarmDetailsPanel::AlarmDetailsPanel(), cern::laser::guiplatform::windows::alarms::AlarmTimestampsPanel::AlarmTimestampsPanel(), cern::laser::guiplatform::windows::search::CategorySelectorWindow::CategorySelectorWindow(), close(), cern::laser::guiplatform::windows::configuration::ConsoleConfigurationWindow::ConsoleConfigurationWindow(), cern::laser::guiplatform::windows::search::ProgressDialog::ProgressDialog(), cern::laser::guiplatform::windows::search::SearchWindow::SearchWindow(), setCloseOperation(), and cern::laser::test::TestTop::TestTop().

constant for desired close operation

Referenced by close(), getCloseOperation(), and writeExternal().

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

a set of actions of this component

Referenced by getSystemActions().

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

a lock for operations in default impl of getLookup

Referenced by getLookup().

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

reference to Lookup with default implementation for the component

Referenced by getLookup().

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

Referenced by TopComponent().

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

manager for the component

Referenced by getManager(), and TopComponent().

Listener to the data object's node or null

Referenced by writeExternal().

identification of serialization version Used in CloneableTopComponent readObject method.

Referenced by writeExternal().

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

The documentation for this class was generated from the following file:

Generated by  doxygen 1.6.2