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
- 1934 discussions
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
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
r31 - in trunk: 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-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util
by kmorin@users.forge.codelutin.com 07 Apr '14
by kmorin@users.forge.codelutin.com 07 Apr '14
07 Apr '14
Author: kmorin
Date: 2014-04-07 16:02:17 +0200 (Mon, 07 Apr 2014)
New Revision: 31
Url: http://forge.codelutin.com/projects/faxtomail/repository/revisions/31
Log:
fixes #4665 [ECRAN] Transfert
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/MailFolderService.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/MailFolderChooserUI.css
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/util/FolderTreeNode.java
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-04 15:42:36 UTC (rev 30)
+++ trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/InitFaxToMailService.java 2014-04-07 14:02:17 UTC (rev 31)
@@ -140,8 +140,7 @@
if (count == 0) {
List<Client> clients;
try {
-// File clientFile = new File(ClassLoader.getSystemResource("fx_clients.csv").toURI());
- File clientFile = new File("/home/kmorin/Projects/faxToMail/faxtomail-service/src/main/resources/fx_clients.csv");
+ File clientFile = new File(ClassLoader.getSystemResource("fx_clients.csv").toURI());
clients = getReferentielService().importClients(clientFile);
} catch(Exception e) {
@@ -235,15 +234,24 @@
int etatAttenteSize = etatAttentes.size();
+ MailFolder chargesClientelle = folderDao.create(MailFolder.PROPERTY_NAME, "Chargés de clientèle");
+ folders.add(chargesClientelle);
+
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);
+
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 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);
@@ -251,36 +259,46 @@
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);
}
- folders.add(folderDao.create(MailFolder.PROPERTY_NAME, "Chargés de clientèle",
- MailFolder.PROPERTY_CHILDREN, Lists.newArrayList(cyrilFolder, claireFolder, 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 marcFolder = folderDao.create(MailFolder.PROPERTY_NAME, "Marc",
+ 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 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 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);
- folders.add(folderDao.create(MailFolder.PROPERTY_NAME, "SAV",
- MailFolder.PROPERTY_CHILDREN, Lists.newArrayList(marcFolder, fredericFolder, jeanneFolder),
- MailFolder.PROPERTY_ETAT_ATTENTE, etatAttentes.subList(0, random.nextInt(etatAttenteSize - 8) + 2)));
// companies
CompanyTopiaDao companyTopiaDao = getPersistenceContext().getCompanyDao();
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-04 15:42:36 UTC (rev 30)
+++ trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/MailFolderService.java 2014-04-07 14:02:17 UTC (rev 31)
@@ -88,8 +88,10 @@
Collection<MailFolder> result = new HashSet<>();
Collection<MailFolder> children = folder.getChildren();
- for (MailFolder child : children) {
- result.addAll(getFoldersWithEtatAttente(child, parentEtatAttente, etatAttente));
+ if (children != null) {
+ for (MailFolder child : children) {
+ result.addAll(getFoldersWithEtatAttente(child, parentEtatAttente, etatAttente));
+ }
}
if (etatAttentes.contains(etatAttente)) {
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-04 15:42:36 UTC (rev 30)
+++ 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)
@@ -506,7 +506,9 @@
}
public void setMailFolder(MailFolder mailFolder) {
+ Object oldValue = getMailFolder();
editObject.setMailFolder(mailFolder);
+ firePropertyChanged(Email.PROPERTY_MAIL_FOLDER, oldValue, mailFolder);
}
public Date getArchiveDate() {
@@ -514,7 +516,9 @@
}
public void setArchiveDate(Date archiveDate) {
+ Object oldValue = getArchiveDate();
editObject.setArchiveDate(archiveDate);
+ firePropertyChanged(Email.PROPERTY_ARCHIVE_DATE, oldValue, archiveDate);
}
public int getQuotationNb() {
Modified: 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-04 15:42:36 UTC (rev 30)
+++ 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)
@@ -15,4 +15,5 @@
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
Modified: 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-04 15:42:36 UTC (rev 30)
+++ 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)
@@ -18,10 +18,8 @@
import javax.swing.event.TreeSelectionListener;
import javax.swing.tree.DefaultMutableTreeNode;
import javax.swing.tree.DefaultTreeCellRenderer;
-import javax.swing.tree.TreeNode;
import java.awt.*;
import java.util.Collection;
-import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
@@ -54,15 +52,26 @@
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);
- DefaultMutableTreeNode node = (DefaultMutableTreeNode) value;
- setEnabled(foldersWithEtatAttente.isEmpty() || foldersWithEtatAttente.contains(node.getUserObject()));
+ FolderTreeNode node = (FolderTreeNode) value;
+ setEnabled(node.isCanSelect());
return component;
}
@@ -73,6 +82,9 @@
public void valueChanged(TreeSelectionEvent e) {
FolderTreeNode folderNode = (FolderTreeNode) e.getPath().getLastPathComponent();
MailFolder folder = folderNode.getMailFolder();
+ if (!folderNode.isCanSelect()) {
+ folder = null;
+ }
getModel().setMailFolder(folder);
}
});
Modified: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/FolderTreeNode.java
===================================================================
--- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/FolderTreeNode.java 2014-04-04 15:42:36 UTC (rev 30)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/FolderTreeNode.java 2014-04-07 14:02:17 UTC (rev 31)
@@ -33,6 +33,8 @@
*/
public class FolderTreeNode extends DefaultMutableTreeNode {
+ protected boolean canSelect;
+
public FolderTreeNode(MailFolder folder) {
super(folder);
}
@@ -41,6 +43,14 @@
return (MailFolder) userObject;
}
+ public boolean isCanSelect() {
+ return canSelect;
+ }
+
+ public void setCanSelect(boolean canSelect) {
+ this.canSelect = canSelect;
+ }
+
@Override
public String toString() {
MailFolder folder = (MailFolder) userObject;
1
0
r30 - 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-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/attachment
by kmorin@users.forge.codelutin.com 04 Apr '14
by kmorin@users.forge.codelutin.com 04 Apr '14
04 Apr '14
Author: kmorin
Date: 2014-04-04 17:42:36 +0200 (Fri, 04 Apr 2014)
New Revision: 30
Url: http://forge.codelutin.com/projects/faxtomail/repository/revisions/30
Log:
refs #4665 [ECRAN] Transfert
ajout de la gestion des etats d'attente
Modified:
trunk/faxtomail-persistence/src/main/xmi/faxtomail.zargo
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/DemandeUIHandler.java
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/util/attachment/AttachmentEditorUIHandler.java
trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/attachment/AttachmentItem.css
trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/attachment/AttachmentItem.jaxx
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-03 16:13:47 UTC (rev 29)
+++ trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/InitFaxToMailService.java 2014-04-04 15:42:36 UTC (rev 30)
@@ -64,6 +64,7 @@
import java.io.File;
import java.util.ArrayList;
import java.util.Calendar;
+import java.util.Collections;
import java.util.Date;
import java.util.List;
import java.util.Random;
@@ -162,20 +163,20 @@
EtatAttenteTopiaDao etatAttenteDao = getPersistenceContext().getEtatAttenteDao();
List<EtatAttente> etatAttentes = Lists.newArrayList(
- etatAttenteDao.create(Range.PROPERTY_LABEL, "REM Attente Remise-accord expo"),
+ 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, "GRA attente accord gratuit"),
- etatAttenteDao.create(Range.PROPERTY_LABEL, "CLT attente réponse client"),
etatAttenteDao.create(Range.PROPERTY_LABEL, "PPC attente chiffrage BEI PPC"),
- etatAttenteDao.create(Range.PROPERTY_LABEL, "SIGN attente réponse BEI signature"),
etatAttenteDao.create(Range.PROPERTY_LABEL, "PROFORMA attente paiement proforma"),
- etatAttenteDao.create(Range.PROPERTY_LABEL, "BAT attente retour BAT lettrage-logo"),
- etatAttenteDao.create(Range.PROPERTY_LABEL, "GAB attente reception gabarit"),
etatAttenteDao.create(Range.PROPERTY_LABEL, "PROTO attente accord proto"),
- etatAttenteDao.create(Range.PROPERTY_LABEL, "DAC attente pour assistance chantier"),
- etatAttenteDao.create(Range.PROPERTY_LABEL, "DAV attente analyse avoir"),
+ etatAttenteDao.create(Range.PROPERTY_LABEL, "REM Attente Remise-accord expo"),
etatAttenteDao.create(Range.PROPERTY_LABEL, "RET attente retour materiel"),
- etatAttenteDao.create(Range.PROPERTY_LABEL, "EXP attente expertise")
+ etatAttenteDao.create(Range.PROPERTY_LABEL, "SIGN attente réponse BEI signature")
);
PriorityTopiaDao priorityDao = getPersistenceContext().getPriorityDao();
@@ -232,7 +233,11 @@
HistoryTopiaDao historyDao = getPersistenceContext().getHistoryDao();
RangeRowTopiaDao rangeRowDao = getPersistenceContext().getRangeRowDao();
- MailFolder cyrilFolder = folderDao.create(MailFolder.PROPERTY_NAME, "Cyril");
+ int etatAttenteSize = etatAttentes.size();
+
+ Collections.shuffle(etatAttentes);
+ MailFolder cyrilFolder = folderDao.create(MailFolder.PROPERTY_NAME, "Cyril",
+ MailFolder.PROPERTY_ETAT_ATTENTE, etatAttentes.subList(0, random.nextInt(etatAttenteSize - 8) + 2));
int r = random.nextInt(10) + 5;
for (int i = 0 ; i < r ; i++) {
createEmail(random, historyDao, rangeRowDao, emailDao, ranges, clients, types, priorities, cyrilFolder, cyril);
@@ -244,7 +249,9 @@
createEmail(random, historyDao, rangeRowDao, emailDao, ranges, clients, types, priorities, claireFolder, claire);
}
- MailFolder agatheFolder = folderDao.create(MailFolder.PROPERTY_NAME, "Agathe");
+ Collections.shuffle(etatAttentes);
+ MailFolder agatheFolder = folderDao.create(MailFolder.PROPERTY_NAME, "Agathe",
+ MailFolder.PROPERTY_ETAT_ATTENTE, etatAttentes.subList(0, random.nextInt(etatAttenteSize - 8) + 2));
r = random.nextInt(10) + 5;
for (int i = 0 ; i < r ; i++) {
createEmail(random, historyDao, rangeRowDao, emailDao, ranges, clients, types, priorities, agatheFolder, agathe);
@@ -270,8 +277,10 @@
for (int i = 0 ; i < r ; i++) {
createEmail(random, historyDao, rangeRowDao, emailDao, ranges, clients, types, priorities, jeanneFolder, jeanne);
}
+ Collections.shuffle(etatAttentes);
folders.add(folderDao.create(MailFolder.PROPERTY_NAME, "SAV",
- MailFolder.PROPERTY_CHILDREN, Lists.newArrayList(marcFolder, fredericFolder, jeanneFolder)));
+ MailFolder.PROPERTY_CHILDREN, Lists.newArrayList(marcFolder, fredericFolder, jeanneFolder),
+ MailFolder.PROPERTY_ETAT_ATTENTE, etatAttentes.subList(0, random.nextInt(etatAttenteSize - 8) + 2)));
// companies
CompanyTopiaDao companyTopiaDao = getPersistenceContext().getCompanyDao();
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-03 16:13:47 UTC (rev 29)
+++ trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/MailFolderService.java 2014-04-04 15:42:36 UTC (rev 30)
@@ -1,15 +1,19 @@
package com.franciaflex.faxtomail.services.service;
+import com.franciaflex.faxtomail.persistence.entities.EtatAttente;
import com.franciaflex.faxtomail.persistence.entities.MailFolder;
import com.franciaflex.faxtomail.persistence.entities.MailFolderTopiaDao;
import com.franciaflex.faxtomail.services.FaxToMailServiceSupport;
+import com.google.common.base.Preconditions;
import com.google.common.collect.Lists;
+import org.apache.commons.collections4.CollectionUtils;
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.HashSet;
import java.util.List;
/**
@@ -58,4 +62,42 @@
return result;
}
+ public Collection<MailFolder> getFoldersWithEtatAttente(EtatAttente etatAttente) {
+ Collection<MailFolder> result = new HashSet<>();
+
+ MailFolderTopiaDao dao = getPersistenceContext().getMailFolderDao();
+ List<MailFolder> roots = dao.forParentEquals(null).findAll();
+
+ for (MailFolder root : roots) {
+ result.addAll(getFoldersWithEtatAttente(root, new HashSet<EtatAttente>(), etatAttente));
+ }
+
+ return result;
+ }
+
+ protected Collection<MailFolder> getFoldersWithEtatAttente(MailFolder folder,
+ Collection<EtatAttente> parentEtatAttente,
+ EtatAttente etatAttente) {
+ Collection<EtatAttente> etatAttentes = folder.getEtatAttente();
+ if (CollectionUtils.isEmpty(etatAttentes)) {
+ etatAttentes = parentEtatAttente;
+
+ } else {
+ parentEtatAttente = etatAttentes;
+ }
+
+ Collection<MailFolder> result = new HashSet<>();
+ Collection<MailFolder> children = folder.getChildren();
+ for (MailFolder child : children) {
+ result.addAll(getFoldersWithEtatAttente(child, parentEtatAttente, etatAttente));
+ }
+
+ if (etatAttentes.contains(etatAttente)) {
+ result.add(folder);
+ }
+
+ return result;
+
+ }
+
}
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-03 16:13:47 UTC (rev 29)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeUIHandler.java 2014-04-04 15:42:36 UTC (rev 30)
@@ -25,7 +25,10 @@
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.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.ReferentielService;
@@ -37,6 +40,7 @@
import com.franciaflex.faxtomail.ui.swing.util.FaxToMailUIUtil;
import com.franciaflex.faxtomail.ui.swing.util.attachment.AttachmentEditorUIModel;
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.JXTable;
@@ -112,12 +116,21 @@
initUI(ui);
DemandeUIModel model = getModel();
+ MailFolder folder = model.getMailFolder();
ReferentielService referentielService = getContext().getReferentielService();
initBeanFilterableComboBox(ui.getDocTypeComboBox(), referentielService.getAllDemandType(), model.getDemandType());
initBeanFilterableComboBox(ui.getPriorityComboBox(), referentielService.getAllPriority(), model.getPriority());
- initBeanFilterableComboBox(ui.getEtatAttenteComboBox(), referentielService.getAllEtatAttente(), model.getEtatAttente());
+ List<EtatAttente> etatAttentes = new ArrayList<EtatAttente>();
+ Collection<EtatAttente> folderEtatAttentes = getEtatAttenteForFolder(folder);
+ if (CollectionUtils.isEmpty(folderEtatAttentes)) {
+ etatAttentes.addAll(referentielService.getAllEtatAttente());
+ } else {
+ etatAttentes.addAll(folderEtatAttentes);
+ }
+ initBeanFilterableComboBox(ui.getEtatAttenteComboBox(), etatAttentes, model.getEtatAttente());
+
JEditorPane editor = ui.getMailBodyField();
HTMLEditorKit htmlEditorKit = new HTMLEditorKit();
editor.setEditorKit(htmlEditorKit);
@@ -381,6 +394,14 @@
return ui.getValidator();
}
+ public Collection<EtatAttente> getEtatAttenteForFolder(MailFolder folder) {
+ Collection<EtatAttente> result = null;
+ while (CollectionUtils.isEmpty(result) && folder != null) {
+ result = folder.getEtatAttente();
+ folder = folder.getParent();
+ }
+ return result;
+ }
public BeanMonitor getMonitor() {
return monitor;
}
@@ -390,8 +411,7 @@
}
public void transmitDemande() {
- MailFolderChooserUI dialogContent = new MailFolderChooserUI(ui);
- dialogContent.setModel(getModel());
+ MailFolderChooserUI dialogContent = new MailFolderChooserUI(ui, getModel());
openDialog(dialogContent, t("faxtomail.chooseMailFolder.title"), new Dimension(350, 500));
}
Modified: 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-03 16:13:47 UTC (rev 29)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/MailFolderChooserUI.jaxx 2014-04-04 15:42:36 UTC (rev 30)
@@ -10,13 +10,14 @@
<script><![CDATA[
- public MailFolderChooserUI(FaxToMailUI parentUI) {
+ public MailFolderChooserUI(FaxToMailUI parentUI, DemandeUIModel model) {
FaxToMailUIUtil.setParentUI(this, parentUI);
+ setContextValue(model);
}
]]></script>
- <DemandeUIModel id='model' javaBean='null'/>
+ <DemandeUIModel id='model' javaBean='getContextValue(DemandeUIModel.class)'/>
<JScrollPane constraints='BorderLayout.CENTER'>
<JTree id="navigationTree"/>
Modified: 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-03 16:13:47 UTC (rev 29)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/MailFolderChooserUIHandler.java 2014-04-04 15:42:36 UTC (rev 30)
@@ -1,6 +1,7 @@
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;
@@ -9,13 +10,19 @@
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 javax.swing.tree.TreeNode;
+import java.awt.*;
import java.util.Collection;
import java.util.HashMap;
+import java.util.HashSet;
import java.util.Map;
/**
@@ -24,17 +31,43 @@
*/
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);
+ 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);
+
+ DefaultMutableTreeNode node = (DefaultMutableTreeNode) value;
+ setEnabled(foldersWithEtatAttente.isEmpty() || foldersWithEtatAttente.contains(node.getUserObject()));
+
+ return component;
+ }
+ });
+
navigationTree.addTreeSelectionListener(new TreeSelectionListener() {
@Override
public void valueChanged(TreeSelectionEvent e) {
@@ -64,25 +97,4 @@
return ui.getNavigationTree();
}
- /**
- * Creates the tree nodes and returns a map of the nodes by folder
- * @param parent the node parent
- * @param folder the folder to add to the tree
- * @return the map of the nodes by folder
- */
- protected Map<MailFolder, DefaultMutableTreeNode> createFolderTree(DefaultMutableTreeNode parent, MailFolder folder) {
- Map<MailFolder, DefaultMutableTreeNode> result = new HashMap<MailFolder, DefaultMutableTreeNode>();
-
- DefaultMutableTreeNode node = new FolderTreeNode(folder);
- result.put(folder, node);
-
- parent.add(node);
- if (folder.isChildrenNotEmpty()) {
- for (MailFolder child : folder.getChildren()) {
- result.putAll(createFolderTree(node, child));
- }
- }
- return result;
- }
-
}
Modified: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/attachment/AttachmentEditorUIHandler.java
===================================================================
--- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/attachment/AttachmentEditorUIHandler.java 2014-04-03 16:13:47 UTC (rev 29)
+++ 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)
@@ -230,6 +230,8 @@
label.setIcon(icon);
}
+ setEditable(getModel().isEditable());
+
return this;
}
}
Modified: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/attachment/AttachmentItem.css
===================================================================
--- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/attachment/AttachmentItem.css 2014-04-03 16:13:47 UTC (rev 29)
+++ 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)
@@ -20,6 +20,5 @@
actionIcon: "delete";
toolTipText: "faxtomail.attachmentEditor.action.remove.tip";
enabled: { getAttachment() != null && getAttachment().getTopiaId() == null };
- //TODO check
- visible: { getHandler().getModel().isEditable() };
+ visible: { Boolean.TRUE.equals(isEditable()) };
}
\ No newline at end of file
Modified: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/attachment/AttachmentItem.jaxx
===================================================================
--- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/attachment/AttachmentItem.jaxx 2014-04-03 16:13:47 UTC (rev 29)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/attachment/AttachmentItem.jaxx 2014-04-04 15:42:36 UTC (rev 30)
@@ -10,6 +10,8 @@
<AttachmentEditorUIHandler id='handler' javaBean='null'/>
+ <Boolean id="editable" javaBean='null'/>
+
<JLabel id='attachmentNameLabel' constraints='BorderLayout.CENTER'/>
<JToolBar id='toolbar' constraints='BorderLayout.EAST'>
1
0
r29 - in trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing: . actions content/demande content/search util util/attachment
by kmorin@users.forge.codelutin.com 03 Apr '14
by kmorin@users.forge.codelutin.com 03 Apr '14
03 Apr '14
Author: kmorin
Date: 2014-04-03 18:13:47 +0200 (Thu, 03 Apr 2014)
New Revision: 29
Url: http://forge.codelutin.com/projects/faxtomail/repository/revisions/29
Log:
refs #4659 [ECRAN] Recherche
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/actions/SaveDemandeAndExitAction.java
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/ShowDemandeListAction.java
trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/ShowRechercheAction.java
trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeListUIHandler.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/search/SearchUI.css
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/util/AbstractFaxToMailDemandListHandler.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/attachment/AttachmentCellEditor.java
trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/attachment/AttachmentItem.css
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-03 15:06:12 UTC (rev 28)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/FaxToMailUIContext.java 2014-04-03 16:13:47 UTC (rev 29)
@@ -41,6 +41,7 @@
import com.franciaflex.faxtomail.services.service.ValidationService;
import com.franciaflex.faxtomail.ui.swing.content.MainUI;
import com.franciaflex.faxtomail.ui.swing.content.demande.DemandeUIModel;
+import com.franciaflex.faxtomail.ui.swing.content.search.SearchUIModel;
import com.franciaflex.faxtomail.ui.swing.util.UIMessageNotifier;
import com.google.common.base.Preconditions;
import com.google.common.collect.Maps;
@@ -221,6 +222,8 @@
protected List<MailFolder> expandedFolders = new ArrayList<MailFolder>();
+ protected SearchUIModel search;
+
public static FaxToMailUIContext newContext(FaxToMailConfiguration config) {
Preconditions.checkNotNull(config);
Preconditions.checkState(applicationContext == null,
@@ -550,14 +553,6 @@
}
protected void saveContextToConfig() {
-// if (log.isInfoEnabled()) {
-// log.info("Save config (programId: " + getProgramId() + ", cruiseId: " +
-// getCruiseId() + ", protocolId: " + getProtocolId() + ", locale: " +
-// getLocale() + ")");
-// }
-// config.setProgramId(getProgramId());
-// config.setCruiseId(getCruiseId());
-// config.setProtocolId(getProtocolId());
config.setI18nLocale(getLocale());
config.save();
}
@@ -721,4 +716,12 @@
public void setExpandedFolders(List<MailFolder> expandedFolders) {
this.expandedFolders = expandedFolders;
}
+
+ public SearchUIModel getSearch() {
+ return search;
+ }
+
+ public void setSearch(SearchUIModel search) {
+ this.search = search;
+ }
}
Modified: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/SaveDemandeAndExitAction.java
===================================================================
--- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/SaveDemandeAndExitAction.java 2014-04-03 15:06:12 UTC (rev 28)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/SaveDemandeAndExitAction.java 2014-04-03 16:13:47 UTC (rev 29)
@@ -17,6 +17,6 @@
public void postSuccessAction() {
super.postSuccessAction();
- getContext().setScreen(FaxToMailScreen.LIST);
+ getContext().setScreen(AbstractChangeScreenAction.PREVIOUS_SCREEN.getContextValue(handler.getUI()));
}
}
Modified: 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/SearchAction.java 2014-04-03 15:06:12 UTC (rev 28)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/SearchAction.java 2014-04-03 16:13:47 UTC (rev 29)
@@ -23,6 +23,8 @@
@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(),
Modified: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/ShowDemandeListAction.java
===================================================================
--- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/ShowDemandeListAction.java 2014-04-03 15:06:12 UTC (rev 28)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/ShowDemandeListAction.java 2014-04-03 16:13:47 UTC (rev 29)
@@ -36,4 +36,10 @@
public ShowDemandeListAction(MainUIHandler handler) {
super(handler, true, FaxToMailScreen.LIST);
}
+
+ @Override
+ public void postSuccessAction() {
+ super.postSuccessAction();
+ getContext().setSearch(null);
+ }
}
Modified: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/ShowRechercheAction.java
===================================================================
--- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/ShowRechercheAction.java 2014-04-03 15:06:12 UTC (rev 28)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/ShowRechercheAction.java 2014-04-03 16:13:47 UTC (rev 29)
@@ -36,4 +36,5 @@
public ShowRechercheAction(MainUIHandler handler) {
super(handler, true, FaxToMailScreen.SEARCH);
}
+
}
Modified: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeListUIHandler.java
===================================================================
--- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeListUIHandler.java 2014-04-03 15:06:12 UTC (rev 28)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeListUIHandler.java 2014-04-03 16:13:47 UTC (rev 29)
@@ -221,6 +221,11 @@
}
@Override
+ protected String[] getEditableTableProperties() {
+ return new String[] { Email.PROPERTY_PRIORITY, Email.PROPERTY_ATTACHMENT };
+ }
+
+ @Override
protected void onDoubleClickOnDemande(DemandeUIModel selectedEmail) {
super.onDoubleClickOnDemande(selectedEmail);
selectedEmail.removePropertyChangeListener(selectedDemandeChangeListener);
@@ -277,34 +282,12 @@
super.beforeOpenPopup(rowIndex, columnIndex);
int selectedRowCount = getUI().getDataTable().getSelectedRowCount();
- log.info(selectedRowCount == 1);
DemandeListUIModel model = getModel();
model.setAddAttachmentEnabled(selectedRowCount == 1);
model.setReplyEnabled(selectedRowCount == 1);
}
- @Override
- public void autoSelectRowInTable(MouseEvent e, JPopupMenu popup) {
- boolean rightClick = SwingUtilities.isRightMouseButton(e);
- if (rightClick) {
- // get the coordinates of the mouse click
- Point p = e.getPoint();
-
- JXTable source = (JXTable) e.getSource();
-
- int[] selectedRows = source.getSelectedRows();
-
- // get the row index at this point
- int rowIndex = source.rowAtPoint(p);
- if (rowIndex == -1 || !ArrayUtils.contains(selectedRows, rowIndex)) {
- source.clearSelection();
- }
- }
-
- super.autoSelectRowInTable(e, popup);
- }
-
public void autoSelectNodeInTree(MouseEvent e, JPopupMenu popup) {
boolean rightClick = SwingUtilities.isRightMouseButton(e);
@@ -374,11 +357,6 @@
log.debug("reply");
}
- public void addAttachment() {
- //TODO
- log.debug("addAttachment");
- }
-
public void archive() {
//TODO
log.debug("archive");
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-03 15:06:12 UTC (rev 28)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeUI.css 2014-04-03 16:13:47 UTC (rev 29)
@@ -273,7 +273,7 @@
#backButton {
text: "faxtomail.demande.back.button.label";
actionIcon: cancel;
- _applicationAction: { com.franciaflex.faxtomail.ui.swing.actions.ShowDemandeListAction.class };
+ _applicationAction: { com.franciaflex.faxtomail.ui.swing.actions.GoToPreviousScreenAction.class };
}
#saveButton {
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-03 15:06:12 UTC (rev 28)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/search/SearchUI.css 2014-04-03 16:13:47 UTC (rev 29)
@@ -51,6 +51,11 @@
text: "faxtomail.demande.takenBy.label";
}
+#takenByComboBox {
+ property: takenBy;
+ selectedItem: { model.getTakenBy() };
+}
+
#modifiedBetweenLabel {
text: "faxtomail.search.modifiedBetween.label";
}
@@ -170,6 +175,6 @@
}
#dataTable {
- editable: false;
+ editable: true;
autoCreateRowSorter: true;
}
\ 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-03 15:06:12 UTC (rev 28)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/search/SearchUIHandler.java 2014-04-03 16:13:47 UTC (rev 29)
@@ -25,6 +25,7 @@
import com.franciaflex.faxtomail.persistence.entities.DemandStatus;
import com.franciaflex.faxtomail.persistence.entities.Email;
import com.franciaflex.faxtomail.services.service.ReferentielService;
+import com.franciaflex.faxtomail.ui.swing.actions.SearchAction;
import com.franciaflex.faxtomail.ui.swing.actions.ShowDemandeAction;
import com.franciaflex.faxtomail.ui.swing.actions.ShowDemandeListAction;
import com.franciaflex.faxtomail.ui.swing.content.demande.DemandeListUIModel;
@@ -84,21 +85,24 @@
public void beforeInit(SearchUI ui) {
super.beforeInit(ui);
- SearchUIModel searchUIModel = new SearchUIModel();
- searchUIModel.setTakenBy(getContext().getCurrentUser());
- searchUIModel.setModifiedBy(getContext().getCurrentUser());
+ 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();
+ 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);
+ searchUIModel.setMaxModificationDate(now);
+ searchUIModel.setMinModificationDate(twoMonthsAgo);
+ searchUIModel.setMaxReceptionDate(now);
+ searchUIModel.setMinReceptionDate(twoMonthsAgo);
+ searchUIModel.setMaxPrintingDate(now);
+ searchUIModel.setMinPrintingDate(twoMonthsAgo);
+ }
getUI().setContextValue(searchUIModel);
}
@@ -109,37 +113,57 @@
ReferentielService referentielService = getContext().getReferentielService();
+ SearchUIModel model = getModel();
initBeanFilterableComboBox(ui.getTakenByComboBox(),
getContext().getUserService().getAllUsers(),
- getModel().getTakenBy());
+ model.getTakenBy());
initBeanFilterableComboBox(ui.getModifiedByComboBox(),
getContext().getUserService().getAllUsers(),
- getModel().getModifiedBy());
+ model.getModifiedBy());
initBeanFilterableComboBox(ui.getDocTypeComboBox(),
referentielService.getAllDemandType(),
- null);
+ model.getDemandType());
initBeanFilterableComboBox(ui.getPriorityComboBox(),
referentielService.getAllPriority(),
- null);
+ model.getPriority());
initBeanFilterableComboBox(ui.getEtatAttenteComboBox(),
referentielService.getAllEtatAttente(),
- null);
+ model.getEtatAttente());
initBeanFilterableComboBox(ui.getStatusComboBox(),
Arrays.asList(DemandStatus.values()),
- null);
+ model.getDemandStatus());
- JXTable dataTable = getUI().getDataTable();
+ final JXTable dataTable = getUI().getDataTable();
final AbstractApplicationTableModel<DemandeUIModel> tableModel = initDemandeTable(dataTable, true);
- getModel().addPropertyChangeListener(SearchUIModel.PROPERTY_RESULTS, new PropertyChangeListener() {
+ 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);
+ }
+ }
+ }
}
@Override
@@ -153,7 +177,6 @@
log.debug("closing: " + ui);
}
clearValidators();
-
}
@Override
@@ -183,4 +206,9 @@
getContext().setCurrentMailFolder(selectedEmail.getMailFolder());
getContext().getActionEngine().runAction(new ShowDemandeListAction(getContext().getMainUI().getHandler()));
}
+
+ @Override
+ protected String[] getEditableTableProperties() {
+ return new String[] { Email.PROPERTY_ATTACHMENT };
+ }
}
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-03 15:06:12 UTC (rev 28)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/AbstractFaxToMailDemandListHandler.java 2014-04-03 16:13:47 UTC (rev 29)
@@ -15,6 +15,7 @@
import com.franciaflex.faxtomail.ui.swing.util.attachment.AttachmentCellEditor;
import com.franciaflex.faxtomail.ui.swing.util.attachment.AttachmentCellRenderer;
import com.google.common.base.Function;
+import org.apache.commons.lang3.ArrayUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -146,7 +147,8 @@
}
}
- final AbstractApplicationTableModel<DemandeUIModel> tableModel = new DemandeTableModel(columnModel);
+ final AbstractApplicationTableModel<DemandeUIModel> tableModel = new DemandeTableModel(columnModel,
+ getEditableTableProperties());
table.setModel(tableModel);
table.setColumnModel(columnModel);
table.getTableHeader().setReorderingAllowed(false);
@@ -222,6 +224,29 @@
return tableModel;
}
+ @Override
+ public void autoSelectRowInTable(MouseEvent e, JPopupMenu popup) {
+ boolean rightClick = SwingUtilities.isRightMouseButton(e);
+ if (rightClick) {
+ // get the coordinates of the mouse click
+ Point p = e.getPoint();
+
+ JXTable source = (JXTable) e.getSource();
+
+ int[] selectedRows = source.getSelectedRows();
+
+ // get the row index at this point
+ int rowIndex = source.rowAtPoint(p);
+ if (rowIndex == -1 || !ArrayUtils.contains(selectedRows, rowIndex)) {
+ source.clearSelection();
+ }
+ }
+
+ super.autoSelectRowInTable(e, popup);
+ }
+
+ protected abstract String[] getEditableTableProperties();
+
protected void onDoubleClickOnDemande(DemandeUIModel selectedEmail) {
}
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-03 15:06:12 UTC (rev 28)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/DemandeTableModel.java 2014-04-03 16:13:47 UTC (rev 29)
@@ -44,8 +44,7 @@
*/
public class DemandeTableModel extends AbstractApplicationTableModel<DemandeUIModel> {
- private static final Log log =
- LogFactory.getLog(DemandeTableModel.class);
+ private static final Log log = LogFactory.getLog(DemandeTableModel.class);
public static final Map<String, ColumnIdentifier<Email>> COLUMN_IDENTIFIERS = new HashMap<String, ColumnIdentifier<Email>>() {{
put(Email.PROPERTY_SENDER,
@@ -158,11 +157,12 @@
}};
- public DemandeTableModel(TableColumnModelExt columnModel) {
+ public DemandeTableModel(TableColumnModelExt columnModel, String... editableProperties) {
super(columnModel, false, false);
List<ColumnIdentifier> nonEditableColumns = new ArrayList<ColumnIdentifier>(COLUMN_IDENTIFIERS.values());
- nonEditableColumns.remove(COLUMN_IDENTIFIERS.get(Email.PROPERTY_PRIORITY));
- nonEditableColumns.remove(COLUMN_IDENTIFIERS.get(Email.PROPERTY_ATTACHMENT));
+ for (String editableProperty : editableProperties) {
+ nonEditableColumns.remove(COLUMN_IDENTIFIERS.get(editableProperty));
+ }
setNoneEditableCols(nonEditableColumns.toArray(new ColumnIdentifier[nonEditableColumns.size()]));
}
Modified: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/attachment/AttachmentCellEditor.java
===================================================================
--- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/attachment/AttachmentCellEditor.java 2014-04-03 15:06:12 UTC (rev 28)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/attachment/AttachmentCellEditor.java 2014-04-03 16:13:47 UTC (rev 29)
@@ -63,14 +63,6 @@
return new AttachmentCellEditor(FaxToMailUIContext.getApplicationContext());
}
- protected JTable table;
-
- protected AbstractApplicationTableModel<AbstractFaxToMailBeanUIModel> tableModel;
-
- protected Integer rowIndex;
-
- protected Integer columnIndex;
-
protected final ButtonAttachment editorButton;
protected FaxToMailUIContext context;
@@ -102,14 +94,12 @@
boolean isSelected,
int row,
int column) {
- this.table = table;
- this.tableModel = (AbstractApplicationTableModel<AbstractFaxToMailBeanUIModel>) table.getModel();
+ AbstractApplicationTableModel<AbstractFaxToMailBeanUIModel> tableModel =
+ (AbstractApplicationTableModel<AbstractFaxToMailBeanUIModel>) table.getModel();
- rowIndex = row;
- columnIndex = column;
+ int modelRow = table.convertRowIndexToModel(row);
+ final DemandeUIModel model = (DemandeUIModel) tableModel.getEntry(modelRow);
- final DemandeUIModel model = (DemandeUIModel) tableModel.getEntry(row);
-
editorButton.init(model);
listener = new AttachmentEditorUIModel.AttachmentListener() {
Modified: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/attachment/AttachmentItem.css
===================================================================
--- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/attachment/AttachmentItem.css 2014-04-03 15:06:12 UTC (rev 28)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/attachment/AttachmentItem.css 2014-04-03 16:13:47 UTC (rev 29)
@@ -20,4 +20,6 @@
actionIcon: "delete";
toolTipText: "faxtomail.attachmentEditor.action.remove.tip";
enabled: { getAttachment() != null && getAttachment().getTopiaId() == null };
+ //TODO check
+ visible: { getHandler().getModel().isEditable() };
}
\ No newline at end of file
1
0
r28 - in trunk: faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/history
by kmorin@users.forge.codelutin.com 03 Apr '14
by kmorin@users.forge.codelutin.com 03 Apr '14
03 Apr '14
Author: kmorin
Date: 2014-04-03 17:06:12 +0200 (Thu, 03 Apr 2014)
New Revision: 28
Url: http://forge.codelutin.com/projects/faxtomail/repository/revisions/28
Log:
refs #4665 [ECRAN] Transfert
Modified:
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/actions/TransmitAction.java
trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/history/HistoryListUIHandler.java
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-03 14:21:15 UTC (rev 27)
+++ trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/EmailService.java 2014-04-03 15:06:12 UTC (rev 28)
@@ -50,7 +50,7 @@
HistoryTopiaDao historyDao = getPersistenceContext().getHistoryDao();
Set<String> fieldSet = Sets.newHashSet(modifiedFields);
- if (modifiedFields.length > 0) {
+ if (!fieldSet.isEmpty() && !fieldSet.contains(Email.PROPERTY_TAKEN_BY)) {
email.setTakenBy(user);
fieldSet.add(Email.PROPERTY_TAKEN_BY);
}
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-03 14:21:15 UTC (rev 27)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/TransmitAction.java 2014-04-03 15:06:12 UTC (rev 28)
@@ -1,9 +1,12 @@
package com.franciaflex.faxtomail.ui.swing.actions;
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 jaxx.runtime.JAXXContext;
+import jaxx.runtime.JAXXUtil;
/**
* @author Kevin Morin (Code Lutin)
@@ -19,10 +22,14 @@
public void doAction() throws Exception {
DemandeUIModel model = getModel();
model.setDemandStatus(DemandStatus.QUALIFIED);
+ model.setTakenBy(null);
//TODO kmorin 20140306
-// SaveDemandeAction action = getContext().getActionFactory().createLogicAction(getContext().getMainUI().getHandler(), SaveDemandeAction.class);
-// action.setDemandeModel(getModel());
-// getContext().getActionEngine().runAction(action);
+ DemandeUI parentUI = (DemandeUI) getUI().getContextValue(JAXXContext.class, JAXXUtil.PARENT);
+ SaveDemandeAction action = getContext().getActionFactory().createLogicAction(parentUI.getHandler(),
+ SaveDemandeAndExitAction.class);
+ getContext().getActionEngine().runAction(action);
+
+
}
}
Modified: 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/util/history/HistoryListUIHandler.java 2014-04-03 14:21:15 UTC (rev 27)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/history/HistoryListUIHandler.java 2014-04-03 15:06:12 UTC (rev 28)
@@ -114,7 +114,7 @@
if (fields != null) {
for (String field : fields) {
String label;
- if (I18n.hasKey(field)) {
+ if (I18n.hasKey("faxtomail.demande." + field + ".label")) {
label = t("faxtomail.demande." + field + ".label");
} else {
label = field;
1
0
r27 - in trunk/faxtomail-ui-swing/src/main: java/com/franciaflex/faxtomail/ui/swing/content/demande java/com/franciaflex/faxtomail/ui/swing/util resources/i18n
by kmorin@users.forge.codelutin.com 03 Apr '14
by kmorin@users.forge.codelutin.com 03 Apr '14
03 Apr '14
Author: kmorin
Date: 2014-04-03 16:21:15 +0200 (Thu, 03 Apr 2014)
New Revision: 27
Url: http://forge.codelutin.com/projects/faxtomail/repository/revisions/27
Log:
refs #4654 [ECRAN] Liste des mails / fax
ajout des colonnes pris par et dernier ?\195?\160 ouvrir une pi?\195?\168ce jointe
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/util/AbstractFaxToMailDemandListHandler.java
trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/DemandeTableModel.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
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-03 14:00:27 UTC (rev 26)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeUIModel.java 2014-04-03 14:21:15 UTC (rev 27)
@@ -65,6 +65,7 @@
public static final String PROPERTY_CLIENT_CODE = "clientCode";
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";
protected final Email editObject = new EmailImpl();
@@ -462,25 +463,37 @@
}
public void addRangeRow(RangeRow rangeRow) {
- Object oldValue = new ArrayList<RangeRow>(getRangeRow());
+ Object oldValue = null;
+ if (getRangeRow() != null) {
+ oldValue = new ArrayList<RangeRow>(getRangeRow());
+ }
editObject.addRangeRow(rangeRow);
firePropertyChange(Email.PROPERTY_RANGE_ROW, oldValue, getRangeRow());
}
public void addAllRangeRow(Collection<RangeRow> rangeRow) {
- Object oldValue = new ArrayList<RangeRow>(getRangeRow());
+ Object oldValue = null;
+ if (getRangeRow() != null) {
+ oldValue = new ArrayList<RangeRow>(getRangeRow());
+ }
editObject.addAllRangeRow(rangeRow);
firePropertyChange(Email.PROPERTY_RANGE_ROW, oldValue, getRangeRow());
}
public void removeRangeRow(RangeRow rangeRow) {
- Object oldValue = new ArrayList<RangeRow>(getRangeRow());
+ Object oldValue = null;
+ if (getRangeRow() != null) {
+ oldValue = new ArrayList<RangeRow>(getRangeRow());
+ }
editObject.removeRangeRow(rangeRow);
firePropertyChange(Email.PROPERTY_RANGE_ROW, oldValue, getRangeRow());
}
public void setRangeRow(Collection<RangeRow> rangeRow) {
- Object oldValue = new ArrayList<RangeRow>(getRangeRow());
+ Object oldValue = null;
+ if (getRangeRow() != null) {
+ oldValue = new ArrayList<RangeRow>(getRangeRow());
+ }
if (rangeRow == null) {
rangeRow = new ArrayList<RangeRow>();
}
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-03 14:00:27 UTC (rev 26)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/AbstractFaxToMailDemandListHandler.java 2014-04-03 14:21:15 UTC (rev 27)
@@ -4,6 +4,7 @@
import com.franciaflex.faxtomail.persistence.entities.Company;
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.persistence.entities.HasLabel;
import com.franciaflex.faxtomail.persistence.entities.HistoryType;
import com.franciaflex.faxtomail.persistence.entities.Priority;
@@ -72,6 +73,8 @@
Email.PROPERTY_ETAT_ATTENTE,
DemandeUIModel.PROPERTY_PF_NB,
DemandeUIModel.PROPERTY_SAV_NB,
+ Email.PROPERTY_TAKEN_BY,
+ DemandeUIModel.PROPERTY_LAST_ATTACHMENT_OPENING_USER,
Email.PROPERTY_ATTACHMENT
}, ',');
}
@@ -117,11 +120,17 @@
case Email.PROPERTY_DEMAND_STATUS:
tableCellRenderer = newTableCellRender(DemandStatus.class);
break;
+
case Email.PROPERTY_DEMAND_TYPE:
case Email.PROPERTY_ETAT_ATTENTE:
tableCellRenderer = newTableCellRender(HasLabel.class);
break;
+ case Email.PROPERTY_TAKEN_BY:
+ case DemandeUIModel.PROPERTY_LAST_ATTACHMENT_OPENING_USER:
+ tableCellRenderer = newTableCellRender(FaxToMailUser.class);
+ break;
+
default:
tableCellRenderer = newTableCellRender(new Decorator<Object>(Object.class) {
@Override
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-03 14:00:27 UTC (rev 26)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/DemandeTableModel.java 2014-04-03 14:21:15 UTC (rev 27)
@@ -150,6 +150,12 @@
n("faxtomail.demandeList.table.header.attachment"),
n("faxtomail.demandeList.table.header.attachment.tip")));
+ put(DemandeUIModel.PROPERTY_LAST_ATTACHMENT_OPENING_USER,
+ ColumnIdentifier.<Email>newId(
+ DemandeUIModel.PROPERTY_LAST_ATTACHMENT_OPENING_USER,
+ n("faxtomail.demandeList.table.header.lastAttachmentOpeningUser"),
+ n("faxtomail.demandeList.table.header.lastAttachmentOpeningUser.tip")));
+
}};
public DemandeTableModel(TableColumnModelExt columnModel) {
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-03 14:00:27 UTC (rev 26)
+++ trunk/faxtomail-ui-swing/src/main/resources/i18n/faxtomail-ui-swing_en_GB.properties 2014-04-03 14:21:15 UTC (rev 27)
@@ -202,6 +202,8 @@
faxtomail.demandeList.table.header.ediCodeNumber.tip=
faxtomail.demandeList.table.header.folder=
faxtomail.demandeList.table.header.folder.tip=
+faxtomail.demandeList.table.header.lastAttachmentOpeningUser=
+faxtomail.demandeList.table.header.lastAttachmentOpeningUser.tip=
faxtomail.demandeList.table.header.object=
faxtomail.demandeList.table.header.object.tip=
faxtomail.demandeList.table.header.pfNb=
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-03 14:00:27 UTC (rev 26)
+++ trunk/faxtomail-ui-swing/src/main/resources/i18n/faxtomail-ui-swing_fr_FR.properties 2014-04-03 14:21:15 UTC (rev 27)
@@ -102,6 +102,8 @@
faxtomail.demandeList.table.header.companyReference.tip=Notre référence
faxtomail.demandeList.table.header.ediCodeNumber=Code EDI
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
1
0
03 Apr '14
Author: kmorin
Date: 2014-04-03 16:00:27 +0200 (Thu, 03 Apr 2014)
New Revision: 26
Url: http://forge.codelutin.com/projects/faxtomail/repository/revisions/26
Log:
refs #4654 [ECRAN] Liste des mails / fax
refs #4655 [ECRAN] D?\195?\169tail d'un mail / fax
dernier utilisateur qui a visualis?\195?\169 une pi?\195?\168ce jointe
refs #4666 [ECRAN] Pi?\195?\168ces jointes
historique d'ouverture et d'?\195?\169dition des pi?\195?\168ces jointes
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-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-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/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/reply/ReplyFormUIModel.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/attachment/AttachmentCellEditor.java
trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/attachment/AttachmentEditorUIHandler.java
trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/attachment/AttachmentEditorUIModel.java
trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/attachment/ButtonAttachment.java
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/util/history/HistoryListUIHandler.java
trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/history/HistoryListUIModel.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
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-02 15:46:04 UTC (rev 25)
+++ trunk/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/persistence/entities/HistoryType.java 2014-04-03 14:00:27 UTC (rev 26)
@@ -38,7 +38,9 @@
MODIFICATION(n("faxtomail.historyType.modification")),
REPLY(n("faxtomail.historyType.reply")),
PRINTING(n("faxtomail.historyType.printing")),
- ARCHIVED(n("faxtomail.historyType.archive"));
+ ARCHIVED(n("faxtomail.historyType.archive")),
+ ATTACHMENT_OPENING(n("faxtomail.historyType.attachmentOpening")),
+ ATTACHMENT_MODIFICATION(n("faxtomail.historyType.attachmentModification"));
protected String labelKey;
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-02 15:46:04 UTC (rev 25)
+++ trunk/faxtomail-persistence/src/main/resources/i18n/faxtomail-persistence_en_GB.properties 2014-04-03 14:00:27 UTC (rev 26)
@@ -26,6 +26,9 @@
faxtomail.demandStatus.transmittedToEdi=
faxtomail.demandStatus.untreated=
faxtomail.historyType.archive=
+faxtomail.historyType.attachmentCreation=
+faxtomail.historyType.attachmentModification=
+faxtomail.historyType.attachmentOpening=
faxtomail.historyType.creation=
faxtomail.historyType.modification=
faxtomail.historyType.opening=
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-02 15:46:04 UTC (rev 25)
+++ trunk/faxtomail-persistence/src/main/resources/i18n/faxtomail-persistence_fr_FR.properties 2014-04-03 14:00:27 UTC (rev 26)
@@ -26,6 +26,8 @@
faxtomail.demandStatus.transmittedToEdi=Transmis à l'EDI
faxtomail.demandStatus.untreated=Non traité
faxtomail.historyType.archive=Archivage
+faxtomail.historyType.attachmentModification=Modification de pièce jointe
+faxtomail.historyType.attachmentOpening=Ouverture de pièce jointe
faxtomail.historyType.creation=Création
faxtomail.historyType.modification=Modification
faxtomail.historyType.opening=Ouverture
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-02 15:46:04 UTC (rev 25)
+++ trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/EmailService.java 2014-04-03 14:00:27 UTC (rev 26)
@@ -133,13 +133,14 @@
return folders;
}
- public Email addToOpeningHistory(String emailId, FaxToMailUser user, Date date) {
+ public Email addToHistory(String emailId, HistoryType type, FaxToMailUser user, Date date, String... fields) {
EmailTopiaDao emailDao = getPersistenceContext().getEmailDao();
Email email = emailDao.findByTopiaId(emailId);
HistoryTopiaDao historyDao = getPersistenceContext().getHistoryDao();
- History history = historyDao.create(History.PROPERTY_TYPE, HistoryType.OPENING,
+ History history = historyDao.create(History.PROPERTY_TYPE, type,
History.PROPERTY_FAX_TO_MAIL_USER, user,
+ History.PROPERTY_FIELDS, Sets.newHashSet(fields),
History.PROPERTY_MODIFICATION_DATE, date);
email.addHistory(history);
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-02 15:46:04 UTC (rev 25)
+++ trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/InitFaxToMailService.java 2014-04-03 14:00:27 UTC (rev 26)
@@ -62,10 +62,6 @@
import org.nuiton.jaxx.application.ApplicationTechnicalException;
import java.io.File;
-import java.io.IOException;
-import java.io.InputStream;
-import java.net.URISyntaxException;
-import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
@@ -350,7 +346,7 @@
if (opened) {
- getEmailService().addToOpeningHistory(email.getTopiaId(), user, now);
+ getEmailService().addToHistory(email.getTopiaId(), HistoryType.OPENING, user, now);
email.setDemandType(types.get(random.nextInt(types.size())));
email.setPriority(priorities.get(random.nextInt(priorities.size())));
email.setRangeRow(rangeRows);
@@ -383,7 +379,7 @@
if (opened) {
- getEmailService().addToOpeningHistory(email.getTopiaId(), user, now);
+ getEmailService().addToHistory(email.getTopiaId(), HistoryType.OPENING, user, now);
email.setDemandType(types.get(random.nextInt(types.size())));
email.setPriority(priorities.get(random.nextInt(priorities.size())));
email.setRangeRow(rangeRows);
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-02 15:46:04 UTC (rev 25)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/GenerateAnnotatedAttachmentAction.java 2014-04-03 14:00:27 UTC (rev 26)
@@ -2,6 +2,7 @@
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;
@@ -19,6 +20,7 @@
import com.itextpdf.text.pdf.PdfReader;
import com.itextpdf.text.pdf.PdfStamper;
import com.itextpdf.text.pdf.PdfWriter;
+import jaxx.runtime.JAXXContext;
import jaxx.runtime.JAXXUtil;
import jaxx.runtime.SwingUtil;
import org.apache.commons.io.FileUtils;
@@ -154,5 +156,11 @@
getModel().setEditedFile(target);
}
+ @Override
+ public void postSuccessAction() {
+ super.postSuccessAction();
+ AttachmentEditorUI parentUI = (AttachmentEditorUI) getUI().getContextValue(JAXXContext.class, JAXXUtil.PARENT);
+ parentUI.getModel().fireAttachmentEdited(getModel().toEntity());
+ }
}
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-02 15:46:04 UTC (rev 25)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeUI.css 2014-04-03 14:00:27 UTC (rev 26)
@@ -204,6 +204,26 @@
text: { handler.decorate(model.getLastModificationDate()) };
}
+#lastAttachmentOpeningLabel {
+ text: "faxtomail.demande.lastAttachmentOpening.label";
+}
+
+#lastAttachmentOpenedByLabel {
+ text: "faxtomail.common.by.label";
+}
+
+#lastAttachmentOpenedByField {
+ text: { handler.decorateUser(model.getLastAttachmentOpeningUser(), true) };
+}
+
+#lastAttachmentOpeningDateLabel {
+ text: "faxtomail.common.on.label";
+}
+
+#lastAttachmentOpeningDateField {
+ text: { handler.decorate(model.getLastAttachmentOpeningDate()) };
+}
+
#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-02 15:46:04 UTC (rev 25)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeUI.jaxx 2014-04-03 14:00:27 UTC (rev 26)
@@ -231,6 +231,27 @@
<JLabel id="lastModificationDateField"/>
</cell>
</row>
+ <row>
+ <cell columns='4'>
+ <JLabel id="lastAttachmentOpeningLabel"/>
+ </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>
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-02 15:46:04 UTC (rev 25)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeUIHandler.java 2014-04-03 14:00:27 UTC (rev 26)
@@ -24,6 +24,8 @@
import com.franciaflex.faxtomail.persistence.entities.Attachment;
+import com.franciaflex.faxtomail.persistence.entities.Email;
+import com.franciaflex.faxtomail.persistence.entities.HistoryType;
import com.franciaflex.faxtomail.persistence.entities.Range;
import com.franciaflex.faxtomail.persistence.entities.RangeRow;
import com.franciaflex.faxtomail.services.service.ReferentielService;
@@ -33,7 +35,7 @@
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.google.common.collect.Maps;
+import com.franciaflex.faxtomail.ui.swing.util.attachment.AttachmentEditorUIModel;
import jaxx.runtime.validator.swing.SwingValidator;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -48,40 +50,25 @@
import org.nuiton.jaxx.application.swing.table.MoveToNextEditableRowAction;
import org.nuiton.jaxx.application.swing.table.MoveToPreviousEditableCellAction;
import org.nuiton.jaxx.application.swing.table.MoveToPreviousEditableRowAction;
-import org.nuiton.topia.persistence.TopiaEntities;
import org.nuiton.util.beans.BeanMonitor;
import javax.swing.*;
import javax.swing.event.ListSelectionEvent;
import javax.swing.event.ListSelectionListener;
-import javax.swing.event.TableModelEvent;
-import javax.swing.event.TableModelListener;
import javax.swing.table.TableCellEditor;
-import javax.swing.text.AbstractDocument;
-import javax.swing.text.AttributeSet;
-import javax.swing.text.BadLocationException;
-import javax.swing.text.Element;
-import javax.swing.text.LabelView;
-import javax.swing.text.StyleConstants;
-import javax.swing.text.View;
-import javax.swing.text.ViewFactory;
-import javax.swing.text.html.HTML;
import javax.swing.text.html.HTMLEditorKit;
import java.awt.*;
import java.awt.event.KeyAdapter;
import java.awt.event.KeyEvent;
-import java.awt.print.PrinterJob;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
import java.io.File;
-import java.io.IOException;
import java.util.ArrayList;
import java.util.Collection;
+import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.Set;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
import static org.nuiton.i18n.I18n.t;
@@ -111,7 +98,7 @@
super.beforeInit(ui);
DemandeUIModel model = getContext().getCurrentEmail();
- listModelIsModify(model);
+// listModelIsModify(model);
Set<String> propertiesToIgnore = getPropertiesToIgnore();
monitor = new BeanMonitor(true, propertiesToIgnore.toArray(new String[propertiesToIgnore.size()]));
monitor.setBean(model);
@@ -319,6 +306,39 @@
model.setModify(false);
registerValidators(validator);
+
+ ui.getAttachmentsButton().getBean().addAttachmentListener(
+ new AttachmentEditorUIModel.AttachmentListener() {
+
+ @Override
+ public void onAttachmentOpened(Attachment attachment) {
+ String topiaId = getModel().getTopiaId();
+ if (topiaId != null) {
+ Email email = getContext().getEmailService().addToHistory(topiaId,
+ HistoryType.ATTACHMENT_OPENING,
+ getContext().getCurrentUser(),
+ new Date(),
+ attachment.getOriginalFile().getName());
+ getModel().fromEntity(email);
+ }
+ }
+
+ @Override
+ public void onAttachmentEdited(Attachment attachment) {
+ String topiaId = getModel().getTopiaId();
+ if (topiaId != null) {
+ Email email = getContext().getEmailService().addToHistory(topiaId,
+ HistoryType.ATTACHMENT_MODIFICATION,
+ getContext().getCurrentUser(),
+ new Date(),
+ attachment.getOriginalFile().getName());
+ getModel().fromEntity(email);
+ }
+ }
+
+
+ }
+ );
}
@Override
@@ -330,6 +350,7 @@
protected Set<String> getPropertiesToIgnore() {
Set<String> result = super.getPropertiesToIgnore();
result.add(DemandeUIModel.PROPERTY_EDITABLE);
+ result.add(Email.PROPERTY_HISTORY);
return result;
}
@@ -347,7 +368,7 @@
public boolean quitUI() {
boolean result = quitScreen(
true,
- getModel().isModify(),
+ getMonitor().wasModified(),
t("faxtomail.demande.askCancelEditBeforeLeaving.cancelSave"),
t("faxtomail.demande.askSaveBeforeLeaving.save"),
getContext().getActionFactory().createUIAction(this, SaveDemandeAction.class)
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-02 15:46:04 UTC (rev 25)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeUIModel.java 2014-04-03 14:00:27 UTC (rev 26)
@@ -47,6 +47,7 @@
import java.util.ArrayList;
import java.util.Collection;
import java.util.Date;
+import java.util.List;
import static org.nuiton.i18n.I18n.t;
@@ -73,6 +74,8 @@
protected History lastModificationHistory;
+ protected History lastAttachmentOpeningHistory;
+
protected int quotationNb;
protected int pfNb;
@@ -95,6 +98,7 @@
public void propertyChange(PropertyChangeEvent evt) {
findFirstOpeningHistory();
findLastModificationHistory();
+ findLastAttachmentOpeningHistory();
}
});
@@ -316,9 +320,8 @@
}
public void setHistory(Collection<History> history) {
- Object oldValue = getHistory();
editObject.setHistory(history);
- firePropertyChanged(Email.PROPERTY_HISTORY, oldValue, history);
+ firePropertyChanged(Email.PROPERTY_HISTORY, null, history);
}
public Collection<History> getHistory() {
@@ -360,6 +363,23 @@
lastModificationHistory = result;
}
+ public void findLastAttachmentOpeningHistory() {
+ History result = null;
+ Date date = null;
+ Collection<History> histories = getHistory();
+ if (histories != null) {
+ for (History history : histories) {
+ if (HistoryType.ATTACHMENT_OPENING.equals(history.getType())) {
+ if (date == null || date.before(history.getModificationDate())) {
+ date = history.getModificationDate();
+ result = history;
+ }
+ }
+ }
+ }
+ lastAttachmentOpeningHistory = result;
+ }
+
public History getFirstOpeningHistory() {
return firstOpeningHistory;
}
@@ -388,6 +408,20 @@
return history != null ? history.getModificationDate() : null;
}
+ public History getLastAttachmentOpeningHistory() {
+ return lastAttachmentOpeningHistory;
+ }
+
+ public FaxToMailUser getLastAttachmentOpeningUser() {
+ History history = getLastAttachmentOpeningHistory();
+ return history != null ? history.getFaxToMailUser() : null;
+ }
+
+ public Date getLastAttachmentOpeningDate() {
+ History history = getLastAttachmentOpeningHistory();
+ return history != null ? history.getModificationDate() : null;
+ }
+
@Override
public Collection<Attachment> getAttachment() {
return attachments;
@@ -395,28 +429,32 @@
@Override
public void addAllAttachment(Collection<Attachment> attachment) {
+ Object oldValue = new ArrayList<Attachment>(getAttachment());
attachments.addAll(attachment);
- firePropertyChange(Email.PROPERTY_ATTACHMENT, null, getAttachment());
+ firePropertyChange(Email.PROPERTY_ATTACHMENT, oldValue, getAttachment());
}
@Override
public void addAttachment(Attachment attachment) {
+ Object oldValue = new ArrayList<Attachment>(getAttachment());
attachments.add(attachment);
- firePropertyChange(Email.PROPERTY_ATTACHMENT, null, getAttachment());
+ firePropertyChange(Email.PROPERTY_ATTACHMENT, oldValue, getAttachment());
}
@Override
public void removeAttachment(Attachment attachment) {
+ Object oldValue = new ArrayList<Attachment>(getAttachment());
attachments.remove(attachment);
- firePropertyChange(Email.PROPERTY_ATTACHMENT, null, getAttachment());
+ firePropertyChange(Email.PROPERTY_ATTACHMENT, oldValue, getAttachment());
}
public void setAttachment(Collection<Attachment> attachment) {
+ Object oldValue = new ArrayList<Attachment>(getAttachment());
attachments.clear();
if (attachment != null) {
attachments.addAll(attachment);
}
- firePropertyChange(Email.PROPERTY_ATTACHMENT, null, getAttachment());
+ firePropertyChange(Email.PROPERTY_ATTACHMENT, oldValue, getAttachment());
}
public Collection<RangeRow> getRangeRow() {
@@ -424,26 +462,30 @@
}
public void addRangeRow(RangeRow rangeRow) {
+ Object oldValue = new ArrayList<RangeRow>(getRangeRow());
editObject.addRangeRow(rangeRow);
- firePropertyChange(Email.PROPERTY_RANGE_ROW, null, getRangeRow());
+ firePropertyChange(Email.PROPERTY_RANGE_ROW, oldValue, getRangeRow());
}
public void addAllRangeRow(Collection<RangeRow> rangeRow) {
+ Object oldValue = new ArrayList<RangeRow>(getRangeRow());
editObject.addAllRangeRow(rangeRow);
- firePropertyChange(Email.PROPERTY_RANGE_ROW, null, getRangeRow());
+ firePropertyChange(Email.PROPERTY_RANGE_ROW, oldValue, getRangeRow());
}
public void removeRangeRow(RangeRow rangeRow) {
+ Object oldValue = new ArrayList<RangeRow>(getRangeRow());
editObject.removeRangeRow(rangeRow);
- firePropertyChange(Email.PROPERTY_RANGE_ROW, null, getRangeRow());
+ firePropertyChange(Email.PROPERTY_RANGE_ROW, oldValue, getRangeRow());
}
public void setRangeRow(Collection<RangeRow> rangeRow) {
+ Object oldValue = new ArrayList<RangeRow>(getRangeRow());
if (rangeRow == null) {
rangeRow = new ArrayList<RangeRow>();
}
editObject.setRangeRow(rangeRow);
- firePropertyChange(Email.PROPERTY_RANGE_ROW, null, getRangeRow());
+ firePropertyChange(Email.PROPERTY_RANGE_ROW, oldValue, getRangeRow());
}
public MailFolder getMailFolder() {
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-02 15:46:04 UTC (rev 25)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/reply/ReplyFormUIModel.java 2014-04-03 14:00:27 UTC (rev 26)
@@ -87,4 +87,5 @@
attachments.remove(attachment);
firePropertyChange(AttachmentModelAware.PROPERTY_ATTACHMENT, null, getAttachment());
}
+
}
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-02 15:46:04 UTC (rev 25)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/AbstractFaxToMailDemandListHandler.java 2014-04-03 14:00:27 UTC (rev 26)
@@ -5,17 +5,15 @@
import com.franciaflex.faxtomail.persistence.entities.DemandStatus;
import com.franciaflex.faxtomail.persistence.entities.Email;
import com.franciaflex.faxtomail.persistence.entities.HasLabel;
+import com.franciaflex.faxtomail.persistence.entities.HistoryType;
import com.franciaflex.faxtomail.persistence.entities.Priority;
import com.franciaflex.faxtomail.persistence.entities.RangeRow;
-import com.franciaflex.faxtomail.services.service.ValidationService;
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 com.franciaflex.faxtomail.ui.swing.util.attachment.AttachmentCellEditor;
import com.franciaflex.faxtomail.ui.swing.util.attachment.AttachmentCellRenderer;
import com.google.common.base.Function;
-import jaxx.runtime.swing.renderer.DecoratorTableCellRenderer;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -34,7 +32,6 @@
import javax.swing.*;
import javax.swing.event.ChangeListener;
import javax.swing.table.DefaultTableCellRenderer;
-import javax.swing.table.TableCellEditor;
import javax.swing.table.TableCellRenderer;
import java.awt.*;
import java.awt.event.MouseAdapter;
@@ -203,9 +200,10 @@
DemandeUIModel selectedEmail = tableModel.getEntry(rowIndex);
onDoubleClickOnDemande(selectedEmail);
FaxToMailUIContext context = getContext();
- Email email = context.getEmailService().addToOpeningHistory(selectedEmail.getTopiaId(),
- context.getCurrentUser(),
- new Date());
+ Email email = context.getEmailService().addToHistory(selectedEmail.getTopiaId(),
+ HistoryType.OPENING,
+ context.getCurrentUser(),
+ new Date());
selectedEmail.fromEntity(email);
openDemand(selectedEmail);
}
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-02 15:46:04 UTC (rev 25)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/AbstractFaxToMailUIHandler.java 2014-04-03 14:00:27 UTC (rev 26)
@@ -182,7 +182,9 @@
@Override
public void propertyChange(PropertyChangeEvent evt) {
- if (!excludeProperties.contains(evt.getPropertyName())) {
+ if (!excludeProperties.contains(evt.getPropertyName())
+ //check that the new value and old value are not both null
+ && evt.getNewValue() != evt.getOldValue()) {
((AbstractFaxToMailBeanUIModel) evt.getSource()).setModify(true);
}
}
Modified: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/attachment/AttachmentCellEditor.java
===================================================================
--- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/attachment/AttachmentCellEditor.java 2014-04-02 15:46:04 UTC (rev 25)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/attachment/AttachmentCellEditor.java 2014-04-03 14:00:27 UTC (rev 26)
@@ -24,7 +24,10 @@
* #L%
*/
+import com.franciaflex.faxtomail.persistence.entities.Attachment;
+import com.franciaflex.faxtomail.persistence.entities.HistoryType;
import com.franciaflex.faxtomail.ui.swing.FaxToMailUIContext;
+import com.franciaflex.faxtomail.ui.swing.content.demande.DemandeUIModel;
import com.franciaflex.faxtomail.ui.swing.util.AbstractFaxToMailBeanUIModel;
import com.franciaflex.faxtomail.ui.swing.util.FaxToMailUI;
import com.google.common.base.Preconditions;
@@ -38,6 +41,7 @@
import javax.swing.event.ChangeEvent;
import javax.swing.table.TableCellEditor;
import java.awt.*;
+import java.util.Date;
import java.util.EventObject;
/**
@@ -69,7 +73,12 @@
protected final ButtonAttachment editorButton;
+ protected FaxToMailUIContext context;
+
+ protected AttachmentEditorUIModel.AttachmentListener listener;
+
public AttachmentCellEditor(FaxToMailUIContext context) {
+ this.context = context;
this.editorButton = new ButtonAttachment("faxtomail.attachmentCellRenderer.text", null);
this.editorButton.setBorder(new LineBorder(Color.BLACK));
@@ -99,11 +108,36 @@
rowIndex = row;
columnIndex = column;
- AttachmentModelAware model =
- (AttachmentModelAware) tableModel.getEntry(row);
+ final DemandeUIModel model = (DemandeUIModel) tableModel.getEntry(row);
editorButton.init(model);
+ listener = new AttachmentEditorUIModel.AttachmentListener() {
+ @Override
+ public void onAttachmentOpened(Attachment attachment) {
+ String topiaId = model.getTopiaId();
+ if (topiaId != null) {
+ context.getEmailService().addToHistory(topiaId,
+ HistoryType.ATTACHMENT_OPENING,
+ context.getCurrentUser(),
+ new Date(),
+ attachment.getOriginalFile().getName());
+ }
+ }
+
+ @Override
+ public void onAttachmentEdited(Attachment attachment) {
+ String topiaId = model.getTopiaId();
+ context.getEmailService().addToHistory(topiaId,
+ HistoryType.ATTACHMENT_MODIFICATION,
+ context.getCurrentUser(),
+ new Date(),
+ attachment.getOriginalFile().getName());
+ }
+ };
+
+ editorButton.getBean().addAttachmentListener(listener);
+
return editorButton;
}
@@ -115,7 +149,7 @@
@Override
public Object getCellEditorValue() {
- AttachmentModelAware model = editorButton.getBean();
+ AttachmentEditorUIModel model = editorButton.getBean();
Preconditions.checkNotNull(model, "No model found in editor.");
Object result = model.getAttachment();
@@ -130,6 +164,7 @@
public boolean stopCellEditing() {
boolean b = super.stopCellEditing();
if (b) {
+ editorButton.getBean().removeAttachmentListener(listener);
editorButton.init(null);
}
return b;
@@ -137,6 +172,7 @@
@Override
public void cancelCellEditing() {
+ editorButton.getBean().removeAttachmentListener(listener);
editorButton.init(null);
super.cancelCellEditing();
}
Modified: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/attachment/AttachmentEditorUIHandler.java
===================================================================
--- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/attachment/AttachmentEditorUIHandler.java 2014-04-02 15:46:04 UTC (rev 25)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/attachment/AttachmentEditorUIHandler.java 2014-04-03 14:00:27 UTC (rev 26)
@@ -31,6 +31,7 @@
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;
@@ -53,7 +54,7 @@
initTable(ui.getAttachments());
- getModel().addPropertyChangeListener(AttachmentEditorUIModel.PROPERTY_ATTACHMENT, new PropertyChangeListener() {
+ getModel().addPropertyChangeListener(AttachmentModelAware.PROPERTY_ATTACHMENT, new PropertyChangeListener() {
@Override
public void propertyChange(PropertyChangeEvent evt) {
AbstractTableModel tableModel = (AbstractTableModel) getUI().getAttachments().getModel();
@@ -164,8 +165,10 @@
throw new ApplicationTechnicalException(t("faxtomail.attachmentEditor.fileNotFound", file.getAbsolutePath()));
}
+ getModel().fireAttachmentOpened(attachment);
+
String extension = FileUtil.extension(file);
- if (EDITABLE_EXTENSIONS.contains(extension.toUpperCase())) {
+ if (getModel().isEditable() && EDITABLE_EXTENSIONS.contains(extension.toUpperCase())) {
PDFEditorUI dialogContent = new PDFEditorUI(ui);
dialogContent.getModel().fromEntity(attachment);
Modified: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/attachment/AttachmentEditorUIModel.java
===================================================================
--- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/attachment/AttachmentEditorUIModel.java 2014-04-02 15:46:04 UTC (rev 25)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/attachment/AttachmentEditorUIModel.java 2014-04-03 14:00:27 UTC (rev 26)
@@ -8,13 +8,13 @@
import java.io.File;
import java.util.ArrayList;
import java.util.Collection;
+import java.util.List;
/**
* @author Kevin Morin (Code Lutin)
* @since x.x
*/
-public class AttachmentEditorUIModel extends AbstractFaxToMailBeanUIModel<AttachmentModelAware, AttachmentEditorUIModel>
- implements AttachmentModelAware {
+public class AttachmentEditorUIModel extends AbstractFaxToMailBeanUIModel<AttachmentModelAware, AttachmentEditorUIModel> {
public static final String PROPERTY_FILE = "file";
public static final String PROPERTY_EDITABLE = "editable";
@@ -24,6 +24,8 @@
protected final Collection<Attachment> attachments = new ArrayList<Attachment>();
+ protected List<AttachmentListener> openingListeners = new ArrayList<AttachmentListener>();
+
protected static Binder<AttachmentEditorUIModel, AttachmentModelAware> toBeanBinder =
BinderFactory.newBinder(AttachmentEditorUIModel.class,
AttachmentModelAware.class);
@@ -55,26 +57,22 @@
firePropertyChange(PROPERTY_EDITABLE, oldValue, editable);
}
- @Override
public Collection<Attachment> getAttachment() {
return attachments;
}
- @Override
public void addAllAttachment(Collection<Attachment> attachments) {
Object oldValue = new ArrayList<Attachment>(getAttachment());
this.attachments.addAll(attachments);
firePropertyChange(AttachmentModelAware.PROPERTY_ATTACHMENT, oldValue, this.attachments);
}
- @Override
public void addAttachment(Attachment attachment) {
Object oldValue = new ArrayList<Attachment>(getAttachment());
attachments.add(attachment);
firePropertyChange(AttachmentModelAware.PROPERTY_ATTACHMENT, oldValue, attachments);
}
- @Override
public void removeAttachment(Attachment attachment) {
Object oldValue = new ArrayList<Attachment>(getAttachment());
attachments.remove(attachment);
@@ -94,4 +92,32 @@
protected AttachmentModelAware newEntity() {
return null;
}
+
+ public void addAttachmentListener(AttachmentListener listener) {
+ openingListeners.add(listener);
+ }
+
+ public void removeAttachmentListener(AttachmentListener listener) {
+ openingListeners.remove(listener);
+ }
+
+ public void fireAttachmentOpened(Attachment attachment) {
+ for (AttachmentListener listener : openingListeners) {
+ listener.onAttachmentOpened(attachment);
+ }
+ }
+
+ public void fireAttachmentEdited(Attachment attachment) {
+ for (AttachmentListener listener : openingListeners) {
+ listener.onAttachmentEdited(attachment);
+ }
+ }
+
+ public static interface AttachmentListener {
+
+ public void onAttachmentOpened(Attachment attachment);
+
+ public void onAttachmentEdited(Attachment attachment);
+
+ }
}
Modified: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/attachment/ButtonAttachment.java
===================================================================
--- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/attachment/ButtonAttachment.java 2014-04-02 15:46:04 UTC (rev 25)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/attachment/ButtonAttachment.java 2014-04-03 14:00:27 UTC (rev 26)
@@ -70,13 +70,13 @@
public void init(AttachmentModelAware model) {
attachmentModelAware = model;
- popup.getModel().removePropertyChangeListener(AttachmentEditorUIModel.PROPERTY_ATTACHMENT, listener);
+ popup.getModel().removePropertyChangeListener(AttachmentModelAware.PROPERTY_ATTACHMENT, listener);
popup.getModel().fromEntity(model);
- popup.getModel().addPropertyChangeListener(AttachmentEditorUIModel.PROPERTY_ATTACHMENT, listener);
+ popup.getModel().addPropertyChangeListener(AttachmentModelAware.PROPERTY_ATTACHMENT, listener);
setText(getButtonText(model != null ? model.getAttachment() : null));
}
- public AttachmentModelAware getBean() {
+ public AttachmentEditorUIModel getBean() {
return popup.getModel();
}
Modified: 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/util/history/ButtonHistory.java 2014-04-02 15:46:04 UTC (rev 25)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/history/ButtonHistory.java 2014-04-03 14:00:27 UTC (rev 26)
@@ -1,6 +1,8 @@
package com.franciaflex.faxtomail.ui.swing.util.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;
@@ -18,6 +20,7 @@
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;
@@ -34,6 +37,16 @@
setToolTipText(t("faxtomail.historyList.action.tip"));
int historySize = popup.getModel().sizeHistory();
setText(t("faxtomail.historyList.text", historySize));
+
+ popup.getModel().addPropertyChangeListener(Email.PROPERTY_HISTORY, new PropertyChangeListener() {
+ @Override
+ public void propertyChange(PropertyChangeEvent evt) {
+ Collection<History> history = (Collection<History>) evt.getNewValue();
+ if (history != null) {
+ setText(t("faxtomail.historyList.text", history.size()));
+ }
+ }
+ });
}
@Override
Modified: 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/util/history/HistoryListUIHandler.java 2014-04-02 15:46:04 UTC (rev 25)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/history/HistoryListUIHandler.java 2014-04-03 14:00:27 UTC (rev 26)
@@ -1,5 +1,6 @@
package com.franciaflex.faxtomail.ui.swing.util.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;
@@ -12,6 +13,7 @@
import org.apache.commons.logging.LogFactory;
import org.jdesktop.swingx.JXList;
import org.jdesktop.swingx.decorator.HighlighterFactory;
+import org.nuiton.i18n.I18n;
import org.nuiton.util.StringUtil;
import javax.swing.*;
@@ -52,11 +54,20 @@
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);
@@ -73,10 +84,19 @@
listModel.setAllElements(getModel().getHistory());
list.setModel(listModel);
list.addHighlighter(HighlighterFactory.createAlternateStriping());
+
+ getModel().addPropertyChangeListener(Email.PROPERTY_HISTORY, new PropertyChangeListener() {
+ @Override
+ public void propertyChange(PropertyChangeEvent evt) {
+ Collection<History> history = (Collection<History>) evt.getNewValue();
+ ((JaxxDefaultListModel) getUI().getHistories().getModel()).setAllElements(history);
+ }
+ });
}
@Override
public void onCloseUI() {
+ getContext().getCurrentEmail().removePropertyChangeListener(Email.PROPERTY_HISTORY, historyChangeListener);
}
@Override
@@ -93,7 +113,13 @@
List<String> fieldLabels = new ArrayList<String>();
if (fields != null) {
for (String field : fields) {
- fieldLabels.add(t("faxtomail.demande." + field + ".label"));
+ String label;
+ if (I18n.hasKey(field)) {
+ label = t("faxtomail.demande." + field + ".label");
+ } else {
+ label = field;
+ }
+ fieldLabels.add(label);
}
}
return StringUtils.join(fieldLabels, ", ");
Modified: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/history/HistoryListUIModel.java
===================================================================
--- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/history/HistoryListUIModel.java 2014-04-02 15:46:04 UTC (rev 25)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/history/HistoryListUIModel.java 2014-04-03 14:00:27 UTC (rev 26)
@@ -31,6 +31,7 @@
public void setHistory(Collection<History> history) {
editObject.setHistory(history);
+ firePropertyChanged(Email.PROPERTY_HISTORY, null, history);
}
public Collection<History> getHistory() {
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-02 15:46:04 UTC (rev 25)
+++ trunk/faxtomail-ui-swing/src/main/resources/i18n/faxtomail-ui-swing_en_GB.properties 2014-04-03 14:00:27 UTC (rev 26)
@@ -132,6 +132,7 @@
faxtomail.demande.gamme.label=
faxtomail.demande.group.button.label=
faxtomail.demande.history.label=
+faxtomail.demande.lastAttachmentOpening.label=
faxtomail.demande.lastModificationDate.label=
faxtomail.demande.lastModified.label=
faxtomail.demande.lastModifiedBy.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-02 15:46:04 UTC (rev 25)
+++ trunk/faxtomail-ui-swing/src/main/resources/i18n/faxtomail-ui-swing_fr_FR.properties 2014-04-03 14:00:27 UTC (rev 26)
@@ -56,6 +56,7 @@
faxtomail.demande.fax.label=Fax
faxtomail.demande.firstOpened.label=Première ouverture
faxtomail.demande.group.button.label=Grouper
+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
faxtomail.demande.mailFolder.label=Dossier
1
0