|
What this is
Other links
The source code/* * Sun Public License Notice * * The contents of this file are subject to the Sun Public License * Version 1.0 (the "License"). You may not use this file except in * compliance with the License. A copy of the License is available at * http://www.sun.com/ * * The Original Code is NetBeans. The Initial Developer of the Original * Code is Sun Microsystems, Inc. Portions Copyright 1997-2003 Sun * Microsystems, Inc. All Rights Reserved. */ package org.openide.windows; import java.awt.Image; import java.beans.PropertyChangeListener; import java.io.Serializable; import java.util.Set; import org.openide.ErrorManager; import org.openide.nodes.Node; import org.openide.util.Lookup; /** * Manages window system. * Allows the work with window system components, i.e.
TopComponentGroup of given name.
* @return instance of TopComponetnGroup or null
* @since 4.13 */
public abstract TopComponentGroup findTopComponentGroup(String name);
//
// You can add implementation to this class (+firePropertyChange), or implement it in subclass
// Do as you want.
//
/**
* Attaches a listener for changes in workspaces.
* @param l the new listener
*/
public abstract void addPropertyChangeListener (PropertyChangeListener l);
/**
* Removes a listener for changes in workspaces.
* @param l the listener to remove
*/
public abstract void removePropertyChangeListener (PropertyChangeListener l);
/** Finds top component manager for given top component.
* @param tc top component to find manager for.
* @return component manager for given top component.
* @deprecated Do not use anymore.
* See {@link WindowManager.Component} deprecation.
*/
protected static final Component findComponentManager (TopComponent tc) {
return null;
}
/** Activate a component. The top component containers should inform
* the top component that it is active via a call to this method through
* derived window manager implementation.
* @param tc the top component to activate;
* or null to deactivate all top components
*/
protected void activateComponent (TopComponent tc) {
// check
if (activeComponent == tc) return;
// deactivate old if possible
if (activeComponent != null) {
try {
activeComponent.componentDeactivated();
} catch(RuntimeException re) {
IllegalStateException ise = new IllegalStateException("[Winsys] TopComponent " + activeComponent // NOI18N
+ " throws runtime exception from its componentDeactivated() method. Repair it!"); // NOI18N
ErrorManager.getDefault().annotate(ise, re);
ErrorManager.getDefault().notify(ErrorManager.INFORMATIONAL, ise);
}
}
activeComponent = tc;
if (activeComponent != null) {
try {
activeComponent.componentActivated();
} catch(RuntimeException re) {
IllegalStateException ise = new IllegalStateException("[Winsys] TopComponent " + activeComponent // NOI18N
+ " throws runtime exception from its componentActivated() method. Repair it!"); // NOI18N
ErrorManager.getDefault().annotate(ise, re);
ErrorManager.getDefault().notify(ErrorManager.INFORMATIONAL, ise);
}
}
}
/** Notifies component that it was opened (and wasn't opened on any
* workspace before). Top component manager that implements Component
* inner interface of this class should send open notifications via
* calling this method
* @param tc the top component to be notified
*/
protected void componentOpenNotify (TopComponent tc) {
try {
tc.componentOpened();
} catch(RuntimeException re) {
IllegalStateException ise = new IllegalStateException("[Winsys] TopComponent " + tc // NOI18N
+ " throws runtime exception from its componentOpened() method. Repair it!"); // NOI18N
ErrorManager.getDefault().annotate(ise, re);
ErrorManager.getDefault().notify(ErrorManager.INFORMATIONAL, ise);
}
}
/** Notifies component that it was closed (and is not opened on any
* workspace anymore). Top component manager that implements Component
* inner interface of this class should send close notifications via
* calling this method
* @param tc the top component to be notified
*/
protected void componentCloseNotify (TopComponent tc) {
try {
tc.componentClosed();
} catch(RuntimeException re) {
IllegalStateException ise = new IllegalStateException("[Winsys] TopComponent " + tc // NOI18N
+ " throws runtime exception from its componentClosed() method. Repair it!"); // NOI18N
ErrorManager.getDefault().annotate(ise, re);
ErrorManager.getDefault().notify(ErrorManager.INFORMATIONAL, ise);
}
}
/** Notifies TopComponent it is about to be shown.
* @param tc TopComponent to be notified
* @see TopComponent#componentShowing
* @since 2.18 */
protected void componentShowing(TopComponent tc) {
try {
tc.componentShowing();
} catch(RuntimeException re) {
IllegalStateException ise = new IllegalStateException("[Winsys] TopComponent " + tc // NOI18N
+ " throws runtime exception from its componentShowing() method. Repair it!"); // NOI18N
ErrorManager.getDefault().annotate(ise, re);
ErrorManager.getDefault().notify(ErrorManager.INFORMATIONAL, ise);
}
}
/** Notifies TopComponent it was hidden.
* @param tc TopComponent to be notified
* @see TopComponent#componentHidden
* @since 2.18 */
protected void componentHidden(TopComponent tc) {
try {
tc.componentHidden();
} catch(RuntimeException re) {
IllegalStateException ise = new IllegalStateException("[Winsys] TopComponent " + tc // NOI18N
+ " throws runtime exception from its componentHidden() method. Repair it!"); // NOI18N
ErrorManager.getDefault().annotate(ise, re);
ErrorManager.getDefault().notify(ErrorManager.INFORMATIONAL, ise);
}
}
/** Provides opening of specified TopComponent .
* @param tc TopComponent to open
* @since 4.13 */
protected abstract void topComponentOpen(TopComponent tc);
/** Provides closing of specified TopComponent .
* @param tc TopComponent to close
* @since 4.13 */
protected abstract void topComponentClose(TopComponent tc);
/** Provides activation of specified TopComponent .
* @param tc TopComponent to activate
* @since 4.13 */
protected abstract void topComponentRequestActive(TopComponent tc);
/** Provides selection of specfied TopComponent .
* @param tc TopComponent to set visible (select)
* @since 4.13 */
protected abstract void topComponentRequestVisible(TopComponent tc);
/** Informs about change of display name of specified TopComponent .
* @param tc TopComponent which display name has changed
* @param displayName newly changed display name value
* @since 4.13 */
protected abstract void topComponentDisplayNameChanged(TopComponent tc, String displayName);
/** Informs about change of tooltip of specified TopComponent .
* @param tc TopComponent which tooltip has changed
* @param toolTip newly changed tooltip value
* @since 4.13 */
protected abstract void topComponentToolTipChanged(TopComponent tc, String toolTip);
/** Informs about chagne of icon of specified TopComponent .
* @param tc TopComponent which icon has changed
* @param icon newly chaned icon value
* @since 4.13 */
protected abstract void topComponentIconChanged(TopComponent tc, Image icon);
/** Informs about change of activated nodes of specified TopComponent .
* @param tc TopComponent which activated nodes has chagned
* @param activatedNodes newly chaged activated nodes value
* @since 4.13 */
protected abstract void topComponentActivatedNodesChanged(TopComponent tc, Node[] activatedNodes);
/** Indicates whether specified TopComponent is opened.
* @param tc specified TopComponent
* @since 4.13 */
protected abstract boolean topComponentIsOpened(TopComponent tc);
/** Gets default list of actions which appear in popup menu of TopComponent.
* The popup menu which is handled by window systsm implementation, typically at tab.
* @param tc TopComponent for which the default actions to provide
* @since 4.13 */
protected abstract javax.swing.Action[] topComponentDefaultActions(TopComponent tc);
/** Returns unique ID for specified TopComponent .
* @param tc TopComponent the component for which is ID returned
* @param preferredID first approximation used for ID
* @return unique TopComponent ID
* @since 4.13 */
protected abstract String topComponentID(TopComponent tc, String preferredID);
/** Returns unique ID for specified TopComponent .
* @param tc TopComponent the component for which is ID returned
* @return unique TopComponent ID
* @since 4.13 */
public String findTopComponentID(TopComponent tc) {
return topComponentID(tc, tc.preferredID());
}
/** Returns TopComponent for given unique ID.
* @param tcID unique TopComponent ID
* @return TopComponent instance corresponding to unique ID
* @since 4.15 */
public abstract TopComponent findTopComponent(String tcID);
/** A manager that handles operations on top components.
* It is always attached to a {@link TopComponent}.
* @deprecated Do not use anymore. This interface is replaced by bunch of protedcted methods
* which name starts with topComponent prefix, i.e. {@link #topComponentOpen}, {@link #topComponentClose} etc. */
protected interface Component extends java.io.Serializable {
/** Open the component on current workspace */
public void open ();
/**
* Opens this component on a given workspace.
* @param workspace the workspace on which to open it
*/
public void open (Workspace workspace);
/**
* Closes this component on a given workspace.
* @param workspace the workspace on which to close it
*/
public void close (Workspace workspace);
/** Called when the component requests focus. Moves it to be visible.
*/
public void requestFocus ();
/** 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().
*/
public void requestVisible ();
/** Get the set of activated nodes.
* @return currently activated nodes for this component
*/
public Node[] getActivatedNodes ();
/** Set the set of activated nodes for this component.
* @param nodes new set of activated nodes
*/
public void setActivatedNodes (Node[] nodes);
/** Called when the name of the top component changes.
*/
public void nameChanged ();
/** Set the icon of the top component.
* @param icon the new icon
*/
public void setIcon (final Image icon);
/**
* Gets the icon associated with this component.
* @return the icon
*/
public Image getIcon ();
/**
* Gets a list of workspaces where this component is currently open.
* @return the set of workspaces where the managed component is open
*/
public Set whereOpened ();
/**
* Do not use.
* @deprecated Only public by accident.
*/
/* public static final */ long serialVersionUID = 0L;
}
}
|
... this post is sponsored by my books ... | |
#1 New Release! |
FP Best Seller |
Copyright 1998-2021 Alvin Alexander, alvinalexander.com
All Rights Reserved.
A percentage of advertising revenue from
pages under the /java/jwarehouse
URI on this website is
paid back to open source projects.