org.openide.explorer
Class ExplorerPanel

java.lang.Object
  |
  +--java.awt.Component
        |
        +--java.awt.Container
              |
              +--javax.swing.JComponent
                    |
                    +--org.openide.windows.TopComponent
                          |
                          +--org.openide.explorer.ExplorerPanel
All Implemented Interfaces:
Accessible, ExplorerManager.Provider, Externalizable, ImageObserver, MenuContainer, Serializable

public class ExplorerPanel
extends TopComponent
implements ExplorerManager.Provider

Simple top component capable of displaying an Explorer. Holds one instance of ExplorerManager and implements ExplorerManager.Provider to allow child components to share the same explorer manager.

Uses BorderLayout by default. Pays attention to the selected nodes and explored context as indicated by the manager. Cut/copy/paste actions are sensitive to the activation state of the component.

It is up to you to add a view and other UI apparatus to the panel.

See Also:
Serialized Form

Inner classes inherited from class org.openide.windows.TopComponent
TopComponent.Cloneable, TopComponent.NodeName, TopComponent.Registry
 
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
 
Fields inherited from class org.openide.windows.TopComponent
CLOSE_EACH, CLOSE_LAST
 
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
ExplorerPanel()
          Default constructor.
ExplorerPanel(ExplorerManager manager)
          Initialize the explorer panel with the provided manager.
 
Method Summary
 boolean canClose(Workspace workspace, boolean last)
          This method is called when top component is about to close.
protected  void componentActivated()
          Called when this component is activated.
protected  void componentDeactivated()
          Called when this component is deactivated.
 ExplorerManager getExplorerManager()
          Get the explorer manager.
 HelpCtx getHelpCtx()
          Get context help for an explorer window.
static HelpCtx getHelpCtx(Node[] sel, HelpCtx def)
          Utility method to get context help from a node selection.
static boolean isConfirmDelete()
          Are deletions confirmed on all Explorer panels?
 void open()
          Show the component on current workspace.
 void open(Workspace workspace)
          Show the component on given workspace.
 void readExternal(ObjectInput oi)
          Reads the manager.
 void requestFocus()
          Request focus for the window holding this top component.
static void setConfirmDelete(boolean confirmDelete)
          Set whether deletions should have to be confirmed on all Explorer panels.
protected  void updateTitle()
          Called when the explored context changes.
 void writeExternal(ObjectOutput oo)
          Stores the manager
 
Methods inherited from class org.openide.windows.TopComponent
close, close, closeNotify, getAccessibleContext, getActivatedNodes, getCloseOperation, getIcon, getRegistry, getSystemActions, getUndoRedo, isOpened, isOpened, openNotify, requestVisible, setActivatedNodes, setCloseOperation, setIcon, setName, writeReplace
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addPropertyChangeListener, addPropertyChangeListener, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAutoscrolls, getBorder, getBounds, getClientProperty, getComponentGraphics, getConditionForKeyStroke, getDebugGraphicsOptions, getGraphics, getHeight, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getUIClassID, getVerifyInputWhenFocusTarget, getVisibleRect, getWidth, getX, getY, grabFocus, hasFocus, hide, isDoubleBuffered, isFocusCycleRoot, isFocusTraversable, isLightweightComponent, isManagingFocus, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isPreferredSizeSet, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, paramString, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processFocusEvent, processKeyBinding, processKeyEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setDebugGraphicsOptions, setDoubleBuffered, setEnabled, setFont, setForeground, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update, updateUI
 
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.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, getBackground, getBounds, getColorModel, getComponentOrientation, getCursor, getDropTarget, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getInputContext, getInputMethodRequests, getLocale, getLocation, getLocationOnScreen, getName, getParent, getPeer, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, imageUpdate, inside, isDisplayable, isEnabled, isLightweight, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setLocale, setLocation, setLocation, setSize, setSize, show, show, size, toString, transferFocus
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ExplorerPanel

public ExplorerPanel(ExplorerManager manager)
Initialize the explorer panel with the provided manager.
Parameters:
explorer - the explorer manager to use

ExplorerPanel

public ExplorerPanel()
Default constructor. Uses newly created manager.
Method Detail

requestFocus

public void requestFocus()
Description copied from class: TopComponent
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.
Overrides:
requestFocus in class TopComponent

open

public void open()
Description copied from class: TopComponent
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).
Overrides:
open in class TopComponent
Following copied from class: org.openide.windows.TopComponent
See Also:
TopComponent.requestFocus()

open

public void open(Workspace workspace)
Description copied from class: TopComponent
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.
Overrides:
open in class TopComponent
Following copied from class: org.openide.windows.TopComponent
Parameters:
workspace - Workspace on which component should be opened. Parameter can be null -> means current workspace.
See Also:
TopComponent.requestFocus()

canClose

public boolean canClose(Workspace workspace,
                        boolean last)
Description copied from class: TopComponent
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.
Overrides:
canClose in class TopComponent
Following copied from class: org.openide.windows.TopComponent
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.

getExplorerManager

public ExplorerManager getExplorerManager()
Description copied from interface: ExplorerManager.Provider
Get the explorer manager.
Specified by:
getExplorerManager in interface ExplorerManager.Provider
Following copied from interface: org.openide.explorer.ExplorerManager.Provider
Returns:
the manager

componentActivated

protected void componentActivated()
Description copied from class: TopComponent
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). Override this method to perform some special action on component activation: typically, set performers for relevant actions. Remember to call the super method. The default implementation does nothing.
Overrides:
componentActivated in class TopComponent

componentDeactivated

protected void componentDeactivated()
Description copied from class: TopComponent
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). Override this method to perform some special action on component deactivation: typically, unset performers for relevant actions. Remember to call the super method. The default implementation does nothing.
Overrides:
componentDeactivated in class TopComponent

updateTitle

protected void updateTitle()
Called when the explored context changes. The default implementation updates the title of the window.

getHelpCtx

public HelpCtx getHelpCtx()
Get context help for an explorer window. Looks at the manager's node selection.
Overrides:
getHelpCtx in class TopComponent
Returns:
the help context
See Also:
getHelpCtx(Node[],HelpCtx)

getHelpCtx

public static HelpCtx getHelpCtx(Node[] sel,
                                 HelpCtx def)
Utility method to get context help from a node selection. Tries to find context helps for selected nodes. If there are some, and they all agree, uses that. In all other cases, uses the supplied generic help.
Parameters:
sel - a list of nodes to search for help in
def - the default help to use if they have none or do not agree
Returns:
a help context

setConfirmDelete

public static void setConfirmDelete(boolean confirmDelete)
Set whether deletions should have to be confirmed on all Explorer panels.
Parameters:
confirmDelete - true to confirm, false to delete at once

isConfirmDelete

public static boolean isConfirmDelete()
Are deletions confirmed on all Explorer panels?
Returns:
true if they must be confirmed

writeExternal

public void writeExternal(ObjectOutput oo)
                   throws IOException
Stores the manager
Overrides:
writeExternal in class TopComponent
Following copied from class: org.openide.windows.TopComponent
Parameters:
out - the stream to serialize to

readExternal

public void readExternal(ObjectInput oi)
                  throws IOException,
                         ClassNotFoundException
Reads the manager. Deserialization may throw SafeException in case the manager cannot be loaded correctly but the stream is still uncorrupted.
Overrides:
readExternal in class TopComponent
Following copied from class: org.openide.windows.TopComponent
Parameters:
in - the stream to deserialize from


Built on December 12 2001.  |  Portions Copyright 1997-2001 Sun Microsystems, Inc. All rights reserved.