001/*
002 * Licensed to the Apache Software Foundation (ASF) under one or more
003 * contributor license agreements.  See the NOTICE file distributed with
004 * this work for additional information regarding copyright ownership.
005 * The ASF licenses this file to You under the Apache License, Version 2.0
006 * (the "License"); you may not use this file except in compliance with
007 * the License.  You may obtain a copy of the License at
008 *
009 *      http://www.apache.org/licenses/LICENSE-2.0
010 *
011 * Unless required by applicable law or agreed to in writing, software
012 * distributed under the License is distributed on an "AS IS" BASIS,
013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014 * See the License for the specific language governing permissions and
015 * limitations under the License.
016 */
017package org.apache.wicket.extensions.breadcrumb;
018
019import org.apache.wicket.Component;
020import org.apache.wicket.extensions.breadcrumb.panel.BreadCrumbPanel;
021import org.apache.wicket.model.IModel;
022import org.apache.wicket.util.io.IClusterable;
023
024
025/**
026 * Bread crumb participants function as proxies for components that are part of a bread crumb
027 * hierarchy. An example of a bread crumb is:
028 * 
029 * <pre>
030 *     Home &gt; Products &amp; Solutions &gt; Hardware &gt; Desktop Systems
031 * </pre>
032 * 
033 * In a {@link BreadCrumbPanel panel based implementation}, <tt>Home</tt>,
034 * <tt>Products &amp; Solutions</tt> etc would be separate panels that all are bread crumb
035 * participants: for instance the <tt>Home</tt> participant's {@link #getTitle() title} would return
036 * 'Home', and {@link #getComponent() the component} would be the corresponding panel.
037 * 
038 * @author Eelco Hillenius
039 */
040public interface IBreadCrumbParticipant extends IClusterable
041{
042        /**
043         * Gets the participating component. Typically, this is a panel.
044         * 
045         * @return The participating component, must return a non-null value
046         */
047        Component getComponent();
048
049        /**
050         * Gets the title of the bread crumb, which will be used for displaying it.
051         * 
052         * @return The title of the bread crumb
053         */
054        IModel<String> getTitle();
055
056        /**
057         * Called when the corresponding bread crumb is activated.
058         * 
059         * @param previous
060         *            The previously active bread crumb participant, possibly null
061         */
062        void onActivate(IBreadCrumbParticipant previous);
063}