Author: ivaynberg
Date: Sun May 25 20:18:23 2008
New Revision: 660094
URL: http://svn.apache.org/viewvc?rev=660094&view=rev
Log:
generics cleanup
Modified:
wicket/trunk/wicket-extensions/src/main/java/org/apache/wicket/extensions/ajax/markup/html/AjaxEditableLabel.java
wicket/trunk/wicket/src/main/java/org/apache/wicket/Request.java
wicket/trunk/wicket/src/main/java/org/apache/wicket/markup/html/form/AbstractTextComponent.java
wicket/trunk/wicket/src/main/java/org/apache/wicket/markup/html/form/Check.java
wicket/trunk/wicket/src/main/java/org/apache/wicket/markup/html/form/CheckBoxMultipleChoice.java
wicket/trunk/wicket/src/main/java/org/apache/wicket/markup/html/form/CheckGroup.java
wicket/trunk/wicket/src/main/java/org/apache/wicket/markup/html/form/Form.java
wicket/trunk/wicket/src/main/java/org/apache/wicket/markup/html/form/FormComponent.java
wicket/trunk/wicket/src/main/java/org/apache/wicket/markup/html/link/IPageLink.java
wicket/trunk/wicket/src/main/java/org/apache/wicket/markup/html/list/ListView.java
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=660094&r1=660093&r2=660094&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
Sun May 25 20:18:23 2008
@@ -226,7 +226,7 @@
* @param labelModel
* @return this for chaining
*/
- public final AjaxEditableLabel<T> setLabel(final IModel<T> labelModel)
+ public final AjaxEditableLabel<T> setLabel(final IModel<String>
labelModel)
{
getEditor().setLabel(labelModel);
return this;
Modified: wicket/trunk/wicket/src/main/java/org/apache/wicket/Request.java
URL:
http://svn.apache.org/viewvc/wicket/trunk/wicket/src/main/java/org/apache/wicket/Request.java?rev=660094&r1=660093&r2=660094&view=diff
==============================================================================
--- wicket/trunk/wicket/src/main/java/org/apache/wicket/Request.java (original)
+++ wicket/trunk/wicket/src/main/java/org/apache/wicket/Request.java Sun May 25
20:18:23 2008
@@ -36,7 +36,7 @@
public abstract class Request
{
/** Any Page decoded for this request */
- private Page< ? > page;
+ private Page<?> page;
/** the type safe request parameters object for this request. */
private RequestParameters requestParameters;
@@ -69,7 +69,7 @@
/**
* @return Any Page for this request
*/
- public Page< ? > getPage()
+ public Page<?> getPage()
{
return page;
}
@@ -201,7 +201,7 @@
* @param page
* The Page for this request
*/
- public void setPage(final Page page)
+ public void setPage(final Page<?> page)
{
this.page = page;
}
Modified:
wicket/trunk/wicket/src/main/java/org/apache/wicket/markup/html/form/AbstractTextComponent.java
URL:
http://svn.apache.org/viewvc/wicket/trunk/wicket/src/main/java/org/apache/wicket/markup/html/form/AbstractTextComponent.java?rev=660094&r1=660093&r2=660094&view=diff
==============================================================================
---
wicket/trunk/wicket/src/main/java/org/apache/wicket/markup/html/form/AbstractTextComponent.java
(original)
+++
wicket/trunk/wicket/src/main/java/org/apache/wicket/markup/html/form/AbstractTextComponent.java
Sun May 25 20:18:23 2008
@@ -77,7 +77,7 @@
/**
* @see org.apache.wicket.Component#Component(String, IModel)
*/
- public AbstractTextComponent(final String id, final IModel<?> model)
+ public AbstractTextComponent(final String id, final IModel<T> model)
{
super(id, model);
setConvertEmptyInputStringToNull(true);
Modified:
wicket/trunk/wicket/src/main/java/org/apache/wicket/markup/html/form/Check.java
URL:
http://svn.apache.org/viewvc/wicket/trunk/wicket/src/main/java/org/apache/wicket/markup/html/form/Check.java?rev=660094&r1=660093&r2=660094&view=diff
==============================================================================
---
wicket/trunk/wicket/src/main/java/org/apache/wicket/markup/html/form/Check.java
(original)
+++
wicket/trunk/wicket/src/main/java/org/apache/wicket/markup/html/form/Check.java
Sun May 25 20:18:23 2008
@@ -100,7 +100,8 @@
checkComponentTag(tag, "input");
checkComponentTagAttribute(tag, "type", "checkbox");
- CheckGroup<T> group = findParent(CheckGroup.class);
+ CheckGroup<?> group = findParent(CheckGroup.class);
+
if (group == null)
{
throw new WicketRuntimeException("Check component [" +
getPath() +
@@ -115,7 +116,7 @@
// check if the model collection of the group contains the
model object.
// if it does check the check box.
- Collection<? extends T> collection = group.getModelObject();
+ Collection<?> collection = group.getModelObject();
// check for npe in group's model object
if (collection == null)
Modified:
wicket/trunk/wicket/src/main/java/org/apache/wicket/markup/html/form/CheckBoxMultipleChoice.java
URL:
http://svn.apache.org/viewvc/wicket/trunk/wicket/src/main/java/org/apache/wicket/markup/html/form/CheckBoxMultipleChoice.java?rev=660094&r1=660093&r2=660094&view=diff
==============================================================================
---
wicket/trunk/wicket/src/main/java/org/apache/wicket/markup/html/form/CheckBoxMultipleChoice.java
(original)
+++
wicket/trunk/wicket/src/main/java/org/apache/wicket/markup/html/form/CheckBoxMultipleChoice.java
Sun May 25 20:18:23 2008
@@ -233,7 +233,7 @@
* @see org.apache.wicket.Component#Component(String)
* @see AbstractChoice#AbstractChoice(String,
org.apache.wicket.model.IModel)
*/
- public CheckBoxMultipleChoice(String id, IModel<List< ? extends T>>
choices)
+ public CheckBoxMultipleChoice(String id, IModel<List<? extends T>>
choices)
{
super(id, choices);
}
@@ -252,7 +252,7 @@
* @see org.apache.wicket.Component#Component(String,
org.apache.wicket.model.IModel)
*/
public CheckBoxMultipleChoice(String id, IModel<Collection<T>> model,
- IModel<List< ? extends T>> choices)
+ IModel<List<? extends T>> choices)
{
super(id, model, choices);
}
@@ -270,7 +270,7 @@
*
org.apache.wicket.model.IModel,org.apache.wicket.markup.html.form.IChoiceRenderer)
* @see org.apache.wicket.Component#Component(String)
*/
- public CheckBoxMultipleChoice(String id, IModel<List< ? extends T>>
choices,
+ public CheckBoxMultipleChoice(String id, IModel<List<? extends T>>
choices,
IChoiceRenderer<T> renderer)
{
super(id, choices, renderer);
@@ -293,7 +293,7 @@
*
org.apache.wicket.model.IModel,org.apache.wicket.markup.html.form.IChoiceRenderer)
*/
public CheckBoxMultipleChoice(String id, IModel<Collection<T>> model,
- IModel<List< ? extends T>> choices, IChoiceRenderer<T> renderer)
+ IModel<List<? extends T>> choices, IChoiceRenderer<T> renderer)
{
super(id, model, choices, renderer);
}
@@ -314,7 +314,7 @@
public final CheckBoxMultipleChoice<T> setPrefix(final String prefix)
{
// Tell the page that this component's prefix was changed
- final Page page = findPage();
+ final Page<?> page = findPage();
if (page != null)
{
addStateChange(new PrefixChange(this.prefix));
@@ -340,7 +340,7 @@
public final CheckBoxMultipleChoice<T> setSuffix(final String suffix)
{
// Tell the page that this component's suffix was changed
- final Page page = findPage();
+ final Page<?> page = findPage();
if (page != null)
{
addStateChange(new SuffixChange(this.suffix));
@@ -373,7 +373,7 @@
final ComponentTag openTag)
{
// Iterate through choices
- final List< ? extends T> choices = getChoices();
+ final List<? extends T> choices = getChoices();
// Buffer to hold generated body
final AppendingStringBuffer buffer = new
AppendingStringBuffer(70 * (choices.size() + 1));
@@ -388,7 +388,7 @@
final T choice = choices.get(index);
Object displayValue =
getChoiceRenderer().getDisplayValue(choice);
- Class objectClass = displayValue == null ? null :
displayValue.getClass();
+ Class<?> objectClass = displayValue == null ? null :
displayValue.getClass();
// Get label for choice
String label = "";
if (objectClass != null && objectClass != String.class)
@@ -459,7 +459,7 @@
/**
* Overridable method to determine whether the label markup should be
escaped.
*
- * @return
+ * @return true if label markup should be escaped
*/
protected boolean isEscapeLabelMarkup()
{
Modified:
wicket/trunk/wicket/src/main/java/org/apache/wicket/markup/html/form/CheckGroup.java
URL:
http://svn.apache.org/viewvc/wicket/trunk/wicket/src/main/java/org/apache/wicket/markup/html/form/CheckGroup.java?rev=660094&r1=660093&r2=660094&view=diff
==============================================================================
---
wicket/trunk/wicket/src/main/java/org/apache/wicket/markup/html/form/CheckGroup.java
(original)
+++
wicket/trunk/wicket/src/main/java/org/apache/wicket/markup/html/form/CheckGroup.java
Sun May 25 20:18:23 2008
@@ -57,9 +57,7 @@
* @param <T>
* The model object type
*/
-public class CheckGroup<T> extends FormComponent<Collection<? extends T>>
- implements
- IOnChangeListener
+public class CheckGroup<T> extends FormComponent<Collection<T>> implements
IOnChangeListener
{
private static final long serialVersionUID = 1L;
@@ -84,7 +82,7 @@
* collection to be used as the model
*
*/
- public CheckGroup(String id, Collection<? extends T> collection)
+ public CheckGroup(String id, Collection<T> collection)
{
this(id, new Model((Serializable)collection));
}
@@ -159,7 +157,7 @@
@Override
public void updateModel()
{
- Collection collection = getModelObject();
+ Collection<T> collection = getModelObject();
if (collection == null)
{
collection = getConvertedInput();
Modified:
wicket/trunk/wicket/src/main/java/org/apache/wicket/markup/html/form/Form.java
URL:
http://svn.apache.org/viewvc/wicket/trunk/wicket/src/main/java/org/apache/wicket/markup/html/form/Form.java?rev=660094&r1=660093&r2=660094&view=diff
==============================================================================
---
wicket/trunk/wicket/src/main/java/org/apache/wicket/markup/html/form/Form.java
(original)
+++
wicket/trunk/wicket/src/main/java/org/apache/wicket/markup/html/form/Form.java
Sun May 25 20:18:23 2008
@@ -526,7 +526,7 @@
* @param args
* argument replacement map for ${key} variables
*/
- public final void error(String error, Map args)
+ public final void error(String error, Map<String, Object> args)
{
error(new MapVariableInterpolator(error, args).toString());
}
@@ -639,12 +639,12 @@
Form<?> root = getRootForm();
return new
AppendingStringBuffer("document.getElementById('").append(
root.getHiddenFieldId()).append("').value='").append(url).append(
-
"';document.getElementById('").append(root.getJavascriptId()).append("').submit();");
+
"';document.getElementById('").append(root.getMarkupId()).append("').submit();");
}
/**
* Gets the maximum size for uploads. If null, the setting
- * [EMAIL PROTECTED]
IApplicationSettings#getDefaultMaximumUploadSize()} is used.
+ * [EMAIL PROTECTED]
IApplicationSettings#getDefaultMaximumUploadSize()} is
used.root.getJavascriptId()
*
* @return the maximum size
*/
@@ -1144,7 +1144,7 @@
* @param url
* The url which describes the component path and the
interface to be called.
*/
- private void dispatchEvent(final Page page, final String url)
+ private void dispatchEvent(final Page<?> page, final String url)
{
RequestCycle rc = RequestCycle.get();
IRequestCycleProcessor processor = rc.getProcessor();
@@ -1402,7 +1402,7 @@
*/
protected final String getHiddenFieldId()
{
- return getInputNamePrefix() + getJavascriptId() + "_hf_0";
+ return getInputNamePrefix() + getMarkupId() + "_hf_0";
}
/**
@@ -1660,7 +1660,7 @@
/**
*
- * @return
+ * @return true if form's method is 'get'
*/
protected boolean encodeUrlInHiddenFields()
{
@@ -1737,6 +1737,10 @@
/**
* Take URL-encoded query string value, unencode it and return
HTML-escaped version
+ *
+ * @param s
+ * value to reencode
+ * @return reencoded value
*/
private String recode(String s)
{
Modified:
wicket/trunk/wicket/src/main/java/org/apache/wicket/markup/html/form/FormComponent.java
URL:
http://svn.apache.org/viewvc/wicket/trunk/wicket/src/main/java/org/apache/wicket/markup/html/form/FormComponent.java?rev=660094&r1=660093&r2=660094&view=diff
==============================================================================
---
wicket/trunk/wicket/src/main/java/org/apache/wicket/markup/html/form/FormComponent.java
(original)
+++
wicket/trunk/wicket/src/main/java/org/apache/wicket/markup/html/form/FormComponent.java
Sun May 25 20:18:23 2008
@@ -233,17 +233,17 @@
* original params map
* @return new params map
*/
- private Map<String, String> addDefaultVars(Map params)
+ private Map<String, Object> addDefaultVars(Map<String, Object>
params)
{
// create and fill the new params map
- final HashMap<String, String> fullParams;
+ final HashMap<String, Object> fullParams;
if (params == null)
{
- fullParams = new HashMap<String, String>(6);
+ fullParams = new HashMap<String, Object>(6);
}
else
{
- fullParams = new HashMap<String,
String>(params.size() + 6);
+ fullParams = new HashMap<String,
Object>(params.size() + 6);
fullParams.putAll(params);
}
@@ -380,7 +380,7 @@
* @param visitor
* The visitor to call
*/
- public static final void visitFormComponentsPostOrder(Component
component,
+ public static final void visitFormComponentsPostOrder(Component<?>
component,
final FormComponent.IVisitor visitor)
{
if (visitor == null)
@@ -392,12 +392,12 @@
}
- private static final Object
visitFormComponentsPostOrderHelper(Component component,
+ private static final Object
visitFormComponentsPostOrderHelper(Component<?> component,
final FormComponent.IVisitor visitor)
{
if (component instanceof MarkupContainer)
{
- final MarkupContainer container =
(MarkupContainer)component;
+ final MarkupContainer<?> container =
(MarkupContainer<?>)component;
if (container.size() > 0)
{
boolean visitChildren = true;
@@ -407,10 +407,10 @@
}
if (visitChildren)
{
- final Iterator children =
container.iterator();
+ final Iterator<Component<?>> children =
container.iterator();
while (children.hasNext())
{
- final Component child =
(Component)children.next();
+ final Component<?> child =
children.next();
Object value =
visitFormComponentsPostOrderHelper(child, visitor);
if (value ==
Component.IVisitor.STOP_TRAVERSAL)
{
@@ -423,7 +423,7 @@
if (component instanceof FormComponent)
{
- final FormComponent fc = (FormComponent)component;
+ final FormComponent<?> fc = (FormComponent<?>)component;
return visitor.formComponent(fc);
}
@@ -462,7 +462,7 @@
/**
* @see org.apache.wicket.Component#Component(String, IModel)
*/
- public FormComponent(final String id, IModel model)
+ public FormComponent(final String id, IModel<T> model)
{
super(id, model);
// the form decides whether form components are versioned or not
@@ -581,7 +581,7 @@
buffer.append(" and error: ");
buffer.append(error.toString());
buffer.append(". Tried keys: ");
- Iterator/* <String> */keys =
source.triedKeys.iterator();
+ Iterator<String> keys = source.triedKeys.iterator();
while (keys.hasNext())
{
buffer.append(keys.next());
@@ -624,24 +624,24 @@
/**
* @return The parent form for this form component
*/
- public Form getForm()
+ public Form<?> getForm()
{
- class FindFormVisitor implements Component.IVisitor
+ class FindFormVisitor implements Component.IVisitor<Form<?>>
{
- Form form = null;
+ Form<?> form = null;
- public Object component(Component component)
+ public Object component(Form<?> component)
{
- form = (Form)component;
+ form = component;
return Component.IVisitor.STOP_TRAVERSAL;
}
}
- Form form = findParent(Form.class);
+ Form<?> form = findParent(Form.class);
if (form == null)
{
// check whether the form is a child of a surrounding
border
- final Border border = findParent(Border.class);
+ final Border<?> border = findParent(Border.class);
if (border != null)
{
FindFormVisitor formVisitor = new
FindFormVisitor();
@@ -710,12 +710,12 @@
// TODO: keep this in sync with AbstractSubmitLink#getInputName
String id = getId();
final PrependingStringBuffer inputName = new
PrependingStringBuffer(id.length());
- Component c = this;
+ Component<?> c = this;
while (true)
{
inputName.prepend(id);
c = c.getParent();
- if (c == null || (c instanceof Form &&
((Form)c).isRootForm()) || c instanceof Page)
+ if (c == null || (c instanceof Form &&
((Form<?>)c).isRootForm()) || c instanceof Page)
{
break;
}
@@ -729,7 +729,7 @@
{
inputName.prepend(Component.PATH_SEPARATOR);
}
- Form form = findParent(Form.class);
+ Form<?> form = findParent(Form.class);
if (form != null)
{
@@ -755,6 +755,7 @@
/**
* @return the type to use when updating the model for this form
component
*/
+ @SuppressWarnings("unchecked")
public final Class<T> getType()
{
return typeName == null ? null :
(Class<T>)Classes.resolveClass(typeName);
@@ -766,7 +767,7 @@
*/
public String getValidatorKeyPrefix()
{
- Form form = findParent(Form.class);
+ Form<?> form = findParent(Form.class);
if (form != null)
{
return getForm().getValidatorKeyPrefix();
@@ -921,7 +922,7 @@
public Object formComponent(IFormVisitorParticipant
formComponent)
{
- final FormComponent fc =
(FormComponent)formComponent;
+ final FormComponent<?> fc =
(FormComponent<?>)formComponent;
if (fc.hasErrorMessage())
{
valid = false;
@@ -972,7 +973,7 @@
* @param labelModel
* @return this for chaining
*/
- public FormComponent<T> setLabel(IModel labelModel)
+ public FormComponent<T> setLabel(IModel<String> labelModel)
{
setLabelInternal(labelModel);
return this;
@@ -1054,7 +1055,7 @@
* @param type
* @return this for chaining
*/
- public final FormComponent<T> setType(Class type)
+ public final FormComponent<T> setType(Class<?> type)
{
typeName = type == null ? null : type.getName();
if (type != null && type.isPrimitive())
@@ -1255,7 +1256,7 @@
error.setVariable("format",
((SimpleDateFormat)format).toLocalizedPattern());
}
- Map variables = e.getVariables();
+ Map<String, Object> variables = e.getVariables();
if (variables != null)
{
error.getVariables().putAll(variables);
@@ -1277,6 +1278,7 @@
* @throws ConversionException
* If input can't be converted
*/
+ @SuppressWarnings("unchecked")
protected T convertValue(String[] value) throws ConversionException
{
return (T)(value != null && value.length > 0 && value[0] !=
null ? trim(value[0]) : null);
Modified:
wicket/trunk/wicket/src/main/java/org/apache/wicket/markup/html/link/IPageLink.java
URL:
http://svn.apache.org/viewvc/wicket/trunk/wicket/src/main/java/org/apache/wicket/markup/html/link/IPageLink.java?rev=660094&r1=660093&r2=660094&view=diff
==============================================================================
---
wicket/trunk/wicket/src/main/java/org/apache/wicket/markup/html/link/IPageLink.java
(original)
+++
wicket/trunk/wicket/src/main/java/org/apache/wicket/markup/html/link/IPageLink.java
Sun May 25 20:18:23 2008
@@ -67,8 +67,6 @@
* }
* </pre>
*
- * @param <C>
- *
* @return The class of page linked to, as a form of identity
* @see Link#linksTo(Page)
*/
Modified:
wicket/trunk/wicket/src/main/java/org/apache/wicket/markup/html/list/ListView.java
URL:
http://svn.apache.org/viewvc/wicket/trunk/wicket/src/main/java/org/apache/wicket/markup/html/list/ListView.java?rev=660094&r1=660093&r2=660094&view=diff
==============================================================================
---
wicket/trunk/wicket/src/main/java/org/apache/wicket/markup/html/list/ListView.java
(original)
+++
wicket/trunk/wicket/src/main/java/org/apache/wicket/markup/html/list/ListView.java
Sun May 25 20:18:23 2008
@@ -429,23 +429,8 @@
*/
public ListView<T> setList(List<T> list)
{
- return setModel(new Model((Serializable)list));
- }
-
- /**
- * Sets the model and removes all current children, so that the next
render will be using the
- * contents of the model.
- *
- * @param model
- * The new model
- * @return This for chaining
- *
- * @see
org.apache.wicket.MarkupContainer#setModel(org.apache.wicket.model.IModel)
- */
- @Override
- public ListView<T> setModel(IModel<List<T>> model)
- {
- return (ListView<T>)super.setModel(model);
+ setModel(new Model((Serializable)list));
+ return this;
}
/**
@@ -539,6 +524,7 @@
/**
* @see org.apache.wicket.markup.repeater.AbstractRepeater#onPopulate()
*/
+ @SuppressWarnings("unchecked")
@Override
protected final void onPopulate()
{
@@ -553,7 +539,7 @@
for (final Iterator<Component<?>> iterator =
iterator(); iterator.hasNext();)
{
// Get next child component
- final ListItem<T> child =
(ListItem<T>)iterator.next();
+ final ListItem<?> child =
(ListItem<?>)iterator.next();
if (child != null)
{
final int index =
child.getIndex();
@@ -642,7 +628,7 @@
@Override
protected final void renderChild(Component<?> child)
{
- renderItem((ListItem<T>)child);
+ renderItem((ListItem<?>)child);
}
@@ -652,7 +638,7 @@
* @param item
* The item to be rendered
*/
- protected void renderItem(final ListItem<T> item)
+ protected void renderItem(final ListItem<?> item)
{
item.render(getMarkupStream());
}