 |
Breadcrumb bar - from closed source to open source
Posted by kirillcool on February 08, 2006 at 12:43 PM | Comments (6)
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
Bookmark blog post: del.icio.us Digg DZone Furl Reddit
Comments
Comments are listed in date ascending order (oldest first) | Post Comment
-
Awesome! Will this work with a TreeModel? It seems like the models are similar...
Posted by: jessewilson on February 08, 2006 at 02:45 PM
-
Jesse,
You can easily write an adapter from the TreeModel to implement the breadcrumb callback. The main reason not to use TreeModel as an underlying structure is that it's not deferred. In the case of file system browsing or large XMLs, you wouldn't want to load the entire structure to the tree model. Think of it as writing a deferred tree model and handling willExpand / willCollapse events in "real-time".
Posted by: kirillcool on February 08, 2006 at 11:01 PM
-
Hey Kirill,
I'm confused about the "deferred" statement. I've written more than one TreeModel that was based on the local filesystem without having to load the entire structure up front.
Posted by: rbair on February 09, 2006 at 12:18 PM
-
Richard,
Correct me if i'm wrong, but when JTree is created based on a straightforward TreeModel implementation, doesn't it traverse the entire model to find out where to put "+" marks and where to create leafs?
Posted by: kirillcool on February 09, 2006 at 12:27 PM
-
No, it doesn't. It only asks for the children if they're expanded. Quite simple to integrate a cache for this. I've done it myself for... way to many times.
Anyway... that component looks really nice. Might be of use for me.
Posted by: pago on February 09, 2006 at 01:05 PM
-
Patrick,
Good to know - never had a chance to work with trees much :) <embarass_mode_off>
Posted by: kirillcool on February 09, 2006 at 01:23 PM
|