You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by walnutmon <ju...@gmail.com> on 2009/02/11 19:47:23 UTC

Feedback Next To Component

In order to add feedback next to the component I used a behavior.  I had some
code from Igor which got me on the right track, although I was unable to
actually get it to work the same way, I simplified it down to the following
code:

AbstractBehavior printMessagesNextToComponent = new AbstractBehavior()
	{

		@Override
		public void onRendered(Component component)
		{
			super.onRendered(component);
			FeedbackMessage message = component.getFeedbackMessage();
			if (message != null)
			{
				final Response out = component.getResponse();
				out.write("");
				out.write(message.getMessage().toString());
				out.write("");
			}
		}
	};

It almost seems too simple, I've tried it and with limited testing it seems
to work just fine, although there are some odd behaviors with Ajax... does
anyone have any comments, better solutions, or possible breaking conditions
that I should check out?
-- 
View this message in context: http://www.nabble.com/Feedback-Next-To-Component-tp21959520p21959520.html
Sent from the Wicket - User mailing list archive at Nabble.com.


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


Re: Feedback Next To Component

Posted by walnutmon <ju...@gmail.com>.
I am trying to build something like that, but I believe that you need
associated markup for each component with a FormComponentFeedbackBorder, and
since I am going to be updating many fields with this behavior, I'd rather
not have to change all of the associated HTML.




Serkan Camurcuoglu-3 wrote:
> 
> there is something called 
> org.apache.wicket.markup.html.form.validation.FormComponentFeedbackBorder, 
> are you trying to build something like it?
> 
> 
> walnutmon wrote:
>> That makes sense, I did pull out the surrounding markup so that it could
>> be
>> edited by calls to the behavior, but that's not really much better.  Are
>> there any approaches that you can think of that may be more extensible? 
>> I'd
>> prefer to not write directly to the page at all, since I'm not
>> particularly
>> familiar with how that works, and I'm nervous about introducing hard to
>> find
>> bugs down the road for other developers not as familiar with the
>> framework.
>>
>>
>> Jonathan Locke wrote:
>>   
>>> behaviors aren't really designed to work like components and render
>>> markup
>>> like that, so it's a bit weird... what if you want to go extend or
>>> change
>>> the markup for the feedback error? it's now embedded in a bunch of code.
>>>
>>>
>>> walnutmon wrote:
>>>     
>>>> In order to add feedback next to the component I used a behavior.  I
>>>> had
>>>> some code from Igor which got me on the right track, although I was
>>>> unable to actually get it to work the same way, I simplified it down to
>>>> the following code:
>>>>
>>>> AbstractBehavior printMessagesNextToComponent = new AbstractBehavior()
>>>> 	{
>>>>
>>>> 		@Override
>>>> 		public void onRendered(Component component)
>>>> 		{
>>>> 			super.onRendered(component);
>>>> 			FeedbackMessage message = component.getFeedbackMessage();
>>>> 			if (message != null)
>>>> 			{
>>>> 				final Response out = component.getResponse();
>>>> 				out.write("");
>>>> 				out.write(message.getMessage().toString());
>>>> 				out.write("");
>>>> 			}
>>>> 		}
>>>> 	};
>>>>
>>>> It almost seems too simple, I've tried it and with limited testing it
>>>> seems to work just fine, although there are some odd behaviors with
>>>> Ajax... does anyone have any comments, better solutions, or possible
>>>> breaking conditions that I should check out?
>>>>
>>>>       
>>>     
>>
>>   
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Feedback-Next-To-Component-tp21959520p22044542.html
Sent from the Wicket - User mailing list archive at Nabble.com.


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


Re: Feedback Next To Component

Posted by Serkan Camurcuoglu <Se...@telenity.com>.
there is something called 
org.apache.wicket.markup.html.form.validation.FormComponentFeedbackBorder, 
are you trying to build something like it?


walnutmon wrote:
> That makes sense, I did pull out the surrounding markup so that it could be
> edited by calls to the behavior, but that's not really much better.  Are
> there any approaches that you can think of that may be more extensible?  I'd
> prefer to not write directly to the page at all, since I'm not particularly
> familiar with how that works, and I'm nervous about introducing hard to find
> bugs down the road for other developers not as familiar with the framework.
>
>
> Jonathan Locke wrote:
>   
>> behaviors aren't really designed to work like components and render markup
>> like that, so it's a bit weird... what if you want to go extend or change
>> the markup for the feedback error? it's now embedded in a bunch of code.
>>
>>
>> walnutmon wrote:
>>     
>>> In order to add feedback next to the component I used a behavior.  I had
>>> some code from Igor which got me on the right track, although I was
>>> unable to actually get it to work the same way, I simplified it down to
>>> the following code:
>>>
>>> AbstractBehavior printMessagesNextToComponent = new AbstractBehavior()
>>> 	{
>>>
>>> 		@Override
>>> 		public void onRendered(Component component)
>>> 		{
>>> 			super.onRendered(component);
>>> 			FeedbackMessage message = component.getFeedbackMessage();
>>> 			if (message != null)
>>> 			{
>>> 				final Response out = component.getResponse();
>>> 				out.write("");
>>> 				out.write(message.getMessage().toString());
>>> 				out.write("");
>>> 			}
>>> 		}
>>> 	};
>>>
>>> It almost seems too simple, I've tried it and with limited testing it
>>> seems to work just fine, although there are some odd behaviors with
>>> Ajax... does anyone have any comments, better solutions, or possible
>>> breaking conditions that I should check out?
>>>
>>>       
>>     
>
>   


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


Re: Feedback Next To Component

Posted by walnutmon <ju...@gmail.com>.
That makes sense, I did pull out the surrounding markup so that it could be
edited by calls to the behavior, but that's not really much better.  Are
there any approaches that you can think of that may be more extensible?  I'd
prefer to not write directly to the page at all, since I'm not particularly
familiar with how that works, and I'm nervous about introducing hard to find
bugs down the road for other developers not as familiar with the framework.


Jonathan Locke wrote:
> 
> 
> behaviors aren't really designed to work like components and render markup
> like that, so it's a bit weird... what if you want to go extend or change
> the markup for the feedback error? it's now embedded in a bunch of code.
> 
> 
> walnutmon wrote:
>> 
>> In order to add feedback next to the component I used a behavior.  I had
>> some code from Igor which got me on the right track, although I was
>> unable to actually get it to work the same way, I simplified it down to
>> the following code:
>> 
>> AbstractBehavior printMessagesNextToComponent = new AbstractBehavior()
>> 	{
>> 
>> 		@Override
>> 		public void onRendered(Component component)
>> 		{
>> 			super.onRendered(component);
>> 			FeedbackMessage message = component.getFeedbackMessage();
>> 			if (message != null)
>> 			{
>> 				final Response out = component.getResponse();
>> 				out.write("");
>> 				out.write(message.getMessage().toString());
>> 				out.write("");
>> 			}
>> 		}
>> 	};
>> 
>> It almost seems too simple, I've tried it and with limited testing it
>> seems to work just fine, although there are some odd behaviors with
>> Ajax... does anyone have any comments, better solutions, or possible
>> breaking conditions that I should check out?
>> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Feedback-Next-To-Component-tp21959520p21975479.html
Sent from the Wicket - User mailing list archive at Nabble.com.


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


Re: Feedback Next To Component

Posted by Jonathan Locke <jo...@gmail.com>.

behaviors aren't really designed to work like components and render markup
like that, so it's a bit weird... what if you want to go extend or change
the markup for the feedback error? it's now embedded in a bunch of code.


walnutmon wrote:
> 
> In order to add feedback next to the component I used a behavior.  I had
> some code from Igor which got me on the right track, although I was unable
> to actually get it to work the same way, I simplified it down to the
> following code:
> 
> AbstractBehavior printMessagesNextToComponent = new AbstractBehavior()
> 	{
> 
> 		@Override
> 		public void onRendered(Component component)
> 		{
> 			super.onRendered(component);
> 			FeedbackMessage message = component.getFeedbackMessage();
> 			if (message != null)
> 			{
> 				final Response out = component.getResponse();
> 				out.write("");
> 				out.write(message.getMessage().toString());
> 				out.write("");
> 			}
> 		}
> 	};
> 
> It almost seems too simple, I've tried it and with limited testing it
> seems to work just fine, although there are some odd behaviors with
> Ajax... does anyone have any comments, better solutions, or possible
> breaking conditions that I should check out?
> 

-- 
View this message in context: http://www.nabble.com/Feedback-Next-To-Component-tp21959520p21964449.html
Sent from the Wicket - User mailing list archive at Nabble.com.


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