You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by kn...@apache.org on 2008/06/15 00:52:31 UTC

svn commit: r667896 - /wicket/trunk/wicket-extensions/src/main/java/org/apache/wicket/extensions/ajax/markup/html/modal/ModalWindow.java

Author: knopp
Date: Sat Jun 14 15:52:26 2008
New Revision: 667896

URL: http://svn.apache.org/viewvc?rev=667896&view=rev
Log:
generics

Modified:
    wicket/trunk/wicket-extensions/src/main/java/org/apache/wicket/extensions/ajax/markup/html/modal/ModalWindow.java

Modified: wicket/trunk/wicket-extensions/src/main/java/org/apache/wicket/extensions/ajax/markup/html/modal/ModalWindow.java
URL: http://svn.apache.org/viewvc/wicket/trunk/wicket-extensions/src/main/java/org/apache/wicket/extensions/ajax/markup/html/modal/ModalWindow.java?rev=667896&r1=667895&r2=667896&view=diff
==============================================================================
--- wicket/trunk/wicket-extensions/src/main/java/org/apache/wicket/extensions/ajax/markup/html/modal/ModalWindow.java (original)
+++ wicket/trunk/wicket-extensions/src/main/java/org/apache/wicket/extensions/ajax/markup/html/modal/ModalWindow.java Sat Jun 14 15:52:26 2008
@@ -46,93 +46,123 @@
 /**
  * Modal window component.
  * <p>
- * Modal window is a draggable window (with either div or iframe content) that prevent user from
- * interacting the rest of page (using a mask) until the window is closed.
+ * Modal window is a draggable window (with either div or iframe content) that
+ * prevent user from interacting the rest of page (using a mask) until the
+ * window is closed.
  * <p>
- * If you want this to work under IE, don't attach this component to a &lt;span&gt; tag, make sure
- * you use a &lt;div&gt;.
+ * If you want this to work under IE, don't attach this component to a
+ * &lt;span&gt; tag, make sure you use a &lt;div&gt;.
  * <p>
  * The window is draggable and optionally resizable. The content can be either
  * <ul>
- * <li><b>a component</b> - you need to add the component to modal window (with id obtained using
- * <code>{@link #getContentId()}</code>, or
- * <li><b>a page</b> - you need to pass a <code>{@link PageCreator}</code> instance to a
- * <code>{@link #setPageCreator(ModalWindow.PageCreator)}</code> method.
+ * <li><b>a component</b> - you need to add the component to modal window
+ * (with id obtained using <code>{@link #getContentId()}</code>, or
+ * <li><b>a page</b> - you need to pass a <code>{@link PageCreator}</code>
+ * instance to a <code>{@link #setPageCreator(ModalWindow.PageCreator)}</code>
+ * method.
  * </ul>
- * In case the content is a component, it is not rendered until the window is shown (method
- * <code>{@link #show(AjaxRequestTarget)})</code>. In case the content is another page, you can
- * set the desired pagemap name using <code>{@link #setPageMapName(String)}</code>. Setting
- * pagemap is only needed when wicket multiwindow support is on.
+ * In case the content is a component, it is not rendered until the window is
+ * shown (method <code>{@link #show(AjaxRequestTarget)})</code>. In case the
+ * content is another page, you can set the desired pagemap name using
+ * <code>{@link #setPageMapName(String)}</code>. Setting pagemap is only
+ * needed when wicket multiwindow support is on.
  * <p>
  * The window can be made visible from an ajax handler using
  * <code>{@link #show(AjaxRequestTarget)}</code>.
  * <p>
  * To close the window there are multiple options. Static method
- * <code>{@link #close(AjaxRequestTarget)}</code> can be used to close the window from a handler
- * of ajax link inside the window. By default the close button in the upper right corner of the
- * window closes it. This behavior can be altered using
- * <code>{@link #setCloseButtonCallback(ModalWindow.CloseButtonCallback)}</code>. If you want to
- * be notified when the window is closed (either using the close button or calling
- * <code>{@link #close(AjaxRequestTarget)})</code>, you can use
+ * <code>{@link #close(AjaxRequestTarget)}</code> can be used to close the
+ * window from a handler of ajax link inside the window. By default the close
+ * button in the upper right corner of the window closes it. This behavior can
+ * be altered using
+ * <code>{@link #setCloseButtonCallback(ModalWindow.CloseButtonCallback)}</code>.
+ * If you want to be notified when the window is closed (either using the close
+ * button or calling <code>{@link #close(AjaxRequestTarget)})</code>, you
+ * can use
  * <code>{@link #setWindowClosedCallback(ModalWindow.WindowClosedCallback)}</code>.
  * <p>
- * Title is specified using {@link #setTitle(String)}. If the content is a page (iframe), the title
- * can remain unset, in that case title from the page inside window will be shown.
+ * Title is specified using {@link #setTitle(String)}. If the content is a page
+ * (iframe), the title can remain unset, in that case title from the page inside
+ * window will be shown.
  * <p>
- * There are several options to specify the visual properties of the window. In all methods where
- * size is expected, width refers to width of entire window (including frame), height refers to the
- * height of window content (without frame).
+ * There are several options to specify the visual properties of the window. In
+ * all methods where size is expected, width refers to width of entire window
+ * (including frame), height refers to the height of window content (without
+ * frame).
  * <p>
  * <ul>
- * <li><code>{@link #setResizable(boolean)}</code> specifies, whether the window can be resized.
- * <li><code>{@link #setInitialWidth(int)}</code> and <code>{@link #setInitialHeight(int)}</code>
- * specify the initial width and height of window. If the window is resizable, the unit of these
- * dimensions is always "px". If the window is not resizable, the unit can be specified using
- * <code>{@link #setWidthUnit(String)}</code> and <code>{@link #setHeightUnit(String)}</code>.
- * If the window is not resizable and the content is a component (not a page), the initial height
- * value can be ignored and the actual height can be determined from the height of the content. To
- * enable this behavior use <code>{@link #setUseInitialHeight(boolean)}</code>.
- * <li>The window position (and size if the window is resizable) can be stored in a cookie, so that
- * it is preserved when window is close. The name of the cookie is specified via
- * <code>{@link #setCookieName(String)}</code>. If the name is <code>null</code>, position is
- * not stored (initial width and height are always used). Default cookie name is null (position is
- * not stored).
- * <li><code>{@link #setMinimalWidth(int)}</code> and <code>{@link #setMinimalHeight(int)}</code>
- * set the minimal dimensions of resizable window.
+ * <li><code>{@link #setResizable(boolean)}</code> specifies, whether the
+ * window can be resized.
+ * <li><code>{@link #setInitialWidth(int)}</code> and
+ * <code>{@link #setInitialHeight(int)}</code> specify the initial width and
+ * height of window. If the window is resizable, the unit of these dimensions is
+ * always "px". If the window is not resizable, the unit can be specified using
+ * <code>{@link #setWidthUnit(String)}</code> and
+ * <code>{@link #setHeightUnit(String)}</code>. If the window is not
+ * resizable and the content is a component (not a page), the initial height
+ * value can be ignored and the actual height can be determined from the height
+ * of the content. To enable this behavior use
+ * <code>{@link #setUseInitialHeight(boolean)}</code>.
+ * <li>The window position (and size if the window is resizable) can be stored
+ * in a cookie, so that it is preserved when window is close. The name of the
+ * cookie is specified via <code>{@link #setCookieName(String)}</code>. If
+ * the name is <code>null</code>, position is not stored (initial width and
+ * height are always used). Default cookie name is null (position is not
+ * stored).
+ * <li><code>{@link #setMinimalWidth(int)}</code> and
+ * <code>{@link #setMinimalHeight(int)}</code> set the minimal dimensions of
+ * resizable window.
  * <li>Modal window can chose between two colors of frame.
- * <code>{@link #setCssClassName(String)}</code> sets the dialog css class, possible values are
- * <code>{@link #CSS_CLASS_BLUE}</code> for blue frame and <code>{@link #CSS_CLASS_GRAY}</code>
- * for gray frame.
- * <li>Mask (element that prevents user from interacting the rest of the page) can be either
- * transparent or semitransparent. <code>{@link #setMaskType(ModalWindow.MaskType)}</code> alters
- * this.
+ * <code>{@link #setCssClassName(String)}</code> sets the dialog css class,
+ * possible values are <code>{@link #CSS_CLASS_BLUE}</code> for blue frame and
+ * <code>{@link #CSS_CLASS_GRAY}</code> for gray frame.
+ * <li>Mask (element that prevents user from interacting the rest of the page)
+ * can be either transparent or semitransparent.
+ * <code>{@link #setMaskType(ModalWindow.MaskType)}</code> alters this.
  * </ul>
- * 
+ *
  * @see IPageSettings#setAutomaticMultiWindowSupport(boolean)
  * @author Matej Knopp
  */
-public class ModalWindow extends Panel
+public class ModalWindow<T> extends Panel<T>
 {
 	private static final long serialVersionUID = 1L;
 
-	private static ResourceReference JAVASCRIPT = new JavascriptResourceReference(
-		ModalWindow.class, "res/modal.js");
+	private static ResourceReference JAVASCRIPT = new JavascriptResourceReference(ModalWindow.class, "res/modal.js");
 
-	private static ResourceReference CSS = new CompressedResourceReference(ModalWindow.class,
-		"res/modal.css");
+	private static ResourceReference CSS = new CompressedResourceReference(ModalWindow.class, "res/modal.css");
 
 	/**
 	 * Creates a new modal window component.
-	 * 
+	 *
 	 * @param id
 	 *            Id of component
 	 */
 	public ModalWindow(String id)
 	{
 		super(id);
+		init();
+	}
+
+	/**
+	 * Creates a new modal window component.
+	 *
+	 * @param id
+	 *            Id of component
+	 * @param model
+	 *            Model
+	 */
+	public ModalWindow(String id, IModel<T> model)
+	{
+		super(id, model);
+		init();
+	}
+
+	private void init()
+	{
 		setVersioned(false);
 		cookieName = null;
-		add(empty = new WebMarkupContainer(getContentId()));
+		add(empty = new WebMarkupContainer<Void>(getContentId()));
 
 		add(new CloseButtonBehavior());
 		add(new WindowClosedBehavior());
@@ -141,67 +171,72 @@
 	}
 
 	/**
-	 * Interface for lazy page creation. The advantage of creating page using this interface over
-	 * just passing a page instance is that page created in <code>{@link #createPage()}</code>
-	 * will have the pagemap automatically set to the pagemap specified for
-	 * <code>{@link ModalWindow}</code>.
-	 * 
+	 * Interface for lazy page creation. The advantage of creating page using
+	 * this interface over just passing a page instance is that page created in
+	 * <code>{@link #createPage()}</code> will have the pagemap automatically
+	 * set to the pagemap specified for <code>{@link ModalWindow}</code>.
+	 *
 	 * @author Matej Knopp
 	 */
 	public static interface PageCreator extends IClusterable
 	{
 		/**
 		 * Creates a new instance of content page.
-		 * 
+		 *
 		 * @return new page instance
 		 */
-		public Page createPage();
+		public Page<?> createPage();
 	}
 
 	/**
-	 * Callback for close button that contains a method that is invoked after the button has been
-	 * clicked. If no callback instance is specified using
+	 * Callback for close button that contains a method that is invoked after
+	 * the button has been clicked. If no callback instance is specified using
 	 * <code>{@link ModalWindow#setCloseButtonCallback(ModalWindow.CloseButtonCallback)}</code>,
-	 * no ajax request will be fired. Clicking the button will just close the window.
-	 * 
+	 * no ajax request will be fired. Clicking the button will just close the
+	 * window.
+	 *
 	 * @author Matej Knopp
 	 */
 	public static interface CloseButtonCallback extends IClusterable
 	{
 		/**
-		 * Methods invoked after the button has been clicked. The invocation is done using an ajax
-		 * call, so <code>{@link AjaxRequestTarget}</code> instance is available.
-		 * 
+		 * Methods invoked after the button has been clicked. The invocation is
+		 * done using an ajax call, so <code>{@link AjaxRequestTarget}</code>
+		 * instance is available.
+		 *
 		 * @param target
-		 *            <code>{@link AjaxRequestTarget}</code> instance bound with the ajax request.
-		 * 
-		 * @return True if the window can be closed (will close the window), false otherwise
+		 *            <code>{@link AjaxRequestTarget}</code> instance bound
+		 *            with the ajax request.
+		 *
+		 * @return True if the window can be closed (will close the window),
+		 *         false otherwise
 		 */
 		public boolean onCloseButtonClicked(AjaxRequestTarget target);
 	}
 
 	/**
-	 * Callback called after the window has been closed. If no callback instance is specified using
-	 * {@link ModalWindow#setWindowClosedCallback(ModalWindow.WindowClosedCallback)}, no ajax
-	 * request will be fired.
-	 * 
+	 * Callback called after the window has been closed. If no callback instance
+	 * is specified using
+	 * {@link ModalWindow#setWindowClosedCallback(ModalWindow.WindowClosedCallback)},
+	 * no ajax request will be fired.
+	 *
 	 * @author Matej Knopp
 	 */
 	public static interface WindowClosedCallback extends IClusterable
 	{
 		/**
 		 * Called after the window has been closed.
-		 * 
+		 *
 		 * @param target
-		 *            <code>{@link AjaxRequestTarget}</code> instance bound with the ajax request.
+		 *            <code>{@link AjaxRequestTarget}</code> instance bound
+		 *            with the ajax request.
 		 */
 		public void onClose(AjaxRequestTarget target);
 	}
 
-
 	/**
 	 * Is this window currently showing.
-	 * 
+	 *
 	 * @return the shown
 	 */
 	public boolean isShown()
@@ -210,9 +245,10 @@
 	}
 
 	/**
-	 * Sets the name of the page ma for the content page. This makes only sense when the content is
-	 * a page, not a component and if wicket multiwindow support is turned on.
-	 * 
+	 * Sets the name of the page ma for the content page. This makes only sense
+	 * when the content is a page, not a component and if wicket multiwindow
+	 * support is turned on.
+	 *
 	 * @param pageMapName
 	 *            Name of the page map
 	 */
@@ -223,7 +259,7 @@
 
 	/**
 	 * Returns the page map name.
-	 * 
+	 *
 	 * @return The page map name.
 	 */
 	public String getPageMapName()
@@ -232,9 +268,9 @@
 	}
 
 	/**
-	 * Sets the <code>{@link PageCreator}</code> instance. The instance is only used when no
-	 * custom component has been added to the dialog.
-	 * 
+	 * Sets the <code>{@link PageCreator}</code> instance. The instance is
+	 * only used when no custom component has been added to the dialog.
+	 *
 	 * @param creator
 	 *            <code>{@link PageCreator}</code> instance
 	 */
@@ -245,7 +281,7 @@
 
 	/**
 	 * Sets the <code>{@link CloseButtonCallback}</code> instance.
-	 * 
+	 *
 	 * @param callback
 	 *            Callback instance
 	 */
@@ -256,7 +292,7 @@
 
 	/**
 	 * Sets the <code>@{link {@link WindowClosedCallback}</code> instance.
-	 * 
+	 *
 	 * @param callback
 	 *            Callback instance
 	 */
@@ -267,7 +303,7 @@
 
 	/**
 	 * Shows the modal window.
-	 * 
+	 *
 	 * @param target
 	 *            Request target associated with current ajax request.
 	 */
@@ -283,10 +319,10 @@
 	}
 
 	/**
-	 * Hides the modal window. This can be called from within the modal window, however, the modal
-	 * window must have configured WindowClosedCallback. Otherwise use the
-	 * {@link #close(AjaxRequestTarget)} method.
-	 * 
+	 * Hides the modal window. This can be called from within the modal window,
+	 * however, the modal window must have configured WindowClosedCallback.
+	 * Otherwise use the {@link #close(AjaxRequestTarget)} method.
+	 *
 	 * @param target
 	 *            Request target associated with current ajax request.
 	 */
@@ -297,7 +333,7 @@
 
 	/**
 	 * Closes the modal window.
-	 * 
+	 *
 	 * @param target
 	 *            Request target associated with current ajax request.
 	 */
@@ -314,29 +350,25 @@
 	private static String getCloseJavacript()
 	{
 		return "var win;\n" //
-			+ "try {\n" + "	win = window.parent.Wicket.Window;\n"
-			+ "} catch (ignore) {\n"
-			+ "}\n"
-			+ "if (typeof(win) == \"undefined\" || typeof(win.current) == \"undefined\") {\n"
-			+ "  try {\n"
-			+ "     win = window.Wicket.Window;\n"
-			+ "  } catch (ignore) {\n"
-			+ "  }\n"
-			+ "}\n"
-			+ "if (typeof(win) != \"undefined\" && typeof(win.current) != \"undefined\") {\n"
-			+ "	window.parent.setTimeout(function() {\n" + "		win.current.close();\n"
-			+ "	}, 0);\n"
-			+ "}";
+				+ "try {\n" + "	win = window.parent.Wicket.Window;\n" + "} catch (ignore) {\n"
+				+ "}\n"
+				+ "if (typeof(win) == \"undefined\" || typeof(win.current) == \"undefined\") {\n"
+				+ "  try {\n"
+				+ "     win = window.Wicket.Window;\n" + "  } catch (ignore) {\n"
+				+ "  }\n"
+				+ "}\n"
+				+ "if (typeof(win) != \"undefined\" && typeof(win.current) != \"undefined\") {\n"
+				+ "	window.parent.setTimeout(function() {\n" + "		win.current.close();\n" + "	}, 0);\n" + "}";
 	}
 
 	/**
 	 * Returns the id of content component.
-	 * 
+	 *
 	 * <pre>
 	 * ModalWindow window = new ModalWindow(parent, &quot;window&quot;);
 	 * new MyPanel(window, window.getContentId());
 	 * </pre>
-	 * 
+	 *
 	 * @return Id of content component.
 	 */
 	public String getContentId()
@@ -345,9 +377,10 @@
 	}
 
 	/**
-	 * Sets the minimal width of window. This value is only used if the window is resizable. The
-	 * width is specified in pixels and it is the width of entire window (including frame).
-	 * 
+	 * Sets the minimal width of window. This value is only used if the window
+	 * is resizable. The width is specified in pixels and it is the width of
+	 * entire window (including frame).
+	 *
 	 * @param minimalWidth
 	 *            Minimal window width.
 	 */
@@ -358,7 +391,7 @@
 
 	/**
 	 * Returns the minimal width of window (in pixels).
-	 * 
+	 *
 	 * @return Minimal width of window
 	 */
 	public int getMinimalWidth()
@@ -367,9 +400,10 @@
 	}
 
 	/**
-	 * Sets the minimal height of window. This value is only used if window is resizable. The height
-	 * is specified in pixels and it is the height of window content (without frame).
-	 * 
+	 * Sets the minimal height of window. This value is only used if window is
+	 * resizable. The height is specified in pixels and it is the height of
+	 * window content (without frame).
+	 *
 	 * @param minimalHeight
 	 *            Minimal height
 	 */
@@ -380,7 +414,7 @@
 
 	/**
 	 * Returns the minimal height of window (in pixels).
-	 * 
+	 *
 	 * @return Minimal height of window
 	 */
 	public int getMinimalHeight()
@@ -399,10 +433,11 @@
 	public final static String CSS_CLASS_GRAY = "w_silver";
 
 	/**
-	 * Sets the CSS class name for this window. This class affects the look of window frame.
-	 * Possible values (if you don't make your style sheet) are <code>{@link #CSS_CLASS_BLUE}</code>
-	 * and <code>{@link #CSS_CLASS_GRAY}</code>.
-	 * 
+	 * Sets the CSS class name for this window. This class affects the look of
+	 * window frame. Possible values (if you don't make your style sheet) are
+	 * <code>{@link #CSS_CLASS_BLUE}</code> and
+	 * <code>{@link #CSS_CLASS_GRAY}</code>.
+	 *
 	 * @param cssClassName
 	 */
 	public void setCssClassName(String cssClassName)
@@ -412,7 +447,7 @@
 
 	/**
 	 * Returns the CSS class name for this window.
-	 * 
+	 *
 	 * @return CSS class name
 	 */
 	public String getCssClassName()
@@ -421,12 +456,13 @@
 	}
 
 	/**
-	 * Sets the initial width of the window. The width refers to the width of entire window
-	 * (including frame). If the window is resizable, the width unit is always "px". If the window
-	 * is not resizable, the unit can be specified using {@link #setWidthUnit(String)}. If cookie
-	 * name is set and window is resizable, the initial width may be ignored in favor of width
+	 * Sets the initial width of the window. The width refers to the width of
+	 * entire window (including frame). If the window is resizable, the width
+	 * unit is always "px". If the window is not resizable, the unit can be
+	 * specified using {@link #setWidthUnit(String)}. If cookie name is set and
+	 * window is resizable, the initial width may be ignored in favor of width
 	 * stored in cookie.
-	 * 
+	 *
 	 * @param initialWidth
 	 *            Initial width of the window
 	 */
@@ -437,7 +473,7 @@
 
 	/**
 	 * Returns the initial width of the window.
-	 * 
+	 *
 	 * @return Initial height of the window
 	 */
 	public int getInitialWidth()
@@ -446,12 +482,13 @@
 	}
 
 	/**
-	 * Sets the initial height of the window. The height refers to the height of window content
-	 * (without frame). If the window is resizable, the height unit is always "px". If the window is
-	 * not resizable, the unit can be specified using {@link #setHeightUnit(String)}. If cookie
-	 * name is set and window is resizable, the initial height may be ignored in favor of height
-	 * stored in cookie.
-	 * 
+	 * Sets the initial height of the window. The height refers to the height of
+	 * window content (without frame). If the window is resizable, the height
+	 * unit is always "px". If the window is not resizable, the unit can be
+	 * specified using {@link #setHeightUnit(String)}. If cookie name is set
+	 * and window is resizable, the initial height may be ignored in favor of
+	 * height stored in cookie.
+	 *
 	 * @param initialHeight
 	 *            Initial height of the window
 	 */
@@ -462,7 +499,7 @@
 
 	/**
 	 * Returns the initial height of the window.
-	 * 
+	 *
 	 * @return Initial height of the window
 	 */
 	public int getInitialHeight()
@@ -471,12 +508,13 @@
 	}
 
 	/**
-	 * Sets whether to use initial height or preserve the real content height. This can only be used
-	 * if the content is a component (not a page) and the window is not resizable.
-	 * 
+	 * Sets whether to use initial height or preserve the real content height.
+	 * This can only be used if the content is a component (not a page) and the
+	 * window is not resizable.
+	 *
 	 * @param useInitialHeight
-	 *            Whether to use initial height instead of preserving content height instead of
-	 *            using initial height
+	 *            Whether to use initial height instead of preserving content
+	 *            height instead of using initial height
 	 */
 	public void setUseInitialHeight(boolean useInitialHeight)
 	{
@@ -484,12 +522,12 @@
 	}
 
 	/**
-	 * Returns true if the initial height should be used (in favor of preserving real content
-	 * height).
-	 * 
-	 * @return True if initial height should be used, false is real content height should be
-	 *         preserved (valid only if the window is not resizable and the content is a component
-	 *         (not a page)
+	 * Returns true if the initial height should be used (in favor of preserving
+	 * real content height).
+	 *
+	 * @return True if initial height should be used, false is real content
+	 *         height should be preserved (valid only if the window is not
+	 *         resizable and the content is a component (not a page)
 	 */
 	public boolean isUseInitialHeight()
 	{
@@ -498,7 +536,7 @@
 
 	/**
 	 * Sets whether the user will be able to resize the window.
-	 * 
+	 *
 	 * @param resizable
 	 *            Whether the window is resizable
 	 */
@@ -509,7 +547,7 @@
 
 	/**
 	 * Returns whether the window is resizable.
-	 * 
+	 *
 	 * @return True if the window is resizable, false otherwise
 	 */
 	public boolean isResizable()
@@ -518,9 +556,9 @@
 	}
 
 	/**
-	 * Sets the CSS unit used for initial window width. This is only applicable when the window is
-	 * not resizable.
-	 * 
+	 * Sets the CSS unit used for initial window width. This is only applicable
+	 * when the window is not resizable.
+	 *
 	 * @param widthUnit
 	 *            CSS unit for initial window width.
 	 */
@@ -531,7 +569,7 @@
 
 	/**
 	 * Returns the CSS unit for initial window width.
-	 * 
+	 *
 	 * @return CSS unit for initial window width.
 	 */
 	public String getWidthUnit()
@@ -540,9 +578,9 @@
 	}
 
 	/**
-	 * Sets the CSS unit used for initial window height. This is only applicable when the window is
-	 * not resizable.
-	 * 
+	 * Sets the CSS unit used for initial window height. This is only applicable
+	 * when the window is not resizable.
+	 *
 	 * @param heightUnit
 	 *            CSS unit for initial window height.
 	 */
@@ -553,7 +591,7 @@
 
 	/**
 	 * Retrns the CSS unit for initial window height.
-	 * 
+	 *
 	 * @return CSS unit for initial window height.
 	 */
 	public String getHeightUnit()
@@ -562,9 +600,9 @@
 	}
 
 	/**
-	 * Sets the name of the cookie that is used to remember window position (and size if the window
-	 * is resizable).
-	 * 
+	 * Sets the name of the cookie that is used to remember window position (and
+	 * size if the window is resizable).
+	 *
 	 * @param cookieName
 	 *            Name of the cookie
 	 */
@@ -578,9 +616,9 @@
 	}
 
 	/**
-	 * Returns the name of cookie that is used to remember window position (and size if the window
-	 * is resizable).
-	 * 
+	 * Returns the name of cookie that is used to remember window position (and
+	 * size if the window is resizable).
+	 *
 	 * @return Name of the cookie
 	 */
 	public String getCookieName()
@@ -589,25 +627,27 @@
 	}
 
 	/**
-	 * Sets the title of window. If the window is a page, title can be <code>null</code>. In that
-	 * case it will display the title document inside the window.
-	 * 
+	 * Sets the title of window. If the window is a page, title can be
+	 * <code>null</code>. In that case it will display the title document
+	 * inside the window.
+	 *
 	 * @param title
 	 *            Title of the window
 	 */
 	public void setTitle(String title)
 	{
-		this.title = new Model(title);
+		this.title = new Model<String>(title);
 	}
 
 	/**
-	 * Sets the title of window. If the window is a page, title can be <code>null</code>. In that
-	 * case it will display the title document inside the window.
-	 * 
+	 * Sets the title of window. If the window is a page, title can be
+	 * <code>null</code>. In that case it will display the title document
+	 * inside the window.
+	 *
 	 * @param title
 	 *            Title of the window
 	 */
-	public void setTitle(IModel title)
+	public void setTitle(IModel<String> title)
 	{
 		title = wrap(title);
 		this.title = title;
@@ -615,22 +655,23 @@
 
 	/**
 	 * Returns the title of the window.
-	 * 
+	 *
 	 * @return Title of the window
 	 */
-	public IModel getTitle()
+	public IModel<String> getTitle()
 	{
 		return title;
 	}
 
 	/**
-	 * Mask is the element behind the window, that prevents user from interacting the rest of page.
-	 * Mask can be either
+	 * Mask is the element behind the window, that prevents user from
+	 * interacting the rest of page. Mask can be either
 	 * <ul>
 	 * <li><code>{@link #TRANSPARENT}</code> - the mask is invisible
-	 * <li><code>{@link #SEMI_TRANSPARENT}</code> - the mask is black with small opacity (10%)
+	 * <li><code>{@link #SEMI_TRANSPARENT}</code> - the mask is black with
+	 * small opacity (10%)
 	 * </ul>
-	 * 
+	 *
 	 * @author Matej Knopp
 	 */
 	public static final class MaskType extends EnumeratedType
@@ -650,7 +691,7 @@
 
 		/**
 		 * Constructor.
-		 * 
+		 *
 		 * @param name
 		 */
 		public MaskType(String name)
@@ -661,7 +702,7 @@
 
 	/**
 	 * Sets the mask type of the window.
-	 * 
+	 *
 	 * @param mask
 	 *            The mask type
 	 */
@@ -672,7 +713,7 @@
 
 	/**
 	 * Returns the mask type of the window
-	 * 
+	 *
 	 * @return The mask type
 	 */
 	public MaskType getMaskType()
@@ -682,10 +723,10 @@
 
 	/**
 	 * Creates the page.
-	 * 
+	 *
 	 * @return Page instance or null if page couldn't be created.
 	 */
-	private Page createPage()
+	private Page<?> createPage()
 	{
 		if (pageCreator == null)
 		{
@@ -710,7 +751,7 @@
 			}
 			try
 			{
-				Page page = pageCreator.createPage();
+				Page<?> page = pageCreator.createPage();
 				return page;
 			}
 			finally
@@ -727,7 +768,7 @@
 	protected void onBeforeRender()
 	{
 		// if user is refreshing whole page, the window will not be shown
-		if (((WebRequest)getRequest()).isAjax() == false)
+		if (((WebRequest) getRequest()).isAjax() == false)
 		{
 			shown = false;
 		}
@@ -748,22 +789,22 @@
 		tag.put("style", "display:none");
 	}
 
-
 	/**
-	 * Returns a content component. In case user haven't specified any content component, it returns
-	 * an empty WebMarkupContainer.
-	 * 
+	 * Returns a content component. In case user haven't specified any content
+	 * component, it returns an empty WebMarkupContainer.
+	 *
 	 * @return Content component
 	 */
-	private Component getContent()
+	private Component<?> getContent()
 	{
 		return get(getContentId());
 	}
 
 	/**
 	 * Returns true if user has added own component to the window.
-	 * 
-	 * @return True if user has added own component to the window, false otherwise.
+	 *
+	 * @return True if user has added own component to the window, false
+	 *         otherwise.
 	 */
 	private boolean isCustomComponent()
 	{
@@ -774,21 +815,21 @@
 	 * @see org.apache.wicket.MarkupContainer#remove(org.apache.wicket.Component)
 	 */
 	@Override
-	public void remove(Component component)
+	public void remove(Component<?> component)
 	{
 		super.remove(component);
 		if (component.getId().equals(getContentId()))
 		{
-			add(empty = new WebMarkupContainer(getContentId()));
+			add(empty = new WebMarkupContainer<Void>(getContentId()));
 		}
 	}
 
 	/**
 	 * Sets the content of the modal window.
-	 * 
+	 *
 	 * @param component
 	 */
-	public void setContent(Component component)
+	public void setContent(Component<?> component)
 	{
 		if (component.getId().equals(getContentId()) == false)
 		{
@@ -850,8 +891,7 @@
 		@Override
 		protected void respond(AjaxRequestTarget target)
 		{
-			if (closeButtonCallback == null ||
-				closeButtonCallback.onCloseButtonClicked(target) == true)
+			if (closeButtonCallback == null || closeButtonCallback.onCloseButtonClicked(target) == true)
 			{
 				close(target);
 			}
@@ -878,7 +918,7 @@
 
 	/**
 	 * Returns the markup id of the component.
-	 * 
+	 *
 	 * @return component id
 	 */
 	private String getContentMarkupId()
@@ -888,10 +928,10 @@
 
 	/**
 	 * Replaces all occurrences of " in string with \".
-	 * 
+	 *
 	 * @param string
 	 *            String to be escaped.
-	 * 
+	 *
 	 * @return escaped string
 	 */
 	private String escapeQuotes(String string)
@@ -905,7 +945,7 @@
 
 	/**
 	 * Returns the javascript used to open the window.
-	 * 
+	 *
 	 * @return javascript that opens the window
 	 */
 	private String getWindowOpenJavascript()
@@ -914,8 +954,7 @@
 
 		if (isCustomComponent() == true)
 		{
-			buffer.append("var element = document.getElementById(\"" + getContentMarkupId() +
-				"\");\n");
+			buffer.append("var element = document.getElementById(\"" + getContentMarkupId() + "\");\n");
 		}
 
 		buffer.append("var settings = new Object();\n");
@@ -939,7 +978,7 @@
 
 		if (isCustomComponent() == false)
 		{
-			Page page = createPage();
+			Page<?> page = createPage();
 			if (page == null)
 			{
 				throw new WicketRuntimeException("Error creating page for modal dialog.");
@@ -962,7 +1001,6 @@
 			buffer.append("settings.cookieId=\"" + getCookieName() + "\";\n");
 		}
 
-
 		Object title = getTitle() != null ? getTitle().getObject() : null;
 		if (title != null)
 		{
@@ -986,10 +1024,8 @@
 		// attach notification request
 		if ((isCustomComponent() == false && deletePageMap) || windowClosedCallback != null)
 		{
-			WindowClosedBehavior behavior = (WindowClosedBehavior)getBehaviors(
-				WindowClosedBehavior.class).get(0);
-			buffer.append("settings.onClose = function() { " + behavior.getCallbackScript() +
-				" };\n");
+			WindowClosedBehavior behavior = (WindowClosedBehavior) getBehaviors(WindowClosedBehavior.class).get(0);
+			buffer.append("settings.onClose = function() { " + behavior.getCallbackScript() + " };\n");
 
 			haveCloseCallback = true;
 		}
@@ -999,10 +1035,8 @@
 		// to close window property (thus cleaning the shown flag)
 		if (closeButtonCallback != null || haveCloseCallback == false)
 		{
-			CloseButtonBehavior behavior = (CloseButtonBehavior)getBehaviors(
-				CloseButtonBehavior.class).get(0);
-			buffer.append("settings.onCloseButton = function() { " + behavior.getCallbackScript() +
-				"};\n");
+			CloseButtonBehavior behavior = (CloseButtonBehavior) getBehaviors(CloseButtonBehavior.class).get(0);
+			buffer.append("settings.onCloseButton = function() { " + behavior.getCallbackScript() + "};\n");
 		}
 
 		postProcessSettings(buffer);
@@ -1014,7 +1048,7 @@
 
 	/**
 	 * Method that allows tweaking the settings
-	 * 
+	 *
 	 * @param settings
 	 * @return settings javascript
 	 */
@@ -1027,7 +1061,7 @@
 	private boolean shown = false;
 
 	// empty container - used when no component is added
-	private WebMarkupContainer empty;
+	private WebMarkupContainer<?> empty;
 
 	private int minimalWidth = 200;
 	private int minimalHeight = 200;
@@ -1039,7 +1073,7 @@
 	private String widthUnit = "px";
 	private String heightUnit = "px";
 	private String cookieName;
-	private IModel title = null;
+	private IModel<String> title = null;
 	private MaskType maskType = MaskType.SEMI_TRANSPARENT;
 
 	private String pageMapName = "modal-dialog-pagemap";