Breadcrumb bar - from closed source to open source
As mentioned in my previous blog entry, one of the reasons i have started the Flamingo project (release candidate February 13, release February 27, version 1.0 code-named Aoife) was the rather unexpected contribution from the commercial vendor (Rick Jeliffe of Topologi). On one hand, he paid money to his developers to make this component happen (back in 2003, way before Windows Vista integrated this component into Windows Explorer), on the other hand maintaining the code base and coping with look-and-feel issues must have been seen as an additional and unwelcome burden. By deciding to "offshore" it to the open-source community he not only serves his own interests (code maintenance, proper documentation, support for third-party look-and-feels, community coming up with ideas), but also allows the Swing developers to take this ready-to-use component and play with it in their own applications.
So, without further ado, you are welcome to :
- Go to Flamingo homepage and download the binaries and the source.
- Go to Substance Flamingo plugin homepage and download the Substance plugin that provides the UI delegates for the breadcrumb bar. You most certainly don't have to because the component looks great (to my taste) under Ocean as well.
- See the complete documentation along with API walk-through and code samples.
- Run the WebStart version of Basic look and feel and Substance look and feel. You will have to grant full permissions since it's a file-system explorer (don't worry, it needs a read-only access, that's a promise).
Here's a small introduction to the breadcrumb bar from the Flamingo project. Rick - I hope this is the beginning of the collaboration between your company and the Swing community:)
The BreadcrumbBar in the org.jvnet.flamingo.bcb is a Swing
component that provides the breadcrumb bar functionality. The breadcrumb bar is a path
of components. Each component has a selector with a popup menu. The breadcrumb bar
allows easy navigation in tree-like structures (file system, XML stream) in a limited
screen space. The following screenshot illustrates a sample application built with the breadcrumb bar.
The application is a Windows Vista-like file explorer.
Breadcrumb Bar parts and functionality overview
The above screenshots illustrates the following parts of the breadcrumb bar:
- Main icon (optional) - appears in the left part of the bar.
- Root selector - appears after the main icon.
- A path of particles with associated selectors.
A particle represents a portion of the currently selected path. For file system,
it can be the name of the current directory. For XML file, it can be the name of the
current node. A particle has an associated selector. When the selector is selected
(using mouse or keyboard), the popup menu containing all possible child particles is shown.
When a child particle is selected, it is added to the bar.
In addition, the breadcrumb bar allows easy backwards navigation in the path - use
the mouse or the keyboard to select some particle. The path will be updated (the rest
of the path is disposed of). A particle can have an associated icon that is shown
in both the bar and the popup menu.
The breadcrumb bar provides memory functionality, allowing adding the current
path to the memory, going back and forth through the memory paths (the selection is updated
automatically), saving the memory to a stream using XML-based format, loading the
memory from XML-based stream and clearing the memory.
The breadcrumb bar uses application-supplied callback to retrieve a list of root particles
and child particles. In addition, it allows registering a listener on the following events:
- Path change
- Memory change
- Item load