org.openide.explorer.view
Class ListView

java.lang.Object
  |
  +--java.awt.Component
        |
        +--java.awt.Container
              |
              +--javax.swing.JComponent
                    |
                    +--javax.swing.JScrollPane
                          |
                          +--org.openide.explorer.view.ListView
All Implemented Interfaces:
Accessible, Externalizable, ImageObserver, MenuContainer, ScrollPaneConstants, Serializable
Direct Known Subclasses:
IconView, ListTableView

public class ListView
extends JScrollPane
implements Externalizable

Explorer view to display items in a list.

See Also:
Serialized Form

Inner classes inherited from class javax.swing.JScrollPane
JScrollPane.AccessibleJScrollPane, JScrollPane.ScrollBar
 
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
protected  JList list
          The actual JList list
protected  NodeListModel model
          model to use
 
Fields inherited from class javax.swing.JScrollPane
columnHeader, horizontalScrollBar, horizontalScrollBarPolicy, lowerLeft, lowerRight, rowHeader, upperLeft, upperRight, verticalScrollBar, verticalScrollBarPolicy, viewport
 
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 javax.swing.ScrollPaneConstants
COLUMN_HEADER, HORIZONTAL_SCROLLBAR, HORIZONTAL_SCROLLBAR_ALWAYS, HORIZONTAL_SCROLLBAR_AS_NEEDED, HORIZONTAL_SCROLLBAR_NEVER, HORIZONTAL_SCROLLBAR_POLICY, LOWER_LEADING_CORNER, LOWER_LEFT_CORNER, LOWER_RIGHT_CORNER, LOWER_TRAILING_CORNER, ROW_HEADER, UPPER_LEADING_CORNER, UPPER_LEFT_CORNER, UPPER_RIGHT_CORNER, UPPER_TRAILING_CORNER, VERTICAL_SCROLLBAR, VERTICAL_SCROLLBAR_ALWAYS, VERTICAL_SCROLLBAR_AS_NEEDED, VERTICAL_SCROLLBAR_NEVER, VERTICAL_SCROLLBAR_POLICY, VIEWPORT
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
ListView()
          Default constructor.
 
Method Summary
 void addNotify()
           
protected  JList createList()
          Creates the list that will display the data.
protected  NodeListModel createModel()
          Allows subclasses to change the default model used for the list.
 int getAllowedDragActions()
           
 int getAllowedDropActions()
           
 ActionListener getDefaultProcessor()
          Get the current processor for default actions.
 int getSelectionMode()
          Get the selection mode.
 boolean isDragSource()
           
 boolean isDropTarget()
           
 boolean isPopupAllowed()
          Test whether display of a popup menu is enabled.
 boolean isTraversalAllowed()
          Test whether hierarchy traversal shortcuts are permitted.
 void readExternal(ObjectInput in)
           
 void removeNotify()
          Removes listeners.
 void requestFocus()
           
protected  boolean selectionAccept(Node[] nodes)
          Called when explorer manager is about to change the current selection.
protected  void selectionChanged(Node[] nodes, ExplorerManager em)
          Called when the list changed selection and the explorer manager should be updated.
 void setAllowedDragActions(int actions)
          Sets allowed actions for dragging
 void setAllowedDropActions(int actions)
          Sets allowed actions for dropping.
 void setDefaultProcessor(ActionListener value)
          Set a new processor for default actions.
 void setDragSource(boolean state)
          Enables/disables dragging support.
 void setDropTarget(boolean state)
          Enables/disables dropping support.
 void setPopupAllowed(boolean value)
          Enable/disable displaying popup menus on list view items.
 void setSelectionMode(int selectionMode)
          Set whether single-item or multiple-item selections are allowed.
 void setTraversalAllowed(boolean value)
          Enable/disable hierarchy traversal using CTRL+click (down) and Backspace (up), default is enabled.
protected  void showSelection(int[] indexes)
          Shows selection.
 void writeExternal(ObjectOutput out)
           
 
Methods inherited from class javax.swing.JScrollPane
createHorizontalScrollBar, createVerticalScrollBar, createViewport, getAccessibleContext, getColumnHeader, getCorner, getHorizontalScrollBar, getHorizontalScrollBarPolicy, getRowHeader, getUI, getUIClassID, getVerticalScrollBar, getVerticalScrollBarPolicy, getViewport, getViewportBorder, getViewportBorderBounds, isValidateRoot, paramString, setColumnHeader, setColumnHeaderView, setComponentOrientation, setCorner, setHorizontalScrollBar, setHorizontalScrollBarPolicy, setLayout, setRowHeader, setRowHeaderView, setUI, setVerticalScrollBar, setVerticalScrollBarPolicy, setViewport, setViewportBorder, setViewportView, updateUI
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, 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, getVerifyInputWhenFocusTarget, getVisibleRect, getWidth, getX, getY, grabFocus, hasFocus, hide, isDoubleBuffered, isFocusCycleRoot, isFocusTraversable, isLightweightComponent, isManagingFocus, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isPreferredSizeSet, isRequestFocusEnabled, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processFocusEvent, processKeyBinding, processKeyEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, 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
 
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, 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, setCursor, setDropTarget, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

list

protected transient JList list
The actual JList list

model

protected transient NodeListModel model
model to use
Constructor Detail

ListView

public ListView()
Default constructor.
Method Detail

writeExternal

public void writeExternal(ObjectOutput out)
                   throws IOException
Specified by:
writeExternal in interface Externalizable

readExternal

public void readExternal(ObjectInput in)
                  throws IOException,
                         ClassNotFoundException
Specified by:
readExternal in interface Externalizable

isPopupAllowed

public boolean isPopupAllowed()
Test whether display of a popup menu is enabled.
Returns:
true if so

setPopupAllowed

public void setPopupAllowed(boolean value)
Enable/disable displaying popup menus on list view items. Default is enabled.
Parameters:
value - true to enable

isTraversalAllowed

public boolean isTraversalAllowed()
Test whether hierarchy traversal shortcuts are permitted.
Returns:
true if so

setTraversalAllowed

public void setTraversalAllowed(boolean value)
Enable/disable hierarchy traversal using CTRL+click (down) and Backspace (up), default is enabled.
Parameters:
value - true to enable

getDefaultProcessor

public ActionListener getDefaultProcessor()
Get the current processor for default actions. If not null, double-clicks or pressing Enter on items in the view will not perform the default action on the selected node; rather the processor will be notified about the event.
Returns:
the current default-action processor, or null

setDefaultProcessor

public void setDefaultProcessor(ActionListener value)
Set a new processor for default actions.
Parameters:
value - the new default-action processor, or null to restore use of the selected node's declared default action
See Also:
getDefaultProcessor()

setSelectionMode

public void setSelectionMode(int selectionMode)
Set whether single-item or multiple-item selections are allowed.
Parameters:
selectionMode - one of ListSelectionModel.SINGLE_SELECTION, ListSelectionModel.SINGLE_INTERVAL_SELECTION, or ListSelectionModel.MULTIPLE_INTERVAL_SELECTION
See Also:
ListSelectionModel.setSelectionMode(int)

getSelectionMode

public int getSelectionMode()
Get the selection mode.
Returns:
the mode
See Also:
setSelectionMode(int)

isDragSource

public boolean isDragSource()
Returns:
true if dragging from the view is enabled, false otherwise.
Drag support is disabled by default.

setDragSource

public void setDragSource(boolean state)
Enables/disables dragging support.
Parameters:
state - true enables dragging support, false disables it.

isDropTarget

public boolean isDropTarget()
Returns:
true if dropping to the view is enabled, false otherwise
Drop support is disabled by default.

setDropTarget

public void setDropTarget(boolean state)
Enables/disables dropping support.
Parameters:
state - true means drops into view are allowed, false forbids any drops into this view.

getAllowedDragActions

public int getAllowedDragActions()
Returns:
Set of actions which are allowed when dragging from asociated component. Actions constants comes from DnDConstants.XXX constants. All actions (copy, move, link) are allowed by default.

setAllowedDragActions

public void setAllowedDragActions(int actions)
Sets allowed actions for dragging
Parameters:
actions - new drag actions, using DnDConstants.XXX

getAllowedDropActions

public int getAllowedDropActions()
Returns:
Set of actions which are allowed when dropping into the asociated component. Actions constants comes from DnDConstants.XXX constants. All actions are allowed by default.

setAllowedDropActions

public void setAllowedDropActions(int actions)
Sets allowed actions for dropping.
Parameters:
actions - new allowed drop actions, using DnDConstants.XXX

createList

protected JList createList()
Creates the list that will display the data.

createModel

protected NodeListModel createModel()
Allows subclasses to change the default model used for the list.

selectionChanged

protected void selectionChanged(Node[] nodes,
                                ExplorerManager em)
                         throws PropertyVetoException
Called when the list changed selection and the explorer manager should be updated.
Parameters:
nodes - list of nodes that should be selected
em - explorer manager
Throws:
PropertyVetoException - if the manager does not allow the selection

selectionAccept

protected boolean selectionAccept(Node[] nodes)
Called when explorer manager is about to change the current selection. The view can forbid the change if it is not able to display such selection.
Parameters:
nodes - the nodes to select
Returns:
false if the view is not able to change the selection

showSelection

protected void showSelection(int[] indexes)
Shows selection.
Parameters:
indexes - indexes of objects to select

addNotify

public void addNotify()
Overrides:
addNotify in class JComponent

removeNotify

public void removeNotify()
Removes listeners.
Overrides:
removeNotify in class JComponent

requestFocus

public void requestFocus()
Overrides:
requestFocus in class JComponent


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