/*
 * $Id: AuthenticatedWebPage.java 5838 2006-05-24 20:44:49 +0000 (Wed, 24 May
 * 2006) joco01 $ $Revision$ $Date: 2006-05-24 20:44:49 +0000 (Wed, 24
 * May 2006) $
 * 
 * ==================================================================== Licensed
 * under the Apache License, Version 2.0 (the "License"); you may not use this
 * file except in compliance with the License. You may obtain a copy of the
 * License at
 * 
 * http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 * License for the specific language governing permissions and limitations under
 * the License.
 */
package wicket.examples.library;

import wicket.MarkupContainer;
import wicket.examples.WicketExamplePage;
import wicket.markup.IAlternateParentProvider;
import wicket.markup.html.border.Border;

/**
 * Ensures that user is authenticated in session. If no user is signed in, a
 * sign in is forced by redirecting the browser to the SignIn page.
 * <p>
 * This base class also creates a border for each page subclass, automatically
 * adding children of the page to the border. This accomplishes two important
 * things: (1) subclasses do not have to repeat the code to create the border
 * navigation and (2) since subclasses do not repeat this code, they are not
 * hardwired to page navigation structure details
 * 
 * @author Jonathan Locke
 */
public class AuthenticatedWebPage extends WicketExamplePage implements IAlternateParentProvider
{
	private Border border;

	/**
	 * Contruct
	 */
	public AuthenticatedWebPage()
	{
	}

	/**
	 * @see wicket.examples.WicketExamplePage#init()
	 */
	@Override
	protected void init()
	{
		super.init();
		
		// Create border and add it to the page
		border = new LibraryApplicationBorder(this, "border");
	}
	
	/**
	 * @see wicket.Component#getSession()
	 */
	@Override
	public LibrarySession getSession()
	{
		return (LibrarySession)super.getSession();
	}

	/**
	 * @see wicket.markup.IAlternateParentProvider#getAlternateParent()
	 */
	public MarkupContainer getAlternateParent()
	{
		return (this.border == null ? this : this.border);
	}
}

@@ -2165,16 +2165,48 @@
 eParent(
+Class childClass, String childId
 )%0A%09 */%0A%09
@@ -2247,16 +2247,60 @@
 eParent(
+final Class childClass, final String childId
 )%0A%09%7B%0A%09%09r

change IAlternateParentProvider to allow for more complex use cases