You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by iv...@apache.org on 2008/06/29 07:51:39 UTC
svn commit: r672603 [6/18] - in /wicket/trunk:
testing/wicket-threadtest/src/main/java/org/apache/wicket/threadtest/apps/app1/
testing/wicket-threadtest/src/main/java/org/apache/wicket/threadtest/apps/app2/
wicket-auth-roles/src/main/java/org/apache/wi...
Modified: wicket/trunk/wicket-extensions/src/main/java/org/apache/wicket/extensions/ajax/markup/html/AjaxEditableLabel.java
URL: http://svn.apache.org/viewvc/wicket/trunk/wicket-extensions/src/main/java/org/apache/wicket/extensions/ajax/markup/html/AjaxEditableLabel.java?rev=672603&r1=672602&r2=672603&view=diff
==============================================================================
--- wicket/trunk/wicket-extensions/src/main/java/org/apache/wicket/extensions/ajax/markup/html/AjaxEditableLabel.java (original)
+++ wicket/trunk/wicket-extensions/src/main/java/org/apache/wicket/extensions/ajax/markup/html/AjaxEditableLabel.java Sat Jun 28 22:50:41 2008
@@ -44,10 +44,10 @@
* <ul>
* <li>{@link #onEdit(AjaxRequestTarget)} is called when the label is clicked and the editor is to
* be displayed. The default implementation switches the label for the editor and places the caret
- * at the end of the text. </li>
+ * at the end of the text.</li>
* <li>{@link #onSubmit(AjaxRequestTarget)} is called when in edit mode, the user submitted new
* content, that content validated well, and the model value successfully updated. This
- * implementation also clears any <code>window.status</code> set. </li>
+ * implementation also clears any <code>window.status</code> set.</li>
* <li>{@link #onError(AjaxRequestTarget)} is called when in edit mode, the user submitted new
* content, but that content did not validate. Get the current input by calling
* {@link FormComponent#getInput()} on {@link #getEditor()}, and the error message by calling:
@@ -67,12 +67,10 @@
*
* @author Igor Vaynberg (ivaynberg)
* @author Eelco Hillenius
- *
* @param <T>
- * The model object type
*/
// TODO wonder if it makes sense to refactor this into a formcomponentpanel
-public class AjaxEditableLabel<T> extends Panel<T>
+public class AjaxEditableLabel<T> extends Panel
{
private static final long serialVersionUID = 1L;
@@ -80,7 +78,7 @@
private FormComponent<T> editor;
/** label component. */
- private WebComponent<T> label;
+ private WebComponent label;
protected class EditorAjaxBehavior extends AbstractDefaultAjaxBehavior
{
@@ -192,13 +190,13 @@
* Adds a validator to this form component. A model must be available for this component before
* Validators can be added. Either add this Component to its parent (already having a Model), or
* provide one before this call via constructor {@link #AjaxEditableLabel(String,IModel)} or
- * {@link #setModel(IModel)}.
+ * {@link #setDefaultModel(IModel)}.
*
* @param validator
* The validator
* @return This
*/
- public final AjaxEditableLabel<T> add(IValidator validator)
+ public final AjaxEditableLabel add(IValidator validator)
{
getEditor().add(validator);
return this;
@@ -226,21 +224,21 @@
* @param labelModel
* @return this for chaining
*/
- public final AjaxEditableLabel<T> setLabel(final IModel<String> labelModel)
+ public final AjaxEditableLabel setLabel(final IModel<String> labelModel)
{
getEditor().setLabel(labelModel);
return this;
}
/**
- * @see org.apache.wicket.MarkupContainer#setModel(org.apache.wicket.model.IModel)
+ * @see org.apache.wicket.MarkupContainer#setDefaultModel(org.apache.wicket.model.IModel)
*/
@Override
- public final AjaxEditableLabel<T> setModel(IModel<T> model)
+ public final AjaxEditableLabel setDefaultModel(IModel<?> model)
{
- super.setModel(model);
- getLabel().setModel(model);
- getEditor().setModel(model);
+ super.setDefaultModel(model);
+ getLabel().setDefaultModel(model);
+ getEditor().setDefaultModel(model);
return this;
}
@@ -250,7 +248,7 @@
* @param required
* @return this for chaining
*/
- public final AjaxEditableLabel<T> setRequired(final boolean required)
+ public final AjaxEditableLabel setRequired(final boolean required)
{
getEditor().setRequired(required);
return this;
@@ -263,7 +261,7 @@
* @param type
* @return this for chaining
*/
- public final AjaxEditableLabel<T> setType(Class<T> type)
+ public final AjaxEditableLabel setType(Class<?> type)
{
getEditor().setType(type);
return this;
@@ -280,8 +278,7 @@
* The model
* @return The editor
*/
- protected FormComponent<T> newEditor(MarkupContainer<?> parent, String componentId,
- IModel<T> model)
+ protected FormComponent<T> newEditor(MarkupContainer parent, String componentId, IModel<T> model)
{
TextField<T> editor = new TextField<T>(componentId, model)
{
@@ -325,10 +322,10 @@
* The model
* @return The editor
*/
- protected WebComponent<T> newLabel(MarkupContainer<?> parent, String componentId,
- IModel<T> model)
+ @SuppressWarnings("unchecked")
+ protected WebComponent newLabel(MarkupContainer parent, String componentId, IModel<T> model)
{
- Label<T> label = new Label<T>(componentId, model)
+ Label label = new Label(componentId, model)
{
private static final long serialVersionUID = 1L;
@@ -342,7 +339,7 @@
@Override
protected void onComponentTagBody(MarkupStream markupStream, ComponentTag openTag)
{
- Object modelObject = getModelObject();
+ Object modelObject = getDefaultModelObject();
if (modelObject == null || "".equals(modelObject))
{
replaceComponentTagBody(markupStream, openTag, defaultNullLabel());
@@ -389,7 +386,7 @@
*
* @return The label component
*/
- protected final WebComponent<T> getLabel()
+ protected final WebComponent getLabel()
{
if (label == null)
{
@@ -501,18 +498,19 @@
/**
* @return Gets the parent model in case no explicit model was specified.
*/
+ @SuppressWarnings("unchecked")
private IModel<T> getParentModel()
{
// the #getModel() call below will resolve and assign any inheritable
// model this component can use. Set that directly to the label and
// editor so that those components work like this enclosing panel
// does not exist (must have that e.g. with CompoundPropertyModels)
- IModel<T> m = getModel();
+ IModel<T> m = (IModel<T>)getDefaultModel();
// check that a model was found
if (m == null)
{
- Component<?> parent = getParent();
+ Component parent = getParent();
String msg = "No model found for this component, either pass one explicitly or "
+ "make sure an inheritable model is available.";
if (parent == null)
Modified: wicket/trunk/wicket-extensions/src/main/java/org/apache/wicket/extensions/ajax/markup/html/AjaxEditableMultiLineLabel.java
URL: http://svn.apache.org/viewvc/wicket/trunk/wicket-extensions/src/main/java/org/apache/wicket/extensions/ajax/markup/html/AjaxEditableMultiLineLabel.java?rev=672603&r1=672602&r2=672603&view=diff
==============================================================================
--- wicket/trunk/wicket-extensions/src/main/java/org/apache/wicket/extensions/ajax/markup/html/AjaxEditableMultiLineLabel.java (original)
+++ wicket/trunk/wicket-extensions/src/main/java/org/apache/wicket/extensions/ajax/markup/html/AjaxEditableMultiLineLabel.java Sat Jun 28 22:50:41 2008
@@ -74,17 +74,16 @@
* java.lang.String, org.apache.wicket.model.IModel)
*/
@Override
- protected MultiLineLabel<T> newLabel(MarkupContainer< ? > parent, String componentId,
- IModel<T> model)
+ protected MultiLineLabel newLabel(MarkupContainer parent, String componentId, IModel<T> model)
{
- MultiLineLabel<T> label = new MultiLineLabel<T>(componentId, model)
+ MultiLineLabel label = new MultiLineLabel(componentId, model)
{
private static final long serialVersionUID = 1L;
@Override
protected void onComponentTagBody(MarkupStream markupStream, ComponentTag openTag)
{
- Object modelObject = getModelObject();
+ Object modelObject = getDefaultModelObject();
if (modelObject == null || "".equals(modelObject))
{
replaceComponentTagBody(markupStream, openTag, defaultNullLabel());
@@ -117,8 +116,7 @@
* java.lang.String, org.apache.wicket.model.IModel)
*/
@Override
- protected FormComponent<T> newEditor(MarkupContainer< ? > parent, String componentId,
- IModel<T> model)
+ protected FormComponent<T> newEditor(MarkupContainer parent, String componentId, IModel<T> model)
{
TextArea<T> editor = new TextArea<T>(componentId, model)
{
Modified: wicket/trunk/wicket-extensions/src/main/java/org/apache/wicket/extensions/ajax/markup/html/AjaxLazyLoadPanel.java
URL: http://svn.apache.org/viewvc/wicket/trunk/wicket-extensions/src/main/java/org/apache/wicket/extensions/ajax/markup/html/AjaxLazyLoadPanel.java?rev=672603&r1=672602&r2=672603&view=diff
==============================================================================
--- wicket/trunk/wicket-extensions/src/main/java/org/apache/wicket/extensions/ajax/markup/html/AjaxLazyLoadPanel.java (original)
+++ wicket/trunk/wicket-extensions/src/main/java/org/apache/wicket/extensions/ajax/markup/html/AjaxLazyLoadPanel.java Sat Jun 28 22:50:41 2008
@@ -50,7 +50,7 @@
* @param id
* @param model
*/
- public AjaxLazyLoadPanel(String id, IModel model)
+ public AjaxLazyLoadPanel(String id, IModel<?> model)
{
super(id, model);
setOutputMarkupId(true);
@@ -61,6 +61,7 @@
{
private static final long serialVersionUID = 1L;
+ @Override
protected void respond(AjaxRequestTarget target)
{
Component component = getLazyLoadComponent("content");
@@ -68,12 +69,14 @@
target.addComponent(AjaxLazyLoadPanel.this);
}
+ @Override
public void renderHead(IHeaderResponse response)
{
super.renderHead(response);
response.renderOnDomReadyJavascript(getCallbackScript().toString());
}
+ @Override
public boolean isEnabled(Component component)
{
return get("content") == loadingComponent;
Modified: wicket/trunk/wicket-extensions/src/main/java/org/apache/wicket/extensions/ajax/markup/html/IndicatingAjaxButton.java
URL: http://svn.apache.org/viewvc/wicket/trunk/wicket-extensions/src/main/java/org/apache/wicket/extensions/ajax/markup/html/IndicatingAjaxButton.java?rev=672603&r1=672602&r2=672603&view=diff
==============================================================================
--- wicket/trunk/wicket-extensions/src/main/java/org/apache/wicket/extensions/ajax/markup/html/IndicatingAjaxButton.java (original)
+++ wicket/trunk/wicket-extensions/src/main/java/org/apache/wicket/extensions/ajax/markup/html/IndicatingAjaxButton.java Sat Jun 28 22:50:41 2008
@@ -28,7 +28,7 @@
* @author evan
*
*/
-public abstract class IndicatingAjaxButton<T> extends AjaxButton<T> implements IAjaxIndicatorAware
+public abstract class IndicatingAjaxButton extends AjaxButton implements IAjaxIndicatorAware
{
/**
Modified: wicket/trunk/wicket-extensions/src/main/java/org/apache/wicket/extensions/ajax/markup/html/IndicatingAjaxFallbackLink.java
URL: http://svn.apache.org/viewvc/wicket/trunk/wicket-extensions/src/main/java/org/apache/wicket/extensions/ajax/markup/html/IndicatingAjaxFallbackLink.java?rev=672603&r1=672602&r2=672603&view=diff
==============================================================================
--- wicket/trunk/wicket-extensions/src/main/java/org/apache/wicket/extensions/ajax/markup/html/IndicatingAjaxFallbackLink.java (original)
+++ wicket/trunk/wicket-extensions/src/main/java/org/apache/wicket/extensions/ajax/markup/html/IndicatingAjaxFallbackLink.java Sat Jun 28 22:50:41 2008
@@ -24,14 +24,12 @@
* A variant of the {@link AjaxFallbackLink} that displays a busy indicator while the ajax request
* is in progress.
*
- * @param <T>
- *
* @since 1.2
*
* @author Igor Vaynberg (ivaynberg)
*
*/
-public abstract class IndicatingAjaxFallbackLink<T> extends AjaxFallbackLink<T>
+public abstract class IndicatingAjaxFallbackLink extends AjaxFallbackLink
implements
IAjaxIndicatorAware
{
@@ -58,7 +56,7 @@
* @param id
* @param model
*/
- public IndicatingAjaxFallbackLink(String id, IModel<T> model)
+ public IndicatingAjaxFallbackLink(String id, IModel<?> model)
{
super(id, model);
add(indicatorAppender);
Modified: wicket/trunk/wicket-extensions/src/main/java/org/apache/wicket/extensions/ajax/markup/html/IndicatingAjaxLink.java
URL: http://svn.apache.org/viewvc/wicket/trunk/wicket-extensions/src/main/java/org/apache/wicket/extensions/ajax/markup/html/IndicatingAjaxLink.java?rev=672603&r1=672602&r2=672603&view=diff
==============================================================================
--- wicket/trunk/wicket-extensions/src/main/java/org/apache/wicket/extensions/ajax/markup/html/IndicatingAjaxLink.java (original)
+++ wicket/trunk/wicket-extensions/src/main/java/org/apache/wicket/extensions/ajax/markup/html/IndicatingAjaxLink.java Sat Jun 28 22:50:41 2008
@@ -24,8 +24,6 @@
* A variant of the {@link AjaxLink} that displays a busy indicator while the ajax request is in
* progress.
*
- * @param <T>
- *
* @since 1.2
*
* @author Igor Vaynberg (ivaynberg)
@@ -33,9 +31,6 @@
*/
public abstract class IndicatingAjaxLink<T> extends AjaxLink<T> implements IAjaxIndicatorAware
{
- /**
- *
- */
private static final long serialVersionUID = 1L;
private final WicketAjaxIndicatorAppender indicatorAppender = new WicketAjaxIndicatorAppender();
Modified: wicket/trunk/wicket-extensions/src/main/java/org/apache/wicket/extensions/ajax/markup/html/IndicatingAjaxSubmitButton.java
URL: http://svn.apache.org/viewvc/wicket/trunk/wicket-extensions/src/main/java/org/apache/wicket/extensions/ajax/markup/html/IndicatingAjaxSubmitButton.java?rev=672603&r1=672602&r2=672603&view=diff
==============================================================================
--- wicket/trunk/wicket-extensions/src/main/java/org/apache/wicket/extensions/ajax/markup/html/IndicatingAjaxSubmitButton.java (original)
+++ wicket/trunk/wicket-extensions/src/main/java/org/apache/wicket/extensions/ajax/markup/html/IndicatingAjaxSubmitButton.java Sat Jun 28 22:50:41 2008
@@ -23,18 +23,12 @@
* A variant of the {@link AjaxSubmitButton} that displays a busy indicator while the ajax request
* is in progress.
*
- * @param <T>
- *
* @author evan
* @deprecated Use {@link IndicatingAjaxButton} instead.
*/
@Deprecated
-public abstract class IndicatingAjaxSubmitButton<T> extends IndicatingAjaxButton<T>
+public abstract class IndicatingAjaxSubmitButton extends IndicatingAjaxButton
{
-
- /**
- *
- */
private static final long serialVersionUID = 1L;
/**
@@ -42,7 +36,7 @@
* @param id
* @param form
*/
- public IndicatingAjaxSubmitButton(String id, Form< ? > form)
+ public IndicatingAjaxSubmitButton(String id, Form<?> form)
{
super(id, form);
}
Modified: wicket/trunk/wicket-extensions/src/main/java/org/apache/wicket/extensions/ajax/markup/html/WicketAjaxIndicatorAppender.java
URL: http://svn.apache.org/viewvc/wicket/trunk/wicket-extensions/src/main/java/org/apache/wicket/extensions/ajax/markup/html/WicketAjaxIndicatorAppender.java?rev=672603&r1=672602&r2=672603&view=diff
==============================================================================
--- wicket/trunk/wicket-extensions/src/main/java/org/apache/wicket/extensions/ajax/markup/html/WicketAjaxIndicatorAppender.java (original)
+++ wicket/trunk/wicket-extensions/src/main/java/org/apache/wicket/extensions/ajax/markup/html/WicketAjaxIndicatorAppender.java Sat Jun 28 22:50:41 2008
@@ -45,7 +45,7 @@
/**
* Component instance this behavior is bound to
*/
- private Component< ? > component;
+ private Component component;
/**
*
@@ -81,7 +81,7 @@
* @see org.apache.wicket.behavior.AbstractBehavior#onRendered(org.apache.wicket.Component)
*/
@Override
- public void onRendered(Component< ? > component)
+ public void onRendered(Component component)
{
final Response r = component.getResponse();
@@ -127,7 +127,7 @@
* @see org.apache.wicket.behavior.AbstractBehavior#bind(org.apache.wicket.Component)
*/
@Override
- public final void bind(Component< ? > component)
+ public final void bind(Component component)
{
this.component = component;
}
Modified: wicket/trunk/wicket-extensions/src/main/java/org/apache/wicket/extensions/ajax/markup/html/autocomplete/AbstractAutoCompleteTextRenderer.java
URL: http://svn.apache.org/viewvc/wicket/trunk/wicket-extensions/src/main/java/org/apache/wicket/extensions/ajax/markup/html/autocomplete/AbstractAutoCompleteTextRenderer.java?rev=672603&r1=672602&r2=672603&view=diff
==============================================================================
--- wicket/trunk/wicket-extensions/src/main/java/org/apache/wicket/extensions/ajax/markup/html/autocomplete/AbstractAutoCompleteTextRenderer.java (original)
+++ wicket/trunk/wicket-extensions/src/main/java/org/apache/wicket/extensions/ajax/markup/html/autocomplete/AbstractAutoCompleteTextRenderer.java Sat Jun 28 22:50:41 2008
@@ -24,18 +24,17 @@
* @since 1.2
*
* @author Igor Vaynberg (ivaynberg)
+ * @param <T>
*
*/
public abstract class AbstractAutoCompleteTextRenderer<T> extends AbstractAutoCompleteRenderer<T>
{
- /**
- *
- */
private static final long serialVersionUID = 1L;
/**
* @see AbstractAutoCompleteRenderer#renderChoice(Object, Response, String)
*/
+ @Override
protected void renderChoice(T object, Response response, String criteria)
{
response.write(getTextValue(object));
Modified: wicket/trunk/wicket-extensions/src/main/java/org/apache/wicket/extensions/ajax/markup/html/form/upload/UploadProgressBar.java
URL: http://svn.apache.org/viewvc/wicket/trunk/wicket-extensions/src/main/java/org/apache/wicket/extensions/ajax/markup/html/form/upload/UploadProgressBar.java?rev=672603&r1=672602&r2=672603&view=diff
==============================================================================
--- wicket/trunk/wicket-extensions/src/main/java/org/apache/wicket/extensions/ajax/markup/html/form/upload/UploadProgressBar.java (original)
+++ wicket/trunk/wicket-extensions/src/main/java/org/apache/wicket/extensions/ajax/markup/html/form/upload/UploadProgressBar.java Sat Jun 28 22:50:41 2008
@@ -37,7 +37,7 @@
*
* @author Andrew Lombardi
*/
-public class UploadProgressBar extends Panel<Void>
+public class UploadProgressBar extends Panel
{
private static final Logger log = LoggerFactory.getLogger(UploadProgressBar.class);
@@ -93,11 +93,11 @@
add(HeaderContributor.forCss(css));
}
- final WebMarkupContainer<Void> barDiv = new WebMarkupContainer<Void>("bar");
+ final WebMarkupContainer barDiv = new WebMarkupContainer("bar");
barDiv.setOutputMarkupId(true);
add(barDiv);
- final WebMarkupContainer<Void> statusDiv = new WebMarkupContainer<Void>("status");
+ final WebMarkupContainer statusDiv = new WebMarkupContainer("status");
statusDiv.setOutputMarkupId(true);
add(statusDiv);
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=672603&r1=672602&r2=672603&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 28 22:50:41 2008
@@ -46,95 +46,84 @@
/**
* 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
- * <span> tag, make sure you use a <div>.
+ * If you want this to work under IE, don't attach this component to a <span> tag, make sure
+ * you use a <div>.
* <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<T> extends Panel<T>
+public class ModalWindow extends Panel
{
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
*/
@@ -146,13 +135,13 @@
/**
* Creates a new modal window component.
- *
+ *
* @param id
* Id of component
* @param model
* Model
*/
- public ModalWindow(String id, IModel<T> model)
+ public ModalWindow(String id, IModel<?> model)
{
super(id, model);
init();
@@ -162,7 +151,7 @@
{
setVersioned(false);
cookieName = null;
- add(empty = new WebMarkupContainer<Void>(getContentId()));
+ add(empty = new WebMarkupContainer(getContentId()));
add(new CloseButtonBehavior());
add(new WindowClosedBehavior());
@@ -171,72 +160,66 @@
}
/**
- * 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()
@@ -245,10 +228,9 @@
}
/**
- * 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
*/
@@ -259,7 +241,7 @@
/**
* Returns the page map name.
- *
+ *
* @return The page map name.
*/
public String getPageMapName()
@@ -268,9 +250,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
*/
@@ -281,7 +263,7 @@
/**
* Sets the <code>{@link CloseButtonCallback}</code> instance.
- *
+ *
* @param callback
* Callback instance
*/
@@ -292,7 +274,7 @@
/**
* Sets the <code>@{link {@link WindowClosedCallback}</code> instance.
- *
+ *
* @param callback
* Callback instance
*/
@@ -303,7 +285,7 @@
/**
* Shows the modal window.
- *
+ *
* @param target
* Request target associated with current ajax request.
*/
@@ -319,10 +301,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.
*/
@@ -333,7 +315,7 @@
/**
* Closes the modal window.
- *
+ *
* @param target
* Request target associated with current ajax request.
*/
@@ -350,25 +332,29 @@
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, "window");
* new MyPanel(window, window.getContentId());
* </pre>
- *
+ *
* @return Id of content component.
*/
public String getContentId()
@@ -377,10 +363,9 @@
}
/**
- * 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.
*/
@@ -391,7 +376,7 @@
/**
* Returns the minimal width of window (in pixels).
- *
+ *
* @return Minimal width of window
*/
public int getMinimalWidth()
@@ -400,10 +385,9 @@
}
/**
- * 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
*/
@@ -414,7 +398,7 @@
/**
* Returns the minimal height of window (in pixels).
- *
+ *
* @return Minimal height of window
*/
public int getMinimalHeight()
@@ -433,11 +417,10 @@
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)
@@ -447,7 +430,7 @@
/**
* Returns the CSS class name for this window.
- *
+ *
* @return CSS class name
*/
public String getCssClassName()
@@ -456,13 +439,12 @@
}
/**
- * 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
*/
@@ -473,7 +455,7 @@
/**
* Returns the initial width of the window.
- *
+ *
* @return Initial height of the window
*/
public int getInitialWidth()
@@ -482,13 +464,12 @@
}
/**
- * 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
*/
@@ -499,7 +480,7 @@
/**
* Returns the initial height of the window.
- *
+ *
* @return Initial height of the window
*/
public int getInitialHeight()
@@ -508,13 +489,12 @@
}
/**
- * 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)
{
@@ -522,12 +502,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()
{
@@ -536,7 +516,7 @@
/**
* Sets whether the user will be able to resize the window.
- *
+ *
* @param resizable
* Whether the window is resizable
*/
@@ -547,7 +527,7 @@
/**
* Returns whether the window is resizable.
- *
+ *
* @return True if the window is resizable, false otherwise
*/
public boolean isResizable()
@@ -556,9 +536,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.
*/
@@ -569,7 +549,7 @@
/**
* Returns the CSS unit for initial window width.
- *
+ *
* @return CSS unit for initial window width.
*/
public String getWidthUnit()
@@ -578,9 +558,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.
*/
@@ -591,7 +571,7 @@
/**
* Retrns the CSS unit for initial window height.
- *
+ *
* @return CSS unit for initial window height.
*/
public String getHeightUnit()
@@ -600,9 +580,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
*/
@@ -616,9 +596,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()
@@ -627,10 +607,9 @@
}
/**
- * 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
*/
@@ -640,10 +619,9 @@
}
/**
- * 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
*/
@@ -655,7 +633,7 @@
/**
* Returns the title of the window.
- *
+ *
* @return Title of the window
*/
public IModel<String> getTitle()
@@ -664,14 +642,13 @@
}
/**
- * 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
@@ -691,7 +668,7 @@
/**
* Constructor.
- *
+ *
* @param name
*/
public MaskType(String name)
@@ -702,7 +679,7 @@
/**
* Sets the mask type of the window.
- *
+ *
* @param mask
* The mask type
*/
@@ -713,7 +690,7 @@
/**
* Returns the mask type of the window
- *
+ *
* @return The mask type
*/
public MaskType getMaskType()
@@ -723,10 +700,10 @@
/**
* Creates the page.
- *
+ *
* @return Page instance or null if page couldn't be created.
*/
- private Page<?> createPage()
+ private Page createPage()
{
if (pageCreator == null)
{
@@ -751,7 +728,7 @@
}
try
{
- Page<?> page = pageCreator.createPage();
+ Page page = pageCreator.createPage();
return page;
}
finally
@@ -768,7 +745,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;
}
@@ -790,21 +767,20 @@
}
/**
- * 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()
{
@@ -815,21 +791,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<Void>(getContentId()));
+ add(empty = new WebMarkupContainer(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)
{
@@ -891,7 +867,8 @@
@Override
protected void respond(AjaxRequestTarget target)
{
- if (closeButtonCallback == null || closeButtonCallback.onCloseButtonClicked(target) == true)
+ if (closeButtonCallback == null ||
+ closeButtonCallback.onCloseButtonClicked(target) == true)
{
close(target);
}
@@ -918,7 +895,7 @@
/**
* Returns the markup id of the component.
- *
+ *
* @return component id
*/
private String getContentMarkupId()
@@ -928,10 +905,10 @@
/**
* Replaces all occurrences of " in string with \".
- *
+ *
* @param string
* String to be escaped.
- *
+ *
* @return escaped string
*/
private String escapeQuotes(String string)
@@ -945,7 +922,7 @@
/**
* Returns the javascript used to open the window.
- *
+ *
* @return javascript that opens the window
*/
private String getWindowOpenJavascript()
@@ -954,7 +931,8 @@
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");
@@ -978,7 +956,7 @@
if (isCustomComponent() == false)
{
- Page<?> page = createPage();
+ Page page = createPage();
if (page == null)
{
throw new WicketRuntimeException("Error creating page for modal dialog.");
@@ -1024,8 +1002,10 @@
// 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;
}
@@ -1035,8 +1015,10 @@
// 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);
@@ -1048,7 +1030,7 @@
/**
* Method that allows tweaking the settings
- *
+ *
* @param settings
* @return settings javascript
*/
@@ -1061,7 +1043,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;
Modified: wicket/trunk/wicket-extensions/src/main/java/org/apache/wicket/extensions/ajax/markup/html/repeater/data/sort/AjaxFallbackOrderByBorder.java
URL: http://svn.apache.org/viewvc/wicket/trunk/wicket-extensions/src/main/java/org/apache/wicket/extensions/ajax/markup/html/repeater/data/sort/AjaxFallbackOrderByBorder.java?rev=672603&r1=672602&r2=672603&view=diff
==============================================================================
--- wicket/trunk/wicket-extensions/src/main/java/org/apache/wicket/extensions/ajax/markup/html/repeater/data/sort/AjaxFallbackOrderByBorder.java (original)
+++ wicket/trunk/wicket-extensions/src/main/java/org/apache/wicket/extensions/ajax/markup/html/repeater/data/sort/AjaxFallbackOrderByBorder.java Sat Jun 28 22:50:41 2008
@@ -33,7 +33,7 @@
* @author Igor Vaynberg (ivaynberg)
*
*/
-public abstract class AjaxFallbackOrderByBorder extends Border<Void>
+public abstract class AjaxFallbackOrderByBorder extends Border
{
private static final long serialVersionUID = 1L;
Modified: wicket/trunk/wicket-extensions/src/main/java/org/apache/wicket/extensions/ajax/markup/html/repeater/data/table/AjaxFallbackDefaultDataTable.java
URL: http://svn.apache.org/viewvc/wicket/trunk/wicket-extensions/src/main/java/org/apache/wicket/extensions/ajax/markup/html/repeater/data/table/AjaxFallbackDefaultDataTable.java?rev=672603&r1=672602&r2=672603&view=diff
==============================================================================
--- wicket/trunk/wicket-extensions/src/main/java/org/apache/wicket/extensions/ajax/markup/html/repeater/data/table/AjaxFallbackDefaultDataTable.java (original)
+++ wicket/trunk/wicket-extensions/src/main/java/org/apache/wicket/extensions/ajax/markup/html/repeater/data/table/AjaxFallbackDefaultDataTable.java Sat Jun 28 22:50:41 2008
@@ -63,6 +63,7 @@
* @param rowsPerPage
* number of rows per page
*/
+ @SuppressWarnings("unchecked")
public AjaxFallbackDefaultDataTable(String id, final List<IColumn<?>> columns,
ISortableDataProvider<T> dataProvider, int rowsPerPage)
{
@@ -81,7 +82,7 @@
* @param rowsPerPage
* number of rows per page
*/
- public AjaxFallbackDefaultDataTable(String id, final IColumn<?>[] columns,
+ public AjaxFallbackDefaultDataTable(String id, final IColumn<T>[] columns,
ISortableDataProvider<T> dataProvider, int rowsPerPage)
{
super(id, columns, dataProvider, rowsPerPage);
Modified: wicket/trunk/wicket-extensions/src/main/java/org/apache/wicket/extensions/ajax/markup/html/repeater/data/table/AjaxFallbackHeadersToolbar.java
URL: http://svn.apache.org/viewvc/wicket/trunk/wicket-extensions/src/main/java/org/apache/wicket/extensions/ajax/markup/html/repeater/data/table/AjaxFallbackHeadersToolbar.java?rev=672603&r1=672602&r2=672603&view=diff
==============================================================================
--- wicket/trunk/wicket-extensions/src/main/java/org/apache/wicket/extensions/ajax/markup/html/repeater/data/table/AjaxFallbackHeadersToolbar.java (original)
+++ wicket/trunk/wicket-extensions/src/main/java/org/apache/wicket/extensions/ajax/markup/html/repeater/data/table/AjaxFallbackHeadersToolbar.java Sat Jun 28 22:50:41 2008
@@ -56,7 +56,7 @@
* org.apache.wicket.extensions.markup.html.repeater.data.sort.ISortStateLocator)
*/
@Override
- protected WebMarkupContainer<?> newSortableHeader(String borderId, String property,
+ protected WebMarkupContainer newSortableHeader(String borderId, String property,
ISortStateLocator locator)
{
return new AjaxFallbackOrderByBorder(borderId, property, locator, getAjaxCallDecorator())
Modified: wicket/trunk/wicket-extensions/src/main/java/org/apache/wicket/extensions/ajax/markup/html/tabs/AjaxTabbedPanel.java
URL: http://svn.apache.org/viewvc/wicket/trunk/wicket-extensions/src/main/java/org/apache/wicket/extensions/ajax/markup/html/tabs/AjaxTabbedPanel.java?rev=672603&r1=672602&r2=672603&view=diff
==============================================================================
--- wicket/trunk/wicket-extensions/src/main/java/org/apache/wicket/extensions/ajax/markup/html/tabs/AjaxTabbedPanel.java (original)
+++ wicket/trunk/wicket-extensions/src/main/java/org/apache/wicket/extensions/ajax/markup/html/tabs/AjaxTabbedPanel.java Sat Jun 28 22:50:41 2008
@@ -51,9 +51,9 @@
}
@Override
- protected <S> WebMarkupContainer<S> newLink(String linkId, final int index)
+ protected WebMarkupContainer newLink(String linkId, final int index)
{
- return new AjaxFallbackLink<S>(linkId)
+ return new AjaxFallbackLink(linkId)
{
private static final long serialVersionUID = 1L;
Modified: wicket/trunk/wicket-extensions/src/main/java/org/apache/wicket/extensions/breadcrumb/BreadCrumbBar.java
URL: http://svn.apache.org/viewvc/wicket/trunk/wicket-extensions/src/main/java/org/apache/wicket/extensions/breadcrumb/BreadCrumbBar.java?rev=672603&r1=672602&r2=672603&view=diff
==============================================================================
--- wicket/trunk/wicket-extensions/src/main/java/org/apache/wicket/extensions/breadcrumb/BreadCrumbBar.java (original)
+++ wicket/trunk/wicket-extensions/src/main/java/org/apache/wicket/extensions/breadcrumb/BreadCrumbBar.java Sat Jun 28 22:50:41 2008
@@ -110,7 +110,7 @@
{
super(id);
setReuseItems(false);
- setModel(new LoadableDetachableModel()
+ setDefaultModel(new LoadableDetachableModel()
{
private static final long serialVersionUID = 1L;
@@ -156,7 +156,7 @@
// else let the listview recalculate it's children immediately;
// it was attached, but it needs to go through that again now
// as the signaling component attached after this
- getModel().detach();
+ getDefaultModel().detach();
super.internalOnAttach();
}
@@ -178,7 +178,7 @@
protected void populateItem(ListItem item)
{
int index = item.getIndex();
- IBreadCrumbParticipant breadCrumbParticipant = (IBreadCrumbParticipant)item.getModelObject();
+ IBreadCrumbParticipant breadCrumbParticipant = (IBreadCrumbParticipant)item.getDefaultModelObject();
item.add(newBreadCrumbComponent("crumb", index, size, breadCrumbParticipant));
}
}
Modified: wicket/trunk/wicket-extensions/src/main/java/org/apache/wicket/extensions/breadcrumb/panel/BreadCrumbPanel.java
URL: http://svn.apache.org/viewvc/wicket/trunk/wicket-extensions/src/main/java/org/apache/wicket/extensions/breadcrumb/panel/BreadCrumbPanel.java?rev=672603&r1=672602&r2=672603&view=diff
==============================================================================
--- wicket/trunk/wicket-extensions/src/main/java/org/apache/wicket/extensions/breadcrumb/panel/BreadCrumbPanel.java (original)
+++ wicket/trunk/wicket-extensions/src/main/java/org/apache/wicket/extensions/breadcrumb/panel/BreadCrumbPanel.java Sat Jun 28 22:50:41 2008
@@ -97,7 +97,7 @@
* @param model
* The model
*/
- public BreadCrumbPanel(String id, IBreadCrumbModel breadCrumbModel, IModel model)
+ public BreadCrumbPanel(String id, IBreadCrumbModel breadCrumbModel, IModel<?> model)
{
super(id, model);
this.breadCrumbModel = breadCrumbModel;
@@ -139,6 +139,7 @@
{
private static final long serialVersionUID = 1L;
+ @Override
public void undo()
{
breadCrumbModel.setActive(active);
Modified: wicket/trunk/wicket-extensions/src/main/java/org/apache/wicket/extensions/breadcrumb/panel/BreadCrumbPanelFactory.java
URL: http://svn.apache.org/viewvc/wicket/trunk/wicket-extensions/src/main/java/org/apache/wicket/extensions/breadcrumb/panel/BreadCrumbPanelFactory.java?rev=672603&r1=672602&r2=672603&view=diff
==============================================================================
--- wicket/trunk/wicket-extensions/src/main/java/org/apache/wicket/extensions/breadcrumb/panel/BreadCrumbPanelFactory.java (original)
+++ wicket/trunk/wicket-extensions/src/main/java/org/apache/wicket/extensions/breadcrumb/panel/BreadCrumbPanelFactory.java Sat Jun 28 22:50:41 2008
@@ -32,7 +32,7 @@
private static final long serialVersionUID = 1L;
/** Class to construct. */
- private Class panelClass;
+ private final Class<? extends BreadCrumbPanel> panelClass;
/**
* Construct.
@@ -42,7 +42,7 @@
* and must have constructor
* {@link BreadCrumbPanel#BreadCrumbPanel(String, IBreadCrumbModel)}
*/
- public BreadCrumbPanelFactory(final Class panelClass)
+ public BreadCrumbPanelFactory(final Class<? extends BreadCrumbPanel> panelClass)
{
if (panelClass == null)
{
@@ -52,7 +52,7 @@
if (!BreadCrumbPanel.class.isAssignableFrom(panelClass))
{
throw new IllegalArgumentException("argument panelClass (" + panelClass +
- ") must extend class " + BreadCrumbPanel.class.getName());
+ ") must extend class " + BreadCrumbPanel.class.getName());
}
@@ -68,10 +68,10 @@
*/
public final BreadCrumbPanel create(String componentId, IBreadCrumbModel breadCrumbModel)
{
- Constructor ctor = getConstructor();
+ Constructor<? extends BreadCrumbPanel> ctor = getConstructor();
try
{
- return (BreadCrumbPanel)ctor.newInstance(new Object[] { componentId, breadCrumbModel });
+ return ctor.newInstance(new Object[] { componentId, breadCrumbModel });
}
catch (Exception e)
{
@@ -84,12 +84,12 @@
*
* @return The constructor.
*/
- private final Constructor getConstructor()
+ private final Constructor<? extends BreadCrumbPanel> getConstructor()
{
try
{
- Constructor ctor = panelClass.getConstructor(new Class[] { String.class,
- IBreadCrumbModel.class });
+ Constructor<? extends BreadCrumbPanel> ctor = panelClass.getConstructor(new Class[] {
+ String.class, IBreadCrumbModel.class });
return ctor;
}
catch (SecurityException e)
Modified: wicket/trunk/wicket-extensions/src/main/java/org/apache/wicket/extensions/breadcrumb/panel/BreadCrumbPanelLink.java
URL: http://svn.apache.org/viewvc/wicket/trunk/wicket-extensions/src/main/java/org/apache/wicket/extensions/breadcrumb/panel/BreadCrumbPanelLink.java?rev=672603&r1=672602&r2=672603&view=diff
==============================================================================
--- wicket/trunk/wicket-extensions/src/main/java/org/apache/wicket/extensions/breadcrumb/panel/BreadCrumbPanelLink.java (original)
+++ wicket/trunk/wicket-extensions/src/main/java/org/apache/wicket/extensions/breadcrumb/panel/BreadCrumbPanelLink.java Sat Jun 28 22:50:41 2008
@@ -42,14 +42,15 @@
* @param id
* The component id
* @param caller
- * The calling panel which will be used to get the
- * {@link IBreadCrumbModel bread crumb model} from.
+ * The calling panel which will be used to get the {@link IBreadCrumbModel bread
+ * crumb model} from.
* @param panelClass
* The class to use for creating instances. Must be of type {@link BreadCrumbPanel},
* and must have constructor
* {@link BreadCrumbPanel#BreadCrumbPanel(String, IBreadCrumbModel)}
*/
- public BreadCrumbPanelLink(final String id, final BreadCrumbPanel caller, final Class panelClass)
+ public BreadCrumbPanelLink(final String id, final BreadCrumbPanel caller,
+ final Class<? extends BreadCrumbPanel> panelClass)
{
this(id, caller.getBreadCrumbModel(), new BreadCrumbPanelFactory(panelClass));
}
@@ -67,7 +68,7 @@
* {@link BreadCrumbPanel#BreadCrumbPanel(String, IBreadCrumbModel)}
*/
public BreadCrumbPanelLink(final String id, final IBreadCrumbModel breadCrumbModel,
- final Class panelClass)
+ final Class<BreadCrumbPanel> panelClass)
{
this(id, breadCrumbModel, new BreadCrumbPanelFactory(panelClass));
}
@@ -83,7 +84,7 @@
* The factory to create bread crumb panels
*/
public BreadCrumbPanelLink(final String id, final IBreadCrumbModel breadCrumbModel,
- final IBreadCrumbPanelFactory breadCrumbPanelFactory)
+ final IBreadCrumbPanelFactory breadCrumbPanelFactory)
{
super(id, breadCrumbModel);
@@ -105,6 +106,7 @@
*
* @see org.apache.wicket.extensions.breadcrumb.BreadCrumbLink#getParticipant(java.lang.String)
*/
+ @Override
protected final IBreadCrumbParticipant getParticipant(String componentId)
{
return breadCrumbPanelFactory.create(componentId, breadCrumbModel);
Modified: wicket/trunk/wicket-extensions/src/main/java/org/apache/wicket/extensions/breadcrumb/panel/BreadCrumbParticipantDelegate.java
URL: http://svn.apache.org/viewvc/wicket/trunk/wicket-extensions/src/main/java/org/apache/wicket/extensions/breadcrumb/panel/BreadCrumbParticipantDelegate.java?rev=672603&r1=672602&r2=672603&view=diff
==============================================================================
--- wicket/trunk/wicket-extensions/src/main/java/org/apache/wicket/extensions/breadcrumb/panel/BreadCrumbParticipantDelegate.java (original)
+++ wicket/trunk/wicket-extensions/src/main/java/org/apache/wicket/extensions/breadcrumb/panel/BreadCrumbParticipantDelegate.java Sat Jun 28 22:50:41 2008
@@ -1,124 +1,125 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You 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 org.apache.wicket.extensions.breadcrumb.panel;
-
-import org.apache.wicket.Component;
-import org.apache.wicket.MarkupContainer;
-import org.apache.wicket.Component.IVisitor;
-import org.apache.wicket.extensions.breadcrumb.IBreadCrumbParticipant;
-import org.apache.wicket.markup.html.panel.Panel;
-
-/**
- * Base implementation for {@link Panel}/ {@link Component} based {@link IBreadCrumbParticipant}
- * that decouples the implementation from the actual panel class.
- *
- * @author eelcohillenius
- */
-public abstract class BreadCrumbParticipantDelegate implements IBreadCrumbParticipant
-{
- private static final long serialVersionUID = 1L;
-
- private final Component component;
-
- /**
- * Construct.
- *
- * @param component
- */
- public BreadCrumbParticipantDelegate(Component component)
- {
- if (component == null)
- {
- throw new IllegalArgumentException("component must be not null");
- }
- this.component = component;
- }
-
- /**
- * @see org.apache.wicket.extensions.breadcrumb.IBreadCrumbParticipant#getComponent()
- */
- public Component getComponent()
- {
- return component;
- }
-
- /**
- * If the previous participant is not null (and a component, which it should be), replace that
- * component on it's parent with this one.
- *
- * @see org.apache.wicket.extensions.breadcrumb.IBreadCrumbParticipant#onActivate(org.apache.wicket.extensions.breadcrumb.IBreadCrumbParticipant)
- */
- public void onActivate(IBreadCrumbParticipant previous)
- {
- if (previous != null)
- {
- MarkupContainer parent = previous.getComponent().getParent();
- if (parent != null)
- {
- final String thisId = component.getId();
- if (parent.get(thisId) != null)
- {
- parent.replace(component);
- }
- else
- {
- // try to search downwards to match the id
- // NOTE unfortunately, we can't rely on the path pre 2.0
- Component c = (Component)parent.visitChildren(new IVisitor()
- {
- public Object component(Component component)
- {
- if (component.getId().equals(thisId))
- {
- return component;
- }
- return IVisitor.CONTINUE_TRAVERSAL;
- }
- });
- if (c == null)
- {
- // not found... do a reverse search (upwards)
- c = (Component)parent.visitParents(Component.class, new IVisitor()
- {
- public Object component(Component component)
- {
- if (component.getId().equals(thisId))
- {
- return component;
- }
- return IVisitor.CONTINUE_TRAVERSAL;
- }
- });
- }
-
- // replace if found
- if (c != null)
- {
- c.replaceWith(component);
- }
- }
- }
- }
- else if (component.getParent() != null)
- {
- component.getParent().replace(component);
- }
- }
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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 org.apache.wicket.extensions.breadcrumb.panel;
+
+import org.apache.wicket.Component;
+import org.apache.wicket.MarkupContainer;
+import org.apache.wicket.Component.IVisitor;
+import org.apache.wicket.extensions.breadcrumb.IBreadCrumbParticipant;
+import org.apache.wicket.markup.html.panel.Panel;
+
+/**
+ * Base implementation for {@link Panel}/ {@link Component} based {@link IBreadCrumbParticipant}
+ * that decouples the implementation from the actual panel class.
+ *
+ * @author eelcohillenius
+ */
+public abstract class BreadCrumbParticipantDelegate implements IBreadCrumbParticipant
+{
+ private static final long serialVersionUID = 1L;
+
+ private final Component component;
+
+ /**
+ * Construct.
+ *
+ * @param component
+ */
+ public BreadCrumbParticipantDelegate(Component component)
+ {
+ if (component == null)
+ {
+ throw new IllegalArgumentException("component must be not null");
+ }
+ this.component = component;
+ }
+
+ /**
+ * @see org.apache.wicket.extensions.breadcrumb.IBreadCrumbParticipant#getComponent()
+ */
+ public Component getComponent()
+ {
+ return component;
+ }
+
+ /**
+ * If the previous participant is not null (and a component, which it should be), replace that
+ * component on it's parent with this one.
+ *
+ * @see org.apache.wicket.extensions.breadcrumb.IBreadCrumbParticipant#onActivate(org.apache.wicket.extensions.breadcrumb.IBreadCrumbParticipant)
+ */
+ public void onActivate(IBreadCrumbParticipant previous)
+ {
+ if (previous != null)
+ {
+ MarkupContainer parent = previous.getComponent().getParent();
+ if (parent != null)
+ {
+ final String thisId = component.getId();
+ if (parent.get(thisId) != null)
+ {
+ parent.replace(component);
+ }
+ else
+ {
+ // try to search downwards to match the id
+ // NOTE unfortunately, we can't rely on the path pre 2.0
+ Component c = (Component)parent.visitChildren(new IVisitor<Component>()
+ {
+ public Object component(Component component)
+ {
+ if (component.getId().equals(thisId))
+ {
+ return component;
+ }
+ return IVisitor.CONTINUE_TRAVERSAL;
+ }
+ });
+ if (c == null)
+ {
+ // not found... do a reverse search (upwards)
+ c = (Component)parent.visitParents(Component.class,
+ new IVisitor<Component>()
+ {
+ public Object component(Component component)
+ {
+ if (component.getId().equals(thisId))
+ {
+ return component;
+ }
+ return IVisitor.CONTINUE_TRAVERSAL;
+ }
+ });
+ }
+
+ // replace if found
+ if (c != null)
+ {
+ c.replaceWith(component);
+ }
+ }
+ }
+ }
+ else if (component.getParent() != null)
+ {
+ component.getParent().replace(component);
+ }
+ }
+}
Modified: wicket/trunk/wicket-extensions/src/main/java/org/apache/wicket/extensions/markup/html/basic/SmartLinkLabel.java
URL: http://svn.apache.org/viewvc/wicket/trunk/wicket-extensions/src/main/java/org/apache/wicket/extensions/markup/html/basic/SmartLinkLabel.java?rev=672603&r1=672602&r2=672603&view=diff
==============================================================================
--- wicket/trunk/wicket-extensions/src/main/java/org/apache/wicket/extensions/markup/html/basic/SmartLinkLabel.java (original)
+++ wicket/trunk/wicket-extensions/src/main/java/org/apache/wicket/extensions/markup/html/basic/SmartLinkLabel.java Sat Jun 28 22:50:41 2008
@@ -36,7 +36,7 @@
*
* @author Juergen Donnerstag
*/
-public class SmartLinkLabel<T> extends Label<T>
+public class SmartLinkLabel extends Label
{
private static final long serialVersionUID = 1L;
@@ -52,7 +52,7 @@
/**
* @see Label#Label(String, IModel)
*/
- public SmartLinkLabel(String name, IModel<T> model)
+ public SmartLinkLabel(String name, IModel<?> model)
{
super(name, model);
}
@@ -67,12 +67,13 @@
/**
* @see org.apache.wicket.Component#onComponentTagBody(org.apache.wicket.markup.MarkupStream,
- * org.apache.wicket.markup.ComponentTag)
+ * org.apache.wicket.markup.ComponentTag)
*/
@Override
protected void onComponentTagBody(final MarkupStream markupStream, final ComponentTag openTag)
{
- replaceComponentTagBody(markupStream, openTag, getSmartLink(getModelObjectAsString()));
+ replaceComponentTagBody(markupStream, openTag,
+ getSmartLink(getDefaultModelObjectAsString()));
}
protected ILinkParser getLinkParser()
@@ -84,7 +85,7 @@
* Replace all email and URL addresses
*
* @param text
- * Text to be modified
+ * Text to be modified
* @return Modified Text
*/
protected final CharSequence getSmartLink(final CharSequence text)
Modified: wicket/trunk/wicket-extensions/src/main/java/org/apache/wicket/extensions/markup/html/basic/SmartLinkMultiLineLabel.java
URL: http://svn.apache.org/viewvc/wicket/trunk/wicket-extensions/src/main/java/org/apache/wicket/extensions/markup/html/basic/SmartLinkMultiLineLabel.java?rev=672603&r1=672602&r2=672603&view=diff
==============================================================================
--- wicket/trunk/wicket-extensions/src/main/java/org/apache/wicket/extensions/markup/html/basic/SmartLinkMultiLineLabel.java (original)
+++ wicket/trunk/wicket-extensions/src/main/java/org/apache/wicket/extensions/markup/html/basic/SmartLinkMultiLineLabel.java Sat Jun 28 22:50:41 2008
@@ -36,7 +36,7 @@
*
* @author Juergen Donnerstag
*/
-public final class SmartLinkMultiLineLabel<T> extends MultiLineLabel<T>
+public final class SmartLinkMultiLineLabel extends MultiLineLabel
{
private static final long serialVersionUID = 1L;
@@ -52,19 +52,19 @@
/**
* @see MultiLineLabel#MultiLineLabel(String, IModel)
*/
- public SmartLinkMultiLineLabel(String name, IModel<T> model)
+ public SmartLinkMultiLineLabel(String name, IModel<?> model)
{
super(name, model);
}
/**
* @see org.apache.wicket.Component#onComponentTagBody(org.apache.wicket.markup.MarkupStream,
- * org.apache.wicket.markup.ComponentTag)
+ * org.apache.wicket.markup.ComponentTag)
*/
@Override
protected void onComponentTagBody(final MarkupStream markupStream, final ComponentTag openTag)
{
- final CharSequence body = Strings.toMultilineMarkup(getModelObjectAsString());
+ final CharSequence body = Strings.toMultilineMarkup(getDefaultModelObjectAsString());
replaceComponentTagBody(markupStream, openTag, getSmartLink(body));
}
Modified: wicket/trunk/wicket-extensions/src/main/java/org/apache/wicket/extensions/markup/html/form/palette/Palette.java
URL: http://svn.apache.org/viewvc/wicket/trunk/wicket-extensions/src/main/java/org/apache/wicket/extensions/markup/html/form/palette/Palette.java?rev=672603&r1=672602&r2=672603&view=diff
==============================================================================
--- wicket/trunk/wicket-extensions/src/main/java/org/apache/wicket/extensions/markup/html/form/palette/Palette.java (original)
+++ wicket/trunk/wicket-extensions/src/main/java/org/apache/wicket/extensions/markup/html/form/palette/Palette.java Sat Jun 28 22:50:41 2008
@@ -73,7 +73,7 @@
* Type of model object
*
*/
-public class Palette<T> extends Panel<List<T>> implements IHeaderContributor
+public class Palette<T> extends Panel implements IHeaderContributor
{
private static final String SELECTED_HEADER_ID = "selectedHeader";
@@ -98,7 +98,7 @@
/**
* recorder component used to track user's selection. it is updated by javascript on changes.
*/
- private Recorder recorderComponent;
+ private Recorder<T> recorderComponent;
/**
* component used to represent all available choices. by default this is a select box with
@@ -251,7 +251,7 @@
/**
* @return iterator over selected choices
*/
- public Iterator getSelectedChoices()
+ public Iterator<T> getSelectedChoices()
{
return getRecorderComponent().getSelectedChoices();
}
@@ -259,7 +259,7 @@
/**
* @return iterator over unselected choices
*/
- public Iterator getUnselectedChoices()
+ public Iterator<T> getUnselectedChoices()
{
return getRecorderComponent().getUnselectedChoices();
}
@@ -270,10 +270,10 @@
*
* @return tracker component
*/
- protected Recorder newRecorderComponent()
+ protected Recorder<T> newRecorderComponent()
{
// create component that will keep track of selections
- return new Recorder("recorder", this)
+ return new Recorder<T>("recorder", this)
{
private static final long serialVersionUID = 1L;
@@ -464,7 +464,7 @@
*
* @return recorder component
*/
- public final Recorder getRecorderComponent()
+ public final Recorder<T> getRecorderComponent()
{
return recorderComponent;
}
@@ -472,7 +472,7 @@
/**
* @return collection representing all available items
*/
- public Collection getChoices()
+ public Collection<T> getChoices()
{
return choicesModel.getObject();
}
@@ -480,15 +480,16 @@
/**
* @return collection representing selected items
*/
- public Collection getModelCollection()
+ @SuppressWarnings("unchecked")
+ public Collection<T> getModelCollection()
{
- return getModelObject();
+ return (Collection<T>)getDefaultModelObject();
}
/**
* @return choice renderer
*/
- public IChoiceRenderer getChoiceRenderer()
+ public IChoiceRenderer<T> getChoiceRenderer()
{
return choiceRenderer;
}
@@ -513,7 +514,7 @@
protected final void updateModel()
{
// prepare model
- List<T> model = getModelObject();
+ Collection<T> model = getModelCollection();
model.clear();
// update model
@@ -525,7 +526,7 @@
model.add(selectedChoice);
}
- getModel().setObject(model);
+ setDefaultModelObject(model);
}
/**
Modified: wicket/trunk/wicket-extensions/src/main/java/org/apache/wicket/extensions/markup/html/form/palette/component/AbstractOptions.java
URL: http://svn.apache.org/viewvc/wicket/trunk/wicket-extensions/src/main/java/org/apache/wicket/extensions/markup/html/form/palette/component/AbstractOptions.java?rev=672603&r1=672602&r2=672603&view=diff
==============================================================================
--- wicket/trunk/wicket-extensions/src/main/java/org/apache/wicket/extensions/markup/html/form/palette/component/AbstractOptions.java (original)
+++ wicket/trunk/wicket-extensions/src/main/java/org/apache/wicket/extensions/markup/html/form/palette/component/AbstractOptions.java Sat Jun 28 22:50:41 2008
@@ -33,18 +33,16 @@
* Generates html option elements based on iterator specified by getOptionsIterator() and
* IChoiceRender specified by the palette
*
+ * @param <T>
* @author Igor Vaynberg ( ivaynberg )
- *
*/
-public abstract class AbstractOptions extends FormComponent
+public abstract class AbstractOptions<T> extends FormComponent<T>
{
- /**
- *
- */
private static final long serialVersionUID = 1L;
- private Palette palette;
- protected Palette getPalette()
+ private final Palette<T> palette;
+
+ protected Palette<T> getPalette()
{
return palette;
}
@@ -55,25 +53,27 @@
* @param palette
* parent palette
*/
- public AbstractOptions(String id, Palette palette)
+ public AbstractOptions(String id, Palette<T> palette)
{
super(id);
this.palette = palette;
setOutputMarkupId(true);
}
- protected abstract Iterator getOptionsIterator();
+ protected abstract Iterator<T> getOptionsIterator();
+ @SuppressWarnings("unchecked")
+ @Override
protected void onComponentTagBody(MarkupStream markupStream, ComponentTag openTag)
{
final AppendingStringBuffer buffer = new AppendingStringBuffer(128);
- Iterator options = getOptionsIterator();
- IChoiceRenderer renderer = getPalette().getChoiceRenderer();
+ Iterator<T> options = getOptionsIterator();
+ IChoiceRenderer<T> renderer = getPalette().getChoiceRenderer();
while (options.hasNext())
{
- final Object choice = options.next();
+ final T choice = options.next();
String id = renderer.getIdValue(choice, 0);
Object displayValue = renderer.getDisplayValue(choice);
Class displayClass = displayValue == null ? null : displayValue.getClass();
@@ -82,13 +82,13 @@
buffer.append("\n<option value=\"").append(id).append("\"");
- Map additionalAttributesMap = getAdditionalAttributes(choice);
+ Map<String, String> additionalAttributesMap = getAdditionalAttributes(choice);
if (additionalAttributesMap != null)
{
- Iterator iter = additionalAttributesMap.keySet().iterator();
+ Iterator<String> iter = additionalAttributesMap.keySet().iterator();
while (iter.hasNext())
{
- String next = (String)iter.next();
+ String next = iter.next();
buffer.append(" " + next + "=\"" +
additionalAttributesMap.get(next).toString() + "\"");
}
@@ -104,17 +104,18 @@
}
/**
+ * @param choice
* @return map of attribute/value pairs (String/String)
*/
- protected Map getAdditionalAttributes(Object choice)
+ protected Map<String, String> getAdditionalAttributes(T choice)
{
return null;
}
/**
- *
- * @param tag
+ * @see org.apache.wicket.markup.html.form.FormComponent#onComponentTag(org.apache.wicket.markup.ComponentTag)
*/
+ @Override
protected void onComponentTag(ComponentTag tag)
{
checkComponentTag(tag, "select");
@@ -143,6 +144,7 @@
/**
* @see org.apache.wicket.markup.html.form.FormComponent#updateModel()
*/
+ @Override
public void updateModel()
{
}
Modified: wicket/trunk/wicket-extensions/src/main/java/org/apache/wicket/extensions/markup/html/form/palette/component/Choices.java
URL: http://svn.apache.org/viewvc/wicket/trunk/wicket-extensions/src/main/java/org/apache/wicket/extensions/markup/html/form/palette/component/Choices.java?rev=672603&r1=672602&r2=672603&view=diff
==============================================================================
--- wicket/trunk/wicket-extensions/src/main/java/org/apache/wicket/extensions/markup/html/form/palette/component/Choices.java (original)
+++ wicket/trunk/wicket-extensions/src/main/java/org/apache/wicket/extensions/markup/html/form/palette/component/Choices.java Sat Jun 28 22:50:41 2008
@@ -26,10 +26,10 @@
/**
* select box containing all available choices of the palette
*
+ * @param <T>
* @author Igor Vaynberg ( ivaynberg )
- *
*/
-public class Choices extends AbstractOptions
+public class Choices<T> extends AbstractOptions<T>
{
private static final long serialVersionUID = 1L;
@@ -39,12 +39,13 @@
* @param palette
* parent palette
*/
- public Choices(String id, Palette palette)
+ public Choices(String id, Palette<T> palette)
{
super(id, palette);
}
+ @Override
protected void onComponentTag(ComponentTag tag)
{
super.onComponentTag(tag);
@@ -58,7 +59,8 @@
tag.getAttributes().put("ondblclick", getPalette().getAddOnClickJS());
}
- protected Iterator getOptionsIterator()
+ @Override
+ protected Iterator<T> getOptionsIterator()
{
return getPalette().getUnselectedChoices();
}
Modified: wicket/trunk/wicket-extensions/src/main/java/org/apache/wicket/extensions/markup/html/form/palette/component/Recorder.java
URL: http://svn.apache.org/viewvc/wicket/trunk/wicket-extensions/src/main/java/org/apache/wicket/extensions/markup/html/form/palette/component/Recorder.java?rev=672603&r1=672602&r2=672603&view=diff
==============================================================================
--- wicket/trunk/wicket-extensions/src/main/java/org/apache/wicket/extensions/markup/html/form/palette/component/Recorder.java (original)
+++ wicket/trunk/wicket-extensions/src/main/java/org/apache/wicket/extensions/markup/html/form/palette/component/Recorder.java Sat Jun 28 22:50:41 2008
@@ -33,9 +33,12 @@
* Component to keep track of selections on the html side. Also used for encoding and decoding those
* selections between html and java.
*
+ * @param <T>
+ * Type of the palette
+ *
* @author Igor Vaynberg ( ivaynberg )
*/
-public class Recorder extends HiddenField
+public class Recorder<T> extends HiddenField<Object>
{
private static final long serialVersionUID = 1L;
@@ -45,14 +48,14 @@
private String[] ids;
/** parent palette object */
- private Palette palette;
+ private final Palette<T> palette;
private boolean attached = false;
/**
* @return parent Palette object
*/
- public Palette getPalette()
+ public Palette<T> getPalette()
{
return palette;
}
@@ -63,14 +66,16 @@
* @param palette
* parent palette object
*/
- public Recorder(String id, Palette palette)
+ @SuppressWarnings("unchecked")
+ public Recorder(String id, Palette<T> palette)
{
super(id);
this.palette = palette;
- setModel(new Model());
+ setDefaultModel(new Model());
setOutputMarkupId(true);
}
+ @Override
protected void onBeforeRender()
{
super.onBeforeRender();
@@ -88,9 +93,9 @@
private void initIds()
{
// construct the model string based on selection collection
- IChoiceRenderer renderer = getPalette().getChoiceRenderer();
+ IChoiceRenderer<T> renderer = getPalette().getChoiceRenderer();
StringBuffer modelStringBuffer = new StringBuffer();
- Iterator selection = getPalette().getModelCollection().iterator();
+ Iterator<T> selection = getPalette().getModelCollection().iterator();
int i = 0;
while (selection.hasNext())
@@ -104,11 +109,12 @@
// set model and update ids array
String modelString = modelStringBuffer.toString();
- setModel(new Model(modelString));
+ setDefaultModel(new Model<String>(modelString));
updateIds(modelString);
}
+ @Override
protected void onValid()
{
super.onValid();
@@ -119,22 +125,22 @@
/**
* @return iterator over selected choices
*/
- public Iterator getSelectedChoices()
+ @SuppressWarnings("unchecked")
+ public Iterator<T> getSelectedChoices()
{
- IChoiceRenderer renderer = getPalette().getChoiceRenderer();
-
+ IChoiceRenderer<T> renderer = getPalette().getChoiceRenderer();
if (ids.length == 0)
{
return Collections.EMPTY_LIST.iterator();
}
- List selected = new ArrayList(ids.length);
+ List<T> selected = new ArrayList<T>(ids.length);
for (int i = 0; i < ids.length; i++)
{
- Iterator it = getPalette().getChoices().iterator();
+ Iterator<T> it = getPalette().getChoices().iterator();
while (it.hasNext())
{
- final Object choice = it.next();
+ final T choice = it.next();
if (renderer.getIdValue(choice, 0).equals(ids[i]))
{
selected.add(choice);
@@ -148,21 +154,22 @@
/**
* @return iterator over unselected choices
*/
- public Iterator getUnselectedChoices()
+ @SuppressWarnings("unchecked")
+ public Iterator<T> getUnselectedChoices()
{
- IChoiceRenderer renderer = getPalette().getChoiceRenderer();
- Collection choices = getPalette().getChoices();
+ IChoiceRenderer<T> renderer = getPalette().getChoiceRenderer();
+ Collection<T> choices = getPalette().getChoices();
if (choices.size() - ids.length == 0)
{
return Collections.EMPTY_LIST.iterator();
}
- List unselected = new ArrayList(Math.max(1, choices.size() - ids.length));
- Iterator it = choices.iterator();
+ List<T> unselected = new ArrayList<T>(Math.max(1, choices.size() - ids.length));
+ Iterator<T> it = choices.iterator();
while (it.hasNext())
{
- final Object choice = it.next();
+ final T choice = it.next();
final String choiceId = renderer.getIdValue(choice, 0);
boolean selected = false;
for (int i = 0; i < ids.length; i++)
@@ -182,6 +189,7 @@
}
+ @Override
protected void onInvalid()
{
super.onInvalid();
Modified: wicket/trunk/wicket-extensions/src/main/java/org/apache/wicket/extensions/markup/html/form/palette/component/Selection.java
URL: http://svn.apache.org/viewvc/wicket/trunk/wicket-extensions/src/main/java/org/apache/wicket/extensions/markup/html/form/palette/component/Selection.java?rev=672603&r1=672602&r2=672603&view=diff
==============================================================================
--- wicket/trunk/wicket-extensions/src/main/java/org/apache/wicket/extensions/markup/html/form/palette/component/Selection.java (original)
+++ wicket/trunk/wicket-extensions/src/main/java/org/apache/wicket/extensions/markup/html/form/palette/component/Selection.java Sat Jun 28 22:50:41 2008
@@ -26,14 +26,11 @@
/**
* select box containg selected choices of the palette
*
+ * @param <T>
* @author Igor Vaynberg ( ivaynberg )
- *
*/
-public class Selection extends AbstractOptions
+public class Selection<T> extends AbstractOptions<T>
{
- /**
- *
- */
private static final long serialVersionUID = 1L;
/**
@@ -42,11 +39,12 @@
* @param palette
* parent palette
*/
- public Selection(String id, Palette palette)
+ public Selection(String id, Palette<T> palette)
{
super(id, palette);
}
+ @Override
protected void onComponentTag(ComponentTag tag)
{
super.onComponentTag(tag);
@@ -61,7 +59,8 @@
tag.getAttributes().put("ondblclick", getPalette().getRemoveOnClickJS());
}
- protected Iterator getOptionsIterator()
+ @Override
+ protected Iterator<T> getOptionsIterator()
{
return getPalette().getSelectedChoices();
}