[jboss-user] [JBoss Seam] - Re: Challenge: Simple Example Adding Records With Lookup Dro

Newlukai do-not-reply at jboss.com
Mon Nov 27 02:59:28 EST 2006


No problem.

But ... erm ... I've another question: In my application there is a table which contains priorities. The table contains two columns: the ID and the description of the priority. On some pages the user can filter all shown entries by priority. Adding a noSelectionLabel the user has also the option to disable the filtering.

But now the user should be able to filter for priorities greater or less than a distinct value, say 3. So I want to add two further rows in the si:selectItems which have this special meaning. I know that the EntityConverter can't handle rows, which are created in my bean and not persisted in the database.
So I think the best solution would be a custom converter which handles the special meanings and invokes the EntityConverter for all the other cases.
Is that possible?

Has to be something like this (got it from the wiki):
public Converter getPriorityConverter() {
  |    return new PriorityConverter<Priority>() {
  | 
  |       protected Object getIdAsObject(String id, Class clazz) {
  |          int priority = Integer.parseInt(id);
  |          if(priority == -2) return SpecialPriorities.GREATER_3;
  |          if(priority == -3) return SpecialPriorities.LESS_3;
  |          Converter entityConverter = new EntityConverter();
  |          return entityConverter.getIdAsObject(id, clazz);
  |       }
  | 
  |       protected String getIdAsString(Priority entity) {
  |          return entity.getId() + " (" + entity.getDescription() + ")";
  |       }
  |    };
  | }

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3988735#3988735

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3988735



More information about the jboss-user mailing list