Re: Force Model to use getter

2017-12-01 Thread Andrew Geery
How about using an IConverter since the issue is not about the data itself
but the representation of it?

For example, you could create a Label class that overrides the
getConverter() and return a BigDecimalConverter object that overrides
the getNumberFormat method to return something like
DecimalFormat.getCurrencyInstance().

Andrew


On Fri, Dec 1, 2017 at 3:39 PM, sorinev  wrote:

> I added a setter for each property, but it's still not working (tried
> matching field types as well). I guess I'll just have to stick with the
> IModel route, even though I don't like it.
>
> I changed the Doubles to BigDecimal, thanks for the reminder.
>
> --
> Sent from: http://apache-wicket.1842946.n4.nabble.com/Users-forum-
> f1842947.html
>
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>


Re: Force Model to use getter

2017-12-01 Thread sorinev
I added a setter for each property, but it's still not working (tried
matching field types as well). I guess I'll just have to stick with the
IModel route, even though I don't like it.

I changed the Doubles to BigDecimal, thanks for the reminder.

--
Sent from: http://apache-wicket.1842946.n4.nabble.com/Users-forum-f1842947.html

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



Re: Force Model to use getter

2017-12-01 Thread Martin Grigorov
Hi,

The "problem" you face is that Wicket tries to find both getter and setter
[1] and if any of them do not exist then it falls back to the field.

I'd continue using a custom IModel for this use case.

And I'd also change the type of the "amount" to BigDecimal! Doing math with
doubles when dealing with money is a bomb with a timer!


1.
https://github.com/apache/wicket/blob/51d9e533dc3a45183210a1f4852851b485f02ea3/wicket-core/src/main/java/org/apache/wicket/core/util/lang/PropertyResolver.java#L274

Martin Grigorov
Wicket Training and Consulting
https://twitter.com/mtgrigorov

On Fri, Dec 1, 2017 at 7:54 PM, sorinev  wrote:

> Wicket 7.9.0.
>
> I have a Java double that is linked to a Wicket Label. This double
> represents a dollar amount, so I want to work with it as a double for math
> purposes. When I display it on the page however, I want it to a be a
> currency formatted String.
>
> I figured I would just add a getter to my page for that property, with a
> return type of String (and do the appropriate actions there). So for a
> member variable called 'amount' of type Double, I have a getter as 'private
> String getAmount()'. It's not working though, it still gets the value
> directly from the property itself when displaying on the page (and seems to
> get displayed as an int, at that).
>
> I was using CompoundPropertyModel at first, then after something i read on
> StackOverflow
>  propertymodel-strangeness>
> , I changed it to a PropertyModel, but it's still not working. Does the
> return type of the getter have to match the type of the variable, even if
> the getter method has the appropriate name otherwise? I am currently going
> with the method shown in the second answer by Andreas on that StackOverflow
> question, but I'd rather it be done automatically through PropertyModel or
> CompoundPropertyModel because it looks a lot cleaner.
>
> --
> Sent from: http://apache-wicket.1842946.n4.nabble.com/Users-forum-
> f1842947.html
>
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>


Re: Endless Redirect with tracking-mode COOKIE and Cookies Disabled in Browser

2017-12-01 Thread Martin Grigorov
Hi,

Technically, this is not managed by Wicket.
It is the web container (like Tomcat, Jetty, ...) that deals with these
matters.
Wicket just tries to bind a HttpSession and cannot find it after the
redirect.
There could be many reasons for this. The most common one is that the
session has just expired...

Martin Grigorov
Wicket Training and Consulting
https://twitter.com/mtgrigorov

On Fri, Dec 1, 2017 at 1:45 PM, Conny Kühne  wrote:

> Hi,
>
> when I select  COOKIE in the web.xml and
> disable cookies in the browser, I run into endless redirects for buffered
> responses. You can see this behavior, e.g., in the forminput example of the
> wicket-examples project.
>
> Not sure, whether this is a bug. After all, how should wicket know that the
> browser has disabled cookies. Maybe there should be a warning message
> during
> startup of the wicket app that the tracking-mode COOKIES could lead to
> endless redirects for stateful pages.
>
> Best,
> Conny
>
> --
> Sent from: http://apache-wicket.1842946.n4.nabble.com/Users-forum-
> f1842947.html
>
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>


Force Model to use getter

2017-12-01 Thread sorinev
Wicket 7.9.0.

I have a Java double that is linked to a Wicket Label. This double
represents a dollar amount, so I want to work with it as a double for math
purposes. When I display it on the page however, I want it to a be a
currency formatted String.

I figured I would just add a getter to my page for that property, with a
return type of String (and do the appropriate actions there). So for a
member variable called 'amount' of type Double, I have a getter as 'private
String getAmount()'. It's not working though, it still gets the value
directly from the property itself when displaying on the page (and seems to
get displayed as an int, at that).

I was using CompoundPropertyModel at first, then after something i read on 
StackOverflow
 
, I changed it to a PropertyModel, but it's still not working. Does the
return type of the getter have to match the type of the variable, even if
the getter method has the appropriate name otherwise? I am currently going
with the method shown in the second answer by Andreas on that StackOverflow
question, but I'd rather it be done automatically through PropertyModel or
CompoundPropertyModel because it looks a lot cleaner.

--
Sent from: http://apache-wicket.1842946.n4.nabble.com/Users-forum-f1842947.html

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



Endless Redirect with tracking-mode COOKIE and Cookies Disabled in Browser

2017-12-01 Thread Conny Kühne
Hi,

when I select  COOKIE in the web.xml and
disable cookies in the browser, I run into endless redirects for buffered
responses. You can see this behavior, e.g., in the forminput example of the
wicket-examples project.

Not sure, whether this is a bug. After all, how should wicket know that the
browser has disabled cookies. Maybe there should be a warning message during
startup of the wicket app that the tracking-mode COOKIES could lead to
endless redirects for stateful pages.

Best,
Conny

--
Sent from: http://apache-wicket.1842946.n4.nabble.com/Users-forum-f1842947.html

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



Re: IAjaxIndicatorAware AjaxBehavior for csv download

2017-12-01 Thread Kamil Paśko
I think he maent: https://issues.apache.org/jira/browse/WICKET-6448 
together with: https://issues.apache.org/jira/browse/WICKET-6460



W dniu 2017-11-30 o 13:53, Maxim Solodovnik pisze:

Since Wicket-8 you can use AjaxDownloadBehavior

I believe it should be more ajax friendly ...

On Thu, Nov 30, 2017 at 7:49 PM, Simon B  wrote:


Hello,

First thanks very much for Wicket I'm still enjoying using it even after
several years.

I'm trying to show a "Please Wait" message while my server gets all the
information for a csv file download.

The dowload (AjaxDownloadBehavior) works fine and is implemented as an
AbstractAjaxBehavior using this posting as a template:

https://cwiki.apache.org/confluence/display/WICKET/
AJAX+update+and+file+download+in+one+blow

The csv file download is initalized from an AjaxSubmitLink which I've made
IAjaxIndicatorAware to show the "Please Wait" message.

The problem is that the Indicator only shows for the duration of the
AjaxSubmitLink to return, the AjaxDownloadBehavior is run asynchronously
and
completes several seconds after the AjaxSubmitLink has returned and the
indicator disappeared.

How can I work the Indicator to show while the AjaxDownloadBehavior is
still
running and disappear when the users browse brings up the "Save File"
dialog
box.

Any help much appreciated.



--
Sent from: http://apache-wicket.1842946.n4.nabble.com/Users-forum-
f1842947.html

-
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