Faxtomail-commits
Threads by month
- ----- 2026 -----
- June
- May
- April
- March
- February
- January
- ----- 2025 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
April 2014
- 3 participants
- 51 discussions
Build failed in Jenkins: faxtomail-nightly » FaxToMail :: Persistence #10
by admin+ci-codelutin.com@codelutin.com 22 Apr '14
by admin+ci-codelutin.com@codelutin.com 22 Apr '14
22 Apr '14
See <http://ci.codelutin.com/jenkins/job/faxtomail-nightly/com.franciaflex.faxto…>
Changes:
[kmorin] refs #4654 [ECRAN] Liste des mails / fax
refs #4655 [ECRAN] Détail d'un mail / fax
------------------------------------------
[...truncated 123 lines...]
[INFO]
[INFO] --- license-maven-plugin:1.6:update-file-header (update-file-header) @ faxtomail-persistence ---
[INFO] Will search files to update from root <http://ci.codelutin.com/jenkins/job/faxtomail-nightly/com.franciaflex.faxto…>
[INFO] Will search files to update from root <http://ci.codelutin.com/jenkins/job/faxtomail-nightly/com.franciaflex.faxto…>
[INFO] - adding license header on file <http://ci.codelutin.com/jenkins/job/faxtomail-nightly/com.franciaflex.faxto…>
[INFO] - adding license header on file <http://ci.codelutin.com/jenkins/job/faxtomail-nightly/com.franciaflex.faxto…>
[INFO] - adding license header on file <http://ci.codelutin.com/jenkins/job/faxtomail-nightly/com.franciaflex.faxto…>
[INFO] - adding license header on file <http://ci.codelutin.com/jenkins/job/faxtomail-nightly/com.franciaflex.faxto…>
[INFO] - adding license header on file <http://ci.codelutin.com/jenkins/job/faxtomail-nightly/com.franciaflex.faxto…>
[INFO] - adding license header on file <http://ci.codelutin.com/jenkins/job/faxtomail-nightly/com.franciaflex.faxto…>
[INFO] - adding license header on file <http://ci.codelutin.com/jenkins/job/faxtomail-nightly/com.franciaflex.faxto…>
[INFO] - adding license header on file <http://ci.codelutin.com/jenkins/job/faxtomail-nightly/com.franciaflex.faxto…>
[INFO] - adding license header on file <http://ci.codelutin.com/jenkins/job/faxtomail-nightly/com.franciaflex.faxto…>
[INFO] - adding license header on file <http://ci.codelutin.com/jenkins/job/faxtomail-nightly/com.franciaflex.faxto…>
[INFO] - adding license header on file <http://ci.codelutin.com/jenkins/job/faxtomail-nightly/com.franciaflex.faxto…>
[INFO] - adding license header on file <http://ci.codelutin.com/jenkins/job/faxtomail-nightly/com.franciaflex.faxto…>
[INFO] - adding license header on file <http://ci.codelutin.com/jenkins/job/faxtomail-nightly/com.franciaflex.faxto…>
[INFO] - adding license header on file <http://ci.codelutin.com/jenkins/job/faxtomail-nightly/com.franciaflex.faxto…>
[INFO] - adding license header on file <http://ci.codelutin.com/jenkins/job/faxtomail-nightly/com.franciaflex.faxto…>
[INFO] - adding license header on file <http://ci.codelutin.com/jenkins/job/faxtomail-nightly/com.franciaflex.faxto…>
[INFO] - adding license header on file <http://ci.codelutin.com/jenkins/job/faxtomail-nightly/com.franciaflex.faxto…>
[INFO] - adding license header on file <http://ci.codelutin.com/jenkins/job/faxtomail-nightly/com.franciaflex.faxto…>
[INFO] - adding license header on file <http://ci.codelutin.com/jenkins/job/faxtomail-nightly/com.franciaflex.faxto…>
[INFO] - adding license header on file <http://ci.codelutin.com/jenkins/job/faxtomail-nightly/com.franciaflex.faxto…>
[INFO] - adding license header on file <http://ci.codelutin.com/jenkins/job/faxtomail-nightly/com.franciaflex.faxto…>
[INFO] - adding license header on file <http://ci.codelutin.com/jenkins/job/faxtomail-nightly/com.franciaflex.faxto…>
[INFO] - adding license header on file <http://ci.codelutin.com/jenkins/job/faxtomail-nightly/com.franciaflex.faxto…>
[INFO] - adding license header on file <http://ci.codelutin.com/jenkins/job/faxtomail-nightly/com.franciaflex.faxto…>
[INFO] - adding license header on file <http://ci.codelutin.com/jenkins/job/faxtomail-nightly/com.franciaflex.faxto…>
[INFO] - adding license header on file <http://ci.codelutin.com/jenkins/job/faxtomail-nightly/com.franciaflex.faxto…>
[INFO] - adding license header on file <http://ci.codelutin.com/jenkins/job/faxtomail-nightly/com.franciaflex.faxto…>
[INFO] - adding license header on file <http://ci.codelutin.com/jenkins/job/faxtomail-nightly/com.franciaflex.faxto…>
[INFO] - adding license header on file <http://ci.codelutin.com/jenkins/job/faxtomail-nightly/com.franciaflex.faxto…>
[INFO] - adding license header on file <http://ci.codelutin.com/jenkins/job/faxtomail-nightly/com.franciaflex.faxto…>
[INFO] - adding license header on file <http://ci.codelutin.com/jenkins/job/faxtomail-nightly/com.franciaflex.faxto…>
[INFO] - adding license header on file <http://ci.codelutin.com/jenkins/job/faxtomail-nightly/com.franciaflex.faxto…>
[INFO] - adding license header on file <http://ci.codelutin.com/jenkins/job/faxtomail-nightly/com.franciaflex.faxto…>
[INFO] - adding license header on file <http://ci.codelutin.com/jenkins/job/faxtomail-nightly/com.franciaflex.faxto…>
[INFO] - adding license header on file <http://ci.codelutin.com/jenkins/job/faxtomail-nightly/com.franciaflex.faxto…>
[INFO] - adding license header on file <http://ci.codelutin.com/jenkins/job/faxtomail-nightly/com.franciaflex.faxto…>
[INFO] - adding license header on file <http://ci.codelutin.com/jenkins/job/faxtomail-nightly/com.franciaflex.faxto…>
[INFO] - adding license header on file <http://ci.codelutin.com/jenkins/job/faxtomail-nightly/com.franciaflex.faxto…>
[INFO] - adding license header on file <http://ci.codelutin.com/jenkins/job/faxtomail-nightly/com.franciaflex.faxto…>
[INFO] - adding license header on file <http://ci.codelutin.com/jenkins/job/faxtomail-nightly/com.franciaflex.faxto…>
[INFO] - adding license header on file <http://ci.codelutin.com/jenkins/job/faxtomail-nightly/com.franciaflex.faxto…>
[INFO] - adding license header on file <http://ci.codelutin.com/jenkins/job/faxtomail-nightly/com.franciaflex.faxto…>
[INFO] - adding license header on file <http://ci.codelutin.com/jenkins/job/faxtomail-nightly/com.franciaflex.faxto…>
[INFO] - adding license header on file <http://ci.codelutin.com/jenkins/job/faxtomail-nightly/com.franciaflex.faxto…>
[INFO] - adding license header on file <http://ci.codelutin.com/jenkins/job/faxtomail-nightly/com.franciaflex.faxto…>
[INFO] - adding license header on file <http://ci.codelutin.com/jenkins/job/faxtomail-nightly/com.franciaflex.faxto…>
[INFO] - adding license header on file <http://ci.codelutin.com/jenkins/job/faxtomail-nightly/com.franciaflex.faxto…>
[INFO] - adding license header on file <http://ci.codelutin.com/jenkins/job/faxtomail-nightly/com.franciaflex.faxto…>
[INFO] - adding license header on file <http://ci.codelutin.com/jenkins/job/faxtomail-nightly/com.franciaflex.faxto…>
[INFO] - adding license header on file <http://ci.codelutin.com/jenkins/job/faxtomail-nightly/com.franciaflex.faxto…>
[INFO] - adding license header on file <http://ci.codelutin.com/jenkins/job/faxtomail-nightly/com.franciaflex.faxto…>
[INFO] - adding license header on file <http://ci.codelutin.com/jenkins/job/faxtomail-nightly/com.franciaflex.faxto…>
[INFO] - adding license header on file <http://ci.codelutin.com/jenkins/job/faxtomail-nightly/com.franciaflex.faxto…>
[INFO] - adding license header on file <http://ci.codelutin.com/jenkins/job/faxtomail-nightly/com.franciaflex.faxto…>
[INFO] - adding license header on file <http://ci.codelutin.com/jenkins/job/faxtomail-nightly/com.franciaflex.faxto…>
[INFO] - adding license header on file <http://ci.codelutin.com/jenkins/job/faxtomail-nightly/com.franciaflex.faxto…>
[INFO] - adding license header on file <http://ci.codelutin.com/jenkins/job/faxtomail-nightly/com.franciaflex.faxto…>
[INFO] - adding license header on file <http://ci.codelutin.com/jenkins/job/faxtomail-nightly/com.franciaflex.faxto…>
[INFO] - adding license header on file <http://ci.codelutin.com/jenkins/job/faxtomail-nightly/com.franciaflex.faxto…>
[INFO] - adding license header on file <http://ci.codelutin.com/jenkins/job/faxtomail-nightly/com.franciaflex.faxto…>
[INFO] - adding license header on file <http://ci.codelutin.com/jenkins/job/faxtomail-nightly/com.franciaflex.faxto…>
[INFO] - adding license header on file <http://ci.codelutin.com/jenkins/job/faxtomail-nightly/com.franciaflex.faxto…>
[INFO] - adding license header on file <http://ci.codelutin.com/jenkins/job/faxtomail-nightly/com.franciaflex.faxto…>
[INFO] - adding license header on file <http://ci.codelutin.com/jenkins/job/faxtomail-nightly/com.franciaflex.faxto…>
[INFO] - adding license header on file <http://ci.codelutin.com/jenkins/job/faxtomail-nightly/com.franciaflex.faxto…>
[INFO] - adding license header on file <http://ci.codelutin.com/jenkins/job/faxtomail-nightly/com.franciaflex.faxto…>
[INFO] - adding license header on file <http://ci.codelutin.com/jenkins/job/faxtomail-nightly/com.franciaflex.faxto…>
[INFO] - adding license header on file <http://ci.codelutin.com/jenkins/job/faxtomail-nightly/com.franciaflex.faxto…>
[INFO] - adding license header on file <http://ci.codelutin.com/jenkins/job/faxtomail-nightly/com.franciaflex.faxto…>
[INFO] - adding license header on file <http://ci.codelutin.com/jenkins/job/faxtomail-nightly/com.franciaflex.faxto…>
[INFO] - adding license header on file <http://ci.codelutin.com/jenkins/job/faxtomail-nightly/com.franciaflex.faxto…>
[INFO] - adding license header on file <http://ci.codelutin.com/jenkins/job/faxtomail-nightly/com.franciaflex.faxto…>
[INFO] - adding license header on file <http://ci.codelutin.com/jenkins/job/faxtomail-nightly/com.franciaflex.faxto…>
[INFO] - adding license header on file <http://ci.codelutin.com/jenkins/job/faxtomail-nightly/com.franciaflex.faxto…>
[INFO] - adding license header on file <http://ci.codelutin.com/jenkins/job/faxtomail-nightly/com.franciaflex.faxto…>
[INFO] - adding license header on file <http://ci.codelutin.com/jenkins/job/faxtomail-nightly/com.franciaflex.faxto…>
[INFO] - adding license header on file <http://ci.codelutin.com/jenkins/job/faxtomail-nightly/com.franciaflex.faxto…>
[INFO] - adding license header on file <http://ci.codelutin.com/jenkins/job/faxtomail-nightly/com.franciaflex.faxto…>
[INFO] - adding license header on file <http://ci.codelutin.com/jenkins/job/faxtomail-nightly/com.franciaflex.faxto…>
[INFO] - adding license header on file <http://ci.codelutin.com/jenkins/job/faxtomail-nightly/com.franciaflex.faxto…>
[INFO] - adding license header on file <http://ci.codelutin.com/jenkins/job/faxtomail-nightly/com.franciaflex.faxto…>
[INFO] - adding license header on file <http://ci.codelutin.com/jenkins/job/faxtomail-nightly/com.franciaflex.faxto…>
[INFO] - adding license header on file <http://ci.codelutin.com/jenkins/job/faxtomail-nightly/com.franciaflex.faxto…>
[INFO] - adding license header on file <http://ci.codelutin.com/jenkins/job/faxtomail-nightly/com.franciaflex.faxto…>
[INFO] - adding license header on file <http://ci.codelutin.com/jenkins/job/faxtomail-nightly/com.franciaflex.faxto…>
[INFO] - adding license header on file <http://ci.codelutin.com/jenkins/job/faxtomail-nightly/com.franciaflex.faxto…>
[INFO] - adding license header on file <http://ci.codelutin.com/jenkins/job/faxtomail-nightly/com.franciaflex.faxto…>
[INFO] - adding license header on file <http://ci.codelutin.com/jenkins/job/faxtomail-nightly/com.franciaflex.faxto…>
[INFO] - adding license header on file <http://ci.codelutin.com/jenkins/job/faxtomail-nightly/com.franciaflex.faxto…>
[INFO] - adding license header on file <http://ci.codelutin.com/jenkins/job/faxtomail-nightly/com.franciaflex.faxto…>
[INFO] - adding license header on file <http://ci.codelutin.com/jenkins/job/faxtomail-nightly/com.franciaflex.faxto…>
[INFO] - adding license header on file <http://ci.codelutin.com/jenkins/job/faxtomail-nightly/com.franciaflex.faxto…>
[INFO] - adding license header on file <http://ci.codelutin.com/jenkins/job/faxtomail-nightly/com.franciaflex.faxto…>
[INFO] - adding license header on file <http://ci.codelutin.com/jenkins/job/faxtomail-nightly/com.franciaflex.faxto…>
[INFO] - adding license header on file <http://ci.codelutin.com/jenkins/job/faxtomail-nightly/com.franciaflex.faxto…>
[INFO] - adding license header on file <http://ci.codelutin.com/jenkins/job/faxtomail-nightly/com.franciaflex.faxto…>
[INFO] - adding license header on file <http://ci.codelutin.com/jenkins/job/faxtomail-nightly/com.franciaflex.faxto…>
[INFO] - adding license header on file <http://ci.codelutin.com/jenkins/job/faxtomail-nightly/com.franciaflex.faxto…>
[INFO] - adding license header on file <http://ci.codelutin.com/jenkins/job/faxtomail-nightly/com.franciaflex.faxto…>
[INFO] - adding license header on file <http://ci.codelutin.com/jenkins/job/faxtomail-nightly/com.franciaflex.faxto…>
[INFO] - adding license header on file <http://ci.codelutin.com/jenkins/job/faxtomail-nightly/com.franciaflex.faxto…>
[INFO] - adding license header on file <http://ci.codelutin.com/jenkins/job/faxtomail-nightly/com.franciaflex.faxto…>
[INFO] - adding license header on file <http://ci.codelutin.com/jenkins/job/faxtomail-nightly/com.franciaflex.faxto…>
[INFO] - adding license header on file <http://ci.codelutin.com/jenkins/job/faxtomail-nightly/com.franciaflex.faxto…>
[INFO] - adding license header on file <http://ci.codelutin.com/jenkins/job/faxtomail-nightly/com.franciaflex.faxto…>
[INFO] - adding license header on file <http://ci.codelutin.com/jenkins/job/faxtomail-nightly/com.franciaflex.faxto…>
[INFO] - adding license header on file <http://ci.codelutin.com/jenkins/job/faxtomail-nightly/com.franciaflex.faxto…>
[INFO] - adding license header on file <http://ci.codelutin.com/jenkins/job/faxtomail-nightly/com.franciaflex.faxto…>
[INFO] - adding license header on file <http://ci.codelutin.com/jenkins/job/faxtomail-nightly/com.franciaflex.faxto…>
[INFO] - adding license header on file <http://ci.codelutin.com/jenkins/job/faxtomail-nightly/com.franciaflex.faxto…>
[INFO] - adding license header on file <http://ci.codelutin.com/jenkins/job/faxtomail-nightly/com.franciaflex.faxto…>
[INFO] - adding license header on file <http://ci.codelutin.com/jenkins/job/faxtomail-nightly/com.franciaflex.faxto…>
[INFO] - adding license header on file <http://ci.codelutin.com/jenkins/job/faxtomail-nightly/com.franciaflex.faxto…>
[INFO] - adding license header on file <http://ci.codelutin.com/jenkins/job/faxtomail-nightly/com.franciaflex.faxto…>
[INFO] - adding license header on file <http://ci.codelutin.com/jenkins/job/faxtomail-nightly/com.franciaflex.faxto…>
[INFO] - adding license header on file <http://ci.codelutin.com/jenkins/job/faxtomail-nightly/com.franciaflex.faxto…>
[INFO] - adding license header on file <http://ci.codelutin.com/jenkins/job/faxtomail-nightly/com.franciaflex.faxto…>
[INFO] - adding license header on file <http://ci.codelutin.com/jenkins/job/faxtomail-nightly/com.franciaflex.faxto…>
[INFO] - adding license header on file <http://ci.codelutin.com/jenkins/job/faxtomail-nightly/com.franciaflex.faxto…>
[INFO] - adding license header on file <http://ci.codelutin.com/jenkins/job/faxtomail-nightly/com.franciaflex.faxto…>
[INFO] - adding license header on file <http://ci.codelutin.com/jenkins/job/faxtomail-nightly/com.franciaflex.faxto…>
[INFO] - adding license header on file <http://ci.codelutin.com/jenkins/job/faxtomail-nightly/com.franciaflex.faxto…>
[INFO] - adding license header on file <http://ci.codelutin.com/jenkins/job/faxtomail-nightly/com.franciaflex.faxto…>
[INFO] - adding license header on file <http://ci.codelutin.com/jenkins/job/faxtomail-nightly/com.franciaflex.faxto…>
[INFO] - adding license header on file <http://ci.codelutin.com/jenkins/job/faxtomail-nightly/com.franciaflex.faxto…>
[INFO] - adding license header on file <http://ci.codelutin.com/jenkins/job/faxtomail-nightly/com.franciaflex.faxto…>
[INFO] - adding license header on file <http://ci.codelutin.com/jenkins/job/faxtomail-nightly/com.franciaflex.faxto…>
[INFO] - adding license header on file <http://ci.codelutin.com/jenkins/job/faxtomail-nightly/com.franciaflex.faxto…>
[INFO] - adding license header on file <http://ci.codelutin.com/jenkins/job/faxtomail-nightly/com.franciaflex.faxto…>
[INFO] - adding license header on file <http://ci.codelutin.com/jenkins/job/faxtomail-nightly/com.franciaflex.faxto…>
[INFO] - adding license header on file <http://ci.codelutin.com/jenkins/job/faxtomail-nightly/com.franciaflex.faxto…>
[INFO] - adding license header on file <http://ci.codelutin.com/jenkins/job/faxtomail-nightly/com.franciaflex.faxto…>
[INFO] Scan 143 files header done in 132.031ms.
[INFO]
* uptodate header on 11 files.
* add header on 132 files.
[INFO]
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ faxtomail-persistence ---
[INFO] Compiling 121 source files to <http://ci.codelutin.com/jenkins/job/faxtomail-nightly/com.franciaflex.faxto…>
[WARNING] <http://ci.codelutin.com/jenkins/job/faxtomail-nightly/com.franciaflex.faxto…>: Some input files use unchecked or unsafe operations.
[WARNING] <http://ci.codelutin.com/jenkins/job/faxtomail-nightly/com.franciaflex.faxto…>: Recompile with -Xlint:unchecked for details.
[INFO]
[INFO] --- animal-sniffer-maven-plugin:1.10:check (default) @ faxtomail-persistence ---
[INFO] Checking unresolved references to org.codehaus.mojo.signature:java16:1.1
[INFO]
[INFO] --- jredmine-maven-plugin:1.6:generate-changes (jredmine-generate-changes) @ faxtomail-persistence ---
[INFO] Skipping goal (skipGenerateChanges flag is on).
[INFO]
[INFO] --- maven-antrun-plugin:1.7:run (generate-surefire-workdir) @ faxtomail-persistence ---
[INFO] Executing tasks
main:
[mkdir] Created dir: <http://ci.codelutin.com/jenkins/job/faxtomail-nightly/com.franciaflex.faxto…>
[INFO] Executed tasks
[INFO]
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ faxtomail-persistence ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory <http://ci.codelutin.com/jenkins/job/faxtomail-nightly/com.franciaflex.faxto…>
[INFO]
[INFO] --- maven-compiler-plugin:3.1:testCompile (default-testCompile) @ faxtomail-persistence ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-surefire-plugin:2.16:test (default-test) @ faxtomail-persistence ---
[INFO] No tests to run.
[JENKINS] Recording test results
[INFO]
[INFO] --- maven-jar-plugin:2.4:jar (default-jar) @ faxtomail-persistence ---
[INFO] Building jar: <http://ci.codelutin.com/jenkins/job/faxtomail-nightly/com.franciaflex.faxto…>
[INFO]
[INFO] >>> maven-source-plugin:2.2.1:jar (attach-sources) @ faxtomail-persistence >>>
[INFO]
[INFO] --- maven-enforcer-plugin:1.3.1:enforce (ensure-no-container-api) @ faxtomail-persistence ---
[INFO]
[INFO] --- maven-enforcer-plugin:1.3.1:enforce (check-project-files) @ faxtomail-persistence ---
[INFO]
[INFO] --- helper-maven-plugin:2.1:share-server-secret (get-redmine-login) @ faxtomail-persistence ---
[INFO] Skipping goal (runOnce flag is on and goal was already executed).
[INFO]
[INFO] --- eugene-maven-plugin:2.7.4:generate (generate-entities) @ faxtomail-persistence ---
[INFO] Process phase [zargo] for one entry.
[INFO] Expanding 1 xmi file(s) from <http://ci.codelutin.com/jenkins/job/faxtomail-nightly/com.franciaflex.faxto…>
[INFO] Copy file <http://ci.codelutin.com/jenkins/job/faxtomail-nightly/com.franciaflex.faxto…> to <http://ci.codelutin.com/jenkins/job/faxtomail-nightly/com.franciaflex.faxto…>
[INFO] No file generated.
[INFO] Process phase [xmi] for one entry.
[INFO] Processing XSL tranformation on <http://ci.codelutin.com/jenkins/job/faxtomail-nightly/com.franciaflex.faxto…> for 1 file(s).
[INFO] No file generated.
[INFO] Process phase [model] for one entry.
WARN [pool-1-thread-1 for channel] (AbstractObjectModelReader.java:126) beforeReadFile - No properties provider filled, will instanciate a new default one
WARN [pool-1-thread-1 for channel] (AbstractObjectModelReader.java:294) loadModelTagValue - Invalid model tag value [model.tagValue.java.lang.String] : the tagvalue 'java.lang.String' is unkown.
WARN [pool-1-thread-1 for channel] (AbstractObjectModelReader.java:303) loadModelTagValue - Invalid model tag value [model.tagValue.useEnumerationName] : this tagvalue 'useEnumerationName' can not be apply on the model.
INFO [pool-1-thread-1 for channel] (AbstractObjectModelReader.java:270) loadModelProperties - 5 tag values were succesfull imported from <http://ci.codelutin.com/jenkins/job/faxtomail-nightly/com.franciaflex.faxto…>
[INFO] No file generated.
[INFO] Apply generator JavaInterfaceTransformer
[INFO] Apply generator TopiaMetaTransformer
INFO [pool-1-thread-1 for channel] (ObjectModelTransformerToJava.java:998) isInClassPath - Will not generate [com.franciaflex.faxtomail.persistence.entities.EmailTopiaDao], already found in class-path.
[WARNING] Failed to getClass for org.apache.maven.plugin.source.SourceJarMojo
[INFO]
[INFO] <<< maven-source-plugin:2.2.1:jar (attach-sources) @ faxtomail-persistence <<<
[INFO]
[INFO] --- maven-source-plugin:2.2.1:jar (attach-sources) @ faxtomail-persistence ---
[INFO] Building jar: <http://ci.codelutin.com/jenkins/job/faxtomail-nightly/com.franciaflex.faxto…>
[INFO]
[INFO] --- maven-javadoc-plugin:2.9.1:jar (attach-javadocs) @ faxtomail-persistence ---
[INFO] Building jar: <http://ci.codelutin.com/jenkins/job/faxtomail-nightly/com.franciaflex.faxto…>
[INFO]
[INFO] --- maven-site-plugin:3.3:attach-descriptor (attach-descriptor) @ faxtomail-persistence ---
[INFO]
[INFO] --- helper-maven-plugin:2.1:share-server-secret (get-pgp-passphrase) @ faxtomail-persistence ---
[INFO] Exporting server [gpg-signer] username in ${gpg.keyname}
[INFO] Exporting server [gpg-signer] password in ${gpg.passphrase}
[INFO]
[INFO] --- helper-maven-plugin:2.1:collect-files (collect-build-artifacts) @ faxtomail-persistence ---
[INFO] Loaded /var/local/forge/data/codelutin.com/jenkins/workspace/faxtomail-nightly/trunk/target/collect-artifacts.txt
[INFO] Copying faxtomail-persistence-0.1-SNAPSHOT.jar to /var/local/forge/data/codelutin.com/jenkins/workspace/faxtomail-nightly/trunk/target/collect/com.franciaflex.faxtomail--faxtomail-persistence/faxtomail-persistence-0.1-SNAPSHOT.jar
[INFO] Copying THIRD-PARTY.properties to /var/local/forge/data/codelutin.com/jenkins/workspace/faxtomail-nightly/trunk/target/collect/com.franciaflex.faxtomail--faxtomail-persistence/THIRD-PARTY.properties
[INFO] Copying faxtomail-persistence-0.1-SNAPSHOT-sources.jar to /var/local/forge/data/codelutin.com/jenkins/workspace/faxtomail-nightly/trunk/target/collect/com.franciaflex.faxtomail--faxtomail-persistence/faxtomail-persistence-0.1-SNAPSHOT-sources.jar
[INFO] Copying faxtomail-persistence-0.1-SNAPSHOT-javadoc.jar to /var/local/forge/data/codelutin.com/jenkins/workspace/faxtomail-nightly/trunk/target/collect/com.franciaflex.faxtomail--faxtomail-persistence/faxtomail-persistence-0.1-SNAPSHOT-javadoc.jar
[INFO]
[INFO] --- helper-maven-plugin:2.1:collect-files (collect-build-attachements) @ faxtomail-persistence ---
[WARNING] Skipping goal (No file to collect).
[INFO]
[INFO] --- maven-gpg-plugin:1.4:sign (sign-artifacts) @ faxtomail-persistence ---
[INFO]
[INFO] --- maven-dependency-plugin:2.8:analyze-only (analyze) @ faxtomail-persistence ---
[INFO] Used declared dependencies found:
[INFO] org.nuiton.topia:topia-persistence:jar:3.0-alpha-10:compile
[INFO] org.nuiton:nuiton-utils:jar:3.0-SNAPSHOT:compile
[INFO] org.nuiton:nuiton-config:jar:3.0-alpha-2:compile
[INFO] org.nuiton:nuiton-updater:jar:3.0-alpha-2:compile
[INFO] org.nuiton.jaxx:jaxx-application-api:jar:2.8.2:compile
[INFO] org.nuiton.i18n:nuiton-i18n:jar:3.0:compile
[INFO] com.google.guava:guava:jar:16.0.1:compile
[INFO] org.apache.commons:commons-lang3:jar:3.2.1:compile
[INFO] commons-io:commons-io:jar:2.4:compile
[INFO] commons-logging:commons-logging:jar:1.1.3:compile
[WARNING] Used undeclared dependencies found:
[WARNING] org.hibernate:hibernate-core:jar:4.2.8.Final:compile
[WARNING] Unused declared dependencies found:
[WARNING] org.nuiton:nuiton-decorator:jar:3.0-alpha-3:compile
[WARNING] commons-collections:commons-collections:jar:3.2.1:compile
[WARNING] org.swinglabs.swingx:swingx-common:jar:1.6.4:compile
[WARNING] org.apache.commons:commons-vfs2:jar:2.0:compile
[WARNING] net.sourceforge.jtds:jtds:jar:1.3.1:compile
[WARNING] commons-beanutils:commons-beanutils:jar:1.9.1:compile
[JENKINS] Archiving disabled
1
9
22 Apr '14
Author: kmorin
Date: 2014-04-22 18:52:11 +0200 (Tue, 22 Apr 2014)
New Revision: 38
Url: http://forge.codelutin.com/projects/faxtomail/repository/revisions/38
Log:
refs #4655 [ECRAN] D?\195?\169tail d'un mail / fax
Affichage ou non des gammes en fonction du type d'?\195?\169l?\195?\169ment
Ecran d'impression des pi?\195?\168ces-jointes
Added:
trunk/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/persistence/entities/Action.java
trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/print/
trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/print/AttachmentToPrintChooserUI.css
trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/print/AttachmentToPrintChooserUI.jaxx
trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/print/AttachmentToPrintChooserUIHandler.java
Modified:
trunk/faxtomail-persistence/src/main/xmi/faxtomail.zargo
trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/InitFaxToMailService.java
trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeUI.css
trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeUI.jaxx
trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeUIHandler.java
trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/transmit/MailFolderChooserUI.css
trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/transmit/MailFolderChooserUI.jaxx
trunk/faxtomail-ui-swing/src/main/resources/i18n/faxtomail-ui-swing_en_GB.properties
trunk/faxtomail-ui-swing/src/main/resources/i18n/faxtomail-ui-swing_fr_FR.properties
Added: trunk/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/persistence/entities/Action.java
===================================================================
--- trunk/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/persistence/entities/Action.java (rev 0)
+++ trunk/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/persistence/entities/Action.java 2014-04-22 16:52:11 UTC (rev 38)
@@ -0,0 +1,16 @@
+package com.franciaflex.faxtomail.persistence.entities;
+
+/**
+ * @author Kevin Morin (Code Lutin)
+ * @since x.x
+ */
+public enum Action {
+
+ SAVE,
+ TRANSMIT,
+ PRINT,
+ ARCHIVE,
+ REPLY,
+ GROUP
+
+}
Modified: trunk/faxtomail-persistence/src/main/xmi/faxtomail.zargo
===================================================================
(Binary files differ)
Modified: trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/InitFaxToMailService.java
===================================================================
--- trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/InitFaxToMailService.java 2014-04-18 13:48:06 UTC (rev 37)
+++ trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/InitFaxToMailService.java 2014-04-22 16:52:11 UTC (rev 38)
@@ -151,33 +151,34 @@
if (count == 0) {
List<DemandType> types = Lists.newArrayList(
- demandTypeDao.create(DemandType.PROPERTY_LABEL, "Commande"),
- demandTypeDao.create(DemandType.PROPERTY_LABEL, "Commande Réponse"),
- demandTypeDao.create(DemandType.PROPERTY_LABEL, "Commande Annulation/Modification"),
- demandTypeDao.create(DemandType.PROPERTY_LABEL, "Devis Diffus"),
- demandTypeDao.create(DemandType.PROPERTY_LABEL, "Devis Chantier"),
- demandTypeDao.create(DemandType.PROPERTY_LABEL, "Devis Gros Chantier"),
- demandTypeDao.create(DemandType.PROPERTY_LABEL, "Devis Réponse/Modification"),
- demandTypeDao.create(DemandType.PROPERTY_LABEL, "Réclamation"),
- demandTypeDao.create(DemandType.PROPERTY_LABEL, "Autres")
+ demandTypeDao.create(DemandType.PROPERTY_LABEL, "Commande", DemandType.PROPERTY_RANGE_NEEDED, true),
+ demandTypeDao.create(DemandType.PROPERTY_LABEL, "Commande Réponse", DemandType.PROPERTY_RANGE_NEEDED, false),
+ demandTypeDao.create(DemandType.PROPERTY_LABEL, "Commande Annulation/Modification", DemandType.PROPERTY_RANGE_NEEDED, false),
+ demandTypeDao.create(DemandType.PROPERTY_LABEL, "Devis Diffus", DemandType.PROPERTY_RANGE_NEEDED, true),
+ demandTypeDao.create(DemandType.PROPERTY_LABEL, "Devis Chantier", DemandType.PROPERTY_RANGE_NEEDED, true),
+ demandTypeDao.create(DemandType.PROPERTY_LABEL, "Devis Gros Chantier", DemandType.PROPERTY_RANGE_NEEDED, true),
+ demandTypeDao.create(DemandType.PROPERTY_LABEL, "Devis Réponse/Modification", DemandType.PROPERTY_RANGE_NEEDED, false),
+ demandTypeDao.create(DemandType.PROPERTY_LABEL, "Réclamation", DemandType.PROPERTY_RANGE_NEEDED, false),
+ demandTypeDao.create(DemandType.PROPERTY_LABEL, "Autres", DemandType.PROPERTY_RANGE_NEEDED, false)
);
EtatAttenteTopiaDao etatAttenteDao = getPersistenceContext().getEtatAttenteDao();
List<EtatAttente> etatAttentes = Lists.newArrayList(
- etatAttenteDao.create(Range.PROPERTY_LABEL, "BAT attente retour BAT lettrage-logo"),
- etatAttenteDao.create(Range.PROPERTY_LABEL, "CLT attente réponse client"),
- etatAttenteDao.create(Range.PROPERTY_LABEL, "DAC attente pour assistance chantier"),
- etatAttenteDao.create(Range.PROPERTY_LABEL, "DAV attente analyse avoir"),
- etatAttenteDao.create(Range.PROPERTY_LABEL, "EXP attente expertise"),
- etatAttenteDao.create(Range.PROPERTY_LABEL, "GAB attente reception gabarit"),
- etatAttenteDao.create(Range.PROPERTY_LABEL, "GRA attente accord gratuit"),
- etatAttenteDao.create(Range.PROPERTY_LABEL, "ODC attente Ouverture de Compte"),
- etatAttenteDao.create(Range.PROPERTY_LABEL, "PPC attente chiffrage BEI PPC"),
- etatAttenteDao.create(Range.PROPERTY_LABEL, "PROFORMA attente paiement proforma"),
- etatAttenteDao.create(Range.PROPERTY_LABEL, "PROTO attente accord proto"),
- etatAttenteDao.create(Range.PROPERTY_LABEL, "REM Attente Remise-accord expo"),
- etatAttenteDao.create(Range.PROPERTY_LABEL, "RET attente retour materiel"),
- etatAttenteDao.create(Range.PROPERTY_LABEL, "SIGN attente réponse BEI signature")
+ etatAttenteDao.create(EtatAttente.PROPERTY_LABEL, "BAT attente retour BAT lettrage-logo"),
+ etatAttenteDao.create(EtatAttente.PROPERTY_LABEL, "CLT attente réponse client"),
+ etatAttenteDao.create(EtatAttente.PROPERTY_LABEL, "DAC attente pour assistance chantier"),
+ etatAttenteDao.create(EtatAttente.PROPERTY_LABEL, "DAV attente analyse avoir"),
+ etatAttenteDao.create(EtatAttente.PROPERTY_LABEL, "EXP attente expertise"),
+ etatAttenteDao.create(EtatAttente.PROPERTY_LABEL, "GAB attente reception gabarit"),
+ etatAttenteDao.create(EtatAttente.PROPERTY_LABEL, "GRA attente accord gratuit"),
+ etatAttenteDao.create(EtatAttente.PROPERTY_LABEL, "ODC attente Ouverture de Compte"),
+ etatAttenteDao.create(EtatAttente.PROPERTY_LABEL, "PPC attente chiffrage BEI PPC"),
+ etatAttenteDao.create(EtatAttente.PROPERTY_LABEL, "PROFORMA attente paiement proforma"),
+ etatAttenteDao.create(EtatAttente.PROPERTY_LABEL, "PROTO attente accord proto"),
+ etatAttenteDao.create(EtatAttente.PROPERTY_LABEL, "REM Attente Remise-accord expo"),
+ etatAttenteDao.create(EtatAttente.PROPERTY_LABEL, "RET attente retour materiel"),
+ etatAttenteDao.create(EtatAttente.PROPERTY_LABEL, "SIGN attente réponse BEI signature"),
+ etatAttenteDao.create(EtatAttente.PROPERTY_LABEL, "SPAM")
);
PriorityTopiaDao priorityDao = getPersistenceContext().getPriorityDao();
Modified: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeUI.css
===================================================================
--- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeUI.css 2014-04-18 13:48:06 UTC (rev 37)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeUI.css 2014-04-22 16:52:11 UTC (rev 38)
@@ -156,6 +156,10 @@
editable: false;
}
+.text-row {
+ layout: { new FlowLayout(FlowLayout.LEADING) };
+}
+
#takenByLabel {
text: "faxtomail.demande.takenBy.label";
}
@@ -204,6 +208,10 @@
text: { handler.decorate(model.getLastModificationDate()) };
}
+#lastAttachmentOpeningPanel {
+ visible: { model.getLastAttachmentOpeningUser() != null };
+}
+
#lastAttachmentOpeningLabel {
text: "faxtomail.demande.lastAttachmentOpening.label";
}
@@ -224,6 +232,14 @@
text: { handler.decorate(model.getLastAttachmentOpeningDate()) };
}
+#leftVerticalSplitPanel {
+ dividerSize : { Boolean.TRUE.equals(model.getDemandType().getRangeNeeded()) ? 10 : 0 };
+}
+
+#rangePanel {
+ visible: { Boolean.TRUE.equals(model.getDemandType().getRangeNeeded()) };
+}
+
#ediCodeNumberLabel {
text: "faxtomail.demande.ediCodeNumber.label";
visible: { model.getEdiCodeNumber() != null };
Modified: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeUI.jaxx
===================================================================
--- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeUI.jaxx 2014-04-18 13:48:06 UTC (rev 37)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeUI.jaxx 2014-04-22 16:52:11 UTC (rev 38)
@@ -82,7 +82,8 @@
<JSplitPane constraints='BorderLayout.CENTER'
orientation="{JSplitPane.HORIZONTAL_SPLIT}">
- <JSplitPane orientation="{JSplitPane.VERTICAL_SPLIT}">
+ <JSplitPane orientation="{JSplitPane.VERTICAL_SPLIT}"
+ id="leftVerticalSplitPanel">
<JScrollPane>
@@ -184,7 +185,6 @@
<JLabel id='statusField'/>
</cell>
</row>
-
<row>
<cell>
<JLabel id="takenByLabel"/>
@@ -193,69 +193,47 @@
<JLabel id="takenByField"/>
</cell>
</row>
+
<row>
- <cell columns='4'>
- <JLabel id="firstOpenedLabel"/>
+ <cell columns="4" insets="10">
+ <JSeparator/>
</cell>
</row>
+
<row>
- <cell>
- <JLabel id="firstOpenedByLabel"/>
+ <cell columns='4'>
+ <JPanel styleClass="text-row">
+ <JLabel id="firstOpenedLabel"/>
+ <JLabel id="firstOpenedByLabel"/>
+ <JLabel id="firstOpenedByField"/>
+ <JLabel id="firstOpeningDateLabel"/>
+ <JLabel id="firstOpeningDateField"/>
+ </JPanel>
</cell>
- <cell columns="3">
- <JLabel id="firstOpenedByField"/>
- </cell>
</row>
<row>
- <cell>
- <JLabel id="firstOpeningDateLabel"/>
- </cell>
- <cell weightx='1' columns="3">
- <JLabel id="firstOpeningDateField"/>
- </cell>
- </row>
- <row>
<cell columns='4'>
- <JLabel id="lastModifiedLabel"/>
+ <JPanel styleClass="text-row">
+ <JLabel id="lastModifiedLabel"/>
+ <JLabel id="lastModifiedByLabel"/>
+ <JLabel id="lastModifiedByField"/>
+ <JLabel id="lastModificationDateLabel"/>
+ <JLabel id="lastModificationDateField"/>
+ </JPanel>
</cell>
</row>
<row>
- <cell>
- <JLabel id="lastModifiedByLabel"/>
- </cell>
- <cell columns="3">
- <JLabel id="lastModifiedByField"/>
- </cell>
- </row>
- <row>
- <cell>
- <JLabel id="lastModificationDateLabel"/>
- </cell>
- <cell weightx='1' columns="3">
- <JLabel id="lastModificationDateField"/>
- </cell>
- </row>
- <row>
<cell columns='4'>
- <JLabel id="lastAttachmentOpeningLabel"/>
+ <JPanel id="lastAttachmentOpeningPanel"
+ styleClass="text-row">
+ <JLabel id="lastAttachmentOpeningLabel"/>
+ <JLabel id="lastAttachmentOpenedByLabel"/>
+ <JLabel id="lastAttachmentOpenedByField"/>
+ <JLabel id="lastAttachmentOpeningDateLabel"/>
+ <JLabel id="lastAttachmentOpeningDateField"/>
+ </JPanel>
</cell>
</row>
- <row>
- <cell>
- <JLabel id="lastAttachmentOpenedByLabel"/>
- </cell>
- <cell columns="3">
- <JLabel id="lastAttachmentOpenedByField"/>
- </cell>
- </row>
- <row>
- <cell>
- <JLabel id="lastAttachmentOpeningDateLabel"/>
- </cell>
- <cell weightx='1' columns="3">
- <JLabel id="lastAttachmentOpeningDateField"/>
- </cell>
- </row>
<row>
<cell>
@@ -271,7 +249,7 @@
</JScrollPane>
- <JPanel layout="{new BorderLayout()}">
+ <JPanel layout="{new BorderLayout()}" id="rangePanel">
<JPanel layout="{new FlowLayout(FlowLayout.LEADING)}" constraints='BorderLayout.NORTH'>
<JLabel id="quotationNbLabel"/>
<JLabel id="quotationNbField"/>
@@ -289,7 +267,8 @@
</JSplitPane>
- <JSplitPane orientation="{JSplitPane.VERTICAL_SPLIT}">
+ <JSplitPane orientation="{JSplitPane.VERTICAL_SPLIT}"
+ id="rightVerticalSplitPanel">
<JPanel layout="{new BorderLayout()}">
<JLabel id='mailBodyLabel'
constraints="BorderLayout.NORTH"/>
Modified: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeUIHandler.java
===================================================================
--- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeUIHandler.java 2014-04-18 13:48:06 UTC (rev 37)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeUIHandler.java 2014-04-22 16:52:11 UTC (rev 38)
@@ -24,6 +24,7 @@
import com.franciaflex.faxtomail.persistence.entities.Attachment;
+import com.franciaflex.faxtomail.persistence.entities.DemandType;
import com.franciaflex.faxtomail.persistence.entities.Email;
import com.franciaflex.faxtomail.persistence.entities.EtatAttente;
import com.franciaflex.faxtomail.persistence.entities.FaxToMailUser;
@@ -34,6 +35,7 @@
import com.franciaflex.faxtomail.services.service.EmailService;
import com.franciaflex.faxtomail.services.service.ReferentielService;
import com.franciaflex.faxtomail.ui.swing.actions.SaveDemandeAction;
+import com.franciaflex.faxtomail.ui.swing.content.print.AttachmentToPrintChooserUI;
import com.franciaflex.faxtomail.ui.swing.content.reply.ReplyFormUI;
import com.franciaflex.faxtomail.ui.swing.content.reply.ReplyFormUIModel;
import com.franciaflex.faxtomail.ui.swing.content.search.SearchToGroupUI;
@@ -81,6 +83,7 @@
import java.util.Date;
import java.util.List;
import java.util.Map;
+import java.util.Objects;
import java.util.Set;
import static org.nuiton.i18n.I18n.t;
@@ -117,6 +120,32 @@
monitor.setBean(model);
this.ui.setContextValue(model);
+
+ model.addPropertyChangeListener(Email.PROPERTY_DEMAND_TYPE, new PropertyChangeListener() {
+
+ private int dividerLocation = -1;
+
+ @Override
+ public void propertyChange(PropertyChangeEvent evt) {
+ DemandType newType = (DemandType) evt.getNewValue();
+ DemandType oldType = (DemandType) evt.getOldValue();
+
+ if (oldType == null ||
+ newType != null && !Objects.equals(oldType.getRangeNeeded(), newType.getRangeNeeded())) {
+ JSplitPane leftVerticalSplitPanel = getUI().getLeftVerticalSplitPanel();
+
+ if (Boolean.TRUE.equals(newType.getRangeNeeded())) {
+ if (dividerLocation < 0) {
+ dividerLocation = leftVerticalSplitPanel.getLeftComponent().getPreferredSize().height + 10;
+ }
+ leftVerticalSplitPanel.setDividerLocation(dividerLocation);
+
+ } else {
+ dividerLocation = leftVerticalSplitPanel.getDividerLocation();
+ }
+ }
+ }
+ });
}
@Override
@@ -344,6 +373,7 @@
}
);
+
}
@Override
@@ -422,22 +452,24 @@
closeButtonPopups();
saveBeforeAction();
- for (Attachment attachment : getModel().getAttachment()) {
-// try {
- File editedFile = attachment.getEditedFile();
- if (editedFile == null) {
- editedFile = attachment.getOriginalFile();
- }
- log.info("print " + editedFile.getAbsolutePath());
-// Desktop.getDesktop().print(editedFile);
-
-
-// } catch (IOException e) {
-// if (log.isErrorEnabled()) {
-// log.error("", e);
+// for (Attachment attachment : getModel().getAttachment()) {
+//// try {
+// File editedFile = attachment.getEditedFile();
+// if (editedFile == null) {
+// editedFile = attachment.getOriginalFile();
// }
-// }
- }
+// log.info("print " + editedFile.getAbsolutePath());
+//// Desktop.getDesktop().print(editedFile);
+//
+//
+//// } catch (IOException e) {
+//// if (log.isErrorEnabled()) {
+//// log.error("", e);
+//// }
+//// }
+// }
+ AttachmentToPrintChooserUI dialogContent = new AttachmentToPrintChooserUI(ui, getModel());
+ openDialog(dialogContent, t("faxtomail.chooseAttachmentToPrint.title"), new Dimension(350, 500));
}
public void reply() {
Copied: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/print/AttachmentToPrintChooserUI.css (from rev 35, trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/transmit/MailFolderChooserUI.css)
===================================================================
--- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/print/AttachmentToPrintChooserUI.css (rev 0)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/print/AttachmentToPrintChooserUI.css 2014-04-22 16:52:11 UTC (rev 38)
@@ -0,0 +1,18 @@
+#message {
+ text: "faxtomail.chooseAttachmentToPrint.message";
+ border: { javax.swing.BorderFactory.createEmptyBorder(5, 5, 5, 5) };
+}
+
+#cancelButton {
+ actionIcon: cancel;
+ text: "faxtomail.chooseAttachmentToPrint.action.cancel";
+ toolTipText: "faxtomail.chooseAttachmentToPrint.action.cancel.tip";
+}
+
+#validateButton {
+ actionIcon: validate;
+ text: "faxtomail.chooseAttachmentToPrint.action.validate";
+ toolTipText: "faxtomail.chooseAttachmentToPrint.action.validate.tip";
+ //_applicationAction: {com.franciaflex.faxtomail.ui.swing.actions.TransmitAction.class};
+ enabled: { model.getMailFolder() != null };
+}
\ No newline at end of file
Copied: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/print/AttachmentToPrintChooserUI.jaxx (from rev 35, trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/transmit/MailFolderChooserUI.jaxx)
===================================================================
--- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/print/AttachmentToPrintChooserUI.jaxx (rev 0)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/print/AttachmentToPrintChooserUI.jaxx 2014-04-22 16:52:11 UTC (rev 38)
@@ -0,0 +1,37 @@
+<JPanel id='attachmentToPrintChooser' layout='{new BorderLayout()}'
+ implements='com.franciaflex.faxtomail.ui.swing.util.FaxToMailUI<com.franciaflex.faxtomail.ui.swing.content.demande.DemandeUIModel, AttachmentToPrintChooserUIHandler>'>
+
+ <import>
+ com.franciaflex.faxtomail.ui.swing.content.demande.DemandeUIModel
+
+ com.franciaflex.faxtomail.ui.swing.util.FaxToMailUI
+ com.franciaflex.faxtomail.ui.swing.util.FaxToMailUIUtil
+
+ javax.swing.BoxLayout
+
+ </import>
+
+ <script><![CDATA[
+
+ public AttachmentToPrintChooserUI(FaxToMailUI parentUI, DemandeUIModel model) {
+ FaxToMailUIUtil.setParentUI(this, parentUI);
+ setContextValue(model);
+ }
+
+ ]]></script>
+
+ <DemandeUIModel id='model' javaBean='getContextValue(DemandeUIModel.class)'/>
+
+ <JLabel id="message" constraints='BorderLayout.NORTH'/>
+
+ <JScrollPane constraints='BorderLayout.CENTER'>
+ <JPanel id="attachmentPanel"
+ layout="{ new BoxLayout(attachmentPanel, BoxLayout.Y_AXIS) }"/>
+ </JScrollPane>
+
+ <JPanel layout='{ new GridLayout(1, 0) }' constraints='BorderLayout.SOUTH'>
+ <JButton id='cancelButton' onActionPerformed='handler.cancel()'/>
+ <JButton id='validateButton'/>
+ </JPanel>
+
+</JPanel>
\ No newline at end of file
Copied: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/print/AttachmentToPrintChooserUIHandler.java (from rev 35, trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/transmit/MailFolderChooserUIHandler.java)
===================================================================
--- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/print/AttachmentToPrintChooserUIHandler.java (rev 0)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/print/AttachmentToPrintChooserUIHandler.java 2014-04-22 16:52:11 UTC (rev 38)
@@ -0,0 +1,67 @@
+package com.franciaflex.faxtomail.ui.swing.content.print;
+
+import com.franciaflex.faxtomail.persistence.entities.Attachment;
+import com.franciaflex.faxtomail.persistence.entities.Company;
+import com.franciaflex.faxtomail.persistence.entities.EtatAttente;
+import com.franciaflex.faxtomail.persistence.entities.MailFolder;
+import com.franciaflex.faxtomail.ui.swing.content.demande.DemandeUIModel;
+import com.franciaflex.faxtomail.ui.swing.util.AbstractFaxToMailUIHandler;
+import com.franciaflex.faxtomail.ui.swing.util.Cancelable;
+import com.franciaflex.faxtomail.ui.swing.util.FaxToMailUIUtil;
+import com.franciaflex.faxtomail.ui.swing.util.FolderTreeNode;
+import jaxx.runtime.validator.swing.SwingValidator;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import javax.swing.*;
+import javax.swing.event.TreeSelectionEvent;
+import javax.swing.event.TreeSelectionListener;
+import javax.swing.tree.DefaultMutableTreeNode;
+import javax.swing.tree.DefaultTreeCellRenderer;
+import java.awt.*;
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.Map;
+
+/**
+ * @author Kevin Morin (Code Lutin)
+ * @since x.x
+ */
+public class AttachmentToPrintChooserUIHandler extends AbstractFaxToMailUIHandler<DemandeUIModel, AttachmentToPrintChooserUI>
+ implements Cancelable {
+
+ private static final Log log = LogFactory.getLog(AttachmentToPrintChooserUIHandler.class);
+
+ @Override
+ public void afterInit(AttachmentToPrintChooserUI attachmentToPrintChooserUI) {
+ initUI(attachmentToPrintChooserUI);
+
+ DemandeUIModel model = getModel();
+
+ JPanel attachmentPanel = ui.getAttachmentPanel();
+ for (Attachment attachment : model.getAttachment()) {
+ JCheckBox checkBox = new JCheckBox(attachment.getOriginalFile().getName(), true);
+ attachmentPanel.add(checkBox);
+ }
+ }
+
+ @Override
+ public void onCloseUI() {
+ }
+
+ @Override
+ public SwingValidator<DemandeUIModel> getValidator() {
+ return null;
+ }
+
+ @Override
+ public void cancel() {
+ closeDialog();
+ }
+
+ @Override
+ protected JComponent getComponentToFocus() {
+ return ui.getAttachmentPanel();
+ }
+
+}
Modified: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/transmit/MailFolderChooserUI.css
===================================================================
--- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/transmit/MailFolderChooserUI.css 2014-04-18 13:48:06 UTC (rev 37)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/transmit/MailFolderChooserUI.css 2014-04-22 16:52:11 UTC (rev 38)
@@ -1,3 +1,8 @@
+#message {
+ text: "faxtomail.chooseMailFolder.message";
+ border: { javax.swing.BorderFactory.createEmptyBorder(5, 5, 5, 5) };
+}
+
#navigationTree {
font-size: "11";
rootVisible: false;
Modified: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/transmit/MailFolderChooserUI.jaxx
===================================================================
--- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/transmit/MailFolderChooserUI.jaxx 2014-04-18 13:48:06 UTC (rev 37)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/transmit/MailFolderChooserUI.jaxx 2014-04-22 16:52:11 UTC (rev 38)
@@ -21,6 +21,8 @@
<DemandeUIModel id='model' javaBean='getContextValue(DemandeUIModel.class)'/>
+ <JLabel id="message" constraints='BorderLayout.NORTH'/>
+
<JScrollPane constraints='BorderLayout.CENTER'>
<JTree id="navigationTree"/>
</JScrollPane>
Modified: trunk/faxtomail-ui-swing/src/main/resources/i18n/faxtomail-ui-swing_en_GB.properties
===================================================================
--- trunk/faxtomail-ui-swing/src/main/resources/i18n/faxtomail-ui-swing_en_GB.properties 2014-04-18 13:48:06 UTC (rev 37)
+++ trunk/faxtomail-ui-swing/src/main/resources/i18n/faxtomail-ui-swing_en_GB.properties 2014-04-22 16:52:11 UTC (rev 38)
@@ -50,12 +50,18 @@
faxtomail.attachmentEditor.text=
faxtomail.attachmentEditor.title=
faxtomail.back.button.label=
+faxtomail.chooseAttachmentToPrint.action.cancel=
+faxtomail.chooseAttachmentToPrint.action.cancel.tip=
+faxtomail.chooseAttachmentToPrint.action.validate=
+faxtomail.chooseAttachmentToPrint.action.validate.tip=
+faxtomail.chooseAttachmentToPrint.message=
faxtomail.chooseMailFolder.action.cancel=
faxtomail.chooseMailFolder.action.cancel.mnemonic=
faxtomail.chooseMailFolder.action.cancel.tip=
faxtomail.chooseMailFolder.action.validate=
faxtomail.chooseMailFolder.action.validate.mnemonic=
faxtomail.chooseMailFolder.action.validate.tip=
+faxtomail.chooseMailFolder.message=
faxtomail.chooseMailFolder.title=
faxtomail.common.askBeforeDelete.help=
faxtomail.common.askCancelEditBeforeLeaving.help=
Modified: trunk/faxtomail-ui-swing/src/main/resources/i18n/faxtomail-ui-swing_fr_FR.properties
===================================================================
--- trunk/faxtomail-ui-swing/src/main/resources/i18n/faxtomail-ui-swing_fr_FR.properties 2014-04-18 13:48:06 UTC (rev 37)
+++ trunk/faxtomail-ui-swing/src/main/resources/i18n/faxtomail-ui-swing_fr_FR.properties 2014-04-22 16:52:11 UTC (rev 38)
@@ -32,11 +32,17 @@
faxtomail.attachmentEditor.saveAttachment.title=Enregistrer la pièce-jointe
faxtomail.attachmentEditor.text=Pièces jointes (%s)
faxtomail.attachmentEditor.title=Pièces jointes
+faxtomail.chooseAttachmentToPrint.action.cancel=Annuler
+faxtomail.chooseAttachmentToPrint.action.cancel.tip=Annuler et fermer la popup
+faxtomail.chooseAttachmentToPrint.action.validate=Valider
+faxtomail.chooseAttachmentToPrint.action.validate.tip=Valider et imprimer les pièces-jointes
+faxtomail.chooseAttachmentToPrint.message=Choisissez les pièces-jointes à imprimer \:
faxtomail.chooseMailFolder.action.cancel=Annuler
faxtomail.chooseMailFolder.action.cancel.tip=Annuler et fermer la popup
faxtomail.chooseMailFolder.action.validate=Valider
faxtomail.chooseMailFolder.action.validate.tip=Valider et transférer l'élément
-faxtomail.chooseMailFolder.title=Choisissez le dossier où transférer l'élément
+faxtomail.chooseMailFolder.message=Choisissez le dossier où transférer l'élément \:
+faxtomail.chooseMailFolder.title=Dossier de destination
faxtomail.common.by.label=par
faxtomail.common.on.label=le
faxtomail.config.application=
1
0
r37 - in trunk: faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/replies faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/reply faxtomail-ui-swing/src/main/resources/i18n faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web
by kmorin@users.forge.codelutin.com 18 Apr '14
by kmorin@users.forge.codelutin.com 18 Apr '14
18 Apr '14
Author: kmorin
Date: 2014-04-18 15:48:06 +0200 (Fri, 18 Apr 2014)
New Revision: 37
Url: http://forge.codelutin.com/projects/faxtomail/repository/revisions/37
Log:
refs #4667 [ECRAN] R?\195?\169pondre
Modified:
trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/replies/DemandRepliesUIHandler.java
trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/reply/AttachmentItem.css
trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/reply/AttachmentItem.jaxx
trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/reply/ReplyFormUI.css
trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/reply/ReplyFormUI.jaxx
trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/reply/ReplyFormUIHandler.java
trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/reply/ReplyFormUIModel.java
trunk/faxtomail-ui-swing/src/main/resources/i18n/faxtomail-ui-swing_en_GB.properties
trunk/faxtomail-ui-swing/src/main/resources/i18n/faxtomail-ui-swing_fr_FR.properties
trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/MailFilterJob.java
Modified: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/replies/DemandRepliesUIHandler.java
===================================================================
--- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/replies/DemandRepliesUIHandler.java 2014-04-17 17:27:05 UTC (rev 36)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/replies/DemandRepliesUIHandler.java 2014-04-18 13:48:06 UTC (rev 37)
@@ -1,16 +1,31 @@
package com.franciaflex.faxtomail.ui.swing.content.demande.replies;
+import com.franciaflex.faxtomail.persistence.entities.Attachment;
+import com.franciaflex.faxtomail.persistence.entities.AttachmentImpl;
import com.franciaflex.faxtomail.persistence.entities.Email;
import com.franciaflex.faxtomail.persistence.entities.Reply;
import com.franciaflex.faxtomail.ui.swing.content.demande.DemandeUIModel;
+import com.franciaflex.faxtomail.ui.swing.content.reply.ReplyFormUI;
+import com.franciaflex.faxtomail.ui.swing.content.reply.ReplyFormUIModel;
import com.franciaflex.faxtomail.ui.swing.util.AbstractToolbarPopupHandler;
import com.google.common.collect.Iterables;
import jaxx.runtime.validator.swing.SwingValidator;
+import org.apache.commons.io.FileUtils;
+import org.apache.commons.io.IOUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
+import org.apache.commons.mail.MultiPartEmail;
import org.jdesktop.swingx.JXTable;
import org.jdesktop.swingx.decorator.HighlighterFactory;
+import javax.activation.DataHandler;
+import javax.activation.DataSource;
+import javax.mail.BodyPart;
+import javax.mail.Message;
+import javax.mail.MessagingException;
+import javax.mail.Part;
+import javax.mail.internet.MimeMessage;
+import javax.mail.internet.MimeMultipart;
import javax.swing.*;
import javax.swing.event.TableModelEvent;
import javax.swing.event.TableModelListener;
@@ -24,7 +39,12 @@
import java.awt.*;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
+import java.io.ByteArrayInputStream;
+import java.io.File;
+import java.io.FileOutputStream;
+import static org.nuiton.i18n.I18n.t;
+
/**
* @author Kevin Morin (Code Lutin)
* @since x.x
@@ -115,11 +135,86 @@
public void openReply(Reply reply) {
closeEditor();
+ try {
+ ReplyFormUI dialogContent = new ReplyFormUI(ui);
+ Message message = new MimeMessage(null, new ByteArrayInputStream(reply.getEmailSource().getBytes()));
+ ReplyFormUIModel replyModel = dialogContent.getModel();
+ replyModel.setReadonly(true);
+ replyModel.setSubject(message.getSubject());
+ replyModel.setTo(message.getAllRecipients()[0].toString());
+ replyModel.setFrom(message.getFrom()[0].toString());
+
+ if (message.isMimeType("multipart/*")) {
+ decomposeMultipartEmail(message, replyModel, reply.getTopiaId());
+
+ } else {
+ String content = IOUtils.toString(message.getInputStream());
+ replyModel.setMessage(content);
+ }
+
+ openFrame(dialogContent, t("faxtomail.reply.title", getModel().getSubject()), new Dimension(800, 600));
+
+ } catch (Exception e) {
+ if (log.isErrorEnabled()) {
+ log.error("", e);
+ }
+ }
+
// FaxToMailUIContext context = getContext();
// context.setCurrentEmail(demande);
// context.getActionEngine().runAction(new ShowDemandeAction(context.getMainUI().getHandler()));
}
+ /**
+ * Decompose a multipart part.
+ * - sets the email content if the part contains a text bodypart
+ * - adds attachments to the email
+ *
+ * @param part the part to decompose
+ * @throws Exception
+ */
+ protected void decomposeMultipartEmail(Part part, ReplyFormUIModel reply, String topiaId) throws Exception {
+ DataSource dataSource = part.getDataHandler().getDataSource();
+ MimeMultipart mimeMultipart = new MimeMultipart(dataSource);
+ int multiPartCount = mimeMultipart.getCount();
+
+ for (int j = 0; j < multiPartCount; j++) {
+ BodyPart bp = mimeMultipart.getBodyPart(j);
+
+ // if it is a text part, the,n this is the email content
+ if (bp.isMimeType("text/*")) {
+ String content = IOUtils.toString(bp.getInputStream());
+ reply.setMessage(content);
+
+ // if it is multipart part, decompose it
+ } else if (bp.isMimeType("multipart/*")) {
+ decomposeMultipartEmail(bp, reply, topiaId);
+
+ // else, this is an attachment
+ } else {
+ String fileName = bp.getFileName();
+ if (fileName == null) {
+ fileName = bp.getHeader("Content-ID")[0];
+ // remove the guillemets between the id
+ fileName = fileName.replaceFirst("^<(.*)>$", "$1");
+ }
+ log.debug("FileName : " + fileName);
+
+ File dir = new File(FileUtils.getTempDirectory(), topiaId);
+ if (!dir.exists()) {
+ dir.mkdir();
+ }
+ File file = new File(dir, fileName);
+ FileOutputStream fos = new FileOutputStream(file);
+
+ DataHandler dh = bp.getDataHandler();
+ dh.writeTo(fos);
+
+ reply.addAttachment(file);
+ }
+ }
+ }
+
protected class DemandReplyItemRenderer extends DemandReplyItem
implements TableCellRenderer {
Modified: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/reply/AttachmentItem.css
===================================================================
--- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/reply/AttachmentItem.css 2014-04-17 17:27:05 UTC (rev 36)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/reply/AttachmentItem.css 2014-04-18 13:48:06 UTC (rev 37)
@@ -3,14 +3,25 @@
}
#attachmentNameLabel {
- text: { attachment != null ? getAttachment().getName() : null };
+ actionIcon: "attachment";
+ text: { t("faxtomail.reply.attachment.label", getAttachment().getName(), getAttachment().length() / 1024) };
border: { BorderFactory.createEmptyBorder(3, 3, 3, 3) };
}
+
+#toolbar {
+ borderPainted: false;
+ floatable: false;
+}
+
#openAttachmentButton {
- actionIcon: "cross";
- opaque: false;
- border: { BorderFactory.createEmptyBorder(3, 3, 3, 3) };
- borderPainted: false;
- contentAreaFilled: false;
-}
\ No newline at end of file
+ actionIcon: "open-file";
+ toolTipText: "faxtomail.attachmentEditor.action.open.tip";
+}
+
+#removeAttachmentButton {
+ actionIcon: "delete";
+ toolTipText: "faxtomail.attachmentEditor.action.remove.tip";
+ visible: { !getHandler().getModel().isReadonly() };
+}
+
Modified: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/reply/AttachmentItem.jaxx
===================================================================
--- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/reply/AttachmentItem.jaxx 2014-04-17 17:27:05 UTC (rev 36)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/reply/AttachmentItem.jaxx 2014-04-18 13:48:06 UTC (rev 37)
@@ -17,8 +17,11 @@
<JLabel id='attachmentNameLabel' constraints='BorderLayout.CENTER'/>
- <JButton id='openAttachmentButton'
- constraints='BorderLayout.EAST'
- onActionPerformed='handler.removeAttachment(this)'/>
+ <JToolBar id='toolbar' constraints='BorderLayout.EAST'>
+ <JButton id='openAttachmentButton'
+ onActionPerformed='handler.openAttachment(attachment)'/>
+ <JButton id='removeAttachmentButton'
+ onActionPerformed='handler.removeAttachment(attachment)'/>
+ </JToolBar>
</JPanel>
\ No newline at end of file
Modified: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/reply/ReplyFormUI.css
===================================================================
--- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/reply/ReplyFormUI.css 2014-04-17 17:27:05 UTC (rev 36)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/reply/ReplyFormUI.css 2014-04-18 13:48:06 UTC (rev 37)
@@ -2,8 +2,13 @@
text: "faxtomail.reply.label.from";
}
+#fromPanelLayout {
+ selected: { String.valueOf(model.isReadonly()) };
+}
+
#fromField {
text: { model.getFrom() };
+ editable: false;
}
#fromComboBox {
@@ -17,14 +22,16 @@
#toField {
text: { model.getTo() };
+ editable: { !model.isReadonly() };
}
#subjectLabel {
text: "faxtomail.reply.label.subject";
}
-#objectField {
- text: { model.getObject() };
+#subjectField {
+ text: { model.getSubject() };
+ editable: { !model.isReadonly() };
}
#splitPane {
@@ -33,6 +40,7 @@
#message {
text: { model.getMessage() };
+ editable: { !model.isReadonly() };
}
#attachmentsPanel {
@@ -40,11 +48,18 @@
}
#attachmentsLabel {
- text: "faxtomail.attachmentEditor.title";
+ text: { t("faxtomail.reply.attachments.title",
+ getModel().getTotalAttachmentLength(),
+ getModel().getMaxAttachmentLength()) };
+ foreground: { getModel().isValid() ? Color.BLACK : Color.RED }
}
+#addAttachmentForm {
+ visible: { !model.isReadonly() };
+}
+
#addAttachmentLabel {
- text: "faxtomail.attachmentEditor.field.file";
+ text: "faxtomail.reply.attachments.add.label";
}
#addAttachmentFile {
@@ -59,6 +74,16 @@
actionIcon: "add";
}
+#buttonPanelLayout {
+ selected: { String.valueOf(model.isReadonly()) };
+}
+
+#closeButton {
+ actionIcon: cancel;
+ text: "faxtomail.reply.action.close";
+ toolTipText: "faxtomail.reply.action.close.tip";
+}
+
#cancelButton {
actionIcon: cancel;
text: "faxtomail.reply.action.cancel";
@@ -70,4 +95,5 @@
text: "faxtomail.reply.action.validate";
toolTipText: "faxtomail.reply.action.validate.tip";
_applicationAction: { com.franciaflex.faxtomail.ui.swing.actions.ReplyAction.class };
+ enabled: { getModel().isValid() };
}
\ No newline at end of file
Modified: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/reply/ReplyFormUI.jaxx
===================================================================
--- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/reply/ReplyFormUI.jaxx 2014-04-17 17:27:05 UTC (rev 36)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/reply/ReplyFormUI.jaxx 2014-04-18 13:48:06 UTC (rev 37)
@@ -23,25 +23,17 @@
implements='com.franciaflex.faxtomail.ui.swing.util.FaxToMailUI<ReplyFormUIModel, ReplyFormUIHandler>'>
<import>
- com.franciaflex.faxtomail.ui.swing.FaxToMailUIContext
com.franciaflex.faxtomail.ui.swing.util.FaxToMailUI
com.franciaflex.faxtomail.ui.swing.util.FaxToMailUIUtil
- com.franciaflex.faxtomail.ui.swing.content.attachment.ButtonAttachment
- com.franciaflex.faxtomail.persistence.entities.Email
- com.franciaflex.faxtomail.persistence.entities.DemandType
- com.franciaflex.faxtomail.persistence.entities.DemandStatus
- com.franciaflex.faxtomail.persistence.entities.Range
- com.franciaflex.faxtomail.persistence.entities.Priority
-
- java.text.SimpleDateFormat
- java.util.Date
-
+ java.awt.CardLayout
java.awt.Color
- jaxx.runtime.swing.editor.FileEditor
+ jaxx.runtime.swing.CardLayout2Ext
org.jdesktop.swingx.WrapLayout
+
+ static org.nuiton.i18n.I18n.t
</import>
<script><![CDATA[
@@ -55,6 +47,12 @@
<ReplyFormUIModel id='model'
initializer='getContextValue(ReplyFormUIModel.class)'/>
+ <CardLayout2Ext id='fromPanelLayout'
+ constructorParams='this, "fromPanel"'/>
+
+ <CardLayout2Ext id='buttonPanelLayout'
+ constructorParams='this, "buttonPanel"'/>
+
<Table constraints='BorderLayout.NORTH'
fill='both'>
<row>
@@ -62,10 +60,14 @@
<JLabel id="fromLabel"/>
</cell>
<cell weightx='1'>
- <!--<JTextField id="fromField"-->
- <!--onKeyReleased='handler.setText(event, "from")'/>-->
- <JComboBox id="fromComboBox"
- onItemStateChanged='handler.setText(event, "from")'/>
+ <JPanel id="fromPanel"
+ layout="{ fromPanelLayout }">
+ <JTextField id="fromField"
+ constraints='"true"'/>
+ <JComboBox id="fromComboBox"
+ onItemStateChanged='handler.setText(event, "from")'
+ constraints='"false"'/>
+ </JPanel>
</cell>
</row>
<row>
@@ -103,6 +105,7 @@
<JPanel id="attachmentsPanel" layout="{new WrapLayout(WrapLayout.LEFT)}"/>
</JScrollPane>
<Table fill="both"
+ id="addAttachmentForm"
constraints='BorderLayout.SOUTH'>
<row>
<cell>
@@ -125,9 +128,18 @@
</JPanel>
</JSplitPane>
- <JPanel layout='{new GridLayout(1, 0)}' constraints='BorderLayout.SOUTH'>
- <JButton id='cancelButton' onActionPerformed='handler.cancel()'/>
- <JButton id='validateButton'/>
+ <JPanel id="buttonPanel"
+ layout="{ buttonPanelLayout }"
+ constraints='BorderLayout.SOUTH'>
+ <JPanel constraints='"true"'
+ layout='{new GridLayout(1, 0)}'>
+ <JButton id='closeButton' onActionPerformed='handler.cancel()'/>
+ </JPanel>
+ <JPanel constraints='"false"'
+ layout='{new GridLayout(1, 0)}'>
+ <JButton id='cancelButton' onActionPerformed='handler.cancel()'/>
+ <JButton id='validateButton'/>
+ </JPanel>
</JPanel>
</JPanel>
\ No newline at end of file
Modified: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/reply/ReplyFormUIHandler.java
===================================================================
--- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/reply/ReplyFormUIHandler.java 2014-04-17 17:27:05 UTC (rev 36)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/reply/ReplyFormUIHandler.java 2014-04-18 13:48:06 UTC (rev 37)
@@ -5,6 +5,7 @@
import com.franciaflex.faxtomail.ui.swing.content.demande.DemandeUIModel;
import com.franciaflex.faxtomail.ui.swing.util.AbstractFaxToMailUIHandler;
import com.franciaflex.faxtomail.ui.swing.util.Cancelable;
+import com.franciaflex.faxtomail.ui.swing.util.FaxToMailUIUtil;
import com.google.common.collect.Lists;
import jaxx.runtime.JAXXUtil;
import jaxx.runtime.swing.editor.FileEditor;
@@ -21,7 +22,10 @@
import java.awt.*;
import java.awt.event.ActionListener;
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
import java.io.File;
+import java.io.IOException;
import java.io.Serializable;
import java.lang.reflect.Method;
import java.util.Collection;
@@ -43,6 +47,7 @@
super.beforeInit(ui);
ReplyFormUIModel model = new ReplyFormUIModel();
+ model.setMaxAttachmentLength(10485760);
DemandeUIModel currentEmail = getContext().getCurrentEmail();
model.setOriginalDemand(currentEmail);
@@ -66,6 +71,20 @@
plainContent.replaceAll("\n", "\n> "));
model.setMessage(quotedReply);
+ model.addPropertyChangeListener(ReplyFormUIModel.PROPERTY_ATTACHMENT, new PropertyChangeListener() {
+ @Override
+ public void propertyChange(PropertyChangeEvent evt) {
+ updateAttachmentPanel((Collection<File>) evt.getNewValue());
+ }
+ });
+
+ model.addPropertyChangeListener(ReplyFormUIModel.PROPERTY_READONLY, new PropertyChangeListener() {
+ @Override
+ public void propertyChange(PropertyChangeEvent evt) {
+ updateAttachmentPanel(getModel().getAttachments());
+ }
+ });
+
this.ui.setContextValue(model);
}
@@ -119,15 +138,11 @@
return getUI().getMessage();
}
- public void removeAttachment(AttachmentItem item) {
+ public void removeAttachment(File attachment) {
ReplyFormUIModel model = getModel();
- File attachment = item.getAttachment();
model.removeAttachment(attachment);
- ui.getAttachmentsPanel().remove(item);
- ui.getAttachmentsPanel().updateUI();
-
model.addAvailableAttachment(attachment);
ui.getAddAttachmentFile().addItem(attachment);
}
@@ -139,13 +154,6 @@
ReplyFormUIModel model = getModel();
model.addAttachment(file);
- AttachmentItem item = new AttachmentItem();
- item.setHandler(this);
- item.setAttachment(file);
- ui.getAttachmentsPanel().add(item);
-
- ui.getAttachmentsPanel().updateUI();
-
model.removeAvailableAttachment(file);
ui.getAddAttachmentFile().removeItem(file);
@@ -153,6 +161,18 @@
}
}
+ protected void updateAttachmentPanel(Collection<File> attachments) {
+ JPanel attachmentsPanel = ui.getAttachmentsPanel();
+ attachmentsPanel.removeAll();
+ for (File attachment : attachments) {
+ AttachmentItem item = new AttachmentItem();
+ item.setHandler(this);
+ item.setAttachment(attachment);
+ attachmentsPanel.add(item);
+ }
+ attachmentsPanel.updateUI();
+ }
+
public void openLocation() {
// use last selected file
ReplyFormUIModel model = getModel();
@@ -177,6 +197,17 @@
}
}
+ public void openAttachment(File attachment) {
+ Desktop desktop = FaxToMailUIUtil.getDesktopForBrowse();
+ try {
+// desktop.browse(file.toURI());
+ desktop.open(attachment);
+
+ } catch (IOException e) {
+ getContext().getErrorHelper().showErrorDialog(t("swing.error.cannot.open.file"));
+ }
+ }
+
protected class FileComboBoxEditor implements ComboBoxEditor {
protected File oldValue;
Modified: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/reply/ReplyFormUIModel.java
===================================================================
--- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/reply/ReplyFormUIModel.java 2014-04-17 17:27:05 UTC (rev 36)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/reply/ReplyFormUIModel.java 2014-04-18 13:48:06 UTC (rev 37)
@@ -9,7 +9,9 @@
import java.io.File;
import java.util.ArrayList;
import java.util.Collection;
+import java.util.HashSet;
import java.util.List;
+import java.util.Set;
/**
* @author Kevin Morin (Code Lutin)
@@ -22,15 +24,24 @@
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_ATTACHMENT = "attachment";
+ public static final String PROPERTY_READONLY = "readonly";
+ public static final String PROPERTY_MAX_ATTACHMENT_LENGHT = "maxAttachmentLength";
+ public static final String PROPERTY_TOTAL_ATTACHMENT_LENGHT = "totalAttachmentLength";
+ public static final String PROPERTY_VALID = "valid";
protected String to;
protected String from;
protected String subject;
protected String message;
protected DemandeUIModel originalDemand;
+ protected long maxAttachmentLength = 0;
+ protected long totalAttachmentLength = 0;
+ protected boolean valid = true;
+ protected boolean readonly = false;
- protected List<File> attachments = new ArrayList<File>();
- protected List<File> availableAttachments = new ArrayList<File>();
+ protected Set<File> attachments = new HashSet<File>();
+ protected Set<File> availableAttachments = new HashSet<File>();
protected File lastVisitedDirectory = FileUtils.getUserDirectory();
@@ -84,19 +95,33 @@
firePropertyChange(PROPERTY_ORIGINAL_DEMAND, oldValue, originalDemand);
}
- public Collection<File> getAttachments() {
+ public Set<File> getAttachments() {
return attachments;
}
public void addAttachment(File attachment) {
attachments.add(attachment);
+ firePropertyChange(PROPERTY_ATTACHMENT, null, getAttachments());
+
+ Object oldValue = getTotalAttachmentLength();
+ totalAttachmentLength += attachment.length();
+ firePropertyChange(PROPERTY_TOTAL_ATTACHMENT_LENGHT, oldValue, getTotalAttachmentLength());
+
+ recomputeValidity();
}
public void removeAttachment(File attachment) {
attachments.remove(attachment);
+ firePropertyChange(PROPERTY_ATTACHMENT, null, getAttachments());
+
+ Object oldValue = getTotalAttachmentLength();
+ totalAttachmentLength -= attachment.length();
+ firePropertyChange(PROPERTY_TOTAL_ATTACHMENT_LENGHT, oldValue, getTotalAttachmentLength());
+
+ recomputeValidity();
}
- public List<File> getAvailableAttachments() {
+ public Set<File> getAvailableAttachments() {
return availableAttachments;
}
@@ -115,4 +140,40 @@
public void setLastVisitedDirectory(File lastVisitedDirectory) {
this.lastVisitedDirectory = lastVisitedDirectory;
}
+
+ public boolean isReadonly() {
+ return readonly;
+ }
+
+ public void setReadonly(boolean readonly) {
+ Object oldValue = isReadonly();
+ this.readonly = readonly;
+ firePropertyChange(PROPERTY_READONLY, oldValue, readonly);
+ }
+
+ public long getMaxAttachmentLength() {
+ return maxAttachmentLength / 1024;
+ }
+
+ public void setMaxAttachmentLength(long maxAttachmentLength) {
+ Object oldValue = getMaxAttachmentLength();
+ this.maxAttachmentLength = maxAttachmentLength;
+ firePropertyChange(PROPERTY_MAX_ATTACHMENT_LENGHT, oldValue, maxAttachmentLength);
+
+ recomputeValidity();
+ }
+
+ public long getTotalAttachmentLength() {
+ return totalAttachmentLength / 1024;
+ }
+
+ public boolean isValid() {
+ return valid;
+ }
+
+ public void recomputeValidity() {
+ Object oldValue = isValid();
+ this.valid = totalAttachmentLength < maxAttachmentLength;
+ firePropertyChange(PROPERTY_VALID, oldValue, valid);
+ }
}
Modified: trunk/faxtomail-ui-swing/src/main/resources/i18n/faxtomail-ui-swing_en_GB.properties
===================================================================
--- trunk/faxtomail-ui-swing/src/main/resources/i18n/faxtomail-ui-swing_en_GB.properties 2014-04-17 17:27:05 UTC (rev 36)
+++ trunk/faxtomail-ui-swing/src/main/resources/i18n/faxtomail-ui-swing_en_GB.properties 2014-04-18 13:48:06 UTC (rev 37)
@@ -315,10 +315,13 @@
faxtomail.reply.action.cancel=
faxtomail.reply.action.cancel.mnemonic=
faxtomail.reply.action.cancel.tip=
+faxtomail.reply.action.close=
+faxtomail.reply.action.close.tip=
faxtomail.reply.action.validate=
faxtomail.reply.action.validate.mnemonic=
faxtomail.reply.action.validate.tip=
faxtomail.reply.attachment=
+faxtomail.reply.attachments.add.label=
faxtomail.reply.from=
faxtomail.reply.label.attachment=
faxtomail.reply.label.from=
Modified: trunk/faxtomail-ui-swing/src/main/resources/i18n/faxtomail-ui-swing_fr_FR.properties
===================================================================
--- trunk/faxtomail-ui-swing/src/main/resources/i18n/faxtomail-ui-swing_fr_FR.properties 2014-04-17 17:27:05 UTC (rev 36)
+++ trunk/faxtomail-ui-swing/src/main/resources/i18n/faxtomail-ui-swing_fr_FR.properties 2014-04-18 13:48:06 UTC (rev 37)
@@ -184,9 +184,13 @@
faxtomail.rangeRows.table.header.savQuantity.tip=Quantité de SAV
faxtomail.reply.action.cancel=Annuler
faxtomail.reply.action.cancel.tip=Annuler et fermer la popup
+faxtomail.reply.action.close=Fermer
+faxtomail.reply.action.close.tip=Fermer
faxtomail.reply.action.validate=Valider
faxtomail.reply.action.validate.tip=Valider et répondre au mail
-faxtomail.reply.label.attachment=Ajouter des pièces jointes
+faxtomail.reply.attachment.label=%1$s (%2$s ko)
+faxtomail.reply.attachments.add.label=Ajouter des pièces jointes
+faxtomail.reply.attachments.title=Pièces-jointes (%1$s / %2$s ko autorisés)
faxtomail.reply.label.from=De \:
faxtomail.reply.label.subject=Objet \:
faxtomail.reply.label.to=À \:
Modified: trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/MailFilterJob.java
===================================================================
--- trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/MailFilterJob.java 2014-04-17 17:27:05 UTC (rev 36)
+++ trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/MailFilterJob.java 2014-04-18 13:48:06 UTC (rev 37)
@@ -257,7 +257,11 @@
} else {
String fileName = bp.getFileName();
if (fileName == null) {
- fileName = bp.getHeader("Content-ID")[0];
+ String[] headers = bp.getHeader("Content-ID");
+ if (headers == null) {
+ break;
+ }
+ fileName = headers[0];
// remove the guillemets between the id
fileName = fileName.replaceFirst("^<(.*)>$", "$1");
}
1
0
17 Apr '14
Author: kmorin
Date: 2014-04-17 19:27:05 +0200 (Thu, 17 Apr 2014)
New Revision: 36
Url: http://forge.codelutin.com/projects/faxtomail/repository/revisions/36
Log:
refs #4667 [ECRAN] R?\195?\169pondre
Added:
trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/demandgroup/
trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/history/
trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/replies/
trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/replies/ButtonDemandReplies.java
trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/replies/DemandRepliesUI.css
trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/replies/DemandRepliesUI.jaxx
trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/replies/DemandRepliesUIHandler.java
trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/replies/DemandReplyItem.css
trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/replies/DemandReplyItem.jaxx
trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/reply/AttachmentItem.css
trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/reply/AttachmentItem.jaxx
trunk/faxtomail-ui-swing/src/main/resources/icons/action-cross.png
trunk/faxtomail-ui-swing/src/main/resources/icons/action-open.png
trunk/faxtomail-ui-swing/src/main/resources/icons/cross_blue.png
trunk/faxtomail-ui-swing/src/main/resources/icons/cross_red.png
Removed:
trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demandgroup/
trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/history/
trunk/faxtomail-ui-swing/src/main/resources/icons/action-cross.png
trunk/faxtomail-ui-swing/src/main/resources/icons/cross.png
Modified:
trunk/faxtomail-persistence/src/main/xmi/faxtomail.zargo
trunk/faxtomail-service/pom.xml
trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/DecoratorService.java
trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/EmailService.java
trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/InitFaxToMailService.java
trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/MailFolderService.java
trunk/faxtomail-service/src/main/resources/i18n/faxtomail-service_en_GB.properties
trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/GroupAction.java
trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/ReplyAction.java
trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/SaveDemandeAction.java
trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/MainUIHandler.java
trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/attachment/AttachmentEditorUI.css
trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeUI.css
trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeUI.jaxx
trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeUIHandler.java
trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeUIModel.java
trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/demandgroup/ButtonEmailGroup.java
trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/demandgroup/DemandGroupItem.css
trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/demandgroup/DemandGroupItem.jaxx
trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/demandgroup/DemandGroupUI.css
trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/demandgroup/DemandGroupUI.jaxx
trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/demandgroup/DemandGroupUIHandler.java
trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/history/ButtonHistory.java
trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/history/HistoryItemModel.java
trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/history/HistoryListUIHandler.java
trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/reply/ReplyFormUI.css
trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/reply/ReplyFormUI.jaxx
trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/reply/ReplyFormUIHandler.java
trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/reply/ReplyFormUIModel.java
trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/search/SearchToGroupUI.css
trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/search/SearchUI.css
trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/search/SearchUI.jaxx
trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/search/SearchUIModel.java
trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/AbstractFaxToMailDemandListHandler.java
trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/AbstractFaxToMailUIHandler.java
trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/AbstractToolbarPopupButton.java
trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/DemandeTableModel.java
trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/FaxToMailUIUtil.java
trunk/faxtomail-ui-swing/src/main/resources/i18n/faxtomail-ui-swing_en_GB.properties
trunk/faxtomail-ui-swing/src/main/resources/i18n/faxtomail-ui-swing_fr_FR.properties
trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/MailFilterJob.java
trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/action/admin/ConfigurationAction.java
trunk/pom.xml
Modified: trunk/faxtomail-persistence/src/main/xmi/faxtomail.zargo
===================================================================
(Binary files differ)
Modified: trunk/faxtomail-service/pom.xml
===================================================================
--- trunk/faxtomail-service/pom.xml 2014-04-14 16:33:11 UTC (rev 35)
+++ trunk/faxtomail-service/pom.xml 2014-04-17 17:27:05 UTC (rev 36)
@@ -113,6 +113,17 @@
<artifactId>xwork-core</artifactId>
</dependency>
+ <dependency>
+ <groupId>javax.mail</groupId>
+ <artifactId>mail</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.commons</groupId>
+ <artifactId>commons-email</artifactId>
+ <version>${commonsEmailVersion}</version>
+ </dependency>
+
<!-- Logging -->
<dependency>
Modified: trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/DecoratorService.java
===================================================================
--- trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/DecoratorService.java 2014-04-14 16:33:11 UTC (rev 35)
+++ trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/DecoratorService.java 2014-04-17 17:27:05 UTC (rev 36)
@@ -3,9 +3,11 @@
import com.franciaflex.faxtomail.persistence.entities.Attachment;
import com.franciaflex.faxtomail.persistence.entities.FaxToMailUser;
import com.franciaflex.faxtomail.persistence.entities.HasLabel;
+import com.franciaflex.faxtomail.persistence.entities.Reply;
import org.nuiton.decorator.Decorator;
import org.nuiton.decorator.DecoratorProvider;
+import java.io.File;
import java.text.DateFormat;
import java.util.Date;
@@ -86,6 +88,17 @@
return DateFormat.getDateInstance(DateFormat.MEDIUM).format(bean);
}
});
+ registerDecorator(new Decorator<File>(File.class) {
+ private static final long serialVersionUID = 1L;
+
+ @Override
+ public String toString(Object bean) {
+ if (bean == null) {
+ return "";
+ }
+ return ((File) bean).getName();
+ }
+ });
registerMultiJXPathDecorator(HasLabel.class, "${label}$s", SEPARATOR, " - ");
registerMultiJXPathDecorator(Attachment.class, "${originalFile}$s", SEPARATOR, " - ");
registerMultiJXPathDecorator(FaxToMailUser.class, "${trigraph}$s#${firstName}$s#${lastName}$s", SEPARATOR, " ");
Modified: trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/EmailService.java
===================================================================
--- trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/EmailService.java 2014-04-14 16:33:11 UTC (rev 35)
+++ trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/EmailService.java 2014-04-17 17:27:05 UTC (rev 36)
@@ -2,6 +2,7 @@
import com.franciaflex.faxtomail.persistence.entities.Attachment;
import com.franciaflex.faxtomail.persistence.entities.AttachmentTopiaDao;
+import com.franciaflex.faxtomail.persistence.entities.Client;
import com.franciaflex.faxtomail.persistence.entities.DemandStatus;
import com.franciaflex.faxtomail.persistence.entities.Email;
import com.franciaflex.faxtomail.persistence.entities.EmailGroup;
@@ -15,24 +16,54 @@
import com.franciaflex.faxtomail.persistence.entities.MailFolder;
import com.franciaflex.faxtomail.persistence.entities.RangeRow;
import com.franciaflex.faxtomail.persistence.entities.RangeRowTopiaDao;
+import com.franciaflex.faxtomail.persistence.entities.Reply;
+import com.franciaflex.faxtomail.persistence.entities.ReplyTopiaDao;
import com.franciaflex.faxtomail.services.FaxToMailServiceSupport;
import com.google.common.collect.Lists;
import com.google.common.collect.Sets;
+import org.apache.commons.io.IOUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
+import org.apache.commons.mail.DefaultAuthenticator;
+import org.apache.commons.mail.EmailAttachment;
+import org.apache.commons.mail.EmailException;
+import org.apache.commons.mail.MultiPartEmail;
+import org.apache.commons.mail.SimpleEmail;
import org.nuiton.topia.persistence.TopiaEntityVisitor;
import org.nuiton.topia.persistence.internal.AbstractTopiaDao;
import org.nuiton.topia.persistence.pager.TopiaPagerBean;
+import javax.activation.DataHandler;
+import javax.activation.DataSource;
+import javax.activation.FileDataSource;
+import javax.mail.BodyPart;
+import javax.mail.Message;
+import javax.mail.MessagingException;
+import javax.mail.Multipart;
+import javax.mail.PasswordAuthentication;
+import javax.mail.Session;
+import javax.mail.Transport;
+import javax.mail.internet.InternetAddress;
+import javax.mail.internet.MailDateFormat;
+import javax.mail.internet.MimeBodyPart;
+import javax.mail.internet.MimeMessage;
+import javax.mail.internet.MimeMultipart;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
+import java.io.File;
+import java.io.InputStream;
+import java.net.URL;
+import java.text.DateFormat;
import java.util.ArrayList;
+import java.util.Calendar;
import java.util.Collection;
import java.util.Date;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
+import java.util.Locale;
import java.util.Map;
+import java.util.Properties;
import java.util.Set;
/**
@@ -54,7 +85,8 @@
HistoryTopiaDao historyDao = getPersistenceContext().getHistoryDao();
Set<String> fieldSet = Sets.newHashSet(modifiedFields);
- if (!fieldSet.isEmpty() && !fieldSet.contains(Email.PROPERTY_TAKEN_BY)) {
+ if (email.getTakenBy() == null &&
+ !fieldSet.isEmpty() && !fieldSet.contains(Email.PROPERTY_TAKEN_BY)) {
email.setTakenBy(user);
fieldSet.add(Email.PROPERTY_TAKEN_BY);
}
@@ -97,7 +129,7 @@
//TODO transmit to EDI
}
- History history = historyDao.create(History.PROPERTY_TYPE, HistoryType.MODIFICATION,
+ History history = historyDao.create(History.PROPERTY_TYPE, email.isHistoryEmpty() ? HistoryType.CREATION : HistoryType.MODIFICATION,
History.PROPERTY_FAX_TO_MAIL_USER, user,
History.PROPERTY_FIELDS, fieldSet,
History.PROPERTY_MODIFICATION_DATE, now);
@@ -186,7 +218,7 @@
EmailTopiaDao dao = getPersistenceContext().getEmailDao();
List<Email> result = new ArrayList<>(dao.newQueryBuilder()
- .addContainsText(Email.PROPERTY_OBJECT, emailLike.getObject())
+ .addContainsText(Email.PROPERTY_SUBJECT, emailLike.getSubject())
.addContainsText(Email.PROPERTY_SENDER, emailLike.getSender())
// .addContainsText(Email.PROPERTY_CLIENT_CODE, emailLike.getClientCode())
.addContainsText(Email.PROPERTY_PROJECT_REFERENCE, emailLike.getProjectReference())
@@ -243,13 +275,13 @@
email1.addHistory(historyDao.create(History.PROPERTY_TYPE, HistoryType.GROUP,
History.PROPERTY_FAX_TO_MAIL_USER, user,
- History.PROPERTY_FIELDS, Sets.newHashSet(email2.getObject()),
+ History.PROPERTY_FIELDS, Sets.newHashSet(email2.getSubject()),
History.PROPERTY_MODIFICATION_DATE, now));
Email result = emailDao.update(email1);
email2.addHistory(historyDao.create(History.PROPERTY_TYPE, HistoryType.GROUP,
History.PROPERTY_FAX_TO_MAIL_USER, user,
- History.PROPERTY_FIELDS, Sets.newHashSet(email1.getObject()),
+ History.PROPERTY_FIELDS, Sets.newHashSet(email1.getSubject()),
History.PROPERTY_MODIFICATION_DATE, now));
emailDao.update(email2);
@@ -257,4 +289,74 @@
return result;
}
+
+ public Email reply(String from, String to, String subject,
+ String content, Collection<File> attachments,
+ String originalEmailId, FaxToMailUser user) {
+
+ Email email = getEmailById(originalEmailId);
+
+ try {
+ Properties properties = new Properties();
+
+ try {
+ URL smtpPropertiesURL = ClassLoader.getSystemResource("smtp.properties");
+ if (smtpPropertiesURL != null) {
+ properties.load(smtpPropertiesURL.openStream());
+ }
+ } catch(Exception e) {
+ log.error("error getting the smtp properties", e);
+ }
+
+ final String smtpUser = properties.getProperty("mail.user");
+ final String password = properties.getProperty("mail.password");
+
+ MultiPartEmail message = new MultiPartEmail();
+ message.setHostName(properties.getProperty("mail.smtp.host"));
+ message.setSmtpPort(Integer.parseInt(properties.getProperty("mail.smtp.port")));
+ message.setAuthenticator(new DefaultAuthenticator(smtpUser, password));
+ message.setSSLOnConnect(true);
+
+ message.setFrom(from);
+ message.addTo(to);
+ message.setSubject(subject);
+ message.setMsg(content);
+
+ for (File attachment : attachments) {
+ // Create the attachment
+ message.attach(attachment);
+ }
+
+ String emailId = message.send();
+
+ ReplyTopiaDao replyTopiaDao = getPersistenceContext().getReplyDao();
+ Date now = new Date();
+ String emailSource = String.format("Date: %1$s\nFrom: %2$s\nTo: %3$s\nMessage-ID: %4$s\nSubject: %5$s\nContent-Type: %6$s\n",
+ MailDateFormat.getDateTimeInstance(DateFormat.FULL, DateFormat.FULL, Locale.US).format(now),
+ from, to, emailId, subject, message.getMimeMessage().getContentType());
+
+ emailSource += IOUtils.toString(message.getMimeMessage().getInputStream());
+ Reply reply = replyTopiaDao.create(Reply.PROPERTY_EMAIL_SOURCE, emailSource,
+ Reply.PROPERTY_SENT_DATE, now,
+ Reply.PROPERTY_SUBJECT, subject);
+
+ email.addReplies(reply);
+
+ HistoryTopiaDao historyDao = getPersistenceContext().getHistoryDao();
+ History history = historyDao.create(History.PROPERTY_TYPE, HistoryType.REPLY,
+ History.PROPERTY_FAX_TO_MAIL_USER, user,
+ History.PROPERTY_MODIFICATION_DATE, now);
+ email.addHistory(history);
+
+ email = saveEmail(email, user);
+
+ } catch (Exception e) {
+ if (log.isErrorEnabled()) {
+ log.error("", e);
+ }
+ }
+
+ return email;
+ }
}
+
Modified: trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/InitFaxToMailService.java
===================================================================
--- trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/InitFaxToMailService.java 2014-04-14 16:33:11 UTC (rev 35)
+++ trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/InitFaxToMailService.java 2014-04-17 17:27:05 UTC (rev 36)
@@ -237,7 +237,8 @@
int etatAttenteSize = etatAttentes.size();
// root folders
- MailFolder chargesClientelle = folderDao.create(MailFolder.PROPERTY_NAME, "Chargés de clientèle");
+ MailFolder chargesClientelle = folderDao.create(MailFolder.PROPERTY_NAME, "Chargés de clientèle",
+ MailFolder.PROPERTY_REPLY_ADRESSES, Lists.newArrayList("no-reply(a)franciaflex.com"));
folders.put("Chargés de clientèle", chargesClientelle);
Collections.shuffle(etatAttentes);
@@ -398,7 +399,7 @@
History.PROPERTY_FIELDS, Sets.newHashSet(Email.PROPERTY_SENDER,
Email.PROPERTY_CLIENT,
Email.PROPERTY_PROJECT_REFERENCE,
- Email.PROPERTY_OBJECT,
+ Email.PROPERTY_SUBJECT,
Email.PROPERTY_RECEPTION_DATE,
Email.PROPERTY_MAIL_FOLDER,
Email.PROPERTY_DEMAND_STATUS),
@@ -409,7 +410,7 @@
Email.PROPERTY_FAX, fax,
Email.PROPERTY_CLIENT, client,
Email.PROPERTY_PROJECT_REFERENCE, projectRef,
- Email.PROPERTY_OBJECT, client.getCaracteristic1() + " / " + client.getCode() + " / " + client.getName() + " / " + client.getFaxNumber() + " / " + dateDecorator.toString(now),
+ Email.PROPERTY_SUBJECT, client.getCaracteristic1() + " / " + client.getCode() + " / " + client.getName() + " / " + client.getFaxNumber() + " / " + dateDecorator.toString(now),
Email.PROPERTY_RECEPTION_DATE, now,
Email.PROPERTY_MAIL_FOLDER, folder,
Email.PROPERTY_DEMAND_STATUS, opened ? DemandStatus.IN_PROGRESS : DemandStatus.UNTREATED,
@@ -431,7 +432,7 @@
History.PROPERTY_FIELDS, Sets.newHashSet(Email.PROPERTY_SENDER,
Email.PROPERTY_CLIENT,
Email.PROPERTY_PROJECT_REFERENCE,
- Email.PROPERTY_OBJECT,
+ Email.PROPERTY_SUBJECT,
Email.PROPERTY_RECEPTION_DATE,
Email.PROPERTY_MAIL_FOLDER,
Email.PROPERTY_DEMAND_STATUS),
@@ -442,7 +443,7 @@
Email.PROPERTY_FAX, fax,
Email.PROPERTY_CLIENT, client,
Email.PROPERTY_PROJECT_REFERENCE, projectRef,
- Email.PROPERTY_OBJECT, client.getCaracteristic1() + " / " + client.getCode() + " / " + client.getName() + " / " + client.getFaxNumber() + " / " + dateDecorator.toString(yesterday),
+ Email.PROPERTY_SUBJECT, client.getCaracteristic1() + " / " + client.getCode() + " / " + client.getName() + " / " + client.getFaxNumber() + " / " + dateDecorator.toString(yesterday),
Email.PROPERTY_RECEPTION_DATE, yesterday,
Email.PROPERTY_MAIL_FOLDER, folder,
Email.PROPERTY_DEMAND_STATUS, opened ? DemandStatus.IN_PROGRESS : DemandStatus.UNTREATED,
Modified: trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/MailFolderService.java
===================================================================
--- trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/MailFolderService.java 2014-04-14 16:33:11 UTC (rev 35)
+++ trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/MailFolderService.java 2014-04-17 17:27:05 UTC (rev 36)
@@ -30,7 +30,6 @@
private static final Log log = LogFactory.getLog(MailFolderService.class);
-
public MailFolder getFolderForRecipient(String recipient) {
MailFilterTopiaDao filterTopiaDao = getPersistenceContext().getMailFilterDao();
Modified: trunk/faxtomail-service/src/main/resources/i18n/faxtomail-service_en_GB.properties
===================================================================
--- trunk/faxtomail-service/src/main/resources/i18n/faxtomail-service_en_GB.properties 2014-04-14 16:33:11 UTC (rev 35)
+++ trunk/faxtomail-service/src/main/resources/i18n/faxtomail-service_en_GB.properties 2014-04-17 17:27:05 UTC (rev 36)
@@ -0,0 +1,7 @@
+faxtomail.email.projectReference.default=
+faxtomail.service.referential.import.clients.error=
+faxtomail.service.referential.import.emailAccount.error=
+faxtomail.service.referential.import.emailFilter.error=
+faxtomail.validator.error.email.clientCode.required=
+faxtomail.validator.error.email.demandType.required=
+faxtomail.validator.error.email.projectReference.required=
Modified: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/GroupAction.java
===================================================================
--- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/GroupAction.java 2014-04-14 16:33:11 UTC (rev 35)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/GroupAction.java 2014-04-17 17:27:05 UTC (rev 36)
@@ -43,7 +43,7 @@
int i = JOptionPane.showConfirmDialog(
null,
- t("faxtomail.alert.groupConfirmation.message", currentEmail.getObject(), selectedEmail.getObject()),
+ t("faxtomail.alert.groupConfirmation.message", currentEmail.getSubject(), selectedEmail.getSubject()),
t("faxtomail.alert.groupConfirmation.title"),
JOptionPane.YES_NO_OPTION,
JOptionPane.QUESTION_MESSAGE);
@@ -64,7 +64,7 @@
currentEmail.fromEntity(email1);
currentEmail.setGroupedDemandes(email1.getEmailGroup());
- handler.showInformationMessage(t("faxtomail.demande.group.successful", email2.getObject()));
+ handler.showInformationMessage(t("faxtomail.demande.group.successful", email2.getSubject()));
handler.closeFrame();
}
Modified: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/ReplyAction.java
===================================================================
--- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/ReplyAction.java 2014-04-14 16:33:11 UTC (rev 35)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/ReplyAction.java 2014-04-17 17:27:05 UTC (rev 36)
@@ -1,5 +1,8 @@
package com.franciaflex.faxtomail.ui.swing.actions;
+import com.franciaflex.faxtomail.persistence.entities.Email;
+import com.franciaflex.faxtomail.services.service.EmailService;
+import com.franciaflex.faxtomail.ui.swing.content.demande.DemandeUIModel;
import com.franciaflex.faxtomail.ui.swing.content.reply.ReplyFormUI;
import com.franciaflex.faxtomail.ui.swing.content.reply.ReplyFormUIHandler;
import com.franciaflex.faxtomail.ui.swing.content.reply.ReplyFormUIModel;
@@ -13,6 +16,7 @@
public class ReplyAction extends AbstractFaxToMailAction<ReplyFormUIModel, ReplyFormUI, ReplyFormUIHandler> {
private static final Log log = LogFactory.getLog(ReplyAction.class);
+ private EmailService emailService;
public ReplyAction(ReplyFormUIHandler handler) {
super(handler, false);
@@ -20,12 +24,26 @@
@Override
public void doAction() throws Exception {
- log.warn("do reply");
+ log.info("do reply");
+
+ ReplyFormUIModel model = getModel();
+ emailService = getContext().getEmailService();
+ DemandeUIModel originalDemand = getModel().getOriginalDemand();
+
+ Email email = emailService.reply(model.getFrom(),
+ model.getTo(),
+ model.getSubject(),
+ model.getMessage(),
+ model.getAttachments(),
+ originalDemand.getTopiaId(),
+ getContext().getCurrentUser());
+
+ originalDemand.fromEntity(email);
}
@Override
public void postSuccessAction() {
super.postSuccessAction();
- handler.closeDialog();
+ handler.closeFrame();
}
}
Modified: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/SaveDemandeAction.java
===================================================================
--- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/SaveDemandeAction.java 2014-04-14 16:33:11 UTC (rev 35)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/SaveDemandeAction.java 2014-04-17 17:27:05 UTC (rev 36)
@@ -72,9 +72,14 @@
FaxToMailUser currentUser = context.getCurrentUser();
Email email = model.toEntity(persistedEmail);
- String[] modifiedProperties = getHandler().getMonitor().getModifiedProperties();
+ BeanMonitor monitor = getHandler().getMonitor();
+
+ String[] modifiedProperties = monitor.getModifiedProperties();
email = context.getEmailService().saveEmail(email, currentUser, modifiedProperties);
model.fromEntity(email);
+
+ getModel().setModify(false);
+ monitor.clearModified();
}
}
Modified: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/MainUIHandler.java
===================================================================
--- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/MainUIHandler.java 2014-04-14 16:33:11 UTC (rev 35)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/MainUIHandler.java 2014-04-17 17:27:05 UTC (rev 36)
@@ -340,7 +340,7 @@
case DEMANDE:
screenUI = new DemandeUI(ui);
DemandeUIModel currentEmail = getContext().getCurrentEmail();
- screenTitle = currentEmail.getObject();
+ screenTitle = currentEmail.getSubject();
icon = JAXXWidgetUtil.createActionIcon("email");
rightDecoration = ((DemandeUI) screenUI).getTopToolBar();
break;
Modified: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/attachment/AttachmentEditorUI.css
===================================================================
--- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/attachment/AttachmentEditorUI.css 2014-04-14 16:33:11 UTC (rev 35)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/attachment/AttachmentEditorUI.css 2014-04-17 17:27:05 UTC (rev 36)
@@ -9,6 +9,8 @@
#noAttachmentsLabel {
text: "faxtomail.attachmentEditor.attachments.empty";
visible: { model.getAttachment().isEmpty() };
+ border: { javax.swing.BorderFactory.createEmptyBorder(3, 3, 3, 3) };
+ font-style: italic;
}
#attachments {
Modified: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeUI.css
===================================================================
--- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeUI.css 2014-04-14 16:33:11 UTC (rev 35)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeUI.css 2014-04-17 17:27:05 UTC (rev 36)
@@ -45,12 +45,12 @@
borderPainted: false;
}
-#objectLabel {
- text: "faxtomail.demande.object.label";
+#subjectLabel {
+ text: "faxtomail.demande.subject.label";
}
-#objectField {
- text: {model.getObject()};
+#subjectField {
+ text: {model.getSubject()};
}
#receivedDateLabel {
@@ -154,7 +154,6 @@
#mailBodyField {
editable: false;
- text: { model.getContent() };
}
#takenByLabel {
@@ -235,7 +234,6 @@
visible: { model.getEdiCodeNumber() != null };
}
-
.horizontal-separator {
text: " | ";
}
@@ -312,4 +310,4 @@
text: "faxtomail.demande.group.button.label";
actionIcon: group;
enabled: { model.isEditable() };
-}
+}
\ No newline at end of file
Modified: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeUI.jaxx
===================================================================
--- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeUI.jaxx 2014-04-14 16:33:11 UTC (rev 35)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeUI.jaxx 2014-04-17 17:27:05 UTC (rev 36)
@@ -27,8 +27,9 @@
com.franciaflex.faxtomail.ui.swing.util.FaxToMailUI
com.franciaflex.faxtomail.ui.swing.util.FaxToMailUIUtil
com.franciaflex.faxtomail.ui.swing.content.attachment.ButtonAttachment
- com.franciaflex.faxtomail.ui.swing.content.history.ButtonHistory
- com.franciaflex.faxtomail.ui.swing.content.demandgroup.ButtonEmailGroup
+ com.franciaflex.faxtomail.ui.swing.content.demande.history.ButtonHistory
+ com.franciaflex.faxtomail.ui.swing.content.demande.demandgroup.ButtonEmailGroup
+ com.franciaflex.faxtomail.ui.swing.content.demande.replies.ButtonDemandReplies
com.franciaflex.faxtomail.persistence.entities.Email
com.franciaflex.faxtomail.persistence.entities.DemandType
@@ -71,6 +72,7 @@
</BeanValidator>
<JToolBar id='topToolBar'>
+ <ButtonDemandReplies id="demandRepliesButton"/>
<ButtonEmailGroup id="demandGroupButton"/>
<ButtonHistory id="historyButton"/>
<ButtonAttachment id="attachmentsButton"
@@ -103,11 +105,11 @@
</row>
<row>
<cell>
- <JLabel id='objectLabel'/>
+ <JLabel id='subjectLabel'/>
</cell>
<cell weightx='1' columns="3">
- <JTextField id='objectField'
- onKeyReleased='handler.setText(event, "object")'/>
+ <JTextField id='subjectField'
+ onKeyReleased='handler.setText(event, "subject")'/>
</cell>
</row>
<row>
@@ -301,7 +303,8 @@
constraints="BorderLayout.NORTH"/>
<JScrollPane id='messagePane'
constraints="BorderLayout.CENTER">
- <JEditorPane id='messageField'/>
+ <JEditorPane id='messageField'
+ onKeyReleased='handler.setText(event, "message")'/>
</JScrollPane>
</JPanel>
</JSplitPane>
Modified: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeUIHandler.java
===================================================================
--- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeUIHandler.java 2014-04-14 16:33:11 UTC (rev 35)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeUIHandler.java 2014-04-17 17:27:05 UTC (rev 36)
@@ -141,36 +141,8 @@
initBeanFilterableComboBox(ui.getEtatAttenteComboBox(), etatAttentes, model.getEtatAttente());
JTextPane editor = ui.getMailBodyField();
- String content = model.getContent();
+ FaxToMailUIUtil.setEmailContentInTextPane(editor, model);
- if (model.getContentType() != null) {
- editor.setContentType(model.getContentType());
-
- if (model.getContentType().contains("text/html")) {
- HTMLEditorKit htmlEditorKit = new HTMLEditorKit();
- editor.setEditorKit(htmlEditorKit);
- editor.addHyperlinkListener(new HyperlinkListener() {
- @Override
- public void hyperlinkUpdate(HyperlinkEvent e) {
- if (e.getEventType() == HyperlinkEvent.EventType.ACTIVATED) {
- FaxToMailUIUtil.openLink(e.getURL());
- }
- }
- });
-
- for (Attachment attachment : model.getAttachment()) {
- File file = attachment.getOriginalFile();
- log.info("file " + file.getName());
- String key = file.getName();
- // the meta tag makes the content is not displayed
- content = content.replaceAll("<meta (.*?)>(</meta>)?", "");
- // replace the inline attachments with the extracted attachment file url
- content = content.replaceAll("<img src=\"cid:" + key + "\"(.*?>)", "<img src=\"file://" + file.getAbsolutePath() + "\"$1");
- }
- }
- }
- editor.setText(content);
-
// init table
final JXTable table = ui.getRangeTable();
@@ -376,7 +348,7 @@
@Override
protected JComponent getComponentToFocus() {
- return getUI().getObjectField();
+ return getUI().getSubjectField();
}
@Override
@@ -385,6 +357,7 @@
result.add(DemandeUIModel.PROPERTY_EDITABLE);
result.add(Email.PROPERTY_HISTORY);
result.add(DemandeUIModel.PROPERTY_GROUPED_DEMANDES);
+ result.add(Email.PROPERTY_REPLIES);
return result;
}
@@ -394,6 +367,10 @@
log.debug("closing: " + ui);
}
clearValidators();
+ closeButtonPopups();
+ }
+
+ protected void closeButtonPopups() {
ui.getAttachmentsButton().setSelected(false);
ui.getHistoryButton().setSelected(false);
ui.getGroupButton().setSelected(false);
@@ -424,6 +401,7 @@
}
return result;
}
+
public BeanMonitor getMonitor() {
return monitor;
}
@@ -433,11 +411,17 @@
}
public void transmitDemande() {
+ closeButtonPopups();
+ saveBeforeAction();
+
MailFolderChooserUI dialogContent = new MailFolderChooserUI(ui, getModel());
openDialog(dialogContent, t("faxtomail.chooseMailFolder.title"), new Dimension(350, 500));
}
public void print() {
+ closeButtonPopups();
+ saveBeforeAction();
+
for (Attachment attachment : getModel().getAttachment()) {
// try {
File editedFile = attachment.getEditedFile();
@@ -457,25 +441,31 @@
}
public void reply() {
+ closeButtonPopups();
+ saveBeforeAction();
+
ReplyFormUI dialogContent = new ReplyFormUI(ui);
ReplyFormUIModel model = dialogContent.getModel();
- String client = getModel().getClientCode();
- model.setObject(client == null ? null : client);
model.setTo(getModel().getSender());
- openFrame(dialogContent, t("faxtomail.reply.title", getModel().getObject()), new Dimension(800, 600));
+ openFrame(dialogContent, t("faxtomail.reply.title", getModel().getSubject()), new Dimension(800, 600));
}
public void group() {
- ui.getGroupButton().setSelected(false);
+ closeButtonPopups();
+ saveBeforeAction();
+ SearchToGroupUI dialogContent = new SearchToGroupUI(ui);
+ openFrame(dialogContent, t("faxtomail.searchToGroup.title", getModel().getSubject()), getContext().getMainUI().getSize());
+ }
+
+ protected void saveBeforeAction() {
+ if (getModel().getTakenBy() == null) {
+ getModel().setTakenBy(getContext().getCurrentUser());
+ }
+
if (getMonitor().wasModified()) {
getContext().getActionFactory().createUIAction(this, SaveDemandeAction.class).actionPerformed(null);
- getModel().setModify(false);
- getMonitor().clearModified();
}
-
- SearchToGroupUI dialogContent = new SearchToGroupUI(ui);
- openFrame(dialogContent, t("faxtomail.searchToGroup.title", getModel().getObject()), getContext().getMainUI().getSize());
}
}
Modified: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeUIModel.java
===================================================================
--- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeUIModel.java 2014-04-14 16:33:11 UTC (rev 35)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeUIModel.java 2014-04-17 17:27:05 UTC (rev 36)
@@ -36,6 +36,7 @@
import com.franciaflex.faxtomail.persistence.entities.MailFolder;
import com.franciaflex.faxtomail.persistence.entities.Priority;
import com.franciaflex.faxtomail.persistence.entities.RangeRow;
+import com.franciaflex.faxtomail.persistence.entities.Reply;
import com.franciaflex.faxtomail.ui.swing.util.AbstractFaxToMailBeanUIModel;
import com.franciaflex.faxtomail.ui.swing.content.attachment.AttachmentModelAware;
import org.apache.commons.logging.Log;
@@ -179,34 +180,34 @@
return editObject.getRecipient();
}
- public void setObject(String object) {
- Object oldValue = getObject();
- editObject.setObject(object);
- firePropertyChanged(Email.PROPERTY_OBJECT, oldValue, object);
+ public void setSubject(String object) {
+ Object oldValue = getSubject();
+ editObject.setSubject(object);
+ firePropertyChanged(Email.PROPERTY_SUBJECT, oldValue, object);
}
- public String getObject() {
- return editObject.getObject();
+ public String getSubject() {
+ return editObject.getSubject();
}
- public String getContent() {
- return editObject.getContent();
+ public String getPlainContent() {
+ return editObject.getPlainContent();
}
- public void setContent(String content) {
- Object oldValue = getContent();
- editObject.setContent(content);
- firePropertyChanged(Email.PROPERTY_CONTENT, oldValue, content);
+ public void setPlainContent(String content) {
+ Object oldValue = getPlainContent();
+ editObject.setPlainContent(content);
+ firePropertyChanged(Email.PROPERTY_PLAIN_CONTENT, oldValue, content);
}
- public String getContentType() {
- return editObject.getContentType();
+ public String getHtmlContent() {
+ return editObject.getHtmlContent();
}
- public void setContentType(String contentType) {
- Object oldValue = getContentType();
- editObject.setContentType(contentType);
- firePropertyChanged(Email.PROPERTY_CONTENT_TYPE, oldValue, contentType);
+ public void setHtmlContent(String content) {
+ Object oldValue = getHtmlContent();
+ editObject.setHtmlContent(content);
+ firePropertyChanged(Email.PROPERTY_HTML_CONTENT, oldValue, content);
}
public void setClientCode(String clientCode) {
@@ -621,6 +622,32 @@
return groupedDemandes.size();
}
+ public void addReplies(Reply reply) {
+ Object oldValue = null;
+ if (getReplies() != null) {
+ oldValue = new ArrayList<Reply>(getReplies());
+ }
+ editObject.addReplies(reply);
+ firePropertyChange(Email.PROPERTY_REPLIES, null, getReplies());
+ }
+
+ public void setReplies(Collection<Reply> replies) {
+ Object oldValue = null;
+ if (getReplies() != null) {
+ oldValue = new ArrayList<Reply>(getReplies());
+ }
+ editObject.setReplies(replies);
+ firePropertyChange(Email.PROPERTY_REPLIES, null, getReplies());
+ }
+
+ public Collection<Reply> getReplies() {
+ return editObject.getReplies();
+ }
+
+ public int sizeReplies() {
+ return editObject.sizeReplies();
+ }
+
@Override
protected Email newEntity() {
return new EmailImpl();
Modified: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/demandgroup/ButtonEmailGroup.java
===================================================================
--- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demandgroup/ButtonEmailGroup.java 2014-04-10 12:18:23 UTC (rev 32)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/demandgroup/ButtonEmailGroup.java 2014-04-17 17:27:05 UTC (rev 36)
@@ -1,10 +1,7 @@
-package com.franciaflex.faxtomail.ui.swing.content.demandgroup;
+package com.franciaflex.faxtomail.ui.swing.content.demande.demandgroup;
-import com.franciaflex.faxtomail.persistence.entities.Email;
-import com.franciaflex.faxtomail.persistence.entities.History;
import com.franciaflex.faxtomail.ui.swing.FaxToMailUIContext;
import com.franciaflex.faxtomail.ui.swing.content.demande.DemandeUIModel;
-import com.franciaflex.faxtomail.ui.swing.content.history.HistoryListUI;
import com.franciaflex.faxtomail.ui.swing.util.AbstractToolbarPopupButton;
import java.beans.PropertyChangeEvent;
@@ -31,7 +28,8 @@
public void propertyChange(PropertyChangeEvent evt) {
Collection<DemandeUIModel> demands = (Collection<DemandeUIModel>) evt.getNewValue();
if (demands != null) {
- setText(t("faxtomail.demandGroup.text", demands.size()));
+ int size = demands.size();
+ setText(t("faxtomail.demandGroup.text", size));
}
}
});
Modified: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/demandgroup/DemandGroupItem.css
===================================================================
--- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demandgroup/DemandGroupItem.css 2014-04-10 12:18:23 UTC (rev 32)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/demandgroup/DemandGroupItem.css 2014-04-17 17:27:05 UTC (rev 36)
@@ -2,8 +2,8 @@
border: { BorderFactory.createEmptyBorder(2, 3, 2, 3) };
}
-#demandeObjectLabel {
- text: { getDemande().getObject() };
+#demandeSubjectLabel {
+ text: { getDemande().getSubject() };
}
#toolbar {
Modified: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/demandgroup/DemandGroupItem.jaxx
===================================================================
--- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demandgroup/DemandGroupItem.jaxx 2014-04-10 12:18:23 UTC (rev 32)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/demandgroup/DemandGroupItem.jaxx 2014-04-17 17:27:05 UTC (rev 36)
@@ -8,7 +8,8 @@
<DemandeUIModel id='demande' javaBean='null'/>
- <DemandGroupUIHandler id='handler' javaBean='null'/>
+ <DemandGroupUIHandler id='handler'
+ initializer='getContextValue(DemandGroupUIHandler.class)'/>
<script><![CDATA[
public DemandGroupItem(DemandGroupUIHandler handler) {
@@ -16,7 +17,7 @@
}
]]></script>
- <JLabel id='demandeObjectLabel' constraints='BorderLayout.CENTER'/>
+ <JLabel id='demandeSubjectLabel' constraints='BorderLayout.CENTER'/>
<JToolBar id='toolbar' constraints='BorderLayout.EAST'>
<JButton id='openDemandeButton'
Modified: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/demandgroup/DemandGroupUI.css
===================================================================
--- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demandgroup/DemandGroupUI.css 2014-04-10 12:18:23 UTC (rev 32)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/demandgroup/DemandGroupUI.css 2014-04-17 17:27:05 UTC (rev 36)
@@ -6,6 +6,14 @@
title: "faxtomail.demandGroup.title";
}
+#noGroupedDemandLabel {
+ text: "faxtomail.demandGroup.empty";
+ visible: { model.getGroupedDemandes().isEmpty() };
+ border: { javax.swing.BorderFactory.createEmptyBorder(3, 3, 3, 3) };
+ font-style: italic;
+}
+
#demandGroup {
editable: true;
-}
\ No newline at end of file
+ visible: { !model.getGroupedDemandes().isEmpty() };
+}
Modified: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/demandgroup/DemandGroupUI.jaxx
===================================================================
--- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demandgroup/DemandGroupUI.jaxx 2014-04-10 12:18:23 UTC (rev 32)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/demandgroup/DemandGroupUI.jaxx 2014-04-17 17:27:05 UTC (rev 36)
@@ -15,6 +15,7 @@
<JXTitledPanel id='body'>
<JScrollPane id='demandGroupBodyScrollPane'>
<JPanel id='mainPanel' layout="{new BorderLayout()}">
+ <JLabel id='noGroupedDemandLabel' constraints="BorderLayout.NORTH"/>
<JXTable id='demandGroup' constraints="BorderLayout.CENTER"/>
</JPanel>
</JScrollPane>
Modified: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/demandgroup/DemandGroupUIHandler.java
===================================================================
--- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demandgroup/DemandGroupUIHandler.java 2014-04-10 12:18:23 UTC (rev 32)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/demandgroup/DemandGroupUIHandler.java 2014-04-17 17:27:05 UTC (rev 36)
@@ -1,19 +1,13 @@
-package com.franciaflex.faxtomail.ui.swing.content.demandgroup;
+package com.franciaflex.faxtomail.ui.swing.content.demande.demandgroup;
-import com.franciaflex.faxtomail.persistence.entities.Attachment;
import com.franciaflex.faxtomail.ui.swing.FaxToMailUIContext;
import com.franciaflex.faxtomail.ui.swing.actions.ShowDemandeAction;
-import com.franciaflex.faxtomail.ui.swing.content.attachment.AttachmentItem;
import com.franciaflex.faxtomail.ui.swing.content.demande.DemandeUIModel;
import com.franciaflex.faxtomail.ui.swing.util.AbstractToolbarPopupHandler;
import com.google.common.collect.Iterables;
-import jaxx.runtime.SwingUtil;
-import jaxx.runtime.swing.model.JaxxDefaultListModel;
import jaxx.runtime.validator.swing.SwingValidator;
-import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import org.jdesktop.swingx.JXList;
import org.jdesktop.swingx.JXTable;
import org.jdesktop.swingx.decorator.HighlighterFactory;
@@ -22,7 +16,6 @@
import javax.swing.event.TableModelListener;
import javax.swing.table.AbstractTableModel;
import javax.swing.table.DefaultTableColumnModel;
-import javax.swing.table.DefaultTableModel;
import javax.swing.table.TableCellEditor;
import javax.swing.table.TableCellRenderer;
import javax.swing.table.TableColumn;
@@ -31,7 +24,6 @@
import java.awt.*;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
-import java.util.Collection;
/**
* @author Kevin Morin (Code Lutin)
@@ -149,8 +141,7 @@
protected DemandGroupItem demandGroupItem;
public DemandGroupItemEditor() {
- demandGroupItem = new DemandGroupItem();
- demandGroupItem.setHandler(DemandGroupUIHandler.this);
+ demandGroupItem = new DemandGroupItem(DemandGroupUIHandler.this);
}
public Component getTableCellEditorComponent(JTable table, Object value,
Modified: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/history/ButtonHistory.java
===================================================================
--- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/history/ButtonHistory.java 2014-04-10 12:18:23 UTC (rev 32)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/history/ButtonHistory.java 2014-04-17 17:27:05 UTC (rev 36)
@@ -1,10 +1,9 @@
-package com.franciaflex.faxtomail.ui.swing.content.history;
+package com.franciaflex.faxtomail.ui.swing.content.demande.history;
import com.franciaflex.faxtomail.persistence.entities.Email;
import com.franciaflex.faxtomail.persistence.entities.History;
import com.franciaflex.faxtomail.ui.swing.FaxToMailUIContext;
import com.franciaflex.faxtomail.ui.swing.util.AbstractToolbarPopupButton;
-import com.franciaflex.faxtomail.ui.swing.content.attachment.AttachmentEditorUI;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
Modified: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/history/HistoryItemModel.java
===================================================================
--- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/history/HistoryItemModel.java 2014-04-10 12:18:23 UTC (rev 32)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/history/HistoryItemModel.java 2014-04-17 17:27:05 UTC (rev 36)
@@ -1,4 +1,4 @@
-package com.franciaflex.faxtomail.ui.swing.content.history;
+package com.franciaflex.faxtomail.ui.swing.content.demande.history;
import com.franciaflex.faxtomail.persistence.entities.FaxToMailUser;
import com.franciaflex.faxtomail.persistence.entities.History;
Modified: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/history/HistoryListUIHandler.java
===================================================================
--- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/history/HistoryListUIHandler.java 2014-04-10 12:18:23 UTC (rev 32)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/history/HistoryListUIHandler.java 2014-04-17 17:27:05 UTC (rev 36)
@@ -1,4 +1,4 @@
-package com.franciaflex.faxtomail.ui.swing.content.history;
+package com.franciaflex.faxtomail.ui.swing.content.demande.history;
import com.franciaflex.faxtomail.persistence.entities.Email;
import com.franciaflex.faxtomail.persistence.entities.History;
@@ -39,7 +39,7 @@
n("faxtomail.demande.sender.label");
n("faxtomail.demande.fax.label");
n("faxtomail.demande.recipient.label");
- n("faxtomail.demande.object.label");
+ n("faxtomail.demande.subject.label");
n("faxtomail.demande.clientCode.label");
n("faxtomail.demande.mailFolder.label");
n("faxtomail.demande.attachment.label");
Copied: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/replies/ButtonDemandReplies.java (from rev 32, trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demandgroup/ButtonEmailGroup.java)
===================================================================
--- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/replies/ButtonDemandReplies.java (rev 0)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/replies/ButtonDemandReplies.java 2014-04-17 17:27:05 UTC (rev 36)
@@ -0,0 +1,50 @@
+package com.franciaflex.faxtomail.ui.swing.content.demande.replies;
+
+import com.franciaflex.faxtomail.persistence.entities.Email;
+import com.franciaflex.faxtomail.ui.swing.FaxToMailUIContext;
+import com.franciaflex.faxtomail.ui.swing.content.demande.DemandeUIModel;
+import com.franciaflex.faxtomail.ui.swing.content.demande.demandgroup.DemandGroupUI;
+import com.franciaflex.faxtomail.ui.swing.util.AbstractToolbarPopupButton;
+
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
+import java.util.Collection;
+
+import static org.nuiton.i18n.I18n.t;
+
+/**
+ * Button to edit attachments.
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 1.1
+ */
+public class ButtonDemandReplies extends AbstractToolbarPopupButton<DemandRepliesUI> {
+
+ public ButtonDemandReplies() {
+ setToolTipText(t("faxtomail.demandReplies.action.tip"));
+ int replyNb = popup.getModel().sizeReplies();
+ setText(t("faxtomail.demandReplies.text", replyNb));
+
+ popup.getModel().addPropertyChangeListener(Email.PROPERTY_REPLIES, new PropertyChangeListener() {
+ @Override
+ public void propertyChange(PropertyChangeEvent evt) {
+ Collection<String> replies = (Collection<String>) evt.getNewValue();
+ if (replies != null) {
+ int size = replies.size();
+ setText(t("faxtomail.demandReplies.text", size));
+ }
+ }
+ });
+ }
+
+ @Override
+ protected String getActionIcon() {
+ return "reply";
+ }
+
+ @Override
+ protected DemandRepliesUI createNewPopup() {
+ return new DemandRepliesUI(FaxToMailUIContext.getApplicationContext());
+ }
+
+}
Copied: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/replies/DemandRepliesUI.css (from rev 32, trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demandgroup/DemandGroupUI.css)
===================================================================
--- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/replies/DemandRepliesUI.css (rev 0)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/replies/DemandRepliesUI.css 2014-04-17 17:27:05 UTC (rev 36)
@@ -0,0 +1,19 @@
+#repliesDialog {
+ minimumSize: { new java.awt.Dimension(500, 0) };
+}
+
+#body {
+ title: "faxtomail.demandReplies.title";
+}
+
+#noReplyLabel {
+ text: "faxtomail.demandReplies.empty";
+ visible: { model.getReplies().isEmpty() };
+ border: { javax.swing.BorderFactory.createEmptyBorder(3, 3, 3, 3) };
+ font-style: italic;
+}
+
+#replies {
+ editable: true;
+ visible: { !model.getReplies().isEmpty() };
+}
Copied: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/replies/DemandRepliesUI.jaxx (from rev 32, trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demandgroup/DemandGroupUI.jaxx)
===================================================================
--- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/replies/DemandRepliesUI.jaxx (rev 0)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/replies/DemandRepliesUI.jaxx 2014-04-17 17:27:05 UTC (rev 36)
@@ -0,0 +1,24 @@
+<com.franciaflex.faxtomail.ui.swing.util.AbstractToolbarPopupUI
+ superGenericType="com.franciaflex.faxtomail.ui.swing.content.demande.DemandeUIModel, DemandRepliesUIHandler"
+ id='repliesDialog'>
+
+ <import>
+ com.franciaflex.faxtomail.ui.swing.content.demande.DemandeUIModel
+
+ org.jdesktop.swingx.JXTable
+ org.jdesktop.swingx.JXTitledPanel
+ </import>
+
+ <DemandeUIModel id='model'
+ initializer='getContextValue(DemandeUIModel.class)'/>
+
+ <JXTitledPanel id='body'>
+ <JScrollPane id='demandRepliesBodyScrollPane'>
+ <JPanel id='mainPanel' layout="{new BorderLayout()}">
+ <JLabel id='noReplyLabel' constraints="BorderLayout.NORTH"/>
+ <JXTable id='replies' constraints="BorderLayout.CENTER"/>
+ </JPanel>
+ </JScrollPane>
+ </JXTitledPanel>
+
+</com.franciaflex.faxtomail.ui.swing.util.AbstractToolbarPopupUI>
\ No newline at end of file
Copied: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/replies/DemandRepliesUIHandler.java (from rev 32, trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demandgroup/DemandGroupUIHandler.java)
===================================================================
--- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/replies/DemandRepliesUIHandler.java (rev 0)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/replies/DemandRepliesUIHandler.java 2014-04-17 17:27:05 UTC (rev 36)
@@ -0,0 +1,168 @@
+package com.franciaflex.faxtomail.ui.swing.content.demande.replies;
+
+import com.franciaflex.faxtomail.persistence.entities.Email;
+import com.franciaflex.faxtomail.persistence.entities.Reply;
+import com.franciaflex.faxtomail.ui.swing.content.demande.DemandeUIModel;
+import com.franciaflex.faxtomail.ui.swing.util.AbstractToolbarPopupHandler;
+import com.google.common.collect.Iterables;
+import jaxx.runtime.validator.swing.SwingValidator;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.jdesktop.swingx.JXTable;
+import org.jdesktop.swingx.decorator.HighlighterFactory;
+
+import javax.swing.*;
+import javax.swing.event.TableModelEvent;
+import javax.swing.event.TableModelListener;
+import javax.swing.table.AbstractTableModel;
+import javax.swing.table.DefaultTableColumnModel;
+import javax.swing.table.TableCellEditor;
+import javax.swing.table.TableCellRenderer;
+import javax.swing.table.TableColumn;
+import javax.swing.table.TableColumnModel;
+import javax.swing.table.TableModel;
+import java.awt.*;
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
+
+/**
+ * @author Kevin Morin (Code Lutin)
+ * @since x.x
+ */
+public class DemandRepliesUIHandler extends AbstractToolbarPopupHandler<DemandeUIModel, DemandRepliesUI> {
+
+ private final static Log log = LogFactory.getLog(DemandRepliesUIHandler.class);
+
+ @Override
+ public void beforeInit(DemandRepliesUI ui) {
+ super.beforeInit(ui);
+
+ DemandeUIModel currentEmail = getContext().getCurrentEmail();
+ this.ui.setContextValue(currentEmail);
+ }
+
+ @Override
+ public void afterInit(DemandRepliesUI ui) {
+ super.afterInit(ui);
+
+ initTable(ui.getReplies());
+
+ getModel().addPropertyChangeListener(Email.PROPERTY_REPLIES, new PropertyChangeListener() {
+ @Override
+ public void propertyChange(PropertyChangeEvent evt) {
+ AbstractTableModel tableModel = (AbstractTableModel) getUI().getReplies().getModel();
+ tableModel.fireTableDataChanged();
+ }
+ });
+ }
+
+ protected void initTable(JXTable table) {
+
+ TableModel demandRepliesTableModel = new AbstractTableModel() {
+ @Override
+ public int getRowCount() {
+ return getModel().sizeReplies();
+ }
+
+ @Override
+ public int getColumnCount() {
+ return 1;
+ }
+
+ @Override
+ public Object getValueAt(int rowIndex, int columnIndex) {
+ return Iterables.get(getModel().getReplies(), rowIndex);
+ }
+
+ @Override
+ public boolean isCellEditable(int rowIndex, int columnIndex) {
+ return true;
+ }
+ };
+
+ demandRepliesTableModel.addTableModelListener(new TableModelListener() {
+ @Override
+ public void tableChanged(TableModelEvent e) {
+ getUI().pack();
+ }
+ });
+
+ TableColumnModel columnModel = new DefaultTableColumnModel();
+ TableColumn column = new TableColumn();
+ column.setCellRenderer(new DemandReplyItemRenderer());
+ column.setCellEditor(new DemandReplyItemEditor());
+ columnModel.addColumn(column);
+
+ table.setModel(demandRepliesTableModel);
+ table.setColumnModel(columnModel);
+ table.addHighlighter(HighlighterFactory.createAlternateStriping());
+ }
+
+ @Override
+ public void onCloseUI() {
+ }
+
+ @Override
+ public SwingValidator<DemandeUIModel> getValidator() {
+ return null;
+ }
+
+ @Override
+ protected JComponent getComponentToFocus() {
+ return null;
+ }
+
+ public void openReply(Reply reply) {
+ closeEditor();
+
+// FaxToMailUIContext context = getContext();
+// context.setCurrentEmail(demande);
+// context.getActionEngine().runAction(new ShowDemandeAction(context.getMainUI().getHandler()));
+ }
+
+ protected class DemandReplyItemRenderer extends DemandReplyItem
+ implements TableCellRenderer {
+
+ public DemandReplyItemRenderer() {
+ super(DemandRepliesUIHandler.this);
+ }
+
+ @Override
+ public Component getTableCellRendererComponent(JTable table, Object value,
+ boolean isSelected, boolean hasFocus, int row, int column) {
+ Reply reply = (Reply) value;
+ setReply(reply);
+ return this;
+ }
+ }
+
+ protected class DemandReplyItemEditor extends AbstractCellEditor implements TableCellEditor {
+
+ protected DemandReplyItem demandReplyItem;
+
+ public DemandReplyItemEditor() {
+ demandReplyItem = new DemandReplyItem(DemandRepliesUIHandler.this);
+ }
+
+ public Component getTableCellEditorComponent(JTable table, Object value,
+ boolean isSelected, int row, int column) {
+ Reply reply = (Reply) value;
+ demandReplyItem.setReply(reply);
+
+ return demandReplyItem;
+ }
+
+ @Override
+ public Object getCellEditorValue() {
+ return demandReplyItem.getReply();
+ }
+
+ public boolean stopCellEditing() {
+ return super.stopCellEditing();
+ }
+
+ protected void fireEditingStopped() {
+ super.fireEditingStopped();
+ }
+ }
+}
Copied: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/replies/DemandReplyItem.css (from rev 32, trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demandgroup/DemandGroupItem.css)
===================================================================
--- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/replies/DemandReplyItem.css (rev 0)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/replies/DemandReplyItem.css 2014-04-17 17:27:05 UTC (rev 36)
@@ -0,0 +1,22 @@
+#replyPanel {
+ border: { BorderFactory.createEmptyBorder(2, 3, 2, 3) };
+}
+
+#replyDateLabel {
+ text: { getHandler().decorate(getReply().getSentDate()) + " - " };
+ font-style: italic;
+}
+
+#replySubjectLabel {
+ text: { getReply().getSubject() };
+}
+
+#toolbar {
+ borderPainted: false;
+ floatable: false;
+}
+
+#openReplyButton {
+ actionIcon: "open-file";
+ toolTipText: "faxtomail.demandReplies.action.open.tip";
+}
\ No newline at end of file
Copied: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/replies/DemandReplyItem.jaxx (from rev 32, trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demandgroup/DemandGroupItem.jaxx)
===================================================================
--- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/replies/DemandReplyItem.jaxx (rev 0)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/replies/DemandReplyItem.jaxx 2014-04-17 17:27:05 UTC (rev 36)
@@ -0,0 +1,30 @@
+<JPanel id='replyPanel' layout='{new BorderLayout()}'>
+
+ <import>
+ com.franciaflex.faxtomail.persistence.entities.Reply
+ com.franciaflex.faxtomail.ui.swing.content.demande.DemandeUIModel
+ static org.nuiton.i18n.I18n.t
+ static jaxx.runtime.JAXXUtil.getStringValue
+ </import>
+
+ <Reply id='reply' javaBean='null'/>
+
+ <DemandRepliesUIHandler id='handler'
+ initializer='getContextValue(DemandRepliesUIHandler.class)'/>
+
+ <script><![CDATA[
+public DemandReplyItem(DemandRepliesUIHandler handler) {
+ setContextValue(handler);
+}
+ ]]></script>
+
+ <JLabel id='replyDateLabel' constraints='BorderLayout.WEST'/>
+
+ <JLabel id='replySubjectLabel' constraints='BorderLayout.CENTER'/>
+
+ <JToolBar id='toolbar' constraints='BorderLayout.EAST'>
+ <JButton id='openReplyButton'
+ onActionPerformed='handler.openReply(reply)'/>
+ </JToolBar>
+
+</JPanel>
\ No newline at end of file
Added: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/reply/AttachmentItem.css
===================================================================
--- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/reply/AttachmentItem.css (rev 0)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/reply/AttachmentItem.css 2014-04-17 17:27:05 UTC (rev 36)
@@ -0,0 +1,16 @@
+#attachmentPanel {
+ border: { BorderFactory.createLineBorder(Color.LIGHT_GRAY) };
+}
+
+#attachmentNameLabel {
+ text: { attachment != null ? getAttachment().getName() : null };
+ border: { BorderFactory.createEmptyBorder(3, 3, 3, 3) };
+}
+
+#openAttachmentButton {
+ actionIcon: "cross";
+ opaque: false;
+ border: { BorderFactory.createEmptyBorder(3, 3, 3, 3) };
+ borderPainted: false;
+ contentAreaFilled: false;
+}
\ No newline at end of file
Added: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/reply/AttachmentItem.jaxx
===================================================================
--- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/reply/AttachmentItem.jaxx (rev 0)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/reply/AttachmentItem.jaxx 2014-04-17 17:27:05 UTC (rev 36)
@@ -0,0 +1,24 @@
+<JPanel id='attachmentPanel' layout='{new BorderLayout()}'>
+
+ <import>
+ com.franciaflex.faxtomail.persistence.entities.Attachment
+
+ java.awt.Color
+ java.io.File
+ javax.swing.BorderFactory
+
+ static org.nuiton.i18n.I18n.t
+ static jaxx.runtime.JAXXUtil.getStringValue
+ </import>
+
+ <File id='attachment' javaBean='null'/>
+
+ <ReplyFormUIHandler id='handler' javaBean='null'/>
+
+ <JLabel id='attachmentNameLabel' constraints='BorderLayout.CENTER'/>
+
+ <JButton id='openAttachmentButton'
+ constraints='BorderLayout.EAST'
+ onActionPerformed='handler.removeAttachment(this)'/>
+
+</JPanel>
\ No newline at end of file
Modified: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/reply/ReplyFormUI.css
===================================================================
--- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/reply/ReplyFormUI.css 2014-04-14 16:33:11 UTC (rev 35)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/reply/ReplyFormUI.css 2014-04-17 17:27:05 UTC (rev 36)
@@ -1,31 +1,64 @@
#fromLabel {
- text: "faxtomail.reply.from";
+ text: "faxtomail.reply.label.from";
}
+#fromField {
+ text: { model.getFrom() };
+}
+
+#fromComboBox {
+ editable: true;
+ selectedItem: { model.getFrom() };
+}
+
#toLabel {
- text: "faxtomail.reply.to";
+ text: "faxtomail.reply.label.to";
}
#toField {
- text: {model.getTo()};
+ text: { model.getTo() };
}
-#objectLabel {
- text: "faxtomail.reply.object";
+#subjectLabel {
+ text: "faxtomail.reply.label.subject";
}
#objectField {
- text: {model.getObject()};
+ text: { model.getObject() };
}
-#attachmentCheckbox {
- text: "faxtomail.reply.attachment";
+#splitPane {
+ dividerLocation: 300;
}
-#attachmentButton {
- enabled: {attachmentCheckbox.isSelected()};
+#message {
+ text: { model.getMessage() };
}
+#attachmentsPanel {
+ background: { Color.WHITE };
+}
+
+#attachmentsLabel {
+ text: "faxtomail.attachmentEditor.title";
+}
+
+#addAttachmentLabel {
+ text: "faxtomail.attachmentEditor.field.file";
+}
+
+#addAttachmentFile {
+ editable: true;
+}
+
+#chooseFileButton {
+ actionIcon: "open";
+}
+
+#addAttachmentButton {
+ actionIcon: "add";
+}
+
#cancelButton {
actionIcon: cancel;
text: "faxtomail.reply.action.cancel";
@@ -36,5 +69,5 @@
actionIcon: validate;
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.actions.ReplyAction.class };
}
\ No newline at end of file
Modified: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/reply/ReplyFormUI.jaxx
===================================================================
--- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/reply/ReplyFormUI.jaxx 2014-04-14 16:33:11 UTC (rev 35)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/reply/ReplyFormUI.jaxx 2014-04-17 17:27:05 UTC (rev 36)
@@ -36,6 +36,12 @@
java.text.SimpleDateFormat
java.util.Date
+
+ java.awt.Color
+
+ jaxx.runtime.swing.editor.FileEditor
+
+ org.jdesktop.swingx.WrapLayout
</import>
<script><![CDATA[
@@ -49,14 +55,17 @@
<ReplyFormUIModel id='model'
initializer='getContextValue(ReplyFormUIModel.class)'/>
- <Table constraints='BorderLayout.CENTER'
+ <Table constraints='BorderLayout.NORTH'
fill='both'>
<row>
<cell>
<JLabel id="fromLabel"/>
</cell>
<cell weightx='1'>
- <JTextField id="fromField"/>
+ <!--<JTextField id="fromField"-->
+ <!--onKeyReleased='handler.setText(event, "from")'/>-->
+ <JComboBox id="fromComboBox"
+ onItemStateChanged='handler.setText(event, "from")'/>
</cell>
</row>
<row>
@@ -64,34 +73,58 @@
<JLabel id="toLabel"/>
</cell>
<cell weightx='1'>
- <JTextField id="toField"/>
+ <JTextField id="toField"
+ onKeyReleased='handler.setText(event, "to")'/>
</cell>
</row>
<row>
<cell>
- <JLabel id="objectLabel"/>
+ <JLabel id="subjectLabel"/>
</cell>
<cell weightx='1'>
- <JTextField id="objectField"/>
+ <JTextField id="subjectField"
+ onKeyReleased='handler.setText(event, "subject")'/>
</cell>
</row>
- <row>
- <cell columns='2'>
- <JPanel layout='{new BorderLayout()}'>
- <JCheckBox id="attachmentCheckbox" constraints="BorderLayout.CENTER"/>
- <ButtonAttachment id="attachmentButton"
- constructorParams="model"
- constraints="BorderLayout.EAST"/>
- </JPanel>
- </cell>
- </row>
- <row weighty='1'>
- <cell columns='2'>
- <JEditorPane id="message" />
- </cell>
- </row>
</Table>
+ <JSplitPane id="splitPane"
+ orientation="{JSplitPane.VERTICAL_SPLIT}"
+ constraints='BorderLayout.CENTER'>
+ <JScrollPane>
+ <JEditorPane id="message"
+ onKeyReleased='handler.setText(event, "message")'/>
+ </JScrollPane>
+
+ <JPanel layout='{new BorderLayout()}'>
+ <JLabel id="attachmentsLabel" constraints='BorderLayout.NORTH'/>
+ <JScrollPane id="attachmentsContainer"
+ constraints='BorderLayout.CENTER'>
+ <JPanel id="attachmentsPanel" layout="{new WrapLayout(WrapLayout.LEFT)}"/>
+ </JScrollPane>
+ <Table fill="both"
+ constraints='BorderLayout.SOUTH'>
+ <row>
+ <cell>
+ <JLabel id='addAttachmentLabel'/>
+ </cell>
+ <cell weightx="1">
+ <JComboBox id="addAttachmentFile"/>
+ </cell>
+ <cell>
+ <JButton id='chooseFileButton'
+ onActionPerformed='handler.openLocation()'/>
+ </cell>
+ <cell>
+ <JButton id='addAttachmentButton'
+ onActionPerformed='handler.addAttachment()'/>
+ </cell>
+ </row>
+ </Table>
+
+ </JPanel>
+ </JSplitPane>
+
<JPanel layout='{new GridLayout(1, 0)}' constraints='BorderLayout.SOUTH'>
<JButton id='cancelButton' onActionPerformed='handler.cancel()'/>
<JButton id='validateButton'/>
Modified: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/reply/ReplyFormUIHandler.java
===================================================================
--- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/reply/ReplyFormUIHandler.java 2014-04-14 16:33:11 UTC (rev 35)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/reply/ReplyFormUIHandler.java 2014-04-17 17:27:05 UTC (rev 36)
@@ -1,18 +1,42 @@
package com.franciaflex.faxtomail.ui.swing.content.reply;
+import com.franciaflex.faxtomail.persistence.entities.Attachment;
+import com.franciaflex.faxtomail.persistence.entities.MailFolder;
+import com.franciaflex.faxtomail.ui.swing.content.demande.DemandeUIModel;
import com.franciaflex.faxtomail.ui.swing.util.AbstractFaxToMailUIHandler;
import com.franciaflex.faxtomail.ui.swing.util.Cancelable;
+import com.google.common.collect.Lists;
+import jaxx.runtime.JAXXUtil;
+import jaxx.runtime.swing.editor.FileEditor;
+import jaxx.runtime.swing.renderer.DecoratorListCellRenderer;
import jaxx.runtime.validator.swing.SwingValidator;
+import org.apache.commons.collections4.CollectionUtils;
+import org.apache.commons.io.FileUtils;
+import org.apache.commons.lang3.StringUtils;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
import javax.swing.*;
-import javax.swing.text.html.HTMLEditorKit;
+import javax.swing.plaf.basic.BasicComboBoxEditor;
+import java.awt.*;
+import java.awt.event.ActionListener;
+import java.io.File;
+import java.io.Serializable;
+import java.lang.reflect.Method;
+import java.util.Collection;
+import java.util.List;
+
+import static org.nuiton.i18n.I18n.t;
+
/**
* @author Kevin Morin (Code Lutin)
* @since x.x
*/
public class ReplyFormUIHandler extends AbstractFaxToMailUIHandler<ReplyFormUIModel, ReplyFormUI> implements Cancelable {
+ private static final Log log = LogFactory.getLog(ReplyFormUIHandler.class);
+
@Override
public void beforeInit(ReplyFormUI ui) {
@@ -20,16 +44,60 @@
ReplyFormUIModel model = new ReplyFormUIModel();
+ DemandeUIModel currentEmail = getContext().getCurrentEmail();
+ model.setOriginalDemand(currentEmail);
+
+ for (Attachment attachment : currentEmail.getAttachment()) {
+ File file = attachment.getEditedFile();
+ if (file == null) {
+ file = attachment.getOriginalFile();
+ }
+ model.addAvailableAttachment(file);
+ }
+
+ model.setFrom(currentEmail.getRecipient());
+
+ model.setSubject(t("faxtomail.reply.subject", currentEmail.getSubject()));
+
+ String plainContent = JAXXUtil.getStringValue(currentEmail.getPlainContent());
+ String quotedReply = t("faxtomail.reply.message",
+ decorate(currentEmail.getReceptionDate()),
+ currentEmail.getSender(),
+ plainContent.replaceAll("\n", "\n> "));
+ model.setMessage(quotedReply);
+
this.ui.setContextValue(model);
}
@Override
- public void afterInit(ReplyFormUI replyFormUIModel) {
+ public void afterInit(ReplyFormUI replyFormUI) {
initUI(ui);
JEditorPane editor = ui.getMessage();
- editor.setEditorKitForContentType("text/html", new HTMLEditorKit());
- editor.setContentType("text/html");
+ editor.setCaretPosition(0);
+
+ ReplyFormUIModel model = getModel();
+
+ DemandeUIModel originalDemand = model.getOriginalDemand();
+ MailFolder folder = originalDemand.getMailFolder();
+ Collection<String> folderReplyAdresses;
+ do {
+ folderReplyAdresses = folder.getReplyAdresses();
+ folder = folder.getParent();
+ } while (CollectionUtils.isEmpty(folderReplyAdresses) && folder != null);
+
+ List<String> replyToAddresses = Lists.newArrayList(originalDemand.getRecipient());
+ if (folderReplyAdresses != null) {
+ replyToAddresses.addAll(folderReplyAdresses);
+ }
+
+ ui.getFromComboBox().setModel(newComboModel(replyToAddresses.toArray()));
+
+ JComboBox addAttachmentFile = ui.getAddAttachmentFile();
+ addAttachmentFile.setRenderer(new DecoratorListCellRenderer(getDecorator(File.class, null)));
+ addAttachmentFile.setEditor(new FileComboBoxEditor());
+ addAttachmentFile.setModel(newComboModel(model.getAvailableAttachments().toArray()));
+ addAttachmentFile.setSelectedItem(null);
}
@Override
@@ -48,6 +116,133 @@
@Override
protected JComponent getComponentToFocus() {
- return null;
+ return getUI().getMessage();
}
+
+ public void removeAttachment(AttachmentItem item) {
+ ReplyFormUIModel model = getModel();
+
+ File attachment = item.getAttachment();
+ model.removeAttachment(attachment);
+
+ ui.getAttachmentsPanel().remove(item);
+ ui.getAttachmentsPanel().updateUI();
+
+ model.addAvailableAttachment(attachment);
+ ui.getAddAttachmentFile().addItem(attachment);
+ }
+
+ public void addAttachment() {
+ JComboBox addAttachmentFile = ui.getAddAttachmentFile();
+ File file = (File) addAttachmentFile.getSelectedItem();
+ if (file != null) {
+ ReplyFormUIModel model = getModel();
+ model.addAttachment(file);
+
+ AttachmentItem item = new AttachmentItem();
+ item.setHandler(this);
+ item.setAttachment(file);
+ ui.getAttachmentsPanel().add(item);
+
+ ui.getAttachmentsPanel().updateUI();
+
+ model.removeAvailableAttachment(file);
+ ui.getAddAttachmentFile().removeItem(file);
+
+ addAttachmentFile.setSelectedItem(null);
+ }
+ }
+
+ public void openLocation() {
+ // use last selected file
+ ReplyFormUIModel model = getModel();
+
+ File startFile = model.getLastVisitedDirectory();
+ JFileChooser fc = new JFileChooser(startFile);
+
+// fc.setDialogTitle(view.getTitle());
+
+ // used to enable file selection
+ fc.setFileSelectionMode(JFileChooser.FILES_ONLY);
+
+ int returnVal = fc.showOpenDialog(ui);
+ model.setLastVisitedDirectory(fc.getCurrentDirectory());
+
+ if (returnVal == JFileChooser.APPROVE_OPTION) {
+
+ // get selected to display in ui
+ File file = fc.getSelectedFile();
+
+ ui.getAddAttachmentFile().setSelectedItem(file);
+ }
+ }
+
+ protected class FileComboBoxEditor implements ComboBoxEditor {
+
+ protected File oldValue;
+
+ protected JTextField editorComponent = new JTextField();
+
+ @Override
+ public Component getEditorComponent() {
+ return editorComponent;
+ }
+
+ @Override
+ public void setItem(Object anObject) {
+ String text;
+ File file = (File) anObject;
+
+ if ( anObject != null ) {
+ text = decorate(file);
+ oldValue = file;
+
+ } else {
+ text = "";
+ }
+ if (! text.equals(editorComponent.getText())) {
+ editorComponent.setText(text);
+ }
+ }
+
+ @Override
+ public Object getItem() {
+ Object newValue = editorComponent.getText();
+
+ if (oldValue != null) {
+ // The original value is not a string. Should return the value in it's
+ // original type.
+ if (newValue.equals(decorate(oldValue))) {
+ return oldValue;
+
+ } else {
+ // Must take the value from the editor and get the value and cast it to the new type.
+ Class<?> cls = oldValue.getClass();
+ try {
+ Method method = cls.getMethod("valueOf", new Class[]{String.class});
+ newValue = method.invoke(oldValue, new Object[] { editorComponent.getText()});
+ } catch (Exception ex) {
+ // Fail silently and return the newValue (a String object)
+ }
+ }
+ }
+ return newValue;
+ }
+
+ @Override
+ public void selectAll() {
+ editorComponent.selectAll();
+ editorComponent.requestFocus();
+ }
+
+ @Override
+ public void addActionListener(ActionListener l) {
+ editorComponent.addActionListener(l);
+ }
+
+ @Override
+ public void removeActionListener(ActionListener l) {
+ editorComponent.removeActionListener(l);
+ }
+ }
}
Modified: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/reply/ReplyFormUIModel.java
===================================================================
--- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/reply/ReplyFormUIModel.java 2014-04-14 16:33:11 UTC (rev 35)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/reply/ReplyFormUIModel.java 2014-04-17 17:27:05 UTC (rev 36)
@@ -2,8 +2,11 @@
import com.franciaflex.faxtomail.persistence.entities.Attachment;
import com.franciaflex.faxtomail.ui.swing.content.attachment.AttachmentModelAware;
+import com.franciaflex.faxtomail.ui.swing.content.demande.DemandeUIModel;
+import org.apache.commons.io.FileUtils;
import org.jdesktop.beans.AbstractSerializableBean;
+import java.io.File;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
@@ -12,19 +15,25 @@
* @author Kevin Morin (Code Lutin)
* @since x.x
*/
-public class ReplyFormUIModel extends AbstractSerializableBean implements AttachmentModelAware {
+public class ReplyFormUIModel extends AbstractSerializableBean {
public static final String PROPERTY_TO = "to";
public static final String PROPERTY_FROM = "from";
- public static final String PROPERTY_OBJECT = "object";
+ public static final String PROPERTY_SUBJECT = "subject";
public static final String PROPERTY_MESSAGE = "message";
+ public static final String PROPERTY_ORIGINAL_DEMAND = "originalDemand";
protected String to;
protected String from;
- protected String object;
+ protected String subject;
protected String message;
- protected List<Attachment> attachments = new ArrayList<Attachment>();
+ protected DemandeUIModel originalDemand;
+ protected List<File> attachments = new ArrayList<File>();
+ protected List<File> availableAttachments = new ArrayList<File>();
+
+ protected File lastVisitedDirectory = FileUtils.getUserDirectory();
+
public String getTo() {
return to;
}
@@ -45,14 +54,14 @@
firePropertyChange(PROPERTY_FROM, oldValue, from);
}
- public String getObject() {
- return object;
+ public String getSubject() {
+ return subject;
}
- public void setObject(String object) {
- Object oldValue = getObject();
- this.object = object;
- firePropertyChange(PROPERTY_OBJECT, oldValue, object);
+ public void setSubject(String subject) {
+ Object oldValue = getSubject();
+ this.subject = subject;
+ firePropertyChange(PROPERTY_SUBJECT, oldValue, subject);
}
public String getMessage() {
@@ -65,27 +74,45 @@
firePropertyChange(PROPERTY_MESSAGE, oldValue, message);
}
- @Override
- public Collection<Attachment> getAttachment() {
- return attachments;
+ public DemandeUIModel getOriginalDemand() {
+ return originalDemand;
}
- @Override
- public void addAllAttachment(Collection<Attachment> attachments) {
- this.attachments.addAll(attachments);
- firePropertyChange(AttachmentModelAware.PROPERTY_ATTACHMENT, null, getAttachment());
+ public void setOriginalDemand(DemandeUIModel originalDemand) {
+ Object oldValue = getOriginalDemand();
+ this.originalDemand = originalDemand;
+ firePropertyChange(PROPERTY_ORIGINAL_DEMAND, oldValue, originalDemand);
}
- @Override
- public void addAttachment(Attachment attachment) {
+ public Collection<File> getAttachments() {
+ return attachments;
+ }
+
+ public void addAttachment(File attachment) {
attachments.add(attachment);
- firePropertyChange(AttachmentModelAware.PROPERTY_ATTACHMENT, null, getAttachment());
}
- @Override
- public void removeAttachment(Attachment attachment) {
+ public void removeAttachment(File attachment) {
attachments.remove(attachment);
- firePropertyChange(AttachmentModelAware.PROPERTY_ATTACHMENT, null, getAttachment());
}
+ public List<File> getAvailableAttachments() {
+ return availableAttachments;
+ }
+
+ public void addAvailableAttachment(File attachment) {
+ availableAttachments.add(attachment);
+ }
+
+ public void removeAvailableAttachment(File attachment) {
+ availableAttachments.remove(attachment);
+ }
+
+ public File getLastVisitedDirectory() {
+ return lastVisitedDirectory;
+ }
+
+ public void setLastVisitedDirectory(File lastVisitedDirectory) {
+ this.lastVisitedDirectory = lastVisitedDirectory;
+ }
}
Modified: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/search/SearchToGroupUI.css
===================================================================
--- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/search/SearchToGroupUI.css 2014-04-14 16:33:11 UTC (rev 35)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/search/SearchToGroupUI.css 2014-04-17 17:27:05 UTC (rev 36)
@@ -93,12 +93,12 @@
date: { model.getMaxPrintingDate() };
}
-#objectLabel {
- text: "faxtomail.demande.object.label";
+#subjectLabel {
+ text: "faxtomail.demande.subject.label";
}
-#objectField {
- text: {model.getObject()};
+#subjectField {
+ text: {model.getSubject()};
}
#senderLabel {
Modified: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/search/SearchUI.css
===================================================================
--- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/search/SearchUI.css 2014-04-14 16:33:11 UTC (rev 35)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/search/SearchUI.css 2014-04-17 17:27:05 UTC (rev 36)
@@ -93,12 +93,12 @@
date: { model.getMaxPrintingDate() };
}
-#objectLabel {
- text: "faxtomail.demande.object.label";
+#subjectLabel {
+ text: "faxtomail.demande.subject.label";
}
-#objectField {
- text: {model.getObject()};
+#subjectField {
+ text: {model.getSubject()};
}
#senderLabel {
Modified: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/search/SearchUI.jaxx
===================================================================
--- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/search/SearchUI.jaxx 2014-04-14 16:33:11 UTC (rev 35)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/search/SearchUI.jaxx 2014-04-17 17:27:05 UTC (rev 36)
@@ -156,11 +156,11 @@
<row>
<cell>
- <JLabel id='objectLabel'/>
+ <JLabel id='subjectLabel'/>
</cell>
<cell columns='3' weightx='1'>
- <JTextField id='objectField'
- onKeyReleased='handler.setText(event, "object")'/>
+ <JTextField id='subjectField'
+ onKeyReleased='handler.setText(event, "subject")'/>
</cell>
<cell>
Modified: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/search/SearchUIModel.java
===================================================================
--- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/search/SearchUIModel.java 2014-04-14 16:33:11 UTC (rev 35)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/search/SearchUIModel.java 2014-04-17 17:27:05 UTC (rev 36)
@@ -113,14 +113,14 @@
return editObject.getRecipient();
}
- public void setObject(String object) {
- Object oldValue = getObject();
- editObject.setObject(object);
- firePropertyChanged(Email.PROPERTY_OBJECT, oldValue, object);
+ public void setSubject(String subject) {
+ Object oldValue = getSubject();
+ editObject.setSubject(subject);
+ firePropertyChanged(Email.PROPERTY_SUBJECT, oldValue, subject);
}
- public String getObject() {
- return editObject.getObject();
+ public String getSubject() {
+ return editObject.getSubject();
}
// public void setClientCode(String clientCode) {
Modified: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/AbstractFaxToMailDemandListHandler.java
===================================================================
--- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/AbstractFaxToMailDemandListHandler.java 2014-04-14 16:33:11 UTC (rev 35)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/AbstractFaxToMailDemandListHandler.java 2014-04-17 17:27:05 UTC (rev 36)
@@ -63,7 +63,7 @@
columns = StringUtils.join(new String[]{
Email.PROPERTY_PRIORITY,
Email.PROPERTY_DEMAND_TYPE,
- Email.PROPERTY_OBJECT,
+ Email.PROPERTY_SUBJECT,
DemandeUIModel.PROPERTY_CLIENT_CODE,
DemandeUIModel.PROPERTY_CLIENT_BRAND,
Email.PROPERTY_SENDER,
Modified: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/AbstractFaxToMailUIHandler.java
===================================================================
--- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/AbstractFaxToMailUIHandler.java 2014-04-14 16:33:11 UTC (rev 35)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/AbstractFaxToMailUIHandler.java 2014-04-17 17:27:05 UTC (rev 36)
@@ -37,6 +37,7 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.nuiton.decorator.Decorator;
+import org.nuiton.jaxx.application.ApplicationDataUtil;
import org.nuiton.jaxx.application.swing.AbstractApplicationUIHandler;
import org.nuiton.jaxx.application.swing.ApplicationUI;
import org.nuiton.jaxx.application.swing.action.ApplicationActionUI;
@@ -48,6 +49,7 @@
import javax.swing.event.TableModelListener;
import java.awt.*;
import java.awt.event.ActionEvent;
+import java.awt.event.ItemEvent;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.beans.PropertyChangeEvent;
@@ -126,6 +128,11 @@
return decorate(user);
}
+ public void setText(ItemEvent e, String property) {
+ String value = JAXXUtil.getStringValue(e.getItem());
+ ApplicationDataUtil.setProperty(getModel(), property, value);
+ }
+
//------------------------------------------------------------------------//
//-- Internal methods --//
//------------------------------------------------------------------------//
Modified: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/AbstractToolbarPopupButton.java
===================================================================
--- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/AbstractToolbarPopupButton.java 2014-04-14 16:33:11 UTC (rev 35)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/AbstractToolbarPopupButton.java 2014-04-17 17:27:05 UTC (rev 36)
@@ -33,7 +33,9 @@
public AbstractToolbarPopupButton() {
- setIcon(SwingUtil.createActionIcon(getActionIcon()));
+ ImageIcon actionIcon = SwingUtil.createActionIcon(getActionIcon());
+ setIcon(actionIcon);
+ setDisabledIcon(actionIcon);
popup = createNewPopup();
Modified: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/DemandeTableModel.java
===================================================================
--- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/DemandeTableModel.java 2014-04-14 16:33:11 UTC (rev 35)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/DemandeTableModel.java 2014-04-17 17:27:05 UTC (rev 36)
@@ -53,11 +53,11 @@
n("faxtomail.demandeList.table.header.sender"),
n("faxtomail.demandeList.table.header.sender.tip")));
- put(Email.PROPERTY_OBJECT,
+ put(Email.PROPERTY_SUBJECT,
ColumnIdentifier.<Email>newReadOnlyId(
- Email.PROPERTY_OBJECT,
- n("faxtomail.demandeList.table.header.object"),
- n("faxtomail.demandeList.table.header.object.tip")));
+ Email.PROPERTY_SUBJECT,
+ n("faxtomail.demandeList.table.header.subject"),
+ n("faxtomail.demandeList.table.header.subject.tip")));
put(Email.PROPERTY_RECEPTION_DATE,
ColumnIdentifier.<Email>newReadOnlyId(
Modified: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/FaxToMailUIUtil.java
===================================================================
--- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/FaxToMailUIUtil.java 2014-04-14 16:33:11 UTC (rev 35)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/FaxToMailUIUtil.java 2014-04-17 17:27:05 UTC (rev 36)
@@ -22,6 +22,7 @@
* #L%
*/
+import com.franciaflex.faxtomail.persistence.entities.Attachment;
import com.franciaflex.faxtomail.persistence.entities.MailFolder;
import com.franciaflex.faxtomail.ui.swing.FaxToMailUIContext;
import com.franciaflex.faxtomail.ui.swing.content.demande.DemandeUIModel;
@@ -35,6 +36,9 @@
import org.nuiton.util.FileUtil;
import javax.swing.*;
+import javax.swing.event.HyperlinkEvent;
+import javax.swing.event.HyperlinkListener;
+import javax.swing.text.html.HTMLEditorKit;
import javax.swing.tree.DefaultMutableTreeNode;
import javax.swing.tree.DefaultTreeCellRenderer;
import javax.swing.tree.DefaultTreeModel;
@@ -169,4 +173,37 @@
public static boolean isFileATif(File file) {
return FileUtil.extension(file).toUpperCase().equals("TIF");
}
+
+ public static void setEmailContentInTextPane(JTextPane textPane, DemandeUIModel demandeUIModel) {
+ String content = demandeUIModel.getHtmlContent();
+ if (content != null) {
+ textPane.setContentType("text/html");
+
+ HTMLEditorKit htmlEditorKit = new HTMLEditorKit();
+ textPane.setEditorKit(htmlEditorKit);
+ textPane.addHyperlinkListener(new HyperlinkListener() {
+ @Override
+ public void hyperlinkUpdate(HyperlinkEvent e) {
+ if (e.getEventType() == HyperlinkEvent.EventType.ACTIVATED) {
+ FaxToMailUIUtil.openLink(e.getURL());
+ }
+ }
+ });
+
+ // the meta tag makes the content is not displayed
+ content = content.replaceAll("<meta (.*?)>(</meta>)?", "");
+
+ for (Attachment attachment : demandeUIModel.getAttachment()) {
+ File file = attachment.getOriginalFile();
+ log.info("file " + file.getName());
+ String key = file.getName();
+ // replace the inline attachments with the extracted attachment file url
+ content = content.replaceAll("<img src=\"cid:" + key + "\"(.*?>)", "<img src=\"file://" + file.getAbsolutePath() + "\"$1");
+ }
+
+ } else {
+ content = demandeUIModel.getPlainContent();
+ }
+ textPane.setText(content);
+ }
}
Modified: trunk/faxtomail-ui-swing/src/main/resources/i18n/faxtomail-ui-swing_en_GB.properties
===================================================================
--- trunk/faxtomail-ui-swing/src/main/resources/i18n/faxtomail-ui-swing_en_GB.properties 2014-04-14 16:33:11 UTC (rev 35)
+++ trunk/faxtomail-ui-swing/src/main/resources/i18n/faxtomail-ui-swing_en_GB.properties 2014-04-17 17:27:05 UTC (rev 36)
@@ -36,6 +36,7 @@
faxtomail.attachmentEditor.action.save.mnemonic=
faxtomail.attachmentEditor.action.save.tip=
faxtomail.attachmentEditor.action.tip=
+faxtomail.attachmentEditor.add.label=
faxtomail.attachmentEditor.attachments.empty=
faxtomail.attachmentEditor.deleteAttachment.message=
faxtomail.attachmentEditor.deleteAttachment.title=
@@ -108,8 +109,14 @@
faxtomail.demand.alreadyTakenBy=
faxtomail.demand.group.successful=
faxtomail.demandGroup.action.tip=
+faxtomail.demandGroup.empty=
faxtomail.demandGroup.text=
faxtomail.demandGroup.title=
+faxtomail.demandReplies.action.open.tip=
+faxtomail.demandReplies.action.tip=
+faxtomail.demandReplies.empty=
+faxtomail.demandReplies.text=
+faxtomail.demandReplies.title=
faxtomail.demande.alreadyTakenBy=
faxtomail.demande.archive.button.label=
faxtomail.demande.archive.button.mnemonic=
@@ -169,6 +176,7 @@
faxtomail.demande.sender.manualCreation=
faxtomail.demande.sender.manual_creation=
faxtomail.demande.status.label=
+faxtomail.demande.subject.label=
faxtomail.demande.takenBy.label=
faxtomail.demande.tcc.label=
faxtomail.demande.title=
@@ -236,6 +244,8 @@
faxtomail.demandeList.table.header.senderEmail.tip=
faxtomail.demandeList.table.header.status=
faxtomail.demandeList.table.header.status.tip=
+faxtomail.demandeList.table.header.subject=
+faxtomail.demandeList.table.header.subject.tip=
faxtomail.demandeList.table.header.type=
faxtomail.demandeList.table.header.type.tip=
faxtomail.demandeList.table.header.user=
@@ -310,7 +320,14 @@
faxtomail.reply.action.validate.tip=
faxtomail.reply.attachment=
faxtomail.reply.from=
+faxtomail.reply.label.attachment=
+faxtomail.reply.label.from=
+faxtomail.reply.label.object=
+faxtomail.reply.label.subject=
+faxtomail.reply.label.to=
+faxtomail.reply.message=
faxtomail.reply.object=
+faxtomail.reply.subject=
faxtomail.reply.title=
faxtomail.reply.to=
faxtomail.save.button.label=
Modified: trunk/faxtomail-ui-swing/src/main/resources/i18n/faxtomail-ui-swing_fr_FR.properties
===================================================================
--- trunk/faxtomail-ui-swing/src/main/resources/i18n/faxtomail-ui-swing_fr_FR.properties 2014-04-14 16:33:11 UTC (rev 35)
+++ trunk/faxtomail-ui-swing/src/main/resources/i18n/faxtomail-ui-swing_fr_FR.properties 2014-04-17 17:27:05 UTC (rev 36)
@@ -25,7 +25,7 @@
faxtomail.attachmentEditor.deleteAttachment.title=Suppression de pièce-jointe
faxtomail.attachmentEditor.field.file=Fichier
faxtomail.attachmentEditor.fileNotFound=Le fichier %s de la pièce jointe n'a pas été trouvé
-faxtomail.attachmentEditor.none.tip=Pas de pièce-jointes
+faxtomail.attachmentEditor.none.tip=Aucune pièce-jointe
faxtomail.attachmentEditor.saveAttachment.button=Enregistrer
faxtomail.attachmentEditor.saveAttachment.error.message=Erreur lors de l'enregistrement de la pièce jointe %1s dans le fichier %2s
faxtomail.attachmentEditor.saveAttachment.success.message=Le fichier %s a été sauvegardé sur votre machine
@@ -42,8 +42,14 @@
faxtomail.config.application=
faxtomail.config.title=
faxtomail.demandGroup.action.tip=Éléments groupés avec l'élément courant
+faxtomail.demandGroup.empty=Aucune demande groupée
faxtomail.demandGroup.text=Groupe (%s)
faxtomail.demandGroup.title=Groupe
+faxtomail.demandReplies.action.open.tip=Visualiser la réponse
+faxtomail.demandReplies.action.tip=Réponses envoyées
+faxtomail.demandReplies.empty=Aucune réponse envoyée
+faxtomail.demandReplies.text=Réponses (%s)
+faxtomail.demandReplies.title=Réponses envoyées
faxtomail.demande.archive.button.label=Archiver
faxtomail.demande.askCancelEditBeforeLeaving.cancelSave=L'élément n'est pas valide et ne peut être sauvé.
faxtomail.demande.askSaveBeforeLeaving.save=Vous avez modifié l'élément mais vous n'avez pas enregistré ces modifications.
@@ -67,7 +73,6 @@
faxtomail.demande.mailBody.label=Corps du mail
faxtomail.demande.mailFolder.label=Dossier
faxtomail.demande.message.label=Message
-faxtomail.demande.object.label=Objet
faxtomail.demande.print.button.label=Imprimer
faxtomail.demande.priority.label=Priorité
faxtomail.demande.projectReference.label=Référence chantier
@@ -80,6 +85,7 @@
faxtomail.demande.sender.label=Émetteur
faxtomail.demande.sender.manualCreation=Création manuelle
faxtomail.demande.status.label=Statut
+faxtomail.demande.subject.label=Objet
faxtomail.demande.takenBy.label=Pris par
faxtomail.demande.transmit.button.label=Transmettre
faxtomail.demandeList.action.archive=Archiver
@@ -110,8 +116,6 @@
faxtomail.demandeList.table.header.ediCodeNumber.tip=Code EDI
faxtomail.demandeList.table.header.lastAttachmentOpeningUser=Dernier à ouvrir une PJ
faxtomail.demandeList.table.header.lastAttachmentOpeningUser.tip=Dernier utilisateur à avoir ouvert une pièce-jointe
-faxtomail.demandeList.table.header.object=Objet
-faxtomail.demandeList.table.header.object.tip=Objet
faxtomail.demandeList.table.header.pfNb=Qté produits
faxtomail.demandeList.table.header.pfNb.tip=Quantité de produits
faxtomail.demandeList.table.header.priority=P
@@ -128,6 +132,8 @@
faxtomail.demandeList.table.header.sender.tip=Addresse email ou numéro de fax de l'émetteur
faxtomail.demandeList.table.header.status=Statut
faxtomail.demandeList.table.header.status.tip=Statut
+faxtomail.demandeList.table.header.subject=Objet
+faxtomail.demandeList.table.header.subject.tip=Objet
faxtomail.demandeList.table.header.type=Type
faxtomail.demandeList.table.header.type.tip=Type
faxtomail.demandeList.table.header.user=Pris par
@@ -180,11 +186,13 @@
faxtomail.reply.action.cancel.tip=Annuler et fermer la popup
faxtomail.reply.action.validate=Valider
faxtomail.reply.action.validate.tip=Valider et répondre au mail
-faxtomail.reply.attachment=Ajouter des pièces jointes
-faxtomail.reply.from=De \:
-faxtomail.reply.object=Objet \:
+faxtomail.reply.label.attachment=Ajouter des pièces jointes
+faxtomail.reply.label.from=De \:
+faxtomail.reply.label.subject=Objet \:
+faxtomail.reply.label.to=À \:
+faxtomail.reply.message=\nLe %1$s, %2$s a écrit \:\n> %3$s
+faxtomail.reply.subject=Re \: %s
faxtomail.reply.title=Réponse à \: %s
-faxtomail.reply.to=À \:
faxtomail.search.action.gotoFolder=Aller au dossier
faxtomail.search.action.gotoFolder.tip=Aller au dossier
faxtomail.search.between2ndPart.label=et le
@@ -195,13 +203,13 @@
faxtomail.search.docType.label=Type document
faxtomail.search.modifiedBetween.label=Modifié entre le
faxtomail.search.modifiedBy.label=Modifié par
-faxtomail.search.object.label=Objet
faxtomail.search.printedBetween.label=Imprimé entre le
faxtomail.search.receivedBetween.label=Reçu entre le
faxtomail.search.ref.label=Référence
faxtomail.search.resultNb=Nombre de résultats \: %s
faxtomail.search.sender.label=Émetteur
faxtomail.search.status.label=Statut
+faxtomail.search.subject.label=Objet
faxtomail.search.title=Recherche
faxtomail.searchToGroup.action.cancel=Annuler
faxtomail.searchToGroup.action.cancel.tip=Fermer la fenêtre sans grouper l'élément
@@ -213,4 +221,3 @@
faxtomail.validator.error.email.demandType.required=Type de demande requis
faxtomail.validator.error.email.projectReference.required=Référence chantier requise
swing.error.cannot.open.file=
-test=
Deleted: trunk/faxtomail-ui-swing/src/main/resources/icons/action-cross.png
===================================================================
(Binary files differ)
Copied: trunk/faxtomail-ui-swing/src/main/resources/icons/action-cross.png (from rev 32, trunk/faxtomail-ui-swing/src/main/resources/icons/cross.png)
===================================================================
(Binary files differ)
Added: trunk/faxtomail-ui-swing/src/main/resources/icons/action-open.png
===================================================================
(Binary files differ)
Property changes on: trunk/faxtomail-ui-swing/src/main/resources/icons/action-open.png
___________________________________________________________________
Added: svn:executable
+ *
Added: svn:mime-type
+ application/octet-stream
Deleted: trunk/faxtomail-ui-swing/src/main/resources/icons/cross.png
===================================================================
(Binary files differ)
Added: trunk/faxtomail-ui-swing/src/main/resources/icons/cross_blue.png
===================================================================
(Binary files differ)
Property changes on: trunk/faxtomail-ui-swing/src/main/resources/icons/cross_blue.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/faxtomail-ui-swing/src/main/resources/icons/cross_red.png
===================================================================
(Binary files differ)
Property changes on: trunk/faxtomail-ui-swing/src/main/resources/icons/cross_red.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Modified: trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/MailFilterJob.java
===================================================================
--- trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/MailFilterJob.java 2014-04-14 16:33:11 UTC (rev 35)
+++ trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/MailFilterJob.java 2014-04-17 17:27:05 UTC (rev 36)
@@ -36,8 +36,11 @@
import javax.mail.internet.MimeMultipart;
import java.io.File;
import java.io.FileOutputStream;
+import java.util.ArrayList;
+import java.util.Arrays;
import java.util.Collection;
import java.util.Date;
+import java.util.List;
import java.util.Properties;
import static org.nuiton.i18n.I18n.t;
@@ -134,41 +137,58 @@
log.debug(count + " messages, " + unread + " unread");
- for (int i = 0 ; i < count ; i++ ) {
+ for (int i = 0 ; i < count ; i++) {
Email email = new EmailImpl();
+ EmailService emailService = serviceContext.newService(EmailService.class);
+ emailService.saveEmail(email, null);
+
int messageNumber = count - i;
Message message = folder.getMessage(messageNumber);
- log.debug("Message n°" + messageNumber);
+ List<String> modifiedProperties = new ArrayList<>();
+
log.debug("Object: " + message.getSubject());
- email.setObject(message.getSubject());
+ email.setSubject(message.getSubject());
+ modifiedProperties.add(Email.PROPERTY_SUBJECT);
- log.debug("Sender: ");
Address[] addresses = message.getFrom();
- if (addresses != null) {
- for (Address address : addresses) {
- email.setSender(address.toString());
- }
+ if (addresses != null && addresses.length > 0) {
+ email.setSender(addresses[0].toString());
+ modifiedProperties.add(Email.PROPERTY_SENDER);
}
- log.debug("Recipients: ");
- addresses = message.getRecipients(Message.RecipientType.TO);
- if (addresses != null) {
- for (Address address : addresses) {
- log.debug("\tTo : " + address);
- email.setRecipient(address.toString());
- }
+ List<Address> recipients = new ArrayList<>();
+ Address[] toRecipients = message.getRecipients(Message.RecipientType.TO);
+ if (toRecipients != null) {
+ recipients.addAll(Arrays.asList(toRecipients));
}
+ Address[] ccRecipients = message.getRecipients(Message.RecipientType.CC);
+ if (ccRecipients != null) {
+ recipients.addAll(Arrays.asList(ccRecipients));
+ }
- addresses = message.getRecipients(Message.RecipientType.CC);
- if (addresses != null) {
- for (Address address : addresses) {
- log.debug("\tCopy : " + address);
+ for (Address address : recipients) {
+ String recipient = address.toString();
+ MailFolder mailFolder = serviceContext.newService(MailFolderService.class).getFolderForRecipient(recipient);
+
+ log.debug("\tTo : " + address + " -> " + (mailFolder != null ? mailFolder.getName() : "none"));
+
+ if (mailFolder != null) {
+ email.setRecipient(recipient);
+ email.setMailFolder(mailFolder);
+ modifiedProperties.add(Email.PROPERTY_RECIPIENT);
+ modifiedProperties.add(Email.PROPERTY_MAIL_FOLDER);
+ break;
}
}
- email.setReceptionDate(message.getReceivedDate());
+ Date receivedDate = message.getReceivedDate();
+ if (receivedDate == null) {
+ receivedDate = message.getSentDate();
+ }
+ email.setReceptionDate(receivedDate);
+ modifiedProperties.add(Email.PROPERTY_RECEPTION_DATE);
Date now = new Date();
@@ -176,39 +196,27 @@
Decorator<Date> dateDecorator = decoratorService.getDecoratorByType(Date.class, DecoratorService.DATE);
String projectRef = t("faxtomail.email.projectReference.default", dateDecorator.toString(now));
email.setProjectReference(projectRef);
+ modifiedProperties.add(Email.PROPERTY_PROJECT_REFERENCE);
email.setDemandStatus(DemandStatus.UNTREATED);
+ modifiedProperties.add(Email.PROPERTY_DEMAND_STATUS);
String originalContent = IOUtils.toString(message.getInputStream());
email.setOriginalEmail(originalContent);
- log.debug("ContentType: " + message.getContentType());
-
if (message.isMimeType("multipart/*")) {
decomposeMultipartEmail(message, email);
} else {
String content = IOUtils.toString(message.getInputStream());
- email.setContent(content);
- email.setContentType(message.getContentType());
+ email.setPlainContent(content);
}
- log.debug("Content: ");
- log.debug(email.getContent());
+ emailService.saveEmail(email, null, modifiedProperties.toArray(new String[modifiedProperties.size()]));
-// content = content.replaceAll("<img src=\"(.*?)\"(/>|>.*?</img>)", "[image : $1]");
-// content = content.replaceAll("<a href=\"(.*?)\">(.*?)</a>", "[$2 : $1]");
-// log.debug("Content : ");
-// log.debug(content);
-// email.setContent(content);
-
- MailFolder mailFolder = serviceContext.newService(MailFolderService.class).getFolderForRecipient(email.getRecipient());
- email.setMailFolder(mailFolder);
-
- serviceContext.newService(EmailService.class).saveEmail(email, null);
-
message.setFlag(Flags.Flag.DELETED, true);
}
+ log.debug("End of emails");
} catch (Exception e) {
log.error("Error while reading the emails", e);
@@ -235,8 +243,11 @@
// if it is a text part, the,n this is the email content
if (bp.isMimeType("text/*")) {
String content = IOUtils.toString(bp.getInputStream());
- email.setContent(content);
- email.setContentType(bp.getContentType());
+ if (bp.isMimeType("text/plain")) {
+ email.setPlainContent(content);
+ } else {
+ email.setHtmlContent(content);
+ }
// if it is multipart part, decompose it
} else if (bp.isMimeType("multipart/*")) {
@@ -245,14 +256,18 @@
// else, this is an attachment
} else {
String fileName = bp.getFileName();
- log.debug("FileName : " + fileName);
if (fileName == null) {
fileName = bp.getHeader("Content-ID")[0];
// remove the guillemets between the id
fileName = fileName.replaceFirst("^<(.*)>$", "$1");
}
+ log.debug("FileName : " + fileName);
- File file = new File(FileUtils.getTempDirectory(), fileName);
+ File dir = new File(FileUtils.getTempDirectory(), email.getTopiaId());
+ if (!dir.exists()) {
+ dir.mkdir();
+ }
+ File file = new File(dir, fileName);
FileOutputStream fos = new FileOutputStream(file);
DataHandler dh = bp.getDataHandler();
Modified: trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/action/admin/ConfigurationAction.java
===================================================================
--- trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/action/admin/ConfigurationAction.java 2014-04-14 16:33:11 UTC (rev 35)
+++ trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/action/admin/ConfigurationAction.java 2014-04-17 17:27:05 UTC (rev 36)
@@ -153,7 +153,7 @@
result.put(Email.PROPERTY_SENDER, "Adresse email");
result.put(Email.PROPERTY_RECEPTION_DATE, "Date de réception");
result.put(Email.PROPERTY_EDI_CODE_NUMBER, "Code EDI");
- result.put(Email.PROPERTY_OBJECT, "Objet");
+ result.put(Email.PROPERTY_SUBJECT, "Objet");
result.put(Email.PROPERTY_PROJECT_REFERENCE, "Référence travaux");
result.put(Email.PROPERTY_PRIORITY, "Priorité");
result.put(Email.PROPERTY_RANGE_ROW, "Gamme");
Modified: trunk/pom.xml
===================================================================
--- trunk/pom.xml 2014-04-14 16:33:11 UTC (rev 35)
+++ trunk/pom.xml 2014-04-17 17:27:05 UTC (rev 36)
@@ -115,7 +115,7 @@
<h2Version>1.3.174</h2Version>
<jaxxVersion>2.8.5-SNAPSHOT</jaxxVersion>
- <swingXVersion>1.6.4</swingXVersion>
+ <swingXVersion>1.6.5-1</swingXVersion>
<xworkVersion>2.3.15.1</xworkVersion>
<struts2Version>2.3.15.3</struts2Version>
1
0
14 Apr '14
Author: kmorin
Date: 2014-04-14 18:33:11 +0200 (Mon, 14 Apr 2014)
New Revision: 35
Url: http://forge.codelutin.com/projects/faxtomail/repository/revisions/35
Log:
refs #4653 [TECH] Gestion des mails / fax entrants
Added:
trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/imports/EmailAccountImportModel.java
trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/imports/EmailFilterImportModel.java
trunk/faxtomail-service/src/test/java/com/
trunk/faxtomail-service/src/test/java/com/franciaflex/
trunk/faxtomail-service/src/test/java/com/franciaflex/faxtomail/
trunk/faxtomail-service/src/test/java/com/franciaflex/faxtomail/services/
trunk/faxtomail-service/src/test/java/com/franciaflex/faxtomail/services/service/
trunk/faxtomail-service/src/test/java/com/franciaflex/faxtomail/services/service/AbstractFaxToMailServiceTest.java
trunk/faxtomail-service/src/test/java/com/franciaflex/faxtomail/services/service/MailFolderServiceTest.java
Modified:
trunk/README.txt
trunk/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/FaxToMailConfiguration.java
trunk/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/FaxToMailConfigurationProvider.java
trunk/faxtomail-persistence/src/main/resources/i18n/faxtomail-persistence_en_GB.properties
trunk/faxtomail-persistence/src/main/resources/i18n/faxtomail-persistence_fr_FR.properties
trunk/faxtomail-persistence/src/main/xmi/faxtomail.zargo
trunk/faxtomail-service/pom.xml
trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/DecoratorService.java
trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/FaxToMailDecorator.java
trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/InitFaxToMailService.java
trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/MailFolderService.java
trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/ReferentielService.java
trunk/faxtomail-service/src/main/resources/i18n/faxtomail-service_en_GB.properties
trunk/faxtomail-service/src/main/resources/i18n/faxtomail-service_fr_FR.properties
trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/MailFilterJob.java
Modified: trunk/README.txt
===================================================================
--- trunk/README.txt 2014-04-14 14:02:52 UTC (rev 34)
+++ trunk/README.txt 2014-04-14 16:33:11 UTC (rev 35)
@@ -1,30 +0,0 @@
-Faire une nouvelle version mineure
-----------------------------------
-
-Cette release va juste déployer sur le dépot nexus les artifacts + mettre à jour
-le fichier de mises à jour sur http://appup.forge.codelutin.com/tutti.
-
-mvn release:prepare
-mvn release:perform
-
-Faire une nouvelle version majeure
-----------------------------------
-
-Cette release va en plus générer et deployer sur forge.codelutin.com les zip
-incluant la jre + l'application.
-
-mvn release:prepare -Darguments="-DperformFullRelease"
-mvn release:perform -Darguments="-DperformFullRelease"
-
-Historique des versions de base
--------------------------------
-
-+---------------------+------------+---------------------------+
-| Application version | Db version | Allegro db schema version |
-+=====================+============+===========================+
-+ 2.3 + 2013.06.04 + 3.2.1.01 +
-+---------------------+------------+---------------------------+
-+ 2.4 + 2013.06.04 + 3.2.3 +
-+---------------------+------------+---------------------------+
-+ 2.8.1 + 2013.08.22 + 3.2.3 +
-+---------------------+------------+---------------------------+
Modified: trunk/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/FaxToMailConfiguration.java
===================================================================
--- trunk/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/FaxToMailConfiguration.java 2014-04-14 14:02:52 UTC (rev 34)
+++ trunk/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/FaxToMailConfiguration.java 2014-04-14 16:33:11 UTC (rev 35)
@@ -190,7 +190,7 @@
applicationConfig.save(file, false, optionKeyToNotSave);
} catch (IOException e) {
throw new ApplicationTechnicalException(
- t("tutti.config.save.error", file), e);
+ t("faxtomail.config.save.error", file), e);
}
}
Modified: trunk/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/FaxToMailConfigurationProvider.java
===================================================================
--- trunk/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/FaxToMailConfigurationProvider.java 2014-04-14 14:02:52 UTC (rev 34)
+++ trunk/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/FaxToMailConfigurationProvider.java 2014-04-14 16:33:11 UTC (rev 35)
@@ -1,29 +1,5 @@
package com.franciaflex.faxtomail;
-/*
- * #%L
- * Tutti :: Persistence
- * $Id: TuttiConfigurationProvider.java 1566 2014-02-04 08:31:02Z tchemit $
- * $HeadURL: http://svn.forge.codelutin.com/svn/tutti/trunk/tutti-persistence/src/main/j… $
- * %%
- * Copyright (C) 2012 - 2013 Ifremer
- * %%
- * 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 org.nuiton.config.ApplicationConfigProvider;
import org.nuiton.config.ConfigActionDef;
import org.nuiton.config.ConfigOptionDef;
Modified: trunk/faxtomail-persistence/src/main/resources/i18n/faxtomail-persistence_en_GB.properties
===================================================================
--- trunk/faxtomail-persistence/src/main/resources/i18n/faxtomail-persistence_en_GB.properties 2014-04-14 14:02:52 UTC (rev 34)
+++ trunk/faxtomail-persistence/src/main/resources/i18n/faxtomail-persistence_en_GB.properties 2014-04-14 16:33:11 UTC (rev 35)
@@ -20,6 +20,7 @@
faxtomail.config.option.ui.showNumberEditorButton.description=
faxtomail.config.option.version.description=
faxtomail.config.parse.error=
+faxtomail.config.save.error=
faxtomail.demandStatus.archive=
faxtomail.demandStatus.inProgress=
faxtomail.demandStatus.qualified=
@@ -39,4 +40,3 @@
faxtomail.persistence.mkDir.error=
faxtomail.service.config.deleteTempDirectory.error=
faxtomail.service.mkDir.error=
-tutti.config.save.error=
Modified: trunk/faxtomail-persistence/src/main/resources/i18n/faxtomail-persistence_fr_FR.properties
===================================================================
--- trunk/faxtomail-persistence/src/main/resources/i18n/faxtomail-persistence_fr_FR.properties 2014-04-14 14:02:52 UTC (rev 34)
+++ trunk/faxtomail-persistence/src/main/resources/i18n/faxtomail-persistence_fr_FR.properties 2014-04-14 16:33:11 UTC (rev 35)
@@ -20,6 +20,7 @@
faxtomail.config.option.ui.showNumberEditorButton.description=
faxtomail.config.option.version.description=
faxtomail.config.parse.error=
+faxtomail.config.save.error=
faxtomail.demandStatus.archive=Archive
faxtomail.demandStatus.inProgress=En cours
faxtomail.demandStatus.qualified=Qualifié
@@ -38,4 +39,3 @@
faxtomail.persistence.mkDir.error=
faxtomail.service.config.deleteTempDirectory.error=
faxtomail.service.mkDir.error=
-tutti.config.save.error=
Modified: trunk/faxtomail-persistence/src/main/xmi/faxtomail.zargo
===================================================================
(Binary files differ)
Modified: trunk/faxtomail-service/pom.xml
===================================================================
--- trunk/faxtomail-service/pom.xml 2014-04-14 14:02:52 UTC (rev 34)
+++ trunk/faxtomail-service/pom.xml 2014-04-14 16:33:11 UTC (rev 35)
@@ -126,24 +126,29 @@
<artifactId>junit</artifactId>
</dependency>
+ <dependency>
+ <groupId>com.h2database</groupId>
+ <artifactId>h2</artifactId>
+ </dependency>
+
</dependencies>
<build>
- <pluginManagement>
- <plugins>
- <plugin>
- <artifactId>maven-surefire-plugin</artifactId>
- <configuration>
- <properties>
- <property>
- <name>listener</name>
- <value>fr.ifremer.tutti.persistence.test.TuttiRunListener</value>
- </property>
- </properties>
- </configuration>
- </plugin>
- </plugins>
- </pluginManagement>
+ <!--<pluginManagement>-->
+ <!--<plugins>-->
+ <!--<plugin>-->
+ <!--<artifactId>maven-surefire-plugin</artifactId>-->
+ <!--<configuration>-->
+ <!--<properties>-->
+ <!--<property>-->
+ <!--<name>listener</name>-->
+ <!--<value>fr.ifremer.tutti.persistence.test.TuttiRunListener</value>-->
+ <!--</property>-->
+ <!--</properties>-->
+ <!--</configuration>-->
+ <!--</plugin>-->
+ <!--</plugins>-->
+ <!--</pluginManagement>-->
<plugins>
<plugin>
Modified: trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/DecoratorService.java
===================================================================
--- trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/DecoratorService.java 2014-04-14 14:02:52 UTC (rev 34)
+++ trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/DecoratorService.java 2014-04-14 16:33:11 UTC (rev 35)
@@ -1,29 +1,5 @@
package com.franciaflex.faxtomail.services;
-/*
- * #%L
- * Tutti :: Application
- * $Id: DecoratorService.java 1566 2014-02-04 08:31:02Z tchemit $
- * $HeadURL: http://svn.forge.codelutin.com/svn/tutti/trunk/tutti-service/src/main/java/… $
- * %%
- * Copyright (C) 2012 Ifremer
- * %%
- * 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.Attachment;
import com.franciaflex.faxtomail.persistence.entities.FaxToMailUser;
import com.franciaflex.faxtomail.persistence.entities.HasLabel;
@@ -34,7 +10,7 @@
import java.util.Date;
/**
- * Tutti decorator service.
+ * FaxToMail decorator service.
*
* @author tchemit <chemit(a)codelutin.com>
* @since 0.1
Modified: trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/FaxToMailDecorator.java
===================================================================
--- trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/FaxToMailDecorator.java 2014-04-14 14:02:52 UTC (rev 34)
+++ trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/FaxToMailDecorator.java 2014-04-14 16:33:11 UTC (rev 35)
@@ -95,7 +95,7 @@
int i = 0;
for (Context<O> OContext : contexts) {
- OContext.setComparator(new TuttiDecoratorComparator<O>(getProperty(i++)));
+ OContext.setComparator(new FaxToMailDecoratorComparator<O>(getProperty(i++)));
}
this.cache = CacheBuilder.newBuilder().build(new CacheLoader<O, String>() {
@@ -137,8 +137,8 @@
this.sortOnlyOnSelectedContextTokens = sortOnlyOnSelectedContextTokens;
}
- public TuttiDecoratorComparator<O> getCurrentComparator() {
- return (TuttiDecoratorComparator<O>) context.getComparator(0);
+ public FaxToMailDecoratorComparator<O> getCurrentComparator() {
+ return (FaxToMailDecoratorComparator<O>) context.getComparator(0);
}
@Override
@@ -216,13 +216,13 @@
return super.clone();
}
- public static class TuttiDecoratorComparator<O> extends JXPathComparator<O> implements Serializable, Cloneable {
+ public static class FaxToMailDecoratorComparator<O> extends JXPathComparator<O> implements Serializable, Cloneable {
private static final long serialVersionUID = 1L;
protected String expression;
- public TuttiDecoratorComparator(String expression) {
+ public FaxToMailDecoratorComparator(String expression) {
super(expression);
this.expression = expression;
}
@@ -230,31 +230,31 @@
@Override
public void init(JXPathDecorator<O> decorator, List<O> datas) {
clear();
- FaxToMailDecorator<O> tuttiDecorator = (FaxToMailDecorator<O>) decorator;
+ FaxToMailDecorator<O> faxToMailDecorator = (FaxToMailDecorator<O>) decorator;
String token = decorator.getTokens()[0];
boolean sortOnlyOnSelectedContext =
- tuttiDecorator.isSortOnlyOnSelectedContext() &&
- tuttiDecorator.getSortOnlyOnSelectedContextTokens() != null &&
- tuttiDecorator.getSortOnlyOnSelectedContextTokens().contains(token);
+ faxToMailDecorator.isSortOnlyOnSelectedContext() &&
+ faxToMailDecorator.getSortOnlyOnSelectedContextTokens() != null &&
+ faxToMailDecorator.getSortOnlyOnSelectedContextTokens().contains(token);
for (O data : datas) {
if (sortOnlyOnSelectedContext) {
- Object tokenValue = tuttiDecorator.getValue(data, token);
+ Object tokenValue = faxToMailDecorator.getValue(data, token);
valueCache.put(data, (Comparable) tokenValue);
} else if (data instanceof Number) {
valueCache.put(data, (Comparable) data);
} else {
- Comparable key = tuttiDecorator.toString(data);
+ Comparable key = faxToMailDecorator.toString(data);
valueCache.put(data, key);
}
}
}
@Override
- public TuttiDecoratorComparator<O> clone() {
- TuttiDecoratorComparator<O> result =
- new TuttiDecoratorComparator<O>(expression);
+ public FaxToMailDecoratorComparator<O> clone() {
+ FaxToMailDecoratorComparator<O> result =
+ new FaxToMailDecoratorComparator<O>(expression);
return result;
}
Modified: trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/InitFaxToMailService.java
===================================================================
--- trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/InitFaxToMailService.java 2014-04-14 14:02:52 UTC (rev 34)
+++ trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/InitFaxToMailService.java 2014-04-14 16:33:11 UTC (rev 35)
@@ -45,6 +45,7 @@
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.MailFilter;
import com.franciaflex.faxtomail.persistence.entities.MailFolder;
import com.franciaflex.faxtomail.persistence.entities.MailFolderTopiaDao;
import com.franciaflex.faxtomail.persistence.entities.Priority;
@@ -67,12 +68,15 @@
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
+import java.net.URISyntaxException;
import java.net.URL;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Collections;
import java.util.Date;
+import java.util.HashMap;
import java.util.List;
+import java.util.Map;
import java.util.Properties;
import java.util.Random;
@@ -223,7 +227,7 @@
FaxToMailUser.PROPERTY_TRIGRAPH, "JBO");
MailFolderTopiaDao folderDao = getPersistenceContext().getMailFolderDao();
- List<MailFolder> folders = new ArrayList<>();
+ Map<String, MailFolder> folders = new HashMap<>();
Random random = new Random();
EmailTopiaDao emailDao = getPersistenceContext().getEmailDao();
@@ -232,79 +236,100 @@
int etatAttenteSize = etatAttentes.size();
+ // root folders
MailFolder chargesClientelle = folderDao.create(MailFolder.PROPERTY_NAME, "Chargés de clientèle");
- folders.add(chargesClientelle);
+ folders.put("Chargés de clientèle", chargesClientelle);
Collections.shuffle(etatAttentes);
+ MailFolder sav = folderDao.create(MailFolder.PROPERTY_NAME, "SAV",
+ MailFolder.PROPERTY_ETAT_ATTENTE, etatAttentes.subList(0, random.nextInt(etatAttenteSize - 8) + 2));
+ folders.put("SAV", sav);
+
+ // companies
+ CompanyTopiaDao companyTopiaDao = getPersistenceContext().getCompanyDao();
+ ConfigurationTopiaDao configurationTopiaDao = getPersistenceContext().getConfigurationDao();
+ Company fx = companyTopiaDao.create(Company.PROPERTY_NAME, "Franciaflex",
+ Company.PROPERTY_CONFIGURATION, configurationTopiaDao.create(),
+ Company.PROPERTY_MAIL_FOLDER, folders.values());
+ companyTopiaDao.create(Company.PROPERTY_NAME, "Faber", Company.PROPERTY_CONFIGURATION, configurationTopiaDao.create());
+ companyTopiaDao.create(Company.PROPERTY_NAME, "France Fermeture", Company.PROPERTY_CONFIGURATION, configurationTopiaDao.create());
+
+ // user folders
+ Collections.shuffle(etatAttentes);
MailFolder cyrilFolder = folderDao.create(MailFolder.PROPERTY_NAME, "Cyril",
MailFolder.PROPERTY_PARENT, chargesClientelle,
MailFolder.PROPERTY_ETAT_ATTENTE, etatAttentes.subList(0, random.nextInt(etatAttenteSize - 8) + 2));
chargesClientelle.addChildren(cyrilFolder);
+ folders.put("Cyril", cyrilFolder);
MailFolder claireFolder = folderDao.create(MailFolder.PROPERTY_NAME, "Claire",
MailFolder.PROPERTY_PARENT, chargesClientelle);
chargesClientelle.addChildren(claireFolder);
+ folders.put("Claire", claireFolder);
Collections.shuffle(etatAttentes);
MailFolder agatheFolder = folderDao.create(MailFolder.PROPERTY_NAME, "Agathe",
MailFolder.PROPERTY_PARENT, chargesClientelle,
MailFolder.PROPERTY_ETAT_ATTENTE, etatAttentes.subList(0, random.nextInt(etatAttenteSize - 8) + 2));
chargesClientelle.addChildren(agatheFolder);
+ folders.put("Agathe", agatheFolder);
- MailFolder sav = folderDao.create(MailFolder.PROPERTY_NAME, "SAV",
- MailFolder.PROPERTY_ETAT_ATTENTE, etatAttentes.subList(0, random.nextInt(etatAttenteSize - 8) + 2));
- folders.add(sav);
-
MailFolder marcFolder = folderDao.create(MailFolder.PROPERTY_NAME, "Marc",
MailFolder.PROPERTY_PARENT, sav);
sav.addChildren(marcFolder);
+ folders.put("Marc", marcFolder);
MailFolder fredericFolder = folderDao.create(MailFolder.PROPERTY_NAME, "Frédéric",
MailFolder.PROPERTY_PARENT, sav);
sav.addChildren(fredericFolder);
+ folders.put("Frédéric", fredericFolder);
MailFolder jeanneFolder = folderDao.create(MailFolder.PROPERTY_NAME, "Jeanne",
MailFolder.PROPERTY_PARENT, sav);
sav.addChildren(jeanneFolder);
+ folders.put("Jeanne", jeanneFolder);
- // companies
- CompanyTopiaDao companyTopiaDao = getPersistenceContext().getCompanyDao();
- ConfigurationTopiaDao configurationTopiaDao = getPersistenceContext().getConfigurationDao();
- Company fx = companyTopiaDao.create(Company.PROPERTY_NAME, "Franciaflex", Company.PROPERTY_CONFIGURATION, configurationTopiaDao.create(), Company.PROPERTY_MAIL_FOLDER, folders);
- companyTopiaDao.create(Company.PROPERTY_NAME, "Faber", Company.PROPERTY_CONFIGURATION, configurationTopiaDao.create());
- companyTopiaDao.create(Company.PROPERTY_NAME, "France Fermeture", Company.PROPERTY_CONFIGURATION, configurationTopiaDao.create());
-
+ // email accounts
try {
- URL mailAccountsPropertiesURL = ClassLoader.getSystemResource("mail_accounts.properties");
- if (mailAccountsPropertiesURL != null) {
- InputStream mailAccountStream = new FileInputStream(mailAccountsPropertiesURL.getPath());
- Properties properties = new Properties();
- properties.load(mailAccountStream);
- String protocol = (String) properties.get("mail.protocol");
- String host = (String) properties.get("mail.host");
- String user = (String) properties.get("mail.user");
- String password = (String) properties.get("mail.password");
+ URL emailAccountsPropertiesURL = ClassLoader.getSystemResource("email_accounts.csv");
+ if (emailAccountsPropertiesURL != null) {
+ File emailAccountFile = new File(emailAccountsPropertiesURL.toURI());
- EmailAccountTopiaDao emailAccountTopiaDao = getPersistenceContext().getEmailAccountDao();
- EmailAccount emailAccount = emailAccountTopiaDao.create(EmailAccount.PROPERTY_PROTOCOL, protocol,
- EmailAccount.PROPERTY_HOST, host,
- EmailAccount.PROPERTY_USER, user,
- EmailAccount.PROPERTY_PASSWORD, password);
- fx.addEmailAccount(emailAccount);
+ List<EmailAccount> emailAccounts = getReferentielService().importEmailAccounts(emailAccountFile);
+
+ fx.addAllEmailAccount(emailAccounts);
companyTopiaDao.update(fx);
}
- } catch(IOException e) {
+ } catch(Exception e) {
log.error("error getting the email accounts", e);
- return;
}
+ // email filters
+
+ try {
+ URL emailFiltersPropertiesURL = ClassLoader.getSystemResource("email_filters.csv");
+ if (emailFiltersPropertiesURL != null) {
+ File emailFilterFile = new File(emailFiltersPropertiesURL.toURI());
+
+ List<MailFilter> mailFilters = getReferentielService().importEmailFilters(emailFilterFile, folders);
+
+ fx.addAllMailFilter(mailFilters);
+ companyTopiaDao.update(fx);
+ }
+
+ } catch(Exception e) {
+ log.error("error getting the email filters", e);
+ }
+
+ // user groups
FaxToMailUserGroupTopiaDao userGroupDao = getPersistenceContext().getFaxToMailUserGroupDao();
userGroupDao.create(FaxToMailUserGroup.PROPERTY_NAME, "Chargés de clientèle");
userGroupDao.create(FaxToMailUserGroup.PROPERTY_NAME, "Commerciaux");
userGroupDao.create(FaxToMailUserGroup.PROPERTY_NAME, "SAV");
userGroupDao.create(FaxToMailUserGroup.PROPERTY_NAME, "Administrateurs");
+ // clients and emails
try {
URL fxClientsURL = ClassLoader.getSystemResource("fx_clients.csv");
if (fxClientsURL != null) {
Modified: trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/MailFolderService.java
===================================================================
--- trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/MailFolderService.java 2014-04-14 14:02:52 UTC (rev 34)
+++ trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/MailFolderService.java 2014-04-14 16:33:11 UTC (rev 35)
@@ -2,6 +2,8 @@
import com.franciaflex.faxtomail.persistence.entities.Email;
import com.franciaflex.faxtomail.persistence.entities.EtatAttente;
+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.services.FaxToMailServiceSupport;
@@ -11,11 +13,14 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.nuiton.topia.persistence.TopiaIdFactory;
+import org.nuiton.topia.persistence.pager.TopiaPagerBean;
import java.util.ArrayList;
import java.util.Collection;
+import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
+import java.util.Map;
/**
* @author kmorin <kmorin(a)codelutin.com>
@@ -26,8 +31,25 @@
private static final Log log = LogFactory.getLog(MailFolderService.class);
- public MailFolder getRandomFolder() {
- return getPersistenceContext().getMailFolderDao().forParentEquals(null).findAny();
+ public MailFolder getFolderForRecipient(String recipient) {
+ MailFilterTopiaDao filterTopiaDao = getPersistenceContext().getMailFilterDao();
+
+ TopiaPagerBean tpb = new TopiaPagerBean();
+ tpb.setSortColumn(MailFilter.PROPERTY_POSITION);
+ tpb.setSortAscendant(true);
+
+ String query = "FROM " + MailFilter.class.getCanonicalName() + " WHERE :recipient LIKE " + MailFilter.PROPERTY_EXPRESSION;
+ Map<String, Object> params = new HashMap<>();
+ params.put("recipient", recipient);
+
+ Collection<MailFilter> filters = filterTopiaDao.find(query, params, tpb);
+ MailFolder result;
+ if (CollectionUtils.isNotEmpty(filters)) {
+ result = filters.iterator().next().getMailFolder();
+ } else {
+ result = null;
+ }
+ return result;
}
public List<MailFolder> getAllMailFolders() {
Modified: trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/ReferentielService.java
===================================================================
--- trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/ReferentielService.java 2014-04-14 14:02:52 UTC (rev 34)
+++ trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/ReferentielService.java 2014-04-14 16:33:11 UTC (rev 35)
@@ -4,14 +4,21 @@
import com.franciaflex.faxtomail.persistence.entities.ClientTopiaDao;
import com.franciaflex.faxtomail.persistence.entities.DemandType;
import com.franciaflex.faxtomail.persistence.entities.DemandTypeTopiaDao;
+import com.franciaflex.faxtomail.persistence.entities.EmailAccount;
+import com.franciaflex.faxtomail.persistence.entities.EmailAccountTopiaDao;
import com.franciaflex.faxtomail.persistence.entities.EtatAttente;
import com.franciaflex.faxtomail.persistence.entities.EtatAttenteTopiaDao;
+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.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.services.FaxToMailServiceSupport;
import com.franciaflex.faxtomail.services.service.imports.ClientImportModel;
+import com.franciaflex.faxtomail.services.service.imports.EmailAccountImportModel;
+import com.franciaflex.faxtomail.services.service.imports.EmailFilterImportModel;
import com.google.common.base.Charsets;
import com.google.common.io.Files;
import org.apache.commons.io.IOUtils;
@@ -24,6 +31,7 @@
import java.io.Reader;
import java.util.ArrayList;
import java.util.List;
+import java.util.Map;
import static org.nuiton.i18n.I18n.t;
@@ -94,4 +102,78 @@
}
return result;
}
+
+ public List<EmailAccount> importEmailAccounts(File csvFile) throws IOException {
+ List<EmailAccount> result = new ArrayList<>();
+ EmailAccountTopiaDao dao = getPersistenceContext().getEmailAccountDao();
+
+ Reader reader = Files.newReader(csvFile, Charsets.UTF_8);
+ EmailAccountImportModel emailAccountImportModel = new EmailAccountImportModel(';');
+ try {
+ Import<EmailAccount> importer = Import.newImport(emailAccountImportModel, reader);
+ try {
+ for (EmailAccount emailAccount : importer) {
+ result.add(dao.create(emailAccount));
+ }
+ getPersistenceContext().commit();
+
+ } finally {
+ IOUtils.closeQuietly(importer);
+ }
+ reader.close();
+
+ } catch (IOException e) {
+ throw new IOException(t("faxtomail.service.referential.import.emailAccount.error", csvFile), e);
+
+ } catch (ImportRuntimeException e) {
+ String message;
+ if (e.getCause() != null) {
+ message = e.getCause().getMessage();
+ } else {
+ message = e.getMessage();
+ }
+ throw new ApplicationTechnicalException(message, e);
+
+ } finally {
+ IOUtils.closeQuietly(reader);
+ }
+ return result;
+ }
+
+ public List<MailFilter> importEmailFilters(File csvFile, Map<String, MailFolder> foldersByName) throws IOException {
+ List<MailFilter> result = new ArrayList<>();
+ MailFilterTopiaDao dao = getPersistenceContext().getMailFilterDao();
+
+ Reader reader = Files.newReader(csvFile, Charsets.UTF_8);
+ EmailFilterImportModel emailFilterImportModel = new EmailFilterImportModel(';', foldersByName);
+ try {
+ Import<MailFilter> importer = Import.newImport(emailFilterImportModel, reader);
+ try {
+ for (MailFilter emailFilter : importer) {
+ result.add(dao.create(emailFilter));
+ }
+ getPersistenceContext().commit();
+
+ } finally {
+ IOUtils.closeQuietly(importer);
+ }
+ reader.close();
+
+ } catch (IOException e) {
+ throw new IOException(t("faxtomail.service.referential.import.emailFilter.error", csvFile), e);
+
+ } catch (ImportRuntimeException e) {
+ String message;
+ if (e.getCause() != null) {
+ message = e.getCause().getMessage();
+ } else {
+ message = e.getMessage();
+ }
+ throw new ApplicationTechnicalException(message, e);
+
+ } finally {
+ IOUtils.closeQuietly(reader);
+ }
+ return result;
+ }
}
Added: trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/imports/EmailAccountImportModel.java
===================================================================
--- trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/imports/EmailAccountImportModel.java (rev 0)
+++ trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/imports/EmailAccountImportModel.java 2014-04-14 16:33:11 UTC (rev 35)
@@ -0,0 +1,29 @@
+package com.franciaflex.faxtomail.services.service.imports;
+
+import com.franciaflex.faxtomail.persistence.entities.EmailAccount;
+import com.franciaflex.faxtomail.persistence.entities.EmailAccountImpl;
+import org.nuiton.csv.ValueParser;
+import org.nuiton.csv.ext.AbstractImportModel;
+
+import java.text.ParseException;
+
+/**
+ * @author Kevin Morin (Code Lutin)
+ * @since x.x
+ */
+public class EmailAccountImportModel extends AbstractImportModel<EmailAccount> {
+
+ public EmailAccountImportModel(char separator) {
+ super(separator);
+
+ newMandatoryColumn("protocol", EmailAccount.PROPERTY_PROTOCOL);
+ newMandatoryColumn("host", EmailAccount.PROPERTY_HOST);
+ newMandatoryColumn("user", EmailAccount.PROPERTY_USER);
+ newMandatoryColumn("password", EmailAccount.PROPERTY_PASSWORD);
+ }
+
+ @Override
+ public EmailAccount newEmptyInstance() {
+ return new EmailAccountImpl();
+ }
+}
Added: trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/imports/EmailFilterImportModel.java
===================================================================
--- trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/imports/EmailFilterImportModel.java (rev 0)
+++ trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/imports/EmailFilterImportModel.java 2014-04-14 16:33:11 UTC (rev 35)
@@ -0,0 +1,42 @@
+package com.franciaflex.faxtomail.services.service.imports;
+
+import com.franciaflex.faxtomail.persistence.entities.EmailAccount;
+import com.franciaflex.faxtomail.persistence.entities.EmailAccountImpl;
+import com.franciaflex.faxtomail.persistence.entities.MailFilter;
+import com.franciaflex.faxtomail.persistence.entities.MailFilterImpl;
+import com.franciaflex.faxtomail.persistence.entities.MailFolder;
+import org.nuiton.csv.ValueParser;
+import org.nuiton.csv.ext.AbstractImportModel;
+
+import java.text.ParseException;
+import java.util.Map;
+
+/**
+ * @author Kevin Morin (Code Lutin)
+ * @since x.x
+ */
+public class EmailFilterImportModel extends AbstractImportModel<MailFilter> {
+
+ public EmailFilterImportModel(char separator, final Map<String, MailFolder> foldersByName) {
+ super(separator);
+
+ newMandatoryColumn("recipient", MailFilter.PROPERTY_EXPRESSION);
+ newMandatoryColumn("folder", MailFilter.PROPERTY_MAIL_FOLDER, new ValueParser<Object>() {
+ @Override
+ public Object parse(String value) throws ParseException {
+ return foldersByName.get(value);
+ }
+ });
+ newMandatoryColumn("position", MailFilter.PROPERTY_POSITION, new ValueParser<Object>() {
+ @Override
+ public Object parse(String value) throws ParseException {
+ return Integer.parseInt(value);
+ }
+ });
+ }
+
+ @Override
+ public MailFilter newEmptyInstance() {
+ return new MailFilterImpl();
+ }
+}
Modified: trunk/faxtomail-service/src/main/resources/i18n/faxtomail-service_en_GB.properties
===================================================================
--- trunk/faxtomail-service/src/main/resources/i18n/faxtomail-service_en_GB.properties 2014-04-14 14:02:52 UTC (rev 34)
+++ trunk/faxtomail-service/src/main/resources/i18n/faxtomail-service_en_GB.properties 2014-04-14 16:33:11 UTC (rev 35)
@@ -1,67 +0,0 @@
-faxtomail.config.option.basedir.description=
-faxtomail.config.option.csv.separator.description=
-faxtomail.config.option.data.directory.description=
-faxtomail.config.option.inceptionYear.description=
-faxtomail.config.option.organizationName.description=
-faxtomail.config.option.site.url.description=
-faxtomail.config.option.tmp.directory.description=
-faxtomail.config.option.version.description=
-faxtomail.config.service=
-faxtomail.email.projectReference.default=
-faxtomail.service.compressZipFile.error=
-faxtomail.service.config.deleteTempDirectory.error=
-faxtomail.service.mkDir.error=
-faxtomail.service.referential.import.clients.error=
-faxtomail.validator.error.email.clientCode.required=
-faxtomail.validator.error.email.demandType.required=
-faxtomail.validator.error.email.projectReference.required=
-tutti.config.option.basedir.description=
-tutti.config.option.csv.separator.description=
-tutti.config.option.inceptionYear.description=
-tutti.config.option.organizationName.description=
-tutti.config.option.site.url.description=
-tutti.config.option.tmp.directory.description=
-tutti.config.option.version.description=
-tutti.property.attachment=
-tutti.property.caracteristic=
-tutti.property.country=
-tutti.property.cruise=
-tutti.property.date=
-tutti.property.department=
-tutti.property.firstName=
-tutti.property.fishingOperation=
-tutti.property.fishingOperationLocation=
-tutti.property.fishingOperationNumber=
-tutti.property.fractionName=
-tutti.property.gear=
-tutti.property.gearShootingStartDate=
-tutti.property.genusSpecies=
-tutti.property.internationalRegistrationCode=
-tutti.property.label=
-tutti.property.lastName=
-tutti.property.marineLitterCategory=
-tutti.property.matrixName=
-tutti.property.methodName=
-tutti.property.multirigAggregation=
-tutti.property.name=
-tutti.property.parameterName=
-tutti.property.person=
-tutti.property.program=
-tutti.property.protocol=
-tutti.property.rankOrder=
-tutti.property.refTaxCode=
-tutti.property.sortedUnsortedCategory=
-tutti.property.species=
-tutti.property.stationNumber=
-tutti.property.strata=
-tutti.property.surveyCode=
-tutti.property.tuttiLocation=
-tutti.property.user=
-tutti.property.vessel=
-tutti.property.zone=
-tutti.propety.no.species.speciesCode=
-tutti.propety.no.vessel.name=
-tutti.propety.no.zone=
-tutti.propety.vessel.nation.registrationCode=
-tutti.service.compressZipFile.error=
-tutti.service.context.serviceInstanciation.error=
Modified: trunk/faxtomail-service/src/main/resources/i18n/faxtomail-service_fr_FR.properties
===================================================================
--- trunk/faxtomail-service/src/main/resources/i18n/faxtomail-service_fr_FR.properties 2014-04-14 14:02:52 UTC (rev 34)
+++ trunk/faxtomail-service/src/main/resources/i18n/faxtomail-service_fr_FR.properties 2014-04-14 16:33:11 UTC (rev 35)
@@ -1,5 +1,7 @@
faxtomail.email.projectReference.default=Votre demande du %s
faxtomail.service.referential.import.clients.error=
+faxtomail.service.referential.import.emailAccount.error=
+faxtomail.service.referential.import.emailFilter.error=
faxtomail.validator.error.email.clientCode.required=
faxtomail.validator.error.email.demandType.required=
faxtomail.validator.error.email.projectReference.required=
Added: trunk/faxtomail-service/src/test/java/com/franciaflex/faxtomail/services/service/AbstractFaxToMailServiceTest.java
===================================================================
--- trunk/faxtomail-service/src/test/java/com/franciaflex/faxtomail/services/service/AbstractFaxToMailServiceTest.java (rev 0)
+++ trunk/faxtomail-service/src/test/java/com/franciaflex/faxtomail/services/service/AbstractFaxToMailServiceTest.java 2014-04-14 16:33:11 UTC (rev 35)
@@ -0,0 +1,277 @@
+package com.franciaflex.faxtomail.services.service;
+
+/*
+ * #%L
+ * Extranet ENC-AHI :: Services
+ * $Id: AbstractExtranetEncAhiServiceTest.java 1134 2014-02-17 08:47:05Z sbavencoff $
+ * $HeadURL: http://svn.forge.codelutin.com/svn/extranet-enc-ahi/trunk/extranet-services… $
+ * %%
+ * Copyright (C) 2013 Ministère des Affaires sociales et de la Santé
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser 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 Lesser Public License for more details.
+ *
+ * You should have received a copy of the GNU General Lesser Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/lgpl-3.0.html>.
+ * #L%
+ */
+
+import com.franciaflex.faxtomail.FaxToMailConfiguration;
+import com.franciaflex.faxtomail.persistence.entities.FaxToMailTopiaApplicationContext;
+import com.franciaflex.faxtomail.persistence.entities.FaxToMailTopiaPersistenceContext;
+import com.franciaflex.faxtomail.services.FaxToMailService;
+import com.franciaflex.faxtomail.services.FaxToMailServiceContext;
+import org.apache.commons.lang3.SystemUtils;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.hibernate.cfg.Environment;
+import org.junit.After;
+import org.nuiton.util.FileUtil;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.HashMap;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+import java.util.UUID;
+
+public class AbstractFaxToMailServiceTest {
+
+ private static final Log log = LogFactory.getLog(AbstractFaxToMailServiceTest.class);
+
+ protected static final String DATABASE_REF = "DataBaseRef";
+
+ protected static FaxToMailConfiguration applicationConfig;
+
+ protected FaxToMailServiceContext serviceContext;
+
+ protected FaxToMailTopiaApplicationContext applicationContext;
+
+ protected List<FaxToMailTopiaPersistenceContext> openedTransactions = new LinkedList<>();
+
+ protected FaxToMailTopiaApplicationContext newApplicationContext(String dataBase) {
+
+ Map<String, String> hibernateH2Config = new HashMap<String, String>();
+
+ hibernateH2Config.putAll(getApplicationConfig().getTopiaProperties());
+
+ hibernateH2Config.put(Environment.DRIVER, org.h2.Driver.class.getName());
+ hibernateH2Config.put(Environment.USER, "sa");
+ hibernateH2Config.put(Environment.PASS, "");
+
+ File tempDirFile = SystemUtils.getJavaIoTmpDir();
+
+ File databaseFile = new File(tempDirFile, dataBase);
+
+ String h2dataPath = databaseFile.getAbsolutePath() + File.separator + "h2data-test";
+
+ String jdbcUrl = "jdbc:h2:file:" + h2dataPath;
+
+ hibernateH2Config.put(Environment.URL, jdbcUrl);
+
+ if (log.isTraceEnabled()) {
+ log.trace("will store H2 data in " + h2dataPath);
+ log.trace("allJpaParameters = " + hibernateH2Config);
+ }
+
+ if (log.isDebugEnabled()) {
+ log.debug("jdbc url is\n" + jdbcUrl);
+ }
+
+ FaxToMailTopiaApplicationContext applicationContext = new FaxToMailTopiaApplicationContext(hibernateH2Config);
+
+ if (log.isTraceEnabled()) {
+ log.trace("created root context " + applicationContext);
+ }
+
+ return applicationContext;
+ }
+
+ protected boolean isDatabaseWithReferential() {
+ return false;
+ }
+
+ protected FaxToMailTopiaApplicationContext getApplicationContext () {
+
+ String databaseName = UUID.randomUUID().toString();
+
+ if (isDatabaseWithReferential()) {
+
+ File tempDirFile = SystemUtils.getJavaIoTmpDir();
+
+ File databaseRefFile = new File(tempDirFile, DATABASE_REF);
+
+ if (!databaseRefFile.exists()) {
+
+ if (log.isTraceEnabled()) {
+ log.trace("create referential data base");
+ }
+
+ FaxToMailTopiaApplicationContext applicationContext = newApplicationContext(DATABASE_REF);
+
+ FaxToMailTopiaPersistenceContext persistenceContext;
+
+ persistenceContext = applicationContext.newPersistenceContext();
+
+ if (log.isTraceEnabled()) {
+ log.trace("opened transaction " + persistenceContext);
+ }
+
+ FaxToMailServiceContext serviceContext = new FaxToMailServiceContext();
+
+ serviceContext.setApplicationConfig(getApplicationConfig());
+
+ serviceContext.setPersistenceContext(persistenceContext);
+
+// serviceContext.setStorageFile(new File (tempDirFile, UUID.randomUUID().toString()));
+
+ InitFaxToMailService initExtranetService = serviceContext.newService(InitFaxToMailService.class);
+
+ initExtranetService.init();
+
+ if (log.isTraceEnabled()) {
+ log.trace("closing transaction " + persistenceContext);
+ }
+
+ persistenceContext.closeContext();
+
+ if (log.isTraceEnabled()) {
+ log.trace("closing transaction " + applicationContext);
+ }
+
+ applicationContext.closeContext();
+
+ File lockFile = new File(databaseRefFile, "h2data.lock.db");
+
+ int countWaiting = 0;
+
+ while (lockFile.exists() && countWaiting < 150) {
+ try {
+ Thread.sleep(200);
+ } catch (InterruptedException e) {
+ throw new RuntimeException("can't wait", e);
+ }
+ countWaiting++;
+ }
+
+ if (lockFile.exists()) {
+ throw new RuntimeException("database ref is not close after 30 seconds !");
+ }
+
+ }
+
+ File databaseFile = new File(tempDirFile, databaseName);
+
+ if (log.isTraceEnabled()) {
+ log.trace("Copy referential database to " + databaseFile.getName());
+ }
+
+ try {
+ FileUtil.copyAndRenameRecursively(databaseRefFile, databaseFile, false, null, null, false);
+ } catch (IOException e) {
+ throw new RuntimeException("can't copy database Ref", e);
+ }
+
+ if (log.isTraceEnabled()) {
+ log.trace("Copy referential database : Complete");
+ }
+ }
+
+ return newApplicationContext(databaseName);
+ }
+
+ protected FaxToMailTopiaPersistenceContext newPersistenceContext() {
+
+ if (applicationContext == null) {
+
+ applicationContext = getApplicationContext();
+
+ }
+
+ FaxToMailTopiaPersistenceContext persistenceContext;
+
+ persistenceContext = applicationContext.newPersistenceContext();
+
+ if (log.isTraceEnabled()) {
+ log.trace("opened transaction " + persistenceContext);
+ }
+
+ openedTransactions.add(persistenceContext);
+
+ return persistenceContext;
+
+ }
+
+ @After
+ public void tearDown() {
+
+ for (FaxToMailTopiaPersistenceContext openedTransaction : openedTransactions) {
+
+ if (log.isTraceEnabled()) {
+ log.trace("closing transaction " + openedTransaction);
+ }
+
+ openedTransaction.closeContext();
+
+ }
+
+ if (applicationContext != null) {
+
+ if (log.isTraceEnabled()) {
+ log.trace("closing transaction " + applicationContext);
+ }
+
+ applicationContext.closeContext();
+
+ }
+
+ }
+
+ protected static FaxToMailConfiguration getApplicationConfig() {
+
+ if (applicationConfig == null) {
+
+ applicationConfig = new FaxToMailConfiguration("faxToMail.properties");
+
+ }
+
+ return applicationConfig;
+
+ }
+
+ protected FaxToMailServiceContext getServiceContext() {
+
+ if (serviceContext == null) {
+
+ FaxToMailServiceContext serviceContext = new FaxToMailServiceContext();
+
+ serviceContext.setApplicationConfig(getApplicationConfig());
+
+ FaxToMailTopiaPersistenceContext persistenceContext = newPersistenceContext();
+
+ serviceContext.setPersistenceContext(persistenceContext);
+
+ this.serviceContext = serviceContext;
+
+ }
+
+ return serviceContext;
+
+ }
+
+ protected <E extends FaxToMailService> E newService(Class<E> serviceClass) {
+
+ return getServiceContext().newService(serviceClass);
+
+ }
+
+}
Added: trunk/faxtomail-service/src/test/java/com/franciaflex/faxtomail/services/service/MailFolderServiceTest.java
===================================================================
--- trunk/faxtomail-service/src/test/java/com/franciaflex/faxtomail/services/service/MailFolderServiceTest.java (rev 0)
+++ trunk/faxtomail-service/src/test/java/com/franciaflex/faxtomail/services/service/MailFolderServiceTest.java 2014-04-14 16:33:11 UTC (rev 35)
@@ -0,0 +1,35 @@
+package com.franciaflex.faxtomail.services.service;
+
+import com.franciaflex.faxtomail.persistence.entities.MailFolder;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+
+/**
+ * @author Kevin Morin (Code Lutin)
+ * @since x.x
+ */
+public class MailFolderServiceTest extends AbstractFaxToMailServiceTest {
+
+ private static final Log log = LogFactory.getLog(MailFolderServiceTest.class);
+
+ protected MailFolderService service;
+
+ @Before
+ public void setUp() {
+ service = newService(MailFolderService.class);
+ log.info("init sample data");
+ newService(InitFaxToMailService.class).initSampleData();
+ }
+
+ @Test
+ public void testFindFilter() {
+ log.info(service.getAllMailFolders());
+ MailFolder folder = service.getFolderForRecipient("fx.savtest(a)franciaflex.com");
+ Assert.assertNotNull(folder);
+ log.info(folder.getName());
+ }
+
+}
Modified: trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/MailFilterJob.java
===================================================================
--- trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/MailFilterJob.java 2014-04-14 14:02:52 UTC (rev 34)
+++ trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/MailFilterJob.java 2014-04-14 16:33:11 UTC (rev 35)
@@ -202,7 +202,7 @@
// log.debug(content);
// email.setContent(content);
- MailFolder mailFolder = serviceContext.newService(MailFolderService.class).getRandomFolder();
+ MailFolder mailFolder = serviceContext.newService(MailFolderService.class).getFolderForRecipient(email.getRecipient());
email.setMailFolder(mailFolder);
serviceContext.newService(EmailService.class).saveEmail(email, null);
1
0
14 Apr '14
See <http://ci.codelutin.com/jenkins/job/faxtomail-ci/22/changes>
Changes:
[kmorin] refs #4653 [TECH] Gestion des mails / fax entrants
------------------------------------------
[...truncated 37 lines...]
[INFO] FaxToMail :: Web
[INFO] FaxToMail :: UI
[INFO]
[INFO] Using the builder org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder with a thread count of 1
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building FaxToMail 0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ faxtomail ---
[INFO] Deleting <http://ci.codelutin.com/jenkins/job/faxtomail-ci/ws/trunk/target>
[INFO]
[INFO] --- maven-enforcer-plugin:1.3.1:enforce (check-project-files) @ faxtomail ---
[INFO]
[INFO] --- maven-antrun-plugin:1.7:run (generate-surefire-workdir) @ faxtomail ---
[INFO] Executing tasks
main:
[mkdir] Created dir: <http://ci.codelutin.com/jenkins/job/faxtomail-ci/ws/trunk/target/surefire-w…>
[INFO] Executed tasks
[INFO]
[INFO] --- maven-site-plugin:3.3:attach-descriptor (attach-descriptor) @ faxtomail ---
[JENKINS] Archiving disabled
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building FaxToMail :: Persistence 0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO] Downloading: http://nexus.nuiton.org/nexus/content/groups/faxtomail-group/org/nuiton/nui…
[INFO] Downloading: http://nexus.nuiton.org/nexus/content/repositories/snapshots/org/nuiton/nui…
[INFO] Downloaded: http://nexus.nuiton.org/nexus/content/repositories/snapshots/org/nuiton/nui… (2 KB at 12.7 KB/sec)
[INFO] Downloaded: http://nexus.nuiton.org/nexus/content/groups/faxtomail-group/org/nuiton/nui… (2 KB at 12.7 KB/sec)
[INFO] Downloading: http://nexus.nuiton.org/nexus/content/repositories/snapshots/org/nuiton/jax…
[INFO] Downloading: http://nexus.nuiton.org/nexus/content/groups/faxtomail-group/org/nuiton/jax…
[INFO] Downloaded: http://nexus.nuiton.org/nexus/content/repositories/snapshots/org/nuiton/jax… (2 KB at 34.8 KB/sec)
[INFO] Downloaded: http://nexus.nuiton.org/nexus/content/groups/faxtomail-group/org/nuiton/jax… (2 KB at 32.0 KB/sec)
[INFO] Downloading: http://nexus.nuiton.org/nexus/content/repositories/snapshots/org/nuiton/jax…
[INFO] Downloading: http://nexus.nuiton.org/nexus/content/groups/faxtomail-group/org/nuiton/jax…
[INFO] Downloaded: http://nexus.nuiton.org/nexus/content/repositories/snapshots/org/nuiton/jax… (805 B at 30.2 KB/sec)
[INFO] Downloaded: http://nexus.nuiton.org/nexus/content/groups/faxtomail-group/org/nuiton/jax… (805 B at 16.0 KB/sec)
[INFO]
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ faxtomail-persistence ---
[INFO] Deleting <http://ci.codelutin.com/jenkins/job/faxtomail-ci/ws/trunk/faxtomail-persist…>
[INFO]
[INFO] --- maven-enforcer-plugin:1.3.1:enforce (check-project-files) @ faxtomail-persistence ---
[INFO]
[INFO] --- eugene-maven-plugin:2.7.4:generate (generate-entities) @ faxtomail-persistence ---
[INFO] Process phase [zargo] for one entry.
[INFO] Expanding 1 xmi file(s) from <http://ci.codelutin.com/jenkins/job/faxtomail-ci/ws/trunk/faxtomail-persist…>
[INFO] Will generate <http://ci.codelutin.com/jenkins/job/faxtomail-ci/ws/trunk/faxtomail-persist…>
[INFO] Copy file <http://ci.codelutin.com/jenkins/job/faxtomail-ci/ws/trunk/faxtomail-persist…> to <http://ci.codelutin.com/jenkins/job/faxtomail-ci/ws/trunk/faxtomail-persist…>
[INFO] Generate one file in 12.417ms.
[INFO] Process phase [xmi] for one entry.
[INFO] Processing XSL tranformation on <http://ci.codelutin.com/jenkins/job/faxtomail-ci/ws/trunk/faxtomail-persist…> for 1 file(s).
[INFO] Will generate <http://ci.codelutin.com/jenkins/job/faxtomail-ci/ws/trunk/faxtomail-persist…>
[INFO] Copy file <http://ci.codelutin.com/jenkins/job/faxtomail-ci/ws/trunk/faxtomail-persist…> to <http://ci.codelutin.com/jenkins/job/faxtomail-ci/ws/trunk/faxtomail-persist…>
[INFO] Generate one file in 760.525ms.
[INFO] Process phase [model] for one entry.
WARN [pool-1-thread-1 for channel] (AbstractObjectModelReader.java:126) beforeReadFile - No properties provider filled, will instanciate a new default one
WARN [pool-1-thread-1 for channel] (AbstractObjectModelReader.java:294) loadModelTagValue - Invalid model tag value [model.tagValue.java.lang.String] : the tagvalue 'java.lang.String' is unkown.
WARN [pool-1-thread-1 for channel] (AbstractObjectModelReader.java:303) loadModelTagValue - Invalid model tag value [model.tagValue.useEnumerationName] : this tagvalue 'useEnumerationName' can not be apply on the model.
INFO [pool-1-thread-1 for channel] (AbstractObjectModelReader.java:270) loadModelProperties - 5 tag values were succesfull imported from <http://ci.codelutin.com/jenkins/job/faxtomail-ci/ws/trunk/faxtomail-persist…>
[INFO] No file generated.
[INFO] Apply generator JavaInterfaceTransformer
[INFO] Apply generator TopiaMetaTransformer
INFO [pool-1-thread-1 for channel] (ObjectModelTransformerToJava.java:998) isInClassPath - Will not generate [com.franciaflex.faxtomail.persistence.entities.EmailTopiaDao], already found in class-path.
[INFO] Add compile source root : <http://ci.codelutin.com/jenkins/job/faxtomail-ci/ws/trunk/faxtomail-persist…>
[INFO] Add resource root :Resource {targetPath: null, filtering: false, FileSet {directory: <http://ci.codelutin.com/jenkins/job/faxtomail-ci/ws/trunk/faxtomail-persist…,> PatternSet [includes: {}, excludes: {**/*.java}]}}
[INFO]
[INFO] --- i18n-maven-plugin:3.0:parserJava (scan-sources) @ faxtomail-persistence ---
[INFO]
[INFO] >>> i18n-maven-plugin:3.0:gen (scan-sources) @ faxtomail-persistence >>>
[INFO]
[INFO] --- i18n-maven-plugin:3.0:get (get) @ faxtomail-persistence ---
[INFO] Copying faxtomail-persistence.properties to <http://ci.codelutin.com/jenkins/job/faxtomail-ci/ws/trunk/faxtomail-persist…>
[INFO] Copying faxtomail-persistence.properties to <http://ci.codelutin.com/jenkins/job/faxtomail-ci/ws/trunk/faxtomail-persist…>
[INFO]
[INFO] <<< i18n-maven-plugin:3.0:gen (scan-sources) @ faxtomail-persistence <<<
[INFO]
[INFO] --- i18n-maven-plugin:3.0:gen (scan-sources) @ faxtomail-persistence ---
[WARNING] bundle fr_FR contains 28/41 empty entries! (use -Di18n.showEmpty to see these entries)
[WARNING] bundle en_GB contains 42/42 empty entries! (use -Di18n.showEmpty to see these entries)
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ faxtomail-persistence ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 4 resources
[INFO] Copying 19 resources
[INFO]
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ faxtomail-persistence ---
[INFO] Compiling 128 source files to <http://ci.codelutin.com/jenkins/job/faxtomail-ci/ws/trunk/faxtomail-persist…>
[WARNING] <http://ci.codelutin.com/jenkins/job/faxtomail-ci/ws/trunk/faxtomail-persist…>: Some input files use unchecked or unsafe operations.
[WARNING] <http://ci.codelutin.com/jenkins/job/faxtomail-ci/ws/trunk/faxtomail-persist…>: Recompile with -Xlint:unchecked for details.
[INFO]
[INFO] --- maven-antrun-plugin:1.7:run (generate-surefire-workdir) @ faxtomail-persistence ---
[INFO] Executing tasks
main:
[mkdir] Created dir: <http://ci.codelutin.com/jenkins/job/faxtomail-ci/ws/trunk/faxtomail-persist…>
[INFO] Executed tasks
[INFO]
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ faxtomail-persistence ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory <http://ci.codelutin.com/jenkins/job/faxtomail-ci/ws/trunk/faxtomail-persist…>
[INFO]
[INFO] --- maven-compiler-plugin:3.1:testCompile (default-testCompile) @ faxtomail-persistence ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-surefire-plugin:2.16:test (default-test) @ faxtomail-persistence ---
[INFO] No tests to run.
[JENKINS] Recording test results
[INFO]
[INFO] --- maven-jar-plugin:2.4:jar (default-jar) @ faxtomail-persistence ---
[INFO] Building jar: <http://ci.codelutin.com/jenkins/job/faxtomail-ci/ws/trunk/faxtomail-persist…>
[INFO]
[INFO] --- maven-site-plugin:3.3:attach-descriptor (attach-descriptor) @ faxtomail-persistence ---
[JENKINS] Archiving disabled
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building FaxToMail :: Service 0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ faxtomail-service ---
[INFO] Deleting <http://ci.codelutin.com/jenkins/job/faxtomail-ci/ws/trunk/faxtomail-service…>
[INFO]
[INFO] --- maven-enforcer-plugin:1.3.1:enforce (check-project-files) @ faxtomail-service ---
[INFO]
[INFO] --- i18n-maven-plugin:3.0:parserJava (scan-sources) @ faxtomail-service ---
[INFO]
[INFO] --- i18n-maven-plugin:3.0:parserValidation (scan-sources) @ faxtomail-service ---
[INFO] Load rules file validation.rules
[INFO]
[INFO] >>> i18n-maven-plugin:3.0:gen (scan-sources) @ faxtomail-service >>>
[INFO]
[INFO] --- i18n-maven-plugin:3.0:get (get) @ faxtomail-service ---
[INFO] Copying faxtomail-service.properties to <http://ci.codelutin.com/jenkins/job/faxtomail-ci/ws/trunk/faxtomail-service…>
[INFO] Copying faxtomail-service.properties to <http://ci.codelutin.com/jenkins/job/faxtomail-ci/ws/trunk/faxtomail-service…>
[INFO]
[INFO] <<< i18n-maven-plugin:3.0:gen (scan-sources) @ faxtomail-service <<<
[INFO]
[INFO] --- i18n-maven-plugin:3.0:gen (scan-sources) @ faxtomail-service ---
[WARNING] bundle fr_FR contains 4/5 empty entries! (use -Di18n.showEmpty to see these entries)
[WARNING] bundle en_GB contains 67/67 empty entries! (use -Di18n.showEmpty to see these entries)
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ faxtomail-service ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 4 resources
[INFO]
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ faxtomail-service ---
[INFO] Compiling 15 source files to <http://ci.codelutin.com/jenkins/job/faxtomail-ci/ws/trunk/faxtomail-service…>
[INFO] -------------------------------------------------------------
[WARNING] COMPILATION WARNING :
[INFO] -------------------------------------------------------------
[WARNING] <http://ci.codelutin.com/jenkins/job/faxtomail-ci/ws/trunk/faxtomail-service…>: <http://ci.codelutin.com/jenkins/job/faxtomail-ci/ws/trunk/faxtomail-service…> uses unchecked or unsafe operations.
[WARNING] <http://ci.codelutin.com/jenkins/job/faxtomail-ci/ws/trunk/faxtomail-service…>: Recompile with -Xlint:unchecked for details.
[INFO] 2 warnings
[INFO] -------------------------------------------------------------
[INFO] -------------------------------------------------------------
[ERROR] COMPILATION ERROR :
[INFO] -------------------------------------------------------------
[ERROR] <http://ci.codelutin.com/jenkins/job/faxtomail-ci/ws/trunk/faxtomail-service…>:[33,50] cannot find symbol
symbol: class MailFilterService
location: package com.franciaflex.faxtomail.services.service
[ERROR] <http://ci.codelutin.com/jenkins/job/faxtomail-ci/ws/trunk/faxtomail-service…>:[84,12] cannot find symbol
symbol: class MailFilterService
location: class com.franciaflex.faxtomail.services.FaxToMailServiceSupport
[ERROR] <http://ci.codelutin.com/jenkins/job/faxtomail-ci/ws/trunk/faxtomail-service…>:[85,27] cannot find symbol
symbol: class MailFilterService
location: class com.franciaflex.faxtomail.services.FaxToMailServiceSupport
[INFO] 3 errors
[INFO] -------------------------------------------------------------
[JENKINS] Archiving disabled
[JENKINS] Archiving disabled
[JENKINS] Archiving disabled
[JENKINS] Archiving disabled
[JENKINS] Archiving disabled
[JENKINS] Archiving disabled
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO]
[INFO] FaxToMail ......................................... SUCCESS [ 2.420 s]
[INFO] FaxToMail :: Persistence .......................... SUCCESS [ 7.375 s]
[INFO] FaxToMail :: Service .............................. FAILURE [ 1.568 s]
[INFO] FaxToMail :: Web .................................. SKIPPED
[INFO] FaxToMail :: UI ................................... SKIPPED
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 12.602 s
[INFO] Finished at: 2014-04-14T15:55:56+01:00
[INFO] Final Memory: 40M/586M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) on project faxtomail-service: Compilation failure: Compilation failure:
[ERROR] <http://ci.codelutin.com/jenkins/job/faxtomail-ci/ws/trunk/faxtomail-service…>:[33,50] cannot find symbol
[ERROR] symbol: class MailFilterService
[ERROR] location: package com.franciaflex.faxtomail.services.service
[ERROR] <http://ci.codelutin.com/jenkins/job/faxtomail-ci/ws/trunk/faxtomail-service…>:[84,12] cannot find symbol
[ERROR] symbol: class MailFilterService
[ERROR] location: class com.franciaflex.faxtomail.services.FaxToMailServiceSupport
[ERROR] <http://ci.codelutin.com/jenkins/job/faxtomail-ci/ws/trunk/faxtomail-service…>:[85,27] cannot find symbol
[ERROR] symbol: class MailFilterService
[ERROR] location: class com.franciaflex.faxtomail.services.FaxToMailServiceSupport
[ERROR] -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) on project faxtomail-service: Compilation failure
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:212)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:108)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:76)
at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:116)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:361)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:155)
at org.jvnet.hudson.maven3.launcher.Maven31Launcher.main(Maven31Launcher.java:132)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchStandard(Launcher.java:330)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:238)
at jenkins.maven3.agent.Maven31Main.launch(Maven31Main.java:181)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at hudson.maven.Maven3Builder.call(Maven3Builder.java:134)
at hudson.maven.Maven3Builder.call(Maven3Builder.java:69)
at hudson.remoting.UserRequest.perform(UserRequest.java:118)
at hudson.remoting.UserRequest.perform(UserRequest.java:48)
at hudson.remoting.Request$2.run(Request.java:328)
at hudson.remoting.InterceptingExecutorService$1.call(InterceptingExecutorService.java:72)
at java.util.concurrent.FutureTask.run(FutureTask.java:262)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:744)
Caused by: org.apache.maven.plugin.compiler.CompilationFailureException: Compilation failure
at org.apache.maven.plugin.compiler.AbstractCompilerMojo.execute(AbstractCompilerMojo.java:858)
at org.apache.maven.plugin.compiler.CompilerMojo.execute(CompilerMojo.java:129)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:133)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208)
... 30 more
[ERROR]
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException
[ERROR]
[ERROR] After correcting the problems, you can resume the build with the command
[ERROR] mvn <goals> -rf :faxtomail-service
Sending e-mails to: faxtomail-commits(a)list.forge.codelutin.com morin(a)codelutin.com
channel stopped
1
1
Build failed in Jenkins: faxtomail-ci » FaxToMail :: Service #22
by admin+ci-codelutin.com@codelutin.com 14 Apr '14
by admin+ci-codelutin.com@codelutin.com 14 Apr '14
14 Apr '14
See <http://ci.codelutin.com/jenkins/job/faxtomail-ci/com.franciaflex.faxtomail$…>
Changes:
[kmorin] refs #4653 [TECH] Gestion des mails / fax entrants
------------------------------------------
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building FaxToMail :: Service 0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ faxtomail-service ---
[INFO] Deleting <http://ci.codelutin.com/jenkins/job/faxtomail-ci/com.franciaflex.faxtomail$…>
[INFO]
[INFO] --- maven-enforcer-plugin:1.3.1:enforce (check-project-files) @ faxtomail-service ---
[INFO]
[INFO] --- i18n-maven-plugin:3.0:parserJava (scan-sources) @ faxtomail-service ---
[INFO]
[INFO] --- i18n-maven-plugin:3.0:parserValidation (scan-sources) @ faxtomail-service ---
[INFO] Load rules file validation.rules
[INFO]
[INFO] >>> i18n-maven-plugin:3.0:gen (scan-sources) @ faxtomail-service >>>
[INFO]
[INFO] --- i18n-maven-plugin:3.0:get (get) @ faxtomail-service ---
[INFO] Copying faxtomail-service.properties to <http://ci.codelutin.com/jenkins/job/faxtomail-ci/com.franciaflex.faxtomail$…>
[INFO] Copying faxtomail-service.properties to <http://ci.codelutin.com/jenkins/job/faxtomail-ci/com.franciaflex.faxtomail$…>
[INFO]
[INFO] <<< i18n-maven-plugin:3.0:gen (scan-sources) @ faxtomail-service <<<
[INFO]
[INFO] --- i18n-maven-plugin:3.0:gen (scan-sources) @ faxtomail-service ---
[WARNING] bundle fr_FR contains 4/5 empty entries! (use -Di18n.showEmpty to see these entries)
[WARNING] bundle en_GB contains 67/67 empty entries! (use -Di18n.showEmpty to see these entries)
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ faxtomail-service ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 4 resources
[INFO]
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ faxtomail-service ---
[INFO] Compiling 15 source files to <http://ci.codelutin.com/jenkins/job/faxtomail-ci/com.franciaflex.faxtomail$…>
[INFO] -------------------------------------------------------------
[WARNING] COMPILATION WARNING :
[INFO] -------------------------------------------------------------
[WARNING] <http://ci.codelutin.com/jenkins/job/faxtomail-ci/com.franciaflex.faxtomail$…>: <http://ci.codelutin.com/jenkins/job/faxtomail-ci/com.franciaflex.faxtomail$…> uses unchecked or unsafe operations.
[WARNING] <http://ci.codelutin.com/jenkins/job/faxtomail-ci/com.franciaflex.faxtomail$…>: Recompile with -Xlint:unchecked for details.
[INFO] 2 warnings
[INFO] -------------------------------------------------------------
[INFO] -------------------------------------------------------------
[ERROR] COMPILATION ERROR :
[INFO] -------------------------------------------------------------
[ERROR] <http://ci.codelutin.com/jenkins/job/faxtomail-ci/com.franciaflex.faxtomail$…>:[33,50] cannot find symbol
symbol: class MailFilterService
location: package com.franciaflex.faxtomail.services.service
[ERROR] <http://ci.codelutin.com/jenkins/job/faxtomail-ci/com.franciaflex.faxtomail$…>:[84,12] cannot find symbol
symbol: class MailFilterService
location: class com.franciaflex.faxtomail.services.FaxToMailServiceSupport
[ERROR] <http://ci.codelutin.com/jenkins/job/faxtomail-ci/com.franciaflex.faxtomail$…>:[85,27] cannot find symbol
symbol: class MailFilterService
location: class com.franciaflex.faxtomail.services.FaxToMailServiceSupport
[INFO] 3 errors
[INFO] -------------------------------------------------------------
[JENKINS] Archiving disabled
1
1
r34 - trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services
by kmorin@users.forge.codelutin.com 14 Apr '14
by kmorin@users.forge.codelutin.com 14 Apr '14
14 Apr '14
Author: kmorin
Date: 2014-04-14 16:02:52 +0200 (Mon, 14 Apr 2014)
New Revision: 34
Url: http://forge.codelutin.com/projects/faxtomail/repository/revisions/34
Log:
fix build
Modified:
trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/FaxToMailServiceSupport.java
Modified: trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/FaxToMailServiceSupport.java
===================================================================
--- trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/FaxToMailServiceSupport.java 2014-04-14 13:43:16 UTC (rev 33)
+++ trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/FaxToMailServiceSupport.java 2014-04-14 14:02:52 UTC (rev 34)
@@ -30,7 +30,6 @@
import com.franciaflex.faxtomail.services.service.ConfigurationService;
import com.franciaflex.faxtomail.services.service.EmailService;
import com.franciaflex.faxtomail.services.service.FaxToMailWebApplicationContext;
-import com.franciaflex.faxtomail.services.service.MailFilterService;
import com.franciaflex.faxtomail.services.service.MailFolderService;
import com.franciaflex.faxtomail.services.service.ReferentielService;
@@ -81,10 +80,6 @@
return newService(MailFolderService.class);
}
- public MailFilterService getMailFilterService() {
- return newService(MailFilterService.class);
- }
-
public EmailService getEmailService() {
return newService(EmailService.class);
}
1
0
r33 - in trunk: . faxtomail-persistence/src/main/xmi faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande faxtomail-ui-web faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web faxtomail-ui-web/src/main/resources
by kmorin@users.forge.codelutin.com 14 Apr '14
by kmorin@users.forge.codelutin.com 14 Apr '14
14 Apr '14
Author: kmorin
Date: 2014-04-14 15:43:16 +0200 (Mon, 14 Apr 2014)
New Revision: 33
Url: http://forge.codelutin.com/projects/faxtomail/repository/revisions/33
Log:
refs #4653 [TECH] Gestion des mails / fax entrants
Added:
trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/MailFilterJob.java
trunk/faxtomail-ui-web/src/main/resources/quartz.properties
Removed:
trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/MailFilterService.java
Modified:
trunk/faxtomail-persistence/src/main/xmi/faxtomail.zargo
trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/CompanyService.java
trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/ConfigurationService.java
trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/EmailService.java
trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/InitFaxToMailService.java
trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/MailFolderService.java
trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeUI.css
trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeUI.jaxx
trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeUIHandler.java
trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeUIModel.java
trunk/faxtomail-ui-web/
trunk/faxtomail-ui-web/pom.xml
trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/FaxToMailApplicationListener.java
trunk/pom.xml
Modified: trunk/faxtomail-persistence/src/main/xmi/faxtomail.zargo
===================================================================
(Binary files differ)
Modified: trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/CompanyService.java
===================================================================
--- trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/CompanyService.java 2014-04-10 12:18:23 UTC (rev 32)
+++ trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/CompanyService.java 2014-04-14 13:43:16 UTC (rev 33)
@@ -3,7 +3,10 @@
import com.franciaflex.faxtomail.persistence.entities.Company;
import com.franciaflex.faxtomail.persistence.entities.CompanyTopiaDao;
import com.franciaflex.faxtomail.persistence.entities.Configuration;
+import com.franciaflex.faxtomail.persistence.entities.EmailAccount;
+import com.franciaflex.faxtomail.persistence.entities.EmailAccountTopiaDao;
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.services.FaxToMailServiceSupport;
import com.google.common.base.Function;
@@ -63,8 +66,7 @@
filter.setMailFolder(folder);
}
}
- MailFilterService mailFilterService = getMailFilterService();
- Collection<MailFilter> filters = mailFilterService.saveMailFilters(mailFilters.keySet());
+ Collection<MailFilter> filters = saveMailFilters(mailFilters.keySet());
company.setMailFilter(filters);
CompanyTopiaDao dao = getPersistenceContext().getCompanyDao();
@@ -74,4 +76,35 @@
return company;
}
+
+ public Collection<MailFilter> saveMailFilters(Collection<MailFilter> mailFilters) {
+ MailFilterTopiaDao dao = getPersistenceContext().getMailFilterDao();
+
+ Collection<MailFilter> result = new ArrayList<>();
+ for (MailFilter mailFilter : mailFilters) {
+
+ MailFilter filter;
+ boolean create = mailFilter.getTopiaId() == null;
+ if (create) {
+ filter = dao.newInstance();
+ } else {
+ filter = dao.findByTopiaId(mailFilter.getTopiaId());
+ }
+ filter.setExpression(mailFilter.getExpression());
+ filter.setMailFolder(mailFilter.getMailFolder());
+
+ if (create) {
+ filter = dao.create(filter);
+ } else {
+ filter = dao.update(filter);
+ }
+ result.add(filter);
+ }
+ return result;
+ }
+
+ public Collection<EmailAccount> getEmailAccounts() {
+ EmailAccountTopiaDao emailAccountTopiaDao = getPersistenceContext().getEmailAccountDao();
+ return new ArrayList<>(emailAccountTopiaDao.findAll());
+ }
}
Modified: trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/ConfigurationService.java
===================================================================
--- trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/ConfigurationService.java 2014-04-10 12:18:23 UTC (rev 32)
+++ trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/ConfigurationService.java 2014-04-14 13:43:16 UTC (rev 33)
@@ -3,12 +3,16 @@
import com.franciaflex.faxtomail.persistence.entities.CompanyTopiaDao;
import com.franciaflex.faxtomail.persistence.entities.Configuration;
import com.franciaflex.faxtomail.persistence.entities.ConfigurationTopiaDao;
+import com.franciaflex.faxtomail.persistence.entities.MailFilter;
+import com.franciaflex.faxtomail.persistence.entities.MailFilterTopiaDao;
import com.franciaflex.faxtomail.services.FaxToMailServiceSupport;
import com.google.common.collect.Lists;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.nuiton.topia.persistence.TopiaIdFactory;
+import java.util.ArrayList;
+import java.util.Collection;
import java.util.List;
/**
Modified: trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/EmailService.java
===================================================================
--- trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/EmailService.java 2014-04-10 12:18:23 UTC (rev 32)
+++ trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/EmailService.java 2014-04-14 13:43:16 UTC (rev 33)
@@ -43,10 +43,6 @@
private static final Log log = LogFactory.getLog(EmailService.class);
- public Email getRandomEmail() {
- return getPersistenceContext().getEmailDao().forArchiveDateEquals(null).findAny();
- }
-
public Email getEmailById(String id) {
Email email = getPersistenceContext().getEmailDao().findByTopiaId(id);
return email;
Modified: trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/InitFaxToMailService.java
===================================================================
--- trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/InitFaxToMailService.java 2014-04-10 12:18:23 UTC (rev 32)
+++ trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/InitFaxToMailService.java 2014-04-14 13:43:16 UTC (rev 33)
@@ -33,6 +33,8 @@
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.EmailAccount;
+import com.franciaflex.faxtomail.persistence.entities.EmailAccountTopiaDao;
import com.franciaflex.faxtomail.persistence.entities.EmailTopiaDao;
import com.franciaflex.faxtomail.persistence.entities.EtatAttente;
import com.franciaflex.faxtomail.persistence.entities.EtatAttenteTopiaDao;
@@ -62,11 +64,16 @@
import org.nuiton.jaxx.application.ApplicationTechnicalException;
import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URL;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Collections;
import java.util.Date;
import java.util.List;
+import java.util.Properties;
import java.util.Random;
import static org.nuiton.i18n.I18n.t;
@@ -138,16 +145,7 @@
long count = demandTypeDao.count();
if (count == 0) {
- List<Client> clients;
- try {
- File clientFile = new File(ClassLoader.getSystemResource("fx_clients.csv").toURI());
- clients = getReferentielService().importClients(clientFile);
- } catch(Exception e) {
- log.error("error", e);
- return;
- }
-
List<DemandType> types = Lists.newArrayList(
demandTypeDao.create(DemandType.PROPERTY_LABEL, "Commande"),
demandTypeDao.create(DemandType.PROPERTY_LABEL, "Commande Réponse"),
@@ -243,31 +241,16 @@
MailFolder.PROPERTY_ETAT_ATTENTE, etatAttentes.subList(0, random.nextInt(etatAttenteSize - 8) + 2));
chargesClientelle.addChildren(cyrilFolder);
- int r = random.nextInt(10) + 5;
- for (int i = 0 ; i < r ; i++) {
- createEmail(random, historyDao, rangeRowDao, emailDao, ranges, clients, types, priorities, cyrilFolder, cyril);
- }
-
MailFolder claireFolder = folderDao.create(MailFolder.PROPERTY_NAME, "Claire",
MailFolder.PROPERTY_PARENT, chargesClientelle);
chargesClientelle.addChildren(claireFolder);
- r = random.nextInt(10) + 5;
- for (int i = 0 ; i < r ; i++) {
- createEmail(random, historyDao, rangeRowDao, emailDao, ranges, clients, types, priorities, claireFolder, claire);
- }
-
Collections.shuffle(etatAttentes);
MailFolder agatheFolder = folderDao.create(MailFolder.PROPERTY_NAME, "Agathe",
MailFolder.PROPERTY_PARENT, chargesClientelle,
MailFolder.PROPERTY_ETAT_ATTENTE, etatAttentes.subList(0, random.nextInt(etatAttenteSize - 8) + 2));
chargesClientelle.addChildren(agatheFolder);
- r = random.nextInt(10) + 5;
- for (int i = 0 ; i < r ; i++) {
- createEmail(random, historyDao, rangeRowDao, emailDao, ranges, clients, types, priorities, agatheFolder, agathe);
- }
-
MailFolder sav = folderDao.create(MailFolder.PROPERTY_NAME, "SAV",
MailFolder.PROPERTY_ETAT_ATTENTE, etatAttentes.subList(0, random.nextInt(etatAttenteSize - 8) + 2));
folders.add(sav);
@@ -276,47 +259,83 @@
MailFolder.PROPERTY_PARENT, sav);
sav.addChildren(marcFolder);
- r = random.nextInt(10) + 5;
- for (int i = 0 ; i < r ; i++) {
- createEmail(random, historyDao, rangeRowDao, emailDao, ranges, clients, types, priorities, marcFolder, marc);
- }
-
MailFolder fredericFolder = folderDao.create(MailFolder.PROPERTY_NAME, "Frédéric",
MailFolder.PROPERTY_PARENT, sav);
sav.addChildren(fredericFolder);
- r = random.nextInt(10) + 5;
- for (int i = 0 ; i < r ; i++) {
- createEmail(random, historyDao, rangeRowDao, emailDao, ranges, clients, types, priorities, fredericFolder, frederic);
- }
-
MailFolder jeanneFolder = folderDao.create(MailFolder.PROPERTY_NAME, "Jeanne",
MailFolder.PROPERTY_PARENT, sav);
sav.addChildren(jeanneFolder);
- r = random.nextInt(10) + 5;
- for (int i = 0 ; i < r ; i++) {
- createEmail(random, historyDao, rangeRowDao, emailDao, ranges, clients, types, priorities, jeanneFolder, jeanne);
- }
- Collections.shuffle(etatAttentes);
-
// companies
CompanyTopiaDao companyTopiaDao = getPersistenceContext().getCompanyDao();
ConfigurationTopiaDao configurationTopiaDao = getPersistenceContext().getConfigurationDao();
- companyTopiaDao.create(Company.PROPERTY_NAME, "Franciaflex", Company.PROPERTY_CONFIGURATION, configurationTopiaDao.create(), Company.PROPERTY_MAIL_FOLDER, folders);
+ Company fx = companyTopiaDao.create(Company.PROPERTY_NAME, "Franciaflex", Company.PROPERTY_CONFIGURATION, configurationTopiaDao.create(), Company.PROPERTY_MAIL_FOLDER, folders);
companyTopiaDao.create(Company.PROPERTY_NAME, "Faber", Company.PROPERTY_CONFIGURATION, configurationTopiaDao.create());
companyTopiaDao.create(Company.PROPERTY_NAME, "France Fermeture", Company.PROPERTY_CONFIGURATION, configurationTopiaDao.create());
+ try {
+ URL mailAccountsPropertiesURL = ClassLoader.getSystemResource("mail_accounts.properties");
+ if (mailAccountsPropertiesURL != null) {
+ InputStream mailAccountStream = new FileInputStream(mailAccountsPropertiesURL.getPath());
+ Properties properties = new Properties();
+ properties.load(mailAccountStream);
+ String protocol = (String) properties.get("mail.protocol");
+ String host = (String) properties.get("mail.host");
+ String user = (String) properties.get("mail.user");
+ String password = (String) properties.get("mail.password");
+
+ EmailAccountTopiaDao emailAccountTopiaDao = getPersistenceContext().getEmailAccountDao();
+ EmailAccount emailAccount = emailAccountTopiaDao.create(EmailAccount.PROPERTY_PROTOCOL, protocol,
+ EmailAccount.PROPERTY_HOST, host,
+ EmailAccount.PROPERTY_USER, user,
+ EmailAccount.PROPERTY_PASSWORD, password);
+ fx.addEmailAccount(emailAccount);
+ companyTopiaDao.update(fx);
+ }
+
+ } catch(IOException e) {
+ log.error("error getting the email accounts", e);
+ return;
+ }
+
FaxToMailUserGroupTopiaDao userGroupDao = getPersistenceContext().getFaxToMailUserGroupDao();
userGroupDao.create(FaxToMailUserGroup.PROPERTY_NAME, "Chargés de clientèle");
userGroupDao.create(FaxToMailUserGroup.PROPERTY_NAME, "Commerciaux");
userGroupDao.create(FaxToMailUserGroup.PROPERTY_NAME, "SAV");
userGroupDao.create(FaxToMailUserGroup.PROPERTY_NAME, "Administrateurs");
+ try {
+ URL fxClientsURL = ClassLoader.getSystemResource("fx_clients.csv");
+ if (fxClientsURL != null) {
+ File clientFile = new File(fxClientsURL.toURI());
+ List<Client> clients = getReferentielService().importClients(clientFile);
+
+ createEmails(random, historyDao, rangeRowDao, emailDao, ranges, clients, types, priorities, cyrilFolder, cyril);
+ createEmails(random, historyDao, rangeRowDao, emailDao, ranges, clients, types, priorities, claireFolder, claire);
+ createEmails(random, historyDao, rangeRowDao, emailDao, ranges, clients, types, priorities, agatheFolder, agathe);
+ createEmails(random, historyDao, rangeRowDao, emailDao, ranges, clients, types, priorities, marcFolder, marc);
+ createEmails(random, historyDao, rangeRowDao, emailDao, ranges, clients, types, priorities, fredericFolder, frederic);
+ createEmails(random, historyDao, rangeRowDao, emailDao, ranges, clients, types, priorities, jeanneFolder, jeanne);
+ }
+
+ } catch(Exception e) {
+ log.error("error getting the client file", e);
+ }
+
getPersistenceContext().commit();
}
}
+ protected void createEmails(Random random, HistoryTopiaDao historyDao, RangeRowTopiaDao rangeRowDao, EmailTopiaDao emailDao,
+ List<Range> ranges, List<Client> clients, List<DemandType> types, List<Priority> priorities,
+ MailFolder folder, FaxToMailUser user) {
+ int r = random.nextInt(10) + 5;
+ for (int i = 0 ; i < r ; i++) {
+ createEmail(random, historyDao, rangeRowDao, emailDao, ranges, clients, types, priorities, folder, user);
+ }
+ }
+
protected void createEmail(Random random,
HistoryTopiaDao historyDao,
RangeRowTopiaDao rangeRowDao,
Deleted: trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/MailFilterService.java
===================================================================
--- trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/MailFilterService.java 2014-04-10 12:18:23 UTC (rev 32)
+++ trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/MailFilterService.java 2014-04-14 13:43:16 UTC (rev 33)
@@ -1,41 +0,0 @@
-package com.franciaflex.faxtomail.services.service;
-
-import com.franciaflex.faxtomail.persistence.entities.MailFilter;
-import com.franciaflex.faxtomail.persistence.entities.MailFilterTopiaDao;
-import com.franciaflex.faxtomail.services.FaxToMailServiceSupport;
-
-import java.util.ArrayList;
-import java.util.Collection;
-
-/**
- * @author kmorin <kmorin(a)codelutin.com>
- * @since x.x
- */
-public class MailFilterService extends FaxToMailServiceSupport {
-
- public Collection<MailFilter> saveMailFilters(Collection<MailFilter> mailFilters) {
- MailFilterTopiaDao dao = getPersistenceContext().getMailFilterDao();
-
- Collection<MailFilter> result = new ArrayList<>();
- for (MailFilter mailFilter : mailFilters) {
-
- MailFilter filter;
- boolean create = mailFilter.getTopiaId() == null;
- if (create) {
- filter = dao.newInstance();
- } else {
- filter = dao.findByTopiaId(mailFilter.getTopiaId());
- }
- filter.setExpression(mailFilter.getExpression());
- filter.setMailFolder(mailFilter.getMailFolder());
-
- if (create) {
- filter = dao.create(filter);
- } else {
- filter = dao.update(filter);
- }
- result.add(filter);
- }
- return result;
- }
-}
Modified: trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/MailFolderService.java
===================================================================
--- trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/MailFolderService.java 2014-04-10 12:18:23 UTC (rev 32)
+++ trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/MailFolderService.java 2014-04-14 13:43:16 UTC (rev 33)
@@ -1,5 +1,6 @@
package com.franciaflex.faxtomail.services.service;
+import com.franciaflex.faxtomail.persistence.entities.Email;
import com.franciaflex.faxtomail.persistence.entities.EtatAttente;
import com.franciaflex.faxtomail.persistence.entities.MailFolder;
import com.franciaflex.faxtomail.persistence.entities.MailFolderTopiaDao;
@@ -24,6 +25,11 @@
private static final Log log = LogFactory.getLog(MailFolderService.class);
+
+ public MailFolder getRandomFolder() {
+ return getPersistenceContext().getMailFolderDao().forParentEquals(null).findAny();
+ }
+
public List<MailFolder> getAllMailFolders() {
MailFolderTopiaDao dao = getPersistenceContext().getMailFolderDao();
return new ArrayList<MailFolder>(dao.findAll());
Modified: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeUI.css
===================================================================
--- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeUI.css 2014-04-10 12:18:23 UTC (rev 32)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeUI.css 2014-04-14 13:43:16 UTC (rev 33)
@@ -154,6 +154,7 @@
#mailBodyField {
editable: false;
+ text: { model.getContent() };
}
#takenByLabel {
Modified: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeUI.jaxx
===================================================================
--- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeUI.jaxx 2014-04-10 12:18:23 UTC (rev 32)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeUI.jaxx 2014-04-14 13:43:16 UTC (rev 33)
@@ -293,7 +293,7 @@
constraints="BorderLayout.NORTH"/>
<JScrollPane id='mailBodyPane'
constraints="BorderLayout.CENTER">
- <JEditorPane id='mailBodyField'/>
+ <JTextPane id='mailBodyField'/>
</JScrollPane>
</JPanel>
<JPanel layout="{new BorderLayout()}">
Modified: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeUIHandler.java
===================================================================
--- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeUIHandler.java 2014-04-10 12:18:23 UTC (rev 32)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeUIHandler.java 2014-04-14 13:43:16 UTC (rev 33)
@@ -60,9 +60,15 @@
import org.nuiton.util.beans.BeanMonitor;
import javax.swing.*;
+import javax.swing.event.HyperlinkEvent;
+import javax.swing.event.HyperlinkListener;
import javax.swing.event.ListSelectionEvent;
import javax.swing.event.ListSelectionListener;
import javax.swing.table.TableCellEditor;
+import javax.swing.text.Document;
+import javax.swing.text.Style;
+import javax.swing.text.StyleConstants;
+import javax.swing.text.StyleContext;
import javax.swing.text.html.HTMLEditorKit;
import java.awt.*;
import java.awt.event.KeyAdapter;
@@ -134,26 +140,37 @@
}
initBeanFilterableComboBox(ui.getEtatAttenteComboBox(), etatAttentes, model.getEtatAttente());
- JEditorPane editor = ui.getMailBodyField();
- HTMLEditorKit htmlEditorKit = new HTMLEditorKit();
- editor.setEditorKit(htmlEditorKit);
-// create some simple html as a string
- String htmlString = "<html>\n"
- + "<body>\n"
- + "<script>document.getElementById('test').innerHTML = 'chaussette'</script>"
- + "<h1 id='test'>Welcome!</h1>\n"
- + "<h2>This is an H2 header</h2><br/>"
- + "<p>This is some sample text</p>\n"
- + "<p><a href=\"http://devdaily.com/blog/\">devdaily blog</a></p>\n"
- + "<p><img src=\"http://jarnal.wikispaces.com/space/showlogo/1301230030/logo.png\"/></p>\n"
- + "</body>\n";
+ JTextPane editor = ui.getMailBodyField();
+ String content = model.getContent();
- htmlString = htmlString.replaceAll("<img src=\"(.*?)\"(/>|>.*?</img>)", "[image : $1]");
- htmlString = htmlString.replaceAll("<a href=\"(.*?)\">(.*?)</a>", "[$2 : $1]");
+ if (model.getContentType() != null) {
+ editor.setContentType(model.getContentType());
-// create a document, set it on the jeditorpane, then add the html
- editor.setText(htmlString);
+ if (model.getContentType().contains("text/html")) {
+ HTMLEditorKit htmlEditorKit = new HTMLEditorKit();
+ editor.setEditorKit(htmlEditorKit);
+ editor.addHyperlinkListener(new HyperlinkListener() {
+ @Override
+ public void hyperlinkUpdate(HyperlinkEvent e) {
+ if (e.getEventType() == HyperlinkEvent.EventType.ACTIVATED) {
+ FaxToMailUIUtil.openLink(e.getURL());
+ }
+ }
+ });
+ for (Attachment attachment : model.getAttachment()) {
+ File file = attachment.getOriginalFile();
+ log.info("file " + file.getName());
+ String key = file.getName();
+ // the meta tag makes the content is not displayed
+ content = content.replaceAll("<meta (.*?)>(</meta>)?", "");
+ // replace the inline attachments with the extracted attachment file url
+ content = content.replaceAll("<img src=\"cid:" + key + "\"(.*?>)", "<img src=\"file://" + file.getAbsolutePath() + "\"$1");
+ }
+ }
+ }
+ editor.setText(content);
+
// init table
final JXTable table = ui.getRangeTable();
Modified: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeUIModel.java
===================================================================
--- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeUIModel.java 2014-04-10 12:18:23 UTC (rev 32)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeUIModel.java 2014-04-14 13:43:16 UTC (rev 33)
@@ -189,6 +189,26 @@
return editObject.getObject();
}
+ public String getContent() {
+ return editObject.getContent();
+ }
+
+ public void setContent(String content) {
+ Object oldValue = getContent();
+ editObject.setContent(content);
+ firePropertyChanged(Email.PROPERTY_CONTENT, oldValue, content);
+ }
+
+ public String getContentType() {
+ return editObject.getContentType();
+ }
+
+ public void setContentType(String contentType) {
+ Object oldValue = getContentType();
+ editObject.setContentType(contentType);
+ firePropertyChanged(Email.PROPERTY_CONTENT_TYPE, oldValue, contentType);
+ }
+
public void setClientCode(String clientCode) {
Object oldValue = getClientCode();
Client client = editObject.getClient();
Property changes on: trunk/faxtomail-ui-web
___________________________________________________________________
Added: svn:ignore
+ target
*.iml
Modified: trunk/faxtomail-ui-web/pom.xml
===================================================================
--- trunk/faxtomail-ui-web/pom.xml 2014-04-10 12:18:23 UTC (rev 32)
+++ trunk/faxtomail-ui-web/pom.xml 2014-04-14 13:43:16 UTC (rev 33)
@@ -171,6 +171,16 @@
<scope>runtime</scope>
</dependency>
+ <dependency>
+ <groupId>org.quartz-scheduler</groupId>
+ <artifactId>quartz</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>javax.mail</groupId>
+ <artifactId>mail</artifactId>
+ </dependency>
+
</dependencies>
<build>
Modified: trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/FaxToMailApplicationListener.java
===================================================================
--- trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/FaxToMailApplicationListener.java 2014-04-10 12:18:23 UTC (rev 32)
+++ trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/FaxToMailApplicationListener.java 2014-04-14 13:43:16 UTC (rev 33)
@@ -25,8 +25,20 @@
*/
import com.franciaflex.faxtomail.FaxToMailApplicationContext;
+import com.franciaflex.faxtomail.persistence.entities.FaxToMailTopiaPersistenceContext;
+import com.franciaflex.faxtomail.persistence.entities.MailFilter;
+import com.franciaflex.faxtomail.services.FaxToMailServiceContext;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
+import org.quartz.CronScheduleBuilder;
+import org.quartz.JobBuilder;
+import org.quartz.JobDataMap;
+import org.quartz.JobDetail;
+import org.quartz.Scheduler;
+import org.quartz.SchedulerException;
+import org.quartz.Trigger;
+import org.quartz.TriggerBuilder;
+import org.quartz.impl.StdSchedulerFactory;
import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;
@@ -44,6 +56,8 @@
log.info("init FaxToMail web ui");
}
+ log.debug("scheduler lanuched");
+
applicationContext = new FaxToMailApplicationContext();
applicationContext.init();
@@ -52,6 +66,35 @@
FaxToMailApplicationContext.APPLICATION_CONTEXT_PARAMETER,
applicationContext);
+ JobDataMap data = new JobDataMap();
+
+ FaxToMailTopiaPersistenceContext persistenceContext = applicationContext.newPersistenceContext();
+ FaxToMailServiceContext serviceContext = applicationContext.newServiceContext(persistenceContext);
+ data.put(MailFilterJob.SERVICE_CONTEXT, serviceContext);
+
+ JobDetail job = JobBuilder.newJob(MailFilterJob.class)
+ .usingJobData(data)
+ .withIdentity("faxToMailJobs", "job1")
+ .build();
+
+ try {
+ Trigger trigger = TriggerBuilder
+ .newTrigger()
+ .withIdentity("mailFiltering", "trigger1")
+// .withSchedule(CronScheduleBuilder.cronSchedule("* 0/1 * * * ?"))
+ .withSchedule(CronScheduleBuilder.cronSchedule("0/20 * * * * ?"))
+ .build();
+
+ Scheduler scheduler = new StdSchedulerFactory().getScheduler();
+ scheduler.start();
+ scheduler.scheduleJob(job, trigger);
+
+ log.debug("scheduler launched");
+
+ } catch (SchedulerException e) {
+ log.error("Error while launching the mail filter job", e);
+ }
+
}
@Override
Added: trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/MailFilterJob.java
===================================================================
--- trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/MailFilterJob.java (rev 0)
+++ trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/MailFilterJob.java 2014-04-14 13:43:16 UTC (rev 33)
@@ -0,0 +1,269 @@
+package com.franciaflex.faxtomail.web;
+
+import com.franciaflex.faxtomail.persistence.entities.Attachment;
+import com.franciaflex.faxtomail.persistence.entities.AttachmentImpl;
+import com.franciaflex.faxtomail.persistence.entities.DemandStatus;
+import com.franciaflex.faxtomail.persistence.entities.Email;
+import com.franciaflex.faxtomail.persistence.entities.EmailAccount;
+import com.franciaflex.faxtomail.persistence.entities.EmailImpl;
+import com.franciaflex.faxtomail.persistence.entities.MailFolder;
+import com.franciaflex.faxtomail.services.DecoratorService;
+import com.franciaflex.faxtomail.services.FaxToMailServiceContext;
+import com.franciaflex.faxtomail.services.service.CompanyService;
+import com.franciaflex.faxtomail.services.service.EmailService;
+import com.franciaflex.faxtomail.services.service.MailFolderService;
+import org.apache.commons.io.FileUtils;
+import org.apache.commons.io.IOUtils;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.nuiton.decorator.Decorator;
+import org.quartz.Job;
+import org.quartz.JobExecutionContext;
+import org.quartz.JobExecutionException;
+
+import javax.activation.DataHandler;
+import javax.activation.DataSource;
+import javax.mail.Address;
+import javax.mail.BodyPart;
+import javax.mail.Flags;
+import javax.mail.Folder;
+import javax.mail.Message;
+import javax.mail.MessagingException;
+import javax.mail.Part;
+import javax.mail.Session;
+import javax.mail.Store;
+import javax.mail.URLName;
+import javax.mail.internet.MimeMultipart;
+import java.io.File;
+import java.io.FileOutputStream;
+import java.util.Collection;
+import java.util.Date;
+import java.util.Properties;
+
+import static org.nuiton.i18n.I18n.t;
+
+/**
+ * @author Kevin Morin (Code Lutin)
+ * @since x.x
+ */
+public class MailFilterJob implements Job {
+
+ private static final Log log = LogFactory.getLog(MailFilterJob.class);
+
+ public static final String SERVICE_CONTEXT = "serviceContext";
+
+ protected FaxToMailServiceContext serviceContext;
+
+ //TODO kmorin 20140414 handle imap protocol
+ @Override
+ public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
+ serviceContext = (FaxToMailServiceContext) jobExecutionContext.getMergedJobDataMap().get(SERVICE_CONTEXT);
+
+ CompanyService companyService = serviceContext.newService(CompanyService.class);
+ Collection<EmailAccount> emailAccounts = companyService.getEmailAccounts();
+
+ for (EmailAccount account : emailAccounts) {
+ if ("pop3".equals(account.getProtocol().toLowerCase())) {
+ checkEmailsOnPop3(account);
+ }
+ }
+ }
+
+ /**
+ * Checks the emails of the account
+ * @param account
+ */
+ public void checkEmailsOnPop3(EmailAccount account) {
+ Properties properties = new Properties();
+ properties.setProperty("mail.store.protocol", "pop3");
+ properties.setProperty("mail.pop3.host", account.getHost());
+ properties.setProperty("mail.pop3.user", account.getUser());
+
+
+ Session session = Session.getInstance(properties);
+ Store store = null;
+ Folder defaultFolder = null;
+ Folder inbox = null;
+
+ try {
+ store = session.getStore(new URLName("pop3://" + account.getHost()));
+ store.connect(account.getUser(), account.getPassword());
+ defaultFolder = store.getDefaultFolder();
+ inbox = defaultFolder.getFolder("INBOX");
+ checkEmailsOfFolder(inbox);
+
+ } catch (Exception e) {
+ log.error("Error while getting emails from the mailbox", e);
+
+ } finally {
+ close(inbox);
+ close(defaultFolder);
+ try {
+ if (store != null && store.isConnected()) {
+ store.close();
+ }
+ } catch (MessagingException e) {
+ log.error("Error while closing the store", e);
+ }
+ }
+
+ }
+
+ protected void close(Folder folder) {
+ if (folder != null && folder.isOpen()) {
+ try {
+ // TODO 20140414 kmorin close(true) in production
+ folder.close(false); // false -> On n'efface pas les messages marqués DELETED
+
+ } catch (Exception e) {
+ log.error("Error while closing the folder", e);
+ }
+ }
+ }
+
+ /**
+ * Check the emails of teh folder, create the emails in the database and delete the email in the folder
+ * @param folder the folder to check
+ */
+ protected void checkEmailsOfFolder(Folder folder) {
+ try {
+ folder.open(Folder.READ_WRITE);
+
+ int count = folder.getMessageCount();
+ int unread = folder.getUnreadMessageCount();
+
+ log.debug(count + " messages, " + unread + " unread");
+
+ for (int i = 0 ; i < count ; i++ ) {
+ Email email = new EmailImpl();
+
+ int messageNumber = count - i;
+ Message message = folder.getMessage(messageNumber);
+
+ log.debug("Message n°" + messageNumber);
+ log.debug("Object: " + message.getSubject());
+ email.setObject(message.getSubject());
+
+ log.debug("Sender: ");
+ Address[] addresses = message.getFrom();
+ if (addresses != null) {
+ for (Address address : addresses) {
+ email.setSender(address.toString());
+ }
+ }
+
+ log.debug("Recipients: ");
+ addresses = message.getRecipients(Message.RecipientType.TO);
+ if (addresses != null) {
+ for (Address address : addresses) {
+ log.debug("\tTo : " + address);
+ email.setRecipient(address.toString());
+ }
+ }
+
+ addresses = message.getRecipients(Message.RecipientType.CC);
+ if (addresses != null) {
+ for (Address address : addresses) {
+ log.debug("\tCopy : " + address);
+ }
+ }
+
+ email.setReceptionDate(message.getReceivedDate());
+
+ Date now = new Date();
+
+ DecoratorService decoratorService = serviceContext.newService(DecoratorService.class);
+ Decorator<Date> dateDecorator = decoratorService.getDecoratorByType(Date.class, DecoratorService.DATE);
+ String projectRef = t("faxtomail.email.projectReference.default", dateDecorator.toString(now));
+ email.setProjectReference(projectRef);
+
+ email.setDemandStatus(DemandStatus.UNTREATED);
+
+ String originalContent = IOUtils.toString(message.getInputStream());
+ email.setOriginalEmail(originalContent);
+
+ log.debug("ContentType: " + message.getContentType());
+
+ if (message.isMimeType("multipart/*")) {
+ decomposeMultipartEmail(message, email);
+
+ } else {
+ String content = IOUtils.toString(message.getInputStream());
+ email.setContent(content);
+ email.setContentType(message.getContentType());
+ }
+
+ log.debug("Content: ");
+ log.debug(email.getContent());
+
+// content = content.replaceAll("<img src=\"(.*?)\"(/>|>.*?</img>)", "[image : $1]");
+// content = content.replaceAll("<a href=\"(.*?)\">(.*?)</a>", "[$2 : $1]");
+// log.debug("Content : ");
+// log.debug(content);
+// email.setContent(content);
+
+ MailFolder mailFolder = serviceContext.newService(MailFolderService.class).getRandomFolder();
+ email.setMailFolder(mailFolder);
+
+ serviceContext.newService(EmailService.class).saveEmail(email, null);
+
+ message.setFlag(Flags.Flag.DELETED, true);
+ }
+
+ } catch (Exception e) {
+ log.error("Error while reading the emails", e);
+ }
+ }
+
+ /**
+ * Decompose a multipart part.
+ * - sets the email content if the part contains a text bodypart
+ * - adds attachments to the email
+ *
+ * @param part the part to decompose
+ * @param email the email object to fill with the attachments or content
+ * @throws Exception
+ */
+ protected void decomposeMultipartEmail(Part part, Email email) throws Exception {
+ DataSource dataSource = part.getDataHandler().getDataSource();
+ MimeMultipart mimeMultipart = new MimeMultipart(dataSource);
+ int multiPartCount = mimeMultipart.getCount();
+
+ for (int j = 0; j < multiPartCount; j++) {
+ BodyPart bp = mimeMultipart.getBodyPart(j);
+
+ // if it is a text part, the,n this is the email content
+ if (bp.isMimeType("text/*")) {
+ String content = IOUtils.toString(bp.getInputStream());
+ email.setContent(content);
+ email.setContentType(bp.getContentType());
+
+ // if it is multipart part, decompose it
+ } else if (bp.isMimeType("multipart/*")) {
+ decomposeMultipartEmail(bp, email);
+
+ // else, this is an attachment
+ } else {
+ String fileName = bp.getFileName();
+ log.debug("FileName : " + fileName);
+ if (fileName == null) {
+ fileName = bp.getHeader("Content-ID")[0];
+ // remove the guillemets between the id
+ fileName = fileName.replaceFirst("^<(.*)>$", "$1");
+ }
+
+ File file = new File(FileUtils.getTempDirectory(), fileName);
+ FileOutputStream fos = new FileOutputStream(file);
+
+ DataHandler dh = bp.getDataHandler();
+ dh.writeTo(fos);
+
+ Attachment attachment = new AttachmentImpl();
+ attachment.setAddedByUser(false);
+ attachment.setOriginalFile(file);
+ email.addAttachment(attachment);
+ }
+ }
+ }
+
+}
Added: trunk/faxtomail-ui-web/src/main/resources/quartz.properties
===================================================================
--- trunk/faxtomail-ui-web/src/main/resources/quartz.properties (rev 0)
+++ trunk/faxtomail-ui-web/src/main/resources/quartz.properties 2014-04-14 13:43:16 UTC (rev 33)
@@ -0,0 +1,3 @@
+org.quartz.scheduler.instanceName = FaxToMailScheduler
+org.quartz.threadPool.threadCount = 3
+org.quartz.jobStore.class = org.quartz.simpl.RAMJobStore
\ No newline at end of file
Modified: trunk/pom.xml
===================================================================
--- trunk/pom.xml 2014-04-10 12:18:23 UTC (rev 32)
+++ trunk/pom.xml 2014-04-14 13:43:16 UTC (rev 33)
@@ -495,6 +495,18 @@
<scope>compile</scope>
</dependency>
+ <dependency>
+ <groupId>org.quartz-scheduler</groupId>
+ <artifactId>quartz</artifactId>
+ <version>2.2.1</version>
+ </dependency>
+
+ <dependency>
+ <groupId>javax.mail</groupId>
+ <artifactId>mail</artifactId>
+ <version>1.4.7</version>
+ </dependency>
+
<!--<dependency>-->
<!--<groupId>net.atlanticbb.tantlinger</groupId>-->
<!--<artifactId>shef</artifactId>-->
1
0
10 Apr '14
Author: kmorin
Date: 2014-04-10 14:18:23 +0200 (Thu, 10 Apr 2014)
New Revision: 32
Url: http://forge.codelutin.com/projects/faxtomail/repository/revisions/32
Log:
fixes #4668 [ECRAN] Grouper
Added:
trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/GroupAction.java
trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/SearchToGroupAction.java
trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/attachment/
trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demandgroup/
trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demandgroup/ButtonEmailGroup.java
trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demandgroup/DemandGroupItem.css
trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demandgroup/DemandGroupItem.jaxx
trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demandgroup/DemandGroupUI.css
trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demandgroup/DemandGroupUI.jaxx
trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demandgroup/DemandGroupUIHandler.java
trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/history/
trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/pdfeditor/
trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/pdfeditor/PDFEditorCrossUI.css
trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/pdfeditor/PDFEditorCrossUI.jaxx
trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/pdfeditor/PDFEditorNoteUI.css
trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/pdfeditor/PDFEditorNoteUI.jaxx
trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/pdfeditor/PDFEditorUI.css
trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/pdfeditor/PDFEditorUI.jaxx
trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/pdfeditor/PDFEditorUIHandler.java
trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/pdfeditor/PDFEditorUIModel.java
trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/search/SearchToGroupUI.css
trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/search/SearchToGroupUI.jaxx
trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/search/SearchToGroupUIHandler.java
trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/transmit/
trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/transmit/MailFolderChooserUI.css
trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/transmit/MailFolderChooserUI.jaxx
trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/transmit/MailFolderChooserUIHandler.java
Removed:
trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/attachment/PDFEditorCrossUI.css
trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/attachment/PDFEditorCrossUI.jaxx
trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/attachment/PDFEditorNoteUI.css
trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/attachment/PDFEditorNoteUI.jaxx
trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/attachment/PDFEditorUI.css
trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/attachment/PDFEditorUI.jaxx
trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/attachment/PDFEditorUIHandler.java
trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/attachment/PDFEditorUIModel.java
trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/MailFolderChooserUI.css
trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/MailFolderChooserUI.jaxx
trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/MailFolderChooserUIHandler.java
trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/history/HistoryListUIModel.java
trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/attachment/
trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/history/
Modified:
trunk/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/persistence/entities/HistoryType.java
trunk/faxtomail-persistence/src/main/resources/i18n/faxtomail-persistence_en_GB.properties
trunk/faxtomail-persistence/src/main/resources/i18n/faxtomail-persistence_fr_FR.properties
trunk/faxtomail-persistence/src/main/xmi/faxtomail.zargo
trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/EmailService.java
trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/FaxToMailUIContext.java
trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/AbstractChangeScreenAction.java
trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/GenerateAnnotatedAttachmentAction.java
trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/SaveDemandeAction.java
trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/ShowDemandeAction.java
trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/TransmitAction.java
trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/attachment/AttachmentCellEditor.java
trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/attachment/AttachmentCellRenderer.java
trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/attachment/AttachmentEditorUI.css
trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/attachment/AttachmentEditorUIHandler.java
trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/attachment/AttachmentEditorUIModel.java
trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/attachment/AttachmentItem.css
trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/attachment/AttachmentModelAware.java
trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/attachment/ButtonAttachment.java
trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeUI.jaxx
trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeUIHandler.java
trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeUIModel.java
trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/history/ButtonHistory.java
trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/history/HistoryItemModel.java
trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/history/HistoryListUI.jaxx
trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/history/HistoryListUIHandler.java
trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/reply/ReplyFormUI.jaxx
trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/reply/ReplyFormUIHandler.java
trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/reply/ReplyFormUIModel.java
trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/search/SearchUI.css
trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/search/SearchUI.jaxx
trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/search/SearchUIHandler.java
trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/search/SearchUIModel.java
trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/AbstractFaxToMailDemandListHandler.java
trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/AbstractFaxToMailUIHandler.java
trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/FaxToMailUIUtil.java
trunk/faxtomail-ui-swing/src/main/resources/i18n/faxtomail-ui-swing_en_GB.properties
trunk/faxtomail-ui-swing/src/main/resources/i18n/faxtomail-ui-swing_fr_FR.properties
trunk/pom.xml
Modified: trunk/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/persistence/entities/HistoryType.java
===================================================================
--- trunk/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/persistence/entities/HistoryType.java 2014-04-07 14:02:17 UTC (rev 31)
+++ trunk/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/persistence/entities/HistoryType.java 2014-04-10 12:18:23 UTC (rev 32)
@@ -39,6 +39,7 @@
REPLY(n("faxtomail.historyType.reply")),
PRINTING(n("faxtomail.historyType.printing")),
ARCHIVED(n("faxtomail.historyType.archive")),
+ GROUP(n("faxtomail.historyType.group")),
ATTACHMENT_OPENING(n("faxtomail.historyType.attachmentOpening")),
ATTACHMENT_MODIFICATION(n("faxtomail.historyType.attachmentModification"));
Modified: trunk/faxtomail-persistence/src/main/resources/i18n/faxtomail-persistence_en_GB.properties
===================================================================
--- trunk/faxtomail-persistence/src/main/resources/i18n/faxtomail-persistence_en_GB.properties 2014-04-07 14:02:17 UTC (rev 31)
+++ trunk/faxtomail-persistence/src/main/resources/i18n/faxtomail-persistence_en_GB.properties 2014-04-10 12:18:23 UTC (rev 32)
@@ -30,6 +30,7 @@
faxtomail.historyType.attachmentModification=
faxtomail.historyType.attachmentOpening=
faxtomail.historyType.creation=
+faxtomail.historyType.group=
faxtomail.historyType.modification=
faxtomail.historyType.opening=
faxtomail.historyType.printing=
Modified: trunk/faxtomail-persistence/src/main/resources/i18n/faxtomail-persistence_fr_FR.properties
===================================================================
--- trunk/faxtomail-persistence/src/main/resources/i18n/faxtomail-persistence_fr_FR.properties 2014-04-07 14:02:17 UTC (rev 31)
+++ trunk/faxtomail-persistence/src/main/resources/i18n/faxtomail-persistence_fr_FR.properties 2014-04-10 12:18:23 UTC (rev 32)
@@ -29,6 +29,7 @@
faxtomail.historyType.attachmentModification=Modification de pièce jointe
faxtomail.historyType.attachmentOpening=Ouverture de pièce jointe
faxtomail.historyType.creation=Création
+faxtomail.historyType.group=
faxtomail.historyType.modification=Modification
faxtomail.historyType.opening=Ouverture
faxtomail.historyType.printing=Impression
Modified: trunk/faxtomail-persistence/src/main/xmi/faxtomail.zargo
===================================================================
(Binary files differ)
Modified: trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/EmailService.java
===================================================================
--- trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/EmailService.java 2014-04-07 14:02:17 UTC (rev 31)
+++ trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/EmailService.java 2014-04-10 12:18:23 UTC (rev 32)
@@ -4,6 +4,9 @@
import com.franciaflex.faxtomail.persistence.entities.AttachmentTopiaDao;
import com.franciaflex.faxtomail.persistence.entities.DemandStatus;
import com.franciaflex.faxtomail.persistence.entities.Email;
+import com.franciaflex.faxtomail.persistence.entities.EmailGroup;
+import com.franciaflex.faxtomail.persistence.entities.EmailGroupImpl;
+import com.franciaflex.faxtomail.persistence.entities.EmailGroupTopiaDao;
import com.franciaflex.faxtomail.persistence.entities.EmailTopiaDao;
import com.franciaflex.faxtomail.persistence.entities.FaxToMailUser;
import com.franciaflex.faxtomail.persistence.entities.History;
@@ -13,6 +16,7 @@
import com.franciaflex.faxtomail.persistence.entities.RangeRow;
import com.franciaflex.faxtomail.persistence.entities.RangeRowTopiaDao;
import com.franciaflex.faxtomail.services.FaxToMailServiceSupport;
+import com.google.common.collect.Lists;
import com.google.common.collect.Sets;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -39,6 +43,10 @@
private static final Log log = LogFactory.getLog(EmailService.class);
+ public Email getRandomEmail() {
+ return getPersistenceContext().getEmailDao().forArchiveDateEquals(null).findAny();
+ }
+
public Email getEmailById(String id) {
Email email = getPersistenceContext().getEmailDao().findByTopiaId(id);
return email;
@@ -186,6 +194,7 @@
.addContainsText(Email.PROPERTY_SENDER, emailLike.getSender())
// .addContainsText(Email.PROPERTY_CLIENT_CODE, emailLike.getClientCode())
.addContainsText(Email.PROPERTY_PROJECT_REFERENCE, emailLike.getProjectReference())
+ .addContainsText(Email.PROPERTY_COMPANY_REFERENCE, emailLike.getCompanyReference())
.addEqualsIfNotNull(Email.PROPERTY_TAKEN_BY, emailLike.getTakenBy())
.addEqualsIfNotNull(Email.PROPERTY_DEMAND_TYPE, emailLike.getDemandType())
.addEqualsIfNotNull(Email.PROPERTY_PRIORITY, emailLike.getPriority())
@@ -194,4 +203,62 @@
.findAll());
return result;
}
+
+ public Email groupEmails(Email email1, Email email2, FaxToMailUser user) {
+ EmailGroupTopiaDao groupDao = getPersistenceContext().getEmailGroupDao();
+
+ EmailGroup group1 = email1.getEmailGroup();
+ EmailGroup group2 = email2.getEmailGroup();
+
+ // if both groups are null
+ if (group1 == null && group2 == null) {
+ EmailGroup group = groupDao.create(EmailGroup.PROPERTY_EMAIL, Lists.newArrayList(email1, email2));
+ email1.setEmailGroup(group);
+ email2.setEmailGroup(group);
+
+ // if only group 1 is null
+ } else if (group1 == null) {
+ email1.setEmailGroup(group2);
+ group2.addEmail(email1);
+ groupDao.update(group2);
+
+ // if only group 2 is null
+ } else if (group2 == null) {
+ email2.setEmailGroup(group1);
+ group1.addEmail(email2);
+ groupDao.update(group1);
+
+ // if the groups are equals, do nothing
+ } else if (group1.equals(group2)) {
+ return email1;
+
+ // if both groups exist, merge them
+ } else {
+ group1.addAllEmail(group2.getEmail());
+ email2.setEmailGroup(group1);
+ group2.clearEmail();
+ groupDao.delete(group2);
+ groupDao.update(group1);
+ }
+
+ EmailTopiaDao emailDao = getPersistenceContext().getEmailDao();
+ HistoryTopiaDao historyDao = getPersistenceContext().getHistoryDao();
+ Date now = new Date();
+
+ email1.addHistory(historyDao.create(History.PROPERTY_TYPE, HistoryType.GROUP,
+ History.PROPERTY_FAX_TO_MAIL_USER, user,
+ History.PROPERTY_FIELDS, Sets.newHashSet(email2.getObject()),
+ History.PROPERTY_MODIFICATION_DATE, now));
+ Email result = emailDao.update(email1);
+
+ email2.addHistory(historyDao.create(History.PROPERTY_TYPE, HistoryType.GROUP,
+ History.PROPERTY_FAX_TO_MAIL_USER, user,
+ History.PROPERTY_FIELDS, Sets.newHashSet(email1.getObject()),
+ History.PROPERTY_MODIFICATION_DATE, now));
+ emailDao.update(email2);
+
+ getPersistenceContext().commit();
+
+ return result;
+ }
}
Modified: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/FaxToMailUIContext.java
===================================================================
--- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/FaxToMailUIContext.java 2014-04-07 14:02:17 UTC (rev 31)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/FaxToMailUIContext.java 2014-04-10 12:18:23 UTC (rev 32)
@@ -194,6 +194,8 @@
private ApplicationActionUI actionUI;
+ private JFrame secondaryFrame;
+
/**
* Flag to know if there is an exsiting db.
*
@@ -569,6 +571,14 @@
this.mainUI = mainUI;
}
+ public JFrame getSecondaryFrame() {
+ return secondaryFrame;
+ }
+
+ public void setSecondaryFrame(JFrame secondaryFrame) {
+ this.secondaryFrame = secondaryFrame;
+ }
+
@Override
public ApplicationActionUI getActionUI() {
return actionUI;
Modified: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/AbstractChangeScreenAction.java
===================================================================
--- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/AbstractChangeScreenAction.java 2014-04-07 14:02:17 UTC (rev 31)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/AbstractChangeScreenAction.java 2014-04-10 12:18:23 UTC (rev 32)
@@ -93,7 +93,8 @@
if (getUI() != null) {
if (previousScreen == null) {
PREVIOUS_SCREEN.removeContextValue(getUI());
- } else {
+
+ } else if (screen != previousScreen) {
PREVIOUS_SCREEN.setContextValue(getUI(), previousScreen);
}
}
Modified: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/GenerateAnnotatedAttachmentAction.java
===================================================================
--- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/GenerateAnnotatedAttachmentAction.java 2014-04-07 14:02:17 UTC (rev 31)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/GenerateAnnotatedAttachmentAction.java 2014-04-10 12:18:23 UTC (rev 32)
@@ -1,13 +1,13 @@
package com.franciaflex.faxtomail.ui.swing.actions;
+import com.franciaflex.faxtomail.ui.swing.content.pdfeditor.PDFEditorCrossUI;
+import com.franciaflex.faxtomail.ui.swing.content.pdfeditor.PDFEditorNoteUI;
+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;
import com.franciaflex.faxtomail.ui.swing.util.FaxToMailUIUtil;
import com.franciaflex.faxtomail.ui.swing.util.JImagePanel;
-import com.franciaflex.faxtomail.ui.swing.util.attachment.AttachmentEditorUI;
-import com.franciaflex.faxtomail.ui.swing.util.attachment.PDFEditorCrossUI;
-import com.franciaflex.faxtomail.ui.swing.util.attachment.PDFEditorNoteUI;
-import com.franciaflex.faxtomail.ui.swing.util.attachment.PDFEditorUI;
-import com.franciaflex.faxtomail.ui.swing.util.attachment.PDFEditorUIHandler;
-import com.franciaflex.faxtomail.ui.swing.util.attachment.PDFEditorUIModel;
+import com.franciaflex.faxtomail.ui.swing.content.attachment.AttachmentEditorUI;
import com.itextpdf.text.BaseColor;
import com.itextpdf.text.Document;
import com.itextpdf.text.Image;
Copied: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/GroupAction.java (from rev 30, trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/ArchiveAction.java)
===================================================================
--- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/GroupAction.java (rev 0)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/GroupAction.java 2014-04-10 12:18:23 UTC (rev 32)
@@ -0,0 +1,71 @@
+package com.franciaflex.faxtomail.ui.swing.actions;
+
+import com.franciaflex.faxtomail.persistence.entities.DemandStatus;
+import com.franciaflex.faxtomail.persistence.entities.Email;
+import com.franciaflex.faxtomail.persistence.entities.FaxToMailUser;
+import com.franciaflex.faxtomail.services.service.EmailService;
+import com.franciaflex.faxtomail.ui.swing.content.demande.DemandeUIHandler;
+import com.franciaflex.faxtomail.ui.swing.content.demande.DemandeUIModel;
+import com.franciaflex.faxtomail.ui.swing.content.search.SearchToGroupUI;
+import com.franciaflex.faxtomail.ui.swing.content.search.SearchToGroupUIHandler;
+import com.franciaflex.faxtomail.ui.swing.content.search.SearchUI;
+import com.franciaflex.faxtomail.ui.swing.content.search.SearchUIModel;
+import com.franciaflex.faxtomail.ui.swing.util.DemandeTableModel;
+import org.jdesktop.swingx.JXTable;
+
+import javax.swing.*;
+import java.util.Date;
+
+import static org.nuiton.i18n.I18n.t;
+
+/**
+ * @author Kevin Morin (Code Lutin)
+ * @since x.x
+ */
+public class GroupAction extends AbstractFaxToMailAction<SearchUIModel, SearchToGroupUI, SearchToGroupUIHandler> {
+
+ public GroupAction(SearchToGroupUIHandler handler) {
+ super(handler, false);
+ }
+
+ protected DemandeUIModel currentEmail;
+ protected DemandeUIModel selectedEmail;
+
+ @Override
+ public boolean prepareAction() throws Exception {
+
+ JXTable dataTable = getUI().getDataTable();
+ int rowIndex = dataTable.getSelectedRow();
+ rowIndex = dataTable.convertRowIndexToModel(rowIndex);
+ selectedEmail = ((DemandeTableModel) dataTable.getModel()).getEntry(rowIndex);
+
+ currentEmail = getContext().getCurrentEmail();
+
+ int i = JOptionPane.showConfirmDialog(
+ null,
+ t("faxtomail.alert.groupConfirmation.message", currentEmail.getObject(), selectedEmail.getObject()),
+ t("faxtomail.alert.groupConfirmation.title"),
+ JOptionPane.YES_NO_OPTION,
+ JOptionPane.QUESTION_MESSAGE);
+
+ boolean result = i == JOptionPane.YES_OPTION;
+ return result;
+ }
+
+ @Override
+ public void doAction() throws Exception {
+ EmailService emailService = getContext().getEmailService();
+
+ Email email2 = emailService.getEmailById(selectedEmail.getTopiaId());
+ Email email1 = emailService.getEmailById(currentEmail.getTopiaId());
+
+ FaxToMailUser currentUser = getContext().getCurrentUser();
+ email1 = emailService.groupEmails(email1, email2, currentUser);
+ currentEmail.fromEntity(email1);
+ currentEmail.setGroupedDemandes(email1.getEmailGroup());
+
+ handler.showInformationMessage(t("faxtomail.demande.group.successful", email2.getObject()));
+
+ handler.closeFrame();
+ }
+}
Modified: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/SaveDemandeAction.java
===================================================================
--- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/SaveDemandeAction.java 2014-04-07 14:02:17 UTC (rev 31)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/SaveDemandeAction.java 2014-04-10 12:18:23 UTC (rev 32)
@@ -73,7 +73,8 @@
Email email = model.toEntity(persistedEmail);
String[] modifiedProperties = getHandler().getMonitor().getModifiedProperties();
- context.getEmailService().saveEmail(email, currentUser, modifiedProperties);
+ email = context.getEmailService().saveEmail(email, currentUser, modifiedProperties);
+ model.fromEntity(email);
}
}
Copied: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/SearchToGroupAction.java (from rev 30, trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/SearchAction.java)
===================================================================
--- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/SearchToGroupAction.java (rev 0)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/SearchToGroupAction.java 2014-04-10 12:18:23 UTC (rev 32)
@@ -0,0 +1,42 @@
+package com.franciaflex.faxtomail.ui.swing.actions;
+
+import com.franciaflex.faxtomail.persistence.entities.Email;
+import com.franciaflex.faxtomail.ui.swing.content.demande.DemandeUIModel;
+import com.franciaflex.faxtomail.ui.swing.content.search.SearchToGroupUI;
+import com.franciaflex.faxtomail.ui.swing.content.search.SearchToGroupUIHandler;
+import com.franciaflex.faxtomail.ui.swing.content.search.SearchUI;
+import com.franciaflex.faxtomail.ui.swing.content.search.SearchUIHandler;
+import com.franciaflex.faxtomail.ui.swing.content.search.SearchUIModel;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * @author Kevin Morin (Code Lutin)
+ * @since x.x
+ */
+public class SearchToGroupAction extends AbstractFaxToMailAction<SearchUIModel, SearchToGroupUI, SearchToGroupUIHandler> {
+
+ public SearchToGroupAction(SearchToGroupUIHandler handler) {
+ super(handler, false);
+ }
+
+ @Override
+ public void doAction() throws Exception {
+ SearchUIModel model = getModel();
+ getContext().setSearch(model);
+
+ Email email = model.toEntity();
+ List<Email> emails = getContext().getEmailService().search(email, model.getMinReceptionDate(), model.getMaxReceptionDate(),
+ model.getMinModificationDate(), model.getMaxModificationDate(), model.getModifiedBy(),
+ model.getMinPrintingDate(), model.getMaxPrintingDate());
+ List<DemandeUIModel> result = new ArrayList<>();
+ for (Email mail : emails) {
+ DemandeUIModel demand = new DemandeUIModel();
+ demand.fromEntity(mail);
+ demand.setValid(handler.isDemandeValid(demand));
+ result.add(demand);
+ }
+ model.setResults(result);
+ }
+}
Modified: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/ShowDemandeAction.java
===================================================================
--- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/ShowDemandeAction.java 2014-04-07 14:02:17 UTC (rev 31)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/ShowDemandeAction.java 2014-04-10 12:18:23 UTC (rev 32)
@@ -49,6 +49,15 @@
}
@Override
+ public void doAction() throws Exception {
+ super.doAction();
+
+ DemandeUIModel currentEmail = getContext().getCurrentEmail();
+ Email email = getContext().getEmailService().getEmailById(currentEmail.getTopiaId());
+ currentEmail.setGroupedDemandes(email.getEmailGroup());
+ }
+
+ @Override
public void postSuccessAction() {
super.postSuccessAction();
Modified: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/TransmitAction.java
===================================================================
--- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/TransmitAction.java 2014-04-07 14:02:17 UTC (rev 31)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/TransmitAction.java 2014-04-10 12:18:23 UTC (rev 32)
@@ -3,8 +3,8 @@
import com.franciaflex.faxtomail.persistence.entities.DemandStatus;
import com.franciaflex.faxtomail.ui.swing.content.demande.DemandeUI;
import com.franciaflex.faxtomail.ui.swing.content.demande.DemandeUIModel;
-import com.franciaflex.faxtomail.ui.swing.content.demande.MailFolderChooserUI;
-import com.franciaflex.faxtomail.ui.swing.content.demande.MailFolderChooserUIHandler;
+import com.franciaflex.faxtomail.ui.swing.content.transmit.MailFolderChooserUI;
+import com.franciaflex.faxtomail.ui.swing.content.transmit.MailFolderChooserUIHandler;
import jaxx.runtime.JAXXContext;
import jaxx.runtime.JAXXUtil;
Modified: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/attachment/AttachmentCellEditor.java
===================================================================
--- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/attachment/AttachmentCellEditor.java 2014-04-04 15:42:36 UTC (rev 30)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/attachment/AttachmentCellEditor.java 2014-04-10 12:18:23 UTC (rev 32)
@@ -1,4 +1,4 @@
-package com.franciaflex.faxtomail.ui.swing.util.attachment;
+package com.franciaflex.faxtomail.ui.swing.content.attachment;
/*
* #%L
Modified: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/attachment/AttachmentCellRenderer.java
===================================================================
--- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/attachment/AttachmentCellRenderer.java 2014-04-04 15:42:36 UTC (rev 30)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/attachment/AttachmentCellRenderer.java 2014-04-10 12:18:23 UTC (rev 32)
@@ -1,4 +1,4 @@
-package com.franciaflex.faxtomail.ui.swing.util.attachment;
+package com.franciaflex.faxtomail.ui.swing.content.attachment;
import com.franciaflex.faxtomail.persistence.entities.Attachment;
import jaxx.runtime.SwingUtil;
@@ -7,7 +7,6 @@
import javax.swing.*;
import javax.swing.table.DefaultTableCellRenderer;
-import java.awt.*;
import java.util.List;
import static org.nuiton.i18n.I18n.n;
Modified: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/attachment/AttachmentEditorUI.css
===================================================================
--- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/attachment/AttachmentEditorUI.css 2014-04-04 15:42:36 UTC (rev 30)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/attachment/AttachmentEditorUI.css 2014-04-10 12:18:23 UTC (rev 32)
@@ -1,3 +1,7 @@
+#attachmentDialog {
+ minimumSize: { new java.awt.Dimension(250, 0) };
+}
+
#body {
title: "faxtomail.attachmentEditor.title";
}
Modified: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/attachment/AttachmentEditorUIHandler.java
===================================================================
--- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/attachment/AttachmentEditorUIHandler.java 2014-04-04 15:42:36 UTC (rev 30)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/attachment/AttachmentEditorUIHandler.java 2014-04-10 12:18:23 UTC (rev 32)
@@ -1,8 +1,8 @@
-package com.franciaflex.faxtomail.ui.swing.util.attachment;
+package com.franciaflex.faxtomail.ui.swing.content.attachment;
import com.franciaflex.faxtomail.persistence.entities.Attachment;
import com.franciaflex.faxtomail.persistence.entities.AttachmentImpl;
-import com.franciaflex.faxtomail.ui.swing.content.demande.DemandeUIModel;
+import com.franciaflex.faxtomail.ui.swing.content.pdfeditor.PDFEditorUI;
import com.franciaflex.faxtomail.ui.swing.util.AbstractToolbarPopupHandler;
import com.franciaflex.faxtomail.ui.swing.util.FaxToMailUIUtil;
import com.google.common.collect.Iterables;
@@ -13,7 +13,6 @@
import org.jdesktop.swingx.JXTable;
import org.jdesktop.swingx.decorator.HighlighterFactory;
import org.nuiton.jaxx.application.ApplicationTechnicalException;
-import org.nuiton.jaxx.application.swing.table.AbstractApplicationTableModel;
import org.nuiton.util.FileUtil;
import javax.swing.*;
@@ -31,7 +30,6 @@
import java.beans.PropertyChangeListener;
import java.io.File;
import java.io.IOException;
-import java.util.Date;
import java.util.List;
import static org.nuiton.i18n.I18n.t;
@@ -119,26 +117,6 @@
return null;
}
- public void place(JComponent component) {
- // Computes the location of bottom left corner of the cell
- Component comp = component;
- int x = 0;
- int y = component.getHeight();
- while (comp != null) {
- x += comp.getX();
- y += comp.getY();
- comp = comp.getParent();
- }
-
- ui.pack();
- // if the editor is too big on the right,
- // then align its right side to the right side of the cell
- if (x + ui.getWidth() > ui.getOwner().getX() + ui.getOwner().getWidth()) {
- x = x - ui.getWidth() + component.getWidth();
- }
- ui.setLocation(x, y);
- }
-
public void addAttachment() {
Attachment attachment = new AttachmentImpl();
attachment.setAddedByUser(true);
@@ -257,6 +235,8 @@
label.setIcon(icon);
}
+ attachmentItem.setEditable(getModel().isEditable());
+
return attachmentItem;
}
Modified: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/attachment/AttachmentEditorUIModel.java
===================================================================
--- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/attachment/AttachmentEditorUIModel.java 2014-04-04 15:42:36 UTC (rev 30)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/attachment/AttachmentEditorUIModel.java 2014-04-10 12:18:23 UTC (rev 32)
@@ -1,4 +1,4 @@
-package com.franciaflex.faxtomail.ui.swing.util.attachment;
+package com.franciaflex.faxtomail.ui.swing.content.attachment;
import com.franciaflex.faxtomail.persistence.entities.Attachment;
import com.franciaflex.faxtomail.ui.swing.util.AbstractFaxToMailBeanUIModel;
Modified: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/attachment/AttachmentItem.css
===================================================================
--- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/attachment/AttachmentItem.css 2014-04-04 15:42:36 UTC (rev 30)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/attachment/AttachmentItem.css 2014-04-10 12:18:23 UTC (rev 32)
@@ -20,5 +20,5 @@
actionIcon: "delete";
toolTipText: "faxtomail.attachmentEditor.action.remove.tip";
enabled: { getAttachment() != null && getAttachment().getTopiaId() == null };
- visible: { Boolean.TRUE.equals(isEditable()) };
+ visible: { isEditable() };
}
\ No newline at end of file
Modified: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/attachment/AttachmentModelAware.java
===================================================================
--- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/attachment/AttachmentModelAware.java 2014-04-04 15:42:36 UTC (rev 30)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/attachment/AttachmentModelAware.java 2014-04-10 12:18:23 UTC (rev 32)
@@ -1,10 +1,9 @@
-package com.franciaflex.faxtomail.ui.swing.util.attachment;
+package com.franciaflex.faxtomail.ui.swing.content.attachment;
import com.franciaflex.faxtomail.persistence.entities.Attachment;
import java.io.Serializable;
import java.util.Collection;
-import java.util.List;
/**
* To place on model wich supports attachments.
Modified: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/attachment/ButtonAttachment.java
===================================================================
--- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/attachment/ButtonAttachment.java 2014-04-04 15:42:36 UTC (rev 30)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/attachment/ButtonAttachment.java 2014-04-10 12:18:23 UTC (rev 32)
@@ -1,4 +1,4 @@
-package com.franciaflex.faxtomail.ui.swing.util.attachment;
+package com.franciaflex.faxtomail.ui.swing.content.attachment;
import com.franciaflex.faxtomail.persistence.entities.Attachment;
import com.franciaflex.faxtomail.ui.swing.FaxToMailUIContext;
Deleted: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/attachment/PDFEditorCrossUI.css
===================================================================
--- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/attachment/PDFEditorCrossUI.css 2014-04-04 15:42:36 UTC (rev 30)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/attachment/PDFEditorCrossUI.css 2014-04-10 12:18:23 UTC (rev 32)
@@ -1,12 +0,0 @@
-#crossPanel {
- scaleImageToFitPanel: { true };
- border: { BorderFactory.createDashedBorder(null) };
-}
-
-#removeButton {
- text: "X";
- //borderPainted: { false };
- //border: { null };
- //opaque : { false };
- //background: { null };
-}
\ No newline at end of file
Deleted: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/attachment/PDFEditorCrossUI.jaxx
===================================================================
--- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/attachment/PDFEditorCrossUI.jaxx 2014-04-04 15:42:36 UTC (rev 30)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/attachment/PDFEditorCrossUI.jaxx 2014-04-10 12:18:23 UTC (rev 32)
@@ -1,30 +0,0 @@
-<com.franciaflex.faxtomail.ui.swing.util.JImagePanel id='crossPanel'>
-
- <import>
- java.awt.Color
- java.awt.Dimension
- java.awt.Font
- javax.swing.BorderFactory
- com.franciaflex.faxtomail.ui.swing.util.JImagePanel
- </import>
-
- <script><![CDATA[
-
- public static final String CROSS_IMAGE_FILE = "cross_blue.png";
-
- public PDFEditorCrossUI() {
- setImage(SwingUtil.createImageIcon(CROSS_IMAGE_FILE).getImage());
- }
-
- protected void removeCross() {
- JImagePanel container = getParentContainer(JImagePanel.class);
- container.remove(this);
- container.updateUI();
- }
-
- ]]></script>
-
- <JButton id="removeButton"
- onActionPerformed="removeCross()"/>
-
-</com.franciaflex.faxtomail.ui.swing.util.JImagePanel>
\ No newline at end of file
Deleted: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/attachment/PDFEditorNoteUI.css
===================================================================
--- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/attachment/PDFEditorNoteUI.css 2014-04-04 15:42:36 UTC (rev 30)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/attachment/PDFEditorNoteUI.css 2014-04-10 12:18:23 UTC (rev 32)
@@ -1,30 +0,0 @@
-#notePanel {
- background: { Color.YELLOW };
- border : { BorderFactory.createEmptyBorder(2, 2, 2, 2) };
-}
-
-#noteHeader {
- background: { null };
-}
-
-#noteTitle {
- font: { Font.decode(BaseFont.HELVETICA).deriveFont(Font.ITALIC) };
- text: { getTitle() };
-}
-
-#removeButton {
- text: "X";
- borderPainted: { false };
- border: { null };
- opaque : { false };
- background: { null };
-}
-
-#noteText {
- border: { null };
- opaque : { false };
- background: { null };
- font: { Font.decode(BaseFont.HELVETICA) };
- lineWrap: { false };
- wrapStyleWord: { false };
-}
\ No newline at end of file
Deleted: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/attachment/PDFEditorNoteUI.jaxx
===================================================================
--- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/attachment/PDFEditorNoteUI.jaxx 2014-04-04 15:42:36 UTC (rev 30)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/attachment/PDFEditorNoteUI.jaxx 2014-04-10 12:18:23 UTC (rev 32)
@@ -1,52 +0,0 @@
-<JPanel id='notePanel' layout='{new BorderLayout()}'>
-
- <import>
- java.awt.Color
- java.awt.Dimension
- java.awt.Font
- java.awt.Insets
- java.awt.Point
- javax.swing.BorderFactory
- com.itextpdf.text.pdf.BaseFont
- com.franciaflex.faxtomail.ui.swing.util.JImagePanel
- </import>
-
- <script><![CDATA[
-
- protected void textTyped() {
- setText(getNoteText().getText());
-
- JImagePanel container = getParentContainer(JImagePanel.class);
- Point location = getLocation();
- Insets insets = container.getInsets();
- Dimension size = getPreferredSize();
- setBounds(location.x + insets.left, location.y + insets.top,
- size.width, size.height);
- }
-
- protected void removeNote() {
- JImagePanel container = getParentContainer(JImagePanel.class);
- container.remove(this);
- container.updateUI();
- }
-
- ]]></script>
-
- <String id="title" javaBean="null"/>
- <String id="text" javaBean=""/>
-
- <JPanel id="noteHeader"
- layout='{ new BorderLayout() }'
- constraints="BorderLayout.NORTH">
- <JLabel id="noteTitle"
- constraints="BorderLayout.CENTER"/>
- <JButton id="removeButton"
- constraints="BorderLayout.EAST"
- onActionPerformed="removeNote()"/>
- </JPanel>
-
- <JTextArea id="noteText"
- constraints="BorderLayout.CENTER"
- onKeyTyped="textTyped()"/>
-
-</JPanel>
\ No newline at end of file
Deleted: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/attachment/PDFEditorUI.css
===================================================================
--- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/attachment/PDFEditorUI.css 2014-04-04 15:42:36 UTC (rev 30)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/attachment/PDFEditorUI.css 2014-04-10 12:18:23 UTC (rev 32)
@@ -1,56 +0,0 @@
-#toolbar {
- floatable: false;
- margin: {new java.awt.Insets(5, 0, 0, 5)};
- borderPainted: false;
-}
-
-#noteButton {
- actionIcon: note;
- toolTipText: "faxtomail.pdfEitor.button.addNote.tip";
-}
-
-#crossButton {
- actionIcon: cross;
- toolTipText: "faxtomail.pdfEitor.button.addCross.tip";
-}
-
-#prevPageButton {
- actionIcon: left;
- enabled: { getModel().getCurrentPageIndex() > 1 };
- toolTipText: "faxtomail.pdfEitor.button.previousPage";
-}
-
-#pageNumber {
- bean: { model };
- property: "currentPageIndex";
- modelText: { String.valueOf(model.getCurrentPageIndex()) };
- useFloat: false;
- useSign: false;
- autoPopup: false;
- showPopupButton: false;
- showReset: false;
- width: 50;
-}
-
-#pageTotal {
- text: { " / " + String.valueOf(model.getPages().length) };
-}
-
-#nextPageButton {
- actionIcon: right;
- enabled: { getModel().getCurrentPageIndex() < getModel().getPages().length };
- toolTipText: "faxtomail.pdfEitor.button.nextPage";
-}
-
-#cancelButton {
- actionIcon: cancel;
- text: "faxtomail.pdfEitor.action.cancel";
- toolTipText: "faxtomail.pdfEitor.action.cancel.tip";
-}
-
-#validateButton {
- actionIcon: validate;
- text: "faxtomail.pdfEitor.action.validate";
- toolTipText: "faxtomail.pdfEitor.action.validate.tip";
- _applicationAction: {com.franciaflex.faxtomail.ui.swing.actions.GenerateAnnotatedAttachmentAction.class};
-}
\ No newline at end of file
Deleted: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/attachment/PDFEditorUI.jaxx
===================================================================
--- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/attachment/PDFEditorUI.jaxx 2014-04-04 15:42:36 UTC (rev 30)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/attachment/PDFEditorUI.jaxx 2014-04-10 12:18:23 UTC (rev 32)
@@ -1,56 +0,0 @@
-<JPanel id="pdfEditorUIPanel"
- layout='{new BorderLayout()}'
- implements='com.franciaflex.faxtomail.ui.swing.util.FaxToMailUI<PDFEditorUIModel, PDFEditorUIHandler>'>
-
- <import>
- com.franciaflex.faxtomail.ui.swing.util.FaxToMailUI
- com.franciaflex.faxtomail.ui.swing.util.FaxToMailUIUtil
-
- com.franciaflex.faxtomail.ui.swing.util.JImagePanel
-
- javax.swing.SwingConstants
-
- jaxx.runtime.swing.editor.NumberEditor
-
- </import>
-
- <script><![CDATA[
-
- public PDFEditorUI(FaxToMailUI parentUI) {
- FaxToMailUIUtil.setParentUI(this, parentUI);
- }
-
- ]]></script>
-
- <PDFEditorUIModel id='model' initializer='new PDFEditorUIModel()'/>
-
- <JToolBar id="toolbar"
- constraints='BorderLayout.NORTH'>
- <JButton id='noteButton'
- onActionPerformed="handler.addNote()"/>
- <JButton id='crossButton'
- onActionPerformed="handler.addCross()"/>
-
- <JSeparator constructorParams="SwingConstants.VERTICAL"/>
-
- <JButton id="prevPageButton"
- onActionPerformed="getModel().decPageIndex()"/>
- <NumberEditor id='pageNumber'
- constructorParams='this' />
- <JLabel id="pageTotal"/>
- <JButton id="nextPageButton"
- onActionPerformed="getModel().incPageIndex()"/>
- </JToolBar>
-
- <JScrollPane constraints='BorderLayout.CENTER'>
- <JPanel>
- <JImagePanel id="container">
- </JImagePanel>
- </JPanel>
- </JScrollPane>
-
- <JPanel layout='{new GridLayout(1, 0)}' constraints='BorderLayout.SOUTH'>
- <JButton id='cancelButton' onActionPerformed='handler.closeDialog()'/>
- <JButton id='validateButton'/>
- </JPanel>
-</JPanel>
\ No newline at end of file
Deleted: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/attachment/PDFEditorUIHandler.java
===================================================================
--- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/attachment/PDFEditorUIHandler.java 2014-04-04 15:42:36 UTC (rev 30)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/attachment/PDFEditorUIHandler.java 2014-04-10 12:18:23 UTC (rev 32)
@@ -1,297 +0,0 @@
-package com.franciaflex.faxtomail.ui.swing.util.attachment;
-
-import com.franciaflex.faxtomail.persistence.entities.Attachment;
-import com.franciaflex.faxtomail.ui.swing.util.AbstractFaxToMailUIHandler;
-import com.franciaflex.faxtomail.ui.swing.util.FaxToMailUIUtil;
-import com.franciaflex.faxtomail.ui.swing.util.JImagePanel;
-import com.itextpdf.text.Document;
-import com.itextpdf.text.DocumentException;
-import com.itextpdf.text.Paragraph;
-import com.itextpdf.text.pdf.PdfWriter;
-import com.sun.pdfview.PDFFile;
-import com.sun.pdfview.PDFPage;
-import jaxx.runtime.swing.ComponentMover;
-import jaxx.runtime.swing.ComponentResizer;
-import jaxx.runtime.validator.swing.SwingValidator;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-import javax.swing.*;
-import java.awt.*;
-import java.awt.event.ContainerEvent;
-import java.awt.event.ContainerListener;
-import java.beans.PropertyChangeEvent;
-import java.beans.PropertyChangeListener;
-import java.io.BufferedReader;
-import java.io.File;
-import java.io.FileOutputStream;
-import java.io.FileReader;
-import java.io.IOException;
-import java.io.RandomAccessFile;
-import java.nio.ByteBuffer;
-import java.nio.channels.FileChannel;
-import java.util.Date;
-
-/**
- * @author Kevin Morin (Code Lutin)
- * @since x.x
- */
-public class PDFEditorUIHandler extends AbstractFaxToMailUIHandler<PDFEditorUIModel, PDFEditorUI> {
-
- private static final Log log = LogFactory.getLog(PDFEditorUIHandler.class);
-
- protected ComponentMover cm = new ComponentMover();
- protected ComponentResizer cr = new ComponentResizer();
-
- protected PDFFile pdf;
-
- @Override
- public void afterInit(PDFEditorUI pdfEditorUI) {
- initUI(pdfEditorUI);
-
- cm.setDragInsets(cr.getDragInsets());
- cm.setEdgeInsets(new Insets(0, 0, 0, 0));
-
-
- ui.getContainer().addContainerListener(new ContainerListener() {
- @Override
- public void componentAdded(ContainerEvent e) {
- Component child = e.getChild();
- PDFEditorUIModel.Page currentPage = getModel().getCurrentPage();
- if (child.getClass().isAssignableFrom(PDFEditorNoteUI.class)) {
- currentPage.addNote((PDFEditorNoteUI) child);
-
- } else if (child.getClass().isAssignableFrom(PDFEditorCrossUI.class)) {
- currentPage.addCross((PDFEditorCrossUI) child);
- }
- }
-
- @Override
- public void componentRemoved(ContainerEvent e) {
- Component child = e.getChild();
- PDFEditorUIModel.Page currentPage = getModel().getCurrentPage();
- if (child.getClass().isAssignableFrom(PDFEditorNoteUI.class)) {
- currentPage.removeNote((PDFEditorNoteUI) child);
-
- } else if (child.getClass().isAssignableFrom(PDFEditorCrossUI.class)) {
- currentPage.removeCross((PDFEditorCrossUI) child);
- }
- }
- });
-
- getModel().addPropertyChangeListener(PDFEditorUIModel.PROPERTY_CURRENT_PAGE_INDEX,
- new PropertyChangeListener() {
- @Override
- public void propertyChange(PropertyChangeEvent evt) {
- Integer pageNb = (Integer) evt.getNewValue();
- Integer prevPageNb = (Integer) evt.getOldValue();
- updatePageNumber(pageNb, prevPageNb);
- }
- });
-
- getModel().addPropertyChangeListener(new PropertyChangeListener() {
- @Override
- public void propertyChange(PropertyChangeEvent evt) {
- if (Attachment.PROPERTY_ORIGINAL_FILE.equals(evt.getPropertyName())
- || Attachment.PROPERTY_EDITED_FILE.equals(evt.getPropertyName())) {
-
- PDFEditorUIModel model = (PDFEditorUIModel) evt.getSource();
- File file = model.getNotNullFile();
-
- if (file != null) {
- if (FaxToMailUIUtil.isFileATxt(file)) {
- try {
- file = convertTextToPdf(file);
-
- } catch (IOException e) {
- if (log.isErrorEnabled()) {
- log.error("", e);
- }
- } catch (DocumentException e) {
- if (log.isErrorEnabled()) {
- log.error("", e);
- }
- }
- }
- if (FaxToMailUIUtil.isFileAPDF(file)) {
- getUI().setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
- try {
- RandomAccessFile raf = new RandomAccessFile(file, "r");
- FileChannel channel = raf.getChannel();
- ByteBuffer buf = channel.map(FileChannel.MapMode.READ_ONLY, 0, channel.size());
- pdf = new PDFFile(buf);
-
- model.setPageNumber(pdf.getNumPages());
- model.setCurrentPageIndex(1);
-
- } catch (IOException e) {
- if (log.isErrorEnabled()) {
- log.error("", e);
- }
- }
- getUI().setCursor(Cursor.getDefaultCursor());
-
- } else {
- model.setPageNumber(1);
- model.setCurrentPageIndex(1);
-
- JImagePanel container = getUI().getContainer();
- if (FaxToMailUIUtil.isFileATxt(file)) {
- JTextPane textPane = new JTextPane();
- textPane.setEditable(false);
- try {
- FileReader fr = new FileReader(file);
- BufferedReader br = new BufferedReader(fr);
- String text = new String();
- while (br.readLine() != null) {
- text += br.readLine() + "\n";
- }
- textPane.setText(text);
-
- log.debug(textPane.getText());
-
- } catch (IOException e) {
- if (log.isErrorEnabled()) {
- log.error("", e);
- }
- }
- container.add(textPane);
-
- Insets insets = container.getInsets();
- Dimension size = textPane.getPreferredSize();
-
- container.setPreferredSize(size);
- container.setMinimumSize(size);
- container.setMaximumSize(size);
- container.setSize(size);
-
- textPane.setBounds(insets.left, insets.top, size.width, size.height);
-
- container.updateUI();
-
- } else {
- if (FaxToMailUIUtil.isFileATif(file)) {
- container.setTifImage(file);
-
- } else {
- container.setImage(file);
- }
- }
- }
- model.firePropertyChanged(PDFEditorUIModel.PROPERTY_CURRENT_PAGE_INDEX, null, 1);
- }
- }
- }
- });
- }
-
- @Override
- protected JComponent getComponentToFocus() {
- return null;
- }
-
- @Override
- public SwingValidator<PDFEditorUIModel> getValidator() {
- return null;
- }
-
- @Override
- public void onCloseUI() {
-
- }
-
- public void addNote() {
- PDFEditorNoteUI note = new PDFEditorNoteUI();
- String title = decorate(new Date()) + " - " + getContext().getCurrentUser().getTrigraph();
- note.setTitle(title);
- addPanel(note);
- }
-
- public void addCross() {
-// java.awt.Image cross = SwingUtil.createImageIcon(CROSS_IMAGE_FILE).getImage();
-// JImagePanel panel = new JImagePanel(cross);
-// panel.setScaleImageToFitPanel(true);
-// panel.setBorder(BorderFactory.createDashedBorder(null));
- PDFEditorCrossUI cross = new PDFEditorCrossUI();
- addPanel(cross);
- cr.registerComponent(cross);
- }
-
- protected void addPanel(JPanel panel) {
- JImagePanel container = ui.getContainer();
- container.add(panel, 0);
-
- Insets insets = container.getInsets();
- Dimension size = panel.getPreferredSize();
- Rectangle rect = container.getVisibleRect();
- panel.setBounds(rect.x + insets.left, rect.y + insets.top,
- size.width, size.height);
-
- container.updateUI();
-
- cm.registerComponent(panel);
- }
-
- protected void updatePageNumber(Integer pageNb, Integer prevPageNb) {
- if (pdf != null) {
- if (pageNb != null) {
- if (prevPageNb != null) {
- PDFEditorUIModel.Page p = getModel().getPage(prevPageNb);
- for (JPanel panel : p.getNotes()) {
- panel.setVisible(false);
- }
- for (JPanel panel : p.getCrosses()) {
- panel.setVisible(false);
- }
- }
-
- PDFPage page = pdf.getPage(pageNb);
- // create the image
- Rectangle rect = new Rectangle(0, 0, (int) page.getBBox().getWidth(),
- (int) page.getBBox().getHeight());
-
- Image image = page.getImage(rect.width, rect.height, // width & height
- rect, // clip rect
- null, // null for the ImageObserver
- true, // fill background with white
- true // block until drawing is done
- );
- JImagePanel container = getUI().getContainer();
- container.setImage(image);
-
- PDFEditorUIModel.Page p = getModel().getPage(pageNb);
- for (JPanel panel : p.getNotes()) {
- panel.setVisible(true);
- }
- for (JPanel panel : p.getCrosses()) {
- panel.setVisible(true);
- }
-
- container.updateUI();
- }
- }
- }
-
- public File convertTextToPdf(File file) throws IOException, DocumentException {
- FileReader fr = new FileReader(file);
- BufferedReader br = new BufferedReader(fr);
- String text = new String();
- while (br.readLine() != null) {
- text += br.readLine() + "\n";
- }
-
- file = File.createTempFile(file.getName(), ".pdf");
-
- Document document = new Document();
- FileOutputStream fos = new FileOutputStream(file);
- PdfWriter writer = PdfWriter.getInstance(document, fos);
- writer.open();
-
- document.open();
- document.add(new Paragraph(text));
- document.close();
- writer.close();
- return file;
- }
-
-}
Deleted: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/attachment/PDFEditorUIModel.java
===================================================================
--- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/attachment/PDFEditorUIModel.java 2014-04-04 15:42:36 UTC (rev 30)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/attachment/PDFEditorUIModel.java 2014-04-10 12:18:23 UTC (rev 32)
@@ -1,162 +0,0 @@
-package com.franciaflex.faxtomail.ui.swing.util.attachment;
-
-import com.franciaflex.faxtomail.persistence.entities.Attachment;
-import com.franciaflex.faxtomail.persistence.entities.AttachmentImpl;
-import com.franciaflex.faxtomail.ui.swing.util.AbstractFaxToMailBeanUIModel;
-import com.franciaflex.faxtomail.ui.swing.util.JImagePanel;
-import org.nuiton.util.beans.Binder;
-import org.nuiton.util.beans.BinderFactory;
-
-import javax.swing.*;
-import java.io.File;
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * @author Kevin Morin (Code Lutin)
- * @since x.x
- */
-public class PDFEditorUIModel extends AbstractFaxToMailBeanUIModel<Attachment, PDFEditorUIModel> {
-
- public static final String PROPERTY_PAGES = "pages";
- public static final String PROPERTY_CURRENT_PAGE_INDEX = "currentPageIndex";
-
- protected final Attachment editObject = new AttachmentImpl();
-
- public class Page {
-
- protected List<PDFEditorNoteUI> notes = new ArrayList<PDFEditorNoteUI>();
- protected List<JImagePanel> crosses = new ArrayList<JImagePanel>();
-
- public List<PDFEditorNoteUI> getNotes() {
- return notes;
- }
-
- public void addNote(PDFEditorNoteUI note) {
- notes.add(note);
- }
-
- public void removeNote(PDFEditorNoteUI note) {
- notes.remove(note);
- }
-
- public List<JImagePanel> getCrosses() {
- return crosses;
- }
-
- public void addCross(JImagePanel cross) {
- crosses.add(cross);
- }
-
- public void removeCross(JPanel cross) {
- crosses.remove(cross);
- }
- }
-
- protected Page[] pages;
-
- // first page is 1 not 0
- protected int currentPageIndex = -1;
-
- protected static Binder<PDFEditorUIModel, Attachment> toBeanBinder =
- BinderFactory.newBinder(PDFEditorUIModel.class,
- Attachment.class);
-
- protected static Binder<Attachment, PDFEditorUIModel> fromBeanBinder =
- BinderFactory.newBinder(Attachment.class, PDFEditorUIModel.class);
-
- public PDFEditorUIModel() {
- super(fromBeanBinder, toBeanBinder);
- }
-
- public void setOriginalFile(File file) {
- Object oldValue = getOriginalFile();
- editObject.setOriginalFile(file);
- firePropertyChange(Attachment.PROPERTY_ORIGINAL_FILE, oldValue, file);
- }
-
- public File getOriginalFile() {
- return editObject.getOriginalFile();
- }
-
- public void setEditedFile(File file) {
- Object oldValue = getEditedFile();
- editObject.setEditedFile(file);
- firePropertyChange(Attachment.PROPERTY_EDITED_FILE, oldValue, file);
- }
-
- public File getEditedFile() {
- return editObject.getEditedFile();
- }
-
- public File getNotNullFile() {
- File file = getEditedFile();
- if (file == null) {
- file = getOriginalFile();
- }
- return file;
- }
-
- public String getTopiaId() {
- return editObject.getTopiaId();
- }
-
- public void setTopiaId(String id) {
- Object oldValue = getTopiaId();
- editObject.setTopiaId(id);
- firePropertyChange(Attachment.PROPERTY_TOPIA_ID, oldValue, id);
- }
-
- public Page[] getPages() {
- return pages;
- }
-
- public void setPageNumber(int nb) {
- pages = new Page[nb];
- for (int i = 0 ; i < nb ; i++) {
- pages[i] = new Page();
- }
- firePropertyChanged(PROPERTY_PAGES, null, pages);
- }
-
- public Page getCurrentPage() {
- if (pages == null || currentPageIndex < 1 || currentPageIndex > pages.length) {
- return null;
- }
- return pages[currentPageIndex - 1];
- }
-
- public Page getPage(int i) {
- if (pages == null || i < 1 || i > pages.length) {
- return null;
- }
- return pages[i - 1];
- }
-
- public int getCurrentPageIndex() {
- return currentPageIndex;
- }
-
- public void setCurrentPageIndex(int currentPageIndex) {
- Object oldValue = getCurrentPageIndex();
- currentPageIndex = Math.max(1, currentPageIndex);
- if (pages != null) {
- currentPageIndex = Math.min(pages.length, currentPageIndex);
- }
- this.currentPageIndex = currentPageIndex;
- firePropertyChange(PROPERTY_CURRENT_PAGE_INDEX, oldValue, currentPageIndex);
- }
-
- public void decPageIndex() {
- setCurrentPageIndex(currentPageIndex - 1);
- }
-
- public void incPageIndex() {
- setCurrentPageIndex(currentPageIndex + 1);
- }
-
- @Override
- protected Attachment newEntity() {
- return new AttachmentImpl();
- }
-}
Modified: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeUI.jaxx
===================================================================
--- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeUI.jaxx 2014-04-07 14:02:17 UTC (rev 31)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeUI.jaxx 2014-04-10 12:18:23 UTC (rev 32)
@@ -26,8 +26,9 @@
com.franciaflex.faxtomail.ui.swing.FaxToMailUIContext
com.franciaflex.faxtomail.ui.swing.util.FaxToMailUI
com.franciaflex.faxtomail.ui.swing.util.FaxToMailUIUtil
- com.franciaflex.faxtomail.ui.swing.util.attachment.ButtonAttachment
- com.franciaflex.faxtomail.ui.swing.util.history.ButtonHistory
+ com.franciaflex.faxtomail.ui.swing.content.attachment.ButtonAttachment
+ com.franciaflex.faxtomail.ui.swing.content.history.ButtonHistory
+ com.franciaflex.faxtomail.ui.swing.content.demandgroup.ButtonEmailGroup
com.franciaflex.faxtomail.persistence.entities.Email
com.franciaflex.faxtomail.persistence.entities.DemandType
@@ -70,6 +71,7 @@
</BeanValidator>
<JToolBar id='topToolBar'>
+ <ButtonEmailGroup id="demandGroupButton"/>
<ButtonHistory id="historyButton"/>
<ButtonAttachment id="attachmentsButton"
constructorParams="model"/>
Modified: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeUIHandler.java
===================================================================
--- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeUIHandler.java 2014-04-07 14:02:17 UTC (rev 31)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeUIHandler.java 2014-04-10 12:18:23 UTC (rev 32)
@@ -26,19 +26,22 @@
import com.franciaflex.faxtomail.persistence.entities.Attachment;
import com.franciaflex.faxtomail.persistence.entities.Email;
import com.franciaflex.faxtomail.persistence.entities.EtatAttente;
+import com.franciaflex.faxtomail.persistence.entities.FaxToMailUser;
import com.franciaflex.faxtomail.persistence.entities.HistoryType;
import com.franciaflex.faxtomail.persistence.entities.MailFolder;
-import com.franciaflex.faxtomail.persistence.entities.MailFolderTopiaDao;
import com.franciaflex.faxtomail.persistence.entities.Range;
import com.franciaflex.faxtomail.persistence.entities.RangeRow;
+import com.franciaflex.faxtomail.services.service.EmailService;
import com.franciaflex.faxtomail.services.service.ReferentielService;
import com.franciaflex.faxtomail.ui.swing.actions.SaveDemandeAction;
import com.franciaflex.faxtomail.ui.swing.content.reply.ReplyFormUI;
import com.franciaflex.faxtomail.ui.swing.content.reply.ReplyFormUIModel;
+import com.franciaflex.faxtomail.ui.swing.content.search.SearchToGroupUI;
+import com.franciaflex.faxtomail.ui.swing.content.transmit.MailFolderChooserUI;
import com.franciaflex.faxtomail.ui.swing.util.AbstractFaxToMailUIHandler;
import com.franciaflex.faxtomail.ui.swing.util.CloseableUI;
import com.franciaflex.faxtomail.ui.swing.util.FaxToMailUIUtil;
-import com.franciaflex.faxtomail.ui.swing.util.attachment.AttachmentEditorUIModel;
+import com.franciaflex.faxtomail.ui.swing.content.attachment.AttachmentEditorUIModel;
import jaxx.runtime.validator.swing.SwingValidator;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.logging.Log;
@@ -364,6 +367,7 @@
Set<String> result = super.getPropertiesToIgnore();
result.add(DemandeUIModel.PROPERTY_EDITABLE);
result.add(Email.PROPERTY_HISTORY);
+ result.add(DemandeUIModel.PROPERTY_GROUPED_DEMANDES);
return result;
}
@@ -375,6 +379,7 @@
clearValidators();
ui.getAttachmentsButton().setSelected(false);
ui.getHistoryButton().setSelected(false);
+ ui.getGroupButton().setSelected(false);
}
@Override
@@ -444,7 +449,16 @@
}
public void group() {
- //TODO
+ ui.getGroupButton().setSelected(false);
+
+ if (getMonitor().wasModified()) {
+ getContext().getActionFactory().createUIAction(this, SaveDemandeAction.class).actionPerformed(null);
+ getModel().setModify(false);
+ getMonitor().clearModified();
+ }
+
+ SearchToGroupUI dialogContent = new SearchToGroupUI(ui);
+ openFrame(dialogContent, t("faxtomail.searchToGroup.title", getModel().getObject()), getContext().getMainUI().getSize());
}
}
Modified: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeUIModel.java
===================================================================
--- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeUIModel.java 2014-04-07 14:02:17 UTC (rev 31)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeUIModel.java 2014-04-10 12:18:23 UTC (rev 32)
@@ -27,6 +27,7 @@
import com.franciaflex.faxtomail.persistence.entities.DemandStatus;
import com.franciaflex.faxtomail.persistence.entities.DemandType;
import com.franciaflex.faxtomail.persistence.entities.Email;
+import com.franciaflex.faxtomail.persistence.entities.EmailGroup;
import com.franciaflex.faxtomail.persistence.entities.EmailImpl;
import com.franciaflex.faxtomail.persistence.entities.EtatAttente;
import com.franciaflex.faxtomail.persistence.entities.FaxToMailUser;
@@ -36,7 +37,7 @@
import com.franciaflex.faxtomail.persistence.entities.Priority;
import com.franciaflex.faxtomail.persistence.entities.RangeRow;
import com.franciaflex.faxtomail.ui.swing.util.AbstractFaxToMailBeanUIModel;
-import com.franciaflex.faxtomail.ui.swing.util.attachment.AttachmentModelAware;
+import com.franciaflex.faxtomail.ui.swing.content.attachment.AttachmentModelAware;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.nuiton.util.beans.Binder;
@@ -47,7 +48,6 @@
import java.util.ArrayList;
import java.util.Collection;
import java.util.Date;
-import java.util.List;
import static org.nuiton.i18n.I18n.t;
@@ -66,11 +66,14 @@
public static final String PROPERTY_CLIENT_BRAND = "clientBrand";
public static final String PROPERTY_EDITABLE = "editable";
public static final String PROPERTY_LAST_ATTACHMENT_OPENING_USER = "lastAttachmentOpeningUser";
+ public static final String PROPERTY_GROUPED_DEMANDES = "groupedDemandes";
protected final Email editObject = new EmailImpl();
protected final Collection<Attachment> attachments = new ArrayList<Attachment>();
+ protected final Collection<DemandeUIModel> groupedDemandes = new ArrayList<DemandeUIModel>();
+
protected History firstOpeningHistory;
protected History lastModificationHistory;
@@ -329,6 +332,10 @@
return editObject.getHistory();
}
+ public int sizeHistory() {
+ return editObject.sizeHistory();
+ }
+
public void findFirstOpeningHistory() {
History result = null;
Date date = null;
@@ -425,7 +432,7 @@
@Override
public Collection<Attachment> getAttachment() {
- return attachments;
+ return new ArrayList<Attachment>(attachments);
}
@Override
@@ -561,6 +568,39 @@
firePropertyChange(PROPERTY_EDITABLE, oldValue, editable);
}
+ public void setGroupedDemandes(EmailGroup emailGroup) {
+ Object oldValue = new ArrayList<DemandeUIModel>(getGroupedDemandes());
+ if (emailGroup != null) {
+ groupedDemandes.clear();
+ Collection<Email> emails = emailGroup.getEmail();
+ if (emails != null) {
+ for (Email email : emails) {
+ if (!email.getTopiaId().equals(getTopiaId())) {
+ DemandeUIModel demandeUIModel = new DemandeUIModel();
+ demandeUIModel.fromEntity(email);
+ groupedDemandes.add(demandeUIModel);
+ }
+ }
+ }
+ }
+ firePropertyChange(PROPERTY_GROUPED_DEMANDES, oldValue, getGroupedDemandes());
+ }
+
+ public void addGroupedDemande(DemandeUIModel demand) {
+ Object oldValue = new ArrayList<DemandeUIModel>(getGroupedDemandes());
+ groupedDemandes.add(demand);
+ firePropertyChange(PROPERTY_GROUPED_DEMANDES, oldValue, getGroupedDemandes());
+
+ }
+
+ public Collection<DemandeUIModel> getGroupedDemandes() {
+ return groupedDemandes;
+ }
+
+ public int sizeGroupedDemandes() {
+ return groupedDemandes.size();
+ }
+
@Override
protected Email newEntity() {
return new EmailImpl();
Deleted: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/MailFolderChooserUI.css
===================================================================
--- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/MailFolderChooserUI.css 2014-04-07 14:02:17 UTC (rev 31)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/MailFolderChooserUI.css 2014-04-10 12:18:23 UTC (rev 32)
@@ -1,19 +0,0 @@
-#navigationTree {
- font-size: "11";
- rootVisible: false;
- showsRootHandles: true;
-}
-
-#cancelButton {
- actionIcon: cancel;
- text: "faxtomail.chooseMailFolder.action.cancel";
- toolTipText: "faxtomail.chooseMailFolder.action.cancel.tip";
-}
-
-#validateButton {
- actionIcon: validate;
- text: "faxtomail.chooseMailFolder.action.validate";
- toolTipText: "faxtomail.chooseMailFolder.action.validate.tip";
- _applicationAction: {com.franciaflex.faxtomail.ui.swing.actions.TransmitAction.class};
- enabled: { model.getMailFolder() != null };
-}
\ No newline at end of file
Deleted: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/MailFolderChooserUI.jaxx
===================================================================
--- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/MailFolderChooserUI.jaxx 2014-04-07 14:02:17 UTC (rev 31)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/MailFolderChooserUI.jaxx 2014-04-10 12:18:23 UTC (rev 32)
@@ -1,31 +0,0 @@
-<JPanel id='mailFolderChooser' layout='{new BorderLayout()}'
- implements='com.franciaflex.faxtomail.ui.swing.util.FaxToMailUI<DemandeUIModel, MailFolderChooserUIHandler>'>
-
- <import>
- com.franciaflex.faxtomail.ui.swing.util.FaxToMailUI
- com.franciaflex.faxtomail.ui.swing.util.FaxToMailUIUtil
-
- javax.swing.tree.DefaultTreeModel
- </import>
-
- <script><![CDATA[
-
- public MailFolderChooserUI(FaxToMailUI parentUI, DemandeUIModel model) {
- FaxToMailUIUtil.setParentUI(this, parentUI);
- setContextValue(model);
- }
-
- ]]></script>
-
- <DemandeUIModel id='model' javaBean='getContextValue(DemandeUIModel.class)'/>
-
- <JScrollPane constraints='BorderLayout.CENTER'>
- <JTree id="navigationTree"/>
- </JScrollPane>
-
- <JPanel layout='{new GridLayout(1, 0)}' constraints='BorderLayout.SOUTH'>
- <JButton id='cancelButton' onActionPerformed='handler.cancel()'/>
- <JButton id='validateButton'/>
- </JPanel>
-
-</JPanel>
\ No newline at end of file
Deleted: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/MailFolderChooserUIHandler.java
===================================================================
--- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/MailFolderChooserUIHandler.java 2014-04-07 14:02:17 UTC (rev 31)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/MailFolderChooserUIHandler.java 2014-04-10 12:18:23 UTC (rev 32)
@@ -1,112 +0,0 @@
-package com.franciaflex.faxtomail.ui.swing.content.demande;
-
-import com.franciaflex.faxtomail.persistence.entities.Company;
-import com.franciaflex.faxtomail.persistence.entities.EtatAttente;
-import com.franciaflex.faxtomail.persistence.entities.MailFolder;
-import com.franciaflex.faxtomail.ui.swing.content.demande.DemandeUIModel;
-import com.franciaflex.faxtomail.ui.swing.content.demande.MailFolderChooserUI;
-import com.franciaflex.faxtomail.ui.swing.util.AbstractFaxToMailUIHandler;
-import com.franciaflex.faxtomail.ui.swing.util.Cancelable;
-import com.franciaflex.faxtomail.ui.swing.util.FaxToMailUIUtil;
-import com.franciaflex.faxtomail.ui.swing.util.FolderTreeNode;
-import jaxx.runtime.validator.swing.SwingValidator;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-import javax.swing.*;
-import javax.swing.event.TreeSelectionEvent;
-import javax.swing.event.TreeSelectionListener;
-import javax.swing.tree.DefaultMutableTreeNode;
-import javax.swing.tree.DefaultTreeCellRenderer;
-import java.awt.*;
-import java.util.Collection;
-import java.util.HashSet;
-import java.util.Map;
-
-/**
- * @author Kevin Morin (Code Lutin)
- * @since x.x
- */
-public class MailFolderChooserUIHandler extends AbstractFaxToMailUIHandler<DemandeUIModel, MailFolderChooserUI> implements Cancelable {
-
- private static final Log log = LogFactory.getLog(MailFolderChooserUIHandler.class);
-
- @Override
- public void afterInit(MailFolderChooserUI mailFolderChooserUI) {
- initUI(mailFolderChooserUI);
-
- DemandeUIModel model = getModel();
-
- EtatAttente etatAttente = model.getEtatAttente();
- final Collection<MailFolder> foldersWithEtatAttente;
- if (etatAttente != null) {
- foldersWithEtatAttente = getContext().getMailFolderService().getFoldersWithEtatAttente(etatAttente);
- } else {
- foldersWithEtatAttente = new HashSet<MailFolder>();
- }
-
- // init tree
- Company franciaflex = getContext().getCurrentCompany();
- Collection<MailFolder> folders = franciaflex.getMailFolder();
- JTree navigationTree = ui.getNavigationTree();
-
- Map<MailFolder, DefaultMutableTreeNode> nodesByFolder =
- FaxToMailUIUtil.initFolderTree(getContext(), navigationTree, folders);
- MailFolder currentFolder = getModel().getMailFolder();
-
- for (MailFolder folder : nodesByFolder.keySet()) {
- DefaultMutableTreeNode node = nodesByFolder.get(folder);
- if (node.getClass().isAssignableFrom(FolderTreeNode.class)) {
- FolderTreeNode folderTreeNode = (FolderTreeNode) node;
- folderTreeNode.setCanSelect(!currentFolder.equals(folder) &&
- (foldersWithEtatAttente.isEmpty()
- || foldersWithEtatAttente.contains(folder)));
- }
- }
-
- navigationTree.setCellRenderer(new DefaultTreeCellRenderer() {
- @Override
- public Component getTreeCellRendererComponent(JTree tree, Object value, boolean sel,
- boolean expanded, boolean leaf, int row, boolean hasFocus) {
- Component component = super.getTreeCellRendererComponent(tree, value, sel, expanded, leaf, row, hasFocus);
-
- FolderTreeNode node = (FolderTreeNode) value;
- setEnabled(node.isCanSelect());
-
- return component;
- }
- });
-
- navigationTree.addTreeSelectionListener(new TreeSelectionListener() {
- @Override
- public void valueChanged(TreeSelectionEvent e) {
- FolderTreeNode folderNode = (FolderTreeNode) e.getPath().getLastPathComponent();
- MailFolder folder = folderNode.getMailFolder();
- if (!folderNode.isCanSelect()) {
- folder = null;
- }
- getModel().setMailFolder(folder);
- }
- });
- }
-
- @Override
- public void onCloseUI() {
- }
-
- @Override
- public SwingValidator<DemandeUIModel> getValidator() {
- return null;
- }
-
- @Override
- public void cancel() {
- closeDialog();
- }
-
- @Override
- protected JComponent getComponentToFocus() {
- return ui.getNavigationTree();
- }
-
-}
Copied: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demandgroup/ButtonEmailGroup.java (from rev 30, trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/history/ButtonHistory.java)
===================================================================
--- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demandgroup/ButtonEmailGroup.java (rev 0)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demandgroup/ButtonEmailGroup.java 2014-04-10 12:18:23 UTC (rev 32)
@@ -0,0 +1,50 @@
+package com.franciaflex.faxtomail.ui.swing.content.demandgroup;
+
+import com.franciaflex.faxtomail.persistence.entities.Email;
+import com.franciaflex.faxtomail.persistence.entities.History;
+import com.franciaflex.faxtomail.ui.swing.FaxToMailUIContext;
+import com.franciaflex.faxtomail.ui.swing.content.demande.DemandeUIModel;
+import com.franciaflex.faxtomail.ui.swing.content.history.HistoryListUI;
+import com.franciaflex.faxtomail.ui.swing.util.AbstractToolbarPopupButton;
+
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
+import java.util.Collection;
+
+import static org.nuiton.i18n.I18n.t;
+
+/**
+ * Button to edit attachments.
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 1.1
+ */
+public class ButtonEmailGroup extends AbstractToolbarPopupButton<DemandGroupUI> {
+
+ public ButtonEmailGroup() {
+ setToolTipText(t("faxtomail.demandGroup.action.tip"));
+ int demandNb = popup.getModel().sizeGroupedDemandes();
+ setText(t("faxtomail.demandGroup.text", demandNb));
+
+ popup.getModel().addPropertyChangeListener(DemandeUIModel.PROPERTY_GROUPED_DEMANDES, new PropertyChangeListener() {
+ @Override
+ public void propertyChange(PropertyChangeEvent evt) {
+ Collection<DemandeUIModel> demands = (Collection<DemandeUIModel>) evt.getNewValue();
+ if (demands != null) {
+ setText(t("faxtomail.demandGroup.text", demands.size()));
+ }
+ }
+ });
+ }
+
+ @Override
+ protected String getActionIcon() {
+ return "group";
+ }
+
+ @Override
+ protected DemandGroupUI createNewPopup() {
+ return new DemandGroupUI(FaxToMailUIContext.getApplicationContext());
+ }
+
+}
Copied: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demandgroup/DemandGroupItem.css (from rev 30, trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/history/HistoryItem.css)
===================================================================
--- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demandgroup/DemandGroupItem.css (rev 0)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demandgroup/DemandGroupItem.css 2014-04-10 12:18:23 UTC (rev 32)
@@ -0,0 +1,17 @@
+#demandPanel {
+ border: { BorderFactory.createEmptyBorder(2, 3, 2, 3) };
+}
+
+#demandeObjectLabel {
+ text: { getDemande().getObject() };
+}
+
+#toolbar {
+ borderPainted: false;
+ floatable: false;
+}
+
+#openDemandeButton {
+ actionIcon: "open-file";
+ toolTipText: "faxtomail.attachmentEditor.action.open.tip";
+}
\ No newline at end of file
Copied: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demandgroup/DemandGroupItem.jaxx (from rev 30, trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/history/HistoryItem.jaxx)
===================================================================
--- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demandgroup/DemandGroupItem.jaxx (rev 0)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demandgroup/DemandGroupItem.jaxx 2014-04-10 12:18:23 UTC (rev 32)
@@ -0,0 +1,26 @@
+<JPanel id='demandPanel' layout='{new BorderLayout()}'>
+
+ <import>
+ com.franciaflex.faxtomail.ui.swing.content.demande.DemandeUIModel
+ static org.nuiton.i18n.I18n.t
+ static jaxx.runtime.JAXXUtil.getStringValue
+ </import>
+
+ <DemandeUIModel id='demande' javaBean='null'/>
+
+ <DemandGroupUIHandler id='handler' javaBean='null'/>
+
+ <script><![CDATA[
+public DemandGroupItem(DemandGroupUIHandler handler) {
+ setContextValue(handler);
+}
+ ]]></script>
+
+ <JLabel id='demandeObjectLabel' constraints='BorderLayout.CENTER'/>
+
+ <JToolBar id='toolbar' constraints='BorderLayout.EAST'>
+ <JButton id='openDemandeButton'
+ onActionPerformed='handler.openDemande(demande)'/>
+ </JToolBar>
+
+</JPanel>
\ No newline at end of file
Copied: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demandgroup/DemandGroupUI.css (from rev 30, trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/history/HistoryListUI.css)
===================================================================
--- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demandgroup/DemandGroupUI.css (rev 0)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demandgroup/DemandGroupUI.css 2014-04-10 12:18:23 UTC (rev 32)
@@ -0,0 +1,11 @@
+#groupedDemandDialog {
+ minimumSize: { new java.awt.Dimension(500, 0) };
+}
+
+#body {
+ title: "faxtomail.demandGroup.title";
+}
+
+#demandGroup {
+ editable: true;
+}
\ No newline at end of file
Copied: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demandgroup/DemandGroupUI.jaxx (from rev 30, trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/history/HistoryListUI.jaxx)
===================================================================
--- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demandgroup/DemandGroupUI.jaxx (rev 0)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demandgroup/DemandGroupUI.jaxx 2014-04-10 12:18:23 UTC (rev 32)
@@ -0,0 +1,23 @@
+<com.franciaflex.faxtomail.ui.swing.util.AbstractToolbarPopupUI
+ superGenericType="com.franciaflex.faxtomail.ui.swing.content.demande.DemandeUIModel, DemandGroupUIHandler"
+ id='groupedDemandDialog'>
+
+ <import>
+ com.franciaflex.faxtomail.ui.swing.content.demande.DemandeUIModel
+
+ org.jdesktop.swingx.JXTable
+ org.jdesktop.swingx.JXTitledPanel
+ </import>
+
+ <DemandeUIModel id='model'
+ initializer='getContextValue(DemandeUIModel.class)'/>
+
+ <JXTitledPanel id='body'>
+ <JScrollPane id='demandGroupBodyScrollPane'>
+ <JPanel id='mainPanel' layout="{new BorderLayout()}">
+ <JXTable id='demandGroup' constraints="BorderLayout.CENTER"/>
+ </JPanel>
+ </JScrollPane>
+ </JXTitledPanel>
+
+</com.franciaflex.faxtomail.ui.swing.util.AbstractToolbarPopupUI>
\ No newline at end of file
Copied: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demandgroup/DemandGroupUIHandler.java (from rev 30, trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/history/HistoryListUIHandler.java)
===================================================================
--- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demandgroup/DemandGroupUIHandler.java (rev 0)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demandgroup/DemandGroupUIHandler.java 2014-04-10 12:18:23 UTC (rev 32)
@@ -0,0 +1,177 @@
+package com.franciaflex.faxtomail.ui.swing.content.demandgroup;
+
+import com.franciaflex.faxtomail.persistence.entities.Attachment;
+import com.franciaflex.faxtomail.ui.swing.FaxToMailUIContext;
+import com.franciaflex.faxtomail.ui.swing.actions.ShowDemandeAction;
+import com.franciaflex.faxtomail.ui.swing.content.attachment.AttachmentItem;
+import com.franciaflex.faxtomail.ui.swing.content.demande.DemandeUIModel;
+import com.franciaflex.faxtomail.ui.swing.util.AbstractToolbarPopupHandler;
+import com.google.common.collect.Iterables;
+import jaxx.runtime.SwingUtil;
+import jaxx.runtime.swing.model.JaxxDefaultListModel;
+import jaxx.runtime.validator.swing.SwingValidator;
+import org.apache.commons.collections4.CollectionUtils;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.jdesktop.swingx.JXList;
+import org.jdesktop.swingx.JXTable;
+import org.jdesktop.swingx.decorator.HighlighterFactory;
+
+import javax.swing.*;
+import javax.swing.event.TableModelEvent;
+import javax.swing.event.TableModelListener;
+import javax.swing.table.AbstractTableModel;
+import javax.swing.table.DefaultTableColumnModel;
+import javax.swing.table.DefaultTableModel;
+import javax.swing.table.TableCellEditor;
+import javax.swing.table.TableCellRenderer;
+import javax.swing.table.TableColumn;
+import javax.swing.table.TableColumnModel;
+import javax.swing.table.TableModel;
+import java.awt.*;
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
+import java.util.Collection;
+
+/**
+ * @author Kevin Morin (Code Lutin)
+ * @since x.x
+ */
+public class DemandGroupUIHandler extends AbstractToolbarPopupHandler<DemandeUIModel, DemandGroupUI> {
+
+ private final static Log log = LogFactory.getLog(DemandGroupUIHandler.class);
+
+ @Override
+ public void beforeInit(DemandGroupUI ui) {
+ super.beforeInit(ui);
+
+ DemandeUIModel currentEmail = getContext().getCurrentEmail();
+ this.ui.setContextValue(currentEmail);
+ }
+
+ @Override
+ public void afterInit(DemandGroupUI ui) {
+ super.afterInit(ui);
+
+ initTable(ui.getDemandGroup());
+
+ getModel().addPropertyChangeListener(DemandeUIModel.PROPERTY_GROUPED_DEMANDES, new PropertyChangeListener() {
+ @Override
+ public void propertyChange(PropertyChangeEvent evt) {
+ AbstractTableModel tableModel = (AbstractTableModel) getUI().getDemandGroup().getModel();
+ tableModel.fireTableDataChanged();
+ }
+ });
+ }
+
+ protected void initTable(JXTable table) {
+
+ TableModel demandGroupTableModel = new AbstractTableModel() {
+ @Override
+ public int getRowCount() {
+ return getModel().sizeGroupedDemandes();
+ }
+
+ @Override
+ public int getColumnCount() {
+ return 1;
+ }
+
+ @Override
+ public Object getValueAt(int rowIndex, int columnIndex) {
+ return Iterables.get(getModel().getGroupedDemandes(), rowIndex);
+ }
+
+ @Override
+ public boolean isCellEditable(int rowIndex, int columnIndex) {
+ return true;
+ }
+ };
+
+ demandGroupTableModel.addTableModelListener(new TableModelListener() {
+ @Override
+ public void tableChanged(TableModelEvent e) {
+ getUI().pack();
+ }
+ });
+
+ TableColumnModel columnModel = new DefaultTableColumnModel();
+ TableColumn column = new TableColumn();
+ column.setCellRenderer(new DemandGroupItemRenderer());
+ column.setCellEditor(new DemandGroupItemEditor());
+ columnModel.addColumn(column);
+
+ table.setModel(demandGroupTableModel);
+ table.setColumnModel(columnModel);
+ table.addHighlighter(HighlighterFactory.createAlternateStriping());
+ }
+
+ @Override
+ public void onCloseUI() {
+ }
+
+ @Override
+ public SwingValidator<DemandeUIModel> getValidator() {
+ return null;
+ }
+
+ @Override
+ protected JComponent getComponentToFocus() {
+ return null;
+ }
+
+ public void openDemande(DemandeUIModel demande) {
+ closeEditor();
+
+ FaxToMailUIContext context = getContext();
+ context.setCurrentEmail(demande);
+ context.getActionEngine().runAction(new ShowDemandeAction(context.getMainUI().getHandler()));
+ }
+
+ protected class DemandGroupItemRenderer extends DemandGroupItem
+ implements TableCellRenderer {
+
+ public DemandGroupItemRenderer() {
+ super(DemandGroupUIHandler.this);
+ }
+
+ @Override
+ public Component getTableCellRendererComponent(JTable table, Object value,
+ boolean isSelected, boolean hasFocus, int row, int column) {
+ DemandeUIModel demand = (DemandeUIModel) value;
+ setDemande(demand);
+ return this;
+ }
+ }
+
+ protected class DemandGroupItemEditor extends AbstractCellEditor implements TableCellEditor {
+
+ protected DemandGroupItem demandGroupItem;
+
+ public DemandGroupItemEditor() {
+ demandGroupItem = new DemandGroupItem();
+ demandGroupItem.setHandler(DemandGroupUIHandler.this);
+ }
+
+ public Component getTableCellEditorComponent(JTable table, Object value,
+ boolean isSelected, int row, int column) {
+ DemandeUIModel demand = (DemandeUIModel) value;
+ demandGroupItem.setDemande(demand);
+
+ return demandGroupItem;
+ }
+
+ @Override
+ public Object getCellEditorValue() {
+ return demandGroupItem.getDemande();
+ }
+
+ public boolean stopCellEditing() {
+ return super.stopCellEditing();
+ }
+
+ protected void fireEditingStopped() {
+ super.fireEditingStopped();
+ }
+ }
+}
Modified: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/history/ButtonHistory.java
===================================================================
--- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/history/ButtonHistory.java 2014-04-04 15:42:36 UTC (rev 30)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/history/ButtonHistory.java 2014-04-10 12:18:23 UTC (rev 32)
@@ -1,27 +1,14 @@
-package com.franciaflex.faxtomail.ui.swing.util.history;
+package com.franciaflex.faxtomail.ui.swing.content.history;
-import com.franciaflex.faxtomail.persistence.entities.Attachment;
import com.franciaflex.faxtomail.persistence.entities.Email;
import com.franciaflex.faxtomail.persistence.entities.History;
import com.franciaflex.faxtomail.ui.swing.FaxToMailUIContext;
import com.franciaflex.faxtomail.ui.swing.util.AbstractToolbarPopupButton;
-import com.franciaflex.faxtomail.ui.swing.util.attachment.AttachmentEditorUI;
-import com.franciaflex.faxtomail.ui.swing.util.attachment.AttachmentModelAware;
-import jaxx.runtime.SwingUtil;
-import org.jdesktop.beans.AbstractSerializableBean;
+import com.franciaflex.faxtomail.ui.swing.content.attachment.AttachmentEditorUI;
-import javax.swing.*;
-import javax.swing.event.ChangeEvent;
-import javax.swing.event.ChangeListener;
-import java.awt.*;
-import java.awt.event.HierarchyBoundsAdapter;
-import java.awt.event.HierarchyEvent;
-import java.awt.event.WindowAdapter;
-import java.awt.event.WindowEvent;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
import java.util.Collection;
-import java.util.List;
import static org.nuiton.i18n.I18n.t;
Modified: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/history/HistoryItemModel.java
===================================================================
--- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/history/HistoryItemModel.java 2014-04-04 15:42:36 UTC (rev 30)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/history/HistoryItemModel.java 2014-04-10 12:18:23 UTC (rev 32)
@@ -1,23 +1,16 @@
-package com.franciaflex.faxtomail.ui.swing.util.history;
+package com.franciaflex.faxtomail.ui.swing.content.history;
-import com.franciaflex.faxtomail.persistence.entities.Email;
import com.franciaflex.faxtomail.persistence.entities.FaxToMailUser;
import com.franciaflex.faxtomail.persistence.entities.History;
import com.franciaflex.faxtomail.persistence.entities.HistoryImpl;
import com.franciaflex.faxtomail.persistence.entities.HistoryType;
import com.franciaflex.faxtomail.ui.swing.util.AbstractFaxToMailBeanUIModel;
-import org.apache.commons.lang3.StringUtils;
import org.nuiton.util.beans.Binder;
import org.nuiton.util.beans.BinderFactory;
-import java.text.DateFormat;
-import java.util.ArrayList;
import java.util.Collection;
import java.util.Date;
-import java.util.List;
-import static org.nuiton.i18n.I18n.t;
-
/**
* @author Kevin Morin (Code Lutin)
* @since x.x
Modified: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/history/HistoryListUI.jaxx
===================================================================
--- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/history/HistoryListUI.jaxx 2014-04-04 15:42:36 UTC (rev 30)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/history/HistoryListUI.jaxx 2014-04-10 12:18:23 UTC (rev 32)
@@ -1,14 +1,16 @@
<com.franciaflex.faxtomail.ui.swing.util.AbstractToolbarPopupUI
- superGenericType="HistoryListUIModel, HistoryListUIHandler"
+ superGenericType="com.franciaflex.faxtomail.ui.swing.content.demande.DemandeUIModel, HistoryListUIHandler"
id='historyListDialog'>
<import>
+ com.franciaflex.faxtomail.ui.swing.content.demande.DemandeUIModel
+
org.jdesktop.swingx.JXList
org.jdesktop.swingx.JXTitledPanel
</import>
- <HistoryListUIModel id='model'
- initializer='getContextValue(HistoryListUIModel.class)'/>
+ <DemandeUIModel id='model'
+ initializer='getContextValue(DemandeUIModel.class)'/>
<JXTitledPanel id='body'>
<JScrollPane id='attachmentBodyScrollPane'>
Modified: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/history/HistoryListUIHandler.java
===================================================================
--- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/history/HistoryListUIHandler.java 2014-04-04 15:42:36 UTC (rev 30)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/history/HistoryListUIHandler.java 2014-04-10 12:18:23 UTC (rev 32)
@@ -1,10 +1,9 @@
-package com.franciaflex.faxtomail.ui.swing.util.history;
+package com.franciaflex.faxtomail.ui.swing.content.history;
import com.franciaflex.faxtomail.persistence.entities.Email;
import com.franciaflex.faxtomail.persistence.entities.History;
import com.franciaflex.faxtomail.ui.swing.content.demande.DemandeUIModel;
import com.franciaflex.faxtomail.ui.swing.util.AbstractToolbarPopupHandler;
-import com.google.common.collect.Iterables;
import jaxx.runtime.swing.model.JaxxDefaultListModel;
import jaxx.runtime.validator.swing.SwingValidator;
import org.apache.commons.collections.CollectionUtils;
@@ -14,10 +13,8 @@
import org.jdesktop.swingx.JXList;
import org.jdesktop.swingx.decorator.HighlighterFactory;
import org.nuiton.i18n.I18n;
-import org.nuiton.util.StringUtil;
import javax.swing.*;
-import javax.swing.text.Highlighter;
import java.awt.*;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
@@ -31,7 +28,7 @@
* @author Kevin Morin (Code Lutin)
* @since x.x
*/
-public class HistoryListUIHandler extends AbstractToolbarPopupHandler<HistoryListUIModel, HistoryListUI> {
+public class HistoryListUIHandler extends AbstractToolbarPopupHandler<DemandeUIModel, HistoryListUI> {
private final static Log log = LogFactory.getLog(HistoryListUIHandler.class);
@@ -54,24 +51,12 @@
n("faxtomail.demande.rangeRow.label");
}
- protected PropertyChangeListener historyChangeListener = new PropertyChangeListener() {
- @Override
- public void propertyChange(PropertyChangeEvent evt) {
- Collection<History> history = (Collection<History>) evt.getNewValue();
- getModel().setHistory(history);
- }
- };
-
@Override
public void beforeInit(HistoryListUI ui) {
super.beforeInit(ui);
DemandeUIModel currentEmail = getContext().getCurrentEmail();
- currentEmail.addPropertyChangeListener(Email.PROPERTY_HISTORY, historyChangeListener);
- HistoryListUIModel model = new HistoryListUIModel();
- model.fromBean(currentEmail);
-
- this.ui.setContextValue(model);
+ this.ui.setContextValue(currentEmail);
}
@Override
@@ -96,11 +81,10 @@
@Override
public void onCloseUI() {
- getContext().getCurrentEmail().removePropertyChangeListener(Email.PROPERTY_HISTORY, historyChangeListener);
}
@Override
- public SwingValidator<HistoryListUIModel> getValidator() {
+ public SwingValidator<DemandeUIModel> getValidator() {
return null;
}
Deleted: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/history/HistoryListUIModel.java
===================================================================
--- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/history/HistoryListUIModel.java 2014-04-04 15:42:36 UTC (rev 30)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/history/HistoryListUIModel.java 2014-04-10 12:18:23 UTC (rev 32)
@@ -1,57 +0,0 @@
-package com.franciaflex.faxtomail.ui.swing.util.history;
-
-import com.franciaflex.faxtomail.persistence.entities.Email;
-import com.franciaflex.faxtomail.persistence.entities.EmailImpl;
-import com.franciaflex.faxtomail.persistence.entities.History;
-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.Collection;
-
-/**
- * @author Kevin Morin (Code Lutin)
- * @since x.x
- */
-public class HistoryListUIModel extends AbstractFaxToMailBeanUIModel<DemandeUIModel, HistoryListUIModel> {
-
- protected static Binder<HistoryListUIModel, DemandeUIModel> toBeanBinder =
- BinderFactory.newBinder(HistoryListUIModel.class,
- DemandeUIModel.class);
-
- protected static Binder<DemandeUIModel, HistoryListUIModel> fromBeanBinder =
- BinderFactory.newBinder(DemandeUIModel.class, HistoryListUIModel.class);
-
- protected final Email editObject = new EmailImpl();
-
- public HistoryListUIModel() {
- super(fromBeanBinder, toBeanBinder);
- }
-
- public void setHistory(Collection<History> history) {
- editObject.setHistory(history);
- firePropertyChanged(Email.PROPERTY_HISTORY, null, history);
- }
-
- public Collection<History> getHistory() {
- return editObject.getHistory();
- }
-
- public int sizeHistory() {
- return editObject.sizeHistory();
- }
-
- public boolean isHistoryEmpty() {
- return editObject.isHistoryEmpty();
- }
-
- public boolean isHistoryNotEmpty() {
- return editObject.isHistoryNotEmpty();
- }
-
- @Override
- protected DemandeUIModel newEntity() {
- return new DemandeUIModel();
- }
-}
Added: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/pdfeditor/PDFEditorCrossUI.css
===================================================================
--- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/pdfeditor/PDFEditorCrossUI.css (rev 0)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/pdfeditor/PDFEditorCrossUI.css 2014-04-10 12:18:23 UTC (rev 32)
@@ -0,0 +1,12 @@
+#crossPanel {
+ scaleImageToFitPanel: { true };
+ border: { BorderFactory.createDashedBorder(null) };
+}
+
+#removeButton {
+ text: "X";
+ //borderPainted: { false };
+ //border: { null };
+ //opaque : { false };
+ //background: { null };
+}
\ No newline at end of file
Added: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/pdfeditor/PDFEditorCrossUI.jaxx
===================================================================
--- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/pdfeditor/PDFEditorCrossUI.jaxx (rev 0)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/pdfeditor/PDFEditorCrossUI.jaxx 2014-04-10 12:18:23 UTC (rev 32)
@@ -0,0 +1,30 @@
+<com.franciaflex.faxtomail.ui.swing.util.JImagePanel id='crossPanel'>
+
+ <import>
+ java.awt.Color
+ java.awt.Dimension
+ java.awt.Font
+ javax.swing.BorderFactory
+ com.franciaflex.faxtomail.ui.swing.util.JImagePanel
+ </import>
+
+ <script><![CDATA[
+
+ public static final String CROSS_IMAGE_FILE = "cross_blue.png";
+
+ public PDFEditorCrossUI() {
+ setImage(SwingUtil.createImageIcon(CROSS_IMAGE_FILE).getImage());
+ }
+
+ protected void removeCross() {
+ JImagePanel container = getParentContainer(JImagePanel.class);
+ container.remove(this);
+ container.updateUI();
+ }
+
+ ]]></script>
+
+ <JButton id="removeButton"
+ onActionPerformed="removeCross()"/>
+
+</com.franciaflex.faxtomail.ui.swing.util.JImagePanel>
\ No newline at end of file
Added: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/pdfeditor/PDFEditorNoteUI.css
===================================================================
--- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/pdfeditor/PDFEditorNoteUI.css (rev 0)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/pdfeditor/PDFEditorNoteUI.css 2014-04-10 12:18:23 UTC (rev 32)
@@ -0,0 +1,30 @@
+#notePanel {
+ background: { Color.YELLOW };
+ border : { BorderFactory.createEmptyBorder(2, 2, 2, 2) };
+}
+
+#noteHeader {
+ background: { null };
+}
+
+#noteTitle {
+ font: { Font.decode(BaseFont.HELVETICA).deriveFont(Font.ITALIC) };
+ text: { getTitle() };
+}
+
+#removeButton {
+ text: "X";
+ borderPainted: { false };
+ border: { null };
+ opaque : { false };
+ background: { null };
+}
+
+#noteText {
+ border: { null };
+ opaque : { false };
+ background: { null };
+ font: { Font.decode(BaseFont.HELVETICA) };
+ lineWrap: { false };
+ wrapStyleWord: { false };
+}
\ No newline at end of file
Added: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/pdfeditor/PDFEditorNoteUI.jaxx
===================================================================
--- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/pdfeditor/PDFEditorNoteUI.jaxx (rev 0)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/pdfeditor/PDFEditorNoteUI.jaxx 2014-04-10 12:18:23 UTC (rev 32)
@@ -0,0 +1,52 @@
+<JPanel id='notePanel' layout='{new BorderLayout()}'>
+
+ <import>
+ java.awt.Color
+ java.awt.Dimension
+ java.awt.Font
+ java.awt.Insets
+ java.awt.Point
+ javax.swing.BorderFactory
+ com.itextpdf.text.pdf.BaseFont
+ com.franciaflex.faxtomail.ui.swing.util.JImagePanel
+ </import>
+
+ <script><![CDATA[
+
+ protected void textTyped() {
+ setText(getNoteText().getText());
+
+ JImagePanel container = getParentContainer(JImagePanel.class);
+ Point location = getLocation();
+ Insets insets = container.getInsets();
+ Dimension size = getPreferredSize();
+ setBounds(location.x + insets.left, location.y + insets.top,
+ size.width, size.height);
+ }
+
+ protected void removeNote() {
+ JImagePanel container = getParentContainer(JImagePanel.class);
+ container.remove(this);
+ container.updateUI();
+ }
+
+ ]]></script>
+
+ <String id="title" javaBean="null"/>
+ <String id="text" javaBean=""/>
+
+ <JPanel id="noteHeader"
+ layout='{ new BorderLayout() }'
+ constraints="BorderLayout.NORTH">
+ <JLabel id="noteTitle"
+ constraints="BorderLayout.CENTER"/>
+ <JButton id="removeButton"
+ constraints="BorderLayout.EAST"
+ onActionPerformed="removeNote()"/>
+ </JPanel>
+
+ <JTextArea id="noteText"
+ constraints="BorderLayout.CENTER"
+ onKeyTyped="textTyped()"/>
+
+</JPanel>
\ No newline at end of file
Added: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/pdfeditor/PDFEditorUI.css
===================================================================
--- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/pdfeditor/PDFEditorUI.css (rev 0)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/pdfeditor/PDFEditorUI.css 2014-04-10 12:18:23 UTC (rev 32)
@@ -0,0 +1,56 @@
+#toolbar {
+ floatable: false;
+ margin: {new java.awt.Insets(5, 0, 0, 5)};
+ borderPainted: false;
+}
+
+#noteButton {
+ actionIcon: note;
+ toolTipText: "faxtomail.pdfEitor.button.addNote.tip";
+}
+
+#crossButton {
+ actionIcon: cross;
+ toolTipText: "faxtomail.pdfEitor.button.addCross.tip";
+}
+
+#prevPageButton {
+ actionIcon: left;
+ enabled: { getModel().getCurrentPageIndex() > 1 };
+ toolTipText: "faxtomail.pdfEitor.button.previousPage";
+}
+
+#pageNumber {
+ bean: { model };
+ property: "currentPageIndex";
+ modelText: { String.valueOf(model.getCurrentPageIndex()) };
+ useFloat: false;
+ useSign: false;
+ autoPopup: false;
+ showPopupButton: false;
+ showReset: false;
+ width: 50;
+}
+
+#pageTotal {
+ text: { " / " + String.valueOf(model.getPages().length) };
+}
+
+#nextPageButton {
+ actionIcon: right;
+ enabled: { getModel().getCurrentPageIndex() < getModel().getPages().length };
+ toolTipText: "faxtomail.pdfEitor.button.nextPage";
+}
+
+#cancelButton {
+ actionIcon: cancel;
+ text: "faxtomail.pdfEitor.action.cancel";
+ toolTipText: "faxtomail.pdfEitor.action.cancel.tip";
+}
+
+#validateButton {
+ actionIcon: validate;
+ text: "faxtomail.pdfEitor.action.validate";
+ toolTipText: "faxtomail.pdfEitor.action.validate.tip";
+ _applicationAction: {com.franciaflex.faxtomail.ui.swing.actions.GenerateAnnotatedAttachmentAction.class};
+}
\ No newline at end of file
Added: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/pdfeditor/PDFEditorUI.jaxx
===================================================================
--- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/pdfeditor/PDFEditorUI.jaxx (rev 0)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/pdfeditor/PDFEditorUI.jaxx 2014-04-10 12:18:23 UTC (rev 32)
@@ -0,0 +1,56 @@
+<JPanel id="pdfEditorUIPanel"
+ layout='{new BorderLayout()}'
+ implements='com.franciaflex.faxtomail.ui.swing.util.FaxToMailUI<PDFEditorUIModel, PDFEditorUIHandler>'>
+
+ <import>
+ com.franciaflex.faxtomail.ui.swing.util.FaxToMailUI
+ com.franciaflex.faxtomail.ui.swing.util.FaxToMailUIUtil
+
+ com.franciaflex.faxtomail.ui.swing.util.JImagePanel
+
+ javax.swing.SwingConstants
+
+ jaxx.runtime.swing.editor.NumberEditor
+
+ </import>
+
+ <script><![CDATA[
+
+ public PDFEditorUI(FaxToMailUI parentUI) {
+ FaxToMailUIUtil.setParentUI(this, parentUI);
+ }
+
+ ]]></script>
+
+ <PDFEditorUIModel id='model' initializer='new PDFEditorUIModel()'/>
+
+ <JToolBar id="toolbar"
+ constraints='BorderLayout.NORTH'>
+ <JButton id='noteButton'
+ onActionPerformed="handler.addNote()"/>
+ <JButton id='crossButton'
+ onActionPerformed="handler.addCross()"/>
+
+ <JSeparator constructorParams="SwingConstants.VERTICAL"/>
+
+ <JButton id="prevPageButton"
+ onActionPerformed="getModel().decPageIndex()"/>
+ <NumberEditor id='pageNumber'
+ constructorParams='this' />
+ <JLabel id="pageTotal"/>
+ <JButton id="nextPageButton"
+ onActionPerformed="getModel().incPageIndex()"/>
+ </JToolBar>
+
+ <JScrollPane constraints='BorderLayout.CENTER'>
+ <JPanel>
+ <JImagePanel id="container">
+ </JImagePanel>
+ </JPanel>
+ </JScrollPane>
+
+ <JPanel layout='{new GridLayout(1, 0)}' constraints='BorderLayout.SOUTH'>
+ <JButton id='cancelButton' onActionPerformed='handler.closeDialog()'/>
+ <JButton id='validateButton'/>
+ </JPanel>
+</JPanel>
\ No newline at end of file
Added: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/pdfeditor/PDFEditorUIHandler.java
===================================================================
--- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/pdfeditor/PDFEditorUIHandler.java (rev 0)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/pdfeditor/PDFEditorUIHandler.java 2014-04-10 12:18:23 UTC (rev 32)
@@ -0,0 +1,297 @@
+package com.franciaflex.faxtomail.ui.swing.content.pdfeditor;
+
+import com.franciaflex.faxtomail.persistence.entities.Attachment;
+import com.franciaflex.faxtomail.ui.swing.util.AbstractFaxToMailUIHandler;
+import com.franciaflex.faxtomail.ui.swing.util.FaxToMailUIUtil;
+import com.franciaflex.faxtomail.ui.swing.util.JImagePanel;
+import com.itextpdf.text.Document;
+import com.itextpdf.text.DocumentException;
+import com.itextpdf.text.Paragraph;
+import com.itextpdf.text.pdf.PdfWriter;
+import com.sun.pdfview.PDFFile;
+import com.sun.pdfview.PDFPage;
+import jaxx.runtime.swing.ComponentMover;
+import jaxx.runtime.swing.ComponentResizer;
+import jaxx.runtime.validator.swing.SwingValidator;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import javax.swing.*;
+import java.awt.*;
+import java.awt.event.ContainerEvent;
+import java.awt.event.ContainerListener;
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.FileReader;
+import java.io.IOException;
+import java.io.RandomAccessFile;
+import java.nio.ByteBuffer;
+import java.nio.channels.FileChannel;
+import java.util.Date;
+
+/**
+ * @author Kevin Morin (Code Lutin)
+ * @since x.x
+ */
+public class PDFEditorUIHandler extends AbstractFaxToMailUIHandler<PDFEditorUIModel, PDFEditorUI> {
+
+ private static final Log log = LogFactory.getLog(PDFEditorUIHandler.class);
+
+ protected ComponentMover cm = new ComponentMover();
+ protected ComponentResizer cr = new ComponentResizer();
+
+ protected PDFFile pdf;
+
+ @Override
+ public void afterInit(PDFEditorUI pdfEditorUI) {
+ initUI(pdfEditorUI);
+
+ cm.setDragInsets(cr.getDragInsets());
+ cm.setEdgeInsets(new Insets(0, 0, 0, 0));
+
+
+ ui.getContainer().addContainerListener(new ContainerListener() {
+ @Override
+ public void componentAdded(ContainerEvent e) {
+ Component child = e.getChild();
+ PDFEditorUIModel.Page currentPage = getModel().getCurrentPage();
+ if (child.getClass().isAssignableFrom(PDFEditorNoteUI.class)) {
+ currentPage.addNote((PDFEditorNoteUI) child);
+
+ } else if (child.getClass().isAssignableFrom(PDFEditorCrossUI.class)) {
+ currentPage.addCross((PDFEditorCrossUI) child);
+ }
+ }
+
+ @Override
+ public void componentRemoved(ContainerEvent e) {
+ Component child = e.getChild();
+ PDFEditorUIModel.Page currentPage = getModel().getCurrentPage();
+ if (child.getClass().isAssignableFrom(PDFEditorNoteUI.class)) {
+ currentPage.removeNote((PDFEditorNoteUI) child);
+
+ } else if (child.getClass().isAssignableFrom(PDFEditorCrossUI.class)) {
+ currentPage.removeCross((PDFEditorCrossUI) child);
+ }
+ }
+ });
+
+ getModel().addPropertyChangeListener(PDFEditorUIModel.PROPERTY_CURRENT_PAGE_INDEX,
+ new PropertyChangeListener() {
+ @Override
+ public void propertyChange(PropertyChangeEvent evt) {
+ Integer pageNb = (Integer) evt.getNewValue();
+ Integer prevPageNb = (Integer) evt.getOldValue();
+ updatePageNumber(pageNb, prevPageNb);
+ }
+ });
+
+ getModel().addPropertyChangeListener(new PropertyChangeListener() {
+ @Override
+ public void propertyChange(PropertyChangeEvent evt) {
+ if (Attachment.PROPERTY_ORIGINAL_FILE.equals(evt.getPropertyName())
+ || Attachment.PROPERTY_EDITED_FILE.equals(evt.getPropertyName())) {
+
+ PDFEditorUIModel model = (PDFEditorUIModel) evt.getSource();
+ File file = model.getNotNullFile();
+
+ if (file != null) {
+ if (FaxToMailUIUtil.isFileATxt(file)) {
+ try {
+ file = convertTextToPdf(file);
+
+ } catch (IOException e) {
+ if (log.isErrorEnabled()) {
+ log.error("", e);
+ }
+ } catch (DocumentException e) {
+ if (log.isErrorEnabled()) {
+ log.error("", e);
+ }
+ }
+ }
+ if (FaxToMailUIUtil.isFileAPDF(file)) {
+ getUI().setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
+ try {
+ RandomAccessFile raf = new RandomAccessFile(file, "r");
+ FileChannel channel = raf.getChannel();
+ ByteBuffer buf = channel.map(FileChannel.MapMode.READ_ONLY, 0, channel.size());
+ pdf = new PDFFile(buf);
+
+ model.setPageNumber(pdf.getNumPages());
+ model.setCurrentPageIndex(1);
+
+ } catch (IOException e) {
+ if (log.isErrorEnabled()) {
+ log.error("", e);
+ }
+ }
+ getUI().setCursor(Cursor.getDefaultCursor());
+
+ } else {
+ model.setPageNumber(1);
+ model.setCurrentPageIndex(1);
+
+ JImagePanel container = getUI().getContainer();
+ if (FaxToMailUIUtil.isFileATxt(file)) {
+ JTextPane textPane = new JTextPane();
+ textPane.setEditable(false);
+ try {
+ FileReader fr = new FileReader(file);
+ BufferedReader br = new BufferedReader(fr);
+ String text = new String();
+ while (br.readLine() != null) {
+ text += br.readLine() + "\n";
+ }
+ textPane.setText(text);
+
+ log.debug(textPane.getText());
+
+ } catch (IOException e) {
+ if (log.isErrorEnabled()) {
+ log.error("", e);
+ }
+ }
+ container.add(textPane);
+
+ Insets insets = container.getInsets();
+ Dimension size = textPane.getPreferredSize();
+
+ container.setPreferredSize(size);
+ container.setMinimumSize(size);
+ container.setMaximumSize(size);
+ container.setSize(size);
+
+ textPane.setBounds(insets.left, insets.top, size.width, size.height);
+
+ container.updateUI();
+
+ } else {
+ if (FaxToMailUIUtil.isFileATif(file)) {
+ container.setTifImage(file);
+
+ } else {
+ container.setImage(file);
+ }
+ }
+ }
+ model.firePropertyChanged(PDFEditorUIModel.PROPERTY_CURRENT_PAGE_INDEX, null, 1);
+ }
+ }
+ }
+ });
+ }
+
+ @Override
+ protected JComponent getComponentToFocus() {
+ return null;
+ }
+
+ @Override
+ public SwingValidator<PDFEditorUIModel> getValidator() {
+ return null;
+ }
+
+ @Override
+ public void onCloseUI() {
+
+ }
+
+ public void addNote() {
+ PDFEditorNoteUI note = new PDFEditorNoteUI();
+ String title = decorate(new Date()) + " - " + getContext().getCurrentUser().getTrigraph();
+ note.setTitle(title);
+ addPanel(note);
+ }
+
+ public void addCross() {
+// java.awt.Image cross = SwingUtil.createImageIcon(CROSS_IMAGE_FILE).getImage();
+// JImagePanel panel = new JImagePanel(cross);
+// panel.setScaleImageToFitPanel(true);
+// panel.setBorder(BorderFactory.createDashedBorder(null));
+ PDFEditorCrossUI cross = new PDFEditorCrossUI();
+ addPanel(cross);
+ cr.registerComponent(cross);
+ }
+
+ protected void addPanel(JPanel panel) {
+ JImagePanel container = ui.getContainer();
+ container.add(panel, 0);
+
+ Insets insets = container.getInsets();
+ Dimension size = panel.getPreferredSize();
+ Rectangle rect = container.getVisibleRect();
+ panel.setBounds(rect.x + insets.left, rect.y + insets.top,
+ size.width, size.height);
+
+ container.updateUI();
+
+ cm.registerComponent(panel);
+ }
+
+ protected void updatePageNumber(Integer pageNb, Integer prevPageNb) {
+ if (pdf != null) {
+ if (pageNb != null) {
+ if (prevPageNb != null) {
+ PDFEditorUIModel.Page p = getModel().getPage(prevPageNb);
+ for (JPanel panel : p.getNotes()) {
+ panel.setVisible(false);
+ }
+ for (JPanel panel : p.getCrosses()) {
+ panel.setVisible(false);
+ }
+ }
+
+ PDFPage page = pdf.getPage(pageNb);
+ // create the image
+ Rectangle rect = new Rectangle(0, 0, (int) page.getBBox().getWidth(),
+ (int) page.getBBox().getHeight());
+
+ Image image = page.getImage(rect.width, rect.height, // width & height
+ rect, // clip rect
+ null, // null for the ImageObserver
+ true, // fill background with white
+ true // block until drawing is done
+ );
+ JImagePanel container = getUI().getContainer();
+ container.setImage(image);
+
+ PDFEditorUIModel.Page p = getModel().getPage(pageNb);
+ for (JPanel panel : p.getNotes()) {
+ panel.setVisible(true);
+ }
+ for (JPanel panel : p.getCrosses()) {
+ panel.setVisible(true);
+ }
+
+ container.updateUI();
+ }
+ }
+ }
+
+ public File convertTextToPdf(File file) throws IOException, DocumentException {
+ FileReader fr = new FileReader(file);
+ BufferedReader br = new BufferedReader(fr);
+ String text = new String();
+ while (br.readLine() != null) {
+ text += br.readLine() + "\n";
+ }
+
+ file = File.createTempFile(file.getName(), ".pdf");
+
+ Document document = new Document();
+ FileOutputStream fos = new FileOutputStream(file);
+ PdfWriter writer = PdfWriter.getInstance(document, fos);
+ writer.open();
+
+ document.open();
+ document.add(new Paragraph(text));
+ document.close();
+ writer.close();
+ return file;
+ }
+
+}
Added: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/pdfeditor/PDFEditorUIModel.java
===================================================================
--- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/pdfeditor/PDFEditorUIModel.java (rev 0)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/pdfeditor/PDFEditorUIModel.java 2014-04-10 12:18:23 UTC (rev 32)
@@ -0,0 +1,162 @@
+package com.franciaflex.faxtomail.ui.swing.content.pdfeditor;
+
+import com.franciaflex.faxtomail.persistence.entities.Attachment;
+import com.franciaflex.faxtomail.persistence.entities.AttachmentImpl;
+import com.franciaflex.faxtomail.ui.swing.util.AbstractFaxToMailBeanUIModel;
+import com.franciaflex.faxtomail.ui.swing.util.JImagePanel;
+import org.nuiton.util.beans.Binder;
+import org.nuiton.util.beans.BinderFactory;
+
+import javax.swing.*;
+import java.io.File;
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * @author Kevin Morin (Code Lutin)
+ * @since x.x
+ */
+public class PDFEditorUIModel extends AbstractFaxToMailBeanUIModel<Attachment, PDFEditorUIModel> {
+
+ public static final String PROPERTY_PAGES = "pages";
+ public static final String PROPERTY_CURRENT_PAGE_INDEX = "currentPageIndex";
+
+ protected final Attachment editObject = new AttachmentImpl();
+
+ public class Page {
+
+ protected List<PDFEditorNoteUI> notes = new ArrayList<PDFEditorNoteUI>();
+ protected List<JImagePanel> crosses = new ArrayList<JImagePanel>();
+
+ public List<PDFEditorNoteUI> getNotes() {
+ return notes;
+ }
+
+ public void addNote(PDFEditorNoteUI note) {
+ notes.add(note);
+ }
+
+ public void removeNote(PDFEditorNoteUI note) {
+ notes.remove(note);
+ }
+
+ public List<JImagePanel> getCrosses() {
+ return crosses;
+ }
+
+ public void addCross(JImagePanel cross) {
+ crosses.add(cross);
+ }
+
+ public void removeCross(JPanel cross) {
+ crosses.remove(cross);
+ }
+ }
+
+ protected Page[] pages;
+
+ // first page is 1 not 0
+ protected int currentPageIndex = -1;
+
+ protected static Binder<PDFEditorUIModel, Attachment> toBeanBinder =
+ BinderFactory.newBinder(PDFEditorUIModel.class,
+ Attachment.class);
+
+ protected static Binder<Attachment, PDFEditorUIModel> fromBeanBinder =
+ BinderFactory.newBinder(Attachment.class, PDFEditorUIModel.class);
+
+ public PDFEditorUIModel() {
+ super(fromBeanBinder, toBeanBinder);
+ }
+
+ public void setOriginalFile(File file) {
+ Object oldValue = getOriginalFile();
+ editObject.setOriginalFile(file);
+ firePropertyChange(Attachment.PROPERTY_ORIGINAL_FILE, oldValue, file);
+ }
+
+ public File getOriginalFile() {
+ return editObject.getOriginalFile();
+ }
+
+ public void setEditedFile(File file) {
+ Object oldValue = getEditedFile();
+ editObject.setEditedFile(file);
+ firePropertyChange(Attachment.PROPERTY_EDITED_FILE, oldValue, file);
+ }
+
+ public File getEditedFile() {
+ return editObject.getEditedFile();
+ }
+
+ public File getNotNullFile() {
+ File file = getEditedFile();
+ if (file == null) {
+ file = getOriginalFile();
+ }
+ return file;
+ }
+
+ public String getTopiaId() {
+ return editObject.getTopiaId();
+ }
+
+ public void setTopiaId(String id) {
+ Object oldValue = getTopiaId();
+ editObject.setTopiaId(id);
+ firePropertyChange(Attachment.PROPERTY_TOPIA_ID, oldValue, id);
+ }
+
+ public Page[] getPages() {
+ return pages;
+ }
+
+ public void setPageNumber(int nb) {
+ pages = new Page[nb];
+ for (int i = 0 ; i < nb ; i++) {
+ pages[i] = new Page();
+ }
+ firePropertyChanged(PROPERTY_PAGES, null, pages);
+ }
+
+ public Page getCurrentPage() {
+ if (pages == null || currentPageIndex < 1 || currentPageIndex > pages.length) {
+ return null;
+ }
+ return pages[currentPageIndex - 1];
+ }
+
+ public Page getPage(int i) {
+ if (pages == null || i < 1 || i > pages.length) {
+ return null;
+ }
+ return pages[i - 1];
+ }
+
+ public int getCurrentPageIndex() {
+ return currentPageIndex;
+ }
+
+ public void setCurrentPageIndex(int currentPageIndex) {
+ Object oldValue = getCurrentPageIndex();
+ currentPageIndex = Math.max(1, currentPageIndex);
+ if (pages != null) {
+ currentPageIndex = Math.min(pages.length, currentPageIndex);
+ }
+ this.currentPageIndex = currentPageIndex;
+ firePropertyChange(PROPERTY_CURRENT_PAGE_INDEX, oldValue, currentPageIndex);
+ }
+
+ public void decPageIndex() {
+ setCurrentPageIndex(currentPageIndex - 1);
+ }
+
+ public void incPageIndex() {
+ setCurrentPageIndex(currentPageIndex + 1);
+ }
+
+ @Override
+ protected Attachment newEntity() {
+ return new AttachmentImpl();
+ }
+}
Modified: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/reply/ReplyFormUI.jaxx
===================================================================
--- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/reply/ReplyFormUI.jaxx 2014-04-07 14:02:17 UTC (rev 31)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/reply/ReplyFormUI.jaxx 2014-04-10 12:18:23 UTC (rev 32)
@@ -26,7 +26,7 @@
com.franciaflex.faxtomail.ui.swing.FaxToMailUIContext
com.franciaflex.faxtomail.ui.swing.util.FaxToMailUI
com.franciaflex.faxtomail.ui.swing.util.FaxToMailUIUtil
- com.franciaflex.faxtomail.ui.swing.util.attachment.ButtonAttachment
+ com.franciaflex.faxtomail.ui.swing.content.attachment.ButtonAttachment
com.franciaflex.faxtomail.persistence.entities.Email
com.franciaflex.faxtomail.persistence.entities.DemandType
Modified: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/reply/ReplyFormUIHandler.java
===================================================================
--- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/reply/ReplyFormUIHandler.java 2014-04-07 14:02:17 UTC (rev 31)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/reply/ReplyFormUIHandler.java 2014-04-10 12:18:23 UTC (rev 32)
@@ -34,7 +34,7 @@
@Override
public void cancel() {
- getParentContainer(JFrame.class).setVisible(false);
+ closeFrame();
}
@Override
Modified: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/reply/ReplyFormUIModel.java
===================================================================
--- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/reply/ReplyFormUIModel.java 2014-04-07 14:02:17 UTC (rev 31)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/reply/ReplyFormUIModel.java 2014-04-10 12:18:23 UTC (rev 32)
@@ -1,7 +1,7 @@
package com.franciaflex.faxtomail.ui.swing.content.reply;
import com.franciaflex.faxtomail.persistence.entities.Attachment;
-import com.franciaflex.faxtomail.ui.swing.util.attachment.AttachmentModelAware;
+import com.franciaflex.faxtomail.ui.swing.content.attachment.AttachmentModelAware;
import org.jdesktop.beans.AbstractSerializableBean;
import java.util.ArrayList;
Added: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/search/SearchToGroupUI.css
===================================================================
--- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/search/SearchToGroupUI.css (rev 0)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/search/SearchToGroupUI.css 2014-04-10 12:18:23 UTC (rev 32)
@@ -0,0 +1,194 @@
+/*
+ * #%L
+ * FaxToMail :: UI
+ * %%
+ * Copyright (C) 2014 Franciaflex
+ * %%
+ * 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 {
+ oneTouchExpandable:true;
+}
+
+BeanFilterableComboBox {
+ showReset: true;
+ showDecorator: false;
+ bean: {model};
+}
+
+JXDatePicker {
+ _selectOnFocus: {true};
+}
+
+.between2ndPartLabel {
+ text: "faxtomail.search.between2ndPart.label";
+}
+
+#goToFolderMenu {
+ actionIcon: list;
+ text: "faxtomail.search.action.gotoFolder";
+ toolTipText: "faxtomail.search.action.gotoFolder.tip";
+ enabled: { model.isMenuEnabled() };
+}
+
+#modifiedByLabel {
+ text: "faxtomail.search.modifiedBy.label";
+}
+
+#takenByLabel {
+ text: "faxtomail.demande.takenBy.label";
+}
+
+#takenByComboBox {
+ property: takenBy;
+ selectedItem: { model.getTakenBy() };
+}
+
+#modifiedBetweenLabel {
+ text: "faxtomail.search.modifiedBetween.label";
+}
+
+#modifiedBetweenStartDatePicker {
+ date: { model.getMinModificationDate() };
+}
+
+#modifiedBetweenEndDatePicker {
+ date: { model.getMaxModificationDate() };
+}
+
+#receivedBetweenLabel {
+ text: "faxtomail.search.receivedBetween.label";
+}
+
+#receivedBetweenStartDatePicker {
+ date: { model.getMinReceptionDate() };
+}
+
+#receivedBetweenEndDatePicker {
+ date: { model.getMaxReceptionDate() };
+}
+
+#printedBetweenLabel {
+ text: "faxtomail.search.printedBetween.label";
+}
+
+#printedBetweenStartDatePicker {
+ date: { model.getMinPrintingDate() };
+}
+
+#printedBetweenEndDatePicker {
+ date: { model.getMaxPrintingDate() };
+}
+
+#objectLabel {
+ text: "faxtomail.demande.object.label";
+}
+
+#objectField {
+ text: {model.getObject()};
+}
+
+#senderLabel {
+ text: "faxtomail.demande.sender.label";
+}
+
+#senderField {
+ text: {model.getSender()};
+}
+
+#clientLabel {
+ text: "faxtomail.demande.client.label";
+}
+
+/*#clientField {
+ text: {model.getClientCode()};
+}*/
+
+#docTypeLabel {
+ text: "faxtomail.demande.docType.label";
+}
+
+#docTypeComboBox {
+ property: demandType;
+ selectedItem: { model.getDemandType() };
+}
+
+#ediCodeNumberLabel {
+ text: "faxtomail.demande.ediCodeNumber.label";
+}
+
+#ediCodeNumberField {
+ text: { model.getEdiCodeNumber() };
+ editable: false;
+}
+
+#priorityLabel {
+ text: "faxtomail.demande.priority.label";
+}
+
+#priorityComboBox {
+ property: priority;
+ selectedItem: { model.getPriority() };
+}
+
+#statusLabel {
+ text: "faxtomail.demande.status.label";
+}
+
+#statusComboBox {
+ property: demandStatus;
+ selectedItem: { model.getDemandStatus() };
+}
+
+#etatAttenteLabel {
+ text: "faxtomail.demande.etatAttente.label";
+}
+
+#etatAttenteComboBox {
+ property: etatAttente;
+ selectedItem: { model.getEtatAttente() };
+}
+
+#projectReferenceLabel {
+ text: "faxtomail.demande.projectReference.label";
+}
+
+#projectReferenceField {
+ text: { model.getProjectReference() };
+}
+
+#searchButton {
+ text: "faxtomail.search.button.label";
+ _applicationAction: { com.franciaflex.faxtomail.ui.swing.actions.SearchToGroupAction.class };
+}
+
+#dataTable {
+ editable: true;
+ autoCreateRowSorter: true;
+}
+
+#groupButton {
+ actionIcon: group;
+ text: "faxtomail.searchToGroup.action.group";
+ toolTipText: "faxtomail.searchToGroup.action.group.tip";
+ enabled: { model.isGroupEnabled() };
+}
+
+#cancelButton {
+ actionIcon: cancel;
+ text: "faxtomail.searchToGroup.action.cancel";
+ toolTipText: "faxtomail.searchToGroup.action.cancel.tip";
+}
\ No newline at end of file
Added: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/search/SearchToGroupUI.jaxx
===================================================================
--- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/search/SearchToGroupUI.jaxx (rev 0)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/search/SearchToGroupUI.jaxx 2014-04-10 12:18:23 UTC (rev 32)
@@ -0,0 +1,221 @@
+<JPanel id='searchToGroupPanel'
+ implements='com.franciaflex.faxtomail.ui.swing.util.FaxToMailUI<SearchUIModel, SearchToGroupUIHandler>'>
+
+ <import>
+ com.franciaflex.faxtomail.ui.swing.FaxToMailUIContext
+ com.franciaflex.faxtomail.ui.swing.util.FaxToMailUI
+ com.franciaflex.faxtomail.ui.swing.util.FaxToMailUIUtil
+
+ com.franciaflex.faxtomail.persistence.entities.HasLabel
+ com.franciaflex.faxtomail.persistence.entities.Email
+ com.franciaflex.faxtomail.persistence.entities.DemandType
+ com.franciaflex.faxtomail.persistence.entities.DemandStatus
+ com.franciaflex.faxtomail.persistence.entities.Range
+ com.franciaflex.faxtomail.persistence.entities.Priority
+ com.franciaflex.faxtomail.persistence.entities.EtatAttente
+ com.franciaflex.faxtomail.persistence.entities.FaxToMailUser
+
+ jaxx.runtime.swing.editor.bean.BeanFilterableComboBox
+
+ org.jdesktop.swingx.JXDatePicker
+ org.jdesktop.swingx.JXTitledPanel
+ org.jdesktop.swingx.JXTable
+ </import>
+
+ <script><![CDATA[
+
+ public SearchToGroupUI(FaxToMailUI parentUI) {
+ FaxToMailUIUtil.setParentUI(this, parentUI);
+ }
+
+ ]]></script>
+
+ <SearchUIModel id='model'
+ initializer='getContextValue(SearchUIModel.class)'/>
+
+ <JSplitPane orientation="{JSplitPane.VERTICAL_SPLIT}"
+ constraints='BorderLayout.CENTER'>
+
+ <JPanel layout='{new BorderLayout()}'>
+ <JScrollPane id='searchScrollPane' constraints='BorderLayout.CENTER'>
+
+ <Table fill='both'>
+
+ <row>
+ <cell anchor='west'>
+ <JLabel id='receivedBetweenLabel'/>
+ </cell>
+ <cell weightx='1'>
+ <JXDatePicker id='receivedBetweenStartDatePicker'/>
+ </cell>
+ <cell>
+ <JLabel styleClass='between2ndPartLabel'/>
+ </cell>
+ <cell weightx='1'>
+ <JXDatePicker id='receivedBetweenEndDatePicker'/>
+ </cell>
+
+ <cell>
+ <JLabel id='takenByLabel'/>
+ </cell>
+ <cell weightx='2'>
+ <BeanFilterableComboBox id='takenByComboBox'
+ constructorParams='this'
+ genericType="FaxToMailUser"/>
+ </cell>
+ </row>
+
+ <row>
+ <cell anchor='west'>
+ <JLabel id='modifiedBetweenLabel'/>
+ </cell>
+ <cell weightx='1'>
+ <JXDatePicker id='modifiedBetweenStartDatePicker'/>
+ </cell>
+ <cell>
+ <JLabel styleClass='between2ndPartLabel'/>
+ </cell>
+ <cell weightx='1'>
+ <JXDatePicker id='modifiedBetweenEndDatePicker'/>
+ </cell>
+
+ <cell anchor='west'>
+ <JLabel id='modifiedByLabel'/>
+ </cell>
+ <cell weightx='2'>
+ <BeanFilterableComboBox id='modifiedByComboBox'
+ constructorParams='this'
+ genericType="FaxToMailUser"/>
+ </cell>
+ </row>
+
+ <row>
+ <cell anchor='west'>
+ <JLabel id='printedBetweenLabel'/>
+ </cell>
+ <cell weightx='1'>
+ <JXDatePicker id='printedBetweenStartDatePicker'/>
+ </cell>
+ <cell>
+ <JLabel styleClass='between2ndPartLabel'/>
+ </cell>
+ <cell weightx='1'>
+ <JXDatePicker id='printedBetweenEndDatePicker'/>
+ </cell>
+ </row>
+
+ <row>
+ <cell>
+ <JLabel id='senderLabel'/>
+ </cell>
+ <cell columns='3' weightx="1">
+ <JTextField id='senderField'
+ onKeyReleased='handler.setText(event, "sender")'/>
+ </cell>
+
+ <cell>
+ <JLabel id='clientLabel'/>
+ </cell>
+ <cell weightx='1'>
+ <JTextField id='clientField'
+ onKeyReleased='handler.setText(event, "clientCode")'/>
+ </cell>
+ </row>
+
+ <row>
+ <cell>
+ <JLabel id='objectLabel'/>
+ </cell>
+ <cell columns='3' weightx='1'>
+ <JTextField id='objectField'
+ onKeyReleased='handler.setText(event, "object")'/>
+ </cell>
+
+ <cell>
+ <JLabel id='docTypeLabel'/>
+ </cell>
+ <cell weightx='1'>
+ <BeanFilterableComboBox id='docTypeComboBox'
+ constructorParams='this'
+ genericType="DemandType"/>
+ </cell>
+ </row>
+
+ <row>
+ <cell>
+ <JLabel id='ediCodeNumberLabel'/>
+ </cell>
+ <cell columns='3' weightx='1'>
+ <JTextField id='ediCodeNumberField'/>
+ </cell>
+
+ <cell>
+ <JLabel id='projectReferenceLabel'/>
+ </cell>
+ <cell weightx='1'>
+ <JTextField id='projectReferenceField'/>
+ </cell>
+ </row>
+
+ <row>
+ <cell>
+ <JLabel id='priorityLabel'/>
+ </cell>
+ <cell weightx='1'>
+ <BeanFilterableComboBox id='priorityComboBox'
+ constructorParams='this'
+ genericType="Priority"/>
+ </cell>
+
+ <cell>
+ <JLabel id='statusLabel'/>
+ </cell>
+ <cell weightx='1'>
+ <BeanFilterableComboBox id='statusComboBox'
+ constructorParams='this'
+ genericType="DemandStatus"/>
+ </cell>
+
+ <cell>
+ <JLabel id='etatAttenteLabel'/>
+ </cell>
+ <cell weightx='2'>
+ <BeanFilterableComboBox id='etatAttenteComboBox'
+ constructorParams='this'
+ genericType="EtatAttente"/>
+ </cell>
+ </row>
+
+ <!--<row>-->
+ <!--<cell anchor='east'>-->
+ <!--<JLabel id='gammeLabel'/>-->
+ <!--</cell>-->
+ <!--<cell weightx='1' columns='6'>-->
+ <!--<BeanFilterableComboBox id='gammeComboBox'-->
+ <!--constructorParams='this'-->
+ <!--genericType="Range"/>-->
+ <!--</cell>-->
+ <!--</row>-->
+
+ </Table>
+ </JScrollPane>
+
+ <JPanel constraints='BorderLayout.SOUTH'>
+ <JButton id="searchButton"/>
+ </JPanel>
+ </JPanel>
+
+ <JPanel layout='{new BorderLayout()}'>
+ <JScrollPane constraints='BorderLayout.CENTER'>
+ <JXTable id='dataTable'/>
+ </JScrollPane>
+ </JPanel>
+
+ </JSplitPane>
+
+ <JPanel layout='{new GridLayout(1, 0)}' constraints='BorderLayout.SOUTH'>
+ <JButton id='cancelButton' onActionPerformed='handler.cancel()'/>
+ <JButton id='groupButton' onActionPerformed='handler.group()'/>
+ </JPanel>
+
+</JPanel>
\ No newline at end of file
Added: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/search/SearchToGroupUIHandler.java
===================================================================
--- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/search/SearchToGroupUIHandler.java (rev 0)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/search/SearchToGroupUIHandler.java 2014-04-10 12:18:23 UTC (rev 32)
@@ -0,0 +1,216 @@
+package com.franciaflex.faxtomail.ui.swing.content.search;
+
+import com.franciaflex.faxtomail.persistence.entities.DemandStatus;
+import com.franciaflex.faxtomail.persistence.entities.Email;
+import com.franciaflex.faxtomail.persistence.entities.FaxToMailUser;
+import com.franciaflex.faxtomail.services.service.EmailService;
+import com.franciaflex.faxtomail.services.service.ReferentielService;
+import com.franciaflex.faxtomail.ui.swing.actions.GroupAction;
+import com.franciaflex.faxtomail.ui.swing.actions.SearchAction;
+import com.franciaflex.faxtomail.ui.swing.actions.ShowDemandeListAction;
+import com.franciaflex.faxtomail.ui.swing.content.demande.DemandeUIModel;
+import com.franciaflex.faxtomail.ui.swing.util.AbstractFaxToMailDemandListHandler;
+import com.franciaflex.faxtomail.ui.swing.util.Cancelable;
+import com.franciaflex.faxtomail.ui.swing.util.DemandeTableModel;
+import jaxx.runtime.validator.swing.SwingValidator;
+import org.apache.commons.lang3.ArrayUtils;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.jdesktop.swingx.JXTable;
+import org.jdesktop.swingx.decorator.ColorHighlighter;
+import org.jdesktop.swingx.decorator.ComponentAdapter;
+import org.jdesktop.swingx.decorator.HighlightPredicate;
+import org.nuiton.jaxx.application.swing.table.AbstractApplicationTableModel;
+
+import javax.swing.*;
+import javax.swing.event.ListSelectionEvent;
+import javax.swing.event.ListSelectionListener;
+import java.awt.*;
+import java.awt.event.KeyEvent;
+import java.awt.event.MouseAdapter;
+import java.awt.event.MouseEvent;
+import java.awt.event.MouseListener;
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
+import java.util.Arrays;
+import java.util.Calendar;
+import java.util.Date;
+import java.util.List;
+
+import static org.nuiton.i18n.I18n.t;
+
+/**
+ * @author Kevin Morin (Code Lutin)
+ * @since x.x
+ */
+public class SearchToGroupUIHandler extends AbstractFaxToMailDemandListHandler<SearchUIModel, SearchToGroupUI>
+ implements Cancelable {
+
+ /** Logger. */
+ private static final Log log = LogFactory.getLog(SearchToGroupUIHandler.class);
+
+ @Override
+ public void beforeInit(SearchToGroupUI ui) {
+ super.beforeInit(ui);
+
+ SearchUIModel searchUIModel = getContext().getSearch();
+ if (searchUIModel == null) {
+ searchUIModel = new SearchUIModel();
+ searchUIModel.setTakenBy(getContext().getCurrentUser());
+ searchUIModel.setModifiedBy(getContext().getCurrentUser());
+
+ Date now = new Date();
+ Calendar cal = Calendar.getInstance();
+ cal.add(Calendar.MONTH, -2);
+ Date twoMonthsAgo = cal.getTime();
+
+ searchUIModel.setMaxModificationDate(now);
+ searchUIModel.setMinModificationDate(twoMonthsAgo);
+ searchUIModel.setMaxReceptionDate(now);
+ searchUIModel.setMinReceptionDate(twoMonthsAgo);
+ searchUIModel.setMaxPrintingDate(now);
+ searchUIModel.setMinPrintingDate(twoMonthsAgo);
+ }
+
+ getUI().setContextValue(searchUIModel);
+ }
+
+ @Override
+ protected JComponent getComponentToFocus() {
+ return null;
+ }
+
+ @Override
+ public void afterInit(SearchToGroupUI ui) {
+ initUI(ui);
+
+ ReferentielService referentielService = getContext().getReferentielService();
+
+ SearchUIModel model = getModel();
+ initBeanFilterableComboBox(ui.getTakenByComboBox(),
+ getContext().getUserService().getAllUsers(),
+ model.getTakenBy());
+ initBeanFilterableComboBox(ui.getModifiedByComboBox(),
+ getContext().getUserService().getAllUsers(),
+ model.getModifiedBy());
+ initBeanFilterableComboBox(ui.getDocTypeComboBox(),
+ referentielService.getAllDemandType(),
+ model.getDemandType());
+ initBeanFilterableComboBox(ui.getPriorityComboBox(),
+ referentielService.getAllPriority(),
+ model.getPriority());
+ initBeanFilterableComboBox(ui.getEtatAttenteComboBox(),
+ referentielService.getAllEtatAttente(),
+ model.getEtatAttente());
+ initBeanFilterableComboBox(ui.getStatusComboBox(),
+ Arrays.asList(DemandStatus.values()),
+ model.getDemandStatus());
+
+ final JXTable dataTable = getUI().getDataTable();
+ dataTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
+
+ final AbstractApplicationTableModel<DemandeUIModel> tableModel = initDemandeTable(dataTable, true);
+
+ model.addPropertyChangeListener(SearchUIModel.PROPERTY_RESULTS, new PropertyChangeListener() {
+ @Override
+ public void propertyChange(PropertyChangeEvent evt) {
+ List<DemandeUIModel> emails = (List<DemandeUIModel>) evt.getNewValue();
+ tableModel.setRows(emails);
+ showInformationMessage(t("faxtomail.search.resultNb", emails.size()));
+
+ DemandeUIModel currentEmail = getContext().getCurrentEmail();
+ if (currentEmail != null) {
+ int row = tableModel.getRowIndex(currentEmail);
+ if (row > 0) {
+ dataTable.setRowSelectionInterval(row, row);
+ }
+ }
+ }
+ });
+
+ if (getContext().getSearch() != null) {
+ try {
+ SearchAction searchAction = getContext().getActionFactory().createLogicAction(this, SearchAction.class);
+ searchAction.doAction();
+
+ } catch (Exception e) {
+ if (log.isErrorEnabled()) {
+ log.error("error while searching", e);
+ }
+ }
+ }
+
+ dataTable.getSelectionModel().addListSelectionListener(new ListSelectionListener() {
+ @Override
+ public void valueChanged(ListSelectionEvent e) {
+ if (!e.getValueIsAdjusting()) {
+ ListSelectionModel selectionModel = (ListSelectionModel) e.getSource();
+ SearchUIModel model = getModel();
+ int selectedIndex = selectionModel.getLeadSelectionIndex();
+ DemandeUIModel selectedModel = selectedIndex < 0 ? null : tableModel.getEntry(selectedIndex);
+ model.setGroupEnabled(!selectionModel.isSelectionEmpty() && isDemandSelectable(selectedModel));
+ }
+ }
+ });
+
+ HighlightPredicate rowAlreadyInGroupPredicate = new HighlightPredicate() {
+ @Override
+ public boolean isHighlighted(Component renderer, ComponentAdapter adapter) {
+ int viewRow = adapter.row;
+ int modelRow = adapter.convertRowIndexToModel(viewRow);
+ DemandeUIModel row = tableModel.getEntry(modelRow);
+ return !isDemandSelectable(row);
+ }
+ };
+ dataTable.addHighlighter(new ColorHighlighter(rowAlreadyInGroupPredicate, null, Color.GRAY, Color.GRAY, Color.WHITE));
+
+ }
+
+ protected boolean isDemandSelectable(DemandeUIModel demand) {
+ DemandeUIModel currentDemand = getContext().getCurrentEmail();
+ return !currentDemand.equals(demand) && !currentDemand.getGroupedDemandes().contains(demand);
+ }
+
+ @Override
+ protected MouseListener getDataTableMouseListener() {
+ return new MouseAdapter() {
+ @Override
+ public void mouseClicked(MouseEvent e) {
+ if (SwingUtilities.isLeftMouseButton(e) && e.getClickCount() == 2) {
+ group();
+ }
+ }
+ };
+ }
+
+ @Override
+ protected String[] getEditableTableProperties() {
+ return new String[0];
+ }
+
+ @Override
+ public void onCloseUI() {
+ }
+
+ @Override
+ public SwingValidator<SearchUIModel> getValidator() {
+ return null;
+ }
+
+ @Override
+ public void cancel() {
+ closeFrame();
+ }
+
+ public void group(KeyEvent e) {
+ if (e.getKeyCode() == KeyEvent.VK_ENTER) {
+ group();
+ }
+ }
+
+ public void group() {
+ if (getModel().isGroupEnabled()) {
+ getContext().getActionEngine().runAction(new GroupAction(this));
+ }
+ }
+}
Modified: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/search/SearchUI.css
===================================================================
--- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/search/SearchUI.css 2014-04-07 14:02:17 UTC (rev 31)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/search/SearchUI.css 2014-04-10 12:18:23 UTC (rev 32)
@@ -41,6 +41,7 @@
actionIcon: list;
text: "faxtomail.search.action.gotoFolder";
toolTipText: "faxtomail.search.action.gotoFolder.tip";
+ enabled: { model.isMenuEnabled() };
}
#modifiedByLabel {
Modified: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/search/SearchUI.jaxx
===================================================================
--- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/search/SearchUI.jaxx 2014-04-07 14:02:17 UTC (rev 31)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/search/SearchUI.jaxx 2014-04-10 12:18:23 UTC (rev 32)
@@ -19,9 +19,8 @@
<http://www.gnu.org/licenses/gpl-3.0.html>.
#L%
-->
-<JSplitPane id='searchPanel'
- orientation="{JSplitPane.VERTICAL_SPLIT}"
- implements='com.franciaflex.faxtomail.ui.swing.util.FaxToMailUI<SearchUIModel, SearchUIHandler>'>
+<JPanel id='searchPanel'
+ implements='com.franciaflex.faxtomail.ui.swing.util.FaxToMailUI<SearchUIModel, SearchUIHandler>'>
<import>
com.franciaflex.faxtomail.ui.swing.FaxToMailUIContext
@@ -53,7 +52,7 @@
]]></script>
<SearchUIModel id='model'
- initializer='getContextValue(SearchUIModel.class)'/>
+ initializer='getContextValue(SearchUIModel.class)'/>
<JPopupMenu id='tablePopup'>
<JMenuItem id='goToFolderMenu'
@@ -66,181 +65,186 @@
<!--onActionPerformed='handler.addAttachment()'/>-->
</JPopupMenu>
- <JPanel layout='{new BorderLayout()}'>
- <JScrollPane id='searchScrollPane' constraints='BorderLayout.CENTER'>
+ <JSplitPane orientation="{JSplitPane.VERTICAL_SPLIT}"
+ constraints='BorderLayout.CENTER'>
- <Table fill='both'>
+ <JPanel layout='{new BorderLayout()}'>
+ <JScrollPane id='searchScrollPane' constraints='BorderLayout.CENTER'>
- <row>
- <cell anchor='west'>
- <JLabel id='receivedBetweenLabel'/>
- </cell>
- <cell weightx='1'>
- <JXDatePicker id='receivedBetweenStartDatePicker'/>
- </cell>
- <cell>
- <JLabel styleClass='between2ndPartLabel'/>
- </cell>
- <cell weightx='1'>
- <JXDatePicker id='receivedBetweenEndDatePicker'/>
- </cell>
+ <Table fill='both'>
- <cell>
- <JLabel id='takenByLabel'/>
- </cell>
- <cell weightx='2'>
- <BeanFilterableComboBox id='takenByComboBox'
- constructorParams='this'
- genericType="FaxToMailUser"/>
- </cell>
- </row>
+ <row>
+ <cell anchor='west'>
+ <JLabel id='receivedBetweenLabel'/>
+ </cell>
+ <cell weightx='1'>
+ <JXDatePicker id='receivedBetweenStartDatePicker'/>
+ </cell>
+ <cell>
+ <JLabel styleClass='between2ndPartLabel'/>
+ </cell>
+ <cell weightx='1'>
+ <JXDatePicker id='receivedBetweenEndDatePicker'/>
+ </cell>
- <row>
- <cell anchor='west'>
- <JLabel id='modifiedBetweenLabel'/>
- </cell>
- <cell weightx='1'>
- <JXDatePicker id='modifiedBetweenStartDatePicker'/>
- </cell>
- <cell>
- <JLabel styleClass='between2ndPartLabel'/>
- </cell>
- <cell weightx='1'>
- <JXDatePicker id='modifiedBetweenEndDatePicker'/>
- </cell>
+ <cell>
+ <JLabel id='takenByLabel'/>
+ </cell>
+ <cell weightx='2'>
+ <BeanFilterableComboBox id='takenByComboBox'
+ constructorParams='this'
+ genericType="FaxToMailUser"/>
+ </cell>
+ </row>
- <cell anchor='west'>
- <JLabel id='modifiedByLabel'/>
- </cell>
- <cell weightx='2'>
- <BeanFilterableComboBox id='modifiedByComboBox'
- constructorParams='this'
- genericType="FaxToMailUser"/>
- </cell>
- </row>
+ <row>
+ <cell anchor='west'>
+ <JLabel id='modifiedBetweenLabel'/>
+ </cell>
+ <cell weightx='1'>
+ <JXDatePicker id='modifiedBetweenStartDatePicker'/>
+ </cell>
+ <cell>
+ <JLabel styleClass='between2ndPartLabel'/>
+ </cell>
+ <cell weightx='1'>
+ <JXDatePicker id='modifiedBetweenEndDatePicker'/>
+ </cell>
- <row>
- <cell anchor='west'>
- <JLabel id='printedBetweenLabel'/>
- </cell>
- <cell weightx='1'>
- <JXDatePicker id='printedBetweenStartDatePicker'/>
- </cell>
- <cell>
- <JLabel styleClass='between2ndPartLabel'/>
- </cell>
- <cell weightx='1'>
- <JXDatePicker id='printedBetweenEndDatePicker'/>
- </cell>
- </row>
+ <cell anchor='west'>
+ <JLabel id='modifiedByLabel'/>
+ </cell>
+ <cell weightx='2'>
+ <BeanFilterableComboBox id='modifiedByComboBox'
+ constructorParams='this'
+ genericType="FaxToMailUser"/>
+ </cell>
+ </row>
- <row>
- <cell>
- <JLabel id='senderLabel'/>
- </cell>
- <cell columns='3' weightx="1">
- <JTextField id='senderField'
- onKeyReleased='handler.setText(event, "sender")'/>
- </cell>
+ <row>
+ <cell anchor='west'>
+ <JLabel id='printedBetweenLabel'/>
+ </cell>
+ <cell weightx='1'>
+ <JXDatePicker id='printedBetweenStartDatePicker'/>
+ </cell>
+ <cell>
+ <JLabel styleClass='between2ndPartLabel'/>
+ </cell>
+ <cell weightx='1'>
+ <JXDatePicker id='printedBetweenEndDatePicker'/>
+ </cell>
+ </row>
- <cell>
- <JLabel id='clientLabel'/>
- </cell>
- <cell weightx='1'>
- <JTextField id='clientField'
- onKeyReleased='handler.setText(event, "clientCode")'/>
- </cell>
- </row>
+ <row>
+ <cell>
+ <JLabel id='senderLabel'/>
+ </cell>
+ <cell columns='3' weightx="1">
+ <JTextField id='senderField'
+ onKeyReleased='handler.setText(event, "sender")'/>
+ </cell>
- <row>
- <cell>
- <JLabel id='objectLabel'/>
- </cell>
- <cell columns='3' weightx='1'>
- <JTextField id='objectField'
- onKeyReleased='handler.setText(event, "object")'/>
- </cell>
+ <cell>
+ <JLabel id='clientLabel'/>
+ </cell>
+ <cell weightx='1'>
+ <JTextField id='clientField'
+ onKeyReleased='handler.setText(event, "clientCode")'/>
+ </cell>
+ </row>
- <cell>
- <JLabel id='docTypeLabel'/>
- </cell>
- <cell weightx='1'>
- <BeanFilterableComboBox id='docTypeComboBox'
- constructorParams='this'
- genericType="DemandType"/>
- </cell>
- </row>
+ <row>
+ <cell>
+ <JLabel id='objectLabel'/>
+ </cell>
+ <cell columns='3' weightx='1'>
+ <JTextField id='objectField'
+ onKeyReleased='handler.setText(event, "object")'/>
+ </cell>
- <row>
- <cell>
- <JLabel id='ediCodeNumberLabel'/>
- </cell>
- <cell columns='3' weightx='1'>
- <JTextField id='ediCodeNumberField'/>
- </cell>
+ <cell>
+ <JLabel id='docTypeLabel'/>
+ </cell>
+ <cell weightx='1'>
+ <BeanFilterableComboBox id='docTypeComboBox'
+ constructorParams='this'
+ genericType="DemandType"/>
+ </cell>
+ </row>
- <cell>
- <JLabel id='projectReferenceLabel'/>
- </cell>
- <cell weightx='1'>
- <JTextField id='projectReferenceField'/>
- </cell>
- </row>
+ <row>
+ <cell>
+ <JLabel id='ediCodeNumberLabel'/>
+ </cell>
+ <cell columns='3' weightx='1'>
+ <JTextField id='ediCodeNumberField'/>
+ </cell>
- <row>
- <cell>
- <JLabel id='priorityLabel'/>
- </cell>
- <cell weightx='1'>
- <BeanFilterableComboBox id='priorityComboBox'
- constructorParams='this'
- genericType="Priority"/>
- </cell>
+ <cell>
+ <JLabel id='projectReferenceLabel'/>
+ </cell>
+ <cell weightx='1'>
+ <JTextField id='projectReferenceField'/>
+ </cell>
+ </row>
- <cell>
- <JLabel id='statusLabel'/>
- </cell>
- <cell weightx='1'>
- <BeanFilterableComboBox id='statusComboBox'
- constructorParams='this'
- genericType="DemandStatus"/>
- </cell>
+ <row>
+ <cell>
+ <JLabel id='priorityLabel'/>
+ </cell>
+ <cell weightx='1'>
+ <BeanFilterableComboBox id='priorityComboBox'
+ constructorParams='this'
+ genericType="Priority"/>
+ </cell>
- <cell>
- <JLabel id='etatAttenteLabel'/>
- </cell>
- <cell weightx='2'>
- <BeanFilterableComboBox id='etatAttenteComboBox'
- constructorParams='this'
- genericType="EtatAttente"/>
- </cell>
- </row>
+ <cell>
+ <JLabel id='statusLabel'/>
+ </cell>
+ <cell weightx='1'>
+ <BeanFilterableComboBox id='statusComboBox'
+ constructorParams='this'
+ genericType="DemandStatus"/>
+ </cell>
- <!--<row>-->
- <!--<cell anchor='east'>-->
- <!--<JLabel id='gammeLabel'/>-->
- <!--</cell>-->
- <!--<cell weightx='1' columns='6'>-->
- <!--<BeanFilterableComboBox id='gammeComboBox'-->
- <!--constructorParams='this'-->
- <!--genericType="Range"/>-->
- <!--</cell>-->
- <!--</row>-->
+ <cell>
+ <JLabel id='etatAttenteLabel'/>
+ </cell>
+ <cell weightx='2'>
+ <BeanFilterableComboBox id='etatAttenteComboBox'
+ constructorParams='this'
+ genericType="EtatAttente"/>
+ </cell>
+ </row>
- </Table>
- </JScrollPane>
+ <!--<row>-->
+ <!--<cell anchor='east'>-->
+ <!--<JLabel id='gammeLabel'/>-->
+ <!--</cell>-->
+ <!--<cell weightx='1' columns='6'>-->
+ <!--<BeanFilterableComboBox id='gammeComboBox'-->
+ <!--constructorParams='this'-->
+ <!--genericType="Range"/>-->
+ <!--</cell>-->
+ <!--</row>-->
- <JPanel constraints='BorderLayout.SOUTH'>
- <JButton id="searchButton"/>
+ </Table>
+ </JScrollPane>
+
+ <JPanel constraints='BorderLayout.SOUTH'>
+ <JButton id="searchButton"/>
+ </JPanel>
</JPanel>
- </JPanel>
- <JPanel layout='{new BorderLayout()}'>
- <JScrollPane constraints='BorderLayout.CENTER'>
- <JXTable id='dataTable'
- onMouseClicked='handler.autoSelectRowInTable(event, tablePopup)'
- onKeyPressed='handler.openRowMenu(event, tablePopup)'/>
- </JScrollPane>
- </JPanel>
+ <JPanel layout='{new BorderLayout()}'>
+ <JScrollPane constraints='BorderLayout.CENTER'>
+ <JXTable id='dataTable'
+ onMouseClicked='handler.autoSelectRowInTable(event, tablePopup)'
+ onKeyPressed='handler.openRowMenu(event, tablePopup)'/>
+ </JScrollPane>
+ </JPanel>
-</JSplitPane>
\ No newline at end of file
+ </JSplitPane>
+
+</JPanel>
\ No newline at end of file
Modified: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/search/SearchUIHandler.java
===================================================================
--- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/search/SearchUIHandler.java 2014-04-07 14:02:17 UTC (rev 31)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/search/SearchUIHandler.java 2014-04-10 12:18:23 UTC (rev 32)
@@ -73,14 +73,6 @@
/** Logger. */
private static final Log log = LogFactory.getLog(SearchUIHandler.class);
- /**
- * Persistence service.
- *
- * @since 0.1
- */
-// private final PersistenceService persistenceService;
-
-
@Override
public void beforeInit(SearchUI ui) {
super.beforeInit(ui);
@@ -106,6 +98,7 @@
getUI().setContextValue(searchUIModel);
}
+
@Override
public void afterInit(SearchUI ui) {
@@ -134,6 +127,8 @@
model.getDemandStatus());
final JXTable dataTable = getUI().getDataTable();
+ dataTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
+
final AbstractApplicationTableModel<DemandeUIModel> tableModel = initDemandeTable(dataTable, true);
model.addPropertyChangeListener(SearchUIModel.PROPERTY_RESULTS, new PropertyChangeListener() {
@@ -197,6 +192,16 @@
return null;
}
+ @Override
+ protected void beforeOpenPopup(int rowIndex, int columnIndex) {
+ super.beforeOpenPopup(rowIndex, columnIndex);
+
+ int selectedRowCount = getUI().getDataTable().getSelectedRowCount();
+
+ SearchUIModel model = getModel();
+ model.setMenuEnabled(selectedRowCount == 1);
+ }
+
public void goToMenu() {
JXTable dataTable = ui.getDataTable();
int rowIndex = dataTable.getSelectedRow();
Modified: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/search/SearchUIModel.java
===================================================================
--- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/search/SearchUIModel.java 2014-04-07 14:02:17 UTC (rev 31)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/search/SearchUIModel.java 2014-04-10 12:18:23 UTC (rev 32)
@@ -56,6 +56,8 @@
private static final Log log = LogFactory.getLog(SearchUIModel.class);
public static final String PROPERTY_RESULTS = "results";
+ public static final String PROPERTY_MENU_ENABLED = "menuEnabled";
+ public static final String PROPERTY_GROUP_ENABLED = "groupEnabled";
protected final Email editObject = new EmailImpl();
@@ -72,6 +74,9 @@
protected List<DemandeUIModel> results;
+ protected boolean menuEnabled;
+ protected boolean groupEnabled;
+
protected static Binder<SearchUIModel, Email> toBeanBinder =
BinderFactory.newBinder(SearchUIModel.class,
Email.class);
@@ -263,6 +268,26 @@
firePropertyChanged(PROPERTY_RESULTS, null, results);
}
+ public boolean isMenuEnabled() {
+ return menuEnabled;
+ }
+
+ public void setMenuEnabled(boolean menuEnabled) {
+ Object oldValue = isMenuEnabled();
+ this.menuEnabled = menuEnabled;
+ firePropertyChanged(PROPERTY_MENU_ENABLED, oldValue, menuEnabled);
+ }
+
+ public boolean isGroupEnabled() {
+ return groupEnabled;
+ }
+
+ public void setGroupEnabled(boolean groupEnabled) {
+ Object oldValue = isGroupEnabled();
+ this.groupEnabled = groupEnabled;
+ firePropertyChanged(PROPERTY_GROUP_ENABLED, oldValue, groupEnabled);
+ }
+
@Override
protected Email newEntity() {
return new EmailImpl();
Copied: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/transmit/MailFolderChooserUI.css (from rev 31, trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/MailFolderChooserUI.css)
===================================================================
--- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/transmit/MailFolderChooserUI.css (rev 0)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/transmit/MailFolderChooserUI.css 2014-04-10 12:18:23 UTC (rev 32)
@@ -0,0 +1,19 @@
+#navigationTree {
+ font-size: "11";
+ rootVisible: false;
+ showsRootHandles: true;
+}
+
+#cancelButton {
+ actionIcon: cancel;
+ text: "faxtomail.chooseMailFolder.action.cancel";
+ toolTipText: "faxtomail.chooseMailFolder.action.cancel.tip";
+}
+
+#validateButton {
+ actionIcon: validate;
+ text: "faxtomail.chooseMailFolder.action.validate";
+ toolTipText: "faxtomail.chooseMailFolder.action.validate.tip";
+ _applicationAction: {com.franciaflex.faxtomail.ui.swing.actions.TransmitAction.class};
+ enabled: { model.getMailFolder() != null };
+}
\ No newline at end of file
Copied: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/transmit/MailFolderChooserUI.jaxx (from rev 30, trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/MailFolderChooserUI.jaxx)
===================================================================
--- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/transmit/MailFolderChooserUI.jaxx (rev 0)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/transmit/MailFolderChooserUI.jaxx 2014-04-10 12:18:23 UTC (rev 32)
@@ -0,0 +1,33 @@
+<JPanel id='mailFolderChooser' layout='{new BorderLayout()}'
+ implements='com.franciaflex.faxtomail.ui.swing.util.FaxToMailUI<com.franciaflex.faxtomail.ui.swing.content.demande.DemandeUIModel, MailFolderChooserUIHandler>'>
+
+ <import>
+ com.franciaflex.faxtomail.ui.swing.content.demande.DemandeUIModel
+
+ com.franciaflex.faxtomail.ui.swing.util.FaxToMailUI
+ com.franciaflex.faxtomail.ui.swing.util.FaxToMailUIUtil
+
+ javax.swing.tree.DefaultTreeModel
+ </import>
+
+ <script><![CDATA[
+
+ public MailFolderChooserUI(FaxToMailUI parentUI, DemandeUIModel model) {
+ FaxToMailUIUtil.setParentUI(this, parentUI);
+ setContextValue(model);
+ }
+
+ ]]></script>
+
+ <DemandeUIModel id='model' javaBean='getContextValue(DemandeUIModel.class)'/>
+
+ <JScrollPane constraints='BorderLayout.CENTER'>
+ <JTree id="navigationTree"/>
+ </JScrollPane>
+
+ <JPanel layout='{new GridLayout(1, 0)}' constraints='BorderLayout.SOUTH'>
+ <JButton id='cancelButton' onActionPerformed='handler.cancel()'/>
+ <JButton id='validateButton'/>
+ </JPanel>
+
+</JPanel>
\ No newline at end of file
Copied: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/transmit/MailFolderChooserUIHandler.java (from rev 31, trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/MailFolderChooserUIHandler.java)
===================================================================
--- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/transmit/MailFolderChooserUIHandler.java (rev 0)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/transmit/MailFolderChooserUIHandler.java 2014-04-10 12:18:23 UTC (rev 32)
@@ -0,0 +1,111 @@
+package com.franciaflex.faxtomail.ui.swing.content.transmit;
+
+import com.franciaflex.faxtomail.persistence.entities.Company;
+import com.franciaflex.faxtomail.persistence.entities.EtatAttente;
+import com.franciaflex.faxtomail.persistence.entities.MailFolder;
+import com.franciaflex.faxtomail.ui.swing.content.demande.DemandeUIModel;
+import com.franciaflex.faxtomail.ui.swing.util.AbstractFaxToMailUIHandler;
+import com.franciaflex.faxtomail.ui.swing.util.Cancelable;
+import com.franciaflex.faxtomail.ui.swing.util.FaxToMailUIUtil;
+import com.franciaflex.faxtomail.ui.swing.util.FolderTreeNode;
+import jaxx.runtime.validator.swing.SwingValidator;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import javax.swing.*;
+import javax.swing.event.TreeSelectionEvent;
+import javax.swing.event.TreeSelectionListener;
+import javax.swing.tree.DefaultMutableTreeNode;
+import javax.swing.tree.DefaultTreeCellRenderer;
+import java.awt.*;
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.Map;
+
+/**
+ * @author Kevin Morin (Code Lutin)
+ * @since x.x
+ */
+public class MailFolderChooserUIHandler extends AbstractFaxToMailUIHandler<DemandeUIModel, MailFolderChooserUI> implements Cancelable {
+
+ private static final Log log = LogFactory.getLog(MailFolderChooserUIHandler.class);
+
+ @Override
+ public void afterInit(MailFolderChooserUI mailFolderChooserUI) {
+ initUI(mailFolderChooserUI);
+
+ DemandeUIModel model = getModel();
+
+ EtatAttente etatAttente = model.getEtatAttente();
+ final Collection<MailFolder> foldersWithEtatAttente;
+ if (etatAttente != null) {
+ foldersWithEtatAttente = getContext().getMailFolderService().getFoldersWithEtatAttente(etatAttente);
+ } else {
+ foldersWithEtatAttente = new HashSet<MailFolder>();
+ }
+
+ // init tree
+ Company franciaflex = getContext().getCurrentCompany();
+ Collection<MailFolder> folders = franciaflex.getMailFolder();
+ JTree navigationTree = ui.getNavigationTree();
+
+ Map<MailFolder, DefaultMutableTreeNode> nodesByFolder =
+ FaxToMailUIUtil.initFolderTree(getContext(), navigationTree, folders);
+ MailFolder currentFolder = getModel().getMailFolder();
+
+ for (MailFolder folder : nodesByFolder.keySet()) {
+ DefaultMutableTreeNode node = nodesByFolder.get(folder);
+ if (node.getClass().isAssignableFrom(FolderTreeNode.class)) {
+ FolderTreeNode folderTreeNode = (FolderTreeNode) node;
+ folderTreeNode.setCanSelect(!currentFolder.equals(folder) &&
+ (foldersWithEtatAttente.isEmpty()
+ || foldersWithEtatAttente.contains(folder)));
+ }
+ }
+
+ navigationTree.setCellRenderer(new DefaultTreeCellRenderer() {
+ @Override
+ public Component getTreeCellRendererComponent(JTree tree, Object value, boolean sel,
+ boolean expanded, boolean leaf, int row, boolean hasFocus) {
+ Component component = super.getTreeCellRendererComponent(tree, value, sel, expanded, leaf, row, hasFocus);
+
+ FolderTreeNode node = (FolderTreeNode) value;
+ setEnabled(node.isCanSelect());
+
+ return component;
+ }
+ });
+
+ navigationTree.addTreeSelectionListener(new TreeSelectionListener() {
+ @Override
+ public void valueChanged(TreeSelectionEvent e) {
+ FolderTreeNode folderNode = (FolderTreeNode) e.getPath().getLastPathComponent();
+ MailFolder folder = folderNode.getMailFolder();
+ if (!folderNode.isCanSelect()) {
+ folder = null;
+ }
+ getModel().setMailFolder(folder);
+ }
+ });
+ }
+
+ @Override
+ public void onCloseUI() {
+ }
+
+ @Override
+ public SwingValidator<DemandeUIModel> getValidator() {
+ return null;
+ }
+
+ @Override
+ public void cancel() {
+ closeDialog();
+ }
+
+ @Override
+ protected JComponent getComponentToFocus() {
+ return ui.getNavigationTree();
+ }
+
+}
Modified: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/AbstractFaxToMailDemandListHandler.java
===================================================================
--- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/AbstractFaxToMailDemandListHandler.java 2014-04-07 14:02:17 UTC (rev 31)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/AbstractFaxToMailDemandListHandler.java 2014-04-10 12:18:23 UTC (rev 32)
@@ -12,8 +12,8 @@
import com.franciaflex.faxtomail.ui.swing.FaxToMailUIContext;
import com.franciaflex.faxtomail.ui.swing.actions.ShowDemandeAction;
import com.franciaflex.faxtomail.ui.swing.content.demande.DemandeUIModel;
-import com.franciaflex.faxtomail.ui.swing.util.attachment.AttachmentCellEditor;
-import com.franciaflex.faxtomail.ui.swing.util.attachment.AttachmentCellRenderer;
+import com.franciaflex.faxtomail.ui.swing.content.attachment.AttachmentCellEditor;
+import com.franciaflex.faxtomail.ui.swing.content.attachment.AttachmentCellRenderer;
import com.google.common.base.Function;
import org.apache.commons.lang3.ArrayUtils;
import org.apache.commons.lang3.StringUtils;
@@ -38,6 +38,7 @@
import java.awt.*;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
+import java.awt.event.MouseListener;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Date;
@@ -169,7 +170,7 @@
Font font = renderer.getFont();
renderer.setFont(font.deriveFont(Font.ITALIC));
//TODO kmorin 20140326 find color between gray and black
- renderer.setForeground(Color.DARK_GRAY);
+ renderer.setForeground(Color.BLUE);
}
return renderer;
}
@@ -201,13 +202,21 @@
Color color = new Color(255, 51, 51);
table.addHighlighter(new ColorHighlighter(rowIsInvalidPredicate, color, Color.WHITE, color.darker(), Color.WHITE));
- table.addMouseListener(new MouseAdapter() {
+ table.addMouseListener(getDataTableMouseListener());
+
+ return tableModel;
+ }
+
+ protected MouseListener getDataTableMouseListener() {
+ return new MouseAdapter() {
public void mouseClicked(MouseEvent evt) {
- JXTable table = (JXTable) evt.getSource();
if (evt.getClickCount() == 2) {
+ JXTable table = (JXTable) evt.getSource();
int rowIndex = table.getSelectedRow();
rowIndex = table.convertRowIndexToModel(rowIndex);
+ AbstractApplicationTableModel<DemandeUIModel> tableModel =
+ (AbstractApplicationTableModel<DemandeUIModel>) table.getModel();
DemandeUIModel selectedEmail = tableModel.getEntry(rowIndex);
onDoubleClickOnDemande(selectedEmail);
FaxToMailUIContext context = getContext();
@@ -219,9 +228,7 @@
openDemand(selectedEmail);
}
}
- });
-
- return tableModel;
+ };
}
@Override
Modified: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/AbstractFaxToMailUIHandler.java
===================================================================
--- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/AbstractFaxToMailUIHandler.java 2014-04-07 14:02:17 UTC (rev 31)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/AbstractFaxToMailUIHandler.java 2014-04-10 12:18:23 UTC (rev 32)
@@ -79,10 +79,6 @@
return (FaxToMailUIContext) super.getContext();
}
-// public FaxToMailDataContext getDataContext() {
-// return getContext().getDataContext();
-// }
-
public FaxToMailConfiguration getConfig() {
return getContext().getConfig();
}
@@ -92,7 +88,7 @@
Component result;
ApplicationActionUI actionUI = getContext().getActionUI();
// if (actionUI.isVisible()) {
- result = actionUI;
+ result = actionUI;
// } else {
// result = getContext().getMainUI();
// }
@@ -197,18 +193,18 @@
AbstractFaxToMailBeanUIModel.PROPERTY_VALID);
}
- protected void closeUI(FaxToMailUI ui) {
- ui.getHandler().onCloseUI();
- }
-
public void openFrame(ApplicationUI dialogContent,
String title, Dimension dim) {
- Component topestUI = getTopestUI();
- JFrame result = new JFrame(title);
+ JFrame result = getContext().getSecondaryFrame();
+ if (result == null) {
+ result = new JFrame();
+ result.setResizable(true);
+ getContext().setSecondaryFrame(result);
+ }
- result.add((Component) dialogContent);
- result.setResizable(true);
+ result.setTitle(title);
+ result.setContentPane((Container) dialogContent);
result.setSize(dim);
@@ -233,19 +229,12 @@
});
}
- result.addWindowListener(new WindowAdapter() {
-
- @Override
- public void windowClosed(WindowEvent e) {
- Component ui = (Component) e.getSource();
- if (log.isDebugEnabled()) {
- log.debug("Destroy ui " + ui);
- }
- JAXXUtil.destroy(ui);
- }
- });
SwingUtil.center(getContext().getMainUI(), result);
result.setVisible(true);
}
+ public void closeFrame() {
+ getParentContainer(JFrame.class).setVisible(false);
+ }
+
}
Modified: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/FaxToMailUIUtil.java
===================================================================
--- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/FaxToMailUIUtil.java 2014-04-07 14:02:17 UTC (rev 31)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/FaxToMailUIUtil.java 2014-04-10 12:18:23 UTC (rev 32)
@@ -22,43 +22,29 @@
* #L%
*/
-import com.franciaflex.faxtomail.persistence.entities.Company;
-import com.franciaflex.faxtomail.persistence.entities.Email;
import com.franciaflex.faxtomail.persistence.entities.MailFolder;
-import com.franciaflex.faxtomail.persistence.entities.RangeRow;
import com.franciaflex.faxtomail.ui.swing.FaxToMailUIContext;
-import com.franciaflex.faxtomail.ui.swing.actions.ShowDemandeAction;
import com.franciaflex.faxtomail.ui.swing.content.demande.DemandeUIModel;
import com.franciaflex.faxtomail.ui.swing.content.demande.RangeRowModel;
import jaxx.runtime.JAXXObject;
import jaxx.runtime.JAXXUtil;
-import org.apache.commons.lang3.StringUtils;
+import org.apache.commons.collections4.ComparatorUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import org.jdesktop.swingx.JXTable;
-import org.jdesktop.swingx.decorator.ComponentAdapter;
-import org.jdesktop.swingx.decorator.Highlighter;
-import org.jdesktop.swingx.table.DefaultTableColumnModelExt;
-import org.jdesktop.swingx.table.TableColumnModelExt;
-import org.nuiton.jaxx.application.swing.table.AbstractApplicationTableModel;
import org.nuiton.jaxx.application.swing.util.ApplicationUIUtil;
import org.nuiton.util.FileUtil;
import javax.swing.*;
-import javax.swing.event.ChangeListener;
import javax.swing.tree.DefaultMutableTreeNode;
import javax.swing.tree.DefaultTreeCellRenderer;
import javax.swing.tree.DefaultTreeModel;
import javax.swing.tree.TreeModel;
import javax.swing.tree.TreePath;
-import java.awt.*;
-import java.awt.event.MouseAdapter;
-import java.awt.event.MouseEvent;
import java.io.File;
-import java.text.DateFormat;
-import java.text.SimpleDateFormat;
+import java.util.ArrayList;
import java.util.Collection;
-import java.util.Date;
+import java.util.Collections;
+import java.util.Comparator;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@@ -129,7 +115,14 @@
parent.add(node);
if (folder.isChildrenNotEmpty()) {
- for (MailFolder child : folder.getChildren()) {
+ List<MailFolder> children = new ArrayList<MailFolder>(folder.getChildren());
+ Collections.sort(children, new Comparator<MailFolder>() {
+ @Override
+ public int compare(MailFolder o1, MailFolder o2) {
+ return o1.getName().compareTo(o2.getName());
+ }
+ });
+ for (MailFolder child : children) {
result.putAll(createFolderTree(node, child));
}
}
Modified: trunk/faxtomail-ui-swing/src/main/resources/i18n/faxtomail-ui-swing_en_GB.properties
===================================================================
--- trunk/faxtomail-ui-swing/src/main/resources/i18n/faxtomail-ui-swing_en_GB.properties 2014-04-07 14:02:17 UTC (rev 31)
+++ trunk/faxtomail-ui-swing/src/main/resources/i18n/faxtomail-ui-swing_en_GB.properties 2014-04-10 12:18:23 UTC (rev 32)
@@ -22,6 +22,8 @@
faxtomail.alert.archiveConfirmation.help=
faxtomail.alert.archiveConfirmation.message=
faxtomail.alert.archiveConfirmation.title=
+faxtomail.alert.groupConfirmation.message=
+faxtomail.alert.groupConfirmation.title=
faxtomail.archive.button.label=
faxtomail.attachmentCellRenderer.text=
faxtomail.attachmentEditor.action.add.mnemonic=
@@ -104,6 +106,10 @@
faxtomail.config.save.error=
faxtomail.config.title=
faxtomail.demand.alreadyTakenBy=
+faxtomail.demand.group.successful=
+faxtomail.demandGroup.action.tip=
+faxtomail.demandGroup.text=
+faxtomail.demandGroup.title=
faxtomail.demande.alreadyTakenBy=
faxtomail.demande.archive.button.label=
faxtomail.demande.archive.button.mnemonic=
@@ -131,6 +137,7 @@
faxtomail.demande.firstOpeningDate.label=
faxtomail.demande.gamme.label=
faxtomail.demande.group.button.label=
+faxtomail.demande.group.successful=
faxtomail.demande.history.label=
faxtomail.demande.lastAttachmentOpening.label=
faxtomail.demande.lastModificationDate.label=
@@ -326,6 +333,11 @@
faxtomail.search.sender.label=
faxtomail.search.status.label=
faxtomail.search.title=
+faxtomail.searchToGroup.action.cancel=
+faxtomail.searchToGroup.action.cancel.tip=
+faxtomail.searchToGroup.action.group=
+faxtomail.searchToGroup.action.group.tip=
+faxtomail.searchToGroup.title=
faxtomail.systemUser=
faxtomail.transmit.button.label=
faxtomail.validator.error.email.clientCode.required=
Modified: trunk/faxtomail-ui-swing/src/main/resources/i18n/faxtomail-ui-swing_fr_FR.properties
===================================================================
--- trunk/faxtomail-ui-swing/src/main/resources/i18n/faxtomail-ui-swing_fr_FR.properties 2014-04-07 14:02:17 UTC (rev 31)
+++ trunk/faxtomail-ui-swing/src/main/resources/i18n/faxtomail-ui-swing_fr_FR.properties 2014-04-10 12:18:23 UTC (rev 32)
@@ -9,8 +9,10 @@
faxtomail.alert.alreadyTakenBy.help=Voulez-vous le prendre ?<ul><li><strong>Annuler</strong> pour ne retourner à la liste</li><li><strong>Non</strong> pour visualiser l'élément en lecture seule</li><li><strong>Oui</strong> pour le prendre</li></ul>
faxtomail.alert.alreadyTakenBy.message=L'élément est déjà pris par %s.
faxtomail.alert.alreadyTakenBy.title=Document déjà pris
-faxtomail.alert.archiveConfirmation.message=Êtes vous sûr de vouloir archiver cet élément ? L'archivage est définitif.
-faxtomail.alert.archiveConfirmation.title=Archivage
+faxtomail.alert.archiveConfirmation.message=<html>Êtes vous sûr de vouloir archiver cet élément ?<br/>L'archivage est définitif.</html>
+faxtomail.alert.archiveConfirmation.title=Confirmation de l'archivage
+faxtomail.alert.groupConfirmation.message=<html>Êtes vous sûr de vouloir grouper les éléments<br/>%1$s et<br/>%2$s ?<br/>Le groupement est définitif.</html>
+faxtomail.alert.groupConfirmation.title=Confirmation du groupement
faxtomail.attachmentCellRenderer.text=(%s)
faxtomail.attachmentEditor.action.add.tip=Ajouter une pièce jointe
faxtomail.attachmentEditor.action.closeAttachment.tip=Fermer la fenêtre des pièces-jointes
@@ -39,6 +41,9 @@
faxtomail.common.on.label=le
faxtomail.config.application=
faxtomail.config.title=
+faxtomail.demandGroup.action.tip=Éléments groupés avec l'élément courant
+faxtomail.demandGroup.text=Groupe (%s)
+faxtomail.demandGroup.title=Groupe
faxtomail.demande.archive.button.label=Archiver
faxtomail.demande.askCancelEditBeforeLeaving.cancelSave=L'élément n'est pas valide et ne peut être sauvé.
faxtomail.demande.askSaveBeforeLeaving.save=Vous avez modifié l'élément mais vous n'avez pas enregistré ces modifications.
@@ -56,6 +61,7 @@
faxtomail.demande.fax.label=Fax
faxtomail.demande.firstOpened.label=Première ouverture
faxtomail.demande.group.button.label=Grouper
+faxtomail.demande.group.successful=Groupement réussi avec l'élément %s
faxtomail.demande.lastAttachmentOpening.label=Dernière ouverture de pièce-jointe
faxtomail.demande.lastModified.label=Dernière modification
faxtomail.demande.mailBody.label=Corps du mail
@@ -197,6 +203,11 @@
faxtomail.search.sender.label=Émetteur
faxtomail.search.status.label=Statut
faxtomail.search.title=Recherche
+faxtomail.searchToGroup.action.cancel=Annuler
+faxtomail.searchToGroup.action.cancel.tip=Fermer la fenêtre sans grouper l'élément
+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.systemUser=Système
faxtomail.validator.error.email.clientCode.required=Code client requis
faxtomail.validator.error.email.demandType.required=Type de demande requis
Modified: trunk/pom.xml
===================================================================
--- trunk/pom.xml 2014-04-07 14:02:17 UTC (rev 31)
+++ trunk/pom.xml 2014-04-10 12:18:23 UTC (rev 32)
@@ -114,7 +114,7 @@
<hibernateVersion>4.2.8.Final</hibernateVersion>
<h2Version>1.3.174</h2Version>
- <jaxxVersion>2.8.2</jaxxVersion>
+ <jaxxVersion>2.8.5-SNAPSHOT</jaxxVersion>
<swingXVersion>1.6.4</swingXVersion>
<xworkVersion>2.3.15.1</xworkVersion>
@@ -132,7 +132,7 @@
<i18n.silent>true</i18n.silent>
<!-- license header configuration -->
- <license.organizationName>Franciaflex</license.organizationName>
+ <license.organizationName>Franciaflex, Code Lutin</license.organizationName>
<license.licenseName>gpl_v3</license.licenseName>
<!-- Java version -->
1
0