Re: Display component feedback message once: safety net renders them always before

2011-01-05 Thread Martin Grigorov
Hi Jeremy,

In the blog you use code as:


   1. final TextField name = new TextField(name, new
PropertyModel(productModel, name));
   2. name.setRequired(true);
   3. name.add(new FeedbackPanel(nameFeedback, new
ComponentFeedbackMessageFilter(name)));


I wonder what kind of .html do you use for that snippet ?

input wicket:id=namespan wicket:id=nameFeedback/span/input is
not HTML valid.

Sorry, for my fiddling criticism. I know this is not the main topic of the
blog article ;-)

On Tue, Jan 4, 2011 at 5:13 PM, Jeremy Thomerson
jer...@wickettraining.comwrote:

 On Thu, Dec 2, 2010 at 5:52 AM, Joseph Pachod j...@thomas-daily.de wrote:

  Hi
 
  I'm trying to apply the behaviors presented by Alastair Maw in his
  presentation Wicket Forms
  with Flair (cf
 
 http://code.google.com/p/londonwicket/downloads/detail?name=LondonWicket-FormsWithFlair.pdfcan=2q=
 )
 
  Basically, Alastair uses behavior to display feedback message specific to
  some components next to the component in question.
 
  We use our components in form with feedback panel, for non component
  specific messages.
 
  Overall, we would like these functionalities:
  A - no message should be rendered twice
  B - no message should be left unrendered (safety net)
  C - component specific message should be rendered next to their component
  D - when some messages were displayed next to their components, the
  feedback panel should display a message for it (like one of more input
  didn't validate, please check them)
 
  In order to try to achieve that, I used the FeedbackMessage.isRendered()
  method in both the behaviors and the feedback panel
 IFeedbackMessageFilter.
 

 As you've discovered, using the isRendered() method for this really is
 difficult because it depends on the order of traversal.  This makes it
 brittle to use this for your safety net or catch all feedback panel.

 I had encountered this issue and for one of my training classes, I threw
 together a solution.  Your post prodded me to go ahead and post my solution
 as a blog post.  After dusting off my long-forgotten blog, here it is:

 http://www.jeremythomerson.com/blog/2011/01/catching-all-feedback-messages-that-arent-rendered-by-other-feedback-panels/(or
 http://bit.ly/eHUEuN if that gets chopped up).

 Hopefully that helps someone.

 --
 Jeremy Thomerson
 http://wickettraining.com
 *Need a CMS for Wicket?  Use Brix! http://brixcms.org*



Re: Display component feedback message once: safety net renders them always before

2011-01-05 Thread Jeremy Thomerson
On Wed, Jan 5, 2011 at 3:12 AM, Martin Grigorov mgrigo...@apache.org wrote:
 Hi Jeremy,

 In the blog you use code as:


   1. final TextField name = new TextField(name, new
    PropertyModel(productModel, name));
   2. name.setRequired(true);
   3. name.add(new FeedbackPanel(nameFeedback, new
    ComponentFeedbackMessageFilter(name)));


 I wonder what kind of .html do you use for that snippet ?

 input wicket:id=namespan wicket:id=nameFeedback/span/input is
 not HTML valid.

 Sorry, for my fiddling criticism. I know this is not the main topic of the
 blog article ;-)

Thanks Martin!  I copied that example from a working example that I
have... but in the working example, I have a border that adds the
feedback panel and a css border for errors, etc.  When I hastily
stripped that out, I made a mistake writing that code in WordPress.

It's corrected now.  Thanks again!

-- 
Jeremy Thomerson
http://wickettraining.com
Need a CMS for Wicket?  Use Brix! http://brixcms.org

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



Re: Display component feedback message once: safety net renders them always before

2011-01-04 Thread Joseph Pachod

Hi Pedro

thanks a lot for your ongoing feedback ;)

I hadn't dig too much into ComponentFeedbackPanel, but I've now done it.

So, my current impressions:
- extra markup required. A bit annoying, I don't need or want that. On 
top of that I would like some design which circles the faulty input, and 
I couldn't do something like:

div wicket:id=stringEditFeedback
div wicket:id=stringEdit
/div
/div
(I may have misses something though, I'm a ComponentFeedbackPanel newbe !)
It 's as well annoying for reusable components: this feedback can't be 
simply added from the outside to inner components, it has to be there in 
the markup as well


- ordering of component addition in the container matters
I first had this ordering:
creation of the form
addition of the form to the parent container
creation of the input field
addition of the input field to the form
creation of the ComponentFeedbackPanel
addition of the ComponentFeedbackPanel to the form
creation of the feedback panel filtering on already rendered messages
addition of the feedback panel to the parent container

in this order the messages of the input field weren't rendered twice

Then I went for creating and adding the feedback panel to the parent 
container as the first action: the messages of the input field were 
rendered twice...


This could be workaround with a Filter similar to the one I used for the 
behavior, meaning the feedback panel shouldn't display messages which 
are linked to a component having a ComponentFeedbackPanel. However I'm 
not sure it's so easy to achieve: the link is from the 
ComponentFeedbackPanel to the Component, not the other way around, 
whereas the feedbackmessage goes at the component...


As such, overall, AFAIK, I don't think that a ComponentFeedbackPanel 
would do it in my use case.


Please let me know if I'm missing something.

Thanks again for your input !

best
joseph


On 01/03/2011 01:05 PM, Pedro Santos wrote:

You are testing the behaviors types of reporter, but if two components with
an FeedbackHighlightBehavior report an feedback you break the functionality
A - no message should be rendered twice

On Wed, Dec 29, 2010 at 12:05 PM, joseph.pachodj...@thomas-daily.de  wrote:


Hi Pedro Santos

I hadn't seen your answer, sorry.

In between, I had time again to look into my issue.

Actually, the root of it was about not displaying the feedback message
twice: once in the general feedback panel and once close from the
generating
component.

As such, while helpful, your solution didn't help there.

But I now found this workaround for this:
  add(new FeedbackPanel(plainFeedback, new IFeedbackMessageFilter()
{

@Override
public boolean accept(final FeedbackMessage message)
{
ListIBehavior  behaviors =
message.getReporter().getBehaviors();
for (IBehavior behavior : behaviors)
{
if (behavior instanceof FeedbackHighlightBehavior)
{
return false;
}
}
return true;
}
}));

=  the feedback panel doesn't display the message twice :)

I have yet to put this change in production, where maybe I would have to do
extra check (like to check that the reporter component is effectively
visible in order to be sure of the feedback message display), but at least
I've found a way to go.

:)

++
joseph


--
View this message in context:
http://apache-wicket.1842946.n4.nabble.com/Display-component-feedback-message-once-safety-net-renders-them-always-before-tp3068969p3167130.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







--
Joseph Pachod
IT

THOMAS DAILY GmbH
Adlerstraße 19
79098 Freiburg
Deutschland
T  + 49 761 3 85 59 506
F  + 49 761 3 85 59 550
E  joseph.pac...@thomas-daily.de
www.thomas-daily.de

Geschäftsführer/Managing Directors:
Wendy Thomas, Susanne Larbig
Handelsregister Freiburg i.Br., HRB 3947

Registrieren Sie sich unter https://www.thomas-daily.de/user/sign-in für die TD 
Morning News, eine kostenlose Auswahl aktueller Themen aus TD Premium, morgens 
ab 9:15 in Ihrer Mailbox.

Aktuelle Presseinformationen für die TD Morning News und TD Premium nimmt 
unsere Redaktion unter redakt...@thomas-daily.de entgegen.
Redaktionsschluss für die TD Morning News ist täglich um 8:45.

Register free of charge at https://www.thomas-daily.de/user/sign-in to have the 
TD Morning News, a selection of the latest topics from TD Premium, delivered to 
your mailbox from 9:15 every morning.

Our editorial department receives the latest press releases for the TD Morning 
News and TD Premium at redakt...@thomas-daily.de. The editorial deadline for 
the TD

Re: Display component feedback message once: safety net renders them always before

2011-01-04 Thread Jeremy Thomerson
On Thu, Dec 2, 2010 at 5:52 AM, Joseph Pachod j...@thomas-daily.de wrote:

 Hi

 I'm trying to apply the behaviors presented by Alastair Maw in his
 presentation Wicket Forms
 with Flair (cf
 http://code.google.com/p/londonwicket/downloads/detail?name=LondonWicket-FormsWithFlair.pdfcan=2q=)

 Basically, Alastair uses behavior to display feedback message specific to
 some components next to the component in question.

 We use our components in form with feedback panel, for non component
 specific messages.

 Overall, we would like these functionalities:
 A - no message should be rendered twice
 B - no message should be left unrendered (safety net)
 C - component specific message should be rendered next to their component
 D - when some messages were displayed next to their components, the
 feedback panel should display a message for it (like one of more input
 didn't validate, please check them)

 In order to try to achieve that, I used the FeedbackMessage.isRendered()
 method in both the behaviors and the feedback panel IFeedbackMessageFilter.


As you've discovered, using the isRendered() method for this really is
difficult because it depends on the order of traversal.  This makes it
brittle to use this for your safety net or catch all feedback panel.

I had encountered this issue and for one of my training classes, I threw
together a solution.  Your post prodded me to go ahead and post my solution
as a blog post.  After dusting off my long-forgotten blog, here it is:
http://www.jeremythomerson.com/blog/2011/01/catching-all-feedback-messages-that-arent-rendered-by-other-feedback-panels/(or
http://bit.ly/eHUEuN if that gets chopped up).

Hopefully that helps someone.

-- 
Jeremy Thomerson
http://wickettraining.com
*Need a CMS for Wicket?  Use Brix! http://brixcms.org*


Re: Display component feedback message once: safety net renders them always before

2011-01-03 Thread Pedro Santos
Hi Joseph, I didn't understood your solution

If have an page with 3 form components and 5 feedback panels: 1 for each
form component, 1 for the form, and the last one for the page. And I want
feedback messages address to form components to be presented only by the
correspondent feedback panel.
I would create:
FeedbackPanel fp1 = new
ComponentFeedbackPanel(formComponent1FeedbackPanel, formComponent1);
FeedbackPanel fp2 = new
ComponentFeedbackPanel(formComponent2FeedbackPanel, formComponent2);
FeedbackPanel fp3 = new
ComponentFeedbackPanel(formComponent3FeedbackPanel, formComponent3);
FeedbackPanel fp4 = new ComponentFeedbackPanel(formFeedbackPanel, form);
FeedbackPanel fp5 = new ComponentFeedbackPanel(pageFeedbackPanel, page);

formComponent1.info(some message) register an message that will only be
presented by fp1
form.error(some message) register an message that will only be presented
by the form

On Wed, Dec 29, 2010 at 12:05 PM, joseph.pachod j...@thomas-daily.de wrote:


 Hi Pedro Santos

 I hadn't seen your answer, sorry.

 In between, I had time again to look into my issue.

 Actually, the root of it was about not displaying the feedback message
 twice: once in the general feedback panel and once close from the
 generating
 component.

 As such, while helpful, your solution didn't help there.

 But I now found this workaround for this:
  add(new FeedbackPanel(plainFeedback, new IFeedbackMessageFilter()
{

@Override
public boolean accept(final FeedbackMessage message)
{
ListIBehavior behaviors =
 message.getReporter().getBehaviors();
for (IBehavior behavior : behaviors)
{
if (behavior instanceof FeedbackHighlightBehavior)
{
return false;
}
}
return true;
}
}));

 = the feedback panel doesn't display the message twice :)

 I have yet to put this change in production, where maybe I would have to do
 extra check (like to check that the reporter component is effectively
 visible in order to be sure of the feedback message display), but at least
 I've found a way to go.

 :)

 ++
 joseph


 --
 View this message in context:
 http://apache-wicket.1842946.n4.nabble.com/Display-component-feedback-message-once-safety-net-renders-them-always-before-tp3068969p3167130.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




-- 
Pedro Henrique Oliveira dos Santos


Re: Display component feedback message once: safety net renders them always before

2011-01-03 Thread Pedro Santos
You are testing the behaviors types of reporter, but if two components with
an FeedbackHighlightBehavior report an feedback you break the functionality
A - no message should be rendered twice

On Wed, Dec 29, 2010 at 12:05 PM, joseph.pachod j...@thomas-daily.de wrote:


 Hi Pedro Santos

 I hadn't seen your answer, sorry.

 In between, I had time again to look into my issue.

 Actually, the root of it was about not displaying the feedback message
 twice: once in the general feedback panel and once close from the
 generating
 component.

 As such, while helpful, your solution didn't help there.

 But I now found this workaround for this:
  add(new FeedbackPanel(plainFeedback, new IFeedbackMessageFilter()
{

@Override
public boolean accept(final FeedbackMessage message)
{
ListIBehavior behaviors =
 message.getReporter().getBehaviors();
for (IBehavior behavior : behaviors)
{
if (behavior instanceof FeedbackHighlightBehavior)
{
return false;
}
}
return true;
}
}));

 = the feedback panel doesn't display the message twice :)

 I have yet to put this change in production, where maybe I would have to do
 extra check (like to check that the reporter component is effectively
 visible in order to be sure of the feedback message display), but at least
 I've found a way to go.

 :)

 ++
 joseph


 --
 View this message in context:
 http://apache-wicket.1842946.n4.nabble.com/Display-component-feedback-message-once-safety-net-renders-them-always-before-tp3068969p3167130.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




-- 
Pedro Henrique Oliveira dos Santos


Re: Display component feedback message once: safety net renders them always before

2010-12-29 Thread joseph.pachod

Hi Pedro Santos

I hadn't seen your answer, sorry. 

In between, I had time again to look into my issue. 

Actually, the root of it was about not displaying the feedback message
twice: once in the general feedback panel and once close from the generating
component.

As such, while helpful, your solution didn't help there.

But I now found this workaround for this:
  add(new FeedbackPanel(plainFeedback, new IFeedbackMessageFilter()
{

@Override
public boolean accept(final FeedbackMessage message)
{
ListIBehavior behaviors =
message.getReporter().getBehaviors();
for (IBehavior behavior : behaviors)
{
if (behavior instanceof FeedbackHighlightBehavior)
{
return false;
}
}
return true;
}
}));

= the feedback panel doesn't display the message twice :)

I have yet to put this change in production, where maybe I would have to do
extra check (like to check that the reporter component is effectively
visible in order to be sure of the feedback message display), but at least
I've found a way to go.

:)

++
joseph


-- 
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Display-component-feedback-message-once-safety-net-renders-them-always-before-tp3068969p3167130.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: Display component feedback message once: safety net renders them always before

2010-12-06 Thread Pedro Santos
Hi Joseph, I use an ComponentFeedbackPanel next to the component when I want
its feedback message presented in an special place.

On Thu, Dec 2, 2010 at 9:52 AM, Joseph Pachod j...@thomas-daily.de wrote:

 Hi

 I'm trying to apply the behaviors presented by Alastair Maw in his
 presentation Wicket Forms
 with Flair (cf
 http://code.google.com/p/londonwicket/downloads/detail?name=LondonWicket-FormsWithFlair.pdfcan=2q=)

 Basically, Alastair uses behavior to display feedback message specific to
 some components next to the component in question.

 We use our components in form with feedback panel, for non component
 specific messages.

 Overall, we would like these functionalities:
 A - no message should be rendered twice
 B - no message should be left unrendered (safety net)
 C - component specific message should be rendered next to their component
 D - when some messages were displayed next to their components, the
 feedback panel should display a message for it (like one of more input
 didn't validate, please check them)

 In order to try to achieve that, I used the FeedbackMessage.isRendered()
 method in both the behaviors and the feedback panel IFeedbackMessageFilter.

 However, it looks like the feedback panel is always the first to be
 rendered, whatever the components ordering. As such, it always get to render
 first the feedback messages.

 I tried to use only behavior based feedback messages display, but looks
 like the behavior added on the top level elements also always get rendered
 first.

 Next stuff coming in my mind is to keep track of all these behaviors to be
 able to ask each of these if they would render some message. Doing so in the
 safety net component would allow to avoid duplicates. However, this feels
 poor to do (list to give around or to access somehow in the background,
 maybe through some thread local container).

 so, the big question: is there a nice and easy way to do that ? Anything
 better than this behavior tracking stuff is welcome ;)

 best
 --

 Joseph Pachod
 IT

 THOMAS DAILY GmbH
 Adlerstraße 19
 79098 Freiburg
 Deutschland
 T  + 49 761 3 85 59 506
 F  + 49 761 3 85 59 550
 E  joseph.pac...@thomas-daily.de
 www.thomas-daily.de

 Geschäftsführer/Managing Directors:
 Wendy Thomas, Susanne Larbig
 Handelsregister Freiburg i.Br., HRB 3947

 Registrieren Sie sich unter https://www.thomas-daily.de/user/sign-in für
 die TD Morning News, eine kostenlose Auswahl aktueller Themen aus TD
 Premium, morgens ab 9:15 in Ihrer Mailbox.

 Aktuelle Presseinformationen für die TD Morning News und TD Premium nimmt
 unsere Redaktion unter redakt...@thomas-daily.de entgegen.
 Redaktionsschluss für die TD Morning News ist täglich um 8:45.

 Register free of charge at https://www.thomas-daily.de/user/sign-in to
 have the TD Morning News, a selection of the latest topics from TD Premium,
 delivered to your mailbox from 9:15 every morning.

 Our editorial department receives the latest press releases for the TD
 Morning News and TD Premium at redakt...@thomas-daily.de. The editorial
 deadline for the TD Morning News is 8.45am daily.


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




-- 
Pedro Henrique Oliveira dos Santos


Display component feedback message once: safety net renders them always before

2010-12-02 Thread Joseph Pachod

Hi

I'm trying to apply the behaviors presented by Alastair Maw in his 
presentation Wicket Forms
with Flair (cf 
http://code.google.com/p/londonwicket/downloads/detail?name=LondonWicket-FormsWithFlair.pdfcan=2q= 
)


Basically, Alastair uses behavior to display feedback message specific 
to some components next to the component in question.


We use our components in form with feedback panel, for non component 
specific messages.


Overall, we would like these functionalities:
A - no message should be rendered twice
B - no message should be left unrendered (safety net)
C - component specific message should be rendered next to their component
D - when some messages were displayed next to their components, the 
feedback panel should display a message for it (like one of more input 
didn't validate, please check them)


In order to try to achieve that, I used the FeedbackMessage.isRendered() 
method in both the behaviors and the feedback panel IFeedbackMessageFilter.


However, it looks like the feedback panel is always the first to be 
rendered, whatever the components ordering. As such, it always get to 
render first the feedback messages.


I tried to use only behavior based feedback messages display, but looks 
like the behavior added on the top level elements also always get 
rendered first.


Next stuff coming in my mind is to keep track of all these behaviors to 
be able to ask each of these if they would render some message. Doing so 
in the safety net component would allow to avoid duplicates. However, 
this feels poor to do (list to give around or to access somehow in the 
background, maybe through some thread local container).


so, the big question: is there a nice and easy way to do that ? Anything 
better than this behavior tracking stuff is welcome ;)


best
--

Joseph Pachod
IT

THOMAS DAILY GmbH
Adlerstraße 19
79098 Freiburg
Deutschland
T  + 49 761 3 85 59 506
F  + 49 761 3 85 59 550
E  joseph.pac...@thomas-daily.de
www.thomas-daily.de

Geschäftsführer/Managing Directors:
Wendy Thomas, Susanne Larbig
Handelsregister Freiburg i.Br., HRB 3947

Registrieren Sie sich unter https://www.thomas-daily.de/user/sign-in für die TD 
Morning News, eine kostenlose Auswahl aktueller Themen aus TD Premium, morgens 
ab 9:15 in Ihrer Mailbox.

Aktuelle Presseinformationen für die TD Morning News und TD Premium nimmt 
unsere Redaktion unter redakt...@thomas-daily.de entgegen.
Redaktionsschluss für die TD Morning News ist täglich um 8:45.

Register free of charge at https://www.thomas-daily.de/user/sign-in to have the 
TD Morning News, a selection of the latest topics from TD Premium, delivered to 
your mailbox from 9:15 every morning.

Our editorial department receives the latest press releases for the TD Morning 
News and TD Premium at redakt...@thomas-daily.de. The editorial deadline for 
the TD Morning News is 8.45am daily.


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