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
August 2012
- 3 participants
- 34 discussions
Author: maven-release
Date: 2012-08-08 18:24:17 +0200 (Wed, 08 Aug 2012)
New Revision: 2486
Url: http://nuiton.org/repositories/revision/jaxx/2486
Log:
optimize dependencies
Modified:
tags/jaxx-2.5.4/jaxx-demo/pom.xml
Modified: tags/jaxx-2.5.4/jaxx-demo/pom.xml
===================================================================
--- tags/jaxx-2.5.4/jaxx-demo/pom.xml 2012-08-08 16:20:05 UTC (rev 2485)
+++ tags/jaxx-2.5.4/jaxx-demo/pom.xml 2012-08-08 16:24:17 UTC (rev 2486)
@@ -95,6 +95,11 @@
<dependency>
<groupId>org.swinglabs.swingx</groupId>
+ <artifactId>swingx-comoon</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.swinglabs.swingx</groupId>
<artifactId>swingx-core</artifactId>
</dependency>
1
0
Author: maven-release
Date: 2012-08-08 18:20:05 +0200 (Wed, 08 Aug 2012)
New Revision: 2485
Url: http://nuiton.org/repositories/revision/jaxx/2485
Log:
optimize dependencies
Modified:
tags/jaxx-2.5.4/pom.xml
Modified: tags/jaxx-2.5.4/pom.xml
===================================================================
--- tags/jaxx-2.5.4/pom.xml 2012-08-08 16:19:16 UTC (rev 2484)
+++ tags/jaxx-2.5.4/pom.xml 2012-08-08 16:20:05 UTC (rev 2485)
@@ -377,6 +377,13 @@
<version>${swingXVersion}</version>
<scope>compile</scope>
</dependency>
+
+ <dependency>
+ <groupId>org.swinglabs.swingx</groupId>
+ <artifactId>swingx-common</artifactId>
+ <version>${swingXVersion}</version>
+ <scope>compile</scope>
+ </dependency>
<dependency>
<groupId>org.swinglabs.swingx</groupId>
1
0
Author: maven-release
Date: 2012-08-08 18:19:16 +0200 (Wed, 08 Aug 2012)
New Revision: 2484
Url: http://nuiton.org/repositories/revision/jaxx/2484
Log:
optimize dependencies
Modified:
tags/jaxx-2.5.4/jaxx-widgets/pom.xml
Modified: tags/jaxx-2.5.4/jaxx-widgets/pom.xml
===================================================================
--- tags/jaxx-2.5.4/jaxx-widgets/pom.xml 2012-08-08 15:01:43 UTC (rev 2483)
+++ tags/jaxx-2.5.4/jaxx-widgets/pom.xml 2012-08-08 16:19:16 UTC (rev 2484)
@@ -55,9 +55,14 @@
<groupId>org.swinglabs.swingx</groupId>
<artifactId>swingx-core</artifactId>
</dependency>
-
+
<dependency>
<groupId>org.swinglabs.swingx</groupId>
+ <artifactId>swingx-common</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.swinglabs.swingx</groupId>
<artifactId>swingx-autocomplete</artifactId>
</dependency>
1
0
r2483 - in trunk: . jaxx-compiler jaxx-demo jaxx-maven-plugin jaxx-runtime jaxx-validator jaxx-widgets
by maven-release@users.nuiton.org 08 Aug '12
by maven-release@users.nuiton.org 08 Aug '12
08 Aug '12
Author: maven-release
Date: 2012-08-08 17:01:43 +0200 (Wed, 08 Aug 2012)
New Revision: 2483
Url: http://nuiton.org/repositories/revision/jaxx/2483
Log:
[maven-release-plugin] prepare for next development iteration
Modified:
trunk/jaxx-compiler/pom.xml
trunk/jaxx-demo/pom.xml
trunk/jaxx-maven-plugin/pom.xml
trunk/jaxx-runtime/pom.xml
trunk/jaxx-validator/pom.xml
trunk/jaxx-widgets/pom.xml
trunk/pom.xml
Modified: trunk/jaxx-compiler/pom.xml
===================================================================
--- trunk/jaxx-compiler/pom.xml 2012-08-08 15:01:41 UTC (rev 2482)
+++ trunk/jaxx-compiler/pom.xml 2012-08-08 15:01:43 UTC (rev 2483)
@@ -34,7 +34,7 @@
<parent>
<groupId>org.nuiton</groupId>
<artifactId>jaxx</artifactId>
- <version>2.5.4</version>
+ <version>2.5.5-SNAPSHOT</version>
</parent>
<groupId>org.nuiton.jaxx</groupId>
Modified: trunk/jaxx-demo/pom.xml
===================================================================
--- trunk/jaxx-demo/pom.xml 2012-08-08 15:01:41 UTC (rev 2482)
+++ trunk/jaxx-demo/pom.xml 2012-08-08 15:01:43 UTC (rev 2483)
@@ -35,7 +35,7 @@
<parent>
<groupId>org.nuiton</groupId>
<artifactId>jaxx</artifactId>
- <version>2.5.4</version>
+ <version>2.5.5-SNAPSHOT</version>
</parent>
<groupId>org.nuiton.jaxx</groupId>
Modified: trunk/jaxx-maven-plugin/pom.xml
===================================================================
--- trunk/jaxx-maven-plugin/pom.xml 2012-08-08 15:01:41 UTC (rev 2482)
+++ trunk/jaxx-maven-plugin/pom.xml 2012-08-08 15:01:43 UTC (rev 2483)
@@ -35,7 +35,7 @@
<parent>
<groupId>org.nuiton</groupId>
<artifactId>jaxx</artifactId>
- <version>2.5.4</version>
+ <version>2.5.5-SNAPSHOT</version>
</parent>
<groupId>org.nuiton.jaxx</groupId>
Modified: trunk/jaxx-runtime/pom.xml
===================================================================
--- trunk/jaxx-runtime/pom.xml 2012-08-08 15:01:41 UTC (rev 2482)
+++ trunk/jaxx-runtime/pom.xml 2012-08-08 15:01:43 UTC (rev 2483)
@@ -34,7 +34,7 @@
<parent>
<groupId>org.nuiton</groupId>
<artifactId>jaxx</artifactId>
- <version>2.5.4</version>
+ <version>2.5.5-SNAPSHOT</version>
</parent>
<groupId>org.nuiton.jaxx</groupId>
Modified: trunk/jaxx-validator/pom.xml
===================================================================
--- trunk/jaxx-validator/pom.xml 2012-08-08 15:01:41 UTC (rev 2482)
+++ trunk/jaxx-validator/pom.xml 2012-08-08 15:01:43 UTC (rev 2483)
@@ -34,7 +34,7 @@
<parent>
<groupId>org.nuiton</groupId>
<artifactId>jaxx</artifactId>
- <version>2.5.4</version>
+ <version>2.5.5-SNAPSHOT</version>
</parent>
<groupId>org.nuiton.jaxx</groupId>
Modified: trunk/jaxx-widgets/pom.xml
===================================================================
--- trunk/jaxx-widgets/pom.xml 2012-08-08 15:01:41 UTC (rev 2482)
+++ trunk/jaxx-widgets/pom.xml 2012-08-08 15:01:43 UTC (rev 2483)
@@ -35,7 +35,7 @@
<parent>
<groupId>org.nuiton</groupId>
<artifactId>jaxx</artifactId>
- <version>2.5.4</version>
+ <version>2.5.5-SNAPSHOT</version>
</parent>
<groupId>org.nuiton.jaxx</groupId>
Modified: trunk/pom.xml
===================================================================
--- trunk/pom.xml 2012-08-08 15:01:41 UTC (rev 2482)
+++ trunk/pom.xml 2012-08-08 15:01:43 UTC (rev 2483)
@@ -38,7 +38,7 @@
</parent>
<artifactId>jaxx</artifactId>
- <version>2.5.4</version>
+ <version>2.5.5-SNAPSHOT</version>
<modules>
<module>jaxx-runtime</module>
@@ -135,11 +135,11 @@
<!-- Source control management. -->
<scm>
- <connection>scm:svn:http://svn.nuiton.org/svn/jaxx/tags/jaxx-2.5.4</connection>
+ <connection>scm:svn:http://svn.nuiton.org/svn/jaxx/trunk</connection>
<developerConnection>
- scm:svn:http://svn.nuiton.org/svn/jaxx/tags/jaxx-2.5.4
+ scm:svn:http://svn.nuiton.org/svn/jaxx/trunk
</developerConnection>
- <url>http://www.nuiton.org/repositories/browse/jaxx/tags/jaxx-2.5.4</url>
+ <url>http://www.nuiton.org/repositories/browse/jaxx/trunk</url>
</scm>
<distributionManagement>
1
0
Author: maven-release
Date: 2012-08-08 17:01:41 +0200 (Wed, 08 Aug 2012)
New Revision: 2482
Url: http://nuiton.org/repositories/revision/jaxx/2482
Log:
[maven-release-plugin] copy for tag jaxx-2.5.4
Added:
tags/jaxx-2.5.4/
1
0
r2481 - in trunk: . jaxx-compiler jaxx-demo jaxx-maven-plugin jaxx-runtime jaxx-validator jaxx-widgets
by maven-release@users.nuiton.org 08 Aug '12
by maven-release@users.nuiton.org 08 Aug '12
08 Aug '12
Author: maven-release
Date: 2012-08-08 17:01:39 +0200 (Wed, 08 Aug 2012)
New Revision: 2481
Url: http://nuiton.org/repositories/revision/jaxx/2481
Log:
[maven-release-plugin] prepare release jaxx-2.5.4
Modified:
trunk/jaxx-compiler/pom.xml
trunk/jaxx-demo/pom.xml
trunk/jaxx-maven-plugin/pom.xml
trunk/jaxx-runtime/pom.xml
trunk/jaxx-validator/pom.xml
trunk/jaxx-widgets/pom.xml
trunk/pom.xml
Modified: trunk/jaxx-compiler/pom.xml
===================================================================
--- trunk/jaxx-compiler/pom.xml 2012-08-08 13:21:22 UTC (rev 2480)
+++ trunk/jaxx-compiler/pom.xml 2012-08-08 15:01:39 UTC (rev 2481)
@@ -34,7 +34,7 @@
<parent>
<groupId>org.nuiton</groupId>
<artifactId>jaxx</artifactId>
- <version>2.5.4-SNAPSHOT</version>
+ <version>2.5.4</version>
</parent>
<groupId>org.nuiton.jaxx</groupId>
Modified: trunk/jaxx-demo/pom.xml
===================================================================
--- trunk/jaxx-demo/pom.xml 2012-08-08 13:21:22 UTC (rev 2480)
+++ trunk/jaxx-demo/pom.xml 2012-08-08 15:01:39 UTC (rev 2481)
@@ -35,7 +35,7 @@
<parent>
<groupId>org.nuiton</groupId>
<artifactId>jaxx</artifactId>
- <version>2.5.4-SNAPSHOT</version>
+ <version>2.5.4</version>
</parent>
<groupId>org.nuiton.jaxx</groupId>
Modified: trunk/jaxx-maven-plugin/pom.xml
===================================================================
--- trunk/jaxx-maven-plugin/pom.xml 2012-08-08 13:21:22 UTC (rev 2480)
+++ trunk/jaxx-maven-plugin/pom.xml 2012-08-08 15:01:39 UTC (rev 2481)
@@ -35,7 +35,7 @@
<parent>
<groupId>org.nuiton</groupId>
<artifactId>jaxx</artifactId>
- <version>2.5.4-SNAPSHOT</version>
+ <version>2.5.4</version>
</parent>
<groupId>org.nuiton.jaxx</groupId>
Modified: trunk/jaxx-runtime/pom.xml
===================================================================
--- trunk/jaxx-runtime/pom.xml 2012-08-08 13:21:22 UTC (rev 2480)
+++ trunk/jaxx-runtime/pom.xml 2012-08-08 15:01:39 UTC (rev 2481)
@@ -34,7 +34,7 @@
<parent>
<groupId>org.nuiton</groupId>
<artifactId>jaxx</artifactId>
- <version>2.5.4-SNAPSHOT</version>
+ <version>2.5.4</version>
</parent>
<groupId>org.nuiton.jaxx</groupId>
Modified: trunk/jaxx-validator/pom.xml
===================================================================
--- trunk/jaxx-validator/pom.xml 2012-08-08 13:21:22 UTC (rev 2480)
+++ trunk/jaxx-validator/pom.xml 2012-08-08 15:01:39 UTC (rev 2481)
@@ -34,7 +34,7 @@
<parent>
<groupId>org.nuiton</groupId>
<artifactId>jaxx</artifactId>
- <version>2.5.4-SNAPSHOT</version>
+ <version>2.5.4</version>
</parent>
<groupId>org.nuiton.jaxx</groupId>
Modified: trunk/jaxx-widgets/pom.xml
===================================================================
--- trunk/jaxx-widgets/pom.xml 2012-08-08 13:21:22 UTC (rev 2480)
+++ trunk/jaxx-widgets/pom.xml 2012-08-08 15:01:39 UTC (rev 2481)
@@ -35,7 +35,7 @@
<parent>
<groupId>org.nuiton</groupId>
<artifactId>jaxx</artifactId>
- <version>2.5.4-SNAPSHOT</version>
+ <version>2.5.4</version>
</parent>
<groupId>org.nuiton.jaxx</groupId>
Modified: trunk/pom.xml
===================================================================
--- trunk/pom.xml 2012-08-08 13:21:22 UTC (rev 2480)
+++ trunk/pom.xml 2012-08-08 15:01:39 UTC (rev 2481)
@@ -38,7 +38,7 @@
</parent>
<artifactId>jaxx</artifactId>
- <version>2.5.4-SNAPSHOT</version>
+ <version>2.5.4</version>
<modules>
<module>jaxx-runtime</module>
@@ -135,11 +135,11 @@
<!-- Source control management. -->
<scm>
- <connection>scm:svn:http://svn.nuiton.org/svn/jaxx/trunk</connection>
+ <connection>scm:svn:http://svn.nuiton.org/svn/jaxx/tags/jaxx-2.5.4</connection>
<developerConnection>
- scm:svn:http://svn.nuiton.org/svn/jaxx/trunk
+ scm:svn:http://svn.nuiton.org/svn/jaxx/tags/jaxx-2.5.4
</developerConnection>
- <url>http://www.nuiton.org/repositories/browse/jaxx/trunk</url>
+ <url>http://www.nuiton.org/repositories/browse/jaxx/tags/jaxx-2.5.4</url>
</scm>
<distributionManagement>
1
0
r2480 - in trunk: jaxx-compiler/src/site jaxx-demo/src/site jaxx-maven-plugin/src/site jaxx-runtime/src/site jaxx-validator/src/site jaxx-widgets/src/site src/site
by tchemit@users.nuiton.org 08 Aug '12
by tchemit@users.nuiton.org 08 Aug '12
08 Aug '12
Author: tchemit
Date: 2012-08-08 15:21:22 +0200 (Wed, 08 Aug 2012)
New Revision: 2480
Url: http://nuiton.org/repositories/revision/jaxx/2480
Log:
update site.xml (using head section for common javascript and css)
Modified:
trunk/jaxx-compiler/src/site/site_fr.xml
trunk/jaxx-demo/src/site/site_fr.xml
trunk/jaxx-maven-plugin/src/site/site_fr.xml
trunk/jaxx-runtime/src/site/site_fr.xml
trunk/jaxx-validator/src/site/site_fr.xml
trunk/jaxx-widgets/src/site/site_fr.xml
trunk/src/site/site_fr.xml
Modified: trunk/jaxx-compiler/src/site/site_fr.xml
===================================================================
--- trunk/jaxx-compiler/src/site/site_fr.xml 2012-08-08 12:23:08 UTC (rev 2479)
+++ trunk/jaxx-compiler/src/site/site_fr.xml 2012-08-08 13:21:22 UTC (rev 2480)
@@ -34,6 +34,15 @@
<body>
+ <head>
+ <script type="text/javascript"
+ src="http://maven-site.nuiton.org/public/js/maven-site-nuiton.org.js">
+ </script>
+
+ <link rel="stylesheet" type="text/css"
+ href="http://maven-site.nuiton.org/public/css/maven-site-nuiton.org.css"/>
+ </head>
+
<breadcrumbs>
<item name="${project.name}" href="index.html"/>
</breadcrumbs>
@@ -46,10 +55,6 @@
<footer>
- <script type="text/javascript"
- src="http://maven-site.nuiton.org/public/js/maven-site-nuiton.org.js">
- </script>
-
<div id='projectMetas'
projectversion='${project.version}'
platform='${project.platform}'
Modified: trunk/jaxx-demo/src/site/site_fr.xml
===================================================================
--- trunk/jaxx-demo/src/site/site_fr.xml 2012-08-08 12:23:08 UTC (rev 2479)
+++ trunk/jaxx-demo/src/site/site_fr.xml 2012-08-08 13:21:22 UTC (rev 2480)
@@ -38,6 +38,15 @@
<body>
+ <head>
+ <script type="text/javascript"
+ src="http://maven-site.nuiton.org/public/js/maven-site-nuiton.org.js">
+ </script>
+
+ <link rel="stylesheet" type="text/css"
+ href="http://maven-site.nuiton.org/public/css/maven-site-nuiton.org.css"/>
+ </head>
+
<breadcrumbs>
<item name="${project.name}" href="index.html"/>
</breadcrumbs>
@@ -55,10 +64,6 @@
<footer>
- <script type="text/javascript"
- src="http://maven-site.nuiton.org/public/js/maven-site-nuiton.org.js">
- </script>
-
<div id='projectMetas'
projectversion='${project.version}'
platform='${project.platform}'
Modified: trunk/jaxx-maven-plugin/src/site/site_fr.xml
===================================================================
--- trunk/jaxx-maven-plugin/src/site/site_fr.xml 2012-08-08 12:23:08 UTC (rev 2479)
+++ trunk/jaxx-maven-plugin/src/site/site_fr.xml 2012-08-08 13:21:22 UTC (rev 2480)
@@ -34,6 +34,15 @@
<body>
+ <head>
+ <script type="text/javascript"
+ src="http://maven-site.nuiton.org/public/js/maven-site-nuiton.org.js">
+ </script>
+
+ <link rel="stylesheet" type="text/css"
+ href="http://maven-site.nuiton.org/public/css/maven-site-nuiton.org.css"/>
+ </head>
+
<breadcrumbs>
<item name="${project.name}" href="index.html"/>
</breadcrumbs>
@@ -60,10 +69,6 @@
<footer>
- <script type="text/javascript"
- src="http://maven-site.nuiton.org/public/js/maven-site-nuiton.org.js">
- </script>
-
<div id='projectMetas'
projectversion='${project.version}'
platform='${project.platform}'
Modified: trunk/jaxx-runtime/src/site/site_fr.xml
===================================================================
--- trunk/jaxx-runtime/src/site/site_fr.xml 2012-08-08 12:23:08 UTC (rev 2479)
+++ trunk/jaxx-runtime/src/site/site_fr.xml 2012-08-08 13:21:22 UTC (rev 2480)
@@ -34,6 +34,15 @@
<body>
+ <head>
+ <script type="text/javascript"
+ src="http://maven-site.nuiton.org/public/js/maven-site-nuiton.org.js">
+ </script>
+
+ <link rel="stylesheet" type="text/css"
+ href="http://maven-site.nuiton.org/public/css/maven-site-nuiton.org.css"/>
+ </head>
+
<breadcrumbs>
<item name="${project.name}" href="index.html"/>
</breadcrumbs>
@@ -50,10 +59,6 @@
<footer>
- <script type="text/javascript"
- src="http://maven-site.nuiton.org/public/js/maven-site-nuiton.org.js">
- </script>
-
<div id='projectMetas'
projectversion='${project.version}'
platform='${project.platform}'
Modified: trunk/jaxx-validator/src/site/site_fr.xml
===================================================================
--- trunk/jaxx-validator/src/site/site_fr.xml 2012-08-08 12:23:08 UTC (rev 2479)
+++ trunk/jaxx-validator/src/site/site_fr.xml 2012-08-08 13:21:22 UTC (rev 2480)
@@ -34,6 +34,15 @@
<body>
+ <head>
+ <script type="text/javascript"
+ src="http://maven-site.nuiton.org/public/js/maven-site-nuiton.org.js">
+ </script>
+
+ <link rel="stylesheet" type="text/css"
+ href="http://maven-site.nuiton.org/public/css/maven-site-nuiton.org.css"/>
+ </head>
+
<breadcrumbs>
<item name="${project.name}" href="index.html"/>
</breadcrumbs>
@@ -48,10 +57,6 @@
<footer>
- <script type="text/javascript"
- src="http://maven-site.nuiton.org/public/js/maven-site-nuiton.org.js">
- </script>
-
<div id='projectMetas'
projectversion='${project.version}'
platform='${project.platform}'
Modified: trunk/jaxx-widgets/src/site/site_fr.xml
===================================================================
--- trunk/jaxx-widgets/src/site/site_fr.xml 2012-08-08 12:23:08 UTC (rev 2479)
+++ trunk/jaxx-widgets/src/site/site_fr.xml 2012-08-08 13:21:22 UTC (rev 2480)
@@ -34,6 +34,15 @@
<body>
+ <head>
+ <script type="text/javascript"
+ src="http://maven-site.nuiton.org/public/js/maven-site-nuiton.org.js">
+ </script>
+
+ <link rel="stylesheet" type="text/css"
+ href="http://maven-site.nuiton.org/public/css/maven-site-nuiton.org.css"/>
+ </head>
+
<breadcrumbs>
<item name="${project.name}" href="index.html"/>
</breadcrumbs>
@@ -48,10 +57,6 @@
<footer>
- <script type="text/javascript"
- src="http://maven-site.nuiton.org/public/js/maven-site-nuiton.org.js">
- </script>
-
<div id='projectMetas'
projectversion='${project.version}'
platform='${project.platform}'
Modified: trunk/src/site/site_fr.xml
===================================================================
--- trunk/src/site/site_fr.xml 2012-08-08 12:23:08 UTC (rev 2479)
+++ trunk/src/site/site_fr.xml 2012-08-08 13:21:22 UTC (rev 2480)
@@ -68,6 +68,15 @@
<body>
+ <head>
+ <script type="text/javascript"
+ src="http://maven-site.nuiton.org/public/js/maven-site-nuiton.org.js">
+ </script>
+
+ <link rel="stylesheet" type="text/css"
+ href="http://maven-site.nuiton.org/public/css/maven-site-nuiton.org.css"/>
+ </head>
+
<links>
<item name="nuiton.org" href="http://www.nuiton.org"/>
<item name="CodeLutin" href="http://codelutin.com"/>
@@ -127,10 +136,6 @@
<footer>
- <script type="text/javascript"
- src="http://maven-site.nuiton.org/public/js/maven-site-nuiton.org.js">
- </script>
-
<div id='projectMetas'
projectversion='${project.version}'
platform='${project.platform}'
1
0
r2479 - in trunk: jaxx-demo/src/main/java/jaxx/demo jaxx-demo/src/main/resources/i18n jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/config jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/config/model jaxx-widgets/src/test/java/jaxx/runtime/swing/editor/config/model
by tchemit@users.nuiton.org 08 Aug '12
by tchemit@users.nuiton.org 08 Aug '12
08 Aug '12
Author: tchemit
Date: 2012-08-08 14:23:08 +0200 (Wed, 08 Aug 2012)
New Revision: 2479
Url: http://nuiton.org/repositories/revision/jaxx/2479
Log:
fixes #2237: The Class type in configuration is not properly saved
fixes #2238: Improve ConfigUI to use configuration with no inheritanceon ApplicationConfig
Added:
trunk/jaxx-widgets/src/test/java/jaxx/runtime/swing/editor/config/model/MyDelegateConfig.java
trunk/jaxx-widgets/src/test/java/jaxx/runtime/swing/editor/config/model/MyDelegateConfigTest.java
trunk/jaxx-widgets/src/test/java/jaxx/runtime/swing/editor/config/model/MyInheritedConfig.java
trunk/jaxx-widgets/src/test/java/jaxx/runtime/swing/editor/config/model/MyInheritedConfigTest.java
Removed:
trunk/jaxx-widgets/src/test/java/jaxx/runtime/swing/editor/config/model/ConfigUIModelBuilderTest.java
trunk/jaxx-widgets/src/test/java/jaxx/runtime/swing/editor/config/model/MyConfig.java
Modified:
trunk/jaxx-demo/src/main/java/jaxx/demo/DemoConfig.java
trunk/jaxx-demo/src/main/java/jaxx/demo/DemoUI.css
trunk/jaxx-demo/src/main/java/jaxx/demo/DemoUIHandler.java
trunk/jaxx-demo/src/main/java/jaxx/demo/RunDemo.java
trunk/jaxx-demo/src/main/resources/i18n/jaxx-demo_en_GB.properties
trunk/jaxx-demo/src/main/resources/i18n/jaxx-demo_es_ES.properties
trunk/jaxx-demo/src/main/resources/i18n/jaxx-demo_fr_FR.properties
trunk/jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/config/ConfigCategoryUIHandler.java
trunk/jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/config/ConfigTableRenderer.java
trunk/jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/config/ConfigUIHelper.java
trunk/jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/config/model/CategoryModel.java
trunk/jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/config/model/ConfigUIModel.java
trunk/jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/config/model/ConfigUIModelBuilder.java
Modified: trunk/jaxx-demo/src/main/java/jaxx/demo/DemoConfig.java
===================================================================
--- trunk/jaxx-demo/src/main/java/jaxx/demo/DemoConfig.java 2012-08-08 12:22:10 UTC (rev 2478)
+++ trunk/jaxx-demo/src/main/java/jaxx/demo/DemoConfig.java 2012-08-08 12:23:08 UTC (rev 2479)
@@ -25,20 +25,28 @@
package jaxx.demo;
-import java.beans.PropertyChangeListener;
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.Locale;
-import java.util.Properties;
-import javax.swing.KeyStroke;
+import com.google.common.base.Supplier;
import jaxx.demo.feature.nav.NavDemo;
import jaxx.runtime.JAXXUtil;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
+import org.jdesktop.beans.AbstractBean;
import org.nuiton.util.ApplicationConfig;
+import org.nuiton.util.ArgumentsParserException;
import org.nuiton.util.Version;
import org.nuiton.util.VersionUtil;
+import javax.swing.KeyStroke;
+import java.awt.Color;
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URL;
+import java.util.Date;
+import java.util.Locale;
+import java.util.Properties;
+
import static org.nuiton.i18n.I18n._;
/**
@@ -49,10 +57,10 @@
* @author tchemit <chemit(a)codelutin.com>
* @since 1.7.2
*/
-public class DemoConfig extends ApplicationConfig {
+public class DemoConfig extends AbstractBean implements Supplier<ApplicationConfig> {
/** Logger */
- static private Log log = LogFactory.getLog(DemoConfig.class);
+ private static final Log log = LogFactory.getLog(DemoConfig.class);
/**
* le fichier de configuration de l'application avec les informations sur
@@ -66,16 +74,28 @@
public static final String PROPERTY_FONT_SIZE = "fontSize";
+ public static final String PROPERTY_DEMO_COLOR = "demoColor";
+
+ public static final String PROPERTY_DEMO_CLASS = "demoClass";
+
public static final String PROPERTY_LOG_LEVEL = "logLevel";
public static final String PROPERTY_LOG_PATTERN_LAYOUT = "logPatternLayout";
public static final String PROPERTY_KEY_OPEN_CONFIG = "keyOpenConfig";
- public DemoConfig() {
+ private final ApplicationConfig applicationConfig;
- setConfigFileName(Option.CONFIG_FILE.defaultValue);
+ @Override
+ public ApplicationConfig get() {
+ return applicationConfig;
+ }
+ public DemoConfig(String... args) {
+
+ applicationConfig = new ApplicationConfig();
+ applicationConfig.setConfigFileName(Option.CONFIG_FILE.defaultValue);
+
// chargement de la configuration interne
InputStream stream =
@@ -90,79 +110,156 @@
if (log.isDebugEnabled()) {
log.debug("install properties " + k + " : " + value);
}
- setDefaultOption(key, "" + value);
+ applicationConfig.setDefaultOption(key, "" + value);
}
} catch (IOException ex) {
throw new RuntimeException(ex);
}
- for (Option o : Option.values()) {
- setDefaultOption(o.key, o.defaultValue);
- }
+ applicationConfig.loadDefaultOptions(Option.values());
// on supprime le stamp de snapshot s'il existe
String sVersion = VersionUtil.removeSnapshot(
- getOption("application.version"));
+ applicationConfig.getOption("application.version"));
Version version = VersionUtil.valueOf(sVersion);
- setDefaultOption("version", version.getVersion());
+ applicationConfig.setDefaultOption("version", version.getVersion());
installSaveUserAction(PROPERTY_FULLSCREEN,
PROPERTY_FONT_SIZE,
- PROPERTY_LOCALE);
+ PROPERTY_LOCALE,
+ PROPERTY_DEMO_CLASS,
+ PROPERTY_DEMO_COLOR);
+
+ try {
+ applicationConfig.parse(args);
+ } catch (ArgumentsParserException e) {
+ throw new IllegalStateException("Could not parse configuration",e);
+ }
}
+ /**
+ * TODO Remove this when the method in ApplicationConfig will be public
+ * <p/>
+ * Action to save user configuration.
+ * <p/>
+ * Add it as a listener of the configuration for a given property.
+ * <p/>
+ * <b>Note:</b> Will not save if {@link ApplicationConfig#isAdjusting()} is {@code true}.
+ *
+ * @since 2.5.4
+ */
+ private final PropertyChangeListener saveUserAction =
+ new PropertyChangeListener() {
+
+ @Override
+ public void propertyChange(PropertyChangeEvent evt) {
+ if (applicationConfig.isAdjusting()) {
+ if (log.isDebugEnabled()) {
+ log.debug("Skip save while adjusting");
+ }
+ } else {
+ if (log.isDebugEnabled()) {
+ log.debug("Saving configuration fired by property [" +
+ evt.getPropertyName() + "] at " +
+ new Date());
+ }
+ saveForUser();
+ }
+ }
+ };
+
+ /**
+ * TODO Remove this when the method in ApplicationConfig will be public
+ * <p/>
+ * Install the {@link #saveUserAction} on givne {@code properties}.
+ *
+ * @param properties properties on which insalls the saveUserAction
+ */
+ protected void installSaveUserAction(String... properties) {
+
+ // pass in adjusting state
+ applicationConfig.setAdjusting(true);
+
+ try {
+ // ajout de tous les listeners pour sauver la configuration
+ // lors de la modification des options de la configuration
+ for (String propertyKey : properties) {
+ // add a listener
+ if (log.isDebugEnabled()) {
+ log.debug("register saveUserAction on property [" +
+ propertyKey + ']');
+ }
+ addPropertyChangeListener(propertyKey, saveUserAction);
+ }
+ } finally {
+
+ // ok back to normal adjusting state
+ applicationConfig.setAdjusting(false);
+ }
+ }
+
public String getCopyrightText() {
return "Version " + getVersion() + " Codelutin @ 2008-2009";
}
/** @return la version de l'application. */
public Version getVersion() {
- Version option = getOption(Version.class, "version");
+ Version option = applicationConfig.getOption(Version.class, "version");
return option;
}
public boolean isFullScreen() {
- Boolean result = getOptionAsBoolean(Option.FULL_SCREEN.key);
+ Boolean result = applicationConfig.getOptionAsBoolean(Option.FULL_SCREEN.key);
return result != null && result;
}
public Locale getLocale() {
- Locale result = getOption(Locale.class, Option.LOCALE.key);
+ Locale result = applicationConfig.getOption(Locale.class, Option.LOCALE.key);
return result;
}
public String getDemoPath() {
- String result = getOption(Option.DEMO_PATH.key);
+ String result = applicationConfig.getOption(Option.DEMO_PATH.key);
return result;
}
public Float getFontSize() {
- Float result = getOption(Float.class, Option.FONT_SIZE.key);
+ Float result = applicationConfig.getOption(Float.class, Option.FONT_SIZE.key);
return result;
}
+ public Color getDemoColor() {
+ Color result = applicationConfig.getOptionAsColor(Option.DEMO_COLOR.key);
+ return result;
+ }
+
+ public Class<?> getDemoClass() {
+ Class<?> result = applicationConfig.getOptionAsClass(Option.DEMO_CLASS.key);
+ return result;
+ }
+
public String getLogLevel() {
- String level = getOption(Option.LOG_LEVEL.key);
+ String level = applicationConfig.getOption(Option.LOG_LEVEL.key);
return level;
}
public String getLogPatternLayout() {
- String result = getOption(Option.LOG_PATTERN_LAYOUT.key);
+ String result = applicationConfig.getOption(Option.LOG_PATTERN_LAYOUT.key);
return result;
}
public KeyStroke getKeyOpenConfig() {
- return getOptionAsKeyStroke(Option.KEY_OPEN_CONFIG.key);
+ return applicationConfig.getOptionAsKeyStroke(Option.KEY_OPEN_CONFIG.key);
}
public void setFullscreen(boolean fullscreen) {
Object oldValue = null;
- setOption(Option.FULL_SCREEN.key, fullscreen + "");
+ applicationConfig.setOption(Option.FULL_SCREEN.key, fullscreen + "");
firePropertyChange(PROPERTY_FULLSCREEN, oldValue, fullscreen);
}
public void setLocale(Locale newLocale) {
- setOption(Option.LOCALE.key, newLocale.toString());
+ applicationConfig.setOption(Option.LOCALE.key, newLocale.toString());
firePropertyChange(PROPERTY_LOCALE, null, newLocale);
}
@@ -171,54 +268,69 @@
if (log.isDebugEnabled()) {
log.debug("changing font-size to " + newFontSize);
}
- setOption(Option.FONT_SIZE.key, newFontSize.toString());
+ applicationConfig.setOption(Option.FONT_SIZE.key, newFontSize.toString());
firePropertyChange(PROPERTY_FONT_SIZE, oldValue, newFontSize);
}
+ public void setDemoColor(Color color) {
+ Color oldValue = getDemoColor();
+ if (log.isDebugEnabled()) {
+ log.debug("changing demo-color to " + color);
+ }
+ applicationConfig.setOption(Option.DEMO_COLOR.key, color.toString());
+ firePropertyChange(PROPERTY_DEMO_COLOR, oldValue, color);
+ }
+
+ public void setDemoClass(Class<?> newClass) {
+ Class<?> oldValue = getDemoClass();
+ if (log.isDebugEnabled()) {
+ log.debug("changing demo-class to " + newClass);
+ }
+ applicationConfig.setOption(Option.DEMO_CLASS.key, newClass.getName());
+ firePropertyChange(PROPERTY_DEMO_CLASS, oldValue, newClass);
+ }
+
public void setLogLevel(String logLevel) {
String oldValue = getLogLevel();
- setOption(Option.LOG_LEVEL.key, logLevel);
+ applicationConfig.setOption(Option.LOG_LEVEL.key, logLevel);
firePropertyChange(PROPERTY_LOG_LEVEL, oldValue, logLevel);
}
public void setLogPatternLayout(String logPatternLayout) {
String oldValue = getLogPatternLayout();
- setOption(Option.LOG_PATTERN_LAYOUT.key, logPatternLayout);
+ applicationConfig.setOption(Option.LOG_PATTERN_LAYOUT.key, logPatternLayout);
firePropertyChange(PROPERTY_LOG_PATTERN_LAYOUT, oldValue, logPatternLayout);
}
public void setKeyOpenConfig(KeyStroke keyStroke) {
KeyStroke oldValue = getKeyOpenConfig();
- setOption(Option.KEY_OPEN_CONFIG.key, keyStroke.toString());
+ applicationConfig.setOption(Option.KEY_OPEN_CONFIG.key, keyStroke.toString());
firePropertyChange(PROPERTY_KEY_OPEN_CONFIG, oldValue, keyStroke);
}
- /**
- * Save configuration, in user home directory using the
- * {@link #getConfigFileName}. Default, env and commande line note saved
- */
+
public void saveForUser() {
// shoudl we never save any conf ?
- super.saveForUser();
+ applicationConfig.saveForUser();
}
public static final String[] DEFAULT_JAXX_PCS = {
PROPERTY_FULLSCREEN,
PROPERTY_LOCALE,
PROPERTY_FONT_SIZE,
- ADJUSTING_PROPERTY
+ ApplicationConfig.ADJUSTING_PROPERTY
};
public void removeJaxxPropertyChangeListener() {
PropertyChangeListener[] toRemove;
toRemove = JAXXUtil.findJaxxPropertyChangeListener(
DEFAULT_JAXX_PCS,
- getPropertyChangeListeners());
+ applicationConfig.getPropertyChangeListeners());
if (toRemove == null || toRemove.length == 0) {
return;
}
if (log.isDebugEnabled()) {
- log.debug("before remove : " + getPropertyChangeListeners().length);
+ log.debug("before remove : " + applicationConfig.getPropertyChangeListeners().length);
log.debug("toRemove : " + toRemove.length);
}
for (PropertyChangeListener listener : toRemove) {
@@ -229,14 +341,30 @@
}
}
+ public URL getApplicationSiteUrl() {
+ return applicationConfig.getOptionAsURL("application.site.url");
+ }
+
+ public String getIconPath() {
+ return applicationConfig.getOption("application.icon.path");
+ }
+
+ public String getLicensePath() {
+ return applicationConfig.getOption("application.license.path");
+ }
+
+ public String getThirdParty() {
+ return applicationConfig.getOption("application.third-party.path");
+ }
+
//////////////////////////////////////////////////
// Toutes les options disponibles
//////////////////////////////////////////////////
- public enum Option implements OptionDef {
+ public enum Option implements ApplicationConfig.OptionDef {
CONFIG_FILE(
- CONFIG_FILE_NAME,
+ ApplicationConfig.CONFIG_FILE_NAME,
_("jaxxdemo.config.configFileName.description"),
"jaxxdemo",
String.class,
@@ -263,6 +391,21 @@
Float.class,
false,
false),
+ DEMO_COLOR(
+ "ui." + PROPERTY_DEMO_COLOR,
+ _("jaxxdemo.config.ui.demoColor"),
+ "#ffffff",
+ Color.class,
+ false,
+ false),
+ DEMO_CLASS(
+ "ui." + PROPERTY_DEMO_CLASS,
+ _("jaxxdemo.config.ui.demoClass"),
+ "java.io.File",
+ Class.class,
+ false,
+ false),
+
LOG_LEVEL(
"ui." + PROPERTY_LOG_LEVEL,
_("jaxxdemo.config.ui.logLevel"),
Modified: trunk/jaxx-demo/src/main/java/jaxx/demo/DemoUI.css
===================================================================
--- trunk/jaxx-demo/src/main/java/jaxx/demo/DemoUI.css 2012-08-08 12:22:10 UTC (rev 2478)
+++ trunk/jaxx-demo/src/main/java/jaxx/demo/DemoUI.css 2012-08-08 12:23:08 UTC (rev 2479)
@@ -37,7 +37,7 @@
#mainFrame {
title:"JAXX Demo";
- iconImage:{SwingUtil.createIcon(getConfig().getOption("application.icon.path")).getImage()};
+ iconImage:{SwingUtil.createIcon(getConfig().getIconPath()).getImage()};
undecorated:{getConfig().isFullScreen()};
}
Modified: trunk/jaxx-demo/src/main/java/jaxx/demo/DemoUIHandler.java
===================================================================
--- trunk/jaxx-demo/src/main/java/jaxx/demo/DemoUIHandler.java 2012-08-08 12:22:10 UTC (rev 2478)
+++ trunk/jaxx-demo/src/main/java/jaxx/demo/DemoUIHandler.java 2012-08-08 12:23:08 UTC (rev 2479)
@@ -44,25 +44,6 @@
*/
package jaxx.demo;
-import java.awt.Component;
-import java.awt.Desktop;
-import java.awt.event.ActionEvent;
-import java.beans.PropertyChangeEvent;
-import java.beans.PropertyChangeListener;
-import java.lang.reflect.Constructor;
-import java.net.URL;
-import java.util.Arrays;
-import java.util.Locale;
-import javax.swing.AbstractAction;
-import javax.swing.InputMap;
-import javax.swing.JComponent;
-import javax.swing.JPanel;
-import javax.swing.JTree;
-import javax.swing.KeyStroke;
-import javax.swing.SwingUtilities;
-import javax.swing.event.TreeSelectionEvent;
-import javax.swing.event.TreeSelectionListener;
-import javax.swing.tree.TreePath;
import jaxx.demo.tree.DemoNode;
import jaxx.demo.tree.DemoTreeHelper;
import jaxx.runtime.JAXXContext;
@@ -81,6 +62,26 @@
import org.nuiton.i18n.I18n;
import org.nuiton.util.decorator.DecoratorProvider;
+import javax.swing.AbstractAction;
+import javax.swing.InputMap;
+import javax.swing.JComponent;
+import javax.swing.JPanel;
+import javax.swing.JTree;
+import javax.swing.KeyStroke;
+import javax.swing.SwingUtilities;
+import javax.swing.event.TreeSelectionEvent;
+import javax.swing.event.TreeSelectionListener;
+import javax.swing.tree.TreePath;
+import java.awt.Component;
+import java.awt.Desktop;
+import java.awt.event.ActionEvent;
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
+import java.lang.reflect.Constructor;
+import java.net.URL;
+import java.util.Arrays;
+import java.util.Locale;
+
import static org.nuiton.i18n.I18n._;
import static org.nuiton.i18n.I18n.n_;
@@ -477,28 +478,36 @@
helper.addCategory(n_("jaxxdemo.config.category.other"),
n_("jaxxdemo.config.category.other.description"));
- helper.addOption(DemoConfig.Option.FULL_SCREEN);
- helper.setOptionPropertyName(DemoConfig.PROPERTY_FULLSCREEN);
+ helper.addOption(DemoConfig.Option.FULL_SCREEN,
+ DemoConfig.PROPERTY_FULLSCREEN);
helper.setOptionCallBack("ui");
- helper.addOption(DemoConfig.Option.FONT_SIZE);
- helper.setOptionPropertyName(DemoConfig.PROPERTY_FONT_SIZE);
- helper.setOptionCallBack("application");
+ helper.addOption(DemoConfig.Option.FONT_SIZE,
+ DemoConfig.PROPERTY_FONT_SIZE);
+ helper.setOptionCallBack("ui");
- helper.addOption(DemoConfig.Option.LOCALE);
- helper.setOptionPropertyName(DemoConfig.PROPERTY_LOCALE);
+ helper.addOption(DemoConfig.Option.LOCALE,
+ DemoConfig.PROPERTY_LOCALE);
helper.setOptionCallBack("ui");
- helper.addOption(DemoConfig.Option.KEY_OPEN_CONFIG);
- helper.setOptionPropertyName(DemoConfig.PROPERTY_KEY_OPEN_CONFIG);
-// helper.setOptionCallBack("keymap");
+ helper.addOption(DemoConfig.Option.DEMO_COLOR,
+ DemoConfig.PROPERTY_DEMO_COLOR);
+ helper.setOptionCallBack("ui");
- helper.addOption(DemoConfig.Option.LOG_LEVEL);
- helper.setOptionPropertyName(DemoConfig.PROPERTY_LOG_LEVEL);
+ helper.addOption(DemoConfig.Option.DEMO_CLASS,
+ DemoConfig.PROPERTY_DEMO_CLASS);
+ helper.setOptionCallBack("ui");
+
+ helper.addOption(DemoConfig.Option.KEY_OPEN_CONFIG,
+ DemoConfig.PROPERTY_KEY_OPEN_CONFIG);
+ helper.setOptionCallBack("ui");
+
+ helper.addOption(DemoConfig.Option.LOG_LEVEL,
+ DemoConfig.PROPERTY_LOG_LEVEL);
helper.setOptionCallBack("log");
- helper.addOption(DemoConfig.Option.LOG_PATTERN_LAYOUT);
- helper.setOptionPropertyName(DemoConfig.PROPERTY_LOG_PATTERN_LAYOUT);
+ helper.addOption(DemoConfig.Option.LOG_PATTERN_LAYOUT,
+ DemoConfig.PROPERTY_LOG_PATTERN_LAYOUT);
helper.setOptionCallBack("log");
helper.buildUI(context, "jaxxdemo.config.category.other");
@@ -531,7 +540,7 @@
DemoUI ui = getUI(context);
DemoConfig config = ui.getConfig();
- URL siteURL = config.getOptionAsURL("application.site.url");
+ URL siteURL = config.getApplicationSiteUrl();
log.info(_("jaxxdemo.message.goto.site", siteURL));
@@ -552,9 +561,9 @@
DemoConfig config = ui.getConfig();
- String iconPath = config.getOption("application.icon.path");
- String licensePath = config.getOption("application.license.path");
- String thirdPartyPath = config.getOption("application.third-party.path");
+ String iconPath = config.getIconPath();
+ String licensePath = config.getLicensePath();
+ String thirdPartyPath = config.getThirdParty();
AboutPanel about = new AboutPanel();
about.setTitle(_("jaxxdemo.title.about"));
Modified: trunk/jaxx-demo/src/main/java/jaxx/demo/RunDemo.java
===================================================================
--- trunk/jaxx-demo/src/main/java/jaxx/demo/RunDemo.java 2012-08-08 12:22:10 UTC (rev 2478)
+++ trunk/jaxx-demo/src/main/java/jaxx/demo/RunDemo.java 2012-08-08 12:23:08 UTC (rev 2479)
@@ -25,8 +25,6 @@
package jaxx.demo;
-import java.util.Arrays;
-import java.util.Date;
import jaxx.demo.entities.DemoDecoratorProvider;
import jaxx.demo.tree.DemoDataProvider;
import jaxx.demo.tree.DemoTreeHelper;
@@ -41,6 +39,9 @@
import org.nuiton.util.StringUtil;
import org.nuiton.util.decorator.DecoratorProvider;
+import java.util.Arrays;
+import java.util.Date;
+
import static org.nuiton.i18n.I18n._;
/** @author tchemit <chemit(a)codelutin.com> */
@@ -78,9 +79,9 @@
rootContext.setContextValue(new DemoTreeHelper(new DemoDataProvider()));
// init config
- DemoConfig config = new DemoConfig();
- config.parse(args);
+ DemoConfig config = new DemoConfig(args);
+
// share the config
rootContext.setContextValue(config);
Modified: trunk/jaxx-demo/src/main/resources/i18n/jaxx-demo_en_GB.properties
===================================================================
--- trunk/jaxx-demo/src/main/resources/i18n/jaxx-demo_en_GB.properties 2012-08-08 12:22:10 UTC (rev 2478)
+++ trunk/jaxx-demo/src/main/resources/i18n/jaxx-demo_en_GB.properties 2012-08-08 12:23:08 UTC (rev 2479)
@@ -194,6 +194,8 @@
jaxxdemo.config.category.other.description=Others preferences
jaxxdemo.config.configFileName.description=Configuration file name
jaxxdemo.config.ui.demo.path=Path of demo to select when starting application
+jaxxdemo.config.ui.demoClass=
+jaxxdemo.config.ui.demoColor=
jaxxdemo.config.ui.fontSize=default font size to use in sources
jaxxdemo.config.ui.fullscreen=To change the screen mode (true for full screen)
jaxxdemo.config.ui.keyOpenConfig=To change key for open config ui
Modified: trunk/jaxx-demo/src/main/resources/i18n/jaxx-demo_es_ES.properties
===================================================================
--- trunk/jaxx-demo/src/main/resources/i18n/jaxx-demo_es_ES.properties 2012-08-08 12:22:10 UTC (rev 2478)
+++ trunk/jaxx-demo/src/main/resources/i18n/jaxx-demo_es_ES.properties 2012-08-08 12:23:08 UTC (rev 2479)
@@ -197,6 +197,8 @@
jaxxdemo.config.category.other.description=Autres options
jaxxdemo.config.configFileName.description=Le nom du fichier de configuration
jaxxdemo.config.ui.demo.path=Chemin de la démo par défaut
+jaxxdemo.config.ui.demoClass=
+jaxxdemo.config.ui.demoColor=
jaxxdemo.config.ui.fontSize=La taille de la police à utiliser pour visualiser dans les sources
jaxxdemo.config.ui.fullscreen=Pour afficher l'aplication en mode pleine écran
jaxxdemo.config.ui.keyOpenConfig=Pour changer le racourcie clavier pour ouvrir l'écran de configuration
Modified: trunk/jaxx-demo/src/main/resources/i18n/jaxx-demo_fr_FR.properties
===================================================================
--- trunk/jaxx-demo/src/main/resources/i18n/jaxx-demo_fr_FR.properties 2012-08-08 12:22:10 UTC (rev 2478)
+++ trunk/jaxx-demo/src/main/resources/i18n/jaxx-demo_fr_FR.properties 2012-08-08 12:23:08 UTC (rev 2479)
@@ -194,6 +194,8 @@
jaxxdemo.config.category.other.description=Autres options
jaxxdemo.config.configFileName.description=Le nom du fichier de configuration
jaxxdemo.config.ui.demo.path=Chemin de la démo par défaut
+jaxxdemo.config.ui.demoClass=
+jaxxdemo.config.ui.demoColor=
jaxxdemo.config.ui.fontSize=La taille de la police à utiliser pour visualiser dans les sources
jaxxdemo.config.ui.fullscreen=Pour afficher l'aplication en mode pleine écran
jaxxdemo.config.ui.keyOpenConfig=Pour changer le racourcie clavier pour ouvrir l'écran de configuration
Modified: trunk/jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/config/ConfigCategoryUIHandler.java
===================================================================
--- trunk/jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/config/ConfigCategoryUIHandler.java 2012-08-08 12:22:10 UTC (rev 2478)
+++ trunk/jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/config/ConfigCategoryUIHandler.java 2012-08-08 12:23:08 UTC (rev 2479)
@@ -26,6 +26,7 @@
import jaxx.runtime.SwingUtil;
import jaxx.runtime.swing.editor.config.model.ConfigTableModel;
import jaxx.runtime.swing.editor.config.model.OptionModel;
+import jaxx.runtime.swing.renderer.ClassTableCellRenderer;
import jaxx.runtime.swing.renderer.ColorCellRenderer;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -72,7 +73,6 @@
n_("config.defaultValue.tip"));
ConfigTableRenderer renderer = new ConfigTableRenderer();
- ColorCellRenderer colorCellRenderer = new ColorCellRenderer();
SwingUtil.setTableColumnRenderer(table, 0, renderer);
SwingUtil.setTableColumnRenderer(table, 1, renderer);
SwingUtil.setTableColumnRenderer(table, 2, renderer);
@@ -80,7 +80,8 @@
int width = SwingUtil.computeTableColumnWidth(table, f, 0, "___*");
SwingUtil.fixTableColumnWidth(table, 0, width);
SwingUtil.setTableColumnEditor(table, 1, new ConfigTableEditor((ConfigTableModel) table.getModel()));
- table.setDefaultRenderer(Color.class, colorCellRenderer);
+ table.setDefaultRenderer(Color.class, new ColorCellRenderer());
+ table.setDefaultRenderer(Class.class, new ClassTableCellRenderer());
}
public void updateDescriptionText() {
Modified: trunk/jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/config/ConfigTableRenderer.java
===================================================================
--- trunk/jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/config/ConfigTableRenderer.java 2012-08-08 12:22:10 UTC (rev 2478)
+++ trunk/jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/config/ConfigTableRenderer.java 2012-08-08 12:23:08 UTC (rev 2479)
@@ -43,7 +43,8 @@
* ##%* */
package jaxx.runtime.swing.editor.config;
-import static org.nuiton.i18n.I18n._;
+import jaxx.runtime.swing.editor.config.model.ConfigTableModel;
+import jaxx.runtime.swing.editor.config.model.OptionModel;
import javax.swing.JComponent;
import javax.swing.JTable;
@@ -52,9 +53,9 @@
import java.awt.Color;
import java.awt.Component;
import java.awt.Font;
-import jaxx.runtime.swing.editor.config.model.ConfigTableModel;
-import jaxx.runtime.swing.editor.config.model.OptionModel;
+import static org.nuiton.i18n.I18n._;
+
/**
* Pour le rendu du tableau des options d'une categorie
*
@@ -86,7 +87,7 @@
font = getFont();
font2 = font.deriveFont(Font.ITALIC | Font.BOLD);
}
- Component cellRenderer = null;
+ Component cellRenderer;
switch (modelColumn) {
case 0:
cellRenderer = getKeyCellRenderer(table, value, isSelected, hasFocus, modelRow, modelColumn, key, isValid, isModified);
Modified: trunk/jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/config/ConfigUIHelper.java
===================================================================
--- trunk/jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/config/ConfigUIHelper.java 2012-08-08 12:22:10 UTC (rev 2478)
+++ trunk/jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/config/ConfigUIHelper.java 2012-08-08 12:23:08 UTC (rev 2479)
@@ -25,6 +25,7 @@
*/
package jaxx.runtime.swing.editor.config;
+import com.google.common.base.Supplier;
import jaxx.runtime.JAXXContext;
import jaxx.runtime.context.JAXXInitialContext;
import jaxx.runtime.swing.editor.config.model.CallBackFinalizer;
@@ -60,6 +61,11 @@
protected ConfigUI ui;
+ public ConfigUIHelper(Supplier<ApplicationConfig> config) {
+ modelBuilder = new ConfigUIModelBuilder();
+ modelBuilder.createModel(config);
+ }
+
public ConfigUIHelper(ApplicationConfig config) {
modelBuilder = new ConfigUIModelBuilder();
modelBuilder.createModel(config);
Modified: trunk/jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/config/model/CategoryModel.java
===================================================================
--- trunk/jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/config/model/CategoryModel.java 2012-08-08 12:22:10 UTC (rev 2478)
+++ trunk/jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/config/model/CategoryModel.java 2012-08-08 12:23:08 UTC (rev 2479)
@@ -76,7 +76,9 @@
}
@Deprecated
- public CategoryModel(String category, String categoryLabel, OptionModel[] entries) {
+ public CategoryModel(String category,
+ String categoryLabel,
+ OptionModel[] entries) {
this.category = category;
this.categoryLabel = categoryLabel;
this.entries = Collections.unmodifiableList(Arrays.asList(entries));
@@ -116,6 +118,16 @@
return valid;
}
+ public OptionModel getOptionModel(String optionModelKey) {
+ OptionModel result = null;
+ for (OptionModel optionModel : this) {
+ if (optionModelKey.endsWith(optionModel.getKey())) {
+ result = optionModel;
+ break;
+ }
+ }
+ return result;
+ }
public void setValue(OptionModel key, Object val) {
boolean wasModified = isModified();
boolean wasValid = isValid();
Modified: trunk/jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/config/model/ConfigUIModel.java
===================================================================
--- trunk/jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/config/model/ConfigUIModel.java 2012-08-08 12:22:10 UTC (rev 2478)
+++ trunk/jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/config/model/ConfigUIModel.java 2012-08-08 12:23:08 UTC (rev 2479)
@@ -25,6 +25,7 @@
package jaxx.runtime.swing.editor.config.model;
+import com.google.common.base.Supplier;
import jaxx.runtime.JAXXUtil;
import org.apache.commons.beanutils.PropertyUtils;
import org.nuiton.util.ApplicationConfig;
@@ -55,8 +56,11 @@
protected final Map<String, CategoryModel> categories;
/** La configuration de l'application */
- protected final ApplicationConfig config;
+ protected final Object configBean;
+ /** La configuration de l'application */
+ protected final ApplicationConfig applicationConfig;
+
/** la cateogrie en cours d'utilisation */
protected CategoryModel categoryModel;
@@ -83,6 +87,7 @@
/**
* optional action to execute (if not null) if no call backs fits.
+ *
* @since 1.4.2
*/
protected Runnable closeAction;
@@ -90,8 +95,17 @@
/** support of modification notifications */
protected final PropertyChangeSupport pcs;
- public ConfigUIModel(ApplicationConfig config) {
- this.config = config;
+ public ConfigUIModel(Supplier<ApplicationConfig> config) {
+ this(config, config.get());
+ }
+
+ public ConfigUIModel(ApplicationConfig applicationConfig) {
+ this(applicationConfig, applicationConfig);
+ }
+
+ public ConfigUIModel(Object configBean, ApplicationConfig applicationConfig) {
+ this.configBean = configBean;
+ this.applicationConfig = applicationConfig;
categories = new LinkedHashMap<String, CategoryModel>();
callBacksManager = new CallBacksManager();
pcs = new PropertyChangeSupport(this);
@@ -168,7 +182,7 @@
}
public void setCloseAction(Runnable closeAction) {
- this.closeAction=closeAction;
+ this.closeAction = closeAction;
}
/**
@@ -215,7 +229,7 @@
// compute transients keys (to never be saved)
List<String> transients = new ArrayList<String>();
- config.setAdjusting(true);
+ applicationConfig.setAdjusting(true);
try {
for (OptionModel option : categoryModel) {
@@ -225,7 +239,7 @@
// this is a javaBean option, push value via mutator
try {
- PropertyUtils.setProperty(config,
+ PropertyUtils.setProperty(configBean,
option.getPropertyName(), value);
} catch (Exception e) {
throw new RuntimeException(
@@ -237,8 +251,9 @@
// simple option with no javabeans, just push the option
// value
- config.setOption(option.getKey(), value == null ?
- null : value.toString());
+ applicationConfig.setOption(option.getKey(),
+ value == null ?
+ null : value.toString());
}
// l'option a été sauvegardée, on la marque
option.setSaved(true);
@@ -250,12 +265,12 @@
}
}
} finally {
- config.setAdjusting(false);
+ applicationConfig.setAdjusting(false);
}
setSaved(true);
// save config
- config.saveForUser(transients.toArray(new String[transients.size()]));
+ applicationConfig.saveForUser(transients.toArray(new String[transients.size()]));
// notify data has changed
categoryModel.firePropertyChange(
CategoryModel.MODIFIED_PROPERTY_NAME,
@@ -344,10 +359,22 @@
destroy();
}
+ /**
+ * @return the underlined application config
+ * @deprecated since 2.5.4 use now {@link #getApplicationConfig()}.
+ */
protected ApplicationConfig getConfig() {
- return config;
+ return applicationConfig;
}
+ /**
+ * @return the underlined application config
+ * @since 2.5.4
+ */
+ protected ApplicationConfig getApplicationConfig() {
+ return applicationConfig;
+ }
+
protected CallBacksManager getCallBacksManager() {
return callBacksManager;
}
Modified: trunk/jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/config/model/ConfigUIModelBuilder.java
===================================================================
--- trunk/jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/config/model/ConfigUIModelBuilder.java 2012-08-08 12:22:10 UTC (rev 2478)
+++ trunk/jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/config/model/ConfigUIModelBuilder.java 2012-08-08 12:23:08 UTC (rev 2479)
@@ -24,6 +24,7 @@
*/
package jaxx.runtime.swing.editor.config.model;
+import com.google.common.base.Supplier;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.nuiton.util.ApplicationConfig;
@@ -39,8 +40,10 @@
* @since 2.0.0
*/
public class ConfigUIModelBuilder {
+
/** Logger */
- private static final Log log = LogFactory.getLog(ConfigUIModelBuilder.class);
+ private static final Log log =
+ LogFactory.getLog(ConfigUIModelBuilder.class);
/** current model used */
ConfigUIModel model;
@@ -58,6 +61,23 @@
* @throws IllegalStateException if there is already a current model
* @throws NullPointerException if config is {@code null}
*/
+ public void createModel(Supplier<ApplicationConfig> config)
+ throws IllegalStateException, NullPointerException {
+ checkNoCurrent(model, "model");
+ checkNotNull(config, "createModel", "config");
+ model = new ConfigUIModel(config);
+ if (log.isDebugEnabled()) {
+ log.debug("model created : " + model);
+ }
+ }
+
+ /**
+ * Create a new model and set it as current model.
+ *
+ * @param config the configuration used in model
+ * @throws IllegalStateException if there is already a current model
+ * @throws NullPointerException if config is {@code null}
+ */
public void createModel(ApplicationConfig config)
throws IllegalStateException, NullPointerException {
checkNoCurrent(model, "model");
@@ -111,7 +131,7 @@
checkCurrent(category, "category");
checkNotNull(def, "addOption", "def");
flushOption();
- Object value = model.getConfig().getOption(def);
+ Object value = model.getApplicationConfig().getOption(def);
option = new OptionModel(def, value);
if (log.isDebugEnabled()) {
log.debug("option created : " + option);
Deleted: trunk/jaxx-widgets/src/test/java/jaxx/runtime/swing/editor/config/model/ConfigUIModelBuilderTest.java
===================================================================
--- trunk/jaxx-widgets/src/test/java/jaxx/runtime/swing/editor/config/model/ConfigUIModelBuilderTest.java 2012-08-08 12:22:10 UTC (rev 2478)
+++ trunk/jaxx-widgets/src/test/java/jaxx/runtime/swing/editor/config/model/ConfigUIModelBuilderTest.java 2012-08-08 12:23:08 UTC (rev 2479)
@@ -1,298 +0,0 @@
-/*
- * #%L
- * JAXX :: Widgets
- *
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2008 - 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 jaxx.runtime.swing.editor.config.model;
-
-import jaxx.runtime.SwingUtil;
-import jaxx.runtime.swing.editor.MyDefaultCellEditor;
-import org.junit.Assert;
-import org.junit.Before;
-import org.junit.BeforeClass;
-import org.junit.Test;
-
-import javax.swing.*;
-import javax.swing.table.TableCellEditor;
-
-/**
- * Created: 22 déc. 2009
- *
- * @author tchemit <chemit(a)codelutin.com>
- * @since 2.0.0
- */
-public class ConfigUIModelBuilderTest {
-
- ConfigUIModelBuilder builder;
-
- static MyConfig config;
-
- @BeforeClass
- public static void beforeeClass() {
- config = new MyConfig();
- }
-
-
- @Before
- public void setup() {
- builder = new ConfigUIModelBuilder();
- }
-
- @Test(expected = NullPointerException.class)
- public void testCreateModelLimitCase0() throws Exception {
- builder.createModel(null);
- }
-
- @Test(expected = IllegalStateException.class)
- public void testFlushModelLimitCase0() throws Exception {
- builder.flushModel();
- }
-
- @Test
- public void testCreateModel() throws Exception {
- builder.createModel(config);
- ConfigUIModel configModel = builder.flushModel();
- Assert.assertNotNull(configModel);
- Assert.assertNotNull(configModel.getConfig());
- }
-
- @Test(expected = IllegalStateException.class)
- public void testRegisterCallbackLimitCase() throws Exception {
- builder.registerCallBack(null, null, null, null);
- }
-
- @Test(expected = NullPointerException.class)
- public void testRegisterCallbackLimitCase0() throws Exception {
- builder.createModel(config);
- builder.registerCallBack(null, null, null, null);
- }
-
- @Test(expected = NullPointerException.class)
- public void testRegisterCallbackLimitCase1() throws Exception {
- builder.createModel(config);
- builder.registerCallBack("yo", null, null, null);
- }
-
- @Test(expected = NullPointerException.class)
- public void testRegisterCallbackLimitCase2() throws Exception {
- builder.createModel(config);
- builder.registerCallBack("yo", "yo description", null, null);
- }
-
- @Test(expected = NullPointerException.class)
- public void testRegisterCallbackLimitCase4() throws Exception {
- builder.createModel(config);
- Runnable callback = new Runnable() {
-
- @Override
- public void run() {
- }
- };
- builder.registerCallBack("yo", "yo description", null, callback);
- }
-
- @Test
- public void testRegisterCallback() throws Exception {
- builder.createModel(config);
- Runnable callback = new Runnable() {
-
- @Override
- public void run() {
- }
- };
- ImageIcon icon = SwingUtil.createActionIcon("add");
- builder.registerCallBack("yo","yo description", icon, callback);
- ConfigUIModel configModel = builder.flushModel();
- Assert.assertNotNull(configModel);
- Assert.assertNotNull(configModel.getConfig());
- CallBackEntry callBackEntry =
- configModel.getCallBacksManager().getCallBack("yo");
- Assert.assertNotNull(callBackEntry );
-
- Assert.assertEquals(callback, callBackEntry.getAction());
- }
-
- @Test(expected = IllegalStateException.class)
- public void testAddCategoryLimitCase0() throws Exception {
- builder.addCategory(null, null);
- }
-
- @Test(expected = NullPointerException.class)
- public void testAddCategoryLimitCase1() throws Exception {
- builder.createModel(config);
- builder.addCategory(null, null);
- }
-
- @Test(expected = NullPointerException.class)
- public void testAddCategoryLimitCase2() throws Exception {
- builder.createModel(config);
- builder.addCategory("", null);
- }
-
- @Test
- public void testAddCategory() throws Exception {
- builder.createModel(config);
- builder.addCategory("cat0", "cat0 label");
- CategoryModel categoryModel = builder.flushCategory();
- Assert.assertNotNull(categoryModel);
- Assert.assertEquals("cat0", categoryModel.category);
- Assert.assertEquals("cat0 label", categoryModel.categoryLabel);
- Assert.assertEquals(0, categoryModel.entries.size());
-
- }
-
- @Test(expected = IllegalStateException.class)
- public void testAddOptionLimitCase0() throws Exception {
- builder.addOption(null);
- }
-
- @Test(expected = IllegalStateException.class)
- public void testAddOptionLimitCase1() throws Exception {
- builder.createModel(config);
- builder.addOption(null);
- }
-
- @Test(expected = NullPointerException.class)
- public void testAddOptionLimitCase2() throws Exception {
- builder.createModel(config);
- builder.addCategory("cat0", "cat0 label");
- builder.addOption(null);
- }
-
- @Test
- public void testAddOption() throws Exception {
- builder.createModel(config);
- builder.addCategory("cat0", "cat0 label");
- builder.addOption(MyConfig.Option.LOCALE);
- OptionModel optionModel = builder.flushOption();
- Assert.assertNotNull(optionModel);
- Assert.assertEquals(MyConfig.Option.LOCALE, optionModel.def);
-
- CategoryModel categoryModel = builder.flushCategory();
- Assert.assertNotNull(categoryModel);
- Assert.assertEquals("cat0", categoryModel.category);
- Assert.assertEquals("cat0 label", categoryModel.categoryLabel);
- Assert.assertEquals(1, categoryModel.entries.size());
- }
-
- @Test(expected = IllegalStateException.class)
- public void testSetOptionPropertyNameLimitCase0() throws Exception {
- builder.setOptionPropertyName(null);
- }
-
- @Test(expected = IllegalStateException.class)
- public void testSetOptionPropertyNameLimitCase1() throws Exception {
- builder.createModel(config);
- builder.setOptionPropertyName(null);
- }
-
- @Test(expected = IllegalStateException.class)
- public void testSetOptionPropertyNameLimitCase2() throws Exception {
- builder.createModel(config);
- builder.addCategory("cat0", "cat0 label");
- builder.setOptionPropertyName(null);
- }
-
- @Test(expected = NullPointerException.class)
- public void testSetOptionPropertyNameLimitCase3() throws Exception {
- builder.createModel(config);
- builder.addCategory("cat0", "cat0 label");
- builder.addOption(MyConfig.Option.LOCALE);
- builder.setOptionPropertyName(null);
- }
-
- @Test
- public void testSetOptionPropertyName() throws Exception {
- builder.createModel(config);
- builder.addCategory("cat0", "cat0 label");
- builder.addOption(MyConfig.Option.LOCALE);
- builder.setOptionPropertyName(MyConfig.PROPERTY_LOCALE);
- OptionModel optionModel = builder.flushOption();
- Assert.assertNotNull(optionModel);
- Assert.assertEquals(MyConfig.Option.LOCALE, optionModel.def);
- Assert.assertEquals(MyConfig.PROPERTY_LOCALE, optionModel.propertyName);
- Assert.assertNull(optionModel.editor);
- }
-
- @Test(expected = IllegalStateException.class)
- public void testSetOptionEditorLimitCase0() throws Exception {
- builder.setOptionEditor(null);
- }
-
- @Test(expected = IllegalStateException.class)
- public void testSetOptionEditorLimitCase1() throws Exception {
- builder.createModel(config);
- builder.setOptionEditor(null);
- }
-
- @Test(expected = IllegalStateException.class)
- public void testSetOptionEditorLimitCase2() throws Exception {
- builder.createModel(config);
- builder.addCategory("cat0", "cat0 label");
- builder.setOptionEditor(null);
- }
-
-
- @Test(expected = NullPointerException.class)
- public void testSetOptionEditorLimitCase3() throws Exception {
- builder.createModel(config);
- builder.addCategory("cat0", "cat0 label");
- builder.addOption(MyConfig.Option.LOCALE);
- builder.setOptionEditor(null);
- }
-
- @Test
- public void testSetOptionEditor() throws Exception {
- builder.createModel(config);
- builder.addCategory("cat0", "cat0 label");
- builder.addOption(MyConfig.Option.LOCALE);
- TableCellEditor cellEditor = MyDefaultCellEditor.newBooleanEditor();
- builder.setOptionEditor(cellEditor);
- OptionModel optionModel = builder.flushOption();
- Assert.assertNotNull(optionModel);
- Assert.assertEquals(MyConfig.Option.LOCALE, optionModel.def);
- Assert.assertNull(optionModel.propertyName);
- Assert.assertEquals(cellEditor, optionModel.editor);
- }
-
- @Test
- public void testFlushModel() throws Exception {
- builder.createModel(config);
- ConfigUIModel configModel = builder.flushModel();
- Assert.assertNotNull(configModel);
- Assert.assertNull(builder.model);
- }
-
- @Test
- public void testSetModel() throws Exception {
-
- }
-
- @Test
- public void testSetCategory() throws Exception {
- }
-
- @Test
- public void testSetOption() throws Exception {
- }
-
-}
Deleted: trunk/jaxx-widgets/src/test/java/jaxx/runtime/swing/editor/config/model/MyConfig.java
===================================================================
--- trunk/jaxx-widgets/src/test/java/jaxx/runtime/swing/editor/config/model/MyConfig.java 2012-08-08 12:22:10 UTC (rev 2478)
+++ trunk/jaxx-widgets/src/test/java/jaxx/runtime/swing/editor/config/model/MyConfig.java 2012-08-08 12:23:08 UTC (rev 2479)
@@ -1,241 +0,0 @@
-/*
- * #%L
- * JAXX :: Widgets
- *
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2008 - 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 jaxx.runtime.swing.editor.config.model;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.nuiton.util.ApplicationConfig;
-
-import java.beans.PropertyChangeEvent;
-import java.beans.PropertyChangeListener;
-import java.util.Date;
-import java.util.Locale;
-
-import static org.nuiton.i18n.I18n._;
-
-/**
- * @author tchemit <chemit(a)codelutin.com>
- * @since 2.0.0
- */
-public class MyConfig extends ApplicationConfig {
-
- /** Logger */
- static private Log log = LogFactory.getLog(MyConfig.class);
-
- public static final String PROPERTY_FULLSCREEN = "fullscreen";
-
- public static final String PROPERTY_LOCALE = "locale";
-
- public static final String PROPERTY_FONT_SIZE = "fontSize";
-
- public static final String PROPERTY_ADJUSTING = "adjusting";
-
- /**
- * un drapeau pour bloquer la sauvegarde lors de la modification en masse des options
- * via les setter.
- */
- protected boolean adjusting;
-
- protected final PropertyChangeListener saveAction = new PropertyChangeListener() {
-
- @Override
- public void propertyChange(PropertyChangeEvent evt) {
- if (adjusting) {
- if (log.isDebugEnabled()) {
- log.debug("skip save while adjusting");
- }
- return;
- }
- if (log.isDebugEnabled()) {
- log.debug("Saving configuration at " + new Date());
- }
- saveForUser();
- }
- };
-
- @Override
- public void saveForUser(String... excludeKeys) {
- // never save anything :)
- }
-
- public MyConfig() {
-
- setConfigFileName(Option.CONFIG_FILE.defaultValue);
-
- // chargement de la configuration interne
-
- for (Option o : Option.values()) {
- setDefaultOption(o.key, o.defaultValue);
- }
-
- adjusting = true;
- addPropertyChangeListener(PROPERTY_FULLSCREEN, saveAction);
- addPropertyChangeListener(PROPERTY_FONT_SIZE, saveAction);
- addPropertyChangeListener(PROPERTY_LOCALE, saveAction);
- adjusting = false;
- }
-
- @Override
- public void setOption(String key, String value) {
- if (key.equals(PROPERTY_ADJUSTING)) {
- setAdjusting(Boolean.valueOf(value));
- return;
- }
- super.setOption(key, value);
- }
-
-
- public boolean isFullScreen() {
- Boolean result = getOptionAsBoolean(Option.FULL_SCREEN.key);
- return result != null && result;
- }
-
- public Locale getLocale() {
- Locale result = getOption(Locale.class, Option.LOCALE.key);
- return result;
- }
-
- public Float getFontSize() {
- Float result = getOption(Float.class, Option.FONT_SIZE.key);
- return result;
- }
-
- public void setFullscreen(boolean fullscreen) {
- Object oldValue = null;
- setOption(Option.FULL_SCREEN.key, fullscreen + "");
- firePropertyChange(PROPERTY_FULLSCREEN, oldValue, fullscreen);
- }
-
- public void setLocale(Locale newLocale) {
- setOption(Option.LOCALE.key, newLocale.toString());
- firePropertyChange(PROPERTY_LOCALE, null, newLocale);
- }
-
- public void setFontSize(Float newFontSize) {
- Float oldValue = getFontSize();
- if (log.isDebugEnabled()) {
- log.debug("changing font-size to " + newFontSize);
- }
- setOption(Option.FONT_SIZE.key, newFontSize.toString());
- firePropertyChange(PROPERTY_FONT_SIZE, oldValue, newFontSize);
- }
-
- public boolean isAdjusting() {
- return adjusting;
- }
-
- public void setAdjusting(boolean adjusting) {
- if (log.isDebugEnabled()) {
- log.debug("changing adjusting to " + adjusting);
- }
- boolean oldValue = this.adjusting;
- this.adjusting = adjusting;
- firePropertyChange(PROPERTY_ADJUSTING, oldValue, adjusting);
- }
-
- //////////////////////////////////////////////////
- // Toutes les options disponibles
- //////////////////////////////////////////////////
-
- public enum Option implements OptionDef {
-
- CONFIG_FILE(CONFIG_FILE_NAME, _("jaxxdemo.config.configFileName.description"), "jaxxdemo", String.class, true, true),
- FULL_SCREEN("ui.fullscreen", _("jaxxdemo.config.ui.fullscreen"), "false", Boolean.class, false, false),
- LOCALE("ui." + PROPERTY_LOCALE, _("jaxxdemo.config.ui." + PROPERTY_LOCALE), Locale.FRANCE.toString(), Locale.class, false, false),
- FONT_SIZE("ui." + PROPERTY_FONT_SIZE, _("jaxxdemo.config.ui." + PROPERTY_FONT_SIZE), "10f", Float.class, false, false);
-
- public final String key;
-
- public final String description;
-
- public String defaultValue;
-
- public final Class<?> type;
-
- public boolean _transient;
-
- public boolean _final;
-
- Option(String key,
- String description,
- String defaultValue,
- Class<?> type,
- boolean _transient,
- boolean _final) {
- this.key = key;
- this.description = description;
- this.defaultValue = defaultValue;
- this.type = type;
- this._final = _final;
- this._transient = _transient;
- }
-
- @Override
- public boolean isFinal() {
- return _final;
- }
-
- @Override
- public void setDefaultValue(String defaultValue) {
- this.defaultValue = defaultValue;
- }
-
- @Override
- public void setTransient(boolean _transient) {
- this._transient = _transient;
- }
-
- @Override
- public void setFinal(boolean _final) {
- this._final = _final;
- }
-
- @Override
- public boolean isTransient() {
- return _transient;
- }
-
- @Override
- public String getDefaultValue() {
- return defaultValue;
- }
-
- @Override
- public String getDescription() {
- return description;
- }
-
- @Override
- public String getKey() {
- return key;
- }
-
- @Override
- public Class<?> getType() {
- return type;
- }
- }
-}
Added: trunk/jaxx-widgets/src/test/java/jaxx/runtime/swing/editor/config/model/MyDelegateConfig.java
===================================================================
--- trunk/jaxx-widgets/src/test/java/jaxx/runtime/swing/editor/config/model/MyDelegateConfig.java (rev 0)
+++ trunk/jaxx-widgets/src/test/java/jaxx/runtime/swing/editor/config/model/MyDelegateConfig.java 2012-08-08 12:23:08 UTC (rev 2479)
@@ -0,0 +1,271 @@
+package jaxx.runtime.swing.editor.config.model;
+/*
+ * #%L
+ * JAXX :: Widgets
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2008 - 2012 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%
+ */
+
+import com.google.common.base.Supplier;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.jdesktop.beans.AbstractBean;
+import org.nuiton.util.ApplicationConfig;
+
+import java.awt.Color;
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
+import java.util.Date;
+import java.util.Locale;
+
+import static org.nuiton.i18n.I18n._;
+
+/**
+ * A config to test config ui api when using a delegation
+ * on {@link ApplicationConfig}.
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 2.5.4
+ */
+public class MyDelegateConfig extends AbstractBean implements Supplier<ApplicationConfig> {
+
+ /** Logger */
+ private static final Log log = LogFactory.getLog(MyDelegateConfig.class);
+
+ public static final String PROPERTY_FULLSCREEN = "fullscreen";
+
+ public static final String PROPERTY_LOCALE = "locale";
+
+ public static final String PROPERTY_FONT_SIZE = "fontSize";
+
+ public static final String PROPERTY_ADJUSTING = "adjusting";
+
+ public static final String PROPERTY_DEMO_COLOR = "demoColor";
+
+ public static final String PROPERTY_DEMO_CLASS = "demoClass";
+
+ protected final ApplicationConfig applicationConfig;
+
+ public MyDelegateConfig() {
+ this.applicationConfig = new ApplicationConfig();
+
+ applicationConfig.setConfigFileName(Option.CONFIG_FILE.defaultValue);
+
+ // chargement de la configuration interne
+
+ for (Option o : Option.values()) {
+ applicationConfig.setDefaultOption(o.key, o.defaultValue);
+ }
+
+ applicationConfig.setAdjusting(true);
+ try {
+ addPropertyChangeListener(PROPERTY_FULLSCREEN, saveAction);
+ addPropertyChangeListener(PROPERTY_FONT_SIZE, saveAction);
+ addPropertyChangeListener(PROPERTY_LOCALE, saveAction);
+ addPropertyChangeListener(PROPERTY_DEMO_COLOR, saveAction);
+ addPropertyChangeListener(PROPERTY_DEMO_CLASS, saveAction);
+ } finally {
+ applicationConfig.setAdjusting(false);
+ }
+ }
+
+ protected final PropertyChangeListener saveAction = new PropertyChangeListener() {
+
+ @Override
+ public void propertyChange(PropertyChangeEvent evt) {
+ if (isAdjusting()) {
+ if (log.isDebugEnabled()) {
+ log.debug("skip save while adjusting");
+ }
+ } else {
+ if (log.isDebugEnabled()) {
+ log.debug("Saving configuration at " + new Date());
+ }
+ saveForUser();
+ }
+ }
+ };
+
+ public void saveForUser(String... excludeKeys) {
+ // never save anything :)
+ }
+
+ public boolean isFullScreen() {
+ Boolean result = applicationConfig.getOptionAsBoolean(Option.FULL_SCREEN.key);
+ return result != null && result;
+ }
+
+ public Locale getLocale() {
+ Locale result = applicationConfig.getOption(Locale.class, Option.LOCALE.key);
+ return result;
+ }
+
+ public Float getFontSize() {
+ Float result = applicationConfig.getOption(Float.class, Option.FONT_SIZE.key);
+ return result;
+ }
+
+ public Color getDemoColor() {
+ Color result = applicationConfig.getOptionAsColor(Option.DEMO_COLOR.key);
+ return result;
+ }
+
+ public Class<?> getDemoClass() {
+ Class<?> result = applicationConfig.getOptionAsClass(Option.DEMO_CLASS.key);
+ return result;
+ }
+
+ public void setFullscreen(boolean fullscreen) {
+ Object oldValue = null;
+ applicationConfig.setOption(Option.FULL_SCREEN.key, fullscreen + "");
+ firePropertyChange(PROPERTY_FULLSCREEN, oldValue, fullscreen);
+ }
+
+ public void setLocale(Locale newLocale) {
+ applicationConfig.setOption(Option.LOCALE.key, newLocale.toString());
+ firePropertyChange(PROPERTY_LOCALE, null, newLocale);
+ }
+
+ public void setFontSize(Float newFontSize) {
+ Float oldValue = getFontSize();
+ if (log.isDebugEnabled()) {
+ log.debug("changing font-size to " + newFontSize);
+ }
+ applicationConfig.setOption(Option.FONT_SIZE.key, newFontSize.toString());
+ firePropertyChange(PROPERTY_FONT_SIZE, oldValue, newFontSize);
+ }
+
+ public void setDemoColor(Color color) {
+ Color oldValue = getDemoColor();
+ if (log.isDebugEnabled()) {
+ log.debug("changing demo-color to " + color);
+ }
+ applicationConfig.setOption(Option.DEMO_COLOR.key, color.toString());
+ firePropertyChange(PROPERTY_DEMO_COLOR, oldValue, color);
+ }
+
+ public void setDemoClass(Class<?> newClass) {
+ Class<?> oldValue = getDemoClass();
+ if (log.isDebugEnabled()) {
+ log.debug("changing demo-class to " + newClass);
+ }
+ applicationConfig.setOption(Option.DEMO_CLASS.key, newClass.getName());
+ firePropertyChange(PROPERTY_DEMO_CLASS, oldValue, newClass);
+ }
+
+ public boolean isAdjusting() {
+ return applicationConfig.isAdjusting();
+ }
+
+ public void setAdjusting(boolean adjusting) {
+ applicationConfig.setAdjusting(adjusting);
+ }
+
+ @Override
+ public ApplicationConfig get() {
+ return applicationConfig;
+ }
+
+ //////////////////////////////////////////////////
+ // Toutes les options disponibles
+ //////////////////////////////////////////////////
+
+ public enum Option implements ApplicationConfig.OptionDef {
+
+ CONFIG_FILE(ApplicationConfig.CONFIG_FILE_NAME, _("jaxxdemo.config.configFileName.description"), "jaxxdemo", String.class, true, true),
+ FULL_SCREEN("ui.fullscreen", _("jaxxdemo.config.ui.fullscreen"), "false", Boolean.class, false, false),
+ LOCALE("ui." + PROPERTY_LOCALE, _("jaxxdemo.config.ui." + PROPERTY_LOCALE), Locale.FRANCE.toString(), Locale.class, false, false),
+ FONT_SIZE("ui." + PROPERTY_FONT_SIZE, _("jaxxdemo.config.ui." + PROPERTY_FONT_SIZE), "10f", Float.class, false, false),
+ DEMO_COLOR("ui." + PROPERTY_DEMO_COLOR, _("jaxxdemo.config.ui.demoColor"), "#ffffff", Color.class, false, false),
+ DEMO_CLASS("ui." + PROPERTY_DEMO_CLASS, _("jaxxdemo.config.ui.demoClass"), "java.io.File", Class.class, false, false);
+
+ public final String key;
+
+ public final String description;
+
+ public String defaultValue;
+
+ public final Class<?> type;
+
+ public boolean _transient;
+
+ public boolean _final;
+
+ Option(String key,
+ String description,
+ String defaultValue,
+ Class<?> type,
+ boolean _transient,
+ boolean _final) {
+ this.key = key;
+ this.description = description;
+ this.defaultValue = defaultValue;
+ this.type = type;
+ this._final = _final;
+ this._transient = _transient;
+ }
+
+ @Override
+ public boolean isFinal() {
+ return _final;
+ }
+
+ @Override
+ public void setDefaultValue(String defaultValue) {
+ this.defaultValue = defaultValue;
+ }
+
+ @Override
+ public void setTransient(boolean _transient) {
+ this._transient = _transient;
+ }
+
+ @Override
+ public void setFinal(boolean _final) {
+ this._final = _final;
+ }
+
+ @Override
+ public boolean isTransient() {
+ return _transient;
+ }
+
+ @Override
+ public String getDefaultValue() {
+ return defaultValue;
+ }
+
+ @Override
+ public String getDescription() {
+ return description;
+ }
+
+ @Override
+ public String getKey() {
+ return key;
+ }
+
+ @Override
+ public Class<?> getType() {
+ return type;
+ }
+ }
+}
+
Property changes on: trunk/jaxx-widgets/src/test/java/jaxx/runtime/swing/editor/config/model/MyDelegateConfig.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Added: trunk/jaxx-widgets/src/test/java/jaxx/runtime/swing/editor/config/model/MyDelegateConfigTest.java
===================================================================
--- trunk/jaxx-widgets/src/test/java/jaxx/runtime/swing/editor/config/model/MyDelegateConfigTest.java (rev 0)
+++ trunk/jaxx-widgets/src/test/java/jaxx/runtime/swing/editor/config/model/MyDelegateConfigTest.java 2012-08-08 12:23:08 UTC (rev 2479)
@@ -0,0 +1,330 @@
+package jaxx.runtime.swing.editor.config.model;
+/*
+ * #%L
+ * JAXX :: Widgets
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2008 - 2012 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%
+ */
+
+import jaxx.runtime.SwingUtil;
+import jaxx.runtime.swing.editor.MyDefaultCellEditor;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+import org.nuiton.util.ApplicationConfig;
+
+import javax.swing.ImageIcon;
+import javax.swing.table.TableCellEditor;
+import java.awt.Color;
+import java.io.File;
+import java.util.Collection;
+
+/**
+ * To test ConfigUI api on {@link MyDelegateConfig}.
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 2.5.4
+ */
+public class MyDelegateConfigTest {
+
+
+ public static final String CATEGORY = "cat0";
+
+ protected ConfigUIModelBuilder builder;
+
+ protected MyDelegateConfig config;
+
+ @Before
+ public void setup() {
+ config = new MyDelegateConfig();
+ builder = new ConfigUIModelBuilder();
+ }
+
+ @Test(expected = NullPointerException.class)
+ public void testCreateModelLimitCase0() throws Exception {
+ builder.createModel((ApplicationConfig) null);
+ }
+
+ @Test(expected = IllegalStateException.class)
+ public void testFlushModelLimitCase0() throws Exception {
+ builder.flushModel();
+ }
+
+ @Test
+ public void testCreateModel() throws Exception {
+ builder.createModel(config);
+ ConfigUIModel configModel = builder.flushModel();
+ Assert.assertNotNull(configModel);
+ Assert.assertNotNull(configModel.getApplicationConfig());
+ }
+
+ @Test(expected = IllegalStateException.class)
+ public void testRegisterCallbackLimitCase() throws Exception {
+ builder.registerCallBack(null, null, null, null);
+ }
+
+ @Test(expected = NullPointerException.class)
+ public void testRegisterCallbackLimitCase0() throws Exception {
+ builder.createModel(config);
+ builder.registerCallBack(null, null, null, null);
+ }
+
+ @Test(expected = NullPointerException.class)
+ public void testRegisterCallbackLimitCase1() throws Exception {
+ builder.createModel(config);
+ builder.registerCallBack("yo", null, null, null);
+ }
+
+ @Test(expected = NullPointerException.class)
+ public void testRegisterCallbackLimitCase2() throws Exception {
+ builder.createModel(config);
+ builder.registerCallBack("yo", "yo description", null, null);
+ }
+
+ @Test(expected = NullPointerException.class)
+ public void testRegisterCallbackLimitCase4() throws Exception {
+ builder.createModel(config);
+ Runnable callback = new Runnable() {
+
+ @Override
+ public void run() {
+ }
+ };
+ builder.registerCallBack("yo", "yo description", null, callback);
+ }
+
+ @Test
+ public void testRegisterCallback() throws Exception {
+ builder.createModel(config);
+ Runnable callback = new Runnable() {
+
+ @Override
+ public void run() {
+ }
+ };
+ ImageIcon icon = SwingUtil.createActionIcon("add");
+ builder.registerCallBack("yo", "yo description", icon, callback);
+ ConfigUIModel configModel = builder.flushModel();
+ Assert.assertNotNull(configModel);
+ Assert.assertNotNull(configModel.getApplicationConfig());
+ CallBackEntry callBackEntry =
+ configModel.getCallBacksManager().getCallBack("yo");
+ Assert.assertNotNull(callBackEntry);
+
+ Assert.assertEquals(callback, callBackEntry.getAction());
+ }
+
+ @Test(expected = IllegalStateException.class)
+ public void testAddCategoryLimitCase0() throws Exception {
+ builder.addCategory(null, null);
+ }
+
+ @Test(expected = NullPointerException.class)
+ public void testAddCategoryLimitCase1() throws Exception {
+ builder.createModel(config);
+ builder.addCategory(null, null);
+ }
+
+ @Test(expected = NullPointerException.class)
+ public void testAddCategoryLimitCase2() throws Exception {
+ builder.createModel(config);
+ builder.addCategory("", null);
+ }
+
+ @Test
+ public void testAddCategory() throws Exception {
+ builder.createModel(config);
+ builder.addCategory("cat0", "cat0 label");
+ CategoryModel categoryModel = builder.flushCategory();
+ Assert.assertNotNull(categoryModel);
+ Assert.assertEquals("cat0", categoryModel.category);
+ Assert.assertEquals("cat0 label", categoryModel.categoryLabel);
+ Assert.assertEquals(0, categoryModel.entries.size());
+
+ }
+
+ @Test(expected = IllegalStateException.class)
+ public void testAddOptionLimitCase0() throws Exception {
+ builder.addOption(null);
+ }
+
+ @Test(expected = IllegalStateException.class)
+ public void testAddOptionLimitCase1() throws Exception {
+ builder.createModel(config);
+ builder.addOption(null);
+ }
+
+ @Test(expected = NullPointerException.class)
+ public void testAddOptionLimitCase2() throws Exception {
+ builder.createModel(config);
+ builder.addCategory("cat0", "cat0 label");
+ builder.addOption(null);
+ }
+
+ @Test
+ public void testAddOption() throws Exception {
+ builder.createModel(config);
+ builder.addCategory("cat0", "cat0 label");
+ builder.addOption(MyDelegateConfig.Option.LOCALE);
+ OptionModel optionModel = builder.flushOption();
+ Assert.assertNotNull(optionModel);
+ Assert.assertEquals(MyDelegateConfig.Option.LOCALE, optionModel.def);
+
+ CategoryModel categoryModel = builder.flushCategory();
+ Assert.assertNotNull(categoryModel);
+ Assert.assertEquals("cat0", categoryModel.category);
+ Assert.assertEquals("cat0 label", categoryModel.categoryLabel);
+ Assert.assertEquals(1, categoryModel.entries.size());
+ }
+
+ @Test(expected = IllegalStateException.class)
+ public void testSetOptionPropertyNameLimitCase0() throws Exception {
+ builder.setOptionPropertyName(null);
+ }
+
+ @Test(expected = IllegalStateException.class)
+ public void testSetOptionPropertyNameLimitCase1() throws Exception {
+ builder.createModel(config);
+ builder.setOptionPropertyName(null);
+ }
+
+ @Test(expected = IllegalStateException.class)
+ public void testSetOptionPropertyNameLimitCase2() throws Exception {
+ builder.createModel(config);
+ builder.addCategory("cat0", "cat0 label");
+ builder.setOptionPropertyName(null);
+ }
+
+ @Test(expected = NullPointerException.class)
+ public void testSetOptionPropertyNameLimitCase3() throws Exception {
+ builder.createModel(config);
+ builder.addCategory("cat0", "cat0 label");
+ builder.addOption(MyDelegateConfig.Option.LOCALE);
+ builder.setOptionPropertyName(null);
+ }
+
+ @Test
+ public void testSetOptionPropertyName() throws Exception {
+ builder.createModel(config);
+ builder.addCategory("cat0", "cat0 label");
+ builder.addOption(MyDelegateConfig.Option.LOCALE);
+ builder.setOptionPropertyName(MyDelegateConfig.PROPERTY_LOCALE);
+ OptionModel optionModel = builder.flushOption();
+ Assert.assertNotNull(optionModel);
+ Assert.assertEquals(MyDelegateConfig.Option.LOCALE, optionModel.def);
+ Assert.assertEquals(MyDelegateConfig.PROPERTY_LOCALE, optionModel.propertyName);
+ Assert.assertNull(optionModel.editor);
+ }
+
+ @Test(expected = IllegalStateException.class)
+ public void testSetOptionEditorLimitCase0() throws Exception {
+ builder.setOptionEditor(null);
+ }
+
+ @Test(expected = IllegalStateException.class)
+ public void testSetOptionEditorLimitCase1() throws Exception {
+ builder.createModel(config);
+ builder.setOptionEditor(null);
+ }
+
+ @Test(expected = IllegalStateException.class)
+ public void testSetOptionEditorLimitCase2() throws Exception {
+ builder.createModel(config);
+ builder.addCategory("cat0", "cat0 label");
+ builder.setOptionEditor(null);
+ }
+
+
+ @Test(expected = NullPointerException.class)
+ public void testSetOptionEditorLimitCase3() throws Exception {
+ builder.createModel(config);
+ builder.addCategory("cat0", "cat0 label");
+ builder.addOption(MyDelegateConfig.Option.LOCALE);
+ builder.setOptionEditor(null);
+ }
+
+ @Test
+ public void testSetOptionEditor() throws Exception {
+ builder.createModel(config);
+ builder.addCategory("cat0", "cat0 label");
+ builder.addOption(MyDelegateConfig.Option.LOCALE);
+ TableCellEditor cellEditor = MyDefaultCellEditor.newBooleanEditor();
+ builder.setOptionEditor(cellEditor);
+ OptionModel optionModel = builder.flushOption();
+ Assert.assertNotNull(optionModel);
+ Assert.assertEquals(MyDelegateConfig.Option.LOCALE, optionModel.def);
+ Assert.assertNull(optionModel.propertyName);
+ Assert.assertEquals(cellEditor, optionModel.editor);
+ }
+
+ @Test
+ public void testFlushModel() throws Exception {
+ builder.createModel(config);
+ ConfigUIModel configModel = builder.flushModel();
+ Assert.assertNotNull(configModel);
+ Assert.assertNull(builder.model);
+ }
+
+ @Test
+ public void testSaveClassOption() throws Exception {
+ builder.createModel(config);
+ builder.addCategory(CATEGORY, "cat0 label");
+ builder.addOption(MyDelegateConfig.Option.DEMO_CLASS, MyDelegateConfig.PROPERTY_DEMO_CLASS);
+ ConfigUIModel configModel = builder.flushModel();
+ configModel.setCategory(CATEGORY);
+
+ CategoryModel categoryModel = configModel.getCategoryModel();
+ Assert.assertNotNull(categoryModel);
+
+ OptionModel optionModel = categoryModel.getOptionModel(MyDelegateConfig.Option.DEMO_CLASS.getKey());
+ Assert.assertNotNull(optionModel);
+
+ categoryModel.setValue(optionModel, Collection.class);
+
+ Assert.assertEquals(File.class, config.getDemoClass());
+
+ configModel.saveModified();
+
+ Assert.assertEquals(Collection.class, config.getDemoClass());
+ }
+
+ @Test
+ public void testSaveColorOption() throws Exception {
+ builder.createModel(config);
+ builder.addCategory(CATEGORY, "cat0 label");
+ builder.addOption(MyDelegateConfig.Option.DEMO_COLOR);
+ ConfigUIModel configModel = builder.flushModel();
+ configModel.setCategory(CATEGORY);
+
+ CategoryModel categoryModel = configModel.getCategoryModel();
+ Assert.assertNotNull(categoryModel);
+
+ OptionModel optionModel = categoryModel.getOptionModel(MyDelegateConfig.Option.DEMO_COLOR.getKey());
+ Assert.assertNotNull(optionModel);
+
+ Color newColor = new Color(0, 0, 0);
+ categoryModel.setValue(optionModel, newColor);
+
+ Assert.assertFalse(newColor.equals(config.getDemoColor()));
+
+ configModel.saveModified();
+ Assert.assertEquals(newColor, config.getDemoColor());
+ }
+}
Property changes on: trunk/jaxx-widgets/src/test/java/jaxx/runtime/swing/editor/config/model/MyDelegateConfigTest.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Added: trunk/jaxx-widgets/src/test/java/jaxx/runtime/swing/editor/config/model/MyInheritedConfig.java
===================================================================
--- trunk/jaxx-widgets/src/test/java/jaxx/runtime/swing/editor/config/model/MyInheritedConfig.java (rev 0)
+++ trunk/jaxx-widgets/src/test/java/jaxx/runtime/swing/editor/config/model/MyInheritedConfig.java 2012-08-08 12:23:08 UTC (rev 2479)
@@ -0,0 +1,282 @@
+package jaxx.runtime.swing.editor.config.model;
+/*
+ * #%L
+ * JAXX :: Widgets
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2008 - 2012 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%
+ */
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.nuiton.util.ApplicationConfig;
+
+import java.awt.Color;
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
+import java.util.Date;
+import java.util.Locale;
+
+import static org.nuiton.i18n.I18n._;
+
+/**
+ * A config to test config ui api when using a delegation
+ * on {@link ApplicationConfig}.
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 2.5.4
+ */
+public class MyInheritedConfig extends ApplicationConfig {
+
+ /** Logger */
+ private static final Log log = LogFactory.getLog(MyInheritedConfig.class);
+
+ public static final String PROPERTY_FULLSCREEN = "fullscreen";
+
+ public static final String PROPERTY_LOCALE = "locale";
+
+ public static final String PROPERTY_FONT_SIZE = "fontSize";
+
+ public static final String PROPERTY_ADJUSTING = "adjusting";
+
+ public static final String PROPERTY_DEMO_COLOR = "demoColor";
+
+ public static final String PROPERTY_DEMO_CLASS = "demoClass";
+
+// /**
+// * un drapeau pour bloquer la sauvegarde lors de la modification en masse des options
+// * via les setter.
+// */
+// protected boolean adjusting;
+
+ protected final PropertyChangeListener saveAction = new PropertyChangeListener() {
+
+ @Override
+ public void propertyChange(PropertyChangeEvent evt) {
+ if (isAdjusting()) {
+ if (log.isDebugEnabled()) {
+ log.debug("skip save while adjusting");
+ }
+ return;
+ }
+ if (log.isDebugEnabled()) {
+ log.debug("Saving configuration at " + new Date());
+ }
+ saveForUser();
+ }
+ };
+
+ @Override
+ public void saveForUser(String... excludeKeys) {
+ // never save anything :)
+ }
+
+ public MyInheritedConfig() {
+
+ setConfigFileName(Option.CONFIG_FILE.defaultValue);
+
+ // chargement de la configuration interne
+
+ for (Option o : Option.values()) {
+ setDefaultOption(o.key, o.defaultValue);
+ }
+
+ setAdjusting(true);
+ try {
+ addPropertyChangeListener(PROPERTY_FULLSCREEN, saveAction);
+ addPropertyChangeListener(PROPERTY_FONT_SIZE, saveAction);
+ addPropertyChangeListener(PROPERTY_LOCALE, saveAction);
+ addPropertyChangeListener(PROPERTY_DEMO_COLOR, saveAction);
+ addPropertyChangeListener(PROPERTY_DEMO_CLASS, saveAction);
+ } finally {
+ setAdjusting(false);
+ }
+ }
+
+ @Override
+ public void setOption(String key, String value) {
+ if (key.equals(PROPERTY_ADJUSTING)) {
+ setAdjusting(Boolean.valueOf(value));
+ return;
+ }
+ super.setOption(key, value);
+ }
+
+
+ public boolean isFullScreen() {
+ Boolean result = getOptionAsBoolean(Option.FULL_SCREEN.key);
+ return result != null && result;
+ }
+
+ public Locale getLocale() {
+ Locale result = getOption(Locale.class, Option.LOCALE.key);
+ return result;
+ }
+
+ public Float getFontSize() {
+ Float result = getOption(Float.class, Option.FONT_SIZE.key);
+ return result;
+ }
+
+ public Color getDemoColor() {
+ Color result = getOptionAsColor(Option.DEMO_COLOR.key);
+ return result;
+ }
+
+ public Class<?> getDemoClass() {
+ Class<?> result = getOptionAsClass(Option.DEMO_CLASS.key);
+ return result;
+ }
+
+ public void setFullscreen(boolean fullscreen) {
+ Object oldValue = null;
+ setOption(Option.FULL_SCREEN.key, fullscreen + "");
+ firePropertyChange(PROPERTY_FULLSCREEN, oldValue, fullscreen);
+ }
+
+ public void setLocale(Locale newLocale) {
+ setOption(Option.LOCALE.key, newLocale.toString());
+ firePropertyChange(PROPERTY_LOCALE, null, newLocale);
+ }
+
+ public void setFontSize(Float newFontSize) {
+ Float oldValue = getFontSize();
+ if (log.isDebugEnabled()) {
+ log.debug("changing font-size to " + newFontSize);
+ }
+ setOption(Option.FONT_SIZE.key, newFontSize.toString());
+ firePropertyChange(PROPERTY_FONT_SIZE, oldValue, newFontSize);
+ }
+
+ public void setDemoColor(Color color) {
+ Color oldValue = getDemoColor();
+ if (log.isDebugEnabled()) {
+ log.debug("changing demo-color to " + color);
+ }
+ setOption(Option.DEMO_COLOR.key, color.toString());
+ firePropertyChange(PROPERTY_DEMO_COLOR, oldValue, color);
+ }
+
+ public void setDemoClass(Class<?> newClass) {
+ Class<?> oldValue = getDemoClass();
+ if (log.isDebugEnabled()) {
+ log.debug("changing demo-class to " + newClass);
+ }
+ setOption(Option.DEMO_CLASS.key, newClass.getName());
+ firePropertyChange(PROPERTY_DEMO_CLASS, oldValue, newClass);
+ }
+
+// public boolean isAdjusting() {
+// return adjusting;
+// }
+//
+// public void setAdjusting(boolean adjusting) {
+// if (log.isDebugEnabled()) {
+// log.debug("changing adjusting to " + adjusting);
+// }
+// boolean oldValue = this.adjusting;
+// this.adjusting = adjusting;
+// firePropertyChange(PROPERTY_ADJUSTING, oldValue, adjusting);
+// }
+
+ //////////////////////////////////////////////////
+ // Toutes les options disponibles
+ //////////////////////////////////////////////////
+
+ public enum Option implements ApplicationConfig.OptionDef {
+
+ CONFIG_FILE(CONFIG_FILE_NAME, _("jaxxdemo.config.configFileName.description"), "jaxxdemo", String.class, true, true),
+ FULL_SCREEN("ui.fullscreen", _("jaxxdemo.config.ui.fullscreen"), "false", Boolean.class, false, false),
+ LOCALE("ui." + PROPERTY_LOCALE, _("jaxxdemo.config.ui." + PROPERTY_LOCALE), Locale.FRANCE.toString(), Locale.class, false, false),
+ FONT_SIZE("ui." + PROPERTY_FONT_SIZE, _("jaxxdemo.config.ui." + PROPERTY_FONT_SIZE), "10f", Float.class, false, false),
+ DEMO_COLOR("ui." + PROPERTY_DEMO_COLOR, _("jaxxdemo.config.ui.demoColor"), "#ffffff", Color.class, false, false),
+ DEMO_CLASS("ui." + PROPERTY_DEMO_CLASS, _("jaxxdemo.config.ui.demoClass"), "java.io.File", Class.class, false, false);
+
+ public final String key;
+
+ public final String description;
+
+ public String defaultValue;
+
+ public final Class<?> type;
+
+ public boolean _transient;
+
+ public boolean _final;
+
+ Option(String key,
+ String description,
+ String defaultValue,
+ Class<?> type,
+ boolean _transient,
+ boolean _final) {
+ this.key = key;
+ this.description = description;
+ this.defaultValue = defaultValue;
+ this.type = type;
+ this._final = _final;
+ this._transient = _transient;
+ }
+
+ @Override
+ public boolean isFinal() {
+ return _final;
+ }
+
+ @Override
+ public void setDefaultValue(String defaultValue) {
+ this.defaultValue = defaultValue;
+ }
+
+ @Override
+ public void setTransient(boolean _transient) {
+ this._transient = _transient;
+ }
+
+ @Override
+ public void setFinal(boolean _final) {
+ this._final = _final;
+ }
+
+ @Override
+ public boolean isTransient() {
+ return _transient;
+ }
+
+ @Override
+ public String getDefaultValue() {
+ return defaultValue;
+ }
+
+ @Override
+ public String getDescription() {
+ return description;
+ }
+
+ @Override
+ public String getKey() {
+ return key;
+ }
+
+ @Override
+ public Class<?> getType() {
+ return type;
+ }
+ }
+}
Property changes on: trunk/jaxx-widgets/src/test/java/jaxx/runtime/swing/editor/config/model/MyInheritedConfig.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Added: trunk/jaxx-widgets/src/test/java/jaxx/runtime/swing/editor/config/model/MyInheritedConfigTest.java
===================================================================
--- trunk/jaxx-widgets/src/test/java/jaxx/runtime/swing/editor/config/model/MyInheritedConfigTest.java (rev 0)
+++ trunk/jaxx-widgets/src/test/java/jaxx/runtime/swing/editor/config/model/MyInheritedConfigTest.java 2012-08-08 12:23:08 UTC (rev 2479)
@@ -0,0 +1,341 @@
+package jaxx.runtime.swing.editor.config.model;
+/*
+ * #%L
+ * JAXX :: Widgets
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2008 - 2012 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%
+ */
+
+import jaxx.runtime.SwingUtil;
+import jaxx.runtime.swing.editor.MyDefaultCellEditor;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+import org.nuiton.util.ApplicationConfig;
+
+import javax.swing.ImageIcon;
+import javax.swing.table.TableCellEditor;
+import java.awt.Color;
+import java.io.File;
+import java.util.Collection;
+
+/**
+ * To test ConfigUI api on {@link MyInheritedConfig}.
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 2.5.4
+ */
+public class MyInheritedConfigTest {
+
+ public static final String CATEGORY = "cat0";
+
+
+ protected ConfigUIModelBuilder builder;
+
+ protected MyInheritedConfig config;
+
+ @Before
+ public void setup() {
+ config = new MyInheritedConfig();
+ builder = new ConfigUIModelBuilder();
+ }
+
+ @Test(expected = NullPointerException.class)
+ public void testCreateModelLimitCase0() throws Exception {
+ builder.createModel((ApplicationConfig) null);
+ }
+
+ @Test(expected = IllegalStateException.class)
+ public void testFlushModelLimitCase0() throws Exception {
+ builder.flushModel();
+ }
+
+ @Test
+ public void testCreateModel() throws Exception {
+ builder.createModel(config);
+ ConfigUIModel configModel = builder.flushModel();
+ Assert.assertNotNull(configModel);
+ Assert.assertNotNull(configModel.getApplicationConfig());
+ }
+
+ @Test(expected = IllegalStateException.class)
+ public void testRegisterCallbackLimitCase() throws Exception {
+ builder.registerCallBack(null, null, null, null);
+ }
+
+ @Test(expected = NullPointerException.class)
+ public void testRegisterCallbackLimitCase0() throws Exception {
+ builder.createModel(config);
+ builder.registerCallBack(null, null, null, null);
+ }
+
+ @Test(expected = NullPointerException.class)
+ public void testRegisterCallbackLimitCase1() throws Exception {
+ builder.createModel(config);
+ builder.registerCallBack("yo", null, null, null);
+ }
+
+ @Test(expected = NullPointerException.class)
+ public void testRegisterCallbackLimitCase2() throws Exception {
+ builder.createModel(config);
+ builder.registerCallBack("yo", "yo description", null, null);
+ }
+
+ @Test(expected = NullPointerException.class)
+ public void testRegisterCallbackLimitCase4() throws Exception {
+ builder.createModel(config);
+ Runnable callback = new Runnable() {
+
+ @Override
+ public void run() {
+ }
+ };
+ builder.registerCallBack("yo", "yo description", null, callback);
+ }
+
+ @Test
+ public void testRegisterCallback() throws Exception {
+ builder.createModel(config);
+ Runnable callback = new Runnable() {
+
+ @Override
+ public void run() {
+ }
+ };
+ ImageIcon icon = SwingUtil.createActionIcon("add");
+ builder.registerCallBack("yo", "yo description", icon, callback);
+ ConfigUIModel configModel = builder.flushModel();
+ Assert.assertNotNull(configModel);
+ Assert.assertNotNull(configModel.getApplicationConfig());
+ CallBackEntry callBackEntry =
+ configModel.getCallBacksManager().getCallBack("yo");
+ Assert.assertNotNull(callBackEntry);
+
+ Assert.assertEquals(callback, callBackEntry.getAction());
+ }
+
+ @Test(expected = IllegalStateException.class)
+ public void testAddCategoryLimitCase0() throws Exception {
+ builder.addCategory(null, null);
+ }
+
+ @Test(expected = NullPointerException.class)
+ public void testAddCategoryLimitCase1() throws Exception {
+ builder.createModel(config);
+ builder.addCategory(null, null);
+ }
+
+ @Test(expected = NullPointerException.class)
+ public void testAddCategoryLimitCase2() throws Exception {
+ builder.createModel(config);
+ builder.addCategory("", null);
+ }
+
+ @Test
+ public void testAddCategory() throws Exception {
+ builder.createModel(config);
+ builder.addCategory("cat0", "cat0 label");
+ CategoryModel categoryModel = builder.flushCategory();
+ Assert.assertNotNull(categoryModel);
+ Assert.assertEquals("cat0", categoryModel.category);
+ Assert.assertEquals("cat0 label", categoryModel.categoryLabel);
+ Assert.assertEquals(0, categoryModel.entries.size());
+
+ }
+
+ @Test(expected = IllegalStateException.class)
+ public void testAddOptionLimitCase0() throws Exception {
+ builder.addOption(null);
+ }
+
+ @Test(expected = IllegalStateException.class)
+ public void testAddOptionLimitCase1() throws Exception {
+ builder.createModel(config);
+ builder.addOption(null);
+ }
+
+ @Test(expected = NullPointerException.class)
+ public void testAddOptionLimitCase2() throws Exception {
+ builder.createModel(config);
+ builder.addCategory("cat0", "cat0 label");
+ builder.addOption(null);
+ }
+
+ @Test
+ public void testAddOption() throws Exception {
+ builder.createModel(config);
+ builder.addCategory("cat0", "cat0 label");
+ builder.addOption(MyInheritedConfig.Option.LOCALE);
+ OptionModel optionModel = builder.flushOption();
+ Assert.assertNotNull(optionModel);
+ Assert.assertEquals(MyInheritedConfig.Option.LOCALE, optionModel.def);
+
+ CategoryModel categoryModel = builder.flushCategory();
+ Assert.assertNotNull(categoryModel);
+ Assert.assertEquals("cat0", categoryModel.category);
+ Assert.assertEquals("cat0 label", categoryModel.categoryLabel);
+ Assert.assertEquals(1, categoryModel.entries.size());
+ }
+
+ @Test(expected = IllegalStateException.class)
+ public void testSetOptionPropertyNameLimitCase0() throws Exception {
+ builder.setOptionPropertyName(null);
+ }
+
+ @Test(expected = IllegalStateException.class)
+ public void testSetOptionPropertyNameLimitCase1() throws Exception {
+ builder.createModel(config);
+ builder.setOptionPropertyName(null);
+ }
+
+ @Test(expected = IllegalStateException.class)
+ public void testSetOptionPropertyNameLimitCase2() throws Exception {
+ builder.createModel(config);
+ builder.addCategory("cat0", "cat0 label");
+ builder.setOptionPropertyName(null);
+ }
+
+ @Test(expected = NullPointerException.class)
+ public void testSetOptionPropertyNameLimitCase3() throws Exception {
+ builder.createModel(config);
+ builder.addCategory("cat0", "cat0 label");
+ builder.addOption(MyInheritedConfig.Option.LOCALE);
+ builder.setOptionPropertyName(null);
+ }
+
+ @Test
+ public void testSetOptionPropertyName() throws Exception {
+ builder.createModel(config);
+ builder.addCategory("cat0", "cat0 label");
+ builder.addOption(MyInheritedConfig.Option.LOCALE);
+ builder.setOptionPropertyName(MyInheritedConfig.PROPERTY_LOCALE);
+ OptionModel optionModel = builder.flushOption();
+ Assert.assertNotNull(optionModel);
+ Assert.assertEquals(MyInheritedConfig.Option.LOCALE, optionModel.def);
+ Assert.assertEquals(MyInheritedConfig.PROPERTY_LOCALE, optionModel.propertyName);
+ Assert.assertNull(optionModel.editor);
+ }
+
+ @Test(expected = IllegalStateException.class)
+ public void testSetOptionEditorLimitCase0() throws Exception {
+ builder.setOptionEditor(null);
+ }
+
+ @Test(expected = IllegalStateException.class)
+ public void testSetOptionEditorLimitCase1() throws Exception {
+ builder.createModel(config);
+ builder.setOptionEditor(null);
+ }
+
+ @Test(expected = IllegalStateException.class)
+ public void testSetOptionEditorLimitCase2() throws Exception {
+ builder.createModel(config);
+ builder.addCategory("cat0", "cat0 label");
+ builder.setOptionEditor(null);
+ }
+
+
+ @Test(expected = NullPointerException.class)
+ public void testSetOptionEditorLimitCase3() throws Exception {
+ builder.createModel(config);
+ builder.addCategory("cat0", "cat0 label");
+ builder.addOption(MyInheritedConfig.Option.LOCALE);
+ builder.setOptionEditor(null);
+ }
+
+ @Test
+ public void testSetOptionEditor() throws Exception {
+ builder.createModel(config);
+ builder.addCategory("cat0", "cat0 label");
+ builder.addOption(MyInheritedConfig.Option.LOCALE);
+ TableCellEditor cellEditor = MyDefaultCellEditor.newBooleanEditor();
+ builder.setOptionEditor(cellEditor);
+ OptionModel optionModel = builder.flushOption();
+ Assert.assertNotNull(optionModel);
+ Assert.assertEquals(MyInheritedConfig.Option.LOCALE, optionModel.def);
+ Assert.assertNull(optionModel.propertyName);
+ Assert.assertEquals(cellEditor, optionModel.editor);
+ }
+
+ @Test
+ public void testFlushModel() throws Exception {
+ builder.createModel(config);
+ ConfigUIModel configModel = builder.flushModel();
+ Assert.assertNotNull(configModel);
+ Assert.assertNull(builder.model);
+ }
+
+ @Test
+ public void testSetModel() throws Exception {
+
+ }
+
+ @Test
+ public void testSetCategory() throws Exception {
+ }
+
+ @Test
+ public void testSetOption() throws Exception {
+ }
+
+ @Test
+ public void testSaveClassOption() throws Exception {
+ builder.createModel(config);
+ builder.addCategory(CATEGORY, "cat0 label");
+ builder.addOption(MyDelegateConfig.Option.DEMO_CLASS, MyDelegateConfig.PROPERTY_DEMO_CLASS);
+ ConfigUIModel configModel = builder.flushModel();
+ configModel.setCategory(CATEGORY);
+ CategoryModel categoryModel = configModel.getCategoryModel();
+ Assert.assertNotNull(categoryModel);
+
+ OptionModel optionModel = categoryModel.getOptionModel(MyDelegateConfig.Option.DEMO_CLASS.getKey());
+ Assert.assertNotNull(optionModel);
+
+ categoryModel.setValue(optionModel, Collection.class);
+
+ Assert.assertEquals(File.class, config.getDemoClass());
+
+ configModel.saveModified();
+ Assert.assertEquals(Collection.class, config.getDemoClass());
+ }
+
+ @Test
+ public void testSaveColorOption() throws Exception {
+ builder.createModel(config);
+ builder.addCategory(CATEGORY, "cat0 label");
+ builder.addOption(MyDelegateConfig.Option.DEMO_COLOR);
+ ConfigUIModel configModel = builder.flushModel();
+ configModel.setCategory(CATEGORY);
+
+ CategoryModel categoryModel = configModel.getCategoryModel();
+ Assert.assertNotNull(categoryModel);
+
+ OptionModel optionModel = categoryModel.getOptionModel(MyDelegateConfig.Option.DEMO_COLOR.getKey());
+ Assert.assertNotNull(optionModel);
+
+ Color newColor = new Color(0, 0, 0);
+ categoryModel.setValue(optionModel, newColor);
+
+ Assert.assertFalse(newColor.equals(config.getDemoColor()));
+
+ configModel.saveModified();
+ Assert.assertEquals(newColor, config.getDemoColor());
+ }
+}
Property changes on: trunk/jaxx-widgets/src/test/java/jaxx/runtime/swing/editor/config/model/MyInheritedConfigTest.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
1
0
r2478 - trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/editor
by tchemit@users.nuiton.org 08 Aug '12
by tchemit@users.nuiton.org 08 Aug '12
08 Aug '12
Author: tchemit
Date: 2012-08-08 14:22:10 +0200 (Wed, 08 Aug 2012)
New Revision: 2478
Url: http://nuiton.org/repositories/revision/jaxx/2478
Log:
fixes 2240: ClassCellEditor does not work for anything but classes
Modified:
trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/editor/ClassCellEditor.java
Modified: trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/editor/ClassCellEditor.java
===================================================================
--- trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/editor/ClassCellEditor.java 2012-08-08 12:20:40 UTC (rev 2477)
+++ trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/editor/ClassCellEditor.java 2012-08-08 12:22:10 UTC (rev 2478)
@@ -47,11 +47,17 @@
@Override
public Component getTableCellEditorComponent(JTable table, Object value, boolean isSelected, int row, int column) {
- String valStr = (value + "").trim();
- if (valStr.equals("null")) {
- valStr = "";
- } else if (valStr.startsWith("class ")) {
- valStr = valStr.substring(6);
+ String valStr;
+
+ if (value instanceof Class<?>) {
+ valStr = ((Class<?>) value).getName();
+ } else {
+ valStr = (value + "").trim();
+ if (valStr.equals("null")) {
+ valStr = "";
+ } else if (valStr.startsWith("class ")) {
+ valStr = valStr.substring(6);
+ }
}
Component comp;
comp = getDelegate().getTableCellEditorComponent(table, valStr, isSelected, row, column);
1
0
r2477 - trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/renderer
by tchemit@users.nuiton.org 08 Aug '12
by tchemit@users.nuiton.org 08 Aug '12
08 Aug '12
Author: tchemit
Date: 2012-08-08 14:20:40 +0200 (Wed, 08 Aug 2012)
New Revision: 2477
Url: http://nuiton.org/repositories/revision/jaxx/2477
Log:
no more use deprecated api
Modified:
trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/renderer/MultiDecoratorListCellRenderer.java
Modified: trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/renderer/MultiDecoratorListCellRenderer.java
===================================================================
--- trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/renderer/MultiDecoratorListCellRenderer.java 2012-08-08 12:20:21 UTC (rev 2476)
+++ trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/renderer/MultiDecoratorListCellRenderer.java 2012-08-08 12:20:40 UTC (rev 2477)
@@ -58,10 +58,10 @@
this.types = new ArrayList<Class<?>>();
List<Decorator<?>> tmp = new ArrayList<Decorator<?>>();
for (JXPathDecorator<?> d : decorator) {
- if (types.contains(d.getInternalClass())) {
- throw new IllegalArgumentException("can not have twice a decorator of type " + d.getInternalClass());
+ if (types.contains(d.getType())) {
+ throw new IllegalArgumentException("can not have twice a decorator of type " + d.getType());
}
- types.add(d.getInternalClass());
+ types.add(d.getType());
tmp.add(d);
}
decorators = tmp.toArray(new Decorator<?>[tmp.size()]);
@@ -72,7 +72,11 @@
}
@Override
- public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
+ public Component getListCellRendererComponent(JList list,
+ Object value,
+ int index,
+ boolean isSelected,
+ boolean cellHasFocus) {
if (value != null) {
int i = types.indexOf(value.getClass());
if (i != -1) {
@@ -80,6 +84,8 @@
value = d.toString(value);
}
}
- return delegate.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
+ Component component = delegate.getListCellRendererComponent(
+ list, value, index, isSelected, cellHasFocus);
+ return component;
}
}
1
0