r524 - in trunk/faxtomail-ui-swing/src/main: java/com/franciaflex/faxtomail/ui/swing/actions java/com/franciaflex/faxtomail/ui/swing/content/demande java/com/franciaflex/faxtomail/ui/swing/content/reply java/com/franciaflex/faxtomail/ui/swing/util resources/com/franciaflex/faxtomail/ui/swing/content/reply resources/i18n
Author: kmorin Date: 2014-08-12 16:00:32 +0200 (Tue, 12 Aug 2014) New Revision: 524 Url: http://forge.codelutin.com/projects/faxtomail/repository/revisions/524 Log: fixes #5534 lorsqu'on a modifi?\195?\169 un document attach?\195?\169, et qu'on quitte, on ne demande pas de confirmation alors qu'il y a eu des modifications on ne prend pas quand on groupe correction de la validation de l'adresse exp?\195?\169diteur de la r?\195?\169ponse Modified: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/GroupAction.java trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandesUIHandler.java trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/reply/ReplyFormUIModel.java trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/AbstractFaxToMailUIHandler.java trunk/faxtomail-ui-swing/src/main/resources/com/franciaflex/faxtomail/ui/swing/content/reply/ReplyFormUIModel-error-validation.xml trunk/faxtomail-ui-swing/src/main/resources/i18n/faxtomail-ui-swing_fr_FR.properties Modified: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/GroupAction.java =================================================================== --- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/GroupAction.java 2014-08-12 09:25:55 UTC (rev 523) +++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/GroupAction.java 2014-08-12 14:00:32 UTC (rev 524) @@ -78,7 +78,6 @@ public void doAction() throws Exception { FaxToMailServiceContext serviceContext = getContext().newServiceContext(); EmailService emailService = serviceContext.getEmailService(); - FaxToMailUser user = getContext().getCurrentUser(); FaxToMailUser currentUser = getContext().getCurrentUser(); Email email = emailService.groupEmails(currentEmail.getTopiaId(), selectedEmail.getTopiaId(), currentUser); Modified: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandesUIHandler.java =================================================================== --- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandesUIHandler.java 2014-08-12 09:25:55 UTC (rev 523) +++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandesUIHandler.java 2014-08-12 14:00:32 UTC (rev 524) @@ -418,7 +418,7 @@ dialogContent, t("faxtomail.searchToGroup.title", demandeUI.getModel().getTitle()), getContext().getMainUI().getSize(), - true); + false); getContext().getActionFactory().createUIAction(null, action).actionPerformed(null); } Modified: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/reply/ReplyFormUIModel.java =================================================================== --- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/reply/ReplyFormUIModel.java 2014-08-12 09:25:55 UTC (rev 523) +++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/reply/ReplyFormUIModel.java 2014-08-12 14:00:32 UTC (rev 524) @@ -30,6 +30,7 @@ import java.util.List; import java.util.Set; +import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.io.FileUtils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; @@ -270,10 +271,9 @@ public boolean isValid(String field) { boolean result = true; if (PROPERTY_FROM.equals(field)) { - // si les deux listes liste getSenderAllowedAddresses et getSenderAllowedDomains sont - // toutes les deux vides on ne valide pas - // sinon un des deux autres test doit forcement etre vrai sinon de n'est pas valide - result = getSenderAllowedAddresses().isEmpty() && getSenderAllowedDomains().isEmpty() || isEmailAllowed(getFrom()) || isDomainAllowed(getFrom()); + // valid if the email address is in the list of the authorized addresses + // or if the domain is in the authorized domains, or if the domain list is empty + result = isEmailAllowed(getFrom()) || isDomainAllowed(getFrom()); } return result; } @@ -286,9 +286,12 @@ */ protected boolean isEmailAllowed(String mail) { Preconditions.checkNotNull(mail); - for (String address : getSenderAllowedAddresses()) { - if (mail.equalsIgnoreCase(address)) { - return true; + List<String> senderAllowedAddresses = getSenderAllowedAddresses(); + if (senderAllowedAddresses != null) { + for (String address : senderAllowedAddresses) { + if (mail.equalsIgnoreCase(address)) { + return true; + } } } return false; @@ -302,7 +305,12 @@ */ protected boolean isDomainAllowed(String mail) { Preconditions.checkNotNull(mail); - for (String domain : getSenderAllowedDomains()) { + List<String> senderAllowedDomains = getSenderAllowedDomains(); + + if (CollectionUtils.isEmpty(senderAllowedDomains)) { + return true; + } + for (String domain : senderAllowedDomains) { if (mail.endsWith(domain)) { return true; } Modified: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/AbstractFaxToMailUIHandler.java =================================================================== --- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/AbstractFaxToMailUIHandler.java 2014-08-12 09:25:55 UTC (rev 523) +++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/AbstractFaxToMailUIHandler.java 2014-08-12 14:00:32 UTC (rev 524) @@ -265,10 +265,10 @@ SwingUtil.center(getContext().getMainUI(), result); result.setVisible(true); } - + /** * Surchargée pour temporairement ajouter un appel à ApplicationUI#onCloseUI on windowClosing. - * + * * @deprecated overriden during waiting response for issue : http://nuiton.org/issues/3415 */ @Deprecated @@ -285,7 +285,7 @@ result.add((Component) dialogContent); result.setResizable(true); - + result.setSize(dim); final AbstractApplicationUIHandler handler = dialogContent.getHandler(); @@ -308,16 +308,11 @@ }); } + result.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE); result.addWindowListener(new WindowAdapter() { @Override public void windowClosing(WindowEvent e) { - boolean canClose = true; - if (handler instanceof CloseableUI) { - canClose = ((CloseableUI)handler).quitUI(); - } - if (canClose) { - result.setVisible(false); - } + closeDialog(); } @Override @@ -335,6 +330,18 @@ result.setVisible(true); } + @Override + public void closeDialog() { + JDialog dialog = getParentContainer(JDialog.class); + boolean canClose = true; + if (this instanceof CloseableUI) { + canClose = ((CloseableUI)this).quitUI(); + } + if (canClose) { + dialog.setVisible(false); + } + } + /** * Gros copier/coller de quitScreen() pour appeler runActionAndWait au lieu de saveAction.actionPerformed(null); par defaut * pour tenter de corriger un problème de concurrence entre l'action de sauvegarde de l'email @@ -389,7 +396,7 @@ } public void closeFrame() { - getParentContainer(JFrame.class).setVisible(false); + getParentContainer(JFrame.class).dispose(); } protected <HL extends HasLabel> void initCheckBoxComboBox(final JComboBox<HL> comboBox, Modified: trunk/faxtomail-ui-swing/src/main/resources/com/franciaflex/faxtomail/ui/swing/content/reply/ReplyFormUIModel-error-validation.xml =================================================================== --- trunk/faxtomail-ui-swing/src/main/resources/com/franciaflex/faxtomail/ui/swing/content/reply/ReplyFormUIModel-error-validation.xml 2014-08-12 09:25:55 UTC (rev 523) +++ trunk/faxtomail-ui-swing/src/main/resources/com/franciaflex/faxtomail/ui/swing/content/reply/ReplyFormUIModel-error-validation.xml 2014-08-12 14:00:32 UTC (rev 524) @@ -51,12 +51,18 @@ </field> <field name="from"> + <field-validator type="requiredstring" short-circuit="true"> + <message>faxtomail.validator.error.reply.from.required</message> + </field-validator> <field-validator type="fieldexpression" short-circuit="true"> <param name="expression"> <![CDATA[ isValid("from") ]]> </param> <message>faxtomail.validator.error.reply.from.invalidDomain</message> </field-validator> + <field-validator type="email" short-circuit="true"> + <message>faxtomail.validator.error.reply.from.email</message> + </field-validator> </field> <field name="subject"> Modified: trunk/faxtomail-ui-swing/src/main/resources/i18n/faxtomail-ui-swing_fr_FR.properties =================================================================== --- trunk/faxtomail-ui-swing/src/main/resources/i18n/faxtomail-ui-swing_fr_FR.properties 2014-08-12 09:25:55 UTC (rev 523) +++ trunk/faxtomail-ui-swing/src/main/resources/i18n/faxtomail-ui-swing_fr_FR.properties 2014-08-12 14:00:32 UTC (rev 524) @@ -291,6 +291,7 @@ faxtomail.validator.error.email.rangeRow.required=Tableau des gammes requis faxtomail.validator.error.reply.cc.email=Le champ 'Copie\:' doit être une adresse email valide \! faxtomail.validator.error.reply.cci.email=Le champ 'opie cachée\:' doit être une adresse email valide \! +faxtomail.validator.error.reply.from.email= faxtomail.validator.error.reply.from.invalidDomain= faxtomail.validator.error.reply.from.required= faxtomail.validator.error.reply.subject.required=
participants (1)
-
kmorin@users.forge.codelutin.com