WicketTester and confirmation modal

2016-01-15 Thread Marco Di Sabatino Di Diodoro

Hi all,

I'm implementing tests with WicketTester for Apache Syncope console.
How can I simulate a click on my confirmation modal?

This is my java class

public class ConfirmationModalBehavior extends Behavior {

private final String message;

public ConfirmationModalBehavior() {
this("confirmDelete");
}

public ConfirmationModalBehavior(final String msg) {
message = new ResourceModel(msg, "Are you sure?").getObject();
}

@Override
public void renderHead(final Component component, final 
IHeaderResponse response) {

super.renderHead(component, response);

response.render(JavaScriptHeaderItem.forScript("var confirm = 
false;", null));

response.render($(component).on("click",
new JavaScriptInlineFunction(""
+ "var element = $(this);"
+ "evt.preventDefault();"
+ "if(confirm == false){"
+ "evt.stopImmediatePropagation();"
+ "bootbox.confirm(\"" + message + "\", 
function(result){"

+ "if(result == true){"
+ "confirm = true;"
+ "element.click();"
+ "}"
+ "else{confirm = false;}"
+ "return true;"
+ "})} "
+ "else {confirm = false;};"
)).asDomReadyScript());
}
}

and this is the generated html






class="bootbox-close-button close" type="button" style="margin-top: 
-10px;">×
Do you really want to delete 
the selected item(s)?



data-bb-handler="cancel">Cancel
data-bb-handler="confirm">OK






Any suggestions?

Regards
M

--
Dott. Marco Di Sabatino Di Diodoro
Tel. +39 3939065570

Tirasa S.r.l.
Viale D'Annunzio 267 - 65127 Pescara
Tel +39 0859116307 / FAX +39 085973
http://www.tirasa.net

Apache Syncope PMC Member
http://people.apache.org/~mdisabatino/



Re: wicketstuff-select2 and Bootstrap 3

2016-01-15 Thread Ernesto Reinaldo Barreiro
I mean this project

https://fk.github.io/select2-bootstrap-css/

On Fri, Jan 15, 2016 at 11:54 AM, Ernesto Reinaldo Barreiro <
reier...@gmail.com> wrote:

> Maybe for that we can use the CSS from the same project Gabriel mentioned:
> as it was 3.x compatible. For the rest there isn't anything 7.X specific I
> think.
>
> On Fri, Jan 15, 2016 at 11:23 AM, Maxim Solodovnik 
> wrote:
>
>> I believe same fix (but different CSS) can be applied to wicket-6
>>
>> On Fri, Jan 15, 2016 at 4:21 PM, Tom Götz  wrote:
>>
>> > Any chance for a Bootstrap theme (backport) for wicketstuff 6.x (i.e.
>> > select2 version 3.x) …? We are currently still using Wicket 6.x and
>> can’t
>> > update yet because of infrastructure restrictions (app server not
>> > supporting Java 7 :-/ ) …
>> >
>> > Cheers,
>> >Tom
>> >
>> >
>> > > On 15.01.2016, at 10:02, Ernesto Reinaldo Barreiro <
>> reier...@gmail.com>
>> > wrote:
>> > >
>> > > Gabriel,
>> > >
>> > > Thanks for sharing! I ended up doing it a bit differently in order to
>> be
>> > > more compatible with existing select2 component. See
>> > >
>> > > https://github.com/wicketstuff/core/pull/453
>> > >
>> > > @martin-g, @solomax,
>> > >
>> > > Sorry again about white spaces vs tabs noise: I need to find some
>> time to
>> > > fix that on my idea settings :-(
>> > >
>> > >
>> > > On Thu, Jan 14, 2016 at 6:58 PM, Gabriel Landon 
>> wrote:
>> > >
>> > >> Ernesto,
>> > >>
>> > >> I've done a simple behavior that I add to the select2 component when
>> > >> needed.
>> > >>
>> > >> public class Select2CssBehavior extends Behavior {
>> > >>/** serialVersionUID. */
>> > >>private static final long serialVersionUID = 1L;
>> > >>/** Select2 CSS for bootstrap. */
>> > >>private static final CssResourceReference SELECT2_CSS = new
>> > >> CssResourceReference(Select2CssBehavior.class,
>> > >>"select2-bootstrap.css");
>> > >>
>> > >>@Override
>> > >>public void renderHead(final Component varComponent, final
>> > >> IHeaderResponse varResponse) {
>> > >>super.renderHead(varComponent, varResponse);
>> > >>varResponse.render(CssHeaderItem.forReference(SELECT2_CSS));
>> > >>}
>> > >>
>> > >> }
>> > >>
>> > >>
>> > >> --
>> > >> View this message in context:
>> > >>
>> >
>> http://apache-wicket.1842946.n4.nabble.com/wicketstuff-select2-and-Bootstrap-3-tp4673303p467.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
>> > >>
>> > >>
>> > >
>> > >
>> > > --
>> > > Regards - Ernesto Reinaldo Barreiro
>> >
>> >
>> >
>> >
>> >
>> > -
>> > To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
>> > For additional commands, e-mail: users-h...@wicket.apache.org
>> >
>> >
>>
>>
>> --
>> WBR
>> Maxim aka solomax
>>
>
>
>
> --
> Regards - Ernesto Reinaldo Barreiro
>



-- 
Regards - Ernesto Reinaldo Barreiro


Re: wicketstuff-select2 and Bootstrap 3

2016-01-15 Thread Tom Götz
Any chance for a Bootstrap theme (backport) for wicketstuff 6.x (i.e. select2 
version 3.x) …? We are currently still using Wicket 6.x and can’t update yet 
because of infrastructure restrictions (app server not supporting Java 7 :-/ ) …

Cheers,
   Tom


> On 15.01.2016, at 10:02, Ernesto Reinaldo Barreiro  wrote:
> 
> Gabriel,
> 
> Thanks for sharing! I ended up doing it a bit differently in order to be
> more compatible with existing select2 component. See
> 
> https://github.com/wicketstuff/core/pull/453
> 
> @martin-g, @solomax,
> 
> Sorry again about white spaces vs tabs noise: I need to find some time to
> fix that on my idea settings :-(
> 
> 
> On Thu, Jan 14, 2016 at 6:58 PM, Gabriel Landon  wrote:
> 
>> Ernesto,
>> 
>> I've done a simple behavior that I add to the select2 component when
>> needed.
>> 
>> public class Select2CssBehavior extends Behavior {
>>/** serialVersionUID. */
>>private static final long serialVersionUID = 1L;
>>/** Select2 CSS for bootstrap. */
>>private static final CssResourceReference SELECT2_CSS = new
>> CssResourceReference(Select2CssBehavior.class,
>>"select2-bootstrap.css");
>> 
>>@Override
>>public void renderHead(final Component varComponent, final
>> IHeaderResponse varResponse) {
>>super.renderHead(varComponent, varResponse);
>>varResponse.render(CssHeaderItem.forReference(SELECT2_CSS));
>>}
>> 
>> }
>> 
>> 
>> --
>> View this message in context:
>> http://apache-wicket.1842946.n4.nabble.com/wicketstuff-select2-and-Bootstrap-3-tp4673303p467.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
>> 
>> 
> 
> 
> -- 
> Regards - Ernesto Reinaldo Barreiro





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



Re: wicketstuff-select2 and Bootstrap 3

2016-01-15 Thread Maxim Solodovnik
I believe same fix (but different CSS) can be applied to wicket-6

On Fri, Jan 15, 2016 at 4:21 PM, Tom Götz  wrote:

> Any chance for a Bootstrap theme (backport) for wicketstuff 6.x (i.e.
> select2 version 3.x) …? We are currently still using Wicket 6.x and can’t
> update yet because of infrastructure restrictions (app server not
> supporting Java 7 :-/ ) …
>
> Cheers,
>Tom
>
>
> > On 15.01.2016, at 10:02, Ernesto Reinaldo Barreiro 
> wrote:
> >
> > Gabriel,
> >
> > Thanks for sharing! I ended up doing it a bit differently in order to be
> > more compatible with existing select2 component. See
> >
> > https://github.com/wicketstuff/core/pull/453
> >
> > @martin-g, @solomax,
> >
> > Sorry again about white spaces vs tabs noise: I need to find some time to
> > fix that on my idea settings :-(
> >
> >
> > On Thu, Jan 14, 2016 at 6:58 PM, Gabriel Landon  wrote:
> >
> >> Ernesto,
> >>
> >> I've done a simple behavior that I add to the select2 component when
> >> needed.
> >>
> >> public class Select2CssBehavior extends Behavior {
> >>/** serialVersionUID. */
> >>private static final long serialVersionUID = 1L;
> >>/** Select2 CSS for bootstrap. */
> >>private static final CssResourceReference SELECT2_CSS = new
> >> CssResourceReference(Select2CssBehavior.class,
> >>"select2-bootstrap.css");
> >>
> >>@Override
> >>public void renderHead(final Component varComponent, final
> >> IHeaderResponse varResponse) {
> >>super.renderHead(varComponent, varResponse);
> >>varResponse.render(CssHeaderItem.forReference(SELECT2_CSS));
> >>}
> >>
> >> }
> >>
> >>
> >> --
> >> View this message in context:
> >>
> http://apache-wicket.1842946.n4.nabble.com/wicketstuff-select2-and-Bootstrap-3-tp4673303p467.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
> >>
> >>
> >
> >
> > --
> > Regards - Ernesto Reinaldo Barreiro
>
>
>
>
>
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>


-- 
WBR
Maxim aka solomax


Re: wicketstuff-select2 and Bootstrap 3

2016-01-15 Thread Maxim Solodovnik
It has "MIT License" so I see no problems here :)

On Fri, Jan 15, 2016 at 5:22 PM, Ernesto Reinaldo Barreiro <
reier...@gmail.com> wrote:

> I mean this project
>
> https://fk.github.io/select2-bootstrap-css/
>
> On Fri, Jan 15, 2016 at 11:54 AM, Ernesto Reinaldo Barreiro <
> reier...@gmail.com> wrote:
>
> > Maybe for that we can use the CSS from the same project Gabriel
> mentioned:
> > as it was 3.x compatible. For the rest there isn't anything 7.X specific
> I
> > think.
> >
> > On Fri, Jan 15, 2016 at 11:23 AM, Maxim Solodovnik  >
> > wrote:
> >
> >> I believe same fix (but different CSS) can be applied to wicket-6
> >>
> >> On Fri, Jan 15, 2016 at 4:21 PM, Tom Götz  wrote:
> >>
> >> > Any chance for a Bootstrap theme (backport) for wicketstuff 6.x (i.e.
> >> > select2 version 3.x) …? We are currently still using Wicket 6.x and
> >> can’t
> >> > update yet because of infrastructure restrictions (app server not
> >> > supporting Java 7 :-/ ) …
> >> >
> >> > Cheers,
> >> >Tom
> >> >
> >> >
> >> > > On 15.01.2016, at 10:02, Ernesto Reinaldo Barreiro <
> >> reier...@gmail.com>
> >> > wrote:
> >> > >
> >> > > Gabriel,
> >> > >
> >> > > Thanks for sharing! I ended up doing it a bit differently in order
> to
> >> be
> >> > > more compatible with existing select2 component. See
> >> > >
> >> > > https://github.com/wicketstuff/core/pull/453
> >> > >
> >> > > @martin-g, @solomax,
> >> > >
> >> > > Sorry again about white spaces vs tabs noise: I need to find some
> >> time to
> >> > > fix that on my idea settings :-(
> >> > >
> >> > >
> >> > > On Thu, Jan 14, 2016 at 6:58 PM, Gabriel Landon 
> >> wrote:
> >> > >
> >> > >> Ernesto,
> >> > >>
> >> > >> I've done a simple behavior that I add to the select2 component
> when
> >> > >> needed.
> >> > >>
> >> > >> public class Select2CssBehavior extends Behavior {
> >> > >>/** serialVersionUID. */
> >> > >>private static final long serialVersionUID = 1L;
> >> > >>/** Select2 CSS for bootstrap. */
> >> > >>private static final CssResourceReference SELECT2_CSS = new
> >> > >> CssResourceReference(Select2CssBehavior.class,
> >> > >>"select2-bootstrap.css");
> >> > >>
> >> > >>@Override
> >> > >>public void renderHead(final Component varComponent, final
> >> > >> IHeaderResponse varResponse) {
> >> > >>super.renderHead(varComponent, varResponse);
> >> > >>varResponse.render(CssHeaderItem.forReference(SELECT2_CSS));
> >> > >>}
> >> > >>
> >> > >> }
> >> > >>
> >> > >>
> >> > >> --
> >> > >> View this message in context:
> >> > >>
> >> >
> >>
> http://apache-wicket.1842946.n4.nabble.com/wicketstuff-select2-and-Bootstrap-3-tp4673303p467.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
> >> > >>
> >> > >>
> >> > >
> >> > >
> >> > > --
> >> > > Regards - Ernesto Reinaldo Barreiro
> >> >
> >> >
> >> >
> >> >
> >> >
> >> > -
> >> > To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> >> > For additional commands, e-mail: users-h...@wicket.apache.org
> >> >
> >> >
> >>
> >>
> >> --
> >> WBR
> >> Maxim aka solomax
> >>
> >
> >
> >
> > --
> > Regards - Ernesto Reinaldo Barreiro
> >
>
>
>
> --
> Regards - Ernesto Reinaldo Barreiro
>



-- 
WBR
Maxim aka solomax


Re: wicketstuff-select2 and Bootstrap 3

2016-01-15 Thread Ernesto Reinaldo Barreiro
Maybe for that we can use the CSS from the same project Gabriel mentioned:
as it was 3.x compatible. For the rest there isn't anything 7.X specific I
think.

On Fri, Jan 15, 2016 at 11:23 AM, Maxim Solodovnik 
wrote:

> I believe same fix (but different CSS) can be applied to wicket-6
>
> On Fri, Jan 15, 2016 at 4:21 PM, Tom Götz  wrote:
>
> > Any chance for a Bootstrap theme (backport) for wicketstuff 6.x (i.e.
> > select2 version 3.x) …? We are currently still using Wicket 6.x and can’t
> > update yet because of infrastructure restrictions (app server not
> > supporting Java 7 :-/ ) …
> >
> > Cheers,
> >Tom
> >
> >
> > > On 15.01.2016, at 10:02, Ernesto Reinaldo Barreiro  >
> > wrote:
> > >
> > > Gabriel,
> > >
> > > Thanks for sharing! I ended up doing it a bit differently in order to
> be
> > > more compatible with existing select2 component. See
> > >
> > > https://github.com/wicketstuff/core/pull/453
> > >
> > > @martin-g, @solomax,
> > >
> > > Sorry again about white spaces vs tabs noise: I need to find some time
> to
> > > fix that on my idea settings :-(
> > >
> > >
> > > On Thu, Jan 14, 2016 at 6:58 PM, Gabriel Landon 
> wrote:
> > >
> > >> Ernesto,
> > >>
> > >> I've done a simple behavior that I add to the select2 component when
> > >> needed.
> > >>
> > >> public class Select2CssBehavior extends Behavior {
> > >>/** serialVersionUID. */
> > >>private static final long serialVersionUID = 1L;
> > >>/** Select2 CSS for bootstrap. */
> > >>private static final CssResourceReference SELECT2_CSS = new
> > >> CssResourceReference(Select2CssBehavior.class,
> > >>"select2-bootstrap.css");
> > >>
> > >>@Override
> > >>public void renderHead(final Component varComponent, final
> > >> IHeaderResponse varResponse) {
> > >>super.renderHead(varComponent, varResponse);
> > >>varResponse.render(CssHeaderItem.forReference(SELECT2_CSS));
> > >>}
> > >>
> > >> }
> > >>
> > >>
> > >> --
> > >> View this message in context:
> > >>
> >
> http://apache-wicket.1842946.n4.nabble.com/wicketstuff-select2-and-Bootstrap-3-tp4673303p467.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
> > >>
> > >>
> > >
> > >
> > > --
> > > Regards - Ernesto Reinaldo Barreiro
> >
> >
> >
> >
> >
> > -
> > To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> > For additional commands, e-mail: users-h...@wicket.apache.org
> >
> >
>
>
> --
> WBR
> Maxim aka solomax
>



-- 
Regards - Ernesto Reinaldo Barreiro


Re: wicketstuff-select2 and Bootstrap 3

2016-01-15 Thread Ernesto Reinaldo Barreiro
My commit to fix white-spaces has fixed nothing :-( I'm on the busy side
right now if someone else can help with that it would be of great help.

@Tom,

To port this to 6.x the only thing to do is copy the changes on PR and
replace CSS with

https://raw.githubusercontent.com/t0m/select2-bootstrap-css/bootstrap3/select2-bootstrap.css

Thought it seems they are not using themes... ? If so we might need to fix
code to allow for empty "name" themes?

https://github.com/wicketstuff/core/pull/453/files#diff-f89d585dcac47246368aa870803d6272R112



On Fri, Jan 15, 2016 at 12:29 PM, Maxim Solodovnik 
wrote:

> It has "MIT License" so I see no problems here :)
>
> On Fri, Jan 15, 2016 at 5:22 PM, Ernesto Reinaldo Barreiro <
> reier...@gmail.com> wrote:
>
> > I mean this project
> >
> > https://fk.github.io/select2-bootstrap-css/
> >
> > On Fri, Jan 15, 2016 at 11:54 AM, Ernesto Reinaldo Barreiro <
> > reier...@gmail.com> wrote:
> >
> > > Maybe for that we can use the CSS from the same project Gabriel
> > mentioned:
> > > as it was 3.x compatible. For the rest there isn't anything 7.X
> specific
> > I
> > > think.
> > >
> > > On Fri, Jan 15, 2016 at 11:23 AM, Maxim Solodovnik <
> solomax...@gmail.com
> > >
> > > wrote:
> > >
> > >> I believe same fix (but different CSS) can be applied to wicket-6
> > >>
> > >> On Fri, Jan 15, 2016 at 4:21 PM, Tom Götz  wrote:
> > >>
> > >> > Any chance for a Bootstrap theme (backport) for wicketstuff 6.x
> (i.e.
> > >> > select2 version 3.x) …? We are currently still using Wicket 6.x and
> > >> can’t
> > >> > update yet because of infrastructure restrictions (app server not
> > >> > supporting Java 7 :-/ ) …
> > >> >
> > >> > Cheers,
> > >> >Tom
> > >> >
> > >> >
> > >> > > On 15.01.2016, at 10:02, Ernesto Reinaldo Barreiro <
> > >> reier...@gmail.com>
> > >> > wrote:
> > >> > >
> > >> > > Gabriel,
> > >> > >
> > >> > > Thanks for sharing! I ended up doing it a bit differently in order
> > to
> > >> be
> > >> > > more compatible with existing select2 component. See
> > >> > >
> > >> > > https://github.com/wicketstuff/core/pull/453
> > >> > >
> > >> > > @martin-g, @solomax,
> > >> > >
> > >> > > Sorry again about white spaces vs tabs noise: I need to find some
> > >> time to
> > >> > > fix that on my idea settings :-(
> > >> > >
> > >> > >
> > >> > > On Thu, Jan 14, 2016 at 6:58 PM, Gabriel Landon 
> > >> wrote:
> > >> > >
> > >> > >> Ernesto,
> > >> > >>
> > >> > >> I've done a simple behavior that I add to the select2 component
> > when
> > >> > >> needed.
> > >> > >>
> > >> > >> public class Select2CssBehavior extends Behavior {
> > >> > >>/** serialVersionUID. */
> > >> > >>private static final long serialVersionUID = 1L;
> > >> > >>/** Select2 CSS for bootstrap. */
> > >> > >>private static final CssResourceReference SELECT2_CSS = new
> > >> > >> CssResourceReference(Select2CssBehavior.class,
> > >> > >>"select2-bootstrap.css");
> > >> > >>
> > >> > >>@Override
> > >> > >>public void renderHead(final Component varComponent, final
> > >> > >> IHeaderResponse varResponse) {
> > >> > >>super.renderHead(varComponent, varResponse);
> > >> > >>
> varResponse.render(CssHeaderItem.forReference(SELECT2_CSS));
> > >> > >>}
> > >> > >>
> > >> > >> }
> > >> > >>
> > >> > >>
> > >> > >> --
> > >> > >> View this message in context:
> > >> > >>
> > >> >
> > >>
> >
> http://apache-wicket.1842946.n4.nabble.com/wicketstuff-select2-and-Bootstrap-3-tp4673303p467.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
> > >> > >>
> > >> > >>
> > >> > >
> > >> > >
> > >> > > --
> > >> > > Regards - Ernesto Reinaldo Barreiro
> > >> >
> > >> >
> > >> >
> > >> >
> > >> >
> > >> >
> -
> > >> > To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> > >> > For additional commands, e-mail: users-h...@wicket.apache.org
> > >> >
> > >> >
> > >>
> > >>
> > >> --
> > >> WBR
> > >> Maxim aka solomax
> > >>
> > >
> > >
> > >
> > > --
> > > Regards - Ernesto Reinaldo Barreiro
> > >
> >
> >
> >
> > --
> > Regards - Ernesto Reinaldo Barreiro
> >
>
>
>
> --
> WBR
> Maxim aka solomax
>



-- 
Regards - Ernesto Reinaldo Barreiro


Re: WicketTester and confirmation modal

2016-01-15 Thread Martin Grigorov
Hi,

You cannot test JavaScript with WicketTester.
You can set some request parameter that says "confirmed" or "denied" and
make a request to the server side where you process it.

You can use something like Selenium for testing real clicks in JavaScript.

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

On Fri, Jan 15, 2016 at 11:13 AM, Marco Di Sabatino Di Diodoro <
marco.disabat...@tirasa.net> wrote:

> Hi all,
>
> I'm implementing tests with WicketTester for Apache Syncope console.
> How can I simulate a click on my confirmation modal?
>
> This is my java class
>
> public class ConfirmationModalBehavior extends Behavior {
>
> private final String message;
>
> public ConfirmationModalBehavior() {
> this("confirmDelete");
> }
>
> public ConfirmationModalBehavior(final String msg) {
> message = new ResourceModel(msg, "Are you sure?").getObject();
> }
>
> @Override
> public void renderHead(final Component component, final
> IHeaderResponse response) {
> super.renderHead(component, response);
>
> response.render(JavaScriptHeaderItem.forScript("var confirm =
> false;", null));
> response.render($(component).on("click",
> new JavaScriptInlineFunction(""
> + "var element = $(this);"
> + "evt.preventDefault();"
> + "if(confirm == false){"
> + "evt.stopImmediatePropagation();"
> + "bootbox.confirm(\"" + message + "\",
> function(result){"
> + "if(result == true){"
> + "confirm = true;"
> + "element.click();"
> + "}"
> + "else{confirm = false;}"
> + "return true;"
> + "})} "
> + "else {confirm = false;};"
> )).asDomReadyScript());
> }
> }
>
> and this is the generated html
>
> 
> 
> 
> 
>  class="bootbox-close-button close" type="button" style="margin-top:
> -10px;">×
> Do you really want to delete the
> selected item(s)?
> 
> 
>  data-bb-handler="cancel">Cancel
>  data-bb-handler="confirm">OK
> 
> 
> 
> 
>
> Any suggestions?
>
> Regards
> M
>
> --
> Dott. Marco Di Sabatino Di Diodoro
> Tel. +39 3939065570
>
> Tirasa S.r.l.
> Viale D'Annunzio 267 - 65127 Pescara
> Tel +39 0859116307 / FAX +39 085973
> http://www.tirasa.net
>
> Apache Syncope PMC Member
> http://people.apache.org/~mdisabatino/
>
>


Re: WicketTester and confirmation modal

2016-01-15 Thread Marco Di Sabatino Di Diodoro



Il 15/01/2016 13:51, Martin Grigorov ha scritto:

Hi,

You cannot test JavaScript with WicketTester.
You can set some request parameter that says "confirmed" or "denied" and
make a request to the server side where you process it.

You can use something like Selenium for testing real clicks in JavaScript.

Thanks, for your support.
I used wicketTester.getRequest().addParameter("confirm", "true");

Regards
M

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

On Fri, Jan 15, 2016 at 11:13 AM, Marco Di Sabatino Di Diodoro <
marco.disabat...@tirasa.net> wrote:


Hi all,

I'm implementing tests with WicketTester for Apache Syncope console.
How can I simulate a click on my confirmation modal?

This is my java class

public class ConfirmationModalBehavior extends Behavior {

 private final String message;

 public ConfirmationModalBehavior() {
 this("confirmDelete");
 }

 public ConfirmationModalBehavior(final String msg) {
 message = new ResourceModel(msg, "Are you sure?").getObject();
 }

 @Override
 public void renderHead(final Component component, final
IHeaderResponse response) {
 super.renderHead(component, response);

 response.render(JavaScriptHeaderItem.forScript("var confirm =
false;", null));
 response.render($(component).on("click",
 new JavaScriptInlineFunction(""
 + "var element = $(this);"
 + "evt.preventDefault();"
 + "if(confirm == false){"
 + "evt.stopImmediatePropagation();"
 + "bootbox.confirm(\"" + message + "\",
function(result){"
 + "if(result == true){"
 + "confirm = true;"
 + "element.click();"
 + "}"
 + "else{confirm = false;}"
 + "return true;"
 + "})} "
 + "else {confirm = false;};"
 )).asDomReadyScript());
 }
}

and this is the generated html


 
 
 
 ×
 Do you really want to delete the
selected item(s)?
 
 
 Cancel
 OK
 
 
 


Any suggestions?

Regards
M

--
Dott. Marco Di Sabatino Di Diodoro
Tel. +39 3939065570

Tirasa S.r.l.
Viale D'Annunzio 267 - 65127 Pescara
Tel +39 0859116307 / FAX +39 085973
http://www.tirasa.net

Apache Syncope PMC Member
http://people.apache.org/~mdisabatino/




--
Dott. Marco Di Sabatino Di Diodoro
Tel. +39 3939065570

Tirasa S.r.l.
Viale D'Annunzio 267 - 65127 Pescara
Tel +39 0859116307 / FAX +39 085973
http://www.tirasa.net

Apache Syncope PMC Member
http://people.apache.org/~mdisabatino/



form model update in a wizard program

2016-01-15 Thread trlt
Hi all,

There is probably something very fundamental that I don't in wicket models. 
Attached is a very simple quickstart to illustrate my problem.

In it, I have a 2-step wizard program:

1) Select "Faculty" from the Appointment Type drop down in step 1;
2) Show what's been selected (works as expected) in "Next" step;
3) Now go back to Select "Staff" from the Appointment Type drop down using
"Previous" button;
4) Label works, but the drop down doesn't (the value stays with same).

I've tried various way to update the model, but to no avail. Hope someone
can shed some light on this for me. Thanks! quickstart.zip
  

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/form-model-update-in-a-wizard-program-tp4673357.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: form model update in a wizard program

2016-01-15 Thread Sven Meier

Hi,

when you move to the previous step, the form inside of the wizard is not 
processed, thus the user input is preserved until next rendering.
Later one when you move to this step once again, the still present user 
input takes precedence over the current values in the model object.


Solution:

add(new PreviousButton("previous", wizard) {
@Override
public void onClick() {
// don't keep input when going back
getForm().clearInput();

super.onClick();
}
});

BTW you should move the following code in SelectEmployeeStep:

@Override
protected void onSubmit() {
employee.setEntry2(employee.getAppointment_type()); // 
default for next step

}

... to an overriden #applyState():

@Override
public void applyState() {
employee.setEntry2(employee.getAppointment_type()); // default 
for next step

}

This way you don't have to mess with calling #process() by yourself in 
RequestWizard#MyButtonBar which is rather awkward.
Furthermore you don't need to have forms inside your steps actually, 
since Wizard itself has a form already.


Have fun
Sven


On 15.01.2016 21:09, trlt wrote:

Hi all,

There is probably something very fundamental that I don't in wicket models.
Attached is a very simple quickstart to illustrate my problem.

In it, I have a 2-step wizard program:

1) Select "Faculty" from the Appointment Type drop down in step 1;
2) Show what's been selected (works as expected) in "Next" step;
3) Now go back to Select "Staff" from the Appointment Type drop down using
"Previous" button;
4) Label works, but the drop down doesn't (the value stays with same).

I've tried various way to update the model, but to no avail. Hope someone
can shed some light on this for me. Thanks! quickstart.zip


--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/form-model-update-in-a-wizard-program-tp4673357.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




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



Re: wicketstuff-select2 and Bootstrap 3

2016-01-15 Thread Ernesto Reinaldo Barreiro
Gabriel,

Thanks for sharing! I ended up doing it a bit differently in order to be
more compatible with existing select2 component. See

https://github.com/wicketstuff/core/pull/453

@martin-g, @solomax,

Sorry again about white spaces vs tabs noise: I need to find some time to
fix that on my idea settings :-(


On Thu, Jan 14, 2016 at 6:58 PM, Gabriel Landon  wrote:

> Ernesto,
>
> I've done a simple behavior that I add to the select2 component when
> needed.
>
> public class Select2CssBehavior extends Behavior {
> /** serialVersionUID. */
> private static final long serialVersionUID = 1L;
> /** Select2 CSS for bootstrap. */
> private static final CssResourceReference SELECT2_CSS = new
> CssResourceReference(Select2CssBehavior.class,
> "select2-bootstrap.css");
>
> @Override
> public void renderHead(final Component varComponent, final
> IHeaderResponse varResponse) {
> super.renderHead(varComponent, varResponse);
> varResponse.render(CssHeaderItem.forReference(SELECT2_CSS));
> }
>
> }
>
>
> --
> View this message in context:
> http://apache-wicket.1842946.n4.nabble.com/wicketstuff-select2-and-Bootstrap-3-tp4673303p467.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
>
>


-- 
Regards - Ernesto Reinaldo Barreiro