Jaxx-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
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2010 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2009 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2008 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2007 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2006 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2005 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2004 -----
- December
- November
- October
- September
- August
February 2014
- 5 participants
- 42 discussions
See <http://ci.nuiton.org/jenkins/job/jaxx-nightly/2/changes>
Changes:
[Tony CHEMIT] fixes #3093: Release profile invoked twice when release:perform
[Tony CHEMIT] update license files
[Tony CHEMIT] refs #1463 remove SwingSession from widget-extra
[Tony CHEMIT] fixes #1463: Merge nuiton-widgets into Jaxx project (make the module available by default in plugin classp-ath + add doc)
[Tony CHEMIT] fixes #1463: Merge nuiton-widgets into Jaxx project
------------------------------------------
[...truncated 1294 lines...]
[INFO] classpath : <http://ci.nuiton.org/jenkins/job/jaxx-nightly/ws/trunk/jaxx-maven-plugin/ta…>
[INFO] includes : [**/compilerTest/cSSTests/*.jaxx]
[INFO] will parse org/nuiton/jaxx/plugin/compilerTest/cSSTests/Child2.jaxx
[INFO] will parse org/nuiton/jaxx/plugin/compilerTest/cSSTests/Pseudoclasses.jaxx
[INFO] will parse org/nuiton/jaxx/plugin/compilerTest/cSSTests/GrandChild.jaxx
[INFO] will parse org/nuiton/jaxx/plugin/compilerTest/cSSTests/GrandChildButton.jaxx
[INFO] will parse org/nuiton/jaxx/plugin/compilerTest/cSSTests/CSSTests.jaxx
[INFO] will parse org/nuiton/jaxx/plugin/compilerTest/cSSTests/SimpleCSS.jaxx
[INFO] will parse org/nuiton/jaxx/plugin/compilerTest/cSSTests/Child.jaxx
[INFO] Detects 7 modified jaxx file(s).
[INFO] Generated 7 file(s) in 303.557ms
[INFO] Detects 1 modified jaxx file(s).
[INFO] Generated 1 file(s) in 86.439ms
[INFO] Detects 1 modified jaxx file(s).
[INFO] Generated 1 file(s) in 19.216ms
[INFO] Detects 1 modified jaxx file(s).
[INFO] Generated 1 file(s) in 11.414ms
[INFO] Detects 1 modified jaxx file(s).
[INFO] Generated 1 file(s) in 13.298ms
[INFO] Nothing to generate - all files are up to date.
[INFO] Detects 1 modified jaxx file(s).
[INFO] Generated 1 file(s) in 11.087ms
[INFO] Detects 1 modified jaxx file(s).
[INFO] Generated 1 file(s) in 11.042ms
[INFO] Detects 2 modified jaxx file(s).
[INFO] Generated 2 file(s) in 17.28ms
[INFO] Detects 6 modified jaxx file(s).
[INFO] Generated 6 file(s) in 93.29ms
[INFO] Detects 1 modified jaxx file(s).
[INFO] Generated 1 file(s) in 37.69ms
[INFO] Detects 3 modified jaxx file(s).
[INFO] Generated 3 file(s) in 47.169ms
[INFO] Detects 1 modified jaxx file(s).
[INFO] Generated 1 file(s) in 44.277ms
[info] Detects 1 modified jaxx file(s).
[info] Detects 1 modified jaxx file(s).
[info] Detects 1 modified jaxx file(s).
[info] Detects 1 modified jaxx file(s).
[info] Detects 1 modified jaxx file(s).
[warn] JAXX detects 1 warning :
<http://ci.nuiton.org/jenkins/job/jaxx-nightly/ws/trunk/jaxx-maven-plugin/ta…>:27
curly braces are unnecessary for script '{System.out.println("Remember kids, only use curly braces where appropriate!")}'
[info] Detects 1 modified jaxx file(s).
[info] Detects 1 modified jaxx file(s).
[info] Detects 1 modified jaxx file(s).
[info] Detects 1 modified jaxx file(s).
[info] Detects 1 modified jaxx file(s).
[info] Detects 1 modified jaxx file(s).
[info] Detects 1 modified jaxx file(s).
[info] Detects 1 modified jaxx file(s).
[info] Detects 1 modified jaxx file(s).
[info] Detects 1 modified jaxx file(s).
[info] Detects 1 modified jaxx file(s).
[info] Detects 1 modified jaxx file(s).
[info] Detects 1 modified jaxx file(s).
[info] Detects 1 modified jaxx file(s).
[info] Detects 1 modified jaxx file(s).
[info] Detects 1 modified jaxx file(s).
[info] Detects 1 modified jaxx file(s).
[info] Detects 1 modified jaxx file(s).
[info] Detects 1 modified jaxx file(s).
[info] Detects 1 modified jaxx file(s).
[info] Detects 1 modified jaxx file(s).
[info] Detects 1 modified jaxx file(s).
[info] Detects 1 modified jaxx file(s).
[info] Detects 1 modified jaxx file(s).
[info] Detects 1 modified jaxx file(s).
[info] Detects 1 modified jaxx file(s).
[info] Detects 1 modified jaxx file(s).
[info] Detects 1 modified jaxx file(s).
Tests run: 16, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 2.386 sec - in org.nuiton.jaxx.plugin.CompilerTest
Running org.nuiton.jaxx.plugin.Bug1751Test
[INFO] Detects 3 modified jaxx file(s).
[INFO] Generated 3 file(s) in 29.074ms
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.036 sec - in org.nuiton.jaxx.plugin.Bug1751Test
Running org.nuiton.jaxx.plugin.DataBindingTest
[INFO] Detects 1 modified jaxx file(s).
[INFO] Generated 1 file(s) in 88.783ms
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.097 sec - in org.nuiton.jaxx.plugin.DataBindingTest
Results :
Tests run: 31, Failures: 0, Errors: 0, Skipped: 1
[JENKINS] Recording test results
[INFO]
[INFO] --- maven-jar-plugin:2.4:jar (default-jar) @ jaxx-maven-plugin ---
[INFO] Building jar: <http://ci.nuiton.org/jenkins/job/jaxx-nightly/ws/trunk/jaxx-maven-plugin/ta…>
[INFO]
[INFO] --- maven-plugin-plugin:3.2:addPluginArtifactMetadata (default-addPluginArtifactMetadata) @ jaxx-maven-plugin ---
[INFO]
[INFO] >>> maven-source-plugin:2.2.1:jar (attach-sources) @ jaxx-maven-plugin >>>
[INFO]
[INFO] --- maven-enforcer-plugin:1.3.1:enforce (ensure-no-container-api) @ jaxx-maven-plugin ---
[INFO]
[INFO] --- helper-maven-plugin:2.1:check-auto-container (check-central-safe) @ jaxx-maven-plugin ---
[INFO] Will use repository http://repo1.maven.org/maven2/
[INFO] Will use repository http://maven.nuiton.org/central-releases
[INFO] Skipping goal (runOnce flag is on and goal was already executed).
[INFO]
[INFO] --- maven-enforcer-plugin:1.3.1:enforce (check-project-files) @ jaxx-maven-plugin ---
[INFO]
[INFO] --- helper-maven-plugin:2.1:share-server-secret (get-redmine-login) @ jaxx-maven-plugin ---
[INFO] Skipping goal (runOnce flag is on and goal was already executed).
[INFO]
[INFO] --- maven-plugin-plugin:3.2:helpmojo (default) @ jaxx-maven-plugin ---
[INFO] Using 'UTF-8' encoding to read mojo metadata.
[INFO] Applying mojo extractor for language: java-annotations
[INFO] Mojo extractor for language: java-annotations found 6 mojo descriptors.
[INFO] Applying mojo extractor for language: java
[INFO] Mojo extractor for language: java found 0 mojo descriptors.
[INFO] Applying mojo extractor for language: bsh
[INFO] Mojo extractor for language: bsh found 0 mojo descriptors.
[WARNING] Failed to getClass for org.apache.maven.plugin.source.SourceJarMojo
[INFO]
[INFO] <<< maven-source-plugin:2.2.1:jar (attach-sources) @ jaxx-maven-plugin <<<
[INFO]
[INFO] --- maven-source-plugin:2.2.1:jar (attach-sources) @ jaxx-maven-plugin ---
[INFO] Building jar: <http://ci.nuiton.org/jenkins/job/jaxx-nightly/ws/trunk/jaxx-maven-plugin/ta…>
[INFO]
[INFO] --- maven-javadoc-plugin:2.9.1:jar (attach-javadocs) @ jaxx-maven-plugin ---
[INFO]
2 warnings
[WARNING] Javadoc Warnings
[WARNING] <http://ci.nuiton.org/jenkins/job/jaxx-nightly/ws/trunk/jaxx-maven-plugin/ta…>:30: warning - @author tag has no arguments.
[WARNING] <http://ci.nuiton.org/jenkins/job/jaxx-nightly/ws/trunk/jaxx-maven-plugin/ta…>:30: warning - @version tag has no arguments.
[INFO] Building jar: <http://ci.nuiton.org/jenkins/job/jaxx-nightly/ws/trunk/jaxx-maven-plugin/ta…>
[INFO]
[INFO] --- maven-site-plugin:3.3:attach-descriptor (attach-descriptor) @ jaxx-maven-plugin ---
[INFO]
[INFO] --- helper-maven-plugin:2.1:share-server-secret (get-pgp-passphrase) @ jaxx-maven-plugin ---
[INFO] Exporting server [gpg-signer] username in ${gpg.keyname}
[INFO] Exporting server [gpg-signer] password in ${gpg.passphrase}
[INFO]
[INFO] --- helper-maven-plugin:2.1:collect-files (collect-build-artifacts) @ jaxx-maven-plugin ---
[INFO] Loaded <http://ci.nuiton.org/jenkins/job/jaxx-nightly/ws/trunk/target/collect-artif…>
[INFO] Copying jaxx-maven-plugin-2.8.2-SNAPSHOT.jar to <http://ci.nuiton.org/jenkins/job/jaxx-nightly/ws/trunk/target/collect/org.n…>
[INFO] Copying THIRD-PARTY.properties to <http://ci.nuiton.org/jenkins/job/jaxx-nightly/ws/trunk/target/collect/org.n…>
[INFO] Copying jaxx-maven-plugin-2.8.2-SNAPSHOT-sources.jar to <http://ci.nuiton.org/jenkins/job/jaxx-nightly/ws/trunk/target/collect/org.n…>
[INFO] Copying jaxx-maven-plugin-2.8.2-SNAPSHOT-javadoc.jar to <http://ci.nuiton.org/jenkins/job/jaxx-nightly/ws/trunk/target/collect/org.n…>
[INFO]
[INFO] --- helper-maven-plugin:2.1:collect-files (collect-build-attachements) @ jaxx-maven-plugin ---
[WARNING] Skipping goal (No file to collect).
[INFO]
[INFO] --- maven-gpg-plugin:1.4:sign (sign-artifacts) @ jaxx-maven-plugin ---
[INFO]
[INFO] --- maven-dependency-plugin:2.8:analyze-only (analyze) @ jaxx-maven-plugin ---
[INFO] Used declared dependencies found:
[INFO] org.nuiton.jaxx:jaxx-runtime:jar:2.8.2-SNAPSHOT:compile
[INFO] org.nuiton.jaxx:jaxx-validator:jar:2.8.2-SNAPSHOT:compile
[INFO] org.nuiton.jaxx:jaxx-compiler:jar:2.8.2-SNAPSHOT:compile
[INFO] org.apache.maven:maven-plugin-api:jar:2.2.1:provided
[INFO] org.apache.maven:maven-project:jar:2.2.1:provided
[INFO] org.apache.maven.plugin-tools:maven-plugin-annotations:jar:3.2:provided
[INFO] org.nuiton:helper-maven-plugin-api:jar:2.1:compile
[INFO] org.nuiton:nuiton-utils:jar:3.0-rc-2:compile
[INFO] org.nuiton.i18n:nuiton-i18n:jar:3.0:compile
[INFO] commons-logging:commons-logging:jar:1.1.3:compile
[INFO] commons-io:commons-io:jar:2.4:compile
[INFO] com.google.guava:guava:jar:16.0.1:compile
[INFO] javax.help:javahelp:jar:2.0.05:compile
[INFO] org.apache.commons:commons-lang3:jar:3.2.1:compile
[INFO] junit:junit:jar:4.11:test
[INFO] org.nuiton:helper-maven-plugin-api:jar:tests:2.1:test
[INFO] org.codehaus.plexus:plexus-utils:jar:3.0.17:compile
[WARNING] Unused declared dependencies found:
[WARNING] org.nuiton.jaxx:jaxx-widgets-extra:jar:2.8.2-SNAPSHOT:compile
[JENKINS] Archiving disabled
[JENKINS] Archiving disabled
[JENKINS] Archiving disabled
[JENKINS] Archiving disabled
[JENKINS] Archiving disabled
[JENKINS] Archiving disabled
[JENKINS] Archiving disabled
[JENKINS] Archiving disabled
[JENKINS] Archiving disabled
[JENKINS] Archiving disabled
[JENKINS] Archiving disabled
[JENKINS] Archiving disabled
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO]
[INFO] JAXX .............................................. SUCCESS [ 16.000 s]
[INFO] JAXX :: Runtime ................................... SUCCESS [ 22.868 s]
[INFO] JAXX :: Validator ................................. SUCCESS [ 13.915 s]
[INFO] JAXX :: Extra Widgets ............................. SUCCESS [ 10.907 s]
[INFO] JAXX :: Compiler .................................. SUCCESS [ 15.170 s]
[INFO] JAXX :: Maven plugin .............................. FAILURE [ 16.442 s]
[INFO] JAXX :: Widgets ................................... SKIPPED
[INFO] JAXX :: Config .................................... SKIPPED
[INFO] JAXX :: Application API ........................... SKIPPED
[INFO] JAXX :: Application Swing ......................... SKIPPED
[INFO] JAXX :: Demo ...................................... SKIPPED
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 01:38 min
[INFO] Finished at: 2014-02-25T01:35:43+01:00
[INFO] Final Memory: 94M/1236M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-dependency-plugin:2.8:analyze-only (analyze) on project jaxx-maven-plugin: Dependency problems found -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-dependency-plugin:2.8:analyze-only (analyze) on project jaxx-maven-plugin: Dependency problems found
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:216)
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.MojoExecutionException: Dependency problems found
at org.apache.maven.plugin.dependency.analyze.AbstractAnalyzeMojo.execute(AbstractAnalyzeMojo.java:188)
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/MojoExecutionException
[ERROR]
[ERROR] After correcting the problems, you can resume the build with the command
[ERROR] mvn <goals> -rf :jaxx-maven-plugin
Sending e-mails to: jaxx-commits(a)list.nuiton.org chemit+nuiton-ci(a)codelutin.com
channel stopped
Skipping sonar analysis due to bad build status FAILURE
1
1
Build failed in Jenkins: jaxx-nightly » JAXX :: Maven plugin #2
by admin+ci-nuiton.org@codelutin.com 26 Feb '14
by admin+ci-nuiton.org@codelutin.com 26 Feb '14
26 Feb '14
See <http://ci.nuiton.org/jenkins/job/jaxx-nightly/org.nuiton.jaxx$jaxx-maven-pl…>
Changes:
[Tony CHEMIT] update license files
[Tony CHEMIT] fixes #1463: Merge nuiton-widgets into Jaxx project (make the module available by default in plugin classp-ath + add doc)
------------------------------------------
[...truncated 88 lines...]
[INFO] Executed tasks
[INFO]
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ jaxx-maven-plugin ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 152 resources
[INFO]
[INFO] --- maven-compiler-plugin:3.1:testCompile (default-testCompile) @ jaxx-maven-plugin ---
[INFO] Compiling 19 source files to <http://ci.nuiton.org/jenkins/job/jaxx-nightly/org.nuiton.jaxx$jaxx-maven-pl…>
[WARNING] bootstrap class path not set in conjunction with -source 1.6
[INFO]
[INFO] --- maven-surefire-plugin:2.16:test (default-test) @ jaxx-maven-plugin ---
[INFO] Surefire report directory: <http://ci.nuiton.org/jenkins/job/jaxx-nightly/org.nuiton.jaxx$jaxx-maven-pl…>
-------------------------------------------------------
T E S T S
-------------------------------------------------------
Running org.nuiton.jaxx.plugin.Bug1750Test
[INFO] Detects 1 modified jaxx file(s).
[INFO] Generated 1 file(s) in 665.808ms
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 1.186 sec - in org.nuiton.jaxx.plugin.Bug1750Test
Running org.nuiton.jaxx.plugin.I18nTest
[INFO] Detects 1 modified jaxx file(s).
[INFO] Generated 1 file(s) in 28.837ms
[INFO] Detects 1 modified jaxx file(s).
[INFO] Generated 1 file(s) in 22.246ms
[INFO] Detects 4 modified jaxx file(s).
[INFO] Generated 4 file(s) in 67.658ms
[INFO] Detects 4 modified jaxx file(s).
[INFO] Generated 4 file(s) in 49.487ms
[INFO] Detects 3 modified jaxx file(s).
[INFO] Generated 3 file(s) in 67.828ms
[INFO] Detects 3 modified jaxx file(s).
[INFO] Generated 3 file(s) in 36.463ms
Tests run: 3, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.357 sec - in org.nuiton.jaxx.plugin.I18nTest
Running org.nuiton.jaxx.plugin.Bug1124Test
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.013 sec - in org.nuiton.jaxx.plugin.Bug1124Test
Running org.nuiton.jaxx.plugin.Bug1404Test
[INFO] Detects 3 modified jaxx file(s).
[INFO] Generated 3 file(s) in 53.317ms
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.077 sec - in org.nuiton.jaxx.plugin.Bug1404Test
Running org.nuiton.jaxx.plugin.Bug184Test
[INFO] Will check encoding : UTF-8
[INFO] adding source roots : <http://ci.nuiton.org/jenkins/job/jaxx-nightly/org.nuiton.jaxx$jaxx-maven-pl…>
[INFO] classpath : <http://ci.nuiton.org/jenkins/job/jaxx-nightly/org.nuiton.jaxx$jaxx-maven-pl…>
[INFO] includes : [**/bug184Test/*.jaxx]
[INFO] will parse org/nuiton/jaxx/plugin/bug184Test/MyPanel.jaxx
[INFO] Detects 1 modified jaxx file(s).
[INFO] Generated 1 file(s) in 41.944ms
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.055 sec - in org.nuiton.jaxx.plugin.Bug184Test
Running org.nuiton.jaxx.plugin.Bug1722Test
[INFO] Detects 2 modified jaxx file(s).
[INFO] Generated 2 file(s) in 37.443ms
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.049 sec - in org.nuiton.jaxx.plugin.Bug1722Test
Running org.nuiton.jaxx.plugin.CompilerValidatorTest
Tests run: 1, Failures: 0, Errors: 0, Skipped: 1, Time elapsed: 0 sec - in org.nuiton.jaxx.plugin.CompilerValidatorTest
Running org.nuiton.jaxx.plugin.NodeItemTest
findChild
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0 sec - in org.nuiton.jaxx.plugin.NodeItemTest
Running org.nuiton.jaxx.plugin.Evolution74Test
[INFO] Detects 6 modified jaxx file(s).
[INFO] Generated 6 file(s) in 84.613ms
[info] Detects 1 modified jaxx file(s).
[info] Detects 1 modified jaxx file(s).
[info] Detects 1 modified jaxx file(s).
Tests run: 2, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.136 sec - in org.nuiton.jaxx.plugin.Evolution74Test
Running org.nuiton.jaxx.plugin.DecoratorTest
[INFO] Detects 1 modified jaxx file(s).
[INFO] Generated 1 file(s) in 15.345ms
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.026 sec - in org.nuiton.jaxx.plugin.DecoratorTest
Running org.nuiton.jaxx.plugin.CompilerTest
[info] Detects 1 modified jaxx file(s).
[INFO] Detects 1 modified jaxx file(s).
[INFO] Generated 1 file(s) in 20.999ms
[INFO] Detects 1 modified jaxx file(s).
[INFO] Generated 1 file(s) in 39.477ms
[INFO] Detects 2 modified jaxx file(s).
[INFO] Generated 2 file(s) in 25.215ms
[INFO] Detects 7 modified jaxx file(s).
[INFO] Generated 7 file(s) in 110.082ms
[INFO] Will check encoding : UTF-8
[INFO] adding source roots : <http://ci.nuiton.org/jenkins/job/jaxx-nightly/org.nuiton.jaxx$jaxx-maven-pl…>
[INFO] classpath : <http://ci.nuiton.org/jenkins/job/jaxx-nightly/org.nuiton.jaxx$jaxx-maven-pl…>
[INFO] includes : [**/compilerTest/cSSTests/*.jaxx]
[INFO] will parse org/nuiton/jaxx/plugin/compilerTest/cSSTests/Child2.jaxx
[INFO] will parse org/nuiton/jaxx/plugin/compilerTest/cSSTests/Pseudoclasses.jaxx
[INFO] will parse org/nuiton/jaxx/plugin/compilerTest/cSSTests/GrandChild.jaxx
[INFO] will parse org/nuiton/jaxx/plugin/compilerTest/cSSTests/GrandChildButton.jaxx
[INFO] will parse org/nuiton/jaxx/plugin/compilerTest/cSSTests/CSSTests.jaxx
[INFO] will parse org/nuiton/jaxx/plugin/compilerTest/cSSTests/SimpleCSS.jaxx
[INFO] will parse org/nuiton/jaxx/plugin/compilerTest/cSSTests/Child.jaxx
[INFO] Detects 7 modified jaxx file(s).
[INFO] Generated 7 file(s) in 303.557ms
[INFO] Detects 1 modified jaxx file(s).
[INFO] Generated 1 file(s) in 86.439ms
[INFO] Detects 1 modified jaxx file(s).
[INFO] Generated 1 file(s) in 19.216ms
[INFO] Detects 1 modified jaxx file(s).
[INFO] Generated 1 file(s) in 11.414ms
[INFO] Detects 1 modified jaxx file(s).
[INFO] Generated 1 file(s) in 13.298ms
[INFO] Nothing to generate - all files are up to date.
[INFO] Detects 1 modified jaxx file(s).
[INFO] Generated 1 file(s) in 11.087ms
[INFO] Detects 1 modified jaxx file(s).
[INFO] Generated 1 file(s) in 11.042ms
[INFO] Detects 2 modified jaxx file(s).
[INFO] Generated 2 file(s) in 17.28ms
[INFO] Detects 6 modified jaxx file(s).
[INFO] Generated 6 file(s) in 93.29ms
[INFO] Detects 1 modified jaxx file(s).
[INFO] Generated 1 file(s) in 37.69ms
[INFO] Detects 3 modified jaxx file(s).
[INFO] Generated 3 file(s) in 47.169ms
[INFO] Detects 1 modified jaxx file(s).
[INFO] Generated 1 file(s) in 44.277ms
[info] Detects 1 modified jaxx file(s).
[info] Detects 1 modified jaxx file(s).
[info] Detects 1 modified jaxx file(s).
[info] Detects 1 modified jaxx file(s).
[info] Detects 1 modified jaxx file(s).
[warn] JAXX detects 1 warning :
<http://ci.nuiton.org/jenkins/job/jaxx-nightly/org.nuiton.jaxx$jaxx-maven-pl…>:27
curly braces are unnecessary for script '{System.out.println("Remember kids, only use curly braces where appropriate!")}'
[info] Detects 1 modified jaxx file(s).
[info] Detects 1 modified jaxx file(s).
[info] Detects 1 modified jaxx file(s).
[info] Detects 1 modified jaxx file(s).
[info] Detects 1 modified jaxx file(s).
[info] Detects 1 modified jaxx file(s).
[info] Detects 1 modified jaxx file(s).
[info] Detects 1 modified jaxx file(s).
[info] Detects 1 modified jaxx file(s).
[info] Detects 1 modified jaxx file(s).
[info] Detects 1 modified jaxx file(s).
[info] Detects 1 modified jaxx file(s).
[info] Detects 1 modified jaxx file(s).
[info] Detects 1 modified jaxx file(s).
[info] Detects 1 modified jaxx file(s).
[info] Detects 1 modified jaxx file(s).
[info] Detects 1 modified jaxx file(s).
[info] Detects 1 modified jaxx file(s).
[info] Detects 1 modified jaxx file(s).
[info] Detects 1 modified jaxx file(s).
[info] Detects 1 modified jaxx file(s).
[info] Detects 1 modified jaxx file(s).
[info] Detects 1 modified jaxx file(s).
[info] Detects 1 modified jaxx file(s).
[info] Detects 1 modified jaxx file(s).
[info] Detects 1 modified jaxx file(s).
[info] Detects 1 modified jaxx file(s).
[info] Detects 1 modified jaxx file(s).
Tests run: 16, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 2.386 sec - in org.nuiton.jaxx.plugin.CompilerTest
Running org.nuiton.jaxx.plugin.Bug1751Test
[INFO] Detects 3 modified jaxx file(s).
[INFO] Generated 3 file(s) in 29.074ms
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.036 sec - in org.nuiton.jaxx.plugin.Bug1751Test
Running org.nuiton.jaxx.plugin.DataBindingTest
[INFO] Detects 1 modified jaxx file(s).
[INFO] Generated 1 file(s) in 88.783ms
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.097 sec - in org.nuiton.jaxx.plugin.DataBindingTest
Results :
Tests run: 31, Failures: 0, Errors: 0, Skipped: 1
[JENKINS] Recording test results
[INFO]
[INFO] --- maven-jar-plugin:2.4:jar (default-jar) @ jaxx-maven-plugin ---
[INFO] Building jar: <http://ci.nuiton.org/jenkins/job/jaxx-nightly/org.nuiton.jaxx$jaxx-maven-pl…>
[INFO]
[INFO] --- maven-plugin-plugin:3.2:addPluginArtifactMetadata (default-addPluginArtifactMetadata) @ jaxx-maven-plugin ---
[INFO]
[INFO] >>> maven-source-plugin:2.2.1:jar (attach-sources) @ jaxx-maven-plugin >>>
[INFO]
[INFO] --- maven-enforcer-plugin:1.3.1:enforce (ensure-no-container-api) @ jaxx-maven-plugin ---
[INFO]
[INFO] --- helper-maven-plugin:2.1:check-auto-container (check-central-safe) @ jaxx-maven-plugin ---
[INFO] Will use repository http://repo1.maven.org/maven2/
[INFO] Will use repository http://maven.nuiton.org/central-releases
[INFO] Skipping goal (runOnce flag is on and goal was already executed).
[INFO]
[INFO] --- maven-enforcer-plugin:1.3.1:enforce (check-project-files) @ jaxx-maven-plugin ---
[INFO]
[INFO] --- helper-maven-plugin:2.1:share-server-secret (get-redmine-login) @ jaxx-maven-plugin ---
[INFO] Skipping goal (runOnce flag is on and goal was already executed).
[INFO]
[INFO] --- maven-plugin-plugin:3.2:helpmojo (default) @ jaxx-maven-plugin ---
[INFO] Using 'UTF-8' encoding to read mojo metadata.
[INFO] Applying mojo extractor for language: java-annotations
[INFO] Mojo extractor for language: java-annotations found 6 mojo descriptors.
[INFO] Applying mojo extractor for language: java
[INFO] Mojo extractor for language: java found 0 mojo descriptors.
[INFO] Applying mojo extractor for language: bsh
[INFO] Mojo extractor for language: bsh found 0 mojo descriptors.
[WARNING] Failed to getClass for org.apache.maven.plugin.source.SourceJarMojo
[INFO]
[INFO] <<< maven-source-plugin:2.2.1:jar (attach-sources) @ jaxx-maven-plugin <<<
[INFO]
[INFO] --- maven-source-plugin:2.2.1:jar (attach-sources) @ jaxx-maven-plugin ---
[INFO] Building jar: <http://ci.nuiton.org/jenkins/job/jaxx-nightly/org.nuiton.jaxx$jaxx-maven-pl…>
[INFO]
[INFO] --- maven-javadoc-plugin:2.9.1:jar (attach-javadocs) @ jaxx-maven-plugin ---
[INFO]
2 warnings
[WARNING] Javadoc Warnings
[WARNING] <http://ci.nuiton.org/jenkins/job/jaxx-nightly/org.nuiton.jaxx$jaxx-maven-pl…>:30: warning - @author tag has no arguments.
[WARNING] <http://ci.nuiton.org/jenkins/job/jaxx-nightly/org.nuiton.jaxx$jaxx-maven-pl…>:30: warning - @version tag has no arguments.
[INFO] Building jar: <http://ci.nuiton.org/jenkins/job/jaxx-nightly/org.nuiton.jaxx$jaxx-maven-pl…>
[INFO]
[INFO] --- maven-site-plugin:3.3:attach-descriptor (attach-descriptor) @ jaxx-maven-plugin ---
[INFO]
[INFO] --- helper-maven-plugin:2.1:share-server-secret (get-pgp-passphrase) @ jaxx-maven-plugin ---
[INFO] Exporting server [gpg-signer] username in ${gpg.keyname}
[INFO] Exporting server [gpg-signer] password in ${gpg.passphrase}
[INFO]
[INFO] --- helper-maven-plugin:2.1:collect-files (collect-build-artifacts) @ jaxx-maven-plugin ---
[INFO] Loaded /var/local/forge/data/nuiton.org/jenkins/workspace/jaxx-nightly/trunk/target/collect-artifacts.txt
[INFO] Copying jaxx-maven-plugin-2.8.2-SNAPSHOT.jar to /var/local/forge/data/nuiton.org/jenkins/workspace/jaxx-nightly/trunk/target/collect/org.nuiton.jaxx--jaxx-maven-plugin/jaxx-maven-plugin-2.8.2-SNAPSHOT.jar
[INFO] Copying THIRD-PARTY.properties to /var/local/forge/data/nuiton.org/jenkins/workspace/jaxx-nightly/trunk/target/collect/org.nuiton.jaxx--jaxx-maven-plugin/THIRD-PARTY.properties
[INFO] Copying jaxx-maven-plugin-2.8.2-SNAPSHOT-sources.jar to /var/local/forge/data/nuiton.org/jenkins/workspace/jaxx-nightly/trunk/target/collect/org.nuiton.jaxx--jaxx-maven-plugin/jaxx-maven-plugin-2.8.2-SNAPSHOT-sources.jar
[INFO] Copying jaxx-maven-plugin-2.8.2-SNAPSHOT-javadoc.jar to /var/local/forge/data/nuiton.org/jenkins/workspace/jaxx-nightly/trunk/target/collect/org.nuiton.jaxx--jaxx-maven-plugin/jaxx-maven-plugin-2.8.2-SNAPSHOT-javadoc.jar
[INFO]
[INFO] --- helper-maven-plugin:2.1:collect-files (collect-build-attachements) @ jaxx-maven-plugin ---
[WARNING] Skipping goal (No file to collect).
[INFO]
[INFO] --- maven-gpg-plugin:1.4:sign (sign-artifacts) @ jaxx-maven-plugin ---
[INFO]
[INFO] --- maven-dependency-plugin:2.8:analyze-only (analyze) @ jaxx-maven-plugin ---
[INFO] Used declared dependencies found:
[INFO] org.nuiton.jaxx:jaxx-runtime:jar:2.8.2-SNAPSHOT:compile
[INFO] org.nuiton.jaxx:jaxx-validator:jar:2.8.2-SNAPSHOT:compile
[INFO] org.nuiton.jaxx:jaxx-compiler:jar:2.8.2-SNAPSHOT:compile
[INFO] org.apache.maven:maven-plugin-api:jar:2.2.1:provided
[INFO] org.apache.maven:maven-project:jar:2.2.1:provided
[INFO] org.apache.maven.plugin-tools:maven-plugin-annotations:jar:3.2:provided
[INFO] org.nuiton:helper-maven-plugin-api:jar:2.1:compile
[INFO] org.nuiton:nuiton-utils:jar:3.0-rc-2:compile
[INFO] org.nuiton.i18n:nuiton-i18n:jar:3.0:compile
[INFO] commons-logging:commons-logging:jar:1.1.3:compile
[INFO] commons-io:commons-io:jar:2.4:compile
[INFO] com.google.guava:guava:jar:16.0.1:compile
[INFO] javax.help:javahelp:jar:2.0.05:compile
[INFO] org.apache.commons:commons-lang3:jar:3.2.1:compile
[INFO] junit:junit:jar:4.11:test
[INFO] org.nuiton:helper-maven-plugin-api:jar:tests:2.1:test
[INFO] org.codehaus.plexus:plexus-utils:jar:3.0.17:compile
[WARNING] Unused declared dependencies found:
[WARNING] org.nuiton.jaxx:jaxx-widgets-extra:jar:2.8.2-SNAPSHOT:compile
[JENKINS] Archiving disabled
1
1
Author: tchemit
Date: 2014-02-25 16:04:31 +0100 (Tue, 25 Feb 2014)
New Revision: 2806
Url: http://nuiton.org/projects/jaxx/repository/revisions/2806
Log:
fixes #3095: updates mavenpom to 5.0
Modified:
trunk/pom.xml
Modified: trunk/pom.xml
===================================================================
--- trunk/pom.xml 2014-02-25 08:41:51 UTC (rev 2805)
+++ trunk/pom.xml 2014-02-25 15:04:31 UTC (rev 2806)
@@ -30,7 +30,7 @@
<parent>
<groupId>org.nuiton</groupId>
<artifactId>mavenpom4redmineAndCentral</artifactId>
- <version>4.7</version>
+ <version>5.0</version>
</parent>
<artifactId>jaxx</artifactId>
@@ -154,7 +154,7 @@
<distributionManagement>
<site>
- <id>${platform}</id>
+ <id>doc.${platform}</id>
<url>${our.site.repository}/${projectId}</url>
</site>
</distributionManagement>
1
0
Author: tchemit
Date: 2014-02-25 09:41:51 +0100 (Tue, 25 Feb 2014)
New Revision: 2805
Url: http://nuiton.org/projects/jaxx/repository/revisions/2805
Log:
optimize dependencies
Modified:
trunk/jaxx-maven-plugin/pom.xml
Modified: trunk/jaxx-maven-plugin/pom.xml
===================================================================
--- trunk/jaxx-maven-plugin/pom.xml 2014-02-24 15:32:39 UTC (rev 2804)
+++ trunk/jaxx-maven-plugin/pom.xml 2014-02-25 08:41:51 UTC (rev 2805)
@@ -58,6 +58,7 @@
<groupId>${project.groupId}</groupId>
<artifactId>jaxx-widgets-extra</artifactId>
<version>${project.version}</version>
+ <scope>runtime</scope>
</dependency>
<dependency>
1
0
Author: tchemit
Date: 2014-02-24 16:32:39 +0100 (Mon, 24 Feb 2014)
New Revision: 2804
Url: http://nuiton.org/projects/jaxx/repository/revisions/2804
Log:
fixes #3093: Release profile invoked twice when release:perform
Modified:
trunk/jaxx-application-swing/pom.xml
Modified: trunk/jaxx-application-swing/pom.xml
===================================================================
--- trunk/jaxx-application-swing/pom.xml 2014-02-24 15:02:09 UTC (rev 2803)
+++ trunk/jaxx-application-swing/pom.xml 2014-02-24 15:32:39 UTC (rev 2804)
@@ -49,9 +49,6 @@
<jaxx.autoRecurseInCss>false</jaxx.autoRecurseInCss>
<jaxx.addAutoHandlerUI>true</jaxx.addAutoHandlerUI>
- <!-- Post Release configuration -->
- <skipPostRelease>false</skipPostRelease>
-
</properties>
<dependencies>
1
0
r2803 - in trunk: . jaxx-application-api jaxx-application-swing jaxx-compiler jaxx-config jaxx-maven-plugin jaxx-maven-plugin/src/license jaxx-runtime jaxx-validator jaxx-widgets jaxx-widgets-extra
by tchemit@users.nuiton.org 24 Feb '14
by tchemit@users.nuiton.org 24 Feb '14
24 Feb '14
Author: tchemit
Date: 2014-02-24 16:02:09 +0100 (Mon, 24 Feb 2014)
New Revision: 2803
Url: http://nuiton.org/projects/jaxx/repository/revisions/2803
Log:
update license files
Modified:
trunk/LICENSE.txt
trunk/jaxx-application-api/LICENSE.txt
trunk/jaxx-application-swing/LICENSE.txt
trunk/jaxx-compiler/LICENSE.txt
trunk/jaxx-config/LICENSE.txt
trunk/jaxx-maven-plugin/LICENSE.txt
trunk/jaxx-maven-plugin/src/license/THIRD-PARTY.properties
trunk/jaxx-runtime/LICENSE.txt
trunk/jaxx-validator/LICENSE.txt
trunk/jaxx-widgets-extra/LICENSE.txt
trunk/jaxx-widgets/LICENSE.txt
Modified: trunk/LICENSE.txt
===================================================================
--- trunk/LICENSE.txt 2014-02-24 14:55:51 UTC (rev 2802)
+++ trunk/LICENSE.txt 2014-02-24 15:02:09 UTC (rev 2803)
@@ -10,7 +10,7 @@
the terms and conditions of version 3 of the GNU General Public
License, supplemented by the additional permissions listed below.
- 0. Additional Definitions.
+ 0. Additional Definitions.
As used herein, "this License" refers to version 3 of the GNU Lesser
General Public License, and the "GNU GPL" refers to version 3 of the GNU
@@ -111,7 +111,7 @@
a copy of the Library already present on the user's computer
system, and (b) will operate properly with a modified version
of the Library that is interface-compatible with the Linked
- Version.
+ Version.
e) Provide Installation Information, but only if you would otherwise
be required to provide such information under section 6 of the
@@ -163,4 +163,3 @@
apply, that proxy's public statement of acceptance of any version is
permanent authorization for you to choose that version for the
Library.
-
Modified: trunk/jaxx-application-api/LICENSE.txt
===================================================================
--- trunk/jaxx-application-api/LICENSE.txt 2014-02-24 14:55:51 UTC (rev 2802)
+++ trunk/jaxx-application-api/LICENSE.txt 2014-02-24 15:02:09 UTC (rev 2803)
@@ -10,7 +10,7 @@
the terms and conditions of version 3 of the GNU General Public
License, supplemented by the additional permissions listed below.
- 0. Additional Definitions.
+ 0. Additional Definitions.
As used herein, "this License" refers to version 3 of the GNU Lesser
General Public License, and the "GNU GPL" refers to version 3 of the GNU
@@ -111,7 +111,7 @@
a copy of the Library already present on the user's computer
system, and (b) will operate properly with a modified version
of the Library that is interface-compatible with the Linked
- Version.
+ Version.
e) Provide Installation Information, but only if you would otherwise
be required to provide such information under section 6 of the
@@ -163,4 +163,3 @@
apply, that proxy's public statement of acceptance of any version is
permanent authorization for you to choose that version for the
Library.
-
Modified: trunk/jaxx-application-swing/LICENSE.txt
===================================================================
--- trunk/jaxx-application-swing/LICENSE.txt 2014-02-24 14:55:51 UTC (rev 2802)
+++ trunk/jaxx-application-swing/LICENSE.txt 2014-02-24 15:02:09 UTC (rev 2803)
@@ -10,7 +10,7 @@
the terms and conditions of version 3 of the GNU General Public
License, supplemented by the additional permissions listed below.
- 0. Additional Definitions.
+ 0. Additional Definitions.
As used herein, "this License" refers to version 3 of the GNU Lesser
General Public License, and the "GNU GPL" refers to version 3 of the GNU
@@ -111,7 +111,7 @@
a copy of the Library already present on the user's computer
system, and (b) will operate properly with a modified version
of the Library that is interface-compatible with the Linked
- Version.
+ Version.
e) Provide Installation Information, but only if you would otherwise
be required to provide such information under section 6 of the
@@ -163,4 +163,3 @@
apply, that proxy's public statement of acceptance of any version is
permanent authorization for you to choose that version for the
Library.
-
Modified: trunk/jaxx-compiler/LICENSE.txt
===================================================================
--- trunk/jaxx-compiler/LICENSE.txt 2014-02-24 14:55:51 UTC (rev 2802)
+++ trunk/jaxx-compiler/LICENSE.txt 2014-02-24 15:02:09 UTC (rev 2803)
@@ -10,7 +10,7 @@
the terms and conditions of version 3 of the GNU General Public
License, supplemented by the additional permissions listed below.
- 0. Additional Definitions.
+ 0. Additional Definitions.
As used herein, "this License" refers to version 3 of the GNU Lesser
General Public License, and the "GNU GPL" refers to version 3 of the GNU
@@ -111,7 +111,7 @@
a copy of the Library already present on the user's computer
system, and (b) will operate properly with a modified version
of the Library that is interface-compatible with the Linked
- Version.
+ Version.
e) Provide Installation Information, but only if you would otherwise
be required to provide such information under section 6 of the
@@ -163,4 +163,3 @@
apply, that proxy's public statement of acceptance of any version is
permanent authorization for you to choose that version for the
Library.
-
Modified: trunk/jaxx-config/LICENSE.txt
===================================================================
--- trunk/jaxx-config/LICENSE.txt 2014-02-24 14:55:51 UTC (rev 2802)
+++ trunk/jaxx-config/LICENSE.txt 2014-02-24 15:02:09 UTC (rev 2803)
@@ -10,7 +10,7 @@
the terms and conditions of version 3 of the GNU General Public
License, supplemented by the additional permissions listed below.
- 0. Additional Definitions.
+ 0. Additional Definitions.
As used herein, "this License" refers to version 3 of the GNU Lesser
General Public License, and the "GNU GPL" refers to version 3 of the GNU
@@ -111,7 +111,7 @@
a copy of the Library already present on the user's computer
system, and (b) will operate properly with a modified version
of the Library that is interface-compatible with the Linked
- Version.
+ Version.
e) Provide Installation Information, but only if you would otherwise
be required to provide such information under section 6 of the
@@ -163,4 +163,3 @@
apply, that proxy's public statement of acceptance of any version is
permanent authorization for you to choose that version for the
Library.
-
Modified: trunk/jaxx-maven-plugin/LICENSE.txt
===================================================================
--- trunk/jaxx-maven-plugin/LICENSE.txt 2014-02-24 14:55:51 UTC (rev 2802)
+++ trunk/jaxx-maven-plugin/LICENSE.txt 2014-02-24 15:02:09 UTC (rev 2803)
@@ -10,7 +10,7 @@
the terms and conditions of version 3 of the GNU General Public
License, supplemented by the additional permissions listed below.
- 0. Additional Definitions.
+ 0. Additional Definitions.
As used herein, "this License" refers to version 3 of the GNU Lesser
General Public License, and the "GNU GPL" refers to version 3 of the GNU
@@ -111,7 +111,7 @@
a copy of the Library already present on the user's computer
system, and (b) will operate properly with a modified version
of the Library that is interface-compatible with the Linked
- Version.
+ Version.
e) Provide Installation Information, but only if you would otherwise
be required to provide such information under section 6 of the
@@ -163,4 +163,3 @@
apply, that proxy's public statement of acceptance of any version is
permanent authorization for you to choose that version for the
Library.
-
Modified: trunk/jaxx-maven-plugin/src/license/THIRD-PARTY.properties
===================================================================
--- trunk/jaxx-maven-plugin/src/license/THIRD-PARTY.properties 2014-02-24 14:55:51 UTC (rev 2802)
+++ trunk/jaxx-maven-plugin/src/license/THIRD-PARTY.properties 2014-02-24 15:02:09 UTC (rev 2803)
@@ -6,6 +6,7 @@
# - BSD License
# - COMMON DEVELOPMENT AND DISTRIBUTION LICENSE (CDDL) Version 1.0
# - Common Public License Version 1.0
+# - GNU GENERAL PUBLIC LICENSE version 2 or higher
# - GNU General Public License - Version 2 with the class path exception
# - Indiana University Extreme! Lab Software License, vesion 1.1.1
# - Lesser General Public License (LGPL)
@@ -13,6 +14,7 @@
# - Lesser General Public License (LPGL)
# - Lesser General Public License (LPGL) v 2.1
# - MIT License
+# - Modified BSD License
# - New BSD License
# - Public Domain
# - The Apache Software License, Version 2.0
@@ -21,13 +23,14 @@
# Please fill the missing licenses for dependencies :
#
#
-#Fri Aug 23 15:15:13 CEST 2013
+#Mon Feb 24 15:57:57 CET 2014
classworlds--classworlds--1.1-alpha-2=http\://classworlds.codehaus.org/lice…
commons-primitives--commons-primitives--1.0=The Apache Software License, Version 2.0
javassist--javassist--3.11.0.GA=The Apache Software License, Version 2.0
nekohtml--xercesMinimal--1.9.6.2=The Apache Software License, Version 2.0
org.codehaus.plexus--plexus-container-default--1.0-alpha-9-stable-1=The Apache Software License, Version 2.0
org.codehaus.plexus--plexus-interactivity-api--1.0-alpha-4=The Apache Software License, Version 2.0
+org.nuiton.thirdparty--sdoc--0.5.0-beta-patchcl=Lesser General Public License (LGPL) v 3.0
org.slf4j--jcl-over-slf4j--1.5.6=MIT license
org.slf4j--slf4j-api--1.5.6=MIT license
org.slf4j--slf4j-jdk14--1.5.6=MIT license
Modified: trunk/jaxx-runtime/LICENSE.txt
===================================================================
--- trunk/jaxx-runtime/LICENSE.txt 2014-02-24 14:55:51 UTC (rev 2802)
+++ trunk/jaxx-runtime/LICENSE.txt 2014-02-24 15:02:09 UTC (rev 2803)
@@ -10,7 +10,7 @@
the terms and conditions of version 3 of the GNU General Public
License, supplemented by the additional permissions listed below.
- 0. Additional Definitions.
+ 0. Additional Definitions.
As used herein, "this License" refers to version 3 of the GNU Lesser
General Public License, and the "GNU GPL" refers to version 3 of the GNU
@@ -111,7 +111,7 @@
a copy of the Library already present on the user's computer
system, and (b) will operate properly with a modified version
of the Library that is interface-compatible with the Linked
- Version.
+ Version.
e) Provide Installation Information, but only if you would otherwise
be required to provide such information under section 6 of the
@@ -163,4 +163,3 @@
apply, that proxy's public statement of acceptance of any version is
permanent authorization for you to choose that version for the
Library.
-
Modified: trunk/jaxx-validator/LICENSE.txt
===================================================================
--- trunk/jaxx-validator/LICENSE.txt 2014-02-24 14:55:51 UTC (rev 2802)
+++ trunk/jaxx-validator/LICENSE.txt 2014-02-24 15:02:09 UTC (rev 2803)
@@ -10,7 +10,7 @@
the terms and conditions of version 3 of the GNU General Public
License, supplemented by the additional permissions listed below.
- 0. Additional Definitions.
+ 0. Additional Definitions.
As used herein, "this License" refers to version 3 of the GNU Lesser
General Public License, and the "GNU GPL" refers to version 3 of the GNU
@@ -111,7 +111,7 @@
a copy of the Library already present on the user's computer
system, and (b) will operate properly with a modified version
of the Library that is interface-compatible with the Linked
- Version.
+ Version.
e) Provide Installation Information, but only if you would otherwise
be required to provide such information under section 6 of the
@@ -163,4 +163,3 @@
apply, that proxy's public statement of acceptance of any version is
permanent authorization for you to choose that version for the
Library.
-
Modified: trunk/jaxx-widgets/LICENSE.txt
===================================================================
--- trunk/jaxx-widgets/LICENSE.txt 2014-02-24 14:55:51 UTC (rev 2802)
+++ trunk/jaxx-widgets/LICENSE.txt 2014-02-24 15:02:09 UTC (rev 2803)
@@ -10,7 +10,7 @@
the terms and conditions of version 3 of the GNU General Public
License, supplemented by the additional permissions listed below.
- 0. Additional Definitions.
+ 0. Additional Definitions.
As used herein, "this License" refers to version 3 of the GNU Lesser
General Public License, and the "GNU GPL" refers to version 3 of the GNU
@@ -111,7 +111,7 @@
a copy of the Library already present on the user's computer
system, and (b) will operate properly with a modified version
of the Library that is interface-compatible with the Linked
- Version.
+ Version.
e) Provide Installation Information, but only if you would otherwise
be required to provide such information under section 6 of the
@@ -163,4 +163,3 @@
apply, that proxy's public statement of acceptance of any version is
permanent authorization for you to choose that version for the
Library.
-
Modified: trunk/jaxx-widgets-extra/LICENSE.txt
===================================================================
--- trunk/jaxx-widgets-extra/LICENSE.txt 2014-02-24 14:55:51 UTC (rev 2802)
+++ trunk/jaxx-widgets-extra/LICENSE.txt 2014-02-24 15:02:09 UTC (rev 2803)
@@ -10,7 +10,7 @@
the terms and conditions of version 3 of the GNU General Public
License, supplemented by the additional permissions listed below.
- 0. Additional Definitions.
+ 0. Additional Definitions.
As used herein, "this License" refers to version 3 of the GNU Lesser
General Public License, and the "GNU GPL" refers to version 3 of the GNU
@@ -111,7 +111,7 @@
a copy of the Library already present on the user's computer
system, and (b) will operate properly with a modified version
of the Library that is interface-compatible with the Linked
- Version.
+ Version.
e) Provide Installation Information, but only if you would otherwise
be required to provide such information under section 6 of the
@@ -163,4 +163,3 @@
apply, that proxy's public statement of acceptance of any version is
permanent authorization for you to choose that version for the
Library.
-
1
0
r2802 - trunk/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra
by tchemit@users.nuiton.org 24 Feb '14
by tchemit@users.nuiton.org 24 Feb '14
24 Feb '14
Author: tchemit
Date: 2014-02-24 15:55:51 +0100 (Mon, 24 Feb 2014)
New Revision: 2802
Url: http://nuiton.org/projects/jaxx/repository/revisions/2802
Log:
refs #1463 remove SwingSession from widget-extra
Removed:
trunk/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/SwingSession.java
Deleted: trunk/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/SwingSession.java
===================================================================
--- trunk/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/SwingSession.java 2014-02-24 14:38:02 UTC (rev 2801)
+++ trunk/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/SwingSession.java 2014-02-24 14:55:51 UTC (rev 2802)
@@ -1,804 +0,0 @@
-/*
- * #%L
- * JAXX :: Extra Widgets
- * %%
- * Copyright (C) 2004 - 2010 CodeLutin
- * %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Lesser Public License for more details.
- *
- * You should have received a copy of the GNU General Lesser Public
- * License along with this program. If not, see
- * <http://www.gnu.org/licenses/lgpl-3.0.html>.
- * #L%
- */
-package org.nuiton.jaxx.widgets.extra;
-
-
-import java.awt.BorderLayout;
-import java.awt.Component;
-import java.awt.Container;
-import java.awt.Dialog;
-import java.awt.Frame;
-import java.awt.GraphicsConfiguration;
-import java.awt.GraphicsDevice;
-import java.awt.GraphicsEnvironment;
-import java.awt.Rectangle;
-import java.awt.Window;
-import java.awt.event.ActionEvent;
-import java.awt.event.ActionListener;
-import java.beans.DefaultPersistenceDelegate;
-import java.beans.Encoder;
-import java.beans.ExceptionListener;
-import java.beans.Expression;
-import java.beans.XMLDecoder;
-import java.beans.XMLEncoder;
-import java.io.ByteArrayOutputStream;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.LinkedHashSet;
-import java.util.Map;
-import javax.swing.JButton;
-import javax.swing.JFrame;
-import javax.swing.JScrollPane;
-import javax.swing.JSplitPane;
-import javax.swing.JTabbedPane;
-import javax.swing.JTable;
-import javax.swing.JTextArea;
-import javax.swing.table.AbstractTableModel;
-import javax.swing.table.TableColumn;
-import javax.swing.table.TableModel;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-/**
- * Use to store and restore position and size of application. Supported widgets
- * are:
- * <li> java.awt.Window (and subclasses)
- * <li> javax.swing.JTabbedPane (and subclasses)
- * <li> javax.swing.JSplitPane (and subclasses)
- * <li> javax.swing.JTable (and subclasses)
- *
- * usage:
- * <li> create SwingSession object
- * <li> add component that you want save
- * <li> explicite call to save
- *
- * You can use same SwingSession for multiple window but in this case you must
- * have setName for each window with different name, otherwize there are
- * collision between window component and result is undetermisitic
- *
- * This code is partialy inspired from http://kenai.com/projects/bsaf/pages/Home
- * project. This project is under LGPL v2.1 license. We can't reuse directly this
- * library because to many fields and methods are private and we can't implements
- * it and modify some behavior.
- *
- * @author poussin
- * @version $Revision$
- *
- * Last update: $Date$
- * by : $Author$
- */
-public class SwingSession {
-
- /** to use log facility, just put in your code: log.info(\"...\"); */
- static private Log log = LogFactory.getLog(SwingSession.class);
-
- protected File file;
- protected boolean autoSave;
- protected LinkedHashSet<Component> registeredComponent =
- new LinkedHashSet<Component>();
- /** State object registered to get and set State.
- * key: class of component managed by the state; value: the state*/
- protected Map<Class, State> stateManager = new HashMap<Class, State>();
- /** state of all component added with add method.
- * key: path of compoenent; value: State */
- protected Map<String, State> states;
-
- public SwingSession(File file, boolean autoSave) {
- this.file = file;
- this.autoSave = autoSave;
- stateManager.put(Window.class, new WindowState());
- stateManager.put(JTable.class, new JTableState());
- stateManager.put(JTabbedPane.class, new JTabbedPaneState());
- stateManager.put(JSplitPane.class, new JSplitPaneState());
-
- states = loadStates(file);
- if (states == null) {
- states = new HashMap<String, State>();
- }
- }
-
- @Override
- protected void finalize() throws Throwable {
- save();
- super.finalize();
- }
-
-
- /* If an exception occurs in the XMLEncoder/Decoder, we want
- * to throw an IOException. The exceptionThrow listener method
- * doesn't throw a checked exception so we just set a flag
- * here and check it when the encode/decode operation finishes
- */
- private static class AbortExceptionListener implements ExceptionListener {
-
- public Exception exception = null;
-
- @Override
- public void exceptionThrown(Exception e) {
- if (exception == null) {
- exception = e;
- }
- }
- }
-
- /* There are some (old) Java classes that aren't proper beans. Rectangle
- * is one of these. When running within the secure sandbox, writing a
- * Rectangle with XMLEncoder causes a security exception because
- * DefaultPersistenceDelegate calls Field.setAccessible(true) to gain
- * access to private fields. This is a workaround for that problem.
- * A bug has been filed, see JDK bug ID 4741757
- */
- private static class RectanglePD extends DefaultPersistenceDelegate {
-
- public RectanglePD() {
- super(new String[]{"x", "y", "width", "height"});
- }
-
- @Override
- protected Expression instantiate(Object oldInstance, Encoder out) {
- Rectangle oldR = (Rectangle) oldInstance;
- Object[] constructorArgs = new Object[]{
- oldR.x, oldR.y, oldR.width, oldR.height
- };
- return new Expression(oldInstance, oldInstance.getClass(), "new", constructorArgs);
- }
- }
-
- public void save() {
- updateState();
- AbortExceptionListener el = new AbortExceptionListener();
- ByteArrayOutputStream bst = new ByteArrayOutputStream();
- XMLEncoder e = null;
- /* Buffer the XMLEncoder's output so that decoding errors don't
- * cause us to trash the current version of the specified file.
- */
- try {
- e = new XMLEncoder(bst);
- e.setPersistenceDelegate(Rectangle.class, new RectanglePD());
- e.setExceptionListener(el);
- e.writeObject(states);
- } finally {
- if (e != null) {
- e.close();
- }
- }
- if (el.exception != null) {
- log.warn("save failed \"" + file + "\"", el.exception);
- } else {
- OutputStream ost = null;
- try {
- ost = new FileOutputStream(file);
- ost.write(bst.toByteArray());
- } catch (IOException eee) {
- log.warn("save failed \"" + file + "\"", eee);
- } finally {
- if (ost != null) {
- try {
- ost.close();
- } catch (IOException eee) {
- log.warn("can't close properly \"" + file + "\"", eee);
- }
- }
- }
- }
- }
-
- /**
- * Loads the states from the file
- */
- public Map<String, State> loadStates(File file) {
- Map<String, State> result = null;
- if (file.exists()) {
- XMLDecoder d = null;
- try {
- InputStream ist = new FileInputStream(file);
- d = new XMLDecoder(ist);
- AbortExceptionListener eee = new AbortExceptionListener();
- d.setExceptionListener(eee);
- Object bean = d.readObject();
- if (eee.exception != null) {
- log.warn("load failed \"" + file + "\"", eee.exception);
- } else {
- result = (Map<String, State>) bean;
- }
- } catch (IOException eee) {
- log.warn("load failed \"" + file + "\"", eee);
- } finally {
- if (d != null) {
- d.close();
- }
- }
- }
- return result;
- }
-
- public void updateState() {
- walkThrowComponent("", registeredComponent,
- new SaveStateAction());
- }
-
- public void add(Component c) {
- if (registeredComponent.contains(c)) {
- log.warn(String.format(
- "Component already added %s(%s)", c.getClass(), c.getName()));
- } else {
- registeredComponent.add(c);
- walkThrowComponent("", Collections.singleton(c),
- new RestoreStateAction());
- }
- }
-
- /**
- * Remove component from component to save
- * @param c
- */
- public void remove(Component c) {
- registeredComponent.remove(c);
- }
-
- protected String getComponentName(Component c) {
- String name = c.getName();
- if (name == null) {
- int n = c.getParent().getComponentZOrder(c);
- if (n >= 0) {
- Class clazz = c.getClass();
- name = clazz.getSimpleName();
- if (name.length() == 0) {
- name = "Anonymous" + clazz.getSuperclass().getSimpleName();
- }
- name = name + n;
- } else {
- // Implies that the component tree is changing
- // while we're computing the path. Punt.
- log.warn("Couldn't compute pathname for " + c);
- }
- }
- return name;
- }
-
- public State getStateManager(Class clazz) {
- State result = null;
- while (result == null && clazz != null) {
- result = stateManager.get(clazz);
- clazz = clazz.getSuperclass();
- }
- return result;
- }
-
- public State getStates(String path) {
- return states.get(path);
- }
-
- public void setStates(String path, State state) {
- this.states.put(path, state);
- }
-
- protected void walkThrowComponent(
- String path, Collection<Component> roots, Action action) {
- for (Component root : roots) {
- if (root != null) {
- String pathname = path + "/" + getComponentName(root);
- State state = getStateManager(root.getClass());
- if (state != null) {
- action.doAction(this, pathname, root);
- }
- if (root instanceof Container) {
- Component[] children = ((Container) root).getComponents();
- if ((children != null) && (children.length > 0)) {
- walkThrowComponent(pathname, Arrays.asList(children), action);
- }
- }
- if (root instanceof JFrame) {
- Component[] children = ((JFrame) root).getContentPane().getComponents();
- if ((children != null) && (children.length > 0)) {
- walkThrowComponent(pathname, Arrays.asList(children), action);
- }
- }
- }
- }
- }
-
- static public interface Action {
- public void doAction(SwingSession session, String path, Component c);
- }
-
- static public class SaveStateAction implements Action {
- @Override
- public void doAction(SwingSession session, String path, Component c) {
- State manager = session.getStateManager(c.getClass());
- State state = manager.getState(c);
- session.setStates(path, state);
- }
- }
-
- static public class RestoreStateAction implements Action {
- @Override
- public void doAction(SwingSession session, String path, Component c) {
- State manager = session.getStateManager(c.getClass());
- State state = session.getStates(path);
- if (state != null) {
- manager.setState(c, state);
- }
- }
- }
-
- /**
- * get(save) and set(restore) state of object passed in argument
- */
- static public interface State {
- public State getState(Object o);
- public void setState(Object o, State state);
- }
-
- /**
- * State for JTabbedPane
- */
- static public class JTabbedPaneState implements State {
-
- protected int selectedIndex = -1;
- protected int tabCount;
-
- public JTabbedPaneState() {
- }
-
- public int getSelectedIndex() {
- return selectedIndex;
- }
-
- public void setSelectedIndex(int selectedIndex) {
- this.selectedIndex = selectedIndex;
- }
-
- public int getTabCount() {
- return tabCount;
- }
-
- public void setTabCount(int tabCount) {
- this.tabCount = tabCount;
- }
-
-
- protected JTabbedPane checkComponent(Object o) {
- if (o == null) {
- throw new IllegalArgumentException("null component");
- }
- if (!(o instanceof JTabbedPane)) {
- throw new IllegalArgumentException("invalid component");
- }
- return (JTabbedPane) o;
- }
-
- @Override
- public State getState(Object o) {
- JTabbedPaneState result = new JTabbedPaneState();
-
- JTabbedPane p = checkComponent(o);
- result.setSelectedIndex(p.getSelectedIndex());
- result.setTabCount(p.getTabCount());
-
- return result;
- }
-
- @Override
- public void setState(Object o, State state) {
- if (state == null) {
- return;
- }
- if (state instanceof JTabbedPaneState) {
- JTabbedPane p = checkComponent(o);
- JTabbedPaneState tps = (JTabbedPaneState) state;
- if (tps.getSelectedIndex() != -1
- && p.getTabCount() == tps.getTabCount()) {
- p.setSelectedIndex(tps.getSelectedIndex());
- }
- } else {
- throw new IllegalArgumentException("invalid state");
- }
- }
- }
-
- /**
- * State for JSplit
- * FIXME add listener for divider move action
- */
- static public class JSplitPaneState implements State {
-
- protected int dividerLocation = -1;
- protected int orientation = JSplitPane.HORIZONTAL_SPLIT;
-
- public JSplitPaneState() {
- }
-
- public int getDividerLocation() {
- return dividerLocation;
- }
-
- public void setDividerLocation(int dividerLocation) {
- this.dividerLocation = dividerLocation;
- }
-
- public int getOrientation() {
- return orientation;
- }
-
- public void setOrientation(int orientation) {
- this.orientation = orientation;
- }
-
- protected JSplitPane checkComponent(Object o) {
- if (o == null) {
- throw new IllegalArgumentException("null component");
- }
- if (!(o instanceof JSplitPane)) {
- throw new IllegalArgumentException("invalid component");
- }
- return (JSplitPane) o;
- }
-
- @Override
- public State getState(Object o) {
- JSplitPane p = checkComponent(o);
-
- JSplitPaneState result = new JSplitPaneState();
- result.setDividerLocation(p.getUI().getDividerLocation(p));
- result.setOrientation(p.getOrientation());
-
- return result;
- }
-
- @Override
- public void setState(Object o, State state) {
- if (state == null) {
- return;
- }
- JSplitPane p = checkComponent(o);
- if (state instanceof JSplitPaneState) {
- JSplitPaneState sps = (JSplitPaneState) state;
- if (sps.getDividerLocation() != -1
- && p.getOrientation() == sps.getOrientation()) {
- p.setDividerLocation(sps.getDividerLocation());
- }
- } else {
- throw new IllegalArgumentException("invalid state");
- }
- }
- }
-
- /**
- * State for JTable.
- * TODO add support for column order change
- */
- static public class JTableState implements State {
-
- protected int[] columnWidths = new int[0];
-
- public JTableState() {
- }
-
- public JTableState(int[] columnWidths) {
- this.columnWidths = columnWidths;
- }
-
- public int[] getColumnWidths() {
- return columnWidths;
- }
-
- public void setColumnWidths(int[] columnWidths) {
- this.columnWidths = columnWidths;
- }
-
- protected JTable checkComponent(Object o) {
- if (o == null) {
- throw new IllegalArgumentException("null component");
- }
- if (!(o instanceof JTable)) {
- throw new IllegalArgumentException("invalid component");
- }
- return (JTable) o;
- }
-
- @Override
- public State getState(Object o) {
- JTable table = checkComponent(o);
- int[] columnWidths = new int[table.getColumnCount()];
- boolean resizableColumnExists = false;
- for (int i = 0; i < columnWidths.length; i++) {
- TableColumn tc = table.getColumnModel().getColumn(i);
- columnWidths[i] = (tc.getResizable()) ? tc.getWidth() : -1;
- if (tc.getResizable()) {
- resizableColumnExists = true;
- }
- }
- JTableState result = null;
- if (resizableColumnExists) {
- result = new JTableState();
- result.setColumnWidths(columnWidths);
- }
- return result;
- }
-
- @Override
- public void setState(Object o, State state) {
- if (!(state instanceof JTableState)) {
- throw new IllegalArgumentException("invalid state");
- }
- JTable table = checkComponent(o);
- int[] columnWidths = ((JTableState) state).getColumnWidths();
- if (columnWidths != null
- && table.getColumnCount() == columnWidths.length) {
- for (int i = 0; i < columnWidths.length; i++) {
- if (columnWidths[i] != -1) {
- TableColumn tc = table.getColumnModel().getColumn(i);
- if (tc.getResizable()) {
- tc.setPreferredWidth(columnWidths[i]);
- }
- }
- }
- }
- }
- }
-
- /**
- * State for Window
- */
- static public class WindowState implements State {
- private static final String WINDOW_STATE_NORMAL_BOUNDS =
- "WindowState.normalBounds";
-
- protected Rectangle bounds;
- protected Rectangle gcBounds;
- protected int frameState = Frame.NORMAL;
-
- public WindowState() {
- }
-
- public WindowState(Rectangle bounds, Rectangle gcBounds, int frameState) {
- this.bounds = new Rectangle(bounds);
- this.gcBounds = new Rectangle(gcBounds);
- this.frameState = frameState;
- }
-
- public Rectangle getBounds() {
- return bounds;
- }
-
- public void setBounds(Rectangle bounds) {
- this.bounds = bounds;
- }
-
- public Rectangle getGcBounds() {
- return gcBounds;
- }
-
- public void setGcBounds(Rectangle gcBounds) {
- this.gcBounds = gcBounds;
- }
-
- public int getFrameState() {
- return frameState;
- }
-
- public void setFrameState(int frameState) {
- this.frameState = frameState;
- }
-
- protected Window checkComponent(Object o) {
- if (o == null) {
- throw new IllegalArgumentException("null component");
- }
- if (!(o instanceof Window)) {
- throw new IllegalArgumentException("invalid component");
- }
- return (Window) o;
- }
-
- /**
- * Checks whether the window supports resizing
- * @param window the {@code Window} to be checked
- * @return true if the window supports resizing
- */
- protected static boolean isResizable(Window window) {
- boolean resizable = true;
- if (window instanceof Frame) {
- resizable = ((Frame) window).isResizable();
- } else if (window instanceof Dialog) {
- resizable = ((Dialog) window).isResizable();
- }
- return resizable;
- }
-
- /**
- * Gets {@code Window} bounds from the client property
- * @param window the source {@code Window}
- * @return bounds from the client property
- */
- protected static Rectangle getWindowNormalBounds(Window window) {
- Rectangle result = null;
- if (window instanceof JFrame) {
- Object res = ((JFrame) window).getRootPane().getClientProperty(
- WINDOW_STATE_NORMAL_BOUNDS);
- if (res instanceof Rectangle) {
- result = (Rectangle) res;
- }
- }
- return result;
- }
-
- /**
- * Calculates virtual graphic bounds.
- * On multiscreen systems all screens are united into one virtual screen.
- * @return the graphic bounds
- */
- public static Rectangle computeVirtualGraphicsBounds() {
- Rectangle virtualBounds = new Rectangle();
- GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
- GraphicsDevice[] gs = ge.getScreenDevices();
- for (GraphicsDevice gd : gs) {
- GraphicsConfiguration gc = gd.getDefaultConfiguration();
- virtualBounds = virtualBounds.union(gc.getBounds());
- }
- return virtualBounds;
- }
-
- /**
- * Puts {@code Window} bounds to client property.
- * @param window the target {@code Window}
- * @param bounds bounds
- */
- public static void putWindowNormalBounds(Window window, Rectangle bounds) {
- if (window instanceof JFrame) {
- ((JFrame) window).getRootPane().putClientProperty(
- WINDOW_STATE_NORMAL_BOUNDS, bounds);
- }
- }
-
- @Override
- public State getState(Object o) {
- Window c = checkComponent(o);
- int frameState = Frame.NORMAL;
- if (c instanceof Frame) {
- frameState = ((Frame) c).getExtendedState();
- }
- GraphicsConfiguration gc = c.getGraphicsConfiguration();
- Rectangle gcBounds = (gc == null) ? null : gc.getBounds();
- Rectangle frameBounds = c.getBounds();
-
- /* If this is a JFrame created by FrameView and it's been maximized,
- * retrieve the frame's normal (not maximized) bounds. More info:
- * see FrameStateListener#windowStateChanged in FrameView.
- */
- if ((c instanceof JFrame) && (0 != (frameState & Frame.MAXIMIZED_BOTH))) {
- frameBounds = getWindowNormalBounds(c);
- }
-
- WindowState result = null;
- if (frameBounds != null && !frameBounds.isEmpty()) {
- result = new WindowState();
- result.setBounds(frameBounds);
- result.setGcBounds(gcBounds);
- result.setFrameState(frameState);
- }
-
- return result;
- }
-
- @Override
- public void setState(Object o, State state) {
- Window w = checkComponent(o);
- if ((state != null) && !(state instanceof WindowState)) {
- throw new IllegalArgumentException("invalid state");
- }
- WindowState windowState = (WindowState) state;
- if (windowState.getBounds() != null) {
- putWindowNormalBounds(w, windowState.getBounds());
- if (!w.isLocationByPlatform() && (state != null)) {
-
- Rectangle gcBounds0 = windowState.getGcBounds();
- if (gcBounds0 != null && isResizable(w)) {
- if (computeVirtualGraphicsBounds().contains(gcBounds0.getLocation())) {
- w.setBounds(windowState.getBounds());
- } else {
- w.setSize(windowState.getBounds().getSize());
- }
- }
- }
- if (w instanceof Frame) {
- ((Frame) w).setExtendedState(windowState.getFrameState());
- }
- }
- }
-
- }
-
-
- /**
- * Just for test rapidly
- * @param args
- */
- static public void main(String[] args) {
- final SwingSession session =
- new SwingSession(new File("/tmp/SwingSession.config"), false);
-
- JFrame frame = new JFrame("truc");
- frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
- frame.setBounds(10, 20, 300, 500);
-
- TableModel dataModel = new AbstractTableModel() {
-
- @Override
- public String getColumnName(int column) {
- return "c" + column;
- }
-
- @Override
- public int getColumnCount() {
- return 5;
- }
-
- @Override
- public int getRowCount() {
- return 10;
- }
-
- @Override
- public Object getValueAt(int row, int col) {
- return new Integer(row * col);
- }
- };
- JTable table = new JTable(dataModel);
- table.setName("MaTable");
-
- JTabbedPane tab = new JTabbedPane();
- tab.setName("MaTab");
- tab.add("tab1", new JTextArea());
- tab.add("tab2", new JTextArea());
- tab.add("tab3", new JTextArea());
-
- JSplitPane split = new JSplitPane();
- split.setTopComponent(new JScrollPane(table));
- split.setBottomComponent(tab);
-
- JButton button = new JButton("Save");
- button.addActionListener(new ActionListener() {
- @Override
- public void actionPerformed(ActionEvent e) {
- session.save();
- }
- });
-
- frame.getContentPane().setLayout(new BorderLayout());
- frame.getContentPane().add(button, BorderLayout.NORTH);
- frame.getContentPane().add(split, BorderLayout.CENTER);
-
- frame.setVisible(true);
- session.add(frame);
- session.save();
- }
-}
1
0
24 Feb '14
Author: tchemit
Date: 2014-02-24 15:38:02 +0100 (Mon, 24 Feb 2014)
New Revision: 2801
Url: http://nuiton.org/projects/jaxx/repository/revisions/2801
Log:
fixes #1463: Merge nuiton-widgets into Jaxx project (make the module available by default in plugin classp-ath + add doc)
Modified:
trunk/jaxx-maven-plugin/pom.xml
trunk/pom.xml
trunk/src/site/rst/index.rst
Modified: trunk/jaxx-maven-plugin/pom.xml
===================================================================
--- trunk/jaxx-maven-plugin/pom.xml 2014-02-24 14:27:22 UTC (rev 2800)
+++ trunk/jaxx-maven-plugin/pom.xml 2014-02-24 14:38:02 UTC (rev 2801)
@@ -56,6 +56,12 @@
<dependency>
<groupId>${project.groupId}</groupId>
+ <artifactId>jaxx-widgets-extra</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>${project.groupId}</groupId>
<artifactId>jaxx-validator</artifactId>
<version>${project.version}</version>
</dependency>
Modified: trunk/pom.xml
===================================================================
--- trunk/pom.xml 2014-02-24 14:27:22 UTC (rev 2800)
+++ trunk/pom.xml 2014-02-24 14:38:02 UTC (rev 2801)
@@ -39,10 +39,10 @@
<modules>
<module>jaxx-runtime</module>
<module>jaxx-validator</module>
+ <module>jaxx-widgets-extra</module>
<module>jaxx-compiler</module>
<module>jaxx-maven-plugin</module>
<module>jaxx-widgets</module>
- <module>jaxx-widgets-extra</module>
<module>jaxx-config</module>
<module>jaxx-application-api</module>
<module>jaxx-application-swing</module>
Modified: trunk/src/site/rst/index.rst
===================================================================
--- trunk/src/site/rst/index.rst 2014-02-24 14:27:22 UTC (rev 2800)
+++ trunk/src/site/rst/index.rst 2014-02-24 14:38:02 UTC (rev 2801)
@@ -38,6 +38,15 @@
english translation at the same time. To help you wait, you can have a look to
the demo_.
+Nouveautés de la version 2.8.2
+------------------------------
+
+Ajout du module jaxx-widgets-extra
+__________________________________
+
+Il s'agit de la reprise du projet https://nuiton.org/projects/nuiton-widgets
+
+
Nouveautés de la version 2.6
----------------------------
1
0
Author: tchemit
Date: 2014-02-24 15:27:22 +0100 (Mon, 24 Feb 2014)
New Revision: 2800
Url: http://nuiton.org/projects/jaxx/repository/revisions/2800
Log:
fixes #1463: Merge nuiton-widgets into Jaxx project
Added:
trunk/jaxx-widgets-extra/
trunk/jaxx-widgets-extra/LICENSE.txt
trunk/jaxx-widgets-extra/README.txt
trunk/jaxx-widgets-extra/changelog.txt
trunk/jaxx-widgets-extra/pom.xml
trunk/jaxx-widgets-extra/src/
trunk/jaxx-widgets-extra/src/license/
trunk/jaxx-widgets-extra/src/license/THIRD-PARTY.properties
trunk/jaxx-widgets-extra/src/main/
trunk/jaxx-widgets-extra/src/main/assembly/
trunk/jaxx-widgets-extra/src/main/assembly/deps.xml
trunk/jaxx-widgets-extra/src/main/assembly/full.xml
trunk/jaxx-widgets-extra/src/main/java/
trunk/jaxx-widgets-extra/src/main/java/org/
trunk/jaxx-widgets-extra/src/main/java/org/nuiton/
trunk/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/
trunk/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/
trunk/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/
trunk/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/AboutFrame.java
trunk/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/ApplicationAction.java
trunk/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/CustomFocusTraversalPolicy.java
trunk/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/GridFlowLayout.java
trunk/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/IconFactory.java
trunk/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/JComboBoxAutoCompletionKit.java
trunk/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/MessageDialog.java
trunk/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/SimpleInternalFrame.java
trunk/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/SplashScreen.java
trunk/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/SwingSession.java
trunk/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/SwingUtil.java
trunk/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/SwingWidgetFactory.java
trunk/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/SwitchPane.java
trunk/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/UIFSplitPane.java
trunk/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/WidgetUtil.java
trunk/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/XMLGridLayout.java
trunk/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/XMLGridParseConstraints.java
trunk/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/datatips/
trunk/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/datatips/DataTipCell.java
trunk/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/datatips/DataTipComponent.java
trunk/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/datatips/DataTipListener.java
trunk/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/datatips/DataTipManager.java
trunk/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/datatips/DataTipPopup.java
trunk/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/datatips/ListDataTipCell.java
trunk/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/datatips/ListDataTipListener.java
trunk/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/datatips/TableDataTipCell.java
trunk/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/datatips/TableDataTipListener.java
trunk/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/datatips/TreeDataTipCell.java
trunk/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/datatips/TreeDataTipListener.java
trunk/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/datatips/package-info.java
trunk/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/editor/
trunk/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/editor/DefaultEditor.java
trunk/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/editor/Editor.java
trunk/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/editor/EditorHelper.java
trunk/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/editor/EditorInterface.java
trunk/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/editor/JEditEditor.java
trunk/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/editor/NullEditor.java
trunk/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/editor/RSyntaxEditor.java
trunk/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/editor/SDocEditor.java
trunk/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/package.html
trunk/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/tooltip/
trunk/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/tooltip/FocusableTip.java
trunk/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/tooltip/SizeGrip.java
trunk/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/tooltip/TipUtil.java
trunk/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/tooltip/TipWindow.java
trunk/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/tooltip/package-info.java
trunk/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/tree/
trunk/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/tree/FilterTreeModel.java
trunk/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/tree/TreeFilter.java
trunk/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/tree/package-info.java
trunk/jaxx-widgets-extra/src/main/resources/
trunk/jaxx-widgets-extra/src/main/resources/.Bpib
trunk/jaxx-widgets-extra/src/main/resources/22x22/
trunk/jaxx-widgets-extra/src/main/resources/22x22/appearance.png
trunk/jaxx-widgets-extra/src/main/resources/22x22/appointment.png
trunk/jaxx-widgets-extra/src/main/resources/22x22/arrow1Down.png
trunk/jaxx-widgets-extra/src/main/resources/22x22/arrow1Left.png
trunk/jaxx-widgets-extra/src/main/resources/22x22/arrow1Right.png
trunk/jaxx-widgets-extra/src/main/resources/22x22/arrow1Up.png
trunk/jaxx-widgets-extra/src/main/resources/22x22/arrow2Down.png
trunk/jaxx-widgets-extra/src/main/resources/22x22/arrow2Left.png
trunk/jaxx-widgets-extra/src/main/resources/22x22/arrow2Right.png
trunk/jaxx-widgets-extra/src/main/resources/22x22/arrow2Up.png
trunk/jaxx-widgets-extra/src/main/resources/22x22/attach.png
trunk/jaxx-widgets-extra/src/main/resources/22x22/cancel.png
trunk/jaxx-widgets-extra/src/main/resources/22x22/close.png
trunk/jaxx-widgets-extra/src/main/resources/22x22/find.png
trunk/jaxx-widgets-extra/src/main/resources/22x22/fonts.png
trunk/jaxx-widgets-extra/src/main/resources/22x22/fullscreen.png
trunk/jaxx-widgets-extra/src/main/resources/22x22/help.png
trunk/jaxx-widgets-extra/src/main/resources/22x22/idea.png
trunk/jaxx-widgets-extra/src/main/resources/22x22/info.png
trunk/jaxx-widgets-extra/src/main/resources/22x22/mail.png
trunk/jaxx-widgets-extra/src/main/resources/22x22/mailGet.png
trunk/jaxx-widgets-extra/src/main/resources/22x22/mailNew.png
trunk/jaxx-widgets-extra/src/main/resources/22x22/mailSend.png
trunk/jaxx-widgets-extra/src/main/resources/22x22/new.png
trunk/jaxx-widgets-extra/src/main/resources/22x22/nofullscreen.png
trunk/jaxx-widgets-extra/src/main/resources/22x22/ok.png
trunk/jaxx-widgets-extra/src/main/resources/22x22/open.png
trunk/jaxx-widgets-extra/src/main/resources/22x22/print.png
trunk/jaxx-widgets-extra/src/main/resources/22x22/redo.png
trunk/jaxx-widgets-extra/src/main/resources/22x22/reset.png
trunk/jaxx-widgets-extra/src/main/resources/22x22/run.png
trunk/jaxx-widgets-extra/src/main/resources/22x22/save.png
trunk/jaxx-widgets-extra/src/main/resources/22x22/saveAs.png
trunk/jaxx-widgets-extra/src/main/resources/22x22/spellcheck.png
trunk/jaxx-widgets-extra/src/main/resources/22x22/stop.png
trunk/jaxx-widgets-extra/src/main/resources/22x22/time.png
trunk/jaxx-widgets-extra/src/main/resources/22x22/undo.png
trunk/jaxx-widgets-extra/src/main/resources/64x64/
trunk/jaxx-widgets-extra/src/main/resources/64x64/camera.png
trunk/jaxx-widgets-extra/src/main/resources/64x64/joystick.png
trunk/jaxx-widgets-extra/src/main/resources/64x64/modem.png
trunk/jaxx-widgets-extra/src/main/resources/64x64/mouse.png
trunk/jaxx-widgets-extra/src/main/resources/64x64/pda.png
trunk/jaxx-widgets-extra/src/main/resources/64x64/printer.png
trunk/jaxx-widgets-extra/src/main/resources/64x64/scanner.png
trunk/jaxx-widgets-extra/src/main/resources/64x64/tablet.png
trunk/jaxx-widgets-extra/src/main/resources/appointment.png
trunk/jaxx-widgets-extra/src/main/resources/arrow1Left.png
trunk/jaxx-widgets-extra/src/main/resources/arrow1Right.png
trunk/jaxx-widgets-extra/src/main/resources/arrow1Up.png
trunk/jaxx-widgets-extra/src/main/resources/arrow2Down.png
trunk/jaxx-widgets-extra/src/main/resources/arrow2Left.png
trunk/jaxx-widgets-extra/src/main/resources/arrow2Right.png
trunk/jaxx-widgets-extra/src/main/resources/arrow2Up.png
trunk/jaxx-widgets-extra/src/main/resources/attach.png
trunk/jaxx-widgets-extra/src/main/resources/cancel.png
trunk/jaxx-widgets-extra/src/main/resources/close.png
trunk/jaxx-widgets-extra/src/main/resources/copy.png
trunk/jaxx-widgets-extra/src/main/resources/find.png
trunk/jaxx-widgets-extra/src/main/resources/fonts.png
trunk/jaxx-widgets-extra/src/main/resources/fullscreen.png
trunk/jaxx-widgets-extra/src/main/resources/greenGrass.jpg
trunk/jaxx-widgets-extra/src/main/resources/greenGrassSmall.jpg
trunk/jaxx-widgets-extra/src/main/resources/help.png
trunk/jaxx-widgets-extra/src/main/resources/i18n/
trunk/jaxx-widgets-extra/src/main/resources/i18n/jaxx-widgets-extra_en_GB.properties
trunk/jaxx-widgets-extra/src/main/resources/i18n/jaxx-widgets-extra_es_ES.properties
trunk/jaxx-widgets-extra/src/main/resources/i18n/jaxx-widgets-extra_fr_FR.properties
trunk/jaxx-widgets-extra/src/main/resources/i18n/nuiton-widgets_en_GB.properties
trunk/jaxx-widgets-extra/src/main/resources/i18n/nuiton-widgets_fr_FR.properties
trunk/jaxx-widgets-extra/src/main/resources/idea.png
trunk/jaxx-widgets-extra/src/main/resources/info.png
trunk/jaxx-widgets-extra/src/main/resources/licenses.txt
trunk/jaxx-widgets-extra/src/main/resources/mail.png
trunk/jaxx-widgets-extra/src/main/resources/mailGet.png
trunk/jaxx-widgets-extra/src/main/resources/mailNew.png
trunk/jaxx-widgets-extra/src/main/resources/mailSend.png
trunk/jaxx-widgets-extra/src/main/resources/mail_new.png
trunk/jaxx-widgets-extra/src/main/resources/new.png
trunk/jaxx-widgets-extra/src/main/resources/nofullscreen.png
trunk/jaxx-widgets-extra/src/main/resources/ok.png
trunk/jaxx-widgets-extra/src/main/resources/open.png
trunk/jaxx-widgets-extra/src/main/resources/print.png
trunk/jaxx-widgets-extra/src/main/resources/redGecko.jpg
trunk/jaxx-widgets-extra/src/main/resources/redo.png
trunk/jaxx-widgets-extra/src/main/resources/reload.png
trunk/jaxx-widgets-extra/src/main/resources/reset.png
trunk/jaxx-widgets-extra/src/main/resources/run.png
trunk/jaxx-widgets-extra/src/main/resources/save.png
trunk/jaxx-widgets-extra/src/main/resources/saveAs.png
trunk/jaxx-widgets-extra/src/main/resources/saveas.png
trunk/jaxx-widgets-extra/src/main/resources/spellcheck.png
trunk/jaxx-widgets-extra/src/main/resources/spellchek.png
trunk/jaxx-widgets-extra/src/main/resources/stop.png
trunk/jaxx-widgets-extra/src/main/resources/time.png
trunk/jaxx-widgets-extra/src/main/resources/undo.png
trunk/jaxx-widgets-extra/src/site/
trunk/jaxx-widgets-extra/src/site/resources/
trunk/jaxx-widgets-extra/src/site/resources/images/
trunk/jaxx-widgets-extra/src/site/resources/images/components/
trunk/jaxx-widgets-extra/src/site/resources/images/components/focusablett1.jpg
trunk/jaxx-widgets-extra/src/site/resources/images/components/focusablett2.jpg
trunk/jaxx-widgets-extra/src/site/rst/
trunk/jaxx-widgets-extra/src/site/rst/Todo.rst
trunk/jaxx-widgets-extra/src/site/rst/components/
trunk/jaxx-widgets-extra/src/site/rst/components/focusabletooltips.rst
trunk/jaxx-widgets-extra/src/site/rst/components/treefilters.rst
trunk/jaxx-widgets-extra/src/site/rst/index.rst
trunk/jaxx-widgets-extra/src/site/site_fr.xml
trunk/jaxx-widgets-extra/src/test/
trunk/jaxx-widgets-extra/src/test/java/
trunk/jaxx-widgets-extra/src/test/java/org/
trunk/jaxx-widgets-extra/src/test/java/org/nuiton/
trunk/jaxx-widgets-extra/src/test/java/org/nuiton/jaxx/
trunk/jaxx-widgets-extra/src/test/java/org/nuiton/jaxx/widgets/
trunk/jaxx-widgets-extra/src/test/java/org/nuiton/jaxx/widgets/extra/
trunk/jaxx-widgets-extra/src/test/java/org/nuiton/jaxx/widgets/extra/AboutFrameTest.java
trunk/jaxx-widgets-extra/src/test/java/org/nuiton/jaxx/widgets/extra/IconFactoryTest.java
trunk/jaxx-widgets-extra/src/test/java/org/nuiton/jaxx/widgets/extra/WidgetUtilTest.java
trunk/jaxx-widgets-extra/src/test/java/org/nuiton/jaxx/widgets/extra/XMLGridLayoutTest.java
trunk/jaxx-widgets-extra/src/test/java/org/nuiton/jaxx/widgets/extra/XMLGridLayoutTest.xgl
trunk/jaxx-widgets-extra/src/test/java/org/nuiton/jaxx/widgets/extra/editor/
trunk/jaxx-widgets-extra/src/test/java/org/nuiton/jaxx/widgets/extra/editor/EditorMain.java
trunk/jaxx-widgets-extra/src/test/java/org/nuiton/jaxx/widgets/extra/toolTip/
trunk/jaxx-widgets-extra/src/test/java/org/nuiton/jaxx/widgets/extra/toolTip/FocusableToolTipMain.java
trunk/jaxx-widgets-extra/src/test/resources/
trunk/jaxx-widgets-extra/src/test/resources/log4j.properties
Modified:
trunk/pom.xml
Property changes on: trunk/jaxx-widgets-extra
___________________________________________________________________
Added: svn:ignore
+ target
.idea
*.ipr
*.iws
*.iml
Added: trunk/jaxx-widgets-extra/LICENSE.txt
===================================================================
--- trunk/jaxx-widgets-extra/LICENSE.txt (rev 0)
+++ trunk/jaxx-widgets-extra/LICENSE.txt 2014-02-24 14:27:22 UTC (rev 2800)
@@ -0,0 +1,166 @@
+ GNU LESSER GENERAL PUBLIC LICENSE
+ Version 3, 29 June 2007
+
+ Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+
+ This version of the GNU Lesser General Public License incorporates
+the terms and conditions of version 3 of the GNU General Public
+License, supplemented by the additional permissions listed below.
+
+ 0. Additional Definitions.
+
+ As used herein, "this License" refers to version 3 of the GNU Lesser
+General Public License, and the "GNU GPL" refers to version 3 of the GNU
+General Public License.
+
+ "The Library" refers to a covered work governed by this License,
+other than an Application or a Combined Work as defined below.
+
+ An "Application" is any work that makes use of an interface provided
+by the Library, but which is not otherwise based on the Library.
+Defining a subclass of a class defined by the Library is deemed a mode
+of using an interface provided by the Library.
+
+ A "Combined Work" is a work produced by combining or linking an
+Application with the Library. The particular version of the Library
+with which the Combined Work was made is also called the "Linked
+Version".
+
+ The "Minimal Corresponding Source" for a Combined Work means the
+Corresponding Source for the Combined Work, excluding any source code
+for portions of the Combined Work that, considered in isolation, are
+based on the Application, and not on the Linked Version.
+
+ The "Corresponding Application Code" for a Combined Work means the
+object code and/or source code for the Application, including any data
+and utility programs needed for reproducing the Combined Work from the
+Application, but excluding the System Libraries of the Combined Work.
+
+ 1. Exception to Section 3 of the GNU GPL.
+
+ You may convey a covered work under sections 3 and 4 of this License
+without being bound by section 3 of the GNU GPL.
+
+ 2. Conveying Modified Versions.
+
+ If you modify a copy of the Library, and, in your modifications, a
+facility refers to a function or data to be supplied by an Application
+that uses the facility (other than as an argument passed when the
+facility is invoked), then you may convey a copy of the modified
+version:
+
+ a) under this License, provided that you make a good faith effort to
+ ensure that, in the event an Application does not supply the
+ function or data, the facility still operates, and performs
+ whatever part of its purpose remains meaningful, or
+
+ b) under the GNU GPL, with none of the additional permissions of
+ this License applicable to that copy.
+
+ 3. Object Code Incorporating Material from Library Header Files.
+
+ The object code form of an Application may incorporate material from
+a header file that is part of the Library. You may convey such object
+code under terms of your choice, provided that, if the incorporated
+material is not limited to numerical parameters, data structure
+layouts and accessors, or small macros, inline functions and templates
+(ten or fewer lines in length), you do both of the following:
+
+ a) Give prominent notice with each copy of the object code that the
+ Library is used in it and that the Library and its use are
+ covered by this License.
+
+ b) Accompany the object code with a copy of the GNU GPL and this license
+ document.
+
+ 4. Combined Works.
+
+ You may convey a Combined Work under terms of your choice that,
+taken together, effectively do not restrict modification of the
+portions of the Library contained in the Combined Work and reverse
+engineering for debugging such modifications, if you also do each of
+the following:
+
+ a) Give prominent notice with each copy of the Combined Work that
+ the Library is used in it and that the Library and its use are
+ covered by this License.
+
+ b) Accompany the Combined Work with a copy of the GNU GPL and this license
+ document.
+
+ c) For a Combined Work that displays copyright notices during
+ execution, include the copyright notice for the Library among
+ these notices, as well as a reference directing the user to the
+ copies of the GNU GPL and this license document.
+
+ d) Do one of the following:
+
+ 0) Convey the Minimal Corresponding Source under the terms of this
+ License, and the Corresponding Application Code in a form
+ suitable for, and under terms that permit, the user to
+ recombine or relink the Application with a modified version of
+ the Linked Version to produce a modified Combined Work, in the
+ manner specified by section 6 of the GNU GPL for conveying
+ Corresponding Source.
+
+ 1) Use a suitable shared library mechanism for linking with the
+ Library. A suitable mechanism is one that (a) uses at run time
+ a copy of the Library already present on the user's computer
+ system, and (b) will operate properly with a modified version
+ of the Library that is interface-compatible with the Linked
+ Version.
+
+ e) Provide Installation Information, but only if you would otherwise
+ be required to provide such information under section 6 of the
+ GNU GPL, and only to the extent that such information is
+ necessary to install and execute a modified version of the
+ Combined Work produced by recombining or relinking the
+ Application with a modified version of the Linked Version. (If
+ you use option 4d0, the Installation Information must accompany
+ the Minimal Corresponding Source and Corresponding Application
+ Code. If you use option 4d1, you must provide the Installation
+ Information in the manner specified by section 6 of the GNU GPL
+ for conveying Corresponding Source.)
+
+ 5. Combined Libraries.
+
+ You may place library facilities that are a work based on the
+Library side by side in a single library together with other library
+facilities that are not Applications and are not covered by this
+License, and convey such a combined library under terms of your
+choice, if you do both of the following:
+
+ a) Accompany the combined library with a copy of the same work based
+ on the Library, uncombined with any other library facilities,
+ conveyed under the terms of this License.
+
+ b) Give prominent notice with the combined library that part of it
+ is a work based on the Library, and explaining where to find the
+ accompanying uncombined form of the same work.
+
+ 6. Revised Versions of the GNU Lesser General Public License.
+
+ The Free Software Foundation may publish revised and/or new versions
+of the GNU Lesser General Public License from time to time. Such new
+versions will be similar in spirit to the present version, but may
+differ in detail to address new problems or concerns.
+
+ Each version is given a distinguishing version number. If the
+Library as you received it specifies that a certain numbered version
+of the GNU Lesser General Public License "or any later version"
+applies to it, you have the option of following the terms and
+conditions either of that published version or of any later version
+published by the Free Software Foundation. If the Library as you
+received it does not specify a version number of the GNU Lesser
+General Public License, you may choose any version of the GNU Lesser
+General Public License ever published by the Free Software Foundation.
+
+ If the Library as you received it specifies that a proxy can decide
+whether future versions of the GNU Lesser General Public License shall
+apply, that proxy's public statement of acceptance of any version is
+permanent authorization for you to choose that version for the
+Library.
+
Property changes on: trunk/jaxx-widgets-extra/LICENSE.txt
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
Added: trunk/jaxx-widgets-extra/README.txt
===================================================================
--- trunk/jaxx-widgets-extra/README.txt (rev 0)
+++ trunk/jaxx-widgets-extra/README.txt 2014-02-24 14:27:22 UTC (rev 2800)
@@ -0,0 +1,2 @@
+To deploy new version of pom: mvn deploy
+To install localy: mvn install
Property changes on: trunk/jaxx-widgets-extra/README.txt
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
Added: trunk/jaxx-widgets-extra/changelog.txt
===================================================================
--- trunk/jaxx-widgets-extra/changelog.txt (rev 0)
+++ trunk/jaxx-widgets-extra/changelog.txt 2014-02-24 14:27:22 UTC (rev 2800)
@@ -0,0 +1,33 @@
+ver-1.0.1 chatellier 2009xxxx
+ * Add setEnabled support for JEdit and RsyntaxTextArea
+ * Add caret listener support on editors
+ * Add cut, copy, paste support on editors
+
+ver-0.14 chatellier 20090409
+ * improve AboutFrame
+ * Fix SDoc background color on nimbus
+
+ver-0.12 chemit 20090118
+ * use lutinproject 3.4
+ * Add about frame
+ * Move tests to junit 4
+
+ver-0.11
+ * localize status bar memory string
+ * localize editor defaut label text
+ * use lutinutil-1.0 (new i18n format)
+ * use lutinproject 3.2
+
+ver-0.10
+ * use lutinproject 3.1
+ * always do tests :) If you don't want them exclude them (for hudson...)
+ * Correct SVN structure
+ * Maven2 layout, LGPLv3
+ * ApplicationMonitor can used LutinLog or jdk java logging
+
+ver-0.9 poussin 20060907
+
+ * StatusBar ajout d'un indicateur de memoire
+ * StatusBar ajout d'une horloge
+ * add XMLGridLayout
+ * add Editor
Property changes on: trunk/jaxx-widgets-extra/changelog.txt
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
Added: trunk/jaxx-widgets-extra/pom.xml
===================================================================
--- trunk/jaxx-widgets-extra/pom.xml (rev 0)
+++ trunk/jaxx-widgets-extra/pom.xml 2014-02-24 14:27:22 UTC (rev 2800)
@@ -0,0 +1,144 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <groupId>org.nuiton</groupId>
+ <artifactId>jaxx</artifactId>
+ <version>2.8.2-SNAPSHOT</version>
+ </parent>
+
+ <groupId>org.nuiton.jaxx</groupId>
+ <artifactId>jaxx-widgets-extra</artifactId>
+
+ <dependencies>
+
+ <dependency>
+ <groupId>org.nuiton</groupId>
+ <artifactId>nuiton-utils</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.nuiton.i18n</groupId>
+ <artifactId>nuiton-i18n</artifactId>
+ </dependency>
+
+ <!-- cl patch is same but without system.out -->
+ <dependency>
+ <groupId>org.nuiton.thirdparty</groupId>
+ <artifactId>sdoc</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>net.sf.jped</groupId>
+ <artifactId>jedit-syntax</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>com.fifesoft</groupId>
+ <artifactId>rsyntaxtextarea</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>commons-io</groupId>
+ <artifactId>commons-io</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.commons</groupId>
+ <artifactId>commons-lang3</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>commons-logging</groupId>
+ <artifactId>commons-logging</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.commons</groupId>
+ <artifactId>commons-collections4</artifactId>
+ </dependency>
+
+ </dependencies>
+
+ <name>JAXX :: Extra Widgets</name>
+ <description>Widgets graphiques utiles pour tous les développements (pour le moment sans lien avec JAXX).</description>
+ <inceptionYear>2004</inceptionYear>
+
+ <properties>
+
+ <!-- extra files to include in release -->
+ <redmine.releaseFiles>${redmine.libReleaseFiles}</redmine.releaseFiles>
+
+ </properties>
+
+ <build>
+
+ <plugins>
+
+ <plugin>
+ <groupId>org.nuiton.i18n</groupId>
+ <artifactId>i18n-maven-plugin</artifactId>
+ <executions>
+ <execution>
+ <goals>
+ <goal>parserJava</goal>
+ <goal>gen</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+
+ </plugins>
+
+ </build>
+
+ <profiles>
+ <!-- create assemblies only at release time -->
+ <profile>
+ <id>assembly-profile</id>
+ <activation>
+ <property>
+ <name>performRelease</name>
+ <value>true</value>
+ </property>
+ </activation>
+ <build>
+ <plugins>
+
+ <!-- launch in a release the assembly automaticly -->
+ <plugin>
+ <artifactId>maven-assembly-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>create-assemblies</id>
+ <phase>verify</phase>
+ <goals>
+ <goal>single</goal>
+ </goals>
+ </execution>
+ </executions>
+ <configuration>
+ <attach>false</attach>
+ <descriptorRefs>
+ <descriptorRef>deps</descriptorRef>
+ <descriptorRef>full</descriptorRef>
+ </descriptorRefs>
+ </configuration>
+ </plugin>
+
+ </plugins>
+
+ </build>
+ </profile>
+
+ </profiles>
+
+</project>
Property changes on: trunk/jaxx-widgets-extra/pom.xml
___________________________________________________________________
Added: svn:mime-type
+ text/xml
Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
Added: trunk/jaxx-widgets-extra/src/license/THIRD-PARTY.properties
===================================================================
--- trunk/jaxx-widgets-extra/src/license/THIRD-PARTY.properties (rev 0)
+++ trunk/jaxx-widgets-extra/src/license/THIRD-PARTY.properties 2014-02-24 14:27:22 UTC (rev 2800)
@@ -0,0 +1,41 @@
+###
+# #%L
+# JAXX :: Extra Widgets
+# %%
+# Copyright (C) 2004 - 2014 CodeLutin
+# %%
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License as
+# published by the Free Software Foundation, either version 3 of the
+# License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Lesser Public License for more details.
+#
+# You should have received a copy of the GNU General Lesser Public
+# License along with this program. If not, see
+# <http://www.gnu.org/licenses/lgpl-3.0.html>.
+# #L%
+###
+# Generated by org.codehaus.mojo.license.AddThirdPartyMojo
+#-------------------------------------------------------------------------------
+# Already used licenses in project :
+# - BSD License
+# - COMMON DEVELOPMENT AND DISTRIBUTION LICENSE (CDDL) Version 1.0
+# - Common Public License Version 1.0
+# - GNU GENERAL PUBLIC LICENSE version 2 or higher
+# - Indiana University Extreme! Lab Software License, vesion 1.1.1
+# - Lesser General Public License (LGPL) v 3.0
+# - Lesser General Public License (LPGL)
+# - Lesser General Public License (LPGL) v 2.1
+# - MIT License
+# - The Apache Software License, Version 2.0
+#-------------------------------------------------------------------------------
+# Please fill the missing licenses for dependencies :
+#
+#
+#Thu Aug 18 07:44:54 CEST 2011
+commons-primitives--commons-primitives--1.0=The Apache Software License, Version 2.0
+org.nuiton.thirdparty--sdoc--0.5.0-beta-patchcl=Lesser General Public License (LGPL) v 3.0
Property changes on: trunk/jaxx-widgets-extra/src/license/THIRD-PARTY.properties
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
Added: trunk/jaxx-widgets-extra/src/main/assembly/deps.xml
===================================================================
--- trunk/jaxx-widgets-extra/src/main/assembly/deps.xml (rev 0)
+++ trunk/jaxx-widgets-extra/src/main/assembly/deps.xml 2014-02-24 14:27:22 UTC (rev 2800)
@@ -0,0 +1,66 @@
+<!--
+ #%L
+ JAXX :: Extra Widgets
+ %%
+ Copyright (C) 2004 - 2010 CodeLutin
+ %%
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation, either version 3 of the
+ License, or (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Lesser Public License for more details.
+
+ You should have received a copy of the GNU General Lesser Public
+ License along with this program. If not, see
+ <http://www.gnu.org/licenses/lgpl-3.0.html>.
+ #L%
+ -->
+<assembly>
+ <id>deps</id>
+ <formats>
+ <format>zip</format>
+ </formats>
+ <!-- This don't support SNAPSHOT -->
+ <dependencySets>
+ <dependencySet>
+ <outputDirectory>lib</outputDirectory>
+ <excludes>
+ <exclude>junit:junit</exclude>
+ <exclude>${artifact.groupId}:${artifact.artifactId}</exclude>
+ </excludes>
+ <scope>runtime</scope>
+ </dependencySet>
+ </dependencySets>
+ <fileSets>
+ <fileSet>
+ <directory>target</directory>
+ <outputDirectory>/</outputDirectory>
+ <includes>
+ <include>*.jar</include>
+ </includes>
+ <excludes>
+ <exclude>*-sources.jar</exclude>
+ <exclude>*-javadoc.jar</exclude>
+ </excludes>
+ </fileSet>
+ <fileSet>
+ <outputDirectory>/</outputDirectory>
+ <includes>
+ <include>README*</include>
+ <include>LICENSE*</include>
+ <include>pom.xml</include>
+ </includes>
+ </fileSet>
+ <fileSet>
+ <outputDirectory>/</outputDirectory>
+ <directory>target/classes</directory>
+ <includes>
+ <include>THIRD-PARTY.txt</include>
+ </includes>
+ </fileSet>
+ </fileSets>
+</assembly>
Property changes on: trunk/jaxx-widgets-extra/src/main/assembly/deps.xml
___________________________________________________________________
Added: svn:mime-type
+ text/xml
Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
Added: trunk/jaxx-widgets-extra/src/main/assembly/full.xml
===================================================================
--- trunk/jaxx-widgets-extra/src/main/assembly/full.xml (rev 0)
+++ trunk/jaxx-widgets-extra/src/main/assembly/full.xml 2014-02-24 14:27:22 UTC (rev 2800)
@@ -0,0 +1,68 @@
+<!--
+ #%L
+ JAXX :: Extra Widgets
+ %%
+ Copyright (C) 2004 - 2010 CodeLutin
+ %%
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation, either version 3 of the
+ License, or (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Lesser Public License for more details.
+
+ You should have received a copy of the GNU General Lesser Public
+ License along with this program. If not, see
+ <http://www.gnu.org/licenses/lgpl-3.0.html>.
+ #L%
+ -->
+<assembly>
+ <id>full</id>
+ <formats>
+ <format>zip</format>
+ </formats>
+ <!-- This don't support SNAPSHOT -->
+ <dependencySets>
+ <dependencySet>
+ <outputDirectory>lib</outputDirectory>
+ <excludes>
+ <exclude>${artifact.groupId}:${artifact.artifactId}</exclude>
+ </excludes>
+ <scope>runtime</scope>
+ </dependencySet>
+ </dependencySets>
+ <fileSets>
+ <fileSet>
+ <directory>target</directory>
+ <outputDirectory>/</outputDirectory>
+ <includes>
+ <include>*.jar</include>
+ </includes>
+ <excludes>
+ <exclude>*-sources.jar</exclude>
+ </excludes>
+ </fileSet>
+ <fileSet>
+ <outputDirectory>/</outputDirectory>
+ <includes>
+ <include>README*</include>
+ <include>LICENSE*</include>
+ <include>pom.xml</include>
+ </includes>
+ </fileSet>
+ <fileSet>
+ <outputDirectory>/</outputDirectory>
+ <directory>target/classes</directory>
+ <includes>
+ <include>THIRD-PARTY.txt</include>
+ </includes>
+ </fileSet>
+ <fileSet>
+ <directory>src</directory>
+ <!--useDefaultExcludes>true</useDefaultExcludes-->
+ </fileSet>
+ </fileSets>
+</assembly>
Property changes on: trunk/jaxx-widgets-extra/src/main/assembly/full.xml
___________________________________________________________________
Added: svn:mime-type
+ text/xml
Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
Added: trunk/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/AboutFrame.java
===================================================================
--- trunk/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/AboutFrame.java (rev 0)
+++ trunk/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/AboutFrame.java 2014-02-24 14:27:22 UTC (rev 2800)
@@ -0,0 +1,305 @@
+/*
+ * #%L
+ * JAXX :: Extra Widgets
+ * %%
+ * Copyright (C) 2004 - 2010 CodeLutin
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Lesser Public License for more details.
+ *
+ * You should have received a copy of the GNU General Lesser Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/lgpl-3.0.html>.
+ * #L%
+ */
+
+package org.nuiton.jaxx.widgets.extra;
+
+import static org.nuiton.i18n.I18n.t;
+
+import java.awt.Color;
+import java.awt.Component;
+import java.awt.Desktop;
+import java.awt.GridBagConstraints;
+import java.awt.GridBagLayout;
+import java.awt.Insets;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.io.IOException;
+import java.net.URISyntaxException;
+import java.net.URL;
+
+import javax.swing.Icon;
+import javax.swing.JButton;
+import javax.swing.JEditorPane;
+import javax.swing.JFrame;
+import javax.swing.JLabel;
+import javax.swing.JTabbedPane;
+import javax.swing.JTextArea;
+import javax.swing.event.HyperlinkEvent;
+import javax.swing.event.HyperlinkListener;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.nuiton.util.Resource;
+
+/**
+ * About windows.
+ *
+ * Can't set :
+ * - top image
+ * - about tab
+ * - license tab (optionnal)
+ *
+ * @author chatellier
+ * @version $Revision$
+ *
+ * Last update : $Date$ By : $Author$
+ */
+public class AboutFrame extends JFrame implements ActionListener,
+ HyperlinkListener {
+
+ /** serialVersionUID */
+ private static final long serialVersionUID = -8693584537185015506L;
+ /** log */
+ private static Log log = LogFactory.getLog(AboutFrame.class);
+ /** Top image path (classpath) */
+ protected String iconPath;
+ /** Background color */
+ protected Color backgroundColor;
+ /** Html text displayed in about tab */
+ protected String aboutHtmlText = "";
+ /** License text displayed in license tab */
+ protected String licenseText;
+
+ /**
+ * Constructor.
+ *
+ * Build UI.
+ */
+ public AboutFrame() {
+ super();
+
+ // fix resizing
+ this.setResizable(false);
+ }
+
+ /**
+ * Set about text.
+ *
+ * @param aboutHtmlText the aboutHtmlText to set
+ */
+ public void setAboutHtmlText(String aboutHtmlText) {
+ this.aboutHtmlText = aboutHtmlText;
+ }
+
+ /**
+ * Set licence text.
+ *
+ * @param licenseText the licenseText to set
+ */
+ public void setLicenseText(String licenseText) {
+ this.licenseText = licenseText;
+ }
+
+ /**
+ * Set icon path.
+ *
+ * @param iconPath the iconPath to set
+ */
+ public void setIconPath(String iconPath) {
+ this.iconPath = iconPath;
+ }
+
+ /**
+ * Set background color.
+ *
+ * @param backgroundColor the backgroundColor to set
+ */
+ public void setBackgroundColor(Color backgroundColor) {
+ this.backgroundColor = backgroundColor;
+ }
+
+ /**
+ * Build ui.
+ */
+ protected void buildUI() {
+
+ setLayout(new GridBagLayout());
+ Contraintes c = new Contraintes();
+
+ // top panel
+ Component top = getTopPanel();
+ c.setConstraints(0, 0, 1, 1, 1, 0, Contraintes.HORIZONTAL,
+ Contraintes.CENTER, new Insets(1, 1, 1, 1), 0, 0);
+ add(top, c);
+
+ JTabbedPane tabPanel = new JTabbedPane();
+
+ // first panel
+ Component firstTab = getAboutTab();
+ tabPanel.add(t("nuitonwidgets.aboutframe.about"), firstTab);
+
+ // second panel
+ if (licenseText != null) {
+ Component secondTab = getLicenseTab();
+ tabPanel.add(t("nuitonwidgets.aboutframe.license"), secondTab);
+ }
+
+ c.setConstraints(0, 1, 1, 1, 1, 1, Contraintes.BOTH,
+ Contraintes.CENTER, new Insets(0, 5, 5, 5), 0, 0);
+ add(tabPanel, c);
+
+ // ok button
+ JButton okButton = new JButton(t("nuitonwidgets.aboutframe.ok"));
+ okButton.setActionCommand("ok");
+ okButton.addActionListener(this);
+ c.setConstraints(0, 2, 1, 1, 1, 0, Contraintes.NONE, Contraintes.EAST,
+ new Insets(0, 5, 5, 5), 20, 0);
+ add(okButton, c);
+
+ // change back color
+ if (backgroundColor != null) {
+ getContentPane().setBackground(backgroundColor);
+ }
+ }
+
+ /**
+ * Build the top component
+ *
+ * @return top component
+ */
+ protected Component getTopPanel() {
+ // image
+ JLabel labelIcon;
+ if (iconPath != null) {
+ Icon logoIcon = Resource.getIcon(iconPath);
+ labelIcon = new JLabel(logoIcon);
+ } else {
+ labelIcon = new JLabel();
+ }
+ return labelIcon;
+ }
+
+ /**
+ * Build license tab.
+ *
+ * @return license tab component
+ */
+ protected Component getLicenseTab() {
+
+ JTextArea licenseArea = new JTextArea();
+ licenseArea.setLineWrap(true);
+ licenseArea.setWrapStyleWord(true);
+ licenseArea.setText(licenseText);
+ licenseArea.setEditable(false);
+ return licenseArea;
+ }
+
+ /**
+ * Build about tab.
+ *
+ * @return about tab component
+ */
+ protected Component getAboutTab() {
+
+ JEditorPane htmlAbout = new JEditorPane("text/html", aboutHtmlText);
+ htmlAbout.addHyperlinkListener(this);
+ htmlAbout.setEditable(false);
+
+ return htmlAbout;
+ }
+
+ /*
+ * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
+ */
+ @Override
+ public void actionPerformed(ActionEvent e) {
+
+ String command = e.getActionCommand();
+
+ if ("ok".equals(command)) {
+ setVisible(false);
+ }
+ }
+
+ /*
+ * @see javax.swing.event.HyperlinkListener#hyperlinkUpdate(javax.swing.event.HyperlinkEvent)
+ */
+ @Override
+ public void hyperlinkUpdate(HyperlinkEvent he) {
+ if (he.getEventType() == HyperlinkEvent.EventType.ACTIVATED) {
+
+ if (Desktop.isDesktopSupported()) {
+ try {
+ URL u = he.getURL();
+ if (u.getProtocol().equalsIgnoreCase("mailto") || u.getProtocol().equalsIgnoreCase("http") || u.getProtocol().equalsIgnoreCase("ftp")) {
+ Desktop.getDesktop().browse(u.toURI());
+ }
+ } catch (IOException e) {
+ if (log.isErrorEnabled()) {
+ log.error("Error while opening link", e);
+ }
+ } catch (URISyntaxException e) {
+ if (log.isErrorEnabled()) {
+ log.error("Error while opening link", e);
+ }
+ }
+ }
+ }
+ }
+
+ @Override
+ public void setVisible(boolean b) {
+ if (b) {
+ // build UI
+ buildUI();
+ }
+
+ super.setVisible(b);
+ }
+}
+
+class Contraintes extends GridBagConstraints {
+
+ /** serialVersionUID. */
+ public static final long serialVersionUID = 77885838537048102L;
+
+ /**
+ * Modifie les contraintes.
+ *
+ * @param x Numéro de cellule en abscisse
+ * @param y Numéro de cellule en ordonnée
+ * @param nbx Nombre de cellules occupées en abscisse
+ * @param nby Nombre de cellules occupées en ordonnée
+ * @param wx Proportion en abscisse
+ * @param wy Proportion en ordonnée
+ * @param fill Méthode de remplissage de la cellule
+ * @param anchor Position dans la cellule
+ * @param espacement <tt>Insets</tt> spécifiant les espaces
+ * latéraux ( <tt>new Insets(haut,gauche,bas,droite)</tt>)
+ * @param etirx Etrirement de la cellule en abscisse
+ * @param etiry Etrirement de la cellule en ordonnée
+ */
+ public void setConstraints(int x, int y, int nbx, int nby, int wx, int wy,
+ int fill, int anchor, Insets espacement, int etirx, int etiry) {
+ this.gridx = x;
+ this.gridy = y;
+ this.gridwidth = nbx;
+ this.gridheight = nby;
+ this.weightx = wx;
+ this.weighty = wy;
+ this.fill = fill;
+ this.anchor = anchor;
+ this.insets = espacement;
+ this.ipadx = etirx;
+ this.ipady = etiry;
+ }
+}
Property changes on: trunk/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/AboutFrame.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
Added: trunk/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/ApplicationAction.java
===================================================================
--- trunk/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/ApplicationAction.java (rev 0)
+++ trunk/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/ApplicationAction.java 2014-02-24 14:27:22 UTC (rev 2800)
@@ -0,0 +1,73 @@
+/*
+ * #%L
+ * JAXX :: Extra Widgets
+ * %%
+ * Copyright (C) 2004 - 2010 CodeLutin
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Lesser Public License for more details.
+ *
+ * You should have received a copy of the GNU General Lesser Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/lgpl-3.0.html>.
+ * #L%
+ */
+
+/* *
+ * ApplicationAction.java
+ *
+ * Created: Nov 22, 2004
+ *
+ * @author C�dric Pineau <pineau(a)codelutin.com>
+ * @version $Revision$
+ *
+ * Last update : $Date$
+ * by : $Author$
+ */
+
+package org.nuiton.jaxx.widgets.extra;
+
+import java.util.List;
+
+import javax.swing.AbstractAction;
+
+/**
+ *
+ */
+public abstract class ApplicationAction extends AbstractAction {
+
+ private static final long serialVersionUID = 1L;
+
+ private String _shortText = null;
+
+ public ApplicationAction(String shortText, String description,
+ String iconId, char mnemonic, String accelerator) {
+ super(description, IconFactory.getIcon(iconId));
+ setShortText(shortText);
+ }
+
+ protected String getShortText() {
+ return this._shortText;
+ }
+
+ protected void setShortText(String shortText) {
+ this._shortText = shortText;
+ }
+
+ protected List<?> arguments = null;
+
+ public List<?> getArguments() {
+ return arguments;
+ }
+
+ public void setArguments(List<?> arguments) {
+ this.arguments = arguments;
+ }
+}
Property changes on: trunk/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/ApplicationAction.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
Added: trunk/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/CustomFocusTraversalPolicy.java
===================================================================
--- trunk/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/CustomFocusTraversalPolicy.java (rev 0)
+++ trunk/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/CustomFocusTraversalPolicy.java 2014-02-24 14:27:22 UTC (rev 2800)
@@ -0,0 +1,103 @@
+/*
+ * #%L
+ * JAXX :: Extra Widgets
+ * %%
+ * Copyright (C) 2004 - 2010 CodeLutin
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Lesser Public License for more details.
+ *
+ * You should have received a copy of the GNU General Lesser Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/lgpl-3.0.html>.
+ * #L%
+ */
+
+ /*
+ * Created on 16 mai 2005
+ *
+ * TODO To change the template for this generated file go to
+ * Window - Preferences - Java - Code Style - Code Templates
+ */
+package org.nuiton.jaxx.widgets.extra;
+
+import java.awt.Component;
+import java.awt.Container;
+import java.awt.FocusTraversalPolicy;
+import java.util.List;
+
+/**
+ * @author cedric
+ *
+ * TODO To change the template for this generated type comment go to
+ * Window - Preferences - Java - Code Style - Code Templates
+ */
+public class CustomFocusTraversalPolicy extends FocusTraversalPolicy {
+
+ protected List<?> order = null;
+
+ public CustomFocusTraversalPolicy(List<?> order) {
+ this.order = order;
+ }
+
+ @Override
+ public Component getFirstComponent(Container focusCycleRoot) {
+ if (order.size() != 0) {
+ return (Component) order.get(0);
+ }
+ return null;
+ }
+
+ @Override
+ public Component getLastComponent(Container focusCycleRoot) {
+ if (order.size() > 0) {
+ return (Component) order.get(order.size() - 1);
+ }
+ return null;
+ }
+
+ @Override
+ public Component getComponentAfter(Container focusCycleRoot,
+ Component aComponent) {
+ int index = order.indexOf(aComponent);
+ if (index != -1) {
+ Component nextC = (Component) order.get((index + 1) % order.size());
+ if (nextC.isEnabled()) {
+ return nextC;
+ }
+ return getComponentAfter(focusCycleRoot, nextC);
+ }
+ return null;
+ }
+
+ @Override
+ public Component getComponentBefore(Container focusCycleRoot,
+ Component aComponent) {
+ int index = order.indexOf(aComponent);
+ if (index != -1) {
+ Component nextC = (Component) order.get((index - 1 + order.size())
+ % order.size());
+ if (nextC.isEnabled()) {
+ return nextC;
+ }
+ return getComponentBefore(focusCycleRoot, nextC);
+ }
+ return null;
+ }
+
+ @Override
+ public Component getDefaultComponent(Container focusCycleRoot) {
+ if (order.size() > 0) {
+ return (Component) order.get(0);
+ }
+ return null;
+ }
+
+}
Property changes on: trunk/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/CustomFocusTraversalPolicy.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
Added: trunk/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/GridFlowLayout.java
===================================================================
--- trunk/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/GridFlowLayout.java (rev 0)
+++ trunk/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/GridFlowLayout.java 2014-02-24 14:27:22 UTC (rev 2800)
@@ -0,0 +1,457 @@
+/*
+ * #%L
+ * JAXX :: Extra Widgets
+ * %%
+ * Copyright (C) 2004 - 2010 CodeLutin
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Lesser Public License for more details.
+ *
+ * You should have received a copy of the GNU General Lesser Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/lgpl-3.0.html>.
+ * #L%
+ */
+
+ /* *
+ * GridFlowLayout.java
+ *
+ * Created: Wed May 8 2002
+ *
+ * @author POUSSIN Benjamin <bpoussin(a)free.fr>
+ * Copyright Code Lutin
+ * @version $Revision$
+ *
+ * Mise a jour: $Date$
+ * par : $Author$
+ */
+
+package org.nuiton.jaxx.widgets.extra;
+
+import java.awt.Component;
+import java.awt.Container;
+import java.awt.Dimension;
+import java.awt.Insets;
+import java.awt.LayoutManager2;
+import java.util.HashMap;
+import java.util.HashSet;
+
+import javax.swing.JViewport;
+
+/**
+ * Ce layout place les composants de gauche à droite ou de droite à gauche selon
+ * la valeur de {@link java.awt.Component#getComponentOrientation}. Si un
+ * composant n'a pas assez de place pour se mettre sur la ligne courant, il est
+ * mis sur la ligne suivante et les composants sont redimensionnés pour prendre
+ * le maximum de place disponible sur la ligne. Si le container est dans un
+ * {@link javax.swing.JViewport} (ou {@link javax.swing.JScrollPane}), ce layout
+ * essai de ne jamais faire apparaitre le ScrollBar horizontal.
+ *
+ * <p>
+ * Tous les composants ont la même taille.
+ */
+public class GridFlowLayout implements LayoutManager2 { // GridFlowLayout
+
+ protected java.util.Map<Component, Object> positions = new HashMap<Component, Object>();
+ int hgap;
+ int vgap;
+
+ /**
+ * GridFlowLayout constructor make a GridFlowLayout with default value (1)
+ * for gap
+ */
+ public GridFlowLayout() {
+ this(1, 1);
+ }
+
+ /**
+ * GridFlowLayout constructor
+ *
+ * @param hgap the horizontal gap between two components
+ * @param vgap the vertical gap between two components
+ */
+ public GridFlowLayout(int hgap, int vgap) {
+ this.hgap = hgap;
+ this.vgap = vgap;
+ }
+
+ // ////////////////////////////////////////////////////////////////////
+
+ /**
+ * Gets the horizontal gap between components.
+ *
+ * @return the horizontal gap between components
+ * @see #setHgap
+ */
+ public int getHgap() {
+ return hgap;
+ }
+
+ /**
+ * Sets the horizontal gap between components.
+ *
+ * @param hgap the horizontal gap between components
+ * @see #getHgap
+ */
+ public void setHgap(int hgap) {
+ this.hgap = hgap;
+ }
+
+ /**
+ * Gets the vertical gap between components.
+ *
+ * @return the vertical gap between components
+ * @see #setVgap
+ */
+ public int getVgap() {
+ return vgap;
+ }
+
+ /**
+ * Sets the vertical gap between components.
+ *
+ * @param vgap the vertical gap between components
+ * @see #getVgap
+ */
+ public void setVgap(int vgap) {
+ this.vgap = vgap;
+ }
+
+ // ////////////////////////////////////////////////////////////////////
+
+ /**
+ * Method addLayoutComponent
+ *
+ * @param comp the component to add
+ * @param constraints a constraint which is a Number (position)
+ */
+ @Override
+ public void addLayoutComponent(Component comp, Object constraints) {
+ if (constraints instanceof Number) {
+ positions.put(comp, constraints);
+ }
+ }
+
+ /**
+ * Method setConstraints
+ *
+ * @param comp the compoenent
+ * @param constraints
+ */
+ public void setConstraints(Component comp, Number constraints) {
+ positions.put(comp, constraints);
+ }
+
+ /**
+ * Method getConstraints
+ *
+ * @param comp
+ * @return a number that corresponding to the constraint
+ */
+ public Number getConstraints(Component comp) {
+ return (Number) positions.get(comp);
+ }
+
+ /**
+ * Method getLayoutAlignmentX
+ *
+ * @param target
+ * @return the X layout alignement
+ */
+ @Override
+ public float getLayoutAlignmentX(Container target) {
+ return 0.5f;
+ }
+
+ /**
+ * Method getLayoutAlignmentY
+ *
+ * @param target
+ * @return the Y layout alignement
+ */
+ @Override
+ public float getLayoutAlignmentY(Container target) {
+ return 0.5f;
+ }
+
+ /**
+ * Method invalidateLayout
+ *
+ * @param target
+ */
+ @Override
+ public void invalidateLayout(Container target) {
+ }
+
+ /**
+ * Method addLayoutComponent
+ *
+ * @param name
+ * @param comp
+ */
+ @Override
+ public void addLayoutComponent(String name, Component comp) {
+ }
+
+ /**
+ * Method minimumLayoutSize
+ *
+ * @param parent
+ * @return the minimum dimension of the layout
+ */
+ @Override
+ public Dimension minimumLayoutSize(Container parent) {
+ synchronized (parent.getTreeLock()) {
+ return getMinWidthHeight(parent);
+ }
+ }
+
+ /**
+ * Method preferredLayoutSize
+ *
+ * @param parent
+ * @return the preferred dimension of the layout
+ */
+ @Override
+ public Dimension preferredLayoutSize(Container parent) {
+ synchronized (parent.getTreeLock()) {
+ Dimension result = getMaxWidthHeight(parent);
+
+ Insets insets = parent.getInsets();
+ int nbChild = getComponentVisibleCount(parent);
+ int nbColumn = (int) Math.round(Math.sqrt(nbChild));
+
+ // si un de nom parent est un JViewPort ou dit que l'on
+ // peut etre plus petit que prevu pour eviter le scroll vertical
+ Container container = parent;
+ while (container != null && container.getWidth() != 0) {
+ if (container instanceof JViewport) {
+ nbColumn = (container.getWidth() - insets.left - insets.right)
+ / ((int) result.getWidth() + 2 * hgap);
+ break;
+ }
+ container = container.getParent();
+ }
+
+ if (nbColumn == 0) {
+ nbColumn++;
+ }
+ int nbRow = (int) Math.ceil((double) nbChild / (double) nbColumn);
+ result.width *= nbColumn;
+ result.height *= nbRow;
+
+ result.width += hgap * 2 * nbColumn;
+ result.height += vgap * 2 * nbRow;
+
+ result.width += insets.left + insets.right;
+ result.height += insets.top + insets.bottom;
+
+ return result;
+ }
+ }
+
+ /**
+ * Method maximumLayoutSize
+ *
+ * @param target
+ * @return the max dimension of the layout
+ */
+ @Override
+ public Dimension maximumLayoutSize(Container target) {
+ return new Dimension(Integer.MAX_VALUE, Integer.MAX_VALUE);
+ }
+
+ /**
+ * Method removeLayoutComponent
+ *
+ * @param comp
+ */
+ @Override
+ public void removeLayoutComponent(Component comp) {
+ positions.remove(comp);
+ }
+
+ /**
+ * Method layoutContainer
+ *
+ * @param parent
+ */
+ @Override
+ public void layoutContainer(Container parent) {
+ synchronized (parent.getTreeLock()) {
+ Component components[] = parent.getComponents();
+ if (components.length == 0) {
+ return;
+ }
+
+ // on met les composants dans l'ordre demande par l'utilisateur.
+ components = computeOrder(components);
+
+ Dimension max = getMaxWidthHeight(parent);
+ int w = (int) max.getWidth();
+ int h = (int) max.getHeight();
+
+ Insets insets = parent.getInsets();
+ int parentWidth = parent.getWidth();
+ boolean ltr = parent.getComponentOrientation().isLeftToRight();
+
+ // recalcul de la largeur et du nombre de colonne
+ int nbColumn = (parentWidth - insets.left - insets.right)
+ / (w + 2 * hgap);
+ if (nbColumn == 0) {
+ nbColumn++;
+ }
+ w = (parentWidth - insets.left - insets.right) / nbColumn;
+ w -= 2 * hgap;
+
+ // nombre a soustraire pour commencer les lignes a gauche
+ // ou a droite
+ int ltrNb = 0;
+ int horizontalMargin = insets.left;
+ int verticalMargin = insets.top;
+ if (!ltr) {
+ ltrNb = nbColumn - 1;
+ horizontalMargin = insets.right;
+ }
+
+ int count = 0;
+ for (Component component : components) {
+ if (component.isVisible()) {
+ int column = count % nbColumn;
+ int row = count / nbColumn;
+ component.setBounds(
+ /* on calcul la position */Math.abs(ltrNb - column) * w
+ /* on ajoute la marge */+ horizontalMargin
+ /* on ajoute les intervales */+ (2 * column + 1) * hgap,
+
+ /* on calcul la position */row * h
+ /* on ajoute la marge */+ verticalMargin
+ /* on ajoute les intervales */+ (2 * row + 1) * vgap,
+
+ w, h);
+ count++;
+ }
+ }
+ }
+ }
+
+ // ////////////////////////////////////////////////////////////////////
+
+ /**
+ * Method getComponentVisibleCount
+ *
+ * @param parent
+ * @return an integer that corresponding to the number of visible components
+ */
+ protected int getComponentVisibleCount(Container parent) {
+ int result = 0;
+ Component components[] = parent.getComponents();
+ for (Component component : components) {
+ if (component.isVisible()) {
+ result++;
+ }
+ }
+ return result;
+ }
+
+ /**
+ * Method getMaxWidthHeight
+ *
+ * @param parent
+ * @return the max size
+ */
+ protected Dimension getMaxWidthHeight(Container parent) {
+ Component components[] = parent.getComponents();
+ Dimension result = new Dimension(0, 0);
+ for (Component component : components) {
+ if (component.isVisible()) {
+ Dimension d = component.getPreferredSize();
+ result.width = Math.max(result.width, d.width);
+ result.height = Math.max(result.height, d.height);
+ }
+ }
+ return result;
+ }
+
+ /**
+ * Method getMinWidthHeight
+ *
+ * @param parent
+ * @return the dimension of this layout
+ */
+ protected Dimension getMinWidthHeight(Container parent) {
+ Component components[] = parent.getComponents();
+ Dimension result = new Dimension(0, 0);
+ for (Component component : components) {
+ if (component.isVisible()) {
+ Dimension d = component.getMinimumSize();
+ result.width = Math.max(result.width, d.width);
+ result.height = Math.max(result.height, d.height);
+ }
+ }
+ return result;
+ }
+
+ /**
+ * Method []
+ *
+ * @param components
+ * @return une tablean de composants contenus dans le layout
+ */
+ public Component[] computeOrder(Component[] components) {
+ Component[] result = new Component[components.length];
+
+ // contient les composants dont la contrainte n'est pas bonne
+ // et que l'on place comme s'il n'avait pas de contraint.
+ HashSet<Component> inWait = new HashSet<Component>();
+
+ // on commence par mettre les composants dont on connait la position
+ for (Component comp : positions.keySet()) {
+ Number pos = (Number) positions.get(comp);
+ if (pos != null && -1 < pos.intValue()
+ && pos.intValue() < result.length) {
+ result[pos.intValue()] = comp;
+ } else {
+ inWait.add(comp);
+ }
+ }
+
+ // on place les autres composants
+ int j = 0;
+ for (Component component : components) {
+ // si la contrainte etait fausse, ou qu'il n'y en avait pas
+ if (inWait.contains(component) || !positions.containsKey(component)) {
+ // on cherche la prochaine place vide
+ while (result[j] != null) {
+ j++;
+ }
+ // pour mettre le composant
+ result[j] = component;
+ }
+ }
+ return result;
+ }
+
+ // ////////////////////////////////////////////////////////////////////
+
+ public static void main(String[] args) {
+ javax.swing.JPanel panel = new javax.swing.JPanel(new GridFlowLayout(
+ 10, 5));
+ for (int i = 0; i < 10; i++) {
+ panel.add(new javax.swing.JButton("label " + i), new Integer(i + 3));
+ }
+
+ javax.swing.JFrame frame = new javax.swing.JFrame("Test");
+ frame.getContentPane().add(new javax.swing.JScrollPane(panel));
+ frame.setDefaultCloseOperation(javax.swing.JFrame.EXIT_ON_CLOSE);
+ frame.pack();
+ frame.setVisible(true);
+ }
+} // GridFlowLayout
Property changes on: trunk/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/GridFlowLayout.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
Added: trunk/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/IconFactory.java
===================================================================
--- trunk/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/IconFactory.java (rev 0)
+++ trunk/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/IconFactory.java 2014-02-24 14:27:22 UTC (rev 2800)
@@ -0,0 +1,191 @@
+/*
+ * #%L
+ * JAXX :: Extra Widgets
+ * %%
+ * Copyright (C) 2004 - 2010 CodeLutin
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Lesser Public License for more details.
+ *
+ * You should have received a copy of the GNU General Lesser Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/lgpl-3.0.html>.
+ * #L%
+ */
+
+/* *
+ * IconFactory.java
+ *
+ * Created: Jul 29, 2004
+ *
+ * @author Cédric Pineau <pineau(a)codelutin.com>
+ *
+ * @version $Revision$
+ *
+ * Last update : $Date$ by : $Author$
+ */
+
+package org.nuiton.jaxx.widgets.extra;
+
+import org.apache.commons.collections4.map.AbstractReferenceMap;
+import org.apache.commons.collections4.map.ReferenceIdentityMap;
+import org.nuiton.util.Resource;
+
+import javax.swing.Icon;
+import javax.swing.JButton;
+import javax.swing.JFrame;
+import javax.swing.WindowConstants;
+import java.util.IdentityHashMap;
+import java.util.Map;
+
+public class IconFactory {
+
+ protected static IconFactory _instance = null;
+
+ protected static IconFactory getInstance() {
+ if (_instance == null) {
+ _instance = new IconFactory();
+ }
+ return _instance;
+ }
+
+ public static final String APPEARANCE = "APPEARANCE";
+ public static final String APPOINTMENT = "APPOINTMENT";
+ public static final String ARROW1DOWN = "DOWN";
+ public static final String ARROW1LEFT = "LEFT";
+ public static final String ARROW1RIGHT = "RIGHT";
+ public static final String ARROW1UP = "UP";
+ public static final String ARROW2DOWN = "DOWN";
+ public static final String ARROW2LEFT = "LEFT";
+ public static final String ARROW2RIGHT = "RIGHT";
+ public static final String ARROW2UP = "UP";
+ public static final String ATTACH = "ATTACH";
+ public static final String CANCEL = "CANCEL";
+ public static final String CLOSE = "CLOSE";
+ public static final String FIND = "FIND";
+ public static final String FONTS = "FONTS";
+ public static final String FULLSCREEN = "FULLSCREEN";
+ public static final String HELP = "HELP";
+ public static final String IDEA = "IDEA";
+ public static final String INFO = "INFO";
+ public static final String LINK = "LINK";
+ public static final String MAIL = "MAIL";
+ public static final String MAILGET = "MAILGET";
+ public static final String MAILNEW = "MAILNEW";
+ public static final String MAILSEND = "MAILSEND";
+ public static final String NEW = "NEW";
+ public static final String NOFULLSCREEN = "NOFULLSCREEN";
+ public static final String OK = "OK";
+ public static final String OPEN = "OPEN";
+ public static final String PRINT = "PRINT";
+ public static final String QUIT = "QUIT";
+ public static final String REDO = "REDO";
+ public static final String RESET = "RESET";
+ public static final String RUN = "RUN";
+ public static final String SAVE = "SAVE";
+ public static final String SAVEAS = "SAVEAS";
+ public static final String SPELLCHECK = "SPELLCHECK";
+ public static final String STOP = "STOP";
+ public static final String TIME = "TIME";
+ public static final String UNDO = "UNDO";
+
+ protected Map<Object, String> iconURLs;
+
+ protected IconFactory() {
+ iconURLs = new IdentityHashMap<Object, String>();
+
+ iconURLs.put(APPEARANCE, "/22x22/appearance.png");
+ iconURLs.put(APPOINTMENT, "/22x22/appointment.png");
+ iconURLs.put(ARROW1DOWN, "/22x22/arrow1Down.png");
+ iconURLs.put(ARROW1LEFT, "/22x22/arrow1Left.png");
+ iconURLs.put(ARROW1RIGHT, "/22x22/arrow1Right.png");
+ iconURLs.put(ARROW1UP, "/22x22/arrow1Up.png");
+ iconURLs.put(ARROW2DOWN, "/22x22/arrow2Down.png");
+ iconURLs.put(ARROW2LEFT, "/22x22/arrow2Left.png");
+ iconURLs.put(ARROW2RIGHT, "/22x22/arrow2Right.png");
+ iconURLs.put(ARROW2UP, "/22x22/arrow2Up.png");
+ iconURLs.put(ATTACH, "/22x22/attach.png");
+ iconURLs.put(CANCEL, "/22x22/cancel.png");
+ iconURLs.put(CLOSE, "/22x22/close.png");
+ iconURLs.put(FIND, "/22x22/find.png");
+ iconURLs.put(FONTS, "/22x22/fonts.png");
+ iconURLs.put(FULLSCREEN, "/22x22/fullscreen.png");
+ iconURLs.put(HELP, "/22x22/help.png");
+ iconURLs.put(IDEA, "/22x22/idea.png");
+ iconURLs.put(INFO, "/22x22/info.png");
+ iconURLs.put(LINK, "/22x22/redo.png");
+ iconURLs.put(MAIL, "/22x22/mail.png");
+ iconURLs.put(MAILGET, "/22x22/mailGet.png");
+ iconURLs.put(MAILNEW, "/22x22/mailNew.png");
+ iconURLs.put(MAILSEND, "/22x22/mailSend.png");
+ iconURLs.put(NEW, "/22x22/new.png");
+ iconURLs.put(NOFULLSCREEN, "/22x22/nofullscreen.png");
+ iconURLs.put(OK, "/22x22/ok.png");
+ iconURLs.put(OPEN, "/22x22/open.png");
+ iconURLs.put(PRINT, "/22x22/print.png");
+ iconURLs.put(QUIT, "/22x22/close.png");
+ iconURLs.put(REDO, "/22x22/redo.png");
+ iconURLs.put(RESET, "/22x22/reset.png");
+ iconURLs.put(RUN, "/22x22/run.png");
+ iconURLs.put(SAVE, "/22x22/save.png");
+ iconURLs.put(SAVEAS, "/22x22/saveAs.png");
+ iconURLs.put(SPELLCHECK, "/22x22/spellcheck.png");
+ iconURLs.put(STOP, "/22x22/stop.png");
+ iconURLs.put(TIME, "/22x22/time.png");
+ iconURLs.put(UNDO, "/22x22/undo.png");
+ }
+
+ static protected ReferenceIdentityMap<Object, Icon> cache = new ReferenceIdentityMap<Object, Icon>(
+ AbstractReferenceMap.ReferenceStrength.HARD, AbstractReferenceMap.ReferenceStrength.SOFT);
+
+ /**
+ * Retourne l'icone demandé.
+ *
+ * @param iconId l'identifiant de l'icon, il doit exister, par exemple
+ * IconFactory.getIcon(IconFactory.UNDO) et non pas
+ * IconFactory.getIcon("UNDO")
+ * @return null si l'icon n'a pas public etre retrouve alors qu'il devrait
+ * exister.
+ * @throws IllegalArgumentException si l'idendifiant de l'icon n'existe pas
+ */
+ static public Icon getIcon(Object iconId) {
+ Icon result = null;
+ if (iconId != null) {
+ if (getInstance().iconURLs.containsKey(iconId)) {
+ result = cache.get(iconId);
+ if (result == null) {
+ result = Resource.getIcon(getInstance().iconURLs.get(iconId));
+ if (result != null) {
+ cache.put(iconId, result);
+ }
+ }
+ } else {
+ throw new IllegalArgumentException("Icon id isn't valid");
+ }
+ }
+ return result;
+ }
+
+ public static void main(String... args) {
+ JFrame frame = new JFrame();
+ frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
+ frame.getContentPane().setLayout(new GridFlowLayout());
+
+ for (Object id : getInstance().iconURLs.keySet()) {
+ JButton button = new JButton();
+ button.setText(id.toString());
+ button.setIcon(IconFactory.getIcon(id));
+ frame.getContentPane().add(button);
+ }
+ frame.pack();
+ frame.setVisible(true);
+ }
+
+}
Property changes on: trunk/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/IconFactory.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
Added: trunk/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/JComboBoxAutoCompletionKit.java
===================================================================
--- trunk/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/JComboBoxAutoCompletionKit.java (rev 0)
+++ trunk/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/JComboBoxAutoCompletionKit.java 2014-02-24 14:27:22 UTC (rev 2800)
@@ -0,0 +1,303 @@
+/*
+ * #%L
+ * JAXX :: Extra Widgets
+ * %%
+ * Copyright (C) 2004 - 2010 CodeLutin
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Lesser Public License for more details.
+ *
+ * You should have received a copy of the GNU General Lesser Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/lgpl-3.0.html>.
+ * #L%
+ */
+
+/* *
+ * JComboBoxAutoCompletionKit.java
+ *
+ * Created: Nov 12, 2004
+ *
+ * @author Cédric Pineau <pineau(a)codelutin.com>
+ * @version $Revision$
+ *
+ * Last update : $Date$
+ * by : $Author$
+ */
+
+package org.nuiton.jaxx.widgets.extra;
+
+import java.awt.Component;
+
+import javax.swing.ComboBoxModel;
+import javax.swing.DefaultListCellRenderer;
+import javax.swing.JComboBox;
+import javax.swing.JFrame;
+import javax.swing.JLabel;
+import javax.swing.JList;
+import javax.swing.ListCellRenderer;
+import javax.swing.event.ListDataEvent;
+import javax.swing.event.ListDataListener;
+
+/**
+ *
+ */
+public class JComboBoxAutoCompletionKit {
+
+ public static void main(String[] args) {
+ JFrame frame = new JFrame();
+ String[] petStrings = { "Bird", "Cat", "Cot", "Dog", "Dog", "Dog1",
+ "Dog2", "Dog3", "Dog4", "Dog5", "Dog6", "Dog7", "Dog", "Dog8",
+ "Dog9", "Dog10", "Rabbit", "Pig" };
+ JComboBox combo = new JComboBox(petStrings);
+ combo.setRenderer(new TestCellRenderer());
+ JComboBoxAutoCompletionKit.setAutoCompleted(combo);
+ frame.getContentPane().add(combo);
+ frame.setSize(800, 50);
+ frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
+ frame.setVisible(true);
+ }
+
+ public static void setAutoCompleted(JComboBox comboBox) {
+ AutoCompletionManager autoCompletionManager = new AutoCompletionManager(
+ comboBox);
+ AutoCompletionModelListener autoCompletionModelListener = new AutoCompletionModelListener(
+ autoCompletionManager);
+ AutoCompletionCellRenderer autoCompletionCellRenderer = new AutoCompletionCellRenderer(
+ autoCompletionManager, comboBox.getRenderer());
+ comboBox.setKeySelectionManager(autoCompletionManager);
+ comboBox.getModel().addListDataListener(autoCompletionModelListener);
+ comboBox.setRenderer(autoCompletionCellRenderer);
+ }
+
+ private static class AutoCompletionManager implements
+ JComboBox.KeySelectionManager {
+
+ private static String EMPTY_PREFIX = "";
+
+ private static int NO_SELECTION = -1;
+
+ private JComboBox _comboBox = null;
+
+ private int _currentSelection = NO_SELECTION;
+
+ private String _prefix = EMPTY_PREFIX;
+
+ public AutoCompletionManager(JComboBox comboBox) {
+ setComboBox(comboBox);
+ }
+
+ @Override
+ public int selectionForKey(char key, ComboBoxModel model) {
+ // TODO change allowed chars to include *, -, ...
+ System.out.println("" + Integer.toString(key)); // TODO remove this
+ if (((key == 8) && (getPrefix().length() > 0))
+ || (Character.isLetterOrDigit(key))) {
+
+ // Build the new prefix and set it
+ String prefix = getPrefix();
+ if ((key == 8) && (prefix.length() > 0)) {
+ prefix = prefix.substring(0, prefix.length() - 1);
+ } else {
+ prefix = getPrefix() + key;
+ }
+ setPrefix(prefix);
+
+ // Look for the first model item with given prefix
+ boolean prefixedItemFound = false;
+ for (int i = 0; i < model.getSize(); i++) {
+ Object element = model.getElementAt(i);
+ if (element.toString().startsWith(prefix)) {
+ // Found it, this is the newly selected item
+ setCurrentSelection(i);
+ prefixedItemFound = true;
+ break;
+ }
+ }
+
+ // Reset AutoCompletion if prefix can't be found
+ if (!prefixedItemFound) {
+ reset();
+ }
+ // Ensure popup is shown
+ getComboBox().showPopup();
+ // Force a repaint
+ model.setSelectedItem(null);
+ }
+
+ return getCurrentSelection();
+ }
+
+ public void reset() {
+ setPrefix(EMPTY_PREFIX);
+ setCurrentSelection(NO_SELECTION);
+ }
+
+ /**
+ * Called by the model listener when model has changed.
+ */
+ public void modelChanged() {
+ // reset();
+ }
+
+ protected JComboBox getComboBox() {
+ return _comboBox;
+ }
+
+ protected void setComboBox(JComboBox comboBox) {
+ _comboBox = comboBox;
+ }
+
+ protected int getCurrentSelection() {
+ return _currentSelection;
+ }
+
+ protected void setCurrentSelection(int currentSelection) {
+ _currentSelection = currentSelection;
+ }
+
+ protected String getPrefix() {
+ return _prefix;
+ }
+
+ protected void setPrefix(String prefix) {
+ this._prefix = prefix;
+ }
+ }
+
+ private static class TestCellRenderer extends DefaultListCellRenderer {
+
+ private static final long serialVersionUID = 1L;
+
+ @Override
+ public Component getListCellRendererComponent(JList list, Object value,
+ int index, boolean isSelected, boolean cellHasFocus) {
+ // Ask to default renderer to do the job for us
+ Component component = super.getListCellRendererComponent(list,
+ value, index, isSelected, cellHasFocus);
+
+ if (value != null) {
+ // Can we trick the rendered thing to reflect current prefix ?
+ if (component instanceof JLabel) {
+ // Everything's fine. Let's have a closer look.
+ JLabel label = (JLabel) component;
+ String text = label.getText();
+ text = "J" + text;
+ label.setText(text);
+ }
+ }
+
+ return component;
+ }
+
+ }
+
+ private static class AutoCompletionCellRenderer extends
+ DefaultListCellRenderer {
+
+ private static final long serialVersionUID = 1L;
+
+ private ListCellRenderer _existingRenderer = null;
+ private AutoCompletionManager _manager = null;
+
+ public AutoCompletionCellRenderer(AutoCompletionManager manager,
+ ListCellRenderer existingRenderer) {
+ setManager(manager);
+ setExistingRenderer(existingRenderer);
+ }
+
+ @Override
+ public Component getListCellRendererComponent(JList list, Object value,
+ int index, boolean isSelected, boolean cellHasFocus) {
+ // Ask to default renderer to do the job for us
+ Component component = getExistingRenderer()
+ .getListCellRendererComponent(list, value, index,
+ isSelected, cellHasFocus);
+
+ if (value != null) {
+ // Can we trick the rendered thing to reflect current prefix ?
+ String prefix = getManager().getPrefix();
+ if ((prefix != null) && (component instanceof JLabel)) {
+ // Everything's fine. Let's have a closer look.
+ JLabel label = (JLabel) component;
+ if (value.toString().startsWith(prefix)) {
+ // We're going trick the label a little bit
+ String text = label.getText();
+ text = "<html><font color=#ffffdd>" + prefix
+ + "</font>" + text.substring(prefix.length())
+ + "</html>";
+ label.setText(text);
+ }
+ }
+ }
+
+ return component;
+ }
+
+ protected AutoCompletionManager getManager() {
+ return this._manager;
+ }
+
+ protected void setManager(AutoCompletionManager manager) {
+ this._manager = manager;
+ }
+
+ /**
+ * @return Returns the _existingRenderer.
+ */
+ protected ListCellRenderer getExistingRenderer() {
+ return this._existingRenderer;
+ }
+
+ /**
+ * @param renderer The _existingRenderer to set.
+ */
+ protected void setExistingRenderer(ListCellRenderer existingRenderer) {
+ this._existingRenderer = existingRenderer;
+ }
+ }
+
+ private static class AutoCompletionModelListener implements
+ ListDataListener {
+
+ private AutoCompletionManager _manager = null;
+
+ public AutoCompletionModelListener(AutoCompletionManager manager) {
+ setManager(manager);
+ }
+
+ @Override
+ public void intervalAdded(ListDataEvent e) {
+ // To be optimized...
+ getManager().modelChanged();
+ }
+
+ @Override
+ public void intervalRemoved(ListDataEvent e) {
+ // To be optimized...
+ getManager().modelChanged();
+ }
+
+ @Override
+ public void contentsChanged(ListDataEvent e) {
+ // To be optimized...
+ getManager().modelChanged();
+ }
+
+ protected AutoCompletionManager getManager() {
+ return _manager;
+ }
+
+ protected void setManager(AutoCompletionManager manager) {
+ this._manager = manager;
+ }
+ }
+
+}
Property changes on: trunk/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/JComboBoxAutoCompletionKit.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
Added: trunk/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/MessageDialog.java
===================================================================
--- trunk/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/MessageDialog.java (rev 0)
+++ trunk/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/MessageDialog.java 2014-02-24 14:27:22 UTC (rev 2800)
@@ -0,0 +1,125 @@
+/*
+ * #%L
+ * JAXX :: Extra Widgets
+ * %%
+ * Copyright (C) 2004 - 2010 CodeLutin
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Lesser Public License for more details.
+ *
+ * You should have received a copy of the GNU General Lesser Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/lgpl-3.0.html>.
+ * #L%
+ */
+
+/* *
+ * MessageDialog.java
+ *
+ * Created: 6 avr. 2004
+ *
+ * @author Benjamin Poussin <poussin(a)codelutin.com>
+ * Copyright Code Lutin
+ * @version $Revision$
+ *
+ * Mise a jour: $Date$
+ * par : $Author$
+ */
+
+package org.nuiton.jaxx.widgets.extra;
+
+import java.io.File;
+
+import javax.swing.JFileChooser;
+
+import org.nuiton.i18n.I18n;
+
+public class MessageDialog { // MessageDialog
+
+// public static void error(String title, String message, Throwable eee) {
+// JOptionPane.showMessageDialog(null, message + "\n"
+// + ExceptionUtil.stackTrace(eee), title,
+// JOptionPane.ERROR_MESSAGE);
+// }
+
+ static protected File currentDirectory = new File(".");
+
+ static public File getLastChoice() {
+ return currentDirectory;
+ }
+
+ static public void setCurrentDirectory(String dir) {
+ currentDirectory = new File(dir);
+ }
+
+ /**
+ * @return le nom du fichier entre dans la boite de dialogue. Si le bouton
+ * annuler est utilisé, ou qu'il y a une erreur retourne null.
+ */
+ static public String getFile() {
+ return getFile(I18n.t("nuitonwidgets.message.file"));
+ }
+
+ static public String getFile(String buttonText) {
+ try {
+ JFileChooser chooser = new JFileChooser(currentDirectory);
+ chooser.setDialogType(JFileChooser.CUSTOM_DIALOG);
+ chooser.setApproveButtonText(buttonText);
+ chooser.setFileSelectionMode(JFileChooser.FILES_ONLY);
+ int returnVal = chooser.showDialog(null, null);
+ if (returnVal == JFileChooser.APPROVE_OPTION) {
+ File theFile = chooser.getSelectedFile();
+ if (theFile != null) {
+ currentDirectory = theFile;
+ return theFile.getAbsolutePath();
+ }
+ } else {
+ return null;
+ }
+ } catch (Exception e) {
+ java.util.logging.Logger.getLogger(
+ "MessageDialog.getFile").severe(
+ "Erreur:");
+ }
+ return null;
+ }
+
+ /**
+ * @return le nom du repertoire entre dans la boite de dialogue. Si le
+ * bouton annuler est utilisé, ou qu'il y a une erreur retourne null.
+ */
+ static public String getDirectory() {
+ try {
+ JFileChooser chooser = new JFileChooser(currentDirectory);
+ chooser.setDialogType(JFileChooser.CUSTOM_DIALOG);
+ chooser.setApproveButtonText(I18n.t("nuitonwidgets.message.folder"));
+ chooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
+ int returnVal = chooser.showDialog(null, null);
+ if (returnVal == JFileChooser.APPROVE_OPTION) {
+ File theFile = chooser.getSelectedFile();
+ if (theFile != null) {
+ currentDirectory = theFile;
+ if (theFile.isDirectory()) {
+ return theFile.getAbsolutePath();
+ }
+ }
+ } else {
+ return null;
+ }
+ } catch (Exception e) {
+ java.util.logging.Logger.getLogger(
+ "MessageDialog.getDirectory").severe(
+ "Erreur:");
+ }
+ return null;
+ }
+
+} // MessageDialog
+
Property changes on: trunk/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/MessageDialog.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
Added: trunk/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/SimpleInternalFrame.java
===================================================================
--- trunk/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/SimpleInternalFrame.java (rev 0)
+++ trunk/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/SimpleInternalFrame.java 2014-02-24 14:27:22 UTC (rev 2800)
@@ -0,0 +1,507 @@
+/*
+ * #%L
+ * JAXX :: Extra Widgets
+ * %%
+ * Copyright (C) 2004 - 2010 CodeLutin
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Lesser Public License for more details.
+ *
+ * You should have received a copy of the GNU General Lesser Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/lgpl-3.0.html>.
+ * #L%
+ */
+/*
+ * Copyright (c) 2003 JGoodies Karsten Lentzsch. All Rights Reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * o Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ *
+ * o Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * o Neither the name of JGoodies Karsten Lentzsch nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+ * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+package org.nuiton.jaxx.widgets.extra;
+
+import java.awt.BorderLayout;
+import java.awt.Color;
+import java.awt.Component;
+import java.awt.GradientPaint;
+import java.awt.Graphics;
+import java.awt.Graphics2D;
+import java.awt.Insets;
+import java.awt.LayoutManager;
+import java.awt.Paint;
+
+import javax.swing.BorderFactory;
+import javax.swing.Icon;
+import javax.swing.JComponent;
+import javax.swing.JLabel;
+import javax.swing.JPanel;
+import javax.swing.JToolBar;
+import javax.swing.SwingConstants;
+import javax.swing.UIManager;
+import javax.swing.border.AbstractBorder;
+
+/**
+ * A JPanel subclass that has a drop shadow border and that provides a header
+ * with icon, title and tool bar. * This class can be used to replace the
+ * JInternalFrame, * for use outside of a JDesktopPane. * The
+ * SimpleInternalFrame is less flexible but often * more usable; it avoids
+ * overlapping windows and scales well * up to IDE size. * Several customers
+ * have reported that they and their clients feel * much better with both the
+ * appearance and the UI feel. * The SimpleInternalFrame provides the following
+ * bound properties: * frameIcon, title, toolBar, content, selected. * By
+ * default the SimpleInternalFrame is in selected state. * If you don't do
+ * anything, multiple simple internal frames will * be displayed as selected. *
+ * *
+ *
+ * @author Karsten Lentzsch *
+ * @version $Revision$ * *
+ * @see javax.swing.JInternalFrame *
+ * @see javax.swing.JDesktopPane
+ */
+
+public class SimpleInternalFrame extends JPanel {
+
+ private static final long serialVersionUID = 1L;
+
+ private JLabel titleLabel = null;
+ private GradientPanel gradientPanel = null;
+ private JPanel headerPanel = null;
+ private boolean isSelected;
+
+ // Instance Creation ****************************************************
+
+ public SimpleInternalFrame() {
+ this(null, null, null, null);
+ }
+
+ /**
+ * Constructs a SimpleInternalFrame with the specified title.
+ *
+ * @param title the initial title
+ */
+ public SimpleInternalFrame(String title) {
+ this(null, title, null, null);
+ }
+
+ /**
+ * Constructs a SimpleInternalFrame with the specified icon, and title.
+ *
+ * @param icon the initial icon
+ * @param title the initial title
+ */
+ public SimpleInternalFrame(Icon icon, String title) {
+ this(icon, title, null, null);
+ }
+
+ /**
+ * Constructs a SimpleInternalFrame with the specified title, tool bar, and
+ * content panel.
+ *
+ * @param title the initial title
+ * @param bar the initial tool bar
+ * @param content the initial content pane
+ */
+ public SimpleInternalFrame(String title, JToolBar bar, JComponent content) {
+ this(null, title, bar, content);
+ }
+
+ /**
+ * Constructs a SimpleInternalFrame with the specified icon, title, tool
+ * bar, and content panel.
+ *
+ * @param icon the initial icon
+ * @param title the initial title
+ * @param bar the initial tool bar
+ * @param content the initial content pane
+ */
+ public SimpleInternalFrame(Icon icon, String title, JToolBar bar,
+ JComponent content) {
+ super(new BorderLayout());
+ this.isSelected = false;
+ this.titleLabel = new JLabel(title, icon, SwingConstants.LEADING);
+ JPanel top = buildHeader(titleLabel, bar);
+ if (title != null) {
+ add(top, BorderLayout.NORTH);
+ } else {
+ // TODO add(new org.jext.gui.VoidComponent(), BorderLayout.NORTH);
+ }
+ if (content != null) {
+ setContent(content);
+ }
+ setBorder(new ShadowBorder());
+ setSelected(true);
+ updateHeader();
+ }
+
+ // Public API ***********************************************************
+
+ /**
+ * Returns the frame's icon.
+ *
+ * @return the frame's icon
+ */
+ public Icon getFrameIcon() {
+ return titleLabel.getIcon();
+ }
+
+ /**
+ * Sets a new frame icon.
+ *
+ * @param newIcon the icon to be set
+ */
+ public void setFrameIcon(Icon newIcon) {
+ Icon oldIcon = getFrameIcon();
+ titleLabel.setIcon(newIcon);
+ firePropertyChange("frameIcon", oldIcon, newIcon);
+ }
+
+ /**
+ * Returns the frame's title text.
+ *
+ * @return String the current title text
+ */
+ public String getTitle() {
+ return titleLabel.getText();
+ }
+
+ /**
+ * Sets a new title text.
+ *
+ * @param newText the title text tp be set
+ */
+ public void setTitle(String newText) {
+ String oldText = getTitle();
+ titleLabel.setText(newText);
+ firePropertyChange("title", oldText, newText);
+ }
+
+ /**
+ * Returns the current toolbar, null if none has been set before.
+ *
+ * @return the current toolbar - if any
+ */
+ public JToolBar getToolBar() {
+ return headerPanel.getComponentCount() > 1 ? (JToolBar) headerPanel
+ .getComponent(1) : null;
+ }
+
+ /**
+ * Sets a new tool bar in the header.
+ *
+ * @param newToolBar the tool bar to be set in the header
+ */
+ public void setToolBar(JToolBar newToolBar) {
+ JToolBar oldToolBar = getToolBar();
+ if (oldToolBar == newToolBar) {
+ return;
+ }
+ if (oldToolBar != null) {
+ headerPanel.remove(oldToolBar);
+ }
+ if (newToolBar != null) {
+ newToolBar.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
+ headerPanel.add(newToolBar, BorderLayout.EAST);
+ }
+ updateHeader();
+ firePropertyChange("toolBar", oldToolBar, newToolBar);
+ }
+
+ /**
+ * Returns the content - null, if none has been set.
+ *
+ * @return the current content
+ */
+ public Component getContent() {
+ return hasContent() ? getComponent(1) : null;
+ }
+
+ /**
+ * Sets a new panel content; replaces any existing content, if existing.
+ *
+ * @param newContent the panel's new content
+ */
+ public void setContent(Component newContent) {
+ Component oldContent = getContent();
+ if (hasContent()) {
+ remove(oldContent);
+ }
+ add(newContent, BorderLayout.CENTER);
+ firePropertyChange("content", oldContent, newContent);
+ }
+
+ /**
+ * Answers if the panel is currently selected (or in other words active) or
+ * not. In the selected state, the header background will be rendered
+ * differently.
+ *
+ * @return boolean a boolean, where true means the frame is selected
+ * (currently active) and false means it is not
+ */
+ public boolean isSelected() {
+ return isSelected;
+ }
+
+ /**
+ * This panel draws its title bar differently if it is selected, which may
+ * be used to indicate to the user that this panel has the focus, or should
+ * get more attention than other simple internal frames.
+ *
+ * @param newValue a boolean, where true means the frame is selected
+ * (currently active) and false means it is not
+ */
+ public void setSelected(boolean newValue) {
+ boolean oldValue = isSelected();
+ isSelected = newValue;
+ updateHeader();
+ firePropertyChange("selected", oldValue, newValue);
+ }
+
+ /*
+ * public void paintComponent(Graphics g) { super.paintComponent(g); if
+ * (!isOpaque()) { return; } Color control = UIManager.getColor("control");
+ * int width = getWidth(); int height = getHeight();
+ *
+ * Graphics2D g2 = (Graphics2D) g;
+ *
+ * Paint storedPaint = g2.getPaint(); g2.setPaint(new GradientPaint(0, 0,
+ * Color.white, width, height, control)); g2.fillRect(0, 0, width, height);
+ * g2.setPaint(storedPaint); }
+ */
+ // Building *************************************************************
+ /**
+ * Creates and answers the header panel, that consists of: an icon, a title
+ * label, a tool bar, and a gradient background.
+ *
+ * @param label the label to paint the icon and text
+ * @param bar the panel's tool bar
+ * @return the panel's built header area
+ */
+ private JPanel buildHeader(JLabel label, JToolBar bar) {
+ gradientPanel = new GradientPanel(new BorderLayout(),
+ getHeaderBackground());
+ label.setOpaque(false);
+
+ gradientPanel.add(label, BorderLayout.WEST);
+ gradientPanel.setBorder(BorderFactory.createEmptyBorder(3, 4, 3, 1));
+
+ headerPanel = new JPanel(new BorderLayout());
+ headerPanel.add(gradientPanel, BorderLayout.CENTER);
+ setToolBar(bar);
+ headerPanel.setBorder(new RaisedHeaderBorder());
+ headerPanel.setOpaque(false);
+ return headerPanel;
+ }
+
+ /**
+ * Updates the header.
+ */
+ private void updateHeader() {
+ if (gradientPanel == null) {
+ return;
+ }
+ gradientPanel.setBackground(getHeaderBackground());
+ gradientPanel.setOpaque(isSelected());
+ titleLabel.setForeground(getTextForeground(isSelected()));
+ headerPanel.repaint();
+ }
+
+ /**
+ * Updates the UI. In addition to the superclass behavior, we need to update
+ * the header component.
+ */
+ @Override
+ public void updateUI() {
+ super.updateUI();
+ if (titleLabel != null) {
+ updateHeader();
+ }
+ }
+
+ // Helper Code **********************************************************
+
+ /**
+ * Checks and answers if the panel has a content component set.
+ *
+ * @return true if the panel has a content, false if it's empty
+ */
+ private boolean hasContent() {
+ return getComponentCount() > 1;
+ }
+
+ /**
+ * Determines and answers the header's text foreground color. Tries to
+ * lookup a special color from the L&F. In case it is absent, it uses the
+ * standard internal frame forground.
+ *
+ * @param selected true to lookup the active color, false for the inactive
+ * @return the color of the foreground text
+ */
+ protected Color getTextForeground(boolean selected) {
+ // if (selected) return Color.BLUE;
+ Color c = UIManager
+ .getColor(selected ? "SimpleInternalFrame.activeTitleForeground"
+ : "SimpleInternalFrame.inactiveTitleForeground");
+ if (c != null) {
+ return c;
+ }
+ return UIManager
+ .getColor(selected ? "InternalFrame.activeTitleForeground"
+ : "Label.foreground");
+
+ }
+
+ /**
+ * Determines and answers the header's background color. Tries to lookup a
+ * special color from the L&F. In case it is absent, it uses the standard
+ * internal frame background.
+ *
+ * @return the color of the header's background
+ */
+ protected Color getHeaderBackground() {
+ Color c = UIManager
+ .getColor("SimpleInternalFrame.activeTitleBackground");
+ if (c != null) {
+ return c;
+ }
+ // if (LookUtils.IS_LAF_WINDOWS_XP_ENABLED)
+ c = UIManager.getColor("InternalFrame.activeTitleGradient");
+ return c != null ? c : UIManager
+ .getColor("InternalFrame.activeTitleBackground");
+ }
+
+ // Helper Classes *******************************************************
+
+ // A custom border for the raised header pseudo 3D effect.
+ private static class RaisedHeaderBorder extends AbstractBorder {
+
+ private static final long serialVersionUID = 1L;
+
+ private static final Insets INSETS = new Insets(1, 1, 1, 0);
+
+ @Override
+ public Insets getBorderInsets(Component c) {
+ return INSETS;
+ }
+
+ @Override
+ public void paintBorder(Component c, Graphics g, int x, int y, int w,
+ int h) {
+
+ g.translate(x, y);
+ g.setColor(UIManager.getColor("controlLtHighlight"));
+ g.fillRect(0, 0, w, 1);
+ g.fillRect(0, 1, 1, h - 1);
+ g.setColor(UIManager.getColor("controlShadow"));
+ g.fillRect(0, h - 1, w, 1);
+ g.translate(-x, -y);
+ }
+ }
+
+ // A custom border that has a shadow on the right and lower sides.
+ private static class ShadowBorder extends AbstractBorder {
+
+ private static final long serialVersionUID = 1L;
+
+ private static final Insets INSETS = new Insets(1, 1, 3, 3);
+
+ @Override
+ public Insets getBorderInsets(Component c) {
+ return INSETS;
+ }
+
+ @Override
+ public void paintBorder(Component c, Graphics g, int x, int y, int w,
+ int h) {
+
+ Color shadow = UIManager.getColor("controlShadow");
+ if (shadow == null) {
+ shadow = Color.GRAY;
+ }
+ Color lightShadow = new Color(shadow.getRed(), shadow.getGreen(),
+ shadow.getBlue(), 170);
+ Color lighterShadow = new Color(shadow.getRed(), shadow.getGreen(),
+ shadow.getBlue(), 70);
+ g.translate(x, y);
+
+ g.setColor(shadow);
+ g.fillRect(0, 0, w - 3, 1);
+ g.fillRect(0, 0, 1, h - 3);
+ g.fillRect(w - 3, 1, 1, h - 3);
+ g.fillRect(1, h - 3, w - 3, 1);
+ // Shadow line 1
+ g.setColor(lightShadow);
+ g.fillRect(w - 3, 0, 1, 1);
+ g.fillRect(0, h - 3, 1, 1);
+ g.fillRect(w - 2, 1, 1, h - 3);
+ g.fillRect(1, h - 2, w - 3, 1);
+ // Shadow line2
+ g.setColor(lighterShadow);
+ g.fillRect(w - 2, 0, 1, 1);
+ g.fillRect(0, h - 2, 1, 1);
+ g.fillRect(w - 2, h - 2, 1, 1);
+ g.fillRect(w - 1, 1, 1, h - 2);
+ g.fillRect(1, h - 1, w - 2, 1);
+ g.translate(-x, -y);
+ }
+ }
+
+ // A panel with a horizontal gradient background.
+ private static class GradientPanel extends JPanel {
+
+ private static final long serialVersionUID = 1L;
+
+ private GradientPanel(LayoutManager lm, Color background) {
+ super(lm);
+ setBackground(background);
+ }
+
+ @Override
+ public void paintComponent(Graphics g) {
+ super.paintComponent(g);
+ if (!isOpaque()) {
+ return;
+ }
+ Color control = UIManager.getColor("control");
+ int width = getWidth();
+ int height = getHeight();
+
+ Graphics2D g2 = (Graphics2D) g;
+ Paint storedPaint = g2.getPaint();
+ g2.setPaint(new GradientPaint(0, 0, getBackground(), width, 0,
+ control));
+ g2.fillRect(0, 0, width, height);
+ g2.setPaint(storedPaint);
+ }
+ }
+}
Property changes on: trunk/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/SimpleInternalFrame.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
Added: trunk/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/SplashScreen.java
===================================================================
--- trunk/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/SplashScreen.java (rev 0)
+++ trunk/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/SplashScreen.java 2014-02-24 14:27:22 UTC (rev 2800)
@@ -0,0 +1,467 @@
+/*
+ * #%L
+ * JAXX :: Extra Widgets
+ * %%
+ * Copyright (C) 2004 - 2010 CodeLutin
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Lesser Public License for more details.
+ *
+ * You should have received a copy of the GNU General Lesser Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/lgpl-3.0.html>.
+ * #L%
+ */
+
+/* *
+ * SplashScreen.java
+ *
+ * Created: Jul 29, 2004
+ *
+ * @author Cédric Pineau <pineau(a)codelutin.com>
+ * @version $Revision$
+ *
+ * Last update : $Date$
+ * by : $Author$
+ */
+
+package org.nuiton.jaxx.widgets.extra;
+
+import java.awt.AlphaComposite;
+import java.awt.Composite;
+import java.awt.Dimension;
+import java.awt.Graphics;
+import java.awt.Graphics2D;
+import java.awt.GridBagConstraints;
+import java.awt.Image;
+import java.awt.Toolkit;
+import java.util.Timer;
+import java.util.TimerTask;
+
+import javax.swing.ImageIcon;
+import javax.swing.JFrame;
+
+/**
+ *
+ */
+public class SplashScreen extends JFrame {
+
+ private static final long serialVersionUID=1L;
+
+ public final static long DEFAULT_DURATION = 3000;
+
+ public final static long DEFAULT_REMANENCE = 5000;
+
+ public final static int DEFAULT_STEPPING_LEFT_INSET = 100;
+
+ public final static int DEFAULT_STEPPING_RIGHT_INSET = 100;
+
+ public final static int DEFAULT_STEPPING_BOTTOM_INSET = 100;
+
+ public final static Composite defaultComposite = AlphaComposite
+ .getInstance(AlphaComposite.SRC_OVER, 0.7f);
+
+ protected long remanence = DEFAULT_REMANENCE;
+
+ protected Image splashImage;
+
+ protected String applicationTitle;
+
+ protected long estimatedDuration;
+
+ protected String[] stepDescriptions;
+
+ protected Image[] stepImages;
+
+ protected int currentStep = -1;
+
+ protected int steppingLeftInset = DEFAULT_STEPPING_LEFT_INSET;
+
+ protected int steppingRightInset = DEFAULT_STEPPING_RIGHT_INSET;
+
+ protected int steppingBottomInset = DEFAULT_STEPPING_BOTTOM_INSET;
+
+ protected Image currentImage;
+
+ protected Composite currentComposite;
+
+ protected ImageAnimator imageAnimator;
+
+ public SplashScreen(String applicationTitle, String splashImagePath) {
+ this(applicationTitle, splashImagePath, DEFAULT_DURATION);
+ }
+
+ public SplashScreen(String applicationTitle, String splashImagePath,
+ long estimatedDuration) {
+ this(applicationTitle, splashImagePath, estimatedDuration, null);
+ }
+
+ public SplashScreen(String applicationTitle, String splashImagePath,
+ long estimatedDuration, String[] stepDescriptions) {
+ this(applicationTitle, splashImagePath, estimatedDuration,
+ stepDescriptions, null);
+ }
+
+ public SplashScreen(String applicationTitle, String splashImagePath,
+ String[] stepDescriptions) {
+ this(applicationTitle, splashImagePath, DEFAULT_DURATION,
+ stepDescriptions, null);
+ }
+
+ public SplashScreen(String applicationTitle, String splashImagePath,
+ String[] stepDescriptions, String[] stepImagesPaths) {
+ this(applicationTitle, splashImagePath, DEFAULT_DURATION,
+ stepDescriptions, stepImagesPaths);
+ }
+
+ public SplashScreen(String applicationTitle, String splashImagePath,
+ long estimatedDuration, String[] stepDescriptions,
+ String[] stepIconsPaths) {
+ super();
+ this.applicationTitle = applicationTitle;
+ this.estimatedDuration = estimatedDuration;
+ this.stepDescriptions = stepDescriptions;
+ initialize(splashImagePath, stepIconsPaths);
+ }
+
+ /**
+ * @return Returns the stepDescriptions.
+ */
+ public String[] getstepDescriptions() {
+ return stepDescriptions;
+ }
+
+ /**
+ * @param stepDescriptions The stepDescriptions to set.
+ */
+ public void setstepDescriptions(String[] stepDescriptions) {
+ this.stepDescriptions = stepDescriptions;
+ }
+
+ /**
+ * @return Returns the steppingInset.
+ */
+ public int getSteppingLeftInset() {
+ return steppingLeftInset;
+ }
+
+ /**
+ * @param steppingLeftInset The steppingInset to set.
+ */
+ public void setSteppingLeftInset(int steppingLeftInset) {
+ this.steppingLeftInset = steppingLeftInset;
+ }
+
+ /**
+ * @return Returns the steppingRightInset.
+ */
+ public int getSteppingRightInset() {
+ return steppingRightInset;
+ }
+
+ /**
+ * @param steppingRightInset The steppingRightInset to set.
+ */
+ public void setSteppingRightInset(int steppingRightInset) {
+ this.steppingRightInset = steppingRightInset;
+ }
+
+ /**
+ * @return Returns the applicationTitle.
+ */
+ public String getApplicationTitle() {
+ return applicationTitle;
+ }
+
+ /**
+ * @return Returns the currentStep.
+ */
+ public int getCurrentStep() {
+ return currentStep;
+ }
+
+ /**
+ * @param currentStep The currentStep to set.
+ */
+ public void setCurrentStep(int currentStep) {
+ this.currentStep = currentStep;
+ }
+
+ /**
+ * @return Returns the estimatedDuration.
+ */
+ public long getEstimatedDuration() {
+ return estimatedDuration;
+ }
+
+ /**
+ * @return Returns the splashImage.
+ */
+ public Image getSplashImage() {
+ return splashImage;
+ }
+
+ /**
+ * @return Returns the stepImages.
+ */
+ public Image[] getStepImages() {
+ return stepImages;
+ }
+
+ /**
+ * @return Returns the steppingBottomInset.
+ */
+ public int getSteppingBottomInset() {
+ return steppingBottomInset;
+ }
+
+ /**
+ * @param steppingBottomInset The steppingBottomInset to set.
+ */
+ public void setSteppingBottomInset(int steppingBottomInset) {
+ this.steppingBottomInset = steppingBottomInset;
+ }
+
+ /**
+ * @return Returns the currentComposite.
+ */
+ public Composite getCurrentComposite() {
+ return currentComposite;
+ }
+
+ /**
+ * @param currentComposite The currentComposite to set.
+ */
+ public void setCurrentComposite(Composite currentComposite) {
+ this.currentComposite = currentComposite;
+ }
+
+ public void nextStep() {
+ if (imageAnimator != null) {
+ imageAnimator.cancel();
+ }
+ setCurrentStep(getCurrentStep() + 1);
+ currentAlpha = 0.1f;
+ currentImage = stepImages[getCurrentStep()];
+ imageAnimator = new ImageAnimator();
+ new Timer().schedule(imageAnimator, 0, 70);
+ repaint();
+ }
+
+ public void complete() {
+ if (imageAnimator != null) {
+ imageAnimator.cancel();
+ }
+ new Timer().schedule(new FrameHider(), remanence);
+ repaint();
+ }
+
+ protected float currentAlpha = 0.1f;
+
+ protected boolean alphaUp = true;
+
+ protected void animateImage() {
+ if (currentAlpha <= 0.3) {
+ alphaUp = true;
+ } else if (currentAlpha >= 0.7) {
+ alphaUp = false;
+ }
+ if (alphaUp) {
+ currentAlpha += 0.1;
+ } else {
+ currentAlpha -= 0.1;
+ }
+ setCurrentComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER,
+ currentAlpha));
+ repaint();
+ }
+
+ protected Image getStepImage(int i) {
+ Image image = null;
+ if (i == currentStep) {
+ image = currentImage;
+ } else {
+ image = stepImages[i];
+ }
+ return image;
+ }
+
+ /**
+ * @param step the required step
+ * @return Returns the currentComposite.
+ */
+ public Composite getCompositeFor(int step) {
+ if (step == getCurrentStep()) {
+ return getCurrentComposite();
+ }
+ return defaultComposite;
+ }
+
+ protected void paintSplash(Graphics g) {
+ g.drawImage(splashImage, 0, 0, null);
+ // TODO draw application Title
+
+ // TODO
+ if (stepImages == null) {
+ // TODO DRAW PROGRESS BAR
+ // g.fillRect(50,50,100,3);
+ } else {
+ // draw step images
+ int steppingInset = (getSplashImage().getWidth(null)
+ - getSteppingLeftInset() - getSteppingRightInset())
+ / (stepImages.length + 1);
+ int steppingY = getSplashImage().getHeight(null)
+ - getSteppingBottomInset();
+ for (int i = 0; i <= currentStep; i++) {
+ Image image = getStepImage(i);
+ Graphics2D g2 = (Graphics2D) g;
+ Composite oldComposite = g2.getComposite();
+ g2.setComposite(getCompositeFor(i));
+ g2.drawImage(image, getSteppingLeftInset()
+ + (steppingInset * (i + 1)) - image.getWidth(null) / 2,
+ steppingY, null);
+ g2.setComposite(oldComposite);
+ }
+ }
+ }
+
+ protected void initialize(String splashImagePath, String[] stepIconsPaths) {
+ initializeUI();
+
+ splashImage = getImage(splashImagePath);
+ this.setUndecorated(true);
+ this.positionAtCenter(splashImage.getWidth(null), splashImage
+ .getHeight(null));
+ // this.setAlwaysOnTop(true); // TODO JDK5.0 specific
+ this.setVisible(true);
+
+ if (stepIconsPaths != null) {
+ stepImages = new Image[stepIconsPaths.length];
+ for (int i = 0; i < stepIconsPaths.length; i++) {
+ stepImages[i] = getImage(stepIconsPaths[i]);
+ }
+ }
+ }
+
+ protected Image getImage(String imagePath) {
+ Image result = null;
+ java.net.URL imageURL = getClass().getResource(imagePath);
+ if (imageURL != null) {
+ result = new ImageIcon(imageURL).getImage();
+ }
+ return result;
+ }
+
+ /**
+ * Positions the window at the centre of the screen, taking into account the
+ * specified width and height
+ */
+ protected void positionAtCenter(int width, int height) {
+ Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
+ setBounds((screenSize.width - width) / 2,
+ (screenSize.height - height) / 2, width, height);
+ }
+
+ protected void initializeUI() {
+ this.setContentPane(getJContentPane());
+ }
+
+ protected javax.swing.JPanel jContentPane = null;
+
+ protected javax.swing.JPanel getJContentPane() {
+ if (jContentPane == null) {
+ jContentPane = new javax.swing.JPanel();
+ jContentPane
+ .setBorder(javax.swing.BorderFactory
+ .createEtchedBorder(javax.swing.border.EtchedBorder.RAISED));
+ jContentPane.setLayout(new java.awt.GridBagLayout());
+ java.awt.GridBagConstraints gridBagConstraints = new GridBagConstraints();
+ gridBagConstraints.insets = new java.awt.Insets(1, 1, 1, 1);
+ gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
+ gridBagConstraints.weightx = 1.0D;
+ gridBagConstraints.weighty = 1.0D;
+ jContentPane.add(getSplashPane(), gridBagConstraints);
+ }
+ return jContentPane;
+ }
+
+ protected javax.swing.JPanel splashPane = null;
+
+ protected javax.swing.JPanel getSplashPane() {
+ if (splashPane == null) {
+ splashPane = new javax.swing.JPanel() {
+ private static final long serialVersionUID=1L;
+
+ @Override
+ public void paint(Graphics g) {
+ paintSplash(g);
+ }
+ };
+ splashPane.setLayout(new java.awt.BorderLayout());
+ }
+ return splashPane;
+ }
+
+ protected class ImageAnimator extends TimerTask {
+
+ @Override
+ public void run() {
+ animateImage();
+ }
+
+ }
+
+ protected class FrameHider extends TimerTask {
+
+ @Override
+ public void run() {
+ setVisible(false);
+ }
+
+ }
+
+ //
+
+ public static void main(String[] args) {
+ SplashScreen f = new SplashScreen(
+ "SplashScreen v0.1\n Released under GNU General Public License v2.0",
+ "/redGecko.jpg", new String[] {}, new String[] {
+ "/64x64/camera.png", "/64x64/joystick.png",
+ "/64x64/modem.png", "/64x64/mouse.png",
+ "/64x64/pda.png", "/64x64/printer.png",
+ "/64x64/scanner.png", "/64x64/tablet.png" });
+ try {
+ Thread.sleep(500);
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ for (int i = 0; i < 8; i++) {
+ try {
+ Thread.sleep(1000);
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ f.nextStep();
+ }
+ try {
+ Thread.sleep(1000);
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ f.complete();
+ try {
+ Thread.sleep(3000);
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ System.exit(0);
+ }
+
+}
Property changes on: trunk/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/SplashScreen.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
Added: trunk/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/SwingSession.java
===================================================================
--- trunk/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/SwingSession.java (rev 0)
+++ trunk/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/SwingSession.java 2014-02-24 14:27:22 UTC (rev 2800)
@@ -0,0 +1,804 @@
+/*
+ * #%L
+ * JAXX :: Extra Widgets
+ * %%
+ * Copyright (C) 2004 - 2010 CodeLutin
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Lesser Public License for more details.
+ *
+ * You should have received a copy of the GNU General Lesser Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/lgpl-3.0.html>.
+ * #L%
+ */
+package org.nuiton.jaxx.widgets.extra;
+
+
+import java.awt.BorderLayout;
+import java.awt.Component;
+import java.awt.Container;
+import java.awt.Dialog;
+import java.awt.Frame;
+import java.awt.GraphicsConfiguration;
+import java.awt.GraphicsDevice;
+import java.awt.GraphicsEnvironment;
+import java.awt.Rectangle;
+import java.awt.Window;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.beans.DefaultPersistenceDelegate;
+import java.beans.Encoder;
+import java.beans.ExceptionListener;
+import java.beans.Expression;
+import java.beans.XMLDecoder;
+import java.beans.XMLEncoder;
+import java.io.ByteArrayOutputStream;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.LinkedHashSet;
+import java.util.Map;
+import javax.swing.JButton;
+import javax.swing.JFrame;
+import javax.swing.JScrollPane;
+import javax.swing.JSplitPane;
+import javax.swing.JTabbedPane;
+import javax.swing.JTable;
+import javax.swing.JTextArea;
+import javax.swing.table.AbstractTableModel;
+import javax.swing.table.TableColumn;
+import javax.swing.table.TableModel;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+/**
+ * Use to store and restore position and size of application. Supported widgets
+ * are:
+ * <li> java.awt.Window (and subclasses)
+ * <li> javax.swing.JTabbedPane (and subclasses)
+ * <li> javax.swing.JSplitPane (and subclasses)
+ * <li> javax.swing.JTable (and subclasses)
+ *
+ * usage:
+ * <li> create SwingSession object
+ * <li> add component that you want save
+ * <li> explicite call to save
+ *
+ * You can use same SwingSession for multiple window but in this case you must
+ * have setName for each window with different name, otherwize there are
+ * collision between window component and result is undetermisitic
+ *
+ * This code is partialy inspired from http://kenai.com/projects/bsaf/pages/Home
+ * project. This project is under LGPL v2.1 license. We can't reuse directly this
+ * library because to many fields and methods are private and we can't implements
+ * it and modify some behavior.
+ *
+ * @author poussin
+ * @version $Revision$
+ *
+ * Last update: $Date$
+ * by : $Author$
+ */
+public class SwingSession {
+
+ /** to use log facility, just put in your code: log.info(\"...\"); */
+ static private Log log = LogFactory.getLog(SwingSession.class);
+
+ protected File file;
+ protected boolean autoSave;
+ protected LinkedHashSet<Component> registeredComponent =
+ new LinkedHashSet<Component>();
+ /** State object registered to get and set State.
+ * key: class of component managed by the state; value: the state*/
+ protected Map<Class, State> stateManager = new HashMap<Class, State>();
+ /** state of all component added with add method.
+ * key: path of compoenent; value: State */
+ protected Map<String, State> states;
+
+ public SwingSession(File file, boolean autoSave) {
+ this.file = file;
+ this.autoSave = autoSave;
+ stateManager.put(Window.class, new WindowState());
+ stateManager.put(JTable.class, new JTableState());
+ stateManager.put(JTabbedPane.class, new JTabbedPaneState());
+ stateManager.put(JSplitPane.class, new JSplitPaneState());
+
+ states = loadStates(file);
+ if (states == null) {
+ states = new HashMap<String, State>();
+ }
+ }
+
+ @Override
+ protected void finalize() throws Throwable {
+ save();
+ super.finalize();
+ }
+
+
+ /* If an exception occurs in the XMLEncoder/Decoder, we want
+ * to throw an IOException. The exceptionThrow listener method
+ * doesn't throw a checked exception so we just set a flag
+ * here and check it when the encode/decode operation finishes
+ */
+ private static class AbortExceptionListener implements ExceptionListener {
+
+ public Exception exception = null;
+
+ @Override
+ public void exceptionThrown(Exception e) {
+ if (exception == null) {
+ exception = e;
+ }
+ }
+ }
+
+ /* There are some (old) Java classes that aren't proper beans. Rectangle
+ * is one of these. When running within the secure sandbox, writing a
+ * Rectangle with XMLEncoder causes a security exception because
+ * DefaultPersistenceDelegate calls Field.setAccessible(true) to gain
+ * access to private fields. This is a workaround for that problem.
+ * A bug has been filed, see JDK bug ID 4741757
+ */
+ private static class RectanglePD extends DefaultPersistenceDelegate {
+
+ public RectanglePD() {
+ super(new String[]{"x", "y", "width", "height"});
+ }
+
+ @Override
+ protected Expression instantiate(Object oldInstance, Encoder out) {
+ Rectangle oldR = (Rectangle) oldInstance;
+ Object[] constructorArgs = new Object[]{
+ oldR.x, oldR.y, oldR.width, oldR.height
+ };
+ return new Expression(oldInstance, oldInstance.getClass(), "new", constructorArgs);
+ }
+ }
+
+ public void save() {
+ updateState();
+ AbortExceptionListener el = new AbortExceptionListener();
+ ByteArrayOutputStream bst = new ByteArrayOutputStream();
+ XMLEncoder e = null;
+ /* Buffer the XMLEncoder's output so that decoding errors don't
+ * cause us to trash the current version of the specified file.
+ */
+ try {
+ e = new XMLEncoder(bst);
+ e.setPersistenceDelegate(Rectangle.class, new RectanglePD());
+ e.setExceptionListener(el);
+ e.writeObject(states);
+ } finally {
+ if (e != null) {
+ e.close();
+ }
+ }
+ if (el.exception != null) {
+ log.warn("save failed \"" + file + "\"", el.exception);
+ } else {
+ OutputStream ost = null;
+ try {
+ ost = new FileOutputStream(file);
+ ost.write(bst.toByteArray());
+ } catch (IOException eee) {
+ log.warn("save failed \"" + file + "\"", eee);
+ } finally {
+ if (ost != null) {
+ try {
+ ost.close();
+ } catch (IOException eee) {
+ log.warn("can't close properly \"" + file + "\"", eee);
+ }
+ }
+ }
+ }
+ }
+
+ /**
+ * Loads the states from the file
+ */
+ public Map<String, State> loadStates(File file) {
+ Map<String, State> result = null;
+ if (file.exists()) {
+ XMLDecoder d = null;
+ try {
+ InputStream ist = new FileInputStream(file);
+ d = new XMLDecoder(ist);
+ AbortExceptionListener eee = new AbortExceptionListener();
+ d.setExceptionListener(eee);
+ Object bean = d.readObject();
+ if (eee.exception != null) {
+ log.warn("load failed \"" + file + "\"", eee.exception);
+ } else {
+ result = (Map<String, State>) bean;
+ }
+ } catch (IOException eee) {
+ log.warn("load failed \"" + file + "\"", eee);
+ } finally {
+ if (d != null) {
+ d.close();
+ }
+ }
+ }
+ return result;
+ }
+
+ public void updateState() {
+ walkThrowComponent("", registeredComponent,
+ new SaveStateAction());
+ }
+
+ public void add(Component c) {
+ if (registeredComponent.contains(c)) {
+ log.warn(String.format(
+ "Component already added %s(%s)", c.getClass(), c.getName()));
+ } else {
+ registeredComponent.add(c);
+ walkThrowComponent("", Collections.singleton(c),
+ new RestoreStateAction());
+ }
+ }
+
+ /**
+ * Remove component from component to save
+ * @param c
+ */
+ public void remove(Component c) {
+ registeredComponent.remove(c);
+ }
+
+ protected String getComponentName(Component c) {
+ String name = c.getName();
+ if (name == null) {
+ int n = c.getParent().getComponentZOrder(c);
+ if (n >= 0) {
+ Class clazz = c.getClass();
+ name = clazz.getSimpleName();
+ if (name.length() == 0) {
+ name = "Anonymous" + clazz.getSuperclass().getSimpleName();
+ }
+ name = name + n;
+ } else {
+ // Implies that the component tree is changing
+ // while we're computing the path. Punt.
+ log.warn("Couldn't compute pathname for " + c);
+ }
+ }
+ return name;
+ }
+
+ public State getStateManager(Class clazz) {
+ State result = null;
+ while (result == null && clazz != null) {
+ result = stateManager.get(clazz);
+ clazz = clazz.getSuperclass();
+ }
+ return result;
+ }
+
+ public State getStates(String path) {
+ return states.get(path);
+ }
+
+ public void setStates(String path, State state) {
+ this.states.put(path, state);
+ }
+
+ protected void walkThrowComponent(
+ String path, Collection<Component> roots, Action action) {
+ for (Component root : roots) {
+ if (root != null) {
+ String pathname = path + "/" + getComponentName(root);
+ State state = getStateManager(root.getClass());
+ if (state != null) {
+ action.doAction(this, pathname, root);
+ }
+ if (root instanceof Container) {
+ Component[] children = ((Container) root).getComponents();
+ if ((children != null) && (children.length > 0)) {
+ walkThrowComponent(pathname, Arrays.asList(children), action);
+ }
+ }
+ if (root instanceof JFrame) {
+ Component[] children = ((JFrame) root).getContentPane().getComponents();
+ if ((children != null) && (children.length > 0)) {
+ walkThrowComponent(pathname, Arrays.asList(children), action);
+ }
+ }
+ }
+ }
+ }
+
+ static public interface Action {
+ public void doAction(SwingSession session, String path, Component c);
+ }
+
+ static public class SaveStateAction implements Action {
+ @Override
+ public void doAction(SwingSession session, String path, Component c) {
+ State manager = session.getStateManager(c.getClass());
+ State state = manager.getState(c);
+ session.setStates(path, state);
+ }
+ }
+
+ static public class RestoreStateAction implements Action {
+ @Override
+ public void doAction(SwingSession session, String path, Component c) {
+ State manager = session.getStateManager(c.getClass());
+ State state = session.getStates(path);
+ if (state != null) {
+ manager.setState(c, state);
+ }
+ }
+ }
+
+ /**
+ * get(save) and set(restore) state of object passed in argument
+ */
+ static public interface State {
+ public State getState(Object o);
+ public void setState(Object o, State state);
+ }
+
+ /**
+ * State for JTabbedPane
+ */
+ static public class JTabbedPaneState implements State {
+
+ protected int selectedIndex = -1;
+ protected int tabCount;
+
+ public JTabbedPaneState() {
+ }
+
+ public int getSelectedIndex() {
+ return selectedIndex;
+ }
+
+ public void setSelectedIndex(int selectedIndex) {
+ this.selectedIndex = selectedIndex;
+ }
+
+ public int getTabCount() {
+ return tabCount;
+ }
+
+ public void setTabCount(int tabCount) {
+ this.tabCount = tabCount;
+ }
+
+
+ protected JTabbedPane checkComponent(Object o) {
+ if (o == null) {
+ throw new IllegalArgumentException("null component");
+ }
+ if (!(o instanceof JTabbedPane)) {
+ throw new IllegalArgumentException("invalid component");
+ }
+ return (JTabbedPane) o;
+ }
+
+ @Override
+ public State getState(Object o) {
+ JTabbedPaneState result = new JTabbedPaneState();
+
+ JTabbedPane p = checkComponent(o);
+ result.setSelectedIndex(p.getSelectedIndex());
+ result.setTabCount(p.getTabCount());
+
+ return result;
+ }
+
+ @Override
+ public void setState(Object o, State state) {
+ if (state == null) {
+ return;
+ }
+ if (state instanceof JTabbedPaneState) {
+ JTabbedPane p = checkComponent(o);
+ JTabbedPaneState tps = (JTabbedPaneState) state;
+ if (tps.getSelectedIndex() != -1
+ && p.getTabCount() == tps.getTabCount()) {
+ p.setSelectedIndex(tps.getSelectedIndex());
+ }
+ } else {
+ throw new IllegalArgumentException("invalid state");
+ }
+ }
+ }
+
+ /**
+ * State for JSplit
+ * FIXME add listener for divider move action
+ */
+ static public class JSplitPaneState implements State {
+
+ protected int dividerLocation = -1;
+ protected int orientation = JSplitPane.HORIZONTAL_SPLIT;
+
+ public JSplitPaneState() {
+ }
+
+ public int getDividerLocation() {
+ return dividerLocation;
+ }
+
+ public void setDividerLocation(int dividerLocation) {
+ this.dividerLocation = dividerLocation;
+ }
+
+ public int getOrientation() {
+ return orientation;
+ }
+
+ public void setOrientation(int orientation) {
+ this.orientation = orientation;
+ }
+
+ protected JSplitPane checkComponent(Object o) {
+ if (o == null) {
+ throw new IllegalArgumentException("null component");
+ }
+ if (!(o instanceof JSplitPane)) {
+ throw new IllegalArgumentException("invalid component");
+ }
+ return (JSplitPane) o;
+ }
+
+ @Override
+ public State getState(Object o) {
+ JSplitPane p = checkComponent(o);
+
+ JSplitPaneState result = new JSplitPaneState();
+ result.setDividerLocation(p.getUI().getDividerLocation(p));
+ result.setOrientation(p.getOrientation());
+
+ return result;
+ }
+
+ @Override
+ public void setState(Object o, State state) {
+ if (state == null) {
+ return;
+ }
+ JSplitPane p = checkComponent(o);
+ if (state instanceof JSplitPaneState) {
+ JSplitPaneState sps = (JSplitPaneState) state;
+ if (sps.getDividerLocation() != -1
+ && p.getOrientation() == sps.getOrientation()) {
+ p.setDividerLocation(sps.getDividerLocation());
+ }
+ } else {
+ throw new IllegalArgumentException("invalid state");
+ }
+ }
+ }
+
+ /**
+ * State for JTable.
+ * TODO add support for column order change
+ */
+ static public class JTableState implements State {
+
+ protected int[] columnWidths = new int[0];
+
+ public JTableState() {
+ }
+
+ public JTableState(int[] columnWidths) {
+ this.columnWidths = columnWidths;
+ }
+
+ public int[] getColumnWidths() {
+ return columnWidths;
+ }
+
+ public void setColumnWidths(int[] columnWidths) {
+ this.columnWidths = columnWidths;
+ }
+
+ protected JTable checkComponent(Object o) {
+ if (o == null) {
+ throw new IllegalArgumentException("null component");
+ }
+ if (!(o instanceof JTable)) {
+ throw new IllegalArgumentException("invalid component");
+ }
+ return (JTable) o;
+ }
+
+ @Override
+ public State getState(Object o) {
+ JTable table = checkComponent(o);
+ int[] columnWidths = new int[table.getColumnCount()];
+ boolean resizableColumnExists = false;
+ for (int i = 0; i < columnWidths.length; i++) {
+ TableColumn tc = table.getColumnModel().getColumn(i);
+ columnWidths[i] = (tc.getResizable()) ? tc.getWidth() : -1;
+ if (tc.getResizable()) {
+ resizableColumnExists = true;
+ }
+ }
+ JTableState result = null;
+ if (resizableColumnExists) {
+ result = new JTableState();
+ result.setColumnWidths(columnWidths);
+ }
+ return result;
+ }
+
+ @Override
+ public void setState(Object o, State state) {
+ if (!(state instanceof JTableState)) {
+ throw new IllegalArgumentException("invalid state");
+ }
+ JTable table = checkComponent(o);
+ int[] columnWidths = ((JTableState) state).getColumnWidths();
+ if (columnWidths != null
+ && table.getColumnCount() == columnWidths.length) {
+ for (int i = 0; i < columnWidths.length; i++) {
+ if (columnWidths[i] != -1) {
+ TableColumn tc = table.getColumnModel().getColumn(i);
+ if (tc.getResizable()) {
+ tc.setPreferredWidth(columnWidths[i]);
+ }
+ }
+ }
+ }
+ }
+ }
+
+ /**
+ * State for Window
+ */
+ static public class WindowState implements State {
+ private static final String WINDOW_STATE_NORMAL_BOUNDS =
+ "WindowState.normalBounds";
+
+ protected Rectangle bounds;
+ protected Rectangle gcBounds;
+ protected int frameState = Frame.NORMAL;
+
+ public WindowState() {
+ }
+
+ public WindowState(Rectangle bounds, Rectangle gcBounds, int frameState) {
+ this.bounds = new Rectangle(bounds);
+ this.gcBounds = new Rectangle(gcBounds);
+ this.frameState = frameState;
+ }
+
+ public Rectangle getBounds() {
+ return bounds;
+ }
+
+ public void setBounds(Rectangle bounds) {
+ this.bounds = bounds;
+ }
+
+ public Rectangle getGcBounds() {
+ return gcBounds;
+ }
+
+ public void setGcBounds(Rectangle gcBounds) {
+ this.gcBounds = gcBounds;
+ }
+
+ public int getFrameState() {
+ return frameState;
+ }
+
+ public void setFrameState(int frameState) {
+ this.frameState = frameState;
+ }
+
+ protected Window checkComponent(Object o) {
+ if (o == null) {
+ throw new IllegalArgumentException("null component");
+ }
+ if (!(o instanceof Window)) {
+ throw new IllegalArgumentException("invalid component");
+ }
+ return (Window) o;
+ }
+
+ /**
+ * Checks whether the window supports resizing
+ * @param window the {@code Window} to be checked
+ * @return true if the window supports resizing
+ */
+ protected static boolean isResizable(Window window) {
+ boolean resizable = true;
+ if (window instanceof Frame) {
+ resizable = ((Frame) window).isResizable();
+ } else if (window instanceof Dialog) {
+ resizable = ((Dialog) window).isResizable();
+ }
+ return resizable;
+ }
+
+ /**
+ * Gets {@code Window} bounds from the client property
+ * @param window the source {@code Window}
+ * @return bounds from the client property
+ */
+ protected static Rectangle getWindowNormalBounds(Window window) {
+ Rectangle result = null;
+ if (window instanceof JFrame) {
+ Object res = ((JFrame) window).getRootPane().getClientProperty(
+ WINDOW_STATE_NORMAL_BOUNDS);
+ if (res instanceof Rectangle) {
+ result = (Rectangle) res;
+ }
+ }
+ return result;
+ }
+
+ /**
+ * Calculates virtual graphic bounds.
+ * On multiscreen systems all screens are united into one virtual screen.
+ * @return the graphic bounds
+ */
+ public static Rectangle computeVirtualGraphicsBounds() {
+ Rectangle virtualBounds = new Rectangle();
+ GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
+ GraphicsDevice[] gs = ge.getScreenDevices();
+ for (GraphicsDevice gd : gs) {
+ GraphicsConfiguration gc = gd.getDefaultConfiguration();
+ virtualBounds = virtualBounds.union(gc.getBounds());
+ }
+ return virtualBounds;
+ }
+
+ /**
+ * Puts {@code Window} bounds to client property.
+ * @param window the target {@code Window}
+ * @param bounds bounds
+ */
+ public static void putWindowNormalBounds(Window window, Rectangle bounds) {
+ if (window instanceof JFrame) {
+ ((JFrame) window).getRootPane().putClientProperty(
+ WINDOW_STATE_NORMAL_BOUNDS, bounds);
+ }
+ }
+
+ @Override
+ public State getState(Object o) {
+ Window c = checkComponent(o);
+ int frameState = Frame.NORMAL;
+ if (c instanceof Frame) {
+ frameState = ((Frame) c).getExtendedState();
+ }
+ GraphicsConfiguration gc = c.getGraphicsConfiguration();
+ Rectangle gcBounds = (gc == null) ? null : gc.getBounds();
+ Rectangle frameBounds = c.getBounds();
+
+ /* If this is a JFrame created by FrameView and it's been maximized,
+ * retrieve the frame's normal (not maximized) bounds. More info:
+ * see FrameStateListener#windowStateChanged in FrameView.
+ */
+ if ((c instanceof JFrame) && (0 != (frameState & Frame.MAXIMIZED_BOTH))) {
+ frameBounds = getWindowNormalBounds(c);
+ }
+
+ WindowState result = null;
+ if (frameBounds != null && !frameBounds.isEmpty()) {
+ result = new WindowState();
+ result.setBounds(frameBounds);
+ result.setGcBounds(gcBounds);
+ result.setFrameState(frameState);
+ }
+
+ return result;
+ }
+
+ @Override
+ public void setState(Object o, State state) {
+ Window w = checkComponent(o);
+ if ((state != null) && !(state instanceof WindowState)) {
+ throw new IllegalArgumentException("invalid state");
+ }
+ WindowState windowState = (WindowState) state;
+ if (windowState.getBounds() != null) {
+ putWindowNormalBounds(w, windowState.getBounds());
+ if (!w.isLocationByPlatform() && (state != null)) {
+
+ Rectangle gcBounds0 = windowState.getGcBounds();
+ if (gcBounds0 != null && isResizable(w)) {
+ if (computeVirtualGraphicsBounds().contains(gcBounds0.getLocation())) {
+ w.setBounds(windowState.getBounds());
+ } else {
+ w.setSize(windowState.getBounds().getSize());
+ }
+ }
+ }
+ if (w instanceof Frame) {
+ ((Frame) w).setExtendedState(windowState.getFrameState());
+ }
+ }
+ }
+
+ }
+
+
+ /**
+ * Just for test rapidly
+ * @param args
+ */
+ static public void main(String[] args) {
+ final SwingSession session =
+ new SwingSession(new File("/tmp/SwingSession.config"), false);
+
+ JFrame frame = new JFrame("truc");
+ frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
+ frame.setBounds(10, 20, 300, 500);
+
+ TableModel dataModel = new AbstractTableModel() {
+
+ @Override
+ public String getColumnName(int column) {
+ return "c" + column;
+ }
+
+ @Override
+ public int getColumnCount() {
+ return 5;
+ }
+
+ @Override
+ public int getRowCount() {
+ return 10;
+ }
+
+ @Override
+ public Object getValueAt(int row, int col) {
+ return new Integer(row * col);
+ }
+ };
+ JTable table = new JTable(dataModel);
+ table.setName("MaTable");
+
+ JTabbedPane tab = new JTabbedPane();
+ tab.setName("MaTab");
+ tab.add("tab1", new JTextArea());
+ tab.add("tab2", new JTextArea());
+ tab.add("tab3", new JTextArea());
+
+ JSplitPane split = new JSplitPane();
+ split.setTopComponent(new JScrollPane(table));
+ split.setBottomComponent(tab);
+
+ JButton button = new JButton("Save");
+ button.addActionListener(new ActionListener() {
+ @Override
+ public void actionPerformed(ActionEvent e) {
+ session.save();
+ }
+ });
+
+ frame.getContentPane().setLayout(new BorderLayout());
+ frame.getContentPane().add(button, BorderLayout.NORTH);
+ frame.getContentPane().add(split, BorderLayout.CENTER);
+
+ frame.setVisible(true);
+ session.add(frame);
+ session.save();
+ }
+}
Property changes on: trunk/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/SwingSession.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
Added: trunk/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/SwingUtil.java
===================================================================
--- trunk/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/SwingUtil.java (rev 0)
+++ trunk/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/SwingUtil.java 2014-02-24 14:27:22 UTC (rev 2800)
@@ -0,0 +1,71 @@
+/*
+ * #%L
+ * JAXX :: Extra Widgets
+ * %%
+ * Copyright (C) 2004 - 2010 CodeLutin
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Lesser Public License for more details.
+ *
+ * You should have received a copy of the GNU General Lesser Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/lgpl-3.0.html>.
+ * #L%
+ */
+
+/* *
+ * SwingUtil.java
+ *
+ * Created: Nov 19, 2004
+ *
+ * @author Cédric Pineau <pineau(a)codelutin.com>
+ * @version $Revision$
+ *
+ * Last update : $Date$
+ * by : $Author$
+ */
+
+package org.nuiton.jaxx.widgets.extra;
+
+import java.awt.Component;
+import java.awt.Dimension;
+import java.awt.Toolkit;
+import java.awt.Window;
+
+import javax.swing.JFrame;
+
+/**
+ *
+ */
+public class SwingUtil {
+
+ public static void configureUI(Component component) {
+ if (component instanceof JFrame) {
+ ((JFrame) component)
+ .setDefaultCloseOperation(javax.swing.WindowConstants.DO_NOTHING_ON_CLOSE);
+ }
+ if (component instanceof Window) {
+ ((Window) component).pack();
+ }
+ center(component);
+ }
+
+ /**
+ * Center the widget on the screen
+ */
+ public static void center(Component component) {
+ Toolkit tk = component.getToolkit();
+ Dimension d = component.getSize();
+ int x = (tk.getScreenSize().width - d.width) / 2;
+ int y = (tk.getScreenSize().height - d.height) / 2;
+ component.setLocation(x, y);
+ }
+
+}
Property changes on: trunk/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/SwingUtil.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
Added: trunk/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/SwingWidgetFactory.java
===================================================================
--- trunk/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/SwingWidgetFactory.java (rev 0)
+++ trunk/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/SwingWidgetFactory.java 2014-02-24 14:27:22 UTC (rev 2800)
@@ -0,0 +1,144 @@
+/*
+ * #%L
+ * JAXX :: Extra Widgets
+ * %%
+ * Copyright (C) 2004 - 2010 CodeLutin
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Lesser Public License for more details.
+ *
+ * You should have received a copy of the GNU General Lesser Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/lgpl-3.0.html>.
+ * #L%
+ */
+
+/* *
+ * SwingWidgetFactory.java
+ *
+ * Created: Nov 19, 2004
+ *
+ * @author Cédric Pineau <pineau(a)codelutin.com>
+ * @version $Revision$
+ *
+ * Last update : $Date$
+ * by : $Author$
+ */
+
+package org.nuiton.jaxx.widgets.extra;
+
+import javax.swing.AbstractButton;
+import javax.swing.JButton;
+import javax.swing.JMenu;
+import javax.swing.JMenuBar;
+import javax.swing.JMenuItem;
+import javax.swing.JPanel;
+import javax.swing.JSplitPane;
+import javax.swing.JToolBar;
+import javax.swing.border.Border;
+import javax.swing.border.CompoundBorder;
+import javax.swing.border.EmptyBorder;
+import javax.swing.border.EtchedBorder;
+
+/**
+ *
+ */
+public class SwingWidgetFactory {
+
+ /**
+ * Creates and returns a <code>AbstractButton</code>
+ */
+ public static AbstractButton createMenuButton(ApplicationAction action) {
+ JButton button = new JButton(action);
+ button.setText(null);
+ return button;
+ }
+
+ /**
+ * Creates and returns a <code>AbstractButton</code>
+ */
+ public static AbstractButton createButton(ApplicationAction action) {
+ JButton button = new JButton(action);
+ button.setText(action.getShortText());
+ return button;
+ }
+
+ /**
+ * Creates and returns a <code>JSplitPane</code>
+ */
+ public static JSplitPane createSplitPane() {
+ return new UIFSplitPane();
+ }
+
+ /**
+ * Creates and returns a <code>JPanel</code>
+ */
+ public static JPanel createPanel() {
+ return new SimpleInternalFrame();
+ }
+
+ /**
+ * Creates and returns a <code>JPanel</code>
+ */
+ public static JPanel createNamedPanel(String title) {
+ return new SimpleInternalFrame(title);
+ }
+
+ public static void setPanelTitle(JPanel panel, String title) {
+ if (panel instanceof SimpleInternalFrame) {
+ ((SimpleInternalFrame) panel).setTitle(title);
+ }
+ }
+
+ /**
+ * Creates and returns a <code>JToolBar</code>
+ */
+ public static JToolBar createToolBar() {
+ JToolBar toolBar = new JToolBar();
+
+ toolBar.setFloatable(false);
+ toolBar.putClientProperty("JToolBar.isRollover", Boolean.TRUE);
+
+ toolBar.setFloatable(false);
+ Border marginBorder = new EmptyBorder(0, 2, 0, 2);
+ EtchedBorder etchedBorder = new EtchedBorder();
+ Border compoundBorder = new CompoundBorder(etchedBorder, marginBorder);
+ toolBar.setBorder(compoundBorder);
+
+ return toolBar;
+ }
+
+ /**
+ * Creates and returns a <code>JMenuBar</code>
+ */
+ public static JMenuBar createMenuBar() {
+ JMenuBar menuBar = new JMenuBar();
+
+ Border marginBorder = new EmptyBorder(0, 2, 0, 2);
+ EtchedBorder etchedBorder = new EtchedBorder();
+ Border compoundBorder = new CompoundBorder(etchedBorder, marginBorder);
+ menuBar.setBorder(compoundBorder);
+
+ return menuBar;
+ }
+
+ public static JMenu createMenu(String text, char mnemonic) {
+ JMenu menu = new JMenu(text);
+ menu.setMnemonic(mnemonic);
+ return menu;
+ }
+
+ public static JMenuItem createMenuItem(ApplicationAction action) {
+ JMenuItem menuItem = new JMenuItem();
+ menuItem.setAction(action);
+ menuItem.setText(action.getShortText());
+ return menuItem;
+ }
+}
Property changes on: trunk/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/SwingWidgetFactory.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
Added: trunk/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/SwitchPane.java
===================================================================
--- trunk/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/SwitchPane.java (rev 0)
+++ trunk/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/SwitchPane.java 2014-02-24 14:27:22 UTC (rev 2800)
@@ -0,0 +1,103 @@
+/*
+ * #%L
+ * JAXX :: Extra Widgets
+ * %%
+ * Copyright (C) 2004 - 2010 CodeLutin
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Lesser Public License for more details.
+ *
+ * You should have received a copy of the GNU General Lesser Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/lgpl-3.0.html>.
+ * #L%
+ */
+
+/*
+ * Created on 16 mai 2005
+ *
+ * TODO To change the template for this generated file go to
+ * Window - Preferences - Java - Code Style - Code Templates
+ */
+package org.nuiton.jaxx.widgets.extra;
+
+import java.awt.BorderLayout;
+import java.awt.Component;
+import java.awt.LayoutManager;
+
+import javax.swing.JPanel;
+
+/**
+ * @author cedric
+ *
+ * TODO To change the template for this generated type comment go to
+ * Window - Preferences - Java - Code Style - Code Templates
+ */
+public class SwitchPane extends JPanel {
+
+ private static final long serialVersionUID = 1L;
+
+ /**
+ * Constructeur unique pour le SwitchPane
+ */
+ public SwitchPane() {
+ super();
+ }
+
+ @Override
+ public void setLayout(LayoutManager mgr) {
+ super.setLayout(new BorderLayout());
+ }
+
+ public void switchTo(Component component) {
+ super.removeAll();
+ super.add(component, BorderLayout.CENTER);
+ revalidate();
+ repaint();
+ }
+
+ public SwitchPane(LayoutManager layout, boolean isDoubleBuffered) {
+ throw new UnsupportedOperationException();
+ }
+
+ public SwitchPane(LayoutManager layout) {
+ throw new UnsupportedOperationException();
+ }
+
+ public SwitchPane(boolean isDoubleBuffered) {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public Component add(Component component) {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public Component add(Component component, int index) {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public void add(Component component, Object constraints) {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public void add(Component component, Object constraints, int index) {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public Component add(String name, Component component) {
+ throw new UnsupportedOperationException();
+ }
+
+}
Property changes on: trunk/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/SwitchPane.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
Added: trunk/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/UIFSplitPane.java
===================================================================
--- trunk/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/UIFSplitPane.java (rev 0)
+++ trunk/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/UIFSplitPane.java 2014-02-24 14:27:22 UTC (rev 2800)
@@ -0,0 +1,274 @@
+/*
+ * #%L
+ * JAXX :: Extra Widgets
+ * %%
+ * Copyright (C) 2004 - 2010 CodeLutin
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Lesser Public License for more details.
+ *
+ * You should have received a copy of the GNU General Lesser Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/lgpl-3.0.html>.
+ * #L%
+ */
+/*
+ * Copyright (c) 2003, 2004 JGoodies Karsten Lentzsch. All Rights Reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * o Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ *
+ * o Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * o Neither the name of JGoodies Karsten Lentzsch nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+ * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+package org.nuiton.jaxx.widgets.extra;
+
+import java.awt.Component;
+
+import javax.swing.JButton;
+import javax.swing.JSplitPane;
+import javax.swing.UIManager;
+import javax.swing.border.Border;
+import javax.swing.border.EmptyBorder;
+import javax.swing.plaf.SplitPaneUI;
+import javax.swing.plaf.basic.BasicSplitPaneUI;
+
+/**
+ * A <code>JSplitPane</code> subclass that can try to remove the divider border.
+ * Useful if the splitted components render their own borders. Note that this
+ * feature is not supported by all look&feels. Some look&feel
+ * implementation will always show a divider border, and conversely, others will
+ * never show a divider border.
+ *
+ * @author Karsten Lentzsch
+ * @version $Revision$
+ *
+ * @see javax.swing.plaf.basic.BasicSplitPaneUI
+ */
+
+public final class UIFSplitPane extends JSplitPane {
+
+ private static final long serialVersionUID = 1L;
+
+ /**
+ * Holds the name of the bound property that tries to show or hide the split
+ * pane's divider border.
+ *
+ * @see #isDividerBorderVisible()
+ * @see #setDividerBorderVisible(boolean)
+ */
+ public static final String PROPERTYNAME_DIVIDER_BORDER_VISIBLE = "dividerBorderVisible";
+
+ /**
+ * Holds an empty border that is reused for the split pane itself and the
+ * divider.
+ */
+ private static final Border EMPTY_BORDER = new EmptyBorder(0, 0, 0, 0);
+
+ /**
+ * Determines whether the divider border shall be removed when the UI is
+ * updated.
+ *
+ * @see #isDividerBorderVisible()
+ * @see #setDividerBorderVisible(boolean)
+ */
+ private boolean dividerBorderVisible;
+
+ // Instance Creation *****************************************************
+
+ /**
+ * Constructs a <code>UIFSplitPane</code> configured to arrange the child
+ * components side-by-side horizontally with no continuous layout, using two
+ * buttons for the components.
+ */
+ public UIFSplitPane() {
+ this(JSplitPane.HORIZONTAL_SPLIT, false, new JButton(UIManager
+ .getString("SplitPane.leftButtonText")), new JButton(UIManager
+ .getString("SplitPane.rightButtonText")));
+ }
+
+ /**
+ * Constructs a <code>UIFSplitPane</code> configured with the specified
+ * orientation and no continuous layout.
+ *
+ * @param newOrientation <code>JSplitPane.HORIZONTAL_SPLIT</code> or
+ * <code>JSplitPane.VERTICAL_SPLIT</code>
+ * @throws IllegalArgumentException if <code>orientation</code> is not one
+ * of HORIZONTAL_SPLIT or VERTICAL_SPLIT.
+ */
+ public UIFSplitPane(int newOrientation) {
+ this(newOrientation, false);
+ }
+
+ /**
+ * Constructs a <code>UIFSplitPane</code> with the specified orientation and
+ * redrawing style.
+ *
+ * @param newOrientation <code>JSplitPane.HORIZONTAL_SPLIT</code> or
+ * <code>JSplitPane.VERTICAL_SPLIT</code>
+ * @param newContinuousLayout a boolean, true for the components to redraw
+ * continuously as the divider changes position, false to wait
+ * until the divider position stops changing to redraw
+ * @throws IllegalArgumentException if <code>orientation</code> is not one
+ * of HORIZONTAL_SPLIT or VERTICAL_SPLIT
+ */
+ public UIFSplitPane(int newOrientation, boolean newContinuousLayout) {
+ this(newOrientation, newContinuousLayout, null, null);
+ }
+
+ /**
+ * Constructs a <code>UIFSplitPane</code> with the specified orientation and
+ * the given componenents.
+ *
+ * @param orientation <code>JSplitPane.HORIZONTAL_SPLIT</code> or
+ * <code>JSplitPane.VERTICAL_SPLIT</code>
+ * @param leftComponent the <code>Component</code> that will appear on the
+ * left of a horizontally-split pane, or at the top of a
+ * vertically-split pane
+ * @param rightComponent the <code>Component</code> that will appear on the
+ * right of a horizontally-split pane, or at the bottom of a
+ * vertically-split pane
+ * @throws IllegalArgumentException if <code>orientation</code> is not one
+ * of: HORIZONTAL_SPLIT or VERTICAL_SPLIT
+ */
+ public UIFSplitPane(int orientation, Component leftComponent,
+ Component rightComponent) {
+ this(orientation, false, leftComponent, rightComponent);
+ }
+
+ /**
+ * Constructs a <code>UIFSplitPane</code> with the specified orientation,
+ * redrawing style, and given components.
+ *
+ * @param orientation <code>JSplitPane.HORIZONTAL_SPLIT</code> or
+ * <code>JSplitPane.VERTICAL_SPLIT</code>
+ * @param continuousLayout a boolean, true for the components to redraw
+ * continuously as the divider changes position, false to wait
+ * until the divider position stops changing to redraw
+ * @param leftComponent the <code>Component</code> that will appear on the
+ * left of a horizontally-split pane, or at the top of a
+ * vertically-split pane
+ * @param rightComponent the <code>Component</code> that will appear on the
+ * right of a horizontally-split pane, or at the bottom of a
+ * vertically-split pane
+ * @throws IllegalArgumentException if <code>orientation</code> is not one
+ * of HORIZONTAL_SPLIT or VERTICAL_SPLIT
+ */
+ public UIFSplitPane(int orientation, boolean continuousLayout,
+ Component leftComponent, Component rightComponent) {
+ super(orientation, continuousLayout, leftComponent, rightComponent);
+ dividerBorderVisible = false;
+ }
+
+ /**
+ * Constructs a <code>UIFSplitPane</code>, i.e. a <code>JSplitPane</code>
+ * that has no borders. Also disabled the one touch exandable property.
+ *
+ * @param orientation <code>JSplitPane.HORIZONTAL_SPLIT</code> or
+ * <code>JSplitPane.VERTICAL_SPLIT</code>
+ * @param leftComponent the <code>Component</code> that will appear on the
+ * left of a horizontally-split pane, or at the top of a
+ * vertically-split pane
+ * @param rightComponent the <code>Component</code> that will appear on the
+ * right of a horizontally-split pane, or at the bottom of a
+ * vertically-split pane
+ * @return the constructed splitepane
+ * @throws IllegalArgumentException if <code>orientation</code> is not one
+ * of: HORIZONTAL_SPLIT or VERTICAL_SPLIT
+ */
+ public static UIFSplitPane createStrippedSplitPane(int orientation,
+ Component leftComponent, Component rightComponent) {
+ UIFSplitPane split = new UIFSplitPane(orientation, leftComponent,
+ rightComponent);
+ split.setBorder(EMPTY_BORDER);
+ split.setOneTouchExpandable(false);
+ return split;
+ }
+
+ // Accessing Properties **************************************************
+
+ /**
+ * Checks and answers whether the divider border shall be visible or
+ * invisible. Note that this feature is not supported by all look&feels.
+ * Some look&feel implementation will always show a divider border, and
+ * conversely, others will never show a divider border.
+ *
+ * @return the desired (but potentially inaccurate) divider border visiblity
+ */
+ public boolean isDividerBorderVisible() {
+ return dividerBorderVisible;
+ }
+
+ /**
+ * Makes the divider border visible or invisible. Note that this feature is
+ * not supported by all look&feels. Some look&feel implementation
+ * will always show a divider border, and conversely, others will never show
+ * a divider border.
+ *
+ * @param newVisibility true for visible, false for invisible
+ */
+ public void setDividerBorderVisible(boolean newVisibility) {
+ boolean oldVisibility = isDividerBorderVisible();
+ if (oldVisibility == newVisibility) {
+ return;
+ }
+ dividerBorderVisible = newVisibility;
+ firePropertyChange(PROPERTYNAME_DIVIDER_BORDER_VISIBLE, oldVisibility,
+ newVisibility);
+ }
+
+ // Changing the Divider Border Visibility *********************************
+
+ /**
+ * Updates the UI and sets an empty divider border. The divider border may
+ * be restored by a L&F at UI installation time. And so, we try to reset it
+ * each time the UI is changed.
+ */
+ public void updateUI() {
+ super.updateUI();
+ if (!isDividerBorderVisible()) {
+ setEmptyDividerBorder();
+ }
+ }
+
+ /**
+ * Sets an empty divider border if and only if the UI is an instance of
+ * <code>BasicSplitPaneUI</code>.
+ */
+ private void setEmptyDividerBorder() {
+ SplitPaneUI splitPaneUI = getUI();
+ if (splitPaneUI instanceof BasicSplitPaneUI) {
+ BasicSplitPaneUI basicUI = (BasicSplitPaneUI) splitPaneUI;
+ basicUI.getDivider().setBorder(EMPTY_BORDER);
+ }
+ }
+
+}
Property changes on: trunk/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/UIFSplitPane.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
Added: trunk/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/WidgetUtil.java
===================================================================
--- trunk/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/WidgetUtil.java (rev 0)
+++ trunk/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/WidgetUtil.java 2014-02-24 14:27:22 UTC (rev 2800)
@@ -0,0 +1,77 @@
+/*
+ * #%L
+ * JAXX :: Extra Widgets
+ * %%
+ * Copyright (C) 2004 - 2010 CodeLutin
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Lesser Public License for more details.
+ *
+ * You should have received a copy of the GNU General Lesser Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/lgpl-3.0.html>.
+ * #L%
+ */
+
+/* *
+ * WidgetUtil.java
+ *
+ * Created: Jul 26, 2004
+ *
+ * @author Benjamin Poussin <poussin(a)codelutin.com>
+ * Copyright Code Lutin
+ * @version $Revision$
+ *
+ * Mise a jour: $Date$
+ * par : $Author$
+ */
+
+package org.nuiton.jaxx.widgets.extra;
+
+import java.awt.Component;
+import java.beans.XMLDecoder;
+import java.beans.XMLEncoder;
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+
+public class WidgetUtil { // WidgetUtil
+
+ public static Component makeDeepCopy(Component clone) throws Exception {
+ XMLEncoder e = null;
+ XMLDecoder d = null;
+ try {
+
+ ByteArrayOutputStream byteOut = new ByteArrayOutputStream();
+ e = new XMLEncoder(byteOut);
+ e.writeObject(clone);
+ e.flush();
+
+ ByteArrayInputStream byteIn = new ByteArrayInputStream(byteOut
+ .toByteArray());
+ d = new XMLDecoder(byteIn);
+
+ return (Component) d.readObject();
+
+ } catch (Exception eee) {
+ eee.printStackTrace();
+ throw (eee);
+ } finally {
+ if (e != null) {
+ e.close();
+ }
+ if (d != null) {
+ d.close();
+ }
+ }
+
+ }
+
+} // WidgetUtil
+
Property changes on: trunk/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/WidgetUtil.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
Added: trunk/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/XMLGridLayout.java
===================================================================
--- trunk/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/XMLGridLayout.java (rev 0)
+++ trunk/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/XMLGridLayout.java 2014-02-24 14:27:22 UTC (rev 2800)
@@ -0,0 +1,179 @@
+/*
+ * #%L
+ * JAXX :: Extra Widgets
+ * %%
+ * Copyright (C) 2004 - 2010 CodeLutin
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Lesser Public License for more details.
+ *
+ * You should have received a copy of the GNU General Lesser Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/lgpl-3.0.html>.
+ * #L%
+ */
+
+package org.nuiton.jaxx.widgets.extra;
+
+import java.awt.Component;
+import java.awt.Container;
+import java.awt.Dimension;
+import java.awt.GridBagConstraints;
+import java.awt.GridBagLayout;
+import java.awt.LayoutManager;
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.net.URL;
+import java.util.Map;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.nuiton.util.Resource;
+import org.xml.sax.SAXException;
+
+/**
+ * XMLGridLayout uses a XML input (a string, for the time being) to define the
+ * layout of components inside the container. To do this a set of constraints in
+ * the form of GridBagConstraints are build and associated to a name. When
+ * adding the component to the container, the name of the constraint to be used
+ * must be supplied, using the add(name,component) method. If the name
+ * associated to the component has no associated constrain, the component is not
+ * layout. <br>
+ * Implementation Note: Internally this class uses a GridBagLayout and delegates
+ * to it all the calculations necesary to layout the components.
+ *
+ * @author Rafael Alvarez
+ */
+// TODO: put a test in place... Just in case
+public class XMLGridLayout implements LayoutManager {
+ /** to use log facility, just put in your code: log.info(\"...\"); */
+ static private Log log = LogFactory.getLog(XMLGridLayout.class);
+
+ private Map constraints;
+ private GridBagLayout layout;
+ private String layoutString;
+
+ public XMLGridLayout(String layoutStringOrFile) {
+
+ /*
+ * // looking for file on filesystem first File file = new
+ * File(layoutStringOrFile); URL url = null; if(file.exists()){ try{ url
+ * = file.toURL(); }catch(MalformedURLException eee){ throw new
+ * RuntimeException("File exists but not convertible to URL: " + file,
+ * eee); } } else { // looking for file in classpath url =
+ * getClass().getResource(layoutStringOrFile); }
+ */
+ URL url = Resource.getURLOrNull(layoutStringOrFile);
+ log.debug("ask: " + layoutStringOrFile + " url: " + url);
+ if (url != null) {
+ // file found
+ init(url);
+ } else {
+ // no file found
+ init(layoutStringOrFile);
+ }
+ }
+
+ public XMLGridLayout(URL url) {
+ init(url);
+ }
+
+ protected void init(URL url) {
+ StringBuffer sb = new StringBuffer();
+ try {
+ BufferedReader in = new BufferedReader(new InputStreamReader(url
+ .openStream()));
+ int c = -1;
+ while ((c = in.read()) != -1) {
+ sb.append((char) c);
+ }
+ } catch (IOException eee) {
+ throw new RuntimeException("Error when reading file: " + url, eee);
+ }
+ init(sb.toString());
+ }
+
+ /**
+ * @param layoutString string that represente the layout
+ */
+ protected void init(String layoutString) {
+ // long initime = System.currentTimeMillis();
+ this.layout = new GridBagLayout();
+ this.layoutString = layoutString;
+ XMLGridParseConstraints parser = null;
+ try {
+ parser = new XMLGridParseConstraints();
+ } catch (SAXException e) {
+ throw new java.lang.RuntimeException(e);
+ }
+
+ try {
+ constraints = parser.parse(layoutString);
+ } catch (SAXException e) {
+ System.err.println(parser.getErrors());
+ throw new RuntimeException("Invalid layout string: " + layoutString);
+ }
+ // System.out.println("XMLGridLayout Initialization Elapsed Time:"
+ // +(System.currentTimeMillis() - initime) + "ms");
+ }
+
+ /**
+ * Binds a name in the layout to the specified component. If the name is not
+ * defined in the layout an error message will be send to System.err
+ *
+ * @param name The name in the layout to bind the component to
+ * @param comp The component to bind to the specified name.
+ */
+ @Override
+ public void addLayoutComponent(String name, Component comp) {
+ GridBagConstraints constraint = (GridBagConstraints) constraints
+ .get(name);
+ if (constraint != null) {
+ layout.addLayoutComponent(comp, constraint);
+ } else {
+ System.err
+ .println("(XMLGridLayout) No constraint defined for name "
+ + name);
+ }
+ }
+
+ @Override
+ public void removeLayoutComponent(Component comp) {
+ layout.removeLayoutComponent(comp);
+ }
+
+ @Override
+ public Dimension preferredLayoutSize(Container parent) {
+ return layout.preferredLayoutSize(parent);
+ }
+
+ @Override
+ public Dimension minimumLayoutSize(Container parent) {
+ return layout.minimumLayoutSize(parent);
+ }
+
+ @Override
+ public void layoutContainer(Container parent) {
+ // long initime = System.currentTimeMillis();
+ layout.layoutContainer(parent);
+ // System.out.println("XMLGridLayout Layout Elapsed Time:"
+ // +(System.currentTimeMillis() - initime) + "ms");
+
+ }
+
+ public GridBagConstraints getConstraint(String componentName) {
+ return (GridBagConstraints) constraints.get(componentName);
+ }
+
+ public String getLayoutString() {
+ return this.layoutString;
+ }
+}
Property changes on: trunk/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/XMLGridLayout.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
Added: trunk/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/XMLGridParseConstraints.java
===================================================================
--- trunk/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/XMLGridParseConstraints.java (rev 0)
+++ trunk/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/XMLGridParseConstraints.java 2014-02-24 14:27:22 UTC (rev 2800)
@@ -0,0 +1,334 @@
+/*
+ * #%L
+ * JAXX :: Extra Widgets
+ * %%
+ * Copyright (C) 2004 - 2010 CodeLutin
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Lesser Public License for more details.
+ *
+ * You should have received a copy of the GNU General Lesser Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/lgpl-3.0.html>.
+ * #L%
+ */
+
+package org.nuiton.jaxx.widgets.extra;
+
+import java.awt.GridBagConstraints;
+import java.awt.Insets;
+import java.awt.Point;
+import java.io.ByteArrayInputStream;
+import java.io.CharArrayWriter;
+import java.io.IOException;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.xml.sax.Attributes;
+import org.xml.sax.ErrorHandler;
+import org.xml.sax.InputSource;
+import org.xml.sax.SAXException;
+import org.xml.sax.SAXParseException;
+import org.xml.sax.XMLReader;
+import org.xml.sax.helpers.DefaultHandler;
+import org.xml.sax.helpers.XMLReaderFactory;
+
+/**
+ * Parses a XML input (a string, for the time being) into a Map of pairs (name,
+ * constraint)
+ *
+ * This class uses Apache Crimsom as the SaxParser
+ *
+ * @author Rafael Alvarez
+ */
+class XMLGridParseConstraints extends DefaultHandler {
+ XMLReader xr;
+ private int td;
+ private int tr;
+ private Map<String, GridBagConstraints> constraints;
+ private Map<String, GridBagConstraints> styles;
+ private GridBagConstraints constraint;
+ private int cellpadding;
+ private int cellspacing;
+ int anchor;
+ private static final int TOP = 0x0001;
+ private static final int BOTTOM = 0x0010;
+ private static final int LEFT = 0x0100;
+ private static final int RIGHT = 0x1000;
+ private static final int CENTER = 0x11111;
+ private boolean styleMode = false;
+ private String id;
+
+ /**
+ * permet de genere precisement la place de chaque td et de faire des
+ * decalage si necessaire
+ */
+ private Map<Point, GridBagConstraints> table;
+
+ public XMLGridParseConstraints() throws SAXException {
+ xr = XMLReaderFactory.createXMLReader();
+ xr.setContentHandler(this);
+ xr.setErrorHandler(new MyErrorHandler());
+ }
+
+ public Map<String, GridBagConstraints> parse(String s) throws SAXException {
+ constraints = new HashMap<String, GridBagConstraints>();
+ styles = new HashMap<String, GridBagConstraints>();
+ try {
+ xr.parse(new InputSource(new ByteArrayInputStream(s.getBytes())));
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+
+ return constraints;
+ }
+
+ private CharArrayWriter contents = new CharArrayWriter();
+
+ public void characters(char[] ch, int start, int length)
+ throws SAXException {
+ contents.write(ch, start, length);
+ }
+
+ public void startElement(String uri, String localName, String qName,
+ Attributes attributes) throws SAXException {
+ if (localName.equals("td")) {
+ handleOpenTD(attributes);
+ } else if (localName.equals("table")) {
+ handleOpenTable(attributes);
+ } else if (localName.equals("style")) {
+ handleOpenStyle(attributes);
+ } else if (localName.equals("styles")) {
+ handleOpenStyles();
+ }
+ }
+
+ public void endElement(String uri, String localName, String qName)
+ throws SAXException {
+ if (localName.equals("td")) {
+ handleCloseTD();
+ } else if (localName.equals("tr")) {
+ this.td = 0;
+ this.tr++;
+ } else if (localName.equals("table")) {
+ handleCloseTable();
+ } else if (localName.equals("style")) {
+ handleCloseTD();
+ } else if (localName.equals("styles")) {
+ handleCloseStyles();
+ }
+ }
+
+ private void handleOpenStyles() {
+ this.styleMode = true;
+ }
+
+ private void handleCloseStyles() {
+ this.styleMode = false;
+ }
+
+ private void handleOpenTable(Attributes attributes) {
+ table = new HashMap<Point, GridBagConstraints>();
+ for (int i = 0; i < attributes.getLength(); i++) {
+ String name = attributes.getLocalName(i);
+ String value = attributes.getValue(i);
+
+ if (name.equals("cellpadding")) {
+ cellpadding = Integer.parseInt(value); // CHECK for parse
+ // exception
+ } else if (name.equals("cellspacing")) {
+ cellspacing = Integer.parseInt(value); // CHECK for parse
+ // exception
+ }
+ }
+ }
+
+ private void handleCloseTable() {
+ cellpadding = -1;
+ cellspacing = -1;
+ }
+
+ private void handleOpenStyle(Attributes attributes) {
+ constraint = new GridBagConstraints();
+ fillConstraint(attributes);
+ }
+
+ private void handleOpenTD(Attributes attributes) {
+
+ String tdStyle = attributes.getValue("", "class");
+ GridBagConstraints constraintStyle = null;
+
+ if (tdStyle != null) {
+ constraintStyle = styles.get(tdStyle);
+ }
+
+ if (constraintStyle != null) {
+ constraint = (GridBagConstraints) constraintStyle.clone();
+ } else {
+ constraint = new GridBagConstraints();
+ }
+
+ fillConstraint(attributes);
+
+ // this.td += constraint.gridwidth;
+ }
+
+ private void fillConstraint(Attributes attributes) {
+ constraint.gridx = this.td;
+ constraint.gridy = this.tr;
+ constraint.ipadx = cellpadding;
+ constraint.ipady = cellpadding;
+ constraint.insets = new Insets(cellspacing, cellspacing, cellspacing,
+ cellspacing);
+
+ contents.reset();
+
+ int colspan = constraint.gridwidth;
+ int rowspan = constraint.gridheight;
+
+ for (int i = 0; i < attributes.getLength(); i++) {
+ String name = attributes.getLocalName(i);
+ String value = attributes.getValue(i);
+
+ if (name.equals("colspan")) {
+ colspan = Integer.parseInt(value); // CHECK for parse exception
+ } else if (name.equals("rowspan")) {
+ rowspan = Integer.parseInt(value); // CHECK for parse exception
+ } else if (name.equals("fill")) {
+ if (value.equalsIgnoreCase("BOTH")) {
+ constraint.fill = GridBagConstraints.BOTH;
+ } else if (value.equalsIgnoreCase("HORIZONTAL")) {
+ constraint.fill = GridBagConstraints.HORIZONTAL;
+ } else if (value.equalsIgnoreCase("VERTICAL")) {
+ constraint.fill = GridBagConstraints.VERTICAL;
+ } else if (value.equalsIgnoreCase("NONE")) {
+ constraint.fill = GridBagConstraints.NONE;
+ }
+ } else if (name.equals("valign")) {
+ if (value.equalsIgnoreCase("TOP")) {
+ anchor = anchor | TOP;
+ } else if (value.equalsIgnoreCase("BOTTOM")) {
+ anchor = anchor | BOTTOM;
+ } else if (value.equalsIgnoreCase("MIDDLE")) {
+ anchor = anchor | CENTER;
+ }
+ } else if (name.equals("align")) {
+ if (value.equalsIgnoreCase("LEFT")) {
+ anchor = anchor | LEFT;
+ } else if (value.equalsIgnoreCase("RIGHT")) {
+ anchor = anchor | RIGHT;
+ } else if (value.equalsIgnoreCase("CENTER")) {
+ anchor = anchor | CENTER;
+ }
+ } else if (name.equals("width")) {
+ constraint.weightx = Double.parseDouble(value.substring(0,
+ value.length() - 1)) / 100;
+ } else if (name.equals("height")) {
+ constraint.weighty = Double.parseDouble(value.substring(0,
+ value.length() - 1)) / 100;
+ } else if (name.equals("id")) {
+ this.id = value;
+ }
+ }
+
+ constraint.gridwidth = colspan;
+ constraint.gridheight = rowspan;
+
+ if (!this.styleMode) {
+ // looking for first empty slot in table
+ Point p = new Point(constraint.gridx, constraint.gridy);
+ GridBagConstraints old = table.get(p);
+ while (old != null) {
+ p.translate(1, 0);
+ old = table.get(p);
+ }
+ constraint.gridx = (int) p.getX();
+ constraint.gridy = (int) p.getY();
+
+ // mark all used slot by this contrains in table map
+ for (int x = 0; x < colspan; x++) {
+ for (int y = 0; y < rowspan; y++) {
+ Point newPoint = p.getLocation();
+ newPoint.translate(x, y);
+ table.put(newPoint, constraint);
+ }
+ }
+ }
+ }
+
+ private void handleCloseTD() {
+ switch (anchor) {
+ case LEFT:
+ constraint.anchor = GridBagConstraints.WEST;
+ break;
+ case RIGHT:
+ constraint.anchor = GridBagConstraints.EAST;
+ break;
+ case CENTER:
+ constraint.anchor = GridBagConstraints.CENTER;
+ break;
+ case TOP:
+ constraint.anchor = GridBagConstraints.NORTH;
+ break;
+ case BOTTOM:
+ constraint.anchor = GridBagConstraints.SOUTH;
+ break;
+ case TOP | LEFT:
+ constraint.anchor = GridBagConstraints.NORTHWEST;
+ break;
+ case TOP | RIGHT:
+ constraint.anchor = GridBagConstraints.NORTHEAST;
+ break;
+ case BOTTOM | LEFT:
+ constraint.anchor = GridBagConstraints.SOUTHWEST;
+ break;
+ case BOTTOM | RIGHT:
+ constraint.anchor = GridBagConstraints.SOUTHEAST;
+ break;
+ }
+ if (this.styleMode) {
+ styles.put(this.id, constraint);
+ } else {
+ constraints.put(contents.toString().trim(), constraint);
+ }
+ contents.reset();
+ anchor = 0;
+ }
+
+ public String getErrors() {
+ MyErrorHandler errorHandler = (MyErrorHandler) xr.getErrorHandler();
+ return errorHandler.getErrors();
+ }
+
+ public Map<String, GridBagConstraints> getStyles() {
+ return Collections.unmodifiableMap(this.styles);
+ }
+
+ class MyErrorHandler implements ErrorHandler {
+ StringBuffer errors = new StringBuffer();
+
+ public void error(SAXParseException e) throws SAXException {
+ errors.append(e.getMessage()).append("\n");
+ }
+
+ public void fatalError(SAXParseException e) throws SAXException {
+ errors.append(e.getMessage()).append("\n");
+ }
+
+ public void warning(SAXParseException e) throws SAXException {
+ errors.append(e.getMessage()).append(Character.LINE_SEPARATOR);
+ }
+
+ public String getErrors() {
+ return errors.toString();
+ }
+ }
+}
Property changes on: trunk/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/XMLGridParseConstraints.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
Added: trunk/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/datatips/DataTipCell.java
===================================================================
--- trunk/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/datatips/DataTipCell.java (rev 0)
+++ trunk/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/datatips/DataTipCell.java 2014-02-24 14:27:22 UTC (rev 2800)
@@ -0,0 +1,66 @@
+/*
+ * %%Ignore-License
+ *
+ * Copyright (c) 2002 - 2005, Stephen Kelvin Friedrich. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification,
+ * are permitted provided that the following conditions are met:
+ *
+ * - Redistributions of source code must retain the above copyright notice, this list
+ * of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright notice, this
+ * list of conditions and the following disclaimer in the documentation and/or other
+ * materials provided with the distribution.
+ * - Neither the name of the copyright holder nor the names of its contributors may be
+ * used to endorse or promote products derived from this software without specific
+ * prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
+ * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+ * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+package org.nuiton.jaxx.widgets.extra.datatips;
+
+import java.awt.*;
+
+interface DataTipCell {
+
+ boolean isSet();
+
+ Component getRendererComponent();
+
+ Rectangle getCellBounds();
+
+ /**
+ * 'Null' value for cells (location is outside of any cell bounds).
+ */
+ DataTipCell NONE = new DataTipCell() {
+
+ public boolean isSet() {
+ return false;
+ }
+
+ public Component getRendererComponent() {
+ return null;
+ }
+
+ public Rectangle getCellBounds() {
+ return null;
+ }
+
+ public boolean equals(Object obj) {
+ return false;
+ }
+
+ public int hashCode() {
+ return 0;
+ }
+ };
+}
Property changes on: trunk/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/datatips/DataTipCell.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
Added: trunk/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/datatips/DataTipComponent.java
===================================================================
--- trunk/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/datatips/DataTipComponent.java (rev 0)
+++ trunk/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/datatips/DataTipComponent.java 2014-02-24 14:27:22 UTC (rev 2800)
@@ -0,0 +1,118 @@
+/*
+ * %%Ignore-License
+ *
+ * Copyright (c) 2002 - 2005, Stephen Kelvin Friedrich. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification,
+ * are permitted provided that the following conditions are met:
+ *
+ * - Redistributions of source code must retain the above copyright notice, this list
+ * of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright notice, this
+ * list of conditions and the following disclaimer in the documentation and/or other
+ * materials provided with the distribution.
+ * - Neither the name of the copyright holder nor the names of its contributors may be
+ * used to endorse or promote products derived from this software without specific
+ * prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
+ * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+ * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+package org.nuiton.jaxx.widgets.extra.datatips;
+
+import javax.swing.*;
+import java.awt.*;
+import java.awt.event.MouseEvent;
+import java.awt.event.MouseWheelEvent;
+
+/**
+ * Note: It's important to inherit from JToolTip: Mouse events get dispatched to the parent.<br/>
+ * I do not really know why this is so. At least PopupFactory creates a different type of popup
+ * if the content is instance of JToolTip.
+ */
+class DataTipComponent extends JToolTip {
+ private DataTipCell cell;
+ private CellRendererPane rendererPane;
+ private Rectangle withoutBorderRectangle;
+ private Color backgroundColor;
+ private boolean isHeavyWeight;
+
+ DataTipComponent(DataTipCell cell, Rectangle withoutBorderRectangle, Color backgroundColor) {
+ this.cell = cell;
+ this.withoutBorderRectangle = withoutBorderRectangle;
+ this.backgroundColor = backgroundColor;
+ rendererPane = new CellRendererPane();
+ add(rendererPane);
+ setFocusable(false);
+ setBorder(null);
+ enableEvents(AWTEvent.MOUSE_EVENT_MASK | AWTEvent.MOUSE_MOTION_EVENT_MASK | AWTEvent.MOUSE_WHEEL_EVENT_MASK);
+ }
+
+ /**
+ * Overriden, so that Swing does not create a ToolTipUI.
+ */
+ public void updateUI() {
+ }
+
+ /**
+ * Overriden to always return false, so that no component ever receives mouse events.
+ * Instead a mouse press will be caught on the popup's window ancestor, the popup will be hidden and the mouse press redispatched
+ * to the underlying component.
+ */
+ public boolean contains(int x, int y) {
+ return isHeavyWeight;
+ }
+
+ protected void processMouseEvent(MouseEvent e) {
+ DataTipManager.get().handleEventFromDataTipComponent(e);
+ }
+
+ protected void processMouseMotionEvent(MouseEvent e) {
+ DataTipManager.get().handleEventFromDataTipComponent(e);
+ }
+
+ protected void processMouseWheelEvent(MouseWheelEvent e) {
+ DataTipManager.get().handleEventFromDataTipComponent(e);
+ }
+
+ public void paintComponent(Graphics g) {
+ Component component = cell.getRendererComponent();
+
+ // Leave the component's opacity settings as is, just paint the background myself.
+ // This seems to be the only viable solution: DefaultTableCellRenderer overrides isOpaque() and returns
+ // true only if renderer color does not equal parent color. The problem is that rendererPane.paintComponent()
+ // re-parents the renderer.
+ g.setColor(backgroundColor);
+ int width = getWidth();
+ int height = getHeight();
+ g.fillRect(0, 0, width, height);
+
+ g.setColor(Color.black);
+ g.drawRect(0, 0, width - 1, height - 1);
+
+ if (withoutBorderRectangle != null) {
+ Shape oldClip = g.getClip();
+ g.setClip(withoutBorderRectangle);
+ g.setColor(backgroundColor);
+ g.fillRect(0, 0, width, height);
+ g.setClip(oldClip);
+ }
+
+ g.setClip(1, 1, width - 2, height - 2);
+ rendererPane.paintComponent(g, component, this, 0, 0, width, height);
+ g.setClip(withoutBorderRectangle);
+ rendererPane.paintComponent(g, component, this, 0, 0, width, height);
+ }
+
+ public void setHeavyWeight(boolean isHeavyWeight) {
+ this.isHeavyWeight = isHeavyWeight;
+ }
+}
Property changes on: trunk/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/datatips/DataTipComponent.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
Added: trunk/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/datatips/DataTipListener.java
===================================================================
--- trunk/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/datatips/DataTipListener.java (rev 0)
+++ trunk/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/datatips/DataTipListener.java 2014-02-24 14:27:22 UTC (rev 2800)
@@ -0,0 +1,232 @@
+/*
+ * %%Ignore-License
+ *
+ * Copyright (c) 2002 - 2005, Stephen Kelvin Friedrich. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification,
+ * are permitted provided that the following conditions are met:
+ *
+ * - Redistributions of source code must retain the above copyright notice, this list
+ * of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright notice, this
+ * list of conditions and the following disclaimer in the documentation and/or other
+ * materials provided with the distribution.
+ * - Neither the name of the copyright holder nor the names of its contributors may be
+ * used to endorse or promote products derived from this software without specific
+ * prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
+ * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+ * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+package org.nuiton.jaxx.widgets.extra.datatips;
+
+import javax.swing.*;
+import javax.swing.event.MouseInputAdapter;
+import java.awt.*;
+import java.awt.event.ComponentEvent;
+import java.awt.event.ComponentListener;
+import java.awt.event.MouseEvent;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+
+abstract class DataTipListener extends MouseInputAdapter implements ComponentListener {
+ private DataTipPopup dataTipPopup;
+
+ // When running under JDK 1.5 (or higher) DataTipListener will check if the tip must be updated when the parent
+ // component changes size or moves.
+ // With JDK 1.4 or earlier this does not work, because no mouse event gets posted (even though the relative mouse
+ // position changes) - yet to be able to compile with 1.4 the necessary JDK 1.5 methods are called by reflection.
+ // On JDK 1.4 the popup is just always hidden qwhen the component changes (and reshown when the user first moves
+ // the mouse again).
+ private static final Class[] NO_PARAMETERS = new Class[0];
+ private static final Object[] NO_ARGUMENTS = new Object[0];
+ private static Class mouseInfoClass;
+ private static Method getPointerInfoMethod;
+ private static Class pointerInfoClass;
+ private static Method getLocationMethod;
+
+ static {
+ try {
+ mouseInfoClass = Class.forName("java.awt.MouseInfo");
+ getPointerInfoMethod = mouseInfoClass.getMethod("getPointerInfo", NO_PARAMETERS);
+ pointerInfoClass = Class.forName("java.awt.PointerInfo");
+ getLocationMethod = pointerInfoClass.getMethod("getLocation", NO_PARAMETERS);
+ }
+ catch(NoSuchMethodException e) {
+ // fine probably running on pre-1.5-JDK
+ }
+ catch(ClassNotFoundException e) {
+ // fine probably running on pre-1.5-JDK
+ }
+ }
+
+ DataTipListener() {
+ }
+
+ /**
+ * @return the cell that is at position 'point' in the component or DataTipCell.NONE if there isn't a cell at that
+ * point.
+ */
+ abstract DataTipCell getCell(JComponent component, Point point);
+
+ /**
+ * If the user presses a mouse button on a popup, Swing's behaviour depends on the popup type:
+ * - lightweight popup:
+ * This case is handled here. Because the TipComponent.contains(int x, int y) is overriden to always return false
+ * Swing will dispath the event directly to the parent component.
+ * - heavyweight popup:
+ * Swing will dispatch the event to the popup's window, which is handled in DataTipPopup.
+ */
+ public void mousePressed(MouseEvent e) {
+ //hideTip(); Can't: Double click would not work. Click count of the second click would be '1', because it would
+ // go to a different window (for heavyweight datatips).
+ }
+
+ public void mouseEntered(MouseEvent event) {
+ checkShowOrHide(event);
+ }
+
+ public void mouseExited(MouseEvent event) {
+ checkShowOrHide(event);
+ }
+
+ public void mouseDragged(MouseEvent event) {
+ checkShowOrHide(event);
+ }
+
+ public void mouseMoved(MouseEvent event) {
+ checkShowOrHide(event);
+ }
+
+ private void checkShowOrHide(MouseEvent event) {
+ JComponent component = (JComponent) event.getSource();
+ Point mousePosition = event.getPoint();
+ checkShowOrHide(component, mousePosition);
+ }
+
+ private void checkShowOrHide(JComponent component, Point mousePosition) {
+ Window windowAncestor = SwingUtilities.getWindowAncestor(component);
+ if (windowAncestor == null || !windowAncestor.isActive()) {
+ hideTip();
+ return;
+ }
+
+ DataTipCell dataTipCell = getCell(component, mousePosition);
+ Rectangle visRect = component.getVisibleRect();
+
+ if(!visRect.contains(mousePosition)) {
+ dataTipCell = DataTipCell.NONE;
+ }
+
+ DataTipCell currentPopupCell = getCurrentPopupCell();
+ if(dataTipCell.equals(currentPopupCell)) {
+ return;
+ }
+
+ hideTip();
+ if(!dataTipCell.isSet()) {
+ return;
+ }
+
+ dataTipPopup = createPopup(component, mousePosition, dataTipCell);
+ }
+
+ private DataTipCell getCurrentPopupCell() {
+ if(!isTipShown()) {
+ return DataTipCell.NONE;
+ }
+ return dataTipPopup.getCell();
+ }
+
+ private DataTipPopup createPopup(JComponent component, Point mousePosition, DataTipCell dataTipCell) {
+ Rectangle cellBounds = dataTipCell.getCellBounds();
+
+ Rectangle visRect = component.getVisibleRect();
+ Rectangle visibleCellRectangle = cellBounds.intersection(visRect);
+ if (!visibleCellRectangle.contains(mousePosition)) {
+ return null;
+ }
+
+ Component rendererComponent = dataTipCell.getRendererComponent();
+ Dimension rendCompDim = rendererComponent.getMinimumSize();
+ Rectangle rendCompBounds = new Rectangle(cellBounds.getLocation(), rendCompDim);
+ if(cellBounds.contains(rendCompBounds) && visRect.contains(rendCompBounds)) {
+ return null;
+ }
+
+ Dimension preferredSize = rendererComponent.getPreferredSize();
+ Point tipPosition = cellBounds.getLocation();
+ int width = Math.max(cellBounds.width, preferredSize.width);
+ int height = Math.max(cellBounds.height, preferredSize.height);
+ Dimension tipDimension = new Dimension(width, height);
+ DataTipPopup dataTipPopup = new DataTipPopup(component, dataTipCell, tipPosition, tipDimension);
+
+ return dataTipPopup;
+ }
+
+ private boolean isTipShown() {
+ return dataTipPopup != null && dataTipPopup.isTipShown();
+ }
+
+ private void hideTip() {
+ if (dataTipPopup != null) {
+ dataTipPopup.hideTip();
+ dataTipPopup = null;
+ }
+ }
+
+ public void componentResized(ComponentEvent e) {
+ checkShowOrHide(e);
+ }
+
+ public void componentMoved(ComponentEvent e) {
+ checkShowOrHide(e);
+ }
+
+ public void componentShown(ComponentEvent e) {
+ checkShowOrHide(e);
+ }
+
+ public void componentHidden(ComponentEvent e) {
+ hideTip();
+ }
+
+ private void checkShowOrHide(ComponentEvent e) {
+ JComponent component = (JComponent) e.getSource();
+ Point mousePosition = getCurrentMousePosition();
+ if(mousePosition == null) {
+ hideTip();
+ }
+ else {
+ SwingUtilities.convertPointFromScreen(mousePosition, component);
+ checkShowOrHide(component, mousePosition);
+ }
+ }
+
+ private static Point getCurrentMousePosition() {
+ if(mouseInfoClass == null) {
+ return null;
+ }
+ try {
+ Object pointerInfo = getPointerInfoMethod.invoke(null, NO_ARGUMENTS);
+ Point mousePosition = (Point) getLocationMethod.invoke(pointerInfo, NO_ARGUMENTS);
+ return mousePosition;
+ }
+ catch(IllegalAccessException e) {
+ // strange, but nothing I can do here
+ }
+ catch(InvocationTargetException e) {
+ // strange, but nothing I can do here
+ }
+
+ return null;
+ }
+}
Property changes on: trunk/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/datatips/DataTipListener.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
Added: trunk/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/datatips/DataTipManager.java
===================================================================
--- trunk/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/datatips/DataTipManager.java (rev 0)
+++ trunk/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/datatips/DataTipManager.java 2014-02-24 14:27:22 UTC (rev 2800)
@@ -0,0 +1,213 @@
+/*
+ * %%Ignore-License
+ *
+ * Copyright (c) 2002 - 2005, Stephen Kelvin Friedrich. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification,
+ * are permitted provided that the following conditions are met:
+ *
+ * - Redistributions of source code must retain the above copyright notice, this list
+ * of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright notice, this
+ * list of conditions and the following disclaimer in the documentation and/or other
+ * materials provided with the distribution.
+ * - Neither the name of the copyright holder nor the names of its contributors may be
+ * used to endorse or promote products derived from this software without specific
+ * prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
+ * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+ * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+package org.nuiton.jaxx.widgets.extra.datatips;
+
+import javax.swing.*;
+import java.awt.*;
+import java.awt.event.AWTEventListener;
+import java.awt.event.MouseEvent;
+import java.awt.event.MouseWheelEvent;
+import java.security.AccessControlException;
+
+/**
+ * <code>DataTipManager</code> provides data tips for tree, table and list components. Whenever the mouse cursor is
+ * over a cell whose content is partially hidden a popup with the complete cell content is shown.
+ * The cell content can be hidden because it is clipped at either the parent component bounds (e.g. scrollpane) or at
+ * the cell bounds (e.g. table row height is too small).
+ */
+public class DataTipManager {
+ private static DataTipManager instance;
+
+ private ListDataTipListener listMouseListener = new ListDataTipListener();
+ private TableDataTipListener tableMouseListener = new TableDataTipListener();
+ private TreeDataTipListener treeMouseListener = new TreeDataTipListener();
+ private Component parentComponent;
+ private Window tipComponentWindow;
+ private MouseEvent lastMouseEvent;
+ private static boolean allowUntrustedUsage;
+
+ private DataTipManager() {
+ try {
+ long eventMask = AWTEvent.MOUSE_EVENT_MASK | AWTEvent.MOUSE_MOTION_EVENT_MASK | AWTEvent.MOUSE_WHEEL_EVENT_MASK;
+ Toolkit.getDefaultToolkit().addAWTEventListener(new MouseEventModifier(), eventMask);
+ }
+ catch(AccessControlException e) {
+ if(!allowUntrustedUsage) {
+ throw new RuntimeException("DataTipManager needs to run in a trusted application", e);
+ }
+ }
+ }
+
+ static void enableUntrustedUsage(boolean enable) {
+ allowUntrustedUsage = enable;
+ }
+
+ /**
+ * @return the single, shared instance of the DataTipmanager
+ */
+ public static synchronized DataTipManager get() {
+ if(instance == null) {
+ instance = new DataTipManager();
+ }
+ return instance;
+ }
+
+ /**
+ * Enable data tips for a list component.
+ * @param list the list which should be enhanced with data tips.
+ */
+ public synchronized void register(JList list) {
+ list.addMouseListener(listMouseListener);
+ list.addMouseMotionListener(listMouseListener);
+ list.addComponentListener(listMouseListener);
+ }
+
+ /**
+ * Enable data tips for a tree component.
+ * @param tree the tree which should be enhanced with data tips.
+ */
+ public synchronized void register(JTree tree) {
+ tree.addMouseListener(treeMouseListener);
+ tree.addMouseMotionListener(treeMouseListener);
+ tree.addComponentListener(treeMouseListener);
+ }
+
+ /**
+ * Enable data tips for a list component.
+ * @param table the table which should be enhanced with data tips.
+ */
+ public synchronized void register(JTable table) {
+ table.addMouseListener(tableMouseListener);
+ table.addMouseMotionListener(tableMouseListener);
+ table.addComponentListener(tableMouseListener);
+ }
+
+ void setTipWindow(Component parentComponent, Window dataTipComponent) {
+ this.parentComponent = parentComponent;
+ tipComponentWindow = dataTipComponent;
+ }
+
+ public boolean handleEventFromParentComponent(MouseEvent mouseEvent) {
+ // filter out events that come from client explicitly calling this method, but we have already handled in awt event listener
+ if(mouseEvent == lastMouseEvent) {
+ return false;
+ }
+ Object source = mouseEvent.getSource();
+ if(source != parentComponent) {
+ return false;
+ }
+ int id = mouseEvent.getID();
+ int x = mouseEvent.getX();
+ int y = mouseEvent.getY();
+ long when = mouseEvent.getWhen();
+ int modifiers = mouseEvent.getModifiers();
+ int clickCount = mouseEvent.getClickCount();
+ boolean isPopupTrigger = mouseEvent.isPopupTrigger();
+ if(id == MouseEvent.MOUSE_EXITED) {
+ Point point = SwingUtilities.convertPoint(parentComponent, x, y, tipComponentWindow);
+ if(tipComponentWindow.contains(point)) {
+ MouseEvent newEvent = new MouseEvent(parentComponent, MouseEvent.MOUSE_MOVED, when, modifiers,
+ x, y, clickCount, isPopupTrigger);
+ parentComponent.dispatchEvent(newEvent);
+ // If the datatip has been hidden as a result, then process the exit event, too, so that
+ // e.g. tooltips will hide.
+ boolean stillVisible = parentComponent != null;
+ return stillVisible;
+ }
+ }
+ return false;
+ }
+
+ public void handleEventFromDataTipComponent(MouseEvent mouseEvent) {
+ mouseEvent.consume();
+ int id = mouseEvent.getID();
+ if(id != MouseEvent.MOUSE_ENTERED) {
+ int x = mouseEvent.getX();
+ int y = mouseEvent.getY();
+ Point point = SwingUtilities.convertPoint(mouseEvent.getComponent(), x, y, parentComponent);
+
+ if(id == MouseEvent.MOUSE_EXITED && parentComponent.contains(point)) {
+ return;
+ }
+ long when = mouseEvent.getWhen();
+ int modifiers = mouseEvent.getModifiers();
+ int clickCount = mouseEvent.getClickCount();
+ boolean isPopupTrigger = mouseEvent.isPopupTrigger();
+ MouseEvent newEvent;
+ if(id == MouseEvent.MOUSE_WHEEL) {
+ MouseWheelEvent mouseWheelEvent = (MouseWheelEvent) mouseEvent;
+ int scrollType = mouseWheelEvent.getScrollType();
+ int scrollAmount = mouseWheelEvent.getScrollAmount();
+ int wheelRotation = mouseWheelEvent.getWheelRotation();
+ newEvent = new MouseWheelEvent(parentComponent, id, when, modifiers, point.x, point.y,
+ clickCount, isPopupTrigger, scrollType, scrollAmount,
+ wheelRotation);
+ }
+ else {
+ newEvent = new MouseEvent(parentComponent, id, when, modifiers, point.x, point.y,
+ clickCount, isPopupTrigger);
+ }
+ Component parentComponentBackup = parentComponent;
+ parentComponent.dispatchEvent(newEvent);
+ if(parentComponent == null && id != MouseEvent.MOUSE_EXITED) {
+ MouseEvent exitEvent = new MouseEvent(parentComponentBackup, MouseEvent.MOUSE_EXITED, when,
+ modifiers, point.x, point.y, clickCount, isPopupTrigger);
+ parentComponentBackup.dispatchEvent(exitEvent);
+ }
+ if(tipComponentWindow != null && id != MouseEvent.MOUSE_MOVED) {
+ // mouse click might have changed appearance (e.g. selection color)
+ tipComponentWindow.repaint();
+ }
+ }
+ }
+
+ private class MouseEventModifier implements AWTEventListener {
+ private MouseEventModifier() {
+ }
+
+ public void eventDispatched(AWTEvent event) {
+ if(tipComponentWindow == null) {
+ return;
+ }
+ Object source = event.getSource();
+
+ if(source == parentComponent) {
+ MouseEvent mouseEvent = (MouseEvent) event;
+ boolean filter = handleEventFromParentComponent(mouseEvent);
+ if(filter) {
+ mouseEvent.consume();
+ }
+ else {
+ lastMouseEvent = mouseEvent;
+ }
+ }
+ }
+ }
+}
+
Property changes on: trunk/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/datatips/DataTipManager.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
Added: trunk/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/datatips/DataTipPopup.java
===================================================================
--- trunk/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/datatips/DataTipPopup.java (rev 0)
+++ trunk/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/datatips/DataTipPopup.java 2014-02-24 14:27:22 UTC (rev 2800)
@@ -0,0 +1,91 @@
+/*
+ * %%Ignore-License
+ *
+ * Copyright (c) 2002 - 2005, Stephen Kelvin Friedrich. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification,
+ * are permitted provided that the following conditions are met:
+ *
+ * - Redistributions of source code must retain the above copyright notice, this list
+ * of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright notice, this
+ * list of conditions and the following disclaimer in the documentation and/or other
+ * materials provided with the distribution.
+ * - Neither the name of the copyright holder nor the names of its contributors may be
+ * used to endorse or promote products derived from this software without specific
+ * prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
+ * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+ * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+package org.nuiton.jaxx.widgets.extra.datatips;
+
+import javax.swing.*;
+import java.awt.*;
+
+class DataTipPopup {
+ private Popup popup;
+ private DataTipCell cell;
+
+ DataTipPopup(JComponent parent, DataTipCell cell, Point tipPosition, Dimension tipDimension) {
+ this.cell = cell;
+ Rectangle parentVisibleRect = parent.getVisibleRect();
+ Rectangle withoutBorderRectangle = parentVisibleRect.intersection(new Rectangle(tipPosition, tipDimension));
+ withoutBorderRectangle.translate(-tipPosition.x, -tipPosition.y);
+
+ DataTipComponent dataTipComponent = new DataTipComponent(cell, withoutBorderRectangle, parent.getBackground());
+
+ Dimension tipDimensionClipped = new Dimension(tipDimension.width, tipDimension.height);
+ Window windowAncestor = SwingUtilities.getWindowAncestor(parent);
+ GraphicsConfiguration gc = windowAncestor.getGraphicsConfiguration();
+ Rectangle screenBounds = gc.getBounds();
+ Point tipScreenPosition = new Point(tipPosition.x, tipPosition.y);
+ SwingUtilities.convertPointToScreen(tipScreenPosition, parent);
+ Point tipPositionClipped = new Point();
+ tipPositionClipped.x = Math.max(tipScreenPosition.x, screenBounds.x);
+ tipPositionClipped.y = Math.max(tipScreenPosition.y, screenBounds.y);
+ tipDimensionClipped.width = Math.min(screenBounds.x + screenBounds.width - tipPositionClipped.x, tipDimensionClipped.width);
+ tipDimensionClipped.height = Math.min(screenBounds.y + screenBounds.height - tipPositionClipped.y, tipDimensionClipped.height);
+ SwingUtilities.convertPointFromScreen(tipPositionClipped, parent);
+ dataTipComponent.setPreferredSize(tipDimensionClipped);
+ SwingUtilities.convertPointToScreen(tipPosition, parent);
+
+ PopupFactory popupFactory = PopupFactory.getSharedInstance();
+ popup = popupFactory.getPopup(parent, dataTipComponent, tipPosition.x, tipPosition.y);
+ popup.show();
+ Window componentWindow = SwingUtilities.windowForComponent(parent);
+ Window tipWindow = SwingUtilities.windowForComponent(dataTipComponent);
+ //noinspection ObjectEquality
+ boolean isHeavyWeight = tipWindow != null && tipWindow != componentWindow;
+ dataTipComponent.setHeavyWeight(isHeavyWeight);
+ if (isHeavyWeight) {
+// ToolTipManager.sharedInstance().registerComponent(dataTipComponent);
+ DataTipManager.get().setTipWindow(parent, tipWindow);
+ }
+ }
+
+ DataTipCell getCell() {
+ return cell;
+ }
+
+ void hideTip() {
+ if (popup != null) {
+ popup.hide();
+ popup = null;
+
+ DataTipManager.get().setTipWindow(null, null);
+ }
+ }
+
+ public boolean isTipShown() {
+ return popup != null;
+ }
+}
Property changes on: trunk/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/datatips/DataTipPopup.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
Added: trunk/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/datatips/ListDataTipCell.java
===================================================================
--- trunk/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/datatips/ListDataTipCell.java (rev 0)
+++ trunk/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/datatips/ListDataTipCell.java 2014-02-24 14:27:22 UTC (rev 2800)
@@ -0,0 +1,81 @@
+/*
+ * %%Ignore-License
+ *
+ * Copyright (c) 2002 - 2005, Stephen Kelvin Friedrich. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification,
+ * are permitted provided that the following conditions are met:
+ *
+ * - Redistributions of source code must retain the above copyright notice, this list
+ * of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright notice, this
+ * list of conditions and the following disclaimer in the documentation and/or other
+ * materials provided with the distribution.
+ * - Neither the name of the copyright holder nor the names of its contributors may be
+ * used to endorse or promote products derived from this software without specific
+ * prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
+ * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+ * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+package org.nuiton.jaxx.widgets.extra.datatips;
+
+import javax.swing.*;
+import java.awt.*;
+
+class ListDataTipCell implements DataTipCell {
+ private final JList list;
+ private final int rowIndex;
+
+ ListDataTipCell(JList list, int rowIndex) {
+ this.list = list;
+ this.rowIndex = rowIndex;
+ }
+
+ public boolean isSet() {
+ return rowIndex >= 0;
+ }
+
+ public Rectangle getCellBounds() {
+ Rectangle cellRect = list.getCellBounds(rowIndex, rowIndex);
+ return cellRect;
+ }
+
+ public Component getRendererComponent() {
+ Object item = list.getModel().getElementAt(rowIndex);
+ boolean isSelected = list.isSelectedIndex(rowIndex);
+ boolean isFocussed = list.hasFocus() && rowIndex == list.getLeadSelectionIndex();
+ ListCellRenderer renderer = list.getCellRenderer();
+ Component component = renderer.getListCellRendererComponent(list, item, rowIndex, isSelected, isFocussed);
+ return component;
+ }
+
+ public boolean equals(Object o) {
+ if(this == o) {
+ return true;
+ }
+ if(o == null || getClass() != o.getClass()) {
+ return false;
+ }
+
+ ListDataTipCell listDataTipCell = (ListDataTipCell) o;
+
+ if(rowIndex != listDataTipCell.rowIndex) {
+ return false;
+ }
+
+ return true;
+ }
+
+ public int hashCode() {
+ return rowIndex;
+ }
+}
Property changes on: trunk/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/datatips/ListDataTipCell.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
Added: trunk/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/datatips/ListDataTipListener.java
===================================================================
--- trunk/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/datatips/ListDataTipListener.java (rev 0)
+++ trunk/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/datatips/ListDataTipListener.java 2014-02-24 14:27:22 UTC (rev 2800)
@@ -0,0 +1,46 @@
+/*
+ * %%Ignore-License
+ *
+ * Copyright (c) 2002 - 2005, Stephen Kelvin Friedrich. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification,
+ * are permitted provided that the following conditions are met:
+ *
+ * - Redistributions of source code must retain the above copyright notice, this list
+ * of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright notice, this
+ * list of conditions and the following disclaimer in the documentation and/or other
+ * materials provided with the distribution.
+ * - Neither the name of the copyright holder nor the names of its contributors may be
+ * used to endorse or promote products derived from this software without specific
+ * prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
+ * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+ * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+package org.nuiton.jaxx.widgets.extra.datatips;
+
+import javax.swing.*;
+import java.awt.*;
+
+class ListDataTipListener extends DataTipListener {
+ ListDataTipListener() {
+ }
+
+ DataTipCell getCell(JComponent component, Point point) {
+ JList list = (JList) component;
+ int index = list.locationToIndex(point);
+ if (index < 0) {
+ return DataTipCell.NONE;
+ }
+ return new ListDataTipCell(list, index);
+ }
+}
Property changes on: trunk/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/datatips/ListDataTipListener.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
Added: trunk/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/datatips/TableDataTipCell.java
===================================================================
--- trunk/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/datatips/TableDataTipCell.java (rev 0)
+++ trunk/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/datatips/TableDataTipCell.java 2014-02-24 14:27:22 UTC (rev 2800)
@@ -0,0 +1,87 @@
+/*
+ * %%Ignore-License
+ *
+ * Copyright (c) 2002 - 2005, Stephen Kelvin Friedrich. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification,
+ * are permitted provided that the following conditions are met:
+ *
+ * - Redistributions of source code must retain the above copyright notice, this list
+ * of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright notice, this
+ * list of conditions and the following disclaimer in the documentation and/or other
+ * materials provided with the distribution.
+ * - Neither the name of the copyright holder nor the names of its contributors may be
+ * used to endorse or promote products derived from this software without specific
+ * prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
+ * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+ * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+package org.nuiton.jaxx.widgets.extra.datatips;
+
+import javax.swing.*;
+import javax.swing.table.TableCellRenderer;
+import java.awt.*;
+
+class TableDataTipCell implements DataTipCell {
+ private final JTable table;
+ private final int rowIndex;
+ private final int columnIndex;
+
+ TableDataTipCell(JTable table, int rowIndex, int columnIndex) {
+ this.table = table;
+ this.rowIndex = rowIndex;
+ this.columnIndex = columnIndex;
+ }
+
+ public boolean isSet() {
+ return rowIndex >= 0 && columnIndex >= 0;
+ }
+
+ public Rectangle getCellBounds() {
+ Rectangle cellRect = table.getCellRect(rowIndex, columnIndex, false);
+ return cellRect;
+ }
+
+ public Component getRendererComponent() {
+ TableCellRenderer cellRenderer = table.getCellRenderer(rowIndex, columnIndex);
+ Component component = table.prepareRenderer(cellRenderer, rowIndex, columnIndex);
+ return component;
+ }
+
+ public boolean equals(Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+
+ TableDataTipCell cellPosition = (TableDataTipCell) o;
+
+ if (columnIndex != cellPosition.columnIndex) {
+ return false;
+ }
+ if (rowIndex != cellPosition.rowIndex) {
+ return false;
+ }
+
+ return true;
+ }
+
+ public int hashCode() {
+ int result;
+ result = rowIndex;
+ result = 29 * result + columnIndex;
+ return result;
+ }
+}
Property changes on: trunk/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/datatips/TableDataTipCell.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
Added: trunk/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/datatips/TableDataTipListener.java
===================================================================
--- trunk/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/datatips/TableDataTipListener.java (rev 0)
+++ trunk/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/datatips/TableDataTipListener.java 2014-02-24 14:27:22 UTC (rev 2800)
@@ -0,0 +1,48 @@
+/*
+ * %%Ignore-License
+ *
+ * Copyright (c) 2002 - 2005, Stephen Kelvin Friedrich. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification,
+ * are permitted provided that the following conditions are met:
+ *
+ * - Redistributions of source code must retain the above copyright notice, this list
+ * of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright notice, this
+ * list of conditions and the following disclaimer in the documentation and/or other
+ * materials provided with the distribution.
+ * - Neither the name of the copyright holder nor the names of its contributors may be
+ * used to endorse or promote products derived from this software without specific
+ * prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
+ * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+ * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+package org.nuiton.jaxx.widgets.extra.datatips;
+
+import javax.swing.*;
+import java.awt.*;
+
+class TableDataTipListener extends DataTipListener {
+ TableDataTipListener() {
+ }
+
+ DataTipCell getCell(JComponent component, Point point) {
+ JTable table = (JTable) component;
+ int rowIndex = table.rowAtPoint(point);
+ int columnIndex = table.columnAtPoint(point);
+ if (rowIndex < 0 || columnIndex < 0) {
+ return DataTipCell.NONE;
+ }
+ TableDataTipCell cellPosition = new TableDataTipCell(table, rowIndex, columnIndex);
+ return cellPosition;
+ }
+}
Property changes on: trunk/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/datatips/TableDataTipListener.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
Added: trunk/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/datatips/TreeDataTipCell.java
===================================================================
--- trunk/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/datatips/TreeDataTipCell.java (rev 0)
+++ trunk/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/datatips/TreeDataTipCell.java 2014-02-24 14:27:22 UTC (rev 2800)
@@ -0,0 +1,100 @@
+/*
+ * %%Ignore-License
+ *
+ * Copyright (c) 2002 - 2005, Stephen Kelvin Friedrich. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification,
+ * are permitted provided that the following conditions are met:
+ *
+ * - Redistributions of source code must retain the above copyright notice, this list
+ * of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright notice, this
+ * list of conditions and the following disclaimer in the documentation and/or other
+ * materials provided with the distribution.
+ * - Neither the name of the copyright holder nor the names of its contributors may be
+ * used to endorse or promote products derived from this software without specific
+ * prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
+ * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+ * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+package org.nuiton.jaxx.widgets.extra.datatips;
+
+import java.awt.Component;
+import java.awt.Rectangle;
+
+import javax.swing.JTree;
+import javax.swing.UIManager;
+import javax.swing.tree.TreeCellRenderer;
+import javax.swing.tree.TreeModel;
+import javax.swing.tree.TreePath;
+
+class TreeDataTipCell implements DataTipCell {
+ private final JTree tree;
+ private final int rowIndex;
+
+ public TreeDataTipCell(JTree tree, int rowIndex) {
+ this.tree = tree;
+ this.rowIndex = rowIndex;
+ }
+
+ public boolean isSet() {
+ return rowIndex >= 0;
+ }
+
+ public Rectangle getCellBounds() {
+ TreePath treePath = tree.getPathForRow(rowIndex);
+ Rectangle cellRect = tree.getPathBounds(treePath);
+ return cellRect;
+ }
+
+ public Component getRendererComponent() {
+ TreeModel treeModel = tree.getModel();
+ TreePath treePath = tree.getPathForRow(rowIndex);
+ TreeCellRenderer renderer = tree.getCellRenderer();
+ boolean isSelected = tree.isPathSelected(treePath);
+ boolean isExpanded = tree.isExpanded(treePath);
+ boolean hasFocus = tree.hasFocus() && rowIndex == tree.getLeadSelectionRow();
+ Object item = treePath.getLastPathComponent();
+ boolean isLeaf = treeModel.isLeaf(item);
+ Component component = renderer.getTreeCellRendererComponent(tree, item, isSelected, isExpanded, isLeaf, rowIndex, hasFocus);
+ component.setFont(tree.getFont());
+
+ // FIX Nimbus white foreground on white background
+ if (isSelected) {
+ component.setForeground(UIManager.getColor("Tree.textForeground"));
+ }
+
+ return component;
+ }
+
+ public boolean equals(Object o) {
+ if(this == o) {
+ return true;
+ }
+ if(o == null || getClass() != o.getClass()) {
+ return false;
+ }
+
+ TreeDataTipCell treeDataTipCell = (TreeDataTipCell) o;
+
+ if(rowIndex != treeDataTipCell.rowIndex) {
+ return false;
+ }
+
+ return true;
+ }
+
+ public int hashCode() {
+ return rowIndex;
+ }
+}
+
Property changes on: trunk/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/datatips/TreeDataTipCell.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
Added: trunk/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/datatips/TreeDataTipListener.java
===================================================================
--- trunk/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/datatips/TreeDataTipListener.java (rev 0)
+++ trunk/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/datatips/TreeDataTipListener.java 2014-02-24 14:27:22 UTC (rev 2800)
@@ -0,0 +1,46 @@
+/*
+ * %%Ignore-License
+ *
+ * Copyright (c) 2002 - 2005, Stephen Kelvin Friedrich. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification,
+ * are permitted provided that the following conditions are met:
+ *
+ * - Redistributions of source code must retain the above copyright notice, this list
+ * of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright notice, this
+ * list of conditions and the following disclaimer in the documentation and/or other
+ * materials provided with the distribution.
+ * - Neither the name of the copyright holder nor the names of its contributors may be
+ * used to endorse or promote products derived from this software without specific
+ * prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
+ * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+ * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+package org.nuiton.jaxx.widgets.extra.datatips;
+
+import javax.swing.*;
+import java.awt.*;
+
+class TreeDataTipListener extends DataTipListener {
+ TreeDataTipListener() {
+ }
+
+ DataTipCell getCell(JComponent component, Point point) {
+ JTree tree = (JTree) component;
+ int rowIndex = tree.getRowForLocation(point.x, point.y);
+ if (rowIndex < 0) {
+ return DataTipCell.NONE;
+ }
+ return new TreeDataTipCell(tree, rowIndex);
+ }
+}
Property changes on: trunk/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/datatips/TreeDataTipListener.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
Added: trunk/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/datatips/package-info.java
===================================================================
--- trunk/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/datatips/package-info.java (rev 0)
+++ trunk/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/datatips/package-info.java 2014-02-24 14:27:22 UTC (rev 2800)
@@ -0,0 +1,29 @@
+/*
+ * #%L
+ * JAXX :: Extra Widgets
+ * %%
+ * Copyright (C) 2004 - 2010 CodeLutin
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Lesser Public License for more details.
+ *
+ * You should have received a copy of the GNU General Lesser Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/lgpl-3.0.html>.
+ * #L%
+ */
+/**
+ * Add data tips to your Swing table, tree or list.
+ *
+ * Those classes has been copied from original project :
+ * https://datatips.dev.java.net/ and just contains some bugfixes
+ * for nimbus look'n'feel.
+ */
+package org.nuiton.jaxx.widgets.extra.datatips;
Property changes on: trunk/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/datatips/package-info.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
Added: trunk/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/editor/DefaultEditor.java
===================================================================
--- trunk/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/editor/DefaultEditor.java (rev 0)
+++ trunk/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/editor/DefaultEditor.java 2014-02-24 14:27:22 UTC (rev 2800)
@@ -0,0 +1,204 @@
+/*
+ * #%L
+ * JAXX :: Extra Widgets
+ * %%
+ * Copyright (C) 2004 - 2010 CodeLutin
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Lesser Public License for more details.
+ *
+ * You should have received a copy of the GNU General Lesser Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/lgpl-3.0.html>.
+ * #L%
+ */
+
+/* *
+ * DefaultEditor.java
+ *
+ * Created: 6 août 2006 13:03:46
+ *
+ * @author poussin
+ * @version $Revision$
+ *
+ * Last update: $Date$
+ * by : $Author$
+ */
+
+package org.nuiton.jaxx.widgets.extra.editor;
+
+import java.awt.BorderLayout;
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.FileOutputStream;
+import java.io.FileReader;
+import java.io.IOException;
+import java.io.OutputStreamWriter;
+import java.io.Reader;
+import java.io.Writer;
+
+import javax.swing.JEditorPane;
+import javax.swing.JPanel;
+import javax.swing.JScrollPane;
+import javax.swing.event.CaretListener;
+import javax.swing.event.DocumentEvent;
+import javax.swing.event.DocumentListener;
+import javax.swing.text.Document;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+/**
+ * Default editor, can open of kind of file
+ *
+ * behaviour: <li>undo/redo (Ctrl-z, Shift-Ctrl-z) <li>Scrollbar
+ *
+ * @author poussin
+ */
+public class DefaultEditor extends JPanel implements EditorInterface,
+ DocumentListener {
+
+ /** serialVersionUID */
+ private static final long serialVersionUID = 5049495816540748017L;
+
+ /** to use log facility, just put in your code: log.info(\"...\"); */
+ static private Log log = LogFactory.getLog(DefaultEditor.class);
+
+ protected JEditorPane editor = new JEditorPane();
+ protected JScrollPane scrollPane = new JScrollPane(editor);
+ protected boolean isModified = false;
+
+ public DefaultEditor() {
+ setLayout(new BorderLayout());
+ add(scrollPane, BorderLayout.CENTER);
+ }
+
+ @Override
+ public void addDocumentListener(DocumentListener listener) {
+ editor.getDocument().addDocumentListener(listener);
+ }
+
+ @Override
+ public void removeDocumentListener(DocumentListener listener) {
+ editor.getDocument().removeDocumentListener(listener);
+ }
+
+ @Override
+ public void addCaretListener(CaretListener listener) {
+ editor.addCaretListener(listener);
+ }
+
+ @Override
+ public void removeCaretListener(CaretListener listener) {
+ editor.removeCaretListener(listener);
+ }
+
+ @Override
+ public boolean accept(File file) {
+ return true;
+ }
+
+ @Override
+ public boolean accept(Editor.EditorSyntaxConstant editorSyntaxConstant) {
+ return true;
+ }
+
+ @Override
+ public boolean isModified() {
+ return isModified;
+ }
+
+ @Override
+ public void setSyntax(Editor.EditorSyntaxConstant editorSyntax) {
+ }
+
+ @Override
+ public boolean open(File file) {
+ try {
+ Document doc = editor.getDocument();
+ EditorHelper.removeUndoRedoSupport(editor);
+ doc.removeDocumentListener(this);
+ Reader in = new BufferedReader(new FileReader(file));
+ editor.read(in, file);
+ doc = editor.getDocument();
+ doc.addDocumentListener(this);
+ EditorHelper.addUndoRedoSupport(editor);
+ isModified = false;
+ return true;
+ } catch (FileNotFoundException eee) {
+ if (log.isWarnEnabled()) {
+ log.warn("Can't find file: " + file, eee);
+ }
+ } catch (IOException eee) {
+ if (log.isWarnEnabled()) {
+ log.warn("Can't open file: " + file, eee);
+ }
+ }
+ return false;
+ }
+
+ @Override
+ public boolean saveAs(File file) {
+ try {
+ FileOutputStream outf = new FileOutputStream(file);
+ Writer out = new OutputStreamWriter(outf, "utf-8");
+ editor.write(out);
+ isModified = false;
+ return true;
+ } catch (IOException eee) {
+ if (log.isWarnEnabled()) {
+ log.warn("Can't save file", eee);
+ }
+ }
+ return false;
+ }
+
+ @Override
+ public String getText() {
+ String result = editor.getText();
+ return result;
+ }
+
+ @Override
+ public void setText(String text) {
+ editor.setText(text);
+ }
+
+ @Override
+ public void insertUpdate(DocumentEvent e) {
+ isModified = true;
+ }
+
+ @Override
+ public void removeUpdate(DocumentEvent e) {
+ isModified = true;
+ }
+
+ @Override
+ public void changedUpdate(DocumentEvent e) {
+ isModified = true;
+ }
+
+ @Override
+ public void copy() {
+ editor.copy();
+ }
+
+ @Override
+ public void cut() {
+ editor.cut();
+ }
+
+ @Override
+ public void paste() {
+ editor.paste();
+ }
+}
Property changes on: trunk/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/editor/DefaultEditor.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
Added: trunk/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/editor/Editor.java
===================================================================
--- trunk/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/editor/Editor.java (rev 0)
+++ trunk/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/editor/Editor.java 2014-02-24 14:27:22 UTC (rev 2800)
@@ -0,0 +1,668 @@
+/*
+ * #%L
+ * JAXX :: Extra Widgets
+ * %%
+ * Copyright (C) 2004 - 2010 CodeLutin
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Lesser Public License for more details.
+ *
+ * You should have received a copy of the GNU General Lesser Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/lgpl-3.0.html>.
+ * #L%
+ */
+
+/* *
+ * Editor.java
+ *
+ * Created: 6 août 2006 10:42:11
+ *
+ * @author poussin
+ * @version $Revision$
+ *
+ * Last update: $Date$
+ * by : $Author$
+ */
+
+package org.nuiton.jaxx.widgets.extra.editor;
+
+import static org.nuiton.i18n.I18n.t;
+
+import java.awt.BorderLayout;
+import java.awt.Component;
+import java.awt.Event;
+import java.awt.event.ActionEvent;
+import java.awt.event.KeyEvent;
+import java.io.File;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import javax.swing.Action;
+import javax.swing.JComponent;
+import javax.swing.JOptionPane;
+import javax.swing.JPanel;
+import javax.swing.KeyStroke;
+import javax.swing.event.CaretListener;
+import javax.swing.event.DocumentListener;
+import javax.swing.text.TextAction;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+/**
+ * L'idee de cette editor, est qu'il ne fait rien lui meme, mais delegue a un
+ * autre editeur enregistré. L'enregistrement ce fait par le nom de la classe
+ * sous forme de String, ce qui permet d'enregistrer des editeurs qui ne peuvent
+ * pas etre chargé car il manque des jars. Par exemple NetBeansEditor qui
+ * demande beaucoup de jar, peu ne pas etre chargé convenablement, dans ce cas
+ * un autre editeur sera choisi.
+ * <p>
+ * L'ordre d'enregistrement est important. Le premier editor enregistré sera le
+ * premier editeur essayé.
+ * <p>
+ * Si l'on souhaite creer un nouvel editeur, il faut implanter
+ * {@link EditorInterface} et etendre au moins {@link Component}
+ * <p>
+ * Si aucun editeur n'est trouvé alors {@link DefaultEditor} est utilisé
+ * <p>
+ * Editeur permet d'utiliser Ctrl-s pour sauver le fichier courant quel que soit
+ * l'editeur.
+ *
+ * @author poussin
+ */
+public class Editor extends JPanel implements EditorInterface {
+
+ /** serialVersionUID */
+ private static final long serialVersionUID = 5820456710194699050L;
+
+ /** to use log facility, just put in your code: log.info(\"...\"); */
+ static private Log log = LogFactory.getLog(Editor.class);
+
+ static protected EditorInterface DEFAULT_EDITOR = new DefaultEditor();
+
+ /**
+ * Available syntaxes.
+ *
+ * Used to force syntax to use on editor
+ */
+ public enum EditorSyntaxConstant {
+
+ // TODO sletellier 09/11/10 : implement others languages
+ XML(t("nuitonwidgets.editor.syntax.xml")),
+ JAVA(t("nuitonwidgets.editor.syntax.java")),
+ SQL(t("nuitonwidgets.editor.syntax.sql")),
+ R(t("nuitonwidgets.editor.syntax.r"));
+
+ protected String name;
+
+ EditorSyntaxConstant(String name) {
+ this.name = name;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public boolean isSupported(EditorSyntaxConstant ... constantsSupported) {
+ for (EditorSyntaxConstant supported : constantsSupported) {
+ if (supported.equals(this)) {
+ return true;
+ }
+ }
+ return false;
+ }
+ }
+
+ static {
+ registered = new ArrayList<EditorInterface>();
+
+ // we try to automatic register some Editor
+ addEditor(SDocEditor.class.getName());
+ addEditor(JEditEditor.class.getName());
+ addEditor(RSyntaxEditor.class.getName());
+ }
+
+ /** tous les Editors enregistré */
+ static protected List<EditorInterface> registered;
+
+ /**
+ * register new editor
+ *
+ * @param editorClassName class name of new editor
+ * @return the new registered Editor, or null, if new editor can't be
+ * instanciant.
+ */
+ static EditorInterface addEditor(String editorClassName) {
+ try {
+ Class<?> editorClass = Class.forName(editorClassName);
+ EditorInterface result = (EditorInterface) editorClass
+ .newInstance();
+ registered.add(result);
+ return result;
+ } catch (NoClassDefFoundError eee) {
+ if (log.isDebugEnabled()) {
+ log.debug("Can't find your editor class: " + editorClassName,
+ eee);
+ }
+ if (log.isInfoEnabled()) {
+ log.info("Can't find your editor class: " + editorClassName);
+ }
+ } catch (ClassNotFoundException eee) {
+ if (log.isDebugEnabled()) {
+ log.debug("Can't find your editor class: " + editorClassName,
+ eee);
+ }
+ if (log.isInfoEnabled()) {
+ log.info("Can't find your editor class: " + editorClassName);
+ }
+ } catch (ClassCastException eee) {
+ if (log.isDebugEnabled()) {
+ log.debug("Your editor class is not Editor Child: "
+ + editorClassName, eee);
+ }
+ if (log.isInfoEnabled()) {
+ log.info("Your editor class is not Editor Child: "
+ + editorClassName);
+ }
+ } catch (InstantiationException eee) {
+ if (log.isDebugEnabled()) {
+ log.debug("Can't instanciant your Editor class: "
+ + editorClassName, eee);
+ }
+ if (log.isInfoEnabled()) {
+ log.info("Can't instanciant your Editor class: "
+ + editorClassName);
+ }
+ } catch (IllegalAccessException eee) {
+ if (log.isDebugEnabled()) {
+ log.debug("Can't access your Editor class: " + editorClassName,
+ eee);
+ }
+ if (log.isInfoEnabled()) {
+ log.info("Can't access your Editor class: " + editorClassName);
+ }
+ } catch (Exception eee) {
+ if (log.isDebugEnabled()) {
+ log.debug("Error during instanciation of your Editor: "
+ + editorClassName, eee);
+ }
+ if (log.isInfoEnabled()) {
+ log.info("Error during instanciation of your Editor: "
+ + editorClassName, eee);
+ }
+ }
+ return null;
+ }
+
+ static protected EditorInterface nullEditor = new NullEditor();
+
+ /** editor already instanciate for this editor */
+ protected Map<EditorInterface, EditorInterface> usedEditor = new HashMap<EditorInterface, EditorInterface>();
+ /** currentEditor is currently opened editor in this editor */
+ protected EditorInterface currentEditor = nullEditor;
+ /** current opened file */
+ protected File openedFile = null;
+ /** All document listener registered on this editor */
+ protected Set<DocumentListener> documentListeners = new HashSet<DocumentListener>();
+ /** All caret listener registered on this editor */
+ protected Set<CaretListener> caretListeners = new HashSet<CaretListener>();
+
+ /**
+ * If the edited file is modifier, before switch to other or close it, ask
+ * the user if he want save the modification
+ */
+ protected boolean askIfNotSaved = true;
+ /** force usage of default editor */
+ protected boolean forceDefault = false;
+
+ public Editor() {
+ setLayout(new BorderLayout());
+ addKeyBinding();
+ close();
+ }
+
+ protected void addKeyBinding() {
+ // Add Ctrl-s -> save
+ Action saveAction = new SaveAction(this);
+ KeyStroke key = KeyStroke.getKeyStroke(KeyEvent.VK_S, Event.CTRL_MASK);
+
+ this.getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT).put(
+ key, "save");
+ this.getActionMap().put("save", saveAction);
+ }
+
+ /**
+ * Force to use syntaxe without file, try to find the better editor for this syntax
+ *
+ * Work only for regis
+ */
+ @Override
+ public void setSyntax(EditorSyntaxConstant editorSyntax) {
+
+ // No file so dont save
+ setAskIfNotSaved(false);
+
+ // Get concerned editor
+ EditorInterface editor = getEditor(editorSyntax);
+ setCurrentEditor(editor);
+
+ // Apply syntax
+ editor.setSyntax(editorSyntax);
+ }
+
+ /**
+ * @return the askIfNotSaved
+ */
+ public boolean isAskIfNotSaved() {
+ return this.askIfNotSaved;
+ }
+
+ /**
+ * @param askIfNotSaved the askIfNotSaved to set
+ */
+ public void setAskIfNotSaved(boolean askIfNotSaved) {
+ this.askIfNotSaved = askIfNotSaved;
+ }
+
+ /**
+ * @return the forceDefault
+ */
+ public boolean isForceDefault() {
+ return this.forceDefault;
+ }
+
+ /**
+ * @param forceDefault the forceDefault to set
+ */
+ public void setForceDefault(boolean forceDefault) {
+ this.forceDefault = forceDefault;
+ }
+
+ /**
+ * try to find better editor for this file
+ *
+ * @param editorSyntaxConstant type of syntaxe
+ * @return the better editor, or Default Editor
+ */
+ public EditorInterface getEditor(EditorSyntaxConstant editorSyntaxConstant) {
+ // if no editor found, DEFAULT_EDITOR will be used
+ EditorInterface editor = DEFAULT_EDITOR;
+ if (!isForceDefault()) {
+ for (EditorInterface e : Editor.registered) {
+ if (e.accept(editorSyntaxConstant)) {
+ editor = e;
+ }
+ }
+ }
+
+ EditorInterface newEditor = usedEditor.get(editor);
+ try {
+ if (newEditor == null) {
+ // create new instance for this editor
+ newEditor = editor.getClass().newInstance();
+ usedEditor.put(editor, newEditor);
+ }
+ } catch (InstantiationException eee) {
+ if (log.isDebugEnabled()) {
+ log.debug("Can't instanciant your Editor class: "
+ + editor.getClass().getName(), eee);
+ }
+ if (log.isInfoEnabled()) {
+ log.info("Can't instanciant your Editor class: "
+ + editor.getClass().getName());
+ }
+ } catch (IllegalAccessException eee) {
+ if (log.isDebugEnabled()) {
+ log.debug("Can't access your Editor class: "
+ + editor.getClass().getName(), eee);
+ }
+ if (log.isInfoEnabled()) {
+ log.info("Can't access your Editor class: "
+ + editor.getClass().getName());
+ }
+ }
+ return newEditor;
+ }
+
+ /**
+ * try to find better editor for this file
+ *
+ * @param file concerned
+ * @return the better editor, or Default Editor
+ */
+ public EditorInterface getEditor(File file) {
+ // if no editor found, DEFAULT_EDITOR will be used
+ EditorInterface editor = DEFAULT_EDITOR;
+ if (!isForceDefault()) {
+ for (EditorInterface e : Editor.registered) {
+ if (e.accept(file)) {
+ editor = e;
+ }
+ }
+ }
+
+ EditorInterface newEditor = usedEditor.get(editor);
+ try {
+ if (newEditor == null) {
+ // create new instance for this editor
+ newEditor = editor.getClass().newInstance();
+ usedEditor.put(editor, newEditor);
+ }
+ } catch (InstantiationException eee) {
+ if (log.isDebugEnabled()) {
+ log.debug("Can't instanciant your Editor class: "
+ + editor.getClass().getName(), eee);
+ }
+ if (log.isInfoEnabled()) {
+ log.info("Can't instanciant your Editor class: "
+ + editor.getClass().getName());
+ }
+ } catch (IllegalAccessException eee) {
+ if (log.isDebugEnabled()) {
+ log.debug("Can't access your Editor class: "
+ + editor.getClass().getName(), eee);
+ }
+ if (log.isInfoEnabled()) {
+ log.info("Can't access your Editor class: "
+ + editor.getClass().getName());
+ }
+ }
+ return newEditor;
+ }
+
+ public void setCurrentEditor(EditorInterface editor) {
+ // remove old editor
+ if (this.currentEditor == null) {
+ // Do nothing
+ return;
+ }
+ remove((Component) this.currentEditor);
+
+ // remove all listener on old editor
+ for (DocumentListener l : documentListeners) {
+ this.currentEditor.removeDocumentListener(l);
+ }
+ for (CaretListener l : caretListeners) {
+ this.currentEditor.removeCaretListener(l);
+ }
+ this.currentEditor = editor;
+ // and add all listener on new editor
+ for (DocumentListener l : documentListeners) {
+ this.currentEditor.addDocumentListener(l);
+ }
+ for (CaretListener l : caretListeners) {
+ this.currentEditor.addCaretListener(l);
+ }
+
+ // put new editor as child
+ add((Component) editor, BorderLayout.CENTER);
+ }
+
+ /**
+ * @return the currentEditor
+ */
+ public EditorInterface getCurrentEditor() {
+ return this.currentEditor;
+ }
+
+ /**
+ * @return the openedFile
+ */
+ public File getOpenedFile() {
+ return this.openedFile;
+ }
+
+ /**
+ * @param openedFile the openedFile to set
+ */
+ public void setOpenedFile(File openedFile) {
+ this.openedFile = openedFile;
+ }
+
+ /**
+ * Closs current file
+ *
+ * @return the current editor
+ */
+ public boolean close() {
+ if (askAndSaveOrCancel()) {
+ setOpenedFile(null);
+ setCurrentEditor(nullEditor);
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ * ask the user to save the current opened file if necessary (current file
+ * is modified)
+ *
+ * @return false if user awnser Cancel, true otherwize.
+ */
+ protected boolean askAndSaveOrCancel() {
+ boolean result = true;
+ if (isAskIfNotSaved() && getCurrentEditor().isModified()) {
+ int val = JOptionPane.showConfirmDialog(this,
+ t("nuitonwidgets.editor.saveorcancel"));
+ switch (val) {
+ case JOptionPane.YES_OPTION:
+ save();
+ result = true;
+ break;
+ case JOptionPane.NO_OPTION:
+ result = true;
+ break;
+ case JOptionPane.CANCEL_OPTION:
+ result = false;
+ break;
+ }
+ }
+ return result;
+ }
+
+ /**
+ * Save current opened file
+ *
+ * @return true if all is ok
+ */
+ public boolean save() {
+ File file = getOpenedFile();
+ boolean result = getCurrentEditor().saveAs(file);
+ return result;
+ }
+
+ /**
+ * if return true, this editor support this file type. Default implantation
+ * return true
+ *
+ * @param file to check
+ * @return if return true, this editor support this file type.
+ */
+ public boolean accept(File file) {
+ return true;
+ }
+
+ /**
+ * if return true, this editor support this syntax type. Default implantation
+ * return true
+ *
+ * @param editorSyntaxConstant to check
+ * @return if return true, this editor support this syntax type.
+ */
+ public boolean accept(Editor.EditorSyntaxConstant editorSyntaxConstant) {
+ return true;
+ }
+
+ /**
+ * indicate if current opened file has been modified
+ *
+ * @return true if currend file is modified
+ */
+ public boolean isModified() {
+ boolean result = getCurrentEditor().isModified();
+ return result;
+ }
+
+ /**
+ * Replace the current edited file by file passed in argument. When you
+ * overide this method, you must call {@link #setOpenedFile(File)}
+ *
+ * @param file the file to open
+ * @return true if file has been opened
+ */
+ public boolean open(File file) {
+ boolean result = false;
+ if (askAndSaveOrCancel()) {
+ EditorInterface editor = getEditor(file);
+ result = editor.open(file);
+ if (result) {
+ setOpenedFile(file);
+ setCurrentEditor(editor);
+ } else {
+ close();
+ }
+ }
+ return result;
+ }
+
+ /**
+ * Replace the current edited file by file passed in argument
+ *
+ * @param file the file to open
+ * @return true if file has been saved and reopen with new name
+ */
+ public boolean saveAs(File file) {
+ boolean result = getCurrentEditor().saveAs(file);
+ if (result) {
+ result = open(file);
+ }
+ return result;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see EditorInterface#getText()
+ */
+ public String getText() {
+ String result = getCurrentEditor().getText();
+ return result;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see EditorInterface#getText()
+ */
+ public void setText(String text) {
+ getCurrentEditor().setText(text);
+ }
+
+ /*
+ * @see EditorInterface#copy()
+ */
+ @Override
+ public void copy() {
+ currentEditor.copy();
+ }
+
+ /*
+ * @see EditorInterface#cut()
+ */
+ @Override
+ public void cut() {
+ currentEditor.cut();
+ }
+
+ /*
+ * @see EditorInterface#paste()
+ */
+ @Override
+ public void paste() {
+ currentEditor.paste();
+ }
+
+ @Override
+ public void setEnabled(boolean b) {
+ super.setEnabled(b);
+ currentEditor.setEnabled(b);
+ }
+
+ /*
+ * @see EditorInterface#addDocumentListener(javax.swing.event.DocumentListener)
+ */
+ @Override
+ public void addDocumentListener(DocumentListener listener) {
+ documentListeners.add(listener);
+ getCurrentEditor().addDocumentListener(listener);
+ }
+
+ /*
+ * @see EditorInterface#removeDocumentListener(javax.swing.event.DocumentListener)
+ */
+ @Override
+ public void removeDocumentListener(DocumentListener listener) {
+ documentListeners.remove(listener);
+ getCurrentEditor().removeDocumentListener(listener);
+ }
+
+ /*
+ * @see EditorInterface#addCaretListener(javax.swing.event.CaretListener)
+ */
+ @Override
+ public void addCaretListener(CaretListener listener) {
+ caretListeners.add(listener);
+ getCurrentEditor().addCaretListener(listener);
+ }
+
+ /*
+ * @see EditorInterface#removeCaretListener(javax.swing.event.CaretListener)
+ */
+ @Override
+ public void removeCaretListener(CaretListener listener) {
+ caretListeners.remove(listener);
+ getCurrentEditor().removeCaretListener(listener);
+ }
+
+ static class SaveAction extends TextAction {
+ /** serialVersionUID */
+ private static final long serialVersionUID = 4694356772539222176L;
+
+ /** to use log facility, just put in your code: log.info(\"...\"); */
+ static private Log log = LogFactory.getLog(SaveAction.class);
+
+ protected Editor editor;
+
+ /* Create this object with the appropriate identifier. */
+ SaveAction(Editor editor) {
+ super("save");
+ this.editor = editor;
+ }
+
+ /**
+ * The operation to perform when this action is triggered.
+ *
+ * @param e the action event
+ */
+ public void actionPerformed(ActionEvent e) {
+ log.info("try to save file");
+ if (!editor.save()) {
+ log.warn("Unable to save");
+ } else {
+ log.info("saved ok");
+ }
+ }
+ }
+}
Property changes on: trunk/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/editor/Editor.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
Added: trunk/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/editor/EditorHelper.java
===================================================================
--- trunk/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/editor/EditorHelper.java (rev 0)
+++ trunk/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/editor/EditorHelper.java 2014-02-24 14:27:22 UTC (rev 2800)
@@ -0,0 +1,150 @@
+/*
+ * #%L
+ * JAXX :: Extra Widgets
+ * %%
+ * Copyright (C) 2004 - 2010 CodeLutin
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Lesser Public License for more details.
+ *
+ * You should have received a copy of the GNU General Lesser Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/lgpl-3.0.html>.
+ * #L%
+ */
+
+package org.nuiton.jaxx.widgets.extra.editor;
+
+import java.awt.Event;
+import java.awt.event.ActionEvent;
+import java.awt.event.KeyEvent;
+
+import javax.swing.Action;
+import javax.swing.JEditorPane;
+import javax.swing.KeyStroke;
+import javax.swing.text.Document;
+import javax.swing.text.TextAction;
+import javax.swing.undo.CannotRedoException;
+import javax.swing.undo.CannotUndoException;
+import javax.swing.undo.UndoManager;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+/**
+ * EditorHelper.
+ *
+ * Created: 6 août 2006 20:51:50
+ *
+ * @author poussin
+ * @version $Revision$
+ *
+ * Last update: $Date$
+ * by : $Author$
+ */
+public class EditorHelper {
+
+ static final protected String UNDO_MANAGER = "UndoManager";
+
+ static protected void addUndoRedoSupport(JEditorPane editor) {
+ UndoManager undo = (UndoManager) editor.getClientProperty(UNDO_MANAGER);
+ if (undo == null) {
+ undo = new UndoManager();
+
+ editor.putClientProperty(UNDO_MANAGER, undo);
+
+ Action undoAction = new UndoAction(undo);
+ KeyStroke key = KeyStroke.getKeyStroke(KeyEvent.VK_Z,
+ Event.CTRL_MASK);
+ editor.getInputMap().put(key, "undo");
+ editor.getActionMap().put("undo", undoAction);
+
+ Action redoAction = new RedoAction(undo);
+ key = KeyStroke.getKeyStroke(KeyEvent.VK_Z, KeyEvent.CTRL_MASK
+ + KeyEvent.SHIFT_DOWN_MASK);
+ editor.getInputMap().put(key, "redo");
+ editor.getActionMap().put("redo", redoAction);
+ }
+ Document doc = editor.getDocument();
+ doc.addUndoableEditListener(undo);
+ }
+
+ static protected void removeUndoRedoSupport(JEditorPane editor) {
+ UndoManager undo = (UndoManager) editor.getClientProperty(UNDO_MANAGER);
+ if (undo != null) {
+ Document doc = editor.getDocument();
+ doc.removeUndoableEditListener(undo);
+ }
+ }
+
+ static class UndoAction extends TextAction {
+ /** serialVersionUID */
+ private static final long serialVersionUID = 14313252664900665L;
+
+ /** to use log facility, just put in your code: log.info(\"...\"); */
+ static private Log log = LogFactory.getLog(UndoAction.class);
+
+ protected UndoManager undo;
+
+ /* Create this object with the appropriate identifier. */
+ UndoAction(UndoManager undo) {
+ super("undo");
+ this.undo = undo;
+ }
+
+ /**
+ * The operation to perform when this action is triggered.
+ *
+ * @param e the action event
+ */
+ public void actionPerformed(ActionEvent e) {
+ try {
+ if (undo.canUndo()) {
+ undo.undo();
+ }
+ } catch (CannotUndoException eee) {
+ log.warn("Unable to undo: ", eee);
+ }
+ }
+ }
+
+ static class RedoAction extends TextAction {
+
+ /** serialVersionUID */
+ private static final long serialVersionUID = 5508420642118093156L;
+
+ /** to use log facility, just put in your code: log.info(\"...\"); */
+ static private Log log = LogFactory.getLog(RedoAction.class);
+
+ protected UndoManager undo;
+
+ /* Create this object with the appropriate identifier. */
+ RedoAction(UndoManager undo) {
+ super("redo");
+ this.undo = undo;
+ }
+
+ /**
+ * The operation to perform when this action is triggered.
+ *
+ * @param e the action event
+ */
+ public void actionPerformed(ActionEvent e) {
+ try {
+ if (undo.canRedo()) {
+ undo.redo();
+ }
+ } catch (CannotRedoException eee) {
+ log.warn("Unable to redo: ", eee);
+ }
+ }
+ }
+
+}
Property changes on: trunk/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/editor/EditorHelper.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
Added: trunk/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/editor/EditorInterface.java
===================================================================
--- trunk/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/editor/EditorInterface.java (rev 0)
+++ trunk/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/editor/EditorInterface.java 2014-02-24 14:27:22 UTC (rev 2800)
@@ -0,0 +1,156 @@
+/*
+ * #%L
+ * JAXX :: Extra Widgets
+ * %%
+ * Copyright (C) 2004 - 2010 CodeLutin
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Lesser Public License for more details.
+ *
+ * You should have received a copy of the GNU General Lesser Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/lgpl-3.0.html>.
+ * #L%
+ */
+
+package org.nuiton.jaxx.widgets.extra.editor;
+
+import java.io.File;
+
+import javax.swing.event.CaretListener;
+import javax.swing.event.DocumentListener;
+
+/**
+ * EditorInterface.
+ *
+ * @author poussin
+ *
+ * Created: 6 août 2006 12:54:19
+ *
+ * @author poussin
+ * @version $Revision$
+ *
+ * Last update: $Date$
+ * by : $Author$
+ */
+public interface EditorInterface {
+
+ /**
+ * Add document listener.
+ *
+ * @param listener listener
+ */
+ void addDocumentListener(DocumentListener listener);
+
+ /**
+ * Remove document listener.
+ *
+ * @param listener listener
+ */
+ void removeDocumentListener(DocumentListener listener);
+
+ /**
+ * Add caret listener.
+ *
+ * @param listener listener
+ */
+ void addCaretListener(CaretListener listener);
+
+ /**
+ * Remove caret listener.
+ *
+ * @param listener listener
+ */
+ void removeCaretListener(CaretListener listener);
+
+ /**
+ * If return true, this editor support this file type.
+ * Default implementation return {@code true}.
+ *
+ * @param file file to test
+ * @return if return {@code true}, this editor support this file type.
+ */
+ boolean accept(File file);
+
+ /**
+ * If return true, this editor support the syntax type.
+ * Default implementation return {@code true}.
+ *
+ * @param editorSyntaxConstant syntaxe type to test
+ * @return if return {@code true}, this editor support this syntax type.
+ */
+ boolean accept(Editor.EditorSyntaxConstant editorSyntaxConstant);
+
+ /**
+ * Indicate if current opened file has been modified.
+ *
+ * @return {@code true} if current file is modified
+ */
+ boolean isModified();
+
+ /**
+ * Replace the current edited file by file passed in argument.
+ *
+ * @param file the file to open
+ * @return true if file has been opened
+ */
+ boolean open(File file);
+
+ /**
+ * Replace the current edited file by file passed in argument.
+ *
+ * @param file the file to open
+ * @return true if file has been saved and reopen with new name
+ */
+ boolean saveAs(File file);
+
+ /**
+ * Return the current content text of the editor as {@link String}.
+ *
+ * @return return the current content text of the editor as {@link String}
+ */
+ String getText();
+
+ /**
+ * Set all text with text in argument.
+ *
+ * @param text test to set
+ */
+ void setText(String text);
+
+ /**
+ * Cut current editor selection into system clipboard.
+ */
+ void cut();
+
+ /**
+ * Copy current current selection into system clipboard.
+ */
+ void copy();
+
+ /**
+ * Paste current clicboard content into editor at caret position.
+ */
+ void paste();
+
+ /**
+ * Enable/disable editor.
+ *
+ * @param b enable
+ */
+ void setEnabled(boolean b);
+
+ /**
+ * Force syntax to use
+ *
+ * @param editorSyntax to use
+ */
+ void setSyntax(Editor.EditorSyntaxConstant editorSyntax);
+}
Property changes on: trunk/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/editor/EditorInterface.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
Added: trunk/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/editor/JEditEditor.java
===================================================================
--- trunk/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/editor/JEditEditor.java (rev 0)
+++ trunk/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/editor/JEditEditor.java 2014-02-24 14:27:22 UTC (rev 2800)
@@ -0,0 +1,245 @@
+/*
+ * #%L
+ * JAXX :: Extra Widgets
+ * %%
+ * Copyright (C) 2004 - 2010 CodeLutin
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Lesser Public License for more details.
+ *
+ * You should have received a copy of the GNU General Lesser Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/lgpl-3.0.html>.
+ * #L%
+ */
+
+package org.nuiton.jaxx.widgets.extra.editor;
+
+import java.awt.BorderLayout;
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.FileReader;
+import java.io.IOException;
+import java.io.Reader;
+
+import javax.swing.JPanel;
+import javax.swing.event.CaretListener;
+import javax.swing.event.DocumentEvent;
+import javax.swing.event.DocumentListener;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.nuiton.util.FileUtil;
+import org.syntax.jedit.JEditTextArea;
+import org.syntax.jedit.tokenmarker.JavaTokenMarker;
+import org.syntax.jedit.tokenmarker.TokenMarker;
+import org.syntax.jedit.tokenmarker.XMLTokenMarker;
+
+/**
+ * RSyntaxTextArea editor implementation.
+ *
+ * @author chatellier
+ * @version $Revision$
+ *
+ * Last update : $Date$
+ * By : $Author$
+ */
+public class JEditEditor extends JPanel implements EditorInterface, DocumentListener {
+
+ /** serialVersionUID. */
+ private static final long serialVersionUID = 5880160718377536089L;
+
+ /** to use log facility, just put in your code: log.info(\"...\"); */
+ private static Log log = LogFactory.getLog(JEditEditor.class);
+
+ protected JEditTextArea editor;
+
+ protected boolean isModified = false;
+
+ public JEditEditor() {
+ editor = new JEditTextArea();
+
+ setLayout(new BorderLayout());
+ add(editor, BorderLayout.CENTER);
+ }
+
+ @Override
+ public boolean accept(File file) {
+ String ext = FileUtil.extension(file);
+ boolean result = "java".equalsIgnoreCase(ext);
+ result = result || "xml".equalsIgnoreCase(ext);
+ return result;
+ }
+
+ @Override
+ public boolean accept(Editor.EditorSyntaxConstant editorSyntaxConstant) {
+ return editorSyntaxConstant.isSupported(Editor.EditorSyntaxConstant.JAVA, Editor.EditorSyntaxConstant.XML);
+ }
+
+ @Override
+ public void setSyntax(Editor.EditorSyntaxConstant editorSyntax) {
+ TokenMarker tokenMarker = null;
+ if (editorSyntax.equals(Editor.EditorSyntaxConstant.JAVA)) {
+ tokenMarker = new JavaTokenMarker();
+ } else if (editorSyntax.equals(Editor.EditorSyntaxConstant.XML)) {
+ tokenMarker = new XMLTokenMarker();
+ } else {
+ log.warn("Syntax '" + editorSyntax.getName() + "' is not yet supported by JEditEditor");
+ }
+
+ if (tokenMarker != null) {
+ editor.setTokenMarker(tokenMarker);
+ }
+ }
+
+ @Override
+ public boolean open(File file) {
+
+ try {
+ editor.getDocument().removeDocumentListener(this);
+
+ Reader in = new BufferedReader(new FileReader(file));
+ // editor.read(in, file);
+ // String text = editor.getText();
+
+ String text = "";
+ char c;
+ int last;
+
+ while ((last = in.read()) != -1) {
+ c = (char) last;
+ // on peut avoir \r\n (windows) \r (macos) \n (unix)
+ if ('\r' == c) { // pour windows et macos on remplace par \n
+ in.mark(1);
+ last = in.read();
+ if (last != -1) {
+ if ('\n' != (char) last) {
+ // on a seulement \r on remet le dernier caractere
+ // lu
+ in.reset();
+ }
+ // dans tous les cas \r ou \r\n on remplace par \n
+ c = '\n';
+ }
+ }
+ text += c;
+ }
+
+ String ext = FileUtil.extension(file);
+ if ("java".equalsIgnoreCase(ext)) {
+ editor.setTokenMarker(new JavaTokenMarker());
+ } else if ("xml".equalsIgnoreCase(ext)) {
+ editor.setTokenMarker(new XMLTokenMarker());
+ }
+
+ editor.setText(text);
+ editor.setCaretPosition(0);
+ editor.getDocument().addDocumentListener(this);
+ isModified = false;
+ return true;
+ } catch (FileNotFoundException eee) {
+ if (log.isWarnEnabled()) {
+ log.warn("Can't find file: " + file, eee);
+ }
+ } catch (IOException eee) {
+ if (log.isWarnEnabled()) {
+ log.warn("Can't open file: " + file, eee);
+ }
+ }
+ return false;
+ }
+
+ @Override
+ public void addDocumentListener(DocumentListener listener) {
+ editor.getDocument().addDocumentListener(listener);
+ }
+
+ @Override
+ public void removeDocumentListener(DocumentListener listener) {
+ editor.getDocument().removeDocumentListener(listener);
+ }
+
+ @Override
+ public void addCaretListener(CaretListener listener) {
+ editor.addCaretListener(listener);
+ }
+
+ @Override
+ public void removeCaretListener(CaretListener listener) {
+ editor.removeCaretListener(listener);
+ }
+
+ @Override
+ public String getText() {
+ String result = editor.getText();
+ return result;
+ }
+
+ @Override
+ public void setEnabled(boolean b) {
+ super.setEnabled(b);
+ editor.setEnabled(b);
+ }
+
+ @Override
+ public boolean isModified() {
+ return isModified;
+ }
+
+ @Override
+ public boolean saveAs(File file) {
+ try {
+ FileUtil.writeString(file, editor.getText(), "utf-8");
+ isModified = false;
+ return true;
+ } catch (IOException eee) {
+ if (log.isWarnEnabled()) {
+ log.warn("Can't save file", eee);
+ }
+ }
+ return false;
+ }
+
+ @Override
+ public void setText(String text) {
+ editor.setText(text);
+ }
+
+ @Override
+ public void changedUpdate(DocumentEvent e) {
+ isModified = true;
+ }
+
+ @Override
+ public void insertUpdate(DocumentEvent e) {
+ isModified = true;
+ }
+
+ @Override
+ public void removeUpdate(DocumentEvent e) {
+ isModified = true;
+ }
+
+ @Override
+ public void copy() {
+ editor.copy();
+ }
+
+ @Override
+ public void cut() {
+ editor.cut();
+ }
+
+ @Override
+ public void paste() {
+ editor.paste();
+ }
+}
Property changes on: trunk/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/editor/JEditEditor.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
Added: trunk/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/editor/NullEditor.java
===================================================================
--- trunk/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/editor/NullEditor.java (rev 0)
+++ trunk/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/editor/NullEditor.java 2014-02-24 14:27:22 UTC (rev 2800)
@@ -0,0 +1,147 @@
+/*
+ * #%L
+ * JAXX :: Extra Widgets
+ * %%
+ * Copyright (C) 2004 - 2010 CodeLutin
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Lesser Public License for more details.
+ *
+ * You should have received a copy of the GNU General Lesser Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/lgpl-3.0.html>.
+ * #L%
+ */
+
+package org.nuiton.jaxx.widgets.extra.editor;
+
+import static org.nuiton.i18n.I18n.t;
+
+import java.awt.BorderLayout;
+import java.awt.Font;
+import java.io.File;
+
+import javax.swing.JLabel;
+import javax.swing.JPanel;
+import javax.swing.event.CaretListener;
+import javax.swing.event.DocumentListener;
+
+/**
+ * Editor used when the have no file to edit
+ *
+ * @author poussin
+ * @version $Revision$
+ *
+ * Last update: $Date$
+ * by : $Author$
+ */
+public class NullEditor extends JPanel implements EditorInterface {
+
+ /** serialVersionUID. */
+ private static final long serialVersionUID = -3451624841247752762L;
+
+ public NullEditor() {
+ setLayout(new BorderLayout());
+ JLabel noFileLabel = new JLabel(t("nuitonwidgets.message.nofile"), JLabel.CENTER);
+ noFileLabel.setFont(noFileLabel.getFont().deriveFont(Font.ITALIC));
+ add(noFileLabel, BorderLayout.CENTER);
+ }
+
+ @Override
+ public void addDocumentListener(DocumentListener listener) {
+ }
+
+ @Override
+ public void removeDocumentListener(DocumentListener listener) {
+ }
+
+ @Override
+ public void addCaretListener(CaretListener listener) {
+
+ }
+
+ @Override
+ public void removeCaretListener(CaretListener listener) {
+
+ }
+
+ @Override
+ public boolean accept(File file) {
+ return false;
+ }
+
+ @Override
+ public boolean accept(Editor.EditorSyntaxConstant editorSyntaxConstant) {
+ return false;
+ }
+
+ @Override
+ public void setSyntax(Editor.EditorSyntaxConstant editorSyntax) {
+ }
+
+ /**
+ * when there is no file opened, the file is not modified.
+ *
+ * @return return false
+ */
+ @Override
+ public boolean isModified() {
+ return false;
+ }
+
+ /**
+ * Do nothing, can't open file, on Null editor.
+ *
+ * @param file the file to open
+ * @return this
+ */
+ @Override
+ public boolean open(File file) {
+ // nothing to do
+ return true;
+ }
+
+ /**
+ * Do nothing, can't save file, on Null editor
+ *
+ * @param file the file to open
+ * @return this
+ */
+ @Override
+ public boolean saveAs(File file) {
+ // nothing to do
+ return true;
+ }
+
+ @Override
+ public String getText() {
+ String result = "";
+ return result;
+ }
+
+ @Override
+ public void setText(String text) {
+ }
+
+ @Override
+ public void copy() {
+
+ }
+
+ @Override
+ public void cut() {
+
+ }
+
+ @Override
+ public void paste() {
+
+ }
+}
Property changes on: trunk/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/editor/NullEditor.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
Added: trunk/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/editor/RSyntaxEditor.java
===================================================================
--- trunk/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/editor/RSyntaxEditor.java (rev 0)
+++ trunk/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/editor/RSyntaxEditor.java 2014-02-24 14:27:22 UTC (rev 2800)
@@ -0,0 +1,275 @@
+/*
+ * #%L
+ * JAXX :: Extra Widgets
+ * %%
+ * Copyright (C) 2004 - 2010 CodeLutin
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Lesser Public License for more details.
+ *
+ * You should have received a copy of the GNU General Lesser Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/lgpl-3.0.html>.
+ * #L%
+ */
+
+package org.nuiton.jaxx.widgets.extra.editor;
+
+import java.awt.BorderLayout;
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.FileOutputStream;
+import java.io.FileReader;
+import java.io.IOException;
+import java.io.OutputStreamWriter;
+import java.io.Reader;
+import java.io.Writer;
+
+import javax.swing.JPanel;
+import javax.swing.event.CaretListener;
+import javax.swing.event.DocumentEvent;
+import javax.swing.event.DocumentListener;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.fife.ui.rsyntaxtextarea.RSyntaxTextArea;
+import org.fife.ui.rsyntaxtextarea.SyntaxConstants;
+import org.fife.ui.rtextarea.RTextScrollPane;
+import org.nuiton.util.FileUtil;
+
+/**
+ * RSyntaxTextArea editor implementation.
+ *
+ * @author chatellier
+ * @version $Revision$
+ *
+ * Last update : $Date$
+ * By : $Author$
+ */
+public class RSyntaxEditor extends JPanel implements EditorInterface, DocumentListener {
+
+ /** serialVersionUID. */
+ private static final long serialVersionUID = 5880160718377536089L;
+
+ /** to use log facility, just put in your code: log.info(\"...\"); */
+ private static Log log = LogFactory.getLog(RSyntaxEditor.class);
+
+ protected RSyntaxTextArea editor;
+
+ protected boolean isModified = false;
+
+ public RSyntaxEditor() {
+ editor = new RSyntaxTextArea();
+
+ RTextScrollPane sp = new RTextScrollPane(editor);
+ setLayout(new BorderLayout());
+ add(sp, BorderLayout.CENTER);
+ }
+
+ @Override
+ public boolean accept(File file) {
+ String ext = FileUtil.extension(file);
+ boolean result = "java".equalsIgnoreCase(ext);
+ result = result || "xml".equalsIgnoreCase(ext);
+ result = result || "sql".equalsIgnoreCase(ext);
+ result = result || "r".equalsIgnoreCase(ext);
+ return result;
+ }
+
+ @Override
+ public boolean accept(Editor.EditorSyntaxConstant editorSyntaxConstant) {
+ return editorSyntaxConstant.isSupported(
+ Editor.EditorSyntaxConstant.JAVA,
+ Editor.EditorSyntaxConstant.XML,
+ Editor.EditorSyntaxConstant.SQL,
+ Editor.EditorSyntaxConstant.R);
+ }
+
+ @Override
+ public void setSyntax(Editor.EditorSyntaxConstant editorSyntax) {
+ String constant = null;
+ if (editorSyntax.equals(Editor.EditorSyntaxConstant.SQL)) {
+ constant = SyntaxConstants.SYNTAX_STYLE_SQL;
+ } else if (editorSyntax.equals(Editor.EditorSyntaxConstant.JAVA)) {
+ constant = SyntaxConstants.SYNTAX_STYLE_JAVA;
+ } else if (editorSyntax.equals(Editor.EditorSyntaxConstant.XML)) {
+ constant = SyntaxConstants.SYNTAX_STYLE_XML;
+ } else if (editorSyntax.equals(Editor.EditorSyntaxConstant.R)) {
+ constant = SyntaxConstants.SYNTAX_STYLE_PERL;
+ } else {
+ log.warn("Syntax '" + editorSyntax.getName() + "' is not yet supported by RSyntaxEditor");
+ }
+ if (constant != null) {
+ editor.setSyntaxEditingStyle(constant);
+ }
+ }
+
+ @Override
+ public boolean open(File file) {
+
+ try {
+ editor.getDocument().removeDocumentListener(this);
+
+ Reader in = new BufferedReader(new FileReader(file));
+ // editor.read(in, file);
+ // String text = editor.getText();
+
+ String text = "";
+ char c;
+ int last;
+
+ while ((last = in.read()) != -1) {
+ c = (char) last;
+ // on peut avoir \r\n (windows) \r (macos) \n (unix)
+ if ('\r' == c) { // pour windows et macos on remplace par \n
+ in.mark(1);
+ last = in.read();
+ if (last != -1) {
+ if ('\n' != (char) last) {
+ // on a seulement \r on remet le dernier caractere
+ // lu
+ in.reset();
+ }
+ // dans tous les cas \r ou \r\n on remplace par \n
+ c = '\n';
+ }
+ }
+ text += c;
+ }
+
+ String ext = FileUtil.extension(file);
+ if ("java".equalsIgnoreCase(ext)) {
+ editor.setSyntaxEditingStyle(SyntaxConstants.SYNTAX_STYLE_JAVA);
+ } else if ("xml".equalsIgnoreCase(ext)) {
+ editor.setSyntaxEditingStyle(SyntaxConstants.SYNTAX_STYLE_XML);
+ } else if ("sql".equalsIgnoreCase(ext)) {
+ editor.setSyntaxEditingStyle(SyntaxConstants.SYNTAX_STYLE_SQL);
+ } else if ("r".equalsIgnoreCase(ext)) {
+ editor.setSyntaxEditingStyle(SyntaxConstants.SYNTAX_STYLE_PERL);
+ }
+
+ editor.setText(text);
+ editor.setCaretPosition(0);
+ editor.getDocument().addDocumentListener(this);
+ isModified = false;
+ return true;
+ } catch (FileNotFoundException eee) {
+ if (log.isWarnEnabled()) {
+ log.warn("Can't find file: " + file, eee);
+ }
+ } catch (IOException eee) {
+ if (log.isWarnEnabled()) {
+ log.warn("Can't open file: " + file, eee);
+ }
+ }
+ return false;
+ }
+
+ @Override
+ public void addDocumentListener(DocumentListener listener) {
+ editor.getDocument().addDocumentListener(listener);
+ }
+
+ @Override
+ public void removeDocumentListener(DocumentListener listener) {
+ editor.getDocument().removeDocumentListener(listener);
+ }
+
+ @Override
+ public void addCaretListener(CaretListener listener) {
+ editor.addCaretListener(listener);
+ }
+
+ @Override
+ public void removeCaretListener(CaretListener listener) {
+ editor.removeCaretListener(listener);
+ }
+
+ @Override
+ public String getText() {
+ String result = editor.getText();
+ return result;
+ }
+
+ @Override
+ public boolean isModified() {
+ return isModified;
+ }
+
+ @Override
+ public boolean saveAs(File file) {
+ Writer out = null;
+ try {
+ FileOutputStream outf = new FileOutputStream(file);
+ out = new OutputStreamWriter(outf, "utf-8");
+ editor.write(out);
+ isModified = false;
+ return true;
+ } catch (IOException eee) {
+ if (log.isWarnEnabled()) {
+ log.warn("Can't save file", eee);
+ }
+ }
+ finally {
+ if (out != null) {
+ try {
+ out.close();
+ } catch (IOException e) {
+ if (log.isWarnEnabled()) {
+ log.warn("Can't save file", e);
+ }
+ }
+ }
+ }
+ return false;
+ }
+
+ @Override
+ public void setText(String text) {
+ editor.setText(text);
+ }
+
+ @Override
+ public void setEnabled(boolean b) {
+ super.setEnabled(b);
+ editor.setEnabled(b);
+ }
+
+ @Override
+ public void changedUpdate(DocumentEvent e) {
+ isModified = true;
+ }
+
+ @Override
+ public void insertUpdate(DocumentEvent e) {
+ isModified = true;
+ }
+
+ @Override
+ public void removeUpdate(DocumentEvent e) {
+ isModified = true;
+ }
+
+ @Override
+ public void copy() {
+ editor.copy();
+ }
+
+ @Override
+ public void cut() {
+ editor.cut();
+ }
+
+ @Override
+ public void paste() {
+ editor.paste();
+ }
+}
Property changes on: trunk/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/editor/RSyntaxEditor.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
Added: trunk/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/editor/SDocEditor.java
===================================================================
--- trunk/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/editor/SDocEditor.java (rev 0)
+++ trunk/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/editor/SDocEditor.java 2014-02-24 14:27:22 UTC (rev 2800)
@@ -0,0 +1,284 @@
+/*
+ * #%L
+ * JAXX :: Extra Widgets
+ * %%
+ * Copyright (C) 2004 - 2010 CodeLutin
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Lesser Public License for more details.
+ *
+ * You should have received a copy of the GNU General Lesser Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/lgpl-3.0.html>.
+ * #L%
+ */
+
+package org.nuiton.jaxx.widgets.extra.editor;
+
+import java.awt.Color;
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.FileReader;
+import java.io.IOException;
+import java.io.Reader;
+
+import javax.swing.text.BadLocationException;
+import javax.swing.text.Document;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.nuiton.util.FileUtil;
+
+import sdoc.Gutter;
+import sdoc.SyntaxSupport;
+
+/**
+ * SDocEditor.
+ *
+ * Created: 19 janv. 07 10:25:18
+ *
+ * @author poussin
+ * @version $Revision$
+ *
+ * Last update: $Date$
+ * by : $Author$
+ */
+public class SDocEditor extends DefaultEditor {
+
+ /** serialVersionUID */
+ private static final long serialVersionUID = -7907912891843847963L;
+
+ /** to use log facility, just put in your code: log.info(\"...\"); */
+ static private Log log = LogFactory.getLog(SDocEditor.class);
+
+ protected SyntaxSupport syntaxSupport;
+
+ public SDocEditor() {
+ syntaxSupport = SyntaxSupport.getInstance();
+
+ // fix background to white (fix bug in nimbus)
+ editor.setBackground(Color.WHITE);
+
+ // if you want line numbering
+ scrollPane.setRowHeaderView(new Gutter(editor, scrollPane));
+ }
+
+ @Override
+ public void setSyntax(Editor.EditorSyntaxConstant editorSyntax) {
+ Integer constant = null;
+ if (editorSyntax.equals(Editor.EditorSyntaxConstant.SQL)) {
+ constant = SyntaxSupport.SQL_LEXER;
+ } else if (editorSyntax.equals(Editor.EditorSyntaxConstant.JAVA)) {
+ constant = SyntaxSupport.JAVA_LEXER;
+ } else if (editorSyntax.equals(Editor.EditorSyntaxConstant.XML)) {
+ constant = SyntaxSupport.XML_LEXER;
+ } else {
+ log.warn("Syntax '" + editorSyntax.getName() + "' is not yet supported by SDocEditor");
+ }
+ if (constant != null) {
+ syntaxSupport.addSupport(constant, editor);
+ }
+ }
+
+ @Override
+ public boolean accept(File file) {
+ String ext = FileUtil.extension(file);
+ boolean result = "java".equalsIgnoreCase(ext);
+ result = result || "xml".equalsIgnoreCase(ext);
+ result = result || "sql".equalsIgnoreCase(ext);
+ return result;
+ }
+
+ @Override
+ public boolean accept(Editor.EditorSyntaxConstant editorSyntaxConstant) {
+ return editorSyntaxConstant.isSupported(
+ Editor.EditorSyntaxConstant.JAVA,
+ Editor.EditorSyntaxConstant.XML,
+ Editor.EditorSyntaxConstant.SQL,
+ Editor.EditorSyntaxConstant.R);
+ }
+
+ @Override
+ public boolean open(File file) {
+ try {
+ Document doc = editor.getDocument();
+ EditorHelper.removeUndoRedoSupport(editor);
+ doc.removeDocumentListener(this);
+
+ Reader in = new BufferedReader(new FileReader(file));
+ // editor.read(in, file);
+ // String text = editor.getText();
+
+ String text = "";
+ char c;
+ int last;
+
+ while ((last = in.read()) != -1) {
+ c = (char) last;
+ // on peut avoir \r\n (windows) \r (macos) \n (unix)
+ if ('\r' == c) { // pour windows et macos on remplace par \n
+ in.mark(1);
+ last = in.read();
+ if (last != -1) {
+ if ('\n' != (char) last) {
+ // on a seulement \r on remet le dernier caractere
+ // lu
+ in.reset();
+ }
+ // dans tous les cas \r ou \r\n on remplace par \n
+ c = '\n';
+ }
+ }
+ text += c;
+ }
+
+ String ext = FileUtil.extension(file);
+ if ("java".equalsIgnoreCase(ext)) {
+ syntaxSupport.addSupport(SyntaxSupport.JAVA_LEXER, editor);
+ } else if ("xml".equalsIgnoreCase(ext)) {
+ syntaxSupport.addSupport(SyntaxSupport.XML_LEXER, editor);
+ } else if ("sql".equalsIgnoreCase(ext)) {
+ syntaxSupport.addSupport(SyntaxSupport.SQL_LEXER, editor);
+ }
+
+ doc = editor.getDocument();
+
+ try {
+ // read(in, doc, 0);
+ doc.insertString(0, text, null);
+ } catch (BadLocationException eee) {
+ if (log.isWarnEnabled()) {
+ log.warn("Can't insert text", eee);
+ }
+ }
+ // editor.setDocument(doc);
+ // editor.setText(text);
+
+ doc = editor.getDocument();
+ doc.addDocumentListener(this);
+ EditorHelper.addUndoRedoSupport(editor);
+ isModified = false;
+ return true;
+ } catch (FileNotFoundException eee) {
+ if (log.isWarnEnabled()) {
+ log.warn("Can't find file: " + file, eee);
+ }
+ } catch (IOException eee) {
+ if (log.isWarnEnabled()) {
+ log.warn("Can't open file: " + file, eee);
+ }
+ }
+ return false;
+ }
+
+ /*
+ * Inserts content from the given stream, which will be treated as plain
+ * text.
+ *
+ * @param in The stream to read from
+ * @param doc The destination for the insertion.
+ * @param pos The location in the document to place the content >= 0.
+ * @exception IOException on any I/O error
+ * @exception BadLocationException if pos represents an invalid location
+ * within the document.
+ *
+ private void read(Reader in, Document doc, int pos) throws IOException,
+ BadLocationException {
+
+ char[] buff = new char[4096];
+ int nch;
+ boolean lastWasCR = false;
+ boolean isCRLF = false;
+ boolean isCR = false;
+ int last;
+ boolean wasEmpty = (doc.getLength() == 0);
+ AttributeSet attr = null;
+
+ // Read in a block at a time, mapping \r\n to \n, as well as single
+ // \r's to \n's. If a \r\n is encountered, \r\n will be set as the
+ // newline string for the document, if \r is encountered it will
+ // be set as the newline character, otherwise the newline property
+ // for the document will be removed.
+ while ((nch = in.read(buff, 0, buff.length)) != -1) {
+ last = 0;
+ for (int counter = 0; counter < nch; counter++) {
+ switch (buff[counter]) {
+ case '\r':
+ if (lastWasCR) {
+ isCR = true;
+ if (counter == 0) {
+ doc.insertString(pos, "\n", attr);
+ pos++;
+ } else {
+ buff[counter - 1] = '\n';
+ }
+ } else {
+ lastWasCR = true;
+ }
+ break;
+ case '\n':
+ if (lastWasCR) {
+ if (counter > (last + 1)) {
+ doc.insertString(pos, new String(buff, last,
+ counter - last - 1), attr);
+ pos += (counter - last - 1);
+ }
+ // else nothing to do, can skip \r, next write will
+ // write \n
+ lastWasCR = false;
+ last = counter;
+ isCRLF = true;
+ }
+ break;
+ default:
+ if (lastWasCR) {
+ isCR = true;
+ if (counter == 0) {
+ doc.insertString(pos, "\n", attr);
+ pos++;
+ } else {
+ buff[counter - 1] = '\n';
+ }
+ lastWasCR = false;
+ }
+ break;
+ }
+ }
+ if (last < nch) {
+ if (lastWasCR) {
+ if (last < (nch - 1)) {
+ doc.insertString(pos, new String(buff, last, nch - last
+ - 1), attr);
+ pos += (nch - last - 1);
+ }
+ } else {
+ doc.insertString(pos, new String(buff, last, nch - last),
+ attr);
+ pos += (nch - last);
+ }
+ }
+ }
+ if (lastWasCR) {
+ doc.insertString(pos, "\n", attr);
+ isCR = true;
+ }
+ if (wasEmpty) {
+ if (isCRLF) {
+ doc.putProperty(DefaultEditorKit.EndOfLineStringProperty,
+ "\r\n");
+ } else if (isCR) {
+ doc.putProperty(DefaultEditorKit.EndOfLineStringProperty, "\r");
+ } else {
+ doc.putProperty(DefaultEditorKit.EndOfLineStringProperty, "\n");
+ }
+ }
+ }*/
+}
Property changes on: trunk/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/editor/SDocEditor.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
Added: trunk/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/package.html
===================================================================
--- trunk/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/package.html (rev 0)
+++ trunk/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/package.html 2014-02-24 14:27:22 UTC (rev 2800)
@@ -0,0 +1,26 @@
+<!--
+ #%L
+ JAXX :: Extra Widgets
+ %%
+ Copyright (C) 2004 - 2010 CodeLutin
+ %%
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation, either version 3 of the
+ License, or (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Lesser Public License for more details.
+
+ You should have received a copy of the GNU General Lesser Public
+ License along with this program. If not, see
+ <http://www.gnu.org/licenses/lgpl-3.0.html>.
+ #L%
+ -->
+<html>
+ <body>
+ <h1>Nuiton-Widgets</h1>
+ </body>
+</html>
Property changes on: trunk/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/package.html
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
Added: trunk/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/tooltip/FocusableTip.java
===================================================================
--- trunk/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/tooltip/FocusableTip.java (rev 0)
+++ trunk/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/tooltip/FocusableTip.java 2014-02-24 14:27:22 UTC (rev 2800)
@@ -0,0 +1,430 @@
+/*
+ * %%Ignore-License
+ *
+ * 07/29/2009
+ *
+ * FocusableTip.java - A focusable tool tip, like those in Eclipse.
+ * Copyright (C) 2009 Robert Futrell
+ * robert_futrell at users.sourceforge.net
+ * http://fifesoft.com/rsyntaxtextarea
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
+ */
+package org.nuiton.jaxx.widgets.extra.tooltip;
+
+import org.apache.commons.lang3.StringUtils;
+import java.awt.Component;
+import java.awt.ComponentOrientation;
+import java.awt.Dimension;
+import java.awt.Point;
+import java.awt.Rectangle;
+import java.awt.Window;
+import java.awt.event.ComponentEvent;
+import java.awt.event.ComponentListener;
+import java.awt.event.FocusEvent;
+import java.awt.event.FocusListener;
+import java.awt.event.KeyEvent;
+import java.awt.event.KeyListener;
+import java.awt.event.MouseEvent;
+import java.net.URL;
+
+import javax.swing.JComponent;
+import javax.swing.SwingUtilities;
+import javax.swing.ToolTipManager;
+import javax.swing.event.CaretEvent;
+import javax.swing.event.CaretListener;
+import javax.swing.event.HyperlinkListener;
+import javax.swing.event.MouseInputAdapter;
+
+
+/**
+ * A focusable tool tip, similar to those found in Eclipse. The user
+ * can click in the tip and it becomes a "real," resizable window.
+ *
+ * @author Robert Futrell
+ * @version 1.0
+ */
+public class FocusableTip {
+
+ public static final String DUMMY_TOOL_TIP = "DUMMY";
+
+ protected JComponent attachedComponent;
+ protected TipWindow tipWindow;
+ protected URL imageBase;
+ protected AttachedComponentListener attachedComponentListener;
+ protected HyperlinkListener hyperlinkListener;
+ protected String lastText;
+ protected Component lastComponent;
+ protected boolean showCopyContextMenu;
+
+ /** Width with default value. */
+ protected int width = 320;
+
+ /** Height with default value. */
+ protected int height = 250;
+
+ /**
+ * The screen bounds in which the mouse has to stay for the currently
+ * displayed tip to stay visible.
+ */
+ protected Rectangle tipVisibleBounds;
+
+ /**
+ * Margin from mouse cursor at which to draw focusable tip.
+ */
+ protected static final int MARGIN = 10;
+
+ /**
+ * FocusableTip constructor
+ *
+ * @param attachedComponent component to attach
+ */
+ public FocusableTip(JComponent attachedComponent) {
+ this(attachedComponent, null);
+ }
+
+ /**
+ * FocusableTip constructor
+ *
+ * @param attachedComponent component to attach
+ * @param listener hyper link listener to add
+ */
+ public FocusableTip(JComponent attachedComponent, HyperlinkListener listener) {
+ this(attachedComponent, listener, false);
+ }
+
+ /**
+ * FocusableTip constructor
+ *
+ * @param attachedComponent component to attach
+ * @param showCopyContextMenu to show copy context menu
+ */
+ public FocusableTip(JComponent attachedComponent, boolean showCopyContextMenu) {
+ this(attachedComponent, null, showCopyContextMenu);
+ }
+
+ /**
+ * FocusableTip constructor
+ *
+ * @param attachedComponent component to attach
+ * @param listener hyper link listener to add
+ * @param showCopyContextMenu to show copy context menu
+ */
+ public FocusableTip(JComponent attachedComponent, HyperlinkListener listener, boolean showCopyContextMenu) {
+ setAttachedComponent(attachedComponent);
+ this.hyperlinkListener = listener;
+ attachedComponentListener = new AttachedComponentListener();
+ tipVisibleBounds = new Rectangle();
+ this.showCopyContextMenu = showCopyContextMenu;
+
+ attachedComponent.setToolTipText(" ");
+ }
+
+ /**
+ * Change tip size.
+ *
+ * @param width width
+ * @param height height
+ */
+ public void setSize(int width, int height) {
+ this.width = width;
+ this.height = height;
+ }
+
+ /**
+ * Get {@link TipWindow} displayed
+ *
+ * @return TipWindow displayed
+ */
+ public TipWindow getTipWindows() {
+ return tipWindow;
+ }
+
+ /**
+ * Compute the bounds in which the user can move the mouse without the
+ * tip window disappearing.
+ */
+ protected void computeTipVisibleBounds() {
+ // Compute area that the mouse can move in without hiding the
+ // tip window. Note that Java 1.4 can only detect mouse events
+ // in Java windows, not globally.
+ Rectangle r = tipWindow.getBounds();
+ Point p = r.getLocation();
+ SwingUtilities.convertPointFromScreen(p, attachedComponent);
+ r.setLocation(p);
+ tipVisibleBounds.setBounds(r.x,r.y-15, r.width,r.height+15*2);
+ }
+
+
+ protected void createAndShowTipWindow(final MouseEvent e, final Component component, final String text) {
+
+ Window owner = SwingUtilities.getWindowAncestor(attachedComponent);
+
+ if (component == null) {
+ tipWindow = new TipWindow(owner, this, text);
+ } else {
+ tipWindow = new TipWindow(owner, this, component);
+ }
+ tipWindow.setHyperlinkListener(hyperlinkListener);
+
+ // TODO: Position tip window better (handle RTL, edges of screen, etc.).
+ // Wrap in an invokeLater() to work around a JEditorPane issue where it
+ // doesn't return its proper preferred size until after it is displayed.
+ // See http://forums.sun.com/thread.jspa?forumID=57&threadID=574810
+ // for a discussion.
+ SwingUtilities.invokeLater(new Runnable() {
+ public void run() {
+
+ // If a new FocusableTip is requested while another one is
+ // *focused* and visible, the focused tip (i.e. "tipWindow")
+ // will be disposed of. If this Runnable is run after the
+ // dispose(), tipWindow will be null. All of this is done on
+ // the EDT so no synchronization should be necessary.
+ if (tipWindow==null) {
+ return;
+ }
+
+ // Add copy context menu
+ if (showCopyContextMenu && component == null) {
+ TipUtil.addCopyContextMenu(tipWindow);
+ }
+
+ tipWindow.fixSize(width, height);
+ ComponentOrientation o = attachedComponent.getComponentOrientation();
+
+ Point p = e.getPoint();
+ SwingUtilities.convertPointToScreen(p, attachedComponent);
+ int x = o.isLeftToRight() ? (p.x-10) :
+ (p.x - tipWindow.getWidth() + MARGIN);
+ int y = p.y + MARGIN;
+
+ // Ensure tooltip is in the window bounds.
+ Dimension ss = tipWindow.getToolkit().getScreenSize();
+ x = Math.max(x, 0);
+ if (x+tipWindow.getWidth()>=ss.width) {
+ x = ss.width - tipWindow.getWidth();
+ }
+ if (y+tipWindow.getHeight()>=ss.height) { // Go above cursor
+ y = p.y - tipWindow.getHeight() - MARGIN;
+ }
+
+ tipWindow.setLocation(x, y);
+ tipWindow.setVisible(true);
+ tipWindow.toFront();
+ computeTipVisibleBounds(); // Do after tip is visible
+ attachedComponentListener.install(attachedComponent);
+ lastText = text;
+ lastComponent = component;
+ }
+ });
+
+ }
+
+
+ /**
+ * Returns the base URL to use when loading images in this focusable tip.
+ *
+ * @return The base URL to use.
+ * @see #setImageBase(URL)
+ */
+ public URL getImageBase() {
+ return imageBase;
+ }
+
+
+ /*
+ * Returns localized text for the given key.
+ *
+ * @param key The key into the resource bundle.
+ * @return The localized text.
+ *
+ static String getString(String key) {
+ return msg.getString(key);
+ }*/
+
+
+ /**
+ * Disposes of the focusable tip currently displayed, if any.
+ */
+ public void possiblyDisposeOfTipWindow() {
+ if (tipWindow != null) {
+ tipWindow.dispose();
+ tipWindow = null;
+ attachedComponentListener.uninstall();
+ tipVisibleBounds.setBounds(-1, -1, 0, 0);
+ lastText = null;
+ lastComponent = null;
+ attachedComponent.requestFocus();
+ }
+ }
+
+
+ void removeListeners() {
+ //System.out.println("DEBUG: Removing text area listeners");
+ attachedComponentListener.uninstall();
+ }
+
+
+ /**
+ * Sets the base URL to use when loading images in this focusable tip.
+ *
+ * @param url The base URL to use.
+ * @see #getImageBase()
+ */
+ public void setImageBase(URL url) {
+ imageBase = url;
+ }
+
+
+ protected void setAttachedComponent(JComponent attachedComponent) {
+ this.attachedComponent = attachedComponent;
+ // Is okay to do multiple times.
+ ToolTipManager.sharedInstance().registerComponent(attachedComponent);
+ }
+
+ public void toolTipRequested(MouseEvent e, String text) {
+
+ if (StringUtils.isEmpty(text)) {
+ possiblyDisposeOfTipWindow();
+ lastText = text;
+ return;
+ }
+
+ if (lastText==null || text.length()!=lastText.length()
+ || !text.equals(lastText)) {
+ possiblyDisposeOfTipWindow();
+ createAndShowTipWindow(e, null, text);
+ }
+
+ }
+
+ /*
+ * To display specific component in toolTip
+ *
+ * Note : Be carfull, set toolTipText of attachedComponent.setToolTipText(FocusableTip.DUMMY_TOOL_TIP);
+ */
+ public void toolTipRequested(MouseEvent e, Component component) {
+
+ if (component == null) {
+ possiblyDisposeOfTipWindow();
+ lastComponent = component;
+ return;
+ }
+
+ if (lastComponent==null || !lastComponent.equals(component)) {
+ possiblyDisposeOfTipWindow();
+ createAndShowTipWindow(e, component, null);
+ }
+
+ }
+
+
+ protected class AttachedComponentListener extends MouseInputAdapter implements
+ CaretListener, ComponentListener, FocusListener, KeyListener {
+
+ public void caretUpdate(CaretEvent e) {
+ Object source = e.getSource();
+ if (source == attachedComponent) {
+ possiblyDisposeOfTipWindow();
+ }
+ }
+
+ public void componentHidden(ComponentEvent e) {
+ handleComponentEvent(e);
+ }
+
+ public void componentMoved(ComponentEvent e) {
+ handleComponentEvent(e);
+ }
+
+ public void componentResized(ComponentEvent e) {
+ handleComponentEvent(e);
+ }
+
+ public void componentShown(ComponentEvent e) {
+ handleComponentEvent(e);
+ }
+
+ public void focusGained(FocusEvent e) {
+ }
+
+ public void focusLost(FocusEvent e) {
+ // Only dispose of tip if it wasn't the TipWindow that was clicked
+ // "c" can be null, at least on OS X, so we must check that before
+ // calling SwingUtilities.getWindowAncestor() to guard against an
+ // NPE.
+ Component c = e.getOppositeComponent();
+ boolean tipClicked = (c instanceof TipWindow) ||
+ (c!=null &&
+ SwingUtilities.getWindowAncestor(c) instanceof TipWindow);
+ if (!tipClicked) {
+ possiblyDisposeOfTipWindow();
+ }
+ }
+
+ protected void handleComponentEvent(ComponentEvent e) {
+ possiblyDisposeOfTipWindow();
+ }
+
+ public void install(JComponent attachedComponent) {
+ //attachedComponent.addCaretListener(this);
+ attachedComponent.addComponentListener(this);
+ attachedComponent.addFocusListener(this);
+ attachedComponent.addKeyListener(this);
+ attachedComponent.addMouseListener(this);
+ attachedComponent.addMouseMotionListener(this);
+ }
+
+ public void keyPressed(KeyEvent e) {
+ if (e.getKeyCode()==KeyEvent.VK_ESCAPE) {
+ possiblyDisposeOfTipWindow();
+ }
+ else if (e.getKeyCode()==KeyEvent.VK_F2) {
+ if (tipWindow!=null && !tipWindow.getFocusableWindowState()) {
+ tipWindow.actionPerformed(null);
+ e.consume(); // Don't do bookmarking stuff
+ }
+ }
+ }
+
+ public void keyReleased(KeyEvent e) {
+ }
+
+ public void keyTyped(KeyEvent e) {
+ }
+
+ public void mouseExited(MouseEvent e) {
+ // possiblyDisposeOfTipWindow();
+ }
+
+ public void mouseMoved(MouseEvent e) {
+ if (tipVisibleBounds==null ||
+ !tipVisibleBounds.contains(e.getPoint())) {
+ possiblyDisposeOfTipWindow();
+ }
+ }
+
+ public void uninstall() {
+ //attachedComponent.removeCaretListener(this);
+ attachedComponent.removeComponentListener(this);
+ attachedComponent.removeFocusListener(this);
+ attachedComponent.removeKeyListener(this);
+ attachedComponent.removeMouseListener(this);
+ attachedComponent.removeMouseMotionListener(this);
+ }
+
+ }
+
+}
\ No newline at end of file
Property changes on: trunk/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/tooltip/FocusableTip.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
Added: trunk/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/tooltip/SizeGrip.java
===================================================================
--- trunk/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/tooltip/SizeGrip.java (rev 0)
+++ trunk/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/tooltip/SizeGrip.java 2014-02-24 14:27:22 UTC (rev 2800)
@@ -0,0 +1,270 @@
+/*
+ * %%Ignore-License
+ *
+ * 12/23/2008
+ *
+ * SizeGrip.java - A size grip component that sits at the bottom of the window,
+ * allowing the user to easily resize that window.
+ * Copyright (C) 2008 Robert Futrell
+ * robert_futrell at users.sourceforge.net
+ * http://fifesoft.com/rsyntaxtextarea
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
+ */
+package org.nuiton.jaxx.widgets.extra.tooltip;
+
+import java.awt.Color;
+import java.awt.ComponentOrientation;
+import java.awt.Cursor;
+import java.awt.Dimension;
+import java.awt.Graphics;
+import java.awt.Image;
+import java.awt.Point;
+import java.awt.Window;
+import java.awt.event.MouseEvent;
+import java.io.File;
+import java.io.IOException;
+import java.net.MalformedURLException;
+import java.net.URL;
+import javax.imageio.ImageIO;
+import javax.swing.JPanel;
+import javax.swing.SwingUtilities;
+import javax.swing.UIManager;
+import javax.swing.event.MouseInputAdapter;
+
+
+/**
+ * A component that allows its parent window to be resizable, similar to the
+ * size grip seen on status bars.
+ *
+ * @author Robert Futrell
+ * @version 1.0
+ */
+public class SizeGrip extends JPanel {
+
+ private static final long serialVersionUID = 1L;
+
+ /**
+ * The size grip to use if we're on OS X.
+ */
+ protected Image osxSizeGrip;
+
+
+ public SizeGrip() {
+ MouseHandler adapter = new MouseHandler();
+ addMouseListener(adapter);
+ addMouseMotionListener(adapter);
+ setPreferredSize(new Dimension(16, 16));
+ }
+
+
+ /**
+ * Overridden to ensure that the cursor for this component is appropriate
+ * for the orientation.
+ *
+ * @param o The new orientation.
+ */
+ public void applyComponentOrientation(ComponentOrientation o) {
+ possiblyFixCursor(o.isLeftToRight());
+ super.applyComponentOrientation(o);
+ }
+
+
+ /**
+ * Creates and returns the OS X size grip image.
+ *
+ * @return The OS X size grip.
+ */
+ protected Image createOSXSizeGrip() {
+ ClassLoader cl = getClass().getClassLoader();
+ URL url = cl.getResource("org/fife/ui/autocomplete/osx_sizegrip.png");
+ if (url==null) {
+ // We're not running in a jar - we may be debugging in Eclipse,
+ // for example
+ File f = new File("../AutoComplete/src/org/fife/ui/autocomplete/osx_sizegrip.png");
+ if (f.isFile()) {
+ try {
+ url = f.toURI().toURL();
+ } catch (MalformedURLException mue) { // Never happens
+ mue.printStackTrace();
+ return null;
+ }
+ }
+ else {
+ return null; // Can't find resource or image file
+ }
+ }
+ Image image = null;
+ try {
+ image = ImageIO.read(url);
+ } catch (IOException ioe) { // Never happens
+ ioe.printStackTrace();
+ }
+ return image;
+ }
+
+
+ /**
+ * Paints this panel.
+ *
+ * @param g The graphics context.
+ */
+ protected void paintComponent(Graphics g) {
+
+ super.paintComponent(g);
+
+ Dimension dim = getSize();
+ Color c1 = UIManager.getColor("Label.disabledShadow");
+ Color c2 = UIManager.getColor("Label.disabledForeground");
+
+ if (osxSizeGrip!=null) {
+ g.drawImage(osxSizeGrip, dim.width-16, dim.height-16, null);
+ return;
+ }
+
+ ComponentOrientation orientation = getComponentOrientation();
+
+ if (orientation.isLeftToRight()) {
+ int width = dim.width -= 3;
+ int height = dim.height -= 3;
+ g.setColor(c1);
+ g.fillRect(width-9,height-1, 3,3);
+ g.fillRect(width-5,height-1, 3,3);
+ g.fillRect(width-1,height-1, 3,3);
+ g.fillRect(width-5,height-5, 3,3);
+ g.fillRect(width-1,height-5, 3,3);
+ g.fillRect(width-1,height-9, 3,3);
+ g.setColor(c2);
+ g.fillRect(width-9,height-1, 2,2);
+ g.fillRect(width-5,height-1, 2,2);
+ g.fillRect(width-1,height-1, 2,2);
+ g.fillRect(width-5,height-5, 2,2);
+ g.fillRect(width-1,height-5, 2,2);
+ g.fillRect(width-1,height-9, 2,2);
+ }
+ else {
+ int height = dim.height -= 3;
+ g.setColor(c1);
+ g.fillRect(10,height-1, 3,3);
+ g.fillRect(6,height-1, 3,3);
+ g.fillRect(2,height-1, 3,3);
+ g.fillRect(6,height-5, 3,3);
+ g.fillRect(2,height-5, 3,3);
+ g.fillRect(2,height-9, 3,3);
+ g.setColor(c2);
+ g.fillRect(10,height-1, 2,2);
+ g.fillRect(6,height-1, 2,2);
+ g.fillRect(2,height-1, 2,2);
+ g.fillRect(6,height-5, 2,2);
+ g.fillRect(2,height-5, 2,2);
+ g.fillRect(2,height-9, 2,2);
+ }
+
+ }
+
+
+ /**
+ * Ensures that the cursor for this component is appropriate for the
+ * orientation.
+ *
+ * @param ltr Whether the current component orientation is LTR.
+ */
+ protected void possiblyFixCursor(boolean ltr) {
+ int cursor = Cursor.NE_RESIZE_CURSOR;
+ if (ltr) {
+ cursor = Cursor.NW_RESIZE_CURSOR;
+ }
+ if (cursor!=getCursor().getType()) {
+ setCursor(Cursor.getPredefinedCursor(cursor));
+ }
+ }
+
+
+ public void updateUI() {
+ super.updateUI();
+ // TODO: Key off of Aqua LaF, not just OS X, as this size grip looks
+ // bad on other LaFs on Mac such as Nimbus.
+ if (System.getProperty("os.name").indexOf("OS X")>-1) {
+ if (osxSizeGrip==null) {
+ osxSizeGrip = createOSXSizeGrip();
+ }
+ }
+ else { // Clear memory in case of runtime LaF change.
+ osxSizeGrip = null;
+ }
+
+ }
+
+
+ /**
+ * Listens for mouse events on this panel and resizes the parent window
+ * appropriately.
+ *
+ * @author Robert Futrell
+ * @version 1.0
+ */
+ /*
+ * NOTE: We use SwingUtilities.convertPointToScreen() instead of just using
+ * the locations relative to the corner component because the latter proved
+ * buggy - stretch the window too wide and some kind of arithmetic error
+ * started happening somewhere - our window would grow way too large.
+ */
+ protected class MouseHandler extends MouseInputAdapter {
+
+ protected Point origPos;
+
+ public void mouseDragged(MouseEvent e) {
+ Point newPos = e.getPoint();
+ SwingUtilities.convertPointToScreen(newPos, SizeGrip.this);
+ int xDelta = newPos.x - origPos.x;
+ int yDelta = newPos.y - origPos.y;
+ Window wind = SwingUtilities.getWindowAncestor(SizeGrip.this);
+ if (wind!=null) { // Should always be true
+ if (getComponentOrientation().isLeftToRight()) {
+ int w = wind.getWidth();
+ if (newPos.x>=wind.getX()) {
+ w += xDelta;
+ }
+ int h = wind.getHeight();
+ if (newPos.y>=wind.getY()) {
+ h += yDelta;
+ }
+ wind.setSize(w,h);
+ }
+ else { // RTL
+ int newW = Math.max(1, wind.getWidth()-xDelta);
+ int newH = Math.max(1, wind.getHeight()+yDelta);
+ wind.setBounds(newPos.x, wind.getY(), newW, newH);
+ }
+ // invalidate()/validate() needed pre-1.6.
+ wind.invalidate();
+ wind.validate();
+ }
+ origPos.setLocation(newPos);
+ }
+
+ public void mousePressed(MouseEvent e) {
+ origPos = e.getPoint();
+ SwingUtilities.convertPointToScreen(origPos, SizeGrip.this);
+ }
+
+ public void mouseReleased(MouseEvent e) {
+ origPos = null;
+ }
+
+ }
+
+
+}
\ No newline at end of file
Property changes on: trunk/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/tooltip/SizeGrip.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
Added: trunk/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/tooltip/TipUtil.java
===================================================================
--- trunk/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/tooltip/TipUtil.java (rev 0)
+++ trunk/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/tooltip/TipUtil.java 2014-02-24 14:27:22 UTC (rev 2800)
@@ -0,0 +1,184 @@
+/*
+ * %%Ignore-License
+ *
+ * 08/13/2009
+ *
+ * TipUtil.java - Utility methods for homemade tool tips.
+ * Copyright (C) 2009 Robert Futrell
+ * robert_futrell at users.sourceforge.net
+ * http://fifesoft.com/rsyntaxtextarea
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
+ */
+package org.nuiton.jaxx.widgets.extra.tooltip;
+
+import java.awt.Color;
+import java.awt.Component;
+import java.awt.Font;
+import java.awt.SystemColor;
+import java.awt.Toolkit;
+import java.awt.datatransfer.Clipboard;
+import java.awt.datatransfer.StringSelection;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.awt.event.MouseAdapter;
+import java.awt.event.MouseEvent;
+
+import javax.swing.BorderFactory;
+import javax.swing.Icon;
+import javax.swing.JEditorPane;
+import javax.swing.JMenuItem;
+import javax.swing.JPopupMenu;
+import javax.swing.UIManager;
+import javax.swing.plaf.ColorUIResource;
+import javax.swing.text.html.HTMLDocument;
+import org.apache.commons.lang3.StringUtils;
+import org.nuiton.util.Resource;
+
+import static org.nuiton.i18n.I18n.t;
+
+/**
+ * Static utility methods for focusable tips.
+ *
+ * @author Robert Futrell
+ * @version 1.0
+ */
+public class TipUtil {
+
+ protected static final String COPY_ICON_PATH = "copy.png";
+
+ private TipUtil() {
+ }
+
+
+ /**
+ * Returns the default background color to use for tool tip windows.
+ *
+ * @return The default background color.
+ */
+ public static Color getToolTipBackground() {
+
+ Color c = UIManager.getColor("ToolTip.background");
+
+ // Tooltip.background is wrong color on Nimbus (!)
+ if (c==null || UIManager.getLookAndFeel().getName().equals("Nimbus")) {
+ c = UIManager.getColor("info"); // Used by Nimbus (and others)
+ if (c==null) {
+ c = SystemColor.info; // System default
+ }
+ }
+
+ // Workaround for a bug (?) with Nimbus - calling JLabel.setBackground()
+ // with a ColorUIResource does nothing, must be a normal Color
+ if (c instanceof ColorUIResource) {
+ c = new Color(c.getRGB());
+ }
+
+ return c;
+
+ }
+
+
+ /**
+ * Tweaks a <code>JEditorPane</code> so it can be used to render the
+ * content in a focusable pseudo-tool tip. It is assumed that the editor
+ * pane is using an <code>HTMLDocument</code>.
+ *
+ * @param textArea The editor pane to tweak.
+ */
+ public static void tweakTipEditorPane(JEditorPane textArea) {
+
+ // Jump through a few hoops to get things looking nice in Nimbus
+ if (UIManager.getLookAndFeel().getName().equals("Nimbus")) {
+ Color selBG = textArea.getSelectionColor();
+ Color selFG = textArea.getSelectedTextColor();
+ textArea.setUI(new javax.swing.plaf.basic.BasicEditorPaneUI());
+ textArea.setSelectedTextColor(selFG);
+ textArea.setSelectionColor(selBG);
+ }
+
+ textArea.setEditable(false); // Required for links to work!
+ textArea.setBorder(BorderFactory.createEmptyBorder(5,5,5,5));
+
+ // Make selection visible even though we are not (initially) focusable.
+ textArea.getCaret().setSelectionVisible(true);
+
+ // Make it use the "tool tip" background color.
+ textArea.setBackground(TipUtil.getToolTipBackground());
+
+ // Force JEditorPane to use a certain font even in HTML.
+ // All standard LookAndFeels, even Nimbus (!), define Label.font.
+ Font font = UIManager.getFont("Label.font");
+ if (font == null) { // Try to make a sensible default
+ font = new Font("SansSerif", Font.PLAIN, 12);
+ }
+ HTMLDocument doc = (HTMLDocument) textArea.getDocument();
+ doc.getStyleSheet().addRule(
+ "body { font-family: " + font.getFamily() + "; font-size: "
+ + font.getSize() + "pt; }");
+ }
+
+ /**
+ * Add context menu for paste selected content
+ *
+ * @param focusableTip to add copy context menu
+ */
+ public static void addCopyContextMenu(FocusableTip focusableTip) {
+ if (focusableTip == null) {
+ throw new NullPointerException("Focusable tip must be non null");
+ }
+
+ TipWindow tipWindows = focusableTip.getTipWindows();
+ addCopyContextMenu(tipWindows);
+ }
+
+ protected static void addCopyContextMenu(TipWindow tipWindows) {
+ if (tipWindows == null) {
+ throw new NullPointerException("TipWindows must be non null");
+ }
+
+ Component component = tipWindows.getComponent();
+ component.addMouseListener(new MouseAdapter(){
+
+ @Override
+ public void mouseClicked(MouseEvent e) {
+
+ JEditorPane textArea = (JEditorPane)e.getSource();
+ final String selectedText = textArea.getSelectedText();
+ if (e.getButton() == MouseEvent.BUTTON3 && !StringUtils.isBlank(selectedText)) {
+
+ JPopupMenu popupMenu = new JPopupMenu();
+
+ Icon copyIcon = Resource.getIcon(COPY_ICON_PATH);
+ JMenuItem copyMenuItem = new JMenuItem(t("nuitonwidgets.common.copy"), copyIcon);
+ copyMenuItem.addActionListener(new ActionListener() {
+
+ @Override
+ public void actionPerformed(ActionEvent e) {
+ StringSelection selection = new StringSelection(selectedText);
+
+ Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard();
+ clipboard.setContents(selection, null);
+ }
+ });
+
+ popupMenu.add(copyMenuItem);
+ popupMenu.show(textArea, e.getX(), e.getY());
+ }
+ }
+ });
+ }
+
+}
\ No newline at end of file
Property changes on: trunk/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/tooltip/TipUtil.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
Added: trunk/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/tooltip/TipWindow.java
===================================================================
--- trunk/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/tooltip/TipWindow.java (rev 0)
+++ trunk/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/tooltip/TipWindow.java 2014-02-24 14:27:22 UTC (rev 2800)
@@ -0,0 +1,370 @@
+/*
+ * %%Ignore-License
+ *
+ * 07/29/2009
+ *
+ * TipWindow.java - The actual window component representing the tool tip.
+ * Copyright (C) 2009 Robert Futrell
+ * robert_futrell at users.sourceforge.net
+ * http://fifesoft.com/rsyntaxtextarea
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
+ */
+package org.nuiton.jaxx.widgets.extra.tooltip;
+
+import static org.nuiton.i18n.I18n.t;
+
+import java.awt.BorderLayout;
+import java.awt.Color;
+import java.awt.Component;
+import java.awt.Container;
+import java.awt.Dimension;
+import java.awt.Font;
+import java.awt.Point;
+import java.awt.Window;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.awt.event.KeyAdapter;
+import java.awt.event.KeyEvent;
+import java.awt.event.MouseAdapter;
+import java.awt.event.MouseEvent;
+import java.awt.event.WindowAdapter;
+import java.awt.event.WindowEvent;
+import javax.swing.BorderFactory;
+import javax.swing.JEditorPane;
+import javax.swing.JLabel;
+import javax.swing.JPanel;
+import javax.swing.JScrollPane;
+import javax.swing.JSeparator;
+import javax.swing.JWindow;
+import javax.swing.SwingConstants;
+import javax.swing.SwingUtilities;
+import javax.swing.UIManager;
+import javax.swing.event.HyperlinkEvent;
+import javax.swing.event.HyperlinkListener;
+import javax.swing.event.MouseInputAdapter;
+import javax.swing.text.html.HTMLDocument;
+
+
+/**
+ * The actual tool tip component.
+ *
+ * @author Robert Futrell
+ * @version 1.0
+ */
+public class TipWindow extends JWindow implements ActionListener {
+
+ protected FocusableTip ft;
+ protected Component component;
+ protected String text;
+ protected TipListener tipListener;
+ protected HyperlinkListener userHyperlinkListener;
+
+ protected static TipWindow visibleInstance;
+
+ /**
+ * Constructor, by default, is JEditorPane will be used for toolTip.
+ *
+ * @param owner The parent window.
+ * @param ft Focusable tip
+ * @param msg The text of the tool tip. This can be HTML.
+ */
+ public TipWindow(Window owner, FocusableTip ft, String msg) {
+ super(owner);
+ this.ft = ft;
+ tipListener = new TipListener();
+
+ JEditorPane textArea = new JEditorPane("text/html", msg);
+ TipUtil.tweakTipEditorPane(textArea);
+ if (ft.getImageBase()!=null) { // Base URL for images
+ ((HTMLDocument)textArea.getDocument()).setBase(ft.getImageBase());
+ }
+ textArea.addMouseListener(tipListener);
+ textArea.addHyperlinkListener(new HyperlinkListener() {
+ public void hyperlinkUpdate(HyperlinkEvent e) {
+ if (e.getEventType()==HyperlinkEvent.EventType.ACTIVATED) {
+ TipWindow.this.ft.possiblyDisposeOfTipWindow();
+ }
+ }
+ });
+ init(ft, textArea);
+ }
+
+ /**
+ * To specify component to display
+ *
+ * @param owner The parent window.
+ * @param ft Focusable tip
+ * @param component custom component to display
+ */
+ public TipWindow(Window owner, FocusableTip ft, Component component) {
+ super(owner);
+ init(ft, component);
+ }
+
+ protected void init(FocusableTip ft, Component component) {
+ this.ft = ft;
+ tipListener = new TipListener();
+ this.component = component;
+
+ JPanel cp = new JPanel(new BorderLayout());
+ cp.setBorder(BorderFactory.createCompoundBorder(BorderFactory
+ .createLineBorder(Color.BLACK), BorderFactory
+ .createEmptyBorder()));
+ cp.setBackground(TipUtil.getToolTipBackground());
+ component.addMouseListener(tipListener);
+ cp.add(component);
+
+ setFocusableWindowState(false);
+ setContentPane(cp);
+ setBottomPanel(); // Must do after setContentPane()
+ pack();
+
+ // InputMap/ActionMap combo doesn't work for JWindows (even when
+ // using the JWindow's JRootPane), so we'll resort to KeyListener
+ KeyAdapter ka = new KeyAdapter() {
+ public void keyPressed(KeyEvent e) {
+ if (e.getKeyCode()==KeyEvent.VK_ESCAPE) {
+ TipWindow.this.ft.possiblyDisposeOfTipWindow();
+ }
+ }
+ };
+ addKeyListener(ka);
+ component.addKeyListener(ka);
+
+ // Ensure only 1 TipWindow is ever visible. If the caller does what
+ // they're supposed to and only creates these on the EDT, the
+ // synchronization isn't necessary, but we'll be extra safe.
+ synchronized (TipWindow.class) {
+ if (visibleInstance!=null) {
+ visibleInstance.dispose();
+ }
+ visibleInstance = this;
+ }
+ }
+
+ /**
+ * Return textArea of TipWindow
+ *
+ * @return textArea
+ */
+ public Component getComponent() {
+ return component;
+ }
+
+ public void actionPerformed(ActionEvent e) {
+
+ if (!getFocusableWindowState()) {
+ setFocusableWindowState(true);
+ setBottomPanel();
+ component.removeMouseListener(tipListener);
+ pack();
+ addWindowFocusListener(new WindowAdapter() {
+ public void windowLostFocus(WindowEvent e) {
+ ft.possiblyDisposeOfTipWindow();
+ }
+ });
+ ft.removeListeners();
+ if (e==null) { // Didn't get here via our mouseover timer
+ requestFocus();
+ }
+ }
+
+ }
+
+
+ /**
+ * Disposes of this window.
+ */
+ public void dispose() {
+ //System.out.println("[DEBUG]: Disposing...");
+ Container cp = getContentPane();
+ for (int i=0; i<cp.getComponentCount(); i++) {
+ // Okay if listener is already removed
+ cp.getComponent(i).removeMouseListener(tipListener);
+ }
+ ft.removeListeners();
+ super.dispose();
+ }
+
+
+ /**
+ * Workaround for JEditorPane not returning its proper preferred size
+ * when rendering HTML until after layout already done. See
+ * http://forums.sun.com/thread.jspa?forumID=57&threadID=574810 for a
+ * discussion.
+ *
+ * @param width min width
+ * @param height min height
+ */
+ public void fixSize(int width, int height) {
+
+// Dimension d = textArea.getPreferredSize();
+// Rectangle r;
+// try {
+//
+// r = textArea.modelToView(textArea.getDocument().getLength()-1);
+// d.height = r.y + r.height;
+//
+// // Ensure the text area doesn't start out too tall or wide.
+// d = textArea.getPreferredSize();
+// d.width = Math.min(d.width+25, width);
+// d.height = Math.min(d.height, height);
+//
+// textArea.setPreferredSize(d);
+//
+// } catch (BadLocationException ble) { // Never happens
+// ble.printStackTrace();
+// }
+//
+// pack(); // Must re-pack to calculate proper size.
+
+ // Use specified size
+ Dimension d = component.getPreferredSize();
+ d.height = width;
+ d.width = height;
+ component.setPreferredSize(d);
+ component.setSize(d);
+ pack();
+ }
+
+
+ public String getText() {
+ return text;
+ }
+
+
+ protected void setBottomPanel() {
+
+ final JPanel panel = new JPanel(new BorderLayout());
+ panel.add(new JSeparator(), BorderLayout.NORTH);
+
+ boolean focusable = getFocusableWindowState();
+ if (focusable) {
+ SizeGrip sg = new SizeGrip();
+ sg.applyComponentOrientation(sg.getComponentOrientation()); // Workaround
+ panel.add(sg, BorderLayout.LINE_END);
+ MouseInputAdapter adapter = new MouseInputAdapter() {
+ protected Point lastPoint;
+ public void mouseDragged(MouseEvent e) {
+ Point p = e.getPoint();
+ SwingUtilities.convertPointToScreen(p, panel);
+ if (lastPoint==null) {
+ lastPoint = p;
+ }
+ else {
+ int dx = p.x - lastPoint.x;
+ int dy = p.y - lastPoint.y;
+ setLocation(getX()+dx, getY()+dy);
+ lastPoint = p;
+ }
+ }
+ public void mousePressed(MouseEvent e) {
+ lastPoint = e.getPoint();
+ SwingUtilities.convertPointToScreen(lastPoint, panel);
+ }
+ };
+ panel.addMouseListener(adapter);
+ panel.addMouseMotionListener(adapter);
+ // Don't add tipListener to the panel or SizeGrip
+ }
+ else {
+ panel.setOpaque(false);
+ JLabel label = new JLabel(t("nuitonwidgets.tootilp.focushotkey")/*FocusableTip.getString("FocusHotkey")*/);
+ Color fg = UIManager.getColor("Label.disabledForeground");
+ Font font = component.getFont();
+ font = font.deriveFont(font.getSize2D() - 1.0f);
+ label.setFont(font);
+ if (fg==null) { // Non BasicLookAndFeel-derived Looks
+ fg = Color.GRAY;
+ }
+ label.setOpaque(true);
+ Color bg = TipUtil.getToolTipBackground();
+ label.setBackground(bg);
+ label.setForeground(fg);
+ label.setHorizontalAlignment(SwingConstants.TRAILING);
+ label.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 5));
+ panel.add(label);
+ panel.addMouseListener(tipListener);
+ }
+
+ // Replace the previous SOUTH Component with the new one.
+ Container cp = getContentPane();
+ if (cp.getComponentCount()==2) { // Skip first time through
+ Component comp = cp.getComponent(0);
+ cp.remove(0);
+ JScrollPane sp = new JScrollPane(comp);
+ sp.setViewportBorder(BorderFactory.createEmptyBorder());
+ sp.setBackground(component.getBackground());
+ sp.getViewport().setBackground(component.getBackground());
+ cp.add(sp);
+ // What was component 1 is now 0.
+ cp.getComponent(0).removeMouseListener(tipListener);
+ cp.remove(0);
+ }
+
+ cp.add(panel, BorderLayout.SOUTH);
+
+ }
+
+
+ /**
+ * Sets the listener for hyperlink events in this tip window.
+ *
+ * @param listener The new listener. The old listener (if any) is
+ * removed. A value of <code>null</code> means "no listener."
+ */
+ public void setHyperlinkListener(HyperlinkListener listener) {
+ if (component instanceof JEditorPane) {
+ JEditorPane textArea = (JEditorPane)component;
+
+ // We've added a separate listener, so remove only the user's.
+ if (userHyperlinkListener!=null) {
+ textArea.removeHyperlinkListener(userHyperlinkListener);
+ }
+ userHyperlinkListener = listener;
+ if (userHyperlinkListener!=null) {
+ textArea.addHyperlinkListener(userHyperlinkListener);
+ }
+ }
+ }
+
+
+ /**
+ * Listens for events in this window.
+ */
+ protected class TipListener extends MouseAdapter {
+
+ public TipListener() {
+ }
+
+ public void mousePressed(MouseEvent e) {
+ actionPerformed(null); // Manually create "real" window
+ }
+
+ public void mouseExited(MouseEvent e) {
+ // Since we registered this listener on the child components of
+ // the JWindow, not the JWindow iteself, we have to be careful.
+ Component source = (Component)e.getSource();
+ Point p = e.getPoint();
+ SwingUtilities.convertPointToScreen(p, source);
+ if (!TipWindow.this.getBounds().contains(p)) {
+ ft.possiblyDisposeOfTipWindow();
+ }
+ }
+
+ }
+
+}
\ No newline at end of file
Property changes on: trunk/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/tooltip/TipWindow.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
Added: trunk/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/tooltip/package-info.java
===================================================================
--- trunk/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/tooltip/package-info.java (rev 0)
+++ trunk/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/tooltip/package-info.java 2014-02-24 14:27:22 UTC (rev 2800)
@@ -0,0 +1,30 @@
+/*
+ * #%L
+ * JAXX :: Extra Widgets
+ * %%
+ * Copyright (C) 2004 - 2010 CodeLutin
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Lesser Public License for more details.
+ *
+ * You should have received a copy of the GNU General Lesser Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/lgpl-3.0.html>.
+ * #L%
+ */
+/**
+ * Focusable tooltip.
+ *
+ * Original code from RSyntaxTextArea project with following modifications:
+ * <ul>
+ * <li>allow setting tooltip on all {@link javax.swing.JComponent}</li>
+ * </ul>
+ */
+package org.nuiton.jaxx.widgets.extra.tooltip;
Property changes on: trunk/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/tooltip/package-info.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
Added: trunk/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/tree/FilterTreeModel.java
===================================================================
--- trunk/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/tree/FilterTreeModel.java (rev 0)
+++ trunk/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/tree/FilterTreeModel.java 2014-02-24 14:27:22 UTC (rev 2800)
@@ -0,0 +1,186 @@
+/*
+ * #%L
+ * JAXX :: Extra Widgets
+ * %%
+ * Copyright (C) 2004 - 2010 CodeLutin
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Lesser Public License for more details.
+ *
+ * You should have received a copy of the GNU General Lesser Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/lgpl-3.0.html>.
+ * #L%
+ */
+
+package org.nuiton.jaxx.widgets.extra.tree;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Iterator;
+
+import javax.swing.event.TreeModelEvent;
+import javax.swing.event.TreeModelListener;
+import javax.swing.tree.TreeModel;
+import javax.swing.tree.TreePath;
+
+/**
+ * Filter tree model.
+ *
+ * Take a delegate {@link TreeModel} filter it with {@link TreeFilter}.
+ *
+ * @author chatellier
+ * @version $Revision$
+ *
+ * Last update : $Date$
+ * By : $Author$
+ *
+ * Based on : http://forums.sun.com/thread.jspa?forumID=57&threadID=5378510
+ */
+public class FilterTreeModel implements TreeModel {
+
+ /** Listener for data and structure change notification. */
+ protected Collection<TreeModelListener> treeModelListeners;
+
+ /** Real application {@link TreeModel}. */
+ protected TreeModel delegateModel;
+
+ /** Filter to use (can be null : no filtering). */
+ protected TreeFilter treeFilter;
+
+ /**
+ * Constructor with delegate model.
+ *
+ * @param delegateModel delegate data model
+ */
+ public FilterTreeModel(TreeModel delegateModel) {
+ this(delegateModel, null);
+ }
+
+ /**
+ * Constructor with delegate model.
+ *
+ * @param delegateModel
+ * @param filter
+ */
+ public FilterTreeModel(TreeModel delegateModel, TreeFilter filter) {
+ this.delegateModel = delegateModel;
+ this.treeFilter = filter;
+ treeModelListeners = new ArrayList<TreeModelListener>();
+ }
+
+ /**
+ * Change filter.
+ *
+ * Send a {@code treeStructureChanged} event on all registred listeners.
+ *
+ * @param treeFilter new filter
+ */
+ public void setFilter(TreeFilter treeFilter) {
+ this.treeFilter = treeFilter;
+ TreePath path = new TreePath(delegateModel.getRoot());
+ fireTreeStructureChanged(path);
+ }
+
+ /**
+ * Send a {@code treeStructureChanged} event on all registred listeners.
+ *
+ * @param path new path to send in notification
+ */
+ protected void fireTreeStructureChanged(TreePath path) {
+ TreeModelEvent event = new TreeModelEvent(delegateModel, path);
+ Iterator<TreeModelListener> itTreeModelListener = treeModelListeners.iterator();
+ while(itTreeModelListener.hasNext()) {
+ TreeModelListener current = itTreeModelListener.next();
+ current.treeStructureChanged(event);
+ }
+ }
+
+ @Override
+ public int getChildCount(Object parent) {
+ int realCount = delegateModel.getChildCount(parent);
+ int filterCount = 0;
+
+ for (int i = 0; i < realCount; i++) {
+ Object child = delegateModel.getChild(parent, i);
+ // null filter allowed, no filtering
+ if (treeFilter == null || treeFilter.include(delegateModel, child)) {
+ filterCount++;
+ }
+ }
+ return filterCount;
+ }
+
+ @Override
+ public Object getChild(Object parent, int index) {
+ int cnt = -1;
+ for (int i = 0; i < delegateModel.getChildCount(parent); i++) {
+ Object child = delegateModel.getChild(parent, i);
+ // null filter allowed, no filtering
+ if (treeFilter == null || treeFilter.include(delegateModel, child)) {
+ cnt++;
+ }
+ if (cnt == index) {
+ return child;
+ }
+ }
+ return null;
+ }
+
+ /*
+ * @see javax.swing.tree.TreeModel#getRoot()
+ */
+ @Override
+ public Object getRoot() {
+ return delegateModel.getRoot();
+ }
+
+ /*
+ * @see javax.swing.tree.TreeModel#isLeaf(java.lang.Object)
+ */
+ @Override
+ public boolean isLeaf(Object node) {
+ return delegateModel.isLeaf(node);
+ }
+
+ /*
+ * @see javax.swing.tree.TreeModel#valueForPathChanged(javax.swing.tree.TreePath, java.lang.Object)
+ */
+ @Override
+ public void valueForPathChanged(TreePath path, Object newValue) {
+ delegateModel.valueForPathChanged(path, newValue);
+ }
+
+ /*
+ * @see javax.swing.tree.TreeModel#getIndexOfChild(java.lang.Object, java.lang.Object)
+ */
+ @Override
+ public int getIndexOfChild(Object parent, Object child) {
+ return delegateModel.getIndexOfChild(parent, child);
+ }
+
+ /*
+ * @see javax.swing.tree.TreeModel#addTreeModelListener(javax.swing.event.TreeModelListener)
+ */
+ @Override
+ public void addTreeModelListener(TreeModelListener l) {
+ delegateModel.addTreeModelListener(l);
+ treeModelListeners.add(l);
+ }
+
+ /*
+ * @see javax.swing.tree.TreeModel#removeTreeModelListener(javax.swing.event.TreeModelListener)
+ */
+ @Override
+ public void removeTreeModelListener(TreeModelListener l) {
+ delegateModel.removeTreeModelListener(l);
+ treeModelListeners.remove(l);
+ }
+}
Property changes on: trunk/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/tree/FilterTreeModel.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
Added: trunk/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/tree/TreeFilter.java
===================================================================
--- trunk/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/tree/TreeFilter.java (rev 0)
+++ trunk/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/tree/TreeFilter.java 2014-02-24 14:27:22 UTC (rev 2800)
@@ -0,0 +1,38 @@
+/*
+ * #%L
+ * JAXX :: Extra Widgets
+ * %%
+ * Copyright (C) 2004 - 2010 CodeLutin
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Lesser Public License for more details.
+ *
+ * You should have received a copy of the GNU General Lesser Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/lgpl-3.0.html>.
+ * #L%
+ */
+
+package org.nuiton.jaxx.widgets.extra.tree;
+
+import javax.swing.tree.TreeModel;
+
+/**
+ * TreeFilter
+ *
+ * TODO ADD COMMENT HERE !
+ *
+ * @author ceric35
+ * Date : 4 mars 2010
+ */
+public interface TreeFilter {
+
+ boolean include(TreeModel model, Object node);
+}
Property changes on: trunk/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/tree/TreeFilter.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
Added: trunk/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/tree/package-info.java
===================================================================
--- trunk/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/tree/package-info.java (rev 0)
+++ trunk/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/tree/package-info.java 2014-02-24 14:27:22 UTC (rev 2800)
@@ -0,0 +1,25 @@
+/*
+ * #%L
+ * JAXX :: Extra Widgets
+ * %%
+ * Copyright (C) 2004 - 2010 CodeLutin
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Lesser Public License for more details.
+ *
+ * You should have received a copy of the GNU General Lesser Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/lgpl-3.0.html>.
+ * #L%
+ */
+/**
+ * Tree filtering classes.
+ */
+package org.nuiton.jaxx.widgets.extra.tree;
Property changes on: trunk/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/tree/package-info.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
Added: trunk/jaxx-widgets-extra/src/main/resources/.Bpib
===================================================================
(Binary files differ)
Property changes on: trunk/jaxx-widgets-extra/src/main/resources/.Bpib
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/jaxx-widgets-extra/src/main/resources/22x22/appearance.png
===================================================================
(Binary files differ)
Property changes on: trunk/jaxx-widgets-extra/src/main/resources/22x22/appearance.png
___________________________________________________________________
Added: svn:mime-type
+ image/png
Added: trunk/jaxx-widgets-extra/src/main/resources/22x22/appointment.png
===================================================================
(Binary files differ)
Property changes on: trunk/jaxx-widgets-extra/src/main/resources/22x22/appointment.png
___________________________________________________________________
Added: svn:mime-type
+ image/png
Added: trunk/jaxx-widgets-extra/src/main/resources/22x22/arrow1Down.png
===================================================================
(Binary files differ)
Property changes on: trunk/jaxx-widgets-extra/src/main/resources/22x22/arrow1Down.png
___________________________________________________________________
Added: svn:mime-type
+ image/png
Added: trunk/jaxx-widgets-extra/src/main/resources/22x22/arrow1Left.png
===================================================================
(Binary files differ)
Property changes on: trunk/jaxx-widgets-extra/src/main/resources/22x22/arrow1Left.png
___________________________________________________________________
Added: svn:mime-type
+ image/png
Added: trunk/jaxx-widgets-extra/src/main/resources/22x22/arrow1Right.png
===================================================================
(Binary files differ)
Property changes on: trunk/jaxx-widgets-extra/src/main/resources/22x22/arrow1Right.png
___________________________________________________________________
Added: svn:mime-type
+ image/png
Added: trunk/jaxx-widgets-extra/src/main/resources/22x22/arrow1Up.png
===================================================================
(Binary files differ)
Property changes on: trunk/jaxx-widgets-extra/src/main/resources/22x22/arrow1Up.png
___________________________________________________________________
Added: svn:mime-type
+ image/png
Added: trunk/jaxx-widgets-extra/src/main/resources/22x22/arrow2Down.png
===================================================================
(Binary files differ)
Property changes on: trunk/jaxx-widgets-extra/src/main/resources/22x22/arrow2Down.png
___________________________________________________________________
Added: svn:mime-type
+ image/png
Added: trunk/jaxx-widgets-extra/src/main/resources/22x22/arrow2Left.png
===================================================================
(Binary files differ)
Property changes on: trunk/jaxx-widgets-extra/src/main/resources/22x22/arrow2Left.png
___________________________________________________________________
Added: svn:mime-type
+ image/png
Added: trunk/jaxx-widgets-extra/src/main/resources/22x22/arrow2Right.png
===================================================================
(Binary files differ)
Property changes on: trunk/jaxx-widgets-extra/src/main/resources/22x22/arrow2Right.png
___________________________________________________________________
Added: svn:mime-type
+ image/png
Added: trunk/jaxx-widgets-extra/src/main/resources/22x22/arrow2Up.png
===================================================================
(Binary files differ)
Property changes on: trunk/jaxx-widgets-extra/src/main/resources/22x22/arrow2Up.png
___________________________________________________________________
Added: svn:mime-type
+ image/png
Added: trunk/jaxx-widgets-extra/src/main/resources/22x22/attach.png
===================================================================
(Binary files differ)
Property changes on: trunk/jaxx-widgets-extra/src/main/resources/22x22/attach.png
___________________________________________________________________
Added: svn:mime-type
+ image/png
Added: trunk/jaxx-widgets-extra/src/main/resources/22x22/cancel.png
===================================================================
(Binary files differ)
Property changes on: trunk/jaxx-widgets-extra/src/main/resources/22x22/cancel.png
___________________________________________________________________
Added: svn:mime-type
+ image/png
Added: trunk/jaxx-widgets-extra/src/main/resources/22x22/close.png
===================================================================
(Binary files differ)
Property changes on: trunk/jaxx-widgets-extra/src/main/resources/22x22/close.png
___________________________________________________________________
Added: svn:mime-type
+ image/png
Added: trunk/jaxx-widgets-extra/src/main/resources/22x22/find.png
===================================================================
(Binary files differ)
Property changes on: trunk/jaxx-widgets-extra/src/main/resources/22x22/find.png
___________________________________________________________________
Added: svn:mime-type
+ image/png
Added: trunk/jaxx-widgets-extra/src/main/resources/22x22/fonts.png
===================================================================
(Binary files differ)
Property changes on: trunk/jaxx-widgets-extra/src/main/resources/22x22/fonts.png
___________________________________________________________________
Added: svn:mime-type
+ image/png
Added: trunk/jaxx-widgets-extra/src/main/resources/22x22/fullscreen.png
===================================================================
(Binary files differ)
Property changes on: trunk/jaxx-widgets-extra/src/main/resources/22x22/fullscreen.png
___________________________________________________________________
Added: svn:mime-type
+ image/png
Added: trunk/jaxx-widgets-extra/src/main/resources/22x22/help.png
===================================================================
(Binary files differ)
Property changes on: trunk/jaxx-widgets-extra/src/main/resources/22x22/help.png
___________________________________________________________________
Added: svn:mime-type
+ image/png
Added: trunk/jaxx-widgets-extra/src/main/resources/22x22/idea.png
===================================================================
(Binary files differ)
Property changes on: trunk/jaxx-widgets-extra/src/main/resources/22x22/idea.png
___________________________________________________________________
Added: svn:mime-type
+ image/png
Added: trunk/jaxx-widgets-extra/src/main/resources/22x22/info.png
===================================================================
(Binary files differ)
Property changes on: trunk/jaxx-widgets-extra/src/main/resources/22x22/info.png
___________________________________________________________________
Added: svn:mime-type
+ image/png
Added: trunk/jaxx-widgets-extra/src/main/resources/22x22/mail.png
===================================================================
(Binary files differ)
Property changes on: trunk/jaxx-widgets-extra/src/main/resources/22x22/mail.png
___________________________________________________________________
Added: svn:mime-type
+ image/png
Added: trunk/jaxx-widgets-extra/src/main/resources/22x22/mailGet.png
===================================================================
(Binary files differ)
Property changes on: trunk/jaxx-widgets-extra/src/main/resources/22x22/mailGet.png
___________________________________________________________________
Added: svn:mime-type
+ image/png
Added: trunk/jaxx-widgets-extra/src/main/resources/22x22/mailNew.png
===================================================================
(Binary files differ)
Property changes on: trunk/jaxx-widgets-extra/src/main/resources/22x22/mailNew.png
___________________________________________________________________
Added: svn:mime-type
+ image/png
Added: trunk/jaxx-widgets-extra/src/main/resources/22x22/mailSend.png
===================================================================
(Binary files differ)
Property changes on: trunk/jaxx-widgets-extra/src/main/resources/22x22/mailSend.png
___________________________________________________________________
Added: svn:mime-type
+ image/png
Added: trunk/jaxx-widgets-extra/src/main/resources/22x22/new.png
===================================================================
(Binary files differ)
Property changes on: trunk/jaxx-widgets-extra/src/main/resources/22x22/new.png
___________________________________________________________________
Added: svn:mime-type
+ image/png
Added: trunk/jaxx-widgets-extra/src/main/resources/22x22/nofullscreen.png
===================================================================
(Binary files differ)
Property changes on: trunk/jaxx-widgets-extra/src/main/resources/22x22/nofullscreen.png
___________________________________________________________________
Added: svn:mime-type
+ image/png
Added: trunk/jaxx-widgets-extra/src/main/resources/22x22/ok.png
===================================================================
(Binary files differ)
Property changes on: trunk/jaxx-widgets-extra/src/main/resources/22x22/ok.png
___________________________________________________________________
Added: svn:mime-type
+ image/png
Added: trunk/jaxx-widgets-extra/src/main/resources/22x22/open.png
===================================================================
(Binary files differ)
Property changes on: trunk/jaxx-widgets-extra/src/main/resources/22x22/open.png
___________________________________________________________________
Added: svn:mime-type
+ image/png
Added: trunk/jaxx-widgets-extra/src/main/resources/22x22/print.png
===================================================================
(Binary files differ)
Property changes on: trunk/jaxx-widgets-extra/src/main/resources/22x22/print.png
___________________________________________________________________
Added: svn:mime-type
+ image/png
Added: trunk/jaxx-widgets-extra/src/main/resources/22x22/redo.png
===================================================================
(Binary files differ)
Property changes on: trunk/jaxx-widgets-extra/src/main/resources/22x22/redo.png
___________________________________________________________________
Added: svn:mime-type
+ image/png
Added: trunk/jaxx-widgets-extra/src/main/resources/22x22/reset.png
===================================================================
(Binary files differ)
Property changes on: trunk/jaxx-widgets-extra/src/main/resources/22x22/reset.png
___________________________________________________________________
Added: svn:mime-type
+ image/png
Added: trunk/jaxx-widgets-extra/src/main/resources/22x22/run.png
===================================================================
(Binary files differ)
Property changes on: trunk/jaxx-widgets-extra/src/main/resources/22x22/run.png
___________________________________________________________________
Added: svn:mime-type
+ image/png
Added: trunk/jaxx-widgets-extra/src/main/resources/22x22/save.png
===================================================================
(Binary files differ)
Property changes on: trunk/jaxx-widgets-extra/src/main/resources/22x22/save.png
___________________________________________________________________
Added: svn:mime-type
+ image/png
Added: trunk/jaxx-widgets-extra/src/main/resources/22x22/saveAs.png
===================================================================
(Binary files differ)
Property changes on: trunk/jaxx-widgets-extra/src/main/resources/22x22/saveAs.png
___________________________________________________________________
Added: svn:mime-type
+ image/png
Added: trunk/jaxx-widgets-extra/src/main/resources/22x22/spellcheck.png
===================================================================
(Binary files differ)
Property changes on: trunk/jaxx-widgets-extra/src/main/resources/22x22/spellcheck.png
___________________________________________________________________
Added: svn:mime-type
+ image/png
Added: trunk/jaxx-widgets-extra/src/main/resources/22x22/stop.png
===================================================================
(Binary files differ)
Property changes on: trunk/jaxx-widgets-extra/src/main/resources/22x22/stop.png
___________________________________________________________________
Added: svn:mime-type
+ image/png
Added: trunk/jaxx-widgets-extra/src/main/resources/22x22/time.png
===================================================================
(Binary files differ)
Property changes on: trunk/jaxx-widgets-extra/src/main/resources/22x22/time.png
___________________________________________________________________
Added: svn:mime-type
+ image/png
Added: trunk/jaxx-widgets-extra/src/main/resources/22x22/undo.png
===================================================================
(Binary files differ)
Property changes on: trunk/jaxx-widgets-extra/src/main/resources/22x22/undo.png
___________________________________________________________________
Added: svn:mime-type
+ image/png
Added: trunk/jaxx-widgets-extra/src/main/resources/64x64/camera.png
===================================================================
(Binary files differ)
Property changes on: trunk/jaxx-widgets-extra/src/main/resources/64x64/camera.png
___________________________________________________________________
Added: svn:mime-type
+ image/png
Added: trunk/jaxx-widgets-extra/src/main/resources/64x64/joystick.png
===================================================================
(Binary files differ)
Property changes on: trunk/jaxx-widgets-extra/src/main/resources/64x64/joystick.png
___________________________________________________________________
Added: svn:mime-type
+ image/png
Added: trunk/jaxx-widgets-extra/src/main/resources/64x64/modem.png
===================================================================
(Binary files differ)
Property changes on: trunk/jaxx-widgets-extra/src/main/resources/64x64/modem.png
___________________________________________________________________
Added: svn:mime-type
+ image/png
Added: trunk/jaxx-widgets-extra/src/main/resources/64x64/mouse.png
===================================================================
(Binary files differ)
Property changes on: trunk/jaxx-widgets-extra/src/main/resources/64x64/mouse.png
___________________________________________________________________
Added: svn:mime-type
+ image/png
Added: trunk/jaxx-widgets-extra/src/main/resources/64x64/pda.png
===================================================================
(Binary files differ)
Property changes on: trunk/jaxx-widgets-extra/src/main/resources/64x64/pda.png
___________________________________________________________________
Added: svn:mime-type
+ image/png
Added: trunk/jaxx-widgets-extra/src/main/resources/64x64/printer.png
===================================================================
(Binary files differ)
Property changes on: trunk/jaxx-widgets-extra/src/main/resources/64x64/printer.png
___________________________________________________________________
Added: svn:mime-type
+ image/png
Added: trunk/jaxx-widgets-extra/src/main/resources/64x64/scanner.png
===================================================================
(Binary files differ)
Property changes on: trunk/jaxx-widgets-extra/src/main/resources/64x64/scanner.png
___________________________________________________________________
Added: svn:mime-type
+ image/png
Added: trunk/jaxx-widgets-extra/src/main/resources/64x64/tablet.png
===================================================================
(Binary files differ)
Property changes on: trunk/jaxx-widgets-extra/src/main/resources/64x64/tablet.png
___________________________________________________________________
Added: svn:mime-type
+ image/png
Added: trunk/jaxx-widgets-extra/src/main/resources/appointment.png
===================================================================
(Binary files differ)
Property changes on: trunk/jaxx-widgets-extra/src/main/resources/appointment.png
___________________________________________________________________
Added: svn:mime-type
+ image/png
Added: trunk/jaxx-widgets-extra/src/main/resources/arrow1Left.png
===================================================================
(Binary files differ)
Property changes on: trunk/jaxx-widgets-extra/src/main/resources/arrow1Left.png
___________________________________________________________________
Added: svn:mime-type
+ image/png
Added: trunk/jaxx-widgets-extra/src/main/resources/arrow1Right.png
===================================================================
(Binary files differ)
Property changes on: trunk/jaxx-widgets-extra/src/main/resources/arrow1Right.png
___________________________________________________________________
Added: svn:mime-type
+ image/png
Added: trunk/jaxx-widgets-extra/src/main/resources/arrow1Up.png
===================================================================
(Binary files differ)
Property changes on: trunk/jaxx-widgets-extra/src/main/resources/arrow1Up.png
___________________________________________________________________
Added: svn:mime-type
+ image/png
Added: trunk/jaxx-widgets-extra/src/main/resources/arrow2Down.png
===================================================================
(Binary files differ)
Property changes on: trunk/jaxx-widgets-extra/src/main/resources/arrow2Down.png
___________________________________________________________________
Added: svn:mime-type
+ image/png
Added: trunk/jaxx-widgets-extra/src/main/resources/arrow2Left.png
===================================================================
(Binary files differ)
Property changes on: trunk/jaxx-widgets-extra/src/main/resources/arrow2Left.png
___________________________________________________________________
Added: svn:mime-type
+ image/png
Added: trunk/jaxx-widgets-extra/src/main/resources/arrow2Right.png
===================================================================
(Binary files differ)
Property changes on: trunk/jaxx-widgets-extra/src/main/resources/arrow2Right.png
___________________________________________________________________
Added: svn:mime-type
+ image/png
Added: trunk/jaxx-widgets-extra/src/main/resources/arrow2Up.png
===================================================================
(Binary files differ)
Property changes on: trunk/jaxx-widgets-extra/src/main/resources/arrow2Up.png
___________________________________________________________________
Added: svn:mime-type
+ image/png
Added: trunk/jaxx-widgets-extra/src/main/resources/attach.png
===================================================================
(Binary files differ)
Property changes on: trunk/jaxx-widgets-extra/src/main/resources/attach.png
___________________________________________________________________
Added: svn:mime-type
+ image/png
Added: trunk/jaxx-widgets-extra/src/main/resources/cancel.png
===================================================================
(Binary files differ)
Property changes on: trunk/jaxx-widgets-extra/src/main/resources/cancel.png
___________________________________________________________________
Added: svn:mime-type
+ image/png
Added: trunk/jaxx-widgets-extra/src/main/resources/close.png
===================================================================
(Binary files differ)
Property changes on: trunk/jaxx-widgets-extra/src/main/resources/close.png
___________________________________________________________________
Added: svn:mime-type
+ image/png
Added: trunk/jaxx-widgets-extra/src/main/resources/copy.png
===================================================================
(Binary files differ)
Property changes on: trunk/jaxx-widgets-extra/src/main/resources/copy.png
___________________________________________________________________
Added: svn:mime-type
+ image/png
Added: trunk/jaxx-widgets-extra/src/main/resources/find.png
===================================================================
(Binary files differ)
Property changes on: trunk/jaxx-widgets-extra/src/main/resources/find.png
___________________________________________________________________
Added: svn:mime-type
+ image/png
Added: trunk/jaxx-widgets-extra/src/main/resources/fonts.png
===================================================================
(Binary files differ)
Property changes on: trunk/jaxx-widgets-extra/src/main/resources/fonts.png
___________________________________________________________________
Added: svn:mime-type
+ image/png
Added: trunk/jaxx-widgets-extra/src/main/resources/fullscreen.png
===================================================================
(Binary files differ)
Property changes on: trunk/jaxx-widgets-extra/src/main/resources/fullscreen.png
___________________________________________________________________
Added: svn:mime-type
+ image/png
Added: trunk/jaxx-widgets-extra/src/main/resources/greenGrass.jpg
===================================================================
(Binary files differ)
Property changes on: trunk/jaxx-widgets-extra/src/main/resources/greenGrass.jpg
___________________________________________________________________
Added: svn:mime-type
+ image/jpeg
Added: trunk/jaxx-widgets-extra/src/main/resources/greenGrassSmall.jpg
===================================================================
(Binary files differ)
Property changes on: trunk/jaxx-widgets-extra/src/main/resources/greenGrassSmall.jpg
___________________________________________________________________
Added: svn:mime-type
+ image/jpeg
Added: trunk/jaxx-widgets-extra/src/main/resources/help.png
===================================================================
(Binary files differ)
Property changes on: trunk/jaxx-widgets-extra/src/main/resources/help.png
___________________________________________________________________
Added: svn:mime-type
+ image/png
Added: trunk/jaxx-widgets-extra/src/main/resources/i18n/jaxx-widgets-extra_en_GB.properties
===================================================================
--- trunk/jaxx-widgets-extra/src/main/resources/i18n/jaxx-widgets-extra_en_GB.properties (rev 0)
+++ trunk/jaxx-widgets-extra/src/main/resources/i18n/jaxx-widgets-extra_en_GB.properties 2014-02-24 14:27:22 UTC (rev 2800)
@@ -0,0 +1,30 @@
+nuitonwidgets.aboutframe.about=About
+nuitonwidgets.aboutframe.license=License
+nuitonwidgets.aboutframe.ok=OK
+nuitonwidgets.common.copy=Copy
+nuitonwidgets.editor.saveorcancel=Do you want to save current opened file ?
+nuitonwidgets.editor.syntax.java=Java
+nuitonwidgets.editor.syntax.r=R
+nuitonwidgets.editor.syntax.sql=SQL
+nuitonwidgets.editor.syntax.xml=XML
+nuitonwidgets.message.file=File
+nuitonwidgets.message.folder=Folder
+nuitonwidgets.message.nofile=No file
+nuitonwidgets.message.statusbar.memory=%d/%dMb
+nuitonwidgets.monitor.button.mail=Send by email
+nuitonwidgets.monitor.button.reset=Reset
+nuitonwidgets.monitor.information.application=Application information
+nuitonwidgets.monitor.information.system=System information
+nuitonwidgets.monitor.mail.failed=Can't send report by mail. Is your mail server up ? (I'm trying to contact the < %s > smtp server)
+nuitonwidgets.monitor.mail.report=A report has been sent to %s
+nuitonwidgets.monitor.mail.stream.all=All streams \:
+nuitonwidgets.monitor.mail.stream.error=Standard Error \:
+nuitonwidgets.monitor.mail.stream.log=Logging system
+nuitonwidgets.monitor.mail.stream.output=Standard Output \:
+nuitonwidgets.monitor.mail.subject=Report from logging console
+nuitonwidgets.monitor.stream.all=All streams
+nuitonwidgets.monitor.stream.error=Error stream
+nuitonwidgets.monitor.stream.log=Log stream
+nuitonwidgets.monitor.stream.output=Output stream
+nuitonwidgets.monitor.title=Application console
+nuitonwidgets.tootilp.focushotkey=Press 'F2' for focus
Property changes on: trunk/jaxx-widgets-extra/src/main/resources/i18n/jaxx-widgets-extra_en_GB.properties
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
Added: trunk/jaxx-widgets-extra/src/main/resources/i18n/jaxx-widgets-extra_es_ES.properties
===================================================================
--- trunk/jaxx-widgets-extra/src/main/resources/i18n/jaxx-widgets-extra_es_ES.properties (rev 0)
+++ trunk/jaxx-widgets-extra/src/main/resources/i18n/jaxx-widgets-extra_es_ES.properties 2014-02-24 14:27:22 UTC (rev 2800)
@@ -0,0 +1,14 @@
+nuitonwidgets.aboutframe.about=
+nuitonwidgets.aboutframe.license=
+nuitonwidgets.aboutframe.ok=
+nuitonwidgets.common.copy=
+nuitonwidgets.editor.saveorcancel=
+nuitonwidgets.editor.syntax.java=
+nuitonwidgets.editor.syntax.r=
+nuitonwidgets.editor.syntax.sql=
+nuitonwidgets.editor.syntax.xml=
+nuitonwidgets.message.file=
+nuitonwidgets.message.folder=
+nuitonwidgets.message.nofile=
+nuitonwidgets.message.statusbar.memory=
+nuitonwidgets.tootilp.focushotkey=
Property changes on: trunk/jaxx-widgets-extra/src/main/resources/i18n/jaxx-widgets-extra_es_ES.properties
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
Added: trunk/jaxx-widgets-extra/src/main/resources/i18n/jaxx-widgets-extra_fr_FR.properties
===================================================================
--- trunk/jaxx-widgets-extra/src/main/resources/i18n/jaxx-widgets-extra_fr_FR.properties (rev 0)
+++ trunk/jaxx-widgets-extra/src/main/resources/i18n/jaxx-widgets-extra_fr_FR.properties 2014-02-24 14:27:22 UTC (rev 2800)
@@ -0,0 +1,30 @@
+nuitonwidgets.aboutframe.about=À propos
+nuitonwidgets.aboutframe.license=Licence
+nuitonwidgets.aboutframe.ok=OK
+nuitonwidgets.common.copy=Copier
+nuitonwidgets.editor.saveorcancel=Voulez vous sauver le fichier modifié ?
+nuitonwidgets.editor.syntax.java=Java
+nuitonwidgets.editor.syntax.r=R
+nuitonwidgets.editor.syntax.sql=SQL
+nuitonwidgets.editor.syntax.xml=XML
+nuitonwidgets.message.file=Fichier
+nuitonwidgets.message.folder=Répertoire
+nuitonwidgets.message.nofile=Aucun fichier
+nuitonwidgets.message.statusbar.memory=%d/%dMo
+nuitonwidgets.monitor.button.mail=Envoyer par courriel
+nuitonwidgets.monitor.button.reset=Reset
+nuitonwidgets.monitor.information.application=Information sur l'application
+nuitonwidgets.monitor.information.system=Information système
+nuitonwidgets.monitor.mail.failed=Impossible d'envoyer le rapport par courriel. Le serveur smtp fonctionne ? (J'essai de contacter < %s > smtp server)
+nuitonwidgets.monitor.mail.report=Le rapport a été envoyé à %s
+nuitonwidgets.monitor.mail.stream.all=Tous les flux \:
+nuitonwidgets.monitor.mail.stream.error=Sortie d'erreur \:
+nuitonwidgets.monitor.mail.stream.log=Log système
+nuitonwidgets.monitor.mail.stream.output=Sortie standard \:
+nuitonwidgets.monitor.mail.subject=Rapport de la console
+nuitonwidgets.monitor.stream.all=Toutes les sorties
+nuitonwidgets.monitor.stream.error=Sortie d'erreur
+nuitonwidgets.monitor.stream.log=Logs
+nuitonwidgets.monitor.stream.output=Sortie standard
+nuitonwidgets.monitor.title=Moniteur de l'application
+nuitonwidgets.tootilp.focushotkey=Appuyez sur 'F2' pour agrandir
Property changes on: trunk/jaxx-widgets-extra/src/main/resources/i18n/jaxx-widgets-extra_fr_FR.properties
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
Added: trunk/jaxx-widgets-extra/src/main/resources/i18n/nuiton-widgets_en_GB.properties
===================================================================
--- trunk/jaxx-widgets-extra/src/main/resources/i18n/nuiton-widgets_en_GB.properties (rev 0)
+++ trunk/jaxx-widgets-extra/src/main/resources/i18n/nuiton-widgets_en_GB.properties 2014-02-24 14:27:22 UTC (rev 2800)
@@ -0,0 +1,51 @@
+###
+# #%L
+# JAXX :: Extra Widgets
+# %%
+# Copyright (C) 2004 - 2014 CodeLutin
+# %%
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License as
+# published by the Free Software Foundation, either version 3 of the
+# License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Lesser Public License for more details.
+#
+# You should have received a copy of the GNU General Lesser Public
+# License along with this program. If not, see
+# <http://www.gnu.org/licenses/lgpl-3.0.html>.
+# #L%
+###
+nuitonwidgets.aboutframe.about=About
+nuitonwidgets.aboutframe.license=License
+nuitonwidgets.aboutframe.ok=OK
+nuitonwidgets.common.copy=Copy
+nuitonwidgets.editor.saveorcancel=Do you want to save current opened file ?
+nuitonwidgets.editor.syntax.java=Java
+nuitonwidgets.editor.syntax.r=R
+nuitonwidgets.editor.syntax.sql=SQL
+nuitonwidgets.editor.syntax.xml=XML
+nuitonwidgets.message.file=File
+nuitonwidgets.message.folder=Folder
+nuitonwidgets.message.nofile=No file
+nuitonwidgets.message.statusbar.memory=%d/%dMb
+nuitonwidgets.monitor.button.mail=Send by email
+nuitonwidgets.monitor.button.reset=Reset
+nuitonwidgets.monitor.information.application=Application information
+nuitonwidgets.monitor.information.system=System information
+nuitonwidgets.monitor.mail.failed=Can't send report by mail. Is your mail server up ? (I'm trying to contact the < %s > smtp server)
+nuitonwidgets.monitor.mail.report=A report has been sent to %s
+nuitonwidgets.monitor.mail.stream.all=All streams \:
+nuitonwidgets.monitor.mail.stream.error=Standard Error \:
+nuitonwidgets.monitor.mail.stream.log=Logging system
+nuitonwidgets.monitor.mail.stream.output=Standard Output \:
+nuitonwidgets.monitor.mail.subject=Report from logging console
+nuitonwidgets.monitor.stream.all=All streams
+nuitonwidgets.monitor.stream.error=Error stream
+nuitonwidgets.monitor.stream.log=Log stream
+nuitonwidgets.monitor.stream.output=Output stream
+nuitonwidgets.monitor.title=Application console
+nuitonwidgets.tootilp.focushotkey=Press 'F2' for focus
Property changes on: trunk/jaxx-widgets-extra/src/main/resources/i18n/nuiton-widgets_en_GB.properties
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
Added: trunk/jaxx-widgets-extra/src/main/resources/i18n/nuiton-widgets_fr_FR.properties
===================================================================
--- trunk/jaxx-widgets-extra/src/main/resources/i18n/nuiton-widgets_fr_FR.properties (rev 0)
+++ trunk/jaxx-widgets-extra/src/main/resources/i18n/nuiton-widgets_fr_FR.properties 2014-02-24 14:27:22 UTC (rev 2800)
@@ -0,0 +1,51 @@
+###
+# #%L
+# JAXX :: Extra Widgets
+# %%
+# Copyright (C) 2004 - 2014 CodeLutin
+# %%
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License as
+# published by the Free Software Foundation, either version 3 of the
+# License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Lesser Public License for more details.
+#
+# You should have received a copy of the GNU General Lesser Public
+# License along with this program. If not, see
+# <http://www.gnu.org/licenses/lgpl-3.0.html>.
+# #L%
+###
+nuitonwidgets.aboutframe.about=\u00C0 propos
+nuitonwidgets.aboutframe.license=Licence
+nuitonwidgets.aboutframe.ok=OK
+nuitonwidgets.common.copy=Copier
+nuitonwidgets.editor.saveorcancel=Voulez vous sauver le fichier modifi\u00E9 ?
+nuitonwidgets.editor.syntax.java=Java
+nuitonwidgets.editor.syntax.r=R
+nuitonwidgets.editor.syntax.sql=SQL
+nuitonwidgets.editor.syntax.xml=XML
+nuitonwidgets.message.file=Fichier
+nuitonwidgets.message.folder=R\u00E9pertoire
+nuitonwidgets.message.nofile=Aucun fichier
+nuitonwidgets.message.statusbar.memory=%d/%dMo
+nuitonwidgets.monitor.button.mail=Envoyer par courriel
+nuitonwidgets.monitor.button.reset=Reset
+nuitonwidgets.monitor.information.application=Information sur l'application
+nuitonwidgets.monitor.information.system=Information syst\u00E8me
+nuitonwidgets.monitor.mail.failed=Impossible d'envoyer le rapport par courriel. Le serveur smtp fonctionne ? (J'essai de contacter < %s > smtp server)
+nuitonwidgets.monitor.mail.report=Le rapport a \u00E9t\u00E9 envoy\u00E9 \u00E0 %s
+nuitonwidgets.monitor.mail.stream.all=Tous les flux \:
+nuitonwidgets.monitor.mail.stream.error=Sortie d'erreur \:
+nuitonwidgets.monitor.mail.stream.log=Log syst\u00E8me
+nuitonwidgets.monitor.mail.stream.output=Sortie standard \:
+nuitonwidgets.monitor.mail.subject=Rapport de la console
+nuitonwidgets.monitor.stream.all=Toutes les sorties
+nuitonwidgets.monitor.stream.error=Sortie d'erreur
+nuitonwidgets.monitor.stream.log=Logs
+nuitonwidgets.monitor.stream.output=Sortie standard
+nuitonwidgets.monitor.title=Moniteur de l'application
+nuitonwidgets.tootilp.focushotkey=Appuyez sur 'F2' pour agrandir
Property changes on: trunk/jaxx-widgets-extra/src/main/resources/i18n/nuiton-widgets_fr_FR.properties
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
Added: trunk/jaxx-widgets-extra/src/main/resources/idea.png
===================================================================
(Binary files differ)
Property changes on: trunk/jaxx-widgets-extra/src/main/resources/idea.png
___________________________________________________________________
Added: svn:mime-type
+ image/png
Added: trunk/jaxx-widgets-extra/src/main/resources/info.png
===================================================================
(Binary files differ)
Property changes on: trunk/jaxx-widgets-extra/src/main/resources/info.png
___________________________________________________________________
Added: svn:mime-type
+ image/png
Added: trunk/jaxx-widgets-extra/src/main/resources/licenses.txt
===================================================================
--- trunk/jaxx-widgets-extra/src/main/resources/licenses.txt (rev 0)
+++ trunk/jaxx-widgets-extra/src/main/resources/licenses.txt 2014-02-24 14:27:22 UTC (rev 2800)
@@ -0,0 +1,54 @@
+The following 22x22 icons come from the Crystal Icon Set (made by Everaldo Coelho for KDE and distributed under LGPL) :
+
+appearance.png
+appointment.png
+arrow1Down.png
+arrow1Left.png
+arrow1Right.png
+arrow1Up.png
+arrow2Down.png
+arrow2Left.png
+arrow2Right.png
+arrow2Up.png
+attach.png
+cancel.png
+close.png
+find.png
+fonts.png
+fullscreen.png
+help.png
+idea.png
+info.png
+mail.png
+mailGet.png
+mailNew.png
+mailSend.png
+new.png
+nofullscreen.png
+ok.png
+open.png
+print.png
+redo.png
+reset.png
+run.png
+save.png
+saveAs.png
+spellcheck.png
+stop.png
+time.png
+undo.png
+
+The following 64x64 icons come from the Crystal Icon Set (made by Everaldo Coelho for KDE and distributed under LGPL) :
+
+camera.png
+joystick.png
+modem.png
+mouse.png
+pda.png
+printer.png
+scanner.png
+tablet.png
+
+The following splashScreen images come from http://www.freedpi.com and are "libres de droit" :
+redGuizmo.jpg
+greenGlass.jpg
Property changes on: trunk/jaxx-widgets-extra/src/main/resources/licenses.txt
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
Added: trunk/jaxx-widgets-extra/src/main/resources/mail.png
===================================================================
(Binary files differ)
Property changes on: trunk/jaxx-widgets-extra/src/main/resources/mail.png
___________________________________________________________________
Added: svn:mime-type
+ image/png
Added: trunk/jaxx-widgets-extra/src/main/resources/mailGet.png
===================================================================
(Binary files differ)
Property changes on: trunk/jaxx-widgets-extra/src/main/resources/mailGet.png
___________________________________________________________________
Added: svn:mime-type
+ image/png
Added: trunk/jaxx-widgets-extra/src/main/resources/mailNew.png
===================================================================
(Binary files differ)
Property changes on: trunk/jaxx-widgets-extra/src/main/resources/mailNew.png
___________________________________________________________________
Added: svn:mime-type
+ image/png
Added: trunk/jaxx-widgets-extra/src/main/resources/mailSend.png
===================================================================
(Binary files differ)
Property changes on: trunk/jaxx-widgets-extra/src/main/resources/mailSend.png
___________________________________________________________________
Added: svn:mime-type
+ image/png
Added: trunk/jaxx-widgets-extra/src/main/resources/mail_new.png
===================================================================
(Binary files differ)
Property changes on: trunk/jaxx-widgets-extra/src/main/resources/mail_new.png
___________________________________________________________________
Added: svn:mime-type
+ image/png
Added: trunk/jaxx-widgets-extra/src/main/resources/new.png
===================================================================
(Binary files differ)
Property changes on: trunk/jaxx-widgets-extra/src/main/resources/new.png
___________________________________________________________________
Added: svn:mime-type
+ image/png
Added: trunk/jaxx-widgets-extra/src/main/resources/nofullscreen.png
===================================================================
(Binary files differ)
Property changes on: trunk/jaxx-widgets-extra/src/main/resources/nofullscreen.png
___________________________________________________________________
Added: svn:mime-type
+ image/png
Added: trunk/jaxx-widgets-extra/src/main/resources/ok.png
===================================================================
(Binary files differ)
Property changes on: trunk/jaxx-widgets-extra/src/main/resources/ok.png
___________________________________________________________________
Added: svn:mime-type
+ image/png
Added: trunk/jaxx-widgets-extra/src/main/resources/open.png
===================================================================
(Binary files differ)
Property changes on: trunk/jaxx-widgets-extra/src/main/resources/open.png
___________________________________________________________________
Added: svn:mime-type
+ image/png
Added: trunk/jaxx-widgets-extra/src/main/resources/print.png
===================================================================
(Binary files differ)
Property changes on: trunk/jaxx-widgets-extra/src/main/resources/print.png
___________________________________________________________________
Added: svn:mime-type
+ image/png
Added: trunk/jaxx-widgets-extra/src/main/resources/redGecko.jpg
===================================================================
(Binary files differ)
Property changes on: trunk/jaxx-widgets-extra/src/main/resources/redGecko.jpg
___________________________________________________________________
Added: svn:mime-type
+ image/jpeg
Added: trunk/jaxx-widgets-extra/src/main/resources/redo.png
===================================================================
(Binary files differ)
Property changes on: trunk/jaxx-widgets-extra/src/main/resources/redo.png
___________________________________________________________________
Added: svn:mime-type
+ image/png
Added: trunk/jaxx-widgets-extra/src/main/resources/reload.png
===================================================================
(Binary files differ)
Property changes on: trunk/jaxx-widgets-extra/src/main/resources/reload.png
___________________________________________________________________
Added: svn:mime-type
+ image/png
Added: trunk/jaxx-widgets-extra/src/main/resources/reset.png
===================================================================
(Binary files differ)
Property changes on: trunk/jaxx-widgets-extra/src/main/resources/reset.png
___________________________________________________________________
Added: svn:mime-type
+ image/png
Added: trunk/jaxx-widgets-extra/src/main/resources/run.png
===================================================================
(Binary files differ)
Property changes on: trunk/jaxx-widgets-extra/src/main/resources/run.png
___________________________________________________________________
Added: svn:mime-type
+ image/png
Added: trunk/jaxx-widgets-extra/src/main/resources/save.png
===================================================================
(Binary files differ)
Property changes on: trunk/jaxx-widgets-extra/src/main/resources/save.png
___________________________________________________________________
Added: svn:mime-type
+ image/png
Added: trunk/jaxx-widgets-extra/src/main/resources/saveAs.png
===================================================================
(Binary files differ)
Property changes on: trunk/jaxx-widgets-extra/src/main/resources/saveAs.png
___________________________________________________________________
Added: svn:mime-type
+ image/png
Added: trunk/jaxx-widgets-extra/src/main/resources/saveas.png
===================================================================
(Binary files differ)
Property changes on: trunk/jaxx-widgets-extra/src/main/resources/saveas.png
___________________________________________________________________
Added: svn:mime-type
+ image/png
Added: trunk/jaxx-widgets-extra/src/main/resources/spellcheck.png
===================================================================
(Binary files differ)
Property changes on: trunk/jaxx-widgets-extra/src/main/resources/spellcheck.png
___________________________________________________________________
Added: svn:mime-type
+ image/png
Added: trunk/jaxx-widgets-extra/src/main/resources/spellchek.png
===================================================================
(Binary files differ)
Property changes on: trunk/jaxx-widgets-extra/src/main/resources/spellchek.png
___________________________________________________________________
Added: svn:mime-type
+ image/png
Added: trunk/jaxx-widgets-extra/src/main/resources/stop.png
===================================================================
(Binary files differ)
Property changes on: trunk/jaxx-widgets-extra/src/main/resources/stop.png
___________________________________________________________________
Added: svn:mime-type
+ image/png
Added: trunk/jaxx-widgets-extra/src/main/resources/time.png
===================================================================
(Binary files differ)
Property changes on: trunk/jaxx-widgets-extra/src/main/resources/time.png
___________________________________________________________________
Added: svn:mime-type
+ image/png
Added: trunk/jaxx-widgets-extra/src/main/resources/undo.png
===================================================================
(Binary files differ)
Property changes on: trunk/jaxx-widgets-extra/src/main/resources/undo.png
___________________________________________________________________
Added: svn:mime-type
+ image/png
Added: trunk/jaxx-widgets-extra/src/site/resources/images/components/focusablett1.jpg
===================================================================
(Binary files differ)
Property changes on: trunk/jaxx-widgets-extra/src/site/resources/images/components/focusablett1.jpg
___________________________________________________________________
Added: svn:mime-type
+ image/jpeg
Added: trunk/jaxx-widgets-extra/src/site/resources/images/components/focusablett2.jpg
===================================================================
(Binary files differ)
Property changes on: trunk/jaxx-widgets-extra/src/site/resources/images/components/focusablett2.jpg
___________________________________________________________________
Added: svn:mime-type
+ image/jpeg
Added: trunk/jaxx-widgets-extra/src/site/rst/Todo.rst
===================================================================
--- trunk/jaxx-widgets-extra/src/site/rst/Todo.rst (rev 0)
+++ trunk/jaxx-widgets-extra/src/site/rst/Todo.rst 2014-02-24 14:27:22 UTC (rev 2800)
@@ -0,0 +1,56 @@
+.. -
+.. * #%L
+.. * JAXX :: Extra Widgets
+.. * %%
+.. * Copyright (C) 2004 - 2010 CodeLutin
+.. * %%
+.. * This program is free software: you can redistribute it and/or modify
+.. * it under the terms of the GNU Lesser General Public License as
+.. * published by the Free Software Foundation, either version 3 of the
+.. * License, or (at your option) any later version.
+.. *
+.. * This program is distributed in the hope that it will be useful,
+.. * but WITHOUT ANY WARRANTY; without even the implied warranty of
+.. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+.. * GNU General Lesser Public License for more details.
+.. *
+.. * You should have received a copy of the GNU General Lesser Public
+.. * License along with this program. If not, see
+.. * <http://www.gnu.org/licenses/lgpl-3.0.html>.
+.. * #L%
+.. -
+
+TODO
+====
+
+ApplicationMonitor :
+- Mettre des regexeps pour changer les paths de classes
+- Mettre des choses utiles dans les panneaux
+ - system : OS, version de la jvm, résolution de l'ecran, classpath, date, locale
+ - application : version, mémoire utilisée par la jvm, uptime de l'appli ;-) ?
+- Ajouter un constructeur qui donne en plus un StatusBar existant (dans ce cas, on ne construit pas le notre)
+
+StatusBar :
+- Ajouter une progressBar à droite toute, et peut-être un témoin d'activité (rouge/busy, vert/ready)
+
+SplashScreen :
+- Finir celui commencé
+- Doit intégrer une forme de progressBar (utilisée en callback par l'application lancée)
+
+Generateur d'interface de saisie de Bean:
+- permettre de mettre un bean en paramètre de la classe, par introspection
+ les champs sont lu et des zones de saisie sont généré. De cette façon
+ on peut mettre des information simplement dans un Bean.
+- prévoir des plugins pour mettre des éditeurs spécifique pour certaine
+ propriété, peut-être regarder du coté des PropertyEditor ?
+
+La modification d'interface a la CSS:
+- Le but est d'avoir un fichier xml contenant les objets, avec leurs noms
+ leur event, et peut-etre des propriétés par defaut. Puis un fichier de
+ type CSS, qui permette de modifier la disposition, la couleur, ...
+ des objets.
+- un parser CSS:
+ http://ajax.sourceforge.net/cypress/
+- un layout se mariant bien avec le CSS:
+ http://pnuts.org/snapshot/latest/modules/pnuts.awt/doc/PnutsLayout.html
+ http://chrriis.brainlex.com/projects/uihierarchy/index.html
Added: trunk/jaxx-widgets-extra/src/site/rst/components/focusabletooltips.rst
===================================================================
--- trunk/jaxx-widgets-extra/src/site/rst/components/focusabletooltips.rst (rev 0)
+++ trunk/jaxx-widgets-extra/src/site/rst/components/focusabletooltips.rst 2014-02-24 14:27:22 UTC (rev 2800)
@@ -0,0 +1,72 @@
+.. -
+.. * #%L
+.. * JAXX :: Extra Widgets
+.. * %%
+.. * Copyright (C) 2004 - 2010 CodeLutin
+.. * %%
+.. * This program is free software: you can redistribute it and/or modify
+.. * it under the terms of the GNU Lesser General Public License as
+.. * published by the Free Software Foundation, either version 3 of the
+.. * License, or (at your option) any later version.
+.. *
+.. * This program is distributed in the hope that it will be useful,
+.. * but WITHOUT ANY WARRANTY; without even the implied warranty of
+.. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+.. * GNU General Lesser Public License for more details.
+.. *
+.. * You should have received a copy of the GNU General Lesser Public
+.. * License along with this program. If not, see
+.. * <http://www.gnu.org/licenses/lgpl-3.0.html>.
+.. * #L%
+.. -
+
+Focusables tooltips
+===================
+
+Focusable tooltips are eclipse-like tooltips original taken from `RSyntaxTextArea`_
+project.
+
+The nuiton-widget version also include modification to allow putting focusable
+tooltips on non-``JTextArea``, ``JComponent``.
+
+Screenshots
+-----------
+
+Default tooltip:
+
+.. image:: ../images/components/focusablett1.jpg
+
+Focused tooltip:
+
+.. image:: ../images/components/focusablett2.jpg
+
+Using
+-----
+
+To use focusable tooltip, you need to redefine the ``getTooltipText()`` method
+on related components ::
+
+ JTable table = new JTable(tableModel) {
+ /** Single tooltip instance. */
+ protected FocusableTip focusableTip;
+
+ @Override
+ public String getToolTipText(MouseEvent e) {
+ String text = super.getToolTipText(e);
+ if (focusableTip == null) {
+ focusableTip = new FocusableTip(this, null);
+ }
+ focusableTip.toolTipRequested(e, text);
+
+ return null;
+ }
+ };
+
+
+Sources
+-------
+
+ * `Fifesoft blog`_.
+
+.. _RSyntaxTextArea: http://fifesoft.com/rsyntaxtextarea/
+.. _Fifesoft blog: http://fifesoft.com/blog/?p=93
Added: trunk/jaxx-widgets-extra/src/site/rst/components/treefilters.rst
===================================================================
--- trunk/jaxx-widgets-extra/src/site/rst/components/treefilters.rst (rev 0)
+++ trunk/jaxx-widgets-extra/src/site/rst/components/treefilters.rst 2014-02-24 14:27:22 UTC (rev 2800)
@@ -0,0 +1,66 @@
+.. -
+.. * #%L
+.. * JAXX :: Extra Widgets
+.. * %%
+.. * Copyright (C) 2004 - 2010 CodeLutin
+.. * %%
+.. * This program is free software: you can redistribute it and/or modify
+.. * it under the terms of the GNU Lesser General Public License as
+.. * published by the Free Software Foundation, either version 3 of the
+.. * License, or (at your option) any later version.
+.. *
+.. * This program is distributed in the hope that it will be useful,
+.. * but WITHOUT ANY WARRANTY; without even the implied warranty of
+.. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+.. * GNU General Lesser Public License for more details.
+.. *
+.. * You should have received a copy of the GNU General Lesser Public
+.. * License along with this program. If not, see
+.. * <http://www.gnu.org/licenses/lgpl-3.0.html>.
+.. * #L%
+.. -
+
+Tree filtering
+==============
+
+Nuiton-widget provide basic model based tree filtering.
+
+API
+---
+
+Only two classes are provided:
+
+ * TreeFilter : Interface for tree filter implementation
+ * TreeFilterModel : Filtered tree model
+
+The TreeFilter currently has only one method ``include`` which must return
+``true`` only if parameter node must be displayed.
+
+Using
+-----
+
+Define your filtered tree::
+
+ public class Test {
+
+ protected FilterTreeModel filterModel;
+
+ [...]
+
+ protected void buildUI() {
+
+ TreeModel realModel = ...
+ filterModel = new FilterTreeModel(realModel);
+
+ JTree tree = new JTree(filterModel);
+
+ [...]
+ }
+
+Then apply filtering (when filter need to be updated)::
+
+ [...]
+ protected void updateFilter(String filterString) {
+ TreeFilter myTreeFilter = new MyTreeFilter(filterString);
+ filterModel.setTreeFilter(myTreeFilter);
+ }
Added: trunk/jaxx-widgets-extra/src/site/rst/index.rst
===================================================================
--- trunk/jaxx-widgets-extra/src/site/rst/index.rst (rev 0)
+++ trunk/jaxx-widgets-extra/src/site/rst/index.rst 2014-02-24 14:27:22 UTC (rev 2800)
@@ -0,0 +1,43 @@
+.. -
+.. * #%L
+.. * JAXX :: Extra Widgets
+.. * %%
+.. * Copyright (C) 2004 - 2010 CodeLutin
+.. * %%
+.. * This program is free software: you can redistribute it and/or modify
+.. * it under the terms of the GNU Lesser General Public License as
+.. * published by the Free Software Foundation, either version 3 of the
+.. * License, or (at your option) any later version.
+.. *
+.. * This program is distributed in the hope that it will be useful,
+.. * but WITHOUT ANY WARRANTY; without even the implied warranty of
+.. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+.. * GNU General Lesser Public License for more details.
+.. *
+.. * You should have received a copy of the GNU General Lesser Public
+.. * License along with this program. If not, see
+.. * <http://www.gnu.org/licenses/lgpl-3.0.html>.
+.. * #L%
+.. -
+
+Nuiton widgets
+==============
+
+Swing components set.
+
+Components
+----------
+
+ * `Tree filters`_.
+ * `Focusable tooltips`_.
+
+Others components
+-----------------
+
+Other usefull components but not included in nuiton-widgets.
+
+ * `Datatips`_.
+
+.. _Tree filters: components/treefilters.html
+.. _Focusable tooltips: components/focusabletooltips.html
+.. _Datatips: https://datatips.dev.java.net/
Added: trunk/jaxx-widgets-extra/src/site/site_fr.xml
===================================================================
--- trunk/jaxx-widgets-extra/src/site/site_fr.xml (rev 0)
+++ trunk/jaxx-widgets-extra/src/site/site_fr.xml 2014-02-24 14:27:22 UTC (rev 2800)
@@ -0,0 +1,77 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ #%L
+ JAXX :: Extra Widgets
+ %%
+ Copyright (C) 2004 - 2010 CodeLutin
+ %%
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation, either version 3 of the
+ License, or (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Lesser Public License for more details.
+
+ You should have received a copy of the GNU General Lesser Public
+ License along with this program. If not, see
+ <http://www.gnu.org/licenses/lgpl-3.0.html>.
+ #L%
+ -->
+
+<project name="${project.name}">
+
+ <bannerLeft>
+ <name>${project.name}</name>
+ <href>index.html</href>
+ </bannerLeft>
+
+ <body>
+
+ <head>
+ <script type="text/javascript"
+ src="${mavenpomSiteCommonResourcesUrl}/js/mavenpom-site.js">
+ </script>
+
+ <link rel="stylesheet" type="text/css"
+ href="${mavenpomSiteCommonResourcesUrl}/css/mavenpom-site.css"/>
+ </head>
+
+ <breadcrumbs>
+ <item name="${project.name}" href="index.html" />
+ </breadcrumbs>
+
+ <menu name="Utilisateur">
+ <item href="./index.html" name="Accueil"/>
+ <item name="Composants" href="components/treefilters.html">
+ <item href="components/treefilters.html" name="Tree filters"/>
+ <item href="components/focusabletooltips.html" name="Focusable tooltips"/>
+ </item>
+ </menu>
+
+ <menu name="Developpeur">
+ <item href="http://www.nuiton.org/projects/nuiton-widgets/files" name="Téléchargement"/>
+ <item name="Todo" href="Todo.html"/>
+ </menu>
+
+ <menu ref="reports"/>
+
+ <footer>
+
+ <div id='projectMetas'
+ projectversion='${project.version}'
+ platform='${project.platform}'
+ projectid='${project.projectId}'
+ scm='${project.scm.developerConnection}'
+ scmwebeditorenabled='${project.scmwebeditorEnabled}'
+ scmwebeditorurl='${project.scmwebeditorUrl}'
+ siteSourcesType='${project.siteSourcesType}'
+ piwikEnabled='${project.piwikEnabled}'
+ piwikId='${project.piwikId}'
+ scmwebeditor_skipDefaultFiles="true">
+ </div>
+ </footer>
+ </body>
+</project>
Property changes on: trunk/jaxx-widgets-extra/src/site/site_fr.xml
___________________________________________________________________
Added: svn:mime-type
+ text/xml
Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
Added: trunk/jaxx-widgets-extra/src/test/java/org/nuiton/jaxx/widgets/extra/AboutFrameTest.java
===================================================================
--- trunk/jaxx-widgets-extra/src/test/java/org/nuiton/jaxx/widgets/extra/AboutFrameTest.java (rev 0)
+++ trunk/jaxx-widgets-extra/src/test/java/org/nuiton/jaxx/widgets/extra/AboutFrameTest.java 2014-02-24 14:27:22 UTC (rev 2800)
@@ -0,0 +1,88 @@
+/*
+ * #%L
+ * JAXX :: Extra Widgets
+ * %%
+ * Copyright (C) 2004 - 2010 CodeLutin
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Lesser Public License for more details.
+ *
+ * You should have received a copy of the GNU General Lesser Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/lgpl-3.0.html>.
+ * #L%
+ */
+
+package org.nuiton.jaxx.widgets.extra;
+
+import org.junit.Assume;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+import java.awt.GraphicsEnvironment;
+
+/**
+ * Test class for about frame.
+ *
+ * @author chatellier
+ * @version $Revision$
+ *
+ * Last update : $Date$
+ * By : $Author$
+ */
+public class AboutFrameTest {
+
+ @BeforeClass
+ public static void setUpClass() throws Exception {
+
+ Assume.assumeTrue("Can't start test with headless env", !GraphicsEnvironment.isHeadless());
+
+ }
+
+ /**
+ * Affiche une about frame avec
+ * seuelement l'onglet about.
+ */
+ @Test
+ public void testOnlyAbout() {
+ AboutFrame about = new AboutFrame();
+
+ about.setAboutHtmlText("test");
+
+ about.setVisible(true);
+ }
+
+ /**
+ * Affiche une about frame avec
+ * l'onglet about et licence.
+ */
+ @Test
+ public void testAboutAndLicense() {
+ AboutFrame about = new AboutFrame();
+
+ about.setAboutHtmlText("test");
+ about.setLicenseText("licence");
+
+ about.setVisible(true);
+ }
+
+ /**
+ * Affiche une about frame avec
+ * l'onglet about et licence.
+ */
+ @Test
+ public void testIcon() {
+ AboutFrame about = new AboutFrame();
+
+ about.setIconPath("undo.png");
+
+ about.setVisible(true);
+ }
+}
Property changes on: trunk/jaxx-widgets-extra/src/test/java/org/nuiton/jaxx/widgets/extra/AboutFrameTest.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
Added: trunk/jaxx-widgets-extra/src/test/java/org/nuiton/jaxx/widgets/extra/IconFactoryTest.java
===================================================================
--- trunk/jaxx-widgets-extra/src/test/java/org/nuiton/jaxx/widgets/extra/IconFactoryTest.java (rev 0)
+++ trunk/jaxx-widgets-extra/src/test/java/org/nuiton/jaxx/widgets/extra/IconFactoryTest.java 2014-02-24 14:27:22 UTC (rev 2800)
@@ -0,0 +1,80 @@
+/*
+ * #%L
+ * JAXX :: Extra Widgets
+ * %%
+ * Copyright (C) 2004 - 2010 CodeLutin
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Lesser Public License for more details.
+ *
+ * You should have received a copy of the GNU General Lesser Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/lgpl-3.0.html>.
+ * #L%
+ */
+
+/* *
+ * IconFactoryTest.java
+ *
+ * Created: 12 août 2004
+ *
+ * @author Benjamin Poussin <poussin(a)codelutin.com>
+ * @version $Revision$
+ *
+ * Mise a jour: $Date$
+ * par : $Author$
+ */
+
+package org.nuiton.jaxx.widgets.extra;
+
+import javax.swing.Icon;
+
+import org.junit.Assert;
+import org.junit.Assume;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+import java.awt.GraphicsEnvironment;
+
+public class IconFactoryTest { // IconFactoryTest
+
+ @BeforeClass
+ public static void setUpClass() throws Exception {
+
+ Assume.assumeTrue("Can't start test with headless env", !GraphicsEnvironment.isHeadless());
+
+ }
+
+ @Test
+ public void testGetIcon() throws Exception {
+ Icon icon0 = IconFactory.getIcon(IconFactory.UNDO);
+ Icon icon1 = IconFactory.getIcon(IconFactory.UNDO);
+
+ Assert.assertEquals(icon0, icon1);
+
+ try {
+ IconFactory.getIcon("ergjlk");
+ Assert.assertTrue(false);
+ } catch (IllegalArgumentException eee) {
+ Assert.assertTrue(true);
+ }
+
+ // test supprime, car le IdentityMap, ne semble pas faire de distinction
+ // sur les chaines de caractere :(
+ // try{
+ // IconFactory.getIcon("UNDO");
+ // assertTrue(false);
+ // }catch(IllegalArgumentException eee){
+ // assertTrue(true);
+ // }
+ }
+
+} // IconFactoryTest
+
Property changes on: trunk/jaxx-widgets-extra/src/test/java/org/nuiton/jaxx/widgets/extra/IconFactoryTest.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
Added: trunk/jaxx-widgets-extra/src/test/java/org/nuiton/jaxx/widgets/extra/WidgetUtilTest.java
===================================================================
--- trunk/jaxx-widgets-extra/src/test/java/org/nuiton/jaxx/widgets/extra/WidgetUtilTest.java (rev 0)
+++ trunk/jaxx-widgets-extra/src/test/java/org/nuiton/jaxx/widgets/extra/WidgetUtilTest.java 2014-02-24 14:27:22 UTC (rev 2800)
@@ -0,0 +1,70 @@
+/*
+ * #%L
+ * JAXX :: Extra Widgets
+ * %%
+ * Copyright (C) 2004 - 2010 CodeLutin
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Lesser Public License for more details.
+ *
+ * You should have received a copy of the GNU General Lesser Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/lgpl-3.0.html>.
+ * #L%
+ */
+
+/* *
+ * WidgetUtilTest.java
+ *
+ * Created: Jul 29, 2004
+ *
+ * @author Benjamin Poussin <poussin(a)codelutin.com>
+ * Copyright Code Lutin
+ * @version $Revision$
+ *
+ * Mise a jour: $Date$
+ * par : $Author$
+ */
+
+package org.nuiton.jaxx.widgets.extra;
+
+import java.awt.Component;
+import java.awt.GraphicsEnvironment;
+
+import javax.swing.JLabel;
+
+import org.junit.Assert;
+import org.junit.Assume;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+public class WidgetUtilTest{ // WidgetUtilTest
+
+ @BeforeClass
+ public static void setUpClass() throws Exception {
+
+ Assume.assumeTrue("Can't start test with headless env", !GraphicsEnvironment.isHeadless());
+
+ }
+
+ @Test
+ public void testMakeDeepCopy() throws Exception {
+
+ JLabel label = new JLabel("CodeLutin");
+ Component component = WidgetUtil.makeDeepCopy(label);
+
+ // test prouve que les composants ne sont pas les memes en profondeur
+ Assert.assertTrue(component != label);
+ Assert.assertTrue(component instanceof JLabel);
+ Assert.assertEquals(label.getText(), ((JLabel) component).getText());
+ }
+
+} // WidgetUtilTest
+
Property changes on: trunk/jaxx-widgets-extra/src/test/java/org/nuiton/jaxx/widgets/extra/WidgetUtilTest.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
Added: trunk/jaxx-widgets-extra/src/test/java/org/nuiton/jaxx/widgets/extra/XMLGridLayoutTest.java
===================================================================
--- trunk/jaxx-widgets-extra/src/test/java/org/nuiton/jaxx/widgets/extra/XMLGridLayoutTest.java (rev 0)
+++ trunk/jaxx-widgets-extra/src/test/java/org/nuiton/jaxx/widgets/extra/XMLGridLayoutTest.java 2014-02-24 14:27:22 UTC (rev 2800)
@@ -0,0 +1,92 @@
+/*
+ * #%L
+ * JAXX :: Extra Widgets
+ * %%
+ * Copyright (C) 2004 - 2010 CodeLutin
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Lesser Public License for more details.
+ *
+ * You should have received a copy of the GNU General Lesser Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/lgpl-3.0.html>.
+ * #L%
+ */
+
+/* *
+ * XMLGridLayoutTest.java
+ *
+ * Created: 3 aout 2005 18:12:37 CEST
+ *
+ * @author Benjamin POUSSIN <poussin(a)codelutin.com>
+ * @version $Revision$
+ *
+ * Last update: $Date$
+ * by : $Author$
+ */
+
+package org.nuiton.jaxx.widgets.extra;
+
+import javax.swing.JButton;
+import javax.swing.JFrame;
+import javax.swing.JPanel;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.junit.Assume;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+import java.awt.GraphicsEnvironment;
+
+public class XMLGridLayoutTest { // XMLGridLayoutTest
+
+ /** to use log facility, just put in your code: log.info(\"...\"); */
+ static private Log log = LogFactory.getLog(XMLGridLayoutTest.class);
+
+ @BeforeClass
+ public static void setUpClass() throws Exception {
+
+ Assume.assumeTrue("Can't start test with headless env", !GraphicsEnvironment.isHeadless());
+
+ }
+
+ @Test
+ public void testString() throws Exception {
+ JPanel panel = new JPanel(
+ new XMLGridLayout(
+ "<table><tr><td>button2</td></tr><tr><td>button1</td></tr></table>"));
+ panel.add("button1", new JButton("Button1"));
+ panel.add("button2", new JButton("Button2"));
+ panel.add("button3", new JButton("Button3"));
+
+ JFrame f = new JFrame("testString");
+ f.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
+ f.getContentPane().add(panel);
+ f.pack();
+ f.setVisible(true);
+ }
+
+ public void testFile() throws Exception {
+ // JPanel panel = new JPanel(new
+ // XMLGridLayout("org.nuiton.widget/XMLGridLayoutTest.xgl"));
+ // panel.add("button1", new JButton("Button1"));
+ // panel.add("button2", new JButton("Button2"));
+ // panel.add("button3", new JButton("Button3"));
+ //
+ // JFrame f = new JFrame("testFile");
+ // f.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
+ // f.getContentPane().add(panel);
+ // f.pack();
+ // f.setVisible(true);
+ }
+
+} // XMLGridLayoutTest
+
Property changes on: trunk/jaxx-widgets-extra/src/test/java/org/nuiton/jaxx/widgets/extra/XMLGridLayoutTest.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
Added: trunk/jaxx-widgets-extra/src/test/java/org/nuiton/jaxx/widgets/extra/XMLGridLayoutTest.xgl
===================================================================
--- trunk/jaxx-widgets-extra/src/test/java/org/nuiton/jaxx/widgets/extra/XMLGridLayoutTest.xgl (rev 0)
+++ trunk/jaxx-widgets-extra/src/test/java/org/nuiton/jaxx/widgets/extra/XMLGridLayoutTest.xgl 2014-02-24 14:27:22 UTC (rev 2800)
@@ -0,0 +1,7 @@
+<table>
+ <tr>
+ <td>button1</td>
+ <td>button3</td>
+ </tr>
+</table>
+
Added: trunk/jaxx-widgets-extra/src/test/java/org/nuiton/jaxx/widgets/extra/editor/EditorMain.java
===================================================================
--- trunk/jaxx-widgets-extra/src/test/java/org/nuiton/jaxx/widgets/extra/editor/EditorMain.java (rev 0)
+++ trunk/jaxx-widgets-extra/src/test/java/org/nuiton/jaxx/widgets/extra/editor/EditorMain.java 2014-02-24 14:27:22 UTC (rev 2800)
@@ -0,0 +1,69 @@
+/*
+ * #%L
+ * JAXX :: Extra Widgets
+ * %%
+ * Copyright (C) 2004 - 2011 CodeLutin, Chatellier Eric
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Lesser Public License for more details.
+ *
+ * You should have received a copy of the GNU General Lesser Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/lgpl-3.0.html>.
+ * #L%
+ */
+
+/* *
+ * EditorMain.java
+ *
+ * Created: 6 août 2006 17:08:26
+ *
+ * @author poussin
+ * @version $Revision$
+ *
+ * Last update: $Date$
+ * by : $Author$
+ */
+
+package org.nuiton.jaxx.widgets.extra.editor;
+
+import java.awt.BorderLayout;
+import java.io.File;
+
+import javax.swing.JFrame;
+import javax.swing.WindowConstants;
+
+import org.apache.commons.io.FileUtils;
+
+/**
+ * @author poussin
+ *
+ */
+
+public class EditorMain {
+
+ public static void main(String[] args) throws Exception {
+ JFrame frame = new JFrame("Editor");
+ frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
+ frame.getContentPane().setLayout(new BorderLayout());
+ Editor editor = new Editor();
+ frame.getContentPane().add(editor);
+ frame.setBounds(10, 10, 300, 300);
+
+ File file = File.createTempFile("NuitonEditorTest", ".java");
+ FileUtils.writeStringToFile(file, "public class toto {\n public void test() {\n \n }\n}");
+ file.deleteOnExit();
+
+ editor.open(file);
+
+ frame.setVisible(true);
+ }
+
+}
Property changes on: trunk/jaxx-widgets-extra/src/test/java/org/nuiton/jaxx/widgets/extra/editor/EditorMain.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
Added: trunk/jaxx-widgets-extra/src/test/java/org/nuiton/jaxx/widgets/extra/toolTip/FocusableToolTipMain.java
===================================================================
--- trunk/jaxx-widgets-extra/src/test/java/org/nuiton/jaxx/widgets/extra/toolTip/FocusableToolTipMain.java (rev 0)
+++ trunk/jaxx-widgets-extra/src/test/java/org/nuiton/jaxx/widgets/extra/toolTip/FocusableToolTipMain.java 2014-02-24 14:27:22 UTC (rev 2800)
@@ -0,0 +1,114 @@
+/*
+ * #%L
+ * JAXX :: Extra Widgets
+ * %%
+ * Copyright (C) 2004 - 2010 CodeLutin
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Lesser Public License for more details.
+ *
+ * You should have received a copy of the GNU General Lesser Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/lgpl-3.0.html>.
+ * #L%
+ */
+package org.nuiton.jaxx.widgets.extra.toolTip;
+
+import java.util.Locale;
+import javax.swing.JFrame;
+import javax.swing.JLabel;
+import javax.swing.JTree;
+import javax.swing.WindowConstants;
+
+import org.nuiton.jaxx.widgets.extra.tooltip.FocusableTip;
+
+import java.awt.BorderLayout;
+import java.awt.event.MouseEvent;
+
+import org.nuiton.i18n.I18n;
+
+/**
+ * @author sletellier
+ */
+public class FocusableToolTipMain {
+
+ public static void main(String[] args) throws Exception {
+
+ // init i18n
+ I18n.init(null, Locale.FRANCE);
+
+ JFrame frame = new JFrame("FocusableToolTip");
+ frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
+ frame.getContentPane().setLayout(new BorderLayout());
+
+ JLabel simpleToolTipLabel = new JLabel("Simple tool tip text") {
+ protected FocusableTip focusableTip;
+
+ @Override
+ public String getToolTipText(MouseEvent event) {
+ String toolTipText = super.getToolTipText(event);
+
+ // display it into persistant tooltip
+ if (focusableTip == null) {
+ focusableTip = new FocusableTip(this, true);
+ focusableTip.setSize(600, 400);
+ }
+ focusableTip.toolTipRequested(event, toolTipText);
+
+ return null;
+ }
+ };
+ simpleToolTipLabel.setToolTipText("Simple tool tip text<p><b>is Working !</b>");
+ frame.getContentPane().add(simpleToolTipLabel, BorderLayout.NORTH);
+
+ JLabel complexeToolTipLabel = new JLabel("Complexe tool tip text") {
+ protected FocusableTip focusableTip;
+
+ @Override
+ public String getToolTipText(MouseEvent event) {
+ super.getToolTipText(event);
+
+ // display it into persistant tooltip
+ if (focusableTip == null) {
+ focusableTip = new FocusableTip(this, true);
+ focusableTip.setSize(600, 400);
+ }
+ focusableTip.toolTipRequested(event, new JTree());
+
+ return null;
+ }
+ };
+ complexeToolTipLabel.setToolTipText(FocusableTip.DUMMY_TOOL_TIP);
+ frame.getContentPane().add(complexeToolTipLabel, BorderLayout.CENTER);
+
+ JLabel emptyToolTipLabel = new JLabel("Empty tool tip text") {
+ protected FocusableTip focusableTip;
+
+ @Override
+ public String getToolTipText(MouseEvent event) {
+ String toolTipText = super.getToolTipText(event);
+
+ // display it into persistant tooltip
+ if (focusableTip == null) {
+ focusableTip = new FocusableTip(this, true);
+ focusableTip.setSize(600, 400);
+ }
+ focusableTip.toolTipRequested(event, toolTipText);
+
+ return null;
+ }
+ };
+ emptyToolTipLabel.setToolTipText(null);
+ frame.getContentPane().add(emptyToolTipLabel, BorderLayout.SOUTH);
+
+ frame.setVisible(true);
+ frame.pack();
+ }
+}
Property changes on: trunk/jaxx-widgets-extra/src/test/java/org/nuiton/jaxx/widgets/extra/toolTip/FocusableToolTipMain.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
Added: trunk/jaxx-widgets-extra/src/test/resources/log4j.properties
===================================================================
--- trunk/jaxx-widgets-extra/src/test/resources/log4j.properties (rev 0)
+++ trunk/jaxx-widgets-extra/src/test/resources/log4j.properties 2014-02-24 14:27:22 UTC (rev 2800)
@@ -0,0 +1,29 @@
+###
+# #%L
+# JAXX :: Extra Widgets
+# %%
+# Copyright (C) 2004 - 2010 CodeLutin
+# %%
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License as
+# published by the Free Software Foundation, either version 3 of the
+# License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Lesser Public License for more details.
+#
+# You should have received a copy of the GNU General Lesser Public
+# License along with this program. If not, see
+# <http://www.gnu.org/licenses/lgpl-3.0.html>.
+# #L%
+###
+# Global logging configuration
+log4j.rootLogger=ERROR, stdout
+# Console output...
+log4j.appender.stdout=org.apache.log4j.ConsoleAppender
+log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
+log4j.appender.stdout.layout.ConversionPattern=%5p [%t] (%F:%L) %M - %m%n
+
+log4j.logger.org.nuiton=INFO
Property changes on: trunk/jaxx-widgets-extra/src/test/resources/log4j.properties
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
Modified: trunk/pom.xml
===================================================================
--- trunk/pom.xml 2014-02-14 10:38:04 UTC (rev 2799)
+++ trunk/pom.xml 2014-02-24 14:27:22 UTC (rev 2800)
@@ -42,6 +42,7 @@
<module>jaxx-compiler</module>
<module>jaxx-maven-plugin</module>
<module>jaxx-widgets</module>
+ <module>jaxx-widgets-extra</module>
<module>jaxx-config</module>
<module>jaxx-application-api</module>
<module>jaxx-application-swing</module>
@@ -425,7 +426,6 @@
<groupId>org.codehaus.plexus</groupId>
<artifactId>plexus-utils</artifactId>
<version>${plexusUtilVersion}</version>
- <scope>compile</scope>
</dependency>
<dependency>
@@ -436,6 +436,19 @@
<classifier>tests</classifier>
</dependency>
+ <!-- cl patch is same but without system.out -->
+ <dependency>
+ <groupId>org.nuiton.thirdparty</groupId>
+ <artifactId>sdoc</artifactId>
+ <version>0.5.0-beta-patchcl</version>
+ </dependency>
+
+ <dependency>
+ <groupId>net.sf.jped</groupId>
+ <artifactId>jedit-syntax</artifactId>
+ <version>2.2.2</version>
+ </dependency>
+
</dependencies>
</dependencyManagement>
1
0
See <http://ci-ng.nuiton.org/jenkins/job/jaxx/21/changes>
Changes:
[Tony CHEMIT] fixes #3077: Updates nuiton-validator to 3.0-rc-1
------------------------------------------
[...truncated 397 lines...]
Running org.nuiton.jaxx.plugin.Bug1124Test
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.021 sec - in org.nuiton.jaxx.plugin.Bug1124Test
Running org.nuiton.jaxx.plugin.Bug1404Test
[INFO] Detects 3 modified jaxx file(s).
[INFO] Generated 3 file(s) in 78.785ms
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.08 sec - in org.nuiton.jaxx.plugin.Bug1404Test
Running org.nuiton.jaxx.plugin.Bug184Test
[INFO] Will check encoding : UTF-8
[INFO] adding source roots : <http://ci-ng.nuiton.org/jenkins/job/jaxx/ws/trunk/jaxx-maven-plugin/target/…>
[INFO] classpath : <http://ci-ng.nuiton.org/jenkins/job/jaxx/ws/trunk/jaxx-maven-plugin/target/…>
[INFO] includes : [**/bug184Test/*.jaxx]
[INFO] will parse org/nuiton/jaxx/plugin/bug184Test/MyPanel.jaxx
[INFO] Detects 1 modified jaxx file(s).
[INFO] Generated 1 file(s) in 46.165ms
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.061 sec - in org.nuiton.jaxx.plugin.Bug184Test
Running org.nuiton.jaxx.plugin.Bug1722Test
[INFO] Detects 2 modified jaxx file(s).
[INFO] Generated 2 file(s) in 30.191ms
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.043 sec - in org.nuiton.jaxx.plugin.Bug1722Test
Running org.nuiton.jaxx.plugin.CompilerValidatorTest
Tests run: 1, Failures: 0, Errors: 0, Skipped: 1, Time elapsed: 0 sec - in org.nuiton.jaxx.plugin.CompilerValidatorTest
Running org.nuiton.jaxx.plugin.NodeItemTest
findChild
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.002 sec - in org.nuiton.jaxx.plugin.NodeItemTest
Running org.nuiton.jaxx.plugin.Evolution74Test
[INFO] Detects 6 modified jaxx file(s).
[INFO] Generated 6 file(s) in 81.083ms
[info] Detects 1 modified jaxx file(s).
[info] Detects 1 modified jaxx file(s).
[info] Detects 1 modified jaxx file(s).
Tests run: 2, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.131 sec - in org.nuiton.jaxx.plugin.Evolution74Test
Running org.nuiton.jaxx.plugin.DecoratorTest
[INFO] Detects 1 modified jaxx file(s).
[INFO] Generated 1 file(s) in 15.937ms
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.026 sec - in org.nuiton.jaxx.plugin.DecoratorTest
Running org.nuiton.jaxx.plugin.CompilerTest
[info] Detects 1 modified jaxx file(s).
[INFO] Detects 1 modified jaxx file(s).
[INFO] Generated 1 file(s) in 14.358ms
[INFO] Detects 1 modified jaxx file(s).
[INFO] Generated 1 file(s) in 28.124ms
[INFO] Detects 2 modified jaxx file(s).
[INFO] Generated 2 file(s) in 31.868ms
[INFO] Detects 7 modified jaxx file(s).
[INFO] Generated 7 file(s) in 102.867ms
[INFO] Will check encoding : UTF-8
[INFO] adding source roots : <http://ci-ng.nuiton.org/jenkins/job/jaxx/ws/trunk/jaxx-maven-plugin/target/…>
[INFO] classpath : <http://ci-ng.nuiton.org/jenkins/job/jaxx/ws/trunk/jaxx-maven-plugin/target/…>
[INFO] includes : [**/compilerTest/cSSTests/*.jaxx]
[INFO] will parse org/nuiton/jaxx/plugin/compilerTest/cSSTests/Child2.jaxx
[INFO] will parse org/nuiton/jaxx/plugin/compilerTest/cSSTests/Pseudoclasses.jaxx
[INFO] will parse org/nuiton/jaxx/plugin/compilerTest/cSSTests/GrandChild.jaxx
[INFO] will parse org/nuiton/jaxx/plugin/compilerTest/cSSTests/GrandChildButton.jaxx
[INFO] will parse org/nuiton/jaxx/plugin/compilerTest/cSSTests/CSSTests.jaxx
[INFO] will parse org/nuiton/jaxx/plugin/compilerTest/cSSTests/SimpleCSS.jaxx
[INFO] will parse org/nuiton/jaxx/plugin/compilerTest/cSSTests/Child.jaxx
[INFO] Detects 7 modified jaxx file(s).
[INFO] Generated 7 file(s) in 312.447ms
[INFO] Detects 1 modified jaxx file(s).
[INFO] Generated 1 file(s) in 61.184ms
[INFO] Detects 1 modified jaxx file(s).
[INFO] Generated 1 file(s) in 12.479ms
[INFO] Detects 1 modified jaxx file(s).
[INFO] Generated 1 file(s) in 11.979ms
[INFO] Detects 1 modified jaxx file(s).
[INFO] Generated 1 file(s) in 10.522ms
[INFO] Nothing to generate - all files are up to date.
[INFO] Detects 1 modified jaxx file(s).
[INFO] Generated 1 file(s) in 10.841ms
[INFO] Detects 1 modified jaxx file(s).
[INFO] Generated 1 file(s) in 10.21ms
[INFO] Detects 2 modified jaxx file(s).
[INFO] Generated 2 file(s) in 17.57ms
[INFO] Detects 6 modified jaxx file(s).
[INFO] Generated 6 file(s) in 89.639ms
[INFO] Detects 1 modified jaxx file(s).
[INFO] Generated 1 file(s) in 18.106ms
[INFO] Detects 3 modified jaxx file(s).
[INFO] Generated 3 file(s) in 58.765ms
[INFO] Detects 1 modified jaxx file(s).
[INFO] Generated 1 file(s) in 39.233ms
[info] Detects 1 modified jaxx file(s).
[info] Detects 1 modified jaxx file(s).
[info] Detects 1 modified jaxx file(s).
[info] Detects 1 modified jaxx file(s).
[info] Detects 1 modified jaxx file(s).
[warn] JAXX detects 1 warning :
<http://ci-ng.nuiton.org/jenkins/job/jaxx/ws/trunk/jaxx-maven-plugin/target/…>:27
curly braces are unnecessary for script '{System.out.println("Remember kids, only use curly braces where appropriate!")}'
[info] Detects 1 modified jaxx file(s).
[info] Detects 1 modified jaxx file(s).
[info] Detects 1 modified jaxx file(s).
[info] Detects 1 modified jaxx file(s).
[info] Detects 1 modified jaxx file(s).
[info] Detects 1 modified jaxx file(s).
[info] Detects 1 modified jaxx file(s).
[info] Detects 1 modified jaxx file(s).
[info] Detects 1 modified jaxx file(s).
[info] Detects 1 modified jaxx file(s).
[info] Detects 1 modified jaxx file(s).
[info] Detects 1 modified jaxx file(s).
[info] Detects 1 modified jaxx file(s).
[info] Detects 1 modified jaxx file(s).
[info] Detects 1 modified jaxx file(s).
[info] Detects 1 modified jaxx file(s).
[info] Detects 1 modified jaxx file(s).
[info] Detects 1 modified jaxx file(s).
[info] Detects 1 modified jaxx file(s).
[info] Detects 1 modified jaxx file(s).
[info] Detects 1 modified jaxx file(s).
[info] Detects 1 modified jaxx file(s).
[info] Detects 1 modified jaxx file(s).
[info] Detects 1 modified jaxx file(s).
[info] Detects 1 modified jaxx file(s).
[info] Detects 1 modified jaxx file(s).
[info] Detects 1 modified jaxx file(s).
[info] Detects 1 modified jaxx file(s).
Tests run: 16, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 2.34 sec - in org.nuiton.jaxx.plugin.CompilerTest
Running org.nuiton.jaxx.plugin.Bug1751Test
[INFO] Detects 3 modified jaxx file(s).
[INFO] Generated 3 file(s) in 20.068ms
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.036 sec - in org.nuiton.jaxx.plugin.Bug1751Test
Running org.nuiton.jaxx.plugin.DataBindingTest
[INFO] Detects 1 modified jaxx file(s).
[INFO] Generated 1 file(s) in 72.066ms
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.076 sec - in org.nuiton.jaxx.plugin.DataBindingTest
Results :
Tests run: 31, Failures: 0, Errors: 0, Skipped: 1
[JENKINS] Recording test results
[INFO]
[INFO] --- maven-jar-plugin:2.4:jar (default-jar) @ jaxx-maven-plugin ---
[INFO] Building jar: <http://ci-ng.nuiton.org/jenkins/job/jaxx/ws/trunk/jaxx-maven-plugin/target/…>
[INFO]
[INFO] --- maven-plugin-plugin:3.2:addPluginArtifactMetadata (default-addPluginArtifactMetadata) @ jaxx-maven-plugin ---
[INFO]
[INFO] --- maven-site-plugin:3.3:attach-descriptor (attach-descriptor) @ jaxx-maven-plugin ---
[JENKINS] Archiving disabled
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building JAXX :: Widgets 2.8.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ jaxx-widgets ---
[INFO] Deleting <http://ci-ng.nuiton.org/jenkins/job/jaxx/ws/trunk/jaxx-widgets/target>
[INFO]
[INFO] --- maven-enforcer-plugin:1.3.1:enforce (check-project-files) @ jaxx-widgets ---
[INFO]
[INFO] --- jaxx-maven-plugin:2.8.1-SNAPSHOT:generate (default) @ jaxx-widgets ---
[WARNING] Failed to getClass for org.nuiton.jaxx.plugin.GenerateMojo
[JENKINS] Archiving disabled
[JENKINS] Archiving disabled
[JENKINS] Archiving disabled
[JENKINS] Archiving disabled
[JENKINS] Archiving disabled
[JENKINS] Archiving disabled
[JENKINS] Archiving disabled
[JENKINS] Archiving disabled
[JENKINS] Archiving disabled
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO]
[INFO] JAXX .............................................. SUCCESS [2.675s]
[INFO] JAXX :: Runtime ................................... SUCCESS [4.840s]
[INFO] JAXX :: Validator ................................. SUCCESS [8.770s]
[INFO] JAXX :: Compiler .................................. SUCCESS [6.637s]
[INFO] JAXX :: Maven plugin .............................. SUCCESS [9.053s]
[INFO] JAXX :: Widgets ................................... FAILURE [0.209s]
[INFO] JAXX :: Config .................................... SKIPPED
[INFO] JAXX :: Application API ........................... SKIPPED
[INFO] JAXX :: Application Swing ......................... SKIPPED
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 34.314s
[INFO] Finished at: Wed Feb 12 18:07:21 CET 2014
[JENKINS] Archiving disabled
[INFO] Final Memory: 58M/844M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.nuiton.jaxx:jaxx-maven-plugin:2.8.1-SNAPSHOT:generate (default) on project jaxx-widgets: Execution default of goal org.nuiton.jaxx:jaxx-maven-plugin:2.8.1-SNAPSHOT:generate failed: Plugin org.nuiton.jaxx:jaxx-maven-plugin:2.8.1-SNAPSHOT or one of its dependencies could not be resolved: Failure to find org.nuiton:nuiton-validator:jar:3.0-rc-1 in http://repo.maven.apache.org/maven2 was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.nuiton.jaxx:jaxx-maven-plugin:2.8.1-SNAPSHOT:generate (default) on project jaxx-widgets: Execution default of goal org.nuiton.jaxx:jaxx-maven-plugin:2.8.1-SNAPSHOT:generate failed: Plugin org.nuiton.jaxx:jaxx-maven-plugin:2.8.1-SNAPSHOT or one of its dependencies could not be resolved: Failure to find org.nuiton:nuiton-validator:jar:3.0-rc-1 in http://repo.maven.apache.org/maven2 was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:224)
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:84)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59)
at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:317)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:152)
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.PluginExecutionException: Execution default of goal org.nuiton.jaxx:jaxx-maven-plugin:2.8.1-SNAPSHOT:generate failed: Plugin org.nuiton.jaxx:jaxx-maven-plugin:2.8.1-SNAPSHOT or one of its dependencies could not be resolved: Failure to find org.nuiton:nuiton-validator:jar:3.0-rc-1 in http://repo.maven.apache.org/maven2 was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:87)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208)
... 30 more
Caused by: org.apache.maven.plugin.PluginResolutionException: Plugin org.nuiton.jaxx:jaxx-maven-plugin:2.8.1-SNAPSHOT or one of its dependencies could not be resolved: Failure to find org.nuiton:nuiton-validator:jar:3.0-rc-1 in http://repo.maven.apache.org/maven2 was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced
at org.apache.maven.plugin.internal.DefaultPluginDependenciesResolver.resolve(DefaultPluginDependenciesResolver.java:208)
at org.apache.maven.plugin.internal.DefaultMavenPluginManager.createPluginRealm(DefaultMavenPluginManager.java:357)
at org.apache.maven.plugin.internal.DefaultMavenPluginManager.setupPluginRealm(DefaultMavenPluginManager.java:325)
at org.apache.maven.plugin.DefaultBuildPluginManager.getPluginRealm(DefaultBuildPluginManager.java:180)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:83)
... 31 more
Caused by: org.eclipse.aether.resolution.ArtifactResolutionException: Failure to find org.nuiton:nuiton-validator:jar:3.0-rc-1 in http://repo.maven.apache.org/maven2 was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced
at org.eclipse.aether.internal.impl.DefaultArtifactResolver.resolve(DefaultArtifactResolver.java:459)
at org.eclipse.aether.internal.impl.DefaultArtifactResolver.resolveArtifacts(DefaultArtifactResolver.java:262)
at org.eclipse.aether.internal.impl.DefaultRepositorySystem.resolveDependencies(DefaultRepositorySystem.java:367)
at org.apache.maven.plugin.internal.DefaultPluginDependenciesResolver.resolve(DefaultPluginDependenciesResolver.java:200)
... 35 more
Caused by: org.eclipse.aether.transfer.ArtifactNotFoundException: Failure to find org.nuiton:nuiton-validator:jar:3.0-rc-1 in http://repo.maven.apache.org/maven2 was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced
at org.eclipse.aether.internal.impl.DefaultUpdateCheckManager.newException(DefaultUpdateCheckManager.java:232)
at org.eclipse.aether.internal.impl.DefaultUpdateCheckManager.checkArtifact(DefaultUpdateCheckManager.java:177)
at org.eclipse.aether.internal.impl.DefaultArtifactResolver.gatherDownloads(DefaultArtifactResolver.java:599)
at org.eclipse.aether.internal.impl.DefaultArtifactResolver.performDownloads(DefaultArtifactResolver.java:518)
at org.eclipse.aether.internal.impl.DefaultArtifactResolver.resolve(DefaultArtifactResolver.java:436)
... 38 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/PluginResolutionException
[ERROR]
[ERROR] After correcting the problems, you can resume the build with the command
[ERROR] mvn <goals> -rf :jaxx-widgets
Sending e-mails to: jaxx-commits(a)list.nuiton.org
channel stopped
Skipping sonar analysis due to bad build status FAILURE
1
2