JIDE 3.5.15

com.jidesoft.navigation
Class NavigationList

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by javax.swing.JComponent
              extended by javax.swing.JList
                  extended by com.jidesoft.navigation.NavigationList
All Implemented Interfaces:
NavigationComponent, ImageObserver, MenuContainer, Serializable, Accessible, Scrollable

public class NavigationList
extends JList
implements NavigationComponent

NavigationList is a special list that is designed for the navigation purpose. It has the following features.

 
 
The selection and rollover effect is painted inside the paintComponent methods of the NavigationList after the original list content is painted. We don't to use the cell renderer to paint the effect as users might create their own cell renderer. However in order to prevent the cell renderer from painting the default selection effect, we set a custom cell renderer that extends DefaultListCellRenderer and pass in false for the cellHasFocus and isSelected parameter in when calling getListCellRendererComponent method. If you have your own cell renderer, please make sure you do the same thing.

Since:
3.3.0
See Also:
Serialized Form

Nested Class Summary
 class NavigationList.NavigationListHelper
          The navigation list helper class.
 
Nested classes/interfaces inherited from class javax.swing.JList
JList.AccessibleJList, JList.DropLocation
 
Nested classes/interfaces inherited from class javax.swing.JComponent
JComponent.AccessibleJComponent
 
Nested classes/interfaces inherited from class java.awt.Container
Container.AccessibleAWTContainer
 
Nested classes/interfaces inherited from class java.awt.Component
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy
 
Field Summary
static String PROPERTY_EXPANDED_TIP
           
static String PROPERTY_WIDE_SELECTION
           
 
Fields inherited from class javax.swing.JList
HORIZONTAL_WRAP, VERTICAL, VERTICAL_WRAP
 
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
NavigationList()
           
NavigationList(ListModel dataModel)
           
NavigationList(Object[] listData)
           
NavigationList(Vector<?> listData)
           
 
Method Summary
protected  NavigationComponentHelper createNavigationHelper()
          Creates the NavigationHelper which is a helper class that paints the rollover and the selection effect.
 int getNavigationRolloverRow()
          Gets the rollover row that currently has rollover effect.
 boolean isExpandedTip()
          Checks if the ExpandedTip feature is enabled.
 boolean isWideSelection()
          Checks if the selection and the rollover highlight covers the whole tree width.
protected  void paintComponent(Graphics g)
           
 void setExpandedTip(boolean expandedTip)
          Sets the ExpandedTip flag.
 void setNavigationRolloverRow(int navigationRolloverRow)
          Sets the rollover row.
 void setWideSelection(boolean wideSelection)
          Sets the flag if the selection and the rollover highlight covers the whole tree width.
 
Methods inherited from class javax.swing.JList
addListSelectionListener, addSelectionInterval, clearSelection, createSelectionModel, ensureIndexIsVisible, fireSelectionValueChanged, getAccessibleContext, getAnchorSelectionIndex, getCellBounds, getCellRenderer, getDragEnabled, getDropLocation, getDropMode, getFirstVisibleIndex, getFixedCellHeight, getFixedCellWidth, getLastVisibleIndex, getLayoutOrientation, getLeadSelectionIndex, getListSelectionListeners, getMaxSelectionIndex, getMinSelectionIndex, getModel, getNextMatch, getPreferredScrollableViewportSize, getPrototypeCellValue, getScrollableBlockIncrement, getScrollableTracksViewportHeight, getScrollableTracksViewportWidth, getScrollableUnitIncrement, getSelectedIndex, getSelectedIndices, getSelectedValue, getSelectedValues, getSelectionBackground, getSelectionForeground, getSelectionMode, getSelectionModel, getToolTipText, getUI, getUIClassID, getValueIsAdjusting, getVisibleRowCount, indexToLocation, isSelectedIndex, isSelectionEmpty, locationToIndex, paramString, removeListSelectionListener, removeSelectionInterval, setCellRenderer, setDragEnabled, setDropMode, setFixedCellHeight, setFixedCellWidth, setLayoutOrientation, setListData, setListData, setModel, setPrototypeCellValue, setSelectedIndex, setSelectedIndices, setSelectedValue, setSelectionBackground, setSelectionForeground, setSelectionInterval, setSelectionMode, setSelectionModel, setUI, setValueIsAdjusting, setVisibleRowCount, updateUI
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, 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, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, 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, update
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, 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, setLayout, 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, 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, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, 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, resize, resize, setBounds, setBounds, setComponentOrientation, 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

PROPERTY_WIDE_SELECTION

public static final String PROPERTY_WIDE_SELECTION
See Also:
Constant Field Values

PROPERTY_EXPANDED_TIP

public static final String PROPERTY_EXPANDED_TIP
See Also:
Constant Field Values
Constructor Detail

NavigationList

public NavigationList()

NavigationList

public NavigationList(Vector<?> listData)

NavigationList

public NavigationList(Object[] listData)

NavigationList

public NavigationList(ListModel dataModel)
Method Detail

createNavigationHelper

protected NavigationComponentHelper createNavigationHelper()
Creates the NavigationHelper which is a helper class that paints the rollover and the selection effect.

By default, it creates a NavigationTreeHelper instance.

Returns:
a new NavigationHelper.

paintComponent

protected void paintComponent(Graphics g)
Overrides:
paintComponent in class JComponent

isWideSelection

public boolean isWideSelection()
Checks if the selection and the rollover highlight covers the whole tree width. In a normal JTree, the selection only covers the node width. When the node is very narrow, the selection is hard to notice. For the navigation purpose, it is important that the selection row is noticeable. That's why we added this flag so that the selection always cover the whole row.

Returns:
true or false. True by default.

setWideSelection

public void setWideSelection(boolean wideSelection)
Sets the flag if the selection and the rollover highlight covers the whole tree width. It is true by default as we want to the selection to be easily noticeable in a NavigationTree.

Parameters:
wideSelection - true to make the selection and the rollover highlight covers the whole tree width, false to only cover the tree node width. It is true by default for NavigationTree.

isExpandedTip

public boolean isExpandedTip()
Checks if the ExpandedTip feature is enabled.

Returns:
true or false.
See Also:
ExpandedTipUtils

setExpandedTip

public void setExpandedTip(boolean expandedTip)
Sets the ExpandedTip flag.

Parameters:
expandedTip - true to enable the ExpandedTip feature and false to disable it. It is true by default.

getNavigationRolloverRow

public int getNavigationRolloverRow()
Gets the rollover row that currently has rollover effect.

Returns:
the row that has the rollover effect.

setNavigationRolloverRow

public void setNavigationRolloverRow(int navigationRolloverRow)
Sets the rollover row.

Parameters:
navigationRolloverRow - the row to show the rollover effect.

JIDE 3.5.15