[jira] Commented: (WICKET-3265) Component data_remove returns Object which is never used

2010-12-17 Thread Igor Vaynberg (JIRA)

[ 
https://issues.apache.org/jira/browse/WICKET-3265?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12972751#action_12972751
 ] 

Igor Vaynberg commented on WICKET-3265:
---

bleh. i wouldve left it as it is. it didnt hurt anything. i never use the 
boolean returned from collection.remove, but its still there for the rare case 
i would need it.

> Component data_remove returns Object which is never used
> 
>
> Key: WICKET-3265
> URL: https://issues.apache.org/jira/browse/WICKET-3265
> Project: Wicket
>  Issue Type: Improvement
>  Components: wicket
>Affects Versions: 1.5-M3
> Environment: All
>Reporter: Richard Emberson
>Assignee: Jeremy Thomerson
>Priority: Trivial
> Fix For: 1.4.15, 1.5-M4
>
>
> The Component method data_remove has the signature:
> private Object data_remove(int position)
> It returns an Object and it is private.
> Only three places call data_remove in Component and none of them use
> the return value.
> Simplify the code in data_remove so that it does not return the data
> being removed.
> At some future time, one can always call data_get if one really needs the 
> value prior to removing it.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.



[jira] Commented: (WICKET-3264) MetaDataEntry set method traverses metaData even after key is found and data set/cleared

2010-12-17 Thread Hudson (JIRA)

[ 
https://issues.apache.org/jira/browse/WICKET-3264?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12972740#action_12972740
 ] 

Hudson commented on WICKET-3264:


Integrated in Apache Wicket 1.4.x #342 (See 
[https://hudson.apache.org/hudson/job/Apache%20Wicket%201.4.x/342/])


> MetaDataEntry set method traverses metaData even after key is found and data 
> set/cleared
> 
>
> Key: WICKET-3264
> URL: https://issues.apache.org/jira/browse/WICKET-3264
> Project: Wicket
>  Issue Type: Improvement
>  Components: wicket
>Affects Versions: 1.5-M3
> Environment: all
>Reporter: Richard Emberson
>Priority: Trivial
>
> The for-loop in the MetaDataKey set method has a break statement that is only 
> called if  metaData is set to null. The break statement should be after the 
> set = true;
> statement.
> Why? from what I can tell, per-key, data can only be entered into the 
> MetaDataEntry
> array once. The data is added only if isSet == false, and this happens only 
> if the
> key is not found in the array.
> Also, he get method only returns the first entry found for a given key so
> it makes no sense to actually have more than one entry.
> So, change from:
> else
> {
>   metaData = null;
>   break;
> }
>   }
>   set = true;
> }
> to:
> else
> {
>   metaData = null;
> }
>   }
>   set = true;
>   break;
> }
> I've made the change on my copy and all of the tests pass.
> If a user is directly playing with the data Object,
> Object data = null;
> in Component rather than using the given methods, then all bets are off 
> anyway.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.



svn commit: r1050583 - /wicket/trunk/wicket/src/test/java/org/apache/wicket/markup/html/DecoratingHeaderResponseTest.java

2010-12-17 Thread pedro
Author: pedro
Date: Sat Dec 18 03:53:29 2010
New Revision: 1050583

URL: http://svn.apache.org/viewvc?rev=1050583&view=rev
Log:
porting the DecoratingHeaderResponseTest to trunk

Added:

wicket/trunk/wicket/src/test/java/org/apache/wicket/markup/html/DecoratingHeaderResponseTest.java
   (with props)

Added: 
wicket/trunk/wicket/src/test/java/org/apache/wicket/markup/html/DecoratingHeaderResponseTest.java
URL: 
http://svn.apache.org/viewvc/wicket/trunk/wicket/src/test/java/org/apache/wicket/markup/html/DecoratingHeaderResponseTest.java?rev=1050583&view=auto
==
--- 
wicket/trunk/wicket/src/test/java/org/apache/wicket/markup/html/DecoratingHeaderResponseTest.java
 (added)
+++ 
wicket/trunk/wicket/src/test/java/org/apache/wicket/markup/html/DecoratingHeaderResponseTest.java
 Sat Dec 18 03:53:29 2010
@@ -0,0 +1,166 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.wicket.markup.html;
+
+import java.io.IOException;
+import java.text.ParseException;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.wicket.MarkupContainer;
+import org.apache.wicket.WicketTestCase;
+import org.apache.wicket.markup.IMarkupResourceStreamProvider;
+import org.apache.wicket.markup.parser.XmlPullParser;
+import org.apache.wicket.markup.parser.XmlTag;
+import org.apache.wicket.request.resource.PackageResourceReference;
+import org.apache.wicket.request.resource.ResourceReference;
+import 
org.apache.wicket.resource.aggregation.AbstractResourceAggregatingHeaderResponse;
+import org.apache.wicket.resource.aggregation.ResourceReferenceAndStringData;
+import org.apache.wicket.resource.aggregation.ResourceReferenceCollection;
+import org.apache.wicket.util.resource.IResourceStream;
+import org.apache.wicket.util.resource.ResourceStreamNotFoundException;
+import org.apache.wicket.util.resource.StringResourceStream;
+
+/**
+ * @author Pedro Santos
+ */
+public class DecoratingHeaderResponseTest extends WicketTestCase
+{
+
+   /**
+* Basic IHeaderResponseDecorator, just prepending the DECORATED string 
to resource name.
+* 
+* @throws IOException
+* @throws ResourceStreamNotFoundException
+* @throws ParseException
+*/
+   public void testDecoratedStringPrepend() throws IOException, 
ResourceStreamNotFoundException,
+   ParseException
+   {
+   tester.getApplication().setHeaderResponseDecorator(new 
IHeaderResponseDecorator()
+   {
+   public IHeaderResponse decorate(IHeaderResponse 
response)
+   {
+   return new DecoratingHeaderResponse(response)
+   {
+   @Override
+   public void 
renderJavaScriptReference(ResourceReference reference, String id)
+   {
+   
super.renderJavaScriptReference(new PackageResourceReference("DECORATED-" +
+   reference.getName()), 
id);
+   }
+   };
+   }
+   });
+   tester.startPage(TestPage.class);
+   XmlPullParser parser = new XmlPullParser();
+   parser.parse(tester.getLastResponseAsString());
+   XmlTag tag = (XmlTag)parser.nextTag();
+   boolean isDecorated = false;
+   do
+   {
+   if (tag.isOpen() && "script".equals(tag.getName()))
+   {
+   isDecorated = 
tag.getString("src").toString().contains("DECORATED");
+   if (!isDecorated)
+   {
+   fail();
+   }
+   break;
+   }
+   }
+   while ((tag = (XmlTag)parser.nextTag()) != null);
+   assertTrue(isDecorated);
+   }
+
+   /**
+* Test

svn commit: r1050582 - in /wicket/branches/wicket-1.4.x/wicket/src/test/java/org/apache/wicket/markup/html: DecoratingHeaderResponseTest.java TestDecoratingHeaderResponse.java

2010-12-17 Thread pedro
Author: pedro
Date: Sat Dec 18 03:52:29 2010
New Revision: 1050582

URL: http://svn.apache.org/viewvc?rev=1050582&view=rev
Log:
renaming

Added:

wicket/branches/wicket-1.4.x/wicket/src/test/java/org/apache/wicket/markup/html/DecoratingHeaderResponseTest.java
  - copied, changed from r1050581, 
wicket/branches/wicket-1.4.x/wicket/src/test/java/org/apache/wicket/markup/html/TestDecoratingHeaderResponse.java
Removed:

wicket/branches/wicket-1.4.x/wicket/src/test/java/org/apache/wicket/markup/html/TestDecoratingHeaderResponse.java

Copied: 
wicket/branches/wicket-1.4.x/wicket/src/test/java/org/apache/wicket/markup/html/DecoratingHeaderResponseTest.java
 (from r1050581, 
wicket/branches/wicket-1.4.x/wicket/src/test/java/org/apache/wicket/markup/html/TestDecoratingHeaderResponse.java)
URL: 
http://svn.apache.org/viewvc/wicket/branches/wicket-1.4.x/wicket/src/test/java/org/apache/wicket/markup/html/DecoratingHeaderResponseTest.java?p2=wicket/branches/wicket-1.4.x/wicket/src/test/java/org/apache/wicket/markup/html/DecoratingHeaderResponseTest.java&p1=wicket/branches/wicket-1.4.x/wicket/src/test/java/org/apache/wicket/markup/html/TestDecoratingHeaderResponse.java&r1=1050581&r2=1050582&rev=1050582&view=diff
==
--- 
wicket/branches/wicket-1.4.x/wicket/src/test/java/org/apache/wicket/markup/html/TestDecoratingHeaderResponse.java
 (original)
+++ 
wicket/branches/wicket-1.4.x/wicket/src/test/java/org/apache/wicket/markup/html/DecoratingHeaderResponseTest.java
 Sat Dec 18 03:52:29 2010
@@ -37,7 +37,7 @@ import org.apache.wicket.util.resource.S
 /**
  * @author Pedro Santos
  */
-public class TestDecoratingHeaderResponse extends WicketTestCase
+public class DecoratingHeaderResponseTest extends WicketTestCase
 {
 
/**




svn commit: r1050581 - in /wicket/trunk/wicket/src/main/java/org/apache/wicket/resource/aggregation: AbstractDependencyRespectingResourceAggregatingHeaderResponse.java AbstractResourceAggregatingHeade

2010-12-17 Thread jrthomerson
Author: jrthomerson
Date: Sat Dec 18 03:32:37 2010
New Revision: 1050581

URL: http://svn.apache.org/viewvc?rev=1050581&view=rev
Log:
slight improvement to api of AbstractResourceAggregatingHeaderResponse.java

Modified:

wicket/trunk/wicket/src/main/java/org/apache/wicket/resource/aggregation/AbstractDependencyRespectingResourceAggregatingHeaderResponse.java

wicket/trunk/wicket/src/main/java/org/apache/wicket/resource/aggregation/AbstractResourceAggregatingHeaderResponse.java

Modified: 
wicket/trunk/wicket/src/main/java/org/apache/wicket/resource/aggregation/AbstractDependencyRespectingResourceAggregatingHeaderResponse.java
URL: 
http://svn.apache.org/viewvc/wicket/trunk/wicket/src/main/java/org/apache/wicket/resource/aggregation/AbstractDependencyRespectingResourceAggregatingHeaderResponse.java?rev=1050581&r1=1050580&r2=1050581&view=diff
==
--- 
wicket/trunk/wicket/src/main/java/org/apache/wicket/resource/aggregation/AbstractDependencyRespectingResourceAggregatingHeaderResponse.java
 (original)
+++ 
wicket/trunk/wicket/src/main/java/org/apache/wicket/resource/aggregation/AbstractDependencyRespectingResourceAggregatingHeaderResponse.java
 Sat Dec 18 03:32:37 2010
@@ -66,7 +66,7 @@ public abstract class AbstractDependency
if (ref instanceof 
AbstractResourceDependentResourceReference)
{
AbstractResourceDependentResourceReference 
parent = (AbstractResourceDependentResourceReference)ref;
-   R childColl = newResourceReferenceCollection();
+   R childColl = 
newResourceReferenceCollection(key);
for (AbstractResourceDependentResourceReference 
child : parent.getDependentResourceReferences())
{
childColl.add(toData(child));

Modified: 
wicket/trunk/wicket/src/main/java/org/apache/wicket/resource/aggregation/AbstractResourceAggregatingHeaderResponse.java
URL: 
http://svn.apache.org/viewvc/wicket/trunk/wicket/src/main/java/org/apache/wicket/resource/aggregation/AbstractResourceAggregatingHeaderResponse.java?rev=1050581&r1=1050580&r2=1050581&view=diff
==
--- 
wicket/trunk/wicket/src/main/java/org/apache/wicket/resource/aggregation/AbstractResourceAggregatingHeaderResponse.java
 (original)
+++ 
wicket/trunk/wicket/src/main/java/org/apache/wicket/resource/aggregation/AbstractResourceAggregatingHeaderResponse.java
 Sat Dec 18 03:32:37 2010
@@ -46,10 +46,10 @@ import org.apache.wicket.resource.Resour
  * @author Jeremy Thomerson
  * @param 
  *the type of ResourceReferenceCollection returned by
- *{...@link #newResourceReferenceCollection()} and passed to all 
the methods that take a
- *ResourceReferenceCollection. You will typically just use 
ResourceReferenceCollection
- *for this param, unless you are returning a specific type of
- *ResourceReferenceCollection from your subclass.
+ *{...@link #newResourceReferenceCollection(Object)} and passed to 
all the methods that
+ *take a ResourceReferenceCollection. You will typically just use
+ *ResourceReferenceCollection for this param, unless you are 
returning a specific type
+ *of ResourceReferenceCollection from your subclass.
  * @param 
  *the class of the key that you will create from
  *{...@link #newGroupingKey(ResourceReferenceAndStringData)}
@@ -107,7 +107,7 @@ public abstract class AbstractResourceAg
R coll = map.get(key);
if (coll == null)
{
-   map.put(key, coll = 
newResourceReferenceCollection());
+   map.put(key, coll = 
newResourceReferenceCollection(key));
}
coll.add(ref);
}
@@ -135,10 +135,13 @@ public abstract class AbstractResourceAg
 * parameter used when creating your subclass defining the type of 
ResourceReferenceCollection
 * this returns and is passed into all methods that take a 
ResourceReferenceCollection
 * 
+* @param key
+*the grouping key that will be used for this collection. 
all references added to it
+*will have the same key
 * @return a newly created collection to contain resource references
 */
@SuppressWarnings("unchecked")
-   protected R newResourceReferenceCollection()
+   protected R newResourceReferenceCollection(K key)
{
return (R)new ResourceReferenceCollection();
}




[jira] Commented: (WICKET-3265) Component data_remove returns Object which is never used

2010-12-17 Thread Hudson (JIRA)

[ 
https://issues.apache.org/jira/browse/WICKET-3265?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12972731#action_12972731
 ] 

Hudson commented on WICKET-3265:


Integrated in Apache Wicket 1.4.x #340 (See 
[https://hudson.apache.org/hudson/job/Apache%20Wicket%201.4.x/340/])
fixes WICKET-3265 for 1.4.x branch


> Component data_remove returns Object which is never used
> 
>
> Key: WICKET-3265
> URL: https://issues.apache.org/jira/browse/WICKET-3265
> Project: Wicket
>  Issue Type: Improvement
>  Components: wicket
>Affects Versions: 1.5-M3
> Environment: All
>Reporter: Richard Emberson
>Assignee: Jeremy Thomerson
>Priority: Trivial
> Fix For: 1.4.15, 1.5-M4
>
>
> The Component method data_remove has the signature:
> private Object data_remove(int position)
> It returns an Object and it is private.
> Only three places call data_remove in Component and none of them use
> the return value.
> Simplify the code in data_remove so that it does not return the data
> being removed.
> At some future time, one can always call data_get if one really needs the 
> value prior to removing it.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.



svn commit: r1050571 - /wicket/branches/wicket-1.4.x/wicket/src/main/java/org/apache/wicket/MetaDataKey.java

2010-12-17 Thread jrthomerson
Author: jrthomerson
Date: Sat Dec 18 02:26:00 2010
New Revision: 1050571

URL: http://svn.apache.org/viewvc?rev=1050571&view=rev
Log:
fixes WICKET-3264

Modified:

wicket/branches/wicket-1.4.x/wicket/src/main/java/org/apache/wicket/MetaDataKey.java

Modified: 
wicket/branches/wicket-1.4.x/wicket/src/main/java/org/apache/wicket/MetaDataKey.java
URL: 
http://svn.apache.org/viewvc/wicket/branches/wicket-1.4.x/wicket/src/main/java/org/apache/wicket/MetaDataKey.java?rev=1050571&r1=1050570&r2=1050571&view=diff
==
--- 
wicket/branches/wicket-1.4.x/wicket/src/main/java/org/apache/wicket/MetaDataKey.java
 (original)
+++ 
wicket/branches/wicket-1.4.x/wicket/src/main/java/org/apache/wicket/MetaDataKey.java
 Sat Dec 18 02:26:00 2010
@@ -117,10 +117,10 @@ public abstract class MetaDataKey imp
else
{
metaData = null;
-   break;
}
}
set = true;
+   break;
}
}
}




svn commit: r1050570 - /wicket/trunk/wicket/src/main/java/org/apache/wicket/MetaDataKey.java

2010-12-17 Thread jrthomerson
Author: jrthomerson
Date: Sat Dec 18 02:25:51 2010
New Revision: 1050570

URL: http://svn.apache.org/viewvc?rev=1050570&view=rev
Log:
fixes WICKET-3264

Modified:
wicket/trunk/wicket/src/main/java/org/apache/wicket/MetaDataKey.java

Modified: wicket/trunk/wicket/src/main/java/org/apache/wicket/MetaDataKey.java
URL: 
http://svn.apache.org/viewvc/wicket/trunk/wicket/src/main/java/org/apache/wicket/MetaDataKey.java?rev=1050570&r1=1050569&r2=1050570&view=diff
==
--- wicket/trunk/wicket/src/main/java/org/apache/wicket/MetaDataKey.java 
(original)
+++ wicket/trunk/wicket/src/main/java/org/apache/wicket/MetaDataKey.java Sat 
Dec 18 02:25:51 2010
@@ -70,7 +70,7 @@ public abstract class MetaDataKey imp
{
if (equals(entry.key))
{
-   return (T) entry.object;
+   return (T)entry.object;
}
}
}
@@ -113,10 +113,10 @@ public abstract class MetaDataKey imp
else
{
metaData = null;
-   break;
}
}
set = true;
+   break;
}
}
}




[jira] Assigned: (WICKET-3265) Component data_remove returns Object which is never used

2010-12-17 Thread Jeremy Thomerson (JIRA)

 [ 
https://issues.apache.org/jira/browse/WICKET-3265?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Jeremy Thomerson reassigned WICKET-3265:


Assignee: Jeremy Thomerson

> Component data_remove returns Object which is never used
> 
>
> Key: WICKET-3265
> URL: https://issues.apache.org/jira/browse/WICKET-3265
> Project: Wicket
>  Issue Type: Improvement
>  Components: wicket
>Affects Versions: 1.5-M3
> Environment: All
>Reporter: Richard Emberson
>Assignee: Jeremy Thomerson
>Priority: Trivial
> Fix For: 1.4.15, 1.5-M4
>
>
> The Component method data_remove has the signature:
> private Object data_remove(int position)
> It returns an Object and it is private.
> Only three places call data_remove in Component and none of them use
> the return value.
> Simplify the code in data_remove so that it does not return the data
> being removed.
> At some future time, one can always call data_get if one really needs the 
> value prior to removing it.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.



[jira] Resolved: (WICKET-3265) Component data_remove returns Object which is never used

2010-12-17 Thread Jeremy Thomerson (JIRA)

 [ 
https://issues.apache.org/jira/browse/WICKET-3265?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Jeremy Thomerson resolved WICKET-3265.
--

   Resolution: Fixed
Fix Version/s: 1.5-M4
   1.4.15

good observation.  thanks

> Component data_remove returns Object which is never used
> 
>
> Key: WICKET-3265
> URL: https://issues.apache.org/jira/browse/WICKET-3265
> Project: Wicket
>  Issue Type: Improvement
>  Components: wicket
>Affects Versions: 1.5-M3
> Environment: All
>Reporter: Richard Emberson
>Assignee: Jeremy Thomerson
>Priority: Trivial
> Fix For: 1.4.15, 1.5-M4
>
>
> The Component method data_remove has the signature:
> private Object data_remove(int position)
> It returns an Object and it is private.
> Only three places call data_remove in Component and none of them use
> the return value.
> Simplify the code in data_remove so that it does not return the data
> being removed.
> At some future time, one can always call data_get if one really needs the 
> value prior to removing it.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.



svn commit: r1050569 - /wicket/trunk/wicket/src/main/java/org/apache/wicket/Component.java

2010-12-17 Thread jrthomerson
Author: jrthomerson
Date: Sat Dec 18 02:09:40 2010
New Revision: 1050569

URL: http://svn.apache.org/viewvc?rev=1050569&view=rev
Log:
fixes WICKET-3265 for trunk

Modified:
wicket/trunk/wicket/src/main/java/org/apache/wicket/Component.java

Modified: wicket/trunk/wicket/src/main/java/org/apache/wicket/Component.java
URL: 
http://svn.apache.org/viewvc/wicket/trunk/wicket/src/main/java/org/apache/wicket/Component.java?rev=1050569&r1=1050568&r2=1050569&view=diff
==
--- wicket/trunk/wicket/src/main/java/org/apache/wicket/Component.java 
(original)
+++ wicket/trunk/wicket/src/main/java/org/apache/wicket/Component.java Sat Dec 
18 02:09:40 2010
@@ -523,24 +523,21 @@ public abstract class Component
}
}
 
-   final Object data_set(int index, Object object)
+   final void data_set(int index, Object object)
{
if (index > data_length() - 1)
{
-   throw new IndexOutOfBoundsException();
+   throw new IndexOutOfBoundsException("can not set data 
at " + index +
+   " when data_length() is " + data_length());
}
else if (index == 0 && !(data instanceof Object[] && !(data 
instanceof MetaDataEntry[])))
{
-   Object old = data;
data = object;
-   return old;
}
else
{
Object[] array = (Object[])data;
-   Object old = array[index];
array[index] = object;
-   return old;
}
}
 
@@ -558,7 +555,8 @@ public abstract class Component
}
if (position > currentLength)
{
-   throw new IndexOutOfBoundsException();
+   throw new IndexOutOfBoundsException("can not insert 
data at " + position +
+   " when data_length() is " + currentLength);
}
if (currentLength == 0)
{
@@ -597,7 +595,7 @@ public abstract class Component
}
}
 
-   Object data_remove(int position)
+   final void data_remove(int position)
{
int currentLength = data_length();
 
@@ -607,9 +605,7 @@ public abstract class Component
}
else if (currentLength == 1)
{
-   Object old = data;
data = null;
-   return old;
}
else if (currentLength == 2)
{
@@ -617,12 +613,10 @@ public abstract class Component
if (position == 0)
{
data = current[1];
-   return current[0];
}
else
{
data = current[0];
-   return current[1];
}
}
else
@@ -639,8 +633,6 @@ public abstract class Component
final int left = currentLength - position - 1;
System.arraycopy(current, position + 1, data, 
position, left);
}
-
-   return current[position];
}
}
 




svn commit: r1050567 - /wicket/branches/wicket-1.4.x/wicket/src/main/java/org/apache/wicket/Component.java

2010-12-17 Thread jrthomerson
Author: jrthomerson
Date: Sat Dec 18 01:55:52 2010
New Revision: 1050567

URL: http://svn.apache.org/viewvc?rev=1050567&view=rev
Log:
fixes WICKET-3265 for 1.4.x branch

Modified:

wicket/branches/wicket-1.4.x/wicket/src/main/java/org/apache/wicket/Component.java

Modified: 
wicket/branches/wicket-1.4.x/wicket/src/main/java/org/apache/wicket/Component.java
URL: 
http://svn.apache.org/viewvc/wicket/branches/wicket-1.4.x/wicket/src/main/java/org/apache/wicket/Component.java?rev=1050567&r1=1050566&r2=1050567&view=diff
==
--- 
wicket/branches/wicket-1.4.x/wicket/src/main/java/org/apache/wicket/Component.java
 (original)
+++ 
wicket/branches/wicket-1.4.x/wicket/src/main/java/org/apache/wicket/Component.java
 Sat Dec 18 01:55:52 2010
@@ -776,24 +776,21 @@ public abstract class Component implemen
}
}
 
-   private final Object data_set(int index, Object object)
+   private final void data_set(int index, Object object)
{
if (index > data_length() - 1)
{
-   throw new IndexOutOfBoundsException();
+   throw new IndexOutOfBoundsException("can not set data 
at " + index +
+   " when data_length() is " + data_length());
}
else if (index == 0 && !(data instanceof Object[] && !(data 
instanceof MetaDataEntry[])))
{
-   Object old = data;
data = object;
-   return old;
}
else
{
Object[] array = (Object[])data;
-   Object old = array[index];
array[index] = object;
-   return old;
}
}
 
@@ -811,7 +808,8 @@ public abstract class Component implemen
}
if (position > currentLength)
{
-   throw new IndexOutOfBoundsException();
+   throw new IndexOutOfBoundsException("can not insert 
data at " + position +
+   " when data_length() is " + currentLength);
}
if (currentLength == 0)
{
@@ -851,7 +849,7 @@ public abstract class Component implemen
}
}
 
-   private Object data_remove(int position)
+   private final void data_remove(int position)
{
int currentLength = data_length();
 
@@ -861,9 +859,7 @@ public abstract class Component implemen
}
else if (currentLength == 1)
{
-   Object old = data;
data = null;
-   return old;
}
else if (currentLength == 2)
{
@@ -871,12 +867,10 @@ public abstract class Component implemen
if (position == 0)
{
data = current[1];
-   return current[0];
}
else
{
data = current[0];
-   return current[1];
}
}
else
@@ -893,8 +887,6 @@ public abstract class Component implemen
final int left = currentLength - position - 1;
System.arraycopy(current, position + 1, data, 
position, left);
}
-
-   return current[position];
}
}
 




[jira] Commented: (WICKET-3265) Component data_remove returns Object which is never used

2010-12-17 Thread Richard Emberson (JIRA)

[ 
https://issues.apache.org/jira/browse/WICKET-3265?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12972709#action_12972709
 ] 

Richard Emberson commented on WICKET-3265:
--

BTW, data_set with signature:
private final Object data_set(int index, Object object)
is used twice in Component and in neither place is the old
value returned by data_set used.
So, this method can also be simplified by not returning
the old value.

> Component data_remove returns Object which is never used
> 
>
> Key: WICKET-3265
> URL: https://issues.apache.org/jira/browse/WICKET-3265
> Project: Wicket
>  Issue Type: Improvement
>  Components: wicket
>Affects Versions: 1.5-M3
> Environment: All
>Reporter: Richard Emberson
>Priority: Trivial
>
> The Component method data_remove has the signature:
> private Object data_remove(int position)
> It returns an Object and it is private.
> Only three places call data_remove in Component and none of them use
> the return value.
> Simplify the code in data_remove so that it does not return the data
> being removed.
> At some future time, one can always call data_get if one really needs the 
> value prior to removing it.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.



[jira] Created: (WICKET-3265) Component data_remove returns Object which is never used

2010-12-17 Thread Richard Emberson (JIRA)
Component data_remove returns Object which is never used


 Key: WICKET-3265
 URL: https://issues.apache.org/jira/browse/WICKET-3265
 Project: Wicket
  Issue Type: Improvement
  Components: wicket
Affects Versions: 1.5-M3
 Environment: All
Reporter: Richard Emberson
Priority: Trivial


The Component method data_remove has the signature:
private Object data_remove(int position)
It returns an Object and it is private.
Only three places call data_remove in Component and none of them use
the return value.
Simplify the code in data_remove so that it does not return the data
being removed.
At some future time, one can always call data_get if one really needs the 
value prior to removing it.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.



svn commit: r1050492 - in /wicket/trunk/wicket/src/main/java/org/apache/wicket/markup: ComponentTag.java MarkupStream.java html/panel/Fragment.java html/panel/Panel.java

2010-12-17 Thread jdonnerstag
Author: jdonnerstag
Date: Fri Dec 17 21:03:20 2010
New Revision: 1050492

URL: http://svn.apache.org/viewvc?rev=1050492&view=rev
Log:
minor tweaks

Modified:
wicket/trunk/wicket/src/main/java/org/apache/wicket/markup/ComponentTag.java
wicket/trunk/wicket/src/main/java/org/apache/wicket/markup/MarkupStream.java

wicket/trunk/wicket/src/main/java/org/apache/wicket/markup/html/panel/Fragment.java

wicket/trunk/wicket/src/main/java/org/apache/wicket/markup/html/panel/Panel.java

Modified: 
wicket/trunk/wicket/src/main/java/org/apache/wicket/markup/ComponentTag.java
URL: 
http://svn.apache.org/viewvc/wicket/trunk/wicket/src/main/java/org/apache/wicket/markup/ComponentTag.java?rev=1050492&r1=1050491&r2=1050492&view=diff
==
--- 
wicket/trunk/wicket/src/main/java/org/apache/wicket/markup/ComponentTag.java 
(original)
+++ 
wicket/trunk/wicket/src/main/java/org/apache/wicket/markup/ComponentTag.java 
Fri Dec 17 21:03:20 2010
@@ -609,7 +609,11 @@ public class ComponentTag extends Markup
 */
public final void setType(final TagType type)
{
-   xmlTag.setType(type);
+   if (type != xmlTag.getType())
+   {
+   xmlTag.setType(type);
+   setModified(true);
+   }
}
 
/**

Modified: 
wicket/trunk/wicket/src/main/java/org/apache/wicket/markup/MarkupStream.java
URL: 
http://svn.apache.org/viewvc/wicket/trunk/wicket/src/main/java/org/apache/wicket/markup/MarkupStream.java?rev=1050492&r1=1050491&r2=1050492&view=diff
==
--- 
wicket/trunk/wicket/src/main/java/org/apache/wicket/markup/MarkupStream.java 
(original)
+++ 
wicket/trunk/wicket/src/main/java/org/apache/wicket/markup/MarkupStream.java 
Fri Dec 17 21:03:20 2010
@@ -17,7 +17,6 @@
 package org.apache.wicket.markup;
 
 import org.apache.wicket.Component;
-import org.apache.wicket.util.lang.Args;
 import org.apache.wicket.util.resource.IResourceStream;
 import org.apache.wicket.util.string.Strings;
 
@@ -62,7 +61,11 @@ public class MarkupStream
 */
public MarkupStream(final IMarkupFragment markup)
{
-   Args.notNull(markup, "markup");
+   if (markup == null)
+   {
+   throwMarkupException("Failed to find markup.");
+   }
+
this.markup = markup;
 
if (markup.size() > 0)

Modified: 
wicket/trunk/wicket/src/main/java/org/apache/wicket/markup/html/panel/Fragment.java
URL: 
http://svn.apache.org/viewvc/wicket/trunk/wicket/src/main/java/org/apache/wicket/markup/html/panel/Fragment.java?rev=1050492&r1=1050491&r2=1050492&view=diff
==
--- 
wicket/trunk/wicket/src/main/java/org/apache/wicket/markup/html/panel/Fragment.java
 (original)
+++ 
wicket/trunk/wicket/src/main/java/org/apache/wicket/markup/html/panel/Fragment.java
 Fri Dec 17 21:03:20 2010
@@ -133,7 +133,6 @@ public class Fragment extends WebMarkupC
if (tag.isOpenClose())
{
tag.setType(TagType.OPEN);
-   tag.setModified(true);
}
super.onComponentTag(tag);
}
@@ -145,21 +144,15 @@ public class Fragment extends WebMarkupC
if (markupStream.getPreviousTag().isOpen())
{
markupStream.skipRawMarkup();
+   if (markupStream.get().closes(openTag) == false)
+   {
+   throw new MarkupException(markupStream, "close 
tag not found for tag: " +
+   openTag.toString() + ". Component: " + 
this.toString());
+   }
}
 
-   renderFragment(openTag);
-   }
-
-   /**
-* Render the markup starting at the current position of the markup 
strean
-* 
-* @param openTag
-*/
-   private void renderFragment(final ComponentTag openTag)
-   {
-   MarkupStream stream = new MarkupStream(getMarkup(null));
-
// Get the fragments open tag
+   MarkupStream stream = new MarkupStream(getMarkup(null));
ComponentTag fragmentOpenTag = stream.getTag();
 
// if it is an open close tag, skip this fragment.
@@ -201,9 +194,8 @@ public class Fragment extends WebMarkupC
IMarkupFragment markup = chooseMarkup();
if (markup == null)
{
-   throw new MarkupException(
-   "chooseMarkup() returned null. No markup to 
search for fragment markup with id: " +
-   markupId);
+   throw new MarkupException("The fragments m

[jira] Created: (WICKET-3264) MetaDataEntry set method traverses metaData even after key is found and data set/cleared

2010-12-17 Thread Richard Emberson (JIRA)
MetaDataEntry set method traverses metaData even after key is found and data 
set/cleared


 Key: WICKET-3264
 URL: https://issues.apache.org/jira/browse/WICKET-3264
 Project: Wicket
  Issue Type: Improvement
  Components: wicket
Affects Versions: 1.5-M3
 Environment: all
Reporter: Richard Emberson
Priority: Trivial


The for-loop in the MetaDataKey set method has a break statement that is only 
called if  metaData is set to null. The break statement should be after the 
set = true;
statement.
Why? from what I can tell, per-key, data can only be entered into the 
MetaDataEntry
array once. The data is added only if isSet == false, and this happens only if 
the
key is not found in the array.
Also, he get method only returns the first entry found for a given key so
it makes no sense to actually have more than one entry.
So, change from:
else
{
  metaData = null;
  break;
}
  }
  set = true;
}
to:
else
{
  metaData = null;
}
  }
  set = true;
  break;
}

I've made the change on my copy and all of the tests pass.
If a user is directly playing with the data Object,
Object data = null;
in Component rather than using the given methods, then all bets are off anyway.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.



[jira] Resolved: (WICKET-3256) Use a Provider for IExceptionMapper

2010-12-17 Thread Pedro Santos (JIRA)

 [ 
https://issues.apache.org/jira/browse/WICKET-3256?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Pedro Santos resolved WICKET-3256.
--

   Resolution: Fixed
Fix Version/s: 1.5-M4

> Use a Provider for IExceptionMapper
> ---
>
> Key: WICKET-3256
> URL: https://issues.apache.org/jira/browse/WICKET-3256
> Project: Wicket
>  Issue Type: New Feature
>  Components: wicket
>Affects Versions: 1.5-M3
>Reporter: James Carman
>Assignee: Pedro Santos
> Fix For: 1.5-M4
>
> Attachments: WICKET-3256-test-2.patch, WICKET-3256-test.patch, 
> WICKET-3256.patch
>
>
> Currently, in order to plug in your own IExceptionMapper, you have to 
> override a method.  This makes developing "frameworks" difficult, since your 
> client code has to do a method override in order to get everything working.  
> It would be nicer if the IExceptionManager was created via a "provider."

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.



svn commit: r1050482 - in /wicket/trunk/wicket/src: main/java/org/apache/wicket/Application.java test/java/org/apache/wicket/ExceptionMapperTest.java

2010-12-17 Thread pedro
Author: pedro
Date: Fri Dec 17 20:00:51 2010
New Revision: 1050482

URL: http://svn.apache.org/viewvc?rev=1050482&view=rev
Log:
Enabling other frameworks to plug in the application a custom response for 
their exceptions
Issue: WICKET-3256

Added:
wicket/trunk/wicket/src/test/java/org/apache/wicket/ExceptionMapperTest.java
Modified:
wicket/trunk/wicket/src/main/java/org/apache/wicket/Application.java

Modified: wicket/trunk/wicket/src/main/java/org/apache/wicket/Application.java
URL: 
http://svn.apache.org/viewvc/wicket/trunk/wicket/src/main/java/org/apache/wicket/Application.java?rev=1050482&r1=1050481&r2=1050482&view=diff
==
--- wicket/trunk/wicket/src/main/java/org/apache/wicket/Application.java 
(original)
+++ wicket/trunk/wicket/src/main/java/org/apache/wicket/Application.java Fri 
Dec 17 20:00:51 2010
@@ -192,6 +192,9 @@ public abstract class Application implem
/** request cycle provider */
private IRequestCycleProvider requestCycleProvider;
 
+/** exception mapper provider */
+private IProvider exceptionMapperProvider;
+
/** session store provider */
private IProvider sessionStoreProvider;
 
@@ -704,9 +707,26 @@ public abstract class Application implem
pageAccessSynchronizer = new 
PageAccessSynchronizer(getRequestCycleSettings().getTimeout());
 
requestCycleProvider = new DefaultRequestCycleProvider();
+exceptionMapperProvider = new DefaultExceptionMapperProvider();
}
 
-   /**
+/**
+ * @return the exception mapper provider
+ */
+public IProvider getExceptionMapperProvider()
+{
+return exceptionMapperProvider;
+}
+
+/**
+ * @param exceptionMapperProvider the new exception mapper provider
+ */
+public void setExceptionMapperProvider(IProvider 
exceptionMapperProvider)
+{
+this.exceptionMapperProvider = exceptionMapperProvider;
+}
+
+/**
 * 
 * @return Session state provider
 */
@@ -1449,6 +1469,14 @@ public abstract class Application implem
this.requestCycleProvider = requestCycleProvider;
}
 
+private static class DefaultExceptionMapperProvider implements 
IProvider
+{
+public IExceptionMapper get()
+{
+return new DefaultExceptionMapper();
+}
+}
+
/**
 * 
 */
@@ -1469,7 +1497,7 @@ public abstract class Application implem
public final RequestCycle createRequestCycle(final Request request, 
final Response response)
{
RequestCycleContext context = new RequestCycleContext(request, 
response,
-   getRootRequestMapper(), newExceptionMapper());
+   getRootRequestMapper(), 
getExceptionMapperProvider().get());
 
RequestCycle requestCycle = 
getRequestCycleProvider().get(context);
requestCycle.getListeners().add(requestCycleListeners);
@@ -1485,15 +1513,6 @@ public abstract class Application implem
}
 
/**
-* @return a mapper that knows what kind of error page to show when an 
exception occurs during
-* page rendering
-*/
-   protected IExceptionMapper newExceptionMapper()
-   {
-   return new DefaultExceptionMapper();
-   }
-
-   /**
 * Sets an {...@link IHeaderResponseDecorator} that you want your 
application to use to decorate
 * header responses.
 * 

Added: 
wicket/trunk/wicket/src/test/java/org/apache/wicket/ExceptionMapperTest.java
URL: 
http://svn.apache.org/viewvc/wicket/trunk/wicket/src/test/java/org/apache/wicket/ExceptionMapperTest.java?rev=1050482&view=auto
==
--- 
wicket/trunk/wicket/src/test/java/org/apache/wicket/ExceptionMapperTest.java 
(added)
+++ 
wicket/trunk/wicket/src/test/java/org/apache/wicket/ExceptionMapperTest.java 
Fri Dec 17 20:00:51 2010
@@ -0,0 +1,140 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.wicket;
+
+import org.apache.wicket.markup.IMarkupResourceStreamPro

[jira] Updated: (WICKET-3263) Allow AjaxRequestTarget.IListeners to be Registered at the WebApplication Level

2010-12-17 Thread James Carman (JIRA)

 [ 
https://issues.apache.org/jira/browse/WICKET-3263?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

James Carman updated WICKET-3263:
-

Attachment: WICKET-3263.patch

Here's a patch (with test case this time :).

> Allow AjaxRequestTarget.IListeners to be Registered at the WebApplication 
> Level
> ---
>
> Key: WICKET-3263
> URL: https://issues.apache.org/jira/browse/WICKET-3263
> Project: Wicket
>  Issue Type: New Feature
>  Components: wicket
>Affects Versions: 1.5-M3
>Reporter: James Carman
> Attachments: WICKET-3263.patch
>
>
> Right now, in order to register an AjaxRequestTarget.IListener, you have to 
> override WebApplication.newAjaxRequestTarget(Page p).  That does make Wicket 
> very "pluggable."  What if multiple frameworks need to add in that hook?  So, 
> why not allow a global, application-level, registry of those listeners.  Each 
> AjaxRequestTarget would have those listeners added to it.  

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.



[jira] Created: (WICKET-3263) Allow AjaxRequestTarget.IListeners to be Registered at the WebApplication Level

2010-12-17 Thread James Carman (JIRA)
Allow AjaxRequestTarget.IListeners to be Registered at the WebApplication Level
---

 Key: WICKET-3263
 URL: https://issues.apache.org/jira/browse/WICKET-3263
 Project: Wicket
  Issue Type: New Feature
  Components: wicket
Affects Versions: 1.5-M3
Reporter: James Carman


Right now, in order to register an AjaxRequestTarget.IListener, you have to 
override WebApplication.newAjaxRequestTarget(Page p).  That does make Wicket 
very "pluggable."  What if multiple frameworks need to add in that hook?  So, 
why not allow a global, application-level, registry of those listeners.  Each 
AjaxRequestTarget would have those listeners added to it.  

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.



[jira] Commented: (WICKET-3093) Self-updating AutoCompleteTextField moves focus to start of field in IE only

2010-12-17 Thread Ritu Sinha (JIRA)

[ 
https://issues.apache.org/jira/browse/WICKET-3093?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12972567#action_12972567
 ] 

Ritu Sinha commented on WICKET-3093:


Changing "onchange" to "onblur" fixes this issue for the most part. 

However, it still does not work if the AutoCompleteTextField in used in a Modal 
window. 

Any help would be greatly appreciated.


> Self-updating AutoCompleteTextField moves focus to start of field in IE only
> 
>
> Key: WICKET-3093
> URL: https://issues.apache.org/jira/browse/WICKET-3093
> Project: Wicket
>  Issue Type: Bug
>Affects Versions: 1.4.12
>Reporter: Alex Grant
>Assignee: Igor Vaynberg
>Priority: Minor
> Attachments: WICKET-3093-autocomplete.zip
>
>
> I have an AutoCompleteTextField that has a AjaxFormSubmitBehavior("onchange") 
> attached so that we can canonicalise the value (eg correct the case) 
> automatically. In IE only, when you pause long enough to trigger the 
> AjaxFormSubmitBehavior, the cursor moves to the start of the text field, so 
> if you type "123" slowly you may be "312".
> This is only an issue in IE as it is caused by WICKET-2279 - if I remove the 
> javascript added for that bug the problem goes away.
> The problem can also be solved by changing AjaxFormSubmitBehavior("onchange") 
> to AjaxFormSubmitBehavior("onblur"), but I still consider it a bug given it 
> only occurs in IE - Firefox and Chrome behave correctly no matter what you do.
> Also, since the javascript added in WICKET-2279 starts with the comment "// 
> hack for a focus issue in IE, WICKET-2279" I figured you'd like to know about 
> any quirky behaviour it causes.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.



[jira] Updated: (WICKET-3262) MountedMapper defined in WicketApplication doesn't accept /mount/paramval0/paramval1

2010-12-17 Thread Andrew Lombardi (JIRA)

 [ 
https://issues.apache.org/jira/browse/WICKET-3262?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Andrew Lombardi updated WICKET-3262:


Attachment: mountedmapper_test.tar.gz

> MountedMapper defined in WicketApplication doesn't accept 
> /mount/paramval0/paramval1
> 
>
> Key: WICKET-3262
> URL: https://issues.apache.org/jira/browse/WICKET-3262
> Project: Wicket
>  Issue Type: Bug
>  Components: wicket
>Affects Versions: 1.5-M3
>Reporter: Andrew Lombardi
> Attachments: mountedmapper_test.tar.gz
>
>
> If you utilize mountPage or create a MountedMapper with parameters, it fails 
> to represent that URL similar to the IndexedParamUrlCodingStrategy.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.



[jira] Created: (WICKET-3262) MountedMapper defined in WicketApplication doesn't accept /mount/paramval0/paramval1

2010-12-17 Thread Andrew Lombardi (JIRA)
MountedMapper defined in WicketApplication doesn't accept 
/mount/paramval0/paramval1


 Key: WICKET-3262
 URL: https://issues.apache.org/jira/browse/WICKET-3262
 Project: Wicket
  Issue Type: Bug
  Components: wicket
Affects Versions: 1.5-M3
Reporter: Andrew Lombardi


If you utilize mountPage or create a MountedMapper with parameters, it fails to 
represent that URL similar to the IndexedParamUrlCodingStrategy.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.



[jira] Created: (WICKET-3261) Create wicket-core Maven module that contains wicket + wicket-util + wicket-request

2010-12-17 Thread Martin Grigorov (JIRA)
Create wicket-core Maven module that contains wicket + wicket-util + 
wicket-request
---

 Key: WICKET-3261
 URL: https://issues.apache.org/jira/browse/WICKET-3261
 Project: Wicket
  Issue Type: New Feature
  Components: wicket
Affects Versions: 1.5-M3
Reporter: Martin Grigorov
Assignee: Martin Grigorov


Create a Maven module that aggregates all classes from wicket.jar and all its 
dependencies (currently wicket-util.jar and wicket-request.jar).
This way the non-Maven users can download wicket-core.jar and start hacking.

Optional: we can do wicket-all.jar that contains all feature providing modules 
(wicket, -extensions, -ioc, -guice, -spring, -auth-roles, -datetime, -jmx, 
-velocity).

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.



svn commit: r1050441 - in /wicket/trunk: wicket-examples/src/main/java/org/apache/wicket/examples/ wicket/src/test/java/org/apache/wicket/ wicket/src/test/java/org/apache/wicket/protocol/http/ wicket/

2010-12-17 Thread ivaynberg
Author: ivaynberg
Date: Fri Dec 17 16:19:37 2010
New Revision: 1050441

URL: http://svn.apache.org/viewvc?rev=1050441&view=rev
Log:
making page oninitialize() final
Issue: WICKET-3218

Modified:

wicket/trunk/wicket-examples/src/main/java/org/apache/wicket/examples/WicketExamplePage.java

wicket/trunk/wicket/src/test/java/org/apache/wicket/ComponentInitializationTest.java

wicket/trunk/wicket/src/test/java/org/apache/wicket/protocol/http/ModifyCookiePage.java

wicket/trunk/wicket/src/test/java/org/apache/wicket/resource/PageWithXmlProperties.java

Modified: 
wicket/trunk/wicket-examples/src/main/java/org/apache/wicket/examples/WicketExamplePage.java
URL: 
http://svn.apache.org/viewvc/wicket/trunk/wicket-examples/src/main/java/org/apache/wicket/examples/WicketExamplePage.java?rev=1050441&r1=1050440&r2=1050441&view=diff
==
--- 
wicket/trunk/wicket-examples/src/main/java/org/apache/wicket/examples/WicketExamplePage.java
 (original)
+++ 
wicket/trunk/wicket-examples/src/main/java/org/apache/wicket/examples/WicketExamplePage.java
 Fri Dec 17 16:19:37 2010
@@ -42,6 +42,10 @@ public class WicketExamplePage extends W
public WicketExamplePage(final PageParameters pageParameters)
{
super(pageParameters);
+
+   final String packageName = getClass().getPackage().getName();
+   add(new WicketExampleHeader("mainNavigation", 
Strings.afterLast(packageName, '.'), this));
+   explain();
}
 
 
@@ -56,19 +60,6 @@ public class WicketExamplePage extends W
}
 
/**
-* @see org.apache.wicket.Component#onInitialize()
-*/
-   @Override
-   protected void onInitialize()
-   {
-   super.onInitialize();
-
-   final String packageName = getClass().getPackage().getName();
-   add(new WicketExampleHeader("mainNavigation", 
Strings.afterLast(packageName, '.'), this));
-   explain();
-   }
-
-   /**
 * Override base method to provide an explanation
 */
protected void explain()

Modified: 
wicket/trunk/wicket/src/test/java/org/apache/wicket/ComponentInitializationTest.java
URL: 
http://svn.apache.org/viewvc/wicket/trunk/wicket/src/test/java/org/apache/wicket/ComponentInitializationTest.java?rev=1050441&r1=1050440&r2=1050441&view=diff
==
--- 
wicket/trunk/wicket/src/test/java/org/apache/wicket/ComponentInitializationTest.java
 (original)
+++ 
wicket/trunk/wicket/src/test/java/org/apache/wicket/ComponentInitializationTest.java
 Fri Dec 17 16:19:37 2010
@@ -24,10 +24,8 @@ import org.apache.wicket.markup.IMarkupR
 import org.apache.wicket.markup.html.WebComponent;
 import org.apache.wicket.markup.html.WebMarkupContainer;
 import org.apache.wicket.markup.html.WebPage;
-import org.apache.wicket.markup.html.basic.Label;
 import org.apache.wicket.util.resource.IResourceStream;
 import org.apache.wicket.util.resource.StringResourceStream;
-import org.apache.wicket.util.tester.WicketTester;
 
 /**
  * Tests {...@link Component#onInitialize()} contract
@@ -68,10 +66,6 @@ public class ComponentInitializationTest
// test initialization when readding a component with 
uninitialized children
page.add(t1);
assertEquals(1, t4.getCount());
-
-   // test page was initialized
-   assertEquals(1, page.getCount());
-
}
 
public void testAtomicity()
@@ -101,18 +95,6 @@ public class ComponentInitializationTest
page.add(t1);
assertEquals(1, t1.getCount());
assertEquals(1, t2.getCount());
-
-   // test page was only initialized once
-   assertEquals(1, page.getCount());
-   }
-
-   public void testPageInitialization()
-   {
-   WicketTester tester = new WicketTester();
-   tester.startPage(TestPage.class);
-   TestPage page = (TestPage)tester.getLastRenderedPage();
-
-   assertEquals(1, page.getCount());
}
 
public void testOnInitializeSuperVerified()
@@ -182,31 +164,14 @@ public class ComponentInitializationTest
 
public static class TestPage extends WebPage implements 
IMarkupResourceStreamProvider
{
-   private int count = 0;
-
public TestPage()
{
}
 
-   @Override
-   protected void onInitialize()
-   {
-   super.onInitialize();
-   count++;
-   add(new Label("addedComponent",
-   "Testing addition of a component to show 
StackOverflowError"));
-   }
-
-   public int getCount()
-   {
-   return count;
-   }

[jira] Resolved: (WICKET-3252) StalePageException on non-versioned Page in Ajax request does not render ajax-response

2010-12-17 Thread Martin Grigorov (JIRA)

 [ 
https://issues.apache.org/jira/browse/WICKET-3252?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Martin Grigorov resolved WICKET-3252.
-

   Resolution: Fixed
Fix Version/s: 1.5-M4
 Assignee: Martin Grigorov

Fixed with r1050433.

Pedro's tests are also in.

> StalePageException on non-versioned Page in Ajax request does not render 
> ajax-response
> --
>
> Key: WICKET-3252
> URL: https://issues.apache.org/jira/browse/WICKET-3252
> Project: Wicket
>  Issue Type: Bug
>  Components: wicket
>Affects Versions: 1.5-M3
>Reporter: Michal Kurtak
>Assignee: Martin Grigorov
> Fix For: 1.5-M4
>
> Attachments: stalepageexception-quickstart.zip, 
> WICKET-3252-test.patch, WICKET-3252.patch
>
>
> If StalePageException occurs in Ajax request on non-versioned page, response 
> contains rendered page but no  element.. Response should 
> contain ajax redirect to stale page.
> How to reproduce this behavior in attached quickstart project (HomePage in 
> quickstart contains two links (one that opens popup window and the other 
> performs ajax request):
> 1. Click on the popup link. New window is opened.
> 2. In the originating window, click Ajax Link.
> 3. In popup window click Ajax Link and error occurs

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.



[jira] Assigned: (WICKET-2467) FilterForm requires focus-tracker and focus-restore be added as children in the markup

2010-12-17 Thread Igor Vaynberg (JIRA)

 [ 
https://issues.apache.org/jira/browse/WICKET-2467?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Igor Vaynberg reassigned WICKET-2467:
-

Assignee: Igor Vaynberg

> FilterForm requires focus-tracker and focus-restore be added as children in 
> the markup
> --
>
> Key: WICKET-2467
> URL: https://issues.apache.org/jira/browse/WICKET-2467
> Project: Wicket
>  Issue Type: Bug
>  Components: wicket-extensions
>Affects Versions: 1.4.0
>Reporter: Steve Lowery
>Assignee: Igor Vaynberg
> Fix For: 1.5-M4
>
> Attachments: WICKET-2467.rar
>
>
> When using a FilterForm, the following error is received:
> WicketMessage: The component(s) below failed to render. A common problem is 
> that you have added a component in code but forgot to reference it in the 
> markup (thus the component will never be rendered).
> 1. [MarkupContainer [Component id = focus-tracker]]
> 2. [MarkupContainer [Component id = focus-restore]]
> The tags have to manually be added to the markup to use the Filter Form.  
> This could be the only way to get this component to work, but this would be 
> the first component I've used thusfar where I was required to create children 
> with specific ids in the markup.
> Here is the java code:
>   public AbstractFilteredPanel(String id, T filter) {
>   super(id);
>   this.filter = filter;
>   AbstractFilteredPanelDataProvider dataProvider = new 
> AbstractFilteredPanelDataProvider();
>   FilterForm form = new FilterForm("filterForm", dataProvider);
>   add(form);
>   AjaxFallbackDefaultDataTable data = new 
> AjaxFallbackDefaultDataTable("data", getColumns(), getDataProvider(), 
> getRowsPerPage());
>   data.addTopToolbar(new FilterToolbar(data, form, dataProvider));
>   form.add(data);
>   }
> And the markup:
> http://wicket.apache.org/";>
> 
>   
>   
>   
> 
> 

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.



[jira] Resolved: (WICKET-3218) Component#onInitialize is broken for Pages

2010-12-17 Thread Igor Vaynberg (JIRA)

 [ 
https://issues.apache.org/jira/browse/WICKET-3218?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Igor Vaynberg resolved WICKET-3218.
---

   Resolution: Fixed
Fix Version/s: 1.5-M4
 Assignee: Igor Vaynberg

fixed in 1.5. leaving in 1.4.x because making it final can break backwards 
compat.

i made the decision to make the method final in page. i think this makes more 
sense then delaying the call because by the time the page's constructor is 
finished the page should be initialized, eg code like this is commong

EditUserPage page=new EditUserPage(user); page.switchToAddressEditMode();

switchToAddressEditMode() may depend on certain components being added to the 
hierarchy and if they are added in oninitialize() which is delayed the method 
may fail.

thus, the principle of least surprise dictates we make it final in page.

> Component#onInitialize is broken for Pages
> --
>
> Key: WICKET-3218
> URL: https://issues.apache.org/jira/browse/WICKET-3218
> Project: Wicket
>  Issue Type: Bug
>  Components: wicket
>Affects Versions: 1.4.14
>Reporter: Carl-Eric Menzel
>Assignee: Igor Vaynberg
> Fix For: 1.5-M4
>
> Attachments: 
> 0001-delay-oninitialize-until-just-before-onconfigure.patch
>
>
> As first mentioned at 
> http://mail-archives.apache.org/mod_mbox/wicket-dev/201012.mbox/%3c1291238699.1749.1408166...@webmail.messagingengine.com%3e
>  , I think the current (Wicket 1.4.14) implementation of 
> Component#onInitialize is broken for Pages. Pages get initialized as soon as 
> the first component is added, which is correct. But this usually happens 
> within the constructor of the page, which means that the page object isn't 
> fully initialized yet. The entire point of having onInitialize, however, is 
> to be able to do further work once all constructors have run. See 
> https://github.com/duesenklipper/wicket-oninitialize for a quickstart that 
> demonstrates the problem.
> Pedro Santos suggested in the above thread to just switch the entire object 
> construction to onInitialize. I don't think this is a good idea, because
> 1) it is completely counter-intuitive
> 2) it is not always realistic to have an entire class hierarchy not using the 
> constructor just because a subclass somewhere might want to use onInitialize
> 3) it is inconsistent with onInitialize behavior for all other (non-Page) 
> components. Here I can easily mix work in the constructor with onInitialize.
> I propose the following patch:
> - override onInitialize in Page and make it final, so Pages can't use this 
> any more. This should not cause any unnecessary breaking, since currently 
> it's not working for pages anyway.
> - introduce Page#onPageInitialize to provide a safe alternative to 
> onInitialize
> - make a special case for Page in Component's beforeRender to fire 
> Page#onPageInitialize if necessary
> Yes, this is a bit of special casing for Page, but there's quite a lot of 
> that needed for Page anyway. I think the impact of this should be minimal.
> My page includes documentation and a new testcase that verifies the new 
> behavior. I modified the old ComponentInitializationTest to reflect the fact 
> that Page doesn't get onInitialize any more.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.



svn commit: r1050433 - in /wicket/trunk/wicket/src: main/java/org/apache/wicket/request/handler/render/ main/java/org/apache/wicket/util/tester/ test/java/org/apache/wicket/request/handler/

2010-12-17 Thread mgrigorov
Author: mgrigorov
Date: Fri Dec 17 16:01:41 2010
New Revision: 1050433

URL: http://svn.apache.org/viewvc?rev=1050433&view=rev
Log:
WICKET-3252 StalePageException on non-versioned Page in Ajax request does not 
render ajax-response

If a hit to stale page is made and the current request is an Ajax one then 
always redirect to the new page. It doesn't make sense to return the new page's 
markup in Ajax response

Added:
wicket/trunk/wicket/src/test/java/org/apache/wicket/request/handler/

wicket/trunk/wicket/src/test/java/org/apache/wicket/request/handler/PageProviderTest.java
   (with props)
Modified:

wicket/trunk/wicket/src/main/java/org/apache/wicket/request/handler/render/WebPageRenderer.java

wicket/trunk/wicket/src/main/java/org/apache/wicket/util/tester/BaseWicketTester.java

Modified: 
wicket/trunk/wicket/src/main/java/org/apache/wicket/request/handler/render/WebPageRenderer.java
URL: 
http://svn.apache.org/viewvc/wicket/trunk/wicket/src/main/java/org/apache/wicket/request/handler/render/WebPageRenderer.java?rev=1050433&r1=1050432&r2=1050433&view=diff
==
--- 
wicket/trunk/wicket/src/main/java/org/apache/wicket/request/handler/render/WebPageRenderer.java
 (original)
+++ 
wicket/trunk/wicket/src/main/java/org/apache/wicket/request/handler/render/WebPageRenderer.java
 Fri Dec 17 16:01:41 2010
@@ -21,12 +21,14 @@ import org.apache.wicket.Session;
 import org.apache.wicket.protocol.http.BufferedWebResponse;
 import org.apache.wicket.protocol.http.WebApplication;
 import org.apache.wicket.request.IRequestHandler;
+import org.apache.wicket.request.Request;
 import org.apache.wicket.request.Response;
 import org.apache.wicket.request.Url;
 import org.apache.wicket.request.component.IRequestablePage;
 import org.apache.wicket.request.cycle.RequestCycle;
 import org.apache.wicket.request.handler.RenderPageRequestHandler;
 import 
org.apache.wicket.request.handler.RenderPageRequestHandler.RedirectPolicy;
+import org.apache.wicket.request.http.WebRequest;
 import org.apache.wicket.request.http.WebResponse;
 import org.apache.wicket.settings.IRequestCycleSettings.RenderStrategy;
 import org.slf4j.Logger;
@@ -97,6 +99,20 @@ public class WebPageRenderer extends Pag
return 
WebApplication.get().getAndRemoveBufferedResponse(getSessionId(), url);
}
 
+   private boolean isAjax(RequestCycle requestCycle)
+   {
+   boolean isAjax = false;
+
+   Request request = requestCycle.getRequest();
+   if (request instanceof WebRequest)
+   {
+   WebRequest webRequest = (WebRequest)request;
+   isAjax = webRequest.isAjax();
+   }
+
+   return isAjax;
+   }
+
/**
 * 
 * @param url
@@ -176,13 +192,15 @@ public class WebPageRenderer extends Pag
Url targetUrl = 
requestCycle.mapUrlFor(getRenderPageRequestHandler());
 
//
-   // the code below is little hairy but we have to handle 3 
redirect policies
-   // and 3 rendering strategies
+   // the code below is little hairy but we have to handle 3 
redirect policies,
+   // 3 rendering strategies and two kind of requests (ajax and 
normal)
//
 
// try to get an already rendered buffered response for current 
URL
BufferedWebResponse bufferedResponse = 
getAndRemoveBufferedResponse(currentUrl);
 
+   boolean isAjax = isAjax(requestCycle);
+
if (bufferedResponse != null)
{
logger.warn("The Buffered response should be handled by 
BufferedResponseRequestHandler");
@@ -191,8 +209,12 @@ public class WebPageRenderer extends Pag
}
else if (getRedirectPolicy() == RedirectPolicy.NEVER_REDIRECT 
|| isOnePassRender() //
||
-   (targetUrl.equals(currentUrl) && 
!getPageProvider().isNewPageInstance() && !getPage().isPageStateless()) //
-   || (targetUrl.equals(currentUrl) && 
isRedirectToRender()))
+   (!isAjax //
+   &&
+   (targetUrl.equals(currentUrl) && 
!getPageProvider().isNewPageInstance() && !getPage().isPageStateless()) //
+   || (targetUrl.equals(currentUrl) && 
isRedirectToRender()) //
+   ) //
+   ) //
{
// if the policy is never to redirect
// or one pass render mode is on
@@ -205,8 +227,10 @@ public class WebPageRenderer extends Pag

response.writeTo((WebResponse)requestCycle.getResponse());
}
}
-   else if (!targetUrl.equals(currentUrl) && //
-   (ge

svn commit: r1050432 - /wicket/trunk/wicket/src/main/java/org/apache/wicket/Page.java

2010-12-17 Thread ivaynberg
Author: ivaynberg
Date: Fri Dec 17 16:00:32 2010
New Revision: 1050432

URL: http://svn.apache.org/viewvc?rev=1050432&view=rev
Log:
making page oninitialize() final
Issue: WICKET-3218

Modified:
wicket/trunk/wicket/src/main/java/org/apache/wicket/Page.java

Modified: wicket/trunk/wicket/src/main/java/org/apache/wicket/Page.java
URL: 
http://svn.apache.org/viewvc/wicket/trunk/wicket/src/main/java/org/apache/wicket/Page.java?rev=1050432&r1=1050431&r2=1050432&view=diff
==
--- wicket/trunk/wicket/src/main/java/org/apache/wicket/Page.java (original)
+++ wicket/trunk/wicket/src/main/java/org/apache/wicket/Page.java Fri Dec 17 
16:00:32 2010
@@ -673,6 +673,17 @@ public abstract class Page extends Marku
return stateless;
}
 
+   @Override
+   protected final void onInitialize()
+   {
+   /*
+* final in the page because: *** doesnt make sense for pages 
*** can be called from page's
+* constructor - which is bad *** if delayed can lead to page 
not being initialized after
+* its constructor call - which is bad
+*/
+   super.onInitialize();
+   }
+
/**
 * Redirect to this page.
 * 




svn commit: r1050427 - /wicket/trunk/wicket/src/test/java/org/apache/wicket/request/mapper/MountedMapperTest.java

2010-12-17 Thread mgrigorov
Author: mgrigorov
Date: Fri Dec 17 15:37:40 2010
New Revision: 1050427

URL: http://svn.apache.org/viewvc?rev=1050427&view=rev
Log:
Add a unit test for MountedMapper working with RenderPageRequestHandler and old 
page instance (i.e. one with page info).

reasoned-by: a complain about this functionality from Andrew Lombardi 
(kinabalu) in IRC

Modified:

wicket/trunk/wicket/src/test/java/org/apache/wicket/request/mapper/MountedMapperTest.java

Modified: 
wicket/trunk/wicket/src/test/java/org/apache/wicket/request/mapper/MountedMapperTest.java
URL: 
http://svn.apache.org/viewvc/wicket/trunk/wicket/src/test/java/org/apache/wicket/request/mapper/MountedMapperTest.java?rev=1050427&r1=1050426&r2=1050427&view=diff
==
--- 
wicket/trunk/wicket/src/test/java/org/apache/wicket/request/mapper/MountedMapperTest.java
 (original)
+++ 
wicket/trunk/wicket/src/test/java/org/apache/wicket/request/mapper/MountedMapperTest.java
 Fri Dec 17 15:37:40 2010
@@ -513,4 +513,32 @@ public class MountedMapperTest extends A
Url url = placeholderEncoder.mapHandler(handler);
assertEquals("some/p1/path/p2/i1/i2?a=b&b=c", url.toString());
}
+
+   /**
+* Test Url creation with {...@link RenderPageRequestHandler}. Cheat 
that the page instance is not
+* new, this way the produced Url has version '1' in the page info 
parameter
+*/
+   public void testPlaceholderEncode3()
+   {
+   PageParameters parameters = new PageParameters();
+   parameters.set(0, "i1");
+   parameters.set(1, "i2");
+   parameters.set("a", "b");
+   parameters.set("b", "c");
+   parameters.set("param1", "p1");
+   parameters.set("param2", "p2");
+
+   PageProvider provider = new PageProvider(MockPage.class, 
parameters)
+   {
+   @Override
+   public boolean isNewPageInstance()
+   {
+   return false;
+   }
+   };
+   provider.setPageSource(context);
+   IRequestHandler handler = new 
RenderPageRequestHandler(provider);
+   Url url = placeholderEncoder.mapHandler(handler);
+   assertEquals("some/p1/path/p2/i1/i2?1&a=b&b=c", url.toString());
+   }
 }




[jira] Assigned: (WICKET-3256) Use a Provider for IExceptionMapper

2010-12-17 Thread Martin Grigorov (JIRA)

 [ 
https://issues.apache.org/jira/browse/WICKET-3256?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Martin Grigorov reassigned WICKET-3256:
---

Assignee: Pedro Santos  (was: Martin Grigorov)

The last patch looks very good.

> Use a Provider for IExceptionMapper
> ---
>
> Key: WICKET-3256
> URL: https://issues.apache.org/jira/browse/WICKET-3256
> Project: Wicket
>  Issue Type: New Feature
>  Components: wicket
>Affects Versions: 1.5-M3
>Reporter: James Carman
>Assignee: Pedro Santos
> Attachments: WICKET-3256-test-2.patch, WICKET-3256-test.patch, 
> WICKET-3256.patch
>
>
> Currently, in order to plug in your own IExceptionMapper, you have to 
> override a method.  This makes developing "frameworks" difficult, since your 
> client code has to do a method override in order to get everything working.  
> It would be nicer if the IExceptionManager was created via a "provider."

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.



[jira] Updated: (WICKET-3256) Use a Provider for IExceptionMapper

2010-12-17 Thread Pedro Santos (JIRA)

 [ 
https://issues.apache.org/jira/browse/WICKET-3256?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Pedro Santos updated WICKET-3256:
-

Attachment: WICKET-3256-test-2.patch

test to wrapper exception mapper providers

> Use a Provider for IExceptionMapper
> ---
>
> Key: WICKET-3256
> URL: https://issues.apache.org/jira/browse/WICKET-3256
> Project: Wicket
>  Issue Type: New Feature
>  Components: wicket
>Affects Versions: 1.5-M3
>Reporter: James Carman
>Assignee: Martin Grigorov
> Attachments: WICKET-3256-test-2.patch, WICKET-3256-test.patch, 
> WICKET-3256.patch
>
>
> Currently, in order to plug in your own IExceptionMapper, you have to 
> override a method.  This makes developing "frameworks" difficult, since your 
> client code has to do a method override in order to get everything working.  
> It would be nicer if the IExceptionManager was created via a "provider."

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.



[jira] Commented: (WICKET-3256) Use a Provider for IExceptionMapper

2010-12-17 Thread Pedro Santos (JIRA)

[ 
https://issues.apache.org/jira/browse/WICKET-3256?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12972492#action_12972492
 ] 

Pedro Santos commented on WICKET-3256:
--

The problem is that Wicket tester is creating an context to the request cycle 
to early: before we set the custom providers.

> Use a Provider for IExceptionMapper
> ---
>
> Key: WICKET-3256
> URL: https://issues.apache.org/jira/browse/WICKET-3256
> Project: Wicket
>  Issue Type: New Feature
>  Components: wicket
>Affects Versions: 1.5-M3
>Reporter: James Carman
>Assignee: Martin Grigorov
> Attachments: WICKET-3256-test.patch, WICKET-3256.patch
>
>
> Currently, in order to plug in your own IExceptionMapper, you have to 
> override a method.  This makes developing "frameworks" difficult, since your 
> client code has to do a method override in order to get everything working.  
> It would be nicer if the IExceptionManager was created via a "provider."

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.



[jira] Commented: (WICKET-3256) Use a Provider for IExceptionMapper

2010-12-17 Thread James Carman (JIRA)

[ 
https://issues.apache.org/jira/browse/WICKET-3256?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12972488#action_12972488
 ] 

James Carman commented on WICKET-3256:
--

I added a RequestCycleListener to the application in the test case and it 
wasn't notified either of the exception. 

> Use a Provider for IExceptionMapper
> ---
>
> Key: WICKET-3256
> URL: https://issues.apache.org/jira/browse/WICKET-3256
> Project: Wicket
>  Issue Type: New Feature
>  Components: wicket
>Affects Versions: 1.5-M3
>Reporter: James Carman
>Assignee: Martin Grigorov
> Attachments: WICKET-3256-test.patch, WICKET-3256.patch
>
>
> Currently, in order to plug in your own IExceptionMapper, you have to 
> override a method.  This makes developing "frameworks" difficult, since your 
> client code has to do a method override in order to get everything working.  
> It would be nicer if the IExceptionManager was created via a "provider."

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.



[jira] Commented: (WICKET-3256) Use a Provider for IExceptionMapper

2010-12-17 Thread James Carman (JIRA)

[ 
https://issues.apache.org/jira/browse/WICKET-3256?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12972480#action_12972480
 ] 

James Carman commented on WICKET-3256:
--

I can do it.  I just need to find a few cycles.  My morning is shot today (I'm 
on EDT), but I can probably address it this afternoon.

> Use a Provider for IExceptionMapper
> ---
>
> Key: WICKET-3256
> URL: https://issues.apache.org/jira/browse/WICKET-3256
> Project: Wicket
>  Issue Type: New Feature
>  Components: wicket
>Affects Versions: 1.5-M3
>Reporter: James Carman
>Assignee: Martin Grigorov
> Attachments: WICKET-3256-test.patch, WICKET-3256.patch
>
>
> Currently, in order to plug in your own IExceptionMapper, you have to 
> override a method.  This makes developing "frameworks" difficult, since your 
> client code has to do a method override in order to get everything working.  
> It would be nicer if the IExceptionManager was created via a "provider."

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.



[jira] Assigned: (WICKET-3256) Use a Provider for IExceptionMapper

2010-12-17 Thread Martin Grigorov (JIRA)

 [ 
https://issues.apache.org/jira/browse/WICKET-3256?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Martin Grigorov reassigned WICKET-3256:
---

Assignee: Martin Grigorov

> Use a Provider for IExceptionMapper
> ---
>
> Key: WICKET-3256
> URL: https://issues.apache.org/jira/browse/WICKET-3256
> Project: Wicket
>  Issue Type: New Feature
>  Components: wicket
>Affects Versions: 1.5-M3
>Reporter: James Carman
>Assignee: Martin Grigorov
> Attachments: WICKET-3256-test.patch, WICKET-3256.patch
>
>
> Currently, in order to plug in your own IExceptionMapper, you have to 
> override a method.  This makes developing "frameworks" difficult, since your 
> client code has to do a method override in order to get everything working.  
> It would be nicer if the IExceptionManager was created via a "provider."

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.



[jira] Commented: (WICKET-3256) Use a Provider for IExceptionMapper

2010-12-17 Thread Pedro Santos (JIRA)

[ 
https://issues.apache.org/jira/browse/WICKET-3256?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12972478#action_12972478
 ] 

Pedro Santos commented on WICKET-3256:
--

ok, I will keep working on the test case

> Use a Provider for IExceptionMapper
> ---
>
> Key: WICKET-3256
> URL: https://issues.apache.org/jira/browse/WICKET-3256
> Project: Wicket
>  Issue Type: New Feature
>  Components: wicket
>Affects Versions: 1.5-M3
>Reporter: James Carman
> Attachments: WICKET-3256-test.patch, WICKET-3256.patch
>
>
> Currently, in order to plug in your own IExceptionMapper, you have to 
> override a method.  This makes developing "frameworks" difficult, since your 
> client code has to do a method override in order to get everything working.  
> It would be nicer if the IExceptionManager was created via a "provider."

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.



[jira] Commented: (WICKET-3249) DateConverter improperly converts time, causing different results between DateField and DateTimeField

2010-12-17 Thread Andera Del Bene (JIRA)

[ 
https://issues.apache.org/jira/browse/WICKET-3249?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12972474#action_12972474
 ] 

Andera Del Bene commented on WICKET-3249:
-

So given the initial input :

DateTimeField: [ 11/06/2010 ] date, [ 0 ] hour, [ 0 ] min
DateField: [ 11/06/2010 ] date 

we should get the following values:

dateTimeField: 2010-11-06T00:00:00Z (timezone difference not applied)
dateField: 2010-11-06T07:00:00Z  (timezone difference applied)

Is it right?

As I said in my previous comment problem should be in class DataConverter.

> DateConverter improperly converts time, causing different results between 
> DateField and DateTimeField
> -
>
> Key: WICKET-3249
> URL: https://issues.apache.org/jira/browse/WICKET-3249
> Project: Wicket
>  Issue Type: Bug
>  Components: wicket-datetime
>Affects Versions: 1.4.6
>Reporter: Tauren Mills
>Priority: Minor
> Attachments: fix-WICKET-DateConverter.patch, TestDateConverter.java
>
>
> With a DateTimeField and a DateField in a wicket form, submit the following:
> DateTimeField: [   11/06/2010  ] date,  [ 0 ] hour,  [ 0 ] min
> DateField:  [   11/06/2010  ] date
> Those should result in the same value. But look at the converted Date values, 
> and you'll see this:
> dateTimeField:   2010-11-06T07:00:00Z
> dateField:  2010-11-06T23:00:00Z
> The dateTimeField value is what I'd expect - the UTC value of midnight in my 
> timezone on 11/6/2010.  It look like dateField is just wrong and that 
> DateConverter isn't dealing with timezone conversions properly. Here's the 
> scenario:
> * Server OS, Java, and Database are all configured to use UTC timezone.
> * Web client is configured in America/Los_Angeles timezone (currently 
> UTC-08:00, or PST).
> * Currently logged in member has profile configured to use 
> America/Los_Angeles timezone.
> * Application WebClientInfo has timezone set from the user's profile, like 
> such:
>   ClientInfo ci = Session.get().getClientInfo();
>   
> ((WebClientInfo)ci).getProperties().setTimeZone(TimeZone.getTimeZone(member.getTimezone()));
> Anywhere that dates are handled in the application with DateLabel or 
> DateTimeField, they seem to be properly converted by Wicket to and from 
> America/Los_Angeles time to UTC time for storage in the database. Examining 
> the database shows a 7 or 8 hour difference between the time in the UI and 
> the time in the database (depending on DST or not).
> However, when using org.apache.wicket.extensions.yui.calendar.DateField, 
> dates are getting converted/persisted incorrectly. I just traced through 
> DateConverter.convertToObject() to see what was happening. Assume it is 
> currently 2010-12-10 00:43 PST(-8). My client timezone is set to PST (-8), as 
> is my profile timezone. I specify 2010-11-06 in the DateField. It does this:
> 1. Creates a Joda value using DateMidnight right now in UTC (the date/time 
> right now in UTC, setting the time portion to midnight UTC. This will be a 
> time before now, not after now, as midnight is the first instant of a day, 
> not the last instant of a day). 2010-12-10T00:00:00Z
> 2. Converts this Joda value to the client's timezone.  
> 2010-12-09T16:00:00-08:00
> 3. Joda parses the submitted text value into the Joda value.  
> 2010-11-06T16:00:00-07:00
> 4. Converts the Joda value to the server's timezone.  2010-11-06T23:00:00Z
> The value should result in 2010-11-06T07:00:00Z, which converts to 
> 2010-11-06T00:00:00-08:00, or midnight on 11/6 in the PST timezone, but it 
> doesn't. Or am I missing something and there is a reason for this? It seems 
> like a bug to me.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.



[jira] Reopened: (WICKET-3260) setEscapeModelStrings() swallows ­

2010-12-17 Thread Pedro Santos (JIRA)

 [ 
https://issues.apache.org/jira/browse/WICKET-3260?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Pedro Santos reopened WICKET-3260:
--


closed by mistake

> setEscapeModelStrings() swallows ­
> --
>
> Key: WICKET-3260
> URL: https://issues.apache.org/jira/browse/WICKET-3260
> Project: Wicket
>  Issue Type: Bug
>  Components: wicket
>Affects Versions: 1.4.14
>Reporter: Gregor B. Rosenauer
>Priority: Minor
> Attachments: setEscapeModelStrings_shy-issue.html
>
>
> When inserting text with the HTML entity ­ (soft hyphen), Wicket ignores 
> it and it is not inserted into the markup even though using 
> setEscapeModelStrings(false);

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.



[jira] Resolved: (WICKET-3260) setEscapeModelStrings() swallows ­

2010-12-17 Thread Pedro Santos (JIRA)

 [ 
https://issues.apache.org/jira/browse/WICKET-3260?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Pedro Santos resolved WICKET-3260.
--

Resolution: Cannot Reproduce

> setEscapeModelStrings() swallows ­
> --
>
> Key: WICKET-3260
> URL: https://issues.apache.org/jira/browse/WICKET-3260
> Project: Wicket
>  Issue Type: Bug
>  Components: wicket
>Affects Versions: 1.4.14
>Reporter: Gregor B. Rosenauer
>Priority: Minor
> Attachments: setEscapeModelStrings_shy-issue.html
>
>
> When inserting text with the HTML entity ­ (soft hyphen), Wicket ignores 
> it and it is not inserted into the markup even though using 
> setEscapeModelStrings(false);

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.



[jira] Commented: (WICKET-3256) Use a Provider for IExceptionMapper

2010-12-17 Thread James Carman (JIRA)

[ 
https://issues.apache.org/jira/browse/WICKET-3256?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12972473#action_12972473
 ] 

James Carman commented on WICKET-3256:
--

I meant more in line with the way other stuff is set up on the Application.  
All of the other setBlahBlahProvider stuff.

> Use a Provider for IExceptionMapper
> ---
>
> Key: WICKET-3256
> URL: https://issues.apache.org/jira/browse/WICKET-3256
> Project: Wicket
>  Issue Type: New Feature
>  Components: wicket
>Affects Versions: 1.5-M3
>Reporter: James Carman
> Attachments: WICKET-3256-test.patch, WICKET-3256.patch
>
>
> Currently, in order to plug in your own IExceptionMapper, you have to 
> override a method.  This makes developing "frameworks" difficult, since your 
> client code has to do a method override in order to get everything working.  
> It would be nicer if the IExceptionManager was created via a "provider."

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.



[jira] Commented: (WICKET-3256) Use a Provider for IExceptionMapper

2010-12-17 Thread Pedro Santos (JIRA)

[ 
https://issues.apache.org/jira/browse/WICKET-3256?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12972471#action_12972471
 ] 

Pedro Santos commented on WICKET-3256:
--

By more in line you mean the BaseWicketTester.TestRequestCycleProvider way to 
wrap the IRequestMapper using the BaseWicketTester.TestExceptionMapper?

> Use a Provider for IExceptionMapper
> ---
>
> Key: WICKET-3256
> URL: https://issues.apache.org/jira/browse/WICKET-3256
> Project: Wicket
>  Issue Type: New Feature
>  Components: wicket
>Affects Versions: 1.5-M3
>Reporter: James Carman
> Attachments: WICKET-3256-test.patch, WICKET-3256.patch
>
>
> Currently, in order to plug in your own IExceptionMapper, you have to 
> override a method.  This makes developing "frameworks" difficult, since your 
> client code has to do a method override in order to get everything working.  
> It would be nicer if the IExceptionManager was created via a "provider."

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.



[jira] Reopened: (WICKET-3256) Use a Provider for IExceptionMapper

2010-12-17 Thread Pedro Santos (JIRA)

 [ 
https://issues.apache.org/jira/browse/WICKET-3256?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Pedro Santos reopened WICKET-3256:
--

  Assignee: (was: Pedro Santos)

Sorry James, I realize now that u can't reopen the ticket if it is closed. My 
mistake, what I mean is to mark the ticket as closed and see your reason to 
reopen.

> Use a Provider for IExceptionMapper
> ---
>
> Key: WICKET-3256
> URL: https://issues.apache.org/jira/browse/WICKET-3256
> Project: Wicket
>  Issue Type: New Feature
>  Components: wicket
>Affects Versions: 1.5-M3
>Reporter: James Carman
> Attachments: WICKET-3256-test.patch, WICKET-3256.patch
>
>
> Currently, in order to plug in your own IExceptionMapper, you have to 
> override a method.  This makes developing "frameworks" difficult, since your 
> client code has to do a method override in order to get everything working.  
> It would be nicer if the IExceptionManager was created via a "provider."

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.



[jira] Commented: (WICKET-3256) Use a Provider for IExceptionMapper

2010-12-17 Thread James Carman (JIRA)

[ 
https://issues.apache.org/jira/browse/WICKET-3256?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12972463#action_12972463
 ] 

James Carman commented on WICKET-3256:
--

It's usually good to let the original reporter close their own JIRA issues.  
The development team should resolve it, but the reporter should close it 
themselves (unless they completely disappear, which I did not).

Yes, this can be done with the IRequestCycleListener, but the way I set it up 
does make it fall more in line with how the other stuff works (the "providery" 
way).

> Use a Provider for IExceptionMapper
> ---
>
> Key: WICKET-3256
> URL: https://issues.apache.org/jira/browse/WICKET-3256
> Project: Wicket
>  Issue Type: New Feature
>  Components: wicket
>Affects Versions: 1.5-M3
>Reporter: James Carman
>Assignee: Pedro Santos
> Attachments: WICKET-3256-test.patch, WICKET-3256.patch
>
>
> Currently, in order to plug in your own IExceptionMapper, you have to 
> override a method.  This makes developing "frameworks" difficult, since your 
> client code has to do a method override in order to get everything working.  
> It would be nicer if the IExceptionManager was created via a "provider."

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.



[jira] Closed: (WICKET-3260) setEscapeModelStrings() swallows ­

2010-12-17 Thread Pedro Santos (JIRA)

 [ 
https://issues.apache.org/jira/browse/WICKET-3260?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Pedro Santos closed WICKET-3260.


Resolution: Cannot Reproduce

Hi Gregor, I couldn't reproduce.


add(new Label("message", 
"Long-UnbreakableText­LongUnbreakableText").setEscapeModelStrings(false));

is resulting in:
Long-UnbreakableText­LongUnbreakableText

> setEscapeModelStrings() swallows ­
> --
>
> Key: WICKET-3260
> URL: https://issues.apache.org/jira/browse/WICKET-3260
> Project: Wicket
>  Issue Type: Bug
>  Components: wicket
>Affects Versions: 1.4.14
>Reporter: Gregor B. Rosenauer
>Priority: Minor
> Attachments: setEscapeModelStrings_shy-issue.html
>
>
> When inserting text with the HTML entity ­ (soft hyphen), Wicket ignores 
> it and it is not inserted into the markup even though using 
> setEscapeModelStrings(false);

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.



[jira] Closed: (WICKET-3256) Use a Provider for IExceptionMapper

2010-12-17 Thread Pedro Santos (JIRA)

 [ 
https://issues.apache.org/jira/browse/WICKET-3256?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Pedro Santos closed WICKET-3256.


Resolution: Won't Fix

Martin is right:

app.setRequestCycleProvider(new IRequestCycleProvider()
{
public RequestCycle get(RequestCycleContext context)
{
RequestCycle requestCycle = new 
RequestCycle(context);
requestCycle.getListeners().add(new 
IRequestCycleListener()
{
public IRequestHandler 
onException(RequestCycle cycle, Exception ex)
{
--> custom handler
return null;
}

public void onEndRequest(RequestCycle 
cycle)
{
}

public void onDetach(RequestCycle cycle)
{
}

public void onBeginRequest(RequestCycle 
cycle)
{
}
});
return null;
}
});

> Use a Provider for IExceptionMapper
> ---
>
> Key: WICKET-3256
> URL: https://issues.apache.org/jira/browse/WICKET-3256
> Project: Wicket
>  Issue Type: New Feature
>  Components: wicket
>Affects Versions: 1.5-M3
>Reporter: James Carman
>Assignee: Pedro Santos
> Attachments: WICKET-3256-test.patch, WICKET-3256.patch
>
>
> Currently, in order to plug in your own IExceptionMapper, you have to 
> override a method.  This makes developing "frameworks" difficult, since your 
> client code has to do a method override in order to get everything working.  
> It would be nicer if the IExceptionManager was created via a "provider."

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.



[jira] Updated: (WICKET-3256) Use a Provider for IExceptionMapper

2010-12-17 Thread Pedro Santos (JIRA)

 [ 
https://issues.apache.org/jira/browse/WICKET-3256?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Pedro Santos updated WICKET-3256:
-

Attachment: WICKET-3256-test.patch

Hi James, sending an faling test case showing an wrapper exception mapper being 
ignored.

> Use a Provider for IExceptionMapper
> ---
>
> Key: WICKET-3256
> URL: https://issues.apache.org/jira/browse/WICKET-3256
> Project: Wicket
>  Issue Type: New Feature
>  Components: wicket
>Affects Versions: 1.5-M3
>Reporter: James Carman
>Assignee: Pedro Santos
> Attachments: WICKET-3256-test.patch, WICKET-3256.patch
>
>
> Currently, in order to plug in your own IExceptionMapper, you have to 
> override a method.  This makes developing "frameworks" difficult, since your 
> client code has to do a method override in order to get everything working.  
> It would be nicer if the IExceptionManager was created via a "provider."

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.



svn commit: r1050350 - /wicket/trunk/wicket/src/main/java/org/apache/wicket/request/resource/PackageResource.java

2010-12-17 Thread mgrigorov
Author: mgrigorov
Date: Fri Dec 17 11:24:09 2010
New Revision: 1050350

URL: http://svn.apache.org/viewvc?rev=1050350&view=rev
Log:
Make it possible to provide a different way to load the resource stream or wrap 
the one returned by super.getResourceStream() (e.g. to compress it).

requested-by: wiquery team

Modified:

wicket/trunk/wicket/src/main/java/org/apache/wicket/request/resource/PackageResource.java

Modified: 
wicket/trunk/wicket/src/main/java/org/apache/wicket/request/resource/PackageResource.java
URL: 
http://svn.apache.org/viewvc/wicket/trunk/wicket/src/main/java/org/apache/wicket/request/resource/PackageResource.java?rev=1050350&r1=1050349&r2=1050350&view=diff
==
--- 
wicket/trunk/wicket/src/main/java/org/apache/wicket/request/resource/PackageResource.java
 (original)
+++ 
wicket/trunk/wicket/src/main/java/org/apache/wicket/request/resource/PackageResource.java
 Fri Dec 17 11:24:09 2010
@@ -290,7 +290,7 @@ public class PackageResource extends Abs
 * 
 * @return resource stream or null if not found
 */
-   private IResourceStream getResourceStream()
+   protected IResourceStream getResourceStream()
{
// Locate resource
return ThreadContext.getApplication()




[jira] Updated: (WICKET-3260) setEscapeModelStrings() swallows ­

2010-12-17 Thread Gregor B. Rosenauer (JIRA)

 [ 
https://issues.apache.org/jira/browse/WICKET-3260?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Gregor B. Rosenauer updated WICKET-3260:


Attachment: setEscapeModelStrings_shy-issue.html

combined with a simple wicket page that creates a Label with the same text as 
in the DIV and using setEscapeModelStrings(false); this should reproduce the 
bug.

> setEscapeModelStrings() swallows ­
> --
>
> Key: WICKET-3260
> URL: https://issues.apache.org/jira/browse/WICKET-3260
> Project: Wicket
>  Issue Type: Bug
>  Components: wicket
>Affects Versions: 1.4.14
>Reporter: Gregor B. Rosenauer
>Priority: Minor
> Attachments: setEscapeModelStrings_shy-issue.html
>
>
> When inserting text with the HTML entity ­ (soft hyphen), Wicket ignores 
> it and it is not inserted into the markup even though using 
> setEscapeModelStrings(false);

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.



[jira] Created: (WICKET-3260) setEscapeModelStrings() swallows ­

2010-12-17 Thread Gregor B. Rosenauer (JIRA)
setEscapeModelStrings() swallows ­
--

 Key: WICKET-3260
 URL: https://issues.apache.org/jira/browse/WICKET-3260
 Project: Wicket
  Issue Type: Bug
  Components: wicket
Affects Versions: 1.4.14
Reporter: Gregor B. Rosenauer
Priority: Minor


When inserting text with the HTML entity ­ (soft hyphen), Wicket ignores it 
and it is not inserted into the markup even though using 
setEscapeModelStrings(false);


-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.



[jira] Commented: (WICKET-3256) Use a Provider for IExceptionMapper

2010-12-17 Thread Martin Grigorov (JIRA)

[ 
https://issues.apache.org/jira/browse/WICKET-3256?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12972437#action_12972437
 ] 

Martin Grigorov commented on WICKET-3256:
-

James, what you need is currently supported by 
org.apache.wicket.request.cycle.IRequestCycleListener.onException(RequestCycle, 
Exception).
You can add a custom listener that will return custom IRequestHandler depending 
on the Exception type.

The ExceptionMapper is used only if none of the registered listeners returns a 
non-null response for its onException() method.

> Use a Provider for IExceptionMapper
> ---
>
> Key: WICKET-3256
> URL: https://issues.apache.org/jira/browse/WICKET-3256
> Project: Wicket
>  Issue Type: New Feature
>  Components: wicket
>Affects Versions: 1.5-M3
>Reporter: James Carman
>Assignee: Pedro Santos
> Attachments: WICKET-3256.patch
>
>
> Currently, in order to plug in your own IExceptionMapper, you have to 
> override a method.  This makes developing "frameworks" difficult, since your 
> client code has to do a method override in order to get everything working.  
> It would be nicer if the IExceptionManager was created via a "provider."

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.