Re: AjaxCallListener and promises

2017-05-03 Thread Martin Grigorov
Hi,

No, Wicket doesn't use the return values for all handlers but
"preconditions" [1].
And even for preconditions the only value that matters is the literal
*false.*


1.
https://github.com/apache/wicket/blob/b24decd2f60983c11e75e5f2c34d0c6a93b56426/wicket-core/src/main/java/org/apache/wicket/ajax/res/js/wicket-ajax-jquery.js#L614

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

On Wed, May 3, 2017 at 5:52 PM, Boris Goldowsky  wrote:

> Is there any way to use a method that returns a promise as the onBefore of
> an IAxaxCallListener?  I don’t want the ajax operation to move forward
> until the promise resolves.  Due to the nature of promises in Javascript,
> there doesn’t seem to be a way to simply wait for it.
>
> Boris
>
>


Re: Question about ajax encoding/decoding, problem with image data url

2017-05-03 Thread Martin Makundi
My bad. Problem solved, accidentally this part of  code was within a
block of markup text where all whitespace was replaced with non breaking
space.

Nbsp looks the same for naked eye but a diff tool shows the difference, and
obviously browser will render differently  compared to
https://twitter.com/mtgrigorov
>>>
>>> On Wed, May 3, 2017 at 4:11 PM, Martin Makundi <
>>> martin.maku...@koodaripalvelut.com> wrote:
>>>
>>> > Here is a sample how it works in jsfiddle without problems:
>>> > https://jsfiddle.net/#=0SQvHmm6Nj
>>> >
>>> > But when same content is in ajax update it breaks. Wonder what happens
>>> to
>>> > it before render?
>>> >
>>> > 2017-05-03 16:06 GMT+03:00 Martin Makundi <
>>> > martin.maku...@koodaripalvelut.com>:
>>> >
>>> > > Hi!
>>> > >
>>> > > I am trying to display (wicket 1.4) an image using base64 image data
>>> > > representation.
>>> > >
>>> > > For some reason the base64 gets garbled every time with ajax.
>>> > >
>>> > > For example:
>>> > >
>>> > > src="data:image/png;base64,iVBORw0KGgoNSUhEUgAAAcIAAA
>>> > > CWCAYAAABNcIgQAAAKUklEQVR4nO3dzYoc1xkG4PcS+g5cVxDmAmzoC/
>>> > > BCm5BANrMIWXilCwgIvIl3hhC8CUYbe+WFcAgJWdgT8MI2xjEYjA0KGYSjmESY
>>> > > kSxLsmXHk0V1R6dPVff09H/JzwMHaTTVVae7xfnqfOen
>>> > >
>>> > > becomes (as viewed from firefox developer tools)
>>> > > >> > > bcm5banrmiwxilcwgivil3hhc8cuybe+wfcagjwdgt8mi2xjeyja0kgysjmesy
>>> > ksxlsmxhk0v1r6dpvff09h=""
>>> > > jzwmhattvvae7xfnqfoen...
>>> > >
>>> > > You can notice lots of ="" marks ="" splitting the string.
>>> > >
>>> > >
>>> > > Is this a wicket encoding issue or a javascript quirk?
>>> > >
>>> > > Thanks.
>>> > >
>>> > > **
>>> > > Martin
>>> > >
>>> > >
>>> >
>>>
>>
>>
>


Re: Question about ajax encoding/decoding, problem with image data url

2017-05-03 Thread Martin Makundi
Really strange, works on same installation in simpler installation. No
difference in http traffic...

2017-05-03 18:07 GMT+03:00 Martin Makundi <
martin.maku...@koodaripalvelut.com>:

> Interesting, it works in a quickstart also on v1.4.
>
> Need to investigate more.
>
> 2017-05-03 17:20 GMT+03:00 Martin Grigorov :
>
>> I don't see any reason why this could break.
>> If you are able to reproduce it in a quickstart with 6.26/7.6 then please
>> create a ticket in JIRA.
>>
>> Check what is in the Ajax response, not what is in the DOM.
>> Also you can check with Google Chrome. Maybe Firefox does something funky.
>>
>> Martin Grigorov
>> Wicket Training and Consulting
>> https://twitter.com/mtgrigorov
>>
>> On Wed, May 3, 2017 at 4:11 PM, Martin Makundi <
>> martin.maku...@koodaripalvelut.com> wrote:
>>
>> > Here is a sample how it works in jsfiddle without problems:
>> > https://jsfiddle.net/#=0SQvHmm6Nj
>> >
>> > But when same content is in ajax update it breaks. Wonder what happens
>> to
>> > it before render?
>> >
>> > 2017-05-03 16:06 GMT+03:00 Martin Makundi <
>> > martin.maku...@koodaripalvelut.com>:
>> >
>> > > Hi!
>> > >
>> > > I am trying to display (wicket 1.4) an image using base64 image data
>> > > representation.
>> > >
>> > > For some reason the base64 gets garbled every time with ajax.
>> > >
>> > > For example:
>> > >
>> > > src="data:image/png;base64,iVBORw0KGgoNSUhEUgAAAcIAAA
>> > > CWCAYAAABNcIgQAAAKUklEQVR4nO3dzYoc1xkG4PcS+g5cVxDmAmzoC/
>> > > BCm5BANrMIWXilCwgIvIl3hhC8CUYbe+WFcAgJWdgT8MI2xjEYjA0KGYSjmESY
>> > > kSxLsmXHk0V1R6dPVff09H/JzwMHaTTVVae7xfnqfOen
>> > >
>> > > becomes (as viewed from firefox developer tools)
>> > > > > > bcm5banrmiwxilcwgivil3hhc8cuybe+wfcagjwdgt8mi2xjeyja0kgysjmesy
>> > ksxlsmxhk0v1r6dpvff09h=""
>> > > jzwmhattvvae7xfnqfoen...
>> > >
>> > > You can notice lots of ="" marks ="" splitting the string.
>> > >
>> > >
>> > > Is this a wicket encoding issue or a javascript quirk?
>> > >
>> > > Thanks.
>> > >
>> > > **
>> > > Martin
>> > >
>> > >
>> >
>>
>
>


AjaxCallListener and promises

2017-05-03 Thread Boris Goldowsky
Is there any way to use a method that returns a promise as the onBefore of an 
IAxaxCallListener?  I don’t want the ajax operation to move forward until the 
promise resolves.  Due to the nature of promises in Javascript, there doesn’t 
seem to be a way to simply wait for it.

Boris



Re: Question about ajax encoding/decoding, problem with image data url

2017-05-03 Thread Martin Makundi
Interesting, it works in a quickstart also on v1.4.

Need to investigate more.

2017-05-03 17:20 GMT+03:00 Martin Grigorov :

> I don't see any reason why this could break.
> If you are able to reproduce it in a quickstart with 6.26/7.6 then please
> create a ticket in JIRA.
>
> Check what is in the Ajax response, not what is in the DOM.
> Also you can check with Google Chrome. Maybe Firefox does something funky.
>
> Martin Grigorov
> Wicket Training and Consulting
> https://twitter.com/mtgrigorov
>
> On Wed, May 3, 2017 at 4:11 PM, Martin Makundi <
> martin.maku...@koodaripalvelut.com> wrote:
>
> > Here is a sample how it works in jsfiddle without problems:
> > https://jsfiddle.net/#=0SQvHmm6Nj
> >
> > But when same content is in ajax update it breaks. Wonder what happens to
> > it before render?
> >
> > 2017-05-03 16:06 GMT+03:00 Martin Makundi <
> > martin.maku...@koodaripalvelut.com>:
> >
> > > Hi!
> > >
> > > I am trying to display (wicket 1.4) an image using base64 image data
> > > representation.
> > >
> > > For some reason the base64 gets garbled every time with ajax.
> > >
> > > For example:
> > >
> > > src="data:image/png;base64,iVBORw0KGgoNSUhEUgAAAcIAAA
> > > CWCAYAAABNcIgQAAAKUklEQVR4nO3dzYoc1xkG4PcS+g5cVxDmAmzoC/
> > > BCm5BANrMIWXilCwgIvIl3hhC8CUYbe+WFcAgJWdgT8MI2xjEYjA0KGYSjmESY
> > > kSxLsmXHk0V1R6dPVff09H/JzwMHaTTVVae7xfnqfOen
> > >
> > > becomes (as viewed from firefox developer tools)
> > >  > > bcm5banrmiwxilcwgivil3hhc8cuybe+wfcagjwdgt8mi2xjeyja0kgysjmesy
> > ksxlsmxhk0v1r6dpvff09h=""
> > > jzwmhattvvae7xfnqfoen...
> > >
> > > You can notice lots of ="" marks ="" splitting the string.
> > >
> > >
> > > Is this a wicket encoding issue or a javascript quirk?
> > >
> > > Thanks.
> > >
> > > **
> > > Martin
> > >
> > >
> >
>


Re: Question about ajax encoding/decoding, problem with image data url

2017-05-03 Thread Martin Grigorov
I don't see any reason why this could break.
If you are able to reproduce it in a quickstart with 6.26/7.6 then please
create a ticket in JIRA.

Check what is in the Ajax response, not what is in the DOM.
Also you can check with Google Chrome. Maybe Firefox does something funky.

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

On Wed, May 3, 2017 at 4:11 PM, Martin Makundi <
martin.maku...@koodaripalvelut.com> wrote:

> Here is a sample how it works in jsfiddle without problems:
> https://jsfiddle.net/#=0SQvHmm6Nj
>
> But when same content is in ajax update it breaks. Wonder what happens to
> it before render?
>
> 2017-05-03 16:06 GMT+03:00 Martin Makundi <
> martin.maku...@koodaripalvelut.com>:
>
> > Hi!
> >
> > I am trying to display (wicket 1.4) an image using base64 image data
> > representation.
> >
> > For some reason the base64 gets garbled every time with ajax.
> >
> > For example:
> >
> > src="data:image/png;base64,iVBORw0KGgoNSUhEUgAAAcIAAA
> > CWCAYAAABNcIgQAAAKUklEQVR4nO3dzYoc1xkG4PcS+g5cVxDmAmzoC/
> > BCm5BANrMIWXilCwgIvIl3hhC8CUYbe+WFcAgJWdgT8MI2xjEYjA0KGYSjmESY
> > kSxLsmXHk0V1R6dPVff09H/JzwMHaTTVVae7xfnqfOen
> >
> > becomes (as viewed from firefox developer tools)
> >  > bcm5banrmiwxilcwgivil3hhc8cuybe+wfcagjwdgt8mi2xjeyja0kgysjmesy
> ksxlsmxhk0v1r6dpvff09h=""
> > jzwmhattvvae7xfnqfoen...
> >
> > You can notice lots of ="" marks ="" splitting the string.
> >
> >
> > Is this a wicket encoding issue or a javascript quirk?
> >
> > Thanks.
> >
> > **
> > Martin
> >
> >
>


Re: Question about ajax encoding/decoding, problem with image data url

2017-05-03 Thread Martin Makundi
Here is a sample how it works in jsfiddle without problems:
https://jsfiddle.net/#=0SQvHmm6Nj

But when same content is in ajax update it breaks. Wonder what happens to
it before render?

2017-05-03 16:06 GMT+03:00 Martin Makundi <
martin.maku...@koodaripalvelut.com>:

> Hi!
>
> I am trying to display (wicket 1.4) an image using base64 image data
> representation.
>
> For some reason the base64 gets garbled every time with ajax.
>
> For example:
>
> src="data:image/png;base64,iVBORw0KGgoNSUhEUgAAAcIAAA
> CWCAYAAABNcIgQAAAKUklEQVR4nO3dzYoc1xkG4PcS+g5cVxDmAmzoC/
> BCm5BANrMIWXilCwgIvIl3hhC8CUYbe+WFcAgJWdgT8MI2xjEYjA0KGYSjmESY
> kSxLsmXHk0V1R6dPVff09H/JzwMHaTTVVae7xfnqfOen
>
> becomes (as viewed from firefox developer tools)
>  bcm5banrmiwxilcwgivil3hhc8cuybe+wfcagjwdgt8mi2xjeyja0kgysjmesyksxlsmxhk0v1r6dpvff09h=""
> jzwmhattvvae7xfnqfoen...
>
> You can notice lots of ="" marks ="" splitting the string.
>
>
> Is this a wicket encoding issue or a javascript quirk?
>
> Thanks.
>
> **
> Martin
>
>


Question about ajax encoding/decoding, problem with image data url

2017-05-03 Thread Martin Makundi
Hi!

I am trying to display (wicket 1.4) an image using base64 image data
representation.

For some reason the base64 gets garbled every time with ajax.

For example:

src="data:image/png;base64,iVBORw0KGgoNSUhEUgAAAcIAAACWCAYAAABNcIgQAAAKUklEQVR4nO3dzYoc1xkG4PcS+g5cVxDmAmzoC/BCm5BANrMIWXilCwgIvIl3hhC8CUYbe+WFcAgJWdgT8MI2xjEYjA0KGYSjmESYkSxLsmXHk0V1R6dPVff09H/JzwMHaTTVVae7xfnqfOen

becomes (as viewed from firefox developer tools)


Re: Modal dialog, form validation in AjaxBootstrapTabbedPanel

2017-05-03 Thread Martin Grigorov
Hi,

I think I see the problem.
When using AjaxBootstrapTabbedPanel the tabs' content is loaded one at a
time. This makes it hard to validate the complete form because not all
fields are available at any time.
You may need to use
https://github.com/l0rdn1kk0n/wicket-bootstrap/blob/wicket-7.x/bootstrap-core/src/main/java/de/agilecoders/wicket/core/markup/html/bootstrap/tabs/ClientSideBootstrapTabbedPanel.java
instead. It will switch the tabs
via JavaScript and make the validation once you use the submit button.
If this doesn't help you then I'll try to take a look at your application
after work!

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

On Wed, May 3, 2017 at 2:19 PM, Knaack, Ulrich <
ulrich.kna...@lgln.niedersachsen.de> wrote:

> Hi,
>
> I've to create a modal dialog which contains a AjaxBootstrapTabbedPanel
> with two or more tabs.
> All tabs belong to the same form. Each tab contains required input fields,
> select boxes
> or drop down choices. Until now, I don't use own validators, but this is a
> future task.
>
> I was able to trigger the validation when switching between the tabs.
>
> When I use the dialog like variant A and B, I get proper feedback from
> validation.
>
> Variant A
> 1. open the dialog
> 2. closing the dialog via submit button immediately results in
> feedback message "please enter a value in field..."
>
> Variant B
> 1. open the dialog
> 2. switch to another tab without filling required fields on initial
> tab gives also "please enter a value in ..."
>
> Variant C - validation problem
> Using the dialog in this way doesn't result in feedback messages:
> 1. open the dialog
> 2. enter all required values on the initial tab
> 3. don't enter values in required fields on another tab
> 4. use the submit button to close the diaolg: no feedback message!!,
> but there has to be one or more
>
> In Variant C, no logging output from the method
> BootstrapAjaxButton#onError() is printed.
>
> I'm using Wicket 7.6.0 and Wicket-Bootstrap 0.10.11
>
> The attachement contains a MCVE which can be run via test class
> StartTryOut.
>
>
> Regards,
> Ulrich Knaack
>
> Landesamt für Geoinformation und Landesvermessung Niedersachsen (LGLN)
> - Landesvermessung und Geobasisinformation - Landesbetrieb -
> Fachgebiet 224 - Geodateninfrastruktur
> Podbielskistraße 331, 30659 Hannover
> Tel.:+49 511 64609-287
> Fax: +49 511 64609-161
> mailto:ulrich.kna...@lgln.niedersachsen.de
> www.lgln.niedersachsen.de
>
>
>
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>


Re: Why has a cell item a model (and why is it a model with the populator (with the property) of the column)?

2017-05-03 Thread Sven Meier
Hi,

a cell item is an org.apache.wicket.markup.repeater.Item, and each item has
a model - so AbstractDataGridView just uses a model containing the
ICellPopulator for that.

It seems strange, that all cells of a row share the same model object, but
it does no harm.

Do you see a problem?

Have fun
Sven

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Why-has-a-cell-item-a-model-and-why-is-it-a-model-with-the-populator-with-the-property-of-the-column-tp462p463.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



Why has a cell item a model (and why is it a model with the populator (with the property) of the column)?

2017-05-03 Thread Eric J. Van der Velden
Hello,

I don't understand why a cell item gets a model, because I have not seen
where it is used. Only the model in the row item is used, together with the
property of the column.

Also why is the populator of the column in that model?


public abstract class AbstractDataGridView extends DataViewBase
@Override
protected final void populateItem(final Item item)
{

RepeatingView cells = new RepeatingView(CELL_REPEATER_ID);
item.add(cells);

int populatorsNumber = populators.size();
for (int i = 0; i < populatorsNumber; i++)
{
ICellPopulator populator = populators.get(i);
IModel populatorModel = new Model<>(populator);
Item cellItem = newCellItem(cells.newChildId(), i,
populatorModel);
cells.add(cellItem);
...

For example here we see that the row model + property of the column is
used, and not the model of the cell item:

public class PropertyPopulator implements ICellPopulator
@Override
public void populateItem(final Item cellItem, final
String componentId,
final IModel rowModel)
{
cellItem.add(new Label(componentId, new PropertyModel<>(rowModel,
property)));
}

Thanks.