branch develop updated (ebfdb777 -> 91af1eed)
This is an automated email from the git hooks/post-receive script. New change to branch develop in repository faxtomail. See https://gitlab.nuiton.org/codelutin/faxtomail.git from ebfdb777 fixes #9321 mauvaise suppression d'un validateur new 91af1eed Correction de fuite mémoire à l'ouverture des demandes The 1 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 91af1eeda4e1fd1d764958b8a7f77cb67bd0e24a Author: Sylvain Bavencoff <bavencoff@codelutin.com> Date: Wed Nov 15 16:59:33 2017 +0100 Correction de fuite mémoire à l'ouverture des demandes Summary of changes: .../faxtomail/ui/swing/FaxToMailUIContext.java | 4 + .../ui/swing/actions/ShowDemandeAction.java | 4 +- .../ui/swing/content/demande/DemandeUIHandler.java | 98 +++++++++++----------- .../ui/swing/content/demande/DemandesUI.jaxx | 3 +- .../swing/content/demande/DemandesUIHandler.java | 28 +------ .../demande/demandgroup/DemandGroupUIHandler.java | 1 + .../util/FaxToMailValidatorMessageWidget.java | 18 ++++ .../util/toolbar/AbstractToolbarPopupButton.java | 50 ++++++----- 8 files changed, 108 insertions(+), 98 deletions(-) create mode 100644 faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/FaxToMailValidatorMessageWidget.java -- To stop receiving notification emails like this one, please contact codelutin.com SCM administrator <admin+scm@codelutin.com>.
This is an automated email from the git hooks/post-receive script. New commit to branch develop in repository faxtomail. See https://gitlab.nuiton.org/codelutin/faxtomail.git commit 91af1eeda4e1fd1d764958b8a7f77cb67bd0e24a Author: Sylvain Bavencoff <bavencoff@codelutin.com> Date: Wed Nov 15 16:59:33 2017 +0100 Correction de fuite mémoire à l'ouverture des demandes --- .../faxtomail/ui/swing/FaxToMailUIContext.java | 4 + .../ui/swing/actions/ShowDemandeAction.java | 4 +- .../ui/swing/content/demande/DemandeUIHandler.java | 98 +++++++++++----------- .../ui/swing/content/demande/DemandesUI.jaxx | 3 +- .../swing/content/demande/DemandesUIHandler.java | 28 +------ .../demande/demandgroup/DemandGroupUIHandler.java | 1 + .../util/FaxToMailValidatorMessageWidget.java | 18 ++++ .../util/toolbar/AbstractToolbarPopupButton.java | 50 ++++++----- 8 files changed, 108 insertions(+), 98 deletions(-) diff --git a/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/FaxToMailUIContext.java b/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/FaxToMailUIContext.java index cc0b16d4..8b4ccb28 100644 --- a/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/FaxToMailUIContext.java +++ b/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/FaxToMailUIContext.java @@ -900,4 +900,8 @@ public class FaxToMailUIContext extends AbstractBean implements Closeable, UIMes public void setFrameForDemande(DemandeUIModel demande, JFrame frame) { demandesFrames.put(demande, frame); } + + public void removeDemande(DemandeUIModel demande) { + demandesFrames.remove(demande); + } } diff --git a/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/ShowDemandeAction.java b/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/ShowDemandeAction.java index d6721380..ddae61d5 100644 --- a/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/ShowDemandeAction.java +++ b/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/ShowDemandeAction.java @@ -237,10 +237,10 @@ public class ShowDemandeAction extends AbstractMainUIFaxToMailAction { @Override public void windowClosed(WindowEvent e) { DemandeUIModel currentEmail = getContext().getCurrentEmail(); - getContext().setFrameForDemande(currentEmail, null); + getContext().removeDemande(currentEmail); for (DemandeUIModel demande : currentEmail.getGroupedDemandes()) { - getContext().setFrameForDemande(demande, null); + getContext().removeDemande(demande); } } }); diff --git a/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeUIHandler.java b/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeUIHandler.java index 260698e4..e888362c 100644 --- a/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeUIHandler.java +++ b/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeUIHandler.java @@ -163,6 +163,54 @@ public class DemandeUIHandler extends AbstractFaxToMailUIHandler<DemandeUIModel, } }; + protected AttachmentListener attachmentListener = new AttachmentListener() { + + @Override + public void onAttachmentOpened(Attachment attachment, boolean original) { + String topiaId = getModel().getTopiaId(); + if (topiaId != null && attachment.isPersisted()) { + String filename; + if (original) { + filename = attachment.getOriginalFileName(); + } else { + filename = FaxToMailUIUtil.getEditedFileName(attachment.getOriginalFileName()); + } + FaxToMailServiceContext serviceContext = getContext().newServiceContext(); + Email email = serviceContext.getEmailService().addToHistory(topiaId, + HistoryType.ATTACHMENT_OPENING, + getContext().getCurrentUser(), + new Date(), + filename); + getModel().setHistory(email.getHistory()); + } + } + + @Override + public void onAttachmentEdited(Attachment attachment) { + String topiaId = getModel().getTopiaId(); + if (topiaId != null && attachment.isPersisted()) { + //TODO create a history manually and add it to the email, but do not save it +// FaxToMailServiceContext serviceContext = getContext().newServiceContext(); +// Email email = serviceContext.getEmailService().addToHistory(topiaId, +// HistoryType.ATTACHMENT_MODIFICATION, +// getContext().getCurrentUser(), +// new Date(), +// FaxToMailUIUtil.getEditedFileName(attachment.getOriginalFileName())); +// getModel().setHistory(email.getHistory()); + + History history = new HistoryImpl(); + history.setType(HistoryType.ATTACHMENT_MODIFICATION); + history.setFaxToMailUser(getContext().getCurrentUser()); + history.setModificationDate(new Date()); + history.setFields(Sets.newHashSet(attachment.getOriginalFileName())); + getModel().getHistory().add(history); + } + getModel().setModify(true); + } + + }; + + @Override public void afterInit(DemandeUI ui) { @@ -350,54 +398,7 @@ public class DemandeUIHandler extends AbstractFaxToMailUIHandler<DemandeUIModel, // if new fishingOperation can already cancel his creation model.setModify(false); - ui.getAttachmentsButton().getBean().addAttachmentListener( - new AttachmentListener() { - - @Override - public void onAttachmentOpened(Attachment attachment, boolean original) { - String topiaId = getModel().getTopiaId(); - if (topiaId != null && attachment.isPersisted()) { - String filename; - if (original) { - filename = attachment.getOriginalFileName(); - } else { - filename = FaxToMailUIUtil.getEditedFileName(attachment.getOriginalFileName()); - } - FaxToMailServiceContext serviceContext = getContext().newServiceContext(); - Email email = serviceContext.getEmailService().addToHistory(topiaId, - HistoryType.ATTACHMENT_OPENING, - getContext().getCurrentUser(), - new Date(), - filename); - getModel().setHistory(email.getHistory()); - } - } - - @Override - public void onAttachmentEdited(Attachment attachment) { - String topiaId = getModel().getTopiaId(); - if (topiaId != null && attachment.isPersisted()) { - //TODO create a history manually and add it to the email, but do not save it -// FaxToMailServiceContext serviceContext = getContext().newServiceContext(); -// Email email = serviceContext.getEmailService().addToHistory(topiaId, -// HistoryType.ATTACHMENT_MODIFICATION, -// getContext().getCurrentUser(), -// new Date(), -// FaxToMailUIUtil.getEditedFileName(attachment.getOriginalFileName())); -// getModel().setHistory(email.getHistory()); - - History history = new HistoryImpl(); - history.setType(HistoryType.ATTACHMENT_MODIFICATION); - history.setFaxToMailUser(getContext().getCurrentUser()); - history.setModificationDate(new Date()); - history.setFields(Sets.newHashSet(attachment.getOriginalFileName())); - getModel().getHistory().add(history); - } - getModel().setModify(true); - } - - } - ); + ui.getAttachmentsButton().getBean().addAttachmentListener(attachmentListener); JSplitPane leftVerticalSplitPanel = getUI().getLeftVerticalSplitPanel(); @@ -470,6 +471,7 @@ public class DemandeUIHandler extends AbstractFaxToMailUIHandler<DemandeUIModel, ui.getAttachmentsButton().onCloseUI(); ui.getHistoryButton().onCloseUI(); + ui.getAttachmentsButton().getBean().removeAttachmentListener(attachmentListener); ui.getDemandRepliesButton().onCloseUI(); clearValidators(); diff --git a/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandesUI.jaxx b/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandesUI.jaxx index d67eff1f..8eb909fa 100644 --- a/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandesUI.jaxx +++ b/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandesUI.jaxx @@ -29,6 +29,7 @@ com.franciaflex.faxtomail.ui.swing.FaxToMailUIContext com.franciaflex.faxtomail.ui.swing.util.FaxToMailUI com.franciaflex.faxtomail.ui.swing.util.FaxToMailUIUtil + com.franciaflex.faxtomail.ui.swing.util.FaxToMailValidatorMessageWidget com.franciaflex.faxtomail.ui.swing.content.demande.demandgroup.ButtonEmailGroup com.franciaflex.faxtomail.ui.swing.content.demande.demandgroup.DemandGroupHighlightDialog @@ -100,7 +101,7 @@ <JToolBar id='bottomToolBar' layout="{ new FlowLayout(FlowLayout.TRAILING, 0, 0) }" constraints='BorderLayout.SOUTH'> - <SwingValidatorMessageWidget id='validatorMessageWidget'/> + <FaxToMailValidatorMessageWidget id='validatorMessageWidget'/> </JToolBar> <DemandGroupHighlightDialog id="demandGroupHighlightDialog" constructorParams="getHandler().getContext(), demandGroupButton"/> diff --git a/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandesUIHandler.java b/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandesUIHandler.java index 7b037a8e..12f62699 100644 --- a/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandesUIHandler.java +++ b/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandesUIHandler.java @@ -112,32 +112,6 @@ public class DemandesUIHandler extends AbstractFaxToMailUIHandler<DemandesUIMode DemandesUIModel model = getModel(); // setCustomTab(0, getModel().getDemands().get(0)); - final PropertyChangeListener demandEnabledAndValidListener = new PropertyChangeListener() { - @Override - public void propertyChange(PropertyChangeEvent evt) { - - if (evt.getPropertyName().equals(DemandeUIModel.PROPERTY_VALID) - || evt.getPropertyName().equals(DemandeUIModel.PROPERTY_EDITABLE) - || evt.getPropertyName().equals(Email.PROPERTY_ARCHIVE_DATE)) { - - DemandesUI ui = getUI(); - ui.processDataBinding(DemandesUI.BINDING_ARCHIVE_BUTTON_ENABLED); - ui.processDataBinding(DemandesUI.BINDING_GROUP_BUTTON_ENABLED); - ui.processDataBinding(DemandesUI.BINDING_REPLY_BUTTON_ENABLED); - ui.processDataBinding(DemandesUI.BINDING_SAVE_BUTTON_ENABLED); - ui.processDataBinding(DemandesUI.BINDING_TRANSMIT_BUTTON_ENABLED); - - } - - if (evt.getPropertyName().equals(DemandeUIModel.PROPERTY_VALID) - || evt.getPropertyName().equals(DemandeUIModel.PROPERTY_EDITABLE) - || evt.getPropertyName().equals(Email.PROPERTY_WAITING_STATE)) { - - updateButtonEnability(); - } - } - }; - model.addDemandsListener(new DemandsListener() { @Override public void onDemandAdded(DemandeUIModel demand, int index, boolean added) { @@ -219,6 +193,8 @@ public class DemandesUIHandler extends AbstractFaxToMailUIHandler<DemandesUIMode DemandeUIHandler tabHandler = (DemandeUIHandler) getTabHandler(i++); quit = tabHandler.quitUI(); } + ui.getDemandGroupHighlightDialog().dispose(); + ui.getValidatorMessageWidget().quitUI(); return quit; } diff --git a/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/demandgroup/DemandGroupUIHandler.java b/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/demandgroup/DemandGroupUIHandler.java index 356f8e1f..f9622964 100644 --- a/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/demandgroup/DemandGroupUIHandler.java +++ b/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/demandgroup/DemandGroupUIHandler.java @@ -122,6 +122,7 @@ public class DemandGroupUIHandler extends AbstractToolbarPopupHandler<DemandeUIM @Override public void onCloseUI() { getModel().removePropertyChangeListener(DemandeUIModel.PROPERTY_GROUPED_DEMANDES, groupedDemandListener); + ui.dispose(); } @Override diff --git a/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/FaxToMailValidatorMessageWidget.java b/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/FaxToMailValidatorMessageWidget.java new file mode 100644 index 00000000..107f4fee --- /dev/null +++ b/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/FaxToMailValidatorMessageWidget.java @@ -0,0 +1,18 @@ +package com.franciaflex.faxtomail.ui.swing.util; + +import jaxx.runtime.validator.swing.SwingValidatorMessageWidget; +import org.nuiton.jaxx.application.swing.util.CloseableUI; + +/** + * @author Sylvain Bavencoff - bavencoff@codelutin.com + */ +public class FaxToMailValidatorMessageWidget extends SwingValidatorMessageWidget implements CloseableUI { + + private static final long serialVersionUID = 5769683678417660752L; + + @Override + public boolean quitUI() { + popup.dispose(); + return true; + } +} diff --git a/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/toolbar/AbstractToolbarPopupButton.java b/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/toolbar/AbstractToolbarPopupButton.java index 9cb02168..61b4d185 100644 --- a/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/toolbar/AbstractToolbarPopupButton.java +++ b/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/toolbar/AbstractToolbarPopupButton.java @@ -24,20 +24,23 @@ package com.franciaflex.faxtomail.ui.swing.util.toolbar; * #L% */ -import com.franciaflex.faxtomail.ui.swing.util.toolbar.AbstractToolbarPopupUI; import jaxx.runtime.SwingUtil; import jaxx.runtime.swing.JAXXWidgetUtil; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; -import javax.swing.*; +import javax.swing.ImageIcon; +import javax.swing.JFrame; +import javax.swing.JToggleButton; import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeListener; -import java.awt.*; +import java.awt.Point; +import java.awt.Window; import java.awt.event.HierarchyBoundsAdapter; import java.awt.event.HierarchyEvent; import java.awt.event.WindowAdapter; import java.awt.event.WindowEvent; +import java.awt.event.WindowListener; /** * @author Kevin Morin (Code Lutin) @@ -50,6 +53,26 @@ public abstract class AbstractToolbarPopupButton<UI extends AbstractToolbarPopup protected final UI popup; + protected final WindowListener windowListener = new WindowAdapter() { + + @Override + public void windowOpened(WindowEvent e) { + setSelected(true); + } + + @Override + public void windowClosing(WindowEvent e) { + setSelected(false); + } + + @Override + public void windowClosed(WindowEvent e) { + setSelected(false); + } + + }; + + protected boolean popupMoving; public AbstractToolbarPopupButton() { @@ -60,24 +83,7 @@ public abstract class AbstractToolbarPopupButton<UI extends AbstractToolbarPopup popup = createNewPopup(); - popup.addWindowListener(new WindowAdapter() { - - @Override - public void windowOpened(WindowEvent e) { - setSelected(true); - } - - @Override - public void windowClosing(WindowEvent e) { - setSelected(false); - } - - @Override - public void windowClosed(WindowEvent e) { - setSelected(false); - } - - }); + popup.addWindowListener(windowListener); addChangeListener(new ChangeListener() { @@ -161,6 +167,8 @@ public abstract class AbstractToolbarPopupButton<UI extends AbstractToolbarPopup protected abstract UI createNewPopup(); public void onCloseUI() { + popup.removeWindowListener(windowListener); + popup.dispose(); setSelected(false); } } -- To stop receiving notification emails like this one, please contact codelutin.com SCM administrator <admin+scm@codelutin.com>.
participants (1)
-
codelutin.com scm