branch develop updated (bf2234a -> c9f48c3)
This is an automated email from the git hooks/post-receive script. New change to branch develop in repository observe. See http://git.codelutin.com/observe.git from bf2234a ajout de l'injecteur pour le type Class new a3091b6 chargement des données des combo et listes dans les écrans de référentiel (refs #7610) new c9f48c3 mise à jour de la liste de référentiels après modif, suppression ou ajout (refs #7610) The 2 revisions listed above as "new" are entirely new to this repository and will be described in separate emails. The revisions listed as "adds" were already present in the repository and have only been added to this reference. Detailed log of new commits: commit c9f48c33e6a3160892b0abcb870588da2c1f94ab 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) commit a3091b60133dd352d733bcefc996b4ae430350ad Author: Kevin Morin <morin@codelutin.com> Date: Fri Oct 16 16:32:58 2015 +0200 chargement des données des combo et listes dans les écrans de référentiel (refs #7610) Summary of changes: .../ui/content/ref/ContentReferenceUIHandler.java | 57 +++++------ .../ref/ReferentialContentUIInitializer.java | 104 +++++++++++++++++++++ 2 files changed, 129 insertions(+), 32 deletions(-) -- To stop receiving notification emails like this one, please contact codelutin.com SCM administrator <admin+scm@list.forge.codelutin.com>.
This is an automated email from the git hooks/post-receive script. New commit to branch develop in repository observe. See http://git.codelutin.com/observe.git commit a3091b60133dd352d733bcefc996b4ae430350ad Author: Kevin Morin <morin@codelutin.com> Date: Fri Oct 16 16:32:58 2015 +0200 chargement des données des combo et listes dans les écrans de référentiel (refs #7610) --- .../ui/content/ref/ContentReferenceUIHandler.java | 15 +-- .../ref/ReferentialContentUIInitializer.java | 104 +++++++++++++++++++++ 2 files changed, 105 insertions(+), 14 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 a007745..693bc2e 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 @@ -439,7 +439,7 @@ public class ContentReferenceUIHandler<E extends ReferentialDto> extends Content } }); - fillListWithReferentials(); + uiInitializer.referentialDataUpdated(); // UIHelper.getLayer(ui.getEditKeyTable()).setUI(ui.getEditKeyTableLayerUI()); } @@ -871,19 +871,6 @@ public class ContentReferenceUIHandler<E extends ReferentialDto> extends Content ContentReferenceUI.LIST_VIEW; } - protected void fillListWithReferentials() { - ReferenceSetDto referentialReferenceSet = getReferentialService().getReferentialReferenceSet(getBeanType()); - List<ReferenceDto> data = new ArrayList<>(referentialReferenceSet.getReference()); - - Decorator<ReferenceDto> decorator = ObserveSwingApplicationContext.get().getDecorator(ReferenceDto.class, - getBeanType().getSimpleName()); - DecoratorUtil.sort((JXPathDecorator<ReferenceDto>) decorator, data, 0); - - BeanListHeader list = getUi().getListHeader(); - list.setData(data); - list.putClientProperty("data", data); - } - protected ReferentialService getReferentialService() { return ObserveSwingApplicationContext.get().newService(ReferentialService.class); } diff --git a/observe-application-swing/src/main/java/fr/ird/observe/ui/content/ref/ReferentialContentUIInitializer.java b/observe-application-swing/src/main/java/fr/ird/observe/ui/content/ref/ReferentialContentUIInitializer.java index e56f645..a601fbb 100644 --- a/observe-application-swing/src/main/java/fr/ird/observe/ui/content/ref/ReferentialContentUIInitializer.java +++ b/observe-application-swing/src/main/java/fr/ird/observe/ui/content/ref/ReferentialContentUIInitializer.java @@ -22,10 +22,27 @@ package fr.ird.observe.ui.content.ref; * #L% */ +import fr.ird.observe.ObserveSwingApplicationContext; +import fr.ird.observe.services.dto.IdDto; +import fr.ird.observe.services.dto.ReferenceDto; +import fr.ird.observe.services.dto.ReferenceSetDto; import fr.ird.observe.services.dto.referential.ReferentialDto; +import fr.ird.observe.services.service.ReferentialService; import fr.ird.observe.ui.content.ContentUIInitializer; +import fr.ird.observe.ui.content.ObserveContentUI; +import jaxx.runtime.swing.editor.bean.BeanComboBox; +import jaxx.runtime.swing.editor.bean.BeanListHeader; 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.jaxx.widgets.select.FilterableDoubleList; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.LinkedHashSet; +import java.util.List; /** * Created on 11/28/14. @@ -51,4 +68,91 @@ public class ReferentialContentUIInitializer<E extends ReferentialDto, UI extend ui.getEditKeyTableLayerUI().setAcceptedComponentNames(doNotBlockComponentIds); } + + + @Override + protected <E1 extends IdDto> void updateData(BeanComboBox comboBox) { + ObserveSwingApplicationContext context = ObserveSwingApplicationContext.get(); + + // init combobox + Class<? extends ReferentialDto> dtoClass = + (Class<? extends ReferentialDto>) comboBox.getClientProperty(ObserveContentUI.CLIENT_PROPERTY_ENTITY_CLASS); + + Boolean noLoad = (Boolean) comboBox.getClientProperty(ObserveContentUI.CLIENT_PROPERTY_LIST_NO_LOAD); + + List<ReferenceDto> data; + + if (noLoad != null && noLoad) { + + if (log.isInfoEnabled()) { + log.info("Skip loading of entity list [" + dtoClass.getName() + "] (listNoLoad property found)"); + } + data = Collections.emptyList(); + + } else { + + data = new ArrayList<>(); + + // get complete data list from service + ReferentialService service = ObserveSwingApplicationContext.get().newService(ReferentialService.class); + ReferenceSetDto referentialReferenceSet = service.getReferentialReferenceSet(dtoClass); + LinkedHashSet<ReferenceDto> reference = referentialReferenceSet.getReference(); + + data.addAll(reference); + + } + + if (log.isInfoEnabled()) { + log.info("entity list [" + dtoClass.getName() + "] : " + data.size()); + } + + comboBox.setData(data); + } + + @Override + protected <E1 extends IdDto> void updateData(BeanListHeader list) { + + Class<? extends ReferentialDto> dtoClass = + (Class<? extends ReferentialDto>) list.getClientProperty(ObserveContentUI.CLIENT_PROPERTY_ENTITY_CLASS); + + ReferentialService service = ObserveSwingApplicationContext.get().newService(ReferentialService.class); + ReferenceSetDto referentialReferenceSet = service.getReferentialReferenceSet(dtoClass); + + List<ReferenceDto> data = new ArrayList<>(referentialReferenceSet.getReference()); + + Decorator<ReferenceDto> decorator = ObserveSwingApplicationContext.get().getDecorator(ReferenceDto.class, + dtoClass.getSimpleName()); + DecoratorUtil.sort((JXPathDecorator<ReferenceDto>) decorator, data, 0); + + list.setData(data); + list.putClientProperty("data", data); + } + + @Override + protected <E1 extends IdDto> void updateData(FilterableDoubleList list) { + Class<? extends ReferentialDto> dtoClass = + (Class<? extends ReferentialDto>) list.getClientProperty(ObserveContentUI.CLIENT_PROPERTY_ENTITY_CLASS); + List<ReferenceDto> data; + + if (ReferentialDto.class.isAssignableFrom(dtoClass)) { + + ReferentialService service = ObserveSwingApplicationContext.get().newService(ReferentialService.class); + ReferenceSetDto referentialReferenceSet = service.getReferentialReferenceSet(dtoClass); + + data = new ArrayList<>(referentialReferenceSet.getReference()); + + } else { + + data = new ArrayList<>(); + + } + + // sort data from first decorator context + ObserveSwingApplicationContext tx = ObserveSwingApplicationContext.get(); + Decorator<ReferenceDto> decorator = tx.getDecorator(ReferenceDto.class, dtoClass.getSimpleName()); + DecoratorUtil.sort((JXPathDecorator<ReferenceDto>) decorator, data, 0); + + list.setUniverse(data); + list.putClientProperty("data", data); + } } -- To stop receiving notification emails like this one, please contact codelutin.com SCM administrator <admin+scm@list.forge.codelutin.com>.
This is an automated email from the git hooks/post-receive script. New commit to branch develop in repository observe. See http://git.codelutin.com/observe.git commit c9f48c33e6a3160892b0abcb870588da2c1f94ab 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>.
participants (1)
-
codelutin.com scm