|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--java.awt.Component | +--java.awt.Container | +--javax.swing.JComponent | +--org.openide.windows.TopComponent
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.
Inner Class Summary | |
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 class |
TopComponent.NodeName
This class provides the connection between the node name and a name of the component. |
static interface |
TopComponent.Registry
Registry of all top components. |
Inner classes inherited from class javax.swing.JComponent |
JComponent.AccessibleJComponent |
Inner classes inherited from class java.awt.Container |
Container.AccessibleAWTContainer |
Inner classes inherited from class java.awt.Component |
Component.AccessibleAWTComponent |
Field Summary | |
static int |
CLOSE_EACH
Behavior in which a top component closed (by the user) in one workspace will be removed from every workspace. |
static int |
CLOSE_LAST
Behavior in which a top component closed (by the user) in one workspace may be left in other workspaces. |
Fields inherited from class javax.swing.JComponent |
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW |
Fields inherited from class java.awt.Component |
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT |
Fields inherited from interface java.awt.image.ImageObserver |
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH |
Constructor Summary | |
TopComponent()
Create a top component. |
|
TopComponent(DataObject obj)
Create a top component associated with a data object. |
Method Summary | |
boolean |
canClose(Workspace workspace,
boolean last)
This method is called when top component is about to close. |
boolean |
close()
Closes the top component on current workspace. |
boolean |
close(Workspace workspace)
Closes the top component on given workspace, if closeOperation is set to CLOSE_LAST. |
protected void |
closeNotify()
Called only when top component was closed so that now it is closed on all workspaces in the system. |
protected void |
componentActivated()
Called when this component is activated. |
protected void |
componentDeactivated()
Called when this component is deactivated. |
AccessibleContext |
getAccessibleContext()
|
Node[] |
getActivatedNodes()
Get the set of activated nodes in this component. |
int |
getCloseOperation()
Get the current close mode for this component. |
HelpCtx |
getHelpCtx()
Get the help context for this component. |
Image |
getIcon()
|
static TopComponent.Registry |
getRegistry()
Getter for class that allows obtaining of information about components. |
SystemAction[] |
getSystemActions()
Get the system actions which will appear in the popup menu of this component. |
UndoRedo |
getUndoRedo()
Get the undo/redo support for this component. |
boolean |
isOpened()
Finds out if this top component is opened at least on one workspace. |
boolean |
isOpened(Workspace workspace)
Finds out whether this top component is opened or not on specified workspace. |
void |
open()
Show the component on current workspace. |
void |
open(Workspace workspace)
Show the component on given workspace. |
protected void |
openNotify()
Called only when top component was closed on all workspaces before and now is opened for the first time on some workspace. |
void |
readExternal(ObjectInput in)
Deserialize this top component. |
void |
requestFocus()
Request focus for the window holding this top component. |
void |
requestVisible()
Set this component visible but not selected or focused if possible. |
void |
setActivatedNodes(Node[] nodes)
Set the set of activated nodes in this component. |
void |
setCloseOperation(int closeOperation)
Set the close mode for the component. |
void |
setIcon(Image icon)
Set the icon of this top component. |
void |
setName(String name)
Set the name of this top component. |
void |
writeExternal(ObjectOutput out)
Serialize this top component. |
protected Object |
writeReplace()
Delegates instance of replacer class to be serialized instead of top component itself. |
Methods inherited from class java.awt.Container |
add, add, add, add, add, addContainerListener, addImpl, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getLayout, insets, invalidate, isAncestorOf, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setLayout, validate, validateTree |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
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 workspace.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).Constructor Detail |
public TopComponent()
public TopComponent(DataObject obj)
obj
- the data objectMethod Detail |
public static final TopComponent.Registry getRegistry()
public final Node[] getActivatedNodes()
public final void setActivatedNodes(Node[] nodes)
nodes
- activated nodes for this componentpublic UndoRedo getUndoRedo()
public void open()
requestFocus()
public void open(Workspace workspace)
workspace
- Workspace on which component should be opened.
Parameter can be null -> means current workspace.requestFocus()
public final boolean isOpened()
public final boolean isOpened(Workspace workspace)
public final boolean close()
public final boolean close(Workspace workspace)
workspace
- Workspace on which component should be closed.public boolean canClose(Workspace workspace, boolean last)
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 trueprotected void openNotify()
protected void closeNotify()
public SystemAction[] getSystemActions()
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 final void setCloseOperation(int closeOperation)
mode
- one of CLOSE_EACH
or CLOSE_LAST
IllegalArgumentException
- if an unrecognized close mode was suppliedclose()
public final int getCloseOperation()
CLOSE_EACH
or CLOSE_LAST
protected void componentActivated()
protected void componentDeactivated()
public void requestFocus()
opened
first
if it is not already.requestFocus
in class JComponent
public void requestVisible()
public void setName(String name)
setName
in class Component
displayName
- the new display namepublic void setIcon(Image icon)
icon
- New components' icon.public Image getIcon()
public HelpCtx getHelpCtx()
public void writeExternal(ObjectOutput out) throws IOException
writeExternal
in interface Externalizable
out
- the stream to serialize topublic void readExternal(ObjectInput in) throws IOException, ClassNotFoundException
readExternal
in interface Externalizable
in
- the stream to deserialize fromprotected Object writeReplace() throws ObjectStreamException
public AccessibleContext getAccessibleContext()
getAccessibleContext
in interface Accessible
getAccessibleContext
in class JComponent
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |