How to format number in (Number)TextField?

2017-10-24 Thread Kamil Paśko

Dear Wicket user group,


I have a TextField (but I can use NumberTextField as well) and when user 
types a number I want that:


1) number is positioned to the right

2) thousands are separated by spaces

3) floating point character is "."

How can I "force" that format in a TextField?

Kind regards,

Kamil



Re: How to format number in (Number)TextField?

2017-10-24 Thread Kamil Paśko

I tried with:

@Override
        protected void onInitialize() {
            super.onInitialize();
            InputMaskBehavior mask = new InputMaskBehavior() {

                @Override
                protected String getMask() {
                    return "999 999.99";
                }
            };
            add(mask);
        }

but this forces the user to type exactly what mask shows, so user can 
not type:


123 nor 123.11, it must be 123 123.11


W dniu 2017-10-24 o 14:48, Francois Meillet pisze:

You can use an input with a mask
something like 
Have a look at https://igorescobar.github.io/jQuery-Mask-Plugin/ 
<https://igorescobar.github.io/jQuery-Mask-Plugin/>

François




Le 24 oct. 2017 à 14:37, Maxim Solodovnik  a écrit :

I believe you can override "getTextFormat 
<https://ci.apache.org/projects/wicket/apidocs/8.x/org/apache/wicket/markup/html/form/AbstractTextComponent.ITextFormatProvider.html#getTextFormat-->()"
 method and provide your own format
According to right align: you can use CSS class for that :)

On Tue, Oct 24, 2017 at 6:52 PM, Kamil Paśko mailto:kamil.pa...@solsoft.pl>> wrote:
Dear Wicket user group,


I have a TextField (but I can use NumberTextField as well) and when user types 
a number I want that:

1) number is positioned to the right

2) thousands are separated by spaces

3) floating point character is "."



How can I "force" that format in a TextField?

Kind regards,

Kamil



--
WBR
Maxim aka solomax





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



Re: How to format number in (Number)TextField?

2017-10-24 Thread Kamil Paśko

Maxim,

I tried with:

    private final class MyFormattedField extends TextField 
implements ITextFormatProvider {

        private MyFormattedField(String id, IModel model) {
            super(id, model);
        }

        @Override
        public String getTextFormat() {
            return "### ###.###";
        }
    }

but this doesn't do anything.

user can type "12321321321" and value is not formatted


W dniu 2017-10-24 o 14:37, Maxim Solodovnik pisze:
I believe you can override "getTextFormat 
<https://ci.apache.org/projects/wicket/apidocs/8.x/org/apache/wicket/markup/html/form/AbstractTextComponent.ITextFormatProvider.html#getTextFormat-->()" 
method and provide your own format

According to right align: you can use CSS class for that :)

On Tue, Oct 24, 2017 at 6:52 PM, Kamil Paśko <mailto:kamil.pa...@solsoft.pl>> wrote:


Dear Wicket user group,


I have a TextField (but I can use NumberTextField as well) and
when user types a number I want that:

1) number is positioned to the right

2) thousands are separated by spaces

3) floating point character is "."

How can I "force" that format in a TextField?

Kind regards,

Kamil




--
WBR
Maxim aka solomax




Re: How to format number in (Number)TextField?

2017-10-24 Thread Kamil Paśko

Thanks!

Combining it with custom Behavior should do the trick


W dniu 2017-10-24 o 16:52, Maxim Solodovnik pisze:

I believe by overriding textFormat you can customize the way number is
being displayed
And the way text is being converted to number inside wicket.

to format field data while user prints you need to use JS llibrary
for ex. this one http://flaviosilveira.com/Jquery-Price-Format/ looks
promising 

On Tue, Oct 24, 2017 at 8:00 PM, Kamil Paśko  wrote:


Maxim,

I tried with:

 private final class MyFormattedField extends TextField
implements ITextFormatProvider {
 private MyFormattedField(String id, IModel model) {
 super(id, model);
 }

 @Override
 public String getTextFormat() {
 return "### ###.###";
 }
 }

but this doesn't do anything.

user can type "12321321321" and value is not formatted


W dniu 2017-10-24 o 14:37, Maxim Solodovnik pisze:


I believe you can override "getTextFormat <https://ci.apache.org/project
s/wicket/apidocs/8.x/org/apache/wicket/markup/html/form
/AbstractTextComponent.ITextFormatProvider.html#getTextFormat-->()"
method and provide your own format
According to right align: you can use CSS class for that :)

On Tue, Oct 24, 2017 at 6:52 PM, Kamil Paśko mailto:kamil.pa...@solsoft.pl>> wrote:

 Dear Wicket user group,


 I have a TextField (but I can use NumberTextField as well) and
 when user types a number I want that:

 1) number is positioned to the right

 2) thousands are separated by spaces

 3) floating point character is "."

 How can I "force" that format in a TextField?

 Kind regards,

 Kamil




--
WBR
Maxim aka solomax








-
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



How to mount 404 page with Wicket and Servlet 3.0?

2018-02-12 Thread Kamil Paśko

Hi,

*Background:*

I'm trying to mount 404 page to my Wicket project.

I found confluence page wchich explains how to do it using web.xml 
(https://cwiki.apache.org/confluence/display/WICKET/Error+Pages+and+Feedback+Messages#ErrorPagesandFeedbackMessages-HTTPErrorPages) 
but my application uses Wicket-SpringBoot 
(https://github.com/MarcGiffing/wicket-spring-boot), so instead of 
web.xml there is Servlet 3.0 configuration somewhere.


*Question:*

Does anybody have an idea how to mount 404 page using Wicket + 
Wicket-SpringBoot + Servlet 3.0?



Thank you in advance,

Kamil




Re: How to mount 404 page with Wicket and Servlet 3.0?

2018-02-13 Thread Kamil Paśko

Thank you Martin!

For anyone that could have this problem: solution with Wicket-SpringBoot 
and annotations (almost identical as Martin suggested) is as follows:


public class MyErrorPageRegistrar implements ErrorPageRegistrar {
    @Override
    public void registerErrorPages(final ErrorPageRegistry registry) {
    registry.addErrorPages(new ErrorPage(HttpStatus.NOT_FOUND, 
"/404")); //notice slash here

    }
}


@MountPath("404")
public class NotFoundPage extends Page {
    @Override
    protected void configureResponse(final WebResponse response) {
        super.configureResponse(response);
        response.setStatus(HttpServletResponse.SC_NOT_FOUND);
    }

    @Override
    public boolean isVersioned() {
    return false;
    }

    @Override
    public boolean isErrorPage() {
    return true;
    }
}


in WicketApplication class:

    @Bean
    public ErrorPageRegistrar errorPageRegistrar(){
    return new MyErrorPageRegistrar();
    }


Hi,

In a plain Spring Boot application (without Wicket-SpringBoot) you can do
it with ErrorPageRegistrar:

import org.springframework.boot.web.servlet.ErrorPage;
import org.springframework.boot.web.servlet.ErrorPageRegistrar;
import org.springframework.boot.web.servlet.ErrorPageRegistry;
import org.springframework.http.HttpStatus;

public class MyErrorPageRegistrar implements ErrorPageRegistrar {
 @Override
 public void registerErrorPages(final ErrorPageRegistry registry) {
 registry.addErrorPages(new ErrorPage(HttpStatus.NOT_FOUND,
MyApplication.PAGE_NOT_FOUND_MOUNT_PATH));
 }
}

In MySpringContext.java:

  @Bean
 public ErrorPageRegistrar errorPageRegistrar(){
 return new MyErrorPageRegistrar();
 }


In MyApplication.java:
mountPage(PAGE_NOT_FOUND_MOUNT_PATH, Error404Page.class);


Martin Grigorov
Wicket Training and Consulting
Looking for a remote position with Wicket ? Contact me!
https://twitter.com/mtgrigorov


On Mon, Feb 12, 2018 at 5:42 PM, Kamil Paśko  wrote:


Hi,

*Background:*

I'm trying to mount 404 page to my Wicket project.

I found confluence page wchich explains how to do it using web.xml (
https://cwiki.apache.org/confluence/display/WICKET/Error+
Pages+and+Feedback+Messages#ErrorPagesandFeedbackMessages-HTTPErrorPages)
but my application uses Wicket-SpringBoot (https://github.com/MarcGiffin
g/wicket-spring-boot), so instead of web.xml there is Servlet 3.0
configuration somewhere.

*Question:*

Does anybody have an idea how to mount 404 page using Wicket +
Wicket-SpringBoot + Servlet 3.0?


Thank you in advance,

Kamil






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



Re: Disable component to prevent double click

2018-03-01 Thread Kamil Paśko

Dear Claudia,

Don't you mind sharing your solution for all this cases?

It would be really beneficial for other users.

Kind regards,
Kamil

W dniu 2018-03-01 o 19:22, Claudia Hirt pisze:

Thanks again for your help.
I got the disabling behaviour bound to all kinds of links and buttons.
I solved the issue about cross-browser link disabling by adding a temporary copy of 
the  tag with JavaScript and hide the original link. This his seems to be 
the best solution for me.
I would like to share my code snippets with others who face the same problems 
if you‘re interested.

Best regards,
Claudia Hirt


Am 21.02.2018 um 21:59 schrieb Martin Grigorov :

You can override public CharSequence getAfterHandler(Component component)
instead to disable the button *after* the Ajax call is made.

Martin Grigorov
Wicket Training and Consulting
Looking for a remote position with Wicket ? Contact me!
https://twitter.com/mtgrigorov



On Wed, Feb 21, 2018 at 8:34 PM, Claudia Hirt  wrote:

Thanks for your answer. Your tip for non-ajax-buttons helped me a lot.
Just another remark about that: disabling a Button in getTriggerJavaScript
leads to the side effect that the onsubmit method of the Button will not be
called because the disabling is done before form submit.
The css property pointer-events does the trick in most cases but is poorly
supported in Internet Explorer.
I‘ll keep on trying...

Best regards,
Claudia Hirt


Am 20.02.2018 um 16:02 schrieb Andrea Del Bene :

Hi,

as reported in its javadoc AjaxDisableComponentListener by default uses

the

DOM attribute 'disabled' to do its job, but this attribute doesn't work
with links. For this kind of components you have to provide the right
JavaScript to enable/disable them by overriding

generateHandlerJavaScript.

Id you are not using AJAX you can not use this behavior and you must
provide the JavaScript code in some other way. For example with

SubmitLink

you have to override getTriggerJavaScript. Unfortunately "disabling" a

html

component is not a standard procedure so for those components that don't
support the attribute 'disabled' we must use custom JavaScript.


On Mon, Feb 19, 2018 at 9:55 PM, Claudia Hirt 

wrote:

By the way: is there any reason why AjaxDisableComponentListener has no
public constructor?


Am 19.02.2018 um 21:49 schrieb Claudia Hirt :

Hi all,
I‘m facing the problem of double submits when double clicking on

buttons

and links. I was very pleased to see there’s a new listener of
https://issues.apache.org/jira/browse/WICKET-6448 implemented in wicket
7.10. But this only works for Buttons not for links like a SubmitLink.

I‘m

also facing the same issue for non-ajax-components.

Any suggestions how to solve this?
Thanks in advance!
Best regards, Claudia


-
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: Disable component to prevent double click

2018-03-06 Thread Kamil Paśko

Thanks Claudia!


W dniu 2018-03-06 o 19:14, Claudia Hirt pisze:

Hi again,

I created a small sample project containing the double-click behaviors 
for ajax- and non-ajax-buttons and links:


https://github.com/sunshineKE/wicketdoubleclickexample/

Best regards,
Claudia Hirt


Am 01.03.2018 um 20:16 schrieb Kamil Paśko:

Dear Claudia,

Don't you mind sharing your solution for all this cases?

It would be really beneficial for other users.

Kind regards,
Kamil

W dniu 2018-03-01 o 19:22, Claudia Hirt pisze:

Thanks again for your help.
I got the disabling behaviour bound to all kinds of links and buttons.
I solved the issue about cross-browser link disabling by adding a 
temporary copy of the  tag with JavaScript and hide the original 
link. This his seems to be the best solution for me.
I would like to share my code snippets with others who face the same 
problems if you‘re interested.


Best regards,
Claudia Hirt


Am 21.02.2018 um 21:59 schrieb Martin Grigorov :

You can override public CharSequence getAfterHandler(Component 
component)

instead to disable the button *after* the Ajax call is made.

Martin Grigorov
Wicket Training and Consulting
Looking for a remote position with Wicket ? Contact me!
https://twitter.com/mtgrigorov


On Wed, Feb 21, 2018 at 8:34 PM, Claudia Hirt 
 wrote:


Thanks for your answer. Your tip for non-ajax-buttons helped me a 
lot.
Just another remark about that: disabling a Button in 
getTriggerJavaScript
leads to the side effect that the onsubmit method of the Button 
will not be

called because the disabling is done before form submit.
The css property pointer-events does the trick in most cases but 
is poorly

supported in Internet Explorer.
I‘ll keep on trying...

Best regards,
Claudia Hirt

Am 20.02.2018 um 16:02 schrieb Andrea Del Bene 
:


Hi,

as reported in its javadoc AjaxDisableComponentListener by 
default uses

the
DOM attribute 'disabled' to do its job, but this attribute 
doesn't work
with links. For this kind of components you have to provide the 
right

JavaScript to enable/disable them by overriding

generateHandlerJavaScript.

Id you are not using AJAX you can not use this behavior and you must
provide the JavaScript code in some other way. For example with

SubmitLink
you have to override getTriggerJavaScript. Unfortunately 
"disabling" a

html
component is not a standard procedure so for those components 
that don't

support the attribute 'disabled' we must use custom JavaScript.


On Mon, Feb 19, 2018 at 9:55 PM, Claudia Hirt 

wrote:
By the way: is there any reason why AjaxDisableComponentListener 
has no

public constructor?


Am 19.02.2018 um 21:49 schrieb Claudia Hirt :

Hi all,
I‘m facing the problem of double submits when double clicking on

buttons

and links. I was very pleased to see there’s a new listener of
https://issues.apache.org/jira/browse/WICKET-6448 implemented in 
wicket
7.10. But this only works for Buttons not for links like a 
SubmitLink.

I‘m

also facing the same issue for non-ajax-components.

Any suggestions how to solve this?
Thanks in advance!
Best regards, Claudia


- 


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




-
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: @SpringBean inside WebSession

2018-04-10 Thread Kamil Paśko

How about:

@Override
    public Session newSession(final Request request, final Response 
response) {
    final AuthenticatedSession session = (AuthenticatedSession) 
super.newSession(request, response);

    Injector.get().inject(session);
    return session;
    }


in WicketApplication?

For us, without this code, @SpringBean didn't work in session.

Maybe  it's a bug, maybe by design ;)


W dniu 2018-04-10 o 13:54, Martin Grigorov pisze:

Hi,

Is this a normal WAR deployment ?
Or Spring Boot self-executable ?
Or something else ...

On Tue, Apr 10, 2018 at 2:46 PM, tomask79  wrote:


question edited.

--
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