r125 - trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing
Author: tchemit Date: 2012-12-29 15:55:51 +0100 (Sat, 29 Dec 2012) New Revision: 125 Url: http://forge.codelutin.com/projects/tutti/repository/revisions/125 Log: improve beanList init + add LabelAware in decorator Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/AbstractTuttiUIHandler.java Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/AbstractTuttiUIHandler.java =================================================================== --- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/AbstractTuttiUIHandler.java 2012-12-29 14:50:59 UTC (rev 124) +++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/AbstractTuttiUIHandler.java 2012-12-29 14:55:51 UTC (rev 125) @@ -56,6 +56,7 @@ import java.awt.event.KeyEvent; import java.beans.PropertyChangeEvent; import java.beans.PropertyChangeListener; +import java.io.Serializable; import java.util.ArrayList; import java.util.Arrays; import java.util.Date; @@ -159,16 +160,14 @@ * * @param comboBox le component graphique à initialiser */ - protected <E extends IdAware> void initBeanComboBox( + protected <E extends Serializable> void initBeanComboBox( BeanComboBox<E> comboBox, List<E> data, E selectedData) { Class<E> beanType = (Class<E>) comboBox.getHandler().getTargetClass(); - DecoratorService decoratorService = - context.getService(DecoratorService.class); - Decorator<E> decorator = decoratorService.getDecoratorByType(beanType); + Decorator<E> decorator = getDecorator(beanType, null); if (log.isInfoEnabled()) { log.info("entity list [" + beanType.getName() + "] : " + @@ -199,7 +198,10 @@ List<E> data, List<E> selectedData) { + Preconditions.checkNotNull(list, "No list!"); + Class<E> beanType = list.getBeanType(); + Preconditions.checkNotNull(beanType, "No beanType on the double list!"); DecoratorService decoratorService = context.getService(DecoratorService.class); @@ -289,7 +291,14 @@ Preconditions.checkNotNull(type); - Decorator<O> decorator = decoratorService.getDecoratorByType(type, name); + Decorator decorator = decoratorService.getDecoratorByType(type, name); + if (decorator == null) { + + if (DecoratorService.LabelAware.class.isAssignableFrom(type)) { + decorator = getDecorator(DecoratorService.LabelAware.class, null); + + } + } Preconditions.checkNotNull(decorator); return decorator; }
participants (1)
-
tchemit@users.forge.codelutin.com