/*
 * $Id$ $Revision:
 * 1.19 $ $Date$
 * 
 * ==============================================================================
 * 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.markup;

import java.util.Locale;

import wicket.MarkupContainer;

/**
 * Because a Component has reference to its parents, which eventually is the
 * Page, and because the Page contains a reference to the Session, keeping a
 * "copy" of a component is very expensive. ContainerInfo shall be used instead
 * of MarkupContainer whenever a small subset of the container's information is
 * required.
 * 
 * @author Juergen Donnerstag
 */
public class ContainerInfo
{
	private Class containerClass;
	private Locale locale;
	private String style;
	private String variation;
	private String fileExtension;

	/**
	 * Construct.
	 * 
	 * @param container
	 *            The container to create the information from
	 */
	public ContainerInfo(final MarkupContainer container)
	{
		this.containerClass = container.getClass();
		this.locale = container.getLocale();
		this.style = container.getStyle();
		this.variation = null;
		this.fileExtension = container.getMarkupType();
	}

	/**
	 * 
	 * @return The container class
	 */
	public Class getContainerClass()
	{
		return containerClass;
	}

	/**
	 * 
	 * @return The container markup type (== file extension)
	 */
	public String getFileExtension()
	{
		return fileExtension;
	}

	/**
	 * 
	 * @return The container locale
	 */
	public Locale getLocale()
	{
		return locale;
	}

	/**
	 * 
	 * @return The container style
	 */
	public String getStyle()
	{
		return style;
	}

	/**
	 * 
	 * @return The containers variation
	 */
	public String getVariation()
	{
		return variation;
	}

	/**
	 * 
	 * @see java.lang.Object#toString()
	 */
	public String toString()
	{
		return containerClass.getName() + ":" + locale + ":" + style + ":" + fileExtension;
	}
}

@@ -3,16 +3,19 @@
 %0A * $Id$
+%0A *
  $Revisi
@@ -20,18 +20,8 @@
 sion
-:%0A * 1.19 
 $ $D
@@ -1599,12 +1599,32 @@
 n = 
-null
+container.getVariation()
 ;%0A%09%09
@@ -2311,32 +2311,38 @@
 ng()%0A%09%7B%0A%09%09return
+ %22%5B%22 +
  containerClass.
@@ -2350,25 +2350,32 @@
 etName() + %22
-:
+,locale=
 %22 + locale +
@@ -2372,25 +2372,31 @@
 + locale + %22
-:
+,style=
 %22 + style + 
@@ -2396,13 +2396,55 @@
 tyle
- + %22:
+%0A%09%09%09%09+ %22,variation=%22 + variation + %22,extension=
 %22 + 
@@ -2452,19 +2452,25 @@
 ileExtension
+ + %22%5D%22
 ;%0A%09%7D%0A%7D%0A

fix (?) we couldn't find whether setting variation (which isn't really used yet, is it?) was deliberately set to null. if it was shame on the guy that didn't document it.