You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Christian Huber <hu...@butterbrot.org> on 2011/08/23 19:10:08 UTC

Sorting Feedback Messages

Hi,

I was wondering if there is a way to have feedback messages show up in 
certain order. Like, when you have multiple messages for the user you 
might want to have the most general one (e.g. success/failure) at the 
top and other detail messages shown below.

 From what I have seen so far it looks like this is not possible (at 
least not with 1.4.18)

As a default messages are rendered in the order they have been provided, 
so usually you can just collect the messages you want to display and 
then add them at the end of your request in the desired order. But there 
can be circumstances where this is not feasible or at least pretty anoying.

I have seen that a FeedbackPanel can be given a comparator to sort the 
messages but the feedback messages only provide a level field to 
distinguish between info, debug, errror etc. To impose a proper priority 
order one would need a metric orthogonal to message levels preferrably 
represented by a primitive (double would give the biggest freedom here).

The Component class could be extended to provide additional methods like 
Component#info(String message, double priority) and messages which do 
not have a priority get assigned a default value specified in the 
Application class (could be 0 in the standard implementation).

Would this be a useful/sensible addition? Is such a thing planned for 
future releases or maybe already available and I just did not see it?

One workaround/hack to implement this with the current version could be 
to prefix all messages with a numeric string and use a Comparator to 
parse this string and sort accordingly.

Cheers, Chris

-- 
The Sanity Resort <http://sanityresort.blogspot.com/>

Re: Sorting Feedback Messages

Posted by Igor Vaynberg <ig...@gmail.com>.
yep, that was the one...i forgot we fixed it.

-igor


On Wed, Aug 24, 2011 at 3:52 PM, Peter Ertl <pe...@gmx.org> wrote:
> here's the related ticket:
>
> https://issues.apache.org/jira/browse/WICKET-2986
>
>
> Am 25.08.2011 um 00:47 schrieb Peter Ertl:
>
>> igor, you mean the sorting criteria or supporting java.io.Serializable for info(), warn(), error(), success() ?
>>
>> 1.5 accepts Serializable for these methods already...
>>
>> So one more nice feature when you upgrade to 1.5 :-)
>>
>> Am 25.08.2011 um 00:31 schrieb Igor Vaynberg:
>>
>>> there is a long standing issue in jira to address this. something to
>>> queue for 1.6
>>>
>>> -igor
>>>
>>>
>>> On Wed, Aug 24, 2011 at 3:24 PM, Peter Ertl <pe...@gmx.org> wrote:
>>>> seems like this works only for error(Serializable)
>>>>
>>>> the required methods for info() and warn() accepting serializable are missing
>>>>
>>>> changing these in 1.4 would mean an api break
>>>>
>>>> however you can add any kind of message easily with
>>>>
>>>>  Session.get().getFeedbackMessages().add(new FeedbackMessage(reporter, message, level))
>>>>
>>>> ...
>>>>
>>>> Am 25.08.2011 um 00:18 schrieb Peter Ertl:
>>>>
>>>>> actually the message property for FeedbackMessage is of type java.io.Serializable, not java.lang.String. So you can can add your own custom error message class instead of a plain string.
>>>>>
>>>>> e.g. inside your page
>>>>>
>>>>> error(new MessageWithSortCriteria("foobar", 4711))
>>>>>
>>>>> with
>>>>>
>>>>> public class MessageWithSortCriteria implements Serializable
>>>>> {
>>>>> public MessageWithSortCriteria(String message, int sortOrder)
>>>>> {
>>>>> }
>>>>>
>>>>> // ...
>>>>> }
>>>>>
>>>>> this useless sample is just to give you an impression :-)
>>>>>
>>>>> then use a message sorter as Martin said that uses the attribute if present...
>>>>>
>>>>> only thing you have to care about is that toString() is overridden and returns a user-readable string for rendering messages to the screen.
>>>>>
>>>>> Am 23.08.2011 um 20:39 schrieb Christian Huber:
>>>>>
>>>>>> Yes, as i wrote this would be the way to impose a custom sorting on messages but at the moment the FilterMessage class does not provide dedicated fields that could be used for a sorting metric. So i was wondering if there are plans to provide such a thing or if we will be bound to incooperate this kind of information into the messages themselves.
>>>>>>
>>>>>> The Sanity Resort <http://sanityresort.blogspot.com/>
>>>>>>
>>>>>> Am 23.08.2011 19:21, schrieb Martin Grigorov:
>>>>>>> I think org.apache.wicket.markup.html.panel.FeedbackPanel.setSortingComparator(Comparator<FeedbackMessage>)
>>>>>>> is for that
>>>>>>>
>>>>>>> On Tue, Aug 23, 2011 at 8:10 PM, Christian Huber<hu...@butterbrot.org>  wrote:
>>>>>>>> Hi,
>>>>>>>>
>>>>>>>> I was wondering if there is a way to have feedback messages show up in
>>>>>>>> certain order. Like, when you have multiple messages for the user you might
>>>>>>>> want to have the most general one (e.g. success/failure) at the top and
>>>>>>>> other detail messages shown below.
>>>>>>>>
>>>>>>>> From what I have seen so far it looks like this is not possible (at least
>>>>>>>> not with 1.4.18)
>>>>>>>>
>>>>>>>> As a default messages are rendered in the order they have been provided, so
>>>>>>>> usually you can just collect the messages you want to display and then add
>>>>>>>> them at the end of your request in the desired order. But there can be
>>>>>>>> circumstances where this is not feasible or at least pretty anoying.
>>>>>>>>
>>>>>>>> I have seen that a FeedbackPanel can be given a comparator to sort the
>>>>>>>> messages but the feedback messages only provide a level field to distinguish
>>>>>>>> between info, debug, errror etc. To impose a proper priority order one would
>>>>>>>> need a metric orthogonal to message levels preferrably represented by a
>>>>>>>> primitive (double would give the biggest freedom here).
>>>>>>>>
>>>>>>>> The Component class could be extended to provide additional methods like
>>>>>>>> Component#info(String message, double priority) and messages which do not
>>>>>>>> have a priority get assigned a default value specified in the Application
>>>>>>>> class (could be 0 in the standard implementation).
>>>>>>>>
>>>>>>>> Would this be a useful/sensible addition? Is such a thing planned for future
>>>>>>>> releases or maybe already available and I just did not see it?
>>>>>>>>
>>>>>>>> One workaround/hack to implement this with the current version could be to
>>>>>>>> prefix all messages with a numeric string and use a Comparator to parse this
>>>>>>>> string and sort accordingly.
>>>>>>>>
>>>>>>>> Cheers, Chris
>>>>>>>>
>>>>>>>> --
>>>>>>>> The Sanity Resort<http://sanityresort.blogspot.com/>
>>>>>>>>
>>>>>>>
>>>>>>>
>>>>>
>>>>>
>>>>> ---------------------------------------------------------------------
>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>>
>>>>
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>
>>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

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


Re: Sorting Feedback Messages

Posted by Peter Ertl <pe...@gmx.org>.
here's the related ticket:

https://issues.apache.org/jira/browse/WICKET-2986


Am 25.08.2011 um 00:47 schrieb Peter Ertl:

> igor, you mean the sorting criteria or supporting java.io.Serializable for info(), warn(), error(), success() ?
> 
> 1.5 accepts Serializable for these methods already...
> 
> So one more nice feature when you upgrade to 1.5 :-)
> 
> Am 25.08.2011 um 00:31 schrieb Igor Vaynberg:
> 
>> there is a long standing issue in jira to address this. something to
>> queue for 1.6
>> 
>> -igor
>> 
>> 
>> On Wed, Aug 24, 2011 at 3:24 PM, Peter Ertl <pe...@gmx.org> wrote:
>>> seems like this works only for error(Serializable)
>>> 
>>> the required methods for info() and warn() accepting serializable are missing
>>> 
>>> changing these in 1.4 would mean an api break
>>> 
>>> however you can add any kind of message easily with
>>> 
>>>  Session.get().getFeedbackMessages().add(new FeedbackMessage(reporter, message, level))
>>> 
>>> ...
>>> 
>>> Am 25.08.2011 um 00:18 schrieb Peter Ertl:
>>> 
>>>> actually the message property for FeedbackMessage is of type java.io.Serializable, not java.lang.String. So you can can add your own custom error message class instead of a plain string.
>>>> 
>>>> e.g. inside your page
>>>> 
>>>> error(new MessageWithSortCriteria("foobar", 4711))
>>>> 
>>>> with
>>>> 
>>>> public class MessageWithSortCriteria implements Serializable
>>>> {
>>>> public MessageWithSortCriteria(String message, int sortOrder)
>>>> {
>>>> }
>>>> 
>>>> // ...
>>>> }
>>>> 
>>>> this useless sample is just to give you an impression :-)
>>>> 
>>>> then use a message sorter as Martin said that uses the attribute if present...
>>>> 
>>>> only thing you have to care about is that toString() is overridden and returns a user-readable string for rendering messages to the screen.
>>>> 
>>>> Am 23.08.2011 um 20:39 schrieb Christian Huber:
>>>> 
>>>>> Yes, as i wrote this would be the way to impose a custom sorting on messages but at the moment the FilterMessage class does not provide dedicated fields that could be used for a sorting metric. So i was wondering if there are plans to provide such a thing or if we will be bound to incooperate this kind of information into the messages themselves.
>>>>> 
>>>>> The Sanity Resort <http://sanityresort.blogspot.com/>
>>>>> 
>>>>> Am 23.08.2011 19:21, schrieb Martin Grigorov:
>>>>>> I think org.apache.wicket.markup.html.panel.FeedbackPanel.setSortingComparator(Comparator<FeedbackMessage>)
>>>>>> is for that
>>>>>> 
>>>>>> On Tue, Aug 23, 2011 at 8:10 PM, Christian Huber<hu...@butterbrot.org>  wrote:
>>>>>>> Hi,
>>>>>>> 
>>>>>>> I was wondering if there is a way to have feedback messages show up in
>>>>>>> certain order. Like, when you have multiple messages for the user you might
>>>>>>> want to have the most general one (e.g. success/failure) at the top and
>>>>>>> other detail messages shown below.
>>>>>>> 
>>>>>>> From what I have seen so far it looks like this is not possible (at least
>>>>>>> not with 1.4.18)
>>>>>>> 
>>>>>>> As a default messages are rendered in the order they have been provided, so
>>>>>>> usually you can just collect the messages you want to display and then add
>>>>>>> them at the end of your request in the desired order. But there can be
>>>>>>> circumstances where this is not feasible or at least pretty anoying.
>>>>>>> 
>>>>>>> I have seen that a FeedbackPanel can be given a comparator to sort the
>>>>>>> messages but the feedback messages only provide a level field to distinguish
>>>>>>> between info, debug, errror etc. To impose a proper priority order one would
>>>>>>> need a metric orthogonal to message levels preferrably represented by a
>>>>>>> primitive (double would give the biggest freedom here).
>>>>>>> 
>>>>>>> The Component class could be extended to provide additional methods like
>>>>>>> Component#info(String message, double priority) and messages which do not
>>>>>>> have a priority get assigned a default value specified in the Application
>>>>>>> class (could be 0 in the standard implementation).
>>>>>>> 
>>>>>>> Would this be a useful/sensible addition? Is such a thing planned for future
>>>>>>> releases or maybe already available and I just did not see it?
>>>>>>> 
>>>>>>> One workaround/hack to implement this with the current version could be to
>>>>>>> prefix all messages with a numeric string and use a Comparator to parse this
>>>>>>> string and sort accordingly.
>>>>>>> 
>>>>>>> Cheers, Chris
>>>>>>> 
>>>>>>> --
>>>>>>> The Sanity Resort<http://sanityresort.blogspot.com/>
>>>>>>> 
>>>>>> 
>>>>>> 
>>>> 
>>>> 
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>> 
>>> 
>>> 
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>> For additional commands, e-mail: users-help@wicket.apache.org
>>> 
>>> 
>> 
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
> 


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


Re: Sorting Feedback Messages

Posted by Peter Ertl <pe...@gmx.org>.
igor, you mean the sorting criteria or supporting java.io.Serializable for info(), warn(), error(), success() ?

1.5 accepts Serializable for these methods already...

So one more nice feature when you upgrade to 1.5 :-)

Am 25.08.2011 um 00:31 schrieb Igor Vaynberg:

> there is a long standing issue in jira to address this. something to
> queue for 1.6
> 
> -igor
> 
> 
> On Wed, Aug 24, 2011 at 3:24 PM, Peter Ertl <pe...@gmx.org> wrote:
>> seems like this works only for error(Serializable)
>> 
>> the required methods for info() and warn() accepting serializable are missing
>> 
>> changing these in 1.4 would mean an api break
>> 
>> however you can add any kind of message easily with
>> 
>>   Session.get().getFeedbackMessages().add(new FeedbackMessage(reporter, message, level))
>> 
>> ...
>> 
>> Am 25.08.2011 um 00:18 schrieb Peter Ertl:
>> 
>>> actually the message property for FeedbackMessage is of type java.io.Serializable, not java.lang.String. So you can can add your own custom error message class instead of a plain string.
>>> 
>>> e.g. inside your page
>>> 
>>>  error(new MessageWithSortCriteria("foobar", 4711))
>>> 
>>> with
>>> 
>>> public class MessageWithSortCriteria implements Serializable
>>> {
>>>  public MessageWithSortCriteria(String message, int sortOrder)
>>>  {
>>>  }
>>> 
>>> // ...
>>> }
>>> 
>>> this useless sample is just to give you an impression :-)
>>> 
>>> then use a message sorter as Martin said that uses the attribute if present...
>>> 
>>> only thing you have to care about is that toString() is overridden and returns a user-readable string for rendering messages to the screen.
>>> 
>>> Am 23.08.2011 um 20:39 schrieb Christian Huber:
>>> 
>>>> Yes, as i wrote this would be the way to impose a custom sorting on messages but at the moment the FilterMessage class does not provide dedicated fields that could be used for a sorting metric. So i was wondering if there are plans to provide such a thing or if we will be bound to incooperate this kind of information into the messages themselves.
>>>> 
>>>> The Sanity Resort <http://sanityresort.blogspot.com/>
>>>> 
>>>> Am 23.08.2011 19:21, schrieb Martin Grigorov:
>>>>> I think org.apache.wicket.markup.html.panel.FeedbackPanel.setSortingComparator(Comparator<FeedbackMessage>)
>>>>> is for that
>>>>> 
>>>>> On Tue, Aug 23, 2011 at 8:10 PM, Christian Huber<hu...@butterbrot.org>  wrote:
>>>>>> Hi,
>>>>>> 
>>>>>> I was wondering if there is a way to have feedback messages show up in
>>>>>> certain order. Like, when you have multiple messages for the user you might
>>>>>> want to have the most general one (e.g. success/failure) at the top and
>>>>>> other detail messages shown below.
>>>>>> 
>>>>>> From what I have seen so far it looks like this is not possible (at least
>>>>>> not with 1.4.18)
>>>>>> 
>>>>>> As a default messages are rendered in the order they have been provided, so
>>>>>> usually you can just collect the messages you want to display and then add
>>>>>> them at the end of your request in the desired order. But there can be
>>>>>> circumstances where this is not feasible or at least pretty anoying.
>>>>>> 
>>>>>> I have seen that a FeedbackPanel can be given a comparator to sort the
>>>>>> messages but the feedback messages only provide a level field to distinguish
>>>>>> between info, debug, errror etc. To impose a proper priority order one would
>>>>>> need a metric orthogonal to message levels preferrably represented by a
>>>>>> primitive (double would give the biggest freedom here).
>>>>>> 
>>>>>> The Component class could be extended to provide additional methods like
>>>>>> Component#info(String message, double priority) and messages which do not
>>>>>> have a priority get assigned a default value specified in the Application
>>>>>> class (could be 0 in the standard implementation).
>>>>>> 
>>>>>> Would this be a useful/sensible addition? Is such a thing planned for future
>>>>>> releases or maybe already available and I just did not see it?
>>>>>> 
>>>>>> One workaround/hack to implement this with the current version could be to
>>>>>> prefix all messages with a numeric string and use a Comparator to parse this
>>>>>> string and sort accordingly.
>>>>>> 
>>>>>> Cheers, Chris
>>>>>> 
>>>>>> --
>>>>>> The Sanity Resort<http://sanityresort.blogspot.com/>
>>>>>> 
>>>>> 
>>>>> 
>>> 
>>> 
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>> For additional commands, e-mail: users-help@wicket.apache.org
>>> 
>> 
>> 
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>> 
>> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
> 


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


Re: Sorting Feedback Messages

Posted by Igor Vaynberg <ig...@gmail.com>.
there is a long standing issue in jira to address this. something to
queue for 1.6

-igor


On Wed, Aug 24, 2011 at 3:24 PM, Peter Ertl <pe...@gmx.org> wrote:
> seems like this works only for error(Serializable)
>
> the required methods for info() and warn() accepting serializable are missing
>
> changing these in 1.4 would mean an api break
>
> however you can add any kind of message easily with
>
>   Session.get().getFeedbackMessages().add(new FeedbackMessage(reporter, message, level))
>
> ...
>
> Am 25.08.2011 um 00:18 schrieb Peter Ertl:
>
>> actually the message property for FeedbackMessage is of type java.io.Serializable, not java.lang.String. So you can can add your own custom error message class instead of a plain string.
>>
>> e.g. inside your page
>>
>>  error(new MessageWithSortCriteria("foobar", 4711))
>>
>> with
>>
>> public class MessageWithSortCriteria implements Serializable
>> {
>>  public MessageWithSortCriteria(String message, int sortOrder)
>>  {
>>  }
>>
>> // ...
>> }
>>
>> this useless sample is just to give you an impression :-)
>>
>> then use a message sorter as Martin said that uses the attribute if present...
>>
>> only thing you have to care about is that toString() is overridden and returns a user-readable string for rendering messages to the screen.
>>
>> Am 23.08.2011 um 20:39 schrieb Christian Huber:
>>
>>> Yes, as i wrote this would be the way to impose a custom sorting on messages but at the moment the FilterMessage class does not provide dedicated fields that could be used for a sorting metric. So i was wondering if there are plans to provide such a thing or if we will be bound to incooperate this kind of information into the messages themselves.
>>>
>>> The Sanity Resort <http://sanityresort.blogspot.com/>
>>>
>>> Am 23.08.2011 19:21, schrieb Martin Grigorov:
>>>> I think org.apache.wicket.markup.html.panel.FeedbackPanel.setSortingComparator(Comparator<FeedbackMessage>)
>>>> is for that
>>>>
>>>> On Tue, Aug 23, 2011 at 8:10 PM, Christian Huber<hu...@butterbrot.org>  wrote:
>>>>> Hi,
>>>>>
>>>>> I was wondering if there is a way to have feedback messages show up in
>>>>> certain order. Like, when you have multiple messages for the user you might
>>>>> want to have the most general one (e.g. success/failure) at the top and
>>>>> other detail messages shown below.
>>>>>
>>>>> From what I have seen so far it looks like this is not possible (at least
>>>>> not with 1.4.18)
>>>>>
>>>>> As a default messages are rendered in the order they have been provided, so
>>>>> usually you can just collect the messages you want to display and then add
>>>>> them at the end of your request in the desired order. But there can be
>>>>> circumstances where this is not feasible or at least pretty anoying.
>>>>>
>>>>> I have seen that a FeedbackPanel can be given a comparator to sort the
>>>>> messages but the feedback messages only provide a level field to distinguish
>>>>> between info, debug, errror etc. To impose a proper priority order one would
>>>>> need a metric orthogonal to message levels preferrably represented by a
>>>>> primitive (double would give the biggest freedom here).
>>>>>
>>>>> The Component class could be extended to provide additional methods like
>>>>> Component#info(String message, double priority) and messages which do not
>>>>> have a priority get assigned a default value specified in the Application
>>>>> class (could be 0 in the standard implementation).
>>>>>
>>>>> Would this be a useful/sensible addition? Is such a thing planned for future
>>>>> releases or maybe already available and I just did not see it?
>>>>>
>>>>> One workaround/hack to implement this with the current version could be to
>>>>> prefix all messages with a numeric string and use a Comparator to parse this
>>>>> string and sort accordingly.
>>>>>
>>>>> Cheers, Chris
>>>>>
>>>>> --
>>>>> The Sanity Resort<http://sanityresort.blogspot.com/>
>>>>>
>>>>
>>>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

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


Re: Sorting Feedback Messages

Posted by Peter Ertl <pe...@gmx.org>.
seems like this works only for error(Serializable)

the required methods for info() and warn() accepting serializable are missing

changing these in 1.4 would mean an api break

however you can add any kind of message easily with

   Session.get().getFeedbackMessages().add(new FeedbackMessage(reporter, message, level))

...

Am 25.08.2011 um 00:18 schrieb Peter Ertl:

> actually the message property for FeedbackMessage is of type java.io.Serializable, not java.lang.String. So you can can add your own custom error message class instead of a plain string.
> 
> e.g. inside your page
> 
>  error(new MessageWithSortCriteria("foobar", 4711))
> 
> with 
> 
> public class MessageWithSortCriteria implements Serializable
> {
>  public MessageWithSortCriteria(String message, int sortOrder)
>  {
>  }
> 
> // ...
> }
> 
> this useless sample is just to give you an impression :-)
> 
> then use a message sorter as Martin said that uses the attribute if present...
> 
> only thing you have to care about is that toString() is overridden and returns a user-readable string for rendering messages to the screen.
> 
> Am 23.08.2011 um 20:39 schrieb Christian Huber:
> 
>> Yes, as i wrote this would be the way to impose a custom sorting on messages but at the moment the FilterMessage class does not provide dedicated fields that could be used for a sorting metric. So i was wondering if there are plans to provide such a thing or if we will be bound to incooperate this kind of information into the messages themselves.
>> 
>> The Sanity Resort <http://sanityresort.blogspot.com/>
>> 
>> Am 23.08.2011 19:21, schrieb Martin Grigorov:
>>> I think org.apache.wicket.markup.html.panel.FeedbackPanel.setSortingComparator(Comparator<FeedbackMessage>)
>>> is for that
>>> 
>>> On Tue, Aug 23, 2011 at 8:10 PM, Christian Huber<hu...@butterbrot.org>  wrote:
>>>> Hi,
>>>> 
>>>> I was wondering if there is a way to have feedback messages show up in
>>>> certain order. Like, when you have multiple messages for the user you might
>>>> want to have the most general one (e.g. success/failure) at the top and
>>>> other detail messages shown below.
>>>> 
>>>> From what I have seen so far it looks like this is not possible (at least
>>>> not with 1.4.18)
>>>> 
>>>> As a default messages are rendered in the order they have been provided, so
>>>> usually you can just collect the messages you want to display and then add
>>>> them at the end of your request in the desired order. But there can be
>>>> circumstances where this is not feasible or at least pretty anoying.
>>>> 
>>>> I have seen that a FeedbackPanel can be given a comparator to sort the
>>>> messages but the feedback messages only provide a level field to distinguish
>>>> between info, debug, errror etc. To impose a proper priority order one would
>>>> need a metric orthogonal to message levels preferrably represented by a
>>>> primitive (double would give the biggest freedom here).
>>>> 
>>>> The Component class could be extended to provide additional methods like
>>>> Component#info(String message, double priority) and messages which do not
>>>> have a priority get assigned a default value specified in the Application
>>>> class (could be 0 in the standard implementation).
>>>> 
>>>> Would this be a useful/sensible addition? Is such a thing planned for future
>>>> releases or maybe already available and I just did not see it?
>>>> 
>>>> One workaround/hack to implement this with the current version could be to
>>>> prefix all messages with a numeric string and use a Comparator to parse this
>>>> string and sort accordingly.
>>>> 
>>>> Cheers, Chris
>>>> 
>>>> --
>>>> The Sanity Resort<http://sanityresort.blogspot.com/>
>>>> 
>>> 
>>> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
> 


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


Re: Sorting Feedback Messages

Posted by Peter Ertl <pe...@gmx.org>.
actually the message property for FeedbackMessage is of type java.io.Serializable, not java.lang.String. So you can can add your own custom error message class instead of a plain string.

e.g. inside your page

  error(new MessageWithSortCriteria("foobar", 4711))

with 

public class MessageWithSortCriteria implements Serializable
{
  public MessageWithSortCriteria(String message, int sortOrder)
  {
  }

 // ...
}

this useless sample is just to give you an impression :-)

then use a message sorter as Martin said that uses the attribute if present...

only thing you have to care about is that toString() is overridden and returns a user-readable string for rendering messages to the screen.

Am 23.08.2011 um 20:39 schrieb Christian Huber:

> Yes, as i wrote this would be the way to impose a custom sorting on messages but at the moment the FilterMessage class does not provide dedicated fields that could be used for a sorting metric. So i was wondering if there are plans to provide such a thing or if we will be bound to incooperate this kind of information into the messages themselves.
> 
> The Sanity Resort <http://sanityresort.blogspot.com/>
> 
> Am 23.08.2011 19:21, schrieb Martin Grigorov:
>> I think org.apache.wicket.markup.html.panel.FeedbackPanel.setSortingComparator(Comparator<FeedbackMessage>)
>> is for that
>> 
>> On Tue, Aug 23, 2011 at 8:10 PM, Christian Huber<hu...@butterbrot.org>  wrote:
>>> Hi,
>>> 
>>> I was wondering if there is a way to have feedback messages show up in
>>> certain order. Like, when you have multiple messages for the user you might
>>> want to have the most general one (e.g. success/failure) at the top and
>>> other detail messages shown below.
>>> 
>>> From what I have seen so far it looks like this is not possible (at least
>>> not with 1.4.18)
>>> 
>>> As a default messages are rendered in the order they have been provided, so
>>> usually you can just collect the messages you want to display and then add
>>> them at the end of your request in the desired order. But there can be
>>> circumstances where this is not feasible or at least pretty anoying.
>>> 
>>> I have seen that a FeedbackPanel can be given a comparator to sort the
>>> messages but the feedback messages only provide a level field to distinguish
>>> between info, debug, errror etc. To impose a proper priority order one would
>>> need a metric orthogonal to message levels preferrably represented by a
>>> primitive (double would give the biggest freedom here).
>>> 
>>> The Component class could be extended to provide additional methods like
>>> Component#info(String message, double priority) and messages which do not
>>> have a priority get assigned a default value specified in the Application
>>> class (could be 0 in the standard implementation).
>>> 
>>> Would this be a useful/sensible addition? Is such a thing planned for future
>>> releases or maybe already available and I just did not see it?
>>> 
>>> One workaround/hack to implement this with the current version could be to
>>> prefix all messages with a numeric string and use a Comparator to parse this
>>> string and sort accordingly.
>>> 
>>> Cheers, Chris
>>> 
>>> --
>>> The Sanity Resort<http://sanityresort.blogspot.com/>
>>> 
>> 
>> 


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


Re: Sorting Feedback Messages

Posted by Christian Huber <hu...@butterbrot.org>.
Yes, as i wrote this would be the way to impose a custom sorting on 
messages but at the moment the FilterMessage class does not provide 
dedicated fields that could be used for a sorting metric. So i was 
wondering if there are plans to provide such a thing or if we will be 
bound to incooperate this kind of information into the messages themselves.

The Sanity Resort <http://sanityresort.blogspot.com/>

Am 23.08.2011 19:21, schrieb Martin Grigorov:
> I think org.apache.wicket.markup.html.panel.FeedbackPanel.setSortingComparator(Comparator<FeedbackMessage>)
> is for that
>
> On Tue, Aug 23, 2011 at 8:10 PM, Christian Huber<hu...@butterbrot.org>  wrote:
>> Hi,
>>
>> I was wondering if there is a way to have feedback messages show up in
>> certain order. Like, when you have multiple messages for the user you might
>> want to have the most general one (e.g. success/failure) at the top and
>> other detail messages shown below.
>>
>>  From what I have seen so far it looks like this is not possible (at least
>> not with 1.4.18)
>>
>> As a default messages are rendered in the order they have been provided, so
>> usually you can just collect the messages you want to display and then add
>> them at the end of your request in the desired order. But there can be
>> circumstances where this is not feasible or at least pretty anoying.
>>
>> I have seen that a FeedbackPanel can be given a comparator to sort the
>> messages but the feedback messages only provide a level field to distinguish
>> between info, debug, errror etc. To impose a proper priority order one would
>> need a metric orthogonal to message levels preferrably represented by a
>> primitive (double would give the biggest freedom here).
>>
>> The Component class could be extended to provide additional methods like
>> Component#info(String message, double priority) and messages which do not
>> have a priority get assigned a default value specified in the Application
>> class (could be 0 in the standard implementation).
>>
>> Would this be a useful/sensible addition? Is such a thing planned for future
>> releases or maybe already available and I just did not see it?
>>
>> One workaround/hack to implement this with the current version could be to
>> prefix all messages with a numeric string and use a Comparator to parse this
>> string and sort accordingly.
>>
>> Cheers, Chris
>>
>> --
>> The Sanity Resort<http://sanityresort.blogspot.com/>
>>
>
>

Re: Sorting Feedback Messages

Posted by Martin Grigorov <mg...@apache.org>.
I think org.apache.wicket.markup.html.panel.FeedbackPanel.setSortingComparator(Comparator<FeedbackMessage>)
is for that

On Tue, Aug 23, 2011 at 8:10 PM, Christian Huber <hu...@butterbrot.org> wrote:
> Hi,
>
> I was wondering if there is a way to have feedback messages show up in
> certain order. Like, when you have multiple messages for the user you might
> want to have the most general one (e.g. success/failure) at the top and
> other detail messages shown below.
>
> From what I have seen so far it looks like this is not possible (at least
> not with 1.4.18)
>
> As a default messages are rendered in the order they have been provided, so
> usually you can just collect the messages you want to display and then add
> them at the end of your request in the desired order. But there can be
> circumstances where this is not feasible or at least pretty anoying.
>
> I have seen that a FeedbackPanel can be given a comparator to sort the
> messages but the feedback messages only provide a level field to distinguish
> between info, debug, errror etc. To impose a proper priority order one would
> need a metric orthogonal to message levels preferrably represented by a
> primitive (double would give the biggest freedom here).
>
> The Component class could be extended to provide additional methods like
> Component#info(String message, double priority) and messages which do not
> have a priority get assigned a default value specified in the Application
> class (could be 0 in the standard implementation).
>
> Would this be a useful/sensible addition? Is such a thing planned for future
> releases or maybe already available and I just did not see it?
>
> One workaround/hack to implement this with the current version could be to
> prefix all messages with a numeric string and use a Comparator to parse this
> string and sort accordingly.
>
> Cheers, Chris
>
> --
> The Sanity Resort <http://sanityresort.blogspot.com/>
>



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

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