|
JIDE 3.5.15 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object java.awt.Component java.awt.Container javax.swing.JComponent javax.swing.JPanel com.jidesoft.navigation.BreadcrumbBar
public class BreadcrumbBar
Breadcrumbs are navigation aids used in user interfaces. They allow users to keep track of their location within programs or documents. The term comes from the trail of breadcrumbs left by Hansel and Gretel in the popular fairytale. Both Windows 7 and Mac OS X introduced breadcrumb components in the file explorer and the finder respectively.
BreadcrumbBar
implements the breadcrumb component using Swing. To leverage the
existing Swing code, it uses the exactly the same TreeModel used in JTree as the model class. The
path displayed in the breadcrumb is simply the current TreePath. If you know how to setup a
TreeModel and are familiar with TreePaths, you will find it extremely easy to use the
BreadcrumbBar component.
Nested Class Summary |
---|
Nested classes/interfaces inherited from class javax.swing.JPanel |
---|
JPanel.AccessibleJPanel |
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_DROPDOWN_ALLOWED
|
static String |
PROPERTY_MODEL
|
static String |
PROPERTY_SELECTED_PATH
|
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 | |
---|---|
BreadcrumbBar()
Creates a BreadcrumbBar . |
|
BreadcrumbBar(TreeModel model)
Creates a BreadcrumbBar . |
|
BreadcrumbBar(TreeModel model,
TreePath selectedPath)
Creates a BreadcrumbBar . |
Method Summary | |
---|---|
protected String |
convertNodeToString(DefaultMutableTreeNode node)
Converts the node to string. |
protected JMenuItem |
createMenuItem(TreePath parent,
Object node)
Creates the menu item on the drop down menu. |
protected Action |
createNodeAction(TreePath path,
Object node)
Creates the action to select the path. |
protected JComponent |
createNodeComponent(TreePath parent,
Object node)
Creates the node component. |
protected JComponent |
createNodeSeparator(JComponent nodeComponent,
TreePath parent,
Object node)
Creates the node separator. |
protected void |
customizeDropDownMenu(JPopupMenu menu,
TreeModel model,
TreePath parent,
Object node)
Customizes the drop down menu. |
protected static TreeModel |
getDefaultTreeModel()
Creates and returns a sample TreeModel . |
Icon |
getDropDownIcon()
Gets the drop down icon. |
TreeModel |
getModel()
Gets the model. |
Icon |
getNextIcon()
Gets the next icon. |
protected Icon |
getNodeIcon(Object node)
Gets the icon representing the node. |
protected String |
getNodeString(Object node)
Gets the string representation of the node. |
TreePath |
getSelectedPath()
Gets the selected path. |
protected void |
initComponents()
|
boolean |
isCascadeMenuAllowed()
Gets the flag indicating if the cascade menu is allowed. |
boolean |
isDropDownAllowed()
Returns the flag if the drop down is allowed. |
void |
setCascadeMenuAllowed(boolean cascadeMenuAllowed)
Sets the flag indicating if the cascade menu is allowed. |
void |
setComponentOrientation(ComponentOrientation o)
|
void |
setDropDownAllowed(boolean dropDownAllowed)
Sets the flag whether the drop down menu will be enabled when the path separator is clicked. |
void |
setDropDownIcon(Icon dropDownIcon)
Sets the drop down icon. |
void |
setModel(TreeModel model)
Sets the model. |
void |
setNextIcon(Icon nextIcon)
Sets the next icon. |
void |
setSelectedPath(TreePath selectedPath)
Sets the selected path. |
protected void |
showDropDownMenu(JComponent pathComponent,
JComponent pathSeparator,
TreePath parent,
Object node)
Shows the drop down menu. |
protected void |
synchronizeRolloverEffect(JComponent c,
JComponent separator)
|
void |
updateUI()
|
Methods inherited from class javax.swing.JPanel |
---|
getAccessibleContext, getUI, getUIClassID, paramString, setUI |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final String PROPERTY_DROPDOWN_ALLOWED
public static final String PROPERTY_MODEL
public static final String PROPERTY_SELECTED_PATH
Constructor Detail |
---|
public BreadcrumbBar()
BreadcrumbBar
.
public BreadcrumbBar(TreeModel model)
BreadcrumbBar
.
model
- the modelpublic BreadcrumbBar(TreeModel model, TreePath selectedPath)
BreadcrumbBar
.
model
- the modelselectedPath
- the tree pathMethod Detail |
---|
protected static TreeModel getDefaultTreeModel()
TreeModel
. This model is used when you didn't pass
a tree model to the constructor as the breadcrumb bar requires a model.
TreeModel
public void updateUI()
updateUI
in class JPanel
protected void initComponents()
protected void synchronizeRolloverEffect(JComponent c, JComponent separator)
public TreeModel getModel()
public void setModel(TreeModel model)
model
- a new tree modelpublic TreePath getSelectedPath()
public void setSelectedPath(TreePath selectedPath)
initComponents()
method which
will recreate all the children components.
selectedPath
- the selected path.public boolean isDropDownAllowed()
public void setDropDownAllowed(boolean dropDownAllowed)
dropDownAllowed
- true or false.protected JComponent createNodeComponent(TreePath parent, Object node)
parent
- the parent pathnode
- the node representing by this node component.
protected JComponent createNodeSeparator(JComponent nodeComponent, TreePath parent, Object node)
nodeComponent
- the node componentparent
- the parent pathnode
- the node representing by this node separator.
public Icon getNextIcon()
public void setNextIcon(Icon nextIcon)
nextIcon
- the next iconpublic Icon getDropDownIcon()
public void setComponentOrientation(ComponentOrientation o)
setComponentOrientation
in class Component
public void setDropDownIcon(Icon dropDownIcon)
dropDownIcon
- a new drop down icon.protected String getNodeString(Object node)
node
- the node.
protected Icon getNodeIcon(Object node)
node
- the node
protected void customizeDropDownMenu(JPopupMenu menu, TreeModel model, TreePath parent, Object node)
menu
- the menu to show upmodel
- the tree modelparent
- the parent tree pathnode
- the nodeprotected void showDropDownMenu(JComponent pathComponent, JComponent pathSeparator, TreePath parent, Object node)
pathComponent
- the path componentpathSeparator
- the path separator component.parent
- the parent pathnode
- the nodeprotected JMenuItem createMenuItem(TreePath parent, Object node)
parent
- the parent pathnode
- the node.
protected String convertNodeToString(DefaultMutableTreeNode node)
node
- the node
protected Action createNodeAction(TreePath path, Object node)
path
- the path.node
- the node.
public boolean isCascadeMenuAllowed()
setCascadeMenuAllowed(boolean)
public void setCascadeMenuAllowed(boolean cascadeMenuAllowed)
isDropDownAllowed()
returns true. By default, the value is false to
keep backward compatibility.
If you have a definite tree and the performance is not a concern, you could set this flag to true to enable your
customer to have a quick selection with the help of cascade menu.
cascadeMenuAllowed
- the flag
|
JIDE 3.5.15 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |