Re: Issues with default type conversion in 1.5

2012-09-08 Thread Paul Bors
Can you please put together a quick start for us?

~ Thank you,
   Paul C Bors

On Sep 7, 2012, at 14:39, Alec Swan alecs...@gmail.com wrote:

 Hello,
 
 I decided to extract this issue into a separate thread.
 
 I keep running into issues with default type converters in 1.5. I also
 think I found a bug in
 org.apache.wicket.util.lang.Objects#convertValue. A call to
 convertValue(nonNullNonArrayValue, Object.class) will always return
 null if nonNullNonArrayValue is a value that is not null and not an
 array! Shouldn't it always return the first parameter when the second
 parameter is Object.class?
 
 Is this a legitimate bug?
 
 Thanks,
 
 Alec
 
 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org
 

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



IComponentResolver and ajax components

2012-09-08 Thread hok
Hello, 
I'm using custom IComponentResolver for inserting widgets in the markup.
In this way I can create markup templates, which can be populated with
components. However, as far as I have read, the components that are inserted
via IComponentResolver are not serialized as part of the page, so if they
have some state associated with them (e.g. ajax, stateful form) this
functionality doesn't work. Is it possible that these remain part of the
page? Thanks in advance.



--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/IComponentResolver-and-ajax-components-tp4651869.html
Sent from the Users forum mailing list archive at Nabble.com.

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: Issues with default type conversion in 1.5

2012-09-08 Thread Alec Swan
An easy fix for this bug is to change the first line in
org.apache.wicket.util.lang.Objects#convertValue from
Object result = null;
to
Object result = value;

Thanks,

Alec

On Sat, Sep 8, 2012 at 1:02 PM, Alec Swan alecs...@gmail.com wrote:
 I attached a quickstart with a test in TestHomePage#formSubmitsSuccessfully.

 The test throws 'NEW VALUE' is not a valid Serializable error when
 NEW VALUE string in value textField is submitted as a part of
 myForm ajax submission.

 This bug should have a high priority in 1.5 because this used to work
 in 1.4 and there is no clear way to track down all places where this
 needs to be fixed in the existing code base.

 Thanks,

 Alec

 On Sat, Sep 8, 2012 at 12:16 AM, Paul Bors p...@bors.ws wrote:
 Can you please put together a quick start for us?

 ~ Thank you,
Paul C Bors

 On Sep 7, 2012, at 14:39, Alec Swan alecs...@gmail.com wrote:

 Hello,

 I decided to extract this issue into a separate thread.

 I keep running into issues with default type converters in 1.5. I also
 think I found a bug in
 org.apache.wicket.util.lang.Objects#convertValue. A call to
 convertValue(nonNullNonArrayValue, Object.class) will always return
 null if nonNullNonArrayValue is a value that is not null and not an
 array! Shouldn't it always return the first parameter when the second
 parameter is Object.class?

 Is this a legitimate bug?

 Thanks,

 Alec

 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org


 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org


-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Do I need a custom ResourceAggregator

2012-09-08 Thread Gonzalo Aguilar Delgado
Hello, 

I'm reimplementing my dojo interface again with version 6.0.0 of wicket.

I need to replicate same functionality that gives ResourceAggregator +
OnDomReadyHeaderItem.

I mean, I need that every script that goes into the require when don is
aggregated.


require([dojo/dom, dojo/domReady!], function(dom){
// All scripts here...
});


So I just want to create a new header item called DojoReadyHeaderItem
and add everything needed to the same script at the begining of the
page.

Behaviors will do something like this:

response.render(DojoReadyHeaderItem.forScript(foobar));
response.render(DojoReadyHeaderItem.forScript(foobar2));


And the result will be like:


require([dojo/dom, dojo/domReady!], function(dom){
foobar;
foobar2;
});


How can I do this with current implementation?

I don't know how to add my own ResourceAggregator...


Thank you in advance.



-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: Issues with default type conversion in 1.5

2012-09-08 Thread Sven Meier

Hi,

Objects#convertValue()'s javadoc states that it returns null, if the 
value can not be converted, thus your proposed change isn't valid for 
most cases.


You could easily fix this issue in your application by registering a 
custom converter for Serializable.


Since Objects#convertValue() does more actually than convert[ing] 
numerically (as stated in the javadoc, it handles booleans and Strings 
too), I think the method could be improved, e.g by adding another 
if-statement to it:


if (toType.isInstance(value))
{
result = toType.cast(value);
}

Please open an issue in Jira.

Sven


On 09/08/2012 09:11 PM, Alec Swan wrote:

An easy fix for this bug is to change the first line in
org.apache.wicket.util.lang.Objects#convertValue from
Object result = null;
to
Object result = value;

Thanks,

Alec

On Sat, Sep 8, 2012 at 1:02 PM, Alec Swan alecs...@gmail.com wrote:

I attached a quickstart with a test in TestHomePage#formSubmitsSuccessfully.

The test throws 'NEW VALUE' is not a valid Serializable error when
NEW VALUE string in value textField is submitted as a part of
myForm ajax submission.

This bug should have a high priority in 1.5 because this used to work
in 1.4 and there is no clear way to track down all places where this
needs to be fixed in the existing code base.

Thanks,

Alec

On Sat, Sep 8, 2012 at 12:16 AM, Paul Bors p...@bors.ws wrote:

Can you please put together a quick start for us?

~ Thank you,
Paul C Bors

On Sep 7, 2012, at 14:39, Alec Swan alecs...@gmail.com wrote:


Hello,

I decided to extract this issue into a separate thread.

I keep running into issues with default type converters in 1.5. I also
think I found a bug in
org.apache.wicket.util.lang.Objects#convertValue. A call to
convertValue(nonNullNonArrayValue, Object.class) will always return
null if nonNullNonArrayValue is a value that is not null and not an
array! Shouldn't it always return the first parameter when the second
parameter is Object.class?

Is this a legitimate bug?

Thanks,

Alec

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org


-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org


-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org




-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: Do I need a custom ResourceAggregator

2012-09-08 Thread Gonzalo Aguilar Delgado
Hello, 

I can answer myself. 

I was studing wicket code and the examples and found a solution,
extending DecoratingHeaderResponse. It still makes me feel a little bit
lost but it works.

I copied functionality from ResourceAggregator.


public class DojoAggregatorHeaderResponse extends
DecoratingHeaderResponse {
...

private void renderCombinedEventScripts()
{
StringBuilder combinedScript = new StringBuilder();
ListString dojoDependencies = new ArrayListString();
for (DojoRequireHeaderItem curItem : 
dojoRequireItemsToBeRendered)
{
HeaderItem itemToBeRendered = 
getItemToBeRendered(curItem);
if (itemToBeRendered == curItem)
{
combinedScript.append(\n);
combinedScript.append(curItem.getJavaScript());
combinedScript.append(;);
for(String requirement : 
curItem.getDojoDependencies())
{

if(!dojoDependencies.contains(requirement))

dojoDependencies.add(requirement);  // TODO Will be faster 
with a
hash?
}
}
else
{
getRealResponse().render(itemToBeRendered);
}

}
if (combinedScript.length()  0)
{
getRealResponse().render(

DojoRequireHeaderItem.forScript(combinedScript.append(\n).toString(),dojoDependencies));
}
}
...
}



Is this correct way to do it?


Best regards,




El sáb, 08-09-2012 a las 21:35 +0200, Gonzalo Aguilar Delgado escribió:
 Hello, 
 
 I'm reimplementing my dojo interface again with version 6.0.0 of wicket.
 
 I need to replicate same functionality that gives ResourceAggregator +
 OnDomReadyHeaderItem.
 
 I mean, I need that every script that goes into the require when don is
 aggregated.
 
 
 require([dojo/dom, dojo/domReady!], function(dom){
   // All scripts here...
 });
 
 
 So I just want to create a new header item called DojoReadyHeaderItem
 and add everything needed to the same script at the begining of the
 page.
 
 Behaviors will do something like this:
 
 response.render(DojoReadyHeaderItem.forScript(foobar));
   response.render(DojoReadyHeaderItem.forScript(foobar2));
 
 
 And the result will be like:
 
 
 require([dojo/dom, dojo/domReady!], function(dom){
   foobar;
   foobar2;
 });
 
 
 How can I do this with current implementation?
 
 I don't know how to add my own ResourceAggregator...
 
 
 Thank you in advance.
 
 
 
 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org
 


-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org