You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by eh...@apache.org on 2008/06/20 22:31:02 UTC
svn commit: r670056 [1/2] - in
/wicket/sandbox/ivaynberg/generics/wicket-extensions/src:
main/java/org/apache/wicket/extensions/ajax/markup/html/
main/java/org/apache/wicket/extensions/ajax/markup/html/autocomplete/
main/java/org/apache/wicket/extensio...
Author: ehillenius
Date: Fri Jun 20 13:31:00 2008
New Revision: 670056
URL: http://svn.apache.org/viewvc?rev=670056&view=rev
Log:
igor's generics wip
Modified:
wicket/sandbox/ivaynberg/generics/wicket-extensions/src/main/java/org/apache/wicket/extensions/ajax/markup/html/AjaxEditableChoiceLabel.java
wicket/sandbox/ivaynberg/generics/wicket-extensions/src/main/java/org/apache/wicket/extensions/ajax/markup/html/AjaxEditableLabel.java
wicket/sandbox/ivaynberg/generics/wicket-extensions/src/main/java/org/apache/wicket/extensions/ajax/markup/html/AjaxEditableMultiLineLabel.java
wicket/sandbox/ivaynberg/generics/wicket-extensions/src/main/java/org/apache/wicket/extensions/ajax/markup/html/AjaxLazyLoadPanel.java
wicket/sandbox/ivaynberg/generics/wicket-extensions/src/main/java/org/apache/wicket/extensions/ajax/markup/html/IndicatingAjaxButton.java
wicket/sandbox/ivaynberg/generics/wicket-extensions/src/main/java/org/apache/wicket/extensions/ajax/markup/html/IndicatingAjaxFallbackLink.java
wicket/sandbox/ivaynberg/generics/wicket-extensions/src/main/java/org/apache/wicket/extensions/ajax/markup/html/IndicatingAjaxLink.java
wicket/sandbox/ivaynberg/generics/wicket-extensions/src/main/java/org/apache/wicket/extensions/ajax/markup/html/IndicatingAjaxSubmitButton.java
wicket/sandbox/ivaynberg/generics/wicket-extensions/src/main/java/org/apache/wicket/extensions/ajax/markup/html/autocomplete/AbstractAutoCompleteTextRenderer.java
wicket/sandbox/ivaynberg/generics/wicket-extensions/src/main/java/org/apache/wicket/extensions/ajax/markup/html/modal/ModalWindow.java
wicket/sandbox/ivaynberg/generics/wicket-extensions/src/main/java/org/apache/wicket/extensions/ajax/markup/html/repeater/data/table/AjaxFallbackDefaultDataTable.java
wicket/sandbox/ivaynberg/generics/wicket-extensions/src/main/java/org/apache/wicket/extensions/ajax/markup/html/tabs/AjaxTabbedPanel.java
wicket/sandbox/ivaynberg/generics/wicket-extensions/src/main/java/org/apache/wicket/extensions/breadcrumb/panel/BreadCrumbPanel.java
wicket/sandbox/ivaynberg/generics/wicket-extensions/src/main/java/org/apache/wicket/extensions/breadcrumb/panel/BreadCrumbPanelFactory.java
wicket/sandbox/ivaynberg/generics/wicket-extensions/src/main/java/org/apache/wicket/extensions/breadcrumb/panel/BreadCrumbPanelLink.java
wicket/sandbox/ivaynberg/generics/wicket-extensions/src/main/java/org/apache/wicket/extensions/breadcrumb/panel/BreadCrumbParticipantDelegate.java
wicket/sandbox/ivaynberg/generics/wicket-extensions/src/main/java/org/apache/wicket/extensions/markup/html/basic/SmartLinkLabel.java
wicket/sandbox/ivaynberg/generics/wicket-extensions/src/main/java/org/apache/wicket/extensions/markup/html/basic/SmartLinkMultiLineLabel.java
wicket/sandbox/ivaynberg/generics/wicket-extensions/src/main/java/org/apache/wicket/extensions/markup/html/form/palette/Palette.java
wicket/sandbox/ivaynberg/generics/wicket-extensions/src/main/java/org/apache/wicket/extensions/markup/html/form/palette/component/AbstractOptions.java
wicket/sandbox/ivaynberg/generics/wicket-extensions/src/main/java/org/apache/wicket/extensions/markup/html/form/palette/component/Choices.java
wicket/sandbox/ivaynberg/generics/wicket-extensions/src/main/java/org/apache/wicket/extensions/markup/html/form/palette/component/Recorder.java
wicket/sandbox/ivaynberg/generics/wicket-extensions/src/main/java/org/apache/wicket/extensions/markup/html/form/palette/component/Selection.java
wicket/sandbox/ivaynberg/generics/wicket-extensions/src/main/java/org/apache/wicket/extensions/markup/html/form/select/Select.java
wicket/sandbox/ivaynberg/generics/wicket-extensions/src/main/java/org/apache/wicket/extensions/markup/html/form/select/SelectOption.java
wicket/sandbox/ivaynberg/generics/wicket-extensions/src/main/java/org/apache/wicket/extensions/markup/html/form/select/SelectOptions.java
wicket/sandbox/ivaynberg/generics/wicket-extensions/src/main/java/org/apache/wicket/extensions/markup/html/repeater/data/grid/AbstractDataGridView.java
wicket/sandbox/ivaynberg/generics/wicket-extensions/src/main/java/org/apache/wicket/extensions/markup/html/repeater/data/grid/DataGridView.java
wicket/sandbox/ivaynberg/generics/wicket-extensions/src/main/java/org/apache/wicket/extensions/markup/html/repeater/data/grid/PropertyPopulator.java
wicket/sandbox/ivaynberg/generics/wicket-extensions/src/main/java/org/apache/wicket/extensions/markup/html/repeater/data/table/AbstractColumn.java
wicket/sandbox/ivaynberg/generics/wicket-extensions/src/main/java/org/apache/wicket/extensions/markup/html/repeater/data/table/AbstractToolbar.java
wicket/sandbox/ivaynberg/generics/wicket-extensions/src/main/java/org/apache/wicket/extensions/markup/html/repeater/data/table/DataTable.java
wicket/sandbox/ivaynberg/generics/wicket-extensions/src/main/java/org/apache/wicket/extensions/markup/html/repeater/data/table/DefaultDataTable.java
wicket/sandbox/ivaynberg/generics/wicket-extensions/src/main/java/org/apache/wicket/extensions/markup/html/repeater/data/table/HeaderlessColumn.java
wicket/sandbox/ivaynberg/generics/wicket-extensions/src/main/java/org/apache/wicket/extensions/markup/html/repeater/data/table/HeadersToolbar.java
wicket/sandbox/ivaynberg/generics/wicket-extensions/src/main/java/org/apache/wicket/extensions/markup/html/repeater/data/table/NavigatorLabel.java
wicket/sandbox/ivaynberg/generics/wicket-extensions/src/main/java/org/apache/wicket/extensions/markup/html/repeater/data/table/NoRecordsToolbar.java
wicket/sandbox/ivaynberg/generics/wicket-extensions/src/main/java/org/apache/wicket/extensions/markup/html/repeater/data/table/filter/AbstractFilter.java
wicket/sandbox/ivaynberg/generics/wicket-extensions/src/main/java/org/apache/wicket/extensions/markup/html/repeater/data/table/filter/ChoiceFilter.java
wicket/sandbox/ivaynberg/generics/wicket-extensions/src/main/java/org/apache/wicket/extensions/markup/html/repeater/data/table/filter/FilterToolbar.java
wicket/sandbox/ivaynberg/generics/wicket-extensions/src/main/java/org/apache/wicket/extensions/markup/html/repeater/data/table/filter/GoAndClearFilter.java
wicket/sandbox/ivaynberg/generics/wicket-extensions/src/main/java/org/apache/wicket/extensions/markup/html/repeater/data/table/filter/GoFilter.java
wicket/sandbox/ivaynberg/generics/wicket-extensions/src/main/java/org/apache/wicket/extensions/markup/html/repeater/data/table/filter/TextFilter.java
wicket/sandbox/ivaynberg/generics/wicket-extensions/src/main/java/org/apache/wicket/extensions/markup/html/tabs/AbstractTab.java
wicket/sandbox/ivaynberg/generics/wicket-extensions/src/main/java/org/apache/wicket/extensions/markup/html/tabs/ITab.java
wicket/sandbox/ivaynberg/generics/wicket-extensions/src/main/java/org/apache/wicket/extensions/markup/html/tabs/PanelCachingTab.java
wicket/sandbox/ivaynberg/generics/wicket-extensions/src/main/java/org/apache/wicket/extensions/markup/html/tabs/TabbedPanel.java
wicket/sandbox/ivaynberg/generics/wicket-extensions/src/main/java/org/apache/wicket/extensions/markup/html/tree/DefaultAbstractTree.java
wicket/sandbox/ivaynberg/generics/wicket-extensions/src/main/java/org/apache/wicket/extensions/markup/html/tree/Tree.java
wicket/sandbox/ivaynberg/generics/wicket-extensions/src/main/java/org/apache/wicket/extensions/markup/html/tree/table/AbstractColumn.java
wicket/sandbox/ivaynberg/generics/wicket-extensions/src/main/java/org/apache/wicket/extensions/markup/html/tree/table/MiddleColumnsView.java
wicket/sandbox/ivaynberg/generics/wicket-extensions/src/main/java/org/apache/wicket/extensions/markup/html/tree/table/PropertyRenderableColumn.java
wicket/sandbox/ivaynberg/generics/wicket-extensions/src/main/java/org/apache/wicket/extensions/markup/html/tree/table/PropertyTreeColumn.java
wicket/sandbox/ivaynberg/generics/wicket-extensions/src/main/java/org/apache/wicket/extensions/markup/html/tree/table/SideColumnsView.java
wicket/sandbox/ivaynberg/generics/wicket-extensions/src/main/java/org/apache/wicket/extensions/markup/html/tree/table/TreeTable.java
wicket/sandbox/ivaynberg/generics/wicket-extensions/src/main/java/org/apache/wicket/extensions/wizard/StaticContentStep.java
wicket/sandbox/ivaynberg/generics/wicket-extensions/src/main/java/org/apache/wicket/extensions/wizard/Wizard.java
wicket/sandbox/ivaynberg/generics/wicket-extensions/src/main/java/org/apache/wicket/extensions/wizard/WizardButton.java
wicket/sandbox/ivaynberg/generics/wicket-extensions/src/main/java/org/apache/wicket/extensions/wizard/WizardButtonBar.java
wicket/sandbox/ivaynberg/generics/wicket-extensions/src/main/java/org/apache/wicket/extensions/wizard/WizardStep.java
wicket/sandbox/ivaynberg/generics/wicket-extensions/src/main/java/org/apache/wicket/extensions/wizard/dynamic/DynamicWizardStep.java
wicket/sandbox/ivaynberg/generics/wicket-extensions/src/test/java/org/apache/wicket/extensions/ajax/markup/html/AjaxEditableTest.java
Modified: wicket/sandbox/ivaynberg/generics/wicket-extensions/src/main/java/org/apache/wicket/extensions/ajax/markup/html/AjaxEditableChoiceLabel.java
URL: http://svn.apache.org/viewvc/wicket/sandbox/ivaynberg/generics/wicket-extensions/src/main/java/org/apache/wicket/extensions/ajax/markup/html/AjaxEditableChoiceLabel.java?rev=670056&r1=670055&r2=670056&view=diff
==============================================================================
--- wicket/sandbox/ivaynberg/generics/wicket-extensions/src/main/java/org/apache/wicket/extensions/ajax/markup/html/AjaxEditableChoiceLabel.java (original)
+++ wicket/sandbox/ivaynberg/generics/wicket-extensions/src/main/java/org/apache/wicket/extensions/ajax/markup/html/AjaxEditableChoiceLabel.java Fri Jun 20 13:31:00 2008
@@ -139,7 +139,7 @@
@SuppressWarnings("unchecked")
public AjaxEditableChoiceLabel(String id, IModel<T> model, List<? extends T> choices)
{
- this(id, model, Model.valueOf(choices));
+ this(id, model, Model.of(choices));
}
/**
@@ -158,7 +158,7 @@
public AjaxEditableChoiceLabel(String id, IModel<T> model, List<? extends T> choices,
IChoiceRenderer<T> renderer)
{
- this(id, model, Model.valueOf(choices), renderer);
+ this(id, model, Model.of(choices), renderer);
}
@@ -167,8 +167,7 @@
* java.lang.String, org.apache.wicket.model.IModel)
*/
@Override
- protected FormComponent newEditor(MarkupContainer parent, String componentId,
- IModel<T> model)
+ protected FormComponent<T> newEditor(MarkupContainer parent, String componentId, IModel<T> model)
{
IModel<List<? extends T>> choiceModel = new AbstractReadOnlyModel<List<? extends T>>()
{
@@ -222,10 +221,9 @@
}
@Override
- protected WebComponent newLabel(MarkupContainer parent, String componentId,
- IModel<T> model)
+ 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;
@@ -236,13 +234,14 @@
return c != null ? c : super.getConverter(type);
}
+ @SuppressWarnings("unchecked")
@Override
protected void onComponentTagBody(MarkupStream markupStream, ComponentTag openTag)
{
String displayValue = getDefaultModelObjectAsString();
if (renderer != null)
{
- Object displayObject = renderer.getDisplayValue(getDefaultModelObject());
+ Object displayObject = renderer.getDisplayValue((T)getDefaultModelObject());
Class<?> objectClass = (displayObject == null ? null : displayObject.getClass());
Modified: wicket/sandbox/ivaynberg/generics/wicket-extensions/src/main/java/org/apache/wicket/extensions/ajax/markup/html/AjaxEditableLabel.java
URL: http://svn.apache.org/viewvc/wicket/sandbox/ivaynberg/generics/wicket-extensions/src/main/java/org/apache/wicket/extensions/ajax/markup/html/AjaxEditableLabel.java?rev=670056&r1=670055&r2=670056&view=diff
==============================================================================
--- wicket/sandbox/ivaynberg/generics/wicket-extensions/src/main/java/org/apache/wicket/extensions/ajax/markup/html/AjaxEditableLabel.java (original)
+++ wicket/sandbox/ivaynberg/generics/wicket-extensions/src/main/java/org/apache/wicket/extensions/ajax/markup/html/AjaxEditableLabel.java Fri Jun 20 13:31:00 2008
@@ -67,17 +67,15 @@
*
* @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;
/** editor component. */
- private FormComponent editor;
+ private FormComponent<T> editor;
/** label component. */
private WebComponent label;
@@ -236,7 +234,7 @@
* @see org.apache.wicket.MarkupContainer#setDefaultModel(org.apache.wicket.model.IModel)
*/
@Override
- public final AjaxEditableLabel<T> setDefaultModel(IModel<T> model)
+ public final AjaxEditableLabel<T> setDefaultModel(IModel<?> model)
{
super.setDefaultModel(model);
getLabel().setDefaultModel(model);
@@ -263,7 +261,7 @@
* @param type
* @return this for chaining
*/
- public final AjaxEditableLabel<T> setType(Class<T> type)
+ public final AjaxEditableLabel<T> setType(Class<?> type)
{
getEditor().setType(type);
return this;
@@ -280,8 +278,7 @@
* The model
* @return The editor
*/
- protected FormComponent 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 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;
@@ -375,7 +372,7 @@
*
* @return The editor component
*/
- protected final FormComponent getEditor()
+ protected final FormComponent<T> getEditor()
{
if (editor == null)
{
@@ -501,13 +498,14 @@
/**
* @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 = getDefaultModel();
+ IModel<T> m = (IModel<T>)getDefaultModel();
// check that a model was found
if (m == null)
Modified: wicket/sandbox/ivaynberg/generics/wicket-extensions/src/main/java/org/apache/wicket/extensions/ajax/markup/html/AjaxEditableMultiLineLabel.java
URL: http://svn.apache.org/viewvc/wicket/sandbox/ivaynberg/generics/wicket-extensions/src/main/java/org/apache/wicket/extensions/ajax/markup/html/AjaxEditableMultiLineLabel.java?rev=670056&r1=670055&r2=670056&view=diff
==============================================================================
--- wicket/sandbox/ivaynberg/generics/wicket-extensions/src/main/java/org/apache/wicket/extensions/ajax/markup/html/AjaxEditableMultiLineLabel.java (original)
+++ wicket/sandbox/ivaynberg/generics/wicket-extensions/src/main/java/org/apache/wicket/extensions/ajax/markup/html/AjaxEditableMultiLineLabel.java Fri Jun 20 13:31:00 2008
@@ -74,10 +74,9 @@
* 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;
@@ -117,8 +116,7 @@
* java.lang.String, org.apache.wicket.model.IModel)
*/
@Override
- protected FormComponent 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/sandbox/ivaynberg/generics/wicket-extensions/src/main/java/org/apache/wicket/extensions/ajax/markup/html/AjaxLazyLoadPanel.java
URL: http://svn.apache.org/viewvc/wicket/sandbox/ivaynberg/generics/wicket-extensions/src/main/java/org/apache/wicket/extensions/ajax/markup/html/AjaxLazyLoadPanel.java?rev=670056&r1=670055&r2=670056&view=diff
==============================================================================
--- wicket/sandbox/ivaynberg/generics/wicket-extensions/src/main/java/org/apache/wicket/extensions/ajax/markup/html/AjaxLazyLoadPanel.java (original)
+++ wicket/sandbox/ivaynberg/generics/wicket-extensions/src/main/java/org/apache/wicket/extensions/ajax/markup/html/AjaxLazyLoadPanel.java Fri Jun 20 13:31:00 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/sandbox/ivaynberg/generics/wicket-extensions/src/main/java/org/apache/wicket/extensions/ajax/markup/html/IndicatingAjaxButton.java
URL: http://svn.apache.org/viewvc/wicket/sandbox/ivaynberg/generics/wicket-extensions/src/main/java/org/apache/wicket/extensions/ajax/markup/html/IndicatingAjaxButton.java?rev=670056&r1=670055&r2=670056&view=diff
==============================================================================
--- wicket/sandbox/ivaynberg/generics/wicket-extensions/src/main/java/org/apache/wicket/extensions/ajax/markup/html/IndicatingAjaxButton.java (original)
+++ wicket/sandbox/ivaynberg/generics/wicket-extensions/src/main/java/org/apache/wicket/extensions/ajax/markup/html/IndicatingAjaxButton.java Fri Jun 20 13:31:00 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/sandbox/ivaynberg/generics/wicket-extensions/src/main/java/org/apache/wicket/extensions/ajax/markup/html/IndicatingAjaxFallbackLink.java
URL: http://svn.apache.org/viewvc/wicket/sandbox/ivaynberg/generics/wicket-extensions/src/main/java/org/apache/wicket/extensions/ajax/markup/html/IndicatingAjaxFallbackLink.java?rev=670056&r1=670055&r2=670056&view=diff
==============================================================================
--- wicket/sandbox/ivaynberg/generics/wicket-extensions/src/main/java/org/apache/wicket/extensions/ajax/markup/html/IndicatingAjaxFallbackLink.java (original)
+++ wicket/sandbox/ivaynberg/generics/wicket-extensions/src/main/java/org/apache/wicket/extensions/ajax/markup/html/IndicatingAjaxFallbackLink.java Fri Jun 20 13:31:00 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/sandbox/ivaynberg/generics/wicket-extensions/src/main/java/org/apache/wicket/extensions/ajax/markup/html/IndicatingAjaxLink.java
URL: http://svn.apache.org/viewvc/wicket/sandbox/ivaynberg/generics/wicket-extensions/src/main/java/org/apache/wicket/extensions/ajax/markup/html/IndicatingAjaxLink.java?rev=670056&r1=670055&r2=670056&view=diff
==============================================================================
--- wicket/sandbox/ivaynberg/generics/wicket-extensions/src/main/java/org/apache/wicket/extensions/ajax/markup/html/IndicatingAjaxLink.java (original)
+++ wicket/sandbox/ivaynberg/generics/wicket-extensions/src/main/java/org/apache/wicket/extensions/ajax/markup/html/IndicatingAjaxLink.java Fri Jun 20 13:31:00 2008
@@ -24,18 +24,13 @@
* 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)
*
*/
-public abstract class IndicatingAjaxLink<T> extends AjaxLink<T> implements IAjaxIndicatorAware
+public abstract class IndicatingAjaxLink extends AjaxLink implements IAjaxIndicatorAware
{
- /**
- *
- */
private static final long serialVersionUID = 1L;
private final WicketAjaxIndicatorAppender indicatorAppender = new WicketAjaxIndicatorAppender();
@@ -55,7 +50,7 @@
* @param id
* @param model
*/
- public IndicatingAjaxLink(String id, IModel<T> model)
+ public IndicatingAjaxLink(String id, IModel<?> model)
{
super(id, model);
add(indicatorAppender);
Modified: wicket/sandbox/ivaynberg/generics/wicket-extensions/src/main/java/org/apache/wicket/extensions/ajax/markup/html/IndicatingAjaxSubmitButton.java
URL: http://svn.apache.org/viewvc/wicket/sandbox/ivaynberg/generics/wicket-extensions/src/main/java/org/apache/wicket/extensions/ajax/markup/html/IndicatingAjaxSubmitButton.java?rev=670056&r1=670055&r2=670056&view=diff
==============================================================================
--- wicket/sandbox/ivaynberg/generics/wicket-extensions/src/main/java/org/apache/wicket/extensions/ajax/markup/html/IndicatingAjaxSubmitButton.java (original)
+++ wicket/sandbox/ivaynberg/generics/wicket-extensions/src/main/java/org/apache/wicket/extensions/ajax/markup/html/IndicatingAjaxSubmitButton.java Fri Jun 20 13:31:00 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/sandbox/ivaynberg/generics/wicket-extensions/src/main/java/org/apache/wicket/extensions/ajax/markup/html/autocomplete/AbstractAutoCompleteTextRenderer.java
URL: http://svn.apache.org/viewvc/wicket/sandbox/ivaynberg/generics/wicket-extensions/src/main/java/org/apache/wicket/extensions/ajax/markup/html/autocomplete/AbstractAutoCompleteTextRenderer.java?rev=670056&r1=670055&r2=670056&view=diff
==============================================================================
--- wicket/sandbox/ivaynberg/generics/wicket-extensions/src/main/java/org/apache/wicket/extensions/ajax/markup/html/autocomplete/AbstractAutoCompleteTextRenderer.java (original)
+++ wicket/sandbox/ivaynberg/generics/wicket-extensions/src/main/java/org/apache/wicket/extensions/ajax/markup/html/autocomplete/AbstractAutoCompleteTextRenderer.java Fri Jun 20 13:31:00 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/sandbox/ivaynberg/generics/wicket-extensions/src/main/java/org/apache/wicket/extensions/ajax/markup/html/modal/ModalWindow.java
URL: http://svn.apache.org/viewvc/wicket/sandbox/ivaynberg/generics/wicket-extensions/src/main/java/org/apache/wicket/extensions/ajax/markup/html/modal/ModalWindow.java?rev=670056&r1=670055&r2=670056&view=diff
==============================================================================
--- wicket/sandbox/ivaynberg/generics/wicket-extensions/src/main/java/org/apache/wicket/extensions/ajax/markup/html/modal/ModalWindow.java (original)
+++ wicket/sandbox/ivaynberg/generics/wicket-extensions/src/main/java/org/apache/wicket/extensions/ajax/markup/html/modal/ModalWindow.java Fri Jun 20 13:31:00 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();
@@ -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();
}
/**
- * 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,7 +700,7 @@
/**
* Creates the page.
- *
+ *
* @return Page instance or null if page couldn't be created.
*/
private Page createPage()
@@ -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,9 +767,9 @@
}
/**
- * 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()
@@ -802,9 +779,8 @@
/**
* 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()
{
@@ -826,7 +802,7 @@
/**
* Sets the content of the modal window.
- *
+ *
* @param component
*/
public void setContent(Component component)
@@ -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");
@@ -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
*/
Modified: wicket/sandbox/ivaynberg/generics/wicket-extensions/src/main/java/org/apache/wicket/extensions/ajax/markup/html/repeater/data/table/AjaxFallbackDefaultDataTable.java
URL: http://svn.apache.org/viewvc/wicket/sandbox/ivaynberg/generics/wicket-extensions/src/main/java/org/apache/wicket/extensions/ajax/markup/html/repeater/data/table/AjaxFallbackDefaultDataTable.java?rev=670056&r1=670055&r2=670056&view=diff
==============================================================================
--- wicket/sandbox/ivaynberg/generics/wicket-extensions/src/main/java/org/apache/wicket/extensions/ajax/markup/html/repeater/data/table/AjaxFallbackDefaultDataTable.java (original)
+++ wicket/sandbox/ivaynberg/generics/wicket-extensions/src/main/java/org/apache/wicket/extensions/ajax/markup/html/repeater/data/table/AjaxFallbackDefaultDataTable.java Fri Jun 20 13:31:00 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/sandbox/ivaynberg/generics/wicket-extensions/src/main/java/org/apache/wicket/extensions/ajax/markup/html/tabs/AjaxTabbedPanel.java
URL: http://svn.apache.org/viewvc/wicket/sandbox/ivaynberg/generics/wicket-extensions/src/main/java/org/apache/wicket/extensions/ajax/markup/html/tabs/AjaxTabbedPanel.java?rev=670056&r1=670055&r2=670056&view=diff
==============================================================================
--- wicket/sandbox/ivaynberg/generics/wicket-extensions/src/main/java/org/apache/wicket/extensions/ajax/markup/html/tabs/AjaxTabbedPanel.java (original)
+++ wicket/sandbox/ivaynberg/generics/wicket-extensions/src/main/java/org/apache/wicket/extensions/ajax/markup/html/tabs/AjaxTabbedPanel.java Fri Jun 20 13:31:00 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/sandbox/ivaynberg/generics/wicket-extensions/src/main/java/org/apache/wicket/extensions/breadcrumb/panel/BreadCrumbPanel.java
URL: http://svn.apache.org/viewvc/wicket/sandbox/ivaynberg/generics/wicket-extensions/src/main/java/org/apache/wicket/extensions/breadcrumb/panel/BreadCrumbPanel.java?rev=670056&r1=670055&r2=670056&view=diff
==============================================================================
--- wicket/sandbox/ivaynberg/generics/wicket-extensions/src/main/java/org/apache/wicket/extensions/breadcrumb/panel/BreadCrumbPanel.java (original)
+++ wicket/sandbox/ivaynberg/generics/wicket-extensions/src/main/java/org/apache/wicket/extensions/breadcrumb/panel/BreadCrumbPanel.java Fri Jun 20 13:31:00 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/sandbox/ivaynberg/generics/wicket-extensions/src/main/java/org/apache/wicket/extensions/breadcrumb/panel/BreadCrumbPanelFactory.java
URL: http://svn.apache.org/viewvc/wicket/sandbox/ivaynberg/generics/wicket-extensions/src/main/java/org/apache/wicket/extensions/breadcrumb/panel/BreadCrumbPanelFactory.java?rev=670056&r1=670055&r2=670056&view=diff
==============================================================================
--- wicket/sandbox/ivaynberg/generics/wicket-extensions/src/main/java/org/apache/wicket/extensions/breadcrumb/panel/BreadCrumbPanelFactory.java (original)
+++ wicket/sandbox/ivaynberg/generics/wicket-extensions/src/main/java/org/apache/wicket/extensions/breadcrumb/panel/BreadCrumbPanelFactory.java Fri Jun 20 13:31:00 2008
@@ -32,7 +32,7 @@
private static final long serialVersionUID = 1L;
/** Class to construct. */
- private Class panelClass;
+ private final Class<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<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<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<BreadCrumbPanel> getConstructor()
{
try
{
- Constructor ctor = panelClass.getConstructor(new Class[] { String.class,
- IBreadCrumbModel.class });
+ Constructor<BreadCrumbPanel> ctor = panelClass.getConstructor(new Class[] {
+ String.class, IBreadCrumbModel.class });
return ctor;
}
catch (SecurityException e)
Modified: wicket/sandbox/ivaynberg/generics/wicket-extensions/src/main/java/org/apache/wicket/extensions/breadcrumb/panel/BreadCrumbPanelLink.java
URL: http://svn.apache.org/viewvc/wicket/sandbox/ivaynberg/generics/wicket-extensions/src/main/java/org/apache/wicket/extensions/breadcrumb/panel/BreadCrumbPanelLink.java?rev=670056&r1=670055&r2=670056&view=diff
==============================================================================
--- wicket/sandbox/ivaynberg/generics/wicket-extensions/src/main/java/org/apache/wicket/extensions/breadcrumb/panel/BreadCrumbPanelLink.java (original)
+++ wicket/sandbox/ivaynberg/generics/wicket-extensions/src/main/java/org/apache/wicket/extensions/breadcrumb/panel/BreadCrumbPanelLink.java Fri Jun 20 13:31:00 2008
@@ -49,7 +49,8 @@
* 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<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/sandbox/ivaynberg/generics/wicket-extensions/src/main/java/org/apache/wicket/extensions/breadcrumb/panel/BreadCrumbParticipantDelegate.java
URL: http://svn.apache.org/viewvc/wicket/sandbox/ivaynberg/generics/wicket-extensions/src/main/java/org/apache/wicket/extensions/breadcrumb/panel/BreadCrumbParticipantDelegate.java?rev=670056&r1=670055&r2=670056&view=diff
==============================================================================
--- wicket/sandbox/ivaynberg/generics/wicket-extensions/src/main/java/org/apache/wicket/extensions/breadcrumb/panel/BreadCrumbParticipantDelegate.java (original)
+++ wicket/sandbox/ivaynberg/generics/wicket-extensions/src/main/java/org/apache/wicket/extensions/breadcrumb/panel/BreadCrumbParticipantDelegate.java Fri Jun 20 13:31:00 2008
@@ -81,7 +81,7 @@
{
// 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 c = (Component)parent.visitChildren(new IVisitor<Component>()
{
public Object component(Component component)
{
@@ -95,17 +95,18 @@
if (c == null)
{
// not found... do a reverse search (upwards)
- c = (Component)parent.visitParents(Component.class, new IVisitor()
- {
- public Object component(Component component)
+ c = (Component)parent.visitParents(Component.class,
+ new IVisitor<Component>()
{
- if (component.getId().equals(thisId))
+ public Object component(Component component)
{
- return component;
+ if (component.getId().equals(thisId))
+ {
+ return component;
+ }
+ return IVisitor.CONTINUE_TRAVERSAL;
}
- return IVisitor.CONTINUE_TRAVERSAL;
- }
- });
+ });
}
// replace if found
Modified: wicket/sandbox/ivaynberg/generics/wicket-extensions/src/main/java/org/apache/wicket/extensions/markup/html/basic/SmartLinkLabel.java
URL: http://svn.apache.org/viewvc/wicket/sandbox/ivaynberg/generics/wicket-extensions/src/main/java/org/apache/wicket/extensions/markup/html/basic/SmartLinkLabel.java?rev=670056&r1=670055&r2=670056&view=diff
==============================================================================
--- wicket/sandbox/ivaynberg/generics/wicket-extensions/src/main/java/org/apache/wicket/extensions/markup/html/basic/SmartLinkLabel.java (original)
+++ wicket/sandbox/ivaynberg/generics/wicket-extensions/src/main/java/org/apache/wicket/extensions/markup/html/basic/SmartLinkLabel.java Fri Jun 20 13:31:00 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(getDefaultModelObjectAsString()));
+ 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/sandbox/ivaynberg/generics/wicket-extensions/src/main/java/org/apache/wicket/extensions/markup/html/basic/SmartLinkMultiLineLabel.java
URL: http://svn.apache.org/viewvc/wicket/sandbox/ivaynberg/generics/wicket-extensions/src/main/java/org/apache/wicket/extensions/markup/html/basic/SmartLinkMultiLineLabel.java?rev=670056&r1=670055&r2=670056&view=diff
==============================================================================
--- wicket/sandbox/ivaynberg/generics/wicket-extensions/src/main/java/org/apache/wicket/extensions/markup/html/basic/SmartLinkMultiLineLabel.java (original)
+++ wicket/sandbox/ivaynberg/generics/wicket-extensions/src/main/java/org/apache/wicket/extensions/markup/html/basic/SmartLinkMultiLineLabel.java Fri Jun 20 13:31:00 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,14 +52,14 @@
/**
* @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)
Modified: wicket/sandbox/ivaynberg/generics/wicket-extensions/src/main/java/org/apache/wicket/extensions/markup/html/form/palette/Palette.java
URL: http://svn.apache.org/viewvc/wicket/sandbox/ivaynberg/generics/wicket-extensions/src/main/java/org/apache/wicket/extensions/markup/html/form/palette/Palette.java?rev=670056&r1=670055&r2=670056&view=diff
==============================================================================
--- wicket/sandbox/ivaynberg/generics/wicket-extensions/src/main/java/org/apache/wicket/extensions/markup/html/form/palette/Palette.java (original)
+++ wicket/sandbox/ivaynberg/generics/wicket-extensions/src/main/java/org/apache/wicket/extensions/markup/html/form/palette/Palette.java Fri Jun 20 13:31:00 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 getDefaultModelObject();
+ 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 = getDefaultModelObject();
+ Collection<T> model = getModelCollection();
model.clear();
// update model
@@ -525,7 +526,7 @@
model.add(selectedChoice);
}
- getDefaultModel().setObject(model);
+ setDefaultModelObject(model);
}
/**
Modified: wicket/sandbox/ivaynberg/generics/wicket-extensions/src/main/java/org/apache/wicket/extensions/markup/html/form/palette/component/AbstractOptions.java
URL: http://svn.apache.org/viewvc/wicket/sandbox/ivaynberg/generics/wicket-extensions/src/main/java/org/apache/wicket/extensions/markup/html/form/palette/component/AbstractOptions.java?rev=670056&r1=670055&r2=670056&view=diff
==============================================================================
--- wicket/sandbox/ivaynberg/generics/wicket-extensions/src/main/java/org/apache/wicket/extensions/markup/html/form/palette/component/AbstractOptions.java (original)
+++ wicket/sandbox/ivaynberg/generics/wicket-extensions/src/main/java/org/apache/wicket/extensions/markup/html/form/palette/component/AbstractOptions.java Fri Jun 20 13:31:00 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/sandbox/ivaynberg/generics/wicket-extensions/src/main/java/org/apache/wicket/extensions/markup/html/form/palette/component/Choices.java
URL: http://svn.apache.org/viewvc/wicket/sandbox/ivaynberg/generics/wicket-extensions/src/main/java/org/apache/wicket/extensions/markup/html/form/palette/component/Choices.java?rev=670056&r1=670055&r2=670056&view=diff
==============================================================================
--- wicket/sandbox/ivaynberg/generics/wicket-extensions/src/main/java/org/apache/wicket/extensions/markup/html/form/palette/component/Choices.java (original)
+++ wicket/sandbox/ivaynberg/generics/wicket-extensions/src/main/java/org/apache/wicket/extensions/markup/html/form/palette/component/Choices.java Fri Jun 20 13:31:00 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/sandbox/ivaynberg/generics/wicket-extensions/src/main/java/org/apache/wicket/extensions/markup/html/form/palette/component/Recorder.java
URL: http://svn.apache.org/viewvc/wicket/sandbox/ivaynberg/generics/wicket-extensions/src/main/java/org/apache/wicket/extensions/markup/html/form/palette/component/Recorder.java?rev=670056&r1=670055&r2=670056&view=diff
==============================================================================
--- wicket/sandbox/ivaynberg/generics/wicket-extensions/src/main/java/org/apache/wicket/extensions/markup/html/form/palette/component/Recorder.java (original)
+++ wicket/sandbox/ivaynberg/generics/wicket-extensions/src/main/java/org/apache/wicket/extensions/markup/html/form/palette/component/Recorder.java Fri Jun 20 13:31:00 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,7 +66,8 @@
* @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;
@@ -71,6 +75,7 @@
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();
- setDefaultModel(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/sandbox/ivaynberg/generics/wicket-extensions/src/main/java/org/apache/wicket/extensions/markup/html/form/palette/component/Selection.java
URL: http://svn.apache.org/viewvc/wicket/sandbox/ivaynberg/generics/wicket-extensions/src/main/java/org/apache/wicket/extensions/markup/html/form/palette/component/Selection.java?rev=670056&r1=670055&r2=670056&view=diff
==============================================================================
--- wicket/sandbox/ivaynberg/generics/wicket-extensions/src/main/java/org/apache/wicket/extensions/markup/html/form/palette/component/Selection.java (original)
+++ wicket/sandbox/ivaynberg/generics/wicket-extensions/src/main/java/org/apache/wicket/extensions/markup/html/form/palette/component/Selection.java Fri Jun 20 13:31:00 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();
}
Modified: wicket/sandbox/ivaynberg/generics/wicket-extensions/src/main/java/org/apache/wicket/extensions/markup/html/form/select/Select.java
URL: http://svn.apache.org/viewvc/wicket/sandbox/ivaynberg/generics/wicket-extensions/src/main/java/org/apache/wicket/extensions/markup/html/form/select/Select.java?rev=670056&r1=670055&r2=670056&view=diff
==============================================================================
--- wicket/sandbox/ivaynberg/generics/wicket-extensions/src/main/java/org/apache/wicket/extensions/markup/html/form/select/Select.java (original)
+++ wicket/sandbox/ivaynberg/generics/wicket-extensions/src/main/java/org/apache/wicket/extensions/markup/html/form/select/Select.java Fri Jun 20 13:31:00 2008
@@ -89,6 +89,7 @@
super(id, model);
}
+ @Override
protected void convertInput()
{
boolean supportsMultiple = getDefaultModelObject() instanceof Collection;
@@ -108,9 +109,9 @@
if (!supportsMultiple && paths.length > 1)
{
throw new WicketRuntimeException(
- "The model of Select component [" +
- getPath() +
- "] is not of type java.util.Collection, but more then one SelectOption component has been selected. Either remove the multiple attribute from the select tag or make the model of the Select component a collection");
+ "The model of Select component [" +
+ getPath() +
+ "] is not of type java.util.Collection, but more then one SelectOption component has been selected. Either remove the multiple attribute from the select tag or make the model of the Select component a collection");
}
List converted = new ArrayList(paths.length);
@@ -136,13 +137,13 @@
if (option == null)
{
throw new WicketRuntimeException(
- "submitted http post value [" +
- paths.toString() +
- "] for SelectOption component [" +
- getPath() +
- "] contains an illegal relative path element [" +
- path +
- "] which does not point to an SelectOption component. Due to this the Select component cannot resolve the selected SelectOption component pointed to by the illegal value. A possible reason is that component hierarchy changed between rendering and form submission.");
+ "submitted http post value [" +
+ paths.toString() +
+ "] for SelectOption component [" +
+ getPath() +
+ "] contains an illegal relative path element [" +
+ path +
+ "] which does not point to an SelectOption component. Due to this the Select component cannot resolve the selected SelectOption component pointed to by the illegal value. A possible reason is that component hierarchy changed between rendering and form submission.");
}
converted.add(option.getDefaultModelObject());
}
@@ -167,6 +168,7 @@
/**
* @see FormComponent#updateModel()
*/
+ @Override
public void updateModel()
{
Object object = getDefaultModelObject();
@@ -187,7 +189,7 @@
}
modelChanged();
// force notify of model update via setObject()
- getDefaultModel().setObject(modelCollection);
+ setDefaultModelObject(modelCollection);
}
else
{
Modified: wicket/sandbox/ivaynberg/generics/wicket-extensions/src/main/java/org/apache/wicket/extensions/markup/html/form/select/SelectOption.java
URL: http://svn.apache.org/viewvc/wicket/sandbox/ivaynberg/generics/wicket-extensions/src/main/java/org/apache/wicket/extensions/markup/html/form/select/SelectOption.java?rev=670056&r1=670055&r2=670056&view=diff
==============================================================================
--- wicket/sandbox/ivaynberg/generics/wicket-extensions/src/main/java/org/apache/wicket/extensions/markup/html/form/select/SelectOption.java (original)
+++ wicket/sandbox/ivaynberg/generics/wicket-extensions/src/main/java/org/apache/wicket/extensions/markup/html/form/select/SelectOption.java Fri Jun 20 13:31:00 2008
@@ -28,10 +28,11 @@
* TODO Post 1.2: General: Example
*
* @see Select
+ * @param <T>
*
* @author Igor Vaynberg
*/
-public class SelectOption<T> extends WebMarkupContainer<T>
+public class SelectOption<T> extends WebMarkupContainer
{
private static final long serialVersionUID = 1L;
@@ -44,6 +45,8 @@
}
/**
+ * @param id
+ * @param model
* @see WebMarkupContainer#WebMarkupContainer(String, IModel)
*/
public SelectOption(String id, IModel<T> model)
@@ -55,12 +58,11 @@
/**
* @see Component#onComponentTag(ComponentTag)
* @param tag
- * the abstraction representing html tag of this component
+ * the abstraction representing html tag of this component
*/
@Override
protected void onComponentTag(final ComponentTag tag)
{
-
// must be attached to <option .../> tag
checkComponentTag(tag, "option");