Can we use stateful pages for web sites?

2013-02-03 Thread Bernard
Hi all,

It takes us more time to work around Wicket bugs than the gain of
using Wicket's statefulness.

It is productive to use Wicket's AJAX and passing around IModel
between pages.

But when doing this we get bugs where page links are no longer
bookmarkable even if the pages are in fact bookmarkable.

Wicket gets confused with bookmarkable pages that are not stateful.
See issues:

PageProvider should create a new Page instance if PageParameters are
changed, even if a stored page exists.
https://issues.apache.org/jira/browse/WICKET-4441


Mounted bookmarkable Page not recreated on Session Expiry
https://issues.apache.org/jira/browse/WICKET-4997

Recovery of bookmarkable Page after Session Expiry
https://issues.apache.org/jira/browse/WICKET-5001


PageProvider#getPageInstance() calls wrong Page Constructor if
pageParameters is null
https://issues.apache.org/jira/browse/WICKET-5008

We can't have all pages stateless because any standard Wicket AJAX
needs server state.

I think there is a major issue with
org.apache.wicket.Component#urlFor() which handles pages as
bookmarkable only if they are stateless.

How are you dealing with this?

Regards

Bernard

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



Re: FormComponent markup

2013-02-03 Thread Andrea Del Bene
ok, I think I've figured out what you need. If you want to group two or 
more form fields in your custom form component you should extend class 
FormComponentPanel instead of FormComponent. This class combines the 
features of both a Panel (it has it's own markup file) and a 
FormComponent (it is a subclass of FormComponent). So for example 
PersonFormComponent will have the following code and markup:


class PersonFormComponent extends FormComponentPanel
{
  PersonFormComponent(Person p)
  {
super("personFormComponent", new CompoundPropertyModel(p));
add(new TextField("firstname"));
add(new TextField("lastname"));
  }
}

markup:




First Name:
Last Name:




Now you can attach you custom component in your form as if it was a 
Panel. You can use a div or a span tag to attach it:



Form form = new Form("form");

form.add(new PersonFormComponent("personFormComponent"));

markup:


  
  


Remember that if you don't like to have a div or a span in you final 
markup you can always call setRenderBodyOnly(true) on your custom component.

No, it's not clear to me once again, sorry, but the above suggestion does not
fit the real case.

Let's make a more concrete example.

class Person
{
   String firstname;
   String lastname;
}

class PhoneNumber
{
   Person person;
   String dial;
   boolean mobile;
}

class PersonFormComponent extends FormComponent
{
   PersonFormComponent(Person p)
   {
 super("personFormComponent", new CompoundPropertyModel(p));
 add(new TextField("firstname"));
 add(new TextField("lastname"));
   }
}

class PhoneNumberComponent extends FormComponentModel
{
   PhoneNumberComponent(PhoneNumber n)
   {
 super("phoneNumberFormComponent", new CompoundPropertyModel(n));
 add(new TextField("dial"));
 add(new CheckBox("mobile"));
   }
}

class PersonForm
{
   PersonForm(Person p)
   {
super("personForm");
add(new PersonFormComponent("personFormComponent",
new CompoundPropertyModel(model));
PhoneNumber pn = findOrCreatePhoneNumber(p);
add(new PhoneNumberFormComponent("phoneNumberComponent", pn);
   }
}

PersonForm.html:

   First Name:
   Last Name:
   ...
   Phone Number:
   Mobile?


What should I write in place of "" ? If I put the FormComponents IDs then
the CompoundPropertyModels won't find the fields to bind. If I put the beans
fields names, then the PersonForm constructor won't find the IDs to bind the
whole FormComponent subclasses.

Can you please show me the markup needed for the above example?




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



Re: FormComponent markup

2013-02-03 Thread Lucio Crusca
In data domenica 3 febbraio 2013 14:57:46, Lucio Crusca ha scritto:
> In data domenica 3 febbraio 2013 13:17:13, Andrea Del Bene ha scritto:
> > To clarify a bit more, you should end up writing something like:
> > 
> > 
> > 
> >
> >...
> > 
> > 
> > 
> >   and Java code
> > 
> > Form form = new Form("form");
> > 
> > form.add(new FormComponentA("formcomponentA"));
> > form.add(new FormComponentB("formcomponentB"));
> 
> Thanks, now it seems clear. Last doubt, what if I have two or more texts in
> either FormComponent? Shouls I repeat wicket:id="FormComponentA" for each
> one?

No, it's not clear to me once again, sorry, but the above suggestion does not 
fit the real case.

Let's make a more concrete example.

class Person
{
  String firstname;
  String lastname;
}

class PhoneNumber
{
  Person person;
  String dial;
  boolean mobile;
}

class PersonFormComponent extends FormComponent
{
  PersonFormComponent(Person p)
  {
super("personFormComponent", new CompoundPropertyModel(p));
add(new TextField("firstname"));
add(new TextField("lastname"));
  }
}

class PhoneNumberComponent extends FormComponentModel
{
  PhoneNumberComponent(PhoneNumber n)
  {
super("phoneNumberFormComponent", new CompoundPropertyModel(n));
add(new TextField("dial"));
add(new CheckBox("mobile"));
  }
}

class PersonForm
{
  PersonForm(Person p)
  { 
   super("personForm");
   add(new PersonFormComponent("personFormComponent", 
new CompoundPropertyModel(model));
   PhoneNumber pn = findOrCreatePhoneNumber(p);
   add(new PhoneNumberFormComponent("phoneNumberComponent", pn);
  }
}

PersonForm.html:

  First Name:
  Last Name:
  ...
  Phone Number:
  Mobile?


What should I write in place of "" ? If I put the FormComponents IDs then 
the CompoundPropertyModels won't find the fields to bind. If I put the beans 
fields names, then the PersonForm constructor won't find the IDs to bind the 
whole FormComponent subclasses.

Can you please show me the markup needed for the above example?


Re: Style Modifier

2013-02-03 Thread William Speirs
Cool, thanks Martin!

Bill-


On Sun, Feb 3, 2013 at 2:59 AM, Martin Grigorov wrote:

> Hi Bill,
>
> As we see there is no much interest to put this in wicket-core, but you can
> contribute it to wicketstuff-minis (
> https://github.com/wicketstuff/core/tree/master/jdk-1.6-parent/minis-parent
> )
> if you like.
>
>
> On Sun, Feb 3, 2013 at 5:38 AM, William Speirs  wrote:
>
> > @Paul Bors I would normally do the same type of thing, but I found myself
> > in a situation where I needed to style the background color of a div that
> > is dynamically loaded from a DB. ie, the user is free to chose whatever
> > color they want for the div's background.
> >
> > A quick modification of the style element was useful here...
> >
> > Bill-
> >
> >
> > On Sat, Feb 2, 2013 at 5:18 AM, vineet semwal  > >wrote:
> >
> > > yes,appears useful to me  :)
> > >  however not sure if this should be added in wicket-core..
> > > another way of doing the same thing is a reusable ondomreadyheaderitem
> > >  using jquery's css(propertyName,value) in a neat way ..
> > >
> > > On Fri, Feb 1, 2013 at 8:14 PM, William Speirs 
> > wrote:
> > > > I created a Behavior the other night that allows one to modify the
> > style
> > > > attribute of a tag by easily adding or removing a CSS property. Why
> is
> > > this
> > > > better/different than AttributeModifier? Because you can update a CSS
> > > > property inside the style attribute. Basic usage:
> > > >
> > > > myComponent.add(new StyleModifier("background-color", "blue")); //
> > > changes
> > > > (or adds) the background-color property of the style tag on this
> > > component
> > > > to blue
> > > >
> > > > myComponent.add(new StyleModifier("background-color")); // removes
> the
> > > > background-color property from the style tag on this component
> > > >
> > > > Would anyone else find this useful? Would the devs on this list
> > consider
> > > > taking it in for the next release of Wicket (if so I can open an
> JIRA)?
> > > Is
> > > > this already implemented and I'm just too stupid to have found it?
> > > >
> > > > Thanks...
> > > >
> > > > Bill-
> > >
> > >
> > >
> > > --
> > > regards,
> > >
> > > Vineet Semwal
> > >
> > > -
> > > To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> > > For additional commands, e-mail: users-h...@wicket.apache.org
> > >
> > >
> >
>
>
>
> --
> Martin Grigorov
> jWeekend
> Training, Consulting, Development
> http://jWeekend.com 
>


Re: Suggestion: Generics in Panel to specify type of default model?

2013-02-03 Thread Martin Grigorov
See GenericPanel and few other components which implement IGenericComponent
We may make them all generic for Wicket 7 if JDK 7 is minimum and diamonds
can be used.


On Sun, Feb 3, 2013 at 3:28 PM, Ondrej Zizka  wrote:

> Hi,
>
> wouldn't it be nice if Panel had type param - Panel - which would be
> used for:
> IModel getDefaultModel()
> T getDefaultModelObject()
>
> Or why is it not so?
>
> Thanks,
> Ondra
>
> --**--**-
> To unsubscribe, e-mail: 
> users-unsubscribe@wicket.**apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>


-- 
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.com 


Suggestion: Generics in Panel to specify type of default model?

2013-02-03 Thread Ondrej Zizka

Hi,

wouldn't it be nice if Panel had type param - Panel - which would be 
used for:

IModel getDefaultModel()
T getDefaultModelObject()

Or why is it not so?

Thanks,
Ondra

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



Re: FormComponent markup

2013-02-03 Thread Lucio Crusca
In data domenica 3 febbraio 2013 13:17:13, Andrea Del Bene ha scritto:
> To clarify a bit more, you should end up writing something like:
> 
> 
>
>...
> 
> 
>   and Java code
> 
> Form form = new Form("form");
> 
> form.add(new FormComponentA("formcomponentA"));
> form.add(new FormComponentB("formcomponentB"));

Thanks, now it seems clear. Last doubt, what if I have two or more texts in 
either FormComponent? Shouls I repeat wicket:id="FormComponentA" for each one?



Re: FormComponent markup

2013-02-03 Thread Andrea Del Bene

To clarify a bit more, you should end up writing something like:


  
  ...


 and Java code

Form form = new Form("form");

form.add(new FormComponentA("formcomponentA"));
form.add(new FormComponentB("formcomponentB"));


In data sabato 2 febbraio 2013 22:28:11, Lucio Crusca ha scritto:

Does that mean I'll have A.html like


   
   ...


and then add my FormComponentA and FormComponentB instances directly to
that Form? And that I won't have any FormComponentA.html /
FormComponentB.html?

Probably not, I suspect I haven't understood. I tried doing like stated above,
but the FormComponent constructor wants an id, so now I assume that each
FormComponent subclass instance has to provide a different id. That makes me
wonder again how should I write the html files.

I'm not able to explain why, but the following solutions seems wrong to me:


   
 
   
   
 ...
   






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



Re: Style Modifier

2013-02-03 Thread Martin Grigorov
Hi Bill,

As we see there is no much interest to put this in wicket-core, but you can
contribute it to wicketstuff-minis (
https://github.com/wicketstuff/core/tree/master/jdk-1.6-parent/minis-parent)
if you like.


On Sun, Feb 3, 2013 at 5:38 AM, William Speirs  wrote:

> @Paul Bors I would normally do the same type of thing, but I found myself
> in a situation where I needed to style the background color of a div that
> is dynamically loaded from a DB. ie, the user is free to chose whatever
> color they want for the div's background.
>
> A quick modification of the style element was useful here...
>
> Bill-
>
>
> On Sat, Feb 2, 2013 at 5:18 AM, vineet semwal  >wrote:
>
> > yes,appears useful to me  :)
> >  however not sure if this should be added in wicket-core..
> > another way of doing the same thing is a reusable ondomreadyheaderitem
> >  using jquery's css(propertyName,value) in a neat way ..
> >
> > On Fri, Feb 1, 2013 at 8:14 PM, William Speirs 
> wrote:
> > > I created a Behavior the other night that allows one to modify the
> style
> > > attribute of a tag by easily adding or removing a CSS property. Why is
> > this
> > > better/different than AttributeModifier? Because you can update a CSS
> > > property inside the style attribute. Basic usage:
> > >
> > > myComponent.add(new StyleModifier("background-color", "blue")); //
> > changes
> > > (or adds) the background-color property of the style tag on this
> > component
> > > to blue
> > >
> > > myComponent.add(new StyleModifier("background-color")); // removes the
> > > background-color property from the style tag on this component
> > >
> > > Would anyone else find this useful? Would the devs on this list
> consider
> > > taking it in for the next release of Wicket (if so I can open an JIRA)?
> > Is
> > > this already implemented and I'm just too stupid to have found it?
> > >
> > > Thanks...
> > >
> > > Bill-
> >
> >
> >
> > --
> > regards,
> >
> > Vineet Semwal
> >
> > -
> > To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> > For additional commands, e-mail: users-h...@wicket.apache.org
> >
> >
>



-- 
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.com