|
Quaqua 8.0 2011-10-02 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.awt.Component
java.awt.Container
javax.swing.JComponent
ch.randelshofer.quaqua.JBrowser
public class JBrowser
JBrowser provides a user interface for displaying and selecting items from a list of data or from hierarchically organized lists of data such as directory paths. When working with a hierarchy of data, the levels are displayed in columns, which are numbered from left to right.
JBrowser is a clean-room implementation of an Aqua column view (NSBrowser), which is used by file dialogs and the finder of Mac OS X.
If you are using JBrowser without the Quaqua Look and Feel, you may notice that it does not fill the viewport with empty columns. To work around this, you may want to use JBrowser together with the helper class JBrowserViewport.
JBrowserViewport
,
Serialized FormNested Class Summary | |
---|---|
protected static class |
JBrowser.BrowserLayout
|
protected static class |
JBrowser.BrowserScrollPaneLayout
|
protected class |
JBrowser.SizeHandle
|
Nested classes/interfaces inherited from class javax.swing.JComponent |
---|
javax.swing.JComponent.AccessibleJComponent |
Nested classes/interfaces inherited from class java.awt.Container |
---|
java.awt.Container.AccessibleAWTContainer |
Nested classes/interfaces inherited from class java.awt.Component |
---|
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy |
Field Summary | |
---|---|
static java.lang.String |
CELL_RENDERER_PROPERTY
Bound property name for cellRenderer . |
static java.lang.String |
COLUMNS_RESIZABLE_PROPERTY
Bound property name for columnsResizable. |
static java.lang.String |
FIXED_CELL_WIDTH_PROPERTY
Bound property name for preferredCellWidth. |
static java.lang.String |
MINIMUM_CELL_WIDTH_PROPERTY
Bound property name for minimumCellWidth. |
static java.lang.String |
PREVIEW_RENDERER_PROPERTY
Bound property name for cellRenderer . |
static java.lang.String |
SELECTION_MODEL_PROPERTY
Bound property name for selectionModel. |
protected javax.swing.tree.TreeSelectionModel |
selectionModel
Models the set of selected nodes in this tree. |
static java.lang.String |
TREE_MODEL_PROPERTY
Bound property name for treeModel . |
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 | |
---|---|
JBrowser()
Creates a JBrowser with a sample model. |
|
JBrowser(java.util.Hashtable value)
Creates a JBrowser created from a Hashtable
which does not display with root. |
|
JBrowser(java.lang.Object[] value)
Creates a JBrowser with each element of the
specified array as the child of a new root node which is not displayed. |
|
JBrowser(javax.swing.tree.TreeModel newModel)
Creates an instance of JBrowser which does not display the
root node -- the tree is created using the specified data model. |
|
JBrowser(javax.swing.tree.TreeNode root)
Creates a JBrowser with the specified
TreeNode as its root, which does not display the root node. |
|
JBrowser(javax.swing.tree.TreeNode root,
boolean asksAllowsChildren)
Creates a JBrowser with the specified TreeNode
as its root, which does not display
the root node and which decides whether a node is a
leaf node in the specified manner. |
|
JBrowser(java.util.Vector value)
Creates a JBrowser with each element of the specified
Vector as the child of a new root node which is not
displayed. |
Method Summary | |
---|---|
protected void |
addColumn(javax.swing.tree.TreePath path)
Appends a new column to the browser. |
void |
addNotify()
Calls the configureEnclosingScrollPane method. |
void |
addSelectionPath(javax.swing.tree.TreePath path)
Adds the node identified by the specified TreePath
to the current selection. |
void |
addTreeSelectionListener(javax.swing.event.TreeSelectionListener tsl)
Adds a listener for TreeSelection events. |
void |
clearSelection()
Clears the selection. |
protected void |
configureEnclosingScrollPane()
If this JTable is the viewportView of an enclosing JScrollPane
(the usual situation), configure this ScrollPane by, amongst other things,
installing the table's tableHeader as the columnHeaderView of the scroll pane. |
java.lang.String |
convertValueToText(java.lang.Object value,
boolean selected,
boolean expanded,
boolean leaf,
int row,
boolean hasFocus)
Called by the renderers to convert the specified value to text. |
protected static javax.swing.tree.TreeModel |
createTreeModel(java.lang.Object value)
Returns a TreeModel wrapping the specified object. |
void |
ensurePathIsVisible(javax.swing.tree.TreePath path)
Ensures that the last node of the specified path is visible. |
protected void |
fireValueChanged(javax.swing.event.TreeSelectionEvent e)
Notifies all listeners that have registered interest for notification on this event type. |
BrowserCellRenderer |
getCellRenderer()
Gets the delegate that's used to paint each cell in the browser. |
java.awt.Point |
getCellTipOrigin()
Returns the origin of the cell tip tooltip relative to the origin of the cell renderer. |
javax.swing.tree.TreePath |
getClosestPathForLocation(int x,
int y)
Returns the path to the node that is closest to x,y. |
javax.swing.ListCellRenderer |
getColumnCellRenderer()
Gets the delegate that's used to paint a column cell in the browser. |
int |
getColumnWidth(int column)
Gets the width of a column. |
protected static javax.swing.tree.TreeModel |
getDefaultTreeModel()
Creates and returns a sample TreeModel . |
boolean |
getDragEnabled()
Gets the dragEnabled property. |
int |
getFixedCellWidth()
|
java.awt.event.KeyListener[] |
getKeyListeners()
Returns an array of all the key listeners registered on this component. |
int |
getMinimumCellWidth()
|
javax.swing.tree.TreeModel |
getModel()
Returns the TreeModel that is providing the data. |
java.awt.Rectangle |
getPathBounds(javax.swing.tree.TreePath path)
Returns the Rectangle that the specified node will be drawn
into. |
javax.swing.tree.TreePath |
getPathForLocation(int x,
int y)
Returns the path for the node at the specified location. |
int |
getPreferredColumnWidth(int column)
Gets the preferred width of a column, which usually is the width of the largest cell. |
java.awt.Dimension |
getPreferredScrollableViewportSize()
Returns the preferred display size of a JBrowser . |
int |
getPreviewColumnWidth()
Gets the width of the preview column. |
int |
getScrollableBlockIncrement(java.awt.Rectangle visibleRect,
int orientation,
int direction)
Returns the amount to increment when scrolling. |
boolean |
getScrollableTracksViewportHeight()
Returns true to indicate that the height of the viewport determines the height of the browser. |
boolean |
getScrollableTracksViewportWidth()
Returns false to indicate that the width of the viewport does not determine the width of the browser, unless the preferred width of the browser is smaller than the viewports width. |
int |
getScrollableUnitIncrement(java.awt.Rectangle visibleRect,
int orientation,
int direction)
Returns the amount to increment when scrolling. |
int |
getSelectionCount()
Returns the number of nodes selected. |
javax.swing.tree.TreeSelectionModel |
getSelectionModel()
Returns the model for selections. |
javax.swing.tree.TreePath |
getSelectionPath()
Returns the path to the first selected node. |
javax.swing.tree.TreePath[] |
getSelectionPaths()
Returns the paths of all selected values. |
BrowserUI |
getUI()
Returns the look and feel (L&F) object that renders this component. |
java.lang.String |
getUIClassID()
Returns the suffix used to construct the name of the look and feel (L&F) class used to render this component. |
boolean |
isColumnsResizable()
Returns true, if the columns are resizable by the uesr. |
boolean |
isPathSelected(javax.swing.tree.TreePath path)
Returns true if the item identified by the path is currently selected. |
boolean |
isShowCellTips()
Returns true if the JBrowser shows cell tips for list cells that don't fit into a column. |
protected void |
removeColumn(int columnIndex)
Removes the specified column from the browser. |
protected void |
removeLastListColumn()
Removes the last list column from the browser. |
void |
removeNotify()
Calls the unconfigureEnclosingScrollPane method. |
void |
removeSelectionPath(javax.swing.tree.TreePath path)
Removes the node identified by the specified path from the current selection. |
void |
removeTreeSelectionListener(javax.swing.event.TreeSelectionListener tsl)
Removes a TreeSelection listener. |
void |
requestFocus()
|
void |
setCellRenderer(BrowserCellRenderer cellRenderer)
Sets the delegate that's used to paint each cell in the browser. |
void |
setColumnCellRenderer(javax.swing.ListCellRenderer cellRenderer)
Sets the delegate that's used to paint a cell and the arrows in the browser. |
void |
setColumnsResizable(boolean newValue)
Sets whether columns should be resizable. |
void |
setColumnWidth(int column,
int width)
Sets the width of a column. |
void |
setDragEnabled(boolean b)
Sets the dragEnabled property,
which must be true to enable
automatic drag handling (the first part of drag and drop)
on this component. |
void |
setDropTarget(java.awt.dnd.DropTarget t)
|
void |
setFixedCellWidth(int width)
Sets the width of every cell in the browser. |
void |
setMinimumCellWidth(int newValue)
Sets the minimum width of cells in the browser. |
void |
setModel(javax.swing.tree.TreeModel newModel)
Sets the TreeModel that will provide the data. |
void |
setPreviewColumnWidth(int width)
Sets the width of the preview column. |
void |
setPreviewRenderer(BrowserPreviewRenderer newValue)
Sets the delegate that's used to paint the preview column in the browser. |
void |
setPrototypeCellValue(java.lang.Object prototypeCellValue)
|
void |
setSelectionMode(int selectionMode)
Sets the selection mode, which must be one of TreeSelectionModel.SINGLE_TREE_SELECTION, CONTIGUOUS_TREE_SELECTION or DISCONTIGUOUS_TREE_SELECTION. |
void |
setSelectionModel(javax.swing.tree.TreeSelectionModel selectionModel)
Sets the tree's selection model. |
void |
setSelectionPath(javax.swing.tree.TreePath path)
Selects the node identified by the specified path. |
void |
setSelectionPaths(javax.swing.tree.TreePath[] paths)
Selects the nodes identified by the specified array of paths. |
void |
setShowCellTipOrigin(java.awt.Point newValue)
Sets the origin of the cell tip tooltip relative to the origin of the cell renderer. |
void |
setShowCellTips(boolean newValue)
Set this to true, if you want to JBrowser to display a tooltip for the cell over which the mouse is hovering. |
void |
setTransferHandler(javax.swing.TransferHandler newValue)
|
void |
setUI(BrowserUI ui)
Sets the look and feel (L&F) object that renders this component. |
protected void |
unconfigureEnclosingScrollPane()
Reverses the effect of configureEnclosingScrollPane
by replacing the columnHeaderView of the enclosing
scroll pane with null . |
void |
updatePreviewColumn()
|
void |
updateUI()
Resets the UI property with the value from the current look and feel. |
Methods inherited from class javax.swing.JComponent |
---|
addAncestorListener, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getAccessibleContext, 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, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, paramString, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, 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, 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, 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, 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 |
---|
protected transient javax.swing.tree.TreeSelectionModel selectionModel
public static final java.lang.String CELL_RENDERER_PROPERTY
cellRenderer
.
public static final java.lang.String PREVIEW_RENDERER_PROPERTY
cellRenderer
.
public static final java.lang.String TREE_MODEL_PROPERTY
treeModel
.
public static final java.lang.String SELECTION_MODEL_PROPERTY
public static final java.lang.String FIXED_CELL_WIDTH_PROPERTY
public static final java.lang.String MINIMUM_CELL_WIDTH_PROPERTY
public static final java.lang.String COLUMNS_RESIZABLE_PROPERTY
Constructor Detail |
---|
public JBrowser()
JBrowser
with a sample model.
The default model used by the browser defines a leaf node as any node
without children.
DefaultTreeModel.asksAllowsChildren
public JBrowser(java.lang.Object[] value)
JBrowser
with each element of the
specified array as the child of a new root node which is not displayed.
By default, the browser defines a leaf node as any node without
children.
value
- an array of Object
sDefaultTreeModel.asksAllowsChildren
public JBrowser(java.util.Vector value)
JBrowser
with each element of the specified
Vector
as the child of a new root node which is not
displayed. By default, the
tree defines a leaf node as any node without children.
value
- a Vector
DefaultTreeModel.asksAllowsChildren
public JBrowser(java.util.Hashtable value)
JBrowser
created from a Hashtable
which does not display with root.
Each value-half of the key/value pairs in the HashTable
becomes a child of the new root node. By default, the tree defines
a leaf node as any node without children.
value
- a Hashtable
DefaultTreeModel.asksAllowsChildren
public JBrowser(javax.swing.tree.TreeNode root)
JBrowser
with the specified
TreeNode
as its root, which does not display the root node.
By default, the tree defines a leaf node as any node without children.
root
- a TreeNode
objectDefaultTreeModel.asksAllowsChildren
public JBrowser(javax.swing.tree.TreeNode root, boolean asksAllowsChildren)
JBrowser
with the specified TreeNode
as its root, which does not display
the root node and which decides whether a node is a
leaf node in the specified manner.
root
- a TreeNode
objectasksAllowsChildren
- if false, any node without children is a
leaf node; if true, only nodes that do not allow
children are leaf nodesDefaultTreeModel.asksAllowsChildren
public JBrowser(javax.swing.tree.TreeModel newModel)
JBrowser
which does not display the
root node -- the tree is created using the specified data model.
newModel
- the TreeModel
to use as the data modelMethod Detail |
---|
public BrowserUI getUI()
ListUI
object that renders this componentpublic void setUI(BrowserUI ui)
ui
- the BrowserUI
L&F objectUIDefaults.getUI(javax.swing.JComponent)
public void updateUI()
updateUI
in class javax.swing.JComponent
UIManager.getUI(javax.swing.JComponent)
public java.lang.String getUIClassID()
getUIClassID
in class javax.swing.JComponent
JComponent.getUIClassID()
,
UIDefaults.getUI(javax.swing.JComponent)
public void setPrototypeCellValue(java.lang.Object prototypeCellValue)
public void setDragEnabled(boolean b)
dragEnabled
property,
which must be true
to enable
automatic drag handling (the first part of drag and drop)
on this component.
The transferHandler
property needs to be set
to a non-null
value for the drag to do
anything. The default value of the dragEnabled
property
is false
.
When automatic drag handling is enabled,
most look and feels begin a drag-and-drop operation
whenever the user presses the mouse button over a selection
and then moves the mouse a few pixels.
Setting this property to true
can therefore have a subtle effect on
how selections behave.
Some look and feels might not support automatic drag and drop;
they will ignore this property. You can work around such
look and feels by modifying the component
to directly call the exportAsDrag
method of a
TransferHandler
.
b
- the value to set the dragEnabled
property to
java.awt.HeadlessException
- if
b
is true
and
GraphicsEnvironment.isHeadless()
returns true
GraphicsEnvironment.isHeadless()
,
getDragEnabled()
,
setTransferHandler(javax.swing.TransferHandler)
,
TransferHandler
public void setTransferHandler(javax.swing.TransferHandler newValue)
setTransferHandler
in class javax.swing.JComponent
public boolean getDragEnabled()
dragEnabled
property.
dragEnabled
propertysetDragEnabled(boolean)
protected static javax.swing.tree.TreeModel getDefaultTreeModel()
TreeModel
.
Used primarily for beanbuilders to show something interesting.
TreeModel
protected static javax.swing.tree.TreeModel createTreeModel(java.lang.Object value)
TreeModel
wrapping the specified object.
If the object is:Object
s,
Hashtable
, or
Vector
value
- the Object
used as the foundation for
the TreeModel
TreeModel
wrapping the specified objectpublic javax.swing.tree.TreePath getClosestPathForLocation(int x, int y)
null
, otherwise it always returns a valid path. To test if
the node is exactly at x, y, get the node's bounds and
test x, y against that.
x
- an integer giving the number of pixels horizontally from
the left edge of the display area, minus any left marginy
- an integer giving the number of pixels vertically from
the top of the display area, minus any top margin
TreePath
for the node closest to that location,getPathForLocation(int, int)
,
getPathBounds(javax.swing.tree.TreePath)
public java.awt.Rectangle getPathBounds(javax.swing.tree.TreePath path)
Rectangle
that the specified node will be drawn
into. Returns null
if any component in the path is hidden
(under a collapsed parent).
Note:
This method returns a valid rectangle, even if the specified
node is not currently displayed.
path
- the TreePath
identifying the node
Rectangle
the node is drawn in,
or null
public void setShowCellTips(boolean newValue)
public boolean isShowCellTips()
public void setShowCellTipOrigin(java.awt.Point newValue)
public java.awt.Point getCellTipOrigin()
public boolean isPathSelected(javax.swing.tree.TreePath path)
path
- a TreePath
identifying a node
public void addSelectionPath(javax.swing.tree.TreePath path)
TreePath
to the current selection. If any component of the path isn't
viewable, and getExpandsSelectedPaths
is true it is
made viewable.
Note that JBrowser
does not allow duplicate nodes to
exist as children under the same parent -- each sibling must be
a unique object.
path
- the TreePath
to addpublic void ensurePathIsVisible(javax.swing.tree.TreePath path)
path
- the TreePath
specifying the node to make
visible.public void setSelectionPath(javax.swing.tree.TreePath path)
path
- the TreePath
specifying the node to selectpublic void removeSelectionPath(javax.swing.tree.TreePath path)
path
- the TreePath
identifying a nodepublic javax.swing.tree.TreePath getPathForLocation(int x, int y)
x
- an integer giving the number of pixels horizontally from
the left edge of the display area, minus any left marginy
- an integer giving the number of pixels vertically from
the top of the display area, minus any top margin
TreePath
for the node at that locationpublic void clearSelection()
public void setFixedCellWidth(int width)
width
is -1,
cell widths are computed by applying getPreferredSize
to the cellRenderer
component for each tree node.
The default value of this property is 175.
This is a JavaBeans bound property.
width
- the width, in pixels, for all cells in this listsetMinimumCellWidth(int)
,
Container.addPropertyChangeListener(java.beans.PropertyChangeListener)
public int getFixedCellWidth()
public void setMinimumCellWidth(int newValue)
The default value of this property is 150.
This is a JavaBeans bound property.
newValue
- the width, in pixels.setFixedCellWidth(int)
,
Container.addPropertyChangeListener(java.beans.PropertyChangeListener)
public int getMinimumCellWidth()
public void setColumnWidth(int column, int width)
column
- Index of the column.width
- The width.public int getColumnWidth(int column)
column
- Index of the column.public int getPreferredColumnWidth(int column)
column
- Index of the column.public void setPreviewColumnWidth(int width)
width
- The width.public int getPreviewColumnWidth()
public void setColumnsResizable(boolean newValue)
newValue
- The new value.public boolean isColumnsResizable()
public void setColumnCellRenderer(javax.swing.ListCellRenderer cellRenderer)
The default value of this property is provided by the ListUI delegate, i.e. by the look and feel implementation.
This is a JavaBeans bound property.
cellRenderer
- the ListCellRenderer
that paints browser cellsgetColumnCellRenderer()
,
setCellRenderer(ch.randelshofer.quaqua.BrowserCellRenderer)
public javax.swing.ListCellRenderer getColumnCellRenderer()
The default value of this property is provided by the BrowserUI delegate, i.e. by the look and feel implementation.
This is a JavaBeans bound property.
ListCellRenderer
that paints browser cellspublic void setCellRenderer(BrowserCellRenderer cellRenderer)
The default value of this property is provided by the ListUI delegate, i.e. by the look and feel implementation.
This is a JavaBeans bound property.
cellRenderer
- the ListCellRenderer
that paints browser cellsgetCellRenderer()
,
setColumnCellRenderer(javax.swing.ListCellRenderer)
public BrowserCellRenderer getCellRenderer()
The default value of this property is provided by the BrowserUI delegate, i.e. by the look and feel implementation. This can be null, if the ListCellRenderer for columns does not make use of a BrowserCellRenderer to render a cell.
This is a JavaBeans bound property.
BrowserCellRenderer
that paints browser cellspublic void setPreviewRenderer(BrowserPreviewRenderer newValue)
The default value of this property is null. If null, no preview column is shown.
This is a JavaBeans bound property.
newValue
- the ListCellRenderer
that paints the preview column.getColumnCellRenderer()
public void setDropTarget(java.awt.dnd.DropTarget t)
setDropTarget
in class java.awt.Component
public int getSelectionCount()
public void setSelectionModel(javax.swing.tree.TreeSelectionModel selectionModel)
selectionModel
- the TreeSelectionModel
to use.
java.lang.IllegalArgumentException
- if the selectionModel is null.TreeSelectionModel
public javax.swing.tree.TreeSelectionModel getSelectionModel()
null
value. If you don't want to allow anything
to be selected
set the selection model to null
, which forces an empty
selection model to be used.
setSelectionModel(javax.swing.tree.TreeSelectionModel)
public void setSelectionMode(int selectionMode)
This may change the selection if the current selection is not valid
for the new mode. For example, if three TreePaths are
selected when the mode is changed to SINGLE_TREE_SELECTION
,
only one TreePath will remain selected. It is up to the particular
implementation to decide what TreePath remains selected.
public javax.swing.tree.TreePath getSelectionPath()
TreePath
for the first selected node,
or null
if nothing is currently selectedpublic javax.swing.tree.TreePath[] getSelectionPaths()
TreePath
objects indicating the selected
nodes, or null
if nothing is currently selectedpublic void setSelectionPaths(javax.swing.tree.TreePath[] paths)
paths
- an array of TreePath
objects that specifies
the nodes to selectpublic java.awt.event.KeyListener[] getKeyListeners()
getKeyListeners
in class java.awt.Component
KeyListener
s
or an empty array if no key
listeners are currently registeredpublic void updatePreviewColumn()
public void addTreeSelectionListener(javax.swing.event.TreeSelectionListener tsl)
TreeSelection
events.
tsl
- the TreeSelectionListener
that will be notified
when a node is selected or deselected (a "negative
selection")public void removeTreeSelectionListener(javax.swing.event.TreeSelectionListener tsl)
TreeSelection
listener.
tsl
- the TreeSelectionListener
to removeprotected void fireValueChanged(javax.swing.event.TreeSelectionEvent e)
e
- the TreeSelectionEvent
to be fired;
generated by the
TreeSelectionModel
when a node is selected or deselectedEventListenerList
public javax.swing.tree.TreeModel getModel()
TreeModel
that is providing the data.
TreeModel
that is providing the datapublic void setModel(javax.swing.tree.TreeModel newModel)
TreeModel
that will provide the data.
newModel
- the TreeModel
that is to provide the dataprotected void addColumn(javax.swing.tree.TreePath path)
protected void removeLastListColumn()
protected void removeColumn(int columnIndex)
public java.awt.Dimension getPreferredScrollableViewportSize()
JBrowser
.
The height is determined from getVisibleRowCount
and
the width is the current preferred width of two columns.
getPreferredScrollableViewportSize
in interface javax.swing.Scrollable
Dimension
object containing the preferred sizepublic int getScrollableUnitIncrement(java.awt.Rectangle visibleRect, int orientation, int direction)
The height is always 10.
FIXME - Find a better way to compute the height.
getScrollableUnitIncrement
in interface javax.swing.Scrollable
visibleRect
- the view area visible within the viewportorientation
- either SwingConstants.VERTICAL
or SwingConstants.HORIZONTAL
direction
- less than zero to scroll up/left,
greater than zero for down/right
JScrollBar.setUnitIncrement(int)
public boolean getScrollableTracksViewportHeight()
In other words: the JScrollPane must never show a vertical scroll bar, because each column of the JBrowser provides one.
getScrollableTracksViewportHeight
in interface javax.swing.Scrollable
Scrollable.getScrollableTracksViewportHeight()
public boolean getScrollableTracksViewportWidth()
getScrollableTracksViewportWidth
in interface javax.swing.Scrollable
Scrollable.getScrollableTracksViewportWidth()
public int getScrollableBlockIncrement(java.awt.Rectangle visibleRect, int orientation, int direction)
The height is always 10.
FIXME - Find a better way to compute the height.
getScrollableBlockIncrement
in interface javax.swing.Scrollable
visibleRect
- the view area visible within the viewportorientation
- either SwingConstants.VERTICAL
or SwingConstants.HORIZONTAL
direction
- less than zero to scroll up/left,
greater than zero for down/right
JScrollBar.setUnitIncrement(int)
public void addNotify()
configureEnclosingScrollPane
method.
addNotify
in class javax.swing.JComponent
configureEnclosingScrollPane()
protected void configureEnclosingScrollPane()
JTable
is the viewportView
of an enclosing JScrollPane
(the usual situation), configure this ScrollPane
by, amongst other things,
installing the table's tableHeader
as the columnHeaderView
of the scroll pane.
When a JTable
is added to a JScrollPane
in the usual way,
using new JScrollPane(myTable)
, addNotify
is
called in the JTable
(when the table is added to the viewport).
JTable
's addNotify
method in turn calls this method,
which is protected so that this default installation procedure can
be overridden by a subclass.
addNotify()
public void removeNotify()
unconfigureEnclosingScrollPane
method.
removeNotify
in class javax.swing.JComponent
unconfigureEnclosingScrollPane()
protected void unconfigureEnclosingScrollPane()
configureEnclosingScrollPane
by replacing the columnHeaderView
of the enclosing
scroll pane with null
. JTable
's
removeNotify
method calls
this method, which is protected so that this default uninstallation
procedure can be overridden by a subclass.
removeNotify()
,
configureEnclosingScrollPane()
public void requestFocus()
requestFocus
in class javax.swing.JComponent
public java.lang.String convertValueToText(java.lang.Object value, boolean selected, boolean expanded, boolean leaf, int row, boolean hasFocus)
value.toString
, ignoring
all other arguments. To control the conversion, subclass this
method and use any of the arguments you need.
value
- the Object
to convert to textselected
- true if the node is selectedexpanded
- true if the node is expandedleaf
- true if the node is a leaf noderow
- an integer specifying the node's display row, where 0 is
the first row in the displayhasFocus
- true if the node has the focus
String
representation of the node's value
|
Copyright 2003-2007 (c) Werner Randelshofer. All rights reserved. |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |