java.io.Externalizable, java.io.SerializableIconView, ListTableViewpublic class ListView
extends javax.swing.JScrollPane
implements java.io.Externalizable
This class is a view
to use it properly you need to add it into a component which implements
ExplorerManager.Provider. Good examples of that can be found
in ExplorerUtils. Then just use
ExplorerManager.Provider.getExplorerManager() call to get the ExplorerManager
and control its state.
There can be multiple views
under one container implementing ExplorerManager.Provider. Select from
range of predefined ones or write your own:
BeanTreeView - shows a tree of nodesContextTreeView - shows a tree of nodes without leaf nodesListView - shows a list of nodesIconView - shows a rows of nodes with bigger iconsChoiceView - creates a combo box based on the explored nodesTreeTableView - shows tree of nodes together with a set of their Node.PropertyMenuView - can create a JMenu structure based on structure of Nodes
All of these views use ExplorerManager.find(java.awt.Component) to walk up the AWT hierarchy and locate the
ExplorerManager to use as a controller. They attach as listeners to
it and also call its setter methods to update the shared state based on the
user action. Not all views make sense together, but for example
ContextTreeView and ListView were designed to complement
themselves and behaves like windows explorer. The PropertySheetView
for example should be able to work with any other view.
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategyjava.awt.Container.AccessibleAWTContainer| Modifier and Type | Field | Description |
|---|---|---|
protected javax.swing.JList |
list |
The actual JList list
|
protected NodeListModel |
model |
model to use
|
accessibleContext, BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENTABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTHlistenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOWcolumnHeader, horizontalScrollBar, horizontalScrollBarPolicy, lowerLeft, lowerRight, rowHeader, upperLeft, upperRight, verticalScrollBar, verticalScrollBarPolicy, viewportCOLUMN_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| Constructor | Description |
|---|---|
ListView() |
Default constructor.
|
| Modifier and Type | Method | Description |
|---|---|---|
void |
addNotify() |
|
protected javax.swing.JList |
createList() |
Creates the list that will display the data.
|
protected NodeListModel |
createModel() |
Allows subclasses to change the default model used for
the list.
|
void |
doLayout() |
|
int |
getAllowedDragActions() |
Actions constants comes from
DnDConstants. |
int |
getAllowedDropActions() |
Actions constants comes from
DnDConstants. |
java.awt.event.ActionListener |
getDefaultProcessor() |
Get the current processor for default actions.
|
java.awt.Dimension |
getPreferredSize() |
|
int |
getSelectionMode() |
Get the selection mode.
|
boolean |
isDragSource() |
|
boolean |
isDropTarget() |
|
boolean |
isPopupAllowed() |
Test whether display of a popup menu is enabled.
|
boolean |
isShowParentNode() |
Is parent node (e.g.
|
boolean |
isTraversalAllowed() |
Test whether hierarchy traversal shortcuts are permitted.
|
void |
paint(java.awt.Graphics g) |
|
void |
readExternal(java.io.ObjectInput in) |
|
void |
removeNotify() |
Removes listeners.
|
void |
requestFocus() |
|
boolean |
requestFocusInWindow() |
|
protected boolean |
selectionAccept(org.openide.nodes.Node[] nodes) |
Called when explorer manager is about to change the current selection.
|
protected void |
selectionChanged(org.openide.nodes.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(java.awt.event.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 |
setShowParentNode(boolean show) |
Shall the first node in the list be ".." representing currently
explored context? By default it is not, but if you want to simplify
the navigation in the
Node hierarchy, you can turn this
property on. |
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.
|
protected void |
validateTree() |
|
void |
writeExternal(java.io.ObjectOutput out) |
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, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, 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, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, resize, resize, setBounds, setBounds, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setMixingCutoutShape, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycleadd, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, transferFocusDownCycle, validateaddAncestorListener, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, hide, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingOrigin, isPaintingTile, isRequestFocusEnabled, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, updatecreateHorizontalScrollBar, 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, updateUIprotected transient javax.swing.JList list
protected transient NodeListModel model
public void writeExternal(java.io.ObjectOutput out)
throws java.io.IOException
writeExternal in interface java.io.Externalizablejava.io.IOExceptionpublic void readExternal(java.io.ObjectInput in)
throws java.io.IOException,
java.lang.ClassNotFoundException
readExternal in interface java.io.Externalizablejava.io.IOExceptionjava.lang.ClassNotFoundExceptionpublic boolean isPopupAllowed()
true if sopublic void setPopupAllowed(boolean value)
value - true to enablepublic boolean isTraversalAllowed()
true if sopublic void setTraversalAllowed(boolean value)
CTRL+click (down) and Backspace (up), default is enabled.value - true to enablepublic boolean isShowParentNode()
public void setShowParentNode(boolean show)
Node hierarchy, you can turn this
property on.show - true to show the "..", false to not to do sopublic java.awt.event.ActionListener getDefaultProcessor()
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.nullpublic void setDefaultProcessor(java.awt.event.ActionListener value)
value - the new default-action processor, or null to restore use of the selected node's declared default actiongetDefaultProcessor()public void setSelectionMode(int selectionMode)
selectionMode - one of ListSelectionModel.SINGLE_SELECTION, ListSelectionModel.SINGLE_INTERVAL_SELECTION, or ListSelectionModel.MULTIPLE_INTERVAL_SELECTIONListSelectionModel.setSelectionMode(int)public int getSelectionMode()
setSelectionMode(int)public boolean isDragSource()
public void setDragSource(boolean state)
state - true enables dragging support, false disables it.public boolean isDropTarget()
public void setDropTarget(boolean state)
state - true means drops into view are allowed,
false forbids any drops into this view.public int getAllowedDragActions()
DnDConstants.
All actions (copy, move, link) are allowed by default.public void setAllowedDragActions(int actions)
actions - new drag actions, using DnDConstantspublic int getAllowedDropActions()
DnDConstants.
All actions are allowed by default.public void setAllowedDropActions(int actions)
actions - new allowed drop actions, using DnDConstantsprotected javax.swing.JList createList()
protected NodeListModel createModel()
protected void selectionChanged(org.openide.nodes.Node[] nodes,
ExplorerManager em)
throws java.beans.PropertyVetoException
nodes - list of nodes that should be selectedem - explorer managerjava.beans.PropertyVetoException - if the manager does not allow the
selectionprotected boolean selectionAccept(org.openide.nodes.Node[] nodes)
nodes - the nodes to selectprotected void showSelection(int[] indexes)
indexes - indexes of objects to selectpublic void paint(java.awt.Graphics g)
paint in class javax.swing.JComponentprotected void validateTree()
validateTree in class java.awt.Containerpublic java.awt.Dimension getPreferredSize()
getPreferredSize in class javax.swing.JComponentpublic void doLayout()
doLayout in class java.awt.Containerpublic void addNotify()
addNotify in class javax.swing.JComponentpublic void removeNotify()
removeNotify in class javax.swing.JComponentpublic void requestFocus()
requestFocus in class javax.swing.JComponentpublic boolean requestFocusInWindow()
requestFocusInWindow in class javax.swing.JComponentBuilt on April 24 2018. | Portions Copyright 1997-2018 Oracle. All rights reserved.