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
April 2013
- 3 participants
- 18 discussions
r2654 - trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/session
by kmorin@users.nuiton.org 09 Apr '13
by kmorin@users.nuiton.org 09 Apr '13
09 Apr '13
Author: kmorin
Date: 2013-04-09 11:29:00 +0200 (Tue, 09 Apr 2013)
New Revision: 2654
Url: http://nuiton.org/projects/jaxx/repository/revisions/2654
Log:
fixes #2655 JXTableSwingSessionState - Error if the number of columns is different from the saved state
Modified:
trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/session/JXTableSwingSessionState.java
Modified: trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/session/JXTableSwingSessionState.java
===================================================================
--- trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/session/JXTableSwingSessionState.java 2013-04-08 13:14:43 UTC (rev 2653)
+++ trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/session/JXTableSwingSessionState.java 2013-04-09 09:29:00 UTC (rev 2654)
@@ -99,7 +99,7 @@
(DefaultTableColumnModelExt) table.getColumnModel();
List<TableColumn> columns = columnModel.getColumns(true);
if (hiddenColumns != null
- && columnModel.getColumnCount(true) == columns.size()) {
+ && hiddenColumns.length == columns.size()) {
for (int i = 0; i < table.getColumnCount(); i++) {
TableColumnExt tc = (TableColumnExt) columns.get(i);
tc.setVisible(!hiddenColumns[i]);
1
0
r2653 - in trunk: . jaxx-compiler jaxx-config jaxx-demo jaxx-maven-plugin jaxx-runtime jaxx-validator jaxx-widgets
by maven-release@users.nuiton.org 08 Apr '13
by maven-release@users.nuiton.org 08 Apr '13
08 Apr '13
Author: maven-release
Date: 2013-04-08 15:14:43 +0200 (Mon, 08 Apr 2013)
New Revision: 2653
Url: http://nuiton.org/projects/jaxx/repository/revisions/2653
Log:
[maven-release-plugin] prepare for next development iteration
Modified:
trunk/jaxx-compiler/pom.xml
trunk/jaxx-config/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 2013-04-08 13:14:41 UTC (rev 2652)
+++ trunk/jaxx-compiler/pom.xml 2013-04-08 13:14:43 UTC (rev 2653)
@@ -30,7 +30,7 @@
<parent>
<groupId>org.nuiton</groupId>
<artifactId>jaxx</artifactId>
- <version>2.5.16</version>
+ <version>2.5.17-SNAPSHOT</version>
</parent>
<groupId>org.nuiton.jaxx</groupId>
Modified: trunk/jaxx-config/pom.xml
===================================================================
--- trunk/jaxx-config/pom.xml 2013-04-08 13:14:41 UTC (rev 2652)
+++ trunk/jaxx-config/pom.xml 2013-04-08 13:14:43 UTC (rev 2653)
@@ -31,7 +31,7 @@
<parent>
<groupId>org.nuiton</groupId>
<artifactId>jaxx</artifactId>
- <version>2.5.16</version>
+ <version>2.5.17-SNAPSHOT</version>
</parent>
<groupId>org.nuiton.jaxx</groupId>
Modified: trunk/jaxx-demo/pom.xml
===================================================================
--- trunk/jaxx-demo/pom.xml 2013-04-08 13:14:41 UTC (rev 2652)
+++ trunk/jaxx-demo/pom.xml 2013-04-08 13:14:43 UTC (rev 2653)
@@ -35,7 +35,7 @@
<parent>
<groupId>org.nuiton</groupId>
<artifactId>jaxx</artifactId>
- <version>2.5.16</version>
+ <version>2.5.17-SNAPSHOT</version>
</parent>
<groupId>org.nuiton.jaxx</groupId>
Modified: trunk/jaxx-maven-plugin/pom.xml
===================================================================
--- trunk/jaxx-maven-plugin/pom.xml 2013-04-08 13:14:41 UTC (rev 2652)
+++ trunk/jaxx-maven-plugin/pom.xml 2013-04-08 13:14:43 UTC (rev 2653)
@@ -31,7 +31,7 @@
<parent>
<groupId>org.nuiton</groupId>
<artifactId>jaxx</artifactId>
- <version>2.5.16</version>
+ <version>2.5.17-SNAPSHOT</version>
</parent>
<groupId>org.nuiton.jaxx</groupId>
Modified: trunk/jaxx-runtime/pom.xml
===================================================================
--- trunk/jaxx-runtime/pom.xml 2013-04-08 13:14:41 UTC (rev 2652)
+++ trunk/jaxx-runtime/pom.xml 2013-04-08 13:14:43 UTC (rev 2653)
@@ -30,7 +30,7 @@
<parent>
<groupId>org.nuiton</groupId>
<artifactId>jaxx</artifactId>
- <version>2.5.16</version>
+ <version>2.5.17-SNAPSHOT</version>
</parent>
<groupId>org.nuiton.jaxx</groupId>
Modified: trunk/jaxx-validator/pom.xml
===================================================================
--- trunk/jaxx-validator/pom.xml 2013-04-08 13:14:41 UTC (rev 2652)
+++ trunk/jaxx-validator/pom.xml 2013-04-08 13:14:43 UTC (rev 2653)
@@ -30,7 +30,7 @@
<parent>
<groupId>org.nuiton</groupId>
<artifactId>jaxx</artifactId>
- <version>2.5.16</version>
+ <version>2.5.17-SNAPSHOT</version>
</parent>
<groupId>org.nuiton.jaxx</groupId>
Modified: trunk/jaxx-widgets/pom.xml
===================================================================
--- trunk/jaxx-widgets/pom.xml 2013-04-08 13:14:41 UTC (rev 2652)
+++ trunk/jaxx-widgets/pom.xml 2013-04-08 13:14:43 UTC (rev 2653)
@@ -31,7 +31,7 @@
<parent>
<groupId>org.nuiton</groupId>
<artifactId>jaxx</artifactId>
- <version>2.5.16</version>
+ <version>2.5.17-SNAPSHOT</version>
</parent>
<groupId>org.nuiton.jaxx</groupId>
@@ -49,11 +49,11 @@
<!-- Source control management. -->
<scm>
- <connection>scm:svn:http://svn.nuiton.org/svn/jaxx/tags/jaxx-2.5.16/jaxx-widgets</connection>
+ <connection>scm:svn:http://svn.nuiton.org/svn/jaxx/trunk/jaxx-widgets</connection>
<developerConnection>
- scm:svn:http://svn.nuiton.org/svn/jaxx/tags/jaxx-2.5.16/jaxx-widgets
+ scm:svn:http://svn.nuiton.org/svn/jaxx/trunk/jaxx-widgets
</developerConnection>
- <url>http://nuiton.org/projects/jaxx/repository/show/trunkjaxx-widgets/tags/jaxx…</url>
+ <url>http://nuiton.org/projects/jaxx/repository/show/trunkjaxx-widgets</url>
</scm>
<dependencies>
Modified: trunk/pom.xml
===================================================================
--- trunk/pom.xml 2013-04-08 13:14:41 UTC (rev 2652)
+++ trunk/pom.xml 2013-04-08 13:14:43 UTC (rev 2653)
@@ -34,7 +34,7 @@
</parent>
<artifactId>jaxx</artifactId>
- <version>2.5.16</version>
+ <version>2.5.17-SNAPSHOT</version>
<modules>
<module>jaxx-runtime</module>
@@ -131,11 +131,11 @@
<!-- Source control management. -->
<scm>
- <connection>scm:svn:http://svn.nuiton.org/svn/jaxx/tags/jaxx-2.5.16</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.16
+ scm:svn:http://svn.nuiton.org/svn/jaxx/trunk
</developerConnection>
- <url>http://nuiton.org/projects/jaxx/repository/show/tags/jaxx-2.5.16</url>
+ <url>http://nuiton.org/projects/jaxx/repository/show/trunk</url>
</scm>
<distributionManagement>
1
0
Author: maven-release
Date: 2013-04-08 15:14:41 +0200 (Mon, 08 Apr 2013)
New Revision: 2652
Url: http://nuiton.org/projects/jaxx/repository/revisions/2652
Log:
[maven-release-plugin] copy for tag jaxx-2.5.16
Added:
tags/jaxx-2.5.16/
1
0
r2651 - in trunk: . jaxx-compiler jaxx-config jaxx-demo jaxx-maven-plugin jaxx-runtime jaxx-validator jaxx-widgets
by maven-release@users.nuiton.org 08 Apr '13
by maven-release@users.nuiton.org 08 Apr '13
08 Apr '13
Author: maven-release
Date: 2013-04-08 15:14:39 +0200 (Mon, 08 Apr 2013)
New Revision: 2651
Url: http://nuiton.org/projects/jaxx/repository/revisions/2651
Log:
[maven-release-plugin] prepare release jaxx-2.5.16
Modified:
trunk/jaxx-compiler/pom.xml
trunk/jaxx-config/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 2013-04-07 10:33:20 UTC (rev 2650)
+++ trunk/jaxx-compiler/pom.xml 2013-04-08 13:14:39 UTC (rev 2651)
@@ -30,7 +30,7 @@
<parent>
<groupId>org.nuiton</groupId>
<artifactId>jaxx</artifactId>
- <version>2.5.16-SNAPSHOT</version>
+ <version>2.5.16</version>
</parent>
<groupId>org.nuiton.jaxx</groupId>
Modified: trunk/jaxx-config/pom.xml
===================================================================
--- trunk/jaxx-config/pom.xml 2013-04-07 10:33:20 UTC (rev 2650)
+++ trunk/jaxx-config/pom.xml 2013-04-08 13:14:39 UTC (rev 2651)
@@ -31,7 +31,7 @@
<parent>
<groupId>org.nuiton</groupId>
<artifactId>jaxx</artifactId>
- <version>2.5.16-SNAPSHOT</version>
+ <version>2.5.16</version>
</parent>
<groupId>org.nuiton.jaxx</groupId>
Modified: trunk/jaxx-demo/pom.xml
===================================================================
--- trunk/jaxx-demo/pom.xml 2013-04-07 10:33:20 UTC (rev 2650)
+++ trunk/jaxx-demo/pom.xml 2013-04-08 13:14:39 UTC (rev 2651)
@@ -35,7 +35,7 @@
<parent>
<groupId>org.nuiton</groupId>
<artifactId>jaxx</artifactId>
- <version>2.5.16-SNAPSHOT</version>
+ <version>2.5.16</version>
</parent>
<groupId>org.nuiton.jaxx</groupId>
Modified: trunk/jaxx-maven-plugin/pom.xml
===================================================================
--- trunk/jaxx-maven-plugin/pom.xml 2013-04-07 10:33:20 UTC (rev 2650)
+++ trunk/jaxx-maven-plugin/pom.xml 2013-04-08 13:14:39 UTC (rev 2651)
@@ -31,7 +31,7 @@
<parent>
<groupId>org.nuiton</groupId>
<artifactId>jaxx</artifactId>
- <version>2.5.16-SNAPSHOT</version>
+ <version>2.5.16</version>
</parent>
<groupId>org.nuiton.jaxx</groupId>
Modified: trunk/jaxx-runtime/pom.xml
===================================================================
--- trunk/jaxx-runtime/pom.xml 2013-04-07 10:33:20 UTC (rev 2650)
+++ trunk/jaxx-runtime/pom.xml 2013-04-08 13:14:39 UTC (rev 2651)
@@ -30,7 +30,7 @@
<parent>
<groupId>org.nuiton</groupId>
<artifactId>jaxx</artifactId>
- <version>2.5.16-SNAPSHOT</version>
+ <version>2.5.16</version>
</parent>
<groupId>org.nuiton.jaxx</groupId>
Modified: trunk/jaxx-validator/pom.xml
===================================================================
--- trunk/jaxx-validator/pom.xml 2013-04-07 10:33:20 UTC (rev 2650)
+++ trunk/jaxx-validator/pom.xml 2013-04-08 13:14:39 UTC (rev 2651)
@@ -30,7 +30,7 @@
<parent>
<groupId>org.nuiton</groupId>
<artifactId>jaxx</artifactId>
- <version>2.5.16-SNAPSHOT</version>
+ <version>2.5.16</version>
</parent>
<groupId>org.nuiton.jaxx</groupId>
Modified: trunk/jaxx-widgets/pom.xml
===================================================================
--- trunk/jaxx-widgets/pom.xml 2013-04-07 10:33:20 UTC (rev 2650)
+++ trunk/jaxx-widgets/pom.xml 2013-04-08 13:14:39 UTC (rev 2651)
@@ -31,7 +31,7 @@
<parent>
<groupId>org.nuiton</groupId>
<artifactId>jaxx</artifactId>
- <version>2.5.16-SNAPSHOT</version>
+ <version>2.5.16</version>
</parent>
<groupId>org.nuiton.jaxx</groupId>
@@ -49,11 +49,11 @@
<!-- Source control management. -->
<scm>
- <connection>scm:svn:http://svn.nuiton.org/svn/jaxx/trunk/jaxx-widgets</connection>
+ <connection>scm:svn:http://svn.nuiton.org/svn/jaxx/tags/jaxx-2.5.16/jaxx-widgets</connection>
<developerConnection>
- scm:svn:http://svn.nuiton.org/svn/jaxx/trunk/jaxx-widgets
+ scm:svn:http://svn.nuiton.org/svn/jaxx/tags/jaxx-2.5.16/jaxx-widgets
</developerConnection>
- <url>http://nuiton.org/projects/jaxx/repository/show/trunkjaxx-widgets</url>
+ <url>http://nuiton.org/projects/jaxx/repository/show/trunkjaxx-widgets/tags/jaxx…</url>
</scm>
<dependencies>
Modified: trunk/pom.xml
===================================================================
--- trunk/pom.xml 2013-04-07 10:33:20 UTC (rev 2650)
+++ trunk/pom.xml 2013-04-08 13:14:39 UTC (rev 2651)
@@ -34,7 +34,7 @@
</parent>
<artifactId>jaxx</artifactId>
- <version>2.5.16-SNAPSHOT</version>
+ <version>2.5.16</version>
<modules>
<module>jaxx-runtime</module>
@@ -131,11 +131,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.16</connection>
<developerConnection>
- scm:svn:http://svn.nuiton.org/svn/jaxx/trunk
+ scm:svn:http://svn.nuiton.org/svn/jaxx/tags/jaxx-2.5.16
</developerConnection>
- <url>http://nuiton.org/projects/jaxx/repository/show/trunk</url>
+ <url>http://nuiton.org/projects/jaxx/repository/show/tags/jaxx-2.5.16</url>
</scm>
<distributionManagement>
1
0
r2650 - in trunk: jaxx-runtime/src/main/java/jaxx/runtime jaxx-runtime/src/main/java/jaxx/runtime/swing/session jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/bean
by tchemit@users.nuiton.org 07 Apr '13
by tchemit@users.nuiton.org 07 Apr '13
07 Apr '13
Author: tchemit
Date: 2013-04-07 12:33:20 +0200 (Sun, 07 Apr 2013)
New Revision: 2650
Url: http://nuiton.org/projects/jaxx/repository/revisions/2650
Log:
prepare release files
Modified:
trunk/jaxx-runtime/src/main/java/jaxx/runtime/FileChooserUtil.java
trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/session/JSplitPaneState.java
trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/session/JTabbedPaneState.java
trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/session/JTableState.java
trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/session/JXTableSwingSessionState.java
trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/session/State.java
trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/session/SwingSession.java
trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/session/WindowState.java
trunk/jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/bean/BeanFilterableComboBoxHandler.java
Modified: trunk/jaxx-runtime/src/main/java/jaxx/runtime/FileChooserUtil.java
===================================================================
--- trunk/jaxx-runtime/src/main/java/jaxx/runtime/FileChooserUtil.java 2013-04-07 10:03:11 UTC (rev 2649)
+++ trunk/jaxx-runtime/src/main/java/jaxx/runtime/FileChooserUtil.java 2013-04-07 10:33:20 UTC (rev 2650)
@@ -1,5 +1,29 @@
package jaxx.runtime;
+/*
+ * #%L
+ * JAXX :: Runtime
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2008 - 2013 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.FileUtil;
Property changes on: trunk/jaxx-runtime/src/main/java/jaxx/runtime/FileChooserUtil.java
___________________________________________________________________
Modified: svn:keywords
- Author Date Id Revision
+ Author Date Id Revision HeadURL
Modified: trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/session/JSplitPaneState.java
===================================================================
--- trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/session/JSplitPaneState.java 2013-04-07 10:03:11 UTC (rev 2649)
+++ trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/session/JSplitPaneState.java 2013-04-07 10:33:20 UTC (rev 2650)
@@ -1,5 +1,29 @@
package jaxx.runtime.swing.session;
+/*
+ * #%L
+ * JAXX :: Runtime
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2008 - 2013 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 javax.swing.*;
/**
Property changes on: trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/session/JSplitPaneState.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Modified: trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/session/JTabbedPaneState.java
===================================================================
--- trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/session/JTabbedPaneState.java 2013-04-07 10:03:11 UTC (rev 2649)
+++ trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/session/JTabbedPaneState.java 2013-04-07 10:33:20 UTC (rev 2650)
@@ -1,5 +1,29 @@
package jaxx.runtime.swing.session;
+/*
+ * #%L
+ * JAXX :: Runtime
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2008 - 2013 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 javax.swing.*;
/**
Property changes on: trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/session/JTabbedPaneState.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Modified: trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/session/JTableState.java
===================================================================
--- trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/session/JTableState.java 2013-04-07 10:03:11 UTC (rev 2649)
+++ trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/session/JTableState.java 2013-04-07 10:33:20 UTC (rev 2650)
@@ -1,5 +1,29 @@
package jaxx.runtime.swing.session;
+/*
+ * #%L
+ * JAXX :: Runtime
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2008 - 2013 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 javax.swing.*;
import javax.swing.table.TableColumn;
Property changes on: trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/session/JTableState.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Modified: trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/session/JXTableSwingSessionState.java
===================================================================
--- trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/session/JXTableSwingSessionState.java 2013-04-07 10:03:11 UTC (rev 2649)
+++ trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/session/JXTableSwingSessionState.java 2013-04-07 10:33:20 UTC (rev 2650)
@@ -1,5 +1,29 @@
package jaxx.runtime.swing.session;
+/*
+ * #%L
+ * JAXX :: Runtime
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2008 - 2013 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.jdesktop.swingx.JXTable;
import org.jdesktop.swingx.table.DefaultTableColumnModelExt;
import org.jdesktop.swingx.table.TableColumnExt;
Property changes on: trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/session/JXTableSwingSessionState.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Modified: trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/session/State.java
===================================================================
--- trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/session/State.java 2013-04-07 10:03:11 UTC (rev 2649)
+++ trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/session/State.java 2013-04-07 10:33:20 UTC (rev 2650)
@@ -1,5 +1,29 @@
package jaxx.runtime.swing.session;
+/*
+ * #%L
+ * JAXX :: Runtime
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2008 - 2013 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%
+ */
+
/**
* get(save) and set(restore) state of object passed in argument
*
Property changes on: trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/session/State.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Modified: trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/session/SwingSession.java
===================================================================
--- trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/session/SwingSession.java 2013-04-07 10:03:11 UTC (rev 2649)
+++ trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/session/SwingSession.java 2013-04-07 10:33:20 UTC (rev 2650)
@@ -2,8 +2,8 @@
* #%L
* Graphical Widget
*
- * $Id: SwingSession.java 300 2010-11-17 21:35:44Z sletellier $
- * $HeadURL: http://svn.nuiton.org/svn/nuiton-widgets/trunk/src/main/java/org/nuiton/wid… $
+ * $Id$
+ * $HeadURL$
* %%
* Copyright (C) 2004 - 2010 CodeLutin
* %%
@@ -68,11 +68,11 @@
*
* @author poussin
* @author kmorin
- * @version $Revision: 300 $
+ * @version $Revision$
* @since 2.5.16
*
- * Last update: $Date: 2010-11-17 22:35:44 +0100 (mer. 17 nov. 2010) $
- * by : $Author: sletellier $
+ * Last update: $Date$
+ * by : $Author$
*/
public class SwingSession {
Property changes on: trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/session/SwingSession.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Modified: trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/session/WindowState.java
===================================================================
--- trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/session/WindowState.java 2013-04-07 10:03:11 UTC (rev 2649)
+++ trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/session/WindowState.java 2013-04-07 10:33:20 UTC (rev 2650)
@@ -1,5 +1,29 @@
package jaxx.runtime.swing.session;
+/*
+ * #%L
+ * JAXX :: Runtime
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2008 - 2013 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 javax.swing.*;
import java.awt.*;
Property changes on: trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/session/WindowState.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Modified: trunk/jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/bean/BeanFilterableComboBoxHandler.java
===================================================================
--- trunk/jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/bean/BeanFilterableComboBoxHandler.java 2013-04-07 10:03:11 UTC (rev 2649)
+++ trunk/jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/bean/BeanFilterableComboBoxHandler.java 2013-04-07 10:33:20 UTC (rev 2650)
@@ -1,23 +1,23 @@
/*
* #%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
+ * 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
+ *
+ * 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%
1
0
r2649 - in trunk: jaxx-demo/src/main/java/jaxx/demo/feature/databinding jaxx-runtime/src/main/java/jaxx/runtime
by tchemit@users.nuiton.org 07 Apr '13
by tchemit@users.nuiton.org 07 Apr '13
07 Apr '13
Author: tchemit
Date: 2013-04-07 12:03:11 +0200 (Sun, 07 Apr 2013)
New Revision: 2649
Url: http://nuiton.org/projects/jaxx/repository/revisions/2649
Log:
fixes #2651: Introduce API to chosse a file or a directory (moved from nuiton-utils#FileUtil)
Added:
trunk/jaxx-runtime/src/main/java/jaxx/runtime/FileChooserUtil.java
Modified:
trunk/jaxx-demo/src/main/java/jaxx/demo/feature/databinding/BindingExtremeDemo.jaxx
Modified: trunk/jaxx-demo/src/main/java/jaxx/demo/feature/databinding/BindingExtremeDemo.jaxx
===================================================================
--- trunk/jaxx-demo/src/main/java/jaxx/demo/feature/databinding/BindingExtremeDemo.jaxx 2013-04-04 16:32:02 UTC (rev 2648)
+++ trunk/jaxx-demo/src/main/java/jaxx/demo/feature/databinding/BindingExtremeDemo.jaxx 2013-04-07 10:03:11 UTC (rev 2649)
@@ -29,6 +29,7 @@
<import>
jaxx.runtime.JAXXBinding
+ jaxx.runtime.FileChooserUtil
java.awt.Color
javax.swing.border.TitledBorder
javax.swing.DefaultListModel
@@ -148,7 +149,7 @@
</cell>
<cell>
<JButton text="file..."
- onActionPerformed='setFile(org.nuiton.util.FileUtil.getFile(this, new String[0]))'/>
+ onActionPerformed='setFile(FileChooserUtil.getFile(this, new String[0]))'/>
</cell>
</row>
@@ -207,7 +208,7 @@
</cell>
<cell>
<JButton text="model0.file..."
- onActionPerformed='model0.setFile(org.nuiton.util.FileUtil.getFile(this,new String[0]))'/>
+ onActionPerformed='model0.setFile(FileChooserUtil.getFile(this,new String[0]))'/>
</cell>
</row>
@@ -269,7 +270,7 @@
</cell>
<cell>
<JButton text="model1.file..."
- onActionPerformed='model1.setFile(org.nuiton.util.FileUtil.getFile(this,new String[0]))'/>
+ onActionPerformed='model1.setFile(FileChooserUtil.getFile(this,new String[0]))'/>
</cell>
</row>
Added: trunk/jaxx-runtime/src/main/java/jaxx/runtime/FileChooserUtil.java
===================================================================
--- trunk/jaxx-runtime/src/main/java/jaxx/runtime/FileChooserUtil.java (rev 0)
+++ trunk/jaxx-runtime/src/main/java/jaxx/runtime/FileChooserUtil.java 2013-04-07 10:03:11 UTC (rev 2649)
@@ -0,0 +1,332 @@
+package jaxx.runtime;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.nuiton.util.FileUtil;
+
+import javax.swing.JFileChooser;
+import java.awt.Component;
+import java.io.File;
+
+/**
+ * To help choosing a file / directory.
+ *
+ * Was previously in {@code org.nuiton.util.FileUtil} from
+ * {@code nuiton-utils} project.
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 2.5.16
+ */
+public class FileChooserUtil {
+
+ /** Logger. */
+ private static final Log log = LogFactory.getLog(FileChooserUtil.class);
+
+ protected static File currentDirectory = new File(".");
+
+ public static void setCurrentDirectory(File dir) {
+ currentDirectory = dir;
+ }
+
+ public static File getCurrentDirectory() {
+ return currentDirectory;
+ }
+
+ protected FileChooserUtil() {
+ // no instance please
+ }
+
+
+ public static class PatternChooserFilter extends javax.swing.filechooser.FileFilter {
+ protected String pattern;
+
+ protected String description;
+
+ public PatternChooserFilter(String pattern, String description) {
+ this.pattern = pattern;
+ this.description = description;
+ }
+
+ @Override
+ public boolean accept(File f) {
+ return f.isDirectory() || f.getAbsolutePath().matches(pattern);
+ }
+
+ @Override
+ public String getDescription() {
+ return description;
+ }
+
+ }
+
+
+ /**
+ * Retourne le nom du fichier entre dans la boite de dialogue.
+ * Si le bouton annuler est utilisé, ou qu'il y a une erreur retourne null.
+ *
+ * @param patternOrDescriptionFilters les filtres a utiliser, les chaines doivent etre données
+ * par deux, le pattern du filtre + la description du filtre
+ * @return le fichier accepté, ou null si rien n'est chois ou l'utilisateur a annulé
+ * @see #getFile(javax.swing.filechooser.FileFilter...)
+ */
+ public static File getFile(String... patternOrDescriptionFilters) {
+ File result;
+ result = getFile(null, patternOrDescriptionFilters);
+ return result;
+ }
+
+ /**
+ * Retourne le nom du fichier entre dans la boite de dialogue.
+ * Si le bouton annuler est utilisé, ou qu'il y a une erreur retourne null.
+ *
+ * @param filters les filtres a ajouter
+ * @return le fichier accepté, ou null si rien n'est chois ou l'utilisateur a annulé
+ */
+ public static File getFile(javax.swing.filechooser.FileFilter... filters) {
+ File result = getFile(null, filters);
+ return result;
+ }
+
+ /**
+ * Retourne le nom du fichier entre dans la boite de dialogue.
+ * Si le bouton annuler est utilisé, ou qu'il y a une erreur retourne null.
+ *
+ * @param parent le component parent du dialog
+ * @param patternOrDescriptionFilters les filtres a utiliser, les chaines doivent etre données
+ * par deux, le pattern du filtre + la description du filtre
+ * @return le fichier accepté, ou null si rien n'est chois ou l'utilisateur a annulé
+ * @see #getFile(javax.swing.filechooser.FileFilter...)
+ */
+ public static File getFile(Component parent,
+ String... patternOrDescriptionFilters) {
+ File result;
+ result = getFile("Ok", "Ok", parent, patternOrDescriptionFilters);
+ return result;
+ }
+
+ /**
+ * Retourne le nom du fichier entre dans la boite de dialogue.
+ * Si le bouton annuler est utilisé, ou qu'il y a une erreur retourne null.
+ *
+ * @param title le titre de la boite de dialogue
+ * @param approvalText le label du boutton d'acceptation
+ * @param parent le component parent du dialog
+ * @param patternOrDescriptionFilters les filtres a utiliser, les chaines doivent etre données
+ * par deux, le pattern du filtre + la description du filtre
+ * @return le fichier accepté, ou null si rien n'est chois ou l'utilisateur a annulé
+ * @see #getFile(javax.swing.filechooser.FileFilter...)
+ */
+ public static File getFile(String title,
+ String approvalText,
+ Component parent,
+ String... patternOrDescriptionFilters) {
+
+ if (patternOrDescriptionFilters.length % 2 != 0) {
+ throw new IllegalArgumentException(
+ "Arguments must be (pattern, description) couple");
+ }
+ javax.swing.filechooser.FileFilter[] filters =
+ new javax.swing.filechooser.FileFilter[
+ patternOrDescriptionFilters.length / 2];
+ for (int i = 0; i < filters.length; i++) {
+ String pattern = patternOrDescriptionFilters[i * 2];
+ String description = patternOrDescriptionFilters[i * 2 + 1];
+ filters[i] = new PatternChooserFilter(pattern, description);
+ }
+ File result;
+ result = getFile(title, approvalText, parent, filters);
+ return result;
+ }
+
+
+ /**
+ * Retourne le nom du fichier entre dans la boite de dialogue.
+ * Si le bouton annuler est utilisé, ou qu'il y a une erreur retourne null.
+ *
+ * @param parent le component parent du dialog
+ * @param filters les filtres a ajouter
+ * @return le fichier accepté, ou null si rien n'est chois ou l'utilisateur a annulé
+ */
+ public static File getFile(Component parent,
+ javax.swing.filechooser.FileFilter... filters) {
+ File result = getFile("Ok", "Ok", parent, filters);
+ return result;
+ }
+
+ /**
+ * Retourne le nom du fichier entre dans la boite de dialogue.
+ * Si le bouton annuler est utilisé, ou qu'il y a une erreur retourne null.
+ *
+ * @param title le titre de la boite de dialogue
+ * @param approvalText le label du boutton d'acceptation
+ * @param parent le component parent du dialog
+ * @param filters les filtres a ajouter
+ * @return le fichier accepté, ou null si rien n'est chois ou l'utilisateur a annulé
+ */
+ public static File getFile(String title,
+ String approvalText,
+ Component parent,
+ javax.swing.filechooser.FileFilter... filters) {
+ try {
+ JFileChooser chooser = new JFileChooser(currentDirectory);
+
+ chooser.setDialogType(JFileChooser.CUSTOM_DIALOG);
+ if (filters.length > 0) {
+ if (filters.length == 1) {
+ chooser.setFileFilter(filters[0]);
+ } else {
+ for (javax.swing.filechooser.FileFilter filter : filters) {
+ chooser.addChoosableFileFilter(filter);
+ }
+ }
+ }
+ chooser.setFileSelectionMode(JFileChooser.FILES_ONLY);
+ chooser.setDialogTitle(title);
+ int returnVal = chooser.showDialog(parent, approvalText);
+ if (returnVal == JFileChooser.APPROVE_OPTION) {
+ File theFile = chooser.getSelectedFile();
+ if (theFile != null) {
+ currentDirectory = theFile;
+ return theFile.getAbsoluteFile();
+ }
+ }
+ } catch (Exception eee) {
+ log.warn("Erreur:", eee);
+ }
+ return null;
+ }
+
+ /**
+ * Retourne le nom du fichier entre dans la boite de dialogue.
+ * Si le bouton annuler est utilisé, ou qu'il y a une erreur retourne null.
+ *
+ * @param title le titre de la boite de dialogue
+ * @param approvalText le label du boutton d'acceptation
+ * @param parent le component parent du dialog
+ * @param patternOrDescriptionFilters les filtres a utiliser, les chaines doivent etre données
+ * par deux, le pattern du filtre + la description du filtre
+ * @return le fichier accepté, ou null si rien n'est chois ou l'utilisateur a annulé
+ */
+ public static File saveFile(String filename,
+ String title,
+ String approvalText,
+ Component parent,
+ String... patternOrDescriptionFilters) {
+
+ if (patternOrDescriptionFilters.length % 2 != 0) {
+ throw new IllegalArgumentException(
+ "Arguments must be (pattern, description) couple");
+ }
+ javax.swing.filechooser.FileFilter[] filters =
+ new javax.swing.filechooser.FileFilter[
+ patternOrDescriptionFilters.length / 2];
+ for (int i = 0; i < filters.length; i++) {
+ String pattern = patternOrDescriptionFilters[i * 2];
+ String description = patternOrDescriptionFilters[i * 2 + 1];
+ filters[i] = new FileUtil.PatternChooserFilter(pattern, description);
+ }
+ File result;
+ result = saveFile(filename, title, approvalText, parent, filters);
+ return result;
+ }
+
+ /**
+ * Retourne le nom du fichier entre dans la boite de dialogue.
+ * Si le bouton annuler est utilisé, ou qu'il y a une erreur retourne null.
+ *
+ * @param title le titre de la boite de dialogue
+ * @param approvalText le label du boutton d'acceptation
+ * @param parent le component parent du dialog
+ * @param filters les filtres a ajouter
+ * @return le fichier accepté, ou null si rien n'est chois ou l'utilisateur a annulé
+ */
+ public static File saveFile(String filename,
+ String title,
+ String approvalText,
+ Component parent,
+ javax.swing.filechooser.FileFilter... filters) {
+ File selectedFile = new File(FileUtil.getCurrentDirectory(), filename);
+ JFileChooser chooser = new JFileChooser(selectedFile);
+
+ chooser.setDialogType(JFileChooser.SAVE_DIALOG);
+ chooser.setSelectedFile(selectedFile);
+ if (filters.length > 0) {
+ if (filters.length == 1) {
+ chooser.setFileFilter(filters[0]);
+ } else {
+ for (javax.swing.filechooser.FileFilter filter : filters) {
+ chooser.addChoosableFileFilter(filter);
+ }
+ }
+ }
+ chooser.setFileSelectionMode(JFileChooser.FILES_ONLY);
+ chooser.setDialogTitle(title);
+
+ File result = null;
+
+ int returnVal = chooser.showDialog(parent, approvalText);
+ if (returnVal == JFileChooser.APPROVE_OPTION) {
+ result = chooser.getSelectedFile();
+ if (result != null) {
+ FileUtil.setCurrentDirectory(result);
+ result = result.getAbsoluteFile();
+ }
+ }
+ return result;
+ }
+
+ /**
+ * @return le nom du repertoire entre dans la boite de dialogue.
+ * Si le bouton annuler est utilisé, ou qu'il y a une erreur retourne
+ * null.
+ */
+ public static String getDirectory() {
+ return getDirectory(null, "Ok", "Ok");
+ }
+
+ /**
+ * @param title le nom de la boite de dialogue
+ * @param approvalText le texte de l'action d'acceptation du répertoire dans le file chooser
+ * @return le nom du repertoire entre dans la boite de dialogue.
+ * Si le bouton annuler est utilisé, ou qu'il y a une erreur retourne
+ * null.
+ */
+ public static String getDirectory(String title, String approvalText) {
+ String result = getDirectory(null, title, approvalText);
+ return result;
+ }
+
+ /**
+ * @param parent le component parent du dialog
+ * @param title le nom de la boite de dialogue
+ * @param approvalText le texte de l'action d'acceptation du répertoire dans le file chooser
+ * @return le nom du repertoire entre dans la boite de dialogue.
+ * Si le bouton annuler est utilisé, ou qu'il y a une erreur retourne
+ * null.
+ */
+ public static String getDirectory(Component parent,
+ String title,
+ String approvalText) {
+ try {
+ JFileChooser chooser = new JFileChooser(currentDirectory);
+ chooser.setDialogType(JFileChooser.CUSTOM_DIALOG);
+ chooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
+ chooser.setDialogTitle(title);
+ int returnVal = chooser.showDialog(parent, approvalText);
+ if (returnVal == JFileChooser.APPROVE_OPTION) {
+ File theFile = chooser.getSelectedFile();
+ if (theFile != null) {
+ currentDirectory = theFile;
+ if (theFile.isDirectory()) {
+ return theFile.getAbsolutePath();
+ }
+ }
+ } else {
+ return null;
+ }
+ } catch (Exception eee) {
+ log.warn("Erreur:", eee);
+ }
+ return null;
+ }
+}
Property changes on: trunk/jaxx-runtime/src/main/java/jaxx/runtime/FileChooserUtil.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
1
0
r2648 - trunk/jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/bean
by kmorin@users.nuiton.org 04 Apr '13
by kmorin@users.nuiton.org 04 Apr '13
04 Apr '13
Author: kmorin
Date: 2013-04-04 18:32:02 +0200 (Thu, 04 Apr 2013)
New Revision: 2648
Url: http://nuiton.org/projects/jaxx/repository/revisions/2648
Log:
fixes #2649 BeanFilterableComboBox - the text is not cleared on reset clicked
Modified:
trunk/jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/bean/BeanFilterableComboBoxHandler.java
Modified: trunk/jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/bean/BeanFilterableComboBoxHandler.java
===================================================================
--- trunk/jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/bean/BeanFilterableComboBoxHandler.java 2013-04-02 14:02:07 UTC (rev 2647)
+++ trunk/jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/bean/BeanFilterableComboBoxHandler.java 2013-04-04 16:32:02 UTC (rev 2648)
@@ -339,7 +339,13 @@
}
public void reset() {
- ui.setSelectedItem(null);
+ if (ui.getSelectedItem() != null) {
+ ui.setSelectedItem(null);
+ } else {
+ JTextComponent editorComponent = (JTextComponent) ui.getCombobox().getEditor().getEditorComponent();
+ editorComponent.setText("");
+ }
+
JComboBox comboBox = ui.getCombobox();
if (comboBox.isShowing()) {
comboBox.hidePopup();
1
0
r2647 - in trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing: . session
by kmorin@users.nuiton.org 02 Apr '13
by kmorin@users.nuiton.org 02 Apr '13
02 Apr '13
Author: kmorin
Date: 2013-04-02 16:02:07 +0200 (Tue, 02 Apr 2013)
New Revision: 2647
Url: http://nuiton.org/projects/jaxx/repository/revisions/2647
Log:
fixes #2646 Move the SwingSession from nuiton-widget
Added:
trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/session/
trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/session/JSplitPaneState.java
trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/session/JTabbedPaneState.java
trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/session/JTableState.java
trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/session/JXTableSwingSessionState.java
trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/session/State.java
trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/session/SwingSession.java
trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/session/WindowState.java
Added: trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/session/JSplitPaneState.java
===================================================================
--- trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/session/JSplitPaneState.java (rev 0)
+++ trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/session/JSplitPaneState.java 2013-04-02 14:02:07 UTC (rev 2647)
@@ -0,0 +1,75 @@
+package jaxx.runtime.swing.session;
+
+import javax.swing.*;
+
+/**
+ * State for JSplit
+ * FIXME add listener for divider move action
+ *
+ * @author poussin
+ * @author kmorin <kmorin(a)codelutin.com>
+ * @since 2.5.16
+ */
+public class JSplitPaneState implements State {
+
+ protected int dividerLocation = -1;
+
+ protected int orientation = JSplitPane.HORIZONTAL_SPLIT;
+
+ public JSplitPaneState() {
+ }
+
+ public int getDividerLocation() {
+ return dividerLocation;
+ }
+
+ public void setDividerLocation(int dividerLocation) {
+ this.dividerLocation = dividerLocation;
+ }
+
+ public int getOrientation() {
+ return orientation;
+ }
+
+ public void setOrientation(int orientation) {
+ this.orientation = orientation;
+ }
+
+ protected JSplitPane checkComponent(Object o) {
+ if (o == null) {
+ throw new IllegalArgumentException("null component");
+ }
+ if (!(o instanceof JSplitPane)) {
+ throw new IllegalArgumentException("invalid component");
+ }
+ return (JSplitPane) o;
+ }
+
+ @Override
+ public State getState(Object o) {
+ JSplitPane p = checkComponent(o);
+
+ JSplitPaneState result = new JSplitPaneState();
+ result.setDividerLocation(p.getUI().getDividerLocation(p));
+ result.setOrientation(p.getOrientation());
+
+ return result;
+ }
+
+ @Override
+ public void setState(Object o, State state) {
+ if (state == null) {
+ return;
+ }
+ JSplitPane p = checkComponent(o);
+ if (state instanceof JSplitPaneState) {
+ JSplitPaneState sps = (JSplitPaneState) state;
+ if (sps.getDividerLocation() != -1
+ && p.getOrientation() == sps.getOrientation()) {
+ p.setDividerLocation(sps.getDividerLocation());
+ }
+ } else {
+ throw new IllegalArgumentException("invalid state");
+ }
+ }
+}
Added: trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/session/JTabbedPaneState.java
===================================================================
--- trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/session/JTabbedPaneState.java (rev 0)
+++ trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/session/JTabbedPaneState.java 2013-04-02 14:02:07 UTC (rev 2647)
@@ -0,0 +1,75 @@
+package jaxx.runtime.swing.session;
+
+import javax.swing.*;
+
+/**
+ * State for the JTabbedPane
+ *
+ * @author poussin
+ * @author kmorin <kmorin(a)codelutin.com>
+ * @since 2.5.16
+ */
+public class JTabbedPaneState implements State {
+
+ protected int selectedIndex = -1;
+
+ protected int tabCount;
+
+ public JTabbedPaneState() {
+ }
+
+ public int getSelectedIndex() {
+ return selectedIndex;
+ }
+
+ public void setSelectedIndex(int selectedIndex) {
+ this.selectedIndex = selectedIndex;
+ }
+
+ public int getTabCount() {
+ return tabCount;
+ }
+
+ public void setTabCount(int tabCount) {
+ this.tabCount = tabCount;
+ }
+
+
+ protected JTabbedPane checkComponent(Object o) {
+ if (o == null) {
+ throw new IllegalArgumentException("null component");
+ }
+ if (!(o instanceof JTabbedPane)) {
+ throw new IllegalArgumentException("invalid component");
+ }
+ return (JTabbedPane) o;
+ }
+
+ @Override
+ public State getState(Object o) {
+ JTabbedPaneState result = new JTabbedPaneState();
+
+ JTabbedPane p = checkComponent(o);
+ result.setSelectedIndex(p.getSelectedIndex());
+ result.setTabCount(p.getTabCount());
+
+ return result;
+ }
+
+ @Override
+ public void setState(Object o, State state) {
+ if (state == null) {
+ return;
+ }
+ if (state instanceof JTabbedPaneState) {
+ JTabbedPane p = checkComponent(o);
+ JTabbedPaneState tps = (JTabbedPaneState) state;
+ if (tps.getSelectedIndex() != -1
+ && p.getTabCount() == tps.getTabCount()) {
+ p.setSelectedIndex(tps.getSelectedIndex());
+ }
+ } else {
+ throw new IllegalArgumentException("invalid state");
+ }
+ }
+}
Added: trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/session/JTableState.java
===================================================================
--- trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/session/JTableState.java (rev 0)
+++ trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/session/JTableState.java 2013-04-02 14:02:07 UTC (rev 2647)
@@ -0,0 +1,83 @@
+package jaxx.runtime.swing.session;
+
+import javax.swing.*;
+import javax.swing.table.TableColumn;
+
+/**
+ * State for JTable.
+ * TODO add support for column order change
+ *
+ * @author poussin
+ * @author kmorin <kmorin(a)codelutin.com>
+ * @since 2.5.16
+ *
+ */
+public class JTableState implements State {
+
+ protected int[] columnWidths = new int[0];
+
+ public JTableState() {
+ }
+
+ public JTableState(int[] columnWidths) {
+ this.columnWidths = columnWidths;
+ }
+
+ public int[] getColumnWidths() {
+ return columnWidths;
+ }
+
+ public void setColumnWidths(int[] columnWidths) {
+ this.columnWidths = columnWidths;
+ }
+
+ protected JTable checkComponent(Object o) {
+ if (o == null) {
+ throw new IllegalArgumentException("null component");
+ }
+ if (!(o instanceof JTable)) {
+ throw new IllegalArgumentException("invalid component");
+ }
+ return (JTable) o;
+ }
+
+ @Override
+ public State getState(Object o) {
+ JTable table = checkComponent(o);
+ int[] columnWidths = new int[table.getColumnCount()];
+ boolean resizableColumnExists = false;
+ for (int i = 0; i < columnWidths.length; i++) {
+ TableColumn tc = table.getColumnModel().getColumn(i);
+ columnWidths[i] = (tc.getResizable()) ? tc.getWidth() : -1;
+ if (tc.getResizable()) {
+ resizableColumnExists = true;
+ }
+ }
+ JTableState result = null;
+ if (resizableColumnExists) {
+ result = new JTableState();
+ result.setColumnWidths(columnWidths);
+ }
+ return result;
+ }
+
+ @Override
+ public void setState(Object o, State state) {
+ if (!(state instanceof JTableState)) {
+ throw new IllegalArgumentException("invalid state");
+ }
+ JTable table = checkComponent(o);
+ int[] columnWidths = ((JTableState) state).getColumnWidths();
+ if (columnWidths != null
+ && table.getColumnCount() == columnWidths.length) {
+ for (int i = 0; i < columnWidths.length; i++) {
+ if (columnWidths[i] != -1) {
+ TableColumn tc = table.getColumnModel().getColumn(i);
+ if (tc.getResizable()) {
+ tc.setPreferredWidth(columnWidths[i]);
+ }
+ }
+ }
+ }
+ }
+}
Added: trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/session/JXTableSwingSessionState.java
===================================================================
--- trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/session/JXTableSwingSessionState.java (rev 0)
+++ trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/session/JXTableSwingSessionState.java 2013-04-02 14:02:07 UTC (rev 2647)
@@ -0,0 +1,85 @@
+package jaxx.runtime.swing.session;
+
+import org.jdesktop.swingx.JXTable;
+import org.jdesktop.swingx.table.DefaultTableColumnModelExt;
+import org.jdesktop.swingx.table.TableColumnExt;
+
+import javax.swing.table.TableColumn;
+import java.util.List;
+
+/**
+ * @author kmorin <morin(a)codelutin.com>
+ * @since 2.5.16
+ */
+public class JXTableSwingSessionState extends JTableState {
+
+ protected boolean[] hiddenColumns;
+
+ public JXTableSwingSessionState() {
+ super();
+ }
+
+ public JXTableSwingSessionState(int[] columnWidths, boolean[] hiddenColumns) {
+ super(columnWidths);
+ this.hiddenColumns = hiddenColumns;
+ }
+
+ public boolean[] getHiddenColumns() {
+ return hiddenColumns;
+ }
+
+ public void setHiddenColumns(boolean[] hiddenColumns) {
+ this.hiddenColumns = hiddenColumns;
+ }
+
+ protected JXTable checkComponent(Object o) {
+ if (o == null) {
+ throw new IllegalArgumentException("null component");
+ }
+ if (!(o instanceof JXTable)) {
+ throw new IllegalArgumentException("invalid component");
+ }
+ return (JXTable) o;
+ }
+
+ @Override
+ public State getState(Object o) {
+ JXTable table = checkComponent(o);
+ JXTableSwingSessionState result = new JXTableSwingSessionState();
+ JTableState state = (JTableState) super.getState(o);
+ if (state != null) {
+ result.setColumnWidths(state.getColumnWidths());
+ }
+ DefaultTableColumnModelExt columnModel =
+ (DefaultTableColumnModelExt) table.getColumnModel();
+ List<TableColumn> columns = columnModel.getColumns(true);
+ boolean[] hiddenColumns = new boolean[columns.size()];
+ for (int i = 0; i < hiddenColumns.length; i++) {
+ TableColumnExt tc = (TableColumnExt) columns.get(i);
+ hiddenColumns[i] = !tc.isVisible();
+ }
+ result.setHiddenColumns(hiddenColumns);
+
+ return result;
+ }
+
+ @Override
+ public void setState(Object o, State state) {
+ if (!(state instanceof JXTableSwingSessionState)) {
+ throw new IllegalArgumentException("invalid state");
+ }
+ super.setState(o, state);
+ JXTable table = checkComponent(o);
+ boolean[] hiddenColumns = ((JXTableSwingSessionState) state).getHiddenColumns();
+ DefaultTableColumnModelExt columnModel =
+ (DefaultTableColumnModelExt) table.getColumnModel();
+ List<TableColumn> columns = columnModel.getColumns(true);
+ if (hiddenColumns != null
+ && columnModel.getColumnCount(true) == columns.size()) {
+ for (int i = 0; i < table.getColumnCount(); i++) {
+ TableColumnExt tc = (TableColumnExt) columns.get(i);
+ tc.setVisible(!hiddenColumns[i]);
+ }
+ }
+ }
+}
Added: trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/session/State.java
===================================================================
--- trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/session/State.java (rev 0)
+++ trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/session/State.java 2013-04-02 14:02:07 UTC (rev 2647)
@@ -0,0 +1,16 @@
+package jaxx.runtime.swing.session;
+
+/**
+ * get(save) and set(restore) state of object passed in argument
+ *
+ * @author poussin
+ * @author kmorin <kmorin(a)codelutin.com>
+ * @since 2.5.16
+ */
+public interface State {
+
+ State getState(Object o);
+
+ void setState(Object o, State state);
+
+}
Added: trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/session/SwingSession.java
===================================================================
--- trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/session/SwingSession.java (rev 0)
+++ trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/session/SwingSession.java 2013-04-02 14:02:07 UTC (rev 2647)
@@ -0,0 +1,339 @@
+/*
+ * #%L
+ * Graphical Widget
+ *
+ * $Id: SwingSession.java 300 2010-11-17 21:35:44Z sletellier $
+ * $HeadURL: http://svn.nuiton.org/svn/nuiton-widgets/trunk/src/main/java/org/nuiton/wid… $
+ * %%
+ * Copyright (C) 2004 - 2010 CodeLutin
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Lesser Public License for more details.
+ *
+ * You should have received a copy of the GNU General Lesser Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/lgpl-3.0.html>.
+ * #L%
+ */
+package jaxx.runtime.swing.session;
+
+
+import com.google.common.collect.Maps;
+import com.google.common.collect.Sets;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.jdesktop.swingx.JXTable;
+
+import javax.swing.*;
+import javax.swing.table.AbstractTableModel;
+import javax.swing.table.TableColumn;
+import javax.swing.table.TableModel;
+import java.awt.*;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.beans.*;
+import java.io.*;
+import java.util.*;
+
+/**
+ * Use to store and restore position and size of application. Default supported widgets
+ * are:
+ * <li> java.awt.Window (and subclasses)
+ * <li> javax.swing.JTabbedPane (and subclasses)
+ * <li> javax.swing.JSplitPane (and subclasses)
+ * <li> org.jdesktop.swingx.JXTable (and subclasses)
+ * <li> javax.swing.JTable (and subclasses)
+ *
+ *
+ * usage:
+ * <li> create SwingSession object
+ * <li> add component that you want save
+ * <li> explicite call to save
+ *
+ * You can use same SwingSession for multiple window but in this case you must
+ * have setName for each window with different name, otherwize there are
+ * collision between window component and result is undetermisitic
+ *
+ * This code is partialy inspired from http://kenai.com/projects/bsaf/pages/Home
+ * project. This project is under LGPL v2.1 license. We can't reuse directly this
+ * library because to many fields and methods are private and we can't implements
+ * it and modify some behavior.
+ *
+ * @author poussin
+ * @author kmorin
+ * @version $Revision: 300 $
+ * @since 2.5.16
+ *
+ * Last update: $Date: 2010-11-17 22:35:44 +0100 (mer. 17 nov. 2010) $
+ * by : $Author: sletellier $
+ */
+public class SwingSession {
+
+ private static final Log log = LogFactory.getLog(SwingSession.class);
+
+ protected File file;
+
+ protected boolean autoSave;
+
+ protected Set<Component> registeredComponent = Sets.newIdentityHashSet();
+
+ /** State object registered to get and set State.
+ * key: class of component managed by the state; value: the state*/
+ protected Map<Class, State> stateManager = Maps.newHashMap();
+
+ /** state of all component added with add method.
+ * key: path of compoenent; value: State */
+ protected Map<String, State> states;
+
+ public SwingSession(File file, boolean autoSave) {
+ this.file = file;
+ this.autoSave = autoSave;
+ stateManager.put(Window.class, new WindowState());
+ stateManager.put(JTable.class, new JTableState());
+ stateManager.put(JTabbedPane.class, new JTabbedPaneState());
+ stateManager.put(JSplitPane.class, new JSplitPaneState());
+ stateManager.put(JXTable.class, new JXTableSwingSessionState());
+
+ states = loadStates(file);
+ if (states == null) {
+ states = Maps.newHashMap();
+ }
+ }
+
+ @Override
+ protected void finalize() throws Throwable {
+ save();
+ super.finalize();
+ }
+
+
+ /* If an exception occurs in the XMLEncoder/Decoder, we want
+ * to throw an IOException. The exceptionThrow listener method
+ * doesn't throw a checked exception so we just set a flag
+ * here and check it when the encode/decode operation finishes
+ */
+ static private class AbortExceptionListener implements ExceptionListener {
+
+ public Exception exception = null;
+
+ @Override
+ public void exceptionThrown(Exception e) {
+ if (exception == null) {
+ exception = e;
+ }
+ }
+ }
+
+ /* There are some (old) Java classes that aren't proper beans. Rectangle
+ * is one of these. When running within the secure sandbox, writing a
+ * Rectangle with XMLEncoder causes a security exception because
+ * DefaultPersistenceDelegate calls Field.setAccessible(true) to gain
+ * access to private fields. This is a workaround for that problem.
+ * A bug has been filed, see JDK bug ID 4741757
+ */
+ private static class RectanglePD extends DefaultPersistenceDelegate {
+
+ public RectanglePD() {
+ super(new String[]{"x", "y", "width", "height"});
+ }
+
+ @Override
+ protected Expression instantiate(Object oldInstance, Encoder out) {
+ Rectangle oldR = (Rectangle) oldInstance;
+ Object[] constructorArgs = new Object[]{
+ oldR.x, oldR.y, oldR.width, oldR.height
+ };
+ return new Expression(oldInstance, oldInstance.getClass(), "new", constructorArgs);
+ }
+ }
+
+ public void save() {
+ updateState();
+ AbortExceptionListener el = new AbortExceptionListener();
+ ByteArrayOutputStream bst = new ByteArrayOutputStream();
+ XMLEncoder e = null;
+ /* Buffer the XMLEncoder's output so that decoding errors don't
+ * cause us to trash the current version of the specified file.
+ */
+ try {
+ e = new XMLEncoder(bst);
+ e.setPersistenceDelegate(Rectangle.class, new RectanglePD());
+ e.setExceptionListener(el);
+ e.writeObject(states);
+ } finally {
+ if (e != null) {
+ e.close();
+ }
+ }
+ if (el.exception != null) {
+ log.warn("save failed \"" + file + "\"", el.exception);
+ } else {
+ OutputStream ost = null;
+ try {
+ ost = new FileOutputStream(file);
+ ost.write(bst.toByteArray());
+ } catch (IOException eee) {
+ log.warn("save failed \"" + file + "\"", eee);
+ } finally {
+ if (ost != null) {
+ try {
+ ost.close();
+ } catch (IOException eee) {
+ log.warn("can't close properly \"" + file + "\"", eee);
+ }
+ }
+ }
+ }
+ }
+
+ /**
+ * Loads the states from the file
+ */
+ public Map<String, State> loadStates(File file) {
+ Map<String, State> result = null;
+ if (file.exists()) {
+ XMLDecoder d = null;
+ try {
+ InputStream ist = new FileInputStream(file);
+ d = new XMLDecoder(ist);
+ AbortExceptionListener eee = new AbortExceptionListener();
+ d.setExceptionListener(eee);
+ Object bean = d.readObject();
+ if (eee.exception != null) {
+ log.warn("load failed \"" + file + "\"", eee.exception);
+ } else {
+ result = (Map<String, State>) bean;
+ }
+ } catch (IOException eee) {
+ log.warn("load failed \"" + file + "\"", eee);
+ } finally {
+ if (d != null) {
+ d.close();
+ }
+ }
+ }
+ return result;
+ }
+
+ public void updateState() {
+ walkThrowComponent("", registeredComponent,
+ new SaveStateAction());
+ }
+
+ public void add(Component c) {
+ if (registeredComponent.contains(c)) {
+ log.warn(String.format(
+ "Component already added %s(%s)", c.getClass(), c.getName()));
+ } else {
+ registeredComponent.add(c);
+ walkThrowComponent("", Collections.singleton(c),
+ new RestoreStateAction());
+ }
+ }
+
+ /**
+ * Remove component from component to save
+ * @param c
+ */
+ public void remove(Component c) {
+ registeredComponent.remove(c);
+ }
+
+ protected String getComponentName(Component c) {
+ String name = c.getName();
+ if (name == null) {
+ int n = c.getParent().getComponentZOrder(c);
+ if (n >= 0) {
+ Class clazz = c.getClass();
+ name = clazz.getSimpleName();
+ if (name.length() == 0) {
+ name = "Anonymous" + clazz.getSuperclass().getSimpleName();
+ }
+ name = name + n;
+ } else {
+ // Implies that the component tree is changing
+ // while we're computing the path. Punt.
+ log.warn("Couldn't compute pathname for " + c);
+ }
+ }
+ return name;
+ }
+
+ public State getStateManager(Class clazz) {
+ State result = null;
+ while (result == null && clazz != null) {
+ result = stateManager.get(clazz);
+ clazz = clazz.getSuperclass();
+ }
+ return result;
+ }
+
+ public void addToStateManager(Class component, State state) {
+ stateManager.put(component, state);
+ }
+
+ public State getStates(String path) {
+ return states.get(path);
+ }
+
+ public void setStates(String path, State state) {
+ this.states.put(path, state);
+ }
+
+ protected void walkThrowComponent(
+ String path, Collection<Component> roots, Action action) {
+ for (Component root : roots) {
+ if (root != null) {
+ String pathname = path + "/" + getComponentName(root);
+ State state = getStateManager(root.getClass());
+ if (state != null) {
+ action.doAction(this, pathname, root);
+ }
+ if (root instanceof Container) {
+ Component[] children = ((Container) root).getComponents();
+ if ((children != null) && (children.length > 0)) {
+ walkThrowComponent(pathname, Arrays.asList(children), action);
+ }
+ }
+ if (root instanceof JFrame) {
+ Component[] children = ((JFrame) root).getContentPane().getComponents();
+ if ((children != null) && (children.length > 0)) {
+ walkThrowComponent(pathname, Arrays.asList(children), action);
+ }
+ }
+ }
+ }
+ }
+
+ public static interface Action {
+ public void doAction(SwingSession session, String path, Component c);
+ }
+
+ public static class SaveStateAction implements Action {
+ @Override
+ public void doAction(SwingSession session, String path, Component c) {
+ State manager = session.getStateManager(c.getClass());
+ State state = manager.getState(c);
+ session.setStates(path, state);
+ }
+ }
+
+ public static class RestoreStateAction implements Action {
+ @Override
+ public void doAction(SwingSession session, String path, Component c) {
+ State manager = session.getStateManager(c.getClass());
+ State state = session.getStates(path);
+ if (state != null) {
+ manager.setState(c, state);
+ }
+ }
+ }
+
+}
Added: trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/session/WindowState.java
===================================================================
--- trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/session/WindowState.java (rev 0)
+++ trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/session/WindowState.java 2013-04-02 14:02:07 UTC (rev 2647)
@@ -0,0 +1,180 @@
+package jaxx.runtime.swing.session;
+
+import javax.swing.*;
+import java.awt.*;
+
+/**
+ * State for Window
+ *
+ * @author poussin
+ * @author kmorin <kmorin(a)codelutin.com>
+ * @since 2.5.16
+ */
+public class WindowState implements State {
+
+ private static final String WINDOW_STATE_NORMAL_BOUNDS =
+ "WindowState.normalBounds";
+
+ protected Rectangle bounds;
+ protected Rectangle gcBounds;
+ protected int frameState = Frame.NORMAL;
+
+ public WindowState() {
+ }
+
+ public WindowState(Rectangle bounds, Rectangle gcBounds, int frameState) {
+ this.bounds = new Rectangle(bounds);
+ this.gcBounds = new Rectangle(gcBounds);
+ this.frameState = frameState;
+ }
+
+ public Rectangle getBounds() {
+ return bounds;
+ }
+
+ public void setBounds(Rectangle bounds) {
+ this.bounds = bounds;
+ }
+
+ public Rectangle getGcBounds() {
+ return gcBounds;
+ }
+
+ public void setGcBounds(Rectangle gcBounds) {
+ this.gcBounds = gcBounds;
+ }
+
+ public int getFrameState() {
+ return frameState;
+ }
+
+ public void setFrameState(int frameState) {
+ this.frameState = frameState;
+ }
+
+ protected Window checkComponent(Object o) {
+ if (o == null) {
+ throw new IllegalArgumentException("null component");
+ }
+ if (!(o instanceof Window)) {
+ throw new IllegalArgumentException("invalid component");
+ }
+ return (Window) o;
+ }
+
+ /**
+ * Checks whether the window supports resizing
+ * @param window the {@code Window} to be checked
+ * @return true if the window supports resizing
+ */
+ protected static boolean isResizable(Window window) {
+ boolean resizable = true;
+ if (window instanceof Frame) {
+ resizable = ((Frame) window).isResizable();
+ } else if (window instanceof Dialog) {
+ resizable = ((Dialog) window).isResizable();
+ }
+ return resizable;
+ }
+
+ /**
+ * Gets {@code Window} bounds from the client property
+ * @param window the source {@code Window}
+ * @return bounds from the client property
+ */
+ protected static Rectangle getWindowNormalBounds(Window window) {
+ Rectangle result = null;
+ if (window instanceof JFrame) {
+ Object res = ((JFrame) window).getRootPane().getClientProperty(
+ WINDOW_STATE_NORMAL_BOUNDS);
+ if (res instanceof Rectangle) {
+ result = (Rectangle) res;
+ }
+ }
+ return result;
+ }
+
+ /**
+ * Calculates virtual graphic bounds.
+ * On multiscreen systems all screens are united into one virtual screen.
+ * @return the graphic bounds
+ */
+ public static Rectangle computeVirtualGraphicsBounds() {
+ Rectangle virtualBounds = new Rectangle();
+ GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
+ GraphicsDevice[] gs = ge.getScreenDevices();
+ for (GraphicsDevice gd : gs) {
+ GraphicsConfiguration gc = gd.getDefaultConfiguration();
+ virtualBounds = virtualBounds.union(gc.getBounds());
+ }
+ return virtualBounds;
+ }
+
+ /**
+ * Puts {@code Window} bounds to client property.
+ * @param window the target {@code Window}
+ * @param bounds bounds
+ */
+ public static void putWindowNormalBounds(Window window, Rectangle bounds) {
+ if (window instanceof JFrame) {
+ ((JFrame) window).getRootPane().putClientProperty(
+ WINDOW_STATE_NORMAL_BOUNDS, bounds);
+ }
+ }
+
+ @Override
+ public State getState(Object o) {
+ Window c = checkComponent(o);
+ int frameState = Frame.NORMAL;
+ if (c instanceof Frame) {
+ frameState = ((Frame) c).getExtendedState();
+ }
+ GraphicsConfiguration gc = c.getGraphicsConfiguration();
+ Rectangle gcBounds = (gc == null) ? null : gc.getBounds();
+ Rectangle frameBounds = c.getBounds();
+
+ /* If this is a JFrame created by FrameView and it's been maximized,
+ * retrieve the frame's normal (not maximized) bounds. More info:
+ * see FrameStateListener#windowStateChanged in FrameView.
+ */
+ if ((c instanceof JFrame) && (0 != (frameState & Frame.MAXIMIZED_BOTH))) {
+ frameBounds = getWindowNormalBounds(c);
+ }
+
+ WindowState result = null;
+ if (frameBounds != null && !frameBounds.isEmpty()) {
+ result = new WindowState();
+ result.setBounds(frameBounds);
+ result.setGcBounds(gcBounds);
+ result.setFrameState(frameState);
+ }
+
+ return result;
+ }
+
+ @Override
+ public void setState(Object o, State state) {
+ Window w = checkComponent(o);
+ if ((state != null) && !(state instanceof WindowState)) {
+ throw new IllegalArgumentException("invalid state");
+ }
+ WindowState windowState = (WindowState) state;
+ if (windowState.getBounds() != null) {
+ putWindowNormalBounds(w, windowState.getBounds());
+ if (!w.isLocationByPlatform() && (state != null)) {
+
+ Rectangle gcBounds0 = windowState.getGcBounds();
+ if (gcBounds0 != null && isResizable(w)) {
+ if (computeVirtualGraphicsBounds().contains(gcBounds0.getLocation())) {
+ w.setBounds(windowState.getBounds());
+ } else {
+ w.setSize(windowState.getBounds().getSize());
+ }
+ }
+ }
+ if (w instanceof Frame) {
+ ((Frame) w).setExtendedState(windowState.getFrameState());
+ }
+ }
+ }
+}
1
0