站内搜索: 请输入搜索关键词
当前页面: 在线文档首页 > NetBeans API Javadoc 5.0.0

ListView (NetBeans Explorer API) - NetBeans API Javadoc 5.0.0

 

org.openide.explorer.view
Class ListView

java.lang.Object
  extended byjava.awt.Component
      extended byjava.awt.Container
          extended byjavax.swing.JComponent
              extended byjavax.swing.JScrollPane
                  extended byorg.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

Nested Class Summary
 
Nested classes inherited from class javax.swing.JScrollPane
JScrollPane.AccessibleJScrollPane, JScrollPane.ScrollBar
 
Nested classes inherited from class javax.swing.JComponent
JComponent.AccessibleJComponent
 
Nested classes inherited from class java.awt.Container
Container.AccessibleAWTContainer
 
Nested classes inherited from class java.awt.Component
Component.AccessibleAWTComponent, Component.BltBufferStrategy, Component.FlipBufferStrategy
 
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()
          Actions constants comes from DnDConstants.
 int getAllowedDropActions()
          Actions constants comes from DnDConstants.
 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()
           
 boolean requestFocusInWindow()
           
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, isWheelScrollingEnabled, paramString, setColumnHeader, setColumnHeaderView, setComponentOrientation, setCorner, setHorizontalScrollBar, setHorizontalScrollBarPolicy, setLayout, setRowHeader, setRowHeaderView, setUI, setVerticalScrollBar, setVerticalScrollBarPolicy, setViewport, setViewportBorder, setViewportView, setWheelScrollingEnabled, 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, getAncestorListeners, getAutoscrolls, getBorder, getBounds, getClientProperty, getComponentGraphics, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getGraphics, getHeight, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPreferredSize, getPropertyChangeListeners, getPropertyChangeListeners, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isPreferredSizeSet, isRequestFocusEnabled, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removePropertyChangeListener, removePropertyChangeListener, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFont, setForeground, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setFocusCycleRoot, setFocusTraversalKeys, setFocusTraversalPolicy, transferFocusBackward, transferFocusDownCycle, validate, validateTree
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMouseWheelListeners, getName, getParent, getPeer, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusUpCycle
 
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
Throws:
IOException

readExternal

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

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()
Actions constants comes from DnDConstants. All actions (copy, move, link) are allowed by default.

Returns:
int representing set of actions which are allowed when dragging from asociated component.

setAllowedDragActions

public void setAllowedDragActions(int actions)
Sets allowed actions for dragging

Parameters:
actions - new drag actions, using DnDConstants

getAllowedDropActions

public int getAllowedDropActions()
Actions constants comes from DnDConstants. All actions are allowed by default.

Returns:
int representing set of actions which are allowed when dropping into the asociated component.

setAllowedDropActions

public void setAllowedDropActions(int actions)
Sets allowed actions for dropping.

Parameters:
actions - new allowed drop actions, using DnDConstants

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

removeNotify

public void removeNotify()
Removes listeners.


requestFocus

public void requestFocus()

requestFocusInWindow

public boolean requestFocusInWindow()

 

Built on May 3 2007.  |  Portions Copyright 1997-2005 Sun Microsystems, Inc. All rights reserved.