Classes | Public Member Functions | Static Public Member Functions | Static Public Attributes | Protected Member Functions | Package Functions | Package Attributes | Static Package Attributes

org.openide.windows.TopComponent Class Reference

Inherits javax::swing::JComponent, java::io::Externalizable, and javax::accessibility::Accessible.

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

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

Create a top component.


Member Function Documentation

void org.openide.windows.TopComponent.addNotify (  ) 
List org.openide.windows.TopComponent.availableModes ( List  modes  ) 

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 
)

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.

Referenced by org.openide.windows.TopComponent.close().

final boolean org.openide.windows.TopComponent.close (  ) 

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.
final boolean org.openide.windows.TopComponent.close ( Workspace  workspace  ) 

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 org.openide.windows.TopComponent.canClose(), org.openide.windows.TopComponent.CLOSE_EACH, org.openide.windows.TopComponent.CLOSE_LAST, and org.openide.windows.TopComponent.getManager().

void org.openide.windows.TopComponent.closeNotify (  )  [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 org.openide.windows.TopComponent.componentClosed().

void org.openide.windows.TopComponent.componentActivated (  )  [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 (  )  [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

References org.openide.windows.TopComponent.closeNotify().

void org.openide.windows.TopComponent.componentDeactivated (  )  [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 (  )  [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 (  )  [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 org.openide.windows.TopComponent.openNotify().

void org.openide.windows.TopComponent.componentShowing (  )  [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 (  ) 
javax.swing.Action [] org.openide.windows.TopComponent.getActions (  ) 

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 org.openide.windows.TopComponent.getSystemActions().

final Node [] org.openide.windows.TopComponent.getActivatedNodes (  ) 

Get the set of activated nodes in this component.

Returns:
the activated nodes for this component

References org.openide.windows.TopComponent.getManager().

final int org.openide.windows.TopComponent.getCloseOperation (  ) 

Get the current close mode for this component.

Returns:
one of CLOSE_EACH or CLOSE_LAST
HelpCtx org.openide.windows.TopComponent.getHelpCtx (  ) 

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 (  ) 
Returns:
The icon of the top component

References org.openide.windows.TopComponent.getManager().

Lookup org.openide.windows.TopComponent.getLookup (  ) 

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

Referenced by cern.gp.actions.support.ActionUtils.actionForComp().

final WindowManager.Component org.openide.windows.TopComponent.getManager (  )  [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.

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

static final Registry org.openide.windows.TopComponent.getRegistry (  )  [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 (  ) 

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.

Referenced by org.openide.windows.TopComponent.getActions().

UndoRedo org.openide.windows.TopComponent.getUndoRedo (  ) 

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  ) 

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 org.openide.windows.TopComponent.getManager().

final boolean org.openide.windows.TopComponent.isOpened (  ) 

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 org.openide.windows.TopComponent.getManager().

void org.openide.windows.TopComponent.open (  ) 

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

Referenced by cern.gp.windows.WindowUtils.openInMode().

void org.openide.windows.TopComponent.open ( Workspace  workspace  ) 

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 org.openide.windows.TopComponent.getManager().

void org.openide.windows.TopComponent.openNotify (  )  [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 org.openide.windows.TopComponent.componentOpened().

void org.openide.windows.TopComponent.readExternal ( ObjectInput  in  )  throws IOException, ClassNotFoundException

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

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 org.openide.windows.TopComponent.getManager().

Referenced by cern.gp.windows.WindowUtils.openInMode().

void org.openide.windows.TopComponent.requestVisible (  ) 

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 org.openide.windows.TopComponent.getManager().

final void org.openide.windows.TopComponent.setActivatedNodes ( Node[]  nodes  ) 

Set the set of activated nodes in this component.

Parameters:
nodes activated nodes for this component

References org.openide.windows.TopComponent.getManager().

final void org.openide.windows.TopComponent.setCloseOperation ( final int  closeOperation  ) 

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

References org.openide.windows.TopComponent.CLOSE_EACH, and org.openide.windows.TopComponent.CLOSE_LAST.

void org.openide.windows.TopComponent.setIcon ( final Image  icon  ) 

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 org.openide.windows.TopComponent.getManager().

void org.openide.windows.TopComponent.setName ( final String  name  ) 

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

Parameters:
name the new display name

References org.openide.windows.TopComponent.getManager().

void org.openide.windows.TopComponent.setToolTipText ( String  toolTip  ) 

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

References org.openide.windows.TopComponent.getManager().

void org.openide.windows.TopComponent.writeExternal ( ObjectOutput  out  )  throws IOException

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 org.openide.windows.TopComponent.serialVersion.

Object org.openide.windows.TopComponent.writeReplace (  )  throws ObjectStreamException [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 org.openide.windows.TopComponent.close(), and org.openide.windows.TopComponent.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 org.openide.windows.TopComponent.close(), and org.openide.windows.TopComponent.setCloseOperation().

identification of serialization version Used in CloneableTopComponent readObject method.

Referenced by org.openide.windows.TopComponent.writeExternal().

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:
 All Classes Namespaces Files Functions Variables Enumerations Properties