Nuiton-web-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
March 2011
- 2 participants
- 6 discussions
r65 - trunk/nuiton-gwt/src/main/java/org/nuiton/web/gwt/table
by jcouteau@users.nuiton.org 23 Mar '11
by jcouteau@users.nuiton.org 23 Mar '11
23 Mar '11
Author: jcouteau
Date: 2011-03-23 13:03:49 +0100 (Wed, 23 Mar 2011)
New Revision: 65
Url: http://nuiton.org/repositories/revision/nuiton-web/65
Log:
Evolution #1418: Allow to put HTML strings in tables
Modified:
trunk/nuiton-gwt/src/main/java/org/nuiton/web/gwt/table/FlexTableWithModel.java
trunk/nuiton-gwt/src/main/java/org/nuiton/web/gwt/table/SortableFlexTableWithModel.java
Modified: trunk/nuiton-gwt/src/main/java/org/nuiton/web/gwt/table/FlexTableWithModel.java
===================================================================
--- trunk/nuiton-gwt/src/main/java/org/nuiton/web/gwt/table/FlexTableWithModel.java 2011-03-22 15:50:33 UTC (rev 64)
+++ trunk/nuiton-gwt/src/main/java/org/nuiton/web/gwt/table/FlexTableWithModel.java 2011-03-23 12:03:49 UTC (rev 65)
@@ -108,9 +108,9 @@
if (value instanceof Widget) {
setWidget(row+1, col, (Widget) value);
} else if (value == null) {
- setText(row+1, col, "");
+ setHTML(row+1, col, "");
} else {
- setText(row+1, col, value.toString());
+ setHTML(row+1, col, value.toString());
}
}
Modified: trunk/nuiton-gwt/src/main/java/org/nuiton/web/gwt/table/SortableFlexTableWithModel.java
===================================================================
--- trunk/nuiton-gwt/src/main/java/org/nuiton/web/gwt/table/SortableFlexTableWithModel.java 2011-03-22 15:50:33 UTC (rev 64)
+++ trunk/nuiton-gwt/src/main/java/org/nuiton/web/gwt/table/SortableFlexTableWithModel.java 2011-03-23 12:03:49 UTC (rev 65)
@@ -114,9 +114,9 @@
if (value instanceof Widget) {
setWidget(row + 1, col, (Widget) value);
} else if (value == null) {
- setText(row + 1, col, "");
+ setHTML(row + 1, col, "");
} else {
- setText(row + 1, col, value.toString());
+ setHTML(row + 1, col, value.toString());
}
}
1
0
r64 - trunk/nuiton-gwt/src/main/java/org/nuiton/web/gwt/table
by jcouteau@users.nuiton.org 22 Mar '11
by jcouteau@users.nuiton.org 22 Mar '11
22 Mar '11
Author: jcouteau
Date: 2011-03-22 16:50:33 +0100 (Tue, 22 Mar 2011)
New Revision: 64
Url: http://nuiton.org/repositories/revision/nuiton-web/64
Log:
Anomalie #1412: SortableFlexTable does not display last column
Modified:
trunk/nuiton-gwt/src/main/java/org/nuiton/web/gwt/table/SortableFlexTableWithModel.java
Modified: trunk/nuiton-gwt/src/main/java/org/nuiton/web/gwt/table/SortableFlexTableWithModel.java
===================================================================
--- trunk/nuiton-gwt/src/main/java/org/nuiton/web/gwt/table/SortableFlexTableWithModel.java 2011-03-12 14:21:48 UTC (rev 63)
+++ trunk/nuiton-gwt/src/main/java/org/nuiton/web/gwt/table/SortableFlexTableWithModel.java 2011-03-22 15:50:33 UTC (rev 64)
@@ -91,7 +91,7 @@
}
}
} else {
- for (int i = firstColumn; i < lastColumn; i++) {
+ for (int i = firstColumn; i <= lastColumn; i++) {
if (firstRow == lastRow) {
Object value = model.getValueAt(i, firstRow);
1
0
Author: tchemit
Date: 2011-03-12 15:21:48 +0100 (Sat, 12 Mar 2011)
New Revision: 63
Url: http://nuiton.org/repositories/revision/nuiton-web/63
Log:
Update mavenpom4redmineAndCentral to 2.5.2.
Modified:
trunk/pom.xml
Modified: trunk/pom.xml
===================================================================
--- trunk/pom.xml 2011-03-10 09:38:54 UTC (rev 62)
+++ trunk/pom.xml 2011-03-12 14:21:48 UTC (rev 63)
@@ -10,7 +10,7 @@
<parent>
<groupId>org.nuiton</groupId>
<artifactId>mavenpom4redmineAndCentral</artifactId>
- <version>2.5.1</version>
+ <version>2.5.2</version>
</parent>
<groupId>org.nuiton.web</groupId>
1
0
r62 - in trunk/nuiton-gwt/src/main: java/org/nuiton/web/gwt/messages resources/i18n
by jcouteau@users.nuiton.org 10 Mar '11
by jcouteau@users.nuiton.org 10 Mar '11
10 Mar '11
Author: jcouteau
Date: 2011-03-10 10:38:54 +0100 (Thu, 10 Mar 2011)
New Revision: 62
Url: http://nuiton.org/repositories/revision/nuiton-web/62
Log:
Fix old i18n key
Modified:
trunk/nuiton-gwt/src/main/java/org/nuiton/web/gwt/messages/UIMessages.java
trunk/nuiton-gwt/src/main/resources/i18n/nuiton-gwt_en_GB.properties
trunk/nuiton-gwt/src/main/resources/i18n/nuiton-gwt_fr_FR.properties
Modified: trunk/nuiton-gwt/src/main/java/org/nuiton/web/gwt/messages/UIMessages.java
===================================================================
--- trunk/nuiton-gwt/src/main/java/org/nuiton/web/gwt/messages/UIMessages.java 2011-03-09 11:08:06 UTC (rev 61)
+++ trunk/nuiton-gwt/src/main/java/org/nuiton/web/gwt/messages/UIMessages.java 2011-03-10 09:38:54 UTC (rev 62)
@@ -29,6 +29,6 @@
*/
public interface UIMessages extends Messages {
- @Key("refcomp.loading")
+ @Key("nuiton.gwt.loading")
String loading();
}
\ No newline at end of file
Modified: trunk/nuiton-gwt/src/main/resources/i18n/nuiton-gwt_en_GB.properties
===================================================================
--- trunk/nuiton-gwt/src/main/resources/i18n/nuiton-gwt_en_GB.properties 2011-03-09 11:08:06 UTC (rev 61)
+++ trunk/nuiton-gwt/src/main/resources/i18n/nuiton-gwt_en_GB.properties 2011-03-10 09:38:54 UTC (rev 62)
@@ -1 +1 @@
-refcomp.loading=Loading, please wait
+nuiton.gwt.loading=Loading, please wait
Modified: trunk/nuiton-gwt/src/main/resources/i18n/nuiton-gwt_fr_FR.properties
===================================================================
--- trunk/nuiton-gwt/src/main/resources/i18n/nuiton-gwt_fr_FR.properties 2011-03-09 11:08:06 UTC (rev 61)
+++ trunk/nuiton-gwt/src/main/resources/i18n/nuiton-gwt_fr_FR.properties 2011-03-10 09:38:54 UTC (rev 62)
@@ -1 +1 @@
-refcomp.loading=Chargement, veuillez patienter
+nuiton.gwt.loading=Chargement, veuillez patienter
1
0
Author: jcouteau
Date: 2011-03-09 12:08:06 +0100 (Wed, 09 Mar 2011)
New Revision: 61
Url: http://nuiton.org/repositories/revision/nuiton-web/61
Log:
Forgot the pom
Modified:
trunk/pom.xml
Modified: trunk/pom.xml
===================================================================
--- trunk/pom.xml 2011-03-09 11:01:10 UTC (rev 60)
+++ trunk/pom.xml 2011-03-09 11:08:06 UTC (rev 61)
@@ -21,6 +21,7 @@
<module>nuiton-web</module>
<module>nuiton-tapestry</module>
<module>nuiton-rss</module>
+ <module>nuiton-gwt</module>
</modules>
<dependencyManagement>
@@ -105,6 +106,14 @@
<version>2.5</version>
<scope>provided</scope>
</dependency>
+
+ <!-- GWT dependencies (from central repo) -->
+ <dependency>
+ <groupId>com.google.gwt</groupId>
+ <artifactId>gwt-user</artifactId>
+ <version>${gwtVersion}</version>
+ <scope>provided</scope>
+ </dependency>
</dependencies>
@@ -141,6 +150,16 @@
<role>Développeur</role>
</roles>
</developer>
+ <developer>
+ <id>jcouteau</id>
+ <name>Jean Couteau</name>
+ <email>couteau(a)codelutin.com</email>
+ <organization>CodeLutin</organization>
+ <timezone>+2</timezone>
+ <roles>
+ <role>Développeur</role>
+ </roles>
+ </developer>
</developers>
<!-- ************************************************************* -->
@@ -158,6 +177,10 @@
<tapestryVersion>5.2.4</tapestryVersion>
<slf4jVersion>1.6.1</slf4jVersion>
+ <!-- GWT -->
+ <gwtVersion>2.1.0</gwtVersion>
+ <gwtPluginVersion>2.1.0-1</gwtPluginVersion>
+
<!--Multilanguage maven-site -->
<siteLocales>en,fr</siteLocales>
1
0
Author: jcouteau
Date: 2011-03-09 12:01:10 +0100 (Wed, 09 Mar 2011)
New Revision: 60
Url: http://nuiton.org/repositories/revision/nuiton-web/60
Log:
Evolution #1384: Add a gwt module
Added:
trunk/nuiton-gwt/
trunk/nuiton-gwt/LICENSE.txt
trunk/nuiton-gwt/README.txt
trunk/nuiton-gwt/changelog.txt
trunk/nuiton-gwt/pom.xml
trunk/nuiton-gwt/src/
trunk/nuiton-gwt/src/main/
trunk/nuiton-gwt/src/main/java/
trunk/nuiton-gwt/src/main/java/org/
trunk/nuiton-gwt/src/main/java/org/nuiton/
trunk/nuiton-gwt/src/main/java/org/nuiton/web/
trunk/nuiton-gwt/src/main/java/org/nuiton/web/gwt/
trunk/nuiton-gwt/src/main/java/org/nuiton/web/gwt/NuitonGWT.gwt.xml
trunk/nuiton-gwt/src/main/java/org/nuiton/web/gwt/comparable/
trunk/nuiton-gwt/src/main/java/org/nuiton/web/gwt/comparable/ComparableAnchor.java
trunk/nuiton-gwt/src/main/java/org/nuiton/web/gwt/comparable/ComparableButton.java
trunk/nuiton-gwt/src/main/java/org/nuiton/web/gwt/comparable/ComparableListBox.java
trunk/nuiton-gwt/src/main/java/org/nuiton/web/gwt/messages/
trunk/nuiton-gwt/src/main/java/org/nuiton/web/gwt/messages/UIMessages.java
trunk/nuiton-gwt/src/main/java/org/nuiton/web/gwt/misc/
trunk/nuiton-gwt/src/main/java/org/nuiton/web/gwt/misc/BlindedPopup.java
trunk/nuiton-gwt/src/main/java/org/nuiton/web/gwt/misc/LoaderNotification.java
trunk/nuiton-gwt/src/main/java/org/nuiton/web/gwt/table/
trunk/nuiton-gwt/src/main/java/org/nuiton/web/gwt/table/AbstractGWTTableModel.java
trunk/nuiton-gwt/src/main/java/org/nuiton/web/gwt/table/DefaultTableModel.java
trunk/nuiton-gwt/src/main/java/org/nuiton/web/gwt/table/FlexTableWithModel.java
trunk/nuiton-gwt/src/main/java/org/nuiton/web/gwt/table/GWTTableModel.java
trunk/nuiton-gwt/src/main/java/org/nuiton/web/gwt/table/SortableFlexTableWithModel.java
trunk/nuiton-gwt/src/main/java/org/nuiton/web/gwt/table/SortableTableModel.java
trunk/nuiton-gwt/src/main/java/org/nuiton/web/gwt/table/TableModelEvent.java
trunk/nuiton-gwt/src/main/java/org/nuiton/web/gwt/table/TableModelListener.java
trunk/nuiton-gwt/src/main/resources/
trunk/nuiton-gwt/src/main/resources/i18n/
trunk/nuiton-gwt/src/main/resources/i18n/nuiton-gwt_en_GB.properties
trunk/nuiton-gwt/src/main/resources/i18n/nuiton-gwt_fr_FR.properties
Property changes on: trunk/nuiton-gwt
___________________________________________________________________
Added: svn:ignore
+ *.iml
target
Added: trunk/nuiton-gwt/LICENSE.txt
===================================================================
--- trunk/nuiton-gwt/LICENSE.txt (rev 0)
+++ trunk/nuiton-gwt/LICENSE.txt 2011-03-09 11:01:10 UTC (rev 60)
@@ -0,0 +1,166 @@
+ GNU LESSER GENERAL PUBLIC LICENSE
+ Version 3, 29 June 2007
+
+ Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+
+ This version of the GNU Lesser General Public License incorporates
+the terms and conditions of version 3 of the GNU General Public
+License, supplemented by the additional permissions listed below.
+
+ 0. Additional Definitions.
+
+ As used herein, "this License" refers to version 3 of the GNU Lesser
+General Public License, and the "GNU GPL" refers to version 3 of the GNU
+General Public License.
+
+ "The Library" refers to a covered work governed by this License,
+other than an Application or a Combined Work as defined below.
+
+ An "Application" is any work that makes use of an interface provided
+by the Library, but which is not otherwise based on the Library.
+Defining a subclass of a class defined by the Library is deemed a mode
+of using an interface provided by the Library.
+
+ A "Combined Work" is a work produced by combining or linking an
+Application with the Library. The particular version of the Library
+with which the Combined Work was made is also called the "Linked
+Version".
+
+ The "Minimal Corresponding Source" for a Combined Work means the
+Corresponding Source for the Combined Work, excluding any source code
+for portions of the Combined Work that, considered in isolation, are
+based on the Application, and not on the Linked Version.
+
+ The "Corresponding Application Code" for a Combined Work means the
+object code and/or source code for the Application, including any data
+and utility programs needed for reproducing the Combined Work from the
+Application, but excluding the System Libraries of the Combined Work.
+
+ 1. Exception to Section 3 of the GNU GPL.
+
+ You may convey a covered work under sections 3 and 4 of this License
+without being bound by section 3 of the GNU GPL.
+
+ 2. Conveying Modified Versions.
+
+ If you modify a copy of the Library, and, in your modifications, a
+facility refers to a function or data to be supplied by an Application
+that uses the facility (other than as an argument passed when the
+facility is invoked), then you may convey a copy of the modified
+version:
+
+ a) under this License, provided that you make a good faith effort to
+ ensure that, in the event an Application does not supply the
+ function or data, the facility still operates, and performs
+ whatever part of its purpose remains meaningful, or
+
+ b) under the GNU GPL, with none of the additional permissions of
+ this License applicable to that copy.
+
+ 3. Object Code Incorporating Material from Library Header Files.
+
+ The object code form of an Application may incorporate material from
+a header file that is part of the Library. You may convey such object
+code under terms of your choice, provided that, if the incorporated
+material is not limited to numerical parameters, data structure
+layouts and accessors, or small macros, inline functions and templates
+(ten or fewer lines in length), you do both of the following:
+
+ a) Give prominent notice with each copy of the object code that the
+ Library is used in it and that the Library and its use are
+ covered by this License.
+
+ b) Accompany the object code with a copy of the GNU GPL and this license
+ document.
+
+ 4. Combined Works.
+
+ You may convey a Combined Work under terms of your choice that,
+taken together, effectively do not restrict modification of the
+portions of the Library contained in the Combined Work and reverse
+engineering for debugging such modifications, if you also do each of
+the following:
+
+ a) Give prominent notice with each copy of the Combined Work that
+ the Library is used in it and that the Library and its use are
+ covered by this License.
+
+ b) Accompany the Combined Work with a copy of the GNU GPL and this license
+ document.
+
+ c) For a Combined Work that displays copyright notices during
+ execution, include the copyright notice for the Library among
+ these notices, as well as a reference directing the user to the
+ copies of the GNU GPL and this license document.
+
+ d) Do one of the following:
+
+ 0) Convey the Minimal Corresponding Source under the terms of this
+ License, and the Corresponding Application Code in a form
+ suitable for, and under terms that permit, the user to
+ recombine or relink the Application with a modified version of
+ the Linked Version to produce a modified Combined Work, in the
+ manner specified by section 6 of the GNU GPL for conveying
+ Corresponding Source.
+
+ 1) Use a suitable shared library mechanism for linking with the
+ Library. A suitable mechanism is one that (a) uses at run time
+ a copy of the Library already present on the user's computer
+ system, and (b) will operate properly with a modified version
+ of the Library that is interface-compatible with the Linked
+ Version.
+
+ e) Provide Installation Information, but only if you would otherwise
+ be required to provide such information under section 6 of the
+ GNU GPL, and only to the extent that such information is
+ necessary to install and execute a modified version of the
+ Combined Work produced by recombining or relinking the
+ Application with a modified version of the Linked Version. (If
+ you use option 4d0, the Installation Information must accompany
+ the Minimal Corresponding Source and Corresponding Application
+ Code. If you use option 4d1, you must provide the Installation
+ Information in the manner specified by section 6 of the GNU GPL
+ for conveying Corresponding Source.)
+
+ 5. Combined Libraries.
+
+ You may place library facilities that are a work based on the
+Library side by side in a single library together with other library
+facilities that are not Applications and are not covered by this
+License, and convey such a combined library under terms of your
+choice, if you do both of the following:
+
+ a) Accompany the combined library with a copy of the same work based
+ on the Library, uncombined with any other library facilities,
+ conveyed under the terms of this License.
+
+ b) Give prominent notice with the combined library that part of it
+ is a work based on the Library, and explaining where to find the
+ accompanying uncombined form of the same work.
+
+ 6. Revised Versions of the GNU Lesser General Public License.
+
+ The Free Software Foundation may publish revised and/or new versions
+of the GNU Lesser General Public License from time to time. Such new
+versions will be similar in spirit to the present version, but may
+differ in detail to address new problems or concerns.
+
+ Each version is given a distinguishing version number. If the
+Library as you received it specifies that a certain numbered version
+of the GNU Lesser General Public License "or any later version"
+applies to it, you have the option of following the terms and
+conditions either of that published version or of any later version
+published by the Free Software Foundation. If the Library as you
+received it does not specify a version number of the GNU Lesser
+General Public License, you may choose any version of the GNU Lesser
+General Public License ever published by the Free Software Foundation.
+
+ If the Library as you received it specifies that a proxy can decide
+whether future versions of the GNU Lesser General Public License shall
+apply, that proxy's public statement of acceptance of any version is
+permanent authorization for you to choose that version for the
+Library.
+
Property changes on: trunk/nuiton-gwt/LICENSE.txt
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: trunk/nuiton-gwt/README.txt
===================================================================
--- trunk/nuiton-gwt/README.txt (rev 0)
+++ trunk/nuiton-gwt/README.txt 2011-03-09 11:01:10 UTC (rev 60)
@@ -0,0 +1 @@
+
Property changes on: trunk/nuiton-gwt/README.txt
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: trunk/nuiton-gwt/changelog.txt
===================================================================
--- trunk/nuiton-gwt/changelog.txt (rev 0)
+++ trunk/nuiton-gwt/changelog.txt 2011-03-09 11:01:10 UTC (rev 60)
@@ -0,0 +1,2 @@
+Please refer to the release note :
+ http://maven-site.nuiton.org/nuiton-gwt/changes-report.html
\ No newline at end of file
Property changes on: trunk/nuiton-gwt/changelog.txt
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: trunk/nuiton-gwt/pom.xml
===================================================================
--- trunk/nuiton-gwt/pom.xml (rev 0)
+++ trunk/nuiton-gwt/pom.xml 2011-03-09 11:01:10 UTC (rev 60)
@@ -0,0 +1,100 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+
+ <modelVersion>4.0.0</modelVersion>
+
+ <!-- ************************************************************* -->
+ <!-- *** POM Relationships *************************************** -->
+ <!-- ************************************************************* -->
+
+ <parent>
+ <groupId>org.nuiton.web</groupId>
+ <artifactId>nuiton-web-parent</artifactId>
+ <version>1.1-SNAPSHOT</version>
+ </parent>
+
+ <artifactId>nuiton-gwt</artifactId>
+
+ <dependencies>
+
+ <!-- GWT -->
+ <dependency>
+ <groupId>com.google.gwt</groupId>
+ <artifactId>gwt-user</artifactId>
+ </dependency>
+
+
+ </dependencies>
+
+ <!-- ************************************************************* -->
+ <!-- *** Project Information ************************************* -->
+ <!-- ************************************************************* -->
+
+ <name>Nuiton Web :: Nuiton GWT</name>
+ <description>Extra classes for GWT based applications</description>
+
+ <!-- ************************************************************* -->
+ <!-- *** Build Settings ****************************************** -->
+ <!-- ************************************************************* -->
+
+ <packaging>jar</packaging>
+
+
+ <build>
+ <plugins>
+ <plugin>
+
+ <!-- extract i18n keys from source -->
+ <groupId>org.nuiton.i18n</groupId>
+ <artifactId>maven-i18n-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>scan-gwt-java-source</id>
+ <goals>
+ <goal>parserGWTJava</goal>
+ </goals>
+ </execution>
+ <execution>
+ <id>gen</id>
+ <goals>
+ <goal>gen</goal>
+ </goals>
+ <configuration>
+ <bundles>fr_FR,en_GB</bundles>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+
+ <!--always generate the -source jar, needed for gwt-->
+ <plugin>
+ <artifactId>maven-source-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>attach-sources</id>
+ <goals>
+ <goal>jar</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+
+ <!-- GWT module configuration -->
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>gwt-maven-plugin</artifactId>
+ <executions>
+ <execution>
+ <goals>
+ <goal>resources</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+
+ </plugins>
+ </build>
+
+</project>
Property changes on: trunk/nuiton-gwt/pom.xml
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: trunk/nuiton-gwt/src/main/java/org/nuiton/web/gwt/NuitonGWT.gwt.xml
===================================================================
--- trunk/nuiton-gwt/src/main/java/org/nuiton/web/gwt/NuitonGWT.gwt.xml (rev 0)
+++ trunk/nuiton-gwt/src/main/java/org/nuiton/web/gwt/NuitonGWT.gwt.xml 2011-03-09 11:01:10 UTC (rev 60)
@@ -0,0 +1,34 @@
+<!--
+ #%L
+ Nuiton Web :: Nuiton GWT
+ %%
+ Copyright (C) 2010 - 2011 CodeLutin, Jean Couteau
+ %%
+ 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%
+ -->
+<!DOCTYPE module PUBLIC "//gwt-module/"
+ "http://google-web-toolkit.googlecode.com/svn/tags/1.6.2/distro-source/core/…">
+<module>
+
+ <!-- Inherit the core Web Toolkit stuff. -->
+ <inherits name='com.google.gwt.user.User'/>
+
+ <source path="comparable"/>
+ <source path="messages"/>
+ <source path="misc"/>
+ <source path="table"/>
+
+</module>
\ No newline at end of file
Property changes on: trunk/nuiton-gwt/src/main/java/org/nuiton/web/gwt/NuitonGWT.gwt.xml
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: trunk/nuiton-gwt/src/main/java/org/nuiton/web/gwt/comparable/ComparableAnchor.java
===================================================================
--- trunk/nuiton-gwt/src/main/java/org/nuiton/web/gwt/comparable/ComparableAnchor.java (rev 0)
+++ trunk/nuiton-gwt/src/main/java/org/nuiton/web/gwt/comparable/ComparableAnchor.java 2011-03-09 11:01:10 UTC (rev 60)
@@ -0,0 +1,48 @@
+/*
+ * #%L
+ * Nuiton Web :: Nuiton GWT
+ * %%
+ * Copyright (C) 2010 - 2011 CodeLutin, Jean Couteau
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Lesser Public License for more details.
+ *
+ * You should have received a copy of the GNU General Lesser Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/lgpl-3.0.html>.
+ * #L%
+ */
+
+package org.nuiton.web.gwt.comparable;
+
+import com.google.gwt.user.client.ui.Anchor;
+
+/**
+ *
+ * Anchor that implements Comparable to be used in SortableTables. Comparison is
+ * made on the text of the anchor.
+ *
+ * @author jcouteau
+ * @since 1.1
+ */
+public class ComparableAnchor extends Anchor implements Comparable<Anchor> {
+
+ public ComparableAnchor(String value){
+ super(value);
+ }
+
+ @Override
+ public int compareTo(Anchor o) {
+ String oValue = o.getText();
+ String value = getText();
+
+ return value.compareTo(oValue);
+ }
+}
\ No newline at end of file
Property changes on: trunk/nuiton-gwt/src/main/java/org/nuiton/web/gwt/comparable/ComparableAnchor.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: trunk/nuiton-gwt/src/main/java/org/nuiton/web/gwt/comparable/ComparableButton.java
===================================================================
--- trunk/nuiton-gwt/src/main/java/org/nuiton/web/gwt/comparable/ComparableButton.java (rev 0)
+++ trunk/nuiton-gwt/src/main/java/org/nuiton/web/gwt/comparable/ComparableButton.java 2011-03-09 11:01:10 UTC (rev 60)
@@ -0,0 +1,44 @@
+/*
+ * #%L
+ * Nuiton Web :: Nuiton GWT
+ * %%
+ * Copyright (C) 2010 - 2011 CodeLutin, Jean Couteau
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Lesser Public License for more details.
+ *
+ * You should have received a copy of the GNU General Lesser Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/lgpl-3.0.html>.
+ * #L%
+ */
+
+package org.nuiton.web.gwt.comparable;
+
+import com.google.gwt.user.client.ui.Button;
+
+/**
+ *
+ * Button that implements Comparable to be used in SortableTables. Comparison is
+ * made on Button text.
+ *
+ * @author jcouteau
+ * @since 1.1
+ */
+public class ComparableButton extends Button implements Comparable<Button> {
+
+ @Override
+ public int compareTo(Button o) {
+ String oValue = o.getText();
+ String value = getText();
+
+ return value.compareTo(oValue);
+ }
+}
Property changes on: trunk/nuiton-gwt/src/main/java/org/nuiton/web/gwt/comparable/ComparableButton.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: trunk/nuiton-gwt/src/main/java/org/nuiton/web/gwt/comparable/ComparableListBox.java
===================================================================
--- trunk/nuiton-gwt/src/main/java/org/nuiton/web/gwt/comparable/ComparableListBox.java (rev 0)
+++ trunk/nuiton-gwt/src/main/java/org/nuiton/web/gwt/comparable/ComparableListBox.java 2011-03-09 11:01:10 UTC (rev 60)
@@ -0,0 +1,44 @@
+/*
+ * #%L
+ * Nuiton Web :: Nuiton GWT
+ * %%
+ * Copyright (C) 2010 - 2011 CodeLutin, Jean Couteau
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Lesser Public License for more details.
+ *
+ * You should have received a copy of the GNU General Lesser Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/lgpl-3.0.html>.
+ * #L%
+ */
+
+package org.nuiton.web.gwt.comparable;
+
+import com.google.gwt.user.client.ui.ListBox;
+
+/**
+ *
+ * ListBox that implements Comaprable to be used in SortableTables. Comparison
+ * is made on the selected value text.
+ *
+ * @author jcouteau
+ * @since 1.1
+ */
+public class ComparableListBox extends ListBox implements Comparable<ListBox> {
+
+ @Override
+ public int compareTo(ListBox o) {
+ String oSelectedValue = o.getItemText(o.getSelectedIndex());
+ String selectedValue = getItemText(getSelectedIndex());
+
+ return selectedValue.compareTo(oSelectedValue);
+ }
+}
Property changes on: trunk/nuiton-gwt/src/main/java/org/nuiton/web/gwt/comparable/ComparableListBox.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: trunk/nuiton-gwt/src/main/java/org/nuiton/web/gwt/messages/UIMessages.java
===================================================================
--- trunk/nuiton-gwt/src/main/java/org/nuiton/web/gwt/messages/UIMessages.java (rev 0)
+++ trunk/nuiton-gwt/src/main/java/org/nuiton/web/gwt/messages/UIMessages.java 2011-03-09 11:01:10 UTC (rev 60)
@@ -0,0 +1,34 @@
+/*
+ * #%L
+ * Nuiton Web :: Nuiton GWT
+ * %%
+ * Copyright (C) 2010 - 2011 CodeLutin, Jean Couteau
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Lesser Public License for more details.
+ *
+ * You should have received a copy of the GNU General Lesser Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/lgpl-3.0.html>.
+ * #L%
+ */
+package org.nuiton.web.gwt.messages;
+
+import com.google.gwt.i18n.client.Messages;
+
+/**
+ * User: couteau
+ * Date: 31/12/10
+ */
+public interface UIMessages extends Messages {
+
+ @Key("refcomp.loading")
+ String loading();
+}
\ No newline at end of file
Property changes on: trunk/nuiton-gwt/src/main/java/org/nuiton/web/gwt/messages/UIMessages.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: trunk/nuiton-gwt/src/main/java/org/nuiton/web/gwt/misc/BlindedPopup.java
===================================================================
--- trunk/nuiton-gwt/src/main/java/org/nuiton/web/gwt/misc/BlindedPopup.java (rev 0)
+++ trunk/nuiton-gwt/src/main/java/org/nuiton/web/gwt/misc/BlindedPopup.java 2011-03-09 11:01:10 UTC (rev 60)
@@ -0,0 +1,124 @@
+/*
+ * #%L
+ * Nuiton Web :: Nuiton GWT
+ * %%
+ * Copyright (C) 2010 - 2011 CodeLutin, Jean Couteau
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Lesser Public License for more details.
+ *
+ * You should have received a copy of the GNU General Lesser Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/lgpl-3.0.html>.
+ * #L%
+ */
+package org.nuiton.web.gwt.misc;
+
+import com.google.gwt.event.dom.client.ClickEvent;
+import com.google.gwt.event.dom.client.ClickHandler;
+import com.google.gwt.user.client.DOM;
+import com.google.gwt.user.client.ui.PopupPanel;
+import com.google.gwt.user.client.ui.Widget;
+
+/**
+ *
+ * This class provides a popup with a glasspanel behind so that users can't
+ * interact with things that are behind.
+ *
+ * Use it like that :
+ *
+ * <code>
+ * new BlindedPopup(myPopupContent);
+ * </code>
+ *
+ * If you want to hide your BlindedPopup from the popup content use :
+ *
+ * <code>
+ * ((BlindedPopup)this.getParent()).hide();
+ * </code>
+ *
+ * So that the BlindedPopup works completely, you must have a 'wrapper' div
+ * that is 100% width and height and the your website content inside :
+ *
+ * <code>
+ * <body>
+ *
+ * <div id="wrapper">
+ * <!-- Site content -->
+ * </div>
+ *
+ * </body>
+ * </code>
+ *
+ * <code>
+ * #wrapper {
+ * height : 100%;
+ * width : 100%;
+ * overflow : scroll;
+ * position:relative;
+ * }
+ * </code>
+ *
+ * @author jcouteau
+ * @since 1.1
+ */
+public class BlindedPopup extends PopupPanel implements ClickHandler {
+ PopupPanel glass;
+
+ public BlindedPopup(Widget widget) {
+ //init popup
+ super(false);
+
+ /*********************************************
+ * A glass panel or 'blinder'
+ * to wash out the current screen
+ ********************************************/
+ glass = new PopupPanel();
+ glass.setStyleName("rx-glass");
+ /*
+ * Set full screen
+ */
+ DOM.setStyleAttribute(glass.getElement(), "width", "100%");
+ DOM.setStyleAttribute(glass.getElement(), "height", "100%");
+ /*
+ * Add default styles if required
+ */
+ DOM.setStyleAttribute(glass.getElement(),
+ "backgroundColor", "#000");
+ DOM.setStyleAttribute(glass.getElement(),
+ "opacity", "0.70");
+// DOM.setStyleAttribute(glass.getElement(),
+// "-moz-opacity", "0.70");
+ DOM.setStyleAttribute(glass.getElement(),
+ "filter", " alpha(opacity=70)");
+ /**********************************************
+ * A popup
+ *********************************************/
+ setStyleName("rx-BlindedPopup");
+
+ setWidget(widget);
+
+ /*
+ * Show the glass first, then the popup will be over it
+ */
+ glass.show();
+ center();
+ }
+
+ @Override
+ public void onClick(ClickEvent event) {
+ hide();
+ }
+
+ public void hide() {
+ glass.hide();
+ super.hide();
+ }
+}
Property changes on: trunk/nuiton-gwt/src/main/java/org/nuiton/web/gwt/misc/BlindedPopup.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: trunk/nuiton-gwt/src/main/java/org/nuiton/web/gwt/misc/LoaderNotification.java
===================================================================
--- trunk/nuiton-gwt/src/main/java/org/nuiton/web/gwt/misc/LoaderNotification.java (rev 0)
+++ trunk/nuiton-gwt/src/main/java/org/nuiton/web/gwt/misc/LoaderNotification.java 2011-03-09 11:01:10 UTC (rev 60)
@@ -0,0 +1,66 @@
+/*
+ * #%L
+ * Nuiton Web :: Nuiton GWT
+ * %%
+ * Copyright (C) 2010 - 2011 CodeLutin, Jean Couteau
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Lesser Public License for more details.
+ *
+ * You should have received a copy of the GNU General Lesser Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/lgpl-3.0.html>.
+ * #L%
+ */
+package org.nuiton.web.gwt.misc;
+
+import com.google.gwt.core.client.GWT;
+import com.google.gwt.user.client.ui.Label;
+import org.nuiton.web.gwt.messages.UIMessages;
+
+/**
+ *
+ * Waiting screen that blocks the user so that he can wait during long
+ * operations.
+ *
+ * To display it, use :
+ * <code>
+ * LoaderNotification.openLoaderPanel();
+ * </code>
+ *
+ * To remove it, use :
+ * <code>
+ * LoaderNotification.cloaseLoader();
+ * </code>
+ *
+ * To style it, use the CSS class : <code>loading</code>
+ *
+ * @author jcouteau
+ * @since 1.1
+ */
+public class LoaderNotification {
+
+ protected static BlindedPopup glassPanel = null;
+
+ public static void openLoaderPanel() {
+
+ UIMessages messages = GWT.create(UIMessages.class);
+
+ Label label = new Label(messages.loading());
+ label.setStyleName("loading");
+ glassPanel = new BlindedPopup(label);
+ }
+
+ public static void closeLoader() {
+ if (glassPanel != null) {
+ glassPanel.hide();
+ }
+ }
+}
Property changes on: trunk/nuiton-gwt/src/main/java/org/nuiton/web/gwt/misc/LoaderNotification.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: trunk/nuiton-gwt/src/main/java/org/nuiton/web/gwt/table/AbstractGWTTableModel.java
===================================================================
--- trunk/nuiton-gwt/src/main/java/org/nuiton/web/gwt/table/AbstractGWTTableModel.java (rev 0)
+++ trunk/nuiton-gwt/src/main/java/org/nuiton/web/gwt/table/AbstractGWTTableModel.java 2011-03-09 11:01:10 UTC (rev 60)
@@ -0,0 +1,265 @@
+/*
+ * #%L
+ * Nuiton Web :: Nuiton GWT
+ * %%
+ * Copyright (C) 2010 - 2011 CodeLutin, Jean Couteau
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Lesser Public License for more details.
+ *
+ * You should have received a copy of the GNU General Lesser Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/lgpl-3.0.html>.
+ * #L%
+ */
+
+package org.nuiton.web.gwt.table;
+
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.EventListener;
+import java.util.List;
+
+/**
+ * @author jcouteau
+ * @since 1.1
+ */
+public abstract class AbstractGWTTableModel implements Serializable, GWTTableModel{
+
+ static final long serialVersionUID = -5798593159423650347L;
+
+ /**
+ * Storage for the listeners registered with this model.
+ */
+ protected List<TableModelListener> listenerList = new ArrayList<TableModelListener>();
+
+ /**
+ * Creates a default instance.
+ */
+ public AbstractGWTTableModel() {
+ // no setup required here
+ }
+
+ /**
+ * Returns the name of the specified column. This method generates default
+ * names in a sequence (starting with column 0): A, B, C, ..., Z, AA, AB,
+ * AC, ..., AZ, BA, BB, BC, and so on. Subclasses may override this method
+ * to allow column names to be specified on some other basis.
+ *
+ * @param columnIndex the column index.
+ *
+ * @return The name of the column.
+ */
+ public String getColumnName(int columnIndex) {
+ StringBuffer buffer = new StringBuffer();
+ while (columnIndex >= 0) {
+ buffer.insert(0, (char) ('A' + columnIndex % 26));
+ columnIndex = columnIndex / 26 - 1;
+ }
+ return buffer.toString();
+ }
+
+ /**
+ * Return the index of the specified column, or <code>-1</code> if there is
+ * no column with the specified name.
+ *
+ * @param columnName the name of the column (<code>null</code> not permitted).
+ *
+ * @return The index of the column, -1 if not found.
+ *
+ * @see #getColumnName(int)
+ * @throws NullPointerException if <code>columnName</code> is
+ * <code>null</code>.
+ */
+ public int findColumn(String columnName) {
+ int count = getColumnCount();
+
+ for (int index = 0; index < count; index++) {
+ String name = getColumnName(index);
+ if (columnName.equals(name)) {
+ return index;
+ }
+ }
+
+ // Unable to locate.
+ return -1;
+ }
+
+
+ /**
+ * Returns the <code>Class</code> for all <code>Object</code> instances
+ * in the specified column.
+ *
+ * @param columnIndex the column index.
+ *
+ * @return The class.
+ */
+ public Class<?> getColumnClass(int columnIndex) {
+ return Object.class;
+ }
+
+ /**
+ * Returns <code>true</code> if the specified cell is editable, and
+ * <code>false</code> if it is not. This implementation returns
+ * <code>false</code> for all arguments, subclasses should override the
+ * method if necessary.
+ *
+ * @param rowIndex the row index of the cell.
+ * @param columnIndex the column index of the cell.
+ *
+ * @return <code>false</code>.
+ */
+ public boolean isCellEditable(int rowIndex, int columnIndex) {
+ return false;
+ }
+
+ /**
+ * Sets the value of the given cell. This implementation ignores all
+ * arguments and does nothing, subclasses should override the
+ * method if necessary.
+ *
+ * @param value the new value (<code>null</code> permitted).
+ * @param rowIndex the row index of the cell.
+ * @param columnIndex the column index of the cell.
+ */
+ public void setValueAt(Object value, int rowIndex, int columnIndex) {
+ // Do nothing...
+ }
+
+ /**
+ * Adds a listener to the table model. The listener will receive notification
+ * of all changes to the table model.
+ *
+ * @param listener the listener.
+ */
+ public void addTableModelListener(TableModelListener listener) {
+ listenerList.add(listener);
+ }
+
+ /**
+ * Removes a listener from the table model so that it will no longer receive
+ * notification of changes to the table model.
+ *
+ * @param listener the listener to remove.
+ */
+ public void removeTableModelListener(TableModelListener listener) {
+ listenerList.remove(listener);
+ }
+
+ /**
+ * Returns an array containing the listeners that have been added to the
+ * table model.
+ *
+ * @return Array of {@link TableModelListener} objects.
+ *
+ * @since 1.4
+ */
+ public TableModelListener[] getTableModelListeners() {
+
+ TableModelListener[] listeners = new TableModelListener[]{};
+
+ listeners = listenerList.toArray(listeners);
+
+ return listeners;
+ }
+
+ /**
+ * Sends a {@link TableModelEvent} to all registered listeners to inform
+ * them that the table data has changed.
+ */
+ public void fireTableDataChanged() {
+ fireTableChanged(new TableModelEvent(this, 0, Integer.MAX_VALUE));
+ }
+
+ /**
+ * Sends a {@link TableModelEvent} to all registered listeners to inform
+ * them that the table structure has changed.
+ */
+ public void fireTableStructureChanged() {
+ fireTableChanged(new TableModelEvent(this, TableModelEvent.HEADER_ROW));
+ }
+
+ /**
+ * Sends a {@link TableModelEvent} to all registered listeners to inform
+ * them that some rows have been inserted into the model.
+ *
+ * @param firstRow the index of the first row.
+ * @param lastRow the index of the last row.
+ */
+ public void fireTableRowsInserted(int firstRow, int lastRow) {
+ fireTableChanged(new TableModelEvent(this, firstRow, lastRow,
+ TableModelEvent.ALL_COLUMNS, TableModelEvent.INSERT));
+ }
+
+ /**
+ * Sends a {@link TableModelEvent} to all registered listeners to inform
+ * them that some rows have been updated.
+ *
+ * @param firstRow the index of the first row.
+ * @param lastRow the index of the last row.
+ */
+ public void fireTableRowsUpdated(int firstRow, int lastRow) {
+ fireTableChanged(new TableModelEvent(this, firstRow, lastRow,
+ TableModelEvent.ALL_COLUMNS, TableModelEvent.UPDATE));
+ }
+
+ /**
+ * Sends a {@link TableModelEvent} to all registered listeners to inform
+ * them that some rows have been deleted from the model.
+ *
+ * @param firstRow the index of the first row.
+ * @param lastRow the index of the last row.
+ */
+ public void fireTableRowsDeleted(int firstRow, int lastRow) {
+ fireTableChanged(new TableModelEvent(this, firstRow, lastRow,
+ TableModelEvent.ALL_COLUMNS, TableModelEvent.DELETE));
+ }
+
+ /**
+ * Sends a {@link TableModelEvent} to all registered listeners to inform
+ * them that a single cell has been updated.
+ *
+ * @param row the row index.
+ * @param column the column index.
+ */
+ public void fireTableCellUpdated(int row, int column) {
+ fireTableChanged(new TableModelEvent(this, row, row, column));
+ }
+
+ /**
+ * Sends the specified event to all registered listeners.
+ *
+ * @param event the event to send.
+ */
+ public void fireTableChanged(TableModelEvent event) {
+ TableModelListener[] list = getTableModelListeners();
+
+ for (TableModelListener listener:list){
+ listener.tableChanged(event);
+ }
+ }
+
+ /**
+ * Returns an array of listeners of the given type that are registered with
+ * this model.
+ *
+ * @param listenerType the listener class.
+ *
+ * @return An array of listeners (possibly empty).
+ */
+ public <T extends EventListener> T[] getListeners(Class<T> listenerType) {
+
+ if (listenerType.getName().equals(TableModelListener.class.getName())){
+ return (T[])getTableModelListeners();
+ } else {
+ return (T[])new Object[]{};
+ }
+ }
+}
Property changes on: trunk/nuiton-gwt/src/main/java/org/nuiton/web/gwt/table/AbstractGWTTableModel.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: trunk/nuiton-gwt/src/main/java/org/nuiton/web/gwt/table/DefaultTableModel.java
===================================================================
--- trunk/nuiton-gwt/src/main/java/org/nuiton/web/gwt/table/DefaultTableModel.java (rev 0)
+++ trunk/nuiton-gwt/src/main/java/org/nuiton/web/gwt/table/DefaultTableModel.java 2011-03-09 11:01:10 UTC (rev 60)
@@ -0,0 +1,625 @@
+
+/* DefaultTableModel.java
+ * Copyright (C) 2002, 2004, 2005, 2006, Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Classpath.
+ *
+ * GNU Classpath is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * GNU Classpath is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Classpath; see the file COPYING. If not, write to the
+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301 USA.
+ *
+ * Linking this library statically or dynamically with other modules is
+ * making a combined work based on this library. Thus, the terms and
+ * conditions of the GNU General Public License cover the whole
+ * combination.
+ *
+ * As a special exception, the copyright holders of this library give you
+ * permission to link this library with independent modules to produce an
+ * executable, regardless of the license terms of these independent
+ * modules, and to copy and distribute the resulting executable under
+ * terms of your choice, provided that you also meet, for each linked
+ * independent module, the terms and conditions of the license of that
+ * module. An independent module is a module which is not derived from
+ * or based on this library. If you modify this library, you may extend
+ * this exception to your version of the library, but you are not
+ * obligated to do so. If you do not wish to do so, delete this
+ * exception statement from your version.
+ *
+ * %%Ignore-License
+ */
+
+package org.nuiton.web.gwt.table;
+
+import java.io.Serializable;
+import java.util.Arrays;
+import java.util.Vector;
+
+/**
+ * A two dimensional data structure used to store <code>Object</code>
+ * instances, usually for display in a <code>JTable</code> component.
+ *
+ * @author Andrew Selkirk
+ */
+public class DefaultTableModel extends AbstractGWTTableModel
+ implements Serializable {
+
+ static final long serialVersionUID=6680042567037222321L;
+
+ /**
+ * Storage for the rows in the table (each row is itself
+ * a <code>Vector</code>).
+ */
+ protected Vector<Vector> dataVector;
+
+ /**
+ * Storage for the column identifiers.
+ */
+ protected Vector columnIdentifiers;
+
+ /**
+ * Creates an empty table with zero rows and zero columns.
+ */
+ public DefaultTableModel() {
+ this(0,0);
+ }
+
+ /**
+ * Creates a new table with the specified number of rows and columns.
+ * All cells in the table are initially empty (set to <code>null</code>).
+ *
+ * @param numRows the number of rows.
+ * @param numColumns the number of columns.
+ */
+ public DefaultTableModel(int numRows,int numColumns) {
+ Vector defaultNames=new Vector(numColumns);
+ Vector data=new Vector(numRows);
+ for(int i=0;i<numColumns;i++) {
+ defaultNames.add(super.getColumnName(i));
+ }
+ for(int r=0;r<numRows;r++) {
+ Vector tmp=new Vector(numColumns);
+ tmp.setSize(numColumns);
+ data.add(tmp);
+ }
+
+ setDataVector(data, defaultNames);
+ }
+
+ /**
+ * Creates a new table with the specified column names and number of
+ * rows. The number of columns is determined by the number of column
+ * names supplied.
+ *
+ * @param columnNames the column names.
+ * @param numRows the number of rows.
+ */
+ public DefaultTableModel(Vector columnNames,int numRows) {
+ if(numRows<0) {
+ throw new IllegalArgumentException("numRows < 0");
+ }
+ Vector data=new Vector();
+ int numColumns=0;
+
+ if(columnNames!=null) {
+ numColumns=columnNames.size();
+ }
+
+ while(0<numRows--) {
+ Vector rowData=new Vector();
+ rowData.setSize(numColumns);
+ data.add(rowData);
+ }
+
+ setDataVector(data, columnNames);
+ }
+
+ /**
+ * Creates a new table with the specified column names and row count.
+ *
+ * @param columnNames the column names.
+ * @param numRows the number of rows.
+ */
+ public DefaultTableModel(Object[]columnNames,int numRows) {
+ this(convertToVector(columnNames), numRows);
+ }
+
+ /**
+ * Creates a new table with the specified data values and column names.
+ *
+ * @param data the data values.
+ * @param columnNames the column names.
+ */
+ public DefaultTableModel(Vector data,Vector columnNames) {
+ setDataVector(data, columnNames);
+ }
+
+ /**
+ * Creates a new table with the specified data values and column names.
+ *
+ * @param data the data values.
+ * @param columnNames the column names.
+ */
+ public DefaultTableModel(Object[][]data,Object[]columnNames) {
+ this(convertToVector(data), convertToVector(columnNames));
+ }
+
+ /**
+ * Returns the vector containing the row data for the table.
+ *
+ * @return The data vector.
+ */
+ public Vector getDataVector() {
+ return dataVector;
+ }
+
+ /**
+ * Sets the data and column identifiers for the table. The data vector
+ * contains a <code>Vector</code> for each row in the table - if the
+ * number of objects in each row does not match the number of column
+ * names specified, the row data is truncated or expanded (by adding
+ * <code>null</code> values) as required.
+ *
+ * @param data the data for the table (a vector of row vectors).
+ * @param columnNames the column names.
+ *
+ * @throws NullPointerException if either argument is <code>null</code>.
+ */
+ public void setDataVector(Vector data,Vector columnNames) {
+ if(data==null) {
+ dataVector=new Vector();
+ } else {
+ dataVector=data;
+ }
+ setColumnIdentifiers(columnNames);
+ }
+
+ /**
+ * Sets the data and column identifiers for the table.
+ *
+ * @param data the data for the table.
+ * @param columnNames the column names.
+ *
+ * @throws NullPointerException if either argument is <code>null</code>.
+ */
+ public void setDataVector(Object[][]data,Object[]columnNames) {
+ setDataVector(convertToVector(data), convertToVector(columnNames));
+ }
+
+ /**
+ * Sends the specified <code>event</code> to all registered listeners.
+ * This method is equivalent to
+ * {@link AbstractGWTTableModel#fireTableChanged(TableModelEvent)}.
+ *
+ * @param event the event.
+ */
+ public void newDataAvailable(TableModelEvent event) {
+ fireTableChanged(event);
+ }
+
+ /**
+ * Sends the specified <code>event</code> to all registered listeners.
+ * This method is equivalent to
+ * {@link AbstractGWTTableModel#fireTableChanged(TableModelEvent)}.
+ *
+ * @param event the event.
+ */
+ public void newRowsAdded(TableModelEvent event) {
+ fireTableChanged(event);
+ }
+
+ /**
+ * Sends the specified <code>event</code> to all registered listeners.
+ * This method is equivalent to
+ * {@link AbstractGWTTableModel#fireTableChanged(TableModelEvent)}.
+ *
+ * @param event the event.
+ */
+ public void rowsRemoved(TableModelEvent event) {
+ fireTableChanged(event);
+ }
+
+ /**
+ * Sets the column identifiers, updates the data rows (truncating
+ * or padding each row with <code>null</code> values) to match the
+ * number of columns, and sends a {@link TableModelEvent} to all
+ * registered listeners.
+ *
+ * @param columnIdentifiers the column identifiers.
+ */
+ public void setColumnIdentifiers(Vector columnIdentifiers) {
+ this.columnIdentifiers=columnIdentifiers;
+ setColumnCount(columnIdentifiers == null ? 0 : columnIdentifiers.size());
+ }
+
+ /**
+ * Sets the column identifiers, updates the data rows (truncating
+ * or padding each row with <code>null</code> values) to match the
+ * number of columns, and sends a {@link TableModelEvent} to all
+ * registered listeners.
+ *
+ * @param columnIdentifiers the column identifiers.
+ */
+ public void setColumnIdentifiers(Object[]columnIdentifiers) {
+ setColumnIdentifiers(convertToVector(columnIdentifiers));
+ }
+
+ /**
+ * This method is obsolete, use {@link #setRowCount(int)} instead.
+ *
+ * @param numRows the number of rows.
+ */
+ public void setNumRows(int numRows) {
+ setRowCount(numRows);
+ }
+
+ /**
+ * Sets the number of rows in the table. If <code>rowCount</code> is less
+ * than the current number of rows in the table, rows are discarded.
+ * If <code>rowCount</code> is greater than the current number of rows in
+ * the table, new (empty) rows are added.
+ *
+ * @param rowCount the row count.
+ */
+ public void setRowCount(int rowCount) {
+ int existingRowCount=dataVector.size();
+
+ if(rowCount<existingRowCount) {
+ dataVector.setSize(rowCount);
+ fireTableRowsDeleted(rowCount,existingRowCount-1);
+ } else {
+ int rowsToAdd=rowCount-existingRowCount;
+ addExtraRows(rowsToAdd,columnIdentifiers.size());
+ fireTableRowsInserted(existingRowCount,rowCount-1);
+ }
+ }
+
+ /**
+ * Sets the number of columns in the table. Existing rows are truncated
+ * or padded with <code>null</code> values to match the new column count.
+ * A {@link TableModelEvent} is sent to all registered listeners.
+ *
+ * @param columnCount the column count.
+ */
+ public void setColumnCount(int columnCount) {
+ for (Vector aDataVector : dataVector) {
+ aDataVector.setSize(columnCount);
+ }
+
+ if(columnIdentifiers!=null) {
+ columnIdentifiers.setSize(columnCount);
+ }
+ fireTableStructureChanged();
+ }
+
+ /**
+ * Adds a column with the specified name to the table. All cell values
+ * for the column are initially set to <code>null</code>.
+ *
+ * @param columnName the column name (<code>null</code> permitted).
+ */
+ public void addColumn(Object columnName) {
+ addColumn(columnName,(Object[])null);
+ }
+
+ /**
+ * Adds a column with the specified name and data values to the table.
+ *
+ * @param columnName the column name (<code>null</code> permitted).
+ * @param columnData the column data.
+ */
+ public void addColumn(Object columnName,Vector columnData) {
+ Object[]dataArray=null;
+
+ if(columnData!=null) {
+ int rowCount=dataVector.size();
+
+ if(columnData.size()<rowCount) {
+ columnData.setSize(rowCount);
+ }
+
+ dataArray=columnData.toArray();
+ }
+
+ addColumn(columnName,dataArray);
+ }
+
+ /**
+ * Adds a column with the specified name and data values to the table.
+ *
+ * @param columnName the column name (<code>null</code> permitted).
+ * @param columnData the column data.
+ */
+ public void addColumn(Object columnName,Object[]columnData) {
+ if(columnData!=null) {
+ // check columnData array for cases where the number of items
+ // doesn't match the number of rows in the existing table
+ if(columnData.length>dataVector.size()) {
+ int rowsToAdd=columnData.length-dataVector.size();
+ addExtraRows(rowsToAdd,columnIdentifiers.size());
+ } else if(columnData.length<dataVector.size()) {
+ Object[]tmp=new Object[dataVector.size()];
+ System.arraycopy(columnData,0,tmp,0,columnData.length);
+ columnData=tmp;
+ }
+ }
+
+ for(int i=0;i<dataVector.size();++i) {
+ dataVector.get(i).add(columnData == null ? null : columnData[i]);
+ }
+
+ columnIdentifiers.add(columnName);
+ fireTableStructureChanged();
+ }
+
+ /**
+ * Adds a new row containing the specified data to the table and sends a
+ * {@link TableModelEvent} to all registered listeners.
+ *
+ * @param rowData the row data (<code>null</code> permitted).
+ */
+ public void addRow(Vector rowData) {
+ int rowIndex = dataVector.size();
+ dataVector.add(rowData);
+ newRowsAdded(new TableModelEvent(this,rowIndex,rowIndex,TableModelEvent.ALL_COLUMNS,TableModelEvent.INSERT));
+ }
+
+ /**
+ * Adds a new row containing the specified data to the table and sends a
+ * {@link TableModelEvent} to all registered listeners.
+ *
+ * @param rowData the row data (<code>null</code> permitted).
+ */
+ public void addRow(Object[]rowData) {
+ addRow(convertToVector(rowData));
+ }
+
+ /**
+ * Inserts a new row into the table.
+ *
+ * @param row the row index.
+ * @param rowData the row data.
+ */
+ public void insertRow(int row,Vector rowData) {
+ dataVector.add(row,rowData);
+ fireTableRowsInserted(row,row);
+ }
+
+ /**
+ * Inserts a new row into the table.
+ *
+ * @param row the row index.
+ * @param rowData the row data.
+ */
+ public void insertRow(int row,Object[]rowData) {
+ insertRow(row,convertToVector(rowData));
+ }
+
+ /**
+ * Moves the rows from <code>startIndex</code> to <code>endIndex</code>
+ * (inclusive) to the specified row.
+ *
+ * @param startIndex the start row.
+ * @param endIndex the end row.
+ * @param toIndex the row to move to.
+ */
+ public void moveRow(int startIndex,int endIndex,int toIndex) {
+ Vector removed=new Vector();
+
+ for(int i=endIndex;i>=startIndex;i--) {
+ removed.add(this.dataVector.remove(i));
+ }
+
+ for(int i=0;i<=endIndex-startIndex;i++) {
+ dataVector.insertElementAt((Vector)removed.get(i),toIndex);
+ }
+
+ int firstRow=Math.min(startIndex,toIndex);
+ int lastRow=Math.max(endIndex,toIndex+(endIndex-startIndex));
+ fireTableRowsUpdated(firstRow,lastRow);
+ }
+
+ /**
+ * Removes a row from the table and sends a {@link TableModelEvent} to
+ * all registered listeners.
+ *
+ * @param row the row index.
+ */
+ public void removeRow(int row) {
+ dataVector.remove(row);
+ fireTableRowsDeleted(row,row);
+ }
+
+ /**
+ * Returns the number of rows in the model.
+ *
+ * @return The row count.
+ */
+ public int getRowCount() {
+ return dataVector.size();
+ }
+
+ /**
+ * Returns the number of columns in the model.
+ *
+ * @return The column count.
+ */
+ public int getColumnCount() {
+
+ if (columnIdentifiers == null){
+ return 0;
+ } else {
+ return columnIdentifiers.size();
+ }
+ }
+
+ /**
+ * Get the name of the column. If the column has the column identifier set,
+ * the return value is the result of the .toString() method call on that
+ * identifier. If the identifier is not explicitly set, the returned value
+ * is calculated by {@link AbstractGWTTableModel#getColumnName(int)}.
+ *
+ * @param column the column index.
+ *
+ * @return The column name.
+ */
+ public String getColumnName(int column) {
+ String result;
+
+ if(columnIdentifiers==null) {
+ result=super.getColumnName(column);
+ } else if(column<getColumnCount()) {
+ checkSize();
+ Object id=columnIdentifiers.get(column);
+
+ if(id!=null) {
+ result=id.toString();
+ } else {
+ result=super.getColumnName(column);
+ }
+ } else {
+ result=super.getColumnName(column);
+ }
+
+ return result;
+ }
+
+ /**
+ * Returns <code>true</code> if the specified cell can be modified, and
+ * <code>false</code> otherwise. For this implementation, the method
+ * always returns <code>true</code>.
+ *
+ * @param row the row index.
+ * @param column the column index.
+ *
+ * @return <code>true</code> in all cases.
+ */
+ public boolean isCellEditable(int row,int column) {
+ return true;
+ }
+
+ /**
+ * Returns the value at the specified cell in the table.
+ *
+ * @param row the row index.
+ * @param column the column index.
+ *
+ * @return The value (<code>Object</code>, possibly <code>null</code>) at
+ * the specified cell in the table.
+ */
+ public Object getValueAt(int column, int row) {
+ if (row<dataVector.size()) {
+ Vector rowVector = dataVector.get(row);
+ if (column<rowVector.size()) {
+ return rowVector.get(column);
+ } else {
+ return null;
+ }
+ } else {
+ return null;
+ }
+ }
+
+ /**
+ * Sets the value for the specified cell in the table and sends a
+ * {@link TableModelEvent} to all registered listeners.
+ *
+ * @param value the value (<code>Object</code>, <code>null</code> permitted).
+ * @param row the row index.
+ * @param column the column index.
+ */
+ public void setValueAt(Object value,int row,int column) {
+ int size = dataVector.size();
+
+ if(row>=size){
+ for (int i=size;i<=row;i++) {
+ addRow(new Object[getColumnCount()]);
+ }
+ }
+ Vector rawVector = dataVector.get(row);
+ rawVector.set(column,value);
+ fireTableCellUpdated(row,column);
+ }
+
+ /**
+ * Converts the data array to a <code>Vector</code>.
+ *
+ * @param data the data array (<code>null</code> permitted).
+ *
+ * @return A vector (or <code>null</code> if the data array
+ * is <code>null</code>).
+ */
+ protected static Vector convertToVector(Object[]data) {
+ if(data == null) {
+ return null;
+ }
+ Vector vector = new Vector(data.length);
+ vector.addAll(Arrays.asList(data));
+ return vector;
+ }
+
+ /**
+ * Converts the data array to a <code>Vector</code> of rows.
+ *
+ * @param data the data array (<code>null</code> permitted).
+ *
+ * @return A vector (or <code>null</code> if the data array
+ * is <code>null</code>.
+ */
+ protected static Vector convertToVector(Object[][]data) {
+ if(data==null) {
+ return null;
+ }
+
+ Vector vector=new Vector(data.length);
+ for (Object[] aData : data) {
+ vector.add(convertToVector(aData));
+ }
+
+ return vector;
+ }
+
+ /**
+ * This method adds some rows to <code>dataVector</code>.
+ *
+ * @param rowsToAdd number of rows to add
+ * @param nbColumns size of the added rows
+ */
+ protected void addExtraRows(int rowsToAdd,int nbColumns) {
+ for(int i=0;i<rowsToAdd;i++) {
+ Vector tmp=new Vector();
+ tmp.setSize(columnIdentifiers.size());
+ dataVector.add(tmp);
+ }
+ }
+
+ /**
+ * Checks the real columns/rows sizes against the ones returned by
+ * <code>getColumnCount()</code> and <code>getRowCount()</code>.
+ * If the supposed one are bigger, then we grow <code>columIdentifiers</code>
+ * and <code>dataVector</code> to their expected size.
+ */
+ protected void checkSize() {
+ int columnCount=getColumnCount();
+ int rowCount=getRowCount();
+
+ if(columnCount>columnIdentifiers.size()) {
+ columnIdentifiers.setSize(columnCount);
+ }
+
+ if(dataVector!=null&&rowCount>dataVector.size()) {
+ int rowsToAdd=rowCount-dataVector.size();
+ addExtraRows(rowsToAdd,columnCount);
+ }
+ }
+}
Property changes on: trunk/nuiton-gwt/src/main/java/org/nuiton/web/gwt/table/DefaultTableModel.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: trunk/nuiton-gwt/src/main/java/org/nuiton/web/gwt/table/FlexTableWithModel.java
===================================================================
--- trunk/nuiton-gwt/src/main/java/org/nuiton/web/gwt/table/FlexTableWithModel.java (rev 0)
+++ trunk/nuiton-gwt/src/main/java/org/nuiton/web/gwt/table/FlexTableWithModel.java 2011-03-09 11:01:10 UTC (rev 60)
@@ -0,0 +1,120 @@
+/*
+ * #%L
+ * Nuiton Web :: Nuiton GWT
+ * %%
+ * Copyright (C) 2010 - 2011 CodeLutin, Jean Couteau
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Lesser Public License for more details.
+ *
+ * You should have received a copy of the GNU General Lesser Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/lgpl-3.0.html>.
+ * #L%
+ */
+
+package org.nuiton.web.gwt.table;
+
+import com.google.gwt.user.client.ui.FlexTable;
+import com.google.gwt.user.client.ui.Widget;
+
+/**
+ * @author jcouteau
+ * @since 1.1
+ */
+public class FlexTableWithModel extends FlexTable
+ implements TableModelListener {
+
+ GWTTableModel model;
+
+ public FlexTableWithModel() {
+ super();
+ }
+
+ public FlexTableWithModel(GWTTableModel model) {
+ super();
+ setModel(model);
+ }
+
+ public void setModel(GWTTableModel model) {
+
+ removeAllRows();
+
+ if (this.model != null){
+ this.model.removeTableModelListener(this);
+ }
+ this.model = model;
+ this.model.addTableModelListener(this);
+ }
+
+ public GWTTableModel getModel(){
+ return model;
+ }
+
+ @Override
+ public void tableChanged(TableModelEvent event) {
+
+ int firstColumn = event.getColumn();
+ int lastColumn = event.getColumn();
+ int type = event.getType();
+
+
+ if (firstColumn == TableModelEvent.ALL_COLUMNS) {
+ firstColumn = 0;
+ lastColumn = getColumnCount() - 1;
+ }
+
+ int firstRow = event.getFirstRow();
+ int lastRow = event.getLastRow();
+
+ if (type == TableModelEvent.DELETE) {
+ for (int i = firstRow; i<=lastRow; i++) {
+ removeRow(i+1);
+ }
+ } else if (firstColumn == lastColumn) {
+ if (firstRow == lastRow) {
+ Object value = model.getValueAt(firstColumn, firstRow);
+ setValueAt(value, firstRow, firstColumn);
+ } else {
+ for (int j = firstRow; j <= lastRow; j++) {
+ Object value = model.getValueAt(firstColumn, j);
+ setValueAt(value, j, firstColumn);
+ }
+ }
+ } else {
+ for (int i=firstColumn; i<lastColumn; i++) {
+
+ if (firstRow == lastRow) {
+ Object value = model.getValueAt(i, firstRow);
+ setValueAt(value,firstRow,i);
+ } else {
+ for (int j=firstRow; j<=lastRow; j++) {
+ Object value = model.getValueAt(i, j);
+ setValueAt(value,j,i);
+ }
+ }
+ }
+ }
+ }
+
+ protected void setValueAt(Object value, int row, int col) {
+ if (value instanceof Widget) {
+ setWidget(row+1, col, (Widget) value);
+ } else if (value == null) {
+ setText(row+1, col, "");
+ } else {
+ setText(row+1, col, value.toString());
+ }
+ }
+
+ protected int getColumnCount() {
+ return model.getColumnCount();
+ }
+}
Property changes on: trunk/nuiton-gwt/src/main/java/org/nuiton/web/gwt/table/FlexTableWithModel.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: trunk/nuiton-gwt/src/main/java/org/nuiton/web/gwt/table/GWTTableModel.java
===================================================================
--- trunk/nuiton-gwt/src/main/java/org/nuiton/web/gwt/table/GWTTableModel.java (rev 0)
+++ trunk/nuiton-gwt/src/main/java/org/nuiton/web/gwt/table/GWTTableModel.java 2011-03-09 11:01:10 UTC (rev 60)
@@ -0,0 +1,49 @@
+/*
+ * #%L
+ * Nuiton Web :: Nuiton GWT
+ * %%
+ * Copyright (C) 2010 - 2011 CodeLutin, Jean Couteau
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Lesser Public License for more details.
+ *
+ * You should have received a copy of the GNU General Lesser Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/lgpl-3.0.html>.
+ * #L%
+ */
+
+package org.nuiton.web.gwt.table;
+
+/**
+ * @author jcouteau
+ * @since 1.1
+ */
+public interface GWTTableModel {
+
+ int getRowCount();
+
+ int getColumnCount();
+
+ String getColumnName(int col);
+
+ Class<?> getColumnClass(int columnIndex);
+
+ boolean isCellEditable(int col, int row);
+
+ Object getValueAt(int col, int row);
+
+ void setValueAt(Object value, int row, int col);
+
+ void addTableModelListener(TableModelListener listener);
+
+ void removeTableModelListener(TableModelListener listener);
+
+}
Property changes on: trunk/nuiton-gwt/src/main/java/org/nuiton/web/gwt/table/GWTTableModel.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: trunk/nuiton-gwt/src/main/java/org/nuiton/web/gwt/table/SortableFlexTableWithModel.java
===================================================================
--- trunk/nuiton-gwt/src/main/java/org/nuiton/web/gwt/table/SortableFlexTableWithModel.java (rev 0)
+++ trunk/nuiton-gwt/src/main/java/org/nuiton/web/gwt/table/SortableFlexTableWithModel.java 2011-03-09 11:01:10 UTC (rev 60)
@@ -0,0 +1,170 @@
+/*
+ * #%L
+ * Nuiton Web :: Nuiton GWT
+ * %%
+ * Copyright (C) 2010 - 2011 CodeLutin, Jean Couteau
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Lesser Public License for more details.
+ *
+ * You should have received a copy of the GNU General Lesser Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/lgpl-3.0.html>.
+ * #L%
+ */
+package org.nuiton.web.gwt.table;
+
+import com.google.gwt.event.dom.client.ClickEvent;
+import com.google.gwt.event.dom.client.ClickHandler;
+import com.google.gwt.user.client.ui.FlexTable;
+import com.google.gwt.user.client.ui.Widget;
+
+/**
+ * @author jcouteau
+ * @since 1.1
+ */
+public class SortableFlexTableWithModel extends FlexTable
+ implements TableModelListener, ClickHandler {
+
+ SortableTableModel model;
+
+ public SortableFlexTableWithModel() {
+ super();
+ this.addClickHandler(this);
+ }
+
+ public SortableFlexTableWithModel(SortableTableModel model) {
+ this();
+ setModel(model);
+ }
+
+ public void setModel(SortableTableModel model) {
+
+ removeAllRows();
+
+ if (this.model != null) {
+ this.model.removeTableModelListener(this);
+ }
+ this.model = model;
+ this.model.addTableModelListener(this);
+ }
+
+ public SortableTableModel getModel() {
+ return model;
+ }
+
+ @Override
+ public void tableChanged(TableModelEvent event) {
+
+ int firstColumn = event.getColumn();
+ int lastColumn = event.getColumn();
+ int type = event.getType();
+
+
+ if (firstColumn == TableModelEvent.ALL_COLUMNS) {
+ firstColumn = 0;
+ lastColumn = getColumnCount() - 1;
+ }
+
+ int firstRow = event.getFirstRow();
+ int lastRow = event.getLastRow();
+
+ if (type == TableModelEvent.DELETE) {
+ for (int i = firstRow; i <= lastRow; i++) {
+ removeRow(i + 1);
+ }
+ } else if (firstColumn == lastColumn) {
+ if (firstRow == lastRow) {
+ Object value = model.getValueAt(firstColumn, firstRow);
+ setValueAt(value, firstRow, firstColumn);
+ } else {
+ for (int j = firstRow; j <= lastRow; j++) {
+ Object value = model.getValueAt(firstColumn, j);
+ setValueAt(value, j, firstColumn);
+ }
+ }
+ } else {
+ for (int i = firstColumn; i < lastColumn; i++) {
+
+ if (firstRow == lastRow) {
+ Object value = model.getValueAt(i, firstRow);
+ setValueAt(value, firstRow, i);
+ } else {
+ for (int j = firstRow; j <= lastRow; j++) {
+ if (j < model.getRowCount()) {
+ Object value = model.getValueAt(i, j);
+ setValueAt(value, j, i);
+ } else {
+ break;
+ }
+ }
+ }
+ }
+ }
+ }
+
+ protected void setValueAt(Object value, int row, int col) {
+ if (value instanceof Widget) {
+ setWidget(row + 1, col, (Widget) value);
+ } else if (value == null) {
+ setText(row + 1, col, "");
+ } else {
+ setText(row + 1, col, value.toString());
+ }
+ }
+
+ protected int getColumnCount() {
+ return model.getColumnCount();
+ }
+
+ @Override
+ public void onClick(ClickEvent event) {
+ int columnClicked = getCellForEvent(event).getCellIndex();
+ int rowIndex = getCellForEvent(event).getRowIndex();
+
+ int sortedColumn = model.getSortedColumn();
+
+ int sortingOrder = model.getSortingOrder();
+
+ if (rowIndex == 0) {
+ if (sortedColumn == columnClicked) {
+ switch (sortingOrder) {
+ case SortableTableModel.ASC:
+ model.setSortedColumn(columnClicked,
+ SortableTableModel.DSC);
+ getCellFormatter().setStyleName(0,columnClicked,"sortedUp");
+ break;
+ case SortableTableModel.DSC:
+ model.setSortedColumn(columnClicked,
+ SortableTableModel.ASC);
+ getCellFormatter().setStyleName(0,columnClicked,"sortedDown");
+ break;
+ default:
+ model.setSortedColumn(columnClicked,
+ SortableTableModel.ASC);
+ getCellFormatter().setStyleName(0,columnClicked,"sortedDown");
+ }
+
+ } else {
+ model.setSortedColumn(columnClicked, SortableTableModel.ASC);
+ if (sortedColumn>=0) {
+ getCellFormatter().setStyleName(0,sortedColumn,"sortable");
+ }
+ getCellFormatter().setStyleName(0,columnClicked,"sortedDown");
+ }
+ }
+ }
+
+ public void setColumnVisible(int col, boolean b) {
+ for (int i = 0; i < getRowCount(); i++) {
+ getCellFormatter().setVisible(i, col, b);
+ }
+ }
+}
\ No newline at end of file
Property changes on: trunk/nuiton-gwt/src/main/java/org/nuiton/web/gwt/table/SortableFlexTableWithModel.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: trunk/nuiton-gwt/src/main/java/org/nuiton/web/gwt/table/SortableTableModel.java
===================================================================
--- trunk/nuiton-gwt/src/main/java/org/nuiton/web/gwt/table/SortableTableModel.java (rev 0)
+++ trunk/nuiton-gwt/src/main/java/org/nuiton/web/gwt/table/SortableTableModel.java 2011-03-09 11:01:10 UTC (rev 60)
@@ -0,0 +1,163 @@
+/*
+ * #%L
+ * Nuiton Web :: Nuiton GWT
+ * %%
+ * Copyright (C) 2010 - 2011 CodeLutin, Jean Couteau
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Lesser Public License for more details.
+ *
+ * You should have received a copy of the GNU General Lesser Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/lgpl-3.0.html>.
+ * #L%
+ */
+package org.nuiton.web.gwt.table;
+
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+/**
+ * This class is used to provide sorting functionnalities when clicking on table
+ * columns. It is based on an underlying model that contains data.
+ *
+ * @author jcouteau
+ * @since 1.1
+ */
+public class SortableTableModel extends AbstractGWTTableModel
+ implements Serializable , TableModelListener {
+
+ protected GWTTableModel model;
+
+ /** The sorted column, -1 means no sorting **/
+ protected int sortedColumn = -1;
+
+ /** The sorting order, -1 means no sorting **/
+ protected int sortingOrder = -1;
+
+ public final static int NO_SORTING = -1;
+
+ public final static int ASC = 0;
+
+ public final static int DSC = 1;
+
+ protected int[] rowsOrder;
+
+ public SortableTableModel(GWTTableModel model) {
+ super();
+ this.model = model;
+
+ //listen to the underlying model changes
+ model.addTableModelListener(this);
+
+ initRowsOrder();
+ }
+
+
+ @Override
+ public void tableChanged(TableModelEvent e) {
+ initRowsOrder();
+ fireTableDataChanged();
+ }
+
+ @Override
+ public int getRowCount() {
+ return model.getRowCount();
+ }
+
+ @Override
+ public int getColumnCount() {
+ return model.getColumnCount();
+ }
+
+ @Override
+ public Object getValueAt(int col, int row) {
+
+ int modelRow = rowsOrder[row];
+ return model.getValueAt(col, modelRow);
+ }
+
+ public void setSortedColumn(int column) {
+ setSortedColumn(column, ASC);
+ }
+
+ public void setSortedColumn(int column, int order) {
+ int rowCount = model.getRowCount();
+
+ if (isSortable(column)) {
+
+ sortedColumn = column;
+ sortingOrder = order;
+
+ List originalColumn = new ArrayList();
+
+ for (int i=0; i<rowCount; i++) {
+ if (model.getValueAt(column,i) == null) {
+ return;
+ }
+ originalColumn.add(model.getValueAt(column, i));
+ }
+
+ List sortedColumn = new ArrayList(originalColumn);
+
+ switch (order) {
+ case ASC :
+ Collections.sort(sortedColumn);
+ break;
+ case DSC :
+ Collections.sort(sortedColumn, Collections.reverseOrder());
+ break;
+ default:
+ break;
+ }
+
+ for (int i=0;i<rowCount; i++) {
+ Object value = sortedColumn.get(i);
+ int originalRow = originalColumn.indexOf(value);
+ originalColumn.set(originalRow,null);
+ rowsOrder[i] = originalRow;
+ }
+
+ fireTableDataChanged();
+ }
+ }
+
+ public int getSortedColumn() {
+ return sortedColumn;
+ }
+
+ public void setSortingOrder(int order) {
+ setSortedColumn(sortedColumn, order);
+ }
+
+ public int getSortingOrder() {
+ return sortingOrder;
+ }
+
+ protected boolean isSortable(int column) {
+
+ try {
+ Comparable value = (Comparable)getValueAt(column, 0);
+ } catch (ClassCastException eee) {
+ return false;
+ }
+ return true;
+ }
+
+ protected void initRowsOrder() {
+ int rowCount = model.getRowCount();
+ rowsOrder = new int[rowCount];
+ for (int i = 0;i<rowCount;i++) {
+ rowsOrder[i] = i;
+ }
+ }
+}
Property changes on: trunk/nuiton-gwt/src/main/java/org/nuiton/web/gwt/table/SortableTableModel.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: trunk/nuiton-gwt/src/main/java/org/nuiton/web/gwt/table/TableModelEvent.java
===================================================================
--- trunk/nuiton-gwt/src/main/java/org/nuiton/web/gwt/table/TableModelEvent.java (rev 0)
+++ trunk/nuiton-gwt/src/main/java/org/nuiton/web/gwt/table/TableModelEvent.java 2011-03-09 11:01:10 UTC (rev 60)
@@ -0,0 +1,102 @@
+/*
+ * Copyright 1997-2001 Sun Microsystems, Inc. All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Sun designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Sun in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ *
+ * %%Ignore-License
+ */
+
+package org.nuiton.web.gwt.table;
+
+import java.util.EventObject;
+
+/**
+ *
+ * Copy of javax.swing.event.TableModelEvent
+ *
+ * @author jcouteau
+ * @since 1.1
+ */
+public class TableModelEvent extends EventObject {
+
+ /** Identifies the addtion of new rows or columns. */
+ public static final int INSERT = 1;
+
+ /** Identifies a change to existing data. */
+ public static final int UPDATE = 0;
+
+ /** Identifies the removal of rows or columns. */
+ public static final int DELETE = -1;
+
+ /** Identifies the header row. */
+ public static final int HEADER_ROW = -1;
+
+ /** Specifies all columns in a row or rows. */
+ public static final int ALL_COLUMNS = -1;
+
+
+ protected int column;
+ protected int firstRow;
+ protected int lastRow;
+ protected int type;
+
+ public TableModelEvent(GWTTableModel source) {
+ this(source, 0, Integer.MAX_VALUE, ALL_COLUMNS, UPDATE);
+ }
+
+ public TableModelEvent(GWTTableModel source, int row) {
+ this(source, row, row, ALL_COLUMNS, UPDATE);
+ }
+
+ public TableModelEvent(GWTTableModel source, int firstRow, int lastRow) {
+ this(source, firstRow, lastRow, ALL_COLUMNS, UPDATE);
+ }
+
+ public TableModelEvent(GWTTableModel source, int firstRow, int lastRow, int column) {
+ this(source, firstRow, lastRow, column, UPDATE);
+ }
+
+ public TableModelEvent(GWTTableModel source, int firstRow, int lastRow, int column, int type) {
+ super(source);
+ this.firstRow = firstRow;
+ this.lastRow = lastRow;
+ this.column = column;
+ this.type = type;
+ }
+
+ public int getColumn() {
+ return column;
+ }
+
+ public int getFirstRow(){
+ return firstRow;
+ }
+
+ public int getLastRow(){
+ return lastRow;
+ }
+
+ public int getType() {
+ return type;
+ }
+
+}
Property changes on: trunk/nuiton-gwt/src/main/java/org/nuiton/web/gwt/table/TableModelEvent.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: trunk/nuiton-gwt/src/main/java/org/nuiton/web/gwt/table/TableModelListener.java
===================================================================
--- trunk/nuiton-gwt/src/main/java/org/nuiton/web/gwt/table/TableModelListener.java (rev 0)
+++ trunk/nuiton-gwt/src/main/java/org/nuiton/web/gwt/table/TableModelListener.java 2011-03-09 11:01:10 UTC (rev 60)
@@ -0,0 +1,35 @@
+/*
+ * #%L
+ * Nuiton Web :: Nuiton GWT
+ * %%
+ * Copyright (C) 2010 - 2011 CodeLutin, Jean Couteau
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Lesser Public License for more details.
+ *
+ * You should have received a copy of the GNU General Lesser Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/lgpl-3.0.html>.
+ * #L%
+ */
+
+package org.nuiton.web.gwt.table;
+
+import java.util.EventListener;
+
+/**
+ * @author jcouteau
+ * @since 1.1
+ */
+public interface TableModelListener extends EventListener {
+
+ void tableChanged(TableModelEvent e);
+
+}
Property changes on: trunk/nuiton-gwt/src/main/java/org/nuiton/web/gwt/table/TableModelListener.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: trunk/nuiton-gwt/src/main/resources/i18n/nuiton-gwt_en_GB.properties
===================================================================
--- trunk/nuiton-gwt/src/main/resources/i18n/nuiton-gwt_en_GB.properties (rev 0)
+++ trunk/nuiton-gwt/src/main/resources/i18n/nuiton-gwt_en_GB.properties 2011-03-09 11:01:10 UTC (rev 60)
@@ -0,0 +1 @@
+refcomp.loading=Loading, please wait
Property changes on: trunk/nuiton-gwt/src/main/resources/i18n/nuiton-gwt_en_GB.properties
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: trunk/nuiton-gwt/src/main/resources/i18n/nuiton-gwt_fr_FR.properties
===================================================================
--- trunk/nuiton-gwt/src/main/resources/i18n/nuiton-gwt_fr_FR.properties (rev 0)
+++ trunk/nuiton-gwt/src/main/resources/i18n/nuiton-gwt_fr_FR.properties 2011-03-09 11:01:10 UTC (rev 60)
@@ -0,0 +1 @@
+refcomp.loading=Chargement, veuillez patienter
Property changes on: trunk/nuiton-gwt/src/main/resources/i18n/nuiton-gwt_fr_FR.properties
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
1
0