branch develop updated (6fd8dce -> 1d2a7cb)
This is an automated email from the git hooks/post-receive script. New change to branch develop in repository faxtomail. See http://git.codelutin.com/faxtomail.git from 6fd8dce fixes #7418 Ouverture de l'éditeur de PJ sur le même écran que lors du dernier traitement new 7603abb fix NPE new 62c4ef1 modification du modèle (ajout des tampons) (refs #7424) new a7a1c9e ajout de la migration pour sqlserver (refs #7424) new fd1d108 début de l'interface d'admin (possibilité de créer des tampons texte seulement) (refs #7424) new 37d8f5b Ajout des tampons dans l'éditeur de pdf (seulement type texte) (refs #7424) new addb08a - finalisation de l'interface d'admin - ajout des tampons dans l'éditeur de PDF (fixes #7424) new 642f7df Merge branch 'feature/7424' into develop new 0803608 ajout des signatures dans le modèle + migration (refs #7419) new 53ec3ff ajout de la signature dans le formulaire de réponse + début d'écran de configuration des signatures (refs #7419) new 0810bf0 - modif du modèle de signatures (plus de Signing, directement des stamp et un lien entre le stamp et le user pour le default) - enregistrement des signatures et mise par défaut refs #7419 new 9d34a5b - Envoi de la signature dans la réponse - mise en page refs #7419 new 0dd9e95 fixes #7419 new 533f73d add license new 1d2a7cb add missing dependency The 14 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 1d2a7cb63000f2a6caea5612dba3ce96a427bc5d Author: Kevin Morin <morin@codelutin.com> Date: Wed Aug 26 10:41:15 2015 +0200 add missing dependency commit 533f73dd67825e77e1111ef0938578ba2f75dc0d Author: Kevin Morin <morin@codelutin.com> Date: Wed Aug 26 10:35:36 2015 +0200 add license commit 0dd9e9537972124a7edcf2d87f57e5401c5468be Merge: 642f7df 9d34a5b Author: Kevin Morin <morin@codelutin.com> Date: Wed Aug 26 10:35:00 2015 +0200 fixes #7419 commit 9d34a5bd21b62a3c30705673b4155c488c6d8e4e Author: Kevin Morin <morin@codelutin.com> Date: Wed Aug 26 10:27:59 2015 +0200 - Envoi de la signature dans la réponse - mise en page refs #7419 commit 0810bf027973d5c82750fa6d6e67e35624d7024a Author: Kevin Morin <morin@codelutin.com> Date: Tue Aug 25 18:29:50 2015 +0200 - modif du modèle de signatures (plus de Signing, directement des stamp et un lien entre le stamp et le user pour le default) - enregistrement des signatures et mise par défaut refs #7419 commit 53ec3ff53c139b8363c2ae40b3ada55243d3385a Author: Kevin Morin <morin@codelutin.com> Date: Mon Aug 24 18:20:32 2015 +0200 ajout de la signature dans le formulaire de réponse + début d'écran de configuration des signatures (refs #7419) commit 08036089b41387ce8ba1508728c6a83e730e63ed Author: Kevin Morin <morin@codelutin.com> Date: Mon Aug 17 10:47:04 2015 +0200 ajout des signatures dans le modèle + migration (refs #7419) commit 642f7dfa28a0d7e662dd4f335a8b57e372d84131 Merge: 7603abb addb08a Author: Kevin Morin <morin@codelutin.com> Date: Mon Aug 17 07:56:55 2015 +0200 Merge branch 'feature/7424' into develop commit addb08a9f37064335721d15b478799ab19550c40 Author: Kevin Morin <morin@codelutin.com> Date: Sat Aug 15 07:34:08 2015 +0200 - finalisation de l'interface d'admin - ajout des tampons dans l'éditeur de PDF (fixes #7424) commit 37d8f5bc7e5faf3c28a89a03b4b29e5b7282dd14 Author: Kevin Morin <morin@codelutin.com> Date: Wed Aug 12 18:03:17 2015 +0200 Ajout des tampons dans l'éditeur de pdf (seulement type texte) (refs #7424) commit fd1d1085e3e53745a2eab50ceec04e19ba2d6291 Author: Kevin Morin <morin@codelutin.com> Date: Wed Aug 12 14:55:38 2015 +0200 début de l'interface d'admin (possibilité de créer des tampons texte seulement) (refs #7424) commit a7a1c9eb1bdb40a769dfe38a2fc956a8d45c20d5 Author: Kevin Morin <morin@codelutin.com> Date: Tue Aug 11 18:39:25 2015 +0200 ajout de la migration pour sqlserver (refs #7424) commit 62c4ef1c6c3602c8fe6b6133d73090d08b35e175 Author: Kevin Morin <morin@codelutin.com> Date: Tue Aug 11 18:29:06 2015 +0200 modification du modèle (ajout des tampons) (refs #7424) commit 7603abb10e6ae5877e6c819db74baa17b33abe6c Author: Kevin Morin <morin@codelutin.com> Date: Tue Aug 11 15:45:26 2015 +0200 fix NPE Summary of changes: .../src/main/xmi/faxtomail.properties | 5 +- faxtomail-persistence/src/main/xmi/faxtomail.zargo | Bin 31055 -> 32540 bytes .../services/service/ConfigurationService.java | 11 +- .../services/service/ConfigurationServiceImpl.java | 72 ++-- .../faxtomail/services/service/EmailService.java | 3 +- .../services/service/EmailServiceImpl.java | 14 +- .../services/service/InitFaxToMailServiceImpl.java | 29 +- .../services/service/LdapServiceImpl.java | 1 + .../services/service/MailFolderService.java | 3 + .../services/service/MailFolderServiceImpl.java | 20 +- .../services/service/ReferentielService.java | 4 + .../services/service/ReferentielServiceImpl.java | 15 + .../faxtomail/services/service/UserService.java | 4 + .../services/service/UserServiceImpl.java | 31 ++ .../services/service/ldap/LdapServiceMock.java | 2 + .../h2/V1_4_0_150811__add_pdf_editor_stamps.sql | 36 ++ .../h2/V1_4_0_150817__add_signings_to_users.sql | 19 + .../V1_4_0_150811__add_pdf_editor_stamps.sql | 39 ++ .../V1_4_0_150817__add_signings_to_users.sql | 19 + faxtomail-ui-swing/pom.xml | 5 + .../ui/swing/actions/EditAttachmentAction.java | 23 +- .../actions/GenerateAnnotatedAttachmentAction.java | 318 ++++++++++------ .../ui/swing/actions/OpenGroupedDemandAction.java | 13 +- ...FEditorLineUI.css => PDFEditorStampImageUI.css} | 11 +- ...ghlighterUI.jaxx => PDFEditorStampImageUI.jaxx} | 18 +- ...DFEditorNoteUI.css => PDFEditorStampTextUI.css} | 23 +- ...EditorNoteUI.jaxx => PDFEditorStampTextUI.jaxx} | 28 +- .../ui/swing/content/pdfeditor/PDFEditorUI.jaxx | 2 +- .../content/pdfeditor/PDFEditorUIHandler.java | 406 +++++++++++++++------ .../swing/content/pdfeditor/PDFEditorUIModel.java | 64 +++- .../ui/swing/content/reply/ReplyFormUI.css | 41 ++- .../ui/swing/content/reply/ReplyFormUI.jaxx | 43 ++- .../ui/swing/content/reply/ReplyFormUIHandler.java | 15 +- .../ui/swing/content/reply/ReplyFormUIModel.java | 13 + .../ui/swing/content/reply/SigningSettingsUI.css | 85 +++++ .../ui/swing/content/reply/SigningSettingsUI.jaxx | 100 +++++ .../content/reply/SigningSettingsUIHandler.java | 171 +++++++++ .../content/reply/SigningSettingsUIModel.java | 147 ++++++++ .../content/reply/actions/NewSigningAction.java | 84 +++++ .../reply/actions/OpenSigningSettingsAction.java | 72 ++++ .../{ => content/reply}/actions/ReplyAction.java | 4 +- .../content/reply/actions/SaveSigningAction.java | 73 ++++ .../reply/actions/SetDefaultSigningAction.java | 74 ++++ .../ui/swing/util/AbstractFaxToMailUIHandler.java | 2 +- .../i18n/faxtomail-ui-swing_fr_FR.properties | 16 + .../src/main/resources/icons/action-default.png | Bin 0 -> 670 bytes .../src/main/resources/icons/action-settings.png | Bin 0 -> 512 bytes .../src/main/resources/icons/stamp.png | Bin 0 -> 588 bytes .../web/action/admin/ConfigurationAction.java | 31 +- .../WEB-INF/content/admin/configuration-input.jsp | 202 +++++++--- .../src/main/webapp/js/configuration.js | 106 +++++- pom.xml | 8 +- 52 files changed, 2088 insertions(+), 437 deletions(-) create mode 100644 faxtomail-service/src/main/resources/db/migration/h2/V1_4_0_150811__add_pdf_editor_stamps.sql create mode 100644 faxtomail-service/src/main/resources/db/migration/h2/V1_4_0_150817__add_signings_to_users.sql create mode 100644 faxtomail-service/src/main/resources/db/migration/sqlserver/V1_4_0_150811__add_pdf_editor_stamps.sql create mode 100644 faxtomail-service/src/main/resources/db/migration/sqlserver/V1_4_0_150817__add_signings_to_users.sql copy faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/pdfeditor/{PDFEditorLineUI.css => PDFEditorStampImageUI.css} (87%) copy faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/pdfeditor/{PDFEditorHighlighterUI.jaxx => PDFEditorStampImageUI.jaxx} (72%) copy faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/pdfeditor/{PDFEditorNoteUI.css => PDFEditorStampTextUI.css} (76%) copy faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/pdfeditor/{PDFEditorNoteUI.jaxx => PDFEditorStampTextUI.jaxx} (69%) create mode 100644 faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/reply/SigningSettingsUI.css create mode 100644 faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/reply/SigningSettingsUI.jaxx create mode 100644 faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/reply/SigningSettingsUIHandler.java create mode 100644 faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/reply/SigningSettingsUIModel.java create mode 100644 faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/reply/actions/NewSigningAction.java create mode 100644 faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/reply/actions/OpenSigningSettingsAction.java rename faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/{ => content/reply}/actions/ReplyAction.java (94%) create mode 100644 faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/reply/actions/SaveSigningAction.java create mode 100644 faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/reply/actions/SetDefaultSigningAction.java create mode 100644 faxtomail-ui-swing/src/main/resources/icons/action-default.png create mode 100644 faxtomail-ui-swing/src/main/resources/icons/action-settings.png create mode 100644 faxtomail-ui-swing/src/main/resources/icons/stamp.png -- 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 http://git.codelutin.com/faxtomail.git commit 7603abb10e6ae5877e6c819db74baa17b33abe6c Author: Kevin Morin <morin@codelutin.com> Date: Tue Aug 11 15:45:26 2015 +0200 fix NPE --- .../franciaflex/faxtomail/ui/swing/util/AbstractFaxToMailUIHandler.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 bcac8f5..658b300 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 @@ -294,7 +294,7 @@ public abstract class AbstractFaxToMailUIHandler<M, UI extends FaxToMailUI<M, ?> result.setResizable(true); getContext().setSecondaryFrame(result); - final JFrame parentContainer = getParentContainer(JFrame.class); + final Frame parentContainer = getParentContainer(Frame.class); parentContainer.setEnabled(false); parentContainer.setFocusableWindowState(false); -- 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 http://git.codelutin.com/faxtomail.git commit 62c4ef1c6c3602c8fe6b6133d73090d08b35e175 Author: Kevin Morin <morin@codelutin.com> Date: Tue Aug 11 18:29:06 2015 +0200 modification du modèle (ajout des tampons) (refs #7424) --- .../src/main/xmi/faxtomail.properties | 6 +++- faxtomail-persistence/src/main/xmi/faxtomail.zargo | Bin 31055 -> 31814 bytes .../h2/V1_4_0_150811__add_pdf_editor_stamps.sql | 36 +++++++++++++++++++++ 3 files changed, 41 insertions(+), 1 deletion(-) diff --git a/faxtomail-persistence/src/main/xmi/faxtomail.properties b/faxtomail-persistence/src/main/xmi/faxtomail.properties index f101632..11ab35c 100644 --- a/faxtomail-persistence/src/main/xmi/faxtomail.properties +++ b/faxtomail-persistence/src/main/xmi/faxtomail.properties @@ -131,4 +131,8 @@ com.franciaflex.faxtomail.persistence.entities.MailLock.attribute.lockOn.tagvalu com.franciaflex.faxtomail.persistence.entities.MailLock.attribute.lockOn.stereotype=unique # BrandsForDomain -com.franciaflex.faxtomail.persistence.entities.BrandsForDomain.attribute.domainName.tagvalue.notNull=true \ No newline at end of file +com.franciaflex.faxtomail.persistence.entities.BrandsForDomain.attribute.domainName.tagvalue.notNull=true + +#Stamp +com.franciaflex.faxtomail.persistence.entities.Stamp.attribute.image.tagValue.hibernateAttributeType=binary +com.franciaflex.faxtomail.persistence.entities.Stamp.attribute.image.tagvalue.length=9999999 \ No newline at end of file diff --git a/faxtomail-persistence/src/main/xmi/faxtomail.zargo b/faxtomail-persistence/src/main/xmi/faxtomail.zargo index 6a304e1..e216944 100644 Binary files a/faxtomail-persistence/src/main/xmi/faxtomail.zargo and b/faxtomail-persistence/src/main/xmi/faxtomail.zargo differ diff --git a/faxtomail-service/src/main/resources/db/migration/h2/V1_4_0_150811__add_pdf_editor_stamps.sql b/faxtomail-service/src/main/resources/db/migration/h2/V1_4_0_150811__add_pdf_editor_stamps.sql new file mode 100644 index 0000000..991d174 --- /dev/null +++ b/faxtomail-service/src/main/resources/db/migration/h2/V1_4_0_150811__add_pdf_editor_stamps.sql @@ -0,0 +1,36 @@ +-- add pdf editor stamps + +create table STAMP ( + topiaId varchar(255) not null, + topiaVersion bigint not null, + topiaCreateDate timestamp, + name longvarchar, + description longvarchar, + image binary(9999999) not null, + text longvarchar not null, + primary key (topiaId) +); + +-- add association between mail folder and stamp + +create table MAILFOLDER_PDFEDITORSTAMPS ( + MAILFOLDER varchar(255) not null, + PDFEDITORSTAMPS varchar(255) not null +); + +alter table MAILFOLDER_PDFEDITORSTAMPS + add constraint FK_47041IYC9CUBBX7OB6E1B32QD + foreign key (MAILFOLDER) + references MAILFOLDER; + +alter table MAILFOLDER_PDFEDITORSTAMPS + add constraint FK_IL3874S78O4MA6YG1EONJ213D + foreign key (PDFEDITORSTAMPS) + references STAMP; + +CREATE INDEX idx_MAILFOLDER_PDFEDITORSTAMPS ON MAILFOLDER_PDFEDITORSTAMPS(MAILFOLDER); + +-- add useCurrentLevelPdfEditorStamps in mail folder + +alter table mailfolder add useCurrentLevelPdfEditorStamps boolean; +update mailfolder set useCurrentLevelPdfEditorStamps = 'f'; \ No newline at end of file -- 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 http://git.codelutin.com/faxtomail.git commit a7a1c9eb1bdb40a769dfe38a2fc956a8d45c20d5 Author: Kevin Morin <morin@codelutin.com> Date: Tue Aug 11 18:39:25 2015 +0200 ajout de la migration pour sqlserver (refs #7424) --- .../V1_4_0_150811__add_pdf_editor_stamps.sql | 39 ++++++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/faxtomail-service/src/main/resources/db/migration/sqlserver/V1_4_0_150811__add_pdf_editor_stamps.sql b/faxtomail-service/src/main/resources/db/migration/sqlserver/V1_4_0_150811__add_pdf_editor_stamps.sql new file mode 100644 index 0000000..0ab48bd --- /dev/null +++ b/faxtomail-service/src/main/resources/db/migration/sqlserver/V1_4_0_150811__add_pdf_editor_stamps.sql @@ -0,0 +1,39 @@ +-- add pdf editor stamps + +create table STAMP ( + topiaId varchar(255) not null, + topiaVersion bigint not null, + topiaCreateDate datetime2, + name varchar(MAX), + description varchar(MAX), + image varbinary(MAX) not null, + text varchar(MAX) not null, + primary key (topiaId) +); + +-- add association between mail folder and stamp + +create table MAILFOLDER_PDFEDITORSTAMPS ( + MAILFOLDER varchar(255) not null, + PDFEDITORSTAMPS varchar(255) not null +); + +alter table MAILFOLDER_PDFEDITORSTAMPS + add constraint FK_47041IYC9CUBBX7OB6E1B32QD + foreign key (MAILFOLDER) + references MAILFOLDER; + +alter table MAILFOLDER_PDFEDITORSTAMPS + add constraint FK_IL3874S78O4MA6YG1EONJ213D + foreign key (PDFEDITORSTAMPS) + references STAMP; + +CREATE INDEX idx_MAILFOLDER_PDFEDITORSTAMPS ON MAILFOLDER_PDFEDITORSTAMPS(MAILFOLDER); + +GO + +-- add useCurrentLevelPdfEditorStamps in mail folder + +alter table mailfolder add useCurrentLevelPdfEditorStamps bit; +GO +update mailfolder set useCurrentLevelPdfEditorStamps = 0; \ No newline at end of file -- 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 http://git.codelutin.com/faxtomail.git commit fd1d1085e3e53745a2eab50ceec04e19ba2d6291 Author: Kevin Morin <morin@codelutin.com> Date: Wed Aug 12 14:55:38 2015 +0200 début de l'interface d'admin (possibilité de créer des tampons texte seulement) (refs #7424) --- faxtomail-persistence/src/main/xmi/faxtomail.zargo | Bin 31814 -> 32024 bytes .../services/service/ConfigurationService.java | 11 +- .../services/service/ConfigurationServiceImpl.java | 72 +++++---- .../services/service/MailFolderServiceImpl.java | 2 +- .../services/service/ReferentielService.java | 4 + .../services/service/ReferentielServiceImpl.java | 8 + .../h2/V1_4_0_150811__add_pdf_editor_stamps.sql | 6 +- .../V1_4_0_150811__add_pdf_editor_stamps.sql | 6 +- .../web/action/admin/ConfigurationAction.java | 22 ++- .../WEB-INF/content/admin/configuration-input.jsp | 175 ++++++++++++++++----- .../src/main/webapp/js/configuration.js | 85 +++++++++- 11 files changed, 306 insertions(+), 85 deletions(-) diff --git a/faxtomail-persistence/src/main/xmi/faxtomail.zargo b/faxtomail-persistence/src/main/xmi/faxtomail.zargo index e216944..0ab28c0 100644 Binary files a/faxtomail-persistence/src/main/xmi/faxtomail.zargo and b/faxtomail-persistence/src/main/xmi/faxtomail.zargo differ diff --git a/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/ConfigurationService.java b/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/ConfigurationService.java index a27ee6d..f897299 100644 --- a/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/ConfigurationService.java +++ b/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/ConfigurationService.java @@ -33,6 +33,7 @@ import com.franciaflex.faxtomail.persistence.entities.FaxToMailUser; import com.franciaflex.faxtomail.persistence.entities.MailField; import com.franciaflex.faxtomail.persistence.entities.MailFilter; import com.franciaflex.faxtomail.persistence.entities.MailFolder; +import com.franciaflex.faxtomail.persistence.entities.Stamp; import com.franciaflex.faxtomail.persistence.entities.WaitingState; import com.franciaflex.faxtomail.services.FaxToMailService; @@ -49,8 +50,14 @@ public interface ConfigurationService extends FaxToMailService { List<MailFilter> getMailFilters(); - void save(Configuration configuration, List<DemandType> demandTypes, List<WaitingState> waitingStates, List<MailFolder> mailFolders, - List<MailFilter> mailFilters, List<EmailAccount> emailAccounts, List<BrandsForDomain> brandsForDomains); + void save(Configuration configuration, + List<DemandType> demandTypes, + List<Stamp> stamps, + List<WaitingState> waitingStates, + List<MailFolder> mailFolders, + List<MailFilter> mailFilters, + List<EmailAccount> emailAccounts, + List<BrandsForDomain> brandsForDomains); List<EmailAccount> getEmailAccountsWithoutPasswords(); diff --git a/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/ConfigurationServiceImpl.java b/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/ConfigurationServiceImpl.java index 4cdf20a..78b5ab3 100644 --- a/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/ConfigurationServiceImpl.java +++ b/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/ConfigurationServiceImpl.java @@ -24,35 +24,7 @@ package com.franciaflex.faxtomail.services.service; * #L% */ -import com.franciaflex.faxtomail.persistence.entities.BrandsForDomain; -import com.franciaflex.faxtomail.persistence.entities.BrandsForDomainImpl; -import com.franciaflex.faxtomail.persistence.entities.BrandsForDomainTopiaDao; -import com.franciaflex.faxtomail.persistence.entities.Configuration; -import com.franciaflex.faxtomail.persistence.entities.ConfigurationImpl; -import com.franciaflex.faxtomail.persistence.entities.ConfigurationTopiaDao; -import com.franciaflex.faxtomail.persistence.entities.DemandType; -import com.franciaflex.faxtomail.persistence.entities.DemandTypeImpl; -import com.franciaflex.faxtomail.persistence.entities.DemandTypeTopiaDao; -import com.franciaflex.faxtomail.persistence.entities.EmailAccount; -import com.franciaflex.faxtomail.persistence.entities.EmailAccountImpl; -import com.franciaflex.faxtomail.persistence.entities.EmailAccountTopiaDao; -import com.franciaflex.faxtomail.persistence.entities.EmailProtocol; -import com.franciaflex.faxtomail.persistence.entities.ExtensionCommand; -import com.franciaflex.faxtomail.persistence.entities.ExtensionCommandTopiaDao; -import com.franciaflex.faxtomail.persistence.entities.FaxToMailUser; -import com.franciaflex.faxtomail.persistence.entities.FaxToMailUserGroup; -import com.franciaflex.faxtomail.persistence.entities.FaxToMailUserTopiaDao; -import com.franciaflex.faxtomail.persistence.entities.GroupChef; -import com.franciaflex.faxtomail.persistence.entities.GroupChefTopiaDao; -import com.franciaflex.faxtomail.persistence.entities.MailField; -import com.franciaflex.faxtomail.persistence.entities.MailFilter; -import com.franciaflex.faxtomail.persistence.entities.MailFilterTopiaDao; -import com.franciaflex.faxtomail.persistence.entities.MailFolder; -import com.franciaflex.faxtomail.persistence.entities.MailFolderImpl; -import com.franciaflex.faxtomail.persistence.entities.MailFolderTopiaDao; -import com.franciaflex.faxtomail.persistence.entities.WaitingState; -import com.franciaflex.faxtomail.persistence.entities.WaitingStateImpl; -import com.franciaflex.faxtomail.persistence.entities.WaitingStateTopiaDao; +import com.franciaflex.faxtomail.persistence.entities.*; import com.franciaflex.faxtomail.services.FaxToMailServiceSupport; import com.google.common.base.Function; import com.google.common.collect.Lists; @@ -138,20 +110,28 @@ public class ConfigurationServiceImpl extends FaxToMailServiceSupport implements * * @param configuration configuration * @param demandTypes types de demande + * @param stamps tampons * @param waitingStates etat d'attentes * @param mailFolders mail folder * @param mailFilters mail filters * @param emailAccounts mail accounts */ @Override - public void save(Configuration configuration, List<DemandType> demandTypes, List<WaitingState> waitingStates, List<MailFolder> mailFolders, - List<MailFilter> mailFilters, List<EmailAccount> emailAccounts, List<BrandsForDomain> brandsForDomains) { + public void save(Configuration configuration, + List<DemandType> demandTypes, + List<Stamp> stamps, + List<WaitingState> waitingStates, + List<MailFolder> mailFolders, + List<MailFilter> mailFilters, + List<EmailAccount> emailAccounts, + List<BrandsForDomain> brandsForDomains) { Collection<MailFolder> toDeleteMailFolder = new ArrayList<>(); // sauvegarde saveConfiguration(configuration); saveDemandTypes(demandTypes); + saveStamps(stamps); Map<String, WaitingState> waitingStateCache = saveWaitingStates(waitingStates); Map<String, MailFolder> mailFolderCache = saveMailFolders(waitingStateCache, mailFolders, toDeleteMailFolder); saveMailFilters(mailFolderCache, mailFilters); @@ -196,6 +176,36 @@ public class ConfigurationServiceImpl extends FaxToMailServiceSupport implements } } + protected void saveStamps(List<Stamp> stamps) { + Binder<Stamp, Stamp> binderStamp = BinderFactory.newBinder(Stamp.class); + StampTopiaDao stampDao = getPersistenceContext().getStampDao(); + + List<Stamp> allStamps = stampDao.findAll(); + Map<String, Stamp> allStampsIndex = new HashMap<>(Maps.uniqueIndex(allStamps, TopiaEntities.getTopiaIdFunction())); + for (Stamp stamp : stamps) { + // get current etat attente + Stamp currentStamp; + if (StringUtils.isBlank(stamp.getTopiaId()) || stamp.getTopiaId().startsWith("new_")) { + currentStamp = new StampImpl(); + } else { + currentStamp = allStampsIndex.remove(stamp.getTopiaId()); + } + + // copy + binderStamp.copyExcluding(stamp, currentStamp, + Stamp.PROPERTY_TOPIA_ID, + Stamp.PROPERTY_TOPIA_CREATE_DATE, + Stamp.PROPERTY_TOPIA_VERSION); + + // persist + if (currentStamp.isPersisted()) { + stampDao.update(currentStamp); + } else { + stampDao.create(currentStamp); + } + } + } + /** * * @param waitingStates diff --git a/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/MailFolderServiceImpl.java b/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/MailFolderServiceImpl.java index c00ed91..847dc31 100644 --- a/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/MailFolderServiceImpl.java +++ b/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/MailFolderServiceImpl.java @@ -88,7 +88,7 @@ public class MailFolderServiceImpl extends FaxToMailServiceSupport implements Ma @Override public List<MailFolder> getAllMailFolders() { MailFolderTopiaDao dao = getPersistenceContext().getMailFolderDao(); - return new ArrayList<MailFolder>(dao.findAll()); + return new ArrayList<>(dao.findAll()); } @Override diff --git a/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/ReferentielService.java b/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/ReferentielService.java index ce166c5..72d58e3 100644 --- a/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/ReferentielService.java +++ b/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/ReferentielService.java @@ -31,6 +31,7 @@ import com.franciaflex.faxtomail.persistence.entities.MailFilter; import com.franciaflex.faxtomail.persistence.entities.MailFolder; import com.franciaflex.faxtomail.persistence.entities.Priority; import com.franciaflex.faxtomail.persistence.entities.Range; +import com.franciaflex.faxtomail.persistence.entities.Stamp; import com.franciaflex.faxtomail.persistence.entities.WaitingState; import com.franciaflex.faxtomail.services.FaxToMailService; @@ -48,6 +49,8 @@ public interface ReferentielService extends FaxToMailService { List<Range> getAllRange(); + List<Stamp> getAllStamps(); + List<WaitingState> getAllWaitingState(); Map<String, Long> getWaitingStatesUsage(); @@ -65,4 +68,5 @@ public interface ReferentielService extends FaxToMailService { List<Range> importRanges(InputStream inputStream); List<DemandType> importDemandTypes(InputStream inputStream); + } diff --git a/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/ReferentielServiceImpl.java b/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/ReferentielServiceImpl.java index 4058df3..f0bae47 100644 --- a/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/ReferentielServiceImpl.java +++ b/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/ReferentielServiceImpl.java @@ -38,6 +38,8 @@ import com.franciaflex.faxtomail.persistence.entities.Priority; import com.franciaflex.faxtomail.persistence.entities.PriorityTopiaDao; import com.franciaflex.faxtomail.persistence.entities.Range; import com.franciaflex.faxtomail.persistence.entities.RangeTopiaDao; +import com.franciaflex.faxtomail.persistence.entities.Stamp; +import com.franciaflex.faxtomail.persistence.entities.StampTopiaDao; import com.franciaflex.faxtomail.persistence.entities.WaitingState; import com.franciaflex.faxtomail.persistence.entities.WaitingStateTopiaDao; import com.franciaflex.faxtomail.services.FaxToMailServiceSupport; @@ -89,6 +91,12 @@ public class ReferentielServiceImpl extends FaxToMailServiceSupport implements R } @Override + public List<Stamp> getAllStamps() { + StampTopiaDao dao = getPersistenceContext().getStampDao(); + return dao.forAll().setOrderByArguments(Stamp.PROPERTY_LABEL).findAll(); + } + + @Override public List<WaitingState> getAllWaitingState() { WaitingStateTopiaDao dao = getPersistenceContext().getWaitingStateDao(); return dao.forAll().setOrderByArguments(WaitingState.PROPERTY_LABEL).findAll(); diff --git a/faxtomail-service/src/main/resources/db/migration/h2/V1_4_0_150811__add_pdf_editor_stamps.sql b/faxtomail-service/src/main/resources/db/migration/h2/V1_4_0_150811__add_pdf_editor_stamps.sql index 991d174..1fafc64 100644 --- a/faxtomail-service/src/main/resources/db/migration/h2/V1_4_0_150811__add_pdf_editor_stamps.sql +++ b/faxtomail-service/src/main/resources/db/migration/h2/V1_4_0_150811__add_pdf_editor_stamps.sql @@ -4,10 +4,10 @@ create table STAMP ( topiaId varchar(255) not null, topiaVersion bigint not null, topiaCreateDate timestamp, - name longvarchar, + label longvarchar, description longvarchar, - image binary(9999999) not null, - text longvarchar not null, + image binary(9999999), + text longvarchar, primary key (topiaId) ); diff --git a/faxtomail-service/src/main/resources/db/migration/sqlserver/V1_4_0_150811__add_pdf_editor_stamps.sql b/faxtomail-service/src/main/resources/db/migration/sqlserver/V1_4_0_150811__add_pdf_editor_stamps.sql index 0ab48bd..fe74f52 100644 --- a/faxtomail-service/src/main/resources/db/migration/sqlserver/V1_4_0_150811__add_pdf_editor_stamps.sql +++ b/faxtomail-service/src/main/resources/db/migration/sqlserver/V1_4_0_150811__add_pdf_editor_stamps.sql @@ -4,10 +4,10 @@ create table STAMP ( topiaId varchar(255) not null, topiaVersion bigint not null, topiaCreateDate datetime2, - name varchar(MAX), + label varchar(MAX), description varchar(MAX), - image varbinary(MAX) not null, - text varchar(MAX) not null, + image varbinary(MAX), + text varchar(MAX), primary key (topiaId) ); diff --git a/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/action/admin/ConfigurationAction.java b/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/action/admin/ConfigurationAction.java index 2f6ce52..317d64e 100644 --- a/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/action/admin/ConfigurationAction.java +++ b/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/action/admin/ConfigurationAction.java @@ -36,6 +36,7 @@ import com.franciaflex.faxtomail.persistence.entities.MailField; import com.franciaflex.faxtomail.persistence.entities.MailFilter; import com.franciaflex.faxtomail.persistence.entities.MailFolder; import com.franciaflex.faxtomail.persistence.entities.Range; +import com.franciaflex.faxtomail.persistence.entities.Stamp; import com.franciaflex.faxtomail.persistence.entities.WaitingState; import com.franciaflex.faxtomail.services.service.ConfigurationService; import com.franciaflex.faxtomail.services.service.MailFolderService; @@ -81,6 +82,8 @@ public class ConfigurationAction extends FaxToMailActionSupport implements Prepa protected List<DemandType> demandTypes; + protected List<Stamp> stamps; + protected List<Range> ranges; protected List<MailFolder> mailFolders; @@ -111,6 +114,7 @@ public class ConfigurationAction extends FaxToMailActionSupport implements Prepa waitingStates = referentielService.getAllWaitingState(); waitingStatesUsage = referentielService.getWaitingStatesUsage(); demandTypes = referentielService.getAllDemandType(); + stamps = referentielService.getAllStamps(); ranges = referentielService.getAllRange(); mailFolders = mailFolderService.getRootMailFolders(); mailFoldersUsage = mailFolderService.getMailFoldersUsage(); @@ -128,7 +132,14 @@ public class ConfigurationAction extends FaxToMailActionSupport implements Prepa public String execute() throws Exception { String result = super.execute(); - configurationService.save(configuration, demandTypes, waitingStates, mailFolders, mailFilters, emailAccounts, brandsForDomains); + configurationService.save(configuration, + demandTypes, + stamps, + waitingStates, + mailFolders, + mailFilters, + emailAccounts, + brandsForDomains); return result; } @@ -179,6 +190,15 @@ public class ConfigurationAction extends FaxToMailActionSupport implements Prepa this.demandTypes = getGson().fromJson(json, type); } + public List<Stamp> getStamps() { + return stamps; + } + + public void setStampsJson(String json) { + Type type = new TypeToken<List<Stamp>>() {}.getType(); + this.stamps = getGson().fromJson(json, type); + } + public List<Range> getRanges() { return ranges; } diff --git a/faxtomail-ui-web/src/main/webapp/WEB-INF/content/admin/configuration-input.jsp b/faxtomail-ui-web/src/main/webapp/WEB-INF/content/admin/configuration-input.jsp index f880720..541426b 100644 --- a/faxtomail-ui-web/src/main/webapp/WEB-INF/content/admin/configuration-input.jsp +++ b/faxtomail-ui-web/src/main/webapp/WEB-INF/content/admin/configuration-input.jsp @@ -44,6 +44,7 @@ 'waitingStates': <s:property value="toJson(waitingStates)" escapeHtml="false"/>, 'waitingStatesUsage': <s:property value="toJson(waitingStatesUsage)" escapeHtml="false"/>, 'demandTypes': <s:property value="toJson(demandTypes)" escapeHtml="false"/>, + 'stamps': <s:property value="toJson(stamps)" escapeHtml="false"/>, 'ranges': <s:property value="toJson(ranges)" escapeHtml="false"/>, 'mailFolders': <s:property value="toJson(mailFolders)" escapeHtml="false"/>, 'mailFoldersUsage': <s:property value="toJson(mailFoldersUsage)" escapeHtml="false"/>, @@ -75,6 +76,7 @@ <li class="active"><a href="#tabs-general" data-toggle="tab">Général</a></li> <li><a href="#tabs-waitingState" data-toggle="tab">États d'attente</a></li> <li><a href="#tabs-demandType" data-toggle="tab">Types de demandes</a></li> + <li><a href="#tabs-stamps" data-toggle="tab">Tampons</a></li> <li><a href="#tabs-tree" data-toggle="tab">Arborescence</a></li> <li><a href="#tabs-filters" data-toggle="tab">Filtres de mail</a></li> <li><a href="#tabs-search" data-toggle="tab">Recherche</a></li> @@ -230,6 +232,41 @@ </div> </div> + + <div id="tabs-stamps" class="tab-pane" ng-controller="ConfigurationStampsController"> + <input type="hidden" name="stampsJson" value="{{stamps}}" /> + + <div class="row"> + <div class="col-md-4"> + <h3>Tampon <input type="button" class="btn btn-success btn-xs pull-right" value="Nouveau" ng-click="newStamp()" /></h3> + <table class="table table-hover"> + <tbody> + <tr ng-repeat="stamp in stamps" + ng-class="{'info' : stamp == selectedStamp}" + ng-click="editStamp(stamp)"> + <td>{{stamp.label}}</td> + </tr> + </tbody> + </table> + </div> + + <div class="col-md-8" ng-if="selectedStamp"> + <h3>Édition du tampon {{selectedStamp.label}}</h3> + <div class="form-group"> + <label>Description :</label> + <textarea name="description" class="form-control" ng-model="selectedStamp.description"></textarea> + </div> + <div class="form-group"> + <label>Texte :</label> + <textarea name="text" class="form-control" ng-model="selectedStamp.text"></textarea> + </div> + </div> + <div class="col-md-8" ng-if="!selectedStamp"> + <em>Sélectionnez un tampon.</em> + </div> + </div> + + </div> <div id="tabs-tree" class="tab-pane" ng-controller="ConfigurationTreeController"> <input type="hidden" name="mailFoldersJson" value="{{mailFolders}}" /> @@ -601,27 +638,31 @@ </div> <div id="collapse3" class="panel-collapse collapse"> <div class="panel-body"> - <label ng-if="selectedMailFolder.$parent"> - <input type="radio" ng-model="selectedMailFolder.useCurrentLevelWaitingState" - ng-value="false" ng-change="initFolderWaitingState()" /> - Hériter des états d'attente déclarés sur les dossiers parent : - </label> - <div class="checkbox" ng-repeat="waitingState in waitingStates" ng-if="selectedMailFolder.$parent && !selectedMailFolder.useCurrentLevelWaitingState"> - <label> - <input type="checkbox" ng-checked="parentScopeValues.waitingStates.containsByTopiaId(waitingState)" - disabled> {{waitingState.label}} + <div> + <label ng-if="selectedMailFolder.$parent"> + <input type="radio" ng-model="selectedMailFolder.useCurrentLevelWaitingState" + ng-value="false" ng-change="initFolderWaitingState()" /> + Hériter des états d'attente déclarés sur les dossiers parent : </label> + <div class="checkbox" ng-repeat="waitingState in waitingStates" ng-if="selectedMailFolder.$parent && !selectedMailFolder.useCurrentLevelWaitingState"> + <label> + <input type="checkbox" ng-checked="parentScopeValues.waitingStates.containsByTopiaId(waitingState)" + disabled> {{waitingState.label}} + </label> + </div> </div> - <label> - <input type="radio" ng-model="selectedMailFolder.useCurrentLevelWaitingState" ng-value="true" - ng-change="initFolderWaitingState()" ng-if="selectedMailFolder.$parent" /> - Définir les états d'attente pour ce dossier : - </label> - <div class="checkbox" ng-repeat="waitingState in waitingStates" ng-if="selectedMailFolder.useCurrentLevelWaitingState || !selectedMailFolder.$parent"> + <div> <label> - <input type="checkbox" ng-checked="selectedMailFolder.waitingStates.containsByTopiaId(waitingState)" - ng-click="changeFolderWaitingState(waitingState)"> {{waitingState.label}} + <input type="radio" ng-model="selectedMailFolder.useCurrentLevelWaitingState" ng-value="true" + ng-change="initFolderWaitingState()" ng-if="selectedMailFolder.$parent" /> + Définir les états d'attente pour ce dossier : </label> + <div class="checkbox" ng-repeat="waitingState in waitingStates" ng-if="selectedMailFolder.useCurrentLevelWaitingState || !selectedMailFolder.$parent"> + <label> + <input type="checkbox" ng-checked="selectedMailFolder.waitingStates.containsByTopiaId(waitingState)" + ng-click="changeFolderWaitingState(waitingState)"> {{waitingState.label}} + </label> + </div> </div> </div> </div> @@ -638,32 +679,78 @@ </div> <div id="collapse4" class="panel-collapse collapse"> <div class="panel-body"> - <label ng-if="selectedMailFolder.$parent"> - <input type="radio" ng-model="selectedMailFolder.useCurrentLevelDemandType" - ng-value="false" ng-change="initFolderDemandTypes()" /> - Hériter des types de demande déclarés sur les dossiers parent : - </label> - <div class="checkbox" ng-repeat="demandType in demandTypes" ng-if="selectedMailFolder.$parent && !selectedMailFolder.useCurrentLevelDemandType"> + <div> + <label ng-if="selectedMailFolder.$parent"> + <input type="radio" ng-model="selectedMailFolder.useCurrentLevelDemandType" + ng-value="false" ng-change="initFolderDemandTypes()" /> + Hériter des types de demande déclarés sur les dossiers parent : + </label> + <div class="checkbox" ng-repeat="demandType in demandTypes" ng-if="selectedMailFolder.$parent && !selectedMailFolder.useCurrentLevelDemandType"> + <label> + <input type="checkbox" ng-checked="parentScopeValues.demandTypes.containsByTopiaId(demandType)" + disabled> {{demandType.label}} + </label> + </div> + </div> + <div> <label> - <input type="checkbox" ng-checked="parentScopeValues.demandTypes.containsByTopiaId(demandType)" - disabled> {{demandType.label}} + <input type="radio" ng-model="selectedMailFolder.useCurrentLevelDemandType" ng-value="true" + ng-change="initFolderDemandTypes()" ng-if="selectedMailFolder.$parent" /> + Définir les types de demande pour ce dossier : </label> + <div class="checkbox" ng-repeat="demandType in demandTypes" ng-if="selectedMailFolder.useCurrentLevelDemandType || !selectedMailFolder.$parent"> + <label> + <input type="checkbox" ng-checked="selectedMailFolder.demandTypes.containsByTopiaId(demandType)" + ng-click="changeFolderDemandType(demandType)"> {{demandType.label}} + </label> + </div> </div> - <label> - <input type="radio" ng-model="selectedMailFolder.useCurrentLevelDemandType" ng-value="true" - ng-change="initFolderDemandTypes()" ng-if="selectedMailFolder.$parent" /> - Définir les types de demande pour ce dossier : - </label> - <div class="checkbox" ng-repeat="demandType in demandTypes" ng-if="selectedMailFolder.useCurrentLevelDemandType || !selectedMailFolder.$parent"> + </div> + </div> + </div> + + <!-- Sélection des tampons possibles pour ce dossier --> + <div class="panel panel-default"> + <div class="panel-heading"> + <h4 class="panel-title"> + <a data-toggle="collapse" data-parent="#accordion" href="#collapseStamps"> + Sélection des tampons possibles pour ce dossier + </a> + </h4> + </div> + <div id="collapseStamps" class="panel-collapse collapse"> + <div class="panel-body"> + <div> + <label ng-if="selectedMailFolder.$parent"> + <input type="radio" ng-model="selectedMailFolder.useCurrentLevelPdfEditorStamps" + ng-value="false" ng-change="initFolderPdfEditorStamps()" /> + Hériter des tampons déclarés sur les dossiers parent : + </label> + <div class="checkbox" ng-repeat="stamp in stamps" ng-if="selectedMailFolder.$parent && !selectedMailFolder.useCurrentLevelPdfEditorStamps"> + <label> + <input type="checkbox" ng-checked="parentScopeValues.pdfEditorStamps.containsByTopiaId(stamp)" + disabled> {{stamp.label}} + </label> + </div> + </div> + <div> <label> - <input type="checkbox" ng-checked="selectedMailFolder.demandTypes.containsByTopiaId(demandType)" - ng-click="changeFolderDemandType(demandType)"> {{demandType.label}} + <input type="radio" ng-model="selectedMailFolder.useCurrentLevelPdfEditorStamps" ng-value="true" + ng-change="initPdfEditorStamps()" ng-if="selectedMailFolder.$parent" /> + Définir les tampons pour ce dossier : </label> + <div class="checkbox" ng-repeat="stamp in stamps" ng-if="selectedMailFolder.useCurrentLevelPdfEditorStamps || !selectedMailFolder.$parent"> + <label> + <input type="checkbox" ng-checked="selectedMailFolder.pdfEditorStamps.containsByTopiaId(stamp)" + ng-click="changeFolderPdfEditorStamp(stamp)"> {{stamp.label}} + </label> + </div> </div> </div> </div> </div> - + + <!-- Sélection des gammes possibles pour ce dossier --> <div class="panel panel-default"> <div class="panel-heading"> @@ -675,16 +762,18 @@ </div> <div id="collapse5" class="panel-collapse collapse"> <div class="panel-body"> - <label ng-if="selectedMailFolder.$parent"> - <input type="radio" ng-model="selectedMailFolder.useCurrentLevelRange" - ng-value="false" ng-change="initFolderRanges()" /> - Hériter des gammes déclarées sur les dossiers parent : - </label> - <div class="checkbox" ng-repeat="range in ranges" ng-if="selectedMailFolder.$parent && !selectedMailFolder.useCurrentLevelRange"> - <label> - <input type="checkbox" ng-checked="parentScopeValues.ranges.containsByTopiaId(range)" - disabled> {{range.label}} + <div> + <label ng-if="selectedMailFolder.$parent"> + <input type="radio" ng-model="selectedMailFolder.useCurrentLevelRange" + ng-value="false" ng-change="initFolderRanges()" /> + Hériter des gammes déclarées sur les dossiers parent : </label> + <div class="checkbox" ng-repeat="range in ranges" ng-if="selectedMailFolder.$parent && !selectedMailFolder.useCurrentLevelRange"> + <label> + <input type="checkbox" ng-checked="parentScopeValues.ranges.containsByTopiaId(range)" + disabled> {{range.label}} + </label> + </div> </div> <div> <label> diff --git a/faxtomail-ui-web/src/main/webapp/js/configuration.js b/faxtomail-ui-web/src/main/webapp/js/configuration.js index a51a010..db22c09 100644 --- a/faxtomail-ui-web/src/main/webapp/js/configuration.js +++ b/faxtomail-ui-web/src/main/webapp/js/configuration.js @@ -43,6 +43,8 @@ ConfigurationModule.controller('ConfigurationController', ['$scope', 'Configurat $scope.ranges = ConfigurationData.ranges; //{Array} les types de documents $scope.demandTypes = ConfigurationData.demandTypes; + //{Array} les tampons + $scope.stamps = ConfigurationData.stamps; //{Array} mail folders $scope.mailFolders = ConfigurationData.mailFolders; // {Map} Mail folder usage @@ -306,7 +308,7 @@ ConfigurationModule.controller('ConfigurationDemandTypeController', ['$scope', ' } }; - // ajout d'un nouvel etat d'attente + // ajout d'un nouveau type de demande $scope.newDemandType = function() { var label = $window.prompt("Nom du nouveau type de document ?"); if (label) { @@ -340,6 +342,58 @@ ConfigurationModule.controller('ConfigurationDemandTypeController', ['$scope', ' }; }]); +/** + * Stamps tab controller. + */ +ConfigurationModule.controller('ConfigurationStampsController', ['$scope', '$window', 'ConfigurationData', + function($scope, $window, ConfigurationData) { + //{Object} tampon selectionné + $scope.selectedStamp; + + // edition d'un tampon + $scope.editStamp = function(stamp) { + $scope.selectedStamp = stamp; + +// // initialize le tableau d'action si vide +// if (!$scope.selectedStamp.requiredFields) { +// $scope.selectedDemandType.requiredFields = []; +// } + }; + + // ajout d'un nouveau tampon + $scope.newStamp = function() { + var label = $window.prompt("Nom du nouveau tampon ?"); + if (label) { + // auto select new etat + var newStamp = { + topiaId : "new_" + guid(), + label: label + }; + + // check if already exists + if ($scope.stamps.indexOfBy('label', newStamp) != -1) { + $window.alert("Ce tampon existe déjà !"); + } else { + $scope.stamps.push(newStamp); + + // auto select + $scope.editStamp(newStamp); + } + } + }; + +// // selection/deselection d'un champ +// $scope.changeDemandTypeField = function(mailField) { +// +// var index = $scope.selectedDemandType.requiredFields.indexOf(mailField); +// if (index != -1) { +// $scope.selectedDemandType.requiredFields.splice(index, 1); +// } else { +// $scope.selectedDemandType.requiredFields.push(mailField); +// } +// }; +}]); + /** * Mail folder tab controller. @@ -525,6 +579,9 @@ ConfigurationModule.controller('ConfigurationTreeController', ['$scope', '$windo if (!$scope.selectedMailFolder.demandTypes) { $scope.selectedMailFolder.demandTypes = []; } + if (!$scope.selectedMailFolder.pdfEditorStamps) { + $scope.selectedMailFolder.pdfEditorStamps = []; + } if (!$scope.selectedMailFolder.ranges) { $scope.selectedMailFolder.ranges = []; } @@ -613,6 +670,8 @@ ConfigurationModule.controller('ConfigurationTreeController', ['$scope', '$windo folderTableColumns: [], waitingStates: [], demandTypes: [], + stamps: [], + pdfEditorStamps: [], ranges: [], //rigths readRightUsers: [], @@ -716,6 +775,9 @@ ConfigurationModule.controller('ConfigurationTreeController', ['$scope', '$windo if ((!$scope.parentScopeValues.demandTypes || $scope.parentScopeValues.demandTypes.length == 0) && folder.demandTypes) { $scope.parentScopeValues.demandTypes = folder.demandTypes; } + if ((!$scope.parentScopeValues.pdfEditorStamps || $scope.parentScopeValues.pdfEditorStamps.length == 0) && folder.pdfEditorStamps) { + $scope.parentScopeValues.pdfEditorStamps = folder.pdfEditorStamps; + } if ((!$scope.parentScopeValues.ranges || $scope.parentScopeValues.ranges.length == 0) && folder.ranges) { $scope.parentScopeValues.ranges = folder.ranges; } @@ -923,6 +985,27 @@ ConfigurationModule.controller('ConfigurationTreeController', ['$scope', '$windo } }; + // initialise la liste des tampons avec celle des niveaux supérieurs + $scope.initFolderPdfEditorStamps = function() { + if ($scope.selectedMailFolder.useCurrentLevelPdfEditorStamps) { + if ($scope.parentScopeValues.pdfEditorStamps) { + $scope.selectedMailFolder.pdfEditorStamps = $scope.parentScopeValues.pdfEditorStamps.slice(); // soft copy + } + } else { + delete $scope.selectedMailFolder.pdfEditorStamps; + } + }; + + // selection/deselection d'un tampon possible pour ce dossier + $scope.changeFolderPdfEditorStamp = function(pdfEditorStamp) { + var index = $scope.selectedMailFolder.pdfEditorStamps.indexOfByTopiaId(pdfEditorStamp); + if (index != -1) { + $scope.selectedMailFolder.pdfEditorStamps.splice(index, 1); + } else { + $scope.selectedMailFolder.pdfEditorStamps.push(pdfEditorStamp); + } + }; + // initialise la liste des gammes avec celle des niveaux supérieurs $scope.initFolderRanges = function() { if ($scope.selectedMailFolder.useCurrentLevelRange) { -- 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 http://git.codelutin.com/faxtomail.git commit 37d8f5bc7e5faf3c28a89a03b4b29e5b7282dd14 Author: Kevin Morin <morin@codelutin.com> Date: Wed Aug 12 18:03:17 2015 +0200 Ajout des tampons dans l'éditeur de pdf (seulement type texte) (refs #7424) --- .../services/service/MailFolderService.java | 3 + .../services/service/MailFolderServiceImpl.java | 18 ++ .../ui/swing/actions/EditAttachmentAction.java | 23 +- .../actions/GenerateAnnotatedAttachmentAction.java | 318 +++++++++++++-------- .../content/pdfeditor/PDFEditorStampTextUI.css | 47 +++ .../content/pdfeditor/PDFEditorStampTextUI.jaxx | 74 +++++ .../ui/swing/content/pdfeditor/PDFEditorUI.jaxx | 2 +- .../content/pdfeditor/PDFEditorUIHandler.java | 125 ++++++-- .../swing/content/pdfeditor/PDFEditorUIModel.java | 49 +++- .../src/main/resources/icons/stamp.png | Bin 0 -> 588 bytes 10 files changed, 492 insertions(+), 167 deletions(-) diff --git a/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/MailFolderService.java b/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/MailFolderService.java index 94d126c..fa4ac0d 100644 --- a/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/MailFolderService.java +++ b/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/MailFolderService.java @@ -28,6 +28,7 @@ import com.franciaflex.faxtomail.persistence.entities.Email; import com.franciaflex.faxtomail.persistence.entities.FaxToMailUser; import com.franciaflex.faxtomail.persistence.entities.MailFilter; import com.franciaflex.faxtomail.persistence.entities.MailFolder; +import com.franciaflex.faxtomail.persistence.entities.Stamp; import com.franciaflex.faxtomail.persistence.entities.WaitingState; import com.franciaflex.faxtomail.services.FaxToMailService; @@ -66,4 +67,6 @@ public interface MailFolderService extends FaxToMailService { MailFolder getMailFolder(String topiaId); MailFilter findMailFilter(Email email, Set<String> modifiedProperties, List<Address> recipients); + + Collection<Stamp> getPdfEditorStamps(String mailFolderId); } diff --git a/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/MailFolderServiceImpl.java b/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/MailFolderServiceImpl.java index 847dc31..13c7b87 100644 --- a/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/MailFolderServiceImpl.java +++ b/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/MailFolderServiceImpl.java @@ -31,6 +31,7 @@ import com.franciaflex.faxtomail.persistence.entities.MailFilter; import com.franciaflex.faxtomail.persistence.entities.MailFilterTopiaDao; import com.franciaflex.faxtomail.persistence.entities.MailFolder; import com.franciaflex.faxtomail.persistence.entities.MailFolderTopiaDao; +import com.franciaflex.faxtomail.persistence.entities.Stamp; import com.franciaflex.faxtomail.persistence.entities.WaitingState; import com.franciaflex.faxtomail.services.FaxToMailServiceSupport; import org.apache.commons.collections4.CollectionUtils; @@ -353,5 +354,22 @@ public class MailFolderServiceImpl extends FaxToMailServiceSupport implements Ma return filter; } + @Override + public Collection<Stamp> getPdfEditorStamps(String mailFolderId) { + MailFolder folder = getMailFolder(mailFolderId); + while (folder != null && !folder.isUseCurrentLevelPdfEditorStamps()) { + folder = folder.getParent(); + } + Collection<Stamp> pdfEditorStamps; + if (folder != null) { + pdfEditorStamps = folder.getPdfEditorStamps(); + Hibernate.initialize(pdfEditorStamps); + + } else { + pdfEditorStamps = null; + } + + return pdfEditorStamps; + } } diff --git a/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/EditAttachmentAction.java b/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/EditAttachmentAction.java index 8df83b6..c969411 100644 --- a/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/EditAttachmentAction.java +++ b/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/EditAttachmentAction.java @@ -25,6 +25,9 @@ package com.franciaflex.faxtomail.ui.swing.actions; */ import com.franciaflex.faxtomail.persistence.entities.Attachment; +import com.franciaflex.faxtomail.persistence.entities.MailFolder; +import com.franciaflex.faxtomail.persistence.entities.Stamp; +import com.franciaflex.faxtomail.services.service.MailFolderService; import com.franciaflex.faxtomail.ui.swing.content.MainUI; import com.franciaflex.faxtomail.ui.swing.content.attachment.AttachmentEditorUI; import com.franciaflex.faxtomail.ui.swing.content.attachment.AttachmentEditorUIHandler; @@ -36,6 +39,7 @@ import com.franciaflex.faxtomail.ui.swing.util.FaxToMailUIUtil; import javax.swing.*; import java.awt.event.WindowAdapter; import java.awt.event.WindowEvent; +import java.util.Collection; import static org.nuiton.i18n.I18n.t; @@ -46,7 +50,7 @@ import static org.nuiton.i18n.I18n.t; public class EditAttachmentAction extends AbstractFaxToMailAction<AttachmentEditorUIModel, AttachmentEditorUI, AttachmentEditorUIHandler> { protected Attachment attachment; - protected PDFEditorUI dialogContent; + protected Collection<Stamp> stamps; protected JFrame frame; public EditAttachmentAction(AttachmentEditorUIHandler handler, Attachment attachment) { @@ -59,18 +63,22 @@ public class EditAttachmentAction extends AbstractFaxToMailAction<AttachmentEdit @Override public void doAction() throws Exception { getModel().fireAttachmentOpened(attachment, false); - FaxToMailUIUtil.forceAttachmentFileLoading(getContext(), attachment); - - dialogContent = new PDFEditorUI(getUI()); - PDFEditorUIModel pdfEditorUIModel = dialogContent.getModel(); - pdfEditorUIModel.fromEntity(attachment); - pdfEditorUIModel.setDemand(getContext().getCurrentEmail()); + MailFolder mailFolder = attachment.getEmail().getMailFolder(); + MailFolderService mailFolderService = getContext().newServiceContext().getMailFolderService(); + stamps = mailFolderService.getPdfEditorStamps(mailFolder.getTopiaId()); } @Override public void postSuccessAction() { super.postSuccessAction(); + + final PDFEditorUI dialogContent = new PDFEditorUI(getUI()); + PDFEditorUIModel pdfEditorUIModel = dialogContent.getModel(); + pdfEditorUIModel.fromEntity(attachment); + pdfEditorUIModel.setDemand(getContext().getCurrentEmail()); + pdfEditorUIModel.setStamps(stamps); + MainUI mainUI = getContext().getMainUI(); frame = getHandler().openFrame(dialogContent, attachment.getOriginalFileName(), mainUI.getSize()); @@ -94,5 +102,6 @@ public class EditAttachmentAction extends AbstractFaxToMailAction<AttachmentEdit } } }); + stamps = null; } } diff --git a/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/GenerateAnnotatedAttachmentAction.java b/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/GenerateAnnotatedAttachmentAction.java index a8f4279..92188eb 100644 --- a/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/GenerateAnnotatedAttachmentAction.java +++ b/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/GenerateAnnotatedAttachmentAction.java @@ -31,6 +31,7 @@ import com.franciaflex.faxtomail.ui.swing.content.pdfeditor.PDFEditorCrossUI; import com.franciaflex.faxtomail.ui.swing.content.pdfeditor.PDFEditorHighlighterUI; import com.franciaflex.faxtomail.ui.swing.content.pdfeditor.PDFEditorLineUI; import com.franciaflex.faxtomail.ui.swing.content.pdfeditor.PDFEditorNoteUI; +import com.franciaflex.faxtomail.ui.swing.content.pdfeditor.PDFEditorStampTextUI; import com.franciaflex.faxtomail.ui.swing.content.pdfeditor.PDFEditorUI; import com.franciaflex.faxtomail.ui.swing.content.pdfeditor.PDFEditorUIHandler; import com.franciaflex.faxtomail.ui.swing.content.pdfeditor.PDFEditorUIModel; @@ -56,6 +57,7 @@ import java.io.BufferedInputStream; import java.io.File; import java.io.FileInputStream; import java.io.FileOutputStream; +import java.io.IOException; import java.io.InputStream; import static org.nuiton.i18n.I18n.t; @@ -95,156 +97,232 @@ public class GenerateAnnotatedAttachmentAction extends AbstractFaxToMailAction<P float zoom = model.getZoom(); int rotation = model.getRotation(); + for (int i = 1 ; i <= pageNb ; i++) { + PdfContentByte cb = pdfStamper.getOverContent(i); - for (int i = 0 ; i < pageNb ; i++) { - PdfContentByte cb = pdfStamper.getOverContent(i + 1); + PDFEditorUIModel.Page page = model.getPage(i); - for (PDFEditorNoteUI note : model.getPages()[i].getNotes()) { + for (PDFEditorNoteUI note : page.getNotes()) { + addNoteToPdf(zoom, rotation, cb, note); + } - int[] coordinates = computeCoordinates(note, rotation, zoom); - int width = coordinates[0]; - int height = coordinates[1]; - int x = coordinates[2]; - int y = coordinates[3]; + for (PDFEditorCrossUI panel : page.getCrosses()) { + addCrossToPdf(zoom, rotation, cb, panel); + } - Insets insets = note.getInsets(); + for (PDFEditorLineUI panel : page.getLines()) { + addLineToPdf(zoom, rotation, cb, panel); + } - cb.saveState(); - cb.setColorFill(BaseColor.YELLOW); - cb.rectangle(x, y, width, height); - cb.fill(); - cb.restoreState(); + for (PDFEditorHighlighterUI panel : page.getHighlighters()) { + addHighlightToPdf(zoom, rotation, cb, panel); + } - cb.saveState(); - JTextArea textArea = note.getNoteText(); - float fontSize = textArea.getFont().getSize2D() / zoom; - BaseFont titleFont = BaseFont.createFont(BaseFont.HELVETICA_OBLIQUE, BaseFont.WINANSI, BaseFont.NOT_EMBEDDED); - BaseFont font = BaseFont.createFont(BaseFont.HELVETICA, BaseFont.WINANSI, BaseFont.NOT_EMBEDDED); + for (PDFEditorStampTextUI panel : page.getStamps()) { + addStampToPdf(zoom, rotation, cb, panel); + } + } - String text = note.getText(); - String[] rows = text.split("\n"); - int rowHeight = (int) ((textArea.getHeight() / rows.length) / zoom); + pdfStamper.close(); + pdfReader.close(); + + // convert content to blob + InputStream is = new BufferedInputStream(new FileInputStream(target)); + FaxToMailServiceContext serviceContext = getContext().newServiceContext(); + AttachmentFile attachmentFileNew = serviceContext.getEmailService().getAttachmentFileFromStream(is); + attachmentFileNew.setRotation(rotation); + String fileName = model.getOriginalFile().getFilename(); + attachmentFileNew.setFilename(FaxToMailUIUtil.getEditedFileName(fileName)); + model.setEditedFile(attachmentFileNew); + } - int xxx = x; - int yyy = y; - if (rotation == 0) { - xxx += insets.left; - yyy += height - rowHeight - insets.top / zoom; + protected void addHighlightToPdf(float zoom, int rotation, PdfContentByte cb, PDFEditorHighlighterUI panel) { + int[] coordinates = computeCoordinates(panel, rotation, zoom); + int width = coordinates[0]; + int height = coordinates[1]; + int x = coordinates[2]; + int y = coordinates[3]; + + cb.saveState(); + PdfGState gs1 = new PdfGState(); + gs1.setFillOpacity(0.4f); + cb.setGState(gs1); + + cb.setColorFill(BaseColor.YELLOW); + cb.rectangle(x, y, width, height); + cb.fill(); + cb.restoreState(); + } - } else if (rotation == 90) { - xxx += rowHeight + insets.top / zoom; - yyy += insets.left; + protected void addLineToPdf(float zoom, int rotation, PdfContentByte cb, PDFEditorLineUI panel) { + int[] coordinates = computeCoordinates(panel, rotation, zoom); + int width = coordinates[0]; + int height = coordinates[1]; + int x = coordinates[2]; + int y = coordinates[3]; - } else if (rotation == 180) { - xxx += width - insets.right / zoom; - yyy += rowHeight - insets.top / zoom; + if (rotation % 180 == 0 ^ !panel.isHorizontal()) { + y += height / 2; + } else { + x += width / 2; + } - } else if (rotation == 270) { - xxx += width - rowHeight - insets.left / zoom; - yyy += height - insets.top / zoom; - } + cb.saveState(); + cb.setColorStroke(BaseColor.BLUE); + cb.moveTo(x, y); + if (rotation % 180 == 0 ^ !panel.isHorizontal()) { + cb.lineTo(x + width, y); + } else { + cb.lineTo(x, y + height); + } + cb.stroke(); + cb.restoreState(); + } - showTextAligned(cb, note.getTitle(), xxx, yyy, rotation, titleFont, fontSize); + protected void addCrossToPdf(float zoom, int rotation, PdfContentByte cb, PDFEditorCrossUI panel) { + int[] coordinates = computeCoordinates(panel, rotation, zoom); + int width = coordinates[0]; + int height = coordinates[1]; + int x = coordinates[2]; + int y = coordinates[3]; + + cb.saveState(); + cb.setColorStroke(BaseColor.BLUE); + cb.moveTo(x, y); + cb.lineTo(x + width, y + height); + cb.stroke(); + cb.moveTo(x + width, y); + cb.lineTo(x, y + height); + cb.stroke(); + cb.restoreState(); + } - for (String s : rows) { - if (s.isEmpty()) { - s = " "; - } - if (rotation == 0) { - yyy -= rowHeight; + protected void addNoteToPdf(float zoom, int rotation, PdfContentByte cb, PDFEditorNoteUI note) throws DocumentException, IOException { + int[] coordinates = computeCoordinates(note, rotation, zoom); + int width = coordinates[0]; + int height = coordinates[1]; + int x = coordinates[2]; + int y = coordinates[3]; + + Insets insets = note.getInsets(); + + cb.saveState(); + cb.setColorFill(BaseColor.YELLOW); + cb.rectangle(x, y, width, height); + cb.fill(); + cb.restoreState(); + + cb.saveState(); + JTextArea textArea = note.getNoteText(); + float fontSize = textArea.getFont().getSize2D() / zoom; + BaseFont titleFont = BaseFont.createFont(BaseFont.HELVETICA_OBLIQUE, BaseFont.WINANSI, BaseFont.NOT_EMBEDDED); + BaseFont font = BaseFont.createFont(BaseFont.HELVETICA, BaseFont.WINANSI, BaseFont.NOT_EMBEDDED); + + String text = note.getText(); + String[] rows = text.split("\n"); + int rowHeight = (int) ((textArea.getHeight() / rows.length) / zoom); + + int xxx = x; + int yyy = y; + if (rotation == 0) { + xxx += insets.left; + yyy += height - rowHeight - insets.top / zoom; - } else if (rotation == 90) { - xxx += rowHeight; + } else if (rotation == 90) { + xxx += rowHeight + insets.top / zoom; + yyy += insets.left; - } else if (rotation == 180) { - yyy += rowHeight; + } else if (rotation == 180) { + xxx += width - insets.right / zoom; + yyy += rowHeight - insets.top / zoom; - } else if (rotation == 270) { - xxx -= rowHeight; - } - showTextAligned(cb, s, xxx, yyy, rotation, font, fontSize); - } + } else if (rotation == 270) { + xxx += width - rowHeight - insets.left / zoom; + yyy += height - insets.top / zoom; + } - cb.restoreState(); + showTextAligned(cb, note.getTitle(), xxx, yyy, rotation, titleFont, fontSize); + for (String s : rows) { + if (s.isEmpty()) { + s = " "; } + if (rotation == 0) { + yyy -= rowHeight; - for (PDFEditorCrossUI panel : model.getPages()[i].getCrosses()) { - - int[] coordinates = computeCoordinates(panel, rotation, zoom); - int width = coordinates[0]; - int height = coordinates[1]; - int x = coordinates[2]; - int y = coordinates[3]; - - cb.saveState(); - cb.setColorStroke(BaseColor.BLUE); - cb.moveTo(x, y); - cb.lineTo(x + width, y + height); - cb.stroke(); - cb.moveTo(x + width, y); - cb.lineTo(x, y + height); - cb.stroke(); - cb.restoreState(); + } else if (rotation == 90) { + xxx += rowHeight; + + } else if (rotation == 180) { + yyy += rowHeight; + + } else if (rotation == 270) { + xxx -= rowHeight; } + showTextAligned(cb, s, xxx, yyy, rotation, font, fontSize); + } + + cb.restoreState(); + } + + protected void addStampToPdf(float zoom, int rotation, PdfContentByte cb, PDFEditorStampTextUI stamp) throws DocumentException, IOException { + int[] coordinates = computeCoordinates(stamp, rotation, zoom); + int width = coordinates[0]; + int height = coordinates[1]; + int x = coordinates[2]; + int y = coordinates[3]; + + Insets insets = stamp.getInsets(); + + cb.saveState(); + JLabel label = stamp.getStampText(); + float fontSize = label.getFont().getSize2D() / zoom; + BaseFont font = BaseFont.createFont(BaseFont.HELVETICA, BaseFont.WINANSI, BaseFont.NOT_EMBEDDED); + + String text = stamp.getText(); + String[] rows = text.split("\n"); + int rowHeight = (int) ((stamp.getHeight() / rows.length) / zoom); + + int xxx = x; + int yyy = y; + if (rotation == 0) { + xxx += insets.left; + yyy += height - rowHeight - insets.top / zoom; + + } else if (rotation == 90) { + xxx += rowHeight + insets.top / zoom; + yyy += insets.left; + + } else if (rotation == 180) { + xxx += width - insets.right / zoom; + yyy += rowHeight - insets.top / zoom; - for (PDFEditorLineUI panel : model.getPages()[i].getLines()) { - - int[] coordinates = computeCoordinates(panel, rotation, zoom); - int width = coordinates[0]; - int height = coordinates[1]; - int x = coordinates[2]; - int y = coordinates[3]; - - if (rotation % 180 == 0 ^ !panel.isHorizontal()) { - y += height / 2; - } else { - x += width / 2; - } - - cb.saveState(); - cb.setColorStroke(BaseColor.BLUE); - cb.moveTo(x, y); - if (rotation % 180 == 0 ^ !panel.isHorizontal()) { - cb.lineTo(x + width, y); - } else { - cb.lineTo(x, y + height); - } - cb.stroke(); - cb.restoreState(); + } else if (rotation == 270) { + xxx += width - rowHeight - insets.left / zoom; + yyy += height - insets.top / zoom; + } + + for (String s : rows) { + if (s.isEmpty()) { + s = " "; } + showTextAligned(cb, s, xxx, yyy, rotation, font, fontSize); - for (PDFEditorHighlighterUI panel : model.getPages()[i].getHighlighters()) { + if (rotation == 0) { + yyy -= rowHeight; - int[] coordinates = computeCoordinates(panel, rotation, zoom); - int width = coordinates[0]; - int height = coordinates[1]; - int x = coordinates[2]; - int y = coordinates[3]; + } else if (rotation == 90) { + xxx += rowHeight; - cb.saveState(); - PdfGState gs1 = new PdfGState(); - gs1.setFillOpacity(0.4f); - cb.setGState(gs1); + } else if (rotation == 180) { + yyy += rowHeight; - cb.setColorFill(BaseColor.YELLOW); - cb.rectangle(x, y, width, height); - cb.fill(); - cb.restoreState(); + } else if (rotation == 270) { + xxx -= rowHeight; } } - pdfStamper.close(); - pdfReader.close(); - - // convert content to blob - InputStream is = new BufferedInputStream(new FileInputStream(target)); - FaxToMailServiceContext serviceContext = getContext().newServiceContext(); - AttachmentFile attachmentFileNew = serviceContext.getEmailService().getAttachmentFileFromStream(is); - attachmentFileNew.setRotation(rotation); - String fileName = model.getOriginalFile().getFilename(); - attachmentFileNew.setFilename(FaxToMailUIUtil.getEditedFileName(fileName)); - model.setEditedFile(attachmentFileNew); + cb.restoreState(); } protected int[] computeCoordinates(Component panel, int rotation, float zoom) { diff --git a/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/pdfeditor/PDFEditorStampTextUI.css b/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/pdfeditor/PDFEditorStampTextUI.css new file mode 100644 index 0000000..6a98d85 --- /dev/null +++ b/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/pdfeditor/PDFEditorStampTextUI.css @@ -0,0 +1,47 @@ +/* + * #%L + * FaxToMail :: UI + * $Id$ + * $HeadURL$ + * %% + * Copyright (C) 2014 Mac-Groupe, Code Lutin + * %% + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty o + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/gpl-3.0.html>. + * #L% + */ + +Component { + opaque: false; + background: { null }; + +} + +#stampPanel { + border : { BorderFactory.createEmptyBorder(2, 2, 2, 2) }; +} + +#removeButton { + text: " X "; + border : { BorderFactory.createLineBorder(Color.BLACK, 1, false) }; + contentAreaFilled: false; + focusPainted: false; +} + +#stampText { + text: { "<html>" + getText().replaceAll("[\n\r]", "<br/>") + "</html>"}; + border: { null }; + font: { Font.decode(BaseFont.HELVETICA) }; + font-size: { (float)(DEFAULT_FONT_SIZE * getZoom()) }; +} diff --git a/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/pdfeditor/PDFEditorStampTextUI.jaxx b/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/pdfeditor/PDFEditorStampTextUI.jaxx new file mode 100644 index 0000000..297e52e --- /dev/null +++ b/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/pdfeditor/PDFEditorStampTextUI.jaxx @@ -0,0 +1,74 @@ +<!-- + #%L + FaxToMail :: UI + $Id$ + $HeadURL$ + %% + Copyright (C) 2014 Mac-Groupe, Code Lutin + %% + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as + published by the Free Software Foundation, either version 3 of the + License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public + License along with this program. If not, see + <http://www.gnu.org/licenses/gpl-3.0.html>. + #L% + --> +<JPanel id='stampPanel' layout='{new BorderLayout()}' onComponentResized="pack()"> + + <import> + java.awt.Color + java.awt.Dimension + java.awt.Font + java.awt.Insets + java.awt.Point + javax.swing.BorderFactory + javax.swing.JPanel + com.itextpdf.text.pdf.BaseFont + com.franciaflex.faxtomail.ui.swing.util.JImagePanel + </import> + + <script><![CDATA[ + + public static final int DEFAULT_FONT_SIZE = 12; + + protected void pack() { + JPanel container = getParentContainer(JPanel.class); + Point location = getLocation(); + Insets containerInsets = container.getInsets(); + Dimension size = getPreferredSize(); + setBounds(location.x + containerInsets.left, + location.y + containerInsets.top, + size.width, // no real logical reason for 10, but otherwise, the text is sometimes cut in the end + size.height); + } + + protected void removeStamp() { + JPanel container = getParentContainer(JPanel.class); + container.remove(this); + container.updateUI(); + } + + ]]></script> + + <String id="text" javaBean=""/> + <Float id="zoom" javaBean="1.0f"/> + + <JPanel layout='{ new BorderLayout() }' + constraints="BorderLayout.EAST"> + <JButton id="removeButton" + constraints="BorderLayout.NORTH" + onActionPerformed="removeStamp()"/> + </JPanel> + + <JLabel id="stampText" + constraints="BorderLayout.CENTER"/> + +</JPanel> diff --git a/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/pdfeditor/PDFEditorUI.jaxx b/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/pdfeditor/PDFEditorUI.jaxx index d6c71f0..156d8d6 100644 --- a/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/pdfeditor/PDFEditorUI.jaxx +++ b/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/pdfeditor/PDFEditorUI.jaxx @@ -60,7 +60,7 @@ <JToggleButton id='highlighterButton' buttonGroup="actionGroup" value="HIGHLIGHTER"/> <!--onActionPerformed="handler.addHighlighter()"/>--> - <JSeparator constructorParams="SwingConstants.VERTICAL"/> + <JSeparator id="actionGroupSeparator" constructorParams="SwingConstants.VERTICAL"/> <JButton id="prevPageButton" onActionPerformed="getModel().decPageIndex()"/> diff --git a/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/pdfeditor/PDFEditorUIHandler.java b/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/pdfeditor/PDFEditorUIHandler.java index 55710af..0fd74c3 100644 --- a/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/pdfeditor/PDFEditorUIHandler.java +++ b/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/pdfeditor/PDFEditorUIHandler.java @@ -28,9 +28,12 @@ import com.franciaflex.faxtomail.persistence.entities.Attachment; import com.franciaflex.faxtomail.persistence.entities.AttachmentFile; import com.franciaflex.faxtomail.persistence.entities.Email; import com.franciaflex.faxtomail.persistence.entities.HistoryType; +import com.franciaflex.faxtomail.persistence.entities.Stamp; import com.franciaflex.faxtomail.services.FaxToMailServiceContext; import com.franciaflex.faxtomail.ui.swing.actions.GenerateAnnotatedAttachmentAction; import com.franciaflex.faxtomail.ui.swing.content.demande.DemandeUIModel; +import com.franciaflex.faxtomail.ui.swing.content.pdfeditor.PDFEditorUIModel.EditionComponent; +import com.franciaflex.faxtomail.ui.swing.content.pdfeditor.PDFEditorUIModel.Page; import com.franciaflex.faxtomail.ui.swing.util.AbstractFaxToMailUIHandler; import com.franciaflex.faxtomail.ui.swing.util.FaxToMailUIUtil; import com.franciaflex.faxtomail.ui.swing.util.JImagePanel; @@ -38,6 +41,7 @@ import com.itextpdf.text.DocumentException; import jaxx.runtime.swing.ComponentMover; import jaxx.runtime.swing.ComponentResizer; import jaxx.runtime.swing.JAXXButtonGroup; +import jaxx.runtime.swing.JAXXWidgetUtil; import jaxx.runtime.validator.swing.SwingValidator; import org.apache.commons.io.IOUtils; import org.apache.commons.logging.Log; @@ -58,6 +62,7 @@ import java.beans.PropertyChangeListener; import java.io.File; import java.io.FileInputStream; import java.io.IOException; +import java.util.Collection; import java.util.Date; import java.util.List; @@ -89,8 +94,16 @@ public class PDFEditorUIHandler extends AbstractFaxToMailUIHandler<PDFEditorUIMo actionGroup.addPropertyChangeListener(JAXXButtonGroup.SELECTED_VALUE_PROPERTY, new PropertyChangeListener() { @Override public void propertyChange(PropertyChangeEvent evt) { - String value = (String) evt.getNewValue(); - model.setSelectedComponent(PDFEditorUIModel.EditionComponent.valueOf(value)); + Object newValue = evt.getNewValue(); + Object selectedComponent; + if (newValue instanceof String) { + String value = (String) newValue; + selectedComponent = PDFEditorUIModel.EditionComponent.valueOf(value); + + } else { + selectedComponent = newValue; + } + model.setSelectedComponent(selectedComponent); } }); @@ -101,36 +114,44 @@ public class PDFEditorUIHandler extends AbstractFaxToMailUIHandler<PDFEditorUIMo @Override public void componentAdded(ContainerEvent e) { Component child = e.getChild(); - PDFEditorUIModel.Page currentPage = model.getCurrentPage(); - if (child.getClass().isAssignableFrom(PDFEditorNoteUI.class)) { + Page currentPage = model.getCurrentPage(); + Class<? extends Component> childClass = child.getClass(); + if (childClass.isAssignableFrom(PDFEditorNoteUI.class)) { currentPage.addNote((PDFEditorNoteUI) child); - } else if (child.getClass().isAssignableFrom(PDFEditorCrossUI.class)) { + } else if (childClass.isAssignableFrom(PDFEditorCrossUI.class)) { currentPage.addCross((PDFEditorCrossUI) child); - } else if (child.getClass().isAssignableFrom(PDFEditorLineUI.class)) { + } else if (childClass.isAssignableFrom(PDFEditorLineUI.class)) { currentPage.addLine((PDFEditorLineUI) child); - } else if (child.getClass().isAssignableFrom(PDFEditorHighlighterUI.class)) { + } else if (childClass.isAssignableFrom(PDFEditorHighlighterUI.class)) { currentPage.addHighlighter((PDFEditorHighlighterUI) child); + + } else if (childClass.isAssignableFrom(PDFEditorStampTextUI.class)) { + currentPage.addStamp((PDFEditorStampTextUI) child); } } @Override public void componentRemoved(ContainerEvent e) { Component child = e.getChild(); - PDFEditorUIModel.Page currentPage = model.getCurrentPage(); - if (child.getClass().isAssignableFrom(PDFEditorNoteUI.class)) { + Page currentPage = model.getCurrentPage(); + Class<? extends Component> childClass = child.getClass(); + if (childClass.isAssignableFrom(PDFEditorNoteUI.class)) { currentPage.removeNote((PDFEditorNoteUI) child); - } else if (child.getClass().isAssignableFrom(PDFEditorCrossUI.class)) { + } else if (childClass.isAssignableFrom(PDFEditorCrossUI.class)) { currentPage.removeCross((PDFEditorCrossUI) child); - } else if (child.getClass().isAssignableFrom(PDFEditorLineUI.class)) { + } else if (childClass.isAssignableFrom(PDFEditorLineUI.class)) { currentPage.removeLine((PDFEditorLineUI) child); - } else if (child.getClass().isAssignableFrom(PDFEditorHighlighterUI.class)) { + } else if (childClass.isAssignableFrom(PDFEditorHighlighterUI.class)) { currentPage.removeHighlighter((PDFEditorHighlighterUI) child); + + } else if (childClass.isAssignableFrom(PDFEditorStampTextUI.class)) { + currentPage.removeStamp((PDFEditorStampTextUI) child); } } }); @@ -216,6 +237,14 @@ public class PDFEditorUIHandler extends AbstractFaxToMailUIHandler<PDFEditorUIMo (Integer) evt.getOldValue()); } }); + + model.addPropertyChangeListener(PDFEditorUIModel.PROPERTY_STAMPS, new PropertyChangeListener() { + @Override + public void propertyChange(PropertyChangeEvent evt) { + Collection<Stamp> stamps = (Collection<Stamp>) evt.getNewValue(); + updateStamps(stamps); + } + }); } @Override @@ -251,23 +280,32 @@ public class PDFEditorUIHandler extends AbstractFaxToMailUIHandler<PDFEditorUIMo } public void addEditionComponent(MouseEvent event) { - PDFEditorUIModel.EditionComponent editionComponent = getModel().getSelectedComponent(); - switch (editionComponent) { - case NOTE: - addNote(event.getX(), event.getY()); - break; - case CROSS: - addCross(event.getX(), event.getY()); - break; - case HLINE: - addHLine(event.getX(), event.getY()); - break; - case VLINE: - addVLine(event.getX(), event.getY()); - break; - case HIGHLIGHTER: - addHighlighter(event.getX(), event.getY()); - break; + Object selectedComponent = getModel().getSelectedComponent(); + + int x = event.getX(); + int y = event.getY(); + if (selectedComponent instanceof PDFEditorUIModel.EditionComponent) { + EditionComponent editionComponent = (EditionComponent) selectedComponent; + switch (editionComponent) { + case NOTE: + addNote(x, y); + break; + case CROSS: + addCross(x, y); + break; + case HLINE: + addHLine(x, y); + break; + case VLINE: + addVLine(x, y); + break; + case HIGHLIGHTER: + addHighlighter(x, y); + break; + } + + } else if (selectedComponent instanceof Stamp) { + addStamp((Stamp) selectedComponent, x, y); } } @@ -305,6 +343,13 @@ public class PDFEditorUIHandler extends AbstractFaxToMailUIHandler<PDFEditorUIMo cr.registerComponent(highlighter); } + public void addStamp(Stamp stamp, int x, int y) { + PDFEditorStampTextUI stampUI = new PDFEditorStampTextUI(); + stampUI.setText(stamp.getText()); + stampUI.setZoom(getModel().getZoom()); + addPanel(stampUI, x, y); + } + protected void addPanel(JPanel panel, int x, int y) { JPanel container = ui.getContainer(); container.add(panel, 0); @@ -322,7 +367,7 @@ public class PDFEditorUIHandler extends AbstractFaxToMailUIHandler<PDFEditorUIMo protected void updatePageNumber(Integer pageNb, Integer prevPageNb) { if (pageNb != null) { if (prevPageNb != null) { - PDFEditorUIModel.Page p = getModel().getPage(prevPageNb); + Page p = getModel().getPage(prevPageNb); for (JPanel panel : p.getNotes()) { panel.setVisible(false); } @@ -375,7 +420,7 @@ public class PDFEditorUIHandler extends AbstractFaxToMailUIHandler<PDFEditorUIMo float zoomRatio = zoom / previousZoom; int rotationDiff = rotation - previousRotation; - PDFEditorUIModel.Page p = getModel().getPage(pageNb); + Page p = getModel().getPage(pageNb); for (PDFEditorNoteUI panel : p.getNotes()) { panel.setVisible(true); @@ -510,6 +555,24 @@ public class PDFEditorUIHandler extends AbstractFaxToMailUIHandler<PDFEditorUIMo } } + protected void updateStamps(Collection<Stamp> stamps) { + PDFEditorUI ui = getUI(); + JAXXButtonGroup actionGroup = ui.getActionGroup(); + Icon stampIcon = JAXXWidgetUtil.createImageIcon("stamp.png"); + JToolBar toolbar = ui.getToolbar(); + + int i = toolbar.getComponentIndex(ui.getActionGroupSeparator()); + + for (Stamp stamp : stamps) { + JToggleButton button = new JToggleButton(stamp.getLabel(), stampIcon); + button.putClientProperty("$value", stamp); + + actionGroup.add(button); + + toolbar.add(button, i++); + } + } + public File convertFileToPdf(AttachmentFile attachmentFile) throws IOException, DocumentException { File target = FaxToMailUIUtil.convertFileToPdf(attachmentFile); // convert content to blob diff --git a/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/pdfeditor/PDFEditorUIModel.java b/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/pdfeditor/PDFEditorUIModel.java index 8a4ff95..2a2ca5f 100644 --- a/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/pdfeditor/PDFEditorUIModel.java +++ b/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/pdfeditor/PDFEditorUIModel.java @@ -27,12 +27,15 @@ package com.franciaflex.faxtomail.ui.swing.content.pdfeditor; import com.franciaflex.faxtomail.persistence.entities.Attachment; import com.franciaflex.faxtomail.persistence.entities.AttachmentFile; import com.franciaflex.faxtomail.persistence.entities.AttachmentImpl; +import com.franciaflex.faxtomail.persistence.entities.Stamp; import com.franciaflex.faxtomail.ui.swing.content.demande.DemandeUIModel; import com.franciaflex.faxtomail.ui.swing.util.AbstractFaxToMailBeanUIModel; import org.nuiton.util.beans.Binder; import org.nuiton.util.beans.BinderFactory; import java.util.ArrayList; +import java.util.Collection; +import java.util.HashSet; import java.util.List; /** @@ -45,23 +48,27 @@ public class PDFEditorUIModel extends AbstractFaxToMailBeanUIModel<Attachment, P public static final String PROPERTY_CURRENT_PAGE_INDEX = "currentPageIndex"; public static final String PROPERTY_ZOOM = "zoom"; public static final String PROPERTY_ROTATION = "rotation"; + public static final String PROPERTY_STAMPS = "stamps"; protected final Attachment editObject = new AttachmentImpl(); protected DemandeUIModel demand; - protected EditionComponent selectedComponent; + protected Collection<Stamp> stamps = new HashSet<>(); - public static enum EditionComponent { + protected Object selectedComponent; + + public enum EditionComponent { NOTE, CROSS, HLINE, VLINE, HIGHLIGHTER } public class Page { - protected List<PDFEditorNoteUI> notes = new ArrayList<PDFEditorNoteUI>(); - protected List<PDFEditorCrossUI> crosses = new ArrayList<PDFEditorCrossUI>(); - protected List<PDFEditorLineUI> lines = new ArrayList<PDFEditorLineUI>(); - protected List<PDFEditorHighlighterUI> highlighters = new ArrayList<PDFEditorHighlighterUI>(); + protected List<PDFEditorNoteUI> notes = new ArrayList<>(); + protected List<PDFEditorCrossUI> crosses = new ArrayList<>(); + protected List<PDFEditorLineUI> lines = new ArrayList<>(); + protected List<PDFEditorHighlighterUI> highlighters = new ArrayList<>(); + protected List<PDFEditorStampTextUI> stamps = new ArrayList<>(); public List<PDFEditorNoteUI> getNotes() { return notes; @@ -118,6 +125,20 @@ public class PDFEditorUIModel extends AbstractFaxToMailBeanUIModel<Attachment, P highlighters.remove(highlighter); setModify(true); } + + public List<PDFEditorStampTextUI> getStamps() { + return stamps; + } + + public void addStamp(PDFEditorStampTextUI stamp) { + stamps.add(stamp); + setModify(true); + } + + public void removeStamp(PDFEditorStampTextUI stamp) { + stamps.remove(stamp); + setModify(true); + } } protected Page[] pages; @@ -257,11 +278,23 @@ public class PDFEditorUIModel extends AbstractFaxToMailBeanUIModel<Attachment, P this.demand = demand; } - public EditionComponent getSelectedComponent() { + public Collection<Stamp> getStamps() { + return stamps; + } + + public void setStamps(Collection<Stamp> stamps) { + this.stamps.clear(); + if (stamps != null) { + this.stamps.addAll(stamps); + } + firePropertyChange(PROPERTY_STAMPS, null, this.stamps); + } + + public Object getSelectedComponent() { return selectedComponent; } - public void setSelectedComponent(EditionComponent selectedComponent) { + public void setSelectedComponent(Object selectedComponent) { this.selectedComponent = selectedComponent; } diff --git a/faxtomail-ui-swing/src/main/resources/icons/stamp.png b/faxtomail-ui-swing/src/main/resources/icons/stamp.png new file mode 100644 index 0000000..71f59d1 Binary files /dev/null and b/faxtomail-ui-swing/src/main/resources/icons/stamp.png differ -- 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 http://git.codelutin.com/faxtomail.git commit addb08a9f37064335721d15b478799ab19550c40 Author: Kevin Morin <morin@codelutin.com> Date: Sat Aug 15 07:34:08 2015 +0200 - finalisation de l'interface d'admin - ajout des tampons dans l'éditeur de PDF (fixes #7424) --- .../src/main/xmi/faxtomail.properties | 6 +- faxtomail-persistence/src/main/xmi/faxtomail.zargo | Bin 32024 -> 32016 bytes .../services/service/MailFolderServiceImpl.java | 2 +- .../h2/V1_4_0_150811__add_pdf_editor_stamps.sql | 2 +- .../V1_4_0_150811__add_pdf_editor_stamps.sql | 2 +- .../actions/GenerateAnnotatedAttachmentAction.java | 2 +- .../content/pdfeditor/PDFEditorStampImageUI.css | 35 +++ ...StampTextUI.jaxx => PDFEditorStampImageUI.jaxx} | 33 +-- .../content/pdfeditor/PDFEditorStampTextUI.jaxx | 2 +- .../content/pdfeditor/PDFEditorUIHandler.java | 293 ++++++++++++++------- .../swing/content/pdfeditor/PDFEditorUIModel.java | 29 +- .../web/action/admin/ConfigurationAction.java | 9 + .../WEB-INF/content/admin/configuration-input.jsp | 31 ++- .../src/main/webapp/js/configuration.js | 49 +++- pom.xml | 2 +- 15 files changed, 339 insertions(+), 158 deletions(-) diff --git a/faxtomail-persistence/src/main/xmi/faxtomail.properties b/faxtomail-persistence/src/main/xmi/faxtomail.properties index 11ab35c..f101632 100644 --- a/faxtomail-persistence/src/main/xmi/faxtomail.properties +++ b/faxtomail-persistence/src/main/xmi/faxtomail.properties @@ -131,8 +131,4 @@ com.franciaflex.faxtomail.persistence.entities.MailLock.attribute.lockOn.tagvalu com.franciaflex.faxtomail.persistence.entities.MailLock.attribute.lockOn.stereotype=unique # BrandsForDomain -com.franciaflex.faxtomail.persistence.entities.BrandsForDomain.attribute.domainName.tagvalue.notNull=true - -#Stamp -com.franciaflex.faxtomail.persistence.entities.Stamp.attribute.image.tagValue.hibernateAttributeType=binary -com.franciaflex.faxtomail.persistence.entities.Stamp.attribute.image.tagvalue.length=9999999 \ No newline at end of file +com.franciaflex.faxtomail.persistence.entities.BrandsForDomain.attribute.domainName.tagvalue.notNull=true \ No newline at end of file diff --git a/faxtomail-persistence/src/main/xmi/faxtomail.zargo b/faxtomail-persistence/src/main/xmi/faxtomail.zargo index 0ab28c0..2658cec 100644 Binary files a/faxtomail-persistence/src/main/xmi/faxtomail.zargo and b/faxtomail-persistence/src/main/xmi/faxtomail.zargo differ diff --git a/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/MailFolderServiceImpl.java b/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/MailFolderServiceImpl.java index 13c7b87..592863d 100644 --- a/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/MailFolderServiceImpl.java +++ b/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/MailFolderServiceImpl.java @@ -357,7 +357,7 @@ public class MailFolderServiceImpl extends FaxToMailServiceSupport implements Ma @Override public Collection<Stamp> getPdfEditorStamps(String mailFolderId) { MailFolder folder = getMailFolder(mailFolderId); - while (folder != null && !folder.isUseCurrentLevelPdfEditorStamps()) { + while (folder.getParent() != null && !folder.isUseCurrentLevelPdfEditorStamps()) { folder = folder.getParent(); } diff --git a/faxtomail-service/src/main/resources/db/migration/h2/V1_4_0_150811__add_pdf_editor_stamps.sql b/faxtomail-service/src/main/resources/db/migration/h2/V1_4_0_150811__add_pdf_editor_stamps.sql index 1fafc64..b65551e 100644 --- a/faxtomail-service/src/main/resources/db/migration/h2/V1_4_0_150811__add_pdf_editor_stamps.sql +++ b/faxtomail-service/src/main/resources/db/migration/h2/V1_4_0_150811__add_pdf_editor_stamps.sql @@ -6,7 +6,7 @@ create table STAMP ( topiaCreateDate timestamp, label longvarchar, description longvarchar, - image binary(9999999), + image longvarchar, text longvarchar, primary key (topiaId) ); diff --git a/faxtomail-service/src/main/resources/db/migration/sqlserver/V1_4_0_150811__add_pdf_editor_stamps.sql b/faxtomail-service/src/main/resources/db/migration/sqlserver/V1_4_0_150811__add_pdf_editor_stamps.sql index fe74f52..103193b 100644 --- a/faxtomail-service/src/main/resources/db/migration/sqlserver/V1_4_0_150811__add_pdf_editor_stamps.sql +++ b/faxtomail-service/src/main/resources/db/migration/sqlserver/V1_4_0_150811__add_pdf_editor_stamps.sql @@ -6,7 +6,7 @@ create table STAMP ( topiaCreateDate datetime2, label varchar(MAX), description varchar(MAX), - image varbinary(MAX), + image varchar(MAX), text varchar(MAX), primary key (topiaId) ); diff --git a/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/GenerateAnnotatedAttachmentAction.java b/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/GenerateAnnotatedAttachmentAction.java index 92188eb..48446c8 100644 --- a/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/GenerateAnnotatedAttachmentAction.java +++ b/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/GenerateAnnotatedAttachmentAction.java @@ -118,7 +118,7 @@ public class GenerateAnnotatedAttachmentAction extends AbstractFaxToMailAction<P addHighlightToPdf(zoom, rotation, cb, panel); } - for (PDFEditorStampTextUI panel : page.getStamps()) { + for (PDFEditorStampTextUI panel : page.getTextStamps()) { addStampToPdf(zoom, rotation, cb, panel); } } diff --git a/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/pdfeditor/PDFEditorStampImageUI.css b/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/pdfeditor/PDFEditorStampImageUI.css new file mode 100644 index 0000000..30c5a77 --- /dev/null +++ b/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/pdfeditor/PDFEditorStampImageUI.css @@ -0,0 +1,35 @@ +/* + * #%L + * FaxToMail :: UI + * $Id$ + * $HeadURL$ + * %% + * Copyright (C) 2014 Mac-Groupe, Code Lutin + * %% + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty o + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/gpl-3.0.html>. + * #L% + */ +#stampPanel { + scaleImageToFitPanel: true; +} + +#removeButton { + opaque: false; + background: { null }; + text: " X "; + border : { BorderFactory.createLineBorder(Color.BLACK, 1, false) }; + contentAreaFilled: false; + focusPainted: false; +} diff --git a/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/pdfeditor/PDFEditorStampTextUI.jaxx b/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/pdfeditor/PDFEditorStampImageUI.jaxx similarity index 55% copy from faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/pdfeditor/PDFEditorStampTextUI.jaxx copy to faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/pdfeditor/PDFEditorStampImageUI.jaxx index 297e52e..3191640 100644 --- a/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/pdfeditor/PDFEditorStampTextUI.jaxx +++ b/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/pdfeditor/PDFEditorStampImageUI.jaxx @@ -21,7 +21,9 @@ <http://www.gnu.org/licenses/gpl-3.0.html>. #L% --> -<JPanel id='stampPanel' layout='{new BorderLayout()}' onComponentResized="pack()"> +<com.franciaflex.faxtomail.ui.swing.util.JImagePanel + id='stampPanel' + layout="{new java.awt.FlowLayout(java.awt.FlowLayout.TRAILING, 0, 0)}"> <import> java.awt.Color @@ -37,19 +39,6 @@ <script><![CDATA[ - public static final int DEFAULT_FONT_SIZE = 12; - - protected void pack() { - JPanel container = getParentContainer(JPanel.class); - Point location = getLocation(); - Insets containerInsets = container.getInsets(); - Dimension size = getPreferredSize(); - setBounds(location.x + containerInsets.left, - location.y + containerInsets.top, - size.width, // no real logical reason for 10, but otherwise, the text is sometimes cut in the end - size.height); - } - protected void removeStamp() { JPanel container = getParentContainer(JPanel.class); container.remove(this); @@ -58,17 +47,7 @@ ]]></script> - <String id="text" javaBean=""/> - <Float id="zoom" javaBean="1.0f"/> - - <JPanel layout='{ new BorderLayout() }' - constraints="BorderLayout.EAST"> - <JButton id="removeButton" - constraints="BorderLayout.NORTH" - onActionPerformed="removeStamp()"/> - </JPanel> - - <JLabel id="stampText" - constraints="BorderLayout.CENTER"/> + <JButton id="removeButton" + onActionPerformed="removeStamp()"/> -</JPanel> +</com.franciaflex.faxtomail.ui.swing.util.JImagePanel> diff --git a/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/pdfeditor/PDFEditorStampTextUI.jaxx b/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/pdfeditor/PDFEditorStampTextUI.jaxx index 297e52e..9ce60d3 100644 --- a/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/pdfeditor/PDFEditorStampTextUI.jaxx +++ b/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/pdfeditor/PDFEditorStampTextUI.jaxx @@ -46,7 +46,7 @@ Dimension size = getPreferredSize(); setBounds(location.x + containerInsets.left, location.y + containerInsets.top, - size.width, // no real logical reason for 10, but otherwise, the text is sometimes cut in the end + size.width, size.height); } diff --git a/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/pdfeditor/PDFEditorUIHandler.java b/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/pdfeditor/PDFEditorUIHandler.java index 0fd74c3..b90c4ae 100644 --- a/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/pdfeditor/PDFEditorUIHandler.java +++ b/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/pdfeditor/PDFEditorUIHandler.java @@ -48,6 +48,7 @@ import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.apache.pdfbox.pdmodel.PDDocument; import org.apache.pdfbox.rendering.PDFRenderer; +import org.apache.xerces.impl.dv.util.Base64; import org.nuiton.jaxx.application.swing.util.Cancelable; import org.nuiton.jaxx.application.swing.util.CloseableUI; @@ -129,7 +130,10 @@ public class PDFEditorUIHandler extends AbstractFaxToMailUIHandler<PDFEditorUIMo currentPage.addHighlighter((PDFEditorHighlighterUI) child); } else if (childClass.isAssignableFrom(PDFEditorStampTextUI.class)) { - currentPage.addStamp((PDFEditorStampTextUI) child); + currentPage.addTextStamp((PDFEditorStampTextUI) child); + + } else if (childClass.isAssignableFrom(PDFEditorStampImageUI.class)) { + currentPage.addImageStamp((PDFEditorStampImageUI) child); } } @@ -151,7 +155,10 @@ public class PDFEditorUIHandler extends AbstractFaxToMailUIHandler<PDFEditorUIMo currentPage.removeHighlighter((PDFEditorHighlighterUI) child); } else if (childClass.isAssignableFrom(PDFEditorStampTextUI.class)) { - currentPage.removeStamp((PDFEditorStampTextUI) child); + currentPage.removeTextStamp((PDFEditorStampTextUI) child); + + } else if (childClass.isAssignableFrom(PDFEditorStampImageUI.class)) { + currentPage.removeImageStamp((PDFEditorStampImageUI) child); } } }); @@ -344,10 +351,33 @@ public class PDFEditorUIHandler extends AbstractFaxToMailUIHandler<PDFEditorUIMo } public void addStamp(Stamp stamp, int x, int y) { - PDFEditorStampTextUI stampUI = new PDFEditorStampTextUI(); - stampUI.setText(stamp.getText()); - stampUI.setZoom(getModel().getZoom()); - addPanel(stampUI, x, y); + + float zoom = getModel().getZoom(); + + if (stamp.getImage() != null) { + String base64Image = stamp.getImage().split(",")[1]; + byte[] imageContent = Base64.decode(base64Image); + ImageIcon imageIcon = new ImageIcon(imageContent); + + PDFEditorStampImageUI stampUI = new PDFEditorStampImageUI(); + Image image = imageIcon.getImage(); + stampUI.setImage(image); + + int scaledWidth = (int) (image.getWidth(null) * zoom); + int scaledHeight = (int) (image.getHeight(null) * zoom); + Dimension scaledSize = new Dimension(scaledWidth, scaledHeight); + stampUI.setSize(scaledSize); + stampUI.setPreferredSize(scaledSize); + + addPanel(stampUI, x, y); + + } else { + PDFEditorStampTextUI stampUI = new PDFEditorStampTextUI(); + stampUI.setText(stamp.getText()); + stampUI.setZoom(zoom); + addPanel(stampUI, x, y); + } + } protected void addPanel(JPanel panel, int x, int y) { @@ -423,136 +453,206 @@ public class PDFEditorUIHandler extends AbstractFaxToMailUIHandler<PDFEditorUIMo Page p = getModel().getPage(pageNb); for (PDFEditorNoteUI panel : p.getNotes()) { - panel.setVisible(true); + displayPageNote(zoom, insets, rect, zoomRatio, rotationDiff, panel); + } - panel.setZoom(zoom); - Rectangle bounds = panel.getBounds(); - int x, y; + boolean orientation180 = Math.abs(rotationDiff) % 180 == 0; - if (rotationDiff == 0) { - x = bounds.x; - y = bounds.y; + for (PDFEditorCrossUI panel : p.getCrosses()) { + displayPageCross(insets, rect, zoomRatio, rotationDiff, orientation180, panel); + } - } else if (rotationDiff == 90 || rotationDiff == -270) { - x = rect.width - bounds.height / 2 - bounds.width / 2 - bounds.y; - y = bounds.x + bounds.width / 2 - bounds.height / 2; + List<PDFEditorLineUI> lines = p.getLines(); + cr.deregisterComponent(lines.toArray(new PDFEditorLineUI[lines.size()])); - } else { - x = bounds.y + bounds.height / 2 - bounds.width / 2; - y = rect.height - bounds.height / 2 - bounds.width / 2 - bounds.x; - } + for (PDFEditorLineUI panel : lines) { + displayPageLine(insets, rect, zoomRatio, rotationDiff, orientation180, panel); + } - panel.setBounds((int) (zoomRatio * x) + insets.left, - (int) (zoomRatio * y) + insets.top, - (int) (zoomRatio * bounds.width), (int) (zoomRatio * bounds.height)); + for (PDFEditorHighlighterUI panel : p.getHighlighters()) { + displayPageHighlighter(insets, rect, zoomRatio, rotationDiff, orientation180, panel); + } + for (PDFEditorStampTextUI panel : p.getTextStamps()) { + displayPageTextStamp(zoom, insets, rect, zoomRatio, rotationDiff, panel); } - boolean orientation180 = Math.abs(rotationDiff) % 180 == 0; + for (PDFEditorStampImageUI panel : p.getImageStamps()) { + displayPageImageStamp(zoom, insets, rect, zoomRatio, rotationDiff, panel); + } - for (PDFEditorCrossUI panel : p.getCrosses()) { - panel.setVisible(true); + container.updateUI(); - Rectangle bounds = panel.getBounds(); + } catch (IOException e) { + if (log.isErrorEnabled()) { + log.error("error while displaying pdf", e); + } + getContext().getErrorHelper().showErrorDialog(t("faxtomail.pdfEditor.readPdf.error")); + } + } - int newWidth = orientation180 ? bounds.width : bounds.height; - int newHeight = orientation180 ? bounds.height : bounds.width; + protected void displayPageNote(float zoom, Insets insets, Rectangle rect, float zoomRatio, int rotationDiff, PDFEditorNoteUI panel) { + panel.setVisible(true); - int x, y; + panel.setZoom(zoom); + Rectangle bounds = panel.getBounds(); + int x, y; - if (rotationDiff == 0) { - x = bounds.x; - y = bounds.y; + if (rotationDiff == 0) { + x = bounds.x; + y = bounds.y; - } else if (rotationDiff == 90 || rotationDiff == -270) { - x = rect.width - newWidth - bounds.y; - y = bounds.x; + } else if (rotationDiff == 90 || rotationDiff == -270) { + x = rect.width - bounds.height / 2 - bounds.width / 2 - bounds.y; + y = bounds.x + bounds.width / 2 - bounds.height / 2; - } else { - x = bounds.y; - y = rect.height - newHeight - bounds.x; - } + } else { + x = bounds.y + bounds.height / 2 - bounds.width / 2; + y = rect.height - bounds.height / 2 - bounds.width / 2 - bounds.x; + } - panel.setBounds((int) (zoomRatio * x) + insets.left, - (int) (zoomRatio * y) + insets.top, - (int) (zoomRatio * newWidth), (int) (zoomRatio * newHeight)); + panel.setBounds((int) (zoomRatio * x) + insets.left, + (int) (zoomRatio * y) + insets.top, + (int) (zoomRatio * bounds.width), (int) (zoomRatio * bounds.height)); + } - } + protected void displayPageHighlighter(Insets insets, Rectangle rect, float zoomRatio, int rotationDiff, boolean orientation180, PDFEditorHighlighterUI panel) { + panel.setVisible(true); - List<PDFEditorLineUI> lines = p.getLines(); - cr.deregisterComponent(lines.toArray(new PDFEditorLineUI[lines.size()])); + Rectangle bounds = panel.getBounds(); - for (PDFEditorLineUI panel : lines) { - panel.setVisible(true); + int newWidth = orientation180 ? bounds.width : bounds.height; + int newHeight = orientation180 ? bounds.height : bounds.width; - Rectangle bounds = panel.getBounds(); + int x, y; - boolean horizontal = panel.isHorizontal(); - panel.setHorizontal(orientation180 ? horizontal : !horizontal); + if (rotationDiff == 0) { + x = bounds.x; + y = bounds.y; - int newWidth = orientation180 ? bounds.width : bounds.height; - int newHeight = orientation180 ? bounds.height : bounds.width; + } else if (rotationDiff == 90 || rotationDiff == -270) { + x = rect.width - newWidth - bounds.y; + y = bounds.x; - int x, y; + } else { + x = bounds.y; + y = rect.height - newHeight - bounds.x; + } - if (rotationDiff == 0) { - x = bounds.x; - y = bounds.y; + panel.setBounds((int) (zoomRatio * x) + insets.left, + (int) (zoomRatio * y) + insets.top, + (int) (zoomRatio * newWidth), (int) (zoomRatio * newHeight)); + } - } else if (rotationDiff == 90 || rotationDiff == -270) { - x = rect.width - newWidth - bounds.y; - y = bounds.x; + protected void displayPageLine(Insets insets, Rectangle rect, float zoomRatio, int rotationDiff, boolean orientation180, PDFEditorLineUI panel) { + panel.setVisible(true); - } else { - x = bounds.y; - y = rect.height - newHeight - bounds.x; - } + Rectangle bounds = panel.getBounds(); - panel.setBounds((int) (zoomRatio * x) + insets.left, - (int) (zoomRatio * y) + insets.top, - (int) (zoomRatio * newWidth), (int) (zoomRatio * newHeight)); + boolean horizontal = panel.isHorizontal(); + panel.setHorizontal(orientation180 ? horizontal : !horizontal); - cr.registerComponent(panel.isHorizontal() ? ComponentResizer.DIRECTION_HORIZONTAL : ComponentResizer.DIRECTION_VERTICAL, - panel); - } + int newWidth = orientation180 ? bounds.width : bounds.height; + int newHeight = orientation180 ? bounds.height : bounds.width; - for (PDFEditorHighlighterUI panel : p.getHighlighters()) { - panel.setVisible(true); + int x, y; - Rectangle bounds = panel.getBounds(); + if (rotationDiff == 0) { + x = bounds.x; + y = bounds.y; - int newWidth = orientation180 ? bounds.width : bounds.height; - int newHeight = orientation180 ? bounds.height : bounds.width; + } else if (rotationDiff == 90 || rotationDiff == -270) { + x = rect.width - newWidth - bounds.y; + y = bounds.x; - int x, y; + } else { + x = bounds.y; + y = rect.height - newHeight - bounds.x; + } - if (rotationDiff == 0) { - x = bounds.x; - y = bounds.y; + panel.setBounds((int) (zoomRatio * x) + insets.left, + (int) (zoomRatio * y) + insets.top, + (int) (zoomRatio * newWidth), (int) (zoomRatio * newHeight)); - } else if (rotationDiff == 90 || rotationDiff == -270) { - x = rect.width - newWidth - bounds.y; - y = bounds.x; + cr.registerComponent(panel.isHorizontal() ? ComponentResizer.DIRECTION_HORIZONTAL : ComponentResizer.DIRECTION_VERTICAL, + panel); + } - } else { - x = bounds.y; - y = rect.height - newHeight - bounds.x; - } + protected void displayPageCross(Insets insets, Rectangle rect, float zoomRatio, int rotationDiff, boolean orientation180, PDFEditorCrossUI panel) { + panel.setVisible(true); - panel.setBounds((int) (zoomRatio * x) + insets.left, - (int) (zoomRatio * y) + insets.top, - (int) (zoomRatio * newWidth), (int) (zoomRatio * newHeight)); + Rectangle bounds = panel.getBounds(); - } + int newWidth = orientation180 ? bounds.width : bounds.height; + int newHeight = orientation180 ? bounds.height : bounds.width; - container.updateUI(); + int x, y; - } catch (IOException e) { - if (log.isErrorEnabled()) { - log.error("error while displaying pdf", e); - } - getContext().getErrorHelper().showErrorDialog(t("faxtomail.pdfEditor.readPdf.error")); + if (rotationDiff == 0) { + x = bounds.x; + y = bounds.y; + + } else if (rotationDiff == 90 || rotationDiff == -270) { + x = rect.width - newWidth - bounds.y; + y = bounds.x; + + } else { + x = bounds.y; + y = rect.height - newHeight - bounds.x; + } + + panel.setBounds((int) (zoomRatio * x) + insets.left, + (int) (zoomRatio * y) + insets.top, + (int) (zoomRatio * newWidth), (int) (zoomRatio * newHeight)); + } + + protected void displayPageTextStamp(float zoom, Insets insets, Rectangle rect, float zoomRatio, int rotationDiff, PDFEditorStampTextUI panel) { + panel.setVisible(true); + + panel.setZoom(zoom); + Rectangle bounds = panel.getBounds(); + int x, y; + + if (rotationDiff == 0) { + x = bounds.x; + y = bounds.y; + + } else if (rotationDiff == 90 || rotationDiff == -270) { + x = rect.width - bounds.height / 2 - bounds.width / 2 - bounds.y; + y = bounds.x + bounds.width / 2 - bounds.height / 2; + + } else { + x = bounds.y + bounds.height / 2 - bounds.width / 2; + y = rect.height - bounds.height / 2 - bounds.width / 2 - bounds.x; } + + panel.setBounds((int) (zoomRatio * x) + insets.left, + (int) (zoomRatio * y) + insets.top, + (int) (zoomRatio * bounds.width), (int) (zoomRatio * bounds.height)); + } + + protected void displayPageImageStamp(float zoom, Insets insets, Rectangle rect, float zoomRatio, int rotationDiff, PDFEditorStampImageUI panel) { + panel.setVisible(true); + + Rectangle bounds = panel.getBounds(); + int x, y; + + if (rotationDiff == 0) { + x = bounds.x; + y = bounds.y; + + } else if (rotationDiff == 90 || rotationDiff == -270) { + x = rect.width - bounds.height / 2 - bounds.width / 2 - bounds.y; + y = bounds.x + bounds.width / 2 - bounds.height / 2; + + } else { + x = bounds.y + bounds.height / 2 - bounds.width / 2; + y = rect.height - bounds.height / 2 - bounds.width / 2 - bounds.x; + } + + panel.setBounds((int) (zoomRatio * x) + insets.left, + (int) (zoomRatio * y) + insets.top, + (int) (zoomRatio * bounds.width), (int) (zoomRatio * bounds.height)); } protected void updateStamps(Collection<Stamp> stamps) { @@ -565,6 +665,7 @@ public class PDFEditorUIHandler extends AbstractFaxToMailUIHandler<PDFEditorUIMo for (Stamp stamp : stamps) { JToggleButton button = new JToggleButton(stamp.getLabel(), stampIcon); + button.setToolTipText(stamp.getDescription()); button.putClientProperty("$value", stamp); actionGroup.add(button); diff --git a/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/pdfeditor/PDFEditorUIModel.java b/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/pdfeditor/PDFEditorUIModel.java index 2a2ca5f..dc47f19 100644 --- a/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/pdfeditor/PDFEditorUIModel.java +++ b/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/pdfeditor/PDFEditorUIModel.java @@ -68,7 +68,8 @@ public class PDFEditorUIModel extends AbstractFaxToMailBeanUIModel<Attachment, P protected List<PDFEditorCrossUI> crosses = new ArrayList<>(); protected List<PDFEditorLineUI> lines = new ArrayList<>(); protected List<PDFEditorHighlighterUI> highlighters = new ArrayList<>(); - protected List<PDFEditorStampTextUI> stamps = new ArrayList<>(); + protected List<PDFEditorStampTextUI> textStamps = new ArrayList<>(); + protected List<PDFEditorStampImageUI> imageStamps = new ArrayList<>(); public List<PDFEditorNoteUI> getNotes() { return notes; @@ -126,17 +127,31 @@ public class PDFEditorUIModel extends AbstractFaxToMailBeanUIModel<Attachment, P setModify(true); } - public List<PDFEditorStampTextUI> getStamps() { - return stamps; + public List<PDFEditorStampTextUI> getTextStamps() { + return textStamps; } - public void addStamp(PDFEditorStampTextUI stamp) { - stamps.add(stamp); + public void addTextStamp(PDFEditorStampTextUI stamp) { + textStamps.add(stamp); setModify(true); } - public void removeStamp(PDFEditorStampTextUI stamp) { - stamps.remove(stamp); + public void removeTextStamp(PDFEditorStampTextUI stamp) { + textStamps.remove(stamp); + setModify(true); + } + + public List<PDFEditorStampImageUI> getImageStamps() { + return imageStamps; + } + + public void addImageStamp(PDFEditorStampImageUI stamp) { + imageStamps.add(stamp); + setModify(true); + } + + public void removeImageStamp(PDFEditorStampImageUI stamp) { + imageStamps.remove(stamp); setModify(true); } } diff --git a/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/action/admin/ConfigurationAction.java b/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/action/admin/ConfigurationAction.java index 317d64e..d1f96b5 100644 --- a/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/action/admin/ConfigurationAction.java +++ b/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/action/admin/ConfigurationAction.java @@ -45,6 +45,8 @@ import com.franciaflex.faxtomail.services.service.UserService; import com.franciaflex.faxtomail.web.FaxToMailActionSupport; import com.google.gson.reflect.TypeToken; import com.opensymphony.xwork2.Preparable; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; import org.apache.struts2.convention.annotation.Action; import org.apache.struts2.convention.annotation.InterceptorRef; import org.apache.struts2.convention.annotation.InterceptorRefs; @@ -66,6 +68,11 @@ import java.util.Map; }) public class ConfigurationAction extends FaxToMailActionSupport implements Preparable { + /** + * Logger. + */ + private static final Log log = LogFactory.getLog(ConfigurationAction.class); + protected ConfigurationService configurationService; protected UserService userService; @@ -124,6 +131,7 @@ public class ConfigurationAction extends FaxToMailActionSupport implements Prepa users = userService.getAllActiveUsers(); groups = userService.getAllActiveUserGroups(); brandsForDomains = configurationService.getAllBrandsForDomains(); + return INPUT; } @@ -270,4 +278,5 @@ public class ConfigurationAction extends FaxToMailActionSupport implements Prepa } return result; } + } diff --git a/faxtomail-ui-web/src/main/webapp/WEB-INF/content/admin/configuration-input.jsp b/faxtomail-ui-web/src/main/webapp/WEB-INF/content/admin/configuration-input.jsp index 541426b..603baea 100644 --- a/faxtomail-ui-web/src/main/webapp/WEB-INF/content/admin/configuration-input.jsp +++ b/faxtomail-ui-web/src/main/webapp/WEB-INF/content/admin/configuration-input.jsp @@ -68,7 +68,7 @@ <h1 class="page-header">Configuration</h1> - <s:form id="main_form" action="configuration" method="post" ng-controller="ConfigurationController"> + <s:form id="main_form" action="configuration" method="post" ng-controller="ConfigurationController" enctype="multipart/form-data"> <!--<s:hidden name="activeTab"/>--> @@ -251,16 +251,41 @@ </div> <div class="col-md-8" ng-if="selectedStamp"> + <h3>Édition du tampon {{selectedStamp.label}}</h3> + <div class="form-group"> <label>Description :</label> <textarea name="description" class="form-control" ng-model="selectedStamp.description"></textarea> </div> + <div class="form-group"> - <label>Texte :</label> - <textarea name="text" class="form-control" ng-model="selectedStamp.text"></textarea> + <label><input type="radio" ng-model="selectedStamp.isImageType" ng-value="true" /> + Image :</label> + + <div ng-show="selectedStamp.isImageType"> + + <input type="file" accept="image/*" id="stampImage" + class="form-control" + onchange="angular.element(this).scope().imageChanged(this)"/> + + <output> + <img id="stampPreview"/> + </output> + + </div> + + </div> + + <div class="form-group"> + <label><input type="radio" ng-model="selectedStamp.isImageType" ng-value="false" /> Texte :</label> + <textarea name="text" class="form-control" + ng-model="selectedStamp.text" ng-show="!selectedStamp.isImageType"> + </textarea> </div> + </div> + <div class="col-md-8" ng-if="!selectedStamp"> <em>Sélectionnez un tampon.</em> </div> diff --git a/faxtomail-ui-web/src/main/webapp/js/configuration.js b/faxtomail-ui-web/src/main/webapp/js/configuration.js index db22c09..86a34c4 100644 --- a/faxtomail-ui-web/src/main/webapp/js/configuration.js +++ b/faxtomail-ui-web/src/main/webapp/js/configuration.js @@ -350,14 +350,20 @@ ConfigurationModule.controller('ConfigurationStampsController', ['$scope', '$win //{Object} tampon selectionné $scope.selectedStamp; + for (var i = 0 ; i < $scope.stamps.length ; i++) { + var stamp = $scope.stamps[i]; + stamp.isImageType = stamp.image != null; + console.log(stamp) + console.log(stamp.isImageType) + } + // edition d'un tampon $scope.editStamp = function(stamp) { + $scope.selectedStamp = stamp; + $('#stampImage').val(null); + $('#stampPreview').attr('src', stamp.image ? stamp.image : null); -// // initialize le tableau d'action si vide -// if (!$scope.selectedStamp.requiredFields) { -// $scope.selectedDemandType.requiredFields = []; -// } }; // ajout d'un nouveau tampon @@ -373,6 +379,7 @@ ConfigurationModule.controller('ConfigurationStampsController', ['$scope', '$win // check if already exists if ($scope.stamps.indexOfBy('label', newStamp) != -1) { $window.alert("Ce tampon existe déjà !"); + } else { $scope.stamps.push(newStamp); @@ -382,16 +389,30 @@ ConfigurationModule.controller('ConfigurationStampsController', ['$scope', '$win } }; -// // selection/deselection d'un champ -// $scope.changeDemandTypeField = function(mailField) { -// -// var index = $scope.selectedDemandType.requiredFields.indexOf(mailField); -// if (index != -1) { -// $scope.selectedDemandType.requiredFields.splice(index, 1); -// } else { -// $scope.selectedDemandType.requiredFields.push(mailField); -// } -// }; + $scope.imageChanged = function(input) { + var f = input.files[0]; // FileList object + + // Only process image files. + if (!f.type.match('image.*')) { + console.log("erorr"); + + $('#stampPreview').attr('src', null); + //TODO error + } + + var reader = new FileReader(); + + // Closure to capture the file information. + reader.onloadend = function() { + + $scope.selectedStamp.image = reader.result; + $('#stampPreview').attr('src', reader.result); + }; + + // Read in the image file as a data URL. + reader.readAsDataURL(f); + } + }]); diff --git a/pom.xml b/pom.xml index ccf076e..f7ac66e 100644 --- a/pom.xml +++ b/pom.xml @@ -622,7 +622,7 @@ <version>1.2.25-1</version> <scope>runtime</scope> </dependency> - + <dependency> <groupId>org.nuiton.js</groupId> <artifactId>nuiton-js-font-awesome</artifactId> -- 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 http://git.codelutin.com/faxtomail.git commit 642f7dfa28a0d7e662dd4f335a8b57e372d84131 Merge: 7603abb addb08a Author: Kevin Morin <morin@codelutin.com> Date: Mon Aug 17 07:56:55 2015 +0200 Merge branch 'feature/7424' into develop faxtomail-persistence/src/main/xmi/faxtomail.zargo | Bin 31055 -> 32016 bytes .../services/service/ConfigurationService.java | 11 +- .../services/service/ConfigurationServiceImpl.java | 72 ++-- .../services/service/MailFolderService.java | 3 + .../services/service/MailFolderServiceImpl.java | 20 +- .../services/service/ReferentielService.java | 4 + .../services/service/ReferentielServiceImpl.java | 8 + .../h2/V1_4_0_150811__add_pdf_editor_stamps.sql | 36 ++ .../V1_4_0_150811__add_pdf_editor_stamps.sql | 39 ++ .../ui/swing/actions/EditAttachmentAction.java | 23 +- .../actions/GenerateAnnotatedAttachmentAction.java | 318 ++++++++++------ .../content/pdfeditor/PDFEditorStampImageUI.css | 35 ++ .../content/pdfeditor/PDFEditorStampImageUI.jaxx | 53 +++ .../content/pdfeditor/PDFEditorStampTextUI.css | 47 +++ .../content/pdfeditor/PDFEditorStampTextUI.jaxx | 74 ++++ .../ui/swing/content/pdfeditor/PDFEditorUI.jaxx | 2 +- .../content/pdfeditor/PDFEditorUIHandler.java | 406 +++++++++++++++------ .../swing/content/pdfeditor/PDFEditorUIModel.java | 64 +++- .../src/main/resources/icons/stamp.png | Bin 0 -> 588 bytes .../web/action/admin/ConfigurationAction.java | 31 +- .../WEB-INF/content/admin/configuration-input.jsp | 202 +++++++--- .../src/main/webapp/js/configuration.js | 106 +++++- pom.xml | 2 +- 23 files changed, 1218 insertions(+), 338 deletions(-) -- 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 http://git.codelutin.com/faxtomail.git commit 08036089b41387ce8ba1508728c6a83e730e63ed Author: Kevin Morin <morin@codelutin.com> Date: Mon Aug 17 10:47:04 2015 +0200 ajout des signatures dans le modèle + migration (refs #7419) --- .../src/main/xmi/faxtomail.properties | 5 +++- faxtomail-persistence/src/main/xmi/faxtomail.zargo | Bin 32016 -> 32665 bytes .../services/service/InitFaxToMailServiceImpl.java | 29 ++----------------- .../services/service/ReferentielServiceImpl.java | 9 +++++- .../h2/V1_4_0_150817__add_signings_to_users.sql | 32 +++++++++++++++++++++ .../V1_4_0_150817__add_signings_to_users.sql | 32 +++++++++++++++++++++ .../src/main/resources/struts.properties | 3 +- 7 files changed, 80 insertions(+), 30 deletions(-) diff --git a/faxtomail-persistence/src/main/xmi/faxtomail.properties b/faxtomail-persistence/src/main/xmi/faxtomail.properties index f101632..faa06ad 100644 --- a/faxtomail-persistence/src/main/xmi/faxtomail.properties +++ b/faxtomail-persistence/src/main/xmi/faxtomail.properties @@ -131,4 +131,7 @@ com.franciaflex.faxtomail.persistence.entities.MailLock.attribute.lockOn.tagvalu com.franciaflex.faxtomail.persistence.entities.MailLock.attribute.lockOn.stereotype=unique # BrandsForDomain -com.franciaflex.faxtomail.persistence.entities.BrandsForDomain.attribute.domainName.tagvalue.notNull=true \ No newline at end of file +com.franciaflex.faxtomail.persistence.entities.BrandsForDomain.attribute.domainName.tagvalue.notNull=true + +#Stamp +#com.franciaflex.faxtomail.persistence.entities.Stamp.attribute.label.tagvalue.naturalId=true \ No newline at end of file diff --git a/faxtomail-persistence/src/main/xmi/faxtomail.zargo b/faxtomail-persistence/src/main/xmi/faxtomail.zargo index 2658cec..f89ff84 100644 Binary files a/faxtomail-persistence/src/main/xmi/faxtomail.zargo and b/faxtomail-persistence/src/main/xmi/faxtomail.zargo differ diff --git a/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/InitFaxToMailServiceImpl.java b/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/InitFaxToMailServiceImpl.java index 540f52d..d629b37 100644 --- a/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/InitFaxToMailServiceImpl.java +++ b/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/InitFaxToMailServiceImpl.java @@ -24,32 +24,7 @@ package com.franciaflex.faxtomail.services.service; * #L% */ -import com.franciaflex.faxtomail.persistence.entities.Client; -import com.franciaflex.faxtomail.persistence.entities.DemandStatus; -import com.franciaflex.faxtomail.persistence.entities.DemandType; -import com.franciaflex.faxtomail.persistence.entities.DemandTypeTopiaDao; -import com.franciaflex.faxtomail.persistence.entities.Email; -import com.franciaflex.faxtomail.persistence.entities.EmailTopiaDao; -import com.franciaflex.faxtomail.persistence.entities.FaxToMailUser; -import com.franciaflex.faxtomail.persistence.entities.FaxToMailUserGroup; -import com.franciaflex.faxtomail.persistence.entities.FaxToMailUserGroupTopiaDao; -import com.franciaflex.faxtomail.persistence.entities.FaxToMailUserTopiaDao; -import com.franciaflex.faxtomail.persistence.entities.History; -import com.franciaflex.faxtomail.persistence.entities.HistoryTopiaDao; -import com.franciaflex.faxtomail.persistence.entities.HistoryType; -import com.franciaflex.faxtomail.persistence.entities.MailField; -import com.franciaflex.faxtomail.persistence.entities.MailFolder; -import com.franciaflex.faxtomail.persistence.entities.MailFolderTopiaDao; -import com.franciaflex.faxtomail.persistence.entities.OriginalEmail; -import com.franciaflex.faxtomail.persistence.entities.OriginalEmailTopiaDao; -import com.franciaflex.faxtomail.persistence.entities.Priority; -import com.franciaflex.faxtomail.persistence.entities.PriorityTopiaDao; -import com.franciaflex.faxtomail.persistence.entities.Range; -import com.franciaflex.faxtomail.persistence.entities.RangeRow; -import com.franciaflex.faxtomail.persistence.entities.RangeRowTopiaDao; -import com.franciaflex.faxtomail.persistence.entities.RangeTopiaDao; -import com.franciaflex.faxtomail.persistence.entities.WaitingState; -import com.franciaflex.faxtomail.persistence.entities.WaitingStateTopiaDao; +import com.franciaflex.faxtomail.persistence.entities.*; import com.franciaflex.faxtomail.services.DecoratorService; import com.franciaflex.faxtomail.services.FaxToMailServiceSupport; import com.franciaflex.faxtomail.services.FaxToMailServiceUtils; @@ -171,7 +146,7 @@ public class InitFaxToMailServiceImpl extends FaxToMailServiceSupport implements FaxToMailUserGroup commerciauxGroup = userGroupDao.create(FaxToMailUserGroup.PROPERTY_NAME, "Commerciaux", FaxToMailUserGroup.PROPERTY_COMPLETE_NAME, "Franciaflex/Commerciaux"); FaxToMailUserGroup savGroup = userGroupDao.create(FaxToMailUserGroup.PROPERTY_NAME, "SAV", - FaxToMailUserGroup.PROPERTY_COMPLETE_NAME, "Franciaflex/SAV"); + FaxToMailUserGroup.PROPERTY_COMPLETE_NAME, "Franciaflex/SAV"); userGroupDao.create(FaxToMailUserGroup.PROPERTY_NAME, "Administrateurs", FaxToMailUserGroup.PROPERTY_COMPLETE_NAME, "Franciaflex/Administrateurs"); diff --git a/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/ReferentielServiceImpl.java b/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/ReferentielServiceImpl.java index f0bae47..50e51b9 100644 --- a/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/ReferentielServiceImpl.java +++ b/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/ReferentielServiceImpl.java @@ -54,6 +54,8 @@ import com.franciaflex.faxtomail.services.service.imports.WaitingStateImportMode import org.apache.commons.collections4.map.MultiKeyMap; import org.apache.commons.io.IOUtils; import org.apache.commons.lang3.StringUtils; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; import org.nuiton.csv.Import; import org.nuiton.csv.ImportRuntimeException; import org.nuiton.jaxx.application.ApplicationTechnicalException; @@ -72,6 +74,11 @@ import java.util.Map; */ public class ReferentielServiceImpl extends FaxToMailServiceSupport implements ReferentielService { + /** + * Logger. + */ + private static final Log log = LogFactory.getLog(ReferentielServiceImpl.class); + @Override public List<DemandType> getAllDemandType() { DemandTypeTopiaDao dao = getPersistenceContext().getDemandTypeDao(); @@ -93,7 +100,7 @@ public class ReferentielServiceImpl extends FaxToMailServiceSupport implements R @Override public List<Stamp> getAllStamps() { StampTopiaDao dao = getPersistenceContext().getStampDao(); - return dao.forAll().setOrderByArguments(Stamp.PROPERTY_LABEL).findAll(); + return dao.forSigningEquals(false).setOrderByArguments(Stamp.PROPERTY_LABEL).findAll(); } @Override diff --git a/faxtomail-service/src/main/resources/db/migration/h2/V1_4_0_150817__add_signings_to_users.sql b/faxtomail-service/src/main/resources/db/migration/h2/V1_4_0_150817__add_signings_to_users.sql new file mode 100644 index 0000000..6362b12 --- /dev/null +++ b/faxtomail-service/src/main/resources/db/migration/h2/V1_4_0_150817__add_signings_to_users.sql @@ -0,0 +1,32 @@ +-- add signings + +create table SIGNING ( + topiaId varchar(255) not null, + topiaVersion bigint not null, + topiaCreateDate timestamp, + defaultsigning boolean, + stamp varchar(255), + faxtomailuser varchar(255), + primary key (topiaId) +); + +alter table SIGNING + add constraint FK_GD2AAMHXEMVLK1YBJO29P2GE5_INDEX_A + foreign key (faxtomailuser) + references faxtomailuser; + +alter table SIGNING + add constraint FK_QACW13RQL32JL97IM0EOHSL4Y_INDEX_A + foreign key (stamp) + references stamp; + +alter table stamp add signing boolean; +alter table stamp add faxtomailuser varchar(255); + +alter table stamp + add constraint FK_KPY7QI4OX3LIY20GRSP7D449M_INDEX_4 + foreign key (faxtomailuser) + references faxtomailuser; + +update stamp set signing = 'f'; + diff --git a/faxtomail-service/src/main/resources/db/migration/sqlserver/V1_4_0_150817__add_signings_to_users.sql b/faxtomail-service/src/main/resources/db/migration/sqlserver/V1_4_0_150817__add_signings_to_users.sql new file mode 100644 index 0000000..62e34ae --- /dev/null +++ b/faxtomail-service/src/main/resources/db/migration/sqlserver/V1_4_0_150817__add_signings_to_users.sql @@ -0,0 +1,32 @@ +-- add signings + +create table SIGNING ( + topiaId varchar(255) not null, + topiaVersion bigint not null, + topiaCreateDate datetime2, + defaultsigning bit, + stamp varchar(255), + faxtomailuser varchar(255), + primary key (topiaId) +); + +alter table SIGNING + add constraint FK_GD2AAMHXEMVLK1YBJO29P2GE5_INDEX_A + foreign key (faxtomailuser) + references faxtomailuser; + +alter table SIGNING + add constraint FK_QACW13RQL32JL97IM0EOHSL4Y_INDEX_A + foreign key (stamp) + references stamp; + +alter table stamp add signing bit; +alter table stamp add faxtomailuser varchar(255); + +alter table stamp + add constraint FK_KPY7QI4OX3LIY20GRSP7D449M_INDEX_4 + foreign key (faxtomailuser) + references faxtomailuser; + +update stamp set signing = 0; + diff --git a/faxtomail-ui-web/src/main/resources/struts.properties b/faxtomail-ui-web/src/main/resources/struts.properties index d18619d..cbd3d9d 100644 --- a/faxtomail-ui-web/src/main/resources/struts.properties +++ b/faxtomail-ui-web/src/main/resources/struts.properties @@ -25,7 +25,8 @@ struts.ui.theme=bootstrap struts.ognl.allowStaticMethodAccess=true # Help debugging -struts.devMode=${devMode} +#struts.devMode=${devMode} +struts.devMode=true struts.ognl.logMissingProperties=${devMode} struts.el.throwExceptionOnFailure=${devMode} struts.i18n.reload=${devMode} -- 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 http://git.codelutin.com/faxtomail.git commit 53ec3ff53c139b8363c2ae40b3ada55243d3385a Author: Kevin Morin <morin@codelutin.com> Date: Mon Aug 24 18:20:32 2015 +0200 ajout de la signature dans le formulaire de réponse + début d'écran de configuration des signatures (refs #7419) --- .../faxtomail/services/DecoratorServiceImpl.java | 13 +++ .../services/service/LdapServiceImpl.java | 1 + .../services/service/ldap/LdapServiceMock.java | 1 + .../ui/swing/content/reply/ReplyFormUI.css | 24 ++++- .../ui/swing/content/reply/ReplyFormUI.jaxx | 35 +++++++- .../ui/swing/content/reply/ReplyFormUIHandler.java | 25 +++++- .../ui/swing/content/reply/ReplyFormUIModel.java | 13 +++ .../ui/swing/content/reply/SigningSettingsUI.css | 60 +++++++++++++ .../ui/swing/content/reply/SigningSettingsUI.jaxx | 100 +++++++++++++++++++++ .../content/reply/SigningSettingsUIHandler.java | 69 ++++++++++++++ .../content/reply/SigningSettingsUIModel.java | 70 +++++++++++++++ .../content/reply/actions/NewSigningAction.java | 63 +++++++++++++ .../reply/actions/OpenSigningSettingsAction.java | 44 +++++++++ .../i18n/faxtomail-ui-swing_fr_FR.properties | 13 +++ .../src/main/resources/icons/action-default.png | Bin 0 -> 670 bytes .../src/main/resources/icons/action-settings.png | Bin 0 -> 512 bytes 16 files changed, 525 insertions(+), 6 deletions(-) diff --git a/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/DecoratorServiceImpl.java b/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/DecoratorServiceImpl.java index 18c6ceb..f4c78f9 100644 --- a/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/DecoratorServiceImpl.java +++ b/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/DecoratorServiceImpl.java @@ -30,9 +30,11 @@ import com.franciaflex.faxtomail.persistence.entities.Client; import com.franciaflex.faxtomail.persistence.entities.FaxToMailUser; import com.franciaflex.faxtomail.persistence.entities.HasLabel; import com.franciaflex.faxtomail.persistence.entities.Reply; +import com.franciaflex.faxtomail.persistence.entities.Signing; import com.franciaflex.faxtomail.services.service.ldap.Contact; import org.nuiton.decorator.Decorator; import org.nuiton.decorator.DecoratorProvider; +import org.nuiton.decorator.JXPathDecorator; import java.text.DateFormat; import java.util.Date; @@ -140,6 +142,17 @@ public class DecoratorServiceImpl extends FaxToMailServiceSupport implements Dec registerMultiJXPathDecorator(Reply.class, "${sentDate}$s#${subject}$s", SEPARATOR, " - "); registerMultiJXPathDecorator(FaxToMailUser.class, "${lastName}$s#${firstName}$s#${trigraph}$s", SEPARATOR, " "); registerMultiJXPathDecorator(Client.class, "${code}$s#${name}$s#${brand}$s", SEPARATOR, " - "); + registerDecorator(new JXPathDecorator<Signing>(Signing.class, "", null) { + private static final long serialVersionUID = 1L; + + @Override + public String toString(Object bean) { + if (bean == null) { + return ""; + } + return ((Signing) bean).getStamp().getLabel(); + } + }); } }; } diff --git a/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/LdapServiceImpl.java b/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/LdapServiceImpl.java index 023992b..4ec9421 100644 --- a/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/LdapServiceImpl.java +++ b/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/LdapServiceImpl.java @@ -390,6 +390,7 @@ public class LdapServiceImpl extends FaxToMailServiceSupport implements LdapServ // force collection loading to force non lazy collections user.isAffectedFoldersEmpty(); user.isUserGroupsEmpty(); + user.isStampSigningEmpty(); return user; } diff --git a/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/ldap/LdapServiceMock.java b/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/ldap/LdapServiceMock.java index 11d70ea..2771fed 100644 --- a/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/ldap/LdapServiceMock.java +++ b/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/ldap/LdapServiceMock.java @@ -109,6 +109,7 @@ public class LdapServiceMock extends LdapServiceImpl { // force collection loading to force non lazy collections result.isAffectedFoldersEmpty(); result.isUserGroupsEmpty(); + result.isStampSigningEmpty(); return result; } } 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 252011b..4cd1704 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 @@ -112,7 +112,7 @@ editable: { !model.isReadonly() }; } -#splitPane { +#messageSplitPane { dividerLocation: 270; } @@ -121,6 +121,28 @@ editable: { !model.isReadonly() }; } +#signingComboBox { + showReset: true; + showDecorator: false; + bean: {model}; + property: signing; + selectedItem: { model.getSigning() }; +} + +#configureSigningButton { + actionIcon: config; + toolTipText: "faxtomail.reply.action.signing.configure.tip"; + _applicationAction: { com.franciaflex.faxtomail.ui.swing.content.reply.actions.OpenSigningSettingsAction.class }; +} + +#signingScrollPanel { + visible: { model.getSigning() != null }; +} + +#signingPanel { + editable: false; +} + #attachmentsPanel { background: { Color.WHITE }; } 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 c78cc5d..fb7b213 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 @@ -23,6 +23,7 @@ implements='com.franciaflex.faxtomail.ui.swing.util.FaxToMailUI<ReplyFormUIModel, ReplyFormUIHandler>'> <import> + com.franciaflex.faxtomail.persistence.entities.Signing com.franciaflex.faxtomail.services.service.ldap.Contact com.franciaflex.faxtomail.ui.swing.util.FaxToMailUI com.franciaflex.faxtomail.ui.swing.util.FaxToMailUIUtil @@ -33,6 +34,7 @@ jaxx.runtime.swing.CardLayout2Ext jaxx.runtime.swing.editor.bean.BeanFilterableComboBox + jaxx.runtime.swing.editor.bean.BeanComboBox static org.nuiton.i18n.I18n.t </import> @@ -143,13 +145,38 @@ </row> </Table> - <JSplitPane id="splitPane" + <JSplitPane id="messageSplitPane" orientation="{JSplitPane.VERTICAL_SPLIT}" constraints='BorderLayout.CENTER'> - <JScrollPane> - <JTextPane id="message" + + <JSplitPane id="signingSplitPane" + orientation="{JSplitPane.VERTICAL_SPLIT}"> + <JScrollPane> + <JTextPane id="message" onKeyReleased='handler.setText(event, "message")'/> - </JScrollPane> + </JScrollPane> + + <Table fill="both"> + <row> + <cell weightx="1"> + <BeanComboBox id="signingComboBox" + constructorParams='this' + genericType="Signing"/> + </cell> + <cell> + <JButton id="configureSigningButton"/> + </cell> + </row> + <row> + <cell columns="2" weighty="1.0"> + <JScrollPane id="signingScrollPanel"> + <JTextPane id="signingPanel"/> + </JScrollPane> + </cell> + </row> + </Table> + + </JSplitPane> <JPanel layout='{new BorderLayout()}'> <JLabel id="attachmentsLabel" constraints='BorderLayout.NORTH'/> 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 8bdecde..497aa67 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 @@ -29,17 +29,22 @@ import com.franciaflex.faxtomail.persistence.entities.AttachmentFile; import com.franciaflex.faxtomail.persistence.entities.AttachmentFileImpl; import com.franciaflex.faxtomail.persistence.entities.AttachmentImpl; import com.franciaflex.faxtomail.persistence.entities.MailFolder; +import com.franciaflex.faxtomail.persistence.entities.Signing; import com.franciaflex.faxtomail.services.service.ldap.Contact; import com.franciaflex.faxtomail.ui.swing.actions.AddAttachmentToReplyAction; import com.franciaflex.faxtomail.ui.swing.content.demande.DemandeUIModel; import com.franciaflex.faxtomail.ui.swing.util.AbstractFaxToMailUIHandler; import com.franciaflex.faxtomail.ui.swing.util.FaxToMailUIUtil; +import com.google.common.base.Optional; +import com.google.common.base.Predicate; import com.google.common.base.Strings; +import com.google.common.collect.Iterables; import com.google.common.collect.Lists; import jaxx.runtime.JAXXUtil; import jaxx.runtime.SwingUtil; import jaxx.runtime.validator.swing.SwingValidator; import org.apache.commons.io.FileUtils; +import org.apache.commons.lang3.BooleanUtils; import org.apache.commons.lang3.StringUtils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; @@ -205,6 +210,24 @@ public class ReplyFormUIHandler extends AbstractFaxToMailUIHandler<ReplyFormUIMo model.setValid((Boolean) evt.getNewValue()); } }); + + Collection<Signing> stampSigning = getContext().getCurrentUser().getStampSigning(); + List<Signing> signings = new ArrayList<>(); + + if (stampSigning != null) { + signings.addAll(stampSigning); + Optional<Signing> signingOptional = Iterables.tryFind(stampSigning, new Predicate<Signing>() { + @Override + public boolean apply(Signing input) { + return BooleanUtils.isTrue(input.getDefaultSigning()); + } + }); + if (signingOptional.isPresent()) { + model.setSigning(signingOptional.get()); + } + } + + initBeanComboBox(ui.getSigningComboBox(), signings, model.getSigning()); } @Override @@ -228,7 +251,7 @@ public class ReplyFormUIHandler extends AbstractFaxToMailUIHandler<ReplyFormUIMo @Override public Component getTopestUI() { - return getUI(); + return getParentContainer(Window.class); } public void removeAttachment(ReplyAttachmentModel attachment) { 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 7576737..fa51d61 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 @@ -24,6 +24,7 @@ package com.franciaflex.faxtomail.ui.swing.content.reply; * #L% */ +import com.franciaflex.faxtomail.persistence.entities.Signing; import com.franciaflex.faxtomail.services.service.ldap.Contact; import com.franciaflex.faxtomail.ui.swing.content.demande.DemandeUIModel; import com.google.common.base.Preconditions; @@ -53,6 +54,7 @@ public class ReplyFormUIModel extends AbstractSerializableBean { public static final String PROPERTY_SUBJECT = "subject"; public static final String PROPERTY_MESSAGE = "message"; public static final String PROPERTY_ORIGINAL_DEMAND = "originalDemand"; + public static final String PROPERTY_SIGNING = "signing"; public static final String PROPERTY_ATTACHMENT = "attachment"; public static final String PROPERTY_MAX_ATTACHMENT_LENGTH = "maxAttachmentLength"; public static final String PROPERTY_TOTAL_ATTACHMENT_LENGTH = "totalAttachmentLength"; @@ -71,6 +73,7 @@ public class ReplyFormUIModel extends AbstractSerializableBean { protected String subject; protected String message; protected DemandeUIModel originalDemand; + protected Signing signing; protected long maxAttachmentLength = 0; protected long totalAttachmentLength = 0; protected boolean valid = true; @@ -177,6 +180,16 @@ public class ReplyFormUIModel extends AbstractSerializableBean { firePropertyChange(PROPERTY_ORIGINAL_DEMAND, oldValue, originalDemand); } + public Signing getSigning() { + return signing; + } + + public void setSigning(Signing signing) { + Object oldValue = getSigning(); + this.signing = signing; + firePropertyChange(PROPERTY_SIGNING, oldValue, signing); + } + public Set<ReplyAttachmentModel> getAttachments() { return attachments; } diff --git a/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/reply/SigningSettingsUI.css b/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/reply/SigningSettingsUI.css new file mode 100644 index 0000000..6d3f5ed --- /dev/null +++ b/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/reply/SigningSettingsUI.css @@ -0,0 +1,60 @@ +#signingsLabel { + text: "faxtomail.signings.settings.label"; +} + +#newSigningButton { + actionIcon: add; + toolTipText: "faxtomail.signings.settings.action.newSigning.tip"; + _applicationAction: { com.franciaflex.faxtomail.ui.swing.content.reply.actions.NewSigningAction.class }; +} + +/* +#signingList { + items: { model.getSignings() }; + selectedItem: { model.getSelectedSigning() }; +} +*/ + +#signingPanelLayout { + selected: { String.valueOf(model.getSelectedSigning() != null) }; +} + +#nameLabel { + text: "faxtomail.signings.settings.name.label"; +} + +#nameField { + text: { model.getSelectedSigningName() }; +} + +#textLabel { + text: "faxtomail.signings.settings.text.label"; +} + +#textField { + text: { model.getSelectedSigningText() }; +} + +#noSigningSelected { + text: "faxtomail.signings.settings.noSelection.label"; +} + +#cancelButton { + actionIcon: cancel; + text: "faxtomail.signings.settings.action.cancel"; + toolTipText: "faxtomail.signings.settings.action.cancel.tip"; +} + +#saveButton { + actionIcon: save; + text: "faxtomail.signings.settings.action.save"; + toolTipText: "faxtomail.signings.settings.action.save.tip"; + //_applicationAction: { com.franciaflex.faxtomail.ui.swing.actions.ReplyAction.class }; +} + +#setDefaultButton { + actionIcon: default; + text: "faxtomail.signings.settings.action.default"; + toolTipText: "faxtomail.signings.settings.action.default.tip"; + //_applicationAction: { com.franciaflex.faxtomail.ui.swing.actions.ReplyAction.class }; +} \ No newline at end of file diff --git a/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/reply/SigningSettingsUI.jaxx b/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/reply/SigningSettingsUI.jaxx new file mode 100644 index 0000000..860fee1 --- /dev/null +++ b/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/reply/SigningSettingsUI.jaxx @@ -0,0 +1,100 @@ +<!-- + #%L + FaxToMail :: UI + %% + Copyright (C) 2014 Mac-Groupe, Code Lutin + %% + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as + published by the Free Software Foundation, either version 3 of the + License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public + License along with this program. If not, see + <http://www.gnu.org/licenses/gpl-3.0.html>. + #L% + --> +<JSplitPane id='signingSettingsPanel' + implements='com.franciaflex.faxtomail.ui.swing.util.FaxToMailUI<SigningSettingsUIModel, SigningSettingsUIHandler>'> + + <import> + com.franciaflex.faxtomail.persistence.entities.Signing + com.franciaflex.faxtomail.ui.swing.util.FaxToMailUI + com.franciaflex.faxtomail.ui.swing.util.FaxToMailUIUtil + + javax.swing.SwingConstants + + jaxx.runtime.swing.CardLayout2Ext + </import> + + <SigningSettingsUIModel id='model' + initializer='getContextValue(SigningSettingsUIModel.class)'/> + + <!--<BeanValidator id='validator' bean='model'--> + <!--uiClass='jaxx.runtime.validator.swing.ui.ImageValidationUI'>--> + <!--<field name='from' component='fromComboBox'/>--> + <!--<field name='to' component='toField'/>--> + <!--<field name='subject' component='subjectField'/>--> + <!--<field name='totalAttachmentLength' component="attachmentsPanel"/>--> + <!--</BeanValidator>--> + + <CardLayout2Ext id='signingPanelLayout' + constructorParams='this, "signingPanel"'/> + + <Table> + <row> + <cell weightx="1.0" fill="both"> + <JLabel id="signingsLabel"/> + </cell> + <cell> + <JButton id="newSigningButton"/> + </cell> + </row> + <row> + <cell columns="2" weighty="1.0" fill="both"> + <JList id="signingList" genericType="Signing"/> + </cell> + </row> + </Table> + + <JPanel layout="{new BorderLayout()}"> + + <JPanel id="signingPanel" + layout="{ signingPanelLayout }" + constraints="BorderLayout.CENTER"> + <Table constraints='"true"'> + <row> + <cell> + <JLabel id="nameLabel"/> + </cell> + <cell weightx="1.0" fill="both" > + <JTextField id="nameField" onKeyReleased='handler.setText(event, "selectedSigningName")'/> + </cell> + </row> + <row> + <cell anchor="northwest"> + <JLabel id="textLabel"/> + </cell> + <cell weightx="1.0" weighty="1.0" fill="both" > + <JTextPane id="textField" onKeyReleased='handler.setText(event, "selectedSigningText")'/> + </cell> + </row> + </Table> + + <JLabel id="noSigningSelected" constraints='"false"'/> + + </JPanel> + + <JPanel constraints="BorderLayout.SOUTH"> + <JButton id="cancelButton" onActionPerformed="handler.cancel()"/> + <JButton id="saveButton"/> + <JButton id="setDefaultButton"/> + </JPanel> + </JPanel> + +</JSplitPane> diff --git a/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/reply/SigningSettingsUIHandler.java b/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/reply/SigningSettingsUIHandler.java new file mode 100644 index 0000000..234e5c7 --- /dev/null +++ b/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/reply/SigningSettingsUIHandler.java @@ -0,0 +1,69 @@ +package com.franciaflex.faxtomail.ui.swing.content.reply; + +import com.franciaflex.faxtomail.persistence.entities.Signing; +import com.franciaflex.faxtomail.ui.swing.util.AbstractFaxToMailUIHandler; +import jaxx.runtime.validator.swing.SwingValidator; +import org.nuiton.jaxx.application.swing.util.Cancelable; + +import javax.swing.*; +import java.awt.*; +import java.beans.PropertyChangeEvent; +import java.beans.PropertyChangeListener; +import java.util.Collection; +import java.util.List; + +/** + * @author Kevin Morin (Code Lutin) + * @since 1.4 + */ +public class SigningSettingsUIHandler extends AbstractFaxToMailUIHandler<SigningSettingsUIModel, SigningSettingsUI> implements Cancelable { + + @Override + public void beforeInit(SigningSettingsUI ui) { + super.beforeInit(ui); + + SigningSettingsUIModel model = new SigningSettingsUIModel(); + this.ui.setContextValue(model); + } + + @Override + public void afterInit(SigningSettingsUI ui) { + initUI(ui); + + SigningSettingsUIModel model = getModel(); + + model.addPropertyChangeListener(SigningSettingsUIModel.PROPERTY_SIGNINGS, new PropertyChangeListener() { + @Override + public void propertyChange(PropertyChangeEvent evt) { + + List<Signing> signings = (List<Signing>) evt.getNewValue(); + JList<Signing> signingList = getUI().getSigningList(); + signingList.setListData(signings.toArray(new Signing[signings.size()])); + } + }); + + Collection<Signing> stampSigning = getContext().getCurrentUser().getStampSigning(); + model.setSignings(stampSigning); + + getUI().getSigningList().setCellRenderer(newListCellRender(Signing.class)); + } + + @Override + public void cancel() { + getParentContainer(Dialog.class).setVisible(false); + } + + @Override + public void onCloseUI() { + } + + @Override + public SwingValidator<SigningSettingsUIModel> getValidator() { + return null; + } + + @Override + protected JComponent getComponentToFocus() { + return null; + } +} diff --git a/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/reply/SigningSettingsUIModel.java b/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/reply/SigningSettingsUIModel.java new file mode 100644 index 0000000..46a5f3c --- /dev/null +++ b/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/reply/SigningSettingsUIModel.java @@ -0,0 +1,70 @@ +package com.franciaflex.faxtomail.ui.swing.content.reply; + +import com.franciaflex.faxtomail.persistence.entities.Signing; +import org.jdesktop.beans.AbstractSerializableBean; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.List; + +/** + * @author Kevin Morin (Code Lutin) + * @since 1.4 + */ +public class SigningSettingsUIModel extends AbstractSerializableBean { + + public static final String PROPERTY_SIGNINGS = "signings"; + public static final String PROPERTY_SELECTED_SIGNING = "selectedSigning"; + public static final String PROPERTY_SELECTED_SIGNING_NAME = "selectedSigningName"; + public static final String PROPERTY_SELECTED_SIGNING_TEXT = "selectedSigningText"; + + protected List<Signing> signings = new ArrayList<>(); + protected Signing selectedSigning; + + public Signing getSelectedSigning() { + return selectedSigning; + } + + public void setSelectedSignings(Signing selectedSigning) { + Object oldValue = getSelectedSigning(); + this.selectedSigning = selectedSigning; + firePropertyChange(PROPERTY_SELECTED_SIGNING, oldValue, selectedSigning); + } + + public List<Signing> getSignings() { + return signings; + } + + public void setSignings(Collection<Signing> signings) { + this.signings.clear(); + if (signings != null) { + this.signings.addAll(signings); + } + firePropertyChange(PROPERTY_SIGNINGS, null, this.signings); + } + + public void addSigning(Signing signing) { + this.signings.add(signing); + firePropertyChange(PROPERTY_SIGNINGS, null, this.signings); + } + + public String getSelectedSigningName() { + return selectedSigning != null ? selectedSigning.getStamp().getLabel() : null; + } + + public void setSelectedSigningName(String selectedSigningName) { + Object oldValue = getSelectedSigningName(); + selectedSigning.getStamp().setLabel(selectedSigningName); + firePropertyChange(PROPERTY_SELECTED_SIGNING_NAME, oldValue, selectedSigningName); + } + + public String getSelectedSigningText() { + return selectedSigning != null ? selectedSigning.getStamp().getText() : null; + } + + public void setSelectedSigningText(String selectedSigningText) { + Object oldValue = getSelectedSigningText(); + selectedSigning.getStamp().setText(selectedSigningText); + firePropertyChange(PROPERTY_SELECTED_SIGNING_TEXT, oldValue, selectedSigningText); + } +} diff --git a/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/reply/actions/NewSigningAction.java b/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/reply/actions/NewSigningAction.java new file mode 100644 index 0000000..4902471 --- /dev/null +++ b/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/reply/actions/NewSigningAction.java @@ -0,0 +1,63 @@ +package com.franciaflex.faxtomail.ui.swing.content.reply.actions; + +import com.franciaflex.faxtomail.persistence.entities.Signing; +import com.franciaflex.faxtomail.persistence.entities.SigningImpl; +import com.franciaflex.faxtomail.persistence.entities.Stamp; +import com.franciaflex.faxtomail.persistence.entities.StampImpl; +import com.franciaflex.faxtomail.ui.swing.actions.AbstractFaxToMailAction; +import com.franciaflex.faxtomail.ui.swing.content.reply.SigningSettingsUI; +import com.franciaflex.faxtomail.ui.swing.content.reply.SigningSettingsUIHandler; +import com.franciaflex.faxtomail.ui.swing.content.reply.SigningSettingsUIModel; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + +import static org.nuiton.i18n.I18n.t; + +/** + * @author Kevin Morin (Code Lutin) + * @since 1.4 + */ +public class NewSigningAction extends AbstractFaxToMailAction<SigningSettingsUIModel, SigningSettingsUI, SigningSettingsUIHandler> { + + /** + * Logger. + */ + private static final Log log = LogFactory.getLog(NewSigningAction.class); + + protected Signing newSigning; + + public NewSigningAction(SigningSettingsUIHandler handler) { + super(handler, false); + } + + @Override + public boolean prepareAction() throws Exception { + return super.prepareAction(); + } + + @Override + public void doAction() throws Exception { + newSigning = new SigningImpl(); + Stamp stamp = new StampImpl(); + newSigning.setStamp(stamp); + } + + @Override + public void postSuccessAction() { + super.postSuccessAction(); + + getModel().addSigning(newSigning); + getModel().setSelectedSignings(newSigning); + getModel().setSelectedSigningName(t("faxtomail.signings.settings.action.newSigning.name")); + + if (log.isInfoEnabled()) { + log.info("new singning : " + getModel().getSelectedSigning().getStamp().getLabel()); + } + } + + @Override + protected void releaseAction() { + super.releaseAction(); + newSigning = null; + } +} diff --git a/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/reply/actions/OpenSigningSettingsAction.java b/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/reply/actions/OpenSigningSettingsAction.java new file mode 100644 index 0000000..79a6144 --- /dev/null +++ b/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/reply/actions/OpenSigningSettingsAction.java @@ -0,0 +1,44 @@ +package com.franciaflex.faxtomail.ui.swing.content.reply.actions; + +import com.franciaflex.faxtomail.ui.swing.actions.AbstractFaxToMailAction; +import com.franciaflex.faxtomail.ui.swing.content.reply.ReplyFormUI; +import com.franciaflex.faxtomail.ui.swing.content.reply.ReplyFormUIHandler; +import com.franciaflex.faxtomail.ui.swing.content.reply.ReplyFormUIModel; +import com.franciaflex.faxtomail.ui.swing.content.reply.SigningSettingsUI; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + +import java.awt.*; + +/** + * @author Kevin Morin (Code Lutin) + * @since 1.4 + */ +public class OpenSigningSettingsAction extends AbstractFaxToMailAction<ReplyFormUIModel, ReplyFormUI, ReplyFormUIHandler> { + + /** + * Logger. + */ + private static final Log log = LogFactory.getLog(OpenSigningSettingsAction.class); + + public OpenSigningSettingsAction(ReplyFormUIHandler handler) { + super(handler, false); + } + + @Override + public void doAction() throws Exception { + // do nothing + } + + @Override + public void postSuccessAction() { + super.postSuccessAction(); + + SigningSettingsUI signingSettingsUI = new SigningSettingsUI(getUI()); + handler.openDialog(signingSettingsUI, "test", new Dimension(600, 400)); + + if (log.isInfoEnabled()) { + log.info("setting closed"); + } + } +} 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 f6a0949..05027fa 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 @@ -278,6 +278,7 @@ faxtomail.reply.action.close=Fermer faxtomail.reply.action.close.tip=Fermer faxtomail.reply.action.forward=Transférer faxtomail.reply.action.forward.tip=Retransférer la réponse vers une autre adresse email +faxtomail.reply.action.signing.configure.tip=Configurer les signatures faxtomail.reply.action.validate=Envoyer faxtomail.reply.action.validate.tip=Envoyer la réponse au mail faxtomail.reply.attachment.label=%1$s (%2$s ko) @@ -316,6 +317,18 @@ faxtomail.searchToGroup.action.cancel.tip=Fermer la fenêtre sans grouper l'él faxtomail.searchToGroup.action.group=Grouper faxtomail.searchToGroup.action.group.tip=Grouper avec l'élément courant faxtomail.searchToGroup.title=Recherche de l'élément avec lequel grouper l'élément %s +faxtomail.signings.settings.action.cancel=Annuler +faxtomail.signings.settings.action.cancel.tip=Annuler et fermer la configuration des signatures +faxtomail.signings.settings.action.default=Par défault +faxtomail.signings.settings.action.default.tip=Signature par défault +faxtomail.signings.settings.action.newSigning.name=Nouvelle signature +faxtomail.signings.settings.action.newSigning.tip=Créer une nouvelle signature +faxtomail.signings.settings.action.save=Enregistrer +faxtomail.signings.settings.action.save.tip=Enregistrer les modifications faites à la signature +faxtomail.signings.settings.label=Signatures +faxtomail.signings.settings.name.label=Nom +faxtomail.signings.settings.noSelection.label=Sélectionnez une signature pour l'éditer +faxtomail.signings.settings.text.label=Texte faxtomail.systemUser=Système faxtomail.validator.error.email.clientCode.required=Code client requis faxtomail.validator.error.email.comment.required=Message requis diff --git a/faxtomail-ui-swing/src/main/resources/icons/action-default.png b/faxtomail-ui-swing/src/main/resources/icons/action-default.png new file mode 100644 index 0000000..b88c857 Binary files /dev/null and b/faxtomail-ui-swing/src/main/resources/icons/action-default.png differ diff --git a/faxtomail-ui-swing/src/main/resources/icons/action-settings.png b/faxtomail-ui-swing/src/main/resources/icons/action-settings.png new file mode 100644 index 0000000..67de2c6 Binary files /dev/null and b/faxtomail-ui-swing/src/main/resources/icons/action-settings.png differ -- 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 http://git.codelutin.com/faxtomail.git commit 0810bf027973d5c82750fa6d6e67e35624d7024a Author: Kevin Morin <morin@codelutin.com> Date: Tue Aug 25 18:29:50 2015 +0200 - modif du modèle de signatures (plus de Signing, directement des stamp et un lien entre le stamp et le user pour le default) - enregistrement des signatures et mise par défaut refs #7419 --- faxtomail-persistence/src/main/xmi/faxtomail.zargo | Bin 32665 -> 32540 bytes .../faxtomail/services/DecoratorServiceImpl.java | 13 --- .../services/service/LdapServiceImpl.java | 2 +- .../faxtomail/services/service/UserService.java | 4 + .../services/service/UserServiceImpl.java | 31 +++++++ .../services/service/ldap/LdapServiceMock.java | 3 +- .../h2/V1_4_0_150817__add_signings_to_users.sql | 27 ++----- .../V1_4_0_150817__add_signings_to_users.sql | 29 ++----- .../ui/swing/actions/OpenGroupedDemandAction.java | 13 +-- .../ui/swing/content/reply/ReplyFormUI.css | 11 +-- .../ui/swing/content/reply/ReplyFormUI.jaxx | 6 +- .../ui/swing/content/reply/ReplyFormUIHandler.java | 28 +++---- .../ui/swing/content/reply/ReplyFormUIModel.java | 18 ++--- .../ui/swing/content/reply/SigningSettingsUI.css | 6 +- .../ui/swing/content/reply/SigningSettingsUI.jaxx | 4 +- .../content/reply/SigningSettingsUIHandler.java | 90 +++++++++++++++++++-- .../content/reply/SigningSettingsUIModel.java | 77 +++++++++++++++--- .../content/reply/actions/NewSigningAction.java | 21 +++-- .../reply/actions/OpenSigningSettingsAction.java | 12 ++- .../content/reply/actions/SaveSigningAction.java | 49 +++++++++++ .../reply/actions/SetDefaultSigningAction.java | 50 ++++++++++++ .../i18n/faxtomail-ui-swing_fr_FR.properties | 5 +- 22 files changed, 358 insertions(+), 141 deletions(-) diff --git a/faxtomail-persistence/src/main/xmi/faxtomail.zargo b/faxtomail-persistence/src/main/xmi/faxtomail.zargo index f89ff84..dc84d52 100644 Binary files a/faxtomail-persistence/src/main/xmi/faxtomail.zargo and b/faxtomail-persistence/src/main/xmi/faxtomail.zargo differ diff --git a/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/DecoratorServiceImpl.java b/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/DecoratorServiceImpl.java index f4c78f9..18c6ceb 100644 --- a/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/DecoratorServiceImpl.java +++ b/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/DecoratorServiceImpl.java @@ -30,11 +30,9 @@ import com.franciaflex.faxtomail.persistence.entities.Client; import com.franciaflex.faxtomail.persistence.entities.FaxToMailUser; import com.franciaflex.faxtomail.persistence.entities.HasLabel; import com.franciaflex.faxtomail.persistence.entities.Reply; -import com.franciaflex.faxtomail.persistence.entities.Signing; import com.franciaflex.faxtomail.services.service.ldap.Contact; import org.nuiton.decorator.Decorator; import org.nuiton.decorator.DecoratorProvider; -import org.nuiton.decorator.JXPathDecorator; import java.text.DateFormat; import java.util.Date; @@ -142,17 +140,6 @@ public class DecoratorServiceImpl extends FaxToMailServiceSupport implements Dec registerMultiJXPathDecorator(Reply.class, "${sentDate}$s#${subject}$s", SEPARATOR, " - "); registerMultiJXPathDecorator(FaxToMailUser.class, "${lastName}$s#${firstName}$s#${trigraph}$s", SEPARATOR, " "); registerMultiJXPathDecorator(Client.class, "${code}$s#${name}$s#${brand}$s", SEPARATOR, " - "); - registerDecorator(new JXPathDecorator<Signing>(Signing.class, "", null) { - private static final long serialVersionUID = 1L; - - @Override - public String toString(Object bean) { - if (bean == null) { - return ""; - } - return ((Signing) bean).getStamp().getLabel(); - } - }); } }; } diff --git a/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/LdapServiceImpl.java b/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/LdapServiceImpl.java index 4ec9421..9045b20 100644 --- a/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/LdapServiceImpl.java +++ b/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/LdapServiceImpl.java @@ -390,7 +390,7 @@ public class LdapServiceImpl extends FaxToMailServiceSupport implements LdapServ // force collection loading to force non lazy collections user.isAffectedFoldersEmpty(); user.isUserGroupsEmpty(); - user.isStampSigningEmpty(); + user.isSigningsEmpty(); return user; } diff --git a/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/UserService.java b/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/UserService.java index 9dbb6bf..1025e0a 100644 --- a/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/UserService.java +++ b/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/UserService.java @@ -26,6 +26,7 @@ package com.franciaflex.faxtomail.services.service; import com.franciaflex.faxtomail.persistence.entities.FaxToMailUser; import com.franciaflex.faxtomail.persistence.entities.FaxToMailUserGroup; +import com.franciaflex.faxtomail.persistence.entities.Stamp; import com.franciaflex.faxtomail.services.FaxToMailService; import java.util.List; @@ -53,4 +54,7 @@ public interface UserService extends FaxToMailService { List<FaxToMailUserGroup> getAllActiveUserGroups(); FaxToMailUser getUser(String topiaId); + + Stamp saveSigning(FaxToMailUser user, Stamp signing, boolean defaultSigning); + } diff --git a/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/UserServiceImpl.java b/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/UserServiceImpl.java index ab10244..d71bbf5 100644 --- a/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/UserServiceImpl.java +++ b/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/UserServiceImpl.java @@ -28,7 +28,10 @@ import com.franciaflex.faxtomail.persistence.entities.FaxToMailUser; import com.franciaflex.faxtomail.persistence.entities.FaxToMailUserGroup; import com.franciaflex.faxtomail.persistence.entities.FaxToMailUserGroupTopiaDao; import com.franciaflex.faxtomail.persistence.entities.FaxToMailUserTopiaDao; +import com.franciaflex.faxtomail.persistence.entities.Stamp; +import com.franciaflex.faxtomail.persistence.entities.StampTopiaDao; import com.franciaflex.faxtomail.services.FaxToMailServiceSupport; +import com.google.common.base.Preconditions; import org.hibernate.Hibernate; import java.util.List; @@ -91,4 +94,32 @@ public class UserServiceImpl extends FaxToMailServiceSupport implements UserServ Hibernate.initialize(user.getAffectedFolders()); return user; } + + @Override + public Stamp saveSigning(FaxToMailUser user, Stamp signing, boolean defaultSigning) { + Preconditions.checkNotNull(user); + Preconditions.checkNotNull(signing); + Preconditions.checkArgument(!signing.isPersisted() || user.containsSignings(signing)); + + StampTopiaDao stampDao = getPersistenceContext().getStampDao(); + FaxToMailUserTopiaDao userDao = getPersistenceContext().getFaxToMailUserDao(); + + if (signing.isPersisted()) { + stampDao.update(signing); + + } else { + stampDao.create(signing); + user.addSignings(signing); + userDao.update(user); + } + + if (defaultSigning) { + user.setDefaultSigning(signing); + userDao.update(user); + } + + getPersistenceContext().commit(); + + return signing; + } } diff --git a/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/ldap/LdapServiceMock.java b/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/ldap/LdapServiceMock.java index 2771fed..fe29972 100644 --- a/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/ldap/LdapServiceMock.java +++ b/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/ldap/LdapServiceMock.java @@ -109,7 +109,8 @@ public class LdapServiceMock extends LdapServiceImpl { // force collection loading to force non lazy collections result.isAffectedFoldersEmpty(); result.isUserGroupsEmpty(); - result.isStampSigningEmpty(); + result.isSigningsEmpty(); + return result; } } diff --git a/faxtomail-service/src/main/resources/db/migration/h2/V1_4_0_150817__add_signings_to_users.sql b/faxtomail-service/src/main/resources/db/migration/h2/V1_4_0_150817__add_signings_to_users.sql index 6362b12..2404832 100644 --- a/faxtomail-service/src/main/resources/db/migration/h2/V1_4_0_150817__add_signings_to_users.sql +++ b/faxtomail-service/src/main/resources/db/migration/h2/V1_4_0_150817__add_signings_to_users.sql @@ -1,25 +1,5 @@ -- add signings -create table SIGNING ( - topiaId varchar(255) not null, - topiaVersion bigint not null, - topiaCreateDate timestamp, - defaultsigning boolean, - stamp varchar(255), - faxtomailuser varchar(255), - primary key (topiaId) -); - -alter table SIGNING - add constraint FK_GD2AAMHXEMVLK1YBJO29P2GE5_INDEX_A - foreign key (faxtomailuser) - references faxtomailuser; - -alter table SIGNING - add constraint FK_QACW13RQL32JL97IM0EOHSL4Y_INDEX_A - foreign key (stamp) - references stamp; - alter table stamp add signing boolean; alter table stamp add faxtomailuser varchar(255); @@ -30,3 +10,10 @@ alter table stamp update stamp set signing = 'f'; +-- add default signing + +alter table faxtomailuser add defaultsigning varchar(255); +alter table faxtomailuser + add constraint FK_CDWL91T1FPNO1PW07532VPN21_INDEX_7 + foreign key (defaultsigning) + references stamp; diff --git a/faxtomail-service/src/main/resources/db/migration/sqlserver/V1_4_0_150817__add_signings_to_users.sql b/faxtomail-service/src/main/resources/db/migration/sqlserver/V1_4_0_150817__add_signings_to_users.sql index 62e34ae..3b9c353 100644 --- a/faxtomail-service/src/main/resources/db/migration/sqlserver/V1_4_0_150817__add_signings_to_users.sql +++ b/faxtomail-service/src/main/resources/db/migration/sqlserver/V1_4_0_150817__add_signings_to_users.sql @@ -1,28 +1,8 @@ -- add signings -create table SIGNING ( - topiaId varchar(255) not null, - topiaVersion bigint not null, - topiaCreateDate datetime2, - defaultsigning bit, - stamp varchar(255), - faxtomailuser varchar(255), - primary key (topiaId) -); - -alter table SIGNING - add constraint FK_GD2AAMHXEMVLK1YBJO29P2GE5_INDEX_A - foreign key (faxtomailuser) - references faxtomailuser; - -alter table SIGNING - add constraint FK_QACW13RQL32JL97IM0EOHSL4Y_INDEX_A - foreign key (stamp) - references stamp; - alter table stamp add signing bit; -alter table stamp add faxtomailuser varchar(255); +alter table stamp add faxtomailuser varchar(255); alter table stamp add constraint FK_KPY7QI4OX3LIY20GRSP7D449M_INDEX_4 foreign key (faxtomailuser) @@ -30,3 +10,10 @@ alter table stamp update stamp set signing = 0; +-- add default signing + +alter table faxtomailuser add defaultsigning varchar(255); +alter table faxtomailuser + add constraint FK_CDWL91T1FPNO1PW07532VPN21_INDEX_7 + foreign key (defaultsigning) + references stamp; \ No newline at end of file diff --git a/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/OpenGroupedDemandAction.java b/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/OpenGroupedDemandAction.java index d8bc25d..eab1fc3 100644 --- a/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/OpenGroupedDemandAction.java +++ b/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/OpenGroupedDemandAction.java @@ -27,23 +27,18 @@ package com.franciaflex.faxtomail.ui.swing.actions; import com.franciaflex.faxtomail.persistence.entities.Email; import com.franciaflex.faxtomail.persistence.entities.FaxToMailUser; import com.franciaflex.faxtomail.persistence.entities.MailFolder; -import com.franciaflex.faxtomail.persistence.entities.RangeRow; import com.franciaflex.faxtomail.services.FaxToMailServiceContext; import com.franciaflex.faxtomail.services.service.EmailService; import com.franciaflex.faxtomail.services.service.exceptions.AlreadyLockedMailException; import com.franciaflex.faxtomail.services.service.exceptions.FolderNotReadableException; -import com.franciaflex.faxtomail.ui.swing.content.MainUIHandler; import com.franciaflex.faxtomail.ui.swing.content.demande.DemandeUIModel; import com.franciaflex.faxtomail.ui.swing.content.demande.DemandesUI; -import com.franciaflex.faxtomail.ui.swing.content.demande.RangeRowModel; import com.franciaflex.faxtomail.ui.swing.content.demande.demandgroup.DemandGroupUI; import com.franciaflex.faxtomail.ui.swing.content.demande.demandgroup.DemandGroupUIHandler; import org.apache.commons.lang3.StringUtils; import org.nuiton.jaxx.application.swing.AbstractApplicationUIHandler; import javax.swing.*; -import java.util.ArrayList; -import java.util.Collection; import static org.nuiton.i18n.I18n.t; @@ -65,8 +60,8 @@ public class OpenGroupedDemandAction extends AbstractFaxToMailAction<DemandeUIMo public boolean prepareAction() throws Exception { boolean result = super.prepareAction(); - MainUIHandler mainUIHandler = getContext().getMainUI().getHandler(); - DemandesUI parentContainer = (DemandesUI) mainUIHandler.getCurrentBody(); + JFrame currentFrame = getContext().getFrameForDemande(getModel()); + DemandesUI parentContainer = (DemandesUI) currentFrame.getContentPane(); if (parentContainer.getModel().containsDemand(demandToOpen)) { openDemandScreen(); result = false; @@ -175,8 +170,8 @@ public class OpenGroupedDemandAction extends AbstractFaxToMailAction<DemandeUIMo } protected void openDemandScreen() { - MainUIHandler mainUIHandler = getContext().getMainUI().getHandler(); - DemandesUI parentContainer = (DemandesUI) mainUIHandler.getCurrentBody(); + JFrame currentFrame = getContext().getFrameForDemande(getModel()); + DemandesUI parentContainer = (DemandesUI) currentFrame.getContentPane(); parentContainer.getModel().addDemand(demandToOpen); } } 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 4cd1704..7389a8a 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 @@ -121,26 +121,27 @@ editable: { !model.isReadonly() }; } -#signingComboBox { +#stampComboBox { showReset: true; showDecorator: false; bean: {model}; - property: signing; - selectedItem: { model.getSigning() }; + property: stamp; + selectedItem: { model.getStamp() }; } #configureSigningButton { - actionIcon: config; + actionIcon: settings; toolTipText: "faxtomail.reply.action.signing.configure.tip"; _applicationAction: { com.franciaflex.faxtomail.ui.swing.content.reply.actions.OpenSigningSettingsAction.class }; } #signingScrollPanel { - visible: { model.getSigning() != null }; + visible: { model.getStamp() != null }; } #signingPanel { editable: false; + text: { model.getStamp().getText() }; } #attachmentsPanel { 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 fb7b213..b9785cf 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 @@ -23,7 +23,7 @@ implements='com.franciaflex.faxtomail.ui.swing.util.FaxToMailUI<ReplyFormUIModel, ReplyFormUIHandler>'> <import> - com.franciaflex.faxtomail.persistence.entities.Signing + com.franciaflex.faxtomail.persistence.entities.Stamp com.franciaflex.faxtomail.services.service.ldap.Contact com.franciaflex.faxtomail.ui.swing.util.FaxToMailUI com.franciaflex.faxtomail.ui.swing.util.FaxToMailUIUtil @@ -159,9 +159,9 @@ <Table fill="both"> <row> <cell weightx="1"> - <BeanComboBox id="signingComboBox" + <BeanComboBox id="stampComboBox" constructorParams='this' - genericType="Signing"/> + genericType="Stamp"/> </cell> <cell> <JButton id="configureSigningButton"/> 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 497aa67..a2f4c59 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 @@ -28,23 +28,20 @@ import com.franciaflex.faxtomail.persistence.entities.Attachment; import com.franciaflex.faxtomail.persistence.entities.AttachmentFile; import com.franciaflex.faxtomail.persistence.entities.AttachmentFileImpl; import com.franciaflex.faxtomail.persistence.entities.AttachmentImpl; +import com.franciaflex.faxtomail.persistence.entities.FaxToMailUser; import com.franciaflex.faxtomail.persistence.entities.MailFolder; -import com.franciaflex.faxtomail.persistence.entities.Signing; +import com.franciaflex.faxtomail.persistence.entities.Stamp; import com.franciaflex.faxtomail.services.service.ldap.Contact; import com.franciaflex.faxtomail.ui.swing.actions.AddAttachmentToReplyAction; import com.franciaflex.faxtomail.ui.swing.content.demande.DemandeUIModel; import com.franciaflex.faxtomail.ui.swing.util.AbstractFaxToMailUIHandler; import com.franciaflex.faxtomail.ui.swing.util.FaxToMailUIUtil; -import com.google.common.base.Optional; -import com.google.common.base.Predicate; import com.google.common.base.Strings; -import com.google.common.collect.Iterables; import com.google.common.collect.Lists; import jaxx.runtime.JAXXUtil; import jaxx.runtime.SwingUtil; import jaxx.runtime.validator.swing.SwingValidator; import org.apache.commons.io.FileUtils; -import org.apache.commons.lang3.BooleanUtils; import org.apache.commons.lang3.StringUtils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; @@ -211,23 +208,16 @@ public class ReplyFormUIHandler extends AbstractFaxToMailUIHandler<ReplyFormUIMo } }); - Collection<Signing> stampSigning = getContext().getCurrentUser().getStampSigning(); - List<Signing> signings = new ArrayList<>(); + FaxToMailUser currentUser = getContext().getCurrentUser(); + Collection<Stamp> userStamps = currentUser.getSignings(); + List<Stamp> stamps = new ArrayList<>(); - if (stampSigning != null) { - signings.addAll(stampSigning); - Optional<Signing> signingOptional = Iterables.tryFind(stampSigning, new Predicate<Signing>() { - @Override - public boolean apply(Signing input) { - return BooleanUtils.isTrue(input.getDefaultSigning()); - } - }); - if (signingOptional.isPresent()) { - model.setSigning(signingOptional.get()); - } + if (userStamps != null) { + stamps.addAll(userStamps); + model.setStamp(currentUser.getDefaultSigning()); } - initBeanComboBox(ui.getSigningComboBox(), signings, model.getSigning()); + initBeanComboBox(ui.getStampComboBox(), stamps, model.getStamp()); } @Override 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 fa51d61..4deecc8 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 @@ -24,7 +24,7 @@ package com.franciaflex.faxtomail.ui.swing.content.reply; * #L% */ -import com.franciaflex.faxtomail.persistence.entities.Signing; +import com.franciaflex.faxtomail.persistence.entities.Stamp; import com.franciaflex.faxtomail.services.service.ldap.Contact; import com.franciaflex.faxtomail.ui.swing.content.demande.DemandeUIModel; import com.google.common.base.Preconditions; @@ -54,7 +54,7 @@ public class ReplyFormUIModel extends AbstractSerializableBean { public static final String PROPERTY_SUBJECT = "subject"; public static final String PROPERTY_MESSAGE = "message"; public static final String PROPERTY_ORIGINAL_DEMAND = "originalDemand"; - public static final String PROPERTY_SIGNING = "signing"; + public static final String PROPERTY_STAMP = "stamp"; public static final String PROPERTY_ATTACHMENT = "attachment"; public static final String PROPERTY_MAX_ATTACHMENT_LENGTH = "maxAttachmentLength"; public static final String PROPERTY_TOTAL_ATTACHMENT_LENGTH = "totalAttachmentLength"; @@ -73,7 +73,7 @@ public class ReplyFormUIModel extends AbstractSerializableBean { protected String subject; protected String message; protected DemandeUIModel originalDemand; - protected Signing signing; + protected Stamp stamp; protected long maxAttachmentLength = 0; protected long totalAttachmentLength = 0; protected boolean valid = true; @@ -180,14 +180,14 @@ public class ReplyFormUIModel extends AbstractSerializableBean { firePropertyChange(PROPERTY_ORIGINAL_DEMAND, oldValue, originalDemand); } - public Signing getSigning() { - return signing; + public Stamp getStamp() { + return stamp; } - public void setSigning(Signing signing) { - Object oldValue = getSigning(); - this.signing = signing; - firePropertyChange(PROPERTY_SIGNING, oldValue, signing); + public void setStamp(Stamp stamp) { + Object oldValue = getStamp(); + this.stamp = stamp; + firePropertyChange(PROPERTY_STAMP, oldValue, stamp); } public Set<ReplyAttachmentModel> getAttachments() { diff --git a/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/reply/SigningSettingsUI.css b/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/reply/SigningSettingsUI.css index 6d3f5ed..15c8e8f 100644 --- a/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/reply/SigningSettingsUI.css +++ b/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/reply/SigningSettingsUI.css @@ -49,12 +49,14 @@ actionIcon: save; text: "faxtomail.signings.settings.action.save"; toolTipText: "faxtomail.signings.settings.action.save.tip"; - //_applicationAction: { com.franciaflex.faxtomail.ui.swing.actions.ReplyAction.class }; + _applicationAction: { com.franciaflex.faxtomail.ui.swing.content.reply.actions.SaveSigningAction.class }; + enabled: { model.getSelectedSigning() != null && model.isModified() }; } #setDefaultButton { actionIcon: default; text: "faxtomail.signings.settings.action.default"; toolTipText: "faxtomail.signings.settings.action.default.tip"; - //_applicationAction: { com.franciaflex.faxtomail.ui.swing.actions.ReplyAction.class }; + _applicationAction: { com.franciaflex.faxtomail.ui.swing.content.reply.actions.SetDefaultSigningAction.class }; + enabled: { model.isSetDefaultButtonEnabled() }; } \ No newline at end of file diff --git a/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/reply/SigningSettingsUI.jaxx b/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/reply/SigningSettingsUI.jaxx index 860fee1..26afbfa 100644 --- a/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/reply/SigningSettingsUI.jaxx +++ b/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/reply/SigningSettingsUI.jaxx @@ -23,7 +23,7 @@ implements='com.franciaflex.faxtomail.ui.swing.util.FaxToMailUI<SigningSettingsUIModel, SigningSettingsUIHandler>'> <import> - com.franciaflex.faxtomail.persistence.entities.Signing + com.franciaflex.faxtomail.persistence.entities.Stamp com.franciaflex.faxtomail.ui.swing.util.FaxToMailUI com.franciaflex.faxtomail.ui.swing.util.FaxToMailUIUtil @@ -57,7 +57,7 @@ </row> <row> <cell columns="2" weighty="1.0" fill="both"> - <JList id="signingList" genericType="Signing"/> + <JList id="signingList" genericType="Stamp"/> </cell> </row> </Table> diff --git a/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/reply/SigningSettingsUIHandler.java b/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/reply/SigningSettingsUIHandler.java index 234e5c7..f0723e7 100644 --- a/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/reply/SigningSettingsUIHandler.java +++ b/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/reply/SigningSettingsUIHandler.java @@ -1,23 +1,37 @@ package com.franciaflex.faxtomail.ui.swing.content.reply; -import com.franciaflex.faxtomail.persistence.entities.Signing; +import com.franciaflex.faxtomail.persistence.entities.Stamp; +import com.franciaflex.faxtomail.ui.swing.content.reply.actions.SaveSigningAction; import com.franciaflex.faxtomail.ui.swing.util.AbstractFaxToMailUIHandler; +import jaxx.runtime.swing.renderer.DecoratorListCellRenderer; import jaxx.runtime.validator.swing.SwingValidator; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.nuiton.decorator.Decorator; import org.nuiton.jaxx.application.swing.util.Cancelable; import javax.swing.*; +import javax.swing.event.ListSelectionEvent; +import javax.swing.event.ListSelectionListener; import java.awt.*; import java.beans.PropertyChangeEvent; import java.beans.PropertyChangeListener; import java.util.Collection; import java.util.List; +import static org.nuiton.i18n.I18n.t; + /** * @author Kevin Morin (Code Lutin) * @since 1.4 */ public class SigningSettingsUIHandler extends AbstractFaxToMailUIHandler<SigningSettingsUIModel, SigningSettingsUI> implements Cancelable { + /** + * Logger. + */ + private static final Log log = LogFactory.getLog(SigningSettingsUIHandler.class); + @Override public void beforeInit(SigningSettingsUI ui) { super.beforeInit(ui); @@ -36,16 +50,63 @@ public class SigningSettingsUIHandler extends AbstractFaxToMailUIHandler<Signing @Override public void propertyChange(PropertyChangeEvent evt) { - List<Signing> signings = (List<Signing>) evt.getNewValue(); - JList<Signing> signingList = getUI().getSigningList(); - signingList.setListData(signings.toArray(new Signing[signings.size()])); + List<Stamp> signings = (List<Stamp>) evt.getNewValue(); + JList<Stamp> signingList = getUI().getSigningList(); + signingList.setListData(signings.toArray(new Stamp[signings.size()])); + } + }); + + model.addPropertyChangeListener(SigningSettingsUIModel.PROPERTY_SELECTED_SIGNING, new PropertyChangeListener() { + @Override + public void propertyChange(PropertyChangeEvent evt) { + getUI().getSigningList().setSelectedValue(evt.getNewValue(), true); } }); - Collection<Signing> stampSigning = getContext().getCurrentUser().getStampSigning(); + Collection<Stamp> stampSigning = getContext().getCurrentUser().getSignings(); model.setSignings(stampSigning); - getUI().getSigningList().setCellRenderer(newListCellRender(Signing.class)); + JList<Stamp> signingList = getUI().getSigningList(); + + Decorator<Stamp> signingDecorator = getDecorator(Stamp.class, null); + ListCellRenderer listCellRenderer = new SigningListCellRenderer(signingDecorator); + signingList.setCellRenderer(listCellRenderer); + + signingList.addListSelectionListener(new ListSelectionListener() { + @Override + public void valueChanged(ListSelectionEvent e) { + if (!e.getValueIsAdjusting()) { + + SigningSettingsUIModel model = getModel(); + JList<Stamp> list = (JList<Stamp>) e.getSource(); + + if (model.isModified()) { + int saveAnswer = askSaveBeforeLeaving(t("faxtomail.signings.settings.saveBeforeLeaving", + model.getSelectedSigningName())); + switch (saveAnswer) { + case JOptionPane.CANCEL_OPTION: + model.setModified(false); // don't cause yet another prompt when reverting selection + list.setSelectedValue(model.getSelectedSigning(), true); + model.setModified(true); + return; + + case JOptionPane.YES_OPTION: + getContext().getActionEngine().runActionAndWait(SigningSettingsUIHandler.this, SaveSigningAction.class); + break; + + case JOptionPane.NO_OPTION: + model.resetSelectedSigning(); + break; + } + } + + Stamp selectedValue = list.getSelectedValue(); + model.setSelectedSigning(selectedValue); + model.setSelectedSigningDefault(selectedValue.equals(getContext().getCurrentUser().getDefaultSigning())); + } + } + }); + } @Override @@ -66,4 +127,21 @@ public class SigningSettingsUIHandler extends AbstractFaxToMailUIHandler<Signing protected JComponent getComponentToFocus() { return null; } + + private class SigningListCellRenderer extends DecoratorListCellRenderer { + + public SigningListCellRenderer(Decorator<Stamp> decorator) { + super(decorator); + } + + @Override + protected Object decorateValue(Object value, int index) { + String label = (String) super.decorateValue(value, index); + Stamp signing = (Stamp) value; + if (signing != null && signing.equals(getContext().getCurrentUser().getDefaultSigning())) { + label = "<html><strong>" + label + "</strong></html>"; + } + return label; + } + } } diff --git a/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/reply/SigningSettingsUIModel.java b/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/reply/SigningSettingsUIModel.java index 46a5f3c..cdb40dd 100644 --- a/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/reply/SigningSettingsUIModel.java +++ b/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/reply/SigningSettingsUIModel.java @@ -1,6 +1,6 @@ package com.franciaflex.faxtomail.ui.swing.content.reply; -import com.franciaflex.faxtomail.persistence.entities.Signing; +import com.franciaflex.faxtomail.persistence.entities.Stamp; import org.jdesktop.beans.AbstractSerializableBean; import java.util.ArrayList; @@ -17,25 +17,39 @@ public class SigningSettingsUIModel extends AbstractSerializableBean { public static final String PROPERTY_SELECTED_SIGNING = "selectedSigning"; public static final String PROPERTY_SELECTED_SIGNING_NAME = "selectedSigningName"; public static final String PROPERTY_SELECTED_SIGNING_TEXT = "selectedSigningText"; + public static final String PROPERTY_SELECTED_SIGNING_DEFAULT = "selectedSigningDefault"; + public static final String PROPERTY_SET_DEFAULT_BUTTON_ENABLED = "setDefaultButtonEnabled"; + public static final String PROPERTY_MODIFIED = "modified"; - protected List<Signing> signings = new ArrayList<>(); - protected Signing selectedSigning; - public Signing getSelectedSigning() { + protected List<Stamp> signings = new ArrayList<>(); + protected Stamp selectedSigning; + protected String selectedSigningName; + protected String selectedSigningText; + protected boolean selectedSigningDefault; + protected boolean modified; + + public Stamp getSelectedSigning() { return selectedSigning; } - public void setSelectedSignings(Signing selectedSigning) { + public void setSelectedSigning(Stamp selectedSigning) { Object oldValue = getSelectedSigning(); this.selectedSigning = selectedSigning; firePropertyChange(PROPERTY_SELECTED_SIGNING, oldValue, selectedSigning); + + setSelectedSigningName(selectedSigning.getLabel()); + setSelectedSigningText(selectedSigning.getText()); + + setModified(false); + updateSetDefaultButtonEnabled(); } - public List<Signing> getSignings() { + public List<Stamp> getSignings() { return signings; } - public void setSignings(Collection<Signing> signings) { + public void setSignings(Collection<Stamp> signings) { this.signings.clear(); if (signings != null) { this.signings.addAll(signings); @@ -43,28 +57,67 @@ public class SigningSettingsUIModel extends AbstractSerializableBean { firePropertyChange(PROPERTY_SIGNINGS, null, this.signings); } - public void addSigning(Signing signing) { + public void addSigning(Stamp signing) { this.signings.add(signing); firePropertyChange(PROPERTY_SIGNINGS, null, this.signings); } public String getSelectedSigningName() { - return selectedSigning != null ? selectedSigning.getStamp().getLabel() : null; + return selectedSigningName; } public void setSelectedSigningName(String selectedSigningName) { Object oldValue = getSelectedSigningName(); - selectedSigning.getStamp().setLabel(selectedSigningName); + this.selectedSigningName = selectedSigningName; firePropertyChange(PROPERTY_SELECTED_SIGNING_NAME, oldValue, selectedSigningName); + setModified(true); } public String getSelectedSigningText() { - return selectedSigning != null ? selectedSigning.getStamp().getText() : null; + return selectedSigningText; } public void setSelectedSigningText(String selectedSigningText) { Object oldValue = getSelectedSigningText(); - selectedSigning.getStamp().setText(selectedSigningText); + this.selectedSigningText = selectedSigningText; firePropertyChange(PROPERTY_SELECTED_SIGNING_TEXT, oldValue, selectedSigningText); + setModified(true); + } + + public boolean isSelectedSigningDefault() { + return selectedSigningDefault; + } + + public void setSelectedSigningDefault(boolean selectedSigningDefault) { + Object oldValue = isSelectedSigningDefault(); + this.selectedSigningDefault = selectedSigningDefault; + firePropertyChange(PROPERTY_SELECTED_SIGNING_DEFAULT, oldValue, selectedSigningDefault); + updateSetDefaultButtonEnabled(); + } + + public boolean isSetDefaultButtonEnabled() { + return selectedSigning != null + && selectedSigning.isPersisted() + && !selectedSigningDefault; + } + + public void updateSetDefaultButtonEnabled() { + firePropertyChange(PROPERTY_SET_DEFAULT_BUTTON_ENABLED, null, isSetDefaultButtonEnabled()); + } + + public boolean isModified() { + return modified; + } + + public void setModified(boolean modified) { + Object oldValue = isModified(); + this.modified = modified; + firePropertyChange(PROPERTY_MODIFIED, oldValue, modified); + } + + public void resetSelectedSigning() { + setSelectedSigningName(selectedSigning.getLabel()); + setSelectedSigningText(selectedSigning.getText()); + setModified(false); } } diff --git a/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/reply/actions/NewSigningAction.java b/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/reply/actions/NewSigningAction.java index 4902471..1fa4c5b 100644 --- a/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/reply/actions/NewSigningAction.java +++ b/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/reply/actions/NewSigningAction.java @@ -1,7 +1,5 @@ package com.franciaflex.faxtomail.ui.swing.content.reply.actions; -import com.franciaflex.faxtomail.persistence.entities.Signing; -import com.franciaflex.faxtomail.persistence.entities.SigningImpl; import com.franciaflex.faxtomail.persistence.entities.Stamp; import com.franciaflex.faxtomail.persistence.entities.StampImpl; import com.franciaflex.faxtomail.ui.swing.actions.AbstractFaxToMailAction; @@ -24,7 +22,7 @@ public class NewSigningAction extends AbstractFaxToMailAction<SigningSettingsUIM */ private static final Log log = LogFactory.getLog(NewSigningAction.class); - protected Signing newSigning; + protected Stamp newSigning; public NewSigningAction(SigningSettingsUIHandler handler) { super(handler, false); @@ -37,22 +35,21 @@ public class NewSigningAction extends AbstractFaxToMailAction<SigningSettingsUIM @Override public void doAction() throws Exception { - newSigning = new SigningImpl(); - Stamp stamp = new StampImpl(); - newSigning.setStamp(stamp); + newSigning = new StampImpl(); + newSigning.setSigning(true); } @Override public void postSuccessAction() { super.postSuccessAction(); - getModel().addSigning(newSigning); - getModel().setSelectedSignings(newSigning); - getModel().setSelectedSigningName(t("faxtomail.signings.settings.action.newSigning.name")); + SigningSettingsUIModel model = getModel(); + model.addSigning(newSigning); + model.setSelectedSigning(newSigning); + model.setSelectedSigningDefault(false); + model.setSelectedSigningName(t("faxtomail.signings.settings.action.newSigning.name")); + model.updateSetDefaultButtonEnabled(); - if (log.isInfoEnabled()) { - log.info("new singning : " + getModel().getSelectedSigning().getStamp().getLabel()); - } } @Override diff --git a/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/reply/actions/OpenSigningSettingsAction.java b/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/reply/actions/OpenSigningSettingsAction.java index 79a6144..6faec84 100644 --- a/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/reply/actions/OpenSigningSettingsAction.java +++ b/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/reply/actions/OpenSigningSettingsAction.java @@ -1,5 +1,6 @@ package com.franciaflex.faxtomail.ui.swing.content.reply.actions; +import com.franciaflex.faxtomail.persistence.entities.Stamp; import com.franciaflex.faxtomail.ui.swing.actions.AbstractFaxToMailAction; import com.franciaflex.faxtomail.ui.swing.content.reply.ReplyFormUI; import com.franciaflex.faxtomail.ui.swing.content.reply.ReplyFormUIHandler; @@ -9,6 +10,9 @@ import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import java.awt.*; +import java.util.List; + +import static org.nuiton.i18n.I18n.t; /** * @author Kevin Morin (Code Lutin) @@ -35,10 +39,10 @@ public class OpenSigningSettingsAction extends AbstractFaxToMailAction<ReplyForm super.postSuccessAction(); SigningSettingsUI signingSettingsUI = new SigningSettingsUI(getUI()); - handler.openDialog(signingSettingsUI, "test", new Dimension(600, 400)); + handler.openDialog(signingSettingsUI, t("faxtomail.signings.settings.title"), new Dimension(600, 400)); - if (log.isInfoEnabled()) { - log.info("setting closed"); - } + List<Stamp> signings = signingSettingsUI.getModel().getSignings(); + getContext().getCurrentUser().setSignings(signings); + getUI().getStampComboBox().setData(signings); } } diff --git a/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/reply/actions/SaveSigningAction.java b/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/reply/actions/SaveSigningAction.java new file mode 100644 index 0000000..bc9a2c5 --- /dev/null +++ b/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/reply/actions/SaveSigningAction.java @@ -0,0 +1,49 @@ +package com.franciaflex.faxtomail.ui.swing.content.reply.actions; + +import com.franciaflex.faxtomail.persistence.entities.FaxToMailUser; +import com.franciaflex.faxtomail.persistence.entities.Stamp; +import com.franciaflex.faxtomail.services.service.UserService; +import com.franciaflex.faxtomail.ui.swing.actions.AbstractFaxToMailAction; +import com.franciaflex.faxtomail.ui.swing.content.reply.SigningSettingsUI; +import com.franciaflex.faxtomail.ui.swing.content.reply.SigningSettingsUIHandler; +import com.franciaflex.faxtomail.ui.swing.content.reply.SigningSettingsUIModel; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + +/** + * @author Kevin Morin (Code Lutin) + * @since 1.4 + */ +public class SaveSigningAction extends AbstractFaxToMailAction<SigningSettingsUIModel, SigningSettingsUI, SigningSettingsUIHandler> { + + /** + * Logger. + */ + private static final Log log = LogFactory.getLog(SaveSigningAction.class); + + public SaveSigningAction(SigningSettingsUIHandler handler) { + super(handler, false); + } + + @Override + public void doAction() throws Exception { + SigningSettingsUIModel model = getModel(); + Stamp signing = model.getSelectedSigning(); + signing.setLabel(model.getSelectedSigningName()); + signing.setText(model.getSelectedSigningText()); + + FaxToMailUser user = getContext().getCurrentUser(); + + UserService userService = getContext().newServiceContext().getUserService(); + userService.saveSigning(user, signing, user.isSigningsEmpty()); + + } + + @Override + public void postSuccessAction() { + super.postSuccessAction(); + getModel().updateSetDefaultButtonEnabled(); + getModel().setModified(false); + getUI().getSigningList().repaint(); + } +} diff --git a/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/reply/actions/SetDefaultSigningAction.java b/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/reply/actions/SetDefaultSigningAction.java new file mode 100644 index 0000000..242c3cb --- /dev/null +++ b/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/reply/actions/SetDefaultSigningAction.java @@ -0,0 +1,50 @@ +package com.franciaflex.faxtomail.ui.swing.content.reply.actions; + +import com.franciaflex.faxtomail.persistence.entities.FaxToMailUser; +import com.franciaflex.faxtomail.persistence.entities.Stamp; +import com.franciaflex.faxtomail.services.service.UserService; +import com.franciaflex.faxtomail.ui.swing.actions.AbstractFaxToMailAction; +import com.franciaflex.faxtomail.ui.swing.content.reply.SigningSettingsUI; +import com.franciaflex.faxtomail.ui.swing.content.reply.SigningSettingsUIHandler; +import com.franciaflex.faxtomail.ui.swing.content.reply.SigningSettingsUIModel; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + +/** + * @author Kevin Morin (Code Lutin) + * @since 1.4 + */ +public class SetDefaultSigningAction extends AbstractFaxToMailAction<SigningSettingsUIModel, SigningSettingsUI, SigningSettingsUIHandler> { + + /** + * Logger. + */ + private static final Log log = LogFactory.getLog(SetDefaultSigningAction.class); + + public SetDefaultSigningAction(SigningSettingsUIHandler handler) { + super(handler, false); + } + + @Override + public void doAction() throws Exception { + SigningSettingsUIModel model = getModel(); + Stamp signing = model.getSelectedSigning(); + signing.setLabel(model.getSelectedSigningName()); + signing.setText(model.getSelectedSigningText()); + + FaxToMailUser user = getContext().getCurrentUser(); + + UserService userService = getContext().newServiceContext().getUserService(); + userService.saveSigning(user, signing, true); + } + + @Override + public void postSuccessAction() { + super.postSuccessAction(); + + getModel().setSelectedSigningDefault(true); + getModel().updateSetDefaultButtonEnabled(); + getModel().setModified(false); + getUI().getSigningList().repaint(); + } +} 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 05027fa..55a061f 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 @@ -317,8 +317,8 @@ faxtomail.searchToGroup.action.cancel.tip=Fermer la fenêtre sans grouper l'él faxtomail.searchToGroup.action.group=Grouper faxtomail.searchToGroup.action.group.tip=Grouper avec l'élément courant faxtomail.searchToGroup.title=Recherche de l'élément avec lequel grouper l'élément %s -faxtomail.signings.settings.action.cancel=Annuler -faxtomail.signings.settings.action.cancel.tip=Annuler et fermer la configuration des signatures +faxtomail.signings.settings.action.cancel=Fermer +faxtomail.signings.settings.action.cancel.tip=Fermer la configuration des signatures sans enregistrer faxtomail.signings.settings.action.default=Par défault faxtomail.signings.settings.action.default.tip=Signature par défault faxtomail.signings.settings.action.newSigning.name=Nouvelle signature @@ -329,6 +329,7 @@ faxtomail.signings.settings.label=Signatures faxtomail.signings.settings.name.label=Nom faxtomail.signings.settings.noSelection.label=Sélectionnez une signature pour l'éditer faxtomail.signings.settings.text.label=Texte +faxtomail.signings.settings.title=Configuration des signatures faxtomail.systemUser=Système faxtomail.validator.error.email.clientCode.required=Code client requis faxtomail.validator.error.email.comment.required=Message requis -- 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 http://git.codelutin.com/faxtomail.git commit 9d34a5bd21b62a3c30705673b4155c488c6d8e4e Author: Kevin Morin <morin@codelutin.com> Date: Wed Aug 26 10:27:59 2015 +0200 - Envoi de la signature dans la réponse - mise en page refs #7419 --- .../faxtomail/services/service/EmailService.java | 3 +- .../services/service/EmailServiceImpl.java | 14 ++++++- .../ui/swing/content/reply/ReplyFormUI.css | 18 ++++++++- .../ui/swing/content/reply/ReplyFormUI.jaxx | 46 +++++++++++++--------- .../{ => content/reply}/actions/ReplyAction.java | 4 +- .../i18n/faxtomail-ui-swing_fr_FR.properties | 1 + 6 files changed, 61 insertions(+), 25 deletions(-) diff --git a/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/EmailService.java b/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/EmailService.java index cf07f89..3da0a7b 100644 --- a/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/EmailService.java +++ b/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/EmailService.java @@ -38,6 +38,7 @@ import com.franciaflex.faxtomail.persistence.entities.Range; import com.franciaflex.faxtomail.persistence.entities.Reply; import com.franciaflex.faxtomail.persistence.entities.ReplyContent; import com.franciaflex.faxtomail.persistence.entities.SearchFilter; +import com.franciaflex.faxtomail.persistence.entities.Stamp; import com.franciaflex.faxtomail.services.FaxToMailService; import com.franciaflex.faxtomail.services.service.exceptions.AlreadyLockedMailException; import com.franciaflex.faxtomail.services.service.exceptions.FolderNotReadableException; @@ -101,7 +102,7 @@ public interface EmailService extends FaxToMailService { Email groupEmails(String email1Id, String email2Id, FaxToMailUser user); Email reply(String from, String to, String cc, String bcc, String subject, - String content, Collection<AttachmentFile> attachments, + String content, Stamp signing, Collection<AttachmentFile> attachments, String originalEmailId, FaxToMailUser user) throws EmailException, MessagingException, IOException; /** diff --git a/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/EmailServiceImpl.java b/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/EmailServiceImpl.java index 8e0b3f8..b4b99a2 100644 --- a/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/EmailServiceImpl.java +++ b/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/EmailServiceImpl.java @@ -1092,6 +1092,7 @@ public class EmailServiceImpl extends FaxToMailServiceSupport implements EmailSe * @param bcc bcc * @param subject subject * @param content content + * @param signing signing * @param attachments attachement * @param originalEmailId mail topia id * @param user user to add new history entry for user @@ -1102,7 +1103,7 @@ public class EmailServiceImpl extends FaxToMailServiceSupport implements EmailSe */ @Override public Email reply(String from, String to, String cc, String bcc, String subject, - String content, Collection<AttachmentFile> attachments, + String content, Stamp signing, Collection<AttachmentFile> attachments, String originalEmailId, FaxToMailUser user) throws EmailException, MessagingException, IOException { Email email = getEmailById(originalEmailId, @@ -1135,10 +1136,19 @@ public class EmailServiceImpl extends FaxToMailServiceSupport implements EmailSe message.addBcc(bccs); } message.setSubject(subject); + + StringBuilder toSendContent = new StringBuilder(); if (StringUtils.isNotEmpty(content)) { - message.setMsg(content); + toSendContent.append(content); + } + + // l'insertion de cette signature sera faîte pour l'envoi de fax uniquement si un corps de mail est renseigné. + if (signing != null && (!email.isFax() || StringUtils.isNotEmpty(content))) { + toSendContent.append("\n\n").append(signing.getText()); } + message.setMsg(toSendContent.toString()); + for (AttachmentFile attachmentFile : attachments) { // Create the attachment File file = attachmentFile.getFile(); 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 7389a8a..04aa031 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 @@ -116,11 +116,25 @@ dividerLocation: 270; } +#signingSplitPane { + dividerSize: { model.isReadonly() ? 0 : 10 }; + resizeWeight: 1.0; + name: { "signingSplitPane" + model.isReadonly() }; // to save the state differently in the swing session +} + #message { text: { model.getMessage() }; editable: { !model.isReadonly() }; } +#signingPanel { + visible: { !model.isReadonly() }; +} + +#signingLabel { + text: "faxtomail.reply.label.signing"; +} + #stampComboBox { showReset: true; showDecorator: false; @@ -139,7 +153,7 @@ visible: { model.getStamp() != null }; } -#signingPanel { +#signingTextPanel { editable: false; text: { model.getStamp().getText() }; } @@ -203,7 +217,7 @@ actionIcon: reply; text: "faxtomail.reply.action.validate"; toolTipText: "faxtomail.reply.action.validate.tip"; - _applicationAction: { com.franciaflex.faxtomail.ui.swing.actions.ReplyAction.class }; + _applicationAction: { com.franciaflex.faxtomail.ui.swing.content.reply.actions.ReplyAction.class }; /* 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 b9785cf..f580568 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 @@ -151,30 +151,38 @@ <JSplitPane id="signingSplitPane" orientation="{JSplitPane.VERTICAL_SPLIT}"> + + <JScrollPane> <JTextPane id="message" onKeyReleased='handler.setText(event, "message")'/> </JScrollPane> - <Table fill="both"> - <row> - <cell weightx="1"> - <BeanComboBox id="stampComboBox" - constructorParams='this' - genericType="Stamp"/> - </cell> - <cell> - <JButton id="configureSigningButton"/> - </cell> - </row> - <row> - <cell columns="2" weighty="1.0"> - <JScrollPane id="signingScrollPanel"> - <JTextPane id="signingPanel"/> - </JScrollPane> - </cell> - </row> - </Table> + <JPanel id="signingPanel" + layout="{new BorderLayout()}"> + + <JPanel layout="{new BorderLayout()}" + constraints="BorderLayout.NORTH"> + + <JLabel id="signingLabel" + constraints="BorderLayout.WEST"/> + + <BeanComboBox id="stampComboBox" + constructorParams='this' + genericType="Stamp" + constraints="BorderLayout.CENTER"/> + + <JButton id="configureSigningButton" + constraints="BorderLayout.EAST"/> + + </JPanel> + + <JScrollPane id="signingScrollPanel" + constraints="BorderLayout.CENTER"> + <JTextPane id="signingTextPanel"/> + </JScrollPane> + + </JPanel> </JSplitPane> diff --git a/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/ReplyAction.java b/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/reply/actions/ReplyAction.java similarity index 94% rename from faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/ReplyAction.java rename to faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/reply/actions/ReplyAction.java index 082e0f9..7a8ba79 100644 --- a/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/ReplyAction.java +++ b/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/reply/actions/ReplyAction.java @@ -1,4 +1,4 @@ -package com.franciaflex.faxtomail.ui.swing.actions; +package com.franciaflex.faxtomail.ui.swing.content.reply.actions; /* * #%L @@ -28,6 +28,7 @@ import com.franciaflex.faxtomail.persistence.entities.AttachmentFile; import com.franciaflex.faxtomail.persistence.entities.Email; import com.franciaflex.faxtomail.services.FaxToMailServiceContext; import com.franciaflex.faxtomail.services.service.EmailService; +import com.franciaflex.faxtomail.ui.swing.actions.AbstractFaxToMailAction; import com.franciaflex.faxtomail.ui.swing.content.demande.DemandeUIModel; import com.franciaflex.faxtomail.ui.swing.content.reply.ReplyAttachmentModel; import com.franciaflex.faxtomail.ui.swing.content.reply.ReplyFormUI; @@ -75,6 +76,7 @@ public class ReplyAction extends AbstractFaxToMailAction<ReplyFormUIModel, Reply model.getCci(), model.getSubject(), model.getMessage(), + model.getStamp(), attachmentFiles, originalDemand.getTopiaId(), getContext().getCurrentUser()); 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 55a061f..dd9f924 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 @@ -290,6 +290,7 @@ faxtomail.reply.label.cc=Copie \: faxtomail.reply.label.cci=Copie cachée \: faxtomail.reply.label.contact=Contact \: faxtomail.reply.label.from=De \: +faxtomail.reply.label.signing=Signature faxtomail.reply.label.subject=Objet \: faxtomail.reply.label.to=À \: faxtomail.reply.message=\nLe %1$s, %2$s a écrit \:\n> %3$s -- 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 http://git.codelutin.com/faxtomail.git commit 0dd9e9537972124a7edcf2d87f57e5401c5468be Merge: 642f7df 9d34a5b Author: Kevin Morin <morin@codelutin.com> Date: Wed Aug 26 10:35:00 2015 +0200 fixes #7419 .../src/main/xmi/faxtomail.properties | 5 +- faxtomail-persistence/src/main/xmi/faxtomail.zargo | Bin 32016 -> 32540 bytes .../faxtomail/services/service/EmailService.java | 3 +- .../services/service/EmailServiceImpl.java | 14 +- .../services/service/InitFaxToMailServiceImpl.java | 29 +--- .../services/service/LdapServiceImpl.java | 1 + .../services/service/ReferentielServiceImpl.java | 9 +- .../faxtomail/services/service/UserService.java | 4 + .../services/service/UserServiceImpl.java | 31 +++++ .../services/service/ldap/LdapServiceMock.java | 2 + .../h2/V1_4_0_150817__add_signings_to_users.sql | 19 +++ .../V1_4_0_150817__add_signings_to_users.sql | 19 +++ .../ui/swing/actions/OpenGroupedDemandAction.java | 13 +- .../ui/swing/content/reply/ReplyFormUI.css | 41 +++++- .../ui/swing/content/reply/ReplyFormUI.jaxx | 43 +++++- .../ui/swing/content/reply/ReplyFormUIHandler.java | 15 ++- .../ui/swing/content/reply/ReplyFormUIModel.java | 13 ++ .../ui/swing/content/reply/SigningSettingsUI.css | 62 +++++++++ .../ui/swing/content/reply/SigningSettingsUI.jaxx | 100 ++++++++++++++ .../content/reply/SigningSettingsUIHandler.java | 147 +++++++++++++++++++++ .../content/reply/SigningSettingsUIModel.java | 123 +++++++++++++++++ .../content/reply/actions/NewSigningAction.java | 60 +++++++++ .../reply/actions/OpenSigningSettingsAction.java | 48 +++++++ .../{ => content/reply}/actions/ReplyAction.java | 4 +- .../content/reply/actions/SaveSigningAction.java | 49 +++++++ .../reply/actions/SetDefaultSigningAction.java | 50 +++++++ .../i18n/faxtomail-ui-swing_fr_FR.properties | 15 +++ .../src/main/resources/icons/action-default.png | Bin 0 -> 670 bytes .../src/main/resources/icons/action-settings.png | Bin 0 -> 512 bytes .../src/main/resources/struts.properties | 3 +- 30 files changed, 872 insertions(+), 50 deletions(-) -- 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 http://git.codelutin.com/faxtomail.git commit 533f73dd67825e77e1111ef0938578ba2f75dc0d Author: Kevin Morin <morin@codelutin.com> Date: Wed Aug 26 10:35:36 2015 +0200 add license --- .../content/pdfeditor/PDFEditorStampImageUI.css | 2 +- .../content/pdfeditor/PDFEditorStampTextUI.css | 2 +- .../ui/swing/content/reply/SigningSettingsUI.css | 23 +++++++++++++++++++++ .../content/reply/SigningSettingsUIHandler.java | 24 ++++++++++++++++++++++ .../content/reply/SigningSettingsUIModel.java | 24 ++++++++++++++++++++++ .../content/reply/actions/NewSigningAction.java | 24 ++++++++++++++++++++++ .../reply/actions/OpenSigningSettingsAction.java | 24 ++++++++++++++++++++++ .../content/reply/actions/SaveSigningAction.java | 24 ++++++++++++++++++++++ .../reply/actions/SetDefaultSigningAction.java | 24 ++++++++++++++++++++++ .../i18n/faxtomail-ui-swing_fr_FR.properties | 1 + 10 files changed, 170 insertions(+), 2 deletions(-) diff --git a/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/pdfeditor/PDFEditorStampImageUI.css b/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/pdfeditor/PDFEditorStampImageUI.css index 30c5a77..d1e7eb0 100644 --- a/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/pdfeditor/PDFEditorStampImageUI.css +++ b/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/pdfeditor/PDFEditorStampImageUI.css @@ -12,7 +12,7 @@ * License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty o + * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * diff --git a/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/pdfeditor/PDFEditorStampTextUI.css b/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/pdfeditor/PDFEditorStampTextUI.css index 6a98d85..81afa9f 100644 --- a/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/pdfeditor/PDFEditorStampTextUI.css +++ b/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/pdfeditor/PDFEditorStampTextUI.css @@ -12,7 +12,7 @@ * License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty o + * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * diff --git a/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/reply/SigningSettingsUI.css b/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/reply/SigningSettingsUI.css index 15c8e8f..3501fd4 100644 --- a/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/reply/SigningSettingsUI.css +++ b/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/reply/SigningSettingsUI.css @@ -1,3 +1,26 @@ +/* + * #%L + * FaxToMail :: UI + * $Id:$ + * $HeadURL:$ + * %% + * Copyright (C) 2014 - 2015 Mac-Groupe, Code Lutin + * %% + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/gpl-3.0.html>. + * #L% + */ #signingsLabel { text: "faxtomail.signings.settings.label"; } diff --git a/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/reply/SigningSettingsUIHandler.java b/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/reply/SigningSettingsUIHandler.java index f0723e7..3726c13 100644 --- a/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/reply/SigningSettingsUIHandler.java +++ b/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/reply/SigningSettingsUIHandler.java @@ -1,5 +1,29 @@ package com.franciaflex.faxtomail.ui.swing.content.reply; +/* + * #%L + * FaxToMail :: UI + * $Id:$ + * $HeadURL:$ + * %% + * Copyright (C) 2014 - 2015 Mac-Groupe, Code Lutin + * %% + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/gpl-3.0.html>. + * #L% + */ + import com.franciaflex.faxtomail.persistence.entities.Stamp; import com.franciaflex.faxtomail.ui.swing.content.reply.actions.SaveSigningAction; import com.franciaflex.faxtomail.ui.swing.util.AbstractFaxToMailUIHandler; diff --git a/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/reply/SigningSettingsUIModel.java b/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/reply/SigningSettingsUIModel.java index cdb40dd..c9ffc80 100644 --- a/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/reply/SigningSettingsUIModel.java +++ b/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/reply/SigningSettingsUIModel.java @@ -1,5 +1,29 @@ package com.franciaflex.faxtomail.ui.swing.content.reply; +/* + * #%L + * FaxToMail :: UI + * $Id:$ + * $HeadURL:$ + * %% + * Copyright (C) 2014 - 2015 Mac-Groupe, Code Lutin + * %% + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/gpl-3.0.html>. + * #L% + */ + import com.franciaflex.faxtomail.persistence.entities.Stamp; import org.jdesktop.beans.AbstractSerializableBean; diff --git a/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/reply/actions/NewSigningAction.java b/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/reply/actions/NewSigningAction.java index 1fa4c5b..2d21658 100644 --- a/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/reply/actions/NewSigningAction.java +++ b/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/reply/actions/NewSigningAction.java @@ -1,5 +1,29 @@ package com.franciaflex.faxtomail.ui.swing.content.reply.actions; +/* + * #%L + * FaxToMail :: UI + * $Id:$ + * $HeadURL:$ + * %% + * Copyright (C) 2014 - 2015 Mac-Groupe, Code Lutin + * %% + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/gpl-3.0.html>. + * #L% + */ + import com.franciaflex.faxtomail.persistence.entities.Stamp; import com.franciaflex.faxtomail.persistence.entities.StampImpl; import com.franciaflex.faxtomail.ui.swing.actions.AbstractFaxToMailAction; diff --git a/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/reply/actions/OpenSigningSettingsAction.java b/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/reply/actions/OpenSigningSettingsAction.java index 6faec84..18d9522 100644 --- a/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/reply/actions/OpenSigningSettingsAction.java +++ b/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/reply/actions/OpenSigningSettingsAction.java @@ -1,5 +1,29 @@ package com.franciaflex.faxtomail.ui.swing.content.reply.actions; +/* + * #%L + * FaxToMail :: UI + * $Id:$ + * $HeadURL:$ + * %% + * Copyright (C) 2014 - 2015 Mac-Groupe, Code Lutin + * %% + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/gpl-3.0.html>. + * #L% + */ + import com.franciaflex.faxtomail.persistence.entities.Stamp; import com.franciaflex.faxtomail.ui.swing.actions.AbstractFaxToMailAction; import com.franciaflex.faxtomail.ui.swing.content.reply.ReplyFormUI; diff --git a/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/reply/actions/SaveSigningAction.java b/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/reply/actions/SaveSigningAction.java index bc9a2c5..db3ed7b 100644 --- a/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/reply/actions/SaveSigningAction.java +++ b/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/reply/actions/SaveSigningAction.java @@ -1,5 +1,29 @@ package com.franciaflex.faxtomail.ui.swing.content.reply.actions; +/* + * #%L + * FaxToMail :: UI + * $Id:$ + * $HeadURL:$ + * %% + * Copyright (C) 2014 - 2015 Mac-Groupe, Code Lutin + * %% + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/gpl-3.0.html>. + * #L% + */ + import com.franciaflex.faxtomail.persistence.entities.FaxToMailUser; import com.franciaflex.faxtomail.persistence.entities.Stamp; import com.franciaflex.faxtomail.services.service.UserService; diff --git a/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/reply/actions/SetDefaultSigningAction.java b/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/reply/actions/SetDefaultSigningAction.java index 242c3cb..298f7dc 100644 --- a/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/reply/actions/SetDefaultSigningAction.java +++ b/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/reply/actions/SetDefaultSigningAction.java @@ -1,5 +1,29 @@ package com.franciaflex.faxtomail.ui.swing.content.reply.actions; +/* + * #%L + * FaxToMail :: UI + * $Id:$ + * $HeadURL:$ + * %% + * Copyright (C) 2014 - 2015 Mac-Groupe, Code Lutin + * %% + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/gpl-3.0.html>. + * #L% + */ + import com.franciaflex.faxtomail.persistence.entities.FaxToMailUser; import com.franciaflex.faxtomail.persistence.entities.Stamp; import com.franciaflex.faxtomail.services.service.UserService; 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 dd9f924..7202fd9 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 @@ -329,6 +329,7 @@ faxtomail.signings.settings.action.save.tip=Enregistrer les modifications faites faxtomail.signings.settings.label=Signatures faxtomail.signings.settings.name.label=Nom faxtomail.signings.settings.noSelection.label=Sélectionnez une signature pour l'éditer +faxtomail.signings.settings.saveBeforeLeaving= faxtomail.signings.settings.text.label=Texte faxtomail.signings.settings.title=Configuration des signatures faxtomail.systemUser=Système -- 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 http://git.codelutin.com/faxtomail.git commit 1d2a7cb63000f2a6caea5612dba3ce96a427bc5d Author: Kevin Morin <morin@codelutin.com> Date: Wed Aug 26 10:41:15 2015 +0200 add missing dependency --- faxtomail-ui-swing/pom.xml | 5 +++++ .../src/main/resources/i18n/faxtomail-ui-swing_fr_FR.properties | 2 +- faxtomail-ui-web/src/main/resources/struts.properties | 3 +-- pom.xml | 6 ++++++ 4 files changed, 13 insertions(+), 3 deletions(-) diff --git a/faxtomail-ui-swing/pom.xml b/faxtomail-ui-swing/pom.xml index 0be87dc..27ba12e 100644 --- a/faxtomail-ui-swing/pom.xml +++ b/faxtomail-ui-swing/pom.xml @@ -279,6 +279,11 @@ <scope>runtime</scope> </dependency> + <dependency> + <groupId>xerces</groupId> + <artifactId>xercesImpl</artifactId> + </dependency> + </dependencies> <build> 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 7202fd9..9f05d21 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 @@ -329,7 +329,7 @@ faxtomail.signings.settings.action.save.tip=Enregistrer les modifications faites faxtomail.signings.settings.label=Signatures faxtomail.signings.settings.name.label=Nom faxtomail.signings.settings.noSelection.label=Sélectionnez une signature pour l'éditer -faxtomail.signings.settings.saveBeforeLeaving= +faxtomail.signings.settings.saveBeforeLeaving=Vous avez modifié la signature. faxtomail.signings.settings.text.label=Texte faxtomail.signings.settings.title=Configuration des signatures faxtomail.systemUser=Système diff --git a/faxtomail-ui-web/src/main/resources/struts.properties b/faxtomail-ui-web/src/main/resources/struts.properties index cbd3d9d..d18619d 100644 --- a/faxtomail-ui-web/src/main/resources/struts.properties +++ b/faxtomail-ui-web/src/main/resources/struts.properties @@ -25,8 +25,7 @@ struts.ui.theme=bootstrap struts.ognl.allowStaticMethodAccess=true # Help debugging -#struts.devMode=${devMode} -struts.devMode=true +struts.devMode=${devMode} struts.ognl.logMissingProperties=${devMode} struts.el.throwExceptionOnFailure=${devMode} struts.i18n.reload=${devMode} diff --git a/pom.xml b/pom.xml index f7ac66e..afef84f 100644 --- a/pom.xml +++ b/pom.xml @@ -728,6 +728,12 @@ </dependency> <dependency> + <groupId>xerces</groupId> + <artifactId>xercesImpl</artifactId> + <version>2.9.1</version> + </dependency> + + <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> <version>${junitVersion}</version> -- To stop receiving notification emails like this one, please contact codelutin.com SCM administrator <admin+scm@codelutin.com>.
participants (1)
-
codelutin.com scm