You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by iv...@apache.org on 2009/02/03 17:15:04 UTC
svn commit: r740333 -
/wicket/trunk/wicket-extensions/src/main/java/org/apache/wicket/extensions/breadcrumb/BreadCrumbBar.java
Author: ivaynberg
Date: Tue Feb 3 16:15:04 2009
New Revision: 740333
URL: http://svn.apache.org/viewvc?rev=740333&view=rev
Log:
introduced #getSeparatorMarkup() for breadcrumbs
Modified:
wicket/trunk/wicket-extensions/src/main/java/org/apache/wicket/extensions/breadcrumb/BreadCrumbBar.java
Modified: wicket/trunk/wicket-extensions/src/main/java/org/apache/wicket/extensions/breadcrumb/BreadCrumbBar.java
URL: http://svn.apache.org/viewvc/wicket/trunk/wicket-extensions/src/main/java/org/apache/wicket/extensions/breadcrumb/BreadCrumbBar.java?rev=740333&r1=740332&r2=740333&view=diff
==============================================================================
--- wicket/trunk/wicket-extensions/src/main/java/org/apache/wicket/extensions/breadcrumb/BreadCrumbBar.java (original)
+++ wicket/trunk/wicket-extensions/src/main/java/org/apache/wicket/extensions/breadcrumb/BreadCrumbBar.java Tue Feb 3 16:15:04 2009
@@ -67,11 +67,12 @@
* @param enableLink
* Whether the link should be enabled
*/
- public BreadCrumbComponent(String id, int index, IBreadCrumbModel breadCrumbModel,
- final IBreadCrumbParticipant breadCrumbParticipant, boolean enableLink)
+ public BreadCrumbComponent(String id, String separator, int index,
+ IBreadCrumbModel breadCrumbModel, final IBreadCrumbParticipant breadCrumbParticipant,
+ boolean enableLink)
{
super(id);
- add(new Label("sep", (index > 0) ? "/" : "").setEscapeModelStrings(false)
+ add(new Label("sep", (index > 0) ? separator : "").setEscapeModelStrings(false)
.setRenderBodyOnly(true));
BreadCrumbLink link = new BreadCrumbLink("link", breadCrumbModel)
{
@@ -92,7 +93,9 @@
/**
* List view for rendering the bread crumbs.
*/
- protected class BreadCrumbsListView extends ListView<IBreadCrumbParticipant> implements IBreadCrumbModelListener
+ protected class BreadCrumbsListView extends ListView<IBreadCrumbParticipant>
+ implements
+ IBreadCrumbModelListener
{
private static final long serialVersionUID = 1L;
@@ -118,7 +121,8 @@
protected Object load()
{
// save a copy
- List<IBreadCrumbParticipant> l = new ArrayList<IBreadCrumbParticipant>(allBreadCrumbParticipants());
+ List<IBreadCrumbParticipant> l = new ArrayList<IBreadCrumbParticipant>(
+ allBreadCrumbParticipants());
size = l.size();
return l;
}
@@ -260,6 +264,15 @@
}
/**
+ * @return markup used as a separator between breadcrumbs. By default <code>/</code> is used,
+ * but <code>>></code> is also a popular choice.
+ */
+ protected String getSeparatorMarkup()
+ {
+ return "/";
+ }
+
+ /**
* Creates a new bread crumb component. That component will be rendered as part of the bread
* crumbs list (which is a <ul> <li> structure).
*
@@ -277,7 +290,8 @@
IBreadCrumbParticipant breadCrumbParticipant)
{
boolean enableLink = getEnableLinkToCurrent() || (index < (total - 1));
- return new BreadCrumbComponent(id, index, this, breadCrumbParticipant, enableLink);
+ return new BreadCrumbComponent(id, getSeparatorMarkup(), index, this,
+ breadCrumbParticipant, enableLink);
}
/**
@@ -291,10 +305,11 @@
{
if (crumb instanceof Component)
{
- ((Component) crumb).detach();
- } else if (crumb instanceof IDetachable)
+ ((Component)crumb).detach();
+ }
+ else if (crumb instanceof IDetachable)
{
- ((IDetachable) crumb).detach();
+ ((IDetachable)crumb).detach();
}
}
}