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
- 3898 discussions
r1733 - in trunk/jaxx-runtime/src/main/java/jaxx/runtime: decorator swing
by tchemit@users.nuiton.org 07 Feb '10
by tchemit@users.nuiton.org 07 Feb '10
07 Feb '10
Author: tchemit
Date: 2010-02-07 12:40:13 +0100 (Sun, 07 Feb 2010)
New Revision: 1733
Modified:
trunk/jaxx-runtime/src/main/java/jaxx/runtime/decorator/JXPathDecorator.java
trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/OneClicListSelectionModel.java
Log:
Anomalie #302: Fix NPE in Decorator sort when context data is null
Modified: trunk/jaxx-runtime/src/main/java/jaxx/runtime/decorator/JXPathDecorator.java
===================================================================
--- trunk/jaxx-runtime/src/main/java/jaxx/runtime/decorator/JXPathDecorator.java 2010-02-01 01:40:24 UTC (rev 1732)
+++ trunk/jaxx-runtime/src/main/java/jaxx/runtime/decorator/JXPathDecorator.java 2010-02-07 11:40:13 UTC (rev 1733)
@@ -156,6 +156,15 @@
public int compare(O o1, O o2) {
Comparable<Comparable<?>> c1 = valueCache.get(o1);
Comparable<Comparable<?>> c2 = valueCache.get(o2);
+ if (c1 == null) {
+ if (c2 == null) {
+ return 0;
+ }
+ return 1;
+ }
+ if (c2 == null) {
+ return -1;
+ }
return c1.compareTo(c2);
}
Modified: trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/OneClicListSelectionModel.java
===================================================================
--- trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/OneClicListSelectionModel.java 2010-02-01 01:40:24 UTC (rev 1732)
+++ trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/OneClicListSelectionModel.java 2010-02-07 11:40:13 UTC (rev 1733)
@@ -34,7 +34,7 @@
*/
public class OneClicListSelectionModel implements ListSelectionModel {
- /** to use log facility, just put in your code: log.info("..."); */
+ /** Logger */
static private Log log = LogFactory.getLog(OneClicListSelectionModel.class);
protected ListSelectionModel delegate;
protected final ListModel model;
1
0
Author: tchemit
Date: 2010-02-01 02:40:24 +0100 (Mon, 01 Feb 2010)
New Revision: 1732
Modified:
trunk/jaxx-demo/pom.xml
Log:
clean imports
Modified: trunk/jaxx-demo/pom.xml
===================================================================
--- trunk/jaxx-demo/pom.xml 2010-02-01 01:32:44 UTC (rev 1731)
+++ trunk/jaxx-demo/pom.xml 2010-02-01 01:40:24 UTC (rev 1732)
@@ -169,6 +169,7 @@
<groupId>org.nuiton.i18n</groupId>
<artifactId>maven-i18n-plugin</artifactId>
<configuration>
+ <treateDefaultEntry>true</treateDefaultEntry>
<entries>
<entry>
<basedir>${maven.gen.dir}/java/</basedir>
1
0
Author: tchemit
Date: 2010-02-01 02:32:44 +0100 (Mon, 01 Feb 2010)
New Revision: 1731
Modified:
trunk/jaxx-demo/src/main/resources/i18n/jaxx-demo-en_GB.properties
trunk/jaxx-demo/src/main/resources/i18n/jaxx-demo-fr_FR.properties
Log:
clean imports
Modified: trunk/jaxx-demo/src/main/resources/i18n/jaxx-demo-en_GB.properties
===================================================================
--- trunk/jaxx-demo/src/main/resources/i18n/jaxx-demo-en_GB.properties 2010-02-01 01:18:46 UTC (rev 1730)
+++ trunk/jaxx-demo/src/main/resources/i18n/jaxx-demo-en_GB.properties 2010-02-01 01:32:44 UTC (rev 1731)
@@ -0,0 +1,234 @@
+-=
+.=
+0=
+1=
+10=
+12=
+14=
+18=
+2=
+24=
+3=
+4=
+5=
+6=
+7=
+8=
+9=
+Age\:=
+Animal=
+Blue=
+Blue\:=
+Bold=
+Button\ label\:=
+C=
+CE=
+Cancel=
+Comments\:=
+Config\ file\ \:=
+Config\ file\:=
+Cyan=
+Dec\ (-)=
+Demo=
+Directory\ file\:=
+Editable=
+Email\ Address\:=
+Email\:=
+Enabled=
+EnumEditor\ (country)\ \:=
+EnumEditor\ (language)\ \:=
+Fancy\ Button=
+First\ Name\:=
+FirstName\:=
+Font\ size=
+Font\ size\:\ =
+Fool\ me\ once=
+Fool\ me\ twice=
+Green=
+Green\:=
+Greet=
+Help=
+Inc\ (+)=
+Italic=
+JAXX\ Demo=
+JMenu\ demo=
+Label\ 1=
+Label\ 2=
+Last\ Name\:=
+LastName\:=
+Locale\ editor\:=
+Message\ Box=
+Mineral=
+Normal\ text\:=
+OK=
+Orange=
+Password\:=
+Purple=
+Ratio\:=
+Red=
+Red\:=
+Reset=
+Show\ Background=
+Show\ password\ dialog=
+Sign\ on=
+Simple\ Button=
+Size\:=
+Sources=
+Spacing\:=
+Start=
+Stop=
+Supported\ Swing\ components\:=
+Text2\:=
+Text\:=
+Total\:\ =
+Underline=
+Upper\ case\ text\:=
+Use\ the\ spinner\ to=
+Username\:=
+Vegetable=
+View=
+Welcome\ to\ the\ JAXX\ framework\!=
+Working\ directory\:=
+Yellow=
+You\ entered\:\ =
+Your\ name\:=
+\\u00f7=
+actors=
+adjust\ the\ spacing=
+between\ these\ lines=
+button\ A=
+button\ B=
+button\ C\ (full\ block)=
+button\ D\ (full\ block\ 2)=
+cancel=
+close=Disable
+close2=Disable 2
+close3=Disable 3
+demo.action.reload.application=Reload application
+demo.action.reload.ui=Reload UI
+edit=Edit
+edit2=Edit 2
+edit3=Edit 3
+f0=
+f1=
+file...=
+form.ratio=Ratio
+form.text=Text
+form.text2=Text 2
+form2.ratio=Form 2 Ratio
+form2.text=Form 2 Text
+form2.text2=Form 2 Text 2
+getModel0().isF0()=
+getModel0().isF0()\ &&\ getModel0().isF1()=
+getModel0().isF0()\ ||\ getModel0().isF1()=
+getModel0().isF1()=
+getModel1().isF0()=
+getModel1().isF0()\ &&\ getModel1().isF1()=
+getModel1().isF0()\ ||\ getModel1().isF1()=
+getModel1().isF1()=
+getT0().isSelected()=
+getT0().isSelected()\ &&\ getT1().isSelected()=
+getT0().isSelected()\ ||\ getT1().isSelected()=
+getT1().isSelected()=
+i18neditor.popup.title=
+isF0()=
+isF0()\ &&\ isF1()=
+isF0()\ ||\ isF1()=
+isF1()=
+jaxxdemo.about.message=<h3>JAXX Demo</h3><hr/>For more informations, viste the <a href\="http\://maven-site.nuiton.org/jaxx/jaxx-demo">website of the project</a>.
+jaxxdemo.action.about=About...
+jaxxdemo.action.about.tip=About JAXXDemo...
+jaxxdemo.action.add=
+jaxxdemo.action.configuration=Preferences
+jaxxdemo.action.configuration.tip=Change the preferences of the application
+jaxxdemo.action.exit=Quit
+jaxxdemo.action.exit.tip=Quit JAXXDemo
+jaxxdemo.action.fullscreen=Full screen
+jaxxdemo.action.fullscreen.tip=Change to full screen mode
+jaxxdemo.action.help=
+jaxxdemo.action.help.tip=Display help
+jaxxdemo.action.locale.fr=French
+jaxxdemo.action.locale.fr.tip=Change to french language
+jaxxdemo.action.locale.uk=English
+jaxxdemo.action.locale.uk.tip=Change to english language
+jaxxdemo.action.normalscreen=Normal screen
+jaxxdemo.action.normalscreen.tip=Change to normal screen mode
+jaxxdemo.action.remove=Remove
+jaxxdemo.action.show=show
+jaxxdemo.action.site=Web site
+jaxxdemo.action.site.tip=Go to the web site
+jaxxdemo.config.category.directories=Files
+jaxxdemo.config.category.directories.description=Files used by application
+jaxxdemo.config.category.other=Others
+jaxxdemo.config.category.other.description=Others preferences
+jaxxdemo.config.configFileName.description=Configuration file name
+jaxxdemo.config.ui.demo.path=Path of demo to select when starting application
+jaxxdemo.config.ui.fontSize=default font size to use in sources
+jaxxdemo.config.ui.fullscreen=To change the screen mode (true for full screen)
+jaxxdemo.config.ui.locale=Language used in application
+jaxxdemo.i18neditor.configuration=Configuration
+jaxxdemo.i18neditor.popupBorderText=Popup title
+jaxxdemo.i18neditor.selected.locale=Selected Language
+jaxxdemo.i18neditor.showIcon=Show icons
+jaxxdemo.i18neditor.showPopupIcon=Show icons in popup
+jaxxdemo.i18neditor.showPopupText=Show texts in popup
+jaxxdemo.i18neditor.showText=Show text
+jaxxdemo.init.closed=JAXXDemo was closed at %1$s
+jaxxdemo.init.context.done=Context initialized in %1$s
+jaxxdemo.init.ui.done=UI initialized.
+jaxxdemo.menu.file=File
+jaxxdemo.menu.file.locale=Languages
+jaxxdemo.menu.help=
+jaxxdemo.message.config.loaded=Configuration of JAXXDemo v. %1$s loaded.
+jaxxdemo.message.goto.site=Go to JAXXDemo Web site
+jaxxdemo.navigation.actor.title=
+jaxxdemo.navigation.actors.title=
+jaxxdemo.navigation.movie.title=
+jaxxdemo.navigation.movies.title=
+jaxxdemo.numbereditor.autoPopup=
+jaxxdemo.numbereditor.configuration=
+jaxxdemo.numbereditor.model=
+jaxxdemo.numbereditor.model.float=
+jaxxdemo.numbereditor.model.int=
+jaxxdemo.numbereditor.showPopupButton=
+jaxxdemo.numbereditor.showReset=
+jaxxdemo.numbereditor.useFloat=
+jaxxdemo.numbereditor.useSign=
+jaxxdemo.title.about=About JAXXDemo...
+jaxxdemo.tree.component.jaxx=JAXX Components
+jaxxdemo.tree.component.jaxx.editor=Editors
+jaxxdemo.tree.component.jaxx.tree.navigation=Navigation trees
+jaxxdemo.tree.component.swing=Swing Components
+jaxxdemo.tree.component.swing.buttons=Buttons
+jaxxdemo.tree.component.swing.form=Form elements
+jaxxdemo.tree.component.swing.form.text=Text
+jaxxdemo.tree.component.swing.layout=Layouts
+jaxxdemo.tree.component.swing.menu=Menus
+jaxxdemo.tree.component.swing.window=windows
+jaxxdemo.tree.feature=Features
+jaxxdemo.tree.features.databinding=Data Binding
+jaxxdemo.tree.features.validation=Validation
+jaxxdemo.tree.fun=Fun
+jaxxdemo.warning.nimbus.landf=Could not init nymbus look and feel, you need at leasr version 1.6u10 of java.
+jaxxdemo.warning.no.ui=No ui environnement detected
+model0.f0=
+model0.f1=
+model0.file...=
+model0.isF0()=
+model0.isF0()\ &&\ model0.isF1()=
+model0.isF0()\ ||\ model0.isF1()=
+model0.isF1()=
+model1.f0=
+model1.f1=
+model1.file...=
+model1.isF0()=
+model1.isF0()\ &&\ model1.isF1()=
+model1.isF0()\ ||\ model1.isF1()=
+model1.isF1()=
+movies=Movies
+t0.isSelected()=
+t0.isSelected()\ &&\ t1.isSelected()=
+t0.isSelected()\ ||\ t1.isSelected()=
+t1.isSelected()=
+valid=
+x=
Modified: trunk/jaxx-demo/src/main/resources/i18n/jaxx-demo-fr_FR.properties
===================================================================
--- trunk/jaxx-demo/src/main/resources/i18n/jaxx-demo-fr_FR.properties 2010-02-01 01:18:46 UTC (rev 1730)
+++ trunk/jaxx-demo/src/main/resources/i18n/jaxx-demo-fr_FR.properties 2010-02-01 01:32:44 UTC (rev 1731)
@@ -0,0 +1,234 @@
+-=-
+.=.
+0=0
+1=1
+10=10
+12=12
+14=14
+18=18
+2=2
+24=24
+3=3
+4=4
+5=5
+6=6
+7=7
+8=8
+9=9
+Age\:=Age \:
+Animal=Animal
+Blue=Bleu
+Blue\:=bleu \:
+Bold=En gras
+Button\ label\:=Libell\u00e9 de l'action
+C=C
+CE=CE
+Cancel=Annuler
+Comments\:=Commentaire
+Config\ file\ \:=Fichier de configuration
+Config\ file\:=Fichier de configuration \:
+Cyan=Bleu cyan
+Dec\ (-)=
+Demo=Demonstration
+Directory\ file\:=
+Editable=Editable
+Email\ Address\:=Courriel
+Email\:=Courriel
+Enabled=Activ\u00e9
+EnumEditor\ (country)\ \:=Editeur de pays
+EnumEditor\ (language)\ \:=Editeur de langue
+Fancy\ Button=Bouton 'Fancy'
+First\ Name\:=Pr\u00e9nom
+FirstName\:=Pr\u00e9nom \:
+Font\ size=Taille de la police
+Font\ size\:\ =
+Fool\ me\ once=
+Fool\ me\ twice=
+Green=Vert
+Green\:=Vert \:
+Greet=
+Help=
+Inc\ (+)=Incr\u00e9menter (+)
+Italic=Italique
+JAXX\ Demo=
+JMenu\ demo=
+Label\ 1=
+Label\ 2=
+Last\ Name\:=Nom \:
+LastName\:=Nom
+Locale\ editor\:=Editeur de locale
+Message\ Box=
+Mineral=
+Normal\ text\:=
+OK=
+Orange=
+Password\:=Mot de passe
+Purple=Pourpre
+Ratio\:=
+Red=Rouge
+Red\:=rouge \:
+Reset=Reinitialiser
+Show\ Background=Voir le fond
+Show\ password\ dialog=Voir l'\u00e9diteur de mot de passe
+Sign\ on=Signer
+Simple\ Button=Bouton simple
+Size\:=Taille \:
+Sources=Sources
+Spacing\:=Espacement \:
+Start=D\u00e9marrer
+Stop=Arr\u00eater
+Supported\ Swing\ components\:=Composants Swing support\u00e9s
+Text2\:=Text 2
+Text\:=Texte \:
+Total\:\ =
+Underline=soulign\u00e9
+Upper\ case\ text\:=Texte en majuscule
+Use\ the\ spinner\ to=Utiliser la jauge pour
+Username\:=Utilisateur \:
+Vegetable=L\u00e9gumes
+View=Vue
+Welcome\ to\ the\ JAXX\ framework\!=Bienvenu dans le framework JAXX
+Working\ directory\:=R\u00e9pertoire de travail
+Yellow=Jaune
+You\ entered\:\ =
+Your\ name\:=Votre nom \:
+\\u00f7=
+actors=Acteurs
+adjust\ the\ spacing=
+between\ these\ lines=
+button\ A=Bouton A
+button\ B=Bouton B
+button\ C\ (full\ block)=Bouton C (blocage compl\u00eat)
+button\ D\ (full\ block\ 2)=Bouton D (blocage compl\u00eat)
+cancel=Annuler
+close=Fermer
+close2=Fermer 2
+close3=Fermer 3
+demo.action.reload.application=Redemarrer l'application
+demo.action.reload.ui=Recharger l'interface graphique
+edit=Editer
+edit2=Editer 2
+edit3=Editer 3
+f0=
+f1=
+file...=
+form.ratio=Form \: ratio
+form.text=Form \: text
+form.text2=Form \: text2
+form2.ratio=Form2 \: ratio
+form2.text=Form2 \: text
+form2.text2=Form2 \: text2
+getModel0().isF0()=
+getModel0().isF0()\ &&\ getModel0().isF1()=
+getModel0().isF0()\ ||\ getModel0().isF1()=
+getModel0().isF1()=
+getModel1().isF0()=
+getModel1().isF0()\ &&\ getModel1().isF1()=
+getModel1().isF0()\ ||\ getModel1().isF1()=
+getModel1().isF1()=
+getT0().isSelected()=
+getT0().isSelected()\ &&\ getT1().isSelected()=
+getT0().isSelected()\ ||\ getT1().isSelected()=
+getT1().isSelected()=
+i18neditor.popup.title=
+isF0()=
+isF0()\ &&\ isF1()=
+isF0()\ ||\ isF1()=
+isF1()=
+jaxxdemo.about.message=<h3>JAXX Demo</h3><hr/>Pour plus d'informations, vous pouvez visiter le <a href\="http\://maven-site.nuiton.org/jaxx/jaxx-demo">site du projet</a>.
+jaxxdemo.action.about=A propos
+jaxxdemo.action.about.tip=A propos de JAXX Demo...
+jaxxdemo.action.add=
+jaxxdemo.action.configuration=Configuration
+jaxxdemo.action.configuration.tip=Modifier la configuration
+jaxxdemo.action.exit=Quitter
+jaxxdemo.action.exit.tip=Quitter JAXX Demo
+jaxxdemo.action.fullscreen=Plein \u00e9cran
+jaxxdemo.action.fullscreen.tip=Passer en mode pleine \u00e9cran
+jaxxdemo.action.help=Aide
+jaxxdemo.action.help.tip=Affichier l'aide
+jaxxdemo.action.locale.fr=Fran\u00e7ais
+jaxxdemo.action.locale.fr.tip=Changer la langue en fran\u00e7ais
+jaxxdemo.action.locale.uk=Anglais
+jaxxdemo.action.locale.uk.tip=Changer la langue en anglais
+jaxxdemo.action.normalscreen=Ecran normal
+jaxxdemo.action.normalscreen.tip=Revenir en mode normal
+jaxxdemo.action.remove=
+jaxxdemo.action.show=
+jaxxdemo.action.site=Site internet
+jaxxdemo.action.site.tip=Acc\u00e9der au site de l'application sur internet
+jaxxdemo.config.category.directories=R\u00e9pertoires
+jaxxdemo.config.category.directories.description=R\u00e9pertoires de l'application
+jaxxdemo.config.category.other=Autre
+jaxxdemo.config.category.other.description=Autres options
+jaxxdemo.config.configFileName.description=Le nom du fichier de configuration
+jaxxdemo.config.ui.demo.path=Chemin de la d\u00e9mo par d\u00e9faut
+jaxxdemo.config.ui.fontSize=La taille de la police \u00e0 utiliser pour visualiser dans les sources
+jaxxdemo.config.ui.fullscreen=Pour afficher l'aplication en mode pleine \u00e9cran
+jaxxdemo.config.ui.locale=La langue utilis\u00e9e par l'application
+jaxxdemo.i18neditor.configuration=Configuration
+jaxxdemo.i18neditor.popupBorderText=Titre de la popup
+jaxxdemo.i18neditor.selected.locale=Langue s\u00e9lectionn\u00e9e
+jaxxdemo.i18neditor.showIcon=Afficher les icones
+jaxxdemo.i18neditor.showPopupIcon=Afficher les icones dans la popup
+jaxxdemo.i18neditor.showPopupText=Afficher les textes dans la popup
+jaxxdemo.i18neditor.showText=Afficher le text
+jaxxdemo.init.closed=JAXX Demo a \u00e9t\u00e9 ferm\u00e9 \u00e0 %1$s
+jaxxdemo.init.context.done=Initialisation du contexte termin\u00e9e en %1$s.
+jaxxdemo.init.ui.done=Initialisation de l'interface graphique termin\u00e9e.
+jaxxdemo.menu.file=Fichier
+jaxxdemo.menu.file.locale=Langues
+jaxxdemo.menu.help=Aide
+jaxxdemo.message.config.loaded=Configuration de JAXX Demo v. %1$s charg\u00e9e.
+jaxxdemo.message.goto.site=Acc\u00e9der au site de JAXX Demo (%1$s)
+jaxxdemo.navigation.actor.title=
+jaxxdemo.navigation.actors.title=
+jaxxdemo.navigation.movie.title=
+jaxxdemo.navigation.movies.title=
+jaxxdemo.numbereditor.autoPopup=Affichage automatique popup
+jaxxdemo.numbereditor.configuration=Configuration
+jaxxdemo.numbereditor.model=R\u00e9sultat
+jaxxdemo.numbereditor.model.float=Valeur d\u00e9cimale \: %1$s
+jaxxdemo.numbereditor.model.int=Valeur enti\u00e8re \: %1$s
+jaxxdemo.numbereditor.showPopupButton=Afficher le boutton de popup
+jaxxdemo.numbereditor.showReset=Afficher le boutton de reset
+jaxxdemo.numbereditor.useFloat=Utiliser les d\u00e9cimales
+jaxxdemo.numbereditor.useSign=Utiliser le signe
+jaxxdemo.title.about=A propos de JAXX Demo...
+jaxxdemo.tree.component.jaxx=Composants JAXX
+jaxxdemo.tree.component.jaxx.editor=Editeurs
+jaxxdemo.tree.component.jaxx.tree.navigation=Arbre de navigation
+jaxxdemo.tree.component.swing=Composants Swing
+jaxxdemo.tree.component.swing.buttons=Boutons
+jaxxdemo.tree.component.swing.form=Elements de formulaire
+jaxxdemo.tree.component.swing.form.text=Texte
+jaxxdemo.tree.component.swing.layout=Layouts
+jaxxdemo.tree.component.swing.menu=Menus
+jaxxdemo.tree.component.swing.window=Fen\u00eatres
+jaxxdemo.tree.feature=Fonctionnalit\u00e9s
+jaxxdemo.tree.features.databinding=Data binding
+jaxxdemo.tree.features.validation=Validation
+jaxxdemo.tree.fun=Fun
+jaxxdemo.warning.nimbus.landf=Le look and Feel Nimbus n'a pas \u00e9t\u00e9 trouv\u00e9, il faut au moins la version 1.6u10 de java.
+jaxxdemo.warning.no.ui=Aucun environnement graphique d\u00e9tect\u00e9
+model0.f0=
+model0.f1=
+model0.file...=
+model0.isF0()=
+model0.isF0()\ &&\ model0.isF1()=
+model0.isF0()\ ||\ model0.isF1()=
+model0.isF1()=
+model1.f0=
+model1.f1=
+model1.file...=
+model1.isF0()=
+model1.isF0()\ &&\ model1.isF1()=
+model1.isF0()\ ||\ model1.isF1()=
+model1.isF1()=
+movies=Films
+t0.isSelected()=
+t0.isSelected()\ &&\ t1.isSelected()=
+t0.isSelected()\ ||\ t1.isSelected()=
+t1.isSelected()=
+valid=valide
+x=x
1
0
r1730 - in trunk: jaxx-demo/src/main/resources/i18n jaxx-widgets/src/main/resources/i18n
by tchemit@users.nuiton.org 01 Feb '10
by tchemit@users.nuiton.org 01 Feb '10
01 Feb '10
Author: tchemit
Date: 2010-02-01 02:18:46 +0100 (Mon, 01 Feb 2010)
New Revision: 1730
Modified:
trunk/jaxx-demo/src/main/resources/i18n/jaxx-demo-en_GB.properties
trunk/jaxx-demo/src/main/resources/i18n/jaxx-demo-fr_FR.properties
trunk/jaxx-widgets/src/main/resources/i18n/jaxx-widgets-en_GB.properties
trunk/jaxx-widgets/src/main/resources/i18n/jaxx-widgets-fr_FR.properties
Log:
clean i18n
Modified: trunk/jaxx-demo/src/main/resources/i18n/jaxx-demo-en_GB.properties
===================================================================
--- trunk/jaxx-demo/src/main/resources/i18n/jaxx-demo-en_GB.properties 2010-02-01 00:12:27 UTC (rev 1729)
+++ trunk/jaxx-demo/src/main/resources/i18n/jaxx-demo-en_GB.properties 2010-02-01 01:18:46 UTC (rev 1730)
@@ -1,234 +0,0 @@
--=
-.=
-0=
-1=
-10=
-12=
-14=
-18=
-2=
-24=
-3=
-4=
-5=
-6=
-7=
-8=
-9=
-Age\:=
-Animal=
-Blue=
-Blue\:=
-Bold=
-Button\ label\:=
-C=
-CE=
-Cancel=
-Comments\:=
-Config\ file\ \:=
-Config\ file\:=
-Cyan=
-Dec\ (-)=
-Demo=
-Directory\ file\:=
-Editable=
-Email\ Address\:=
-Email\:=
-Enabled=
-EnumEditor\ (country)\ \:=
-EnumEditor\ (language)\ \:=
-Fancy\ Button=
-First\ Name\:=
-FirstName\:=
-Font\ size=
-Font\ size\:\ =
-Fool\ me\ once=
-Fool\ me\ twice=
-Green=
-Green\:=
-Greet=
-Help=
-Inc\ (+)=
-Italic=
-JAXX\ Demo=
-JMenu\ demo=
-Label\ 1=
-Label\ 2=
-Last\ Name\:=
-LastName\:=
-Locale\ editor\:=
-Message\ Box=
-Mineral=
-Normal\ text\:=
-OK=
-Orange=
-Password\:=
-Purple=
-Ratio\:=
-Red=
-Red\:=
-Reset=
-Show\ Background=
-Show\ password\ dialog=
-Sign\ on=
-Simple\ Button=
-Size\:=
-Sources=
-Spacing\:=
-Start=
-Stop=
-Supported\ Swing\ components\:=
-Text2\:=
-Text\:=
-Total\:\ =
-Underline=
-Upper\ case\ text\:=
-Use\ the\ spinner\ to=
-Username\:=
-Vegetable=
-View=
-Welcome\ to\ the\ JAXX\ framework\!=
-Working\ directory\:=
-Yellow=
-You\ entered\:\ =
-Your\ name\:=
-\\u00f7=
-actors=
-adjust\ the\ spacing=
-between\ these\ lines=
-button\ A=
-button\ B=
-button\ C\ (full\ block)=
-button\ D\ (full\ block\ 2)=
-cancel=
-close=Disable
-close2=Disable 2
-close3=Disable 3
-demo.action.reload.application=Reload application
-demo.action.reload.ui=Reload UI
-edit=Edit
-edit2=Edit 2
-edit3=Edit 3
-f0=
-f1=
-file...=
-form.ratio=Ratio
-form.text=Text
-form.text2=Text 2
-form2.ratio=Form 2 Ratio
-form2.text=Form 2 Text
-form2.text2=Form 2 Text 2
-getModel0().isF0()=
-getModel0().isF0()\ &&\ getModel0().isF1()=
-getModel0().isF0()\ ||\ getModel0().isF1()=
-getModel0().isF1()=
-getModel1().isF0()=
-getModel1().isF0()\ &&\ getModel1().isF1()=
-getModel1().isF0()\ ||\ getModel1().isF1()=
-getModel1().isF1()=
-getT0().isSelected()=
-getT0().isSelected()\ &&\ getT1().isSelected()=
-getT0().isSelected()\ ||\ getT1().isSelected()=
-getT1().isSelected()=
-i18neditor.popup.title=
-isF0()=
-isF0()\ &&\ isF1()=
-isF0()\ ||\ isF1()=
-isF1()=
-jaxxdemo.about.message=<h3>JAXX Demo</h3><hr/>For more informations, viste the <a href\="http\://maven-site.nuiton.org/jaxx/jaxx-demo">website of the project</a>.
-jaxxdemo.action.about=About...
-jaxxdemo.action.about.tip=About JAXXDemo...
-jaxxdemo.action.add=
-jaxxdemo.action.configuration=Preferences
-jaxxdemo.action.configuration.tip=Change the preferences of the application
-jaxxdemo.action.exit=Quit
-jaxxdemo.action.exit.tip=Quit JAXXDemo
-jaxxdemo.action.fullscreen=Full screen
-jaxxdemo.action.fullscreen.tip=Change to full screen mode
-jaxxdemo.action.help=
-jaxxdemo.action.help.tip=Display help
-jaxxdemo.action.locale.fr=French
-jaxxdemo.action.locale.fr.tip=Change to french language
-jaxxdemo.action.locale.uk=English
-jaxxdemo.action.locale.uk.tip=Change to english language
-jaxxdemo.action.normalscreen=Normal screen
-jaxxdemo.action.normalscreen.tip=Change to normal screen mode
-jaxxdemo.action.remove=Remove
-jaxxdemo.action.show=show
-jaxxdemo.action.site=Web site
-jaxxdemo.action.site.tip=Go to the web site
-jaxxdemo.config.category.directories=Files
-jaxxdemo.config.category.directories.description=Files used by application
-jaxxdemo.config.category.other=Others
-jaxxdemo.config.category.other.description=Others preferences
-jaxxdemo.config.configFileName.description=Configuration file name
-jaxxdemo.config.ui.demo.path=Path of demo to select when starting application
-jaxxdemo.config.ui.fontSize=default font size to use in sources
-jaxxdemo.config.ui.fullscreen=To change the screen mode (true for full screen)
-jaxxdemo.config.ui.locale=Language used in application
-jaxxdemo.i18neditor.configuration=Configuration
-jaxxdemo.i18neditor.popupBorderText=Popup title
-jaxxdemo.i18neditor.selected.locale=Selected Language
-jaxxdemo.i18neditor.showIcon=Show icons
-jaxxdemo.i18neditor.showPopupIcon=Show icons in popup
-jaxxdemo.i18neditor.showPopupText=Show texts in popup
-jaxxdemo.i18neditor.showText=Show text
-jaxxdemo.init.closed=JAXXDemo was closed at %1$s
-jaxxdemo.init.context.done=Context initialized in %1$s
-jaxxdemo.init.ui.done=UI initialized.
-jaxxdemo.menu.file=File
-jaxxdemo.menu.file.locale=Languages
-jaxxdemo.menu.help=
-jaxxdemo.message.config.loaded=Configuration of JAXXDemo v. %1$s loaded.
-jaxxdemo.message.goto.site=Go to JAXXDemo Web site
-jaxxdemo.navigation.actor.title=
-jaxxdemo.navigation.actors.title=
-jaxxdemo.navigation.movie.title=
-jaxxdemo.navigation.movies.title=
-jaxxdemo.numbereditor.autoPopup=
-jaxxdemo.numbereditor.configuration=
-jaxxdemo.numbereditor.model=
-jaxxdemo.numbereditor.model.float=
-jaxxdemo.numbereditor.model.int=
-jaxxdemo.numbereditor.showPopupButton=
-jaxxdemo.numbereditor.showReset=
-jaxxdemo.numbereditor.useFloat=
-jaxxdemo.numbereditor.useSign=
-jaxxdemo.title.about=About JAXXDemo...
-jaxxdemo.tree.component.jaxx=JAXX Components
-jaxxdemo.tree.component.jaxx.editor=Editors
-jaxxdemo.tree.component.jaxx.tree.navigation=Navigation trees
-jaxxdemo.tree.component.swing=Swing Components
-jaxxdemo.tree.component.swing.buttons=Buttons
-jaxxdemo.tree.component.swing.form=Form elements
-jaxxdemo.tree.component.swing.form.text=Text
-jaxxdemo.tree.component.swing.layout=Layouts
-jaxxdemo.tree.component.swing.menu=Menus
-jaxxdemo.tree.component.swing.window=windows
-jaxxdemo.tree.feature=Features
-jaxxdemo.tree.features.databinding=Data Binding
-jaxxdemo.tree.features.validation=Validation
-jaxxdemo.tree.fun=Fun
-jaxxdemo.warning.nimbus.landf=Could not init nymbus look and feel, you need at leasr version 1.6u10 of java.
-jaxxdemo.warning.no.ui=No ui environnement detected
-model0.f0=
-model0.f1=
-model0.file...=
-model0.isF0()=
-model0.isF0()\ &&\ model0.isF1()=
-model0.isF0()\ ||\ model0.isF1()=
-model0.isF1()=
-model1.f0=
-model1.f1=
-model1.file...=
-model1.isF0()=
-model1.isF0()\ &&\ model1.isF1()=
-model1.isF0()\ ||\ model1.isF1()=
-model1.isF1()=
-movies=Movies
-t0.isSelected()=
-t0.isSelected()\ &&\ t1.isSelected()=
-t0.isSelected()\ ||\ t1.isSelected()=
-t1.isSelected()=
-valid=
-x=
Modified: trunk/jaxx-demo/src/main/resources/i18n/jaxx-demo-fr_FR.properties
===================================================================
--- trunk/jaxx-demo/src/main/resources/i18n/jaxx-demo-fr_FR.properties 2010-02-01 00:12:27 UTC (rev 1729)
+++ trunk/jaxx-demo/src/main/resources/i18n/jaxx-demo-fr_FR.properties 2010-02-01 01:18:46 UTC (rev 1730)
@@ -1,234 +0,0 @@
--=-
-.=.
-0=0
-1=1
-10=10
-12=12
-14=14
-18=18
-2=2
-24=24
-3=3
-4=4
-5=5
-6=6
-7=7
-8=8
-9=9
-Age\:=Age \:
-Animal=Animal
-Blue=Bleu
-Blue\:=bleu \:
-Bold=En gras
-Button\ label\:=Libell\u00E9 de l'action
-C=C
-CE=CE
-Cancel=Annuler
-Comments\:=Commentaire
-Config\ file\ \:=Fichier de configuration
-Config\ file\:=Fichier de configuration \:
-Cyan=Bleu cyan
-Dec\ (-)=
-Demo=Demonstration
-Directory\ file\:=
-Editable=Editable
-Email\ Address\:=Courriel
-Email\:=Courriel
-Enabled=Activ\u00E9
-EnumEditor\ (country)\ \:=Editeur de pays
-EnumEditor\ (language)\ \:=Editeur de langue
-Fancy\ Button=Bouton 'Fancy'
-First\ Name\:=Pr\u00E9nom
-FirstName\:=Pr\u00E9nom \:
-Font\ size=Taille de la police
-Font\ size\:\ =
-Fool\ me\ once=
-Fool\ me\ twice=
-Green=Vert
-Green\:=Vert \:
-Greet=
-Help=
-Inc\ (+)=Incr\u00E9menter (+)
-Italic=Italique
-JAXX\ Demo=
-JMenu\ demo=
-Label\ 1=
-Label\ 2=
-Last\ Name\:=Nom \:
-LastName\:=Nom
-Locale\ editor\:=Editeur de locale
-Message\ Box=
-Mineral=
-Normal\ text\:=
-OK=
-Orange=
-Password\:=Mot de passe
-Purple=Pourpre
-Ratio\:=
-Red=Rouge
-Red\:=rouge \:
-Reset=Reinitialiser
-Show\ Background=Voir le fond
-Show\ password\ dialog=Voir l'\u00E9diteur de mot de passe
-Sign\ on=Signer
-Simple\ Button=Bouton simple
-Size\:=Taille \:
-Sources=Sources
-Spacing\:=Espacement \:
-Start=D\u00E9marrer
-Stop=Arr\u00EAter
-Supported\ Swing\ components\:=Composants Swing support\u00E9s
-Text2\:=Text 2
-Text\:=Texte \:
-Total\:\ =
-Underline=soulign\u00E9
-Upper\ case\ text\:=Texte en majuscule
-Use\ the\ spinner\ to=Utiliser la jauge pour
-Username\:=Utilisateur \:
-Vegetable=L\u00E9gumes
-View=Vue
-Welcome\ to\ the\ JAXX\ framework\!=Bienvenu dans le framework JAXX
-Working\ directory\:=R\u00E9pertoire de travail
-Yellow=Jaune
-You\ entered\:\ =
-Your\ name\:=Votre nom \:
-\\u00f7=
-actors=Acteurs
-adjust\ the\ spacing=
-between\ these\ lines=
-button\ A=Bouton A
-button\ B=Bouton B
-button\ C\ (full\ block)=Bouton C (blocage compl\u00EAt)
-button\ D\ (full\ block\ 2)=Bouton D (blocage compl\u00EAt)
-cancel=Annuler
-close=Fermer
-close2=Fermer 2
-close3=Fermer 3
-demo.action.reload.application=Redemarrer l'application
-demo.action.reload.ui=Recharger l'interface graphique
-edit=Editer
-edit2=Editer 2
-edit3=Editer 3
-f0=
-f1=
-file...=
-form.ratio=Form \: ratio
-form.text=Form \: text
-form.text2=Form \: text2
-form2.ratio=Form2 \: ratio
-form2.text=Form2 \: text
-form2.text2=Form2 \: text2
-getModel0().isF0()=
-getModel0().isF0()\ &&\ getModel0().isF1()=
-getModel0().isF0()\ ||\ getModel0().isF1()=
-getModel0().isF1()=
-getModel1().isF0()=
-getModel1().isF0()\ &&\ getModel1().isF1()=
-getModel1().isF0()\ ||\ getModel1().isF1()=
-getModel1().isF1()=
-getT0().isSelected()=
-getT0().isSelected()\ &&\ getT1().isSelected()=
-getT0().isSelected()\ ||\ getT1().isSelected()=
-getT1().isSelected()=
-i18neditor.popup.title=
-isF0()=
-isF0()\ &&\ isF1()=
-isF0()\ ||\ isF1()=
-isF1()=
-jaxxdemo.about.message=<h3>JAXX Demo</h3><hr/>Pour plus d'informations, vous pouvez visiter le <a href\="http\://maven-site.nuiton.org/jaxx/jaxx-demo">site du projet</a>.
-jaxxdemo.action.about=A propos
-jaxxdemo.action.about.tip=A propos de JAXX Demo...
-jaxxdemo.action.add=
-jaxxdemo.action.configuration=Configuration
-jaxxdemo.action.configuration.tip=Modifier la configuration
-jaxxdemo.action.exit=Quitter
-jaxxdemo.action.exit.tip=Quitter JAXX Demo
-jaxxdemo.action.fullscreen=Plein \u00E9cran
-jaxxdemo.action.fullscreen.tip=Passer en mode pleine \u00E9cran
-jaxxdemo.action.help=Aide
-jaxxdemo.action.help.tip=Affichier l'aide
-jaxxdemo.action.locale.fr=Fran\u00E7ais
-jaxxdemo.action.locale.fr.tip=Changer la langue en fran\u00E7ais
-jaxxdemo.action.locale.uk=Anglais
-jaxxdemo.action.locale.uk.tip=Changer la langue en anglais
-jaxxdemo.action.normalscreen=Ecran normal
-jaxxdemo.action.normalscreen.tip=Revenir en mode normal
-jaxxdemo.action.remove=
-jaxxdemo.action.show=
-jaxxdemo.action.site=Site internet
-jaxxdemo.action.site.tip=Acc\u00E9der au site de l'application sur internet
-jaxxdemo.config.category.directories=R\u00E9pertoires
-jaxxdemo.config.category.directories.description=R\u00E9pertoires de l'application
-jaxxdemo.config.category.other=Autre
-jaxxdemo.config.category.other.description=Autres options
-jaxxdemo.config.configFileName.description=Le nom du fichier de configuration
-jaxxdemo.config.ui.demo.path=Chemin de la d\u00E9mo par d\u00E9faut
-jaxxdemo.config.ui.fontSize=La taille de la police \u00E0 utiliser pour visualiser dans les sources
-jaxxdemo.config.ui.fullscreen=Pour afficher l'aplication en mode pleine \u00E9cran
-jaxxdemo.config.ui.locale=La langue utilis\u00E9e par l'application
-jaxxdemo.i18neditor.configuration=Configuration
-jaxxdemo.i18neditor.popupBorderText=Titre de la popup
-jaxxdemo.i18neditor.selected.locale=Langue s\u00E9lectionn\u00E9e
-jaxxdemo.i18neditor.showIcon=Afficher les icones
-jaxxdemo.i18neditor.showPopupIcon=Afficher les icones dans la popup
-jaxxdemo.i18neditor.showPopupText=Afficher les textes dans la popup
-jaxxdemo.i18neditor.showText=Afficher le text
-jaxxdemo.init.closed=JAXX Demo a \u00E9t\u00E9 ferm\u00E9 \u00E0 %1$s
-jaxxdemo.init.context.done=Initialisation du contexte termin\u00E9e en %1$s.
-jaxxdemo.init.ui.done=Initialisation de l'interface graphique termin\u00E9e.
-jaxxdemo.menu.file=Fichier
-jaxxdemo.menu.file.locale=Langues
-jaxxdemo.menu.help=Aide
-jaxxdemo.message.config.loaded=Configuration de JAXX Demo v. %1$s charg\u00E9e.
-jaxxdemo.message.goto.site=Acc\u00E9der au site de JAXX Demo (%1$s)
-jaxxdemo.navigation.actor.title=
-jaxxdemo.navigation.actors.title=
-jaxxdemo.navigation.movie.title=
-jaxxdemo.navigation.movies.title=
-jaxxdemo.numbereditor.autoPopup=Affichage automatique popup
-jaxxdemo.numbereditor.configuration=Configuration
-jaxxdemo.numbereditor.model=R\u00E9sultat
-jaxxdemo.numbereditor.model.float=Valeur d\u00E9cimale \: %1$s
-jaxxdemo.numbereditor.model.int=Valeur enti\u00E8re \: %1$s
-jaxxdemo.numbereditor.showPopupButton=Afficher le boutton de popup
-jaxxdemo.numbereditor.showReset=Afficher le boutton de reset
-jaxxdemo.numbereditor.useFloat=Utiliser les d\u00E9cimales
-jaxxdemo.numbereditor.useSign=Utiliser le signe
-jaxxdemo.title.about=A propos de JAXX Demo...
-jaxxdemo.tree.component.jaxx=Composants JAXX
-jaxxdemo.tree.component.jaxx.editor=Editeurs
-jaxxdemo.tree.component.jaxx.tree.navigation=Arbre de navigation
-jaxxdemo.tree.component.swing=Composants Swing
-jaxxdemo.tree.component.swing.buttons=Boutons
-jaxxdemo.tree.component.swing.form=Elements de formulaire
-jaxxdemo.tree.component.swing.form.text=Texte
-jaxxdemo.tree.component.swing.layout=Layouts
-jaxxdemo.tree.component.swing.menu=Menus
-jaxxdemo.tree.component.swing.window=Fen\u00EAtres
-jaxxdemo.tree.feature=Fonctionnalit\u00E9s
-jaxxdemo.tree.features.databinding=Data binding
-jaxxdemo.tree.features.validation=Validation
-jaxxdemo.tree.fun=Fun
-jaxxdemo.warning.nimbus.landf=Le look and Feel Nimbus n'a pas \u00E9t\u00E9 trouv\u00E9, il faut au moins la version 1.6u10 de java.
-jaxxdemo.warning.no.ui=Aucun environnement graphique d\u00E9tect\u00E9
-model0.f0=
-model0.f1=
-model0.file...=
-model0.isF0()=
-model0.isF0()\ &&\ model0.isF1()=
-model0.isF0()\ ||\ model0.isF1()=
-model0.isF1()=
-model1.f0=
-model1.f1=
-model1.file...=
-model1.isF0()=
-model1.isF0()\ &&\ model1.isF1()=
-model1.isF0()\ ||\ model1.isF1()=
-model1.isF1()=
-movies=Films
-t0.isSelected()=
-t0.isSelected()\ &&\ t1.isSelected()=
-t0.isSelected()\ ||\ t1.isSelected()=
-t1.isSelected()=
-valid=valide
-x=x
Modified: trunk/jaxx-widgets/src/main/resources/i18n/jaxx-widgets-en_GB.properties
===================================================================
--- trunk/jaxx-widgets/src/main/resources/i18n/jaxx-widgets-en_GB.properties 2010-02-01 00:12:27 UTC (rev 1729)
+++ trunk/jaxx-widgets/src/main/resources/i18n/jaxx-widgets-en_GB.properties 2010-02-01 01:18:46 UTC (rev 1730)
@@ -23,7 +23,6 @@
config.detected.callBack=Detected actions
config.error.category.already.exists=category with name '%1$s' does already exist\!
config.error.category.not.found=category with name '%1$s' does not exist\!
-config.final.callBack=Action to perform
config.key=Key
config.key.tip=Key of the option
config.launch.callBack=Perform
Modified: trunk/jaxx-widgets/src/main/resources/i18n/jaxx-widgets-fr_FR.properties
===================================================================
--- trunk/jaxx-widgets/src/main/resources/i18n/jaxx-widgets-fr_FR.properties 2010-02-01 00:12:27 UTC (rev 1729)
+++ trunk/jaxx-widgets/src/main/resources/i18n/jaxx-widgets-fr_FR.properties 2010-02-01 01:18:46 UTC (rev 1730)
@@ -23,7 +23,6 @@
config.detected.callBack=Actions d\u00E9tect\u00E9es pour les options modifi\u00E9es
config.error.category.already.exists=La cat\u00E9gorie de nom '%1$s' existe d\u00E9j\u00E0\!
config.error.category.not.found=La cat\u00E9gorie de nom '%1$s' n'existe pas\!
-config.final.callBack=Action \u00E0 executer
config.key=Clef
config.key.tip=Clef de l'option
config.launch.callBack=Lancer
1
0
r1729 - in trunk: jaxx-demo/src/main/java/jaxx/demo jaxx-demo/src/main/resources/i18n jaxx-demo/src/main/resources/icons jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/config jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/config/model jaxx-widgets/src/main/resources/i18n
by tchemit@users.nuiton.org 01 Feb '10
by tchemit@users.nuiton.org 01 Feb '10
01 Feb '10
Author: tchemit
Date: 2010-02-01 01:12:27 +0100 (Mon, 01 Feb 2010)
New Revision: 1729
Added:
trunk/jaxx-demo/src/main/resources/icons/action-reload-application.png
trunk/jaxx-demo/src/main/resources/icons/action-reload-ui.png
trunk/jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/config/ConfigCallBackUI.jaxx
trunk/jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/config/ConfigCallBackUIHandler.java
trunk/jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/config/model/CallBackEntry.java
trunk/jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/config/model/CallBacksManager.java
Modified:
trunk/jaxx-demo/src/main/java/jaxx/demo/DemoConfig.java
trunk/jaxx-demo/src/main/java/jaxx/demo/DemoUIHandler.java
trunk/jaxx-demo/src/main/resources/i18n/jaxx-demo-en_GB.properties
trunk/jaxx-demo/src/main/resources/i18n/jaxx-demo-fr_FR.properties
trunk/jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/config/ConfigCategoryUI.jaxx
trunk/jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/config/ConfigUI.jaxx
trunk/jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/config/ConfigUIBuilder.java
trunk/jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/config/model/ConfigUIModel.java
trunk/jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/config/model/ConfigUIModelBuilder.java
trunk/jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/config/model/OptionModel.java
trunk/jaxx-widgets/src/main/resources/i18n/jaxx-widgets-en_GB.properties
trunk/jaxx-widgets/src/main/resources/i18n/jaxx-widgets-fr_FR.properties
Log:
Evolution #297: Improve ConfigUI with a CallBackManager
Modified: trunk/jaxx-demo/src/main/java/jaxx/demo/DemoConfig.java
===================================================================
--- trunk/jaxx-demo/src/main/java/jaxx/demo/DemoConfig.java 2010-01-30 11:46:50 UTC (rev 1728)
+++ trunk/jaxx-demo/src/main/java/jaxx/demo/DemoConfig.java 2010-02-01 00:12:27 UTC (rev 1729)
@@ -63,26 +63,27 @@
public static final String PROPERTY_ADJUSTING = "adjusting";
/**
- * un drapeau pour bloquer la sauvegarde lors de la modification en masse des options
- * via les setter.
+ * un drapeau pour bloquer la sauvegarde lors de la modification en
+ * masse des options via les setter.
*/
protected boolean adjusting;
- protected final PropertyChangeListener saveAction = new PropertyChangeListener() {
+ protected final PropertyChangeListener saveAction =
+ new PropertyChangeListener() {
- @Override
- public void propertyChange(PropertyChangeEvent evt) {
- if (adjusting) {
- if (log.isDebugEnabled()) {
- log.debug("skip save while adjusting");
+ @Override
+ public void propertyChange(PropertyChangeEvent evt) {
+ if (adjusting) {
+ if (log.isDebugEnabled()) {
+ log.debug("skip save while adjusting");
+ }
+ return;
+ }
+ if (log.isDebugEnabled()) {
+ log.debug("Saving configuration at " + new Date());
+ }
+ saveForUser();
}
- return;
- }
- if (log.isDebugEnabled()) {
- log.debug("Saving configuration at " + new Date());
- }
- saveForUser();
- }
- };
+ };
public DemoConfig() {
@@ -90,7 +91,8 @@
// chargement de la configuration interne
- InputStream stream = getClass().getResourceAsStream(APPLICATION_PROPERTIES);
+ InputStream stream = getClass().getResourceAsStream(
+ APPLICATION_PROPERTIES);
Properties p = new Properties();
try {
@@ -112,7 +114,8 @@
}
// on supprime le stamp de snapshot s'il existe
- String sVersion = VersionUtil.removeSnapshot(getOption("application.version"));
+ String sVersion = VersionUtil.removeSnapshot(
+ getOption("application.version"));
Version version = VersionUtil.valueOf(sVersion);
setDefaultOption("version", version.getVersion());
@@ -210,11 +213,17 @@
}
public static final String[] DEFAULT_JAXX_PCS = {
- PROPERTY_FULLSCREEN, PROPERTY_LOCALE, PROPERTY_FONT_SIZE, PROPERTY_ADJUSTING
+ PROPERTY_FULLSCREEN,
+ PROPERTY_LOCALE,
+ PROPERTY_FONT_SIZE,
+ PROPERTY_ADJUSTING
};
public void removeJaxxPropertyChangeListener() {
- PropertyChangeListener[] toRemove = JAXXUtil.findJaxxPropertyChangeListener(DEFAULT_JAXX_PCS, getPropertyChangeListeners());
+ PropertyChangeListener[] toRemove;
+ toRemove = JAXXUtil.findJaxxPropertyChangeListener(
+ DEFAULT_JAXX_PCS,
+ getPropertyChangeListeners());
if (toRemove == null || toRemove.length == 0) {
return;
}
@@ -235,11 +244,41 @@
//////////////////////////////////////////////////
public static enum Option implements OptionDef {
- CONFIG_FILE(CONFIG_FILE_NAME, _("jaxxdemo.config.configFileName.description"), "jaxxdemo", String.class, true, true),
- FULL_SCREEN("ui.fullscreen", _("jaxxdemo.config.ui.fullscreen"), "false", Boolean.class, false, false),
- LOCALE("ui." + PROPERTY_LOCALE, _("jaxxdemo.config.ui." + PROPERTY_LOCALE), Locale.FRANCE.toString(), Locale.class, false, false),
- FONT_SIZE("ui." + PROPERTY_FONT_SIZE, _("jaxxdemo.config.ui." + PROPERTY_FONT_SIZE), "10f", Float.class, false, false),
- DEMO_PATH("ui.demo.path", _("jaxxdemo.config.ui.demo.path"), "$root/jaxxdemo.tree.component.jaxx/jaxxdemo.tree.component.jaxx.tree.navigation/" + FullNavigationTreeDemo.class.getSimpleName(), String.class, false, false);
+ CONFIG_FILE(
+ CONFIG_FILE_NAME,
+ _("jaxxdemo.config.configFileName.description"),
+ "jaxxdemo",
+ String.class,
+ true,
+ true),
+ FULL_SCREEN(
+ "ui.fullscreen",
+ _("jaxxdemo.config.ui.fullscreen"),
+ "false",
+ Boolean.class,
+ false,
+ false),
+ LOCALE(
+ "ui." + PROPERTY_LOCALE,
+ _("jaxxdemo.config.ui.locale"),
+ Locale.FRANCE.toString(),
+ Locale.class,
+ false,
+ false),
+ FONT_SIZE(
+ "ui." + PROPERTY_FONT_SIZE,
+ _("jaxxdemo.config.ui.fontSize"),
+ "10f",
+ Float.class,
+ false,
+ false),
+ DEMO_PATH(
+ "ui.demo.path",
+ _("jaxxdemo.config.ui.demo.path"),
+ "$root/jaxxdemo.tree.component.jaxx/jaxxdemo.tree.component.jaxx.tree.navigation/" + FullNavigationTreeDemo.class.getSimpleName(),
+ String.class,
+ false,
+ true);
public final String key;
public final String description;
public final String defaultValue;
Modified: trunk/jaxx-demo/src/main/java/jaxx/demo/DemoUIHandler.java
===================================================================
--- trunk/jaxx-demo/src/main/java/jaxx/demo/DemoUIHandler.java 2010-01-30 11:46:50 UTC (rev 1728)
+++ trunk/jaxx-demo/src/main/java/jaxx/demo/DemoUIHandler.java 2010-02-01 00:12:27 UTC (rev 1729)
@@ -22,6 +22,7 @@
import jaxx.runtime.JAXXContext;
import jaxx.runtime.JAXXUtil;
+import jaxx.runtime.SwingUtil;
import jaxx.runtime.context.DefaultApplicationContext;
import jaxx.runtime.context.JAXXContextEntryDef;
import jaxx.runtime.context.JAXXInitialContext;
@@ -249,6 +250,31 @@
}
}
+ final Runnable reloadUICallback = new Runnable() {
+
+ @Override
+ public void run() {
+ if (log.isInfoEnabled()) {
+ log.info("will reload ui");
+ }
+ DefaultApplicationContext context = RunDemo.get();
+ DemoUI ui = getUI(context);
+ DemoConfig config = ui.getConfig();
+ reloadUI(context, config);
+ }
+ };
+
+ final Runnable reloadApplicationCallback = new Runnable() {
+
+ @Override
+ public void run() {
+ if (log.isInfoEnabled()) {
+ log.info("will reload appplication");
+ }
+ close(RunDemo.get());
+ }
+ };
+
public void showConfig(JAXXContext context) {
DemoUI ui = getUI(context);
final DemoConfig config = ui.getConfig();
@@ -257,19 +283,16 @@
builder.createModel(config);
- builder.setReloadUICallback(new Runnable() {
- @Override
- public void run() {
- if (log.isInfoEnabled()) {
- log.info("will reload ui");
- }
- DefaultApplicationContext context = RunDemo.get();
- DemoUI ui = getUI(context);
- DemoConfig config = ui.getConfig();
- reloadUI(context, config);
- }
- });
+ builder.registerCallBack("ui",
+ n_("demo.action.reload.ui"),
+ SwingUtil.createActionIcon("reload-ui"),
+ reloadUICallback);
+
+ builder.registerCallBack("application",
+ n_("demo.action.reload.application"),
+ SwingUtil.createActionIcon("reload-application"),
+ reloadApplicationCallback);
// categorie repertoires
@@ -284,17 +307,21 @@
builder.addOption(DemoConfig.Option.FULL_SCREEN);
builder.setOptionPropertyName(DemoConfig.PROPERTY_FULLSCREEN);
- builder.setOptionNeedReloadUI(true);
+ builder.setOptionCallBack("ui");
builder.addOption(DemoConfig.Option.FONT_SIZE);
builder.setOptionPropertyName(DemoConfig.PROPERTY_FONT_SIZE);
+ builder.setOptionCallBack("application");
builder.addOption(DemoConfig.Option.LOCALE);
builder.setOptionPropertyName(DemoConfig.PROPERTY_LOCALE);
- builder.setOptionNeedReloadUI(true);
+ builder.setOptionCallBack("ui");
ConfigUIModel model = builder.flushModel();
- ConfigUI configUI = ConfigUIBuilder.newConfigUI(context, model, "jaxxdemo.config.category.directories");
+ ConfigUI configUI = ConfigUIBuilder.newConfigUI(
+ context,
+ model,
+ "jaxxdemo.config.category.other");
ConfigUIBuilder.showConfigUI(configUI, ui, false);
}
Modified: trunk/jaxx-demo/src/main/resources/i18n/jaxx-demo-en_GB.properties
===================================================================
--- trunk/jaxx-demo/src/main/resources/i18n/jaxx-demo-en_GB.properties 2010-01-30 11:46:50 UTC (rev 1728)
+++ trunk/jaxx-demo/src/main/resources/i18n/jaxx-demo-en_GB.properties 2010-02-01 00:12:27 UTC (rev 1729)
@@ -104,6 +104,8 @@
close=Disable
close2=Disable 2
close3=Disable 3
+demo.action.reload.application=Reload application
+demo.action.reload.ui=Reload UI
edit=Edit
edit2=Edit 2
edit3=Edit 3
@@ -160,9 +162,10 @@
jaxxdemo.config.category.other=Others
jaxxdemo.config.category.other.description=Others preferences
jaxxdemo.config.configFileName.description=Configuration file name
-jaxxdemo.config.ui.=
jaxxdemo.config.ui.demo.path=Path of demo to select when starting application
+jaxxdemo.config.ui.fontSize=default font size to use in sources
jaxxdemo.config.ui.fullscreen=To change the screen mode (true for full screen)
+jaxxdemo.config.ui.locale=Language used in application
jaxxdemo.i18neditor.configuration=Configuration
jaxxdemo.i18neditor.popupBorderText=Popup title
jaxxdemo.i18neditor.selected.locale=Selected Language
Modified: trunk/jaxx-demo/src/main/resources/i18n/jaxx-demo-fr_FR.properties
===================================================================
--- trunk/jaxx-demo/src/main/resources/i18n/jaxx-demo-fr_FR.properties 2010-01-30 11:46:50 UTC (rev 1728)
+++ trunk/jaxx-demo/src/main/resources/i18n/jaxx-demo-fr_FR.properties 2010-02-01 00:12:27 UTC (rev 1729)
@@ -104,6 +104,8 @@
close=Fermer
close2=Fermer 2
close3=Fermer 3
+demo.action.reload.application=Redemarrer l'application
+demo.action.reload.ui=Recharger l'interface graphique
edit=Editer
edit2=Editer 2
edit3=Editer 3
@@ -160,9 +162,10 @@
jaxxdemo.config.category.other=Autre
jaxxdemo.config.category.other.description=Autres options
jaxxdemo.config.configFileName.description=Le nom du fichier de configuration
-jaxxdemo.config.ui.=
-jaxxdemo.config.ui.demo.path=
+jaxxdemo.config.ui.demo.path=Chemin de la d\u00E9mo par d\u00E9faut
+jaxxdemo.config.ui.fontSize=La taille de la police \u00E0 utiliser pour visualiser dans les sources
jaxxdemo.config.ui.fullscreen=Pour afficher l'aplication en mode pleine \u00E9cran
+jaxxdemo.config.ui.locale=La langue utilis\u00E9e par l'application
jaxxdemo.i18neditor.configuration=Configuration
jaxxdemo.i18neditor.popupBorderText=Titre de la popup
jaxxdemo.i18neditor.selected.locale=Langue s\u00E9lectionn\u00E9e
Added: trunk/jaxx-demo/src/main/resources/icons/action-reload-application.png
===================================================================
(Binary files differ)
Property changes on: trunk/jaxx-demo/src/main/resources/icons/action-reload-application.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/jaxx-demo/src/main/resources/icons/action-reload-ui.png
===================================================================
(Binary files differ)
Property changes on: trunk/jaxx-demo/src/main/resources/icons/action-reload-ui.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/config/ConfigCallBackUI.jaxx
===================================================================
--- trunk/jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/config/ConfigCallBackUI.jaxx (rev 0)
+++ trunk/jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/config/ConfigCallBackUI.jaxx 2010-02-01 00:12:27 UTC (rev 1729)
@@ -0,0 +1,47 @@
+<JPanel layout='{new BorderLayout()}'>
+ <script><![CDATA[
+ import jaxx.runtime.swing.editor.config.model.*;
+
+ /**
+ * Init the ui.
+ */
+ public void init() {
+ getHandler().init(this);
+ }
+ ]]>
+ </script>
+
+ <ConfigCallBackUIHandler
+ id='handler'
+ initializer='getContextValue(ConfigCallBackUIHandler.class)'/>
+
+ <JScrollPane constraints='BorderLayout.CENTER'
+ columnHeaderView='{treeHeader}'>
+
+ <JTree id='detectedCallBack'
+ editable='false'
+ rootVisible='false'
+ rowHeight='24'/>
+
+ </JScrollPane>
+
+ <!--JPanel constraints='BorderLayout.SOUTH' layout='{new BorderLayout()}'>
+
+ <JPanel constraints='BorderLayout.CENTER'
+ border='{new TitledBorder(_("config.callBack.description"))}'>
+ <JLabel id='callBackDescription'/>
+ </JPanel-->
+
+ <JButton constraints='BorderLayout.SOUTH'
+ id='go'
+ text='config.launch.callBack'
+ toolTipText='config.launch.callBack.tip'
+ actionIcon='config-quit'
+ onActionPerformed='getHandler().doAction(this)'/>
+ <!--/JPanel-->
+
+ <JPanel id='treeHeader' constraints='BorderLayout.EAST'>
+ <JLabel text='config.detected.callBack'/>
+ </JPanel>
+
+</JPanel>
\ No newline at end of file
Added: trunk/jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/config/ConfigCallBackUIHandler.java
===================================================================
--- trunk/jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/config/ConfigCallBackUIHandler.java (rev 0)
+++ trunk/jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/config/ConfigCallBackUIHandler.java 2010-02-01 00:12:27 UTC (rev 1729)
@@ -0,0 +1,167 @@
+package jaxx.runtime.swing.editor.config;
+
+import jaxx.runtime.SwingUtil;
+import jaxx.runtime.swing.editor.config.model.CallBackEntry;
+import jaxx.runtime.swing.editor.config.model.OptionModel;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import static org.nuiton.i18n.I18n._;
+
+import javax.swing.*;
+import javax.swing.tree.DefaultMutableTreeNode;
+import javax.swing.tree.DefaultTreeCellRenderer;
+import javax.swing.tree.DefaultTreeModel;
+import java.awt.*;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * callBackUI handler
+ *
+ * @author tchemit < chemit(a)codelutin.com >
+ * @since 2.0
+ */
+public class ConfigCallBackUIHandler {
+
+ /**
+ * Logger
+ */
+ private static final Log log = LogFactory.getLog(ConfigCallBackUIHandler.class);
+
+ public void init(ConfigCallBackUI ui) {
+
+ // build tree model
+ DefaultMutableTreeNode root = new DefaultMutableTreeNode();
+
+ Map<CallBackEntry, List<OptionModel>> forSaved;
+
+ forSaved = ui.getContextValue(Map.class,
+ ConfigUIBuilder.CALLBACKS_WITH_OPTIONS);
+
+ for (Map.Entry<CallBackEntry, List<OptionModel>> e :
+ forSaved.entrySet()) {
+
+ CallBackEntry callBackEntry = e.getKey();
+ List<OptionModel> options = e.getValue();
+
+ DefaultMutableTreeNode callBackNode;
+ callBackNode = new DefaultMutableTreeNode(callBackEntry, true);
+
+ root.add(callBackNode);
+ for (OptionModel o : options) {
+
+ DefaultMutableTreeNode optionkNode;
+ optionkNode = new DefaultMutableTreeNode(o, false);
+
+ callBackNode.add(optionkNode);
+ }
+ }
+
+ JTree tree = ui.getDetectedCallBack();
+
+ tree.setModel(new DefaultTreeModel(root));
+
+ SwingUtil.expandTree(tree);
+
+ tree.setCellRenderer(new DefaultTreeCellRenderer() {
+ @Override
+ public Component getTreeCellRendererComponent(JTree tree,
+ Object value,
+ boolean sel,
+ boolean expanded,
+ boolean leaf,
+ int row,
+ boolean hasFocus) {
+ if (log.isDebugEnabled()) {
+ log.debug("value = " + value.getClass());
+ }
+ if (value == null) {
+ return super.getTreeCellRendererComponent(
+ tree,
+ value,
+ sel,
+ expanded,
+ leaf,
+ row,
+ hasFocus);
+ }
+
+ if (!(value instanceof DefaultMutableTreeNode)) {
+ return super.getTreeCellRendererComponent(
+ tree,
+ value,
+ sel,
+ expanded,
+ leaf,
+ row,
+ hasFocus);
+ }
+
+ DefaultMutableTreeNode n = (DefaultMutableTreeNode) value;
+ value = n.getUserObject();
+
+ if (value instanceof CallBackEntry) {
+ CallBackEntry v = (CallBackEntry) value;
+ if (log.isDebugEnabled()) {
+ log.debug("callBackEntry detected " + v.getName());
+ }
+ value = _(v.getDescription());
+ } else if (value instanceof OptionModel) {
+
+ OptionModel v = (OptionModel) value;
+ if (log.isDebugEnabled()) {
+ log.debug("option detected " + v.getKey());
+ }
+ value = v.getKey() + " (" + _(v.getDescription()) + ")";
+ }
+
+ JLabel rendererComponent;
+ rendererComponent = (JLabel)
+ super.getTreeCellRendererComponent(
+ tree,
+ value,
+ sel,
+ expanded,
+ leaf,
+ row,
+ hasFocus);
+
+ value = n.getUserObject();
+
+ if (value instanceof CallBackEntry) {
+
+ CallBackEntry v = (CallBackEntry) value;
+ rendererComponent.setIcon(v.getIcon());
+ }
+ return rendererComponent;
+ }
+ });
+ }
+
+ public void doAction(final ConfigCallBackUI ui) {
+ log.info("Launch callBacks...");
+ Window parent = ui.getContextValue(Window.class, "parent");
+ if (parent != null) {
+ log.info("dispose parent window...");
+ parent.dispose();
+ }
+
+ SwingUtilities.invokeLater(new Runnable() {
+
+ @Override
+ public void run() {
+
+ List<CallBackEntry> callBacks;
+ callBacks = ui.getContextValue(
+ List.class,
+ ConfigUIBuilder.CALLBACKS);
+ for (CallBackEntry e : callBacks) {
+ if (log.isInfoEnabled()) {
+ log.info("launch callBack " + _(e.getDescription()));
+ }
+ e.getAction().run();
+ }
+ }
+ });
+ }
+}
\ No newline at end of file
Property changes on: trunk/jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/config/ConfigCallBackUIHandler.java
___________________________________________________________________
Added: svn:keywords
+ "Author Date Id Revision HeadURL
Modified: trunk/jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/config/ConfigCategoryUI.jaxx
===================================================================
--- trunk/jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/config/ConfigCategoryUI.jaxx 2010-01-30 11:46:50 UTC (rev 1728)
+++ trunk/jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/config/ConfigCategoryUI.jaxx 2010-02-01 00:12:27 UTC (rev 1729)
@@ -1,26 +1,3 @@
-<!--
-
-/**
- * *##% jaxx-runtime-swing-widget
- * Copyright (C) 2008 - 2009 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>. ##%*
- */
-
--->
-
<JPanel layout='{new BorderLayout()}'>
<style source='ConfigCategoryUI.css'/>
Modified: trunk/jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/config/ConfigUI.jaxx
===================================================================
--- trunk/jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/config/ConfigUI.jaxx 2010-01-30 11:46:50 UTC (rev 1728)
+++ trunk/jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/config/ConfigUI.jaxx 2010-02-01 00:12:27 UTC (rev 1729)
@@ -1,26 +1,3 @@
-<!--
-
-/**
- * *##% jaxx-runtime-swing-widget
- * Copyright (C) 2008 - 2009 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>. ##%*
- */
-
--->
-
<JPanel layout='{new BorderLayout()}'>
<style source='ConfigUI.css'/>
Modified: trunk/jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/config/ConfigUIBuilder.java
===================================================================
--- trunk/jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/config/ConfigUIBuilder.java 2010-01-30 11:46:50 UTC (rev 1728)
+++ trunk/jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/config/ConfigUIBuilder.java 2010-02-01 00:12:27 UTC (rev 1729)
@@ -23,6 +23,7 @@
import jaxx.runtime.JAXXContext;
import jaxx.runtime.SwingUtil;
import jaxx.runtime.context.JAXXInitialContext;
+import jaxx.runtime.swing.editor.config.model.CallBackEntry;
import jaxx.runtime.swing.editor.config.model.CategoryModel;
import jaxx.runtime.swing.editor.config.model.ConfigUIModel;
import jaxx.runtime.swing.editor.config.model.OptionModel;
@@ -36,8 +37,8 @@
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.util.ArrayList;
-import java.util.Iterator;
import java.util.List;
+import java.util.Map;
/**
* La classe pour construire l'ui
@@ -47,6 +48,8 @@
public class ConfigUIBuilder {
public static final Log log = LogFactory.getLog(ConfigUIBuilder.class);
+ public static final String CALLBACKS_WITH_OPTIONS = "callbacksWithOptions";
+ public static final String CALLBACKS = "callbacks";
/**
* Construire l'ui de configuration (sous forme de panel)
@@ -56,14 +59,17 @@
* @param defaultCategory la categorie a selectionner
* @return l'ui instanciate
*/
- public static ConfigUI newConfigUI(JAXXContext parentContext, final ConfigUIModel model, String defaultCategory) {
+ public static ConfigUI newConfigUI(JAXXContext parentContext,
+ final ConfigUIModel model,
+ String defaultCategory) {
JAXXContext tx = new JAXXInitialContext().add(parentContext).add(model);
final ConfigUI ui = new ConfigUI(tx);
JButton quitButton = ui.getQuit();
// prepare quit action
- Action quitAction = new AbstractAction(quitButton.getText(), quitButton.getIcon()) {
+ Action quitAction = new AbstractAction(quitButton.getText(),
+ quitButton.getIcon()) {
private static final long serialVersionUID = 1L;
@@ -73,119 +79,57 @@
return;
}
- boolean needReloadUI = false;
- boolean needReloadApplication = false;
+ final Window parentWindow = ui.getParentContainer(Window.class);
- StringBuilder reloadUIBuffer = new StringBuilder();
+ if (!model.isSaved() || model.isStandalone()) {
- StringBuilder reloadApplicationBuffer = new StringBuilder();
+ // just quit, no callBack can be apply here
- if (model.isSaved() && !model.isStandalone()) {
+ // close the configu ui
+ parentWindow.dispose();
+ return;
+ }
+ Map<CallBackEntry, List<OptionModel>> forSaved;
+ forSaved = model.getCallBacksForSaved();
- StringBuilder buffer = new StringBuilder();
+ if (forSaved.isEmpty()) {
+ // just quit, no callBack to call
- // on doit verifier si des options sauvees necessite
- // un redemarrage de l'application
- for (CategoryModel cat : model) {
- List<OptionModel> savedOptions = cat.getSavedOptions();
- List<OptionModel> needReloadUIOptions = new ArrayList<OptionModel>();
- List<OptionModel> needReloadApplicationOptions = new ArrayList<OptionModel>();
- if (!savedOptions.isEmpty()) {
- Iterator<OptionModel> itr = savedOptions.iterator();
- buffer.append("\n").append(_("config.category.saved", _(cat.getCategory()))).append("\n");
- while (itr.hasNext()) {
- OptionModel option = itr.next();
- buffer.append("\n- ").append(option.getKey());
- if (option.isNeedReloadApplication()) {
- needReloadApplication = true;
- needReloadApplicationOptions.add(option);
- continue;
- }
- if (option.isNeedReloadUI()) {
- needReloadUI = true;
- needReloadUIOptions.add(option);
- continue;
- }
- itr.remove();
-
- }
- if (!savedOptions.isEmpty()) {
-
- if (!needReloadApplicationOptions.isEmpty()) {
- reloadApplicationBuffer.append("\n");
- reloadApplicationBuffer.append(_("config.category.needReloadApplication", _(cat.getCategory())));
- reloadApplicationBuffer.append("\n");
- // second pass to obtain needReloadUI
- for (OptionModel option : needReloadApplicationOptions) {
- reloadApplicationBuffer.append("\n- ").append(option.getKey());
- }
- }
-
- if (!needReloadUIOptions.isEmpty()) {
- reloadUIBuffer.append("\n");
- reloadUIBuffer.append(_("config.category.needReloadUI", _(cat.getCategory())));
- reloadUIBuffer.append("\n");
- // second pass to obtain needReloadUI
- for (OptionModel option : needReloadUIOptions) {
- reloadUIBuffer.append("\n- ").append(option.getKey());
- }
- }
- }
-
- }
- }
-
- if (log.isInfoEnabled()) {
- log.info("save options :\n" + buffer.toString());
- }
-
- if (needReloadApplication) {
-
- // reloading application implies reloading ui
- needReloadUI = false;
-
- askUser(ui,
- _("config.title.will.reload.application"),
- _("config.model.needReloadApplication") +
- reloadApplicationBuffer.toString(),
- JOptionPane.INFORMATION_MESSAGE,
- new Object[]{_("config.choice.ok")},
- 0);
- }
-
- if (needReloadUI) {
- askUser(ui,
- _("config.title.will.reload.ui"),
- _("config.model.needReloadUI") +
- reloadUIBuffer.toString(),
- JOptionPane.INFORMATION_MESSAGE,
- new Object[]{_("config.choice.ok")},
- 0);
- }
+ // close the configu ui
+ parentWindow.dispose();
+ return;
}
- // close the configu ui
- ui.getParentContainer(Window.class).dispose();
+ forSaved = model.getCallBacksForSaved();
- if (needReloadApplication) {
+ // init callBackUI
- Runnable callback = model.getReloadApplicationCallback();
- if (callback == null) {
- throw new IllegalStateException("No reloadApplicationCallback found in model");
- }
+ ConfigCallBackUI lastUI = new ConfigCallBackUI(
+ new JAXXInitialContext().
+ add("parent", parentWindow).
+ add(ui).
+ add(CALLBACKS_WITH_OPTIONS, forSaved).
+ add(CALLBACKS, new ArrayList<CallBackEntry>(forSaved.keySet())).
+ add(new ConfigCallBackUIHandler())
+ );
- SwingUtilities.invokeLater(callback);
- } else if (needReloadUI) {
+ lastUI.init();
+ ui.setVisible(false);
+ parentWindow.remove(ui);
+ parentWindow.add(lastUI);
+
+ SwingUtilities.invokeLater(new Runnable() {
- Runnable callback = model.getReloadUICallback();
- if (callback == null) {
- throw new IllegalStateException("No reloadUICallback found in model");
+ @Override
+ public void run() {
+ parentWindow.validate();
}
- SwingUtilities.invokeLater(callback);
- }
+ });
+// dialog.pack();
+// SwingUtil.center(parentWindow, lastUI);
-
+// lastUI.setVisible(true);
}
};
String tip = quitButton.getToolTipText();
@@ -196,7 +140,8 @@
for (CategoryModel categoryModel : model) {
String category = categoryModel.getCategory();
String categoryLabel = _(categoryModel.getCategoryLabel());
- ConfigCategoryUI p = new ConfigCategoryUI(new JAXXInitialContext().add(ui).add(categoryModel));
+ ConfigCategoryUI p = new ConfigCategoryUI(new
+ JAXXInitialContext().add(ui).add(categoryModel));
p.getCategoryLabel().setText(categoryLabel);
p.setName(category);
ui.getCategories().addTab(_(category), null, p, categoryLabel);
@@ -205,7 +150,8 @@
model.setCategory(defaultCategory);
int categoryIndex = model.getCategoryIndex(defaultCategory);
if (log.isDebugEnabled()) {
- log.debug("index of default category (" + defaultCategory + ") : " + categoryIndex);
+ log.debug("index of default category (" + defaultCategory + ") : "
+ + categoryIndex);
}
ui.getCategories().setSelectedIndex(categoryIndex);
return ui;
@@ -215,10 +161,14 @@
* Affiche l'ui de configuration dans un boite de dialogue.
*
* @param configUI l'ui de configuration
- * @param ui l'ui parent de la boite de dialogue a afficher (peut etre nulle)
- * @param undecorated un drapeau pour savoir si on affiche les decorations de fenetre
+ * @param ui l'ui parent de la boite de dialogue a afficher
+ * (peut etre nulle)
+ * @param undecorated un drapeau pour savoir si on affiche les decorations
+ * de fenetre
*/
- public static void showConfigUI(final ConfigUI configUI, Frame ui, boolean undecorated) {
+ public static void showConfigUI(final ConfigUI configUI,
+ Frame ui,
+ boolean undecorated) {
JDialog f = new JDialog(ui, true);
f.setTitle(_("config.title"));
f.add(configUI);
@@ -240,7 +190,8 @@
f.setUndecorated(undecorated);
JRootPane rootPane = f.getRootPane();
rootPane.setDefaultButton(configUI.getQuit());
- rootPane.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(KeyStroke.getKeyStroke("ESCAPE"), "quit");
+ rootPane.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(
+ KeyStroke.getKeyStroke("ESCAPE"), "quit");
rootPane.getActionMap().put("quit", configUI.getQuit().getAction());
f.pack();
SwingUtil.center(ui, f);
@@ -258,7 +209,9 @@
// get all the invalid options
StringBuilder buffer = new StringBuilder();
- buffer.append(_("config.message.quit.invalid.category", categoryName)).append('\n');
+ buffer.append(_("config.message.quit.invalid.category",
+ categoryName));
+ buffer.append('\n');
for (OptionModel m : categoryModel.getInvalidOptions()) {
buffer.append("\n- ").append(m.getKey());
}
@@ -289,7 +242,8 @@
// category was modified, ask user if wants to save
StringBuilder buffer = new StringBuilder();
- buffer.append(_("config.message.quit.valid.and.modified.category", categoryName)).append('\n');
+ buffer.append(_("config.message.quit.valid.and.modified.category",
+ categoryName)).append('\n');
for (OptionModel m : categoryModel.getModifiedOptions()) {
buffer.append("\n- ").append(m.getKey());
}
@@ -323,7 +277,12 @@
return canContinue;
}
- public static int askUser(ConfigUI parent, String title, String message, int typeMessage, Object[] options, int defaultOption) {
+ public static int askUser(ConfigUI parent,
+ String title,
+ String message,
+ int typeMessage,
+ Object[] options,
+ int defaultOption) {
int response = JOptionPane.showOptionDialog(
parent,
@@ -338,4 +297,159 @@
return response;
}
+
+ /**
+ * // prepare quit action
+ Action quitAction = new AbstractAction(quitButton.getText(),
+ quitButton.getIcon()) {
+
+ private static final long serialVersionUID = 1L;
+
+ @Override public void actionPerformed(ActionEvent e) {
+ if (!canQuitCategory(ui)) {
+ return;
+ }
+
+ boolean needReloadUI = false;
+ boolean needReloadApplication = false;
+
+ StringBuilder reloadUIBuffer = new StringBuilder();
+
+ StringBuilder reloadApplicationBuffer = new StringBuilder();
+
+ if (model.isSaved() && !model.isStandalone()) {
+
+
+ StringBuilder buffer = new StringBuilder();
+
+ // on doit verifier si des options sauvees necessite
+ // un redemarrage de l'application
+ for (CategoryModel cat : model) {
+ List<OptionModel> savedOptions = cat.getSavedOptions();
+ List<OptionModel> needReloadUIOptions = new ArrayList<OptionModel>();
+ List<OptionModel> needReloadApplicationOptions = new ArrayList<OptionModel>();
+ if (!savedOptions.isEmpty()) {
+ Iterator<OptionModel> itr = savedOptions.iterator();
+ buffer.append("\n").append(_("config.category.saved", _(cat.getCategory()))).append("\n");
+ while (itr.hasNext()) {
+ OptionModel option = itr.next();
+ buffer.append("\n- ").append(option.getKey());
+ if (option.isNeedReloadApplication()) {
+ needReloadApplication = true;
+ needReloadApplicationOptions.add(option);
+ continue;
+ }
+ if (option.isNeedReloadUI()) {
+ needReloadUI = true;
+ needReloadUIOptions.add(option);
+ continue;
+ }
+ itr.remove();
+
+ }
+ if (!savedOptions.isEmpty()) {
+
+ if (!needReloadApplicationOptions.isEmpty()) {
+ reloadApplicationBuffer.append("\n");
+ reloadApplicationBuffer.append(_("config.category.needReloadApplication", _(cat.getCategory())));
+ reloadApplicationBuffer.append("\n");
+ // second pass to obtain needReloadUI
+ for (OptionModel option : needReloadApplicationOptions) {
+ reloadApplicationBuffer.append("\n- ").append(option.getKey());
+ }
+ }
+
+ if (!needReloadUIOptions.isEmpty()) {
+ reloadUIBuffer.append("\n");
+ reloadUIBuffer.append(_("config.category.needReloadUI", _(cat.getCategory())));
+ reloadUIBuffer.append("\n");
+ // second pass to obtain needReloadUI
+ for (OptionModel option : needReloadUIOptions) {
+ reloadUIBuffer.append("\n- ").append(option.getKey());
+ }
+ }
+ }
+
+ }
+ }
+
+ if (log.isInfoEnabled()) {
+ log.info("save options :\n" + buffer.toString());
+ }
+
+ if (needReloadApplication) {
+
+ // reloading application implies reloading ui
+ needReloadUI = false;
+
+ askUser(ui,
+ _("config.title.will.reload.application"),
+ _("config.model.needReloadApplication") +
+ reloadApplicationBuffer.toString(),
+ JOptionPane.INFORMATION_MESSAGE,
+ new Object[]{_("config.choice.ok")},
+ 0);
+ }
+
+ if (needReloadUI) {
+ askUser(ui,
+ _("config.title.will.reload.ui"),
+ _("config.model.needReloadUI") +
+ reloadUIBuffer.toString(),
+ JOptionPane.INFORMATION_MESSAGE,
+ new Object[]{_("config.choice.ok")},
+ 0);
+ }
+ }
+
+ // close the configu ui
+ ui.getParentContainer(Window.class).dispose();
+
+ if (needReloadApplication) {
+
+ Runnable callback = model.getReloadApplicationCallback();
+ if (callback == null) {
+ throw new IllegalStateException(
+ "No reloadApplicationCallback found in model");
+ }
+
+ SwingUtilities.invokeLater(callback);
+ } else if (needReloadUI) {
+
+ Runnable callback = model.getReloadUICallback();
+ if (callback == null) {
+ throw new IllegalStateException(
+ "No reloadUICallback found in model");
+ }
+ SwingUtilities.invokeLater(callback);
+ }
+
+
+ }
+ };
+ String tip = quitButton.getToolTipText();
+ quitButton.setAction(quitAction);
+ quitButton.setToolTipText(tip);
+
+ // build categories tabs
+ for (CategoryModel categoryModel : model) {
+ String category = categoryModel.getCategory();
+ String categoryLabel = _(categoryModel.getCategoryLabel());
+ ConfigCategoryUI p = new ConfigCategoryUI(new
+ JAXXInitialContext().add(ui).add(categoryModel));
+ p.getCategoryLabel().setText(categoryLabel);
+ p.setName(category);
+ ui.getCategories().addTab(_(category), null, p, categoryLabel);
+ }
+
+ model.setCategory(defaultCategory);
+ int categoryIndex = model.getCategoryIndex(defaultCategory);
+ if (log.isDebugEnabled()) {
+ log.debug("index of default category (" + defaultCategory + ") : "
+ + categoryIndex);
+ }
+ ui.getCategories().setSelectedIndex(categoryIndex);
+ return ui;
+ }
+ */
}
Added: trunk/jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/config/model/CallBackEntry.java
===================================================================
--- trunk/jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/config/model/CallBackEntry.java (rev 0)
+++ trunk/jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/config/model/CallBackEntry.java 2010-02-01 00:12:27 UTC (rev 1729)
@@ -0,0 +1,57 @@
+package jaxx.runtime.swing.editor.config.model;
+
+import javax.swing.*;
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * A call back with his attached options.
+ *
+ * @author tchemit < chemit(a)codelutin.com >
+ * @since 2.0
+ */
+public class CallBackEntry {
+
+ protected final String name;
+ protected final String description;
+ protected final Icon icon;
+ protected final Runnable action;
+ protected List<OptionModel> options;
+
+ public CallBackEntry(String name,
+ String description,
+ Icon icon,
+ Runnable action) {
+ this.description = description;
+ this.icon = icon;
+ options = new ArrayList<OptionModel>();
+ this.name = name;
+ this.action = action;
+ }
+
+ public Runnable getAction() {
+ return action;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public String getDescription() {
+ return description;
+ }
+
+ public Icon getIcon() {
+ return icon;
+ }
+
+ public List<OptionModel> getOptions() {
+ // always send a copy
+ return new ArrayList<OptionModel>(options);
+ }
+
+ protected void addOption(OptionModel option) {
+ options.add(option);
+
+ }
+}
\ No newline at end of file
Property changes on: trunk/jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/config/model/CallBackEntry.java
___________________________________________________________________
Added: svn:keywords
+ "Author Date Id Revision HeadURL
Added: trunk/jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/config/model/CallBacksManager.java
===================================================================
--- trunk/jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/config/model/CallBacksManager.java (rev 0)
+++ trunk/jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/config/model/CallBacksManager.java 2010-02-01 00:12:27 UTC (rev 1729)
@@ -0,0 +1,171 @@
+package jaxx.runtime.swing.editor.config.model;
+
+import javax.swing.*;
+import java.util.ArrayList;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * CallBack manager.
+ *
+ * @author tchemit < chemit(a)codelutin.com >
+ * @since 2.0
+ */
+public class CallBacksManager {
+
+ /**
+ * lists of registred callback.
+ */
+ protected List<CallBackEntry> callbacks;
+
+ public CallBacksManager() {
+ callbacks = new ArrayList<CallBackEntry>();
+ }
+
+ /**
+ * Registers a new callback.
+ * <p/>
+ * <b>Note:</b> the order of registred callback is used to determine
+ * the higher priority of callback to launch if required.
+ *
+ * @param name the unique name of a callback
+ * @param description the i18n key to describe the action
+ * @param icon icon of callBack (used in ui)
+ * @param action the action of the callback
+ */
+ public void registerCallBack(String name,
+ String description,
+ Icon icon,
+ Runnable action) {
+ if (name == null) {
+ throw new NullPointerException("parameter 'name' can not be null");
+ }
+ if (action == null) {
+ throw new NullPointerException("parameter 'action' can not be null");
+ }
+ if (description == null) {
+ throw new NullPointerException("parameter 'description' can " +
+ "not be null");
+ }
+ if (icon == null) {
+ throw new NullPointerException("parameter 'icon' can not be null");
+ }
+ if (getCallBack(name) != null) {
+ throw new IllegalArgumentException("there is already a callback " +
+ "with name '" + name + "'");
+ }
+ callbacks.add(new CallBackEntry(name, description, icon, action));
+ }
+
+ /**
+ * Registers a option into a known callback.
+ *
+ * @param name the name of the callback
+ * @param option the option to register for the given callback
+ */
+ public void registerOption(String name, OptionModel option) {
+ if (name == null) {
+ throw new NullPointerException("parameter 'name' can not be null");
+ }
+ if (option == null) {
+ throw new NullPointerException("parameter 'option' can not be null");
+ }
+ CallBackEntry callback = getCallBack(name);
+ if (callback == null) {
+ throw new IllegalArgumentException("could not find a callback " +
+ "with name '" + name + "'");
+ }
+ callback.addOption(option);
+ }
+
+ /**
+ * Scan a model and grab per callBack the options saved.
+ *
+ * @param model the model to scan
+ * @return the dictionnary of options for each callback to launch
+ */
+ public Map<CallBackEntry, List<OptionModel>> getCallBacksForSaved(
+ ConfigUIModel model) {
+
+ Map<CallBackEntry, List<OptionModel>> result;
+ result = new LinkedHashMap<CallBackEntry, List<OptionModel>>();
+
+ for (CategoryModel categoryModel : model) {
+ Map<CallBackEntry, List<OptionModel>> callBacks =
+ getCallBacksForSaved(categoryModel);
+ for (Map.Entry<CallBackEntry, List<OptionModel>> entry :
+ callBacks.entrySet()) {
+ CallBackEntry key = entry.getKey();
+ List<OptionModel> value = entry.getValue();
+ if (result.containsKey(key)) {
+ result.get(key).addAll(value);
+ } else {
+ result.put(key, value);
+ }
+ }
+ callBacks.clear();
+ }
+ return result;
+ }
+
+ /**
+ * Scan a category and grab per callBack the options saved.
+ *
+ * @param category the category to scan
+ * @return the dictionnary of options for each callBack to launch
+ */
+ public Map<CallBackEntry, List<OptionModel>> getCallBacksForSaved(
+ CategoryModel category) {
+
+ Map<CallBackEntry, List<OptionModel>> result;
+ result = new LinkedHashMap<CallBackEntry, List<OptionModel>>();
+
+ for (OptionModel optionModel : category) {
+ if (optionModel.isSaved()) {
+ CallBackEntry callBackEntry = getCallBack(optionModel);
+ if (callBackEntry != null) {
+ List<OptionModel> models = result.get(callBackEntry);
+ if (models == null) {
+ models = new ArrayList<OptionModel>();
+ result.put(callBackEntry, models);
+ }
+ models.add(optionModel);
+ }
+ }
+ }
+ return result;
+ }
+
+ /**
+ * Get the first callBack for a given option.
+ *
+ * @param option the option
+ * @return the first callBack (so the most important) on which the given
+ * option is attacjed. (can be null)
+ */
+ protected CallBackEntry getCallBack(OptionModel option) {
+ for (CallBackEntry callback : callbacks) {
+ if (callback.getOptions().contains(option)) {
+ return callback;
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Obtain a registred callBack from his name.
+ *
+ * @param name the name of the searched callBack
+ * @return the callBack for the given name (or {@code null} if not found).
+ */
+ protected CallBackEntry getCallBack(String name) {
+ for (CallBackEntry callback : callbacks) {
+ if (callback.getName().equals(name)) {
+ return callback;
+ }
+ }
+ return null;
+ }
+
+}
\ No newline at end of file
Property changes on: trunk/jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/config/model/CallBacksManager.java
___________________________________________________________________
Added: svn:keywords
+ "Author Date Id Revision HeadURL
Modified: trunk/jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/config/model/ConfigUIModel.java
===================================================================
--- trunk/jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/config/model/ConfigUIModel.java 2010-01-30 11:46:50 UTC (rev 1728)
+++ trunk/jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/config/model/ConfigUIModel.java 2010-02-01 00:12:27 UTC (rev 1729)
@@ -25,6 +25,7 @@
import org.nuiton.util.ApplicationConfig;
import org.nuiton.util.ApplicationConfig.OptionDef;
+import javax.swing.*;
import java.beans.PropertyChangeListener;
import java.beans.PropertyChangeSupport;
import java.util.*;
@@ -68,14 +69,20 @@
*/
protected boolean standalone;
/**
+ * Callbacks manager
+ */
+ protected CallBacksManager callBacksManager;
+ /**
* call back when reload ui is necessary
*/
+ @Deprecated
protected Runnable reloadUICallback;
/**
* call back when reload application is necessary
*/
+ @Deprecated
protected Runnable reloadApplicationCallback;
-
+
/**
* suport of modification
*/
@@ -84,20 +91,27 @@
public ConfigUIModel(ApplicationConfig config) {
this.config = config;
this.categories = new LinkedHashMap<String, CategoryModel>();
+ this.callBacksManager = new CallBacksManager();
}
/**
* Ajoute une categorie dans le modele.
*
- * @param category l'id de la categorie (la clef de traduction du nom de la categorie)
- * @param categoryLabel la clef de traduction de la description de la categorie
+ * @param category l'id de la categorie (la clef de traduction du nom
+ * de la categorie)
+ * @param categoryLabel la clef de traduction de la description de
+ * la categorie
* @param keys les options de la categorie
- * @deprecated since 2.0.0 prefer use the {@link #addCategory(CategoryModel)}
+ * @deprecated since 2.0.0 prefer use the
+ * {@link #addCategory(CategoryModel)}
*/
@Deprecated
- public void addCategory(String category, String categoryLabel, OptionDef... keys) {
+ public void addCategory(String category,
+ String categoryLabel,
+ OptionDef... keys) {
if (categories.containsKey(category)) {
- throw new IllegalArgumentException(_("config.error.category.already.exists", category));
+ throw new IllegalArgumentException(
+ _("config.error.category.already.exists", category));
}
OptionModel[] entries = new OptionModel[keys.length];
int index = 0;
@@ -117,7 +131,9 @@
*/
public void addCategory(CategoryModel category) {
if (categories.containsKey(category.getCategory())) {
- throw new IllegalArgumentException(_("config.error.category.already.exists", category.getCategory()));
+ throw new IllegalArgumentException(
+ _("config.error.category.already.exists",
+ category.getCategory()));
}
categories.put(category.getCategory(), category);
}
@@ -129,14 +145,52 @@
*/
public void setCategory(String category) {
if (!categories.containsKey(category)) {
- throw new IllegalArgumentException(_("config.error.category.not.found", category));
+ throw new IllegalArgumentException(
+ _("config.error.category.not.found", category));
}
CategoryModel newCategoryModel = categories.get(category);
setCategoryModel(newCategoryModel);
- newCategoryModel.firePropertyChange(CategoryModel.MODIFIED_PROPERTY_NAME, false, getCategoryModel().isModified());
- newCategoryModel.firePropertyChange(CategoryModel.VALID_PROPERTY_NAME, false, getCategoryModel().isValid());
+ newCategoryModel.firePropertyChange(
+ CategoryModel.MODIFIED_PROPERTY_NAME, false,
+ getCategoryModel().isModified());
+ newCategoryModel.firePropertyChange(
+ CategoryModel.VALID_PROPERTY_NAME, false,
+ getCategoryModel().isValid());
}
+ /**
+ * Registers a new callback.
+ * <p/>
+ * <b>Note:</b> the order of registred callback is used to determine
+ * the higher priority of callback to launch if required.
+ *
+ * @param name the unique name of a callback
+ * @param description the i18n key to describe the action
+ * @param icon the icon of the callBack (used in ui)
+ * @param action the action of the callback
+ */
+ public void registerCallBack(String name,
+ String description,
+ Icon icon,
+ Runnable action) {
+ callBacksManager.registerCallBack(name, description, icon, action);
+ }
+
+ /**
+ * Registers a option into a known callback.
+ *
+ * @param name the name of the callback
+ * @param option the option to register for the given callback
+ */
+ public void registerOptionCallBack(String name, OptionModel option) {
+ callBacksManager.registerOption(name, option);
+ }
+
+ public Map<CallBackEntry, List<OptionModel>> getCallBacksForSaved(
+ ) {
+ return callBacksManager.getCallBacksForSaved(this);
+ }
+
@Override
public Iterator<CategoryModel> iterator() {
return categories.values().iterator();
@@ -168,10 +222,12 @@
this.standalone = standalone;
}
+ @Deprecated
public Runnable getReloadApplicationCallback() {
return reloadApplicationCallback;
}
+ @Deprecated
public Runnable getReloadUICallback() {
return reloadUICallback;
}
@@ -180,7 +236,8 @@
// compute transients keys (to never be saved)
List<String> transients = new ArrayList<String>();
- //TODO TC-20091222 : will be in ApplicationConfig, for the moment catch in your config it...
+ //TODO TC-20091222 : will be in ApplicationConfig, for the moment
+ // catch in your config it...
// config.setAdjusting(true);
config.setOption("adjusting", "true");
@@ -192,13 +249,19 @@
if (option.getPropertyName() != null) {
// this is a javaBean option
try {
- PropertyUtils.setProperty(config, option.getPropertyName(), value);
+ PropertyUtils.setProperty(config,
+ option.getPropertyName(), value);
} catch (Exception e) {
- throw new RuntimeException("could not set property [" + option.getPropertyName() + "] with value = " + value, e);
+ throw new RuntimeException(
+ "could not set property [" +
+ option.getPropertyName() +
+ "] with value = " + value, e);
}
} else {
- // mutator could have extra code to be done when modify an option
- config.setOption(option.getKey(), value == null ? null : value.toString());
+ // mutator could have extra code to be done when
+ // modify an option
+ config.setOption(option.getKey(), value == null ?
+ null : value.toString());
}
// l'option a été sauvegardée, on la marque
option.setSaved(true);
@@ -210,7 +273,8 @@
}
}
} finally {
- //TODO TC-20091222 : will be in ApplicationConfig, for the moment catch in your config it...
+ //TODO TC-20091222 : will be in ApplicationConfig,
+ // for the moment catch in your config it...
// config.setAdjusting(false);
config.setOption("adjusting", "false");
}
@@ -219,9 +283,14 @@
// save config
config.saveForUser(transients.toArray(new String[transients.size()]));
// notify data has changed
- categoryModel.firePropertyChange(CategoryModel.MODIFIED_PROPERTY_NAME, categoryModel.isModified(), true);
- categoryModel.firePropertyChange(CategoryModel.VALID_PROPERTY_NAME, false, categoryModel.isValid());
- categoryModel.firePropertyChange(CategoryModel.RELOAD_PROPERTY_NAME, false, true);
+ categoryModel.firePropertyChange(
+ CategoryModel.MODIFIED_PROPERTY_NAME,
+ categoryModel.isModified(), true);
+ categoryModel.firePropertyChange(
+ CategoryModel.VALID_PROPERTY_NAME,
+ false, categoryModel.isValid());
+ categoryModel.firePropertyChange(
+ CategoryModel.RELOAD_PROPERTY_NAME, false, true);
}
public void reset() {
@@ -232,9 +301,14 @@
}
}
// notify data has changed
- categoryModel.firePropertyChange(CategoryModel.MODIFIED_PROPERTY_NAME, categoryModel.isModified(), true);
- categoryModel.firePropertyChange(CategoryModel.VALID_PROPERTY_NAME, false, categoryModel.isValid());
- categoryModel.firePropertyChange(CategoryModel.RELOAD_PROPERTY_NAME, false, true);
+ categoryModel.firePropertyChange(
+ CategoryModel.MODIFIED_PROPERTY_NAME,
+ categoryModel.isModified(), true);
+ categoryModel.firePropertyChange(
+ CategoryModel.VALID_PROPERTY_NAME,
+ false, categoryModel.isValid());
+ categoryModel.firePropertyChange(
+ CategoryModel.RELOAD_PROPERTY_NAME, false, true);
}
public int getCategoryIndex(String category) {
@@ -249,7 +323,9 @@
return -1;
}
- public void firePropertyChange(String propertyName, Object oldValue, Object newValue) {
+ public void firePropertyChange(String propertyName,
+ Object oldValue,
+ Object newValue) {
pcs.firePropertyChange(propertyName, oldValue, newValue);
}
@@ -257,7 +333,8 @@
pcs.addPropertyChangeListener(listener);
}
- public void addPropertyChangeListener(String propertyName, PropertyChangeListener listener) {
+ public void addPropertyChangeListener(String propertyName,
+ PropertyChangeListener listener) {
pcs.addPropertyChangeListener(propertyName, listener);
}
@@ -265,7 +342,8 @@
pcs.removePropertyChangeListener(listener);
}
- public void removePropertyChangeListener(String propertyName, PropertyChangeListener listener) {
+ public void removePropertyChangeListener(String propertyName,
+ PropertyChangeListener listener) {
pcs.removePropertyChangeListener(propertyName, listener);
}
@@ -273,7 +351,8 @@
return pcs.hasListeners(propertyName);
}
- public synchronized PropertyChangeListener[] getPropertyChangeListeners(String propertyName) {
+ public synchronized PropertyChangeListener[] getPropertyChangeListeners(
+ String propertyName) {
return pcs.getPropertyChangeListeners(propertyName);
}
@@ -281,10 +360,13 @@
return pcs.getPropertyChangeListeners();
}
- protected void setReloadApplicationCallback(Runnable reloadApplicationCallback) {
+ @Deprecated
+ protected void setReloadApplicationCallback(
+ Runnable reloadApplicationCallback) {
this.reloadApplicationCallback = reloadApplicationCallback;
}
+ @Deprecated
protected void setReloadUICallback(Runnable reloadUICallback) {
this.reloadUICallback = reloadUICallback;
}
@@ -292,4 +374,8 @@
protected ApplicationConfig getConfig() {
return config;
}
+
+ protected CallBacksManager getCallBacksManager() {
+ return callBacksManager;
+ }
}
Modified: trunk/jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/config/model/ConfigUIModelBuilder.java
===================================================================
--- trunk/jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/config/model/ConfigUIModelBuilder.java 2010-01-30 11:46:50 UTC (rev 1728)
+++ trunk/jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/config/model/ConfigUIModelBuilder.java 2010-02-01 00:12:27 UTC (rev 1729)
@@ -4,6 +4,7 @@
import org.apache.commons.logging.LogFactory;
import org.nuiton.util.ApplicationConfig;
+import javax.swing.*;
import javax.swing.table.TableCellEditor;
/**
@@ -43,7 +44,8 @@
* @throws IllegalStateException if there is already a current model
* @throws NullPointerException if config is {@code null}
*/
- public void createModel(ApplicationConfig config) throws IllegalStateException, NullPointerException {
+ public void createModel(ApplicationConfig config)
+ throws IllegalStateException, NullPointerException {
checkNoCurrent(model, "model");
checkNotNull(config, "createModel", "config");
model = new ConfigUIModel(config);
@@ -58,9 +60,11 @@
* @param callback the call back to set
* @throws IllegalStateException if there is not a current model
* @throws NullPointerException if any of parameter is {@code null}
- * @see jaxx.runtime.swing.editor.config.model.ConfigUIModel#setReloadApplicationCallback(Runnable)
+ * @see ConfigUIModel#setReloadApplicationCallback(Runnable)
*/
- public void setReloadApplicationCallback(Runnable callback) throws IllegalStateException, NullPointerException {
+ @Deprecated
+ public void setReloadApplicationCallback(Runnable callback)
+ throws IllegalStateException, NullPointerException {
checkCurrent(model, "model");
checkNotNull(callback, "setReloadApplicationCallback", "callback");
model.setReloadApplicationCallback(callback);
@@ -72,8 +76,9 @@
* @param callback the call back to set
* @throws IllegalStateException if there is not a current model
* @throws NullPointerException if any of parameter is {@code null}
- * @see jaxx.runtime.swing.editor.config.model.ConfigUIModel#setReloadUICallback(Runnable)
+ * @see ConfigUIModel#setReloadUICallback(Runnable)
*/
+ @Deprecated
public void setReloadUICallback(Runnable callback) {
checkCurrent(model, "model");
checkNotNull(callback, "setReloadUICallback", "callback");
@@ -83,14 +88,19 @@
/**
* Add a new category, and set it as current.
* <p/>
- * <b>Note:</b> As side effets, if a previous category, then store it to the model.
+ * <b>Note:</b> As side effets, if a previous category, then store it to
+ * the model.
*
- * @param categoryName the name of the new category (can not to be {@code null})
- * @param categoryLabel the label of the new category (can not to be {@code null})
- * @throws IllegalStateException if there is not a current model, nor category
+ * @param categoryName the name of the new category
+ * (can not to be {@code null})
+ * @param categoryLabel the label of the new category
+ * (can not to be {@code null})
+ * @throws IllegalStateException if there is not a current model,
+ * nor category
* @throws NullPointerException if any of parameter is {@code null}
*/
- public void addCategory(String categoryName, String categoryLabel) throws IllegalStateException, NullPointerException {
+ public void addCategory(String categoryName, String categoryLabel)
+ throws IllegalStateException, NullPointerException {
checkCurrent(model, "model");
checkNotNull(categoryName, "addCategory", "categoryName");
checkNotNull(categoryLabel, "addCategory", "categoryLabel");
@@ -104,13 +114,16 @@
/**
* Add a new option, and set it as current.
* <p/>
- * <b>Note:</b> As side effets, if a previous option, then store it to the model.
+ * <b>Note:</b> As side effets, if a previous option, then store it to
+ * the model.
*
* @param def the def ot the new option
- * @throws IllegalStateException if there is not a current model, nor category
+ * @throws IllegalStateException if there is not a current model,
+ * nor category
* @throws NullPointerException if any of parameter is {@code null}
*/
- public void addOption(ApplicationConfig.OptionDef def) throws IllegalStateException, NullPointerException {
+ public void addOption(ApplicationConfig.OptionDef def)
+ throws IllegalStateException, NullPointerException {
checkCurrent(model, "model");
checkCurrent(category, "category");
checkNotNull(def, "addOption", "def");
@@ -125,7 +138,8 @@
/**
* Add a new option with a propertyName, and set it as current.
* <p/>
- * <b>Note:</b> As side effets, if a previous option, then store it to the model.
+ * <b>Note:</b> As side effets, if a previous option, then store it to
+ * the model.
* <p/>
* <b>Note:</b> This method is a short-cut for
* {@link #addOption(org.nuiton.util.ApplicationConfig.OptionDef)} then
@@ -133,10 +147,12 @@
*
* @param def the def ot the new option
* @param propertyName the propertyName to set on the option
- * @throws IllegalStateException if there is not a current model, nor category
+ * @throws IllegalStateException if there is not a current model, nor
+ * category
* @throws NullPointerException if any of parameter is {@code null}
*/
- public void addOption(ApplicationConfig.OptionDef def, String propertyName) throws IllegalStateException, NullPointerException {
+ public void addOption(ApplicationConfig.OptionDef def, String propertyName)
+ throws IllegalStateException, NullPointerException {
addOption(def);
checkNotNull(propertyName, "setOptionPropertyName", "propertyName");
option.setPropertyName(propertyName);
@@ -148,9 +164,10 @@
* @param propertyName the propertyName to set in the current option.
* @throws IllegalStateException if there is not a current option set.
* @throws NullPointerException if any of parameter is {@code null}
- * @see jaxx.runtime.swing.editor.config.model.OptionModel#setPropertyName(String)
+ * @see OptionModel#setPropertyName(String)
*/
- public void setOptionPropertyName(String propertyName) throws IllegalStateException, NullPointerException {
+ public void setOptionPropertyName(String propertyName)
+ throws IllegalStateException, NullPointerException {
checkCurrent(option, "option");
checkNotNull(propertyName, "setOptionPropertyName", "propertyName");
option.setPropertyName(propertyName);
@@ -162,22 +179,58 @@
* @param editor the editor to set in the current option.
* @throws IllegalStateException if there is not a current option set.
* @throws NullPointerException if any of parameter is {@code null}
- * @see jaxx.runtime.swing.editor.config.model.OptionModel#setEditor(javax.swing.table.TableCellEditor)
+ * @see OptionModel#setEditor(javax.swing.table.TableCellEditor)
*/
- public void setOptionEditor(TableCellEditor editor) throws IllegalStateException, NullPointerException {
+ public void setOptionEditor(TableCellEditor editor)
+ throws IllegalStateException, NullPointerException {
checkCurrent(option, "option");
checkNotNull(editor, "setOptionEditor", "editor");
option.setEditor(editor);
}
/**
+ * Registers a new callback.
+ * <p/>
+ * <b>Note:</b> the order of registred callback is used to determine
+ * the higher priority of callback to launch if required.
+ *
+ * @param name the unique name of a callback
+ * @param description the i18n key to describe the action
+ * @param icon the icon of the callBack (used in ui)
+ * @param action the action of the callback
+ */
+ public void registerCallBack(String name,
+ String description,
+ Icon icon,
+ Runnable action) {
+ checkCurrent(model, "model");
+ checkNotNull(name, "registerCallBack", "name");
+ checkNotNull(description, "registerCallBack", "description");
+ checkNotNull(action, "registerCallBack", "action");
+ model.registerCallBack(name, description, icon, action);
+ }
+
+ /**
+ * Registers the current option into a known callback.
+ *
+ * @param name the name of the callback
+ */
+ public void setOptionCallBack(String name) {
+ checkCurrent(option, "option");
+ checkNotNull(name, "setOptionCallBack", "name");
+ model.registerOptionCallBack(name, option);
+ }
+
+ /**
* Set the needReloadUI flag on the current option.
*
* @param needReload new value to set
* @throws IllegalStateException if there is not a current option set.
- * @see jaxx.runtime.swing.editor.config.model.OptionModel#setNeedReloadUI(boolean)
+ * @see OptionModel#setNeedReloadUI(boolean)
*/
- public void setOptionNeedReloadUI(boolean needReload) throws IllegalStateException {
+ @Deprecated
+ public void setOptionNeedReloadUI(boolean needReload)
+ throws IllegalStateException {
checkCurrent(option, "option");
option.setNeedReloadUI(needReload);
}
@@ -187,9 +240,10 @@
*
* @param needReload new value to set
* @throws IllegalStateException if there is not a current option set.
- * @see jaxx.runtime.swing.editor.config.model.OptionModel#setNeedReloadUI(boolean)
+ * @see OptionModel#setNeedReloadUI(boolean)
*/
- public void setOptionNeedReloadApplication(boolean needReload) throws IllegalStateException {
+ public void setOptionNeedReloadApplication(boolean needReload)
+ throws IllegalStateException {
checkCurrent(option, "option");
option.setNeedReloadApplication(needReload);
}
@@ -197,7 +251,8 @@
/**
* Flush the model and return it.
* <p/>
- * <b>Note:</b> As a side effect, nothing is available in the builder after this operation.
+ * <b>Note:</b> As a side effect, nothing is available in the builder
+ * after this operation.
* To reuse the builder on a model, use the dedicated setter.
*
* @return the final model
@@ -235,9 +290,11 @@
* <b>Note:</b> As side effets, il will clean current option.
*
* @param categoryModel the category to use
- * @throws IllegalStateException if there is not a current model or a current category
+ * @throws IllegalStateException if there is not a current model or a
+ * current category
*/
- public void setCategory(CategoryModel categoryModel) throws IllegalStateException {
+ public void setCategory(CategoryModel categoryModel)
+ throws IllegalStateException {
checkCurrent(model, "model");
checkNoCurrent(category, "category");
category = categoryModel;
@@ -251,9 +308,11 @@
* Sets the given option as current option.
*
* @param optionModel the option to use
- * @throws IllegalStateException if there is not a current model, nor category, or a current option
+ * @throws IllegalStateException if there is not a current model, nor
+ * category, or a current option
*/
- public void setOption(OptionModel optionModel) throws IllegalStateException {
+ public void setOption(OptionModel optionModel)
+ throws IllegalStateException {
checkCurrent(model, "model");
checkCurrent(category, "category");
checkNoCurrent(option, "option");
@@ -292,13 +351,15 @@
protected void checkNoCurrent(Object o, String type) {
if (o != null) {
- throw new IllegalStateException("there is already a current " + type + "!");
+ throw new IllegalStateException("there is already a current " +
+ type + "!");
}
}
protected void checkNotNull(Object o, String method, String parameter) {
if (o == null) {
- throw new NullPointerException("method " + method + " does not support null parameter " + parameter + "!");
+ throw new NullPointerException("method " + method +
+ " does not support null parameter " + parameter + "!");
}
}
Modified: trunk/jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/config/model/OptionModel.java
===================================================================
--- trunk/jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/config/model/OptionModel.java 2010-01-30 11:46:50 UTC (rev 1728)
+++ trunk/jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/config/model/OptionModel.java 2010-02-01 00:12:27 UTC (rev 1729)
@@ -46,10 +46,12 @@
/**
* un drapeau pour savoir si le changement de l'option nécessite un redémarrage de l'ui.
*/
+ @Deprecated
protected boolean needReloadUI = false;
/**
* un drapeau pour savoir si le changement de l'option nécessite un redémarrage de l'application.
*/
+ @Deprecated
protected boolean needReloadApplication = false;
/**
* la valeur non modifié de l'option
@@ -103,10 +105,12 @@
return def.isFinal();
}
+ @Deprecated
public boolean isNeedReloadUI() {
return needReloadUI;
}
+ @Deprecated
public boolean isNeedReloadApplication() {
return needReloadApplication;
}
@@ -160,10 +164,12 @@
this.editor = editor;
}
+ @Deprecated
protected void setNeedReloadUI(boolean needReloadUI) {
this.needReloadUI = needReloadUI;
}
+ @Deprecated
protected void setNeedReloadApplication(boolean needReloadApplication) {
this.needReloadApplication = needReloadApplication;
}
Modified: trunk/jaxx-widgets/src/main/resources/i18n/jaxx-widgets-en_GB.properties
===================================================================
--- trunk/jaxx-widgets/src/main/resources/i18n/jaxx-widgets-en_GB.properties 2010-01-30 11:46:50 UTC (rev 1728)
+++ trunk/jaxx-widgets/src/main/resources/i18n/jaxx-widgets-en_GB.properties 2010-02-01 00:12:27 UTC (rev 1729)
@@ -20,10 +20,14 @@
config.defaultValue=Default value
config.defaultValue.tip=Default value of the option
config.descrition=Description
+config.detected.callBack=Detected actions
config.error.category.already.exists=category with name '%1$s' does already exist\!
config.error.category.not.found=category with name '%1$s' does not exist\!
+config.final.callBack=Action to perform
config.key=Key
config.key.tip=Key of the option
+config.launch.callBack=Perform
+config.launch.callBack.tip=Perform necessary actions
config.message.quit.invalid.category=The category '%1$s' is not valid\!
config.message.quit.valid.and.modified.category=The category '%1$s' has some modified options \:
config.model.needReloadApplication=
Modified: trunk/jaxx-widgets/src/main/resources/i18n/jaxx-widgets-fr_FR.properties
===================================================================
--- trunk/jaxx-widgets/src/main/resources/i18n/jaxx-widgets-fr_FR.properties 2010-01-30 11:46:50 UTC (rev 1728)
+++ trunk/jaxx-widgets/src/main/resources/i18n/jaxx-widgets-fr_FR.properties 2010-02-01 00:12:27 UTC (rev 1729)
@@ -20,10 +20,14 @@
config.defaultValue=Valeur par d\u00E9faut
config.defaultValue.tip=Valeur par d\u00E9faut de l'option
config.descrition=Description
+config.detected.callBack=Actions d\u00E9tect\u00E9es pour les options modifi\u00E9es
config.error.category.already.exists=La cat\u00E9gorie de nom '%1$s' existe d\u00E9j\u00E0\!
config.error.category.not.found=La cat\u00E9gorie de nom '%1$s' n'existe pas\!
+config.final.callBack=Action \u00E0 executer
config.key=Clef
config.key.tip=Clef de l'option
+config.launch.callBack=Lancer
+config.launch.callBack.tip=Lancer les actions n\u00E9cessaires
config.message.quit.invalid.category=La cat\u00E9gorie '%1$s' n'est pas valide\!
config.message.quit.valid.and.modified.category=La cat\u00E9gorie '%1$s' poss\u00E8dent des options modifi\u00E9es \:
config.model.needReloadApplication=Des options ont \u00E9t\u00E9 modifi\u00E9es qui n\u00E9cessitent le red\u00E9marrage de l'application.\n
1
0
30 Jan '10
Author: tchemit
Date: 2010-01-30 12:46:50 +0100 (Sat, 30 Jan 2010)
New Revision: 1728
Modified:
trunk/jaxx-compiler/src/main/java/jaxx/compiler/JAXXEngine.java
Log:
- add jaxx.runtime and jaxx.runtime.swing namespace in all generated files
Modified: trunk/jaxx-compiler/src/main/java/jaxx/compiler/JAXXEngine.java
===================================================================
--- trunk/jaxx-compiler/src/main/java/jaxx/compiler/JAXXEngine.java 2010-01-30 09:57:56 UTC (rev 1727)
+++ trunk/jaxx-compiler/src/main/java/jaxx/compiler/JAXXEngine.java 2010-01-30 11:46:50 UTC (rev 1728)
@@ -647,13 +647,14 @@
"javax.swing.*",
"javax.swing.border.*",
"javax.swing.event.*",
- "jaxx.runtime.swing.JAXXButtonGroup",
- "jaxx.runtime.swing.HBox",
- "jaxx.runtime.swing.VBox",
- "jaxx.runtime.swing.Table",
- "jaxx.runtime.Util",
- "jaxx.runtime.JAXXUtil",
- "jaxx.runtime.SwingUtil",
+// "jaxx.runtime.swing.JAXXButtonGroup",
+// "jaxx.runtime.swing.HBox",
+// "jaxx.runtime.swing.VBox",
+// "jaxx.runtime.swing.Table",
+ "jaxx.runtime.*",
+ "jaxx.runtime.swing.*",
+// "jaxx.runtime.JAXXUtil",
+// "jaxx.runtime.SwingUtil",
"static org.nuiton.i18n.I18n._",
"static jaxx.runtime.SwingUtil.createImageIcon")
);
1
0
30 Jan '10
Author: tchemit
Date: 2010-01-30 10:57:56 +0100 (Sat, 30 Jan 2010)
New Revision: 1727
Modified:
trunk/jaxx-compiler/src/main/java/jaxx/compiler/JAXXEngine.java
Log:
For the moment let old Util class in generation to make it compatible
Modified: trunk/jaxx-compiler/src/main/java/jaxx/compiler/JAXXEngine.java
===================================================================
--- trunk/jaxx-compiler/src/main/java/jaxx/compiler/JAXXEngine.java 2010-01-29 17:32:57 UTC (rev 1726)
+++ trunk/jaxx-compiler/src/main/java/jaxx/compiler/JAXXEngine.java 2010-01-30 09:57:56 UTC (rev 1727)
@@ -651,6 +651,7 @@
"jaxx.runtime.swing.HBox",
"jaxx.runtime.swing.VBox",
"jaxx.runtime.swing.Table",
+ "jaxx.runtime.Util",
"jaxx.runtime.JAXXUtil",
"jaxx.runtime.SwingUtil",
"static org.nuiton.i18n.I18n._",
1
0
r1726 - in trunk: jaxx-compiler/src/main/java/jaxx/compiler jaxx-runtime/src/main/java/jaxx/runtime
by sletellier@users.nuiton.org 29 Jan '10
by sletellier@users.nuiton.org 29 Jan '10
29 Jan '10
Author: sletellier
Date: 2010-01-29 18:32:57 +0100 (Fri, 29 Jan 2010)
New Revision: 1726
Modified:
trunk/jaxx-compiler/src/main/java/jaxx/compiler/JAXXCompiler.java
trunk/jaxx-runtime/src/main/java/jaxx/runtime/Util.java
Log:
Evol 292 : Refactoring, Util is deprecated and will be replaced by JAXXUtil
Modified: trunk/jaxx-compiler/src/main/java/jaxx/compiler/JAXXCompiler.java
===================================================================
--- trunk/jaxx-compiler/src/main/java/jaxx/compiler/JAXXCompiler.java 2010-01-29 16:58:54 UTC (rev 1725)
+++ trunk/jaxx-compiler/src/main/java/jaxx/compiler/JAXXCompiler.java 2010-01-29 17:32:57 UTC (rev 1726)
@@ -127,7 +127,7 @@
*/
protected final IDHelper idHelper;
/**
- * Binding JAXXUtil
+ * Binding Util
*/
protected final DataBindingHelper bindingHelper;
/**
Modified: trunk/jaxx-runtime/src/main/java/jaxx/runtime/Util.java
===================================================================
--- trunk/jaxx-runtime/src/main/java/jaxx/runtime/Util.java 2010-01-29 16:58:54 UTC (rev 1725)
+++ trunk/jaxx-runtime/src/main/java/jaxx/runtime/Util.java 2010-01-29 17:32:57 UTC (rev 1726)
@@ -20,6 +20,9 @@
* ##%*
*/
-@Deprecated // since 2.0.4-XXX, will be removed
+/**
+ * @deprecated since 2, will be removed in 2.1
+ */
+@Deprecated
public class Util extends JAXXUtil{
}
1
0
Author: sletellier
Date: 2010-01-29 17:58:54 +0100 (Fri, 29 Jan 2010)
New Revision: 1725
Added:
trunk/jaxx-runtime/src/main/java/jaxx/runtime/JAXXUtil.java
Modified:
trunk/jaxx-compiler/src/main/java/jaxx/compiler/CompiledObject.java
trunk/jaxx-compiler/src/main/java/jaxx/compiler/JAXXCompiler.java
trunk/jaxx-compiler/src/main/java/jaxx/compiler/JAXXEngine.java
trunk/jaxx-compiler/src/main/java/jaxx/compiler/binding/DataSource.java
trunk/jaxx-compiler/src/main/java/jaxx/compiler/finalizers/DefaultFinalizer.java
trunk/jaxx-compiler/src/main/java/jaxx/compiler/script/ScriptManager.java
trunk/jaxx-compiler/src/main/java/jaxx/compiler/tags/DefaultObjectHandler.java
trunk/jaxx-compiler/src/site/rst/BeanValidator.rst
trunk/jaxx-demo/src/main/java/jaxx/demo/DemoConfig.java
trunk/jaxx-demo/src/main/java/jaxx/demo/DemoTreeHelper.java
trunk/jaxx-demo/src/main/java/jaxx/demo/DemoUIHandler.java
trunk/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/navigation/FullNavigationTreeHelper.java
trunk/jaxx-runtime/src/main/java/jaxx/runtime/SwingUtil.java
trunk/jaxx-runtime/src/main/java/jaxx/runtime/Util.java
trunk/jaxx-runtime/src/main/java/jaxx/runtime/context/DataContext.java
trunk/jaxx-runtime/src/main/java/jaxx/runtime/context/DefaultJAXXContext.java
trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation/NavigationTreeContextHelper.java
trunk/jaxx-runtime/src/test/java/jaxx/runtime/UtilTest.java
trunk/jaxx-runtime/src/test/java/jaxx/runtime/swing/navigation/NavigationTreeModelTest.java
trunk/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/plugin/Bug1750Test.java
trunk/src/site/rst/BeanValidator.rst
Log:
Evol 292 : Refactoring, Util is deprecated and will be replaced by JAXXUtil
Modified: trunk/jaxx-compiler/src/main/java/jaxx/compiler/CompiledObject.java
===================================================================
--- trunk/jaxx-compiler/src/main/java/jaxx/compiler/CompiledObject.java 2010-01-29 15:49:15 UTC (rev 1724)
+++ trunk/jaxx-compiler/src/main/java/jaxx/compiler/CompiledObject.java 2010-01-29 16:58:54 UTC (rev 1725)
@@ -460,8 +460,8 @@
MethodDescriptor addMethod = handler.getAddMethod();
ClassDescriptor listenerClass = addMethod.getParameterTypes()[0];
//TC-20091026 use 'this' instead of root object javaCode
- //TC-20091105 Util.getEventListener is generic, no more need cast and use simple name
- return getJavaCode() + '.' + addMethod.getName() + "(Util.getEventListener(" + listenerClass.getSimpleName() + ".class, " +
+ //TC-20091105 JAXXUtil.getEventListener is generic, no more need cast and use simple name
+ return getJavaCode() + '.' + addMethod.getName() + "(JAXXUtil.getEventListener(" + listenerClass.getSimpleName() + ".class, " +
TypeManager.getJavaCode(handler.getListenerMethod().getName()) + ", this, " +
TypeManager.getJavaCode(compiler.getEventHandlerMethodName(handler)) + "));" + JAXXCompiler.getLineSeparator();
}
Modified: trunk/jaxx-compiler/src/main/java/jaxx/compiler/JAXXCompiler.java
===================================================================
--- trunk/jaxx-compiler/src/main/java/jaxx/compiler/JAXXCompiler.java 2010-01-29 15:49:15 UTC (rev 1724)
+++ trunk/jaxx-compiler/src/main/java/jaxx/compiler/JAXXCompiler.java 2010-01-29 16:58:54 UTC (rev 1725)
@@ -127,7 +127,7 @@
*/
protected final IDHelper idHelper;
/**
- * Binding Util
+ * Binding JAXXUtil
*/
protected final DataBindingHelper bindingHelper;
/**
Modified: trunk/jaxx-compiler/src/main/java/jaxx/compiler/JAXXEngine.java
===================================================================
--- trunk/jaxx-compiler/src/main/java/jaxx/compiler/JAXXEngine.java 2010-01-29 15:49:15 UTC (rev 1724)
+++ trunk/jaxx-compiler/src/main/java/jaxx/compiler/JAXXEngine.java 2010-01-29 16:58:54 UTC (rev 1725)
@@ -651,7 +651,7 @@
"jaxx.runtime.swing.HBox",
"jaxx.runtime.swing.VBox",
"jaxx.runtime.swing.Table",
- "jaxx.runtime.Util",
+ "jaxx.runtime.JAXXUtil",
"jaxx.runtime.SwingUtil",
"static org.nuiton.i18n.I18n._",
"static jaxx.runtime.SwingUtil.createImageIcon")
Modified: trunk/jaxx-compiler/src/main/java/jaxx/compiler/binding/DataSource.java
===================================================================
--- trunk/jaxx-compiler/src/main/java/jaxx/compiler/binding/DataSource.java 2010-01-29 15:49:15 UTC (rev 1724)
+++ trunk/jaxx-compiler/src/main/java/jaxx/compiler/binding/DataSource.java 2010-01-29 16:58:54 UTC (rev 1725)
@@ -37,7 +37,7 @@
import jaxx.compiler.tags.DefaultObjectHandler;
import jaxx.compiler.tags.TagManager;
import jaxx.compiler.types.TypeManager;
-import jaxx.runtime.Util;
+import jaxx.runtime.JAXXUtil;
import org.apache.commons.lang.StringUtils;
import org.apache.commons.lang.builder.ToStringBuilder;
import org.apache.commons.lang.builder.ToStringStyle;
@@ -620,12 +620,12 @@
}
String code = objectCode + (eventInfo.getModelName() != null ? ".get" + StringUtils.capitalize(eventInfo.getModelName()) + "()" : "");
result.append("$bindingSources.put(\"").append(code).append("\", ").append(code).append(");").append(JAXXCompiler.getLineSeparator());
- //TC-20091105 Util.getEventListener is generic, no more need cast and use simple listener name
- result.append(code).append('.').append(eventInfo.getAddMethod()).append("( Util.getEventListener(").append(eventInfo.getListenerClass().getSimpleName()).append(".class, ").append("this").append(", ").append(TypeManager.getJavaCode(methodName)).append("));");
+ //TC-20091105 JAXXUtil.getEventListener is generic, no more need cast and use simple listener name
+ result.append(code).append('.').append(eventInfo.getAddMethod()).append("( JAXXUtil.getEventListener(").append(eventInfo.getListenerClass().getSimpleName()).append(".class, ").append("this").append(", ").append(TypeManager.getJavaCode(methodName)).append("));");
result.append(JAXXCompiler.getLineSeparator());
if (eventInfo.getModelName() != null) {
result.append(getAddMemberListenerCode(handler, objectCode, "get" + StringUtils.capitalize(eventInfo.getModelName()),
- Util.class.getSimpleName() + ".getDataBindingUpdateListener(" + (compiler.getOutputClassName() + ".this") + ", " + constantId + ")",
+ JAXXUtil.class.getSimpleName() + ".getDataBindingUpdateListener(" + (compiler.getOutputClassName() + ".this") + ", " + constantId + ")",
compiler));
}
return result.toString();
@@ -696,12 +696,12 @@
result.append(modelClassName).append(" $target = ((").append(modelClassName).append(") $bindingSources.remove(\"").append(code).append("\"));").append(eol);
//TC-20091105 test if $target is not null
result.append("if ($target != null) {").append(eol);
- //TC-20091105 Util.getEventListener is generic, no more need cast and use simple listener name
- result.append(" $target.").append(eventInfo.getRemoveMethod()).append("( Util.getEventListener(").append(eventInfo.getListenerClass().getSimpleName()).append(".class, ").append("this").append(", ").append(TypeManager.getJavaCode(methodName)).append("));").append(eol);
+ //TC-20091105 JAXXUtil.getEventListener is generic, no more need cast and use simple listener name
+ result.append(" $target.").append(eventInfo.getRemoveMethod()).append("( JAXXUtil.getEventListener(").append(eventInfo.getListenerClass().getSimpleName()).append(".class, ").append("this").append(", ").append(TypeManager.getJavaCode(methodName)).append("));").append(eol);
result.append("}").append(eol);
if (eventInfo.getModelName() != null) {
result.append(getRemoveMemberListenerCode(handler, objectCode, "get" + StringUtils.capitalize(eventInfo.getModelName()),
- Util.class.getSimpleName() + ".getDataBindingUpdateListener(" + compiler.getOutputClassName() + ".this, " + constantId + ")",
+ JAXXUtil.class.getSimpleName() + ".getDataBindingUpdateListener(" + compiler.getOutputClassName() + ".this, " + constantId + ")",
compiler));
}
return result.toString();
Modified: trunk/jaxx-compiler/src/main/java/jaxx/compiler/finalizers/DefaultFinalizer.java
===================================================================
--- trunk/jaxx-compiler/src/main/java/jaxx/compiler/finalizers/DefaultFinalizer.java 2010-01-29 15:49:15 UTC (rev 1724)
+++ trunk/jaxx-compiler/src/main/java/jaxx/compiler/finalizers/DefaultFinalizer.java 2010-01-29 16:58:54 UTC (rev 1725)
@@ -194,7 +194,7 @@
*
*/
protected static final JavaMethod GET_JAXX_OBJECT_DESCRIPTOR_METHOD = newMethod(PUBLIC | STATIC, "JAXXObjectDescriptor", METHOD_NAME_$GET_JAXXOBJECT_DESCRIPTOR,
- "return Util.decodeCompressedJAXXObjectDescriptor(" + FIELD_NAME_$JAXX_OBJECT_DESCRIPTOR + ");", false);
+ "return JAXXUtil.decodeCompressedJAXXObjectDescriptor(" + FIELD_NAME_$JAXX_OBJECT_DESCRIPTOR + ");", false);
/**
*
*/
@@ -624,7 +624,7 @@
}
}
if (!superclassIsJAXXObject) {
- code.append(Util.class.getSimpleName()).append(".initContext(this, " + PARAMETER_NAME_PARENT_CONTEXT + ");");
+ code.append(JAXXUtil.class.getSimpleName()).append(".initContext(this, " + PARAMETER_NAME_PARENT_CONTEXT + ");");
code.append(eol);
}
code.append(METHOD_NAME_$INITIALIZE + "();");
@@ -708,7 +708,7 @@
if (bindings.length > 0) {
result.append(eol).append("// apply ").append(bindings.length).append(" data bindings").append(eol);
- result.append(Util.class.getSimpleName()).append("." + METHOD_NAME_APPLY_DATA_BINDING + "(this, " + FIELD_NAME_$BINDINGS + ".keySet());").append(eol);
+ result.append(JAXXUtil.class.getSimpleName()).append("." + METHOD_NAME_APPLY_DATA_BINDING + "(this, " + FIELD_NAME_$BINDINGS + ".keySet());").append(eol);
}
bindings = compiler.getBindingHelper().getSimpleBindings();
Modified: trunk/jaxx-compiler/src/main/java/jaxx/compiler/script/ScriptManager.java
===================================================================
--- trunk/jaxx-compiler/src/main/java/jaxx/compiler/script/ScriptManager.java 2010-01-29 15:49:15 UTC (rev 1724)
+++ trunk/jaxx-compiler/src/main/java/jaxx/compiler/script/ScriptManager.java 2010-01-29 16:58:54 UTC (rev 1725)
@@ -133,7 +133,7 @@
for (FieldDescriptor field : fields) {
if (field.getName().equals(lhs)) {
//lhs.substring(lhs.lastIndexOf(".") + 1);
- node.firstToken.image = "jaxx.runtime.Util.assignment(" + node.firstToken.image;
+ node.firstToken.image = "jaxx.runtime.JAXXUtil.assignment(" + node.firstToken.image;
String outputClassName = compiler.getOutputClassName();
node.lastToken.image = node.lastToken.image + ", \"" + lhs + "\", " + outputClassName + ".this)";
}
Modified: trunk/jaxx-compiler/src/main/java/jaxx/compiler/tags/DefaultObjectHandler.java
===================================================================
--- trunk/jaxx-compiler/src/main/java/jaxx/compiler/tags/DefaultObjectHandler.java 2010-01-29 15:49:15 UTC (rev 1724)
+++ trunk/jaxx-compiler/src/main/java/jaxx/compiler/tags/DefaultObjectHandler.java 2010-01-29 16:58:54 UTC (rev 1725)
@@ -337,13 +337,13 @@
// }
// String code = objectCode + (eventInfo.modelName != null ? ".get" + StringUtils.capitalize(eventInfo.modelName) + "()" : "");
// result.append("$bindingSources.put(\"").append(code).append("\", ").append(code).append(");").append(JAXXCompiler.getLineSeparator());
-// //TC-20091105 Util.getEventListener is generic, no more need cast and use simple listener name
-// result.append(code).append('.').append(eventInfo.addMethod).append("( Util.getEventListener(").append(eventInfo.listenerClass.getSimpleName()).append(".class, ").append(compiler.getRootObject().getJavaCode()).append(", ").append(TypeManager.getJavaCode(methodName)).append("));");
+// //TC-20091105 JAXXUtil.getEventListener is generic, no more need cast and use simple listener name
+// result.append(code).append('.').append(eventInfo.addMethod).append("( JAXXUtil.getEventListener(").append(eventInfo.listenerClass.getSimpleName()).append(".class, ").append(compiler.getRootObject().getJavaCode()).append(", ").append(TypeManager.getJavaCode(methodName)).append("));");
// result.append(JAXXCompiler.getLineSeparator());
// if (eventInfo.modelName != null) {
// result.append(getAddMemberListenerCode(objectCode, dataBinding, "get" + StringUtils.capitalize(eventInfo.modelName),
-// Util.class.getSimpleName() + ".getDataBindingUpdateListener(this , " + dataBinding + ")",
-//// Util.class.getSimpleName() + ".getDataBindingUpdateListener(this , \"" + dataBinding + "\")",
+// JAXXUtil.class.getSimpleName() + ".getDataBindingUpdateListener(this , " + dataBinding + ")",
+//// JAXXUtil.class.getSimpleName() + ".getDataBindingUpdateListener(this , \"" + dataBinding + "\")",
// compiler));
// }
// return result.toString();
@@ -407,14 +407,14 @@
// result.append(modelClassName).append(" $target = ((").append(modelClassName).append(") $bindingSources.remove(\"").append(code).append("\"));").append(eol);
// //TC-20091105 test if $target is not null
// result.append("if ($target != null) {").append(eol);
-// //TC-20091105 Util.getEventListener is generic, no more need cast and use simple listener name
-// result.append(" $target.").append(eventInfo.removeMethod).append("( Util.getEventListener(").append(eventInfo.listenerClass.getSimpleName()).append(".class, ").append(compiler.getRootObject().getJavaCode()).append(", ").append(TypeManager.getJavaCode(methodName)).append("));").append(eol);
+// //TC-20091105 JAXXUtil.getEventListener is generic, no more need cast and use simple listener name
+// result.append(" $target.").append(eventInfo.removeMethod).append("( JAXXUtil.getEventListener(").append(eventInfo.listenerClass.getSimpleName()).append(".class, ").append(compiler.getRootObject().getJavaCode()).append(", ").append(TypeManager.getJavaCode(methodName)).append("));").append(eol);
// result.append("}").append(eol);
// if (eventInfo.modelName != null) {
//// String bi = dataBinding.startsWith("this.") ? dataBinding : ("\"" + dataBinding + "\"");
// result.append(getRemoveMemberListenerCode(objectCode, dataBinding, "get" + StringUtils.capitalize(eventInfo.modelName),
-// Util.class.getSimpleName() + ".getDataBindingUpdateListener(this, " + dataBinding + ")",
-//// Util.class.getSimpleName() + ".getDataBindingUpdateListener(this, \"" + dataBinding + "\")",
+// JAXXUtil.class.getSimpleName() + ".getDataBindingUpdateListener(this, " + dataBinding + ")",
+//// JAXXUtil.class.getSimpleName() + ".getDataBindingUpdateListener(this, \"" + dataBinding + "\")",
// compiler));
// }
// return result.toString();
Modified: trunk/jaxx-compiler/src/site/rst/BeanValidator.rst
===================================================================
--- trunk/jaxx-compiler/src/site/rst/BeanValidator.rst 2010-01-29 15:49:15 UTC (rev 1724)
+++ trunk/jaxx-compiler/src/site/rst/BeanValidator.rst 2010-01-29 16:58:54 UTC (rev 1725)
@@ -170,7 +170,7 @@
::
- jaxx.runtime.Util.convert(validator,"nomDeLaPropriété",widget.getText(),TypeDeLaProriete.class);
+ jaxx.runtime.JAXXUtil.convert(validator,"nomDeLaPropriété",widget.getText(),TypeDeLaProriete.class);
On obtiendra si une erreur de conversion intervient, une erreur dont le libellé est de la forme *error.convertor.XXX*
Modified: trunk/jaxx-demo/src/main/java/jaxx/demo/DemoConfig.java
===================================================================
--- trunk/jaxx-demo/src/main/java/jaxx/demo/DemoConfig.java 2010-01-29 15:49:15 UTC (rev 1724)
+++ trunk/jaxx-demo/src/main/java/jaxx/demo/DemoConfig.java 2010-01-29 16:58:54 UTC (rev 1725)
@@ -29,7 +29,7 @@
import java.util.Properties;
import jaxx.demo.component.jaxx.navigation.FullNavigationTreeDemo;
-import jaxx.runtime.Util;
+import jaxx.runtime.JAXXUtil;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -214,7 +214,7 @@
};
public void removeJaxxPropertyChangeListener() {
- PropertyChangeListener[] toRemove = Util.findJaxxPropertyChangeListener(DEFAULT_JAXX_PCS, getPropertyChangeListeners());
+ PropertyChangeListener[] toRemove = JAXXUtil.findJaxxPropertyChangeListener(DEFAULT_JAXX_PCS, getPropertyChangeListeners());
if (toRemove == null || toRemove.length == 0) {
return;
}
Modified: trunk/jaxx-demo/src/main/java/jaxx/demo/DemoTreeHelper.java
===================================================================
--- trunk/jaxx-demo/src/main/java/jaxx/demo/DemoTreeHelper.java 2010-01-29 15:49:15 UTC (rev 1724)
+++ trunk/jaxx-demo/src/main/java/jaxx/demo/DemoTreeHelper.java 2010-01-29 16:58:54 UTC (rev 1725)
@@ -37,7 +37,7 @@
import jaxx.demo.fun.LabelStyleDemo;
import jaxx.runtime.JAXXContext;
import jaxx.runtime.JAXXObject;
-import jaxx.runtime.Util;
+import jaxx.runtime.JAXXUtil;
import jaxx.runtime.context.JAXXContextEntryDef;
import jaxx.runtime.swing.CardLayout2;
import jaxx.runtime.swing.ErrorDialogUI;
@@ -191,7 +191,7 @@
/**
* la definition de l'unqiue object a partage
*/
- static private final JAXXContextEntryDef<DemoConfig> def = Util.newContextEntryDef(DemoConfig.class);
+ static private final JAXXContextEntryDef<DemoConfig> def = JAXXUtil.newContextEntryDef(DemoConfig.class);
/**
* la pile des noeuds parent
*/
Modified: trunk/jaxx-demo/src/main/java/jaxx/demo/DemoUIHandler.java
===================================================================
--- trunk/jaxx-demo/src/main/java/jaxx/demo/DemoUIHandler.java 2010-01-29 15:49:15 UTC (rev 1724)
+++ trunk/jaxx-demo/src/main/java/jaxx/demo/DemoUIHandler.java 2010-01-29 16:58:54 UTC (rev 1725)
@@ -21,7 +21,7 @@
package jaxx.demo;
import jaxx.runtime.JAXXContext;
-import jaxx.runtime.Util;
+import jaxx.runtime.JAXXUtil;
import jaxx.runtime.context.DefaultApplicationContext;
import jaxx.runtime.context.JAXXContextEntryDef;
import jaxx.runtime.context.JAXXInitialContext;
@@ -57,7 +57,7 @@
* to use log facility, just put in your code: log.info(\"...\");
*/
static private Log log = LogFactory.getLog(DemoUIHandler.class);
- static final JAXXContextEntryDef<DemoUI> MAIN_UI_ENTRY_DEF = Util.newContextEntryDef("mainui", DemoUI.class);
+ static final JAXXContextEntryDef<DemoUI> MAIN_UI_ENTRY_DEF = JAXXUtil.newContextEntryDef("mainui", DemoUI.class);
/**
* Methode pour initialiser l'ui principale sans l'afficher.
Modified: trunk/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/navigation/FullNavigationTreeHelper.java
===================================================================
--- trunk/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/navigation/FullNavigationTreeHelper.java 2010-01-29 15:49:15 UTC (rev 1724)
+++ trunk/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/navigation/FullNavigationTreeHelper.java 2010-01-29 16:58:54 UTC (rev 1725)
@@ -22,7 +22,7 @@
import jaxx.runtime.JAXXContext;
import jaxx.runtime.JAXXObject;
-import jaxx.runtime.Util;
+import jaxx.runtime.JAXXUtil;
import jaxx.runtime.context.JAXXContextEntryDef;
import jaxx.runtime.swing.CardLayout2;
import jaxx.runtime.swing.ErrorDialogUI;
@@ -63,11 +63,11 @@
/**
* where the movies are hold in context
*/
- static public final JAXXContextEntryDef<List<Movie>> MOVIES = Util.newListContextEntryDef("movies");
+ static public final JAXXContextEntryDef<List<Movie>> MOVIES = JAXXUtil.newListContextEntryDef("movies");
/**
* where the actors are hold in context
*/
- static public final JAXXContextEntryDef<List<People>> ACTORS = Util.newListContextEntryDef("actors");
+ static public final JAXXContextEntryDef<List<People>> ACTORS = JAXXUtil.newListContextEntryDef("actors");
protected FullNavigationTreeModelBuilder builder;
public FullNavigationTreeHelper() {
Added: trunk/jaxx-runtime/src/main/java/jaxx/runtime/JAXXUtil.java
===================================================================
--- trunk/jaxx-runtime/src/main/java/jaxx/runtime/JAXXUtil.java (rev 0)
+++ trunk/jaxx-runtime/src/main/java/jaxx/runtime/JAXXUtil.java 2010-01-29 16:58:54 UTC (rev 1725)
@@ -0,0 +1,516 @@
+/*
+ * *##%
+ * JAXX Runtime
+ * Copyright (C) 2008 - 2009 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>.
+ * ##%*
+ */
+package jaxx.runtime;
+
+import jaxx.runtime.context.JAXXContextEntryDef;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import java.beans.PropertyChangeListener;
+import java.beans.PropertyChangeListenerProxy;
+import java.io.IOException;
+import java.lang.ref.WeakReference;
+import java.lang.reflect.InvocationHandler;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.lang.reflect.Proxy;
+import java.util.*;
+
+public class JAXXUtil {
+
+ // public static final String DEFAULT_ICON_PATH = "/icons/";
+ // public static final String DEFAULT_ICON_PATH_PROPERTY = "default.icon.path";
+ /**
+ * Logger
+ */
+ static private final Log log = LogFactory.getLog(JAXXUtil.class);
+ public static final String PARENT = "parent";
+ // Maps root objects to lists of event listeners
+ private static Map<Object, WeakReference<List<EventListenerDescriptor>>> eventListeners = new WeakHashMap<Object, WeakReference<List<EventListenerDescriptor>>>();
+ private static Map<JAXXObject, WeakReference<List<DataBindingUpdateListener>>> dataBindingUpdateListeners = new WeakHashMap<JAXXObject, WeakReference<List<DataBindingUpdateListener>>>();
+
+ private static class EventListenerDescriptor {
+
+ Class<?> listenerClass;
+ String listenerMethodName;
+ String methodName;
+ Object eventListener;
+ }
+
+ /**
+ * Decodes the serialized representation of a JAXXObjectDescriptor. The string must be a byte-to-character mapping
+ * of the binary serialization data for a JAXXObjectDescriptor. See the comments in JAXXCompiler.createJAXXObjectDescriptorField
+ * for the rationale behind this (admittedly ugly) approach.
+ *
+ * @param descriptor descriptor to decode
+ * @return the dedoced descriptor
+ */
+ public static JAXXObjectDescriptor decodeJAXXObjectDescriptor(String descriptor) {
+ try {
+ return (JAXXObjectDescriptor) Base64Coder.deserialize(descriptor, false);
+ /*byte[] data = new byte[descriptor.length()];
+ // copy low-order bytes into the array. The high-order bytes should all be zero.
+ System.arraycopy(descriptor.getBytes(), 0, data, 0, data.length);
+ //descriptor.getBytes(0, descriptor.length(), data, 0);
+ ObjectInputStream in = new ObjectInputStream(new ByteArrayInputStream(data));
+ return (JAXXObjectDescriptor) in.readObject();*/
+ } catch (IOException e) {
+ throw new RuntimeException("Internal error: can't-happen error", e);
+ } catch (ClassNotFoundException e) {
+ throw new RuntimeException("Internal error: can't-happen error", e);
+ }
+ }
+
+ public static JAXXObjectDescriptor decodeCompressedJAXXObjectDescriptor(String descriptor) {
+ try {
+ return (JAXXObjectDescriptor) Base64Coder.deserialize(descriptor, true);
+
+ /*byte[] data = new byte[descriptor.length()];
+ // copy low-order bytes into the array. The high-order bytes should all be zero.
+ System.arraycopy(descriptor.getBytes(), 0, data, 0, data.length);
+ //descriptor.getBytes(0, descriptor.length(), data, 0);
+ ObjectInputStream in = new ObjectInputStream(new GZIPInputStream(new ByteArrayInputStream(data)));
+ return (JAXXObjectDescriptor) in.readObject();*/
+ } catch (IOException e) {
+ throw new RuntimeException("Internal error: can't-happen error", e);
+ } catch (ClassNotFoundException e) {
+ throw new RuntimeException("Internal error: can't-happen error", e);
+ }
+ }
+
+ public static <O> JAXXContextEntryDef<O> newContextEntryDef(Class<O> klass) {
+ return newContextEntryDef(null, klass);
+ }
+
+ public static <O> JAXXContextEntryDef<O> newContextEntryDef(String name, Class<O> klass) {
+ return new JAXXContextEntryDef<O>(name, klass);
+ }
+
+ public static <O> JAXXContextEntryDef<List<O>> newListContextEntryDef() {
+ return newListContextEntryDef(null);
+ }
+
+ public static <O> JAXXContextEntryDef<List<O>> newListContextEntryDef(String name) {
+ Class<List<O>> castList = JAXXUtil.castList();
+ JAXXContextEntryDef<List<O>> contextEntryDef = new JAXXContextEntryDef<List<O>>(name, castList);
+ return contextEntryDef;
+ }
+
+// public static DefaultJAXXBinding registerBinding(Map<String, DefaultJAXXBinding> bindings, DefaultJAXXBinding binding) {
+// bindings.put(binding.getId(), binding);
+//// binding.applyDataBinding();
+//// binding.processDataBinding();
+// return binding;
+// }
+
+// /**
+// * Return parent's container corresponding to the Class clazz
+// *
+// * @param <O> type of container to obtain from context
+// * @param top the top container
+// * @param clazz desired
+// * @return parent's container
+// */
+// @SuppressWarnings({"unchecked"})
+// public static <O extends Container> O getParentContainer(Object top, Class<O> clazz) {
+// if (top == null) {
+// throw new IllegalArgumentException("top parameter can not be null");
+// }
+// if (!Container.class.isAssignableFrom(top.getClass())) {
+// throw new IllegalArgumentException("top parameter " + top + " is not a " + Container.class);
+// }
+// Container parent = ((Container) top).getParent();
+// if (parent != null && !clazz.isAssignableFrom(parent.getClass())) {
+// parent = getParentContainer(parent, clazz);
+// }
+// return (O) parent;
+// }
+
+ @SuppressWarnings({"unchecked"})
+ protected static <O> Class<List<O>> castList() {
+ return (Class<List<O>>) Collections.emptyList().getClass();
+ }
+
+ /**
+ * Method to initialize the context of a ui.
+ *
+ * @param ui the ui
+ * @param parentContext the context to set in ui
+ */
+ public static void initContext(JAXXObject ui, JAXXContext parentContext) {
+
+ if (parentContext instanceof jaxx.runtime.context.JAXXInitialContext) {
+ ((jaxx.runtime.context.JAXXInitialContext) parentContext).to(ui);
+ } else {
+ ui.setContextValue(parentContext);
+ }
+ // if parentContext is a JAXXObject then
+ // add an special parent entry to can go up
+ if (parentContext instanceof JAXXObject) {
+ ui.setContextValue(parentContext, PARENT);
+ }
+ }
+
+ public static <E extends EventListener> E getEventListener(Class<E> listenerClass, final String listenerMethodName, final Object methodContainer, final String methodName) {
+ WeakReference<List<EventListenerDescriptor>> ref = eventListeners.get(methodContainer);
+ List<EventListenerDescriptor> descriptors = ref != null ? ref.get() : null;
+ if (descriptors == null) {
+ descriptors = new ArrayList<EventListenerDescriptor>();
+ eventListeners.put(methodContainer, new WeakReference<List<EventListenerDescriptor>>(descriptors));
+ } else {
+ for (EventListenerDescriptor descriptor : descriptors) {
+ if (listenerClass == descriptor.listenerClass &&
+ (listenerMethodName == null ? descriptor.listenerMethodName == null : listenerMethodName.equals(descriptor.listenerMethodName)) &&
+ methodName.equals(descriptor.methodName)) {
+ return (E) descriptor.eventListener;
+ }
+ }
+ }
+
+ // else we need to create a new listener
+ final EventListenerDescriptor descriptor = new EventListenerDescriptor();
+ descriptor.listenerClass = listenerClass;
+ descriptor.listenerMethodName = listenerMethodName;
+ descriptor.methodName = methodName;
+ try {
+ final List<Method> listenerMethods = Arrays.asList(listenerClass.getMethods());
+ Method listenerMethod = null;
+ if (listenerMethodName != null) {
+ for (Method listenerMethod1 : listenerMethods) {
+ if ((listenerMethod1).getName().equals(listenerMethodName)) {
+ listenerMethod = listenerMethod1;
+ break;
+ }
+ }
+ }
+ if (listenerMethodName != null && listenerMethod == null) {
+ throw new IllegalArgumentException("no method named " + listenerMethodName + " found in class " + listenerClass.getName());
+ }
+ Class<?>[] parameterTypes = listenerMethods.get(0).getParameterTypes();
+ Class<?> methodContainerClass = methodContainer.getClass();
+ final Method targetMethod = methodContainerClass.getMethod(methodName, parameterTypes);
+ descriptor.eventListener = Proxy.newProxyInstance(listenerClass.getClassLoader(),
+ new Class<?>[]{listenerClass},
+ new InvocationHandler() {
+
+ @Override
+ public Object invoke(Object proxy, Method method, Object[] args) {
+ String methodName = method.getName();
+ if ((listenerMethodName == null && listenerMethods.contains(method)) || methodName.equals(listenerMethodName)) {
+ try {
+ targetMethod.setAccessible(true);
+ return targetMethod.invoke(methodContainer, args);
+ } catch (IllegalAccessException e) {
+ throw new RuntimeException("could not invoke on container " + methodContainer, e);
+ } catch (InvocationTargetException e) {
+ throw new RuntimeException(e);
+ }
+ }
+ if (methodName.equals("toString")) {
+ return toString();
+ }
+ if (methodName.equals("equals")) {
+ return descriptor.eventListener == args[0];
+ }
+ if (methodName.equals("hashCode")) {
+ return hashCode();
+ }
+ return null;
+ }
+ });
+ descriptors.add(descriptor);
+ return (E) descriptor.eventListener;
+ } catch (NoSuchMethodException e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+ public static <E extends EventListener> E getEventListener(Class<E> listenerClass, final Object methodContainer, final String methodName) {
+ return getEventListener(listenerClass, null, methodContainer, methodName);
+ }
+
+ public static DataBindingUpdateListener getDataBindingUpdateListener(JAXXObject object, String bindingName) {
+ WeakReference<List<DataBindingUpdateListener>> ref = dataBindingUpdateListeners.get(object);
+ List<DataBindingUpdateListener> listeners = ref == null ? null : ref.get();
+ if (listeners == null) {
+ listeners = new ArrayList<DataBindingUpdateListener>();
+ dataBindingUpdateListeners.put(object, new WeakReference<List<DataBindingUpdateListener>>(listeners));
+ } else {
+ for (DataBindingUpdateListener listener : listeners) {
+ if (bindingName.equals(listener.getBindingName())) {
+ return listener;
+ }
+ }
+ }
+ DataBindingUpdateListener listener = new DataBindingUpdateListener(object, bindingName);
+ listeners.add(listener);
+ return listener;
+ }
+
+// public static void setComponentWidth(Component component, int width) {
+// component.setSize(width, component.getHeight());
+// if (component instanceof JComponent) {
+// JComponent jcomponent = (JComponent) component;
+// jcomponent.setPreferredSize(new Dimension(width, jcomponent.getPreferredSize().height));
+// jcomponent.setMinimumSize(new Dimension(width, jcomponent.getPreferredSize().height));
+// if (jcomponent.isDisplayable()) {
+// jcomponent.revalidate();
+// }
+// }
+// }
+
+// public static void setComponentHeight(Component component, int height) {
+// component.setSize(component.getWidth(), height);
+// if (component instanceof JComponent) {
+// JComponent jcomponent = (JComponent) component;
+// jcomponent.setPreferredSize(new Dimension(jcomponent.getPreferredSize().width, height));
+// jcomponent.setMinimumSize(new Dimension(jcomponent.getPreferredSize().width, height));
+// if (jcomponent.isDisplayable()) {
+// jcomponent.revalidate();
+// }
+// }
+// }
+
+ public static boolean assignment(boolean value, String name, JAXXObject src) {
+ src.firePropertyChange(name.trim(), null, "dummy value");
+ return value;
+ }
+
+ public static byte assignment(byte value, String name, JAXXObject src) {
+ src.firePropertyChange(name.trim(), null, "dummy value");
+ return value;
+ }
+
+ public static short assignment(short value, String name, JAXXObject src) {
+ src.firePropertyChange(name.trim(), null, "dummy value");
+ return value;
+ }
+
+ public static int assignment(int value, String name, JAXXObject src) {
+ src.firePropertyChange(name.trim(), null, "dummy value");
+ return value;
+ }
+
+ public static long assignment(long value, String name, JAXXObject src) {
+ src.firePropertyChange(name.trim(), null, "dummy value");
+ return value;
+ }
+
+ public static float assignment(float value, String name, JAXXObject src) {
+ src.firePropertyChange(name.trim(), null, "dummy value");
+ return value;
+ }
+
+ public static double assignment(double value, String name, JAXXObject src) {
+ src.firePropertyChange(name.trim(), null, "dummy value");
+ return value;
+ }
+
+ public static char assignment(char value, String name, JAXXObject src) {
+ src.firePropertyChange(name.trim(), null, "dummy value");
+ return value;
+ }
+
+ public static java.lang.Object assignment(java.lang.Object value, String name, JAXXObject src) {
+ src.firePropertyChange(name.trim(), null, "dummy value");
+ return value;
+ }
+
+ /**
+ * Compute the string representation of an object.
+ * <p/>
+ * Return empty string if given object is null
+ *
+ * @param value the value to write
+ * @return the string representation of the given object or an empty string if object is null.
+ */
+ public static String getStringValue(Object value) {
+ String result;
+ result = value == null ? "" : value.toString();
+ return result;
+ }
+
+ /**
+ * Test if a type of entry exists in a given context and throw an IllegalArgumentException if not found.
+ * <p/>
+ * If entry is found, return his value in context.
+ *
+ * @param <T> the type of required data
+ * @param context the context to test
+ * @param def the definition of the entry to seek in context
+ * @return the value from the context
+ * @throws IllegalArgumentException if the entry is not found in context.
+ */
+ public static <T> T checkJAXXContextEntry(JAXXContext context, JAXXContextEntryDef<T> def) throws IllegalArgumentException {
+
+ T value = def.getContextValue(context);
+
+ if (value == null) {
+ throw new IllegalArgumentException("the context entry [" + def + "] ] was not found in context " + context);
+ }
+
+ return value;
+ }
+
+ /**
+ * Convinient method to apply more than one binding on a JAXX ui.
+ *
+ * @param src the ui to treate
+ * @param bindings the list of binding to process.
+ */
+ public static void applyDataBinding(JAXXObject src, String... bindings) {
+ for (String binding : bindings) {
+ src.applyDataBinding(binding);
+ }
+ }
+ /**
+ * Convinient method to apply more than one binding on a JAXX ui.
+ *
+ * @param src the ui to treate
+ * @param bindings the list of binding to process.
+ */
+ public static void applyDataBinding(JAXXObject src, Collection<String> bindings) {
+ for (String binding : bindings) {
+ src.applyDataBinding(binding);
+ }
+ }
+
+ /**
+ * Convinient method to process more than one binding on a JAXX ui.
+ *
+ * @param src the ui to treate
+ * @param bindings the list of binding to process.
+ */
+ public static void processDataBinding(JAXXObject src, String... bindings) {
+ for (String binding : bindings) {
+ src.processDataBinding(binding);
+ }
+ }
+
+ /**
+ * Convinient method to remove more than one binding on a JAXX ui.
+ *
+ * @param src the ui to treate
+ * @param bindings the list of binding to process.
+ */
+ public static void removeDataBinding(JAXXObject src, String... bindings) {
+ for (String binding : bindings) {
+ src.removeDataBinding(binding);
+ }
+ }
+
+// public static ImageIcon createIcon(String path) {
+// java.net.URL imgURL = JAXXUtil.class.getResource(path);
+// if (imgURL != null) {
+// return new ImageIcon(imgURL);
+// } else {
+// throw new IllegalArgumentException("could not find icon " + path);
+// }
+// }
+
+// /**
+// * @param path the location of icons in root directory icons
+// * @return the icon at {@link #getIconPath()}+path
+// */
+// public static ImageIcon createImageIcon(String path) {
+// String iconPath = getIconPath();
+// return createIcon(iconPath + path);
+// }
+//
+// /**
+// * @param key the key of the icon to retreave from {@link UIManager}
+// * @return the icon, or <code>null if no icon found in {@link UIManager}
+// */
+// public static Icon getUIManagerIcon(String key) {
+// return UIManager.getIcon(key);
+// }
+//
+// /**
+// * retreave for the {@link UIManager} the icon prefixed by <code>action.</code>
+// *
+// * @param key the key of the action icon to retreave from {@link UIManager}
+// * @return the icon, or <code>null if no icon found in {@link UIManager}
+// */
+// public static Icon getUIManagerActionIcon(String key) {
+// return getUIManagerIcon("action." + key);
+// }
+//
+// public static ImageIcon createActionIcon(String name) {
+// String iconPath = getIconPath();
+// return createIcon(iconPath + "action-" + name + ".png");
+// }
+//
+// public static ImageIcon createI18nIcon(String name) {
+// String iconPath = getIconPath();
+// return createIcon(iconPath + "i18n/" + name + ".png");
+// }
+
+ /**
+ * detects all PropertychangedListener added by Jaxx uis
+ * (should be a {@link DataBindingListener}
+ *
+ * @param propertyNames the array of property names to find
+ * @param listeners the array of listeners to filter
+ * @return the filtered listeners
+ */
+ public static PropertyChangeListener[] findJaxxPropertyChangeListener(String[] propertyNames, PropertyChangeListener... listeners) {
+ if (listeners == null || listeners.length == 0) {
+ return new PropertyChangeListener[0];
+ }
+ List<String> pNames = Arrays.asList(propertyNames);
+
+ List<PropertyChangeListener> toRemove = new ArrayList<PropertyChangeListener>();
+
+ for (PropertyChangeListener listener : listeners) {
+ String pName = null;
+ PropertyChangeListenerProxy plistener = null;
+ if (listener instanceof PropertyChangeListenerProxy) {
+ plistener = (PropertyChangeListenerProxy) listener;
+ if (!pNames.contains(plistener.getPropertyName())) {
+ // not on the good property
+ continue;
+ }
+ listener = (PropertyChangeListener) plistener.getListener();
+ pName = plistener.getPropertyName();
+ }
+ if (plistener != null && pName != null && listener instanceof DataBindingListener) {
+ if (log.isDebugEnabled()) {
+ log.debug("find config listener to remove [" + pName + "] : " + listener);
+ }
+ toRemove.add(plistener);
+ //toRemove.add(listener);
+ }
+ }
+ return toRemove.toArray(new PropertyChangeListener[toRemove.size()]);
+ }
+
+// private static String getIconPath() {
+// String iconPath = UIManager.getString(DEFAULT_ICON_PATH_PROPERTY);
+// if (iconPath == null) {
+// iconPath = DEFAULT_ICON_PATH;
+// } else {
+// if (!iconPath.endsWith("/")) {
+// iconPath += "/";
+// }
+// }
+// return iconPath;
+// }
+}
Modified: trunk/jaxx-runtime/src/main/java/jaxx/runtime/SwingUtil.java
===================================================================
--- trunk/jaxx-runtime/src/main/java/jaxx/runtime/SwingUtil.java 2010-01-29 15:49:15 UTC (rev 1724)
+++ trunk/jaxx-runtime/src/main/java/jaxx/runtime/SwingUtil.java 2010-01-29 16:58:54 UTC (rev 1725)
@@ -79,7 +79,7 @@
* @author tony
* @since 1.2
*/
-public class SwingUtil extends Util {
+public class SwingUtil extends JAXXUtil {
/**
* to use log facility, just put in your code: log.info(\"...\");
@@ -861,7 +861,7 @@
}
public static ImageIcon createIcon(String path) {
- java.net.URL imgURL = Util.class.getResource(path);
+ java.net.URL imgURL = JAXXUtil.class.getResource(path);
if (imgURL != null) {
return new ImageIcon(imgURL);
} else {
Modified: trunk/jaxx-runtime/src/main/java/jaxx/runtime/Util.java
===================================================================
--- trunk/jaxx-runtime/src/main/java/jaxx/runtime/Util.java 2010-01-29 15:49:15 UTC (rev 1724)
+++ trunk/jaxx-runtime/src/main/java/jaxx/runtime/Util.java 2010-01-29 16:58:54 UTC (rev 1725)
@@ -1,5 +1,6 @@
+package jaxx.runtime;
/*
- * *##%
+ * *##%
* JAXX Runtime
* Copyright (C) 2008 - 2009 CodeLutin
*
@@ -18,499 +19,7 @@
* <http://www.gnu.org/licenses/lgpl-3.0.html>.
* ##%*
*/
-package jaxx.runtime;
-import jaxx.runtime.context.JAXXContextEntryDef;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-import java.beans.PropertyChangeListener;
-import java.beans.PropertyChangeListenerProxy;
-import java.io.IOException;
-import java.lang.ref.WeakReference;
-import java.lang.reflect.InvocationHandler;
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
-import java.lang.reflect.Proxy;
-import java.util.*;
-
-public class Util {
-
- // public static final String DEFAULT_ICON_PATH = "/icons/";
- // public static final String DEFAULT_ICON_PATH_PROPERTY = "default.icon.path";
- /**
- * Logger
- */
- static private final Log log = LogFactory.getLog(Util.class);
- public static final String PARENT = "parent";
- // Maps root objects to lists of event listeners
- private static Map<Object, WeakReference<List<EventListenerDescriptor>>> eventListeners = new WeakHashMap<Object, WeakReference<List<EventListenerDescriptor>>>();
- private static Map<JAXXObject, WeakReference<List<DataBindingUpdateListener>>> dataBindingUpdateListeners = new WeakHashMap<JAXXObject, WeakReference<List<DataBindingUpdateListener>>>();
-
- private static class EventListenerDescriptor {
-
- Class<?> listenerClass;
- String listenerMethodName;
- String methodName;
- Object eventListener;
- }
-
- /**
- * Decodes the serialized representation of a JAXXObjectDescriptor. The string must be a byte-to-character mapping
- * of the binary serialization data for a JAXXObjectDescriptor. See the comments in JAXXCompiler.createJAXXObjectDescriptorField
- * for the rationale behind this (admittedly ugly) approach.
- *
- * @param descriptor descriptor to decode
- * @return the dedoced descriptor
- */
- public static JAXXObjectDescriptor decodeJAXXObjectDescriptor(String descriptor) {
- try {
- return (JAXXObjectDescriptor) Base64Coder.deserialize(descriptor, false);
- /*byte[] data = new byte[descriptor.length()];
- // copy low-order bytes into the array. The high-order bytes should all be zero.
- System.arraycopy(descriptor.getBytes(), 0, data, 0, data.length);
- //descriptor.getBytes(0, descriptor.length(), data, 0);
- ObjectInputStream in = new ObjectInputStream(new ByteArrayInputStream(data));
- return (JAXXObjectDescriptor) in.readObject();*/
- } catch (IOException e) {
- throw new RuntimeException("Internal error: can't-happen error", e);
- } catch (ClassNotFoundException e) {
- throw new RuntimeException("Internal error: can't-happen error", e);
- }
- }
-
- public static JAXXObjectDescriptor decodeCompressedJAXXObjectDescriptor(String descriptor) {
- try {
- return (JAXXObjectDescriptor) Base64Coder.deserialize(descriptor, true);
-
- /*byte[] data = new byte[descriptor.length()];
- // copy low-order bytes into the array. The high-order bytes should all be zero.
- System.arraycopy(descriptor.getBytes(), 0, data, 0, data.length);
- //descriptor.getBytes(0, descriptor.length(), data, 0);
- ObjectInputStream in = new ObjectInputStream(new GZIPInputStream(new ByteArrayInputStream(data)));
- return (JAXXObjectDescriptor) in.readObject();*/
- } catch (IOException e) {
- throw new RuntimeException("Internal error: can't-happen error", e);
- } catch (ClassNotFoundException e) {
- throw new RuntimeException("Internal error: can't-happen error", e);
- }
- }
-
- public static <O> JAXXContextEntryDef<O> newContextEntryDef(Class<O> klass) {
- return newContextEntryDef(null, klass);
- }
-
- public static <O> JAXXContextEntryDef<O> newContextEntryDef(String name, Class<O> klass) {
- return new JAXXContextEntryDef<O>(name, klass);
- }
-
- public static <O> JAXXContextEntryDef<List<O>> newListContextEntryDef() {
- return newListContextEntryDef(null);
- }
-
- public static <O> JAXXContextEntryDef<List<O>> newListContextEntryDef(String name) {
- Class<List<O>> castList = Util.castList();
- JAXXContextEntryDef<List<O>> contextEntryDef = new JAXXContextEntryDef<List<O>>(name, castList);
- return contextEntryDef;
- }
-
-// public static DefaultJAXXBinding registerBinding(Map<String, DefaultJAXXBinding> bindings, DefaultJAXXBinding binding) {
-// bindings.put(binding.getId(), binding);
-//// binding.applyDataBinding();
-//// binding.processDataBinding();
-// return binding;
-// }
-
-// /**
-// * Return parent's container corresponding to the Class clazz
-// *
-// * @param <O> type of container to obtain from context
-// * @param top the top container
-// * @param clazz desired
-// * @return parent's container
-// */
-// @SuppressWarnings({"unchecked"})
-// public static <O extends Container> O getParentContainer(Object top, Class<O> clazz) {
-// if (top == null) {
-// throw new IllegalArgumentException("top parameter can not be null");
-// }
-// if (!Container.class.isAssignableFrom(top.getClass())) {
-// throw new IllegalArgumentException("top parameter " + top + " is not a " + Container.class);
-// }
-// Container parent = ((Container) top).getParent();
-// if (parent != null && !clazz.isAssignableFrom(parent.getClass())) {
-// parent = getParentContainer(parent, clazz);
-// }
-// return (O) parent;
-// }
-
- @SuppressWarnings({"unchecked"})
- protected static <O> Class<List<O>> castList() {
- return (Class<List<O>>) Collections.emptyList().getClass();
- }
-
- /**
- * Method to initialize the context of a ui.
- *
- * @param ui the ui
- * @param parentContext the context to set in ui
- */
- public static void initContext(JAXXObject ui, JAXXContext parentContext) {
-
- if (parentContext instanceof jaxx.runtime.context.JAXXInitialContext) {
- ((jaxx.runtime.context.JAXXInitialContext) parentContext).to(ui);
- } else {
- ui.setContextValue(parentContext);
- }
- // if parentContext is a JAXXObject then
- // add an special parent entry to can go up
- if (parentContext instanceof JAXXObject) {
- ui.setContextValue(parentContext, PARENT);
- }
- }
-
- public static <E extends EventListener> E getEventListener(Class<E> listenerClass, final String listenerMethodName, final Object methodContainer, final String methodName) {
- WeakReference<List<EventListenerDescriptor>> ref = eventListeners.get(methodContainer);
- List<EventListenerDescriptor> descriptors = ref != null ? ref.get() : null;
- if (descriptors == null) {
- descriptors = new ArrayList<EventListenerDescriptor>();
- eventListeners.put(methodContainer, new WeakReference<List<EventListenerDescriptor>>(descriptors));
- } else {
- for (EventListenerDescriptor descriptor : descriptors) {
- if (listenerClass == descriptor.listenerClass &&
- (listenerMethodName == null ? descriptor.listenerMethodName == null : listenerMethodName.equals(descriptor.listenerMethodName)) &&
- methodName.equals(descriptor.methodName)) {
- return (E) descriptor.eventListener;
- }
- }
- }
-
- // else we need to create a new listener
- final EventListenerDescriptor descriptor = new EventListenerDescriptor();
- descriptor.listenerClass = listenerClass;
- descriptor.listenerMethodName = listenerMethodName;
- descriptor.methodName = methodName;
- try {
- final List<Method> listenerMethods = Arrays.asList(listenerClass.getMethods());
- Method listenerMethod = null;
- if (listenerMethodName != null) {
- for (Method listenerMethod1 : listenerMethods) {
- if ((listenerMethod1).getName().equals(listenerMethodName)) {
- listenerMethod = listenerMethod1;
- break;
- }
- }
- }
- if (listenerMethodName != null && listenerMethod == null) {
- throw new IllegalArgumentException("no method named " + listenerMethodName + " found in class " + listenerClass.getName());
- }
- Class<?>[] parameterTypes = listenerMethods.get(0).getParameterTypes();
- Class<?> methodContainerClass = methodContainer.getClass();
- final Method targetMethod = methodContainerClass.getMethod(methodName, parameterTypes);
- descriptor.eventListener = Proxy.newProxyInstance(listenerClass.getClassLoader(),
- new Class<?>[]{listenerClass},
- new InvocationHandler() {
-
- @Override
- public Object invoke(Object proxy, Method method, Object[] args) {
- String methodName = method.getName();
- if ((listenerMethodName == null && listenerMethods.contains(method)) || methodName.equals(listenerMethodName)) {
- try {
- targetMethod.setAccessible(true);
- return targetMethod.invoke(methodContainer, args);
- } catch (IllegalAccessException e) {
- throw new RuntimeException("could not invoke on container " + methodContainer, e);
- } catch (InvocationTargetException e) {
- throw new RuntimeException(e);
- }
- }
- if (methodName.equals("toString")) {
- return toString();
- }
- if (methodName.equals("equals")) {
- return descriptor.eventListener == args[0];
- }
- if (methodName.equals("hashCode")) {
- return hashCode();
- }
- return null;
- }
- });
- descriptors.add(descriptor);
- return (E) descriptor.eventListener;
- } catch (NoSuchMethodException e) {
- throw new RuntimeException(e);
- }
- }
-
- public static <E extends EventListener> E getEventListener(Class<E> listenerClass, final Object methodContainer, final String methodName) {
- return getEventListener(listenerClass, null, methodContainer, methodName);
- }
-
- public static DataBindingUpdateListener getDataBindingUpdateListener(JAXXObject object, String bindingName) {
- WeakReference<List<DataBindingUpdateListener>> ref = dataBindingUpdateListeners.get(object);
- List<DataBindingUpdateListener> listeners = ref == null ? null : ref.get();
- if (listeners == null) {
- listeners = new ArrayList<DataBindingUpdateListener>();
- dataBindingUpdateListeners.put(object, new WeakReference<List<DataBindingUpdateListener>>(listeners));
- } else {
- for (DataBindingUpdateListener listener : listeners) {
- if (bindingName.equals(listener.getBindingName())) {
- return listener;
- }
- }
- }
- DataBindingUpdateListener listener = new DataBindingUpdateListener(object, bindingName);
- listeners.add(listener);
- return listener;
- }
-
-// public static void setComponentWidth(Component component, int width) {
-// component.setSize(width, component.getHeight());
-// if (component instanceof JComponent) {
-// JComponent jcomponent = (JComponent) component;
-// jcomponent.setPreferredSize(new Dimension(width, jcomponent.getPreferredSize().height));
-// jcomponent.setMinimumSize(new Dimension(width, jcomponent.getPreferredSize().height));
-// if (jcomponent.isDisplayable()) {
-// jcomponent.revalidate();
-// }
-// }
-// }
-
-// public static void setComponentHeight(Component component, int height) {
-// component.setSize(component.getWidth(), height);
-// if (component instanceof JComponent) {
-// JComponent jcomponent = (JComponent) component;
-// jcomponent.setPreferredSize(new Dimension(jcomponent.getPreferredSize().width, height));
-// jcomponent.setMinimumSize(new Dimension(jcomponent.getPreferredSize().width, height));
-// if (jcomponent.isDisplayable()) {
-// jcomponent.revalidate();
-// }
-// }
-// }
-
- public static boolean assignment(boolean value, String name, JAXXObject src) {
- src.firePropertyChange(name.trim(), null, "dummy value");
- return value;
- }
-
- public static byte assignment(byte value, String name, JAXXObject src) {
- src.firePropertyChange(name.trim(), null, "dummy value");
- return value;
- }
-
- public static short assignment(short value, String name, JAXXObject src) {
- src.firePropertyChange(name.trim(), null, "dummy value");
- return value;
- }
-
- public static int assignment(int value, String name, JAXXObject src) {
- src.firePropertyChange(name.trim(), null, "dummy value");
- return value;
- }
-
- public static long assignment(long value, String name, JAXXObject src) {
- src.firePropertyChange(name.trim(), null, "dummy value");
- return value;
- }
-
- public static float assignment(float value, String name, JAXXObject src) {
- src.firePropertyChange(name.trim(), null, "dummy value");
- return value;
- }
-
- public static double assignment(double value, String name, JAXXObject src) {
- src.firePropertyChange(name.trim(), null, "dummy value");
- return value;
- }
-
- public static char assignment(char value, String name, JAXXObject src) {
- src.firePropertyChange(name.trim(), null, "dummy value");
- return value;
- }
-
- public static java.lang.Object assignment(java.lang.Object value, String name, JAXXObject src) {
- src.firePropertyChange(name.trim(), null, "dummy value");
- return value;
- }
-
- /**
- * Compute the string representation of an object.
- * <p/>
- * Return empty string if given object is null
- *
- * @param value the value to write
- * @return the string representation of the given object or an empty string if object is null.
- */
- public static String getStringValue(Object value) {
- String result;
- result = value == null ? "" : value.toString();
- return result;
- }
-
- /**
- * Test if a type of entry exists in a given context and throw an IllegalArgumentException if not found.
- * <p/>
- * If entry is found, return his value in context.
- *
- * @param <T> the type of required data
- * @param context the context to test
- * @param def the definition of the entry to seek in context
- * @return the value from the context
- * @throws IllegalArgumentException if the entry is not found in context.
- */
- public static <T> T checkJAXXContextEntry(JAXXContext context, JAXXContextEntryDef<T> def) throws IllegalArgumentException {
-
- T value = def.getContextValue(context);
-
- if (value == null) {
- throw new IllegalArgumentException("the context entry [" + def + "] ] was not found in context " + context);
- }
-
- return value;
- }
-
- /**
- * Convinient method to apply more than one binding on a JAXX ui.
- *
- * @param src the ui to treate
- * @param bindings the list of binding to process.
- */
- public static void applyDataBinding(JAXXObject src, String... bindings) {
- for (String binding : bindings) {
- src.applyDataBinding(binding);
- }
- }
- /**
- * Convinient method to apply more than one binding on a JAXX ui.
- *
- * @param src the ui to treate
- * @param bindings the list of binding to process.
- */
- public static void applyDataBinding(JAXXObject src, Collection<String> bindings) {
- for (String binding : bindings) {
- src.applyDataBinding(binding);
- }
- }
-
- /**
- * Convinient method to process more than one binding on a JAXX ui.
- *
- * @param src the ui to treate
- * @param bindings the list of binding to process.
- */
- public static void processDataBinding(JAXXObject src, String... bindings) {
- for (String binding : bindings) {
- src.processDataBinding(binding);
- }
- }
-
- /**
- * Convinient method to remove more than one binding on a JAXX ui.
- *
- * @param src the ui to treate
- * @param bindings the list of binding to process.
- */
- public static void removeDataBinding(JAXXObject src, String... bindings) {
- for (String binding : bindings) {
- src.removeDataBinding(binding);
- }
- }
-
-// public static ImageIcon createIcon(String path) {
-// java.net.URL imgURL = Util.class.getResource(path);
-// if (imgURL != null) {
-// return new ImageIcon(imgURL);
-// } else {
-// throw new IllegalArgumentException("could not find icon " + path);
-// }
-// }
-
-// /**
-// * @param path the location of icons in root directory icons
-// * @return the icon at {@link #getIconPath()}+path
-// */
-// public static ImageIcon createImageIcon(String path) {
-// String iconPath = getIconPath();
-// return createIcon(iconPath + path);
-// }
-//
-// /**
-// * @param key the key of the icon to retreave from {@link UIManager}
-// * @return the icon, or <code>null if no icon found in {@link UIManager}
-// */
-// public static Icon getUIManagerIcon(String key) {
-// return UIManager.getIcon(key);
-// }
-//
-// /**
-// * retreave for the {@link UIManager} the icon prefixed by <code>action.</code>
-// *
-// * @param key the key of the action icon to retreave from {@link UIManager}
-// * @return the icon, or <code>null if no icon found in {@link UIManager}
-// */
-// public static Icon getUIManagerActionIcon(String key) {
-// return getUIManagerIcon("action." + key);
-// }
-//
-// public static ImageIcon createActionIcon(String name) {
-// String iconPath = getIconPath();
-// return createIcon(iconPath + "action-" + name + ".png");
-// }
-//
-// public static ImageIcon createI18nIcon(String name) {
-// String iconPath = getIconPath();
-// return createIcon(iconPath + "i18n/" + name + ".png");
-// }
-
- /**
- * detects all PropertychangedListener added by Jaxx uis
- * (should be a {@link DataBindingListener}
- *
- * @param propertyNames the array of property names to find
- * @param listeners the array of listeners to filter
- * @return the filtered listeners
- */
- public static PropertyChangeListener[] findJaxxPropertyChangeListener(String[] propertyNames, PropertyChangeListener... listeners) {
- if (listeners == null || listeners.length == 0) {
- return new PropertyChangeListener[0];
- }
- List<String> pNames = Arrays.asList(propertyNames);
-
- List<PropertyChangeListener> toRemove = new ArrayList<PropertyChangeListener>();
-
- for (PropertyChangeListener listener : listeners) {
- String pName = null;
- PropertyChangeListenerProxy plistener = null;
- if (listener instanceof PropertyChangeListenerProxy) {
- plistener = (PropertyChangeListenerProxy) listener;
- if (!pNames.contains(plistener.getPropertyName())) {
- // not on the good property
- continue;
- }
- listener = (PropertyChangeListener) plistener.getListener();
- pName = plistener.getPropertyName();
- }
- if (plistener != null && pName != null && listener instanceof DataBindingListener) {
- if (log.isDebugEnabled()) {
- log.debug("find config listener to remove [" + pName + "] : " + listener);
- }
- toRemove.add(plistener);
- //toRemove.add(listener);
- }
- }
- return toRemove.toArray(new PropertyChangeListener[toRemove.size()]);
- }
-
-// private static String getIconPath() {
-// String iconPath = UIManager.getString(DEFAULT_ICON_PATH_PROPERTY);
-// if (iconPath == null) {
-// iconPath = DEFAULT_ICON_PATH;
-// } else {
-// if (!iconPath.endsWith("/")) {
-// iconPath += "/";
-// }
-// }
-// return iconPath;
-// }
+@Deprecated // since 2.0.4-XXX, will be removed
+public class Util extends JAXXUtil{
}
Modified: trunk/jaxx-runtime/src/main/java/jaxx/runtime/context/DataContext.java
===================================================================
--- trunk/jaxx-runtime/src/main/java/jaxx/runtime/context/DataContext.java 2010-01-29 15:49:15 UTC (rev 1724)
+++ trunk/jaxx-runtime/src/main/java/jaxx/runtime/context/DataContext.java 2010-01-29 16:58:54 UTC (rev 1725)
@@ -21,7 +21,7 @@
package jaxx.runtime.context;
import jaxx.runtime.JAXXContext;
-import jaxx.runtime.Util;
+import jaxx.runtime.JAXXUtil;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -248,7 +248,7 @@
}
public void removeJaxxPropertyChangeListener() {
- PropertyChangeListener[] toRemove = Util.findJaxxPropertyChangeListener(DEFAULT_JAXX_PCS, getPropertyChangeListeners());
+ PropertyChangeListener[] toRemove = JAXXUtil.findJaxxPropertyChangeListener(DEFAULT_JAXX_PCS, getPropertyChangeListeners());
if (toRemove == null || toRemove.length == 0) {
return;
}
Modified: trunk/jaxx-runtime/src/main/java/jaxx/runtime/context/DefaultJAXXContext.java
===================================================================
--- trunk/jaxx-runtime/src/main/java/jaxx/runtime/context/DefaultJAXXContext.java 2010-01-29 15:49:15 UTC (rev 1724)
+++ trunk/jaxx-runtime/src/main/java/jaxx/runtime/context/DefaultJAXXContext.java 2010-01-29 16:58:54 UTC (rev 1725)
@@ -22,7 +22,7 @@
import jaxx.runtime.JAXXContext;
import jaxx.runtime.JAXXObject;
-import jaxx.runtime.Util;
+import jaxx.runtime.JAXXUtil;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -47,7 +47,7 @@
/**
* entry of the parent context
*/
- protected static final JAXXContextEntryDef<JAXXContext> PARENT_CONTEXT_ENTRY = Util.newContextEntryDef(JAXXContext.class);
+ protected static final JAXXContextEntryDef<JAXXContext> PARENT_CONTEXT_ENTRY = JAXXUtil.newContextEntryDef(JAXXContext.class);
/**
* Logger
*/
@@ -194,7 +194,7 @@
// }
protected JAXXContextEntryDef<?> getKey(String name, Class<?> klass) {
- return Util.newContextEntryDef(name, klass);
+ return JAXXUtil.newContextEntryDef(name, klass);
}
@SuppressWarnings({"unchecked"})
Modified: trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation/NavigationTreeContextHelper.java
===================================================================
--- trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation/NavigationTreeContextHelper.java 2010-01-29 15:49:15 UTC (rev 1724)
+++ trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation/NavigationTreeContextHelper.java 2010-01-29 16:58:54 UTC (rev 1725)
@@ -23,7 +23,7 @@
import javax.swing.JTree;
import jaxx.runtime.JAXXContext;
-import jaxx.runtime.Util;
+import jaxx.runtime.JAXXUtil;
import jaxx.runtime.context.JAXXContextEntryDef;
/**
@@ -71,13 +71,13 @@
public NavigationTreeContextHelper(String prefix) {
this.prefix = prefix;
- treeContextEntry = Util.newContextEntryDef(prefix + "-tree", JTree.class);
- treeModelContextEntry = Util.newContextEntryDef(prefix + "-tree-model", NavigationTreeModel.class);
- treeHandlerContextEntry = Util.newContextEntryDef(prefix + "-tree-handler", NavigationTreeHandler.class);
- selectedBeanContextEntry = Util.newContextEntryDef(prefix + "-selected-bean", Object.class);
- selectedNodeContextEntry = Util.newContextEntryDef(prefix + "-selected-node", NavigationTreeNode.class);
- selectedPathContextEntry = Util.newContextEntryDef(prefix + "-selected-path", String.class);
-// selectedUIContextEntry = Util.newContextEntryDef(prefix + "-selected-ui", Component.class);
+ treeContextEntry = JAXXUtil.newContextEntryDef(prefix + "-tree", JTree.class);
+ treeModelContextEntry = JAXXUtil.newContextEntryDef(prefix + "-tree-model", NavigationTreeModel.class);
+ treeHandlerContextEntry = JAXXUtil.newContextEntryDef(prefix + "-tree-handler", NavigationTreeHandler.class);
+ selectedBeanContextEntry = JAXXUtil.newContextEntryDef(prefix + "-selected-bean", Object.class);
+ selectedNodeContextEntry = JAXXUtil.newContextEntryDef(prefix + "-selected-node", NavigationTreeNode.class);
+ selectedPathContextEntry = JAXXUtil.newContextEntryDef(prefix + "-selected-path", String.class);
+// selectedUIContextEntry = JAXXUtil.newContextEntryDef(prefix + "-selected-ui", Component.class);
}
public String getPrefix() {
Modified: trunk/jaxx-runtime/src/test/java/jaxx/runtime/UtilTest.java
===================================================================
--- trunk/jaxx-runtime/src/test/java/jaxx/runtime/UtilTest.java 2010-01-29 15:49:15 UTC (rev 1724)
+++ trunk/jaxx-runtime/src/test/java/jaxx/runtime/UtilTest.java 2010-01-29 16:58:54 UTC (rev 1725)
@@ -33,10 +33,10 @@
@Test
public void testGetEventListener() {
count = 0;
- DocumentListener listener = (DocumentListener) Util.getEventListener(javax.swing.event.DocumentListener.class, this, "incCount");
+ DocumentListener listener = (DocumentListener) JAXXUtil.getEventListener(javax.swing.event.DocumentListener.class, this, "incCount");
listener.insertUpdate(null);
Assert.assertEquals(count, 1);
- DocumentListener listener2 = (DocumentListener) Util.getEventListener(javax.swing.event.DocumentListener.class, this, "incCount");
+ DocumentListener listener2 = (DocumentListener) JAXXUtil.getEventListener(javax.swing.event.DocumentListener.class, this, "incCount");
listener2.removeUpdate(null);
Assert.assertEquals(count, 2);
//assertTrue("Received two different event listeners despite using identical parameters", listener == listener2);
Modified: trunk/jaxx-runtime/src/test/java/jaxx/runtime/swing/navigation/NavigationTreeModelTest.java
===================================================================
--- trunk/jaxx-runtime/src/test/java/jaxx/runtime/swing/navigation/NavigationTreeModelTest.java 2010-01-29 15:49:15 UTC (rev 1724)
+++ trunk/jaxx-runtime/src/test/java/jaxx/runtime/swing/navigation/NavigationTreeModelTest.java 2010-01-29 16:58:54 UTC (rev 1725)
@@ -20,7 +20,7 @@
*/
package jaxx.runtime.swing.navigation;
-import jaxx.runtime.Util;
+import jaxx.runtime.JAXXUtil;
import jaxx.runtime.context.DefaultJAXXContext;
import jaxx.runtime.JAXXContext;
import org.junit.Assert;
@@ -164,10 +164,10 @@
NavigationTreeNode sonSonNode;
NavigationTreeNode sonSonSonNode;
- builder.build(rootNode, (String) null, Util.newContextEntryDef("name", String.class), "name", null, null);
- builder.build(rootNode, (String) null, Util.newContextEntryDef("name2", String.class), "name2", null, null);
+ builder.build(rootNode, (String) null, JAXXUtil.newContextEntryDef("name", String.class), "name", null, null);
+ builder.build(rootNode, (String) null, JAXXUtil.newContextEntryDef("name2", String.class), "name2", null, null);
- sonNode = builder.build(rootNode, (String) null, Util.newContextEntryDef(Model.class), "model", null, null);
+ sonNode = builder.build(rootNode, (String) null, JAXXUtil.newContextEntryDef(Model.class), "model", null, null);
builder.build(sonNode, (String) null, "../name", "name", null, null);
builder.build(sonNode, (String) null, "../integerValue", "integerValue", null, null);
@@ -286,7 +286,7 @@
NavigationTreeNode sonSonSonNode;
// first son is a list of models
- sonNode = builder.build(rootNode, (String) null, Util.newListContextEntryDef("models"), "models", null, null);
+ sonNode = builder.build(rootNode, (String) null, JAXXUtil.newListContextEntryDef("models"), "models", null, null);
// first son son is a model
sonSonNode = builder.build(sonNode, (String) null, "..[1]", "0", null, null);
Modified: trunk/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/plugin/Bug1750Test.java
===================================================================
--- trunk/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/plugin/Bug1750Test.java 2010-01-29 15:49:15 UTC (rev 1724)
+++ trunk/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/plugin/Bug1750Test.java 2010-01-29 16:58:54 UTC (rev 1725)
@@ -23,7 +23,7 @@
import jaxx.runtime.Base64Coder;
import jaxx.compiler.JAXXCompiler;
import jaxx.runtime.JAXXObjectDescriptor;
-import jaxx.runtime.Util;
+import jaxx.runtime.JAXXUtil;
import org.junit.Test;
import static org.junit.Assert.*;
@@ -48,7 +48,7 @@
assertNotNull(descriptor2);
assertEquals(descriptor.toString(), descriptor2.toString());
- descriptor2 = Util.decodeJAXXObjectDescriptor(data);
+ descriptor2 = JAXXUtil.decodeJAXXObjectDescriptor(data);
assertNotNull(descriptor2);
assertEquals(descriptor.toString(), descriptor2.toString());
@@ -58,7 +58,7 @@
assertNotNull(descriptor2);
assertEquals(descriptor.toString(), descriptor2.toString());
- descriptor2 = Util.decodeCompressedJAXXObjectDescriptor(data);
+ descriptor2 = JAXXUtil.decodeCompressedJAXXObjectDescriptor(data);
assertNotNull(descriptor2);
assertEquals(descriptor.toString(), descriptor2.toString());
Modified: trunk/src/site/rst/BeanValidator.rst
===================================================================
--- trunk/src/site/rst/BeanValidator.rst 2010-01-29 15:49:15 UTC (rev 1724)
+++ trunk/src/site/rst/BeanValidator.rst 2010-01-29 16:58:54 UTC (rev 1725)
@@ -170,7 +170,7 @@
::
- jaxx.runtime.Util.convert(validator,"nomDeLaPropriété",widget.getText(),TypeDeLaProriete.class);
+ jaxx.runtime.JAXXUtil.convert(validator,"nomDeLaPropriété",widget.getText(),TypeDeLaProriete.class);
On obtiendra si une erreur de conversion intervient, une erreur dont le libellé est de la forme *error.convertor.XXX*
1
0
Author: sletellier
Date: 2010-01-29 16:49:15 +0100 (Fri, 29 Jan 2010)
New Revision: 1724
Added:
trunk/jaxx-runtime/src/main/java/jaxx/runtime/Util.java
Removed:
trunk/jaxx-runtime/src/main/java/jaxx/runtime/JAXXUtil.java
Modified:
trunk/jaxx-compiler/src/main/java/jaxx/compiler/CompiledObject.java
trunk/jaxx-compiler/src/main/java/jaxx/compiler/JAXXCompiler.java
trunk/jaxx-compiler/src/main/java/jaxx/compiler/JAXXEngine.java
trunk/jaxx-compiler/src/main/java/jaxx/compiler/binding/DataSource.java
trunk/jaxx-compiler/src/main/java/jaxx/compiler/finalizers/DefaultFinalizer.java
trunk/jaxx-compiler/src/main/java/jaxx/compiler/script/ScriptManager.java
trunk/jaxx-compiler/src/main/java/jaxx/compiler/tags/DefaultObjectHandler.java
trunk/jaxx-compiler/src/site/rst/BeanValidator.rst
trunk/jaxx-demo/src/main/java/jaxx/demo/DemoConfig.java
trunk/jaxx-demo/src/main/java/jaxx/demo/DemoTreeHelper.java
trunk/jaxx-demo/src/main/java/jaxx/demo/DemoUIHandler.java
trunk/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/navigation/FullNavigationTreeHelper.java
trunk/jaxx-runtime/src/main/java/jaxx/runtime/SwingUtil.java
trunk/jaxx-runtime/src/main/java/jaxx/runtime/context/DataContext.java
trunk/jaxx-runtime/src/main/java/jaxx/runtime/context/DefaultJAXXContext.java
trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation/NavigationTreeContextHelper.java
trunk/jaxx-runtime/src/test/java/jaxx/runtime/UtilTest.java
trunk/jaxx-runtime/src/test/java/jaxx/runtime/swing/navigation/NavigationTreeModelTest.java
trunk/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/plugin/Bug1750Test.java
trunk/src/site/rst/BeanValidator.rst
Log:
Revert
Modified: trunk/jaxx-compiler/src/main/java/jaxx/compiler/CompiledObject.java
===================================================================
--- trunk/jaxx-compiler/src/main/java/jaxx/compiler/CompiledObject.java 2010-01-29 15:18:50 UTC (rev 1723)
+++ trunk/jaxx-compiler/src/main/java/jaxx/compiler/CompiledObject.java 2010-01-29 15:49:15 UTC (rev 1724)
@@ -460,8 +460,8 @@
MethodDescriptor addMethod = handler.getAddMethod();
ClassDescriptor listenerClass = addMethod.getParameterTypes()[0];
//TC-20091026 use 'this' instead of root object javaCode
- //TC-20091105 JAXXUtil.getEventListener is generic, no more need cast and use simple name
- return getJavaCode() + '.' + addMethod.getName() + "(JAXXUtil.getEventListener(" + listenerClass.getSimpleName() + ".class, " +
+ //TC-20091105 Util.getEventListener is generic, no more need cast and use simple name
+ return getJavaCode() + '.' + addMethod.getName() + "(Util.getEventListener(" + listenerClass.getSimpleName() + ".class, " +
TypeManager.getJavaCode(handler.getListenerMethod().getName()) + ", this, " +
TypeManager.getJavaCode(compiler.getEventHandlerMethodName(handler)) + "));" + JAXXCompiler.getLineSeparator();
}
Modified: trunk/jaxx-compiler/src/main/java/jaxx/compiler/JAXXCompiler.java
===================================================================
--- trunk/jaxx-compiler/src/main/java/jaxx/compiler/JAXXCompiler.java 2010-01-29 15:18:50 UTC (rev 1723)
+++ trunk/jaxx-compiler/src/main/java/jaxx/compiler/JAXXCompiler.java 2010-01-29 15:49:15 UTC (rev 1724)
@@ -127,7 +127,7 @@
*/
protected final IDHelper idHelper;
/**
- * Binding JAXXUtil
+ * Binding Util
*/
protected final DataBindingHelper bindingHelper;
/**
Modified: trunk/jaxx-compiler/src/main/java/jaxx/compiler/JAXXEngine.java
===================================================================
--- trunk/jaxx-compiler/src/main/java/jaxx/compiler/JAXXEngine.java 2010-01-29 15:18:50 UTC (rev 1723)
+++ trunk/jaxx-compiler/src/main/java/jaxx/compiler/JAXXEngine.java 2010-01-29 15:49:15 UTC (rev 1724)
@@ -651,7 +651,7 @@
"jaxx.runtime.swing.HBox",
"jaxx.runtime.swing.VBox",
"jaxx.runtime.swing.Table",
- "jaxx.runtime.JAXXUtil",
+ "jaxx.runtime.Util",
"jaxx.runtime.SwingUtil",
"static org.nuiton.i18n.I18n._",
"static jaxx.runtime.SwingUtil.createImageIcon")
Modified: trunk/jaxx-compiler/src/main/java/jaxx/compiler/binding/DataSource.java
===================================================================
--- trunk/jaxx-compiler/src/main/java/jaxx/compiler/binding/DataSource.java 2010-01-29 15:18:50 UTC (rev 1723)
+++ trunk/jaxx-compiler/src/main/java/jaxx/compiler/binding/DataSource.java 2010-01-29 15:49:15 UTC (rev 1724)
@@ -37,7 +37,7 @@
import jaxx.compiler.tags.DefaultObjectHandler;
import jaxx.compiler.tags.TagManager;
import jaxx.compiler.types.TypeManager;
-import jaxx.runtime.JAXXUtil;
+import jaxx.runtime.Util;
import org.apache.commons.lang.StringUtils;
import org.apache.commons.lang.builder.ToStringBuilder;
import org.apache.commons.lang.builder.ToStringStyle;
@@ -620,12 +620,12 @@
}
String code = objectCode + (eventInfo.getModelName() != null ? ".get" + StringUtils.capitalize(eventInfo.getModelName()) + "()" : "");
result.append("$bindingSources.put(\"").append(code).append("\", ").append(code).append(");").append(JAXXCompiler.getLineSeparator());
- //TC-20091105 JAXXUtil.getEventListener is generic, no more need cast and use simple listener name
- result.append(code).append('.').append(eventInfo.getAddMethod()).append("( JAXXUtil.getEventListener(").append(eventInfo.getListenerClass().getSimpleName()).append(".class, ").append("this").append(", ").append(TypeManager.getJavaCode(methodName)).append("));");
+ //TC-20091105 Util.getEventListener is generic, no more need cast and use simple listener name
+ result.append(code).append('.').append(eventInfo.getAddMethod()).append("( Util.getEventListener(").append(eventInfo.getListenerClass().getSimpleName()).append(".class, ").append("this").append(", ").append(TypeManager.getJavaCode(methodName)).append("));");
result.append(JAXXCompiler.getLineSeparator());
if (eventInfo.getModelName() != null) {
result.append(getAddMemberListenerCode(handler, objectCode, "get" + StringUtils.capitalize(eventInfo.getModelName()),
- JAXXUtil.class.getSimpleName() + ".getDataBindingUpdateListener(" + (compiler.getOutputClassName() + ".this") + ", " + constantId + ")",
+ Util.class.getSimpleName() + ".getDataBindingUpdateListener(" + (compiler.getOutputClassName() + ".this") + ", " + constantId + ")",
compiler));
}
return result.toString();
@@ -696,12 +696,12 @@
result.append(modelClassName).append(" $target = ((").append(modelClassName).append(") $bindingSources.remove(\"").append(code).append("\"));").append(eol);
//TC-20091105 test if $target is not null
result.append("if ($target != null) {").append(eol);
- //TC-20091105 JAXXUtil.getEventListener is generic, no more need cast and use simple listener name
- result.append(" $target.").append(eventInfo.getRemoveMethod()).append("( JAXXUtil.getEventListener(").append(eventInfo.getListenerClass().getSimpleName()).append(".class, ").append("this").append(", ").append(TypeManager.getJavaCode(methodName)).append("));").append(eol);
+ //TC-20091105 Util.getEventListener is generic, no more need cast and use simple listener name
+ result.append(" $target.").append(eventInfo.getRemoveMethod()).append("( Util.getEventListener(").append(eventInfo.getListenerClass().getSimpleName()).append(".class, ").append("this").append(", ").append(TypeManager.getJavaCode(methodName)).append("));").append(eol);
result.append("}").append(eol);
if (eventInfo.getModelName() != null) {
result.append(getRemoveMemberListenerCode(handler, objectCode, "get" + StringUtils.capitalize(eventInfo.getModelName()),
- JAXXUtil.class.getSimpleName() + ".getDataBindingUpdateListener(" + compiler.getOutputClassName() + ".this, " + constantId + ")",
+ Util.class.getSimpleName() + ".getDataBindingUpdateListener(" + compiler.getOutputClassName() + ".this, " + constantId + ")",
compiler));
}
return result.toString();
Modified: trunk/jaxx-compiler/src/main/java/jaxx/compiler/finalizers/DefaultFinalizer.java
===================================================================
--- trunk/jaxx-compiler/src/main/java/jaxx/compiler/finalizers/DefaultFinalizer.java 2010-01-29 15:18:50 UTC (rev 1723)
+++ trunk/jaxx-compiler/src/main/java/jaxx/compiler/finalizers/DefaultFinalizer.java 2010-01-29 15:49:15 UTC (rev 1724)
@@ -194,7 +194,7 @@
*
*/
protected static final JavaMethod GET_JAXX_OBJECT_DESCRIPTOR_METHOD = newMethod(PUBLIC | STATIC, "JAXXObjectDescriptor", METHOD_NAME_$GET_JAXXOBJECT_DESCRIPTOR,
- "return JAXXUtil.decodeCompressedJAXXObjectDescriptor(" + FIELD_NAME_$JAXX_OBJECT_DESCRIPTOR + ");", false);
+ "return Util.decodeCompressedJAXXObjectDescriptor(" + FIELD_NAME_$JAXX_OBJECT_DESCRIPTOR + ");", false);
/**
*
*/
@@ -624,7 +624,7 @@
}
}
if (!superclassIsJAXXObject) {
- code.append(JAXXUtil.class.getSimpleName()).append(".initContext(this, " + PARAMETER_NAME_PARENT_CONTEXT + ");");
+ code.append(Util.class.getSimpleName()).append(".initContext(this, " + PARAMETER_NAME_PARENT_CONTEXT + ");");
code.append(eol);
}
code.append(METHOD_NAME_$INITIALIZE + "();");
@@ -708,7 +708,7 @@
if (bindings.length > 0) {
result.append(eol).append("// apply ").append(bindings.length).append(" data bindings").append(eol);
- result.append(JAXXUtil.class.getSimpleName()).append("." + METHOD_NAME_APPLY_DATA_BINDING + "(this, " + FIELD_NAME_$BINDINGS + ".keySet());").append(eol);
+ result.append(Util.class.getSimpleName()).append("." + METHOD_NAME_APPLY_DATA_BINDING + "(this, " + FIELD_NAME_$BINDINGS + ".keySet());").append(eol);
}
bindings = compiler.getBindingHelper().getSimpleBindings();
Modified: trunk/jaxx-compiler/src/main/java/jaxx/compiler/script/ScriptManager.java
===================================================================
--- trunk/jaxx-compiler/src/main/java/jaxx/compiler/script/ScriptManager.java 2010-01-29 15:18:50 UTC (rev 1723)
+++ trunk/jaxx-compiler/src/main/java/jaxx/compiler/script/ScriptManager.java 2010-01-29 15:49:15 UTC (rev 1724)
@@ -133,7 +133,7 @@
for (FieldDescriptor field : fields) {
if (field.getName().equals(lhs)) {
//lhs.substring(lhs.lastIndexOf(".") + 1);
- node.firstToken.image = "jaxx.runtime.JAXXUtil.assignment(" + node.firstToken.image;
+ node.firstToken.image = "jaxx.runtime.Util.assignment(" + node.firstToken.image;
String outputClassName = compiler.getOutputClassName();
node.lastToken.image = node.lastToken.image + ", \"" + lhs + "\", " + outputClassName + ".this)";
}
Modified: trunk/jaxx-compiler/src/main/java/jaxx/compiler/tags/DefaultObjectHandler.java
===================================================================
--- trunk/jaxx-compiler/src/main/java/jaxx/compiler/tags/DefaultObjectHandler.java 2010-01-29 15:18:50 UTC (rev 1723)
+++ trunk/jaxx-compiler/src/main/java/jaxx/compiler/tags/DefaultObjectHandler.java 2010-01-29 15:49:15 UTC (rev 1724)
@@ -337,13 +337,13 @@
// }
// String code = objectCode + (eventInfo.modelName != null ? ".get" + StringUtils.capitalize(eventInfo.modelName) + "()" : "");
// result.append("$bindingSources.put(\"").append(code).append("\", ").append(code).append(");").append(JAXXCompiler.getLineSeparator());
-// //TC-20091105 JAXXUtil.getEventListener is generic, no more need cast and use simple listener name
-// result.append(code).append('.').append(eventInfo.addMethod).append("( JAXXUtil.getEventListener(").append(eventInfo.listenerClass.getSimpleName()).append(".class, ").append(compiler.getRootObject().getJavaCode()).append(", ").append(TypeManager.getJavaCode(methodName)).append("));");
+// //TC-20091105 Util.getEventListener is generic, no more need cast and use simple listener name
+// result.append(code).append('.').append(eventInfo.addMethod).append("( Util.getEventListener(").append(eventInfo.listenerClass.getSimpleName()).append(".class, ").append(compiler.getRootObject().getJavaCode()).append(", ").append(TypeManager.getJavaCode(methodName)).append("));");
// result.append(JAXXCompiler.getLineSeparator());
// if (eventInfo.modelName != null) {
// result.append(getAddMemberListenerCode(objectCode, dataBinding, "get" + StringUtils.capitalize(eventInfo.modelName),
-// JAXXUtil.class.getSimpleName() + ".getDataBindingUpdateListener(this , " + dataBinding + ")",
-//// JAXXUtil.class.getSimpleName() + ".getDataBindingUpdateListener(this , \"" + dataBinding + "\")",
+// Util.class.getSimpleName() + ".getDataBindingUpdateListener(this , " + dataBinding + ")",
+//// Util.class.getSimpleName() + ".getDataBindingUpdateListener(this , \"" + dataBinding + "\")",
// compiler));
// }
// return result.toString();
@@ -407,14 +407,14 @@
// result.append(modelClassName).append(" $target = ((").append(modelClassName).append(") $bindingSources.remove(\"").append(code).append("\"));").append(eol);
// //TC-20091105 test if $target is not null
// result.append("if ($target != null) {").append(eol);
-// //TC-20091105 JAXXUtil.getEventListener is generic, no more need cast and use simple listener name
-// result.append(" $target.").append(eventInfo.removeMethod).append("( JAXXUtil.getEventListener(").append(eventInfo.listenerClass.getSimpleName()).append(".class, ").append(compiler.getRootObject().getJavaCode()).append(", ").append(TypeManager.getJavaCode(methodName)).append("));").append(eol);
+// //TC-20091105 Util.getEventListener is generic, no more need cast and use simple listener name
+// result.append(" $target.").append(eventInfo.removeMethod).append("( Util.getEventListener(").append(eventInfo.listenerClass.getSimpleName()).append(".class, ").append(compiler.getRootObject().getJavaCode()).append(", ").append(TypeManager.getJavaCode(methodName)).append("));").append(eol);
// result.append("}").append(eol);
// if (eventInfo.modelName != null) {
//// String bi = dataBinding.startsWith("this.") ? dataBinding : ("\"" + dataBinding + "\"");
// result.append(getRemoveMemberListenerCode(objectCode, dataBinding, "get" + StringUtils.capitalize(eventInfo.modelName),
-// JAXXUtil.class.getSimpleName() + ".getDataBindingUpdateListener(this, " + dataBinding + ")",
-//// JAXXUtil.class.getSimpleName() + ".getDataBindingUpdateListener(this, \"" + dataBinding + "\")",
+// Util.class.getSimpleName() + ".getDataBindingUpdateListener(this, " + dataBinding + ")",
+//// Util.class.getSimpleName() + ".getDataBindingUpdateListener(this, \"" + dataBinding + "\")",
// compiler));
// }
// return result.toString();
Modified: trunk/jaxx-compiler/src/site/rst/BeanValidator.rst
===================================================================
--- trunk/jaxx-compiler/src/site/rst/BeanValidator.rst 2010-01-29 15:18:50 UTC (rev 1723)
+++ trunk/jaxx-compiler/src/site/rst/BeanValidator.rst 2010-01-29 15:49:15 UTC (rev 1724)
@@ -170,7 +170,7 @@
::
- jaxx.runtime.JAXXUtil.convert(validator,"nomDeLaPropriété",widget.getText(),TypeDeLaProriete.class);
+ jaxx.runtime.Util.convert(validator,"nomDeLaPropriété",widget.getText(),TypeDeLaProriete.class);
On obtiendra si une erreur de conversion intervient, une erreur dont le libellé est de la forme *error.convertor.XXX*
Modified: trunk/jaxx-demo/src/main/java/jaxx/demo/DemoConfig.java
===================================================================
--- trunk/jaxx-demo/src/main/java/jaxx/demo/DemoConfig.java 2010-01-29 15:18:50 UTC (rev 1723)
+++ trunk/jaxx-demo/src/main/java/jaxx/demo/DemoConfig.java 2010-01-29 15:49:15 UTC (rev 1724)
@@ -29,7 +29,7 @@
import java.util.Properties;
import jaxx.demo.component.jaxx.navigation.FullNavigationTreeDemo;
-import jaxx.runtime.JAXXUtil;
+import jaxx.runtime.Util;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -214,7 +214,7 @@
};
public void removeJaxxPropertyChangeListener() {
- PropertyChangeListener[] toRemove = JAXXUtil.findJaxxPropertyChangeListener(DEFAULT_JAXX_PCS, getPropertyChangeListeners());
+ PropertyChangeListener[] toRemove = Util.findJaxxPropertyChangeListener(DEFAULT_JAXX_PCS, getPropertyChangeListeners());
if (toRemove == null || toRemove.length == 0) {
return;
}
Modified: trunk/jaxx-demo/src/main/java/jaxx/demo/DemoTreeHelper.java
===================================================================
--- trunk/jaxx-demo/src/main/java/jaxx/demo/DemoTreeHelper.java 2010-01-29 15:18:50 UTC (rev 1723)
+++ trunk/jaxx-demo/src/main/java/jaxx/demo/DemoTreeHelper.java 2010-01-29 15:49:15 UTC (rev 1724)
@@ -37,7 +37,7 @@
import jaxx.demo.fun.LabelStyleDemo;
import jaxx.runtime.JAXXContext;
import jaxx.runtime.JAXXObject;
-import jaxx.runtime.JAXXUtil;
+import jaxx.runtime.Util;
import jaxx.runtime.context.JAXXContextEntryDef;
import jaxx.runtime.swing.CardLayout2;
import jaxx.runtime.swing.ErrorDialogUI;
@@ -191,7 +191,7 @@
/**
* la definition de l'unqiue object a partage
*/
- static private final JAXXContextEntryDef<DemoConfig> def = JAXXUtil.newContextEntryDef(DemoConfig.class);
+ static private final JAXXContextEntryDef<DemoConfig> def = Util.newContextEntryDef(DemoConfig.class);
/**
* la pile des noeuds parent
*/
Modified: trunk/jaxx-demo/src/main/java/jaxx/demo/DemoUIHandler.java
===================================================================
--- trunk/jaxx-demo/src/main/java/jaxx/demo/DemoUIHandler.java 2010-01-29 15:18:50 UTC (rev 1723)
+++ trunk/jaxx-demo/src/main/java/jaxx/demo/DemoUIHandler.java 2010-01-29 15:49:15 UTC (rev 1724)
@@ -21,7 +21,7 @@
package jaxx.demo;
import jaxx.runtime.JAXXContext;
-import jaxx.runtime.JAXXUtil;
+import jaxx.runtime.Util;
import jaxx.runtime.context.DefaultApplicationContext;
import jaxx.runtime.context.JAXXContextEntryDef;
import jaxx.runtime.context.JAXXInitialContext;
@@ -57,7 +57,7 @@
* to use log facility, just put in your code: log.info(\"...\");
*/
static private Log log = LogFactory.getLog(DemoUIHandler.class);
- static final JAXXContextEntryDef<DemoUI> MAIN_UI_ENTRY_DEF = JAXXUtil.newContextEntryDef("mainui", DemoUI.class);
+ static final JAXXContextEntryDef<DemoUI> MAIN_UI_ENTRY_DEF = Util.newContextEntryDef("mainui", DemoUI.class);
/**
* Methode pour initialiser l'ui principale sans l'afficher.
Modified: trunk/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/navigation/FullNavigationTreeHelper.java
===================================================================
--- trunk/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/navigation/FullNavigationTreeHelper.java 2010-01-29 15:18:50 UTC (rev 1723)
+++ trunk/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/navigation/FullNavigationTreeHelper.java 2010-01-29 15:49:15 UTC (rev 1724)
@@ -22,7 +22,7 @@
import jaxx.runtime.JAXXContext;
import jaxx.runtime.JAXXObject;
-import jaxx.runtime.JAXXUtil;
+import jaxx.runtime.Util;
import jaxx.runtime.context.JAXXContextEntryDef;
import jaxx.runtime.swing.CardLayout2;
import jaxx.runtime.swing.ErrorDialogUI;
@@ -63,11 +63,11 @@
/**
* where the movies are hold in context
*/
- static public final JAXXContextEntryDef<List<Movie>> MOVIES = JAXXUtil.newListContextEntryDef("movies");
+ static public final JAXXContextEntryDef<List<Movie>> MOVIES = Util.newListContextEntryDef("movies");
/**
* where the actors are hold in context
*/
- static public final JAXXContextEntryDef<List<People>> ACTORS = JAXXUtil.newListContextEntryDef("actors");
+ static public final JAXXContextEntryDef<List<People>> ACTORS = Util.newListContextEntryDef("actors");
protected FullNavigationTreeModelBuilder builder;
public FullNavigationTreeHelper() {
Deleted: trunk/jaxx-runtime/src/main/java/jaxx/runtime/JAXXUtil.java
===================================================================
--- trunk/jaxx-runtime/src/main/java/jaxx/runtime/JAXXUtil.java 2010-01-29 15:18:50 UTC (rev 1723)
+++ trunk/jaxx-runtime/src/main/java/jaxx/runtime/JAXXUtil.java 2010-01-29 15:49:15 UTC (rev 1724)
@@ -1,516 +0,0 @@
-/*
- * *##%
- * JAXX Runtime
- * Copyright (C) 2008 - 2009 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>.
- * ##%*
- */
-package jaxx.runtime;
-
-import jaxx.runtime.context.JAXXContextEntryDef;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-import java.beans.PropertyChangeListener;
-import java.beans.PropertyChangeListenerProxy;
-import java.io.IOException;
-import java.lang.ref.WeakReference;
-import java.lang.reflect.InvocationHandler;
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
-import java.lang.reflect.Proxy;
-import java.util.*;
-
-public class JAXXUtil {
-
- // public static final String DEFAULT_ICON_PATH = "/icons/";
- // public static final String DEFAULT_ICON_PATH_PROPERTY = "default.icon.path";
- /**
- * Logger
- */
- static private final Log log = LogFactory.getLog(JAXXUtil.class);
- public static final String PARENT = "parent";
- // Maps root objects to lists of event listeners
- private static Map<Object, WeakReference<List<EventListenerDescriptor>>> eventListeners = new WeakHashMap<Object, WeakReference<List<EventListenerDescriptor>>>();
- private static Map<JAXXObject, WeakReference<List<DataBindingUpdateListener>>> dataBindingUpdateListeners = new WeakHashMap<JAXXObject, WeakReference<List<DataBindingUpdateListener>>>();
-
- private static class EventListenerDescriptor {
-
- Class<?> listenerClass;
- String listenerMethodName;
- String methodName;
- Object eventListener;
- }
-
- /**
- * Decodes the serialized representation of a JAXXObjectDescriptor. The string must be a byte-to-character mapping
- * of the binary serialization data for a JAXXObjectDescriptor. See the comments in JAXXCompiler.createJAXXObjectDescriptorField
- * for the rationale behind this (admittedly ugly) approach.
- *
- * @param descriptor descriptor to decode
- * @return the dedoced descriptor
- */
- public static JAXXObjectDescriptor decodeJAXXObjectDescriptor(String descriptor) {
- try {
- return (JAXXObjectDescriptor) Base64Coder.deserialize(descriptor, false);
- /*byte[] data = new byte[descriptor.length()];
- // copy low-order bytes into the array. The high-order bytes should all be zero.
- System.arraycopy(descriptor.getBytes(), 0, data, 0, data.length);
- //descriptor.getBytes(0, descriptor.length(), data, 0);
- ObjectInputStream in = new ObjectInputStream(new ByteArrayInputStream(data));
- return (JAXXObjectDescriptor) in.readObject();*/
- } catch (IOException e) {
- throw new RuntimeException("Internal error: can't-happen error", e);
- } catch (ClassNotFoundException e) {
- throw new RuntimeException("Internal error: can't-happen error", e);
- }
- }
-
- public static JAXXObjectDescriptor decodeCompressedJAXXObjectDescriptor(String descriptor) {
- try {
- return (JAXXObjectDescriptor) Base64Coder.deserialize(descriptor, true);
-
- /*byte[] data = new byte[descriptor.length()];
- // copy low-order bytes into the array. The high-order bytes should all be zero.
- System.arraycopy(descriptor.getBytes(), 0, data, 0, data.length);
- //descriptor.getBytes(0, descriptor.length(), data, 0);
- ObjectInputStream in = new ObjectInputStream(new GZIPInputStream(new ByteArrayInputStream(data)));
- return (JAXXObjectDescriptor) in.readObject();*/
- } catch (IOException e) {
- throw new RuntimeException("Internal error: can't-happen error", e);
- } catch (ClassNotFoundException e) {
- throw new RuntimeException("Internal error: can't-happen error", e);
- }
- }
-
- public static <O> JAXXContextEntryDef<O> newContextEntryDef(Class<O> klass) {
- return newContextEntryDef(null, klass);
- }
-
- public static <O> JAXXContextEntryDef<O> newContextEntryDef(String name, Class<O> klass) {
- return new JAXXContextEntryDef<O>(name, klass);
- }
-
- public static <O> JAXXContextEntryDef<List<O>> newListContextEntryDef() {
- return newListContextEntryDef(null);
- }
-
- public static <O> JAXXContextEntryDef<List<O>> newListContextEntryDef(String name) {
- Class<List<O>> castList = JAXXUtil.castList();
- JAXXContextEntryDef<List<O>> contextEntryDef = new JAXXContextEntryDef<List<O>>(name, castList);
- return contextEntryDef;
- }
-
-// public static DefaultJAXXBinding registerBinding(Map<String, DefaultJAXXBinding> bindings, DefaultJAXXBinding binding) {
-// bindings.put(binding.getId(), binding);
-//// binding.applyDataBinding();
-//// binding.processDataBinding();
-// return binding;
-// }
-
-// /**
-// * Return parent's container corresponding to the Class clazz
-// *
-// * @param <O> type of container to obtain from context
-// * @param top the top container
-// * @param clazz desired
-// * @return parent's container
-// */
-// @SuppressWarnings({"unchecked"})
-// public static <O extends Container> O getParentContainer(Object top, Class<O> clazz) {
-// if (top == null) {
-// throw new IllegalArgumentException("top parameter can not be null");
-// }
-// if (!Container.class.isAssignableFrom(top.getClass())) {
-// throw new IllegalArgumentException("top parameter " + top + " is not a " + Container.class);
-// }
-// Container parent = ((Container) top).getParent();
-// if (parent != null && !clazz.isAssignableFrom(parent.getClass())) {
-// parent = getParentContainer(parent, clazz);
-// }
-// return (O) parent;
-// }
-
- @SuppressWarnings({"unchecked"})
- protected static <O> Class<List<O>> castList() {
- return (Class<List<O>>) Collections.emptyList().getClass();
- }
-
- /**
- * Method to initialize the context of a ui.
- *
- * @param ui the ui
- * @param parentContext the context to set in ui
- */
- public static void initContext(JAXXObject ui, JAXXContext parentContext) {
-
- if (parentContext instanceof jaxx.runtime.context.JAXXInitialContext) {
- ((jaxx.runtime.context.JAXXInitialContext) parentContext).to(ui);
- } else {
- ui.setContextValue(parentContext);
- }
- // if parentContext is a JAXXObject then
- // add an special parent entry to can go up
- if (parentContext instanceof JAXXObject) {
- ui.setContextValue(parentContext, PARENT);
- }
- }
-
- public static <E extends EventListener> E getEventListener(Class<E> listenerClass, final String listenerMethodName, final Object methodContainer, final String methodName) {
- WeakReference<List<EventListenerDescriptor>> ref = eventListeners.get(methodContainer);
- List<EventListenerDescriptor> descriptors = ref != null ? ref.get() : null;
- if (descriptors == null) {
- descriptors = new ArrayList<EventListenerDescriptor>();
- eventListeners.put(methodContainer, new WeakReference<List<EventListenerDescriptor>>(descriptors));
- } else {
- for (EventListenerDescriptor descriptor : descriptors) {
- if (listenerClass == descriptor.listenerClass &&
- (listenerMethodName == null ? descriptor.listenerMethodName == null : listenerMethodName.equals(descriptor.listenerMethodName)) &&
- methodName.equals(descriptor.methodName)) {
- return (E) descriptor.eventListener;
- }
- }
- }
-
- // else we need to create a new listener
- final EventListenerDescriptor descriptor = new EventListenerDescriptor();
- descriptor.listenerClass = listenerClass;
- descriptor.listenerMethodName = listenerMethodName;
- descriptor.methodName = methodName;
- try {
- final List<Method> listenerMethods = Arrays.asList(listenerClass.getMethods());
- Method listenerMethod = null;
- if (listenerMethodName != null) {
- for (Method listenerMethod1 : listenerMethods) {
- if ((listenerMethod1).getName().equals(listenerMethodName)) {
- listenerMethod = listenerMethod1;
- break;
- }
- }
- }
- if (listenerMethodName != null && listenerMethod == null) {
- throw new IllegalArgumentException("no method named " + listenerMethodName + " found in class " + listenerClass.getName());
- }
- Class<?>[] parameterTypes = listenerMethods.get(0).getParameterTypes();
- Class<?> methodContainerClass = methodContainer.getClass();
- final Method targetMethod = methodContainerClass.getMethod(methodName, parameterTypes);
- descriptor.eventListener = Proxy.newProxyInstance(listenerClass.getClassLoader(),
- new Class<?>[]{listenerClass},
- new InvocationHandler() {
-
- @Override
- public Object invoke(Object proxy, Method method, Object[] args) {
- String methodName = method.getName();
- if ((listenerMethodName == null && listenerMethods.contains(method)) || methodName.equals(listenerMethodName)) {
- try {
- targetMethod.setAccessible(true);
- return targetMethod.invoke(methodContainer, args);
- } catch (IllegalAccessException e) {
- throw new RuntimeException("could not invoke on container " + methodContainer, e);
- } catch (InvocationTargetException e) {
- throw new RuntimeException(e);
- }
- }
- if (methodName.equals("toString")) {
- return toString();
- }
- if (methodName.equals("equals")) {
- return descriptor.eventListener == args[0];
- }
- if (methodName.equals("hashCode")) {
- return hashCode();
- }
- return null;
- }
- });
- descriptors.add(descriptor);
- return (E) descriptor.eventListener;
- } catch (NoSuchMethodException e) {
- throw new RuntimeException(e);
- }
- }
-
- public static <E extends EventListener> E getEventListener(Class<E> listenerClass, final Object methodContainer, final String methodName) {
- return getEventListener(listenerClass, null, methodContainer, methodName);
- }
-
- public static DataBindingUpdateListener getDataBindingUpdateListener(JAXXObject object, String bindingName) {
- WeakReference<List<DataBindingUpdateListener>> ref = dataBindingUpdateListeners.get(object);
- List<DataBindingUpdateListener> listeners = ref == null ? null : ref.get();
- if (listeners == null) {
- listeners = new ArrayList<DataBindingUpdateListener>();
- dataBindingUpdateListeners.put(object, new WeakReference<List<DataBindingUpdateListener>>(listeners));
- } else {
- for (DataBindingUpdateListener listener : listeners) {
- if (bindingName.equals(listener.getBindingName())) {
- return listener;
- }
- }
- }
- DataBindingUpdateListener listener = new DataBindingUpdateListener(object, bindingName);
- listeners.add(listener);
- return listener;
- }
-
-// public static void setComponentWidth(Component component, int width) {
-// component.setSize(width, component.getHeight());
-// if (component instanceof JComponent) {
-// JComponent jcomponent = (JComponent) component;
-// jcomponent.setPreferredSize(new Dimension(width, jcomponent.getPreferredSize().height));
-// jcomponent.setMinimumSize(new Dimension(width, jcomponent.getPreferredSize().height));
-// if (jcomponent.isDisplayable()) {
-// jcomponent.revalidate();
-// }
-// }
-// }
-
-// public static void setComponentHeight(Component component, int height) {
-// component.setSize(component.getWidth(), height);
-// if (component instanceof JComponent) {
-// JComponent jcomponent = (JComponent) component;
-// jcomponent.setPreferredSize(new Dimension(jcomponent.getPreferredSize().width, height));
-// jcomponent.setMinimumSize(new Dimension(jcomponent.getPreferredSize().width, height));
-// if (jcomponent.isDisplayable()) {
-// jcomponent.revalidate();
-// }
-// }
-// }
-
- public static boolean assignment(boolean value, String name, JAXXObject src) {
- src.firePropertyChange(name.trim(), null, "dummy value");
- return value;
- }
-
- public static byte assignment(byte value, String name, JAXXObject src) {
- src.firePropertyChange(name.trim(), null, "dummy value");
- return value;
- }
-
- public static short assignment(short value, String name, JAXXObject src) {
- src.firePropertyChange(name.trim(), null, "dummy value");
- return value;
- }
-
- public static int assignment(int value, String name, JAXXObject src) {
- src.firePropertyChange(name.trim(), null, "dummy value");
- return value;
- }
-
- public static long assignment(long value, String name, JAXXObject src) {
- src.firePropertyChange(name.trim(), null, "dummy value");
- return value;
- }
-
- public static float assignment(float value, String name, JAXXObject src) {
- src.firePropertyChange(name.trim(), null, "dummy value");
- return value;
- }
-
- public static double assignment(double value, String name, JAXXObject src) {
- src.firePropertyChange(name.trim(), null, "dummy value");
- return value;
- }
-
- public static char assignment(char value, String name, JAXXObject src) {
- src.firePropertyChange(name.trim(), null, "dummy value");
- return value;
- }
-
- public static java.lang.Object assignment(java.lang.Object value, String name, JAXXObject src) {
- src.firePropertyChange(name.trim(), null, "dummy value");
- return value;
- }
-
- /**
- * Compute the string representation of an object.
- * <p/>
- * Return empty string if given object is null
- *
- * @param value the value to write
- * @return the string representation of the given object or an empty string if object is null.
- */
- public static String getStringValue(Object value) {
- String result;
- result = value == null ? "" : value.toString();
- return result;
- }
-
- /**
- * Test if a type of entry exists in a given context and throw an IllegalArgumentException if not found.
- * <p/>
- * If entry is found, return his value in context.
- *
- * @param <T> the type of required data
- * @param context the context to test
- * @param def the definition of the entry to seek in context
- * @return the value from the context
- * @throws IllegalArgumentException if the entry is not found in context.
- */
- public static <T> T checkJAXXContextEntry(JAXXContext context, JAXXContextEntryDef<T> def) throws IllegalArgumentException {
-
- T value = def.getContextValue(context);
-
- if (value == null) {
- throw new IllegalArgumentException("the context entry [" + def + "] ] was not found in context " + context);
- }
-
- return value;
- }
-
- /**
- * Convinient method to apply more than one binding on a JAXX ui.
- *
- * @param src the ui to treate
- * @param bindings the list of binding to process.
- */
- public static void applyDataBinding(JAXXObject src, String... bindings) {
- for (String binding : bindings) {
- src.applyDataBinding(binding);
- }
- }
- /**
- * Convinient method to apply more than one binding on a JAXX ui.
- *
- * @param src the ui to treate
- * @param bindings the list of binding to process.
- */
- public static void applyDataBinding(JAXXObject src, Collection<String> bindings) {
- for (String binding : bindings) {
- src.applyDataBinding(binding);
- }
- }
-
- /**
- * Convinient method to process more than one binding on a JAXX ui.
- *
- * @param src the ui to treate
- * @param bindings the list of binding to process.
- */
- public static void processDataBinding(JAXXObject src, String... bindings) {
- for (String binding : bindings) {
- src.processDataBinding(binding);
- }
- }
-
- /**
- * Convinient method to remove more than one binding on a JAXX ui.
- *
- * @param src the ui to treate
- * @param bindings the list of binding to process.
- */
- public static void removeDataBinding(JAXXObject src, String... bindings) {
- for (String binding : bindings) {
- src.removeDataBinding(binding);
- }
- }
-
-// public static ImageIcon createIcon(String path) {
-// java.net.URL imgURL = JAXXUtil.class.getResource(path);
-// if (imgURL != null) {
-// return new ImageIcon(imgURL);
-// } else {
-// throw new IllegalArgumentException("could not find icon " + path);
-// }
-// }
-
-// /**
-// * @param path the location of icons in root directory icons
-// * @return the icon at {@link #getIconPath()}+path
-// */
-// public static ImageIcon createImageIcon(String path) {
-// String iconPath = getIconPath();
-// return createIcon(iconPath + path);
-// }
-//
-// /**
-// * @param key the key of the icon to retreave from {@link UIManager}
-// * @return the icon, or <code>null if no icon found in {@link UIManager}
-// */
-// public static Icon getUIManagerIcon(String key) {
-// return UIManager.getIcon(key);
-// }
-//
-// /**
-// * retreave for the {@link UIManager} the icon prefixed by <code>action.</code>
-// *
-// * @param key the key of the action icon to retreave from {@link UIManager}
-// * @return the icon, or <code>null if no icon found in {@link UIManager}
-// */
-// public static Icon getUIManagerActionIcon(String key) {
-// return getUIManagerIcon("action." + key);
-// }
-//
-// public static ImageIcon createActionIcon(String name) {
-// String iconPath = getIconPath();
-// return createIcon(iconPath + "action-" + name + ".png");
-// }
-//
-// public static ImageIcon createI18nIcon(String name) {
-// String iconPath = getIconPath();
-// return createIcon(iconPath + "i18n/" + name + ".png");
-// }
-
- /**
- * detects all PropertychangedListener added by Jaxx uis
- * (should be a {@link DataBindingListener}
- *
- * @param propertyNames the array of property names to find
- * @param listeners the array of listeners to filter
- * @return the filtered listeners
- */
- public static PropertyChangeListener[] findJaxxPropertyChangeListener(String[] propertyNames, PropertyChangeListener... listeners) {
- if (listeners == null || listeners.length == 0) {
- return new PropertyChangeListener[0];
- }
- List<String> pNames = Arrays.asList(propertyNames);
-
- List<PropertyChangeListener> toRemove = new ArrayList<PropertyChangeListener>();
-
- for (PropertyChangeListener listener : listeners) {
- String pName = null;
- PropertyChangeListenerProxy plistener = null;
- if (listener instanceof PropertyChangeListenerProxy) {
- plistener = (PropertyChangeListenerProxy) listener;
- if (!pNames.contains(plistener.getPropertyName())) {
- // not on the good property
- continue;
- }
- listener = (PropertyChangeListener) plistener.getListener();
- pName = plistener.getPropertyName();
- }
- if (plistener != null && pName != null && listener instanceof DataBindingListener) {
- if (log.isDebugEnabled()) {
- log.debug("find config listener to remove [" + pName + "] : " + listener);
- }
- toRemove.add(plistener);
- //toRemove.add(listener);
- }
- }
- return toRemove.toArray(new PropertyChangeListener[toRemove.size()]);
- }
-
-// private static String getIconPath() {
-// String iconPath = UIManager.getString(DEFAULT_ICON_PATH_PROPERTY);
-// if (iconPath == null) {
-// iconPath = DEFAULT_ICON_PATH;
-// } else {
-// if (!iconPath.endsWith("/")) {
-// iconPath += "/";
-// }
-// }
-// return iconPath;
-// }
-}
Modified: trunk/jaxx-runtime/src/main/java/jaxx/runtime/SwingUtil.java
===================================================================
--- trunk/jaxx-runtime/src/main/java/jaxx/runtime/SwingUtil.java 2010-01-29 15:18:50 UTC (rev 1723)
+++ trunk/jaxx-runtime/src/main/java/jaxx/runtime/SwingUtil.java 2010-01-29 15:49:15 UTC (rev 1724)
@@ -79,7 +79,7 @@
* @author tony
* @since 1.2
*/
-public class SwingUtil extends JAXXUtil {
+public class SwingUtil extends Util {
/**
* to use log facility, just put in your code: log.info(\"...\");
@@ -861,7 +861,7 @@
}
public static ImageIcon createIcon(String path) {
- java.net.URL imgURL = JAXXUtil.class.getResource(path);
+ java.net.URL imgURL = Util.class.getResource(path);
if (imgURL != null) {
return new ImageIcon(imgURL);
} else {
Added: trunk/jaxx-runtime/src/main/java/jaxx/runtime/Util.java
===================================================================
--- trunk/jaxx-runtime/src/main/java/jaxx/runtime/Util.java (rev 0)
+++ trunk/jaxx-runtime/src/main/java/jaxx/runtime/Util.java 2010-01-29 15:49:15 UTC (rev 1724)
@@ -0,0 +1,516 @@
+/*
+ * *##%
+ * JAXX Runtime
+ * Copyright (C) 2008 - 2009 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>.
+ * ##%*
+ */
+package jaxx.runtime;
+
+import jaxx.runtime.context.JAXXContextEntryDef;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import java.beans.PropertyChangeListener;
+import java.beans.PropertyChangeListenerProxy;
+import java.io.IOException;
+import java.lang.ref.WeakReference;
+import java.lang.reflect.InvocationHandler;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.lang.reflect.Proxy;
+import java.util.*;
+
+public class Util {
+
+ // public static final String DEFAULT_ICON_PATH = "/icons/";
+ // public static final String DEFAULT_ICON_PATH_PROPERTY = "default.icon.path";
+ /**
+ * Logger
+ */
+ static private final Log log = LogFactory.getLog(Util.class);
+ public static final String PARENT = "parent";
+ // Maps root objects to lists of event listeners
+ private static Map<Object, WeakReference<List<EventListenerDescriptor>>> eventListeners = new WeakHashMap<Object, WeakReference<List<EventListenerDescriptor>>>();
+ private static Map<JAXXObject, WeakReference<List<DataBindingUpdateListener>>> dataBindingUpdateListeners = new WeakHashMap<JAXXObject, WeakReference<List<DataBindingUpdateListener>>>();
+
+ private static class EventListenerDescriptor {
+
+ Class<?> listenerClass;
+ String listenerMethodName;
+ String methodName;
+ Object eventListener;
+ }
+
+ /**
+ * Decodes the serialized representation of a JAXXObjectDescriptor. The string must be a byte-to-character mapping
+ * of the binary serialization data for a JAXXObjectDescriptor. See the comments in JAXXCompiler.createJAXXObjectDescriptorField
+ * for the rationale behind this (admittedly ugly) approach.
+ *
+ * @param descriptor descriptor to decode
+ * @return the dedoced descriptor
+ */
+ public static JAXXObjectDescriptor decodeJAXXObjectDescriptor(String descriptor) {
+ try {
+ return (JAXXObjectDescriptor) Base64Coder.deserialize(descriptor, false);
+ /*byte[] data = new byte[descriptor.length()];
+ // copy low-order bytes into the array. The high-order bytes should all be zero.
+ System.arraycopy(descriptor.getBytes(), 0, data, 0, data.length);
+ //descriptor.getBytes(0, descriptor.length(), data, 0);
+ ObjectInputStream in = new ObjectInputStream(new ByteArrayInputStream(data));
+ return (JAXXObjectDescriptor) in.readObject();*/
+ } catch (IOException e) {
+ throw new RuntimeException("Internal error: can't-happen error", e);
+ } catch (ClassNotFoundException e) {
+ throw new RuntimeException("Internal error: can't-happen error", e);
+ }
+ }
+
+ public static JAXXObjectDescriptor decodeCompressedJAXXObjectDescriptor(String descriptor) {
+ try {
+ return (JAXXObjectDescriptor) Base64Coder.deserialize(descriptor, true);
+
+ /*byte[] data = new byte[descriptor.length()];
+ // copy low-order bytes into the array. The high-order bytes should all be zero.
+ System.arraycopy(descriptor.getBytes(), 0, data, 0, data.length);
+ //descriptor.getBytes(0, descriptor.length(), data, 0);
+ ObjectInputStream in = new ObjectInputStream(new GZIPInputStream(new ByteArrayInputStream(data)));
+ return (JAXXObjectDescriptor) in.readObject();*/
+ } catch (IOException e) {
+ throw new RuntimeException("Internal error: can't-happen error", e);
+ } catch (ClassNotFoundException e) {
+ throw new RuntimeException("Internal error: can't-happen error", e);
+ }
+ }
+
+ public static <O> JAXXContextEntryDef<O> newContextEntryDef(Class<O> klass) {
+ return newContextEntryDef(null, klass);
+ }
+
+ public static <O> JAXXContextEntryDef<O> newContextEntryDef(String name, Class<O> klass) {
+ return new JAXXContextEntryDef<O>(name, klass);
+ }
+
+ public static <O> JAXXContextEntryDef<List<O>> newListContextEntryDef() {
+ return newListContextEntryDef(null);
+ }
+
+ public static <O> JAXXContextEntryDef<List<O>> newListContextEntryDef(String name) {
+ Class<List<O>> castList = Util.castList();
+ JAXXContextEntryDef<List<O>> contextEntryDef = new JAXXContextEntryDef<List<O>>(name, castList);
+ return contextEntryDef;
+ }
+
+// public static DefaultJAXXBinding registerBinding(Map<String, DefaultJAXXBinding> bindings, DefaultJAXXBinding binding) {
+// bindings.put(binding.getId(), binding);
+//// binding.applyDataBinding();
+//// binding.processDataBinding();
+// return binding;
+// }
+
+// /**
+// * Return parent's container corresponding to the Class clazz
+// *
+// * @param <O> type of container to obtain from context
+// * @param top the top container
+// * @param clazz desired
+// * @return parent's container
+// */
+// @SuppressWarnings({"unchecked"})
+// public static <O extends Container> O getParentContainer(Object top, Class<O> clazz) {
+// if (top == null) {
+// throw new IllegalArgumentException("top parameter can not be null");
+// }
+// if (!Container.class.isAssignableFrom(top.getClass())) {
+// throw new IllegalArgumentException("top parameter " + top + " is not a " + Container.class);
+// }
+// Container parent = ((Container) top).getParent();
+// if (parent != null && !clazz.isAssignableFrom(parent.getClass())) {
+// parent = getParentContainer(parent, clazz);
+// }
+// return (O) parent;
+// }
+
+ @SuppressWarnings({"unchecked"})
+ protected static <O> Class<List<O>> castList() {
+ return (Class<List<O>>) Collections.emptyList().getClass();
+ }
+
+ /**
+ * Method to initialize the context of a ui.
+ *
+ * @param ui the ui
+ * @param parentContext the context to set in ui
+ */
+ public static void initContext(JAXXObject ui, JAXXContext parentContext) {
+
+ if (parentContext instanceof jaxx.runtime.context.JAXXInitialContext) {
+ ((jaxx.runtime.context.JAXXInitialContext) parentContext).to(ui);
+ } else {
+ ui.setContextValue(parentContext);
+ }
+ // if parentContext is a JAXXObject then
+ // add an special parent entry to can go up
+ if (parentContext instanceof JAXXObject) {
+ ui.setContextValue(parentContext, PARENT);
+ }
+ }
+
+ public static <E extends EventListener> E getEventListener(Class<E> listenerClass, final String listenerMethodName, final Object methodContainer, final String methodName) {
+ WeakReference<List<EventListenerDescriptor>> ref = eventListeners.get(methodContainer);
+ List<EventListenerDescriptor> descriptors = ref != null ? ref.get() : null;
+ if (descriptors == null) {
+ descriptors = new ArrayList<EventListenerDescriptor>();
+ eventListeners.put(methodContainer, new WeakReference<List<EventListenerDescriptor>>(descriptors));
+ } else {
+ for (EventListenerDescriptor descriptor : descriptors) {
+ if (listenerClass == descriptor.listenerClass &&
+ (listenerMethodName == null ? descriptor.listenerMethodName == null : listenerMethodName.equals(descriptor.listenerMethodName)) &&
+ methodName.equals(descriptor.methodName)) {
+ return (E) descriptor.eventListener;
+ }
+ }
+ }
+
+ // else we need to create a new listener
+ final EventListenerDescriptor descriptor = new EventListenerDescriptor();
+ descriptor.listenerClass = listenerClass;
+ descriptor.listenerMethodName = listenerMethodName;
+ descriptor.methodName = methodName;
+ try {
+ final List<Method> listenerMethods = Arrays.asList(listenerClass.getMethods());
+ Method listenerMethod = null;
+ if (listenerMethodName != null) {
+ for (Method listenerMethod1 : listenerMethods) {
+ if ((listenerMethod1).getName().equals(listenerMethodName)) {
+ listenerMethod = listenerMethod1;
+ break;
+ }
+ }
+ }
+ if (listenerMethodName != null && listenerMethod == null) {
+ throw new IllegalArgumentException("no method named " + listenerMethodName + " found in class " + listenerClass.getName());
+ }
+ Class<?>[] parameterTypes = listenerMethods.get(0).getParameterTypes();
+ Class<?> methodContainerClass = methodContainer.getClass();
+ final Method targetMethod = methodContainerClass.getMethod(methodName, parameterTypes);
+ descriptor.eventListener = Proxy.newProxyInstance(listenerClass.getClassLoader(),
+ new Class<?>[]{listenerClass},
+ new InvocationHandler() {
+
+ @Override
+ public Object invoke(Object proxy, Method method, Object[] args) {
+ String methodName = method.getName();
+ if ((listenerMethodName == null && listenerMethods.contains(method)) || methodName.equals(listenerMethodName)) {
+ try {
+ targetMethod.setAccessible(true);
+ return targetMethod.invoke(methodContainer, args);
+ } catch (IllegalAccessException e) {
+ throw new RuntimeException("could not invoke on container " + methodContainer, e);
+ } catch (InvocationTargetException e) {
+ throw new RuntimeException(e);
+ }
+ }
+ if (methodName.equals("toString")) {
+ return toString();
+ }
+ if (methodName.equals("equals")) {
+ return descriptor.eventListener == args[0];
+ }
+ if (methodName.equals("hashCode")) {
+ return hashCode();
+ }
+ return null;
+ }
+ });
+ descriptors.add(descriptor);
+ return (E) descriptor.eventListener;
+ } catch (NoSuchMethodException e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+ public static <E extends EventListener> E getEventListener(Class<E> listenerClass, final Object methodContainer, final String methodName) {
+ return getEventListener(listenerClass, null, methodContainer, methodName);
+ }
+
+ public static DataBindingUpdateListener getDataBindingUpdateListener(JAXXObject object, String bindingName) {
+ WeakReference<List<DataBindingUpdateListener>> ref = dataBindingUpdateListeners.get(object);
+ List<DataBindingUpdateListener> listeners = ref == null ? null : ref.get();
+ if (listeners == null) {
+ listeners = new ArrayList<DataBindingUpdateListener>();
+ dataBindingUpdateListeners.put(object, new WeakReference<List<DataBindingUpdateListener>>(listeners));
+ } else {
+ for (DataBindingUpdateListener listener : listeners) {
+ if (bindingName.equals(listener.getBindingName())) {
+ return listener;
+ }
+ }
+ }
+ DataBindingUpdateListener listener = new DataBindingUpdateListener(object, bindingName);
+ listeners.add(listener);
+ return listener;
+ }
+
+// public static void setComponentWidth(Component component, int width) {
+// component.setSize(width, component.getHeight());
+// if (component instanceof JComponent) {
+// JComponent jcomponent = (JComponent) component;
+// jcomponent.setPreferredSize(new Dimension(width, jcomponent.getPreferredSize().height));
+// jcomponent.setMinimumSize(new Dimension(width, jcomponent.getPreferredSize().height));
+// if (jcomponent.isDisplayable()) {
+// jcomponent.revalidate();
+// }
+// }
+// }
+
+// public static void setComponentHeight(Component component, int height) {
+// component.setSize(component.getWidth(), height);
+// if (component instanceof JComponent) {
+// JComponent jcomponent = (JComponent) component;
+// jcomponent.setPreferredSize(new Dimension(jcomponent.getPreferredSize().width, height));
+// jcomponent.setMinimumSize(new Dimension(jcomponent.getPreferredSize().width, height));
+// if (jcomponent.isDisplayable()) {
+// jcomponent.revalidate();
+// }
+// }
+// }
+
+ public static boolean assignment(boolean value, String name, JAXXObject src) {
+ src.firePropertyChange(name.trim(), null, "dummy value");
+ return value;
+ }
+
+ public static byte assignment(byte value, String name, JAXXObject src) {
+ src.firePropertyChange(name.trim(), null, "dummy value");
+ return value;
+ }
+
+ public static short assignment(short value, String name, JAXXObject src) {
+ src.firePropertyChange(name.trim(), null, "dummy value");
+ return value;
+ }
+
+ public static int assignment(int value, String name, JAXXObject src) {
+ src.firePropertyChange(name.trim(), null, "dummy value");
+ return value;
+ }
+
+ public static long assignment(long value, String name, JAXXObject src) {
+ src.firePropertyChange(name.trim(), null, "dummy value");
+ return value;
+ }
+
+ public static float assignment(float value, String name, JAXXObject src) {
+ src.firePropertyChange(name.trim(), null, "dummy value");
+ return value;
+ }
+
+ public static double assignment(double value, String name, JAXXObject src) {
+ src.firePropertyChange(name.trim(), null, "dummy value");
+ return value;
+ }
+
+ public static char assignment(char value, String name, JAXXObject src) {
+ src.firePropertyChange(name.trim(), null, "dummy value");
+ return value;
+ }
+
+ public static java.lang.Object assignment(java.lang.Object value, String name, JAXXObject src) {
+ src.firePropertyChange(name.trim(), null, "dummy value");
+ return value;
+ }
+
+ /**
+ * Compute the string representation of an object.
+ * <p/>
+ * Return empty string if given object is null
+ *
+ * @param value the value to write
+ * @return the string representation of the given object or an empty string if object is null.
+ */
+ public static String getStringValue(Object value) {
+ String result;
+ result = value == null ? "" : value.toString();
+ return result;
+ }
+
+ /**
+ * Test if a type of entry exists in a given context and throw an IllegalArgumentException if not found.
+ * <p/>
+ * If entry is found, return his value in context.
+ *
+ * @param <T> the type of required data
+ * @param context the context to test
+ * @param def the definition of the entry to seek in context
+ * @return the value from the context
+ * @throws IllegalArgumentException if the entry is not found in context.
+ */
+ public static <T> T checkJAXXContextEntry(JAXXContext context, JAXXContextEntryDef<T> def) throws IllegalArgumentException {
+
+ T value = def.getContextValue(context);
+
+ if (value == null) {
+ throw new IllegalArgumentException("the context entry [" + def + "] ] was not found in context " + context);
+ }
+
+ return value;
+ }
+
+ /**
+ * Convinient method to apply more than one binding on a JAXX ui.
+ *
+ * @param src the ui to treate
+ * @param bindings the list of binding to process.
+ */
+ public static void applyDataBinding(JAXXObject src, String... bindings) {
+ for (String binding : bindings) {
+ src.applyDataBinding(binding);
+ }
+ }
+ /**
+ * Convinient method to apply more than one binding on a JAXX ui.
+ *
+ * @param src the ui to treate
+ * @param bindings the list of binding to process.
+ */
+ public static void applyDataBinding(JAXXObject src, Collection<String> bindings) {
+ for (String binding : bindings) {
+ src.applyDataBinding(binding);
+ }
+ }
+
+ /**
+ * Convinient method to process more than one binding on a JAXX ui.
+ *
+ * @param src the ui to treate
+ * @param bindings the list of binding to process.
+ */
+ public static void processDataBinding(JAXXObject src, String... bindings) {
+ for (String binding : bindings) {
+ src.processDataBinding(binding);
+ }
+ }
+
+ /**
+ * Convinient method to remove more than one binding on a JAXX ui.
+ *
+ * @param src the ui to treate
+ * @param bindings the list of binding to process.
+ */
+ public static void removeDataBinding(JAXXObject src, String... bindings) {
+ for (String binding : bindings) {
+ src.removeDataBinding(binding);
+ }
+ }
+
+// public static ImageIcon createIcon(String path) {
+// java.net.URL imgURL = Util.class.getResource(path);
+// if (imgURL != null) {
+// return new ImageIcon(imgURL);
+// } else {
+// throw new IllegalArgumentException("could not find icon " + path);
+// }
+// }
+
+// /**
+// * @param path the location of icons in root directory icons
+// * @return the icon at {@link #getIconPath()}+path
+// */
+// public static ImageIcon createImageIcon(String path) {
+// String iconPath = getIconPath();
+// return createIcon(iconPath + path);
+// }
+//
+// /**
+// * @param key the key of the icon to retreave from {@link UIManager}
+// * @return the icon, or <code>null if no icon found in {@link UIManager}
+// */
+// public static Icon getUIManagerIcon(String key) {
+// return UIManager.getIcon(key);
+// }
+//
+// /**
+// * retreave for the {@link UIManager} the icon prefixed by <code>action.</code>
+// *
+// * @param key the key of the action icon to retreave from {@link UIManager}
+// * @return the icon, or <code>null if no icon found in {@link UIManager}
+// */
+// public static Icon getUIManagerActionIcon(String key) {
+// return getUIManagerIcon("action." + key);
+// }
+//
+// public static ImageIcon createActionIcon(String name) {
+// String iconPath = getIconPath();
+// return createIcon(iconPath + "action-" + name + ".png");
+// }
+//
+// public static ImageIcon createI18nIcon(String name) {
+// String iconPath = getIconPath();
+// return createIcon(iconPath + "i18n/" + name + ".png");
+// }
+
+ /**
+ * detects all PropertychangedListener added by Jaxx uis
+ * (should be a {@link DataBindingListener}
+ *
+ * @param propertyNames the array of property names to find
+ * @param listeners the array of listeners to filter
+ * @return the filtered listeners
+ */
+ public static PropertyChangeListener[] findJaxxPropertyChangeListener(String[] propertyNames, PropertyChangeListener... listeners) {
+ if (listeners == null || listeners.length == 0) {
+ return new PropertyChangeListener[0];
+ }
+ List<String> pNames = Arrays.asList(propertyNames);
+
+ List<PropertyChangeListener> toRemove = new ArrayList<PropertyChangeListener>();
+
+ for (PropertyChangeListener listener : listeners) {
+ String pName = null;
+ PropertyChangeListenerProxy plistener = null;
+ if (listener instanceof PropertyChangeListenerProxy) {
+ plistener = (PropertyChangeListenerProxy) listener;
+ if (!pNames.contains(plistener.getPropertyName())) {
+ // not on the good property
+ continue;
+ }
+ listener = (PropertyChangeListener) plistener.getListener();
+ pName = plistener.getPropertyName();
+ }
+ if (plistener != null && pName != null && listener instanceof DataBindingListener) {
+ if (log.isDebugEnabled()) {
+ log.debug("find config listener to remove [" + pName + "] : " + listener);
+ }
+ toRemove.add(plistener);
+ //toRemove.add(listener);
+ }
+ }
+ return toRemove.toArray(new PropertyChangeListener[toRemove.size()]);
+ }
+
+// private static String getIconPath() {
+// String iconPath = UIManager.getString(DEFAULT_ICON_PATH_PROPERTY);
+// if (iconPath == null) {
+// iconPath = DEFAULT_ICON_PATH;
+// } else {
+// if (!iconPath.endsWith("/")) {
+// iconPath += "/";
+// }
+// }
+// return iconPath;
+// }
+}
Modified: trunk/jaxx-runtime/src/main/java/jaxx/runtime/context/DataContext.java
===================================================================
--- trunk/jaxx-runtime/src/main/java/jaxx/runtime/context/DataContext.java 2010-01-29 15:18:50 UTC (rev 1723)
+++ trunk/jaxx-runtime/src/main/java/jaxx/runtime/context/DataContext.java 2010-01-29 15:49:15 UTC (rev 1724)
@@ -21,7 +21,7 @@
package jaxx.runtime.context;
import jaxx.runtime.JAXXContext;
-import jaxx.runtime.JAXXUtil;
+import jaxx.runtime.Util;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -248,7 +248,7 @@
}
public void removeJaxxPropertyChangeListener() {
- PropertyChangeListener[] toRemove = JAXXUtil.findJaxxPropertyChangeListener(DEFAULT_JAXX_PCS, getPropertyChangeListeners());
+ PropertyChangeListener[] toRemove = Util.findJaxxPropertyChangeListener(DEFAULT_JAXX_PCS, getPropertyChangeListeners());
if (toRemove == null || toRemove.length == 0) {
return;
}
Modified: trunk/jaxx-runtime/src/main/java/jaxx/runtime/context/DefaultJAXXContext.java
===================================================================
--- trunk/jaxx-runtime/src/main/java/jaxx/runtime/context/DefaultJAXXContext.java 2010-01-29 15:18:50 UTC (rev 1723)
+++ trunk/jaxx-runtime/src/main/java/jaxx/runtime/context/DefaultJAXXContext.java 2010-01-29 15:49:15 UTC (rev 1724)
@@ -22,7 +22,7 @@
import jaxx.runtime.JAXXContext;
import jaxx.runtime.JAXXObject;
-import jaxx.runtime.JAXXUtil;
+import jaxx.runtime.Util;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -47,7 +47,7 @@
/**
* entry of the parent context
*/
- protected static final JAXXContextEntryDef<JAXXContext> PARENT_CONTEXT_ENTRY = JAXXUtil.newContextEntryDef(JAXXContext.class);
+ protected static final JAXXContextEntryDef<JAXXContext> PARENT_CONTEXT_ENTRY = Util.newContextEntryDef(JAXXContext.class);
/**
* Logger
*/
@@ -194,7 +194,7 @@
// }
protected JAXXContextEntryDef<?> getKey(String name, Class<?> klass) {
- return JAXXUtil.newContextEntryDef(name, klass);
+ return Util.newContextEntryDef(name, klass);
}
@SuppressWarnings({"unchecked"})
Modified: trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation/NavigationTreeContextHelper.java
===================================================================
--- trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation/NavigationTreeContextHelper.java 2010-01-29 15:18:50 UTC (rev 1723)
+++ trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation/NavigationTreeContextHelper.java 2010-01-29 15:49:15 UTC (rev 1724)
@@ -23,7 +23,7 @@
import javax.swing.JTree;
import jaxx.runtime.JAXXContext;
-import jaxx.runtime.JAXXUtil;
+import jaxx.runtime.Util;
import jaxx.runtime.context.JAXXContextEntryDef;
/**
@@ -71,13 +71,13 @@
public NavigationTreeContextHelper(String prefix) {
this.prefix = prefix;
- treeContextEntry = JAXXUtil.newContextEntryDef(prefix + "-tree", JTree.class);
- treeModelContextEntry = JAXXUtil.newContextEntryDef(prefix + "-tree-model", NavigationTreeModel.class);
- treeHandlerContextEntry = JAXXUtil.newContextEntryDef(prefix + "-tree-handler", NavigationTreeHandler.class);
- selectedBeanContextEntry = JAXXUtil.newContextEntryDef(prefix + "-selected-bean", Object.class);
- selectedNodeContextEntry = JAXXUtil.newContextEntryDef(prefix + "-selected-node", NavigationTreeNode.class);
- selectedPathContextEntry = JAXXUtil.newContextEntryDef(prefix + "-selected-path", String.class);
-// selectedUIContextEntry = JAXXUtil.newContextEntryDef(prefix + "-selected-ui", Component.class);
+ treeContextEntry = Util.newContextEntryDef(prefix + "-tree", JTree.class);
+ treeModelContextEntry = Util.newContextEntryDef(prefix + "-tree-model", NavigationTreeModel.class);
+ treeHandlerContextEntry = Util.newContextEntryDef(prefix + "-tree-handler", NavigationTreeHandler.class);
+ selectedBeanContextEntry = Util.newContextEntryDef(prefix + "-selected-bean", Object.class);
+ selectedNodeContextEntry = Util.newContextEntryDef(prefix + "-selected-node", NavigationTreeNode.class);
+ selectedPathContextEntry = Util.newContextEntryDef(prefix + "-selected-path", String.class);
+// selectedUIContextEntry = Util.newContextEntryDef(prefix + "-selected-ui", Component.class);
}
public String getPrefix() {
Modified: trunk/jaxx-runtime/src/test/java/jaxx/runtime/UtilTest.java
===================================================================
--- trunk/jaxx-runtime/src/test/java/jaxx/runtime/UtilTest.java 2010-01-29 15:18:50 UTC (rev 1723)
+++ trunk/jaxx-runtime/src/test/java/jaxx/runtime/UtilTest.java 2010-01-29 15:49:15 UTC (rev 1724)
@@ -33,10 +33,10 @@
@Test
public void testGetEventListener() {
count = 0;
- DocumentListener listener = (DocumentListener) JAXXUtil.getEventListener(javax.swing.event.DocumentListener.class, this, "incCount");
+ DocumentListener listener = (DocumentListener) Util.getEventListener(javax.swing.event.DocumentListener.class, this, "incCount");
listener.insertUpdate(null);
Assert.assertEquals(count, 1);
- DocumentListener listener2 = (DocumentListener) JAXXUtil.getEventListener(javax.swing.event.DocumentListener.class, this, "incCount");
+ DocumentListener listener2 = (DocumentListener) Util.getEventListener(javax.swing.event.DocumentListener.class, this, "incCount");
listener2.removeUpdate(null);
Assert.assertEquals(count, 2);
//assertTrue("Received two different event listeners despite using identical parameters", listener == listener2);
Modified: trunk/jaxx-runtime/src/test/java/jaxx/runtime/swing/navigation/NavigationTreeModelTest.java
===================================================================
--- trunk/jaxx-runtime/src/test/java/jaxx/runtime/swing/navigation/NavigationTreeModelTest.java 2010-01-29 15:18:50 UTC (rev 1723)
+++ trunk/jaxx-runtime/src/test/java/jaxx/runtime/swing/navigation/NavigationTreeModelTest.java 2010-01-29 15:49:15 UTC (rev 1724)
@@ -20,7 +20,7 @@
*/
package jaxx.runtime.swing.navigation;
-import jaxx.runtime.JAXXUtil;
+import jaxx.runtime.Util;
import jaxx.runtime.context.DefaultJAXXContext;
import jaxx.runtime.JAXXContext;
import org.junit.Assert;
@@ -164,10 +164,10 @@
NavigationTreeNode sonSonNode;
NavigationTreeNode sonSonSonNode;
- builder.build(rootNode, (String) null, JAXXUtil.newContextEntryDef("name", String.class), "name", null, null);
- builder.build(rootNode, (String) null, JAXXUtil.newContextEntryDef("name2", String.class), "name2", null, null);
+ builder.build(rootNode, (String) null, Util.newContextEntryDef("name", String.class), "name", null, null);
+ builder.build(rootNode, (String) null, Util.newContextEntryDef("name2", String.class), "name2", null, null);
- sonNode = builder.build(rootNode, (String) null, JAXXUtil.newContextEntryDef(Model.class), "model", null, null);
+ sonNode = builder.build(rootNode, (String) null, Util.newContextEntryDef(Model.class), "model", null, null);
builder.build(sonNode, (String) null, "../name", "name", null, null);
builder.build(sonNode, (String) null, "../integerValue", "integerValue", null, null);
@@ -286,7 +286,7 @@
NavigationTreeNode sonSonSonNode;
// first son is a list of models
- sonNode = builder.build(rootNode, (String) null, JAXXUtil.newListContextEntryDef("models"), "models", null, null);
+ sonNode = builder.build(rootNode, (String) null, Util.newListContextEntryDef("models"), "models", null, null);
// first son son is a model
sonSonNode = builder.build(sonNode, (String) null, "..[1]", "0", null, null);
Modified: trunk/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/plugin/Bug1750Test.java
===================================================================
--- trunk/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/plugin/Bug1750Test.java 2010-01-29 15:18:50 UTC (rev 1723)
+++ trunk/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/plugin/Bug1750Test.java 2010-01-29 15:49:15 UTC (rev 1724)
@@ -23,7 +23,7 @@
import jaxx.runtime.Base64Coder;
import jaxx.compiler.JAXXCompiler;
import jaxx.runtime.JAXXObjectDescriptor;
-import jaxx.runtime.JAXXUtil;
+import jaxx.runtime.Util;
import org.junit.Test;
import static org.junit.Assert.*;
@@ -48,7 +48,7 @@
assertNotNull(descriptor2);
assertEquals(descriptor.toString(), descriptor2.toString());
- descriptor2 = JAXXUtil.decodeJAXXObjectDescriptor(data);
+ descriptor2 = Util.decodeJAXXObjectDescriptor(data);
assertNotNull(descriptor2);
assertEquals(descriptor.toString(), descriptor2.toString());
@@ -58,7 +58,7 @@
assertNotNull(descriptor2);
assertEquals(descriptor.toString(), descriptor2.toString());
- descriptor2 = JAXXUtil.decodeCompressedJAXXObjectDescriptor(data);
+ descriptor2 = Util.decodeCompressedJAXXObjectDescriptor(data);
assertNotNull(descriptor2);
assertEquals(descriptor.toString(), descriptor2.toString());
Modified: trunk/src/site/rst/BeanValidator.rst
===================================================================
--- trunk/src/site/rst/BeanValidator.rst 2010-01-29 15:18:50 UTC (rev 1723)
+++ trunk/src/site/rst/BeanValidator.rst 2010-01-29 15:49:15 UTC (rev 1724)
@@ -170,7 +170,7 @@
::
- jaxx.runtime.JAXXUtil.convert(validator,"nomDeLaPropriété",widget.getText(),TypeDeLaProriete.class);
+ jaxx.runtime.Util.convert(validator,"nomDeLaPropriété",widget.getText(),TypeDeLaProriete.class);
On obtiendra si une erreur de conversion intervient, une erreur dont le libellé est de la forme *error.convertor.XXX*
1
0