r900 - in trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches: . accidental benthos individualobservation marinelitter species
Author: tchemit Date: 2013-04-30 17:59:25 +0200 (Tue, 30 Apr 2013) New Revision: 900 Url: http://forge.codelutin.com/projects/tutti/repository/revisions/900 Log: fixes #2387: [ERGO] Supprimer l'acc?\195?\168s aux pi?\195?\168ces-jointes sur les onglets esp?\195?\168ce - benthos - macro d?\195?\169ch?\195?\169t Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/EditCatchesUI.css trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/EditCatchesUIHandler.java trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/accidental/AccidentalBatchUI.jaxx trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/BenthosBatchUI.css trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/BenthosBatchUI.jaxx trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/BenthosBatchUIHandler.java trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/BenthosBatchUIModel.java trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/individualobservation/IndividualObservationBatchUI.jaxx trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/marinelitter/MarineLitterBatchUI.css trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/marinelitter/MarineLitterBatchUI.jaxx trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/marinelitter/MarineLitterBatchUIHandler.java trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/marinelitter/MarineLitterBatchUIModel.java trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/SpeciesBatchUI.css trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/SpeciesBatchUI.jaxx trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/SpeciesBatchUIHandler.java trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/SpeciesBatchUIModel.java Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/EditCatchesUI.css =================================================================== --- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/EditCatchesUI.css 2013-04-30 15:41:24 UTC (rev 899) +++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/EditCatchesUI.css 2013-04-30 15:59:25 UTC (rev 900) @@ -60,18 +60,6 @@ rightDecoration: {catchesCaracteristicsTabToolBar}; } -#speciesTabFishingOperationReminderLabel { - rightDecoration: {speciesTabContent.getSpeciesBatchTabToolBar()}; -} - -#benthosTabFishingOperationReminderLabel { - rightDecoration: {benthosTabContent.getBenthosBatchTabToolBar()}; -} - -#marineLitterTabFishingOperationReminderLabel { - rightDecoration: {marineLitterTabContent.getMarineLitterBatchTabToolBar()}; -} - #catchTable { border: {BorderFactory.createTitledBorder(_("tutti.editCatchBatch.legend.total"))}; } Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/EditCatchesUIHandler.java =================================================================== --- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/EditCatchesUIHandler.java 2013-04-30 15:41:24 UTC (rev 899) +++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/EditCatchesUIHandler.java 2013-04-30 15:59:25 UTC (rev 900) @@ -183,9 +183,6 @@ @Override protected boolean onTabChanged(int currentIndex, int newIndex) { ui.getCatchesCaracteristicsAttachmentsButton().onCloseUI(); - ui.getSpeciesTabContent().getSpeciesBatchAttachmentsButton().onCloseUI(); - ui.getBenthosTabContent().getBenthosBatchAttachmentsButton().onCloseUI(); - ui.getMarineLitterTabContent().getMarineLitterBatchAttachmentsButton().onCloseUI(); ui.getComputeSpeciesBatchButton().setVisible(newIndex < 4); return super.onTabChanged(currentIndex, newIndex); } @@ -194,9 +191,6 @@ public boolean onHideTab(int currentIndex, int newIndex) { ui.getCatchesCaracteristicsAttachmentsButton().onCloseUI(); - ui.getSpeciesTabContent().getSpeciesBatchAttachmentsButton().onCloseUI(); - ui.getBenthosTabContent().getBenthosBatchAttachmentsButton().onCloseUI(); - ui.getMarineLitterTabContent().getMarineLitterBatchAttachmentsButton().onCloseUI(); //FIXME 20130203 kmorin: cannot change tab if model is modified // (I do not even know why it is set to modified and have no time // before the demo) Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/accidental/AccidentalBatchUI.jaxx =================================================================== --- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/accidental/AccidentalBatchUI.jaxx 2013-04-30 15:41:24 UTC (rev 899) +++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/accidental/AccidentalBatchUI.jaxx 2013-04-30 15:59:25 UTC (rev 900) @@ -29,7 +29,6 @@ fr.ifremer.tutti.ui.swing.TuttiHelpBroker fr.ifremer.tutti.ui.swing.TuttiUIContext fr.ifremer.tutti.ui.swing.util.TuttiUI - fr.ifremer.tutti.ui.swing.util.attachment.ButtonAttachment jaxx.runtime.swing.editor.NumberEditor Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/BenthosBatchUI.css =================================================================== --- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/BenthosBatchUI.css 2013-04-30 15:41:24 UTC (rev 899) +++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/BenthosBatchUI.css 2013-04-30 15:59:25 UTC (rev 900) @@ -46,16 +46,6 @@ _help: {"tutti.editBenthosBatch.help"}; } -#benthosBatchTabToolBar { - floatable: false; - opaque: false; - borderPainted: false; -} - -#benthosBatchAttachmentsButton { - enabled: {model.getObjectId() != null}; -} - #benthosTotalWeightLabel { text: "tutti.editBenthosBatch.field.benthosTotalWeight"; toolTipText: "tutti.editBenthosBatch.field.benthosTotalWeight.tip"; Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/BenthosBatchUI.jaxx =================================================================== --- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/BenthosBatchUI.jaxx 2013-04-30 15:41:24 UTC (rev 899) +++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/BenthosBatchUI.jaxx 2013-04-30 15:59:25 UTC (rev 900) @@ -30,7 +30,6 @@ fr.ifremer.tutti.ui.swing.content.operation.catches.TableViewMode fr.ifremer.tutti.ui.swing.util.TuttiUI - fr.ifremer.tutti.ui.swing.util.attachment.ButtonAttachment fr.ifremer.tutti.ui.swing.util.editor.TuttiComputedOrNotDataEditor org.jdesktop.swingx.JXTable @@ -70,11 +69,6 @@ <TuttiHelpBroker id='broker' constructorParams='"tutti.editBenthosBatch.help"'/> - <JToolBar id='benthosBatchTabToolBar'> - <ButtonAttachment id='benthosBatchAttachmentsButton' - constructorParams='getHandler().getContext(), getModel()'/> - </JToolBar> - <JPopupMenu id='tablePopup'> <JMenuItem id='splitBenthosBatchMenu' onActionPerformed='handler.splitBatch()'/> Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/BenthosBatchUIHandler.java =================================================================== --- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/BenthosBatchUIHandler.java 2013-04-30 15:41:24 UTC (rev 899) +++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/BenthosBatchUIHandler.java 2013-04-30 15:59:25 UTC (rev 900) @@ -35,14 +35,11 @@ import fr.ifremer.tutti.persistence.entities.data.FishingOperation; import fr.ifremer.tutti.persistence.entities.data.SampleCategory; import fr.ifremer.tutti.persistence.entities.data.SampleCategoryEnum; -import fr.ifremer.tutti.persistence.entities.protocol.SpeciesProtocol; -import fr.ifremer.tutti.persistence.entities.protocol.TuttiProtocol; import fr.ifremer.tutti.persistence.entities.protocol.TuttiProtocols; import fr.ifremer.tutti.persistence.entities.referential.CaracteristicQualitativeValue; import fr.ifremer.tutti.persistence.entities.referential.Species; import fr.ifremer.tutti.service.DecoratorService; import fr.ifremer.tutti.service.ValidationService; -import fr.ifremer.tutti.ui.swing.TuttiUIContext; import fr.ifremer.tutti.ui.swing.content.operation.AbstractTuttiBatchTableUIHandler; import fr.ifremer.tutti.ui.swing.content.operation.catches.EditCatchesUI; import fr.ifremer.tutti.ui.swing.content.operation.catches.EditCatchesUIHandler; @@ -57,8 +54,6 @@ import fr.ifremer.tutti.ui.swing.content.operation.catches.benthos.split.SplitBenthosBatchRowModel; import fr.ifremer.tutti.ui.swing.content.operation.catches.benthos.split.SplitBenthosBatchUI; import fr.ifremer.tutti.ui.swing.content.operation.catches.benthos.split.SplitBenthosBatchUIModel; -import fr.ifremer.tutti.ui.swing.content.operation.catches.species.SpeciesBatchRowModel; -import fr.ifremer.tutti.ui.swing.content.operation.catches.species.frequency.SpeciesFrequencyRowModel; import fr.ifremer.tutti.ui.swing.util.TuttiBeanMonitor; import fr.ifremer.tutti.ui.swing.util.TuttiUI; import fr.ifremer.tutti.ui.swing.util.TuttiUIUtil; @@ -221,26 +216,12 @@ } rows = Lists.newArrayList(); - model.removeAllAttachment(model.getAttachment()); - if (!TuttiEntities.isNew(bean)) { // get all batch species root (says the one with only a species sample category) BatchContainer<BenthosBatch> rootBenthosBatch = persistenceService.getRootBenthosBatch(bean.getId()); - model.setRootBatchId(rootBenthosBatch.getIdAsInt()); - - List<Attachment> attachments = - persistenceService.getAllAttachments( - model.getObjectType(), - model.getObjectId()); - model.addAllAttachment(attachments); - - if (log.isInfoEnabled()) { - log.info("species root batch id: " + model.getRootBatchId()); - } - List<BenthosBatch> catches = rootBenthosBatch.getChildren(); for (BenthosBatch aBatch : catches) { @@ -288,9 +269,9 @@ boolean result = !validator.hasErrorMessagess(); if (result - && ValidationService.VALIDATION_CONTEXT_VALIDATE.equals( + && ValidationService.VALIDATION_CONTEXT_VALIDATE.equals( getContext().getValidationContext()) - && row.isBatchLeaf()) { + && row.isBatchLeaf()) { List<BenthosBatchFrequency> frequencies = BenthosFrequencyRowModel.toBeans(row.getFrequency(), batch); result = TuttiProtocols.isBenthosBatchValid(getDataContext().getProtocol(), @@ -695,7 +676,6 @@ if (log.isDebugEnabled()) { log.debug("Closing: " + ui); } - ui.getBenthosBatchAttachmentsButton().onCloseUI(); } //------------------------------------------------------------------------// @@ -1118,7 +1098,7 @@ Float rowWeight = newRow.getFinestCategory().getNotNullWeight(); boolean subSample = rowWeight != null && childrenWeights != null - && childrenWeights < rowWeight; + && childrenWeights < rowWeight; for (BenthosBatchRowModel childRow : batchChilds) { childRow.getFinestCategory().setSubSample(subSample); } Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/BenthosBatchUIModel.java =================================================================== --- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/BenthosBatchUIModel.java 2013-04-30 15:41:24 UTC (rev 899) +++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/BenthosBatchUIModel.java 2013-04-30 15:59:25 UTC (rev 900) @@ -24,10 +24,7 @@ * #L% */ -import com.google.common.collect.Lists; import com.google.common.collect.Multimap; -import fr.ifremer.tutti.persistence.entities.data.AttachementObjectTypeEnum; -import fr.ifremer.tutti.persistence.entities.data.Attachment; import fr.ifremer.tutti.persistence.entities.referential.CaracteristicQualitativeValue; import fr.ifremer.tutti.persistence.entities.referential.Species; import fr.ifremer.tutti.ui.swing.content.operation.AbstractTuttiBatchUIModel; @@ -35,12 +32,8 @@ import fr.ifremer.tutti.ui.swing.content.operation.catches.TableViewMode; import fr.ifremer.tutti.ui.swing.util.TabContentModel; import fr.ifremer.tutti.ui.swing.util.TuttiComputedOrNotData; -import fr.ifremer.tutti.ui.swing.util.attachment.AttachmentModelAware; import org.apache.commons.collections.CollectionUtils; -import java.util.Collection; -import java.util.List; - import static org.nuiton.i18n.I18n.n_; /** @@ -48,7 +41,7 @@ * @since 0.1 */ public class BenthosBatchUIModel extends AbstractTuttiBatchUIModel<BenthosBatchRowModel, BenthosBatchUIModel> - implements AttachmentModelAware, TabContentModel { + implements TabContentModel { private static final long serialVersionUID = 1L; @@ -131,10 +124,6 @@ /** @since 1.0 */ protected int leafNumber; - protected final List<Attachment> attachment = Lists.newArrayList(); - - private Integer rootBatchId; - public BenthosBatchUIModel(EditCatchesUIModel catchesUIModel) { super(catchesUIModel, EditCatchesUIModel.PROPERTY_BENTHOS_TOTAL_COMPUTED_WEIGHT, @@ -150,8 +139,7 @@ return CollectionUtils.isEmpty(getRows()) && getBenthosTotalSortedWeight() == null && getBenthosTotalInertWeight() == null - && getBenthosTotalLivingNotItemizedWeight() == null - && CollectionUtils.isEmpty(getAttachment()); + && getBenthosTotalLivingNotItemizedWeight() == null; } @Override @@ -357,57 +345,4 @@ firePropertyChange(PROPERTY_CREATE_MELAG_ENABLED, oldValue, createMelagEnabled); } - public void setRootBatchId(Integer rootBatchId) { - Integer oldValue = getObjectId(); - this.rootBatchId = rootBatchId; - firePropertyChange(PROPERTY_OBJECT_ID, oldValue, getObjectId()); - } - - public Integer getRootBatchId() { - return rootBatchId; - } - - //------------------------------------------------------------------------// - //-- AttachmentModelAware --// - //------------------------------------------------------------------------// - - @Override - public AttachementObjectTypeEnum getObjectType() { - return AttachementObjectTypeEnum.BATCH; - } - - @Override - public Integer getObjectId() { - return rootBatchId; - } - - @Override - public List<Attachment> getAttachment() { - return attachment; - } - - @Override - public void addAllAttachment(Collection<Attachment> attachments) { - this.attachment.addAll(attachments); - firePropertyChange(PROPERTY_ATTACHMENT, null, getAttachment()); - } - - @Override - public void addAttachment(Attachment attachment) { - this.attachment.add(attachment); - firePropertyChange(PROPERTY_ATTACHMENT, null, getAttachment()); - } - - @Override - public void removeAllAttachment(Collection<Attachment> attachments) { - this.attachment.removeAll(attachments); - firePropertyChange(PROPERTY_ATTACHMENT, null, getAttachment()); - } - - @Override - public void removeAttachment(Attachment attachment) { - this.attachment.remove(attachment); - firePropertyChange(PROPERTY_ATTACHMENT, null, getAttachment()); - } - } Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/individualobservation/IndividualObservationBatchUI.jaxx =================================================================== --- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/individualobservation/IndividualObservationBatchUI.jaxx 2013-04-30 15:41:24 UTC (rev 899) +++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/individualobservation/IndividualObservationBatchUI.jaxx 2013-04-30 15:59:25 UTC (rev 900) @@ -29,7 +29,6 @@ fr.ifremer.tutti.ui.swing.TuttiHelpBroker fr.ifremer.tutti.ui.swing.TuttiUIContext fr.ifremer.tutti.ui.swing.util.TuttiUI - fr.ifremer.tutti.ui.swing.util.attachment.ButtonAttachment jaxx.runtime.swing.editor.NumberEditor Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/marinelitter/MarineLitterBatchUI.css =================================================================== --- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/marinelitter/MarineLitterBatchUI.css 2013-04-30 15:41:24 UTC (rev 899) +++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/marinelitter/MarineLitterBatchUI.css 2013-04-30 15:59:25 UTC (rev 900) @@ -36,16 +36,6 @@ _help: {"tutti.editMarineLitterBatch.help"}; } -#marineLitterBatchTabToolBar { - floatable: false; - opaque: false; - borderPainted: false; -} - -#marineLitterBatchAttachmentsButton { - enabled: {model.getObjectId() != null}; -} - #marineLitterTotalWeightLabel { text: "tutti.editMarineLitterBatch.field.marineLitterTotalWeight"; toolTipText: "tutti.editMarineLitterBatch.field.marineLitterTotalWeight.tip"; Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/marinelitter/MarineLitterBatchUI.jaxx =================================================================== --- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/marinelitter/MarineLitterBatchUI.jaxx 2013-04-30 15:41:24 UTC (rev 899) +++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/marinelitter/MarineLitterBatchUI.jaxx 2013-04-30 15:59:25 UTC (rev 900) @@ -29,7 +29,6 @@ fr.ifremer.tutti.ui.swing.TuttiHelpBroker fr.ifremer.tutti.ui.swing.TuttiUIContext fr.ifremer.tutti.ui.swing.util.TuttiUI - fr.ifremer.tutti.ui.swing.util.attachment.ButtonAttachment fr.ifremer.tutti.ui.swing.util.editor.TuttiComputedOrNotDataEditor org.jdesktop.swingx.JXTable @@ -68,11 +67,6 @@ <TuttiHelpBroker id='broker' constructorParams='"tutti.editMarineLitterBatch.help"'/> - <JToolBar id='marineLitterBatchTabToolBar'> - <ButtonAttachment id='marineLitterBatchAttachmentsButton' - constructorParams='getHandler().getContext(), getModel()'/> - </JToolBar> - <JPopupMenu id='tablePopup'> <JMenuItem id='removeMarineLitterBatchMenu'/> </JPopupMenu> Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/marinelitter/MarineLitterBatchUIHandler.java =================================================================== --- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/marinelitter/MarineLitterBatchUIHandler.java 2013-04-30 15:41:24 UTC (rev 899) +++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/marinelitter/MarineLitterBatchUIHandler.java 2013-04-30 15:59:25 UTC (rev 900) @@ -116,18 +116,6 @@ BatchContainer<MarineLitterBatch> batchContainer = persistenceService.getRootMarineLitterBatch(bean.getId()); - model.setRootBatchId(batchContainer.getIdAsInt()); - - List<Attachment> attachments = - persistenceService.getAllAttachments( - model.getObjectType(), - model.getObjectId()); - model.addAllAttachment(attachments); - - if (log.isInfoEnabled()) { - log.info("marineLitter root batch id: " + model.getRootBatchId()); - } - for (MarineLitterBatch aBatch : batchContainer.getChildren()) { MarineLitterBatchRowModel entry = loadBatch(aBatch); rows.add(entry); @@ -389,7 +377,6 @@ if (log.isDebugEnabled()) { log.debug("closing: " + ui); } - ui.getMarineLitterBatchAttachmentsButton().onCloseUI(); } //------------------------------------------------------------------------// Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/marinelitter/MarineLitterBatchUIModel.java =================================================================== --- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/marinelitter/MarineLitterBatchUIModel.java 2013-04-30 15:41:24 UTC (rev 899) +++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/marinelitter/MarineLitterBatchUIModel.java 2013-04-30 15:59:25 UTC (rev 900) @@ -24,21 +24,14 @@ * #L% */ -import com.google.common.collect.Lists; import com.google.common.collect.Multimap; -import fr.ifremer.tutti.persistence.entities.data.AttachementObjectTypeEnum; -import fr.ifremer.tutti.persistence.entities.data.Attachment; import fr.ifremer.tutti.persistence.entities.referential.CaracteristicQualitativeValue; import fr.ifremer.tutti.ui.swing.content.operation.AbstractTuttiBatchUIModel; import fr.ifremer.tutti.ui.swing.content.operation.catches.EditCatchesUIModel; import fr.ifremer.tutti.ui.swing.util.TabContentModel; import fr.ifremer.tutti.ui.swing.util.TuttiComputedOrNotData; -import fr.ifremer.tutti.ui.swing.util.attachment.AttachmentModelAware; import org.apache.commons.collections.CollectionUtils; -import java.util.Collection; -import java.util.List; - import static org.nuiton.i18n.I18n.n_; /** @@ -46,14 +39,12 @@ * @since 0.2 */ public class MarineLitterBatchUIModel extends AbstractTuttiBatchUIModel<MarineLitterBatchRowModel, MarineLitterBatchUIModel> - implements AttachmentModelAware, TabContentModel { + implements TabContentModel { private static final long serialVersionUID = 1L; public static final String PROPERTY_REMOVE_BATCH_ENABLED = "removeBatchEnabled"; - protected final List<Attachment> attachment = Lists.newArrayList(); - /** * Can user remove a selected marineLitter batch? * @@ -61,8 +52,6 @@ */ protected boolean removeBatchEnabled; - private Integer rootBatchId; - public MarineLitterBatchUIModel(EditCatchesUIModel catchesUIModel) { super(catchesUIModel, EditCatchesUIModel.PROPERTY_MARINE_LITTER_TOTAL_WEIGHT); @@ -98,71 +87,17 @@ firePropertyChange(PROPERTY_REMOVE_BATCH_ENABLED, oldValue, removeBatchEnabled); } - public void setRootBatchId(Integer rootBatchId) { - Integer oldValue = getObjectId(); - this.rootBatchId = rootBatchId; - firePropertyChange(PROPERTY_OBJECT_ID, oldValue, getObjectId()); - } - - public Integer getRootBatchId() { - return rootBatchId; - } - public Multimap<CaracteristicQualitativeValue, CaracteristicQualitativeValue> getMarineLitterCategoriesUsed() { return catchesUIModel.getMarineLitterCategoriesUsed(); } //------------------------------------------------------------------------// - //-- AttachmentModelAware --// - //------------------------------------------------------------------------// - - @Override - public AttachementObjectTypeEnum getObjectType() { - return AttachementObjectTypeEnum.BATCH; - } - - @Override - public Integer getObjectId() { - return rootBatchId; - } - - @Override - public List<Attachment> getAttachment() { - return attachment; - } - - @Override - public void addAllAttachment(Collection<Attachment> attachments) { - this.attachment.addAll(attachments); - firePropertyChange(PROPERTY_ATTACHMENT, null, getAttachment()); - } - - @Override - public void addAttachment(Attachment attachment) { - this.attachment.add(attachment); - firePropertyChange(PROPERTY_ATTACHMENT, null, getAttachment()); - } - - @Override - public void removeAllAttachment(Collection<Attachment> attachments) { - this.attachment.removeAll(attachments); - firePropertyChange(PROPERTY_ATTACHMENT, null, getAttachment()); - } - - @Override - public void removeAttachment(Attachment attachment) { - this.attachment.remove(attachment); - firePropertyChange(PROPERTY_ATTACHMENT, null, getAttachment()); - } - - //------------------------------------------------------------------------// //-- TabContentModel --// //------------------------------------------------------------------------// @Override public boolean isEmpty() { - boolean result = getMarineLitterTotalWeight() == null - && CollectionUtils.isEmpty(getAttachment()); + boolean result = getMarineLitterTotalWeight() == null; if (result && CollectionUtils.isNotEmpty(getRows())) { // check if every line is not valid Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/SpeciesBatchUI.css =================================================================== --- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/SpeciesBatchUI.css 2013-04-30 15:41:24 UTC (rev 899) +++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/SpeciesBatchUI.css 2013-04-30 15:59:25 UTC (rev 900) @@ -46,16 +46,6 @@ _help: {"tutti.editSpeciesBatch.help"}; } -#speciesBatchTabToolBar { - floatable: false; - opaque: false; - borderPainted: false; -} - -#speciesBatchAttachmentsButton { - enabled: {model.getObjectId() != null}; -} - #speciesTotalWeightLabel { text: "tutti.editSpeciesBatch.field.speciesTotalWeight"; toolTipText: "tutti.editSpeciesBatch.field.speciesTotalWeight.tip"; Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/SpeciesBatchUI.jaxx =================================================================== --- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/SpeciesBatchUI.jaxx 2013-04-30 15:41:24 UTC (rev 899) +++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/SpeciesBatchUI.jaxx 2013-04-30 15:59:25 UTC (rev 900) @@ -29,7 +29,6 @@ fr.ifremer.tutti.ui.swing.TuttiHelpBroker fr.ifremer.tutti.ui.swing.content.operation.catches.TableViewMode fr.ifremer.tutti.ui.swing.util.TuttiUI - fr.ifremer.tutti.ui.swing.util.attachment.ButtonAttachment fr.ifremer.tutti.ui.swing.util.editor.TuttiComputedOrNotDataEditor org.jdesktop.swingx.JXTable @@ -69,11 +68,6 @@ <TuttiHelpBroker id='broker' constructorParams='"tutti.editSpeciesBatch.help"'/> - <JToolBar id='speciesBatchTabToolBar'> - <ButtonAttachment id='speciesBatchAttachmentsButton' - constructorParams='getHandler().getContext(), getModel()'/> - </JToolBar> - <JPopupMenu id='tablePopup'> <JMenuItem id='splitSpeciesBatchMenu' onActionPerformed='handler.splitBatch()'/> Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/SpeciesBatchUIHandler.java =================================================================== --- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/SpeciesBatchUIHandler.java 2013-04-30 15:41:24 UTC (rev 899) +++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/SpeciesBatchUIHandler.java 2013-04-30 15:59:25 UTC (rev 900) @@ -35,14 +35,11 @@ import fr.ifremer.tutti.persistence.entities.data.SampleCategoryEnum; import fr.ifremer.tutti.persistence.entities.data.SpeciesBatch; import fr.ifremer.tutti.persistence.entities.data.SpeciesBatchFrequency; -import fr.ifremer.tutti.persistence.entities.protocol.SpeciesProtocol; -import fr.ifremer.tutti.persistence.entities.protocol.TuttiProtocol; import fr.ifremer.tutti.persistence.entities.protocol.TuttiProtocols; import fr.ifremer.tutti.persistence.entities.referential.CaracteristicQualitativeValue; import fr.ifremer.tutti.persistence.entities.referential.Species; import fr.ifremer.tutti.service.DecoratorService; import fr.ifremer.tutti.service.ValidationService; -import fr.ifremer.tutti.ui.swing.TuttiUIContext; import fr.ifremer.tutti.ui.swing.content.operation.AbstractTuttiBatchTableUIHandler; import fr.ifremer.tutti.ui.swing.content.operation.catches.EditCatchesUI; import fr.ifremer.tutti.ui.swing.content.operation.catches.EditCatchesUIHandler; @@ -71,7 +68,6 @@ import jaxx.runtime.SwingUtil; import jaxx.runtime.validator.swing.SwingValidator; import org.apache.commons.collections.CollectionUtils; -import org.apache.commons.collections.ListUtils; import org.apache.commons.lang3.StringUtils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; @@ -219,25 +215,12 @@ } rows = Lists.newArrayList(); - model.removeAllAttachment(model.getAttachment()); - if (!TuttiEntities.isNew(bean)) { // get all batch species root (says the one with only a species sample category) BatchContainer<SpeciesBatch> rootSpeciesBatch = persistenceService.getRootSpeciesBatch(bean.getId()); - model.setRootBatchId(rootSpeciesBatch.getIdAsInt()); - - List<Attachment> attachments = - persistenceService.getAllAttachments(model.getObjectType(), - model.getObjectId()); - model.addAllAttachment(attachments); - - if (log.isInfoEnabled()) { - log.info("species root batch id: " + model.getRootBatchId()); - } - List<SpeciesBatch> catches = rootSpeciesBatch.getChildren(); for (SpeciesBatch aBatch : catches) { @@ -285,9 +268,9 @@ boolean result = !validator.hasErrorMessagess(); if (result - && ValidationService.VALIDATION_CONTEXT_VALIDATE.equals( - getContext().getValidationContext()) - && row.isBatchLeaf()) { + && ValidationService.VALIDATION_CONTEXT_VALIDATE.equals( + getContext().getValidationContext()) + && row.isBatchLeaf()) { List<SpeciesBatchFrequency> frequencies = SpeciesFrequencyRowModel.toBeans(row.getFrequency(), batch); @@ -695,7 +678,6 @@ if (log.isDebugEnabled()) { log.debug("Closing: " + ui); } - ui.getSpeciesBatchAttachmentsButton().onCloseUI(); } //------------------------------------------------------------------------// Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/SpeciesBatchUIModel.java =================================================================== --- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/SpeciesBatchUIModel.java 2013-04-30 15:41:24 UTC (rev 899) +++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/SpeciesBatchUIModel.java 2013-04-30 15:59:25 UTC (rev 900) @@ -24,10 +24,7 @@ * #L% */ -import com.google.common.collect.Lists; import com.google.common.collect.Multimap; -import fr.ifremer.tutti.persistence.entities.data.AttachementObjectTypeEnum; -import fr.ifremer.tutti.persistence.entities.data.Attachment; import fr.ifremer.tutti.persistence.entities.referential.CaracteristicQualitativeValue; import fr.ifremer.tutti.persistence.entities.referential.Species; import fr.ifremer.tutti.ui.swing.content.operation.AbstractTuttiBatchUIModel; @@ -35,12 +32,8 @@ import fr.ifremer.tutti.ui.swing.content.operation.catches.TableViewMode; import fr.ifremer.tutti.ui.swing.util.TabContentModel; import fr.ifremer.tutti.ui.swing.util.TuttiComputedOrNotData; -import fr.ifremer.tutti.ui.swing.util.attachment.AttachmentModelAware; import org.apache.commons.collections.CollectionUtils; -import java.util.Collection; -import java.util.List; - import static org.nuiton.i18n.I18n.n_; /** @@ -48,7 +41,7 @@ * @since 0.1 */ public class SpeciesBatchUIModel extends AbstractTuttiBatchUIModel<SpeciesBatchRowModel, SpeciesBatchUIModel> - implements AttachmentModelAware, TabContentModel { + implements TabContentModel { private static final long serialVersionUID = 1L; @@ -131,10 +124,6 @@ /** @since 1.0 */ protected int leafNumber; - protected final List<Attachment> attachment = Lists.newArrayList(); - - private Integer rootBatchId; - public SpeciesBatchUIModel(EditCatchesUIModel catchesUIModel) { super(catchesUIModel, EditCatchesUIModel.PROPERTY_SPECIES_TOTAL_COMPUTED_WEIGHT, @@ -338,60 +327,7 @@ firePropertyChange(PROPERTY_CREATE_MELAG_ENABLED, oldValue, createMelagEnabled); } - public void setRootBatchId(Integer rootBatchId) { - Integer oldValue = getObjectId(); - this.rootBatchId = rootBatchId; - firePropertyChange(PROPERTY_OBJECT_ID, oldValue, getObjectId()); - } - - public Integer getRootBatchId() { - return rootBatchId; - } - //------------------------------------------------------------------------// - //-- AttachmentModelAware --// - //------------------------------------------------------------------------// - - @Override - public AttachementObjectTypeEnum getObjectType() { - return AttachementObjectTypeEnum.BATCH; - } - - @Override - public Integer getObjectId() { - return rootBatchId; - } - - @Override - public List<Attachment> getAttachment() { - return attachment; - } - - @Override - public void addAllAttachment(Collection<Attachment> attachments) { - this.attachment.addAll(attachments); - firePropertyChange(PROPERTY_ATTACHMENT, null, getAttachment()); - } - - @Override - public void addAttachment(Attachment attachment) { - this.attachment.add(attachment); - firePropertyChange(PROPERTY_ATTACHMENT, null, getAttachment()); - } - - @Override - public void removeAllAttachment(Collection<Attachment> attachments) { - this.attachment.removeAll(attachments); - firePropertyChange(PROPERTY_ATTACHMENT, null, getAttachment()); - } - - @Override - public void removeAttachment(Attachment attachment) { - this.attachment.remove(attachment); - firePropertyChange(PROPERTY_ATTACHMENT, null, getAttachment()); - } - - //------------------------------------------------------------------------// //-- TabContentModel --// //------------------------------------------------------------------------// @@ -400,8 +336,7 @@ return CollectionUtils.isEmpty(getRows()) && getSpeciesTotalSortedWeight() == null && getSpeciesTotalInertWeight() == null - && getSpeciesTotalLivingNotItemizedWeight() == null - && CollectionUtils.isEmpty(getAttachment()); + && getSpeciesTotalLivingNotItemizedWeight() == null; } @Override
participants (1)
-
tchemit@users.forge.codelutin.com