Component level FeedbackPanel's (and a form-level one)

2009-11-12 Thread Tomás Rossi

Hi people,

¿What is the Wicket's way of adding component level feedback panels? I 
mean, having one feedback panel for each form component (on a side or 
below the field), and somehow a global feedback panel with a filter so 
that it doesn't show the already showed messages.


I tried the following:

public class BordeFeedbackPanel extends Border implements IFeedback {
  public BordeFeedbackPanel(final String id) {
  super(id);
  add(new ComponentFeedbackPanel("feedback", this));
  }
}


  
  
  Invalid field
  


And in the form:

add(new BordeFeedbackPanel("brd1").add(TextField(...

But I get a horrible exception!... :(

Unexpected RuntimeException

Root cause:

java.util.ConcurrentModificationException
at java.util.AbstractList$Itr.checkForComodification(AbstractList.java:372)
at java.util.AbstractList$Itr.next(AbstractList.java:343)
at org.apache.wicket.Component.prepareForRender(Component.java:2236)
at org.apache.wicket.Component.prepareForRender(Component.java:2260)
at org.apache.wicket.Page.renderPage(Page.java:893)
at 
org.apache.wicket.request.target.component.BookmarkablePageRequestTarget.respond(BookmarkablePageRequestTarget.java:262)
at 
org.apache.wicket.request.AbstractRequestCycleProcessor.respond(AbstractRequestCycleProcessor.java:105)
at 
org.apache.wicket.RequestCycle.processEventsAndRespond(RequestCycle.java:1258)

at org.apache.wicket.RequestCycle.step(RequestCycle.java:1329)
at org.apache.wicket.RequestCycle.steps(RequestCycle.java:1428)
at org.apache.wicket.RequestCycle.request(RequestCycle.java:545)
at org.apache.wicket.protocol.http.WicketFilter.doGet(WicketFilter.java:468)
at 
org.apache.wicket.protocol.http.WicketFilter.doFilter(WicketFilter.java:301)
at 
org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1089)

at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:365)
at 
org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216)

at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:181)
at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:712)
at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:405)
at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:139)
at org.mortbay.jetty.Server.handle(Server.java:295)
at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:503)
at 
org.mortbay.jetty.HttpConnection$RequestHandler.headerComplete(HttpConnection.java:827)

at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:511)
at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:210)
at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:379)
at 
org.mortbay.jetty.bio.SocketConnector$Connection.run(SocketConnector.java:226)
at 
org.mortbay.thread.BoundedThreadPool$PoolThread.run(BoundedThreadPool.java:442)


What is happening? How can I achieve this?

Thanks,
Tom;

PS: I've already done it using a Label for each component instead of a 
FeedbackPanel and it worked, but now trying another (more proper) approach.


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



Re: StatelessForm.clearInput()

2009-10-30 Thread Tomás Rossi

Ok, I did it. I needed to clean the model object like this...

...
   add(new Button("clear") {
   private static final long serialVersionUID = 1L;

   public void onSubmit() {
   getForm().modelChanging();
   data.clear(); // data is the model object of the 
form, and clear sets null to all fields, recursively

   getForm().modelChanged();
   getForm().clearInput();
   };
   }.setDefaultFormProcessing(false));
...

Tomás Rossi escribió:
Wait a minute... Because I need a reset button which effectively clean 
all fields and feedback messages. Reset button doesn't do that so it's 
not what I want.


Tomás Rossi escribió:

That's a very good question. I'll use that.

But then, if it weren't a stateless form, should I involve Wicket and 
use clearInput()? Why?


Tom;

Martin Grigorov escribió:

What's the benefit of this approach instead of using  without involving Wicket at all (it is stateless form) ?

El vie, 30-10-2009 a las 12:42 -0300, Tomás Rossi escribió:
 

Hi.

I have a stateless form and a button inside to reset all fields 
like this:


...
add(new Button("clear") {
private static final long serialVersionUID = 1L;

public void onSubmit() {
getForm().clearInput();
};
}.setDefaultFormProcessing(false));
...

The first time I use the form, fill some inputs and then hit 
"Clear", the form is submitted and returns from the server clean 
(which is what I expected to happen). But after I submit the form 
with all valid input (that redirects me to another page with a 
message), then press browser's back button (return to the form) and 
then hit the Clear button, some of the fields keep they values and 
some of  them cleans. What is happening?



Thanks,
Tom;

-
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: StatelessForm.clearInput()

2009-10-30 Thread Tomás Rossi
Wait a minute... Because I need a reset button which effectively clean 
all fields and feedback messages. Reset button doesn't do that so it's 
not what I want.


Tomás Rossi escribió:

That's a very good question. I'll use that.

But then, if it weren't a stateless form, should I involve Wicket and 
use clearInput()? Why?


Tom;

Martin Grigorov escribió:

What's the benefit of this approach instead of using  without involving Wicket at all (it is stateless form) ?

El vie, 30-10-2009 a las 12:42 -0300, Tomás Rossi escribió:
 

Hi.

I have a stateless form and a button inside to reset all fields like 
this:


...
add(new Button("clear") {
private static final long serialVersionUID = 1L;

public void onSubmit() {
getForm().clearInput();
};
}.setDefaultFormProcessing(false));
...

The first time I use the form, fill some inputs and then hit 
"Clear", the form is submitted and returns from the server clean 
(which is what I expected to happen). But after I submit the form 
with all valid input (that redirects me to another page with a 
message), then press browser's back button (return to the form) and 
then hit the Clear button, some of the fields keep they values and 
some of  them cleans. What is happening?



Thanks,
Tom;

-
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: StatelessForm.clearInput()

2009-10-30 Thread Tomás Rossi

That's a very good question. I'll use that.

But then, if it weren't a stateless form, should I involve Wicket and 
use clearInput()? Why?


Tom;

Martin Grigorov escribió:

What's the benefit of this approach instead of using  without involving Wicket at all (it is stateless form) ?

El vie, 30-10-2009 a las 12:42 -0300, Tomás Rossi escribió:
  

Hi.

I have a stateless form and a button inside to reset all fields like this:

...
add(new Button("clear") {
private static final long serialVersionUID = 1L;

public void onSubmit() {
getForm().clearInput();
};
}.setDefaultFormProcessing(false));
...

The first time I use the form, fill some inputs and then hit "Clear", 
the form is submitted and returns from the server clean (which is what I 
expected to happen). But after I submit the form with all valid input 
(that redirects me to another page with a message), then press browser's 
back button (return to the form) and then hit the Clear button, some of 
the fields keep they values and some of  them cleans. What is happening?



Thanks,
Tom;

-
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



StatelessForm.clearInput()

2009-10-30 Thread Tomás Rossi

Hi.

I have a stateless form and a button inside to reset all fields like this:

...
   add(new Button("clear") {
   private static final long serialVersionUID = 1L;

   public void onSubmit() {
   getForm().clearInput();
   };
   }.setDefaultFormProcessing(false));
...

The first time I use the form, fill some inputs and then hit "Clear", 
the form is submitted and returns from the server clean (which is what I 
expected to happen). But after I submit the form with all valid input 
(that redirects me to another page with a message), then press browser's 
back button (return to the form) and then hit the Clear button, some of 
the fields keep they values and some of  them cleans. What is happening?



Thanks,
Tom;

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



Re: Force page expiration

2009-10-28 Thread Tomás Rossi

Thank you for your time.

Now we know that all of our pages must be stateless AND we need it to 
expire them anyway. Maybe Wicket is not prepared for this so we'll try 
it manually.


Pedro Santos escribió:
1) The browser keep the page url on his history. If that url don't has 
any historical information, the server will think the user want a new 
page.
2)Every component is stateless until you change it. You make an 
component statefull adding it an statefull behavior, or overriding the 
getStatelessHint method.

3)Sending an zip wiht an stateless page and an statefull page.
you can test like:

1- go to stateless page
2 - go to statefull page
3 - go to stateless page AND clear the pagemap (it has to be done 
after the page 2 get into the pagemap)
4 - click at back button and the page is expired... ( if you are using 
firefox, just clean the cache before this step!)


It work fine on IE. On firefox, for some reason, the page got cached 
on the browser! I add some meta tags to avoid it but nothing... Tomás, 
mayb it is what is happening on your project too. Make sure the 
firefox don't cache your pages.


On Wed, Oct 28, 2009 at 3:46 PM, Tomás Rossi <mailto:tro...@mecon.gov.ar>> wrote:


1) So, what does the fact that it creates a new pagemap (or not)
has to do with the current page been expired or not? I mean, I
understand the URL encode for the page versioning stuff, but I
don't get why the page is not expired. Maybe because when I hit
the back button, the URL points to the last created page on the
pagemap instead of pointing to an old one?

2) Let me see if I get it right. A page that changes it's
component tree is stateful (like the guestbook example) and one
that only changes it's content through it's models is stateless.
Am I right? In that case, why shouldn't I think a feedback panel
as a stateless component (and thus stateless the page which
contains it)?

3) That didn't work for me... I'll give it another try.

Pedro Santos escribió:

1) Why setting bookmarkable or not bookmarkable response page
makes the
difference between expiring and not expiring the current page?
Basically, the page instances are versioned to framework be
able to get them
back. The default versioning implementation encode page
version information
at url. As bookmarkable pages don't have such information
encoded on they
ulr, just a new pagemap are created for they.

2) What determines if a page is stateless or stateful? Is it
just the fact
that it contains stateless or stateful forms?
It is stateless by default. Contain an statefull component (as
form) is
enough to page turn to statefull

3) Is there a way I can expire the current page if I set a
bookmarkable
response page?
yes, just: (if I understand your question)
getPageMap().clear();
setResponsePage(MyStatelessPage);
so
1- go to stateless page 1
2 - go to statefull page 2
3 - clean the pagemap go to stateless page 1
4 - click at back button and the page is expired...

If anyone can point us where to read on these subjects we'll
appreciate it
very much.

http://cwiki.apache.org/WICKET/page-maps.html

On Wed, Oct 28, 2009 at 1:43 PM, Tomás Rossi
mailto:tro...@mecon.gov.ar>> wrote:

 


Ok... Our page had a StatelessForm inside. We changed it
to just Form.

When the form was submitted, we had a bookmarkable page as
a response page
and now we changed the call to produce a non-bookmarkable
page. This is:

onSubmit() {
...
//setResponsePage(MyResponsePage.class); // <- REMOVED
setResponsePage(new MyResponsePage()); // <- ADDED
...
}

With this (and no need to clear the pagemap) a submit
after a back button
produces a page expired message.

If I make the form stateless again, kaboom!

Questions:
1) Why setting bookmarkable or not bookmarkable response
page makes the
difference between expiring and not expiring the current page?
2) What determines if a page is stateless or stateful? Is
it just the fact
that it contains stateless or stateful forms?
3) Is there a way I can expire the current page if I set a
bookmarkable
response page?

We feel Wicket is a great framework, but there are things
we don't yet
understand. Mainly, we get really confused on how does
Wicket handle back
button, what are and what disti

Re: Force page expiration

2009-10-28 Thread Tomás Rossi
1) So, what does the fact that it creates a new pagemap (or not) has to 
do with the current page been expired or not? I mean, I understand the 
URL encode for the page versioning stuff, but I don't get why the page 
is not expired. Maybe because when I hit the back button, the URL points 
to the last created page on the pagemap instead of pointing to an old one?


2) Let me see if I get it right. A page that changes it's component tree 
is stateful (like the guestbook example) and one that only changes it's 
content through it's models is stateless. Am I right? In that case, why 
shouldn't I think a feedback panel as a stateless component (and thus 
stateless the page which contains it)?


3) That didn't work for me... I'll give it another try.

Pedro Santos escribió:

1) Why setting bookmarkable or not bookmarkable response page makes the
difference between expiring and not expiring the current page?
Basically, the page instances are versioned to framework be able to get them
back. The default versioning implementation encode page version information
at url. As bookmarkable pages don't have such information encoded on they
ulr, just a new pagemap are created for they.

2) What determines if a page is stateless or stateful? Is it just the fact
that it contains stateless or stateful forms?
It is stateless by default. Contain an statefull component (as form) is
enough to page turn to statefull

3) Is there a way I can expire the current page if I set a bookmarkable
response page?
yes, just: (if I understand your question)
getPageMap().clear();
setResponsePage(MyStatelessPage);
so
1- go to stateless page 1
2 - go to statefull page 2
3 - clean the pagemap go to stateless page 1
4 - click at back button and the page is expired...

If anyone can point us where to read on these subjects we'll appreciate it
very much.

http://cwiki.apache.org/WICKET/page-maps.html

On Wed, Oct 28, 2009 at 1:43 PM, Tomás Rossi  wrote:

  

Ok... Our page had a StatelessForm inside. We changed it to just Form.

When the form was submitted, we had a bookmarkable page as a response page
and now we changed the call to produce a non-bookmarkable page. This is:

onSubmit() {
...
//setResponsePage(MyResponsePage.class); // <- REMOVED
setResponsePage(new MyResponsePage()); // <- ADDED
...
}

With this (and no need to clear the pagemap) a submit after a back button
produces a page expired message.

If I make the form stateless again, kaboom!

Questions:
1) Why setting bookmarkable or not bookmarkable response page makes the
difference between expiring and not expiring the current page?
2) What determines if a page is stateless or stateful? Is it just the fact
that it contains stateless or stateful forms?
3) Is there a way I can expire the current page if I set a bookmarkable
response page?

We feel Wicket is a great framework, but there are things we don't yet
understand. Mainly, we get really confused on how does Wicket handle back
button, what are and what distinguishes stateless or stateful pages, what
are versioned pages/components, what problems they solve and how to use
them. If anyone can point us where to read on these subjects we'll
appreciate it very much.

Kind regards and thanks,

Tom;

Pedro Santos escribió:

 You are aware that to an page expire, it has to be statefull, right?


In a statefull page:
getPage().getPageMap().clear()
and the previous versions will to be removed from pagemap, then you got
the
page expired when try to back to then...

On Tue, Oct 27, 2009 at 4:05 PM, Tomás Rossi  wrote:



  

Nothing seems to work.

Does the fact that the page I want to expire is the home page has
anything
to do with it?

Pedro Santos escribió:

 The page returned from back button came from pagemap. Make sure to
remove




it
from there and you get the expired exception.

On Tue, Oct 27, 2009 at 11:57 AM, Tomás Rossi 
wrote:





  

Hi, I have another question...

in Wicket (1.4.2), can I force the expiration of a page?
Specifically, if users hit browser's back-button, I'd like to show them
the
page-expired message.

I've already tried to invalidate the session, but I got a horrible
exception when re-submitting the form after reaching it through the
back
button.

Thanks in advance,
--
Tom;



-
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: Force page expiration

2009-10-28 Thread Tomás Rossi

Ok... Our page had a StatelessForm inside. We changed it to just Form.

When the form was submitted, we had a bookmarkable page as a response 
page and now we changed the call to produce a non-bookmarkable page. 
This is:


onSubmit() {
...
//setResponsePage(MyResponsePage.class); // <- REMOVED
setResponsePage(new MyResponsePage()); // <- ADDED
...
}

With this (and no need to clear the pagemap) a submit after a back 
button produces a page expired message.


If I make the form stateless again, kaboom!

Questions:
1) Why setting bookmarkable or not bookmarkable response page makes the 
difference between expiring and not expiring the current page?
2) What determines if a page is stateless or stateful? Is it just the 
fact that it contains stateless or stateful forms?
3) Is there a way I can expire the current page if I set a bookmarkable 
response page?


We feel Wicket is a great framework, but there are things we don't yet 
understand. Mainly, we get really confused on how does Wicket handle 
back button, what are and what distinguishes stateless or stateful 
pages, what are versioned pages/components, what problems they solve and 
how to use them. If anyone can point us where to read on these subjects 
we'll appreciate it very much.


Kind regards and thanks,

Tom;

Pedro Santos escribió:

You are aware that to an page expire, it has to be statefull, right?
In a statefull page:
getPage().getPageMap().clear()
and the previous versions will to be removed from pagemap, then you got the
page expired when try to back to then...

On Tue, Oct 27, 2009 at 4:05 PM, Tomás Rossi  wrote:

  

Nothing seems to work.

Does the fact that the page I want to expire is the home page has anything
to do with it?

Pedro Santos escribió:

 The page returned from back button came from pagemap. Make sure to remove


it
from there and you get the expired exception.

On Tue, Oct 27, 2009 at 11:57 AM, Tomás Rossi 
wrote:



  

Hi, I have another question...

in Wicket (1.4.2), can I force the expiration of a page?
Specifically, if users hit browser's back-button, I'd like to show them
the
page-expired message.

I've already tried to invalidate the session, but I got a horrible
exception when re-submitting the form after reaching it through the back
button.

Thanks in advance,
--
Tom;



-
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: Force page expiration

2009-10-27 Thread Tomás Rossi

Nothing seems to work.

Does the fact that the page I want to expire is the home page has 
anything to do with it?


Pedro Santos escribió:

The page returned from back button came from pagemap. Make sure to remove it
from there and you get the expired exception.

On Tue, Oct 27, 2009 at 11:57 AM, Tomás Rossi  wrote:

  

Hi, I have another question...

in Wicket (1.4.2), can I force the expiration of a page?
Specifically, if users hit browser's back-button, I'd like to show them the
page-expired message.

I've already tried to invalidate the session, but I got a horrible
exception when re-submitting the form after reaching it through the back
button.

Thanks in advance,
--
Tom;



-
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



Force page expiration

2009-10-27 Thread Tomás Rossi

Hi, I have another question...

in Wicket (1.4.2), can I force the expiration of a page?
Specifically, if users hit browser's back-button, I'd like to show them 
the page-expired message.


I've already tried to invalidate the session, but I got a horrible 
exception when re-submitting the form after reaching it through the back 
button.


Thanks in advance,
--
Tom;



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



Nested panel and Exception "Attempted to set property value on a null object"

2009-10-23 Thread Tomás Rossi

Hi again,

I get the following error message:

Attempted to set property value on a null object. Property expression: 
aspectoRapidez Value: 4


I have a page with a nested stateless form, which has some fields and a 
couple of instances of a panel (with radio groups inside, each).
I submit the form the first time, everything's ok. Then I hit the back 
button, submit it again and get the error message above.


I searched google and found some guy with a similar problem with a 
nested panel. He did the following inside the panel:


public void updateModel() {} // Override the deafult updateModel for the 
panel


I did the same in my own nested panel and the problem was solved. But I 
can't live if a don't know what the hell is happening :(


Here is the relevant code:

The panel to which I had to override updateModel:
http://pastebin.com/m6668ffa6

The page code with the nested form which includes the panel above:
http://pastebin.com/m2a86846b

The object models:
http://pastebin.com/m21e25e8



Thanks in advance,
Tom;


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



Re: Exceptions in MyApplication.init()

2009-10-23 Thread Tomás Rossi

That's what we suspected. So we stick with our workaround.

Thanks

Pedro Santos escribió:

The init method is called by the wicket servlet filter. If it throw an
exception the web container will not place the filter into service, than the
request will not be handled by wicket.

On Fri, Oct 23, 2009 at 3:26 PM, Josh Glassman  wrote:

  

There is a wiki page with information on creating custom error pages.

http://cwiki.apache.org/WICKET/error-pages-and-feedback-messages.html

Hopefully that is what you are looking for!

Josh

On Fri, Oct 23, 2009 at 12:34 PM, Tomás Rossi  wrote:


Hey people,

I've noted that if an exception occurs during the execution of init
  

method


of MyApplication (which extends WebApplication), a SERVICE UNAVAILABLE
(error 503) page shows. We'd like to have our own error page for this
  

case


and figured out a workaround which includes catching and saving the
exception in the init method, setting some state and then handling it
later...
But, what is the Wicket way of doing this?

Thanks in advance,
--
Tom;



-
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



Exceptions in MyApplication.init()

2009-10-23 Thread Tomás Rossi

Hey people,

I've noted that if an exception occurs during the execution of init 
method of MyApplication (which extends WebApplication), a SERVICE 
UNAVAILABLE (error 503) page shows. We'd like to have our own error page 
for this case and figured out a workaround which includes catching and 
saving the exception in the init method, setting some state and then 
handling it later...

But, what is the Wicket way of doing this?

Thanks in advance,
--
Tom;



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



Re: Reusable components and wicket:id

2009-10-20 Thread Tomás Rossi

Wait a minute...

I made a "PantallaEncuesta.properties" with:

panelTelefonico-rapidezAtencion=Rapidez en la atención (telefónica)
...

Then I expected it to yield:

* Field 'Rapidez en la atención (telefónica)' is required.

But it still prints:

* Field 'panelTelefonico-rapidezAtencion' is required.

Not what I want... What's wrong? :(

Igor Vaynberg escribió:

thats why formcomponents take models for labels. you can give it a
resourcemodel that uses the parent's id as the resource key and
achieve what you want.

-igor

On Tue, Oct 20, 2009 at 10:46 AM, Tomás Rossi  wrote:
  

Thanks! That worked.

Though, I'd love for wicket to provide an automatic mechanism for this kind
of stuff. Each instance of a reusable component could be mutually
independent, even if used in the same container (at least that was my
intuitive idea).

Kind regards,
Tom;

Pedro Santos escribió:


now I understand
1 - you can use different feedback panels for each panel
2 - you can write a custom model for the component label
here is a draft, you can create a concrete class from, can override the
form
component getLabel, can set the custom model on the RadioButtonGenerico
constructor...

   myRadioButtonGenerico.setLabel(new AbstractReadOnlyModel()
   {
   @Override
   public String getObject()
   {
   return getParent().getId() + "-" + getId();
   }
   });


On Tue, Oct 20, 2009 at 2:51 PM, Tomás Rossi  wrote:


  

Yes, but I have 2 panels in the same page, and get:

* Field 'rapidezAtencion' is required.
* Field 'explicacionClara' is required.
* Field 'resolucionProblema' is required.
* Field 'rapidezAtencion' is required.
* Field 'explicacionClara' is required.
* Field 'resolucionProblema' is required.

And I want something like:

* Field 'panel1-rapidezAtencion' is required.
* Field 'panel1-explicacionClara' is required.
* Field 'panel1-resolucionProblema' is required.
* Field 'panel2-rapidezAtencion' is required.
* Field 'panel2-explicacionClara' is required.
* Field 'panel2-resolucionProblema' is required.

So that I can change those labels with a properties file later.


Tom;

Pedro Santos escribió:




Hi Tomás, I didn't found the problem. The feedback panel get:

* Field 'rapidezAtencion' is required.
* Field 'explicacionClara' is required.
* Field 'resolucionProblema' is required.

just as expected...

On Tue, Oct 20, 2009 at 12:00 PM, Tomás Rossi 
wrote:




  

Sure, here's the markup (BTW, using Wicket 1.4.2):

PanelEncuesta.html (means SurveyPanel):

...






 
 Muy Bueno
 Bueno
 Regular
 Malo
 Ns/Nc



 
 Rapidez en la atención
 
 
 
 
 
 



 
 Explicaciones claras
 
 
 
 
 
 



 
 Resolución del problema
 
 
 
 
 
 






...

PantallaEncuesta.html (means SurveyScreen):
...


¿Cómo calificaría los siguientes aspectos de la atención telefónica
de
Informática?
Acá va la encuesta de atención
telefónica 





¿Cómo calificaría los siguientes aspectos de la atención del
personal
de Informática?
Acá va la encuesta de atención
personal 


...

--
Tom;

Pedro Santos escribió:

 Hi Tómas,





What the form component RadioButtonGenerico receive as id, the
validation
message will use as label. The code should generate the outputs:
* Field 'rapidezAtencion' is required.
* Field 'explicacionClara' is required.

your report output :
 
is an generic markup or always the "score" id is placed on html? If
so,
can
you send the panel html? what wicket version are you using?

On Mon, Oct 19, 2009 at 5:56 PM, Tomás Rossi 
wrote:






  

Here goes the java code...

RadioButtonGenerico.java (means GenericRadioButton):

public class RadioButtonGenerico extends RadioGroup {

 private static final long serialVersionUID = -1725627853431547878L;

 public RadioButtonGenerico(String id, List opciones,
IModel
modelo) {
   super(id, modelo);

   for (int i = 0; i < opciones.size(); i++) {
   add(new Radio(id + i, new Model(i)));
   }
 }
}

PanelEncuesta.java (means SurveyPanel):

public class PanelEncuesta extends FormComponentPanel
{

 private static final long serialVersionUID = -1545571698439481842L;

 public PanelEncuesta(String id, IModel modelo) {
   super(id, modelo);
   add(new RadioButtonGenerico("rapidezAtencion",
   DatosEncuesta.CALIFICACIONES,
   new PropertyModel(modelo,
"rapidezAtencion")).setRequired(true));

   add(new RadioButtonGenerico("explicacionClara",
   DatosEncuesta.CALIFICACIONES,
   new PropertyModel(modelo,
"explicacionClara")).setRequired(true));
   add(new RadioButtonGenerico("resolucionProblema",
   DatosEncuesta.CALIFICACIONES,
   new PropertyModel(modelo,
"

Re: Reusable components and wicket:id

2009-10-20 Thread Tomás Rossi

Thanks! That worked.

Though, I'd love for wicket to provide an automatic mechanism for this 
kind of stuff. Each instance of a reusable component could be mutually 
independent, even if used in the same container (at least that was my 
intuitive idea).


Kind regards,
Tom;

Pedro Santos escribió:

now I understand
1 - you can use different feedback panels for each panel
2 - you can write a custom model for the component label
here is a draft, you can create a concrete class from, can override the form
component getLabel, can set the custom model on the RadioButtonGenerico
constructor...

myRadioButtonGenerico.setLabel(new AbstractReadOnlyModel()
{
@Override
public String getObject()
{
return getParent().getId() + "-" + getId();
}
});


On Tue, Oct 20, 2009 at 2:51 PM, Tomás Rossi  wrote:

  

Yes, but I have 2 panels in the same page, and get:

* Field 'rapidezAtencion' is required.
* Field 'explicacionClara' is required.
* Field 'resolucionProblema' is required.
* Field 'rapidezAtencion' is required.
* Field 'explicacionClara' is required.
* Field 'resolucionProblema' is required.

And I want something like:

* Field 'panel1-rapidezAtencion' is required.
* Field 'panel1-explicacionClara' is required.
* Field 'panel1-resolucionProblema' is required.
* Field 'panel2-rapidezAtencion' is required.
* Field 'panel2-explicacionClara' is required.
* Field 'panel2-resolucionProblema' is required.

So that I can change those labels with a properties file later.


Tom;

Pedro Santos escribió:



Hi Tomás, I didn't found the problem. The feedback panel get:

* Field 'rapidezAtencion' is required.
* Field 'explicacionClara' is required.
* Field 'resolucionProblema' is required.

just as expected...

On Tue, Oct 20, 2009 at 12:00 PM, Tomás Rossi 
wrote:



  

Sure, here's the markup (BTW, using Wicket 1.4.2):

PanelEncuesta.html (means SurveyPanel):

...






 
 Muy Bueno
 Bueno
 Regular
 Malo
 Ns/Nc



 
 Rapidez en la atención
 
 
 
 
 
 



 
 Explicaciones claras
 
 
 
 
 
 



 
 Resolución del problema
 
 
 
 
 
 






...

PantallaEncuesta.html (means SurveyScreen):
...


¿Cómo calificaría los siguientes aspectos de la atención telefónica
de
Informática?
Acá va la encuesta de atención
telefónica 





¿Cómo calificaría los siguientes aspectos de la atención del personal
de Informática?
Acá va la encuesta de atención
personal 


...

--
Tom;

Pedro Santos escribió:

 Hi Tómas,




What the form component RadioButtonGenerico receive as id, the
validation
message will use as label. The code should generate the outputs:
* Field 'rapidezAtencion' is required.
* Field 'explicacionClara' is required.

your report output :
 
is an generic markup or always the "score" id is placed on html? If so,
can
you send the panel html? what wicket version are you using?

On Mon, Oct 19, 2009 at 5:56 PM, Tomás Rossi 
wrote:





  

Here goes the java code...

RadioButtonGenerico.java (means GenericRadioButton):

public class RadioButtonGenerico extends RadioGroup {

 private static final long serialVersionUID = -1725627853431547878L;

 public RadioButtonGenerico(String id, List opciones, IModel
modelo) {
super(id, modelo);

for (int i = 0; i < opciones.size(); i++) {
add(new Radio(id + i, new Model(i)));
}
 }
}

PanelEncuesta.java (means SurveyPanel):

public class PanelEncuesta extends FormComponentPanel {

 private static final long serialVersionUID = -1545571698439481842L;

 public PanelEncuesta(String id, IModel modelo) {
super(id, modelo);
add(new RadioButtonGenerico("rapidezAtencion",
DatosEncuesta.CALIFICACIONES,
new PropertyModel(modelo,
"rapidezAtencion")).setRequired(true));

add(new RadioButtonGenerico("explicacionClara",
DatosEncuesta.CALIFICACIONES,
new PropertyModel(modelo,
"explicacionClara")).setRequired(true));
add(new RadioButtonGenerico("resolucionProblema",
DatosEncuesta.CALIFICACIONES,
new PropertyModel(modelo,
"resolucionProblema")).setRequired(true)); }

}

PantallaEncuesta.java: (means SurveyScreen):

public class PantallaEncuesta extends WebPage {

 public PantallaEncuesta() {
add(new FeedbackPanel("feedback"));
add(new FormEncuesta("formEncuesta"));
 }

 public static class FormEncuesta extends Form { //
(Means
SurveyForm)
private static final long serialVersionUID = 8582266005577827473L;

// Modelo para las respuestas respecto a la atención éfonica.
private final DatosEncuesta datosEncuestaTelefonico = new
DatosEncuesta();
// Modelo para las respues

Re: Reusable components and wicket:id

2009-10-20 Thread Tomás Rossi

Yes, but I have 2 panels in the same page, and get:

* Field 'rapidezAtencion' is required.
* Field 'explicacionClara' is required.
* Field 'resolucionProblema' is required.
* Field 'rapidezAtencion' is required.
* Field 'explicacionClara' is required.
* Field 'resolucionProblema' is required.

And I want something like:

* Field 'panel1-rapidezAtencion' is required.
* Field 'panel1-explicacionClara' is required.
* Field 'panel1-resolucionProblema' is required.
* Field 'panel2-rapidezAtencion' is required.
* Field 'panel2-explicacionClara' is required.
* Field 'panel2-resolucionProblema' is required.

So that I can change those labels with a properties file later.

Tom;

Pedro Santos escribió:

Hi Tomás, I didn't found the problem. The feedback panel get:

* Field 'rapidezAtencion' is required.
* Field 'explicacionClara' is required.
* Field 'resolucionProblema' is required.

just as expected...

On Tue, Oct 20, 2009 at 12:00 PM, Tomás Rossi  wrote:

  

Sure, here's the markup (BTW, using Wicket 1.4.2):

PanelEncuesta.html (means SurveyPanel):

...






  
  Muy Bueno
  Bueno
  Regular
  Malo
  Ns/Nc



  
  Rapidez en la atención
  
  
  
  
  
  



  
  Explicaciones claras
  
  
  
  
  
  



  
  Resolución del problema
  
  
  
  
  
  






...

PantallaEncuesta.html (means SurveyScreen):
...


¿Cómo calificaría los siguientes aspectos de la atención telefónica de
Informática?
Acá va la encuesta de atención
telefónica 





¿Cómo calificaría los siguientes aspectos de la atención del personal
de Informática?
Acá va la encuesta de atención
personal 


...

--
Tom;

Pedro Santos escribió:

 Hi Tómas,


What the form component RadioButtonGenerico receive as id, the validation
message will use as label. The code should generate the outputs:
* Field 'rapidezAtencion' is required.
* Field 'explicacionClara' is required.

your report output :
 
is an generic markup or always the "score" id is placed on html? If so,
can
you send the panel html? what wicket version are you using?

On Mon, Oct 19, 2009 at 5:56 PM, Tomás Rossi  wrote:



  

Here goes the java code...

RadioButtonGenerico.java (means GenericRadioButton):

public class RadioButtonGenerico extends RadioGroup {

 private static final long serialVersionUID = -1725627853431547878L;

 public RadioButtonGenerico(String id, List opciones, IModel
modelo) {
 super(id, modelo);

 for (int i = 0; i < opciones.size(); i++) {
 add(new Radio(id + i, new Model(i)));
 }
 }
}

PanelEncuesta.java (means SurveyPanel):

public class PanelEncuesta extends FormComponentPanel {

 private static final long serialVersionUID = -1545571698439481842L;

 public PanelEncuesta(String id, IModel modelo) {
 super(id, modelo);
 add(new RadioButtonGenerico("rapidezAtencion",
 DatosEncuesta.CALIFICACIONES,
 new PropertyModel(modelo,
"rapidezAtencion")).setRequired(true));

 add(new RadioButtonGenerico("explicacionClara",
 DatosEncuesta.CALIFICACIONES,
 new PropertyModel(modelo,
"explicacionClara")).setRequired(true));
 add(new RadioButtonGenerico("resolucionProblema",
 DatosEncuesta.CALIFICACIONES,
 new PropertyModel(modelo,
"resolucionProblema")).setRequired(true)); }

}

PantallaEncuesta.java: (means SurveyScreen):

public class PantallaEncuesta extends WebPage {

 public PantallaEncuesta() {
 add(new FeedbackPanel("feedback"));
 add(new FormEncuesta("formEncuesta"));
 }

 public static class FormEncuesta extends Form { // (Means
SurveyForm)
 private static final long serialVersionUID = 8582266005577827473L;

 // Modelo para las respuestas respecto a la atención éfonica.
 private final DatosEncuesta datosEncuestaTelefonico = new
DatosEncuesta();
 // Modelo para las respuestas respecto a la atención personal.
 private final DatosEncuesta datosEncuestaPersonal = new
DatosEncuesta();
 // Modelo para los datos optativos de la encuesta.
 private final DatosOptativos datosOptativos = new DatosOptativos();

 private CaptchaImageResource captcha = new CaptchaImageResource();
 private final ValueMap claveCaptcha = new ValueMap();

 public FormEncuesta(String id) {
 super(id);
 ...
 add(new PanelEncuesta("panelTelefonico",
 new Model(datosEncuestaTelefonico)));
 add(new PanelEncuesta("panelPersonal",
 new Model(datosEncuestaPersonal)));
 ... }
...

Pedro Santos escribió:

 Actually the panel wicket id is an parameter for panel constructor, can




you
some code?

On Mon, Oct 19, 2009 at 5:07 PM, Tomás Rossi 
wrote:






Re: Reusable components and wicket:id

2009-10-20 Thread Tomás Rossi

Sure, here's the markup (BTW, using Wicket 1.4.2):

PanelEncuesta.html (means SurveyPanel):

...






   
   Muy Bueno
   Bueno
   Regular
   Malo
   Ns/Nc



   
   Rapidez en la atención
   
   
   
   
   
   



   
   Explicaciones claras
   
   
   
   
   
   



   
   Resolución del problema
   
   
   
   
   
   






...

PantallaEncuesta.html (means SurveyScreen):
...


¿Cómo calificaría los siguientes aspectos de la atención telefónica 
de Informática?
Acá va la encuesta de atención 
telefónica 






¿Cómo calificaría los siguientes aspectos de la atención del 
personal de Informática?
Acá va la encuesta de atención 
personal 



...

--
Tom;

Pedro Santos escribió:

Hi Tómas,
What the form component RadioButtonGenerico receive as id, the validation
message will use as label. The code should generate the outputs:
* Field 'rapidezAtencion' is required.
* Field 'explicacionClara' is required.

your report output :
  
is an generic markup or always the "score" id is placed on html? If so, can
you send the panel html? what wicket version are you using?

On Mon, Oct 19, 2009 at 5:56 PM, Tomás Rossi  wrote:

  

Here goes the java code...

RadioButtonGenerico.java (means GenericRadioButton):

public class RadioButtonGenerico extends RadioGroup {

  private static final long serialVersionUID = -1725627853431547878L;

  public RadioButtonGenerico(String id, List opciones, IModel
modelo) {
  super(id, modelo);

  for (int i = 0; i < opciones.size(); i++) {
  add(new Radio(id + i, new Model(i)));
  }
  }
}

PanelEncuesta.java (means SurveyPanel):

public class PanelEncuesta extends FormComponentPanel {

  private static final long serialVersionUID = -1545571698439481842L;

  public PanelEncuesta(String id, IModel modelo) {
  super(id, modelo);
  add(new RadioButtonGenerico("rapidezAtencion",
  DatosEncuesta.CALIFICACIONES,
  new PropertyModel(modelo,
"rapidezAtencion")).setRequired(true));

  add(new RadioButtonGenerico("explicacionClara",
  DatosEncuesta.CALIFICACIONES,
  new PropertyModel(modelo,
"explicacionClara")).setRequired(true));
  add(new RadioButtonGenerico("resolucionProblema",
  DatosEncuesta.CALIFICACIONES,
  new PropertyModel(modelo,
"resolucionProblema")).setRequired(true)); }

}

PantallaEncuesta.java: (means SurveyScreen):

public class PantallaEncuesta extends WebPage {

  public PantallaEncuesta() {
  add(new FeedbackPanel("feedback"));
  add(new FormEncuesta("formEncuesta"));
  }

  public static class FormEncuesta extends Form { // (Means
SurveyForm)
  private static final long serialVersionUID = 8582266005577827473L;

  // Modelo para las respuestas respecto a la atención éfonica.
  private final DatosEncuesta datosEncuestaTelefonico = new
DatosEncuesta();
  // Modelo para las respuestas respecto a la atención personal.
  private final DatosEncuesta datosEncuestaPersonal = new
DatosEncuesta();
  // Modelo para los datos optativos de la encuesta.
  private final DatosOptativos datosOptativos = new DatosOptativos();

  private CaptchaImageResource captcha = new CaptchaImageResource();
  private final ValueMap claveCaptcha = new ValueMap();

  public FormEncuesta(String id) {
  super(id);
  ...
  add(new PanelEncuesta("panelTelefonico",
  new Model(datosEncuestaTelefonico)));
  add(new PanelEncuesta("panelPersonal",
  new Model(datosEncuestaPersonal)));
  ... }
...

Pedro Santos escribió:

 Actually the panel wicket id is an parameter for panel constructor, can


you
some code?

On Mon, Oct 19, 2009 at 5:07 PM, Tomás Rossi  wrote:



  

Then I'm unable to use the properties file for tweaking the string in
question.

What is the beauty of panels if they don't prefix its internal ids
automatically? Or am I getting it all wrong... :S

Tom;

Igor Vaynberg escribió:

 call radiogroup.setlabel()




-igor

On Mon, Oct 19, 2009 at 10:55 AM, Tomás Rossi 
wrote:




  

Hi,

We are building a simple survey with Wicket.

Essentially, we have a lot of RadioGroup components repeated all over
the
main survey page. Those components are in fact the same thing (to score
some
item), but obviously, they reffer to different subjects/groups. For
example:

Are you happy with X?

In doing job A: ( ) very happy
( ) not so much
( ) sucks

In doing job B: ( ) very happy
( ) not so much
( ) sucks

Are you happy with Y?

In doing job A: ( ) very happy
( ) not so much
( ) sucks
 

So we decided to make a reusable component (a panel) for the score
input,
and repeat it as much as we needed.

We also have our survey page with a feedback panel and a form. Inside
that
form we include t

Re: Reusable components and wicket:id

2009-10-19 Thread Tomás Rossi

Here goes the java code...

RadioButtonGenerico.java (means GenericRadioButton):

public class RadioButtonGenerico extends RadioGroup {

   private static final long serialVersionUID = -1725627853431547878L;

   public RadioButtonGenerico(String id, List opciones, 
IModel modelo) {

   super(id, modelo);

   for (int i = 0; i < opciones.size(); i++) {
   add(new Radio(id + i, new Model(i)));
   }
   }
}

PanelEncuesta.java (means SurveyPanel):

public class PanelEncuesta extends FormComponentPanel {

   private static final long serialVersionUID = -1545571698439481842L;

   public PanelEncuesta(String id, IModel modelo) {
   super(id, modelo);   


   add(new RadioButtonGenerico("rapidezAtencion",
   DatosEncuesta.CALIFICACIONES,
   new PropertyModel(modelo, 
"rapidezAtencion")).setRequired(true));


   add(new RadioButtonGenerico("explicacionClara",
   DatosEncuesta.CALIFICACIONES,
   new PropertyModel(modelo, 
"explicacionClara")).setRequired(true));   


   add(new RadioButtonGenerico("resolucionProblema",
   DatosEncuesta.CALIFICACIONES,
   new PropertyModel(modelo, 
"resolucionProblema")).setRequired(true));   
   }


}

PantallaEncuesta.java: (means SurveyScreen):

public class PantallaEncuesta extends WebPage {

   public PantallaEncuesta() {
   add(new FeedbackPanel("feedback"));
   add(new FormEncuesta("formEncuesta"));
   }

   public static class FormEncuesta extends Form { // 
(Means SurveyForm)

   private static final long serialVersionUID = 8582266005577827473L;

   // Modelo para las respuestas respecto a la atención éfonica.
   private final DatosEncuesta datosEncuestaTelefonico = new 
DatosEncuesta();

   // Modelo para las respuestas respecto a la atención personal.
   private final DatosEncuesta datosEncuestaPersonal = new 
DatosEncuesta();

   // Modelo para los datos optativos de la encuesta.
   private final DatosOptativos datosOptativos = new DatosOptativos();

   private CaptchaImageResource captcha = new CaptchaImageResource();
   private final ValueMap claveCaptcha = new ValueMap();

   public FormEncuesta(String id) {
   super(id);
   ...
   add(new PanelEncuesta("panelTelefonico",
   new Model(datosEncuestaTelefonico)));
   add(new PanelEncuesta("panelPersonal",
   new Model(datosEncuestaPersonal)));
   ...  
   }

...

Pedro Santos escribió:

Actually the panel wicket id is an parameter for panel constructor, can you
some code?

On Mon, Oct 19, 2009 at 5:07 PM, Tomás Rossi  wrote:

  

Then I'm unable to use the properties file for tweaking the string in
question.

What is the beauty of panels if they don't prefix its internal ids
automatically? Or am I getting it all wrong... :S

Tom;

Igor Vaynberg escribió:

 call radiogroup.setlabel()


-igor

On Mon, Oct 19, 2009 at 10:55 AM, Tomás Rossi 
wrote:


  

Hi,

We are building a simple survey with Wicket.

Essentially, we have a lot of RadioGroup components repeated all over the
main survey page. Those components are in fact the same thing (to score
some
item), but obviously, they reffer to different subjects/groups. For
example:

Are you happy with X?

In doing job A: ( ) very happy
( ) not so much
( ) sucks

In doing job B: ( ) very happy
( ) not so much
( ) sucks

Are you happy with Y?

In doing job A: ( ) very happy
( ) not so much
( ) sucks
 

So we decided to make a reusable component (a panel) for the score input,
and repeat it as much as we needed.

We also have our survey page with a feedback panel and a form. Inside
that
form we include the panel many times, one for each item. But the
required-field-feedback shows the same wicket:id for a bunch of fields,
which isn't what we want. We need a unique wicket:id for each instance of
the score input.

E.G.

Our Panel is like this:

...

 
 
 
 
 

...

And our feedback is like this:

* Field 'score' is required.
* Field 'score' is required.
* Field 'score' is required.
* Field 'score' is required.

How can I solve this?

Thanks
Tom;


-
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: Reusable components and wicket:id

2009-10-19 Thread Tomás Rossi
Then I'm unable to use the properties file for tweaking the string in 
question.


What is the beauty of panels if they don't prefix its internal ids 
automatically? Or am I getting it all wrong... :S


Tom;

Igor Vaynberg escribió:

call radiogroup.setlabel()

-igor

On Mon, Oct 19, 2009 at 10:55 AM, Tomás Rossi  wrote:
  

Hi,

We are building a simple survey with Wicket.

Essentially, we have a lot of RadioGroup components repeated all over the
main survey page. Those components are in fact the same thing (to score some
item), but obviously, they reffer to different subjects/groups. For example:

Are you happy with X?

In doing job A: ( ) very happy
( ) not so much
( ) sucks

In doing job B: ( ) very happy
( ) not so much
( ) sucks

Are you happy with Y?

In doing job A: ( ) very happy
( ) not so much
( ) sucks
 

So we decided to make a reusable component (a panel) for the score input,
and repeat it as much as we needed.

We also have our survey page with a feedback panel and a form. Inside that
form we include the panel many times, one for each item. But the
required-field-feedback shows the same wicket:id for a bunch of fields,
which isn't what we want. We need a unique wicket:id for each instance of
the score input.

E.G.

Our Panel is like this:

...

  
  
  
  
  

...

And our feedback is like this:

* Field 'score' is required.
* Field 'score' is required.
* Field 'score' is required.
* Field 'score' is required.

How can I solve this?

Thanks
Tom;


-
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



Reusable components and wicket:id

2009-10-19 Thread Tomás Rossi

Hi,

We are building a simple survey with Wicket.

Essentially, we have a lot of RadioGroup components repeated all over 
the main survey page. Those components are in fact the same thing (to 
score some item), but obviously, they reffer to different 
subjects/groups. For example:


Are you happy with X?

In doing job A: 
( ) very happy

( ) not so much
( ) sucks

In doing job B: 
( ) very happy

( ) not so much
( ) sucks

Are you happy with Y?

In doing job A: 
( ) very happy

( ) not so much
( ) sucks
 

So we decided to make a reusable component (a panel) for the score 
input, and repeat it as much as we needed.


We also have our survey page with a feedback panel and a form. Inside 
that form we include the panel many times, one for each item. But the 
required-field-feedback shows the same wicket:id for a bunch of fields, 
which isn't what we want. We need a unique wicket:id for each instance 
of the score input.


E.G.

Our Panel is like this:

...

   
   
   
   
   

...

And our feedback is like this:

* Field 'score' is required.
* Field 'score' is required.
* Field 'score' is required.
* Field 'score' is required.

How can I solve this?

Thanks
Tom;


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



Re: Feedback messages, input and label

2009-10-07 Thread Tomás Rossi
Ok, that's a little nicer, but still... It'd be better if the label 
could be deduced from the markup itself. Yet, no big deal.


Thanks

Matej Knopp escribió:

try putting inputPwd = Password in your property file.

-Matej

On Wed, Oct 7, 2009 at 5:33 PM, Tomás Rossi  wrote:
  

Hi,

lets say you have this in you html form:
--
...
Password

...
--

Then, a properties file for your app with this:
--
...
Required=Field ${label} is required!
...
--

When the required-error-message prints, it does like this:

* Field inputPwd is required!

Now I wish I could change it to say "Field Password is required!" without
modifying wicket:id attribute nor adding specific required message for the
component.
Is this possible?

Kind regards,
Tom;

-
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: Feedback messages, input and label

2009-10-07 Thread Tomás Rossi

Yeah, we'd need 300 programmers for that task ;)

So you have to specify the label for each component in a property file? 
And then you'd have a property file for each markup that contains a 
form? Mmhh...


Igor Vaynberg escribió:

Nonetheless, it'd be madness



no, this is spartaaa!

form components search property files for their labels without you
having to explicitly set a model.

-igor


if I had to do that with every component of the
  

system. Is this the only way? Couldn't this be done in a more automatic
fashion, like for example, extracting it from the html label content which
is associated to the input?

Olivier Bourgeois escribió:


Have you tried something like this in your page.java :

pwd.setLabel(new Model("Password"));

?


2009/10/7 Tomás Rossi 


  

Hi,

lets say you have this in you html form:
--
...
Password

...
--

Then, a properties file for your app with this:
--
...
Required=Field ${label} is required!
...
--

When the required-error-message prints, it does like this:

* Field inputPwd is required!

Now I wish I could change it to say "Field Password is required!" without
modifying wicket:id attribute nor adding specific required message for
the
component.
Is this possible?

Kind regards,
Tom;

-
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: Feedback messages, input and label

2009-10-07 Thread Tomás Rossi

Yeah, it worked, thanks.

Nonetheless, it'd be madness if I had to do that with every component of 
the system. Is this the only way? Couldn't this be done in a more 
automatic fashion, like for example, extracting it from the html label 
content which is associated to the input?


Olivier Bourgeois escribió:

Have you tried something like this in your page.java :

pwd.setLabel(new Model("Password"));

?


2009/10/7 Tomás Rossi 

  

Hi,

lets say you have this in you html form:
--
...
Password

...
--

Then, a properties file for your app with this:
--
...
Required=Field ${label} is required!
...
--

When the required-error-message prints, it does like this:

* Field inputPwd is required!

Now I wish I could change it to say "Field Password is required!" without
modifying wicket:id attribute nor adding specific required message for the
component.
Is this possible?

Kind regards,
Tom;

-
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



Feedback messages, input and label

2009-10-07 Thread Tomás Rossi

Hi,

lets say you have this in you html form:
--
...
Password

...
--

Then, a properties file for your app with this:
--
...
Required=Field ${label} is required!
...
--

When the required-error-message prints, it does like this:

* Field inputPwd is required!

Now I wish I could change it to say "Field Password is required!" 
without modifying wicket:id attribute nor adding specific required 
message for the component.

Is this possible?

Kind regards,
Tom;

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