public class MultiColumnBrowser extends JPanel
MultiColumnBrowser starts at the root of the tree and automatically expands to the right as navigation goes deeper. MultiColumnBrowser uses the same TreeModel as a regular JTree for its navigation model.
Users are notified of selection changes via a TreeSelectionEvents.
| Modifier and Type | Class and Description |
|---|---|
protected class |
MultiColumnBrowser.BrowserPanel |
JPanel.AccessibleJPanelJComponent.AccessibleJComponentContainer.AccessibleAWTContainerComponent.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy| Modifier and Type | Field and Description |
|---|---|
protected ListSelectionListener |
browserSelector |
protected List<MultiColumnBrowser.BrowserPanel> |
columns |
static int |
DEFAULT_MIN_COLUMNS_COUNT |
protected int |
minColumns |
protected TreeModel |
model |
protected Dimension |
preferredColumnSize |
protected ListCellRenderer |
renderer |
protected static ImageIcon |
rightArrow |
protected Object[] |
selectionPath |
protected List<TreeSelectionListener> |
treeSelectionListeners |
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOWBOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENTABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH| Constructor and Description |
|---|
MultiColumnBrowser() |
MultiColumnBrowser(int minColumns) |
| Modifier and Type | Method and Description |
|---|---|
void |
addTreeSelectionListener(TreeSelectionListener listener) |
void |
clearSelection()
Clears selection in browser and removes all unnessesary columns
|
protected void |
fireTreeSelectionEvent(Object[] selectionPath)
Notifies listeners of a tree selection change.
|
int |
getColumnsCount()
Returns a current number of columns.
|
int |
getMinColumns()
Returns the minumum number of displayed columns.
|
TreeModel |
getModel()
Returns browser model.
|
Dimension |
getPreferredColumnSize()
Returns prefrred size of a single browser column.
|
ListCellRenderer |
getRenderer()
Returns ListCellRenderer for individual elements of each column.
|
TreePath |
getSelectionPath()
Returns current selection path or null if no selection is made.
|
protected void |
installColumn(MultiColumnBrowser.BrowserPanel panel)
Installs all needed columns and renderers to a new column
|
void |
removeTreeSelectionListener(TreeSelectionListener listener) |
protected void |
selectRow(Object row,
int index,
TreePath path)
Selects one path component
|
void |
setDefaultRenderer()
Resets currently used renderer to default one that will use the "name"
property of objects and display a small arrow to the right of all
non-leaf nodes.
|
void |
setMinColumns(int minColumns)
Sets the minumum number of displayed columns.
|
void |
setModel(TreeModel model)
Initializes browser model.
|
void |
setPreferredColumnSize(Dimension preferredColumnSize) |
void |
setRenderer(ListCellRenderer renderer)
Initializes the renderer of column cells.
|
void |
setSelectionPath(TreePath path)
Sets new selection path and fires an event
|
protected void |
uninstallColumn(MultiColumnBrowser.BrowserPanel panel)
Removes all local listeners from the column
|
protected void |
updateFromModel(Object selectedNode,
int panelIndex)
Rebuilds view for the new object selection.
|
protected void |
updateFromModel(Object selectedNode,
int panelIndex,
boolean load)
Rebuilds view for the new object selection.
|
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUIaddAncestorListener, 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, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, hide, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingOrigin, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, 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, updateadd, 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, transferFocusDownCycle, validate, validateTreeaction, 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, 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, transferFocusBackward, transferFocusUpCycleprotected static final ImageIcon rightArrow
public static final int DEFAULT_MIN_COLUMNS_COUNT
protected int minColumns
protected ListCellRenderer renderer
protected TreeModel model
protected Object[] selectionPath
protected Dimension preferredColumnSize
protected List<MultiColumnBrowser.BrowserPanel> columns
protected ListSelectionListener browserSelector
protected List<TreeSelectionListener> treeSelectionListeners
public MultiColumnBrowser()
public MultiColumnBrowser(int minColumns)
public void addTreeSelectionListener(TreeSelectionListener listener)
public void removeTreeSelectionListener(TreeSelectionListener listener)
protected void fireTreeSelectionEvent(Object[] selectionPath)
public TreePath getSelectionPath()
public void setSelectionPath(TreePath path)
public int getMinColumns()
public void setMinColumns(int minColumns)
public Dimension getPreferredColumnSize()
public void setPreferredColumnSize(Dimension preferredColumnSize)
public void setDefaultRenderer()
public ListCellRenderer getRenderer()
public void setRenderer(ListCellRenderer renderer)
public void setModel(TreeModel model)
public TreeModel getModel()
public int getColumnsCount()
protected void installColumn(MultiColumnBrowser.BrowserPanel panel)
public void clearSelection()
protected void uninstallColumn(MultiColumnBrowser.BrowserPanel panel)
protected void updateFromModel(Object selectedNode, int panelIndex)
protected void updateFromModel(Object selectedNode, int panelIndex, boolean load)
load - Whether children are loaded automaticallyCopyright © 2001–2015 Apache Cayenne. All rights reserved.