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 39ab5e9dcfc3a010664281bc73c21764e5df44e8 Author: Kevin Morin <morin@codelutin.com> Date: Thu Mar 30 11:09:18 2017 +0200 refs #9103 prise en compte de la conf des fonctions répondre et transférer dans la partie cliente --- .../ui/swing/content/demande/DemandeListUI.css | 10 ++++ .../ui/swing/content/demande/DemandeListUI.jaxx | 1 + .../content/demande/DemandeListUIHandler.java | 24 +++++++-- .../swing/content/demande/DemandeListUIModel.java | 39 ++++++++++++++ .../ui/swing/content/demande/DemandesUI.css | 8 +++ .../ui/swing/content/demande/DemandesUI.jaxx | 38 ++++++++++---- .../swing/content/demande/DemandesUIHandler.java | 30 ++++++++++- .../ui/swing/content/demande/DemandesUIModel.java | 36 +++++++++++++ ...yFormAction.java => OpenForwardFormAction.java} | 17 ++----- .../demande/actions/OpenReplyFormAction.java | 1 + ...tion.java => SaveAndOpenForwardFormAction.java} | 17 ++----- .../actions/SaveAndOpenReplyFormAction.java | 2 +- .../demande/replies/DemandRepliesUIHandler.java | 1 + .../demande/replies/actions/OpenReplyAction.java | 5 +- .../ui/swing/content/reply/ReplyFormUI.css | 10 ++-- .../ui/swing/content/reply/ReplyFormUI.jaxx | 33 ++++++------ .../ui/swing/content/reply/ReplyFormUIHandler.java | 59 +++++++++++++++++----- .../ui/swing/content/reply/ReplyFormUIModel.java | 12 +++++ .../ui/swing/util/AbstractFaxToMailUIHandler.java | 5 +- .../i18n/faxtomail-ui-swing_fr_FR.properties | 4 ++ 20 files changed, 266 insertions(+), 86 deletions(-) diff --git a/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeListUI.css b/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeListUI.css index d32c873..12cb824 100644 --- a/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeListUI.css +++ b/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeListUI.css @@ -104,10 +104,20 @@ actionIcon: reply; text: "faxtomail.demandeList.action.reply"; toolTipText: "faxtomail.demandeList.action.reply.tip"; + visible: { model.isReplyActivated() }; enabled: { model.isReplyEnabled() }; _applicationAction: { com.franciaflex.faxtomail.ui.swing.content.demande.actions.OpenReplyFormAction.class }; } +#forwardMenu { + actionIcon: reply; + text: "faxtomail.demandeList.action.forward"; + toolTipText: "faxtomail.demandeList.action.forward.tip"; + visible: { model.isForwardActivated() }; + enabled: { model.isForwardEnabled() }; + _applicationAction: { com.franciaflex.faxtomail.ui.swing.content.demande.actions.OpenForwardFormAction.class }; +} + #archiveMenu { actionIcon: archive; text: "faxtomail.demandeList.action.archive"; diff --git a/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeListUI.jaxx b/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeListUI.jaxx index de31984..b289a82 100644 --- a/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeListUI.jaxx +++ b/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeListUI.jaxx @@ -61,6 +61,7 @@ <JMenuItem id='printMenu' onActionPerformed='handler.print()'/> <JMenuItem id='replyMenu'/> + <JMenuItem id='forwardMenu'/> <JMenuItem id='archiveMenu'/> <JMenuItem id='moveMenu'/> </JPopupMenu> diff --git a/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeListUIHandler.java b/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeListUIHandler.java index ce69130..6c29f64 100644 --- a/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeListUIHandler.java +++ b/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeListUIHandler.java @@ -320,6 +320,20 @@ public class DemandeListUIHandler extends AbstractFaxToMailDemandListHandler<Dem getContext().setCurrentMailFolder(folder); loadFolderDemands(nodesByFolder); + MailFolder folderWithShowReplyAction = folder; + while (folderWithShowReplyAction.getParent() != null + && folderWithShowReplyAction.getShowReplyAction() == null) { + folderWithShowReplyAction = folderWithShowReplyAction.getParent(); + } + getModel().setReplyActivated(Boolean.TRUE.equals(folderWithShowReplyAction.getShowReplyAction())); + + MailFolder folderWithShowForwardAction = folder; + while (folderWithShowForwardAction.getParent() != null + && folderWithShowForwardAction.getShowForwardAction() == null) { + folderWithShowForwardAction = folderWithShowForwardAction.getParent(); + } + getModel().setForwardActivated(Boolean.TRUE.equals(folderWithShowForwardAction.getShowForwardAction())); + DefaultMutableTreeNode node = nodesByFolder.get(folder); if (node != null) { navigationTree.setSelectionPath(new TreePath(node.getPath())); @@ -503,11 +517,7 @@ public class DemandeListUIHandler extends AbstractFaxToMailDemandListHandler<Dem if (log.isErrorEnabled()) { log.error("error while introspecting emailfilter for property " + property, e); } - } catch (InvocationTargetException e) { - if (log.isErrorEnabled()) { - log.error("error while calling getter for property " + property, e); - } - } catch (IllegalAccessException e) { + } catch (InvocationTargetException | IllegalAccessException e) { if (log.isErrorEnabled()) { log.error("error while calling getter for property " + property, e); } @@ -712,6 +722,10 @@ public class DemandeListUIHandler extends AbstractFaxToMailDemandListHandler<Dem && model.getSelectedEmails().get(0).isEditable() && isActionEnabled(model.getSelectedEmails().get(0), MailAction.REPLY)); + model.setForwardEnabled(selectedRowCount == 1 + && model.getSelectedEmails().get(0).isEditable() + && isActionEnabled(model.getSelectedEmails().get(0), MailAction.FORWARD)); + model.setArchiveEnabled(selectedRowCount > 0); model.setTransmitEnabled(selectedRowCount > 0); model.setPrintEnabled(selectedRowCount > 0); diff --git a/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeListUIModel.java b/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeListUIModel.java index 2fdac33..d61d6e4 100644 --- a/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeListUIModel.java +++ b/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeListUIModel.java @@ -48,7 +48,10 @@ public class DemandeListUIModel extends AbstractSerializableBean { public static final String PROPERTY_QUOTATION_NB = "quotationNb"; public static final String PROPERTY_PF_NB = "pfNb"; public static final String PROPERTY_SAV_NB = "savNb"; + public static final String PROPERTY_REPLY_ACTIVATED = "replyActivated"; public static final String PROPERTY_REPLY_ENABLED = "replyEnabled"; + public static final String PROPERTY_FORWARD_ACTIVATED = "forwardActivated"; + public static final String PROPERTY_FORWARD_ENABLED = "forwardEnabled"; public static final String PROPERTY_ARCHIVE_ENABLED = "archiveEnabled"; public static final String PROPERTY_TRANSMIT_ENABLED = "transmitEnabled"; public static final String PROPERTY_PRINT_ENABLED = "printEnabled"; @@ -76,8 +79,14 @@ public class DemandeListUIModel extends AbstractSerializableBean { protected MailFolder selectedFolder; + protected boolean replyActivated; + protected boolean replyEnabled; + protected boolean forwardActivated; + + protected boolean forwardEnabled; + protected boolean archiveEnabled; protected boolean transmitEnabled; @@ -202,6 +211,16 @@ public class DemandeListUIModel extends AbstractSerializableBean { firePropertyChange(PROPERTY_SELECTED_FOLDER, oldValue, selectedFolder); } + public boolean isReplyActivated() { + return replyActivated; + } + + public void setReplyActivated(boolean replyActivated) { + Object oldValue = isReplyActivated(); + this.replyActivated = replyActivated; + firePropertyChange(PROPERTY_REPLY_ACTIVATED, oldValue, replyActivated); + } + public boolean isReplyEnabled() { return replyEnabled; } @@ -212,6 +231,26 @@ public class DemandeListUIModel extends AbstractSerializableBean { firePropertyChange(PROPERTY_REPLY_ENABLED, oldValue, replyEnabled); } + public boolean isForwardActivated() { + return forwardActivated; + } + + public void setForwardActivated(boolean forwardActivated) { + Object oldValue = isForwardActivated(); + this.forwardActivated = forwardActivated; + firePropertyChange(PROPERTY_FORWARD_ACTIVATED, oldValue, forwardActivated); + } + + public boolean isForwardEnabled() { + return forwardEnabled; + } + + public void setForwardEnabled(boolean forwardEnabled) { + Object oldValue = isForwardEnabled(); + this.forwardEnabled = forwardEnabled; + firePropertyChange(PROPERTY_FORWARD_ENABLED, oldValue, forwardEnabled); + } + public boolean isArchiveEnabled() { return archiveEnabled; } diff --git a/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandesUI.css b/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandesUI.css index 317e2e0..79b2ef1 100644 --- a/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandesUI.css +++ b/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandesUI.css @@ -65,9 +65,17 @@ #replyButton { text: "faxtomail.demande.reply.button.label"; actionIcon: reply; + visible: { model.isReplyActivated() }; enabled: { model.isReplyEnabled() }; } +#forwardButton { + text: "faxtomail.demande.forward.button.label"; + actionIcon: reply; + visible: { model.isForwardActivated() }; + enabled: { model.isForwardEnabled() }; +} + #groupButton { text: "faxtomail.demande.group.button.label"; actionIcon: group; 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 3cefae5..d67eff1 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 @@ -64,16 +64,34 @@ <!--</tab>--> </JTabbedPane> - <JPanel layout='{new GridLayout(1,0)}' - constraints='BorderLayout.SOUTH'> - <JButton id="backButton" onActionPerformed="handler.closeFrame()"/> - <JButton id="saveButton" onActionPerformed="handler.save()"/> - <JButton id="transmitButton" onActionPerformed="handler.transmitDemande()"/> - <JButton id="printButton" onActionPerformed="handler.print()"/> - <JButton id="archiveButton" onActionPerformed="handler.archive()"/> - <JButton id="replyButton" onActionPerformed="handler.reply()"/> - <JButton id="groupButton" onActionPerformed="handler.group()"/> - </JPanel> + <Table constraints='BorderLayout.SOUTH' fill="both" insets="0"> + <row> + <cell weightx="1" insets="0"> + <JButton id="backButton" onActionPerformed="handler.closeFrame()"/> + </cell> + <cell weightx="1" insets="0"> + <JButton id="saveButton" onActionPerformed="handler.save()"/> + </cell> + <cell weightx="1" insets="0"> + <JButton id="transmitButton" onActionPerformed="handler.transmitDemande()"/> + </cell> + <cell weightx="1" insets="0"> + <JButton id="printButton" onActionPerformed="handler.print()"/> + </cell> + <cell weightx="1" insets="0"> + <JButton id="archiveButton" onActionPerformed="handler.archive()"/> + </cell> + <cell weightx="1" insets="0"> + <JButton id="replyButton" onActionPerformed="handler.reply()"/> + </cell> + <cell weightx="1" insets="0"> + <JButton id="forwardButton" onActionPerformed="handler.forward()"/> + </cell> + <cell weightx="1" insets="0"> + <JButton id="groupButton" onActionPerformed="handler.group()"/> + </cell> + </row> + </Table> </JPanel> 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 e987300..7b037a8 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 @@ -27,8 +27,10 @@ package com.franciaflex.faxtomail.ui.swing.content.demande; import com.franciaflex.faxtomail.persistence.entities.Configuration; import com.franciaflex.faxtomail.persistence.entities.Email; import com.franciaflex.faxtomail.persistence.entities.MailAction; +import com.franciaflex.faxtomail.persistence.entities.MailFolder; import com.franciaflex.faxtomail.ui.swing.content.demande.actions.ArchiveAction; import com.franciaflex.faxtomail.ui.swing.content.demande.actions.SaveAndOpenChooseAttachmentToPrintAction; +import com.franciaflex.faxtomail.ui.swing.content.demande.actions.SaveAndOpenForwardFormAction; import com.franciaflex.faxtomail.ui.swing.content.demande.actions.SaveAndOpenMailFolderChooserAction; import com.franciaflex.faxtomail.ui.swing.content.demande.actions.SaveAndOpenReplyFormAction; import com.franciaflex.faxtomail.ui.swing.content.demande.actions.SaveAndOpenSearchToGroupAction; @@ -46,8 +48,10 @@ import org.nuiton.jaxx.application.swing.tab.TabContentModel; import org.nuiton.jaxx.application.swing.tab.TabHandler; import org.nuiton.jaxx.application.swing.util.CloseableUI; -import javax.swing.*; -import java.awt.*; +import javax.swing.DefaultSingleSelectionModel; +import javax.swing.JComponent; +import javax.swing.JTabbedPane; +import java.awt.Component; import java.beans.PropertyChangeEvent; import java.beans.PropertyChangeListener; @@ -179,8 +183,25 @@ public class DemandesUIHandler extends AbstractFaxToMailUIHandler<DemandesUIMode boolean printEnabled = isActionEnabled(model, MailAction.PRINT); getModel().setPrintEnabled(printEnabled); + MailFolder folderWithShowReplyAction = model.getMailFolder(); + while (folderWithShowReplyAction.getParent() != null + && folderWithShowReplyAction.getShowReplyAction() == null) { + folderWithShowReplyAction = folderWithShowReplyAction.getParent(); + } + getModel().setReplyActivated(Boolean.TRUE.equals(folderWithShowReplyAction.getShowReplyAction())); + boolean replyEnabled = (editable || archived) && isActionEnabled(model, MailAction.REPLY); getModel().setReplyEnabled(replyEnabled); + + MailFolder folderWithShowForwardAction = model.getMailFolder(); + while (folderWithShowForwardAction.getParent() != null + && folderWithShowForwardAction.getShowForwardAction() == null) { + folderWithShowForwardAction = folderWithShowForwardAction.getParent(); + } + getModel().setForwardActivated(Boolean.TRUE.equals(folderWithShowForwardAction.getShowForwardAction())); + + boolean forwardEnabled = (editable || archived) && isActionEnabled(model, MailAction.FORWARD); + getModel().setForwardEnabled(forwardEnabled); } @Override @@ -373,6 +394,11 @@ public class DemandesUIHandler extends AbstractFaxToMailUIHandler<DemandesUIMode runAction(SaveAndOpenReplyFormAction.class); } + public void forward() { + closeButtonPopups(); + runAction(SaveAndOpenForwardFormAction.class); + } + public void group() { closeButtonPopups(); runAction(SaveAndOpenSearchToGroupAction.class); diff --git a/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandesUIModel.java b/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandesUIModel.java index 9f7cf6b..48f38d0 100644 --- a/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandesUIModel.java +++ b/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandesUIModel.java @@ -40,13 +40,19 @@ public class DemandesUIModel extends AbstractBean { public static final String PROPERTY_ARCHIVE_ENABLED = "archiveEnabled"; public static final String PROPERTY_GROUP_ENABLED = "groupEnabled"; public static final String PROPERTY_PRINT_ENABLED = "printEnabled"; + public static final String PROPERTY_REPLY_ACTIVATED = "replyActivated"; public static final String PROPERTY_REPLY_ENABLED = "replyEnabled"; + public static final String PROPERTY_FORWARD_ACTIVATED = "forwardActivated"; + public static final String PROPERTY_FORWARD_ENABLED = "forwardEnabled"; protected boolean transmitEnabled; protected boolean archiveEnabled; protected boolean groupEnabled; protected boolean printEnabled; + protected boolean replyActivated; protected boolean replyEnabled; + protected boolean forwardActivated; + protected boolean forwardEnabled; protected List<DemandeUIModel> demands = new ArrayList<DemandeUIModel>(); @@ -94,6 +100,16 @@ public class DemandesUIModel extends AbstractBean { firePropertyChange(PROPERTY_PRINT_ENABLED, oldValue, printEnabled); } + public boolean isReplyActivated() { + return replyActivated; + } + + public void setReplyActivated(boolean replyActivated) { + Object oldValue = isReplyActivated(); + this.replyActivated = replyActivated; + firePropertyChange(PROPERTY_REPLY_ACTIVATED, oldValue, replyActivated); + } + public boolean isReplyEnabled() { return replyEnabled; } @@ -104,6 +120,26 @@ public class DemandesUIModel extends AbstractBean { firePropertyChange(PROPERTY_REPLY_ENABLED, oldValue, replyEnabled); } + public boolean isForwardActivated() { + return forwardActivated; + } + + public void setForwardActivated(boolean forwardActivated) { + Object oldValue = isForwardActivated(); + this.forwardActivated = forwardActivated; + firePropertyChange(PROPERTY_FORWARD_ACTIVATED, oldValue, forwardActivated); + } + + public boolean isForwardEnabled() { + return forwardEnabled; + } + + public void setForwardEnabled(boolean forwardEnabled) { + Object oldValue = isForwardEnabled(); + this.forwardEnabled = forwardEnabled; + firePropertyChange(PROPERTY_FORWARD_ENABLED, oldValue, forwardEnabled); + } + protected List<DemandeUIModel> getDemands() { return demands; } diff --git a/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/actions/OpenReplyFormAction.java b/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/actions/OpenForwardFormAction.java similarity index 83% copy from faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/actions/OpenReplyFormAction.java copy to faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/actions/OpenForwardFormAction.java index 545029b..bee286d 100644 --- a/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/actions/OpenReplyFormAction.java +++ b/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/actions/OpenForwardFormAction.java @@ -25,10 +25,8 @@ package com.franciaflex.faxtomail.ui.swing.content.demande.actions; */ import com.franciaflex.faxtomail.persistence.entities.Email; -import com.franciaflex.faxtomail.persistence.entities.MailFolder; import com.franciaflex.faxtomail.persistence.entities.SigningForDomain; import com.franciaflex.faxtomail.services.FaxToMailServiceContext; -import com.franciaflex.faxtomail.services.FaxToMailServiceUtils; import com.franciaflex.faxtomail.ui.swing.FaxToMailUIContext; import com.franciaflex.faxtomail.ui.swing.actions.AbstractFaxToMailAction; import com.franciaflex.faxtomail.ui.swing.content.demande.DemandeListUI; @@ -37,7 +35,6 @@ import com.franciaflex.faxtomail.ui.swing.content.demande.DemandeListUIModel; import com.franciaflex.faxtomail.ui.swing.content.demande.DemandeUIModel; import com.franciaflex.faxtomail.ui.swing.content.reply.ReplyFormUI; import com.franciaflex.faxtomail.ui.swing.content.reply.ReplyFormUIModel; -import jaxx.runtime.JAXXUtil; import org.apache.commons.lang3.StringUtils; import javax.swing.JFrame; @@ -52,12 +49,12 @@ import static org.nuiton.i18n.I18n.t; * @author Kevin Morin (Code Lutin) * @since 1.1 */ -public class OpenReplyFormAction extends AbstractFaxToMailAction<DemandeListUIModel, DemandeListUI, DemandeListUIHandler> { +public class OpenForwardFormAction extends AbstractFaxToMailAction<DemandeListUIModel, DemandeListUI, DemandeListUIHandler> { protected ReplyFormUI frameContent; protected JFrame frame; - public OpenReplyFormAction(DemandeListUIHandler handler) { + public OpenForwardFormAction(DemandeListUIHandler handler) { super(handler, false); } @@ -81,14 +78,8 @@ public class OpenReplyFormAction extends AbstractFaxToMailAction<DemandeListUIMo } model.setSigning(signingForDomain); + model.setForward(true); model.setOriginalDemand(demand); - - String sender = JAXXUtil.getStringValue(demand.getSender()); - if (demand.isFax()) { - MailFolder selectedFolder = getModel().getSelectedFolder(); - sender = FaxToMailServiceUtils.addFaxDomainToFaxNumber(sender, selectedFolder); - } - model.setTo(sender); } } @@ -96,7 +87,7 @@ public class OpenReplyFormAction extends AbstractFaxToMailAction<DemandeListUIMo public void postSuccessAction() { super.postSuccessAction(); frame = getHandler().openModalFrame(frameContent, - t("faxtomail.reply.title", getContext().getCurrentEmail().getTitle()), + t("faxtomail.reply.forwardsubject", getContext().getCurrentEmail().getSubject()), new Dimension(800, 600)); getContext().addPropertyChangeListener(FaxToMailUIContext.PROPERTY_BUSY, new PropertyChangeListener() { diff --git a/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/actions/OpenReplyFormAction.java b/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/actions/OpenReplyFormAction.java index 545029b..2248e6a 100644 --- a/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/actions/OpenReplyFormAction.java +++ b/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/actions/OpenReplyFormAction.java @@ -81,6 +81,7 @@ public class OpenReplyFormAction extends AbstractFaxToMailAction<DemandeListUIMo } model.setSigning(signingForDomain); + model.setForward(false); model.setOriginalDemand(demand); String sender = JAXXUtil.getStringValue(demand.getSender()); diff --git a/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/actions/SaveAndOpenReplyFormAction.java b/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/actions/SaveAndOpenForwardFormAction.java similarity index 77% copy from faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/actions/SaveAndOpenReplyFormAction.java copy to faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/actions/SaveAndOpenForwardFormAction.java index 13d52b4..4bb7334 100644 --- a/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/actions/SaveAndOpenReplyFormAction.java +++ b/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/actions/SaveAndOpenForwardFormAction.java @@ -25,12 +25,10 @@ package com.franciaflex.faxtomail.ui.swing.content.demande.actions; */ import com.franciaflex.faxtomail.persistence.entities.SigningForDomain; -import com.franciaflex.faxtomail.services.FaxToMailServiceUtils; import com.franciaflex.faxtomail.ui.swing.content.demande.DemandeUIModel; import com.franciaflex.faxtomail.ui.swing.content.demande.DemandesUIHandler; import com.franciaflex.faxtomail.ui.swing.content.reply.ReplyFormUI; import com.franciaflex.faxtomail.ui.swing.content.reply.ReplyFormUIModel; -import jaxx.runtime.JAXXUtil; import java.awt.Dimension; @@ -39,16 +37,15 @@ import static org.nuiton.i18n.I18n.t; /** * @author Kevin Morin (Code Lutin) */ -public class SaveAndOpenReplyFormAction extends SaveAndOpenModalFrameAction<ReplyFormUI> { +public class SaveAndOpenForwardFormAction extends SaveAndOpenModalFrameAction<ReplyFormUI> { - public SaveAndOpenReplyFormAction(DemandesUIHandler handler) { + public SaveAndOpenForwardFormAction(DemandesUIHandler handler) { super(handler); - setTakeIfNotTaken(true); } @Override public String getTitle() { - return t("faxtomail.reply.title", getModel().getTitle()); + return t("faxtomail.reply.titleForward", getModel().getTitle()); } @Override @@ -69,13 +66,7 @@ public class SaveAndOpenReplyFormAction extends SaveAndOpenModalFrameAction<Repl signingForDomain = getContext().newServiceContext().getConfigurationService().getSigningForEmailAddress(currentDemand.getRecipient()).orNull(); } model.setSigning(signingForDomain); - + model.setForward(true); model.setOriginalDemand(currentDemand); - - String sender = JAXXUtil.getStringValue(currentDemand.getSender()); - if (currentDemand.isFax()) { - sender = FaxToMailServiceUtils.addFaxDomainToFaxNumber(sender, currentDemand.getMailFolder()); - } - model.setTo(sender); } } diff --git a/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/actions/SaveAndOpenReplyFormAction.java b/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/actions/SaveAndOpenReplyFormAction.java index 13d52b4..4af49bd 100644 --- a/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/actions/SaveAndOpenReplyFormAction.java +++ b/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/actions/SaveAndOpenReplyFormAction.java @@ -69,7 +69,7 @@ public class SaveAndOpenReplyFormAction extends SaveAndOpenModalFrameAction<Repl signingForDomain = getContext().newServiceContext().getConfigurationService().getSigningForEmailAddress(currentDemand.getRecipient()).orNull(); } model.setSigning(signingForDomain); - + model.setForward(false); model.setOriginalDemand(currentDemand); String sender = JAXXUtil.getStringValue(currentDemand.getSender()); diff --git a/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/replies/DemandRepliesUIHandler.java b/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/replies/DemandRepliesUIHandler.java index 7512e4d..f4b456d 100644 --- a/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/replies/DemandRepliesUIHandler.java +++ b/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/replies/DemandRepliesUIHandler.java @@ -208,6 +208,7 @@ public class DemandRepliesUIHandler extends AbstractToolbarPopupHandler<DemandeU MimeMessage message = MimeMessageUtils.createMimeMessage(null, replyContent.getSource()); ReplyFormUIModel replyModel = dialogContent.getModel(); replyModel.setEditable(editable); + replyModel.setForward(true); replyModel.setOriginalDemand(ui.getModel()); replyModel.setReadSentDate(reply.getSentDate()); replyModel.setSubject(t("faxtomail.reply.forwardsubject", message.getSubject())); diff --git a/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/replies/actions/OpenReplyAction.java b/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/replies/actions/OpenReplyAction.java index db85c6d..375ce18 100644 --- a/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/replies/actions/OpenReplyAction.java +++ b/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/replies/actions/OpenReplyAction.java @@ -43,11 +43,11 @@ import org.apache.commons.lang3.StringUtils; import org.apache.commons.mail.util.MimeMessageUtils; import javax.mail.internet.MimeMessage; -import java.beans.PropertyChangeEvent; -import java.beans.PropertyChangeListener; import javax.swing.JFrame; import javax.swing.SwingUtilities; import java.awt.Dimension; +import java.beans.PropertyChangeEvent; +import java.beans.PropertyChangeListener; import static org.nuiton.i18n.I18n.t; @@ -87,6 +87,7 @@ public class OpenReplyAction extends AbstractFaxToMailAction<DemandeUIModel, Dem MimeMessage message = MimeMessageUtils.createMimeMessage(null, replyContent.getSource()); ReplyFormUIModel replyModel = frameContent.getModel(); replyModel.setEditable(editable); + replyModel.setForward(false); replyModel.setOriginalDemand(demand); replyModel.setReadonly(true); replyModel.setReadSentDate(reply.getSentDate()); diff --git a/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/reply/ReplyFormUI.css b/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/reply/ReplyFormUI.css index e813e30..cd8207a 100644 --- a/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/reply/ReplyFormUI.css +++ b/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/reply/ReplyFormUI.css @@ -156,27 +156,25 @@ enabled: { addAttachmentFile.getSelectedItem() != null }; } -#buttonPanelLayout { - selected: { String.valueOf(model.isReadonly()) }; -} - #forwardButton { actionIcon: transmit; text: "faxtomail.reply.action.forward"; toolTipText: "faxtomail.reply.action.forward.tip"; - visible: { getModel().isEditable() }; + visible: { model.isReadonly() && model.isEditable() }; } #closeButton { actionIcon: cancel; text: "faxtomail.reply.action.close"; toolTipText: "faxtomail.reply.action.close.tip"; + visible: {model.isReadonly()}; } #cancelButton { actionIcon: cancel; text: "faxtomail.reply.action.cancel"; toolTipText: "faxtomail.reply.action.cancel.tip"; + visible: {!model.isReadonly()}; } #validateButton { @@ -184,7 +182,7 @@ text: "faxtomail.reply.action.validate"; toolTipText: "faxtomail.reply.action.validate.tip"; _applicationAction: { com.franciaflex.faxtomail.ui.swing.content.reply.actions.ReplyAction.class }; - + visible: {!model.isReadonly()}; /* FIXME echatellier 20140715 : ca doit pas se faire comme ca, mais pas trop d'idée */ enabled: { getModel().isValid() && getModel().isAttachmentSizeValid(getModel().getTotalAttachmentLength()) }; } diff --git a/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/reply/ReplyFormUI.jaxx b/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/reply/ReplyFormUI.jaxx index 66b2e4e..ce61164 100644 --- a/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/reply/ReplyFormUI.jaxx +++ b/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/reply/ReplyFormUI.jaxx @@ -61,9 +61,6 @@ <CardLayout2Ext id='fromPanelLayout' constructorParams='this, "fromPanel"'/> - <CardLayout2Ext id='buttonPanelLayout' - constructorParams='this, "buttonPanel"'/> - <Table constraints='BorderLayout.NORTH' fill='both'> <row> @@ -185,19 +182,23 @@ </JPanel> </JSplitPane> - <JPanel id="buttonPanel" - layout="{ buttonPanelLayout }" + <Table id="buttonPanel" + fill="both" insets="0" constraints='BorderLayout.SOUTH'> - <JPanel constraints='"true"' - layout='{new GridLayout(1, 0)}'> - <JButton id='forwardButton' onActionPerformed='handler.forward()'/> - <JButton id='closeButton' onActionPerformed='handler.cancel()'/> - </JPanel> - <JPanel constraints='"false"' - layout='{new GridLayout(1, 0)}'> - <JButton id='cancelButton' onActionPerformed='handler.cancel()'/> - <JButton id='validateButton'/> - </JPanel> - </JPanel> + <row> + <cell insets="0" weightx="1"> + <JButton id='forwardButton' onActionPerformed='handler.forward()'/> + </cell> + <cell insets="0" weightx="1"> + <JButton id='closeButton' onActionPerformed='handler.cancel()'/> + </cell> + <cell insets="0" weightx="1"> + <JButton id='cancelButton' onActionPerformed='handler.cancel()'/> + </cell> + <cell insets="0" weightx="1"> + <JButton id='validateButton'/> + </cell> + </row> + </Table> </JPanel> diff --git a/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/reply/ReplyFormUIHandler.java b/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/reply/ReplyFormUIHandler.java index 17d1066..4cb69d9 100644 --- a/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/reply/ReplyFormUIHandler.java +++ b/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/reply/ReplyFormUIHandler.java @@ -139,25 +139,44 @@ public class ReplyFormUIHandler extends AbstractFaxToMailUIHandler<ReplyFormUIMo for (Attachment attachment : demandeUIModel.getAttachment()) { ReplyAttachmentModel replyOriginalAttachmentModel = - new ReplyAttachmentModel(attachment, true, prefix + attachment.getOriginalFileName()); + new ReplyAttachmentModel(attachment, true, prefix + " - " + attachment.getOriginalFileName()); model.addAvailableAttachment(replyOriginalAttachmentModel); if (!Strings.isNullOrEmpty(attachment.getEditedFileName())) { ReplyAttachmentModel replyEditedAttachmentModel = - new ReplyAttachmentModel(attachment, false, prefix + attachment.getEditedFileName()); - model.addAvailableAttachment(replyEditedAttachmentModel); + new ReplyAttachmentModel(attachment, false, prefix + " - " + attachment.getEditedFileName()); + + if (addAttchmentToReply(demand, model, demandeUIModel, attachment)) { + model.addAttachment(replyEditedAttachmentModel); + addAttachmentToReplyAction.setReplyAttachmentModel(replyEditedAttachmentModel); + getContext().getActionEngine().runInternalAction(addAttachmentToReplyAction); + } else { + model.addAvailableAttachment(replyEditedAttachmentModel); + } + + } else if (addAttchmentToReply(demand, model, demandeUIModel, attachment)){ + model.addAttachment(replyOriginalAttachmentModel); + model.removeAvailableAttachment(replyOriginalAttachmentModel); + addAttachmentToReplyAction.setReplyAttachmentModel(replyOriginalAttachmentModel); + getContext().getActionEngine().runInternalAction(addAttachmentToReplyAction); } } } - model.setSubject(t("faxtomail.reply.subject", demand.getSubject())); + String subject; + if (model.isForward()) { + subject = t("faxtomail.reply.forwardsubject", demand.getSubject()); + } else { + subject = t("faxtomail.reply.subject", demand.getSubject()); + } + model.setSubject(subject); String recipient = demand.getRecipient(); String signing; // this have to be disable for read only mode (useless) if (!model.isReadonly()) { - + // attachment combo JComboBox<AttachmentFile> addAttachmentFile = ui.getAddAttachmentFile(); addAttachmentFile.setModel(SwingUtil.newComboModel(model.getAvailableAttachments().toArray())); @@ -166,13 +185,10 @@ public class ReplyFormUIHandler extends AbstractFaxToMailUIHandler<ReplyFormUIMo // sender combo MailFolder folder = demand.getMailFolder(); List<String> folderReplyAdresses = new ArrayList<>(); -// List<String> folderReplyDomains = new ArrayList<>(); while (folder != null) { folderReplyAdresses.addAll(folder.getReplyAddresses()); -// folderReplyDomains.addAll(folder.getReplyDomains()); folder = folder.getParent(); } -// model.setSenderAllowedDomains(folderReplyDomains); List<String> replyToAddresses = Lists.newArrayList(); String selectedItem = null; @@ -181,9 +197,7 @@ public class ReplyFormUIHandler extends AbstractFaxToMailUIHandler<ReplyFormUIMo model.setFrom(recipient); selectedItem = recipient; } - if (folderReplyAdresses != null) { - replyToAddresses.addAll(folderReplyAdresses); - } + replyToAddresses.addAll(folderReplyAdresses); Collections.sort(replyToAddresses); ui.getFromComboBox().setBeanType(String.class); @@ -195,7 +209,7 @@ public class ReplyFormUIHandler extends AbstractFaxToMailUIHandler<ReplyFormUIMo initBeanFilterableComboBox(ui.getContactField(), getContext().getContactCache(), null); // signatures - signing = getSigningParagraph(createSigning(recipient)); + signing = getSigningParagraph(createSigning(model.getFrom())); } else { model.setFrom(recipient); @@ -205,7 +219,18 @@ public class ReplyFormUIHandler extends AbstractFaxToMailUIHandler<ReplyFormUIMo String plainContent = StringUtils.join(demand.getPlainContent(), CONTENT_SEPARATOR); String quotedText = plainContent != null ? plainContent.replaceAll("\n", "<br/> ") : ""; - String quotedReply = FaxToMailUIUtil.getQuotedReplyContent(signing, decorate(demand.getReceptionDate()), demand.getSender(), quotedText); + String quotedReply; + if (model.isForward()) { + quotedReply = FaxToMailUIUtil.getQuotedForwardContent(signing, + demand.getSubject(), + decorate(demand.getReceptionDate()), + demand.getSender(), + demand.getRecipient(), + demand.getCcRecipients(), + quotedText); + } else { + quotedReply = FaxToMailUIUtil.getQuotedReplyContent(signing, decorate(demand.getReceptionDate()), demand.getSender(), quotedText); + } model.setMessage(quotedReply); } }); @@ -256,6 +281,11 @@ public class ReplyFormUIHandler extends AbstractFaxToMailUIHandler<ReplyFormUIMo } + protected boolean addAttchmentToReply(DemandeUIModel demand, ReplyFormUIModel model, DemandeUIModel demandeUIModel, Attachment attachment) { + return model.isForward() && demandeUIModel.equals(demand) + && !attachment.isInlineAttachment() && !attachment.isLessImportant(); + } + @Override public void cancel() { closeFrame(); @@ -477,6 +507,7 @@ public class ReplyFormUIHandler extends AbstractFaxToMailUIHandler<ReplyFormUIMo // clear fields that need to be filled by hand replyModel.setReadonly(false); + replyModel.setForward(true); replyModel.setOriginalDemand(getModel().getOriginalDemand()); replyModel.setReadSentDate(null); replyModel.setTo(null); @@ -493,7 +524,7 @@ public class ReplyFormUIHandler extends AbstractFaxToMailUIHandler<ReplyFormUIMo originalReply); replyModel.setMessage(quotedReply); - openModalFrame(dialogContent, t("faxtomail.reply.forward", getModel().getSubject()), new Dimension(800, 600)); + openModalFrame(dialogContent, replyModel.getSubject(), new Dimension(800, 600)); } catch (Exception ex) { if (log.isErrorEnabled()) { diff --git a/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/reply/ReplyFormUIModel.java b/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/reply/ReplyFormUIModel.java index d68cd0a..f41a7c5 100644 --- a/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/reply/ReplyFormUIModel.java +++ b/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/reply/ReplyFormUIModel.java @@ -64,6 +64,7 @@ public class ReplyFormUIModel extends AbstractSerializableBean { public static final String PROPERTY_READONLY = "readonly"; public static final String PROPERTY_EDITABLE = "editable"; public static final String PROPERTY_READ_SENT_DATE = "readSentDate"; + public static final String PROPERTY_FORWARD = "forward"; protected Contact contact; protected String to; @@ -77,6 +78,7 @@ public class ReplyFormUIModel extends AbstractSerializableBean { protected long maxAttachmentLength = 0; protected long totalAttachmentLength = 0; protected boolean valid = true; + protected boolean forward; /** Flag pour marquer les champs non editables dans le cas d'une lecture d'une réponse déjà envoyée. */ protected boolean readonly = false; @@ -314,6 +316,16 @@ public class ReplyFormUIModel extends AbstractSerializableBean { return result; } + public boolean isForward() { + return forward; + } + + public void setForward(boolean forward) { + Object oldValue = isForward(); + this.forward = forward; + firePropertyChange(PROPERTY_FORWARD, oldValue, forward); + } + /** * Test si un email est present dans une liste (sans tenir compte de la casse). * diff --git a/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/AbstractFaxToMailUIHandler.java b/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/AbstractFaxToMailUIHandler.java index 67b9d32..d65eb95 100644 --- a/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/AbstractFaxToMailUIHandler.java +++ b/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/AbstractFaxToMailUIHandler.java @@ -507,13 +507,10 @@ public abstract class AbstractFaxToMailUIHandler<M, UI extends FaxToMailUI<M, ?> && !folderWithInvalidFormDisabledActions.isUseCurrentLevelInvalidFormDisabledActions()) { folderWithInvalidFormDisabledActions = folderWithInvalidFormDisabledActions.getParent(); } - boolean enabled = - waitingState == null && (valid || !FaxToMailServiceUtils.contains(folderWithInvalidFormDisabledActions.getInvalidFormDisabledActions(), action)) + return waitingState == null && (valid || !FaxToMailServiceUtils.contains(folderWithInvalidFormDisabledActions.getInvalidFormDisabledActions(), action)) || waitingState != null && (valid && !FaxToMailServiceUtils.contains(waitingState.getValidFormDisabledActions(), action) || !valid && !FaxToMailServiceUtils.contains(waitingState.getInvalidFormDisabledActions(), action)); - - return enabled; } protected <R, B> TableColumnExt addComboDataColumnToModel(TableColumnModel model, diff --git a/faxtomail-ui-swing/src/main/resources/i18n/faxtomail-ui-swing_fr_FR.properties b/faxtomail-ui-swing/src/main/resources/i18n/faxtomail-ui-swing_fr_FR.properties index 3c2086e..a20908e 100644 --- a/faxtomail-ui-swing/src/main/resources/i18n/faxtomail-ui-swing_fr_FR.properties +++ b/faxtomail-ui-swing/src/main/resources/i18n/faxtomail-ui-swing_fr_FR.properties @@ -128,6 +128,7 @@ faxtomail.demande.docType.label=Type faxtomail.demande.ediError.label=Retour EDI faxtomail.demande.fax.label=Fax faxtomail.demande.firstOpened.label=Première ouverture +faxtomail.demande.forward.button.label=Transférer faxtomail.demande.gamme.label=Gamme faxtomail.demande.group.button.label=Grouper faxtomail.demande.group.successful=Groupement réussi @@ -163,6 +164,8 @@ faxtomail.demandeList.action.archive=Archiver faxtomail.demandeList.action.archive.tip=Archiver l'élément faxtomail.demandeList.action.computeQuantitiesByRange=Calculer les quantités par gamme faxtomail.demandeList.action.computeQuantitiesByRange.tip=Calculer les quantités par gamme +faxtomail.demandeList.action.forward=Transférer +faxtomail.demandeList.action.forward.tip=Transférer faxtomail.demandeList.action.newDemand=Créer une nouvelle demande faxtomail.demandeList.action.newDemand.tip=Créer une nouvelle demande faxtomail.demandeList.action.print=Imprimer @@ -316,6 +319,7 @@ faxtomail.reply.label.to=À \: faxtomail.reply.message=<html><body><p></p>%s<p>Le %s, %s a écrit \:</p><div style\='border-left\: 2px solid blue;padding-left\: 5px;'>%s</div> faxtomail.reply.subject=Re \: %s faxtomail.reply.title=Réponse à \: %s +faxtomail.reply.titleForward= faxtomail.search.action.error=Erreur lors de la recherche faxtomail.search.action.gotoFolder=Aller au dossier faxtomail.search.action.gotoFolder.tip=Aller au dossier -- To stop receiving notification emails like this one, please contact codelutin.com SCM administrator <admin+scm@codelutin.com>.