org.formaria.swing
Class BreadcrumbBar
java.lang.Object
java.awt.Component
java.awt.Container
javax.swing.JComponent
javax.swing.JPanel
org.formaria.swing.Panel
org.formaria.swing.BreadcrumbBar
- All Implemented Interfaces:
- java.awt.event.ActionListener, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, java.util.EventListener, javax.accessibility.Accessible, PersistentState, StyleComponent
public class BreadcrumbBar
- extends Panel
- implements java.awt.event.ActionListener, StyleComponent
The Breadcrumb bar can be used to present a navigation history by listing
links to the pages used to navigate to the current page.
If the visible navigation history exceeds the size of the component the
component will scroll the navigation either left or right via arrow keys
automatically prefixed and appended to the component.
When a link is selected an ActionEvent is fired and the listener can
respond to the event. The page name associated with the link is passed with
the event as the action command. Once the link has been clicked the links to
the right of the select link are removed and the bar is refreshed.
- See Also:
- Serialized Form
| Nested classes/interfaces inherited from class javax.swing.JPanel |
javax.swing.JPanel.AccessibleJPanel |
| 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 |
| 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 new instance of BreadcrumbBar |
|
Method Summary |
void |
actionPerformed(java.awt.event.ActionEvent ae)
Respond to the button click events |
void |
addActionListener(java.awt.event.ActionListener l)
Adds an ActionListener to the button. |
void |
addLink(java.lang.String caption,
java.lang.String pageName)
Add a new link. |
void |
addLink(java.lang.String caption,
java.lang.String pageName,
java.lang.String tooltip,
java.lang.String iconName)
Add a new link. |
void |
addNotify()
Repaint the component once it has been created |
protected void |
fireActionPerformed()
Notifies all listeners that have registered interest for
notification on this event type. |
java.awt.event.ActionListener[] |
getActionListeners()
Returns an array of all the ActionListeners added
to this AbstractButton with addActionListener(). |
void |
removeActionListener(java.awt.event.ActionListener l)
Removes an ActionListener from the button. |
void |
setBounds(int x,
int y,
int w,
int h)
Intercept the size change to reset the navigation buttons |
void |
setBounds(java.awt.Rectangle r)
Intercept the size change to reset the navigation buttons |
void |
setLinks(java.lang.String links)
|
void |
setStyle(java.lang.String name)
Set the component style |
void |
showAll()
|
void |
showEarlierLinks()
Display the earlier (hidden) links |
void |
showLaterLinks()
Display the later links by hiding earlier links |
void |
updateNavButtons()
Update the navigation buttons accoriding to the available width; |
| Methods inherited from class org.formaria.swing.Panel |
getArc, getDrawBorder, getInsets, getPainter, getPreferredSize, getUsesLaf, paintComponent, restoreState, saveState, setArc, setBlend, setBorder, setDrawBorder, setImageName, setPad, setPainter, setSwingBorder, setTitle, setTitlePos, setTitlePosition, setTitleStyle, setToolTip, setTranslucent, setUsesLaf, update |
| Methods inherited from class javax.swing.JPanel |
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI |
| Methods inherited from class javax.swing.JComponent |
addAncestorListener, 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, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, 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, 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 |
| 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, 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 |
links
protected java.util.ArrayList links
prevButton
protected HyperLabel prevButton
nextButton
protected HyperLabel nextButton
pageMgr
protected PageManager pageMgr
actionListener
protected java.awt.event.ActionListener actionListener
BreadcrumbBar
public BreadcrumbBar()
- Creates a new instance of BreadcrumbBar
setStyle
public void setStyle(java.lang.String name)
- Set the component style
- Specified by:
setStyle in interface StyleComponent
- Parameters:
name - the new style name
actionPerformed
public void actionPerformed(java.awt.event.ActionEvent ae)
- Respond to the button click events
- Specified by:
actionPerformed in interface java.awt.event.ActionListener
showEarlierLinks
public void showEarlierLinks()
- Display the earlier (hidden) links
showLaterLinks
public void showLaterLinks()
- Display the later links by hiding earlier links
setLinks
public void setLinks(java.lang.String links)
addLink
public void addLink(java.lang.String caption,
java.lang.String pageName)
- Add a new link. The new link will be appended to the breadcrumb trail.
- Parameters:
caption - the component caption (or localization key) as displayed to the end userpageName - the page to which the application will move to if the new link is selected
addLink
public void addLink(java.lang.String caption,
java.lang.String pageName,
java.lang.String tooltip,
java.lang.String iconName)
- Add a new link. The new link will be appended to the breadcrumb trail.
- Parameters:
caption - the component caption (or localization key) as displayed to the end userpageName - the page to which the application will move to if the new link is selectedtooltip - the tooltip text or null if none is specifiediconName - the link icon or null if none is specified
addNotify
public void addNotify()
- Repaint the component once it has been created
- Overrides:
addNotify in class Panel
updateNavButtons
public void updateNavButtons()
- Update the navigation buttons accoriding to the available width;
showAll
public void showAll()
setBounds
public void setBounds(java.awt.Rectangle r)
- Intercept the size change to reset the navigation buttons
- Overrides:
setBounds in class java.awt.Component
setBounds
public void setBounds(int x,
int y,
int w,
int h)
- Intercept the size change to reset the navigation buttons
- Overrides:
setBounds in class Panel
addActionListener
public void addActionListener(java.awt.event.ActionListener l)
- Adds an
ActionListener to the button.
- Parameters:
l - the ActionListener to be added
removeActionListener
public void removeActionListener(java.awt.event.ActionListener l)
- Removes an
ActionListener from the button.
If the listener is the currently set Action
for the button, then the Action
is set to null.
- Parameters:
l - the listener to be removed
getActionListeners
public java.awt.event.ActionListener[] getActionListeners()
- Returns an array of all the
ActionListeners added
to this AbstractButton with addActionListener().
- Returns:
- all of the
ActionListeners added or an empty
array if no listeners have been added - Since:
- 1.4
fireActionPerformed
protected void fireActionPerformed()
- Notifies all listeners that have registered interest for
notification on this event type. The event instance
is lazily created using the
event
parameter.
- See Also:
EventListenerList