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<hub...@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-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

Reply via email to