You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by gs...@apache.org on 2008/05/05 23:41:04 UTC

svn commit: r653609 - in /wicket/trunk: wicket-examples/src/main/java/org/apache/wicket/examples/velocity/DynamicPage.java wicket-velocity/src/main/java/org/apache/wicket/velocity/markup/html/VelocityPanel.java

Author: gseitz
Date: Mon May  5 14:41:03 2008
New Revision: 653609

URL: http://svn.apache.org/viewvc?rev=653609&view=rev
Log:
generics + javadoc typo fixes

Modified:
    wicket/trunk/wicket-examples/src/main/java/org/apache/wicket/examples/velocity/DynamicPage.java
    wicket/trunk/wicket-velocity/src/main/java/org/apache/wicket/velocity/markup/html/VelocityPanel.java

Modified: wicket/trunk/wicket-examples/src/main/java/org/apache/wicket/examples/velocity/DynamicPage.java
URL: http://svn.apache.org/viewvc/wicket/trunk/wicket-examples/src/main/java/org/apache/wicket/examples/velocity/DynamicPage.java?rev=653609&r1=653608&r2=653609&view=diff
==============================================================================
--- wicket/trunk/wicket-examples/src/main/java/org/apache/wicket/examples/velocity/DynamicPage.java (original)
+++ wicket/trunk/wicket-examples/src/main/java/org/apache/wicket/examples/velocity/DynamicPage.java Mon May  5 14:41:03 2008
@@ -33,7 +33,7 @@
  * 
  * @author <a href="mailto:jbq@apache.org">Jean-Baptiste Quenot</a>
  */
-public class DynamicPage extends WicketExamplePage
+public class DynamicPage extends WicketExamplePage<Void>
 {
 	/**
 	 * Constructor
@@ -41,10 +41,11 @@
 	 * @param parameters
 	 *            Page parameters
 	 */
+	@SuppressWarnings("unchecked")
 	public DynamicPage(final PageParameters parameters)
 	{
 		final IStringResourceStream template = new PackageResourceStream(DynamicPage.class,
-				"fields.vm");
+			"fields.vm");
 
 		Map<String, List<Field>> map = new HashMap<String, List<Field>>();
 		List<Field> fields = VelocityTemplateApplication.getFields();

Modified: wicket/trunk/wicket-velocity/src/main/java/org/apache/wicket/velocity/markup/html/VelocityPanel.java
URL: http://svn.apache.org/viewvc/wicket/trunk/wicket-velocity/src/main/java/org/apache/wicket/velocity/markup/html/VelocityPanel.java?rev=653609&r1=653608&r2=653609&view=diff
==============================================================================
--- wicket/trunk/wicket-velocity/src/main/java/org/apache/wicket/velocity/markup/html/VelocityPanel.java (original)
+++ wicket/trunk/wicket-velocity/src/main/java/org/apache/wicket/velocity/markup/html/VelocityPanel.java Mon May  5 14:41:03 2008
@@ -43,19 +43,17 @@
 /**
  * Panel that displays the result of rendering a <a
  * href="http://jakarta.apache.org/velocity">Velocity</a> template. The template itself can be any
- * <code><a href="http://wicket.apache.org/wicket/apidocs/org/apache/wicket/util/resource/IStringResourceStream.html">IStringResourceStream</a></code>
- * implementation, of which there are a number of convenient implementations in the wicket.util
- * package. The model can be any normal
- * <code><a href="http://java.sun.com/j2se/1.4.2/docs/api/java/util/Map.html">Map</a></code>,
- * which will be used to create the
- * <code><a href="http://jakarta.apache.org/velocity/docs/api/org/apache/velocity/VelocityContext.html">VelocityContext</a></code>.
+ * {@link StringResourceStream} implementation, of which there are a number of convenient
+ * implementations in the {@link org.apache.wicket.util} package. The model can be any normal
+ * {@link Map}, which will be used to create the {@link VelocityContext}.
  * 
  * <p>
  * <b>Note:</b> Be sure to properly initialize the Velocity engine before using
- * <code>VelocityPanel</code>.
+ * {@link VelocityPanel}.
  * </p>
  */
-public abstract class VelocityPanel extends Panel
+@SuppressWarnings("unchecked")
+public abstract class VelocityPanel extends Panel<Map>
 		implements
 			IMarkupResourceStreamProvider,
 			IMarkupCacheKeyProvider
@@ -67,12 +65,12 @@
 	 * @param id
 	 *            Component id
 	 * @param model
-	 *            optional model for variable substituation.
+	 *            optional model for variable substitution.
 	 * @param templateResource
 	 *            The template resource
 	 * @return an instance of {@link VelocityPanel}
 	 */
-	public static VelocityPanel forTemplateResource(String id, IModel model,
+	public static VelocityPanel forTemplateResource(String id, IModel<Map> model,
 			final IStringResourceStream templateResource)
 	{
 		if (templateResource == null)
@@ -82,6 +80,7 @@
 
 		return new VelocityPanel(id, model)
 		{
+			@Override
 			protected IStringResourceStream getTemplateResource()
 			{
 				return templateResource;
@@ -100,10 +99,9 @@
 	 * @param templateResource
 	 *            The velocity template as a string resource
 	 * @param model
-	 *            Model with variables that can be substituted by Velocity. Must return a
-	 *            {@link Map}.
+	 *            Model with variables that can be substituted by Velocity.
 	 */
-	public VelocityPanel(final String id, final IModel/* <Map> */model)
+	public VelocityPanel(final String id, final IModel<Map> model)
 	{
 		super(id, model);
 	}
@@ -134,6 +132,7 @@
 	 * @see org.apache.wicket.markup.html.panel.Panel#onComponentTagBody(org.apache.wicket.markup.MarkupStream,
 	 *      org.apache.wicket.markup.ComponentTag)
 	 */
+	@Override
 	protected void onComponentTagBody(MarkupStream markupStream, ComponentTag openTag)
 	{
 		if (!Strings.isEmpty(stackTraceAsString))
@@ -218,7 +217,7 @@
 		if (evaluatedTemplate == null)
 		{
 			// Get model as a map
-			final Map map = (Map)getModelObject();
+			final Map map = getModelObject();
 
 			// create a Velocity context object using the model if set
 			final VelocityContext ctx = new VelocityContext(map);
@@ -282,8 +281,8 @@
 	 * traps and displays any exception without having consequences for the other components on the
 	 * page.
 	 * <p>
-	 * Trapping these exceptions without disturbing the other components is especially usefull in
-	 * CMS like applications, where 'normal' users are allowed to do basic scripting. On errors, you
+	 * Trapping these exceptions without disturbing the other components is especially useful in CMS
+	 * like applications, where 'normal' users are allowed to do basic scripting. On errors, you
 	 * want them to be able to have them correct them while the rest of the application keeps on
 	 * working.
 	 * </p>
@@ -299,8 +298,8 @@
 	 * @see org.apache.wicket.markup.IMarkupResourceStreamProvider#getMarkupResourceStream(org.apache.wicket.MarkupContainer,
 	 *      java.lang.Class)
 	 */
-	public final IResourceStream getMarkupResourceStream(MarkupContainer container,
-			Class containerClass)
+	public final IResourceStream getMarkupResourceStream(MarkupContainer< ? > container,
+			Class< ? > containerClass)
 	{
 		Reader reader = getTemplateReader();
 		if (reader == null)
@@ -320,7 +319,7 @@
 	 * @see org.apache.wicket.markup.IMarkupCacheKeyProvider#getCacheKey(org.apache.wicket.MarkupContainer,
 	 *      java.lang.Class)
 	 */
-	public final String getCacheKey(MarkupContainer container, Class containerClass)
+	public final String getCacheKey(MarkupContainer< ? > container, Class< ? > containerClass)
 	{
 		// don't cache the evaluated template
 		return null;
@@ -329,6 +328,7 @@
 	/**
 	 * @see org.apache.wicket.Component#onDetach()
 	 */
+	@Override
 	protected void onDetach()
 	{
 		super.onDetach();