This is an automated email from the git hooks/post-receive script. New commit to branch feature/7610-2 in repository observe. See http://git.codelutin.com/observe.git commit b15fb6b4e80a3c85facb91404671a8a2c1c112ae Author: Kevin Morin <morin@codelutin.com> Date: Fri Oct 16 17:02:21 2015 +0200 mise à jour de la liste de référentiels après modif, suppression ou ajout (refs #7610) --- .../ui/content/ref/ContentReferenceUIHandler.java | 42 ++++++++++++---------- 1 file changed, 24 insertions(+), 18 deletions(-) diff --git a/observe-application-swing/src/main/java/fr/ird/observe/ui/content/ref/ContentReferenceUIHandler.java b/observe-application-swing/src/main/java/fr/ird/observe/ui/content/ref/ContentReferenceUIHandler.java index 693bc2e..21f6501 100644 --- a/observe-application-swing/src/main/java/fr/ird/observe/ui/content/ref/ContentReferenceUIHandler.java +++ b/observe-application-swing/src/main/java/fr/ird/observe/ui/content/ref/ContentReferenceUIHandler.java @@ -57,8 +57,6 @@ import org.apache.commons.lang3.StringUtils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.nuiton.decorator.Decorator; -import org.nuiton.decorator.DecoratorUtil; -import org.nuiton.decorator.JXPathDecorator; import org.nuiton.util.beans.Binder; import org.nuiton.util.beans.BinderFactory; @@ -127,8 +125,12 @@ public class ContentReferenceUIHandler<E extends ReferentialDto> extends Content } }; + private ReferentialContentUIInitializer<E, ContentReferenceUI<E>> uiInitializer; + public ContentReferenceUIHandler(ContentReferenceUI<E> ui) { super(ui, null, null); + uiInitializer = new ReferentialContentUIInitializer<>(ui); + } public static <E extends IdDto> void showUsagesForDelete( @@ -198,26 +200,29 @@ public class ContentReferenceUIHandler<E extends ReferentialDto> extends Content public void selectBean(ReferenceDto<E> selectedReference) { - FormDto<E> formDto; - if (getDataSource().canWriteReferential()) { - formDto = getReferentialService().loadToEdit(getBeanType(), selectedReference.getId()); - } else { - formDto = getReferentialService().loadToRead(getBeanType(), selectedReference.getId()); - } + if (selectedReference != null) { - E selectedBean = formDto.getForm(); + FormDto<E> formDto; + if (getDataSource().canWriteReferential()) { + formDto = getReferentialService().loadToEdit(getBeanType(), selectedReference.getId()); + } else { + formDto = getReferentialService().loadToRead(getBeanType(), selectedReference.getId()); + } - getModel().setSelectedBean(selectedBean); + E selectedBean = formDto.getForm(); - // copy right now the selected bean to the model bean to respect contract - // of parent handler (for delation or save objectOperation...) - //FIXME -// getLoadBinder().load(selectedBean, getBean(), true); + getModel().setSelectedBean(selectedBean); + + // copy right now the selected bean to the model bean to respect contract + // of parent handler (for delation or save objectOperation...) + //FIXME + // getLoadBinder().load(selectedBean, getBean(), true); - Binder<E, E> binder = BinderFactory.newBinder(getBeanType()); - binder.copy(selectedBean, getBean()); + Binder<E, E> binder = BinderFactory.newBinder(getBeanType()); + binder.copy(selectedBean, getBean()); - //TODO update data cache + //TODO update data cache + } } @@ -423,7 +428,6 @@ public class ContentReferenceUIHandler<E extends ReferentialDto> extends Content @Override public void initUI() throws Exception { - ReferentialContentUIInitializer<E, ContentReferenceUI<E>> uiInitializer = new ReferentialContentUIInitializer<E, ContentReferenceUI<E>>(getUi()); uiInitializer.initUI(); ContentReferenceUI<E> ui = getUi(); @@ -619,6 +623,8 @@ public class ContentReferenceUIHandler<E extends ReferentialDto> extends Content removeAllMessages(ui); addInfoMessage(t("observe.message.referentiel.editable")); } + + uiInitializer.referentialDataUpdated(); } @Override -- To stop receiving notification emails like this one, please contact codelutin.com SCM administrator <admin+scm@list.forge.codelutin.com>.