You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by jd...@apache.org on 2008/04/12 16:31:28 UTC
svn commit: r647455 - in
/wicket/trunk/wicket/src/main/java/org/apache/wicket: application/
authorization/ authorization/strategies/ authorization/strategies/action/
authorization/strategies/page/ behavior/ feedback/
Author: jdonnerstag
Date: Sat Apr 12 07:31:25 2008
New Revision: 647455
URL: http://svn.apache.org/viewvc?rev=647455&view=rev
Log:
generics
Modified:
wicket/trunk/wicket/src/main/java/org/apache/wicket/application/IComponentOnAfterRenderListener.java
wicket/trunk/wicket/src/main/java/org/apache/wicket/application/IComponentOnBeforeRenderListener.java
wicket/trunk/wicket/src/main/java/org/apache/wicket/application/ReloadingClassLoader.java
wicket/trunk/wicket/src/main/java/org/apache/wicket/application/WildcardMatcherHelper.java
wicket/trunk/wicket/src/main/java/org/apache/wicket/authorization/IAuthorizationStrategy.java
wicket/trunk/wicket/src/main/java/org/apache/wicket/authorization/UnauthorizedActionException.java
wicket/trunk/wicket/src/main/java/org/apache/wicket/authorization/UnauthorizedInstantiationException.java
wicket/trunk/wicket/src/main/java/org/apache/wicket/authorization/strategies/CompoundAuthorizationStrategy.java
wicket/trunk/wicket/src/main/java/org/apache/wicket/authorization/strategies/action/ActionAuthorizationStrategy.java
wicket/trunk/wicket/src/main/java/org/apache/wicket/authorization/strategies/action/IActionAuthorizer.java
wicket/trunk/wicket/src/main/java/org/apache/wicket/authorization/strategies/page/AbstractPageAuthorizationStrategy.java
wicket/trunk/wicket/src/main/java/org/apache/wicket/authorization/strategies/page/SimplePageAuthorizationStrategy.java
wicket/trunk/wicket/src/main/java/org/apache/wicket/behavior/AbstractAjaxBehavior.java
wicket/trunk/wicket/src/main/java/org/apache/wicket/behavior/AttributeAppender.java
wicket/trunk/wicket/src/main/java/org/apache/wicket/behavior/HeaderContributor.java
wicket/trunk/wicket/src/main/java/org/apache/wicket/behavior/IActivePageBehaviorListener.java
wicket/trunk/wicket/src/main/java/org/apache/wicket/behavior/IBehaviorListener.java
wicket/trunk/wicket/src/main/java/org/apache/wicket/behavior/SimpleAttributeModifier.java
wicket/trunk/wicket/src/main/java/org/apache/wicket/behavior/StringHeaderContributor.java
wicket/trunk/wicket/src/main/java/org/apache/wicket/feedback/ComponentFeedbackMessageFilter.java
wicket/trunk/wicket/src/main/java/org/apache/wicket/feedback/ContainerFeedbackMessageFilter.java
wicket/trunk/wicket/src/main/java/org/apache/wicket/feedback/FeedbackMessage.java
wicket/trunk/wicket/src/main/java/org/apache/wicket/feedback/FeedbackMessages.java
wicket/trunk/wicket/src/main/java/org/apache/wicket/feedback/FeedbackMessagesModel.java
Modified: wicket/trunk/wicket/src/main/java/org/apache/wicket/application/IComponentOnAfterRenderListener.java
URL: http://svn.apache.org/viewvc/wicket/trunk/wicket/src/main/java/org/apache/wicket/application/IComponentOnAfterRenderListener.java?rev=647455&r1=647454&r2=647455&view=diff
==============================================================================
--- wicket/trunk/wicket/src/main/java/org/apache/wicket/application/IComponentOnAfterRenderListener.java (original)
+++ wicket/trunk/wicket/src/main/java/org/apache/wicket/application/IComponentOnAfterRenderListener.java Sat Apr 12 07:31:25 2008
@@ -31,5 +31,5 @@
* @param component
* the component that was just rendered
*/
- public void onAfterRender(Component component);
+ public void onAfterRender(Component< ? > component);
}
Modified: wicket/trunk/wicket/src/main/java/org/apache/wicket/application/IComponentOnBeforeRenderListener.java
URL: http://svn.apache.org/viewvc/wicket/trunk/wicket/src/main/java/org/apache/wicket/application/IComponentOnBeforeRenderListener.java?rev=647455&r1=647454&r2=647455&view=diff
==============================================================================
--- wicket/trunk/wicket/src/main/java/org/apache/wicket/application/IComponentOnBeforeRenderListener.java (original)
+++ wicket/trunk/wicket/src/main/java/org/apache/wicket/application/IComponentOnBeforeRenderListener.java Sat Apr 12 07:31:25 2008
@@ -32,5 +32,5 @@
* @param component
* the component that is about to be rendered
*/
- public void onBeforeRender(Component component);
+ public void onBeforeRender(Component< ? > component);
}
Modified: wicket/trunk/wicket/src/main/java/org/apache/wicket/application/ReloadingClassLoader.java
URL: http://svn.apache.org/viewvc/wicket/trunk/wicket/src/main/java/org/apache/wicket/application/ReloadingClassLoader.java?rev=647455&r1=647454&r2=647455&view=diff
==============================================================================
--- wicket/trunk/wicket/src/main/java/org/apache/wicket/application/ReloadingClassLoader.java (original)
+++ wicket/trunk/wicket/src/main/java/org/apache/wicket/application/ReloadingClassLoader.java Sat Apr 12 07:31:25 2008
@@ -44,9 +44,28 @@
{
private static final Logger log = LoggerFactory.getLogger(ReloadingClassLoader.class);
- private static final Set urls = new HashSet();
- private static final List patterns = new ArrayList();
+ private static final Set<URL> urls = new HashSet<URL>();
+ private static final List<String> patterns = new ArrayList<String>();
+
+ private IChangeListener listener;
+
+ private final Duration pollFrequency = Duration.seconds(3);
+
+ private final ModificationWatcher watcher;
+
+ static
+ {
+ addClassLoaderUrls(ReloadingClassLoader.class.getClassLoader());
+ excludePattern("org.apache.wicket.*");
+ includePattern("org.apache.wicket.examples.*");
+ }
+
+ /**
+ *
+ * @param name
+ * @return
+ */
protected boolean tryClassHere(String name)
{
// don't include classes in the java or javax.servlet package
@@ -66,10 +85,10 @@
{
// See if it matches include patterns
tryHere = false;
- Iterator includesIterator = patterns.iterator();
+ Iterator<String> includesIterator = patterns.iterator();
while (includesIterator.hasNext())
{
- String rawpattern = (String)includesIterator.next();
+ String rawpattern = includesIterator.next();
if (rawpattern.length() <= 1)
{
continue;
@@ -113,7 +132,7 @@
*
* @return list of patterns as String
*/
- public static List getPatterns()
+ public static List<String> getPatterns()
{
return patterns;
}
@@ -134,7 +153,7 @@
*
* @return list of locations as URL
*/
- public static Set getLocations()
+ public static Set<URL> getLocations()
{
return urls;
}
@@ -166,19 +185,6 @@
}
}
- private IChangeListener listener;
-
- private final Duration pollFrequency = Duration.seconds(3);
-
- private final ModificationWatcher watcher;
-
- static
- {
- addClassLoaderUrls(ReloadingClassLoader.class.getClassLoader());
- excludePattern("org.apache.wicket.*");
- includePattern("org.apache.wicket.examples.*");
- }
-
/**
* Create a new reloading ClassLoader from a list of URLs, and initialize the
* ModificationWatcher to detect class file modifications
@@ -193,9 +199,9 @@
// probably doubles from this class, but just in case
addClassLoaderUrls(parent);
- for (Iterator i = urls.iterator(); i.hasNext();)
+ for (Iterator<URL> iter = urls.iterator(); iter.hasNext();)
{
- addURL((URL)i.next());
+ addURL(iter.next());
}
watcher = new ModificationWatcher(pollFrequency);
}
@@ -209,6 +215,7 @@
*
* @param name of resource
*/
+ @Override
public final URL getResource(final String name)
{
URL resource = findResource(name);
@@ -234,10 +241,11 @@
* @return the resulting <code>Class</code> object
* @exception ClassNotFoundException if the class could not be found
*/
- public final Class loadClass(String name, boolean resolve) throws ClassNotFoundException
+ @Override
+ public final Class< ? > loadClass(String name, boolean resolve) throws ClassNotFoundException
{
// First check if it's already loaded
- Class clazz = findLoadedClass(name);
+ Class< ? > clazz = findLoadedClass(name);
if (clazz == null)
{
@@ -300,18 +308,18 @@
* @param clz
* the class to watch
*/
- private void watchForModifications(Class clz)
+ private void watchForModifications(Class< ? > clz)
{
// Watch class in the future
- Iterator locationsIterator = urls.iterator();
+ Iterator<URL> locationsIterator = urls.iterator();
File clzFile = null;
while (locationsIterator.hasNext())
{
// FIXME only works for directories, but JARs etc could be checked
// as well
- URL location = (URL)locationsIterator.next();
+ URL location = locationsIterator.next();
String clzLocation = location.getFile() + clz.getName().replaceAll("\\.", "/") +
- ".class";
+ ".class";
log.debug("clzLocation=" + clzLocation);
clzFile = new File(clzLocation);
final File finalClzFile = clzFile;
Modified: wicket/trunk/wicket/src/main/java/org/apache/wicket/application/WildcardMatcherHelper.java
URL: http://svn.apache.org/viewvc/wicket/trunk/wicket/src/main/java/org/apache/wicket/application/WildcardMatcherHelper.java?rev=647455&r1=647454&r2=647455&view=diff
==============================================================================
--- wicket/trunk/wicket/src/main/java/org/apache/wicket/application/WildcardMatcherHelper.java (original)
+++ wicket/trunk/wicket/src/main/java/org/apache/wicket/application/WildcardMatcherHelper.java Sat Apr 12 07:31:25 2008
@@ -80,7 +80,7 @@
* with "1" for the left most, "2" for the next, a.s.o. The key "0" is the string
* itself. If the return value is null, string does not match to the pattern .
*/
- public static Map match(final String pat, final String str)
+ public static Map<String, String> match(final String pat, final String str)
{
final Matcher map = new Matcher(pat, str);
@@ -116,7 +116,7 @@
private final int lstr;
/** The <code>Map</code> to be filled */
- private final Map map = new HashMap();
+ private final Map<String, String> map = new HashMap<String, String>();
/** Whether string matched to pattern */
private final boolean matched;
@@ -159,7 +159,7 @@
*
* @return DOCUMENT ME!
*/
- public Map getMap()
+ public Map<String, String> getMap()
{
return map;
}
@@ -325,8 +325,8 @@
final int sipat = ipat;
while (ipat < lpat && apat[ipat] != STAR &&
- (apat[ipat] != ESC || ipat < lpat - 1 && apat[ipat + 1] != STAR) &&
- apat[ipat] != PATHSEP)
+ (apat[ipat] != ESC || ipat < lpat - 1 && apat[ipat + 1] != STAR) &&
+ apat[ipat] != PATHSEP)
{
ipat++;
}
@@ -376,10 +376,9 @@
{
// scan a common literal suffix
while (ipat < lpat &&
- istr < lstr &&
- (apat[ipat] == ESC && ipat < lpat - 1 && apat[ipat + 1] == STAR &&
- apat[++ipat] == astr[istr] || apat[ipat] != STAR &&
- apat[ipat] == astr[istr]))
+ istr < lstr &&
+ (apat[ipat] == ESC && ipat < lpat - 1 && apat[ipat + 1] == STAR &&
+ apat[++ipat] == astr[istr] || apat[ipat] != STAR && apat[ipat] == astr[istr]))
{
ipat++;
istr++;
@@ -403,7 +402,7 @@
* @return Whether the all the mentioned characters match each other
*/
private final boolean strncmp(final char[] a1, final int o1, final char[] a2, final int o2,
- final int l)
+ final int l)
{
int i = 0;
Modified: wicket/trunk/wicket/src/main/java/org/apache/wicket/authorization/IAuthorizationStrategy.java
URL: http://svn.apache.org/viewvc/wicket/trunk/wicket/src/main/java/org/apache/wicket/authorization/IAuthorizationStrategy.java?rev=647455&r1=647454&r2=647455&view=diff
==============================================================================
--- wicket/trunk/wicket/src/main/java/org/apache/wicket/authorization/IAuthorizationStrategy.java (original)
+++ wicket/trunk/wicket/src/main/java/org/apache/wicket/authorization/IAuthorizationStrategy.java Sat Apr 12 07:31:25 2008
@@ -40,7 +40,7 @@
/**
* @see org.apache.wicket.authorization.IAuthorizationStrategy#isInstantiationAuthorized(java.lang.Class)
*/
- public boolean isInstantiationAuthorized(final Class c)
+ public boolean isInstantiationAuthorized(final Class< ? extends Component> c)
{
return true;
}
@@ -49,7 +49,7 @@
* @see org.apache.wicket.authorization.IAuthorizationStrategy#isActionAuthorized(org.apache.wicket.Component,
* org.apache.wicket.authorization.Action)
*/
- public boolean isActionAuthorized(Component c, Action action)
+ public boolean isActionAuthorized(Component< ? > c, Action action)
{
return true;
}
@@ -70,7 +70,7 @@
* The component class to check
* @return Whether the given component may be created
*/
- boolean isInstantiationAuthorized(Class componentClass);
+ boolean isInstantiationAuthorized(Class< ? extends Component> componentClass);
/**
* Gets whether the given action is permitted. If it is, this method should return true. If it
@@ -88,5 +88,5 @@
* @see Component#ENABLE
* @see Component#RENDER
*/
- boolean isActionAuthorized(Component component, Action action);
+ boolean isActionAuthorized(Component< ? > component, Action action);
}
Modified: wicket/trunk/wicket/src/main/java/org/apache/wicket/authorization/UnauthorizedActionException.java
URL: http://svn.apache.org/viewvc/wicket/trunk/wicket/src/main/java/org/apache/wicket/authorization/UnauthorizedActionException.java?rev=647455&r1=647454&r2=647455&view=diff
==============================================================================
--- wicket/trunk/wicket/src/main/java/org/apache/wicket/authorization/UnauthorizedActionException.java (original)
+++ wicket/trunk/wicket/src/main/java/org/apache/wicket/authorization/UnauthorizedActionException.java Sat Apr 12 07:31:25 2008
@@ -32,7 +32,7 @@
private final Action action;
/** The component that caused the unauthorized exception */
- private final Component component;
+ private final Component< ? > component;
/**
* Construct.
@@ -42,7 +42,7 @@
* @param action
* The action
*/
- public UnauthorizedActionException(Component component, Action action)
+ public UnauthorizedActionException(Component< ? > component, Action action)
{
super("Component " + component + " does not permit action " + action);
this.component = component;
@@ -60,7 +60,7 @@
/**
* @return The component that caused the unauthorized exception
*/
- public Component getComponent()
+ public Component< ? > getComponent()
{
return component;
}
Modified: wicket/trunk/wicket/src/main/java/org/apache/wicket/authorization/UnauthorizedInstantiationException.java
URL: http://svn.apache.org/viewvc/wicket/trunk/wicket/src/main/java/org/apache/wicket/authorization/UnauthorizedInstantiationException.java?rev=647455&r1=647454&r2=647455&view=diff
==============================================================================
--- wicket/trunk/wicket/src/main/java/org/apache/wicket/authorization/UnauthorizedInstantiationException.java (original)
+++ wicket/trunk/wicket/src/main/java/org/apache/wicket/authorization/UnauthorizedInstantiationException.java Sat Apr 12 07:31:25 2008
@@ -16,6 +16,7 @@
*/
package org.apache.wicket.authorization;
+import org.apache.wicket.Component;
import org.apache.wicket.util.lang.Classes;
/**
@@ -37,16 +38,16 @@
* @param componentClass
* The unauthorized component class
*/
- public UnauthorizedInstantiationException(final Class componentClass)
+ public UnauthorizedInstantiationException(final Class< ? extends Component> componentClass)
{
super("Not authorized to instantiate class " + componentClass.getName());
- this.componentClassName = componentClass.getName();
+ componentClassName = componentClass.getName();
}
/**
* @return The component class that could not be instantiated
*/
- public Class getComponentClass()
+ public Class< ? extends Component> getComponentClass()
{
return Classes.resolveClass(componentClassName);
}
Modified: wicket/trunk/wicket/src/main/java/org/apache/wicket/authorization/strategies/CompoundAuthorizationStrategy.java
URL: http://svn.apache.org/viewvc/wicket/trunk/wicket/src/main/java/org/apache/wicket/authorization/strategies/CompoundAuthorizationStrategy.java?rev=647455&r1=647454&r2=647455&view=diff
==============================================================================
--- wicket/trunk/wicket/src/main/java/org/apache/wicket/authorization/strategies/CompoundAuthorizationStrategy.java (original)
+++ wicket/trunk/wicket/src/main/java/org/apache/wicket/authorization/strategies/CompoundAuthorizationStrategy.java Sat Apr 12 07:31:25 2008
@@ -17,6 +17,7 @@
package org.apache.wicket.authorization.strategies;
import java.util.ArrayList;
+import java.util.List;
import org.apache.wicket.Component;
import org.apache.wicket.authorization.Action;
@@ -32,7 +33,7 @@
public class CompoundAuthorizationStrategy implements IAuthorizationStrategy
{
/** List of strategies to consult */
- private final ArrayList strategies = new ArrayList();
+ private final List<IAuthorizationStrategy> strategies = new ArrayList<IAuthorizationStrategy>();
/**
* Adds a strategy to the chain
@@ -52,12 +53,12 @@
/**
* @see org.apache.wicket.authorization.IAuthorizationStrategy#isInstantiationAuthorized(java.lang.Class)
*/
- public final boolean isInstantiationAuthorized(Class componentClass)
+ public final boolean isInstantiationAuthorized(Class< ? extends Component> componentClass)
{
int size = strategies.size();
for (int i = 0; i < size; i++)
{
- IAuthorizationStrategy strategy = (IAuthorizationStrategy)strategies.get(i);
+ IAuthorizationStrategy strategy = strategies.get(i);
if (!strategy.isInstantiationAuthorized(componentClass))
{
return false;
@@ -70,12 +71,12 @@
* @see org.apache.wicket.authorization.IAuthorizationStrategy#isActionAuthorized(org.apache.wicket.Component,
* org.apache.wicket.authorization.Action)
*/
- public final boolean isActionAuthorized(Component component, Action action)
+ public final boolean isActionAuthorized(Component< ? > component, Action action)
{
int size = strategies.size();
for (int i = 0; i < size; i++)
{
- IAuthorizationStrategy strategy = (IAuthorizationStrategy)strategies.get(i);
+ IAuthorizationStrategy strategy = strategies.get(i);
if (!strategy.isActionAuthorized(component, action))
{
return false;
Modified: wicket/trunk/wicket/src/main/java/org/apache/wicket/authorization/strategies/action/ActionAuthorizationStrategy.java
URL: http://svn.apache.org/viewvc/wicket/trunk/wicket/src/main/java/org/apache/wicket/authorization/strategies/action/ActionAuthorizationStrategy.java?rev=647455&r1=647454&r2=647455&view=diff
==============================================================================
--- wicket/trunk/wicket/src/main/java/org/apache/wicket/authorization/strategies/action/ActionAuthorizationStrategy.java (original)
+++ wicket/trunk/wicket/src/main/java/org/apache/wicket/authorization/strategies/action/ActionAuthorizationStrategy.java Sat Apr 12 07:31:25 2008
@@ -34,7 +34,7 @@
public class ActionAuthorizationStrategy implements IAuthorizationStrategy
{
/** Map from Action keys to IActionAuthorizer implementations. */
- private final Map actionAuthorizerForAction = new HashMap();
+ private final Map<Action, IActionAuthorizer> actionAuthorizerForAction = new HashMap<Action, IActionAuthorizer>();
/**
* Adds an action authorizer.
@@ -50,7 +50,7 @@
/**
* @see org.apache.wicket.authorization.IAuthorizationStrategy#isInstantiationAuthorized(java.lang.Class)
*/
- public boolean isInstantiationAuthorized(Class componentClass)
+ public boolean isInstantiationAuthorized(Class< ? extends Component> componentClass)
{
return true;
}
@@ -59,9 +59,9 @@
* @see org.apache.wicket.authorization.IAuthorizationStrategy#isActionAuthorized(org.apache.wicket.Component,
* org.apache.wicket.authorization.Action)
*/
- public boolean isActionAuthorized(Component component, Action action)
+ public boolean isActionAuthorized(Component< ? > component, Action action)
{
- IActionAuthorizer authorizer = (IActionAuthorizer)actionAuthorizerForAction.get(action);
+ IActionAuthorizer authorizer = actionAuthorizerForAction.get(action);
if (authorizer != null)
{
return authorizer.authorizeAction(component);
Modified: wicket/trunk/wicket/src/main/java/org/apache/wicket/authorization/strategies/action/IActionAuthorizer.java
URL: http://svn.apache.org/viewvc/wicket/trunk/wicket/src/main/java/org/apache/wicket/authorization/strategies/action/IActionAuthorizer.java?rev=647455&r1=647454&r2=647455&view=diff
==============================================================================
--- wicket/trunk/wicket/src/main/java/org/apache/wicket/authorization/strategies/action/IActionAuthorizer.java (original)
+++ wicket/trunk/wicket/src/main/java/org/apache/wicket/authorization/strategies/action/IActionAuthorizer.java Sat Apr 12 07:31:25 2008
@@ -42,5 +42,5 @@
* The component to authorize this action on
* @return True if this action is authorized
*/
- boolean authorizeAction(Component component);
+ boolean authorizeAction(Component< ? > component);
}
Modified: wicket/trunk/wicket/src/main/java/org/apache/wicket/authorization/strategies/page/AbstractPageAuthorizationStrategy.java
URL: http://svn.apache.org/viewvc/wicket/trunk/wicket/src/main/java/org/apache/wicket/authorization/strategies/page/AbstractPageAuthorizationStrategy.java?rev=647455&r1=647454&r2=647455&view=diff
==============================================================================
--- wicket/trunk/wicket/src/main/java/org/apache/wicket/authorization/strategies/page/AbstractPageAuthorizationStrategy.java (original)
+++ wicket/trunk/wicket/src/main/java/org/apache/wicket/authorization/strategies/page/AbstractPageAuthorizationStrategy.java Sat Apr 12 07:31:25 2008
@@ -35,7 +35,7 @@
* @see org.apache.wicket.authorization.IAuthorizationStrategy#isActionAuthorized(org.apache.wicket.Component,
* org.apache.wicket.authorization.Action)
*/
- public boolean isActionAuthorized(final Component component, final Action action)
+ public boolean isActionAuthorized(final Component< ? > component, final Action action)
{
return true;
}
@@ -43,11 +43,11 @@
/**
* @see org.apache.wicket.authorization.IAuthorizationStrategy#isInstantiationAuthorized(java.lang.Class)
*/
- public final boolean isInstantiationAuthorized(final Class/* <Component> */componentClass)
+ public final boolean isInstantiationAuthorized(final Class< ? extends Component> componentClass)
{
if (instanceOf(componentClass, Page.class))
{
- return isPageAuthorized(componentClass);
+ return isPageAuthorized((Class< ? extends Page>)componentClass);
}
return true;
}
@@ -62,7 +62,7 @@
* The interface or superclass that the type needs to implement or extend
* @return True if the type is an instance of the superType
*/
- protected boolean instanceOf(final Class type, final Class superType)
+ protected boolean instanceOf(final Class< ? > type, final Class< ? > superType)
{
return superType.isAssignableFrom(type);
}
@@ -74,7 +74,7 @@
* The Page class
* @return True if to page may be created
*/
- protected boolean isPageAuthorized(Class/* <Page> */pageClass)
+ protected boolean isPageAuthorized(Class< ? extends Page> pageClass)
{
return true;
}
Modified: wicket/trunk/wicket/src/main/java/org/apache/wicket/authorization/strategies/page/SimplePageAuthorizationStrategy.java
URL: http://svn.apache.org/viewvc/wicket/trunk/wicket/src/main/java/org/apache/wicket/authorization/strategies/page/SimplePageAuthorizationStrategy.java?rev=647455&r1=647454&r2=647455&view=diff
==============================================================================
--- wicket/trunk/wicket/src/main/java/org/apache/wicket/authorization/strategies/page/SimplePageAuthorizationStrategy.java (original)
+++ wicket/trunk/wicket/src/main/java/org/apache/wicket/authorization/strategies/page/SimplePageAuthorizationStrategy.java Sat Apr 12 07:31:25 2008
@@ -37,7 +37,7 @@
*
* <pre>
* SimplePageAuthorizationStrategy authorizationStrategy = new SimplePageAuthorizationStrategy(
- * MySecureWebPage.class, MySignInPage.class)
+ * MySecureWebPage.class, MySignInPage.class)
* {
* protected boolean isAuthorized()
* {
@@ -57,7 +57,7 @@
/**
* The supertype (class or interface) of Pages that require authorization to be instantiated.
*/
- private final WeakReference/* <Class> */securePageSuperTypeRef;
+ private final WeakReference<Class< ? extends Component>> securePageSuperTypeRef;
/**
* Construct.
@@ -68,45 +68,46 @@
* @param signInPageClass
* The sign in page class
*/
- public SimplePageAuthorizationStrategy(final Class securePageSuperType,
- final Class signInPageClass)
+ public SimplePageAuthorizationStrategy(final Class< ? extends Component> securePageSuperType,
+ final Class< ? extends Page> signInPageClass)
{
if (securePageSuperType == null)
{
throw new IllegalArgumentException("Secure page super type must not be null");
}
- this.securePageSuperTypeRef = new WeakReference(securePageSuperType);
+ securePageSuperTypeRef = new WeakReference<Class< ? extends Component>>(securePageSuperType);
// Handle unauthorized access to pages
Application.get().getSecuritySettings().setUnauthorizedComponentInstantiationListener(
- new IUnauthorizedComponentInstantiationListener()
+ new IUnauthorizedComponentInstantiationListener()
+ {
+ public void onUnauthorizedInstantiation(final Component< ? > component)
{
- public void onUnauthorizedInstantiation(final Component component)
+ // If there is a sign in page class declared, and the
+ // unauthorized component is a page, but it's not the
+ // sign in page
+ if (component instanceof Page)
{
- // If there is a sign in page class declared, and the
- // unauthorized component is a page, but it's not the
- // sign in page
- if (component instanceof Page)
- {
- // Redirect to page to let the user sign in
- throw new RestartResponseAtInterceptPageException(signInPageClass);
- }
- else
- {
- // The component was not a page, so throw exception
- throw new UnauthorizedInstantiationException(component.getClass());
- }
+ // Redirect to page to let the user sign in
+ throw new RestartResponseAtInterceptPageException(signInPageClass);
}
- });
+ else
+ {
+ // The component was not a page, so throw exception
+ throw new UnauthorizedInstantiationException(component.getClass());
+ }
+ }
+ });
}
/**
* @see org.apache.wicket.authorization.strategies.page.AbstractPageAuthorizationStrategy#isPageAuthorized(java.lang.Class)
*/
- protected boolean isPageAuthorized(final Class pageClass)
+ @Override
+ protected boolean isPageAuthorized(final Class< ? extends Page> pageClass)
{
- if (instanceOf(pageClass, (Class)securePageSuperTypeRef.get()))
+ if (instanceOf(pageClass, securePageSuperTypeRef.get()))
{
return isAuthorized();
}
Modified: wicket/trunk/wicket/src/main/java/org/apache/wicket/behavior/AbstractAjaxBehavior.java
URL: http://svn.apache.org/viewvc/wicket/trunk/wicket/src/main/java/org/apache/wicket/behavior/AbstractAjaxBehavior.java?rev=647455&r1=647454&r2=647455&view=diff
==============================================================================
--- wicket/trunk/wicket/src/main/java/org/apache/wicket/behavior/AbstractAjaxBehavior.java (original)
+++ wicket/trunk/wicket/src/main/java/org/apache/wicket/behavior/AbstractAjaxBehavior.java Sat Apr 12 07:31:25 2008
@@ -40,8 +40,9 @@
*
*/
private static final long serialVersionUID = 1L;
+
/** the component that this handler is bound to. */
- private Component component;
+ private Component< ? > component;
/**
* Construct.
@@ -56,7 +57,8 @@
* @param hostComponent
* the component to bind to
*/
- public final void bind(final Component hostComponent)
+ @Override
+ public final void bind(final Component< ? > hostComponent)
{
if (hostComponent == null)
{
@@ -68,7 +70,6 @@
throw new IllegalStateException("this kind of handler cannot be attached to " +
"multiple components; it is already attached to component " + component +
", but component " + hostComponent + " wants to be attached too");
-
}
component = hostComponent;
@@ -127,7 +128,8 @@
* @see org.apache.wicket.behavior.IBehavior#onComponentTag(org.apache.wicket.Component,
* org.apache.wicket.markup.ComponentTag)
*/
- public final void onComponentTag(final Component component, final ComponentTag tag)
+ @Override
+ public final void onComponentTag(final Component< ? > component, final ComponentTag tag)
{
onComponentTag(tag);
}
@@ -135,7 +137,8 @@
/**
* @see org.apache.wicket.behavior.AbstractBehavior#onRendered(org.apache.wicket.Component)
*/
- public final void onRendered(final Component hostComponent)
+ @Override
+ public final void onRendered(final Component< ? > hostComponent)
{
onComponentRendered();
}
@@ -143,6 +146,7 @@
/**
* @see org.apache.wicket.markup.html.IHeaderContributor#renderHead(IHeaderResponse)
*/
+ @Override
public void renderHead(final IHeaderResponse response)
{
}
@@ -152,7 +156,7 @@
*
* @return the component that this handler is bound to
*/
- protected final Component getComponent()
+ protected final Component< ? > getComponent()
{
return component;
}
@@ -187,24 +191,36 @@
/**
* @see org.apache.wicket.behavior.AbstractBehavior#getStatelessHint(Component)
*/
- public boolean getStatelessHint(Component component)
+ @Override
+ public boolean getStatelessHint(Component< ? > component)
{
return false;
}
-
// TODO the next three methods will be removed with next commit. Here as
// final to help with refactoring
+ /**
+ *
+ * @return
+ */
protected final String getImplementationId()
{
return "foo";
}
+ /**
+ *
+ * @param response
+ */
protected final void onRenderHeadContribution(final Response response)
{
}
+ /**
+ *
+ * @param response
+ */
protected final void onRenderHeadInitContribution(final Response response)
{
}
Modified: wicket/trunk/wicket/src/main/java/org/apache/wicket/behavior/AttributeAppender.java
URL: http://svn.apache.org/viewvc/wicket/trunk/wicket/src/main/java/org/apache/wicket/behavior/AttributeAppender.java?rev=647455&r1=647454&r2=647455&view=diff
==============================================================================
--- wicket/trunk/wicket/src/main/java/org/apache/wicket/behavior/AttributeAppender.java (original)
+++ wicket/trunk/wicket/src/main/java/org/apache/wicket/behavior/AttributeAppender.java Sat Apr 12 07:31:25 2008
@@ -69,7 +69,7 @@
* the separator string, comes between the original value and the append value
*/
public AttributeAppender(String attribute, boolean addAttributeIfNotPresent,
- IModel appendModel, String separator)
+ IModel< ? > appendModel, String separator)
{
super(attribute, addAttributeIfNotPresent, appendModel);
this.separator = separator;
@@ -86,7 +86,7 @@
* @param separator
* the separator string, comes between the original value and the append value
*/
- public AttributeAppender(String attribute, IModel appendModel, String separator)
+ public AttributeAppender(String attribute, IModel< ? > appendModel, String separator)
{
super(attribute, true, appendModel);
this.separator = separator;
@@ -95,6 +95,7 @@
/**
* @see org.apache.wicket.AttributeModifier#newValue(java.lang.String, java.lang.String)
*/
+ @Override
protected String newValue(String currentValue, String appendValue)
{
final int appendValueLen = (appendValue == null) ? 0 : appendValue.length();
@@ -107,7 +108,7 @@
else
{
sb = new AppendingStringBuffer(currentValue.length() + appendValueLen +
- separator.length());
+ separator.length());
sb.append(currentValue);
}
Modified: wicket/trunk/wicket/src/main/java/org/apache/wicket/behavior/HeaderContributor.java
URL: http://svn.apache.org/viewvc/wicket/trunk/wicket/src/main/java/org/apache/wicket/behavior/HeaderContributor.java?rev=647455&r1=647454&r2=647455&view=diff
==============================================================================
--- wicket/trunk/wicket/src/main/java/org/apache/wicket/behavior/HeaderContributor.java (original)
+++ wicket/trunk/wicket/src/main/java/org/apache/wicket/behavior/HeaderContributor.java Sat Apr 12 07:31:25 2008
@@ -52,7 +52,7 @@
* The path
* @return the new header contributor instance
*/
- public static final HeaderContributor forCss(final Class scope, final String path)
+ public static final HeaderContributor forCss(final Class< ? > scope, final String path)
{
return new HeaderContributor(new IHeaderContributor()
{
@@ -78,7 +78,7 @@
* The media type for this CSS ("print", "screen", etc.)
* @return the new header contributor instance
*/
- public static final HeaderContributor forCss(final Class scope, final String path,
+ public static final HeaderContributor forCss(final Class< ? > scope, final String path,
final String media)
{
return new HeaderContributor(new IHeaderContributor()
@@ -203,7 +203,7 @@
* The path
* @return the new header contributor instance
*/
- public static final HeaderContributor forJavaScript(final Class scope, final String path)
+ public static final HeaderContributor forJavaScript(final Class< ? > scope, final String path)
{
return new HeaderContributor(new IHeaderContributor()
{
@@ -303,6 +303,7 @@
/**
* @see org.apache.wicket.behavior.AbstractHeaderContributor#getHeaderContributors()
*/
+ @Override
public final IHeaderContributor[] getHeaderContributors()
{
return new IHeaderContributor[] { headerContributor };
Modified: wicket/trunk/wicket/src/main/java/org/apache/wicket/behavior/IActivePageBehaviorListener.java
URL: http://svn.apache.org/viewvc/wicket/trunk/wicket/src/main/java/org/apache/wicket/behavior/IActivePageBehaviorListener.java?rev=647455&r1=647454&r2=647455&view=diff
==============================================================================
--- wicket/trunk/wicket/src/main/java/org/apache/wicket/behavior/IActivePageBehaviorListener.java (original)
+++ wicket/trunk/wicket/src/main/java/org/apache/wicket/behavior/IActivePageBehaviorListener.java Sat Apr 12 07:31:25 2008
@@ -33,11 +33,19 @@
*/
public interface IActivePageBehaviorListener extends IBehaviorListener
{
+ /** */
public static final RequestListenerInterface INTERFACE = new RequestListenerInterface(
- IActivePageBehaviorListener.class)
+ IActivePageBehaviorListener.class)
{
- public IRequestTarget newRequestTarget(Page page, Component component,
- RequestListenerInterface listener, RequestParameters requestParameters)
+ /**
+ *
+ * @see org.apache.wicket.RequestListenerInterface#newRequestTarget(org.apache.wicket.Page,
+ * org.apache.wicket.Component, org.apache.wicket.RequestListenerInterface,
+ * org.apache.wicket.request.RequestParameters)
+ */
+ @Override
+ public IRequestTarget newRequestTarget(Page page, Component< ? > component,
+ RequestListenerInterface listener, RequestParameters requestParameters)
{
return new BehaviorRequestTarget(page, component, listener, requestParameters);
}
Modified: wicket/trunk/wicket/src/main/java/org/apache/wicket/behavior/IBehaviorListener.java
URL: http://svn.apache.org/viewvc/wicket/trunk/wicket/src/main/java/org/apache/wicket/behavior/IBehaviorListener.java?rev=647455&r1=647454&r2=647455&view=diff
==============================================================================
--- wicket/trunk/wicket/src/main/java/org/apache/wicket/behavior/IBehaviorListener.java (original)
+++ wicket/trunk/wicket/src/main/java/org/apache/wicket/behavior/IBehaviorListener.java Sat Apr 12 07:31:25 2008
@@ -36,10 +36,17 @@
{
/** Behavior listener interface */
public static final RequestListenerInterface INTERFACE = new RequestListenerInterface(
- IBehaviorListener.class)
+ IBehaviorListener.class)
{
- public IRequestTarget newRequestTarget(Page page, Component component,
- RequestListenerInterface listener, RequestParameters requestParameters)
+ /**
+ *
+ * @see org.apache.wicket.RequestListenerInterface#newRequestTarget(org.apache.wicket.Page,
+ * org.apache.wicket.Component, org.apache.wicket.RequestListenerInterface,
+ * org.apache.wicket.request.RequestParameters)
+ */
+ @Override
+ public IRequestTarget newRequestTarget(Page page, Component< ? > component,
+ RequestListenerInterface listener, RequestParameters requestParameters)
{
return new BehaviorRequestTarget(page, component, listener, requestParameters);
}
Modified: wicket/trunk/wicket/src/main/java/org/apache/wicket/behavior/SimpleAttributeModifier.java
URL: http://svn.apache.org/viewvc/wicket/trunk/wicket/src/main/java/org/apache/wicket/behavior/SimpleAttributeModifier.java?rev=647455&r1=647454&r2=647455&view=diff
==============================================================================
--- wicket/trunk/wicket/src/main/java/org/apache/wicket/behavior/SimpleAttributeModifier.java (original)
+++ wicket/trunk/wicket/src/main/java/org/apache/wicket/behavior/SimpleAttributeModifier.java Sat Apr 12 07:31:25 2008
@@ -79,6 +79,7 @@
* @return true
* @deprecated use isEnabled(Component) now.
*/
+ @Deprecated
public final boolean isEnabled()
{
return true;
@@ -88,7 +89,8 @@
* @see org.apache.wicket.behavior.AbstractBehavior#onComponentTag(org.apache.wicket.Component,
* org.apache.wicket.markup.ComponentTag)
*/
- public void onComponentTag(final Component component, final ComponentTag tag)
+ @Override
+ public void onComponentTag(final Component< ? > component, final ComponentTag tag)
{
if (isEnabled(component))
{
Modified: wicket/trunk/wicket/src/main/java/org/apache/wicket/behavior/StringHeaderContributor.java
URL: http://svn.apache.org/viewvc/wicket/trunk/wicket/src/main/java/org/apache/wicket/behavior/StringHeaderContributor.java?rev=647455&r1=647454&r2=647455&view=diff
==============================================================================
--- wicket/trunk/wicket/src/main/java/org/apache/wicket/behavior/StringHeaderContributor.java (original)
+++ wicket/trunk/wicket/src/main/java/org/apache/wicket/behavior/StringHeaderContributor.java Sat Apr 12 07:31:25 2008
@@ -45,7 +45,7 @@
private static final long serialVersionUID = 1L;
/** The contribution as a model that returns a plain string. */
- private final IModel contribution;
+ private final IModel< ? > contribution;
/**
* Construct.
@@ -60,7 +60,7 @@
throw new IllegalArgumentException("argument contribition must be not null");
}
- this.contribution = new Model(contribution);
+ this.contribution = new Model<String>(contribution);
}
/**
@@ -69,7 +69,7 @@
* @param contribution
* The contribution as a model that returns a plain string
*/
- public StringContributor(IModel contribution)
+ public StringContributor(IModel< ? > contribution)
{
if (contribution == null)
{
@@ -94,6 +94,7 @@
/**
* @see java.lang.Object#hashCode()
*/
+ @Override
public int hashCode()
{
Object object = contribution.getObject();
@@ -103,6 +104,7 @@
/**
* @see java.lang.Object#equals(java.lang.Object)
*/
+ @Override
public boolean equals(Object obj)
{
if (obj instanceof StringContributor)
@@ -117,6 +119,7 @@
/**
* @see java.lang.Object#toString()
*/
+ @Override
public String toString()
{
return "StringContributor[contribution=" + contribution + "]";
@@ -140,7 +143,7 @@
* @param contribution
* header contribution as a model that returns a plain string
*/
- public StringHeaderContributor(IModel contribution)
+ public StringHeaderContributor(IModel< ? > contribution)
{
contributor = new StringContributor(contribution);
}
@@ -148,6 +151,7 @@
/**
* @see org.apache.wicket.behavior.AbstractHeaderContributor#getHeaderContributors()
*/
+ @Override
public final IHeaderContributor[] getHeaderContributors()
{
return new IHeaderContributor[] { contributor };
@@ -156,7 +160,8 @@
/**
* @see org.apache.wicket.behavior.AbstractBehavior#detach(org.apache.wicket.Component)
*/
- public void detach(Component component)
+ @Override
+ public void detach(Component< ? > component)
{
contributor.contribution.detach();
}
@@ -164,6 +169,7 @@
/**
* @see java.lang.Object#toString()
*/
+ @Override
public String toString()
{
Object string = contributor.contribution.getObject();
Modified: wicket/trunk/wicket/src/main/java/org/apache/wicket/feedback/ComponentFeedbackMessageFilter.java
URL: http://svn.apache.org/viewvc/wicket/trunk/wicket/src/main/java/org/apache/wicket/feedback/ComponentFeedbackMessageFilter.java?rev=647455&r1=647454&r2=647455&view=diff
==============================================================================
--- wicket/trunk/wicket/src/main/java/org/apache/wicket/feedback/ComponentFeedbackMessageFilter.java (original)
+++ wicket/trunk/wicket/src/main/java/org/apache/wicket/feedback/ComponentFeedbackMessageFilter.java Sat Apr 12 07:31:25 2008
@@ -29,7 +29,7 @@
private static final long serialVersionUID = 1L;
/** The component to accept feedback messages for */
- private final Component component;
+ private final Component< ? > component;
/**
* Constructor
@@ -37,7 +37,7 @@
* @param component
* The component to filter on
*/
- public ComponentFeedbackMessageFilter(Component component)
+ public ComponentFeedbackMessageFilter(Component< ? > component)
{
this.component = component;
}
Modified: wicket/trunk/wicket/src/main/java/org/apache/wicket/feedback/ContainerFeedbackMessageFilter.java
URL: http://svn.apache.org/viewvc/wicket/trunk/wicket/src/main/java/org/apache/wicket/feedback/ContainerFeedbackMessageFilter.java?rev=647455&r1=647454&r2=647455&view=diff
==============================================================================
--- wicket/trunk/wicket/src/main/java/org/apache/wicket/feedback/ContainerFeedbackMessageFilter.java (original)
+++ wicket/trunk/wicket/src/main/java/org/apache/wicket/feedback/ContainerFeedbackMessageFilter.java Sat Apr 12 07:31:25 2008
@@ -28,7 +28,7 @@
{
private static final long serialVersionUID = 1L;
- private final MarkupContainer container;
+ private final MarkupContainer< ? > container;
/**
* Constructor
@@ -36,7 +36,7 @@
* @param container
* The container that message reporters must be a child of
*/
- public ContainerFeedbackMessageFilter(MarkupContainer container)
+ public ContainerFeedbackMessageFilter(MarkupContainer< ? > container)
{
if (container == null)
{
@@ -57,7 +57,7 @@
else
{
return container.contains(message.getReporter(), true) ||
- container == message.getReporter();
+ container == message.getReporter();
}
}
}
Modified: wicket/trunk/wicket/src/main/java/org/apache/wicket/feedback/FeedbackMessage.java
URL: http://svn.apache.org/viewvc/wicket/trunk/wicket/src/main/java/org/apache/wicket/feedback/FeedbackMessage.java?rev=647455&r1=647454&r2=647455&view=diff
==============================================================================
--- wicket/trunk/wicket/src/main/java/org/apache/wicket/feedback/FeedbackMessage.java (original)
+++ wicket/trunk/wicket/src/main/java/org/apache/wicket/feedback/FeedbackMessage.java Sat Apr 12 07:31:25 2008
@@ -56,7 +56,7 @@
public static final int WARNING = 300;
/** Levels as strings for debugging. */
- private static final Map levelStrings = new HashMap();
+ private static final Map<Integer, String> levelStrings = new HashMap<Integer, String>();
static
{
@@ -79,7 +79,7 @@
private final Serializable message;
/** The reporting component. */
- private final Component reporter;
+ private final Component< ? > reporter;
/** Whether or not this message has been rendered */
private boolean rendered = false;
@@ -94,7 +94,8 @@
* @param level
* The level of the message
*/
- public FeedbackMessage(final Component reporter, final Serializable message, final int level)
+ public FeedbackMessage(final Component< ? > reporter, final Serializable message,
+ final int level)
{
this.reporter = reporter;
this.message = message;
@@ -139,7 +140,7 @@
*/
public String getLevelAsString()
{
- return (String)levelStrings.get(new Integer(getLevel()));
+ return levelStrings.get(new Integer(getLevel()));
}
/**
@@ -157,7 +158,7 @@
*
* @return the reporting component.
*/
- public final Component getReporter()
+ public final Component< ? > getReporter()
{
return reporter;
}
@@ -237,10 +238,11 @@
/**
* @see java.lang.Object#toString()
*/
+ @Override
public String toString()
{
return "[FeedbackMessage message = \"" + getMessage() + "\", reporter = " +
- ((getReporter() == null) ? "null" : getReporter().getId()) + ", level = " +
- getLevelAsString() + "]";
+ ((getReporter() == null) ? "null" : getReporter().getId()) + ", level = " +
+ getLevelAsString() + "]";
}
}
Modified: wicket/trunk/wicket/src/main/java/org/apache/wicket/feedback/FeedbackMessages.java
URL: http://svn.apache.org/viewvc/wicket/trunk/wicket/src/main/java/org/apache/wicket/feedback/FeedbackMessages.java?rev=647455&r1=647454&r2=647455&view=diff
==============================================================================
--- wicket/trunk/wicket/src/main/java/org/apache/wicket/feedback/FeedbackMessages.java (original)
+++ wicket/trunk/wicket/src/main/java/org/apache/wicket/feedback/FeedbackMessages.java Sat Apr 12 07:31:25 2008
@@ -66,7 +66,7 @@
* @param message
* @param level
*/
- public final void add(Component reporter, String message, int level)
+ public final void add(Component< ? > reporter, String message, int level)
{
add(new FeedbackMessage(reporter, message, level));
}
@@ -111,7 +111,7 @@
* @param message
* the actual message
*/
- public final void debug(Component reporter, String message)
+ public final void debug(Component< ? > reporter, String message)
{
add(new FeedbackMessage(reporter, message, FeedbackMessage.DEBUG));
}
@@ -124,7 +124,7 @@
* @param message
* the actual message
*/
- public final void error(Component reporter, Serializable message)
+ public final void error(Component< ? > reporter, Serializable message)
{
add(new FeedbackMessage(reporter, message, FeedbackMessage.ERROR));
}
@@ -137,7 +137,7 @@
* @param message
* the actual message
*/
- public final void fatal(Component reporter, String message)
+ public final void fatal(Component< ? > reporter, String message)
{
add(new FeedbackMessage(reporter, message, FeedbackMessage.FATAL));
}
@@ -150,7 +150,7 @@
* the component to look up whether it registered a message
* @return whether the given component registered a message with this list with level ERROR
*/
- public final boolean hasErrorMessageFor(Component component)
+ public final boolean hasErrorMessageFor(Component< ? > component)
{
return hasMessageFor(component, FeedbackMessage.ERROR);
}
@@ -172,7 +172,7 @@
* the component to look up whether it registered a message
* @return whether the given component registered a message with this list
*/
- public final boolean hasMessageFor(Component component)
+ public final boolean hasMessageFor(Component< ? > component)
{
return messageForComponent(component) != null;
}
@@ -187,7 +187,7 @@
* The level of the message
* @return Whether the given component registered a message with this list with the given level
*/
- public final boolean hasMessageFor(Component component, int level)
+ public final boolean hasMessageFor(Component< ? > component, int level)
{
final FeedbackMessage message = messageForComponent(component);
return message != null && message.isLevel(level);
@@ -201,7 +201,7 @@
* @param message
* The actual message
*/
- public final void info(Component reporter, String message)
+ public final void info(Component< ? > reporter, String message)
{
add(new FeedbackMessage(reporter, message, FeedbackMessage.INFO));
}
@@ -234,7 +234,7 @@
* @return the message that is found for the given component (first match) or null if none was
* found
*/
- public final FeedbackMessage messageForComponent(final Component component)
+ public final FeedbackMessage messageForComponent(final Component< ? > component)
{
for (Iterator<FeedbackMessage> iterator = messages.iterator(); iterator.hasNext();)
{
@@ -333,7 +333,7 @@
* @param message
* the actual message
*/
- public final void warn(Component reporter, String message)
+ public final void warn(Component< ? > reporter, String message)
{
add(new FeedbackMessage(reporter, message, FeedbackMessage.WARNING));
}
Modified: wicket/trunk/wicket/src/main/java/org/apache/wicket/feedback/FeedbackMessagesModel.java
URL: http://svn.apache.org/viewvc/wicket/trunk/wicket/src/main/java/org/apache/wicket/feedback/FeedbackMessagesModel.java?rev=647455&r1=647454&r2=647455&view=diff
==============================================================================
--- wicket/trunk/wicket/src/main/java/org/apache/wicket/feedback/FeedbackMessagesModel.java (original)
+++ wicket/trunk/wicket/src/main/java/org/apache/wicket/feedback/FeedbackMessagesModel.java Sat Apr 12 07:31:25 2008
@@ -32,7 +32,7 @@
*
* @author Eelco Hillenius
*/
-public class FeedbackMessagesModel implements IModel
+public class FeedbackMessagesModel implements IModel<List<FeedbackMessage>>
{
private static final long serialVersionUID = 1L;
@@ -40,10 +40,10 @@
private IFeedbackMessageFilter filter;
/** Lazy loaded, temporary list. */
- private transient List messages;
+ private transient List<FeedbackMessage> messages;
/** Comparator used for sorting the messages. */
- private Comparator sortingComparator;
+ private Comparator<FeedbackMessage> sortingComparator;
/**
* Constructor. Creates a model for all feedback messages on the page.
@@ -52,7 +52,7 @@
* The component where the page will be get from for which messages will be displayed
* usually the same page as the one feedbackpanel is attached to
*/
- public FeedbackMessagesModel(Component component)
+ public FeedbackMessagesModel(Component< ? > component)
{
if (component == null)
{
@@ -87,7 +87,7 @@
/**
* @return The current sorting comparator
*/
- public final Comparator getSortingComparator()
+ public final Comparator<FeedbackMessage> getSortingComparator()
{
return sortingComparator;
}
@@ -95,7 +95,7 @@
/**
* @see org.apache.wicket.model.IModel#getObject()
*/
- public final Object getObject()
+ public final List<FeedbackMessage> getObject()
{
if (messages == null)
{
@@ -136,7 +136,8 @@
* comparator used for sorting the messages
* @return this
*/
- public final FeedbackMessagesModel setSortingComparator(Comparator sortingComparator)
+ public final FeedbackMessagesModel setSortingComparator(
+ Comparator<FeedbackMessage> sortingComparator)
{
if (!(sortingComparator instanceof Serializable))
{
@@ -153,7 +154,7 @@
* List of sorted and filtered FeedbackMessages for further processing
* @return The processed FeedbackMessage list
*/
- protected List processMessages(final List messages)
+ protected List<FeedbackMessage> processMessages(final List<FeedbackMessage> messages)
{
return messages;
}
@@ -162,7 +163,7 @@
*
* @see org.apache.wicket.model.IModel#setObject(java.lang.Object)
*/
- public void setObject(Object object)
+ public void setObject(List<FeedbackMessage> object)
{
}