Buix-commits
Threads by month
- ----- 2026 -----
- August
- July
- 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
- 1440 discussions
r1536 - trunk/guix-compiler-swing/src/main/java/org/nuiton/guix/generator
by kmorin@users.labs.libre-entreprise.org July 28, 2009
by kmorin@users.labs.libre-entreprise.org July 28, 2009
July 28, 2009
Author: kmorin
Date: 2009-07-28 12:38:42 +0200 (Tue, 28 Jul 2009)
New Revision: 1536
Modified:
trunk/guix-compiler-swing/src/main/java/org/nuiton/guix/generator/SwingGenerator.java
Log:
Correction after the last failed build
Modified: trunk/guix-compiler-swing/src/main/java/org/nuiton/guix/generator/SwingGenerator.java
===================================================================
--- trunk/guix-compiler-swing/src/main/java/org/nuiton/guix/generator/SwingGenerator.java 2009-07-28 10:38:31 UTC (rev 1535)
+++ trunk/guix-compiler-swing/src/main/java/org/nuiton/guix/generator/SwingGenerator.java 2009-07-28 10:38:42 UTC (rev 1536)
@@ -96,23 +96,32 @@
return jf;
}
- catch (IllegalArgumentException ex) {
- log.error(ex);
+ catch (IllegalArgumentException eee) {
+ if(log.isErrorEnabled()) {
+ log.error(eee);
+ }
}
- catch (IllegalStateException ex) {
- log.error(ex);
+ catch (IllegalStateException eee) {
+ if(log.isErrorEnabled()) {
+ log.error(eee);
+ }
}
- catch (IOException ex) {
- log.error(ex);
+ catch (IOException eee) {
+ if(log.isErrorEnabled()) {
+ log.error(eee);
+ }
}
}
else if (log.isWarnEnabled()) {
log.warn(gmo.getClassDescriptor().getName() + " has already been generated and is up to date.");
}
}
- finally {
- return null;
+ catch(Exception eee) {
+ if(log.isErrorEnabled()) {
+ log.error(eee);
+ }
}
+ return null;
}
@Override
@@ -407,6 +416,7 @@
result.addAll(generateBindings(dbCreation, dbDeletion, th, nextFile, nextClazz, binding, i+1, alreadyChecked, methodToInvoke, generatedFiles));
}
if(listener == null) {
+ log.error("Unable to find the right listener");
return null;
}
if(!result.contains(listener)) {
1
0
r1535 - trunk/guix-compiler-gwt/src/main/java/org/nuiton/guix/generator
by kmorin@users.labs.libre-entreprise.org July 28, 2009
by kmorin@users.labs.libre-entreprise.org July 28, 2009
July 28, 2009
Author: kmorin
Date: 2009-07-28 12:38:31 +0200 (Tue, 28 Jul 2009)
New Revision: 1535
Modified:
trunk/guix-compiler-gwt/src/main/java/org/nuiton/guix/generator/GwtGenerator.java
Log:
Correction after the last failed build
Modified: trunk/guix-compiler-gwt/src/main/java/org/nuiton/guix/generator/GwtGenerator.java
===================================================================
--- trunk/guix-compiler-gwt/src/main/java/org/nuiton/guix/generator/GwtGenerator.java 2009-07-28 10:02:13 UTC (rev 1534)
+++ trunk/guix-compiler-gwt/src/main/java/org/nuiton/guix/generator/GwtGenerator.java 2009-07-28 10:38:31 UTC (rev 1535)
@@ -125,23 +125,33 @@
return jf;
}
- catch (IllegalArgumentException ex) {
- log.error(ex);
+ catch (IllegalArgumentException eee) {
+ if(log.isErrorEnabled()) {
+ log.error(eee);
+ }
}
- catch (IllegalStateException ex) {
- log.error(ex);
+ catch (IllegalStateException eee) {
+ if(log.isErrorEnabled()) {
+ log.error(eee);
+ }
}
- catch (IOException ex) {
- log.error(ex);
+ catch (IOException eee) {
+ if(log.isErrorEnabled()) {
+ log.error(eee);
+ }
}
}
else if (log.isWarnEnabled()) {
log.warn(gmo.getClassDescriptor().getName() + " has already been generated and is up to date.");
}
}
- finally {
- return null;
+ catch(Exception eee) {
+ if(log.isErrorEnabled()) {
+ log.error(eee);
+ }
}
+
+ return null;
}
@Override
1
0
r1534 - in trunk/guix-compiler-swing/src: main/java/org/nuiton/guix/generator test/java/org/nuiton/guix test/java/org/nuiton/guix/generator
by kmorin@users.labs.libre-entreprise.org July 28, 2009
by kmorin@users.labs.libre-entreprise.org July 28, 2009
July 28, 2009
Author: kmorin
Date: 2009-07-28 12:02:13 +0200 (Tue, 28 Jul 2009)
New Revision: 1534
Added:
trunk/guix-compiler-swing/src/test/java/org/nuiton/guix/generator/
trunk/guix-compiler-swing/src/test/java/org/nuiton/guix/generator/SwingGeneratorTest.java
Modified:
trunk/guix-compiler-swing/src/main/java/org/nuiton/guix/generator/SwingGenerator.java
trunk/guix-compiler-swing/src/test/java/org/nuiton/guix/SwingEventHandlerTest.java
Log:
add not null conditions + tests for the binding generation
Modified: trunk/guix-compiler-swing/src/main/java/org/nuiton/guix/generator/SwingGenerator.java
===================================================================
--- trunk/guix-compiler-swing/src/main/java/org/nuiton/guix/generator/SwingGenerator.java 2009-07-28 10:02:01 UTC (rev 1533)
+++ trunk/guix-compiler-swing/src/main/java/org/nuiton/guix/generator/SwingGenerator.java 2009-07-28 10:02:13 UTC (rev 1534)
@@ -50,65 +50,69 @@
*/
@Override
public JavaFile generate() {
- String gmoClassName = gmo.getClassDescriptor().getName();
- File out = new File(destDir, gmoClassName + ".java");
- File outAbstract = new File(destDir, gmoClassName + "Abstract.java");
- File outImpl = new File(destDir, gmoClassName + "Impl.java");
+ try {
+ String gmoClassName = gmo.getClassDescriptor().getName();
+ File out = new File(destDir, gmoClassName + ".java");
+ File outAbstract = new File(destDir, gmoClassName + "Abstract.java");
+ File outImpl = new File(destDir, gmoClassName + "Impl.java");
- if (lastModification > out.lastModified()) {
- try {
- if (log.isInfoEnabled()) {
- log.info("Generation of " + gmo.getClassDescriptor().getName());
- }
- if (!out.exists()) {
- try {
- out.createNewFile();
- outAbstract.createNewFile();
- outImpl.createNewFile();
+ if (lastModification > out.lastModified()) {
+ try {
+ if (log.isInfoEnabled()) {
+ log.info("Generation of " + gmo.getClassDescriptor().getName());
}
- catch (IOException ex) {
- log.error(ex);
+ if (!out.exists()) {
+ try {
+ out.createNewFile();
+ outAbstract.createNewFile();
+ outImpl.createNewFile();
+ }
+ catch (IOException ex) {
+ log.error(ex);
+ }
}
- }
- SwingInterfaceGenerator sing = new SwingInterfaceGenerator(gmo, classes);
- SwingAbstractClassGenerator sacg = new SwingAbstractClassGenerator(gmo, classes);
- SwingImplementationGenerator simg = new SwingImplementationGenerator(gmo, classes);
+ SwingInterfaceGenerator sing = new SwingInterfaceGenerator(gmo, classes);
+ SwingAbstractClassGenerator sacg = new SwingAbstractClassGenerator(gmo, classes);
+ SwingImplementationGenerator simg = new SwingImplementationGenerator(gmo, classes);
- sing.generate();
- generators.put(sing, out);
- JavaFile jf = sacg.generate();
- generators.put(sacg, outAbstract);
- simg.generate();
- generators.put(simg, outImpl);
+ sing.generate();
+ generators.put(sing, out);
+ JavaFile jf = sacg.generate();
+ generators.put(sacg, outAbstract);
+ simg.generate();
+ generators.put(simg, outImpl);
- if (mainClass) {
- SwingMainClassGenerator smcg = new SwingMainClassGenerator(gmo);
- File outMain = new File(destDir, launcherName + ".java");
- smcg.generate(outMain);
- }
+ if (mainClass) {
+ SwingMainClassGenerator smcg = new SwingMainClassGenerator(gmo);
+ File outMain = new File(destDir, launcherName + ".java");
+ smcg.generate(outMain);
+ }
- serializer.startTag("", "bean");
- serializer.attribute("", "id", gmoClassName.replace(out.getName().charAt(0),
- Character.toLowerCase(out.getName().charAt(0)))).attribute("", "class", gmoClassName + "Impl").attribute("", "singleton", "false").endTag("", "bean");
+ serializer.startTag("", "bean");
+ serializer.attribute("", "id", gmoClassName.replace(out.getName().charAt(0),
+ Character.toLowerCase(out.getName().charAt(0)))).attribute("", "class", gmoClassName + "Impl").attribute("", "singleton", "false").endTag("", "bean");
- setBindingsToGenerate(sacg.getBindings2Generate());
+ setBindingsToGenerate(sacg.getBindings2Generate());
- return jf;
+ return jf;
+ }
+ catch (IllegalArgumentException ex) {
+ log.error(ex);
+ }
+ catch (IllegalStateException ex) {
+ log.error(ex);
+ }
+ catch (IOException ex) {
+ log.error(ex);
+ }
}
- catch (IllegalArgumentException ex) {
- log.error(ex);
+ else if (log.isWarnEnabled()) {
+ log.warn(gmo.getClassDescriptor().getName() + " has already been generated and is up to date.");
}
- catch (IllegalStateException ex) {
- log.error(ex);
- }
- catch (IOException ex) {
- log.error(ex);
- }
}
- else if (log.isWarnEnabled()) {
- log.warn(gmo.getClassDescriptor().getName() + " has already been generated and is up to date.");
+ finally {
+ return null;
}
- return null;
}
@Override
@@ -121,6 +125,10 @@
@Override
public List<Class> generateBindings(StringBuffer dbCreation, StringBuffer dbDeletion, TagHandler prevTh, JavaFile jf, Class clazz,
String[] binding, int i, List<String> alreadyChecked, String methodToInvoke, Map<GuixGenerator,JavaFile> generatedFiles) {
+ if(dbCreation == null || dbDeletion == null || binding == null || (jf == null && clazz ==null)
+ || methodToInvoke == null || generatedFiles == null || i < 0) {
+ return null;
+ }
//does the attribute or method to bind exists ?
boolean bindingExists = false;
//the return type of the binding
@@ -393,12 +401,20 @@
alreadyChecked = new ArrayList<String>();
}
alreadyChecked.add(getter);
- //if it is not the last element of the binding
- if(i + 1 < binding.length) {
- result.addAll(generateBindings(dbCreation, dbDeletion, th, nextFile, nextClazz, binding, i+1, alreadyChecked, methodToInvoke, generatedFiles));
+ try {
+ //if it is not the last element of the binding
+ if(i + 1 < binding.length) {
+ result.addAll(generateBindings(dbCreation, dbDeletion, th, nextFile, nextClazz, binding, i+1, alreadyChecked, methodToInvoke, generatedFiles));
+ }
+ if(listener == null) {
+ return null;
+ }
+ if(!result.contains(listener)) {
+ result.add(listener);
+ }
}
- if(!result.contains(listener)) {
- result.add(listener);
+ catch(NullPointerException eee) {
+ return null;
}
}
else if(log.isErrorEnabled()) {
Modified: trunk/guix-compiler-swing/src/test/java/org/nuiton/guix/SwingEventHandlerTest.java
===================================================================
--- trunk/guix-compiler-swing/src/test/java/org/nuiton/guix/SwingEventHandlerTest.java 2009-07-28 10:02:01 UTC (rev 1533)
+++ trunk/guix-compiler-swing/src/test/java/org/nuiton/guix/SwingEventHandlerTest.java 2009-07-28 10:02:13 UTC (rev 1534)
@@ -35,6 +35,7 @@
*/
public class SwingEventHandlerTest {
+ /** log */
Log log = LogFactory.getLog(SwingEventHandlerTest.class);
/**
@@ -44,11 +45,15 @@
public void testAddEvent() {
SwingEventHandler seh = new SwingEventHandler();
try {
+ //null parameters return false
assertFalse(seh.addEvent(null, "", ""));
assertFalse(seh.addEvent(JComponent.class, null, ""));
assertFalse(seh.addEvent(JComponent.class, "", null));
+ //tests a basic adding
assertTrue(seh.addEvent(JComponent.class, "propertyChange", "test1"));
+ //tests the adding of some different code for the same event
assertTrue(seh.addEvent(JComponent.class, "propertyChange", "test2"));
+ //tests an unknown event
assertFalse(seh.addEvent(JComponent.class, "azerty", ""));
}
catch (IntrospectionException eee) {
@@ -65,10 +70,19 @@
public void testGenerate() {
SwingEventHandler seh = new SwingEventHandler();
try {
+ //tests a basic generation without any added event
+ assertNotNull(seh.generate("object"));
assertNotNull(seh.generate(""));
+ assertNotNull(seh.generate(null));
+ assertEquals(seh.generate("object"), "");
assertEquals(seh.generate(""), "");
+ assertEquals(seh.generate(null), "");
+ //adds an event
seh.addEvent(JComponent.class, "propertyChange", "");
+ //tests that something is generated
+ assertTrue(seh.generate("object").length() > 0);
assertTrue(seh.generate("").length() > 0);
+ assertTrue(seh.generate(null).length() > 0);
}
catch (IntrospectionException eee) {
if(log.isErrorEnabled()) {
Added: trunk/guix-compiler-swing/src/test/java/org/nuiton/guix/generator/SwingGeneratorTest.java
===================================================================
--- trunk/guix-compiler-swing/src/test/java/org/nuiton/guix/generator/SwingGeneratorTest.java (rev 0)
+++ trunk/guix-compiler-swing/src/test/java/org/nuiton/guix/generator/SwingGeneratorTest.java 2009-07-28 10:02:13 UTC (rev 1534)
@@ -0,0 +1,144 @@
+/**
+ * *##% guix-compiler-gwt
+ * Copyright (C) 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 org.nuiton.guix.generator;
+
+import java.beans.PropertyChangeListener;
+import java.lang.reflect.Modifier;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import javax.swing.JToggleButton;
+import javax.swing.event.ChangeListener;
+import org.junit.Assert;
+import org.junit.Test;
+import org.nuiton.guix.SwingGuixInitializer;
+import org.nuiton.guix.tags.swing.ToggleButtonHandler;
+
+/**
+ *
+ * @author kmorin
+ */
+public class SwingGeneratorTest {
+ @Test
+ public void testGenerate() {
+ SwingGenerator sg = new SwingGenerator();
+ Assert.assertNull(sg.generate());
+ }
+
+ @Test
+ public void testGenerateBinding() {
+ SwingGuixInitializer.initialize();
+ SwingGenerator sg = new SwingGenerator();
+ //tests the not null condition for the parameters that needs to be not null
+ Assert.assertNull(sg.generateBindings(null, new StringBuffer(), null, null, Class.class, new String[0], 0, null, "", new HashMap<GuixGenerator, JavaFile>()));
+ Assert.assertNull(sg.generateBindings(new StringBuffer(), null, null, null, Class.class, new String[0], 0, null, "", new HashMap<GuixGenerator, JavaFile>()));
+ Assert.assertNull(sg.generateBindings(new StringBuffer(), new StringBuffer(), null, null, Class.class, null, 0, null, "", new HashMap<GuixGenerator, JavaFile>()));
+ Assert.assertNull(sg.generateBindings(new StringBuffer(), new StringBuffer(), null, null, Class.class, new String[0], -1, null, "", new HashMap<GuixGenerator, JavaFile>()));
+ Assert.assertNull(sg.generateBindings(new StringBuffer(), new StringBuffer(), null, null, Class.class, new String[0], -1, null, "", new HashMap<GuixGenerator, JavaFile>()));
+ Assert.assertNull(sg.generateBindings(new StringBuffer(), new StringBuffer(), null, null, Class.class, new String[0], 0, null, null, new HashMap<GuixGenerator, JavaFile>()));
+ Assert.assertNull(sg.generateBindings(new StringBuffer(), new StringBuffer(), null, null, Class.class, new String[0], 0, null, "", null));
+ Assert.assertNull(sg.generateBindings(new StringBuffer(), new StringBuffer(), null, null, null, new String[0], 0, null, "", new HashMap<GuixGenerator, JavaFile>()));
+
+ //tests with a class parameter not null
+ //tests without TagHandlers
+ List<Class> l = sg.generateBindings(new StringBuffer(), new StringBuffer(), null, null, JToggleButton.class, new String[]{"isSelected()"}, 0, null, "", new HashMap<GuixGenerator, JavaFile>());
+ Assert.assertNotNull(l);
+ Assert.assertEquals(l.size(), 1);
+ Assert.assertNotNull(l.get(0));
+ Assert.assertEquals(l.get(0), PropertyChangeListener.class);
+ //tests a successful generation with a method as a binding
+ l = sg.generateBindings(new StringBuffer(), new StringBuffer(), new ToggleButtonHandler(), null, JToggleButton.class, new String[]{"isSelected()"}, 0, null, "", new HashMap<GuixGenerator, JavaFile>());
+ Assert.assertNotNull(l);
+ Assert.assertEquals(l.size(), 1);
+ Assert.assertNotNull(l.get(0));
+ Assert.assertEquals(l.get(0), ChangeListener.class);
+ //tests a successful generation with an attribute as a binding
+ l = sg.generateBindings(new StringBuffer(), new StringBuffer(), new ToggleButtonHandler(), null, JToggleButton.class, new String[]{"selected"}, 0, null, "", new HashMap<GuixGenerator, JavaFile>());
+ Assert.assertNotNull(l);
+ Assert.assertEquals(l.size(), 1);
+ Assert.assertNotNull(l.get(0));
+ Assert.assertEquals(l.get(0), ChangeListener.class);
+
+ //tests with a javafile parameter not null
+ //tests if the result is null without the taghandler associated to the field
+ JavaFile jf = new JavaFile();
+ jf.addField(new JavaField(Modifier.PRIVATE, "javax.swing.JToggleButton", "button", null));
+ jf.addMethod(new JavaMethod(Modifier.PUBLIC, "javax.swing.JToggleButton", "getButton", null, null, "", null));
+ l = sg.generateBindings(new StringBuffer(), new StringBuffer(), null, jf, null, new String[]{"getButton()", "isSelected()"}, 0, null, "", new HashMap<GuixGenerator, JavaFile>());
+ Assert.assertNotNull(l);
+ Assert.assertEquals(l.size(), 1);
+ Assert.assertNotNull(l.get(0));
+ Assert.assertEquals(l.get(0), PropertyChangeListener.class);
+
+ //tests a successful generation with a method as a binding
+ jf = new JavaFile();
+ jf.addField(new JavaField(Modifier.PRIVATE, "javax.swing.JToggleButton", "button", null, new ToggleButtonHandler()));
+ jf.addMethod(new JavaMethod(Modifier.PUBLIC, "javax.swing.JToggleButton", "getButton", null, null, "", null));
+ l = sg.generateBindings(new StringBuffer(), new StringBuffer(), null, jf, null, new String[]{"getButton()", "isSelected()"}, 0, null, "", new HashMap<GuixGenerator, JavaFile>());
+ Assert.assertNotNull(l);
+ Assert.assertEquals(l.size(), 2);
+ Assert.assertNotNull(l.get(0));
+ Assert.assertEquals(l.get(0), ChangeListener.class);
+ Assert.assertNotNull(l.get(1));
+ Assert.assertEquals(l.get(1), PropertyChangeListener.class);
+ //tests a successful generation with an attribute as a binding
+ l = sg.generateBindings(new StringBuffer(), new StringBuffer(), null, jf, null, new String[]{"button","selected"}, 0, null, "", new HashMap<GuixGenerator, JavaFile>());
+ Assert.assertNotNull(l);
+ Assert.assertEquals(l.size(), 2);
+ Assert.assertNotNull(l.get(0));
+ Assert.assertEquals(l.get(0), ChangeListener.class);
+ Assert.assertNotNull(l.get(1));
+ Assert.assertEquals(l.get(1), PropertyChangeListener.class);
+
+ //tests with a javafile parameter not null with an attribute whose type is another generated file
+ //tests if the result is null without the taghandler associated to the field
+ jf = new JavaFile();
+ jf.addField(new JavaField(Modifier.PRIVATE, "test.Test", "test", null));
+ jf.addMethod(new JavaMethod(Modifier.PUBLIC, "test.Test", "getTest", null, null, "", null));
+ JavaFile jf2 = new JavaFile(Modifier.PUBLIC, 0, "test", "Test", null, null);
+ jf2.addField(new JavaField(Modifier.PRIVATE, "javax.swing.JToggleButton", "button", null));
+ jf2.addMethod(new JavaMethod(Modifier.PUBLIC, "javax.swing.JToggleButton", "getButton", null, null, "", null));
+ Assert.assertNull(sg.generateBindings(new StringBuffer(), new StringBuffer(), null, jf, null, new String[]{"getTest()","getButton()","isSelected()"}, 0, null, "", new HashMap<GuixGenerator, JavaFile>()));
+ //test without jf2 in the map of generators with JavaFile
+ jf2 = new JavaFile(Modifier.PUBLIC, 0, "test", "Test", null, null);
+ jf2.addField(new JavaField(Modifier.PRIVATE, "javax.swing.JToggleButton", "button", null, new ToggleButtonHandler()));
+ jf2.addMethod(new JavaMethod(Modifier.PUBLIC, "javax.swing.JToggleButton", "getButton", null, null, "", null));
+ Assert.assertNull(sg.generateBindings(new StringBuffer(), new StringBuffer(), null, jf, null, new String[]{"getTest()","getButton()","isSelected()"}, 0, null, "", new HashMap<GuixGenerator, JavaFile>()));
+ Map<GuixGenerator,JavaFile> map = new HashMap<GuixGenerator, JavaFile>();
+ map.put(sg, jf2);
+ //tests a successful generation with a method as a binding
+ l = sg.generateBindings(new StringBuffer(), new StringBuffer(), null, jf, null, new String[]{"getTest()","getButton()", "isSelected()"}, 0, null, "", map);
+ Assert.assertNotNull(l);
+ Assert.assertEquals(l.size(), 2);
+ Assert.assertNotNull(l.get(0));
+ Assert.assertEquals(l.get(0), ChangeListener.class);
+ //the PropertyChangeListener is recorded only once
+ Assert.assertNotNull(l.get(1));
+ Assert.assertEquals(l.get(1), PropertyChangeListener.class);
+ //tests a successful generation with an attribute as a binding
+ l = sg.generateBindings(new StringBuffer(), new StringBuffer(), null, jf, null, new String[]{"test","button","selected"}, 0, null, "", map);
+ Assert.assertNotNull(l);
+ Assert.assertEquals(l.size(), 2);
+ Assert.assertNotNull(l.get(0));
+ Assert.assertEquals(l.get(0), ChangeListener.class);
+ //the PropertyChangeListener is recorded only once
+ Assert.assertNotNull(l.get(1));
+ Assert.assertEquals(l.get(1), PropertyChangeListener.class);
+ }
+}
1
0
r1533 - in trunk/guix-compiler-gwt/src: main/java/org/nuiton/guix/generator test/java/org/nuiton/guix test/java/org/nuiton/guix/generator
by kmorin@users.labs.libre-entreprise.org July 28, 2009
by kmorin@users.labs.libre-entreprise.org July 28, 2009
July 28, 2009
Author: kmorin
Date: 2009-07-28 12:02:01 +0200 (Tue, 28 Jul 2009)
New Revision: 1533
Added:
trunk/guix-compiler-gwt/src/test/java/org/nuiton/guix/generator/
trunk/guix-compiler-gwt/src/test/java/org/nuiton/guix/generator/GwtGeneratorTest.java
Modified:
trunk/guix-compiler-gwt/src/main/java/org/nuiton/guix/generator/GwtGenerator.java
trunk/guix-compiler-gwt/src/main/java/org/nuiton/guix/generator/GwtJavaFileGenerator.java
trunk/guix-compiler-gwt/src/test/java/org/nuiton/guix/GwtEventHandlerTest.java
Log:
add not null conditions + tests for the binding generation
Modified: trunk/guix-compiler-gwt/src/main/java/org/nuiton/guix/generator/GwtGenerator.java
===================================================================
--- trunk/guix-compiler-gwt/src/main/java/org/nuiton/guix/generator/GwtGenerator.java 2009-07-27 12:37:53 UTC (rev 1532)
+++ trunk/guix-compiler-gwt/src/main/java/org/nuiton/guix/generator/GwtGenerator.java 2009-07-28 10:02:01 UTC (rev 1533)
@@ -49,95 +49,99 @@
@Override
public JavaFile generate() {
- String gmoClassName = gmo.getClassDescriptor().getName();
- File outDir = new File(destDir, "client");
- if (!outDir.exists()) {
- outDir.mkdir();
- }
- File out = new File(outDir, gmoClassName + ".java");
- File outAbstract = new File(outDir, gmoClassName + "Abstract.java");
- File outImpl = new File(outDir, gmoClassName + "Impl.java");
+ try {
+ String gmoClassName = gmo.getClassDescriptor().getName();
+ File outDir = new File(destDir, "client");
+ if (!outDir.exists()) {
+ outDir.mkdir();
+ }
+ File out = new File(outDir, gmoClassName + ".java");
+ File outAbstract = new File(outDir, gmoClassName + "Abstract.java");
+ File outImpl = new File(outDir, gmoClassName + "Impl.java");
- if (lastModification > out.lastModified()) {
- try {
- if (log.isInfoEnabled()) {
- log.info("Generation of " + gmo.getClassDescriptor().getName());
- }
- if (!out.exists()) {
- try {
- out.createNewFile();
- outAbstract.createNewFile();
- outImpl.createNewFile();
+ if (lastModification > out.lastModified()) {
+ try {
+ if (log.isInfoEnabled()) {
+ log.info("Generation of " + gmo.getClassDescriptor().getName());
}
- catch (IOException ex) {
- log.error(ex);
+ if (!out.exists()) {
+ try {
+ out.createNewFile();
+ outAbstract.createNewFile();
+ outImpl.createNewFile();
+ }
+ catch (IOException ex) {
+ log.error(ex);
+ }
}
- }
- GwtInterfaceGenerator ging = new GwtInterfaceGenerator(gmo, classes);
- GwtAbstractClassGenerator gacg = new GwtAbstractClassGenerator(gmo, classes);
- GwtImplementationGenerator gimg = new GwtImplementationGenerator(gmo, classes);
+ GwtInterfaceGenerator ging = new GwtInterfaceGenerator(gmo, classes);
+ GwtAbstractClassGenerator gacg = new GwtAbstractClassGenerator(gmo, classes);
+ GwtImplementationGenerator gimg = new GwtImplementationGenerator(gmo, classes);
- if (mainClass) {
- gimg.addMainMethod();
- GwtConfigGenerator gcg = new GwtConfigGenerator(gmo, getCSSFiles());
- GwtHtmlGenerator ghg = new GwtHtmlGenerator(gmo, launcherName);
- File outConfigMain = new File(destDir, launcherName.substring(launcherName.lastIndexOf('.') + 1) + ".gwt.xml");
- File publicDir = new File(destDir, "public");
- if (!publicDir.exists()) {
- publicDir.mkdir();
- }
- File outHtmlMain = new File(publicDir, launcherName.substring(launcherName.lastIndexOf('.') + 1) + ".html");
- gcg.generate(outConfigMain);
- for(File f : getCSSFiles()) {
- try {
- File fPublic = new File(publicDir, f.getName());
- fPublic.createNewFile();
- FileInputStream fis = new FileInputStream(f);
- FileOutputStream fos = new FileOutputStream(fPublic);
- // segment size : 0.5Mo
- byte buffer[] = new byte[512*1024];
- int read;
- while((read = fis.read(buffer)) != -1) {
- fos.write(buffer, 0, read);
+ if (mainClass) {
+ gimg.addMainMethod();
+ GwtConfigGenerator gcg = new GwtConfigGenerator(gmo, getCSSFiles());
+ GwtHtmlGenerator ghg = new GwtHtmlGenerator(gmo, launcherName);
+ File outConfigMain = new File(destDir, launcherName.substring(launcherName.lastIndexOf('.') + 1) + ".gwt.xml");
+ File publicDir = new File(destDir, "public");
+ if (!publicDir.exists()) {
+ publicDir.mkdir();
+ }
+ File outHtmlMain = new File(publicDir, launcherName.substring(launcherName.lastIndexOf('.') + 1) + ".html");
+ gcg.generate(outConfigMain);
+ for(File f : getCSSFiles()) {
+ try {
+ File fPublic = new File(publicDir, f.getName());
+ fPublic.createNewFile();
+ FileInputStream fis = new FileInputStream(f);
+ FileOutputStream fos = new FileOutputStream(fPublic);
+ // segment size : 0.5Mo
+ byte buffer[] = new byte[512*1024];
+ int read;
+ while((read = fis.read(buffer)) != -1) {
+ fos.write(buffer, 0, read);
+ }
+ fis.close();
+ fos.close();
}
- fis.close();
- fos.close();
+ catch(IOException eee) {
+ log.error(eee);
+ }
}
- catch(IOException eee) {
- log.error(eee);
- }
+ ghg.generate(outHtmlMain);
}
- ghg.generate(outHtmlMain);
- }
- ging.generate();
- generators.put(ging, out);
- JavaFile jf = gacg.generate();
- generators.put(gacg, outAbstract);
- gimg.generate();
- generators.put(gimg, outImpl);
+ ging.generate();
+ generators.put(ging, out);
+ JavaFile jf = gacg.generate();
+ generators.put(gacg, outAbstract);
+ gimg.generate();
+ generators.put(gimg, outImpl);
- serializer.startTag("", "bean");
- serializer.attribute("", "id", gmoClassName.replace(out.getName().charAt(0),
- Character.toLowerCase(out.getName().charAt(0)))).attribute("", "class", gmoClassName + "Impl").attribute("", "singleton", "false").endTag("", "bean");
- setBindingsToGenerate(gacg.getBindings2Generate());
+ serializer.startTag("", "bean");
+ serializer.attribute("", "id", gmoClassName.replace(out.getName().charAt(0),
+ Character.toLowerCase(out.getName().charAt(0)))).attribute("", "class", gmoClassName + "Impl").attribute("", "singleton", "false").endTag("", "bean");
+ setBindingsToGenerate(gacg.getBindings2Generate());
- return jf;
+ return jf;
+ }
+ catch (IllegalArgumentException ex) {
+ log.error(ex);
+ }
+ catch (IllegalStateException ex) {
+ log.error(ex);
+ }
+ catch (IOException ex) {
+ log.error(ex);
+ }
}
- catch (IllegalArgumentException ex) {
- log.error(ex);
+ else if (log.isWarnEnabled()) {
+ log.warn(gmo.getClassDescriptor().getName() + " has already been generated and is up to date.");
}
- catch (IllegalStateException ex) {
- log.error(ex);
- }
- catch (IOException ex) {
- log.error(ex);
- }
}
- else if (log.isWarnEnabled()) {
- log.warn(gmo.getClassDescriptor().getName() + " has already been generated and is up to date.");
+ finally {
+ return null;
}
- return null;
}
@Override
@@ -150,6 +154,11 @@
@Override
public List<Class> generateBindings(StringBuffer dbCreation, StringBuffer dbDeletion, TagHandler prevTh, JavaFile jf, Class clazz,
String[] binding, int i, List<String> alreadyChecked, String methodToInvoke, Map<GuixGenerator, JavaFile> generatedFiles) {
+ if(dbCreation == null || dbDeletion == null || binding == null || (jf == null && clazz ==null)
+ || methodToInvoke == null || generatedFiles == null || i < 0) {
+ return null;
+ }
+
//does the attribute or method to bind exists ?
boolean bindingExists = false;
//the return type of the binding
@@ -399,6 +408,9 @@
return generateBindings(dbCreation, dbDeletion, th, nextFile, nextClazz, binding, i + 1, alreadyChecked, methodToInvoke, generatedFiles);
}
else {
+ if(listener == null) {
+ return null;
+ }
result.add(listener);
return result;
}
Modified: trunk/guix-compiler-gwt/src/main/java/org/nuiton/guix/generator/GwtJavaFileGenerator.java
===================================================================
--- trunk/guix-compiler-gwt/src/main/java/org/nuiton/guix/generator/GwtJavaFileGenerator.java 2009-07-27 12:37:53 UTC (rev 1532)
+++ trunk/guix-compiler-gwt/src/main/java/org/nuiton/guix/generator/GwtJavaFileGenerator.java 2009-07-28 10:02:01 UTC (rev 1533)
@@ -44,6 +44,9 @@
* @param gmo GuixModelObject which represents the class to generate
*/
protected void addImports(GuixModelObject gmo) {
+ if(gmo == null) {
+ return;
+ }
for (GuixModelObject child : gmo.getChildren()) {
if (child.getClassDescriptor().getPackageName() == null
&& TagManager.getGuixClassHandler(child.getClassDescriptor().getName()) != null) {
Modified: trunk/guix-compiler-gwt/src/test/java/org/nuiton/guix/GwtEventHandlerTest.java
===================================================================
--- trunk/guix-compiler-gwt/src/test/java/org/nuiton/guix/GwtEventHandlerTest.java 2009-07-27 12:37:53 UTC (rev 1532)
+++ trunk/guix-compiler-gwt/src/test/java/org/nuiton/guix/GwtEventHandlerTest.java 2009-07-28 10:02:01 UTC (rev 1533)
@@ -36,6 +36,7 @@
*/
public class GwtEventHandlerTest {
+ /** log */
Log log = LogFactory.getLog(GwtEventHandlerTest.class);
/**
@@ -45,11 +46,15 @@
public void testAddEvent() {
GwtEventHandler geh = new GwtEventHandler();
try {
+ //null parameters return false
assertFalse(geh.addEvent(null, "", ""));
assertFalse(geh.addEvent(Widget.class, null, ""));
assertFalse(geh.addEvent(Widget.class, "", null));
+ //tests a basic adding
assertTrue(geh.addEvent(FocusWidget.class, "onClick", "test1"));
+ //tests the adding of some different code for the same event
assertTrue(geh.addEvent(FocusWidget.class, "onClick", "test2"));
+ //tests an unknown event
assertFalse(geh.addEvent(FocusWidget.class, "azerty", ""));
}
catch (IntrospectionException eee) {
@@ -64,12 +69,21 @@
*/
@Test
public void testGenerate() {
- GwtEventHandler seh = new GwtEventHandler();
+ GwtEventHandler geh = new GwtEventHandler();
try {
- assertNotNull(seh.generate(""));
- assertEquals(seh.generate(""), "");
- seh.addEvent(FocusWidget.class, "onClick", "");
- assertTrue(seh.generate("").length() > 0);
+ //tests a basic generation without any added event
+ assertNotNull(geh.generate("object"));
+ assertNotNull(geh.generate(""));
+ assertNotNull(geh.generate(null));
+ assertEquals(geh.generate("object"), "");
+ assertEquals(geh.generate(""), "");
+ assertEquals(geh.generate(null), "");
+ //adds an event
+ geh.addEvent(FocusWidget.class, "onClick", "test");
+ //tests that something is generated
+ assertTrue(geh.generate("object").length() > 0);
+ assertTrue(geh.generate("").length() > 0);
+ assertTrue(geh.generate(null).length() > 0);
}
catch (IntrospectionException eee) {
if(log.isErrorEnabled()) {
Added: trunk/guix-compiler-gwt/src/test/java/org/nuiton/guix/generator/GwtGeneratorTest.java
===================================================================
--- trunk/guix-compiler-gwt/src/test/java/org/nuiton/guix/generator/GwtGeneratorTest.java (rev 0)
+++ trunk/guix-compiler-gwt/src/test/java/org/nuiton/guix/generator/GwtGeneratorTest.java 2009-07-28 10:02:01 UTC (rev 1533)
@@ -0,0 +1,134 @@
+/**
+ * *##% guix-compiler-gwt
+ * Copyright (C) 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 org.nuiton.guix.generator;
+
+import org.nuiton.guix.*;
+import com.google.gwt.user.client.ui.ClickListener;
+import com.google.gwt.user.client.ui.ToggleButton;
+import java.lang.reflect.Modifier;
+import java.util.HashMap;
+import java.util.Map;
+import org.junit.Test;
+import org.nuiton.guix.generator.GwtGenerator;
+import org.junit.Assert;
+import org.nuiton.guix.generator.GuixGenerator;
+import org.nuiton.guix.generator.JavaField;
+import org.nuiton.guix.generator.JavaFile;
+import org.nuiton.guix.generator.JavaMethod;
+import org.nuiton.guix.tags.gwt.ToggleButtonHandler;
+
+/**
+ * Tests the methods of the GwtGenerator class
+ *
+ * @author kmorin
+ */
+public class GwtGeneratorTest {
+
+ @Test
+ public void testGenerate() {
+ GwtGenerator gg = new GwtGenerator();
+ Assert.assertNull(gg.generate());
+ }
+
+ @Test
+ public void testGenerateBinding() {
+ GwtGuixInitializer.initialize();
+ GwtGenerator gg = new GwtGenerator();
+ //tests the not null condition for the parameters that needs to be not null
+ Assert.assertNull(gg.generateBindings(null, new StringBuffer(), null, null, Class.class, new String[0], 0, null, "", new HashMap<GuixGenerator, JavaFile>()));
+ Assert.assertNull(gg.generateBindings(new StringBuffer(), null, null, null, Class.class, new String[0], 0, null, "", new HashMap<GuixGenerator, JavaFile>()));
+ Assert.assertNull(gg.generateBindings(new StringBuffer(), new StringBuffer(), null, null, Class.class, null, 0, null, "", new HashMap<GuixGenerator, JavaFile>()));
+ Assert.assertNull(gg.generateBindings(new StringBuffer(), new StringBuffer(), null, null, Class.class, new String[0], -1, null, "", new HashMap<GuixGenerator, JavaFile>()));
+ Assert.assertNull(gg.generateBindings(new StringBuffer(), new StringBuffer(), null, null, Class.class, new String[0], -1, null, "", new HashMap<GuixGenerator, JavaFile>()));
+ Assert.assertNull(gg.generateBindings(new StringBuffer(), new StringBuffer(), null, null, Class.class, new String[0], 0, null, null, new HashMap<GuixGenerator, JavaFile>()));
+ Assert.assertNull(gg.generateBindings(new StringBuffer(), new StringBuffer(), null, null, Class.class, new String[0], 0, null, "", null));
+ Assert.assertNull(gg.generateBindings(new StringBuffer(), new StringBuffer(), null, null, null, new String[0], 0, null, "", new HashMap<GuixGenerator, JavaFile>()));
+ //tests with a class parameter not null
+ //tests if a null listener as result returns null
+ Assert.assertNull(gg.generateBindings(new StringBuffer(), new StringBuffer(), null, null, ToggleButton.class, new String[]{"isDown()"}, 0, null, "", new HashMap<GuixGenerator, JavaFile>()));
+ //tests a successful generation with a method as a binding
+ Assert.assertNotNull(gg.generateBindings(new StringBuffer(), new StringBuffer(), new ToggleButtonHandler(), null, ToggleButton.class, new String[]{"isDown()"}, 0, null, "", new HashMap<GuixGenerator, JavaFile>()));
+ Assert.assertEquals(gg.generateBindings(new StringBuffer(), new StringBuffer(), new ToggleButtonHandler(), null, ToggleButton.class, new String[]{"isDown()"}, 0, null, "", new HashMap<GuixGenerator, JavaFile>()).size(),1);
+ Assert.assertNotNull(gg.generateBindings(new StringBuffer(), new StringBuffer(), new ToggleButtonHandler(), null, ToggleButton.class, new String[]{"isDown()"}, 0, null, "", new HashMap<GuixGenerator, JavaFile>()).get(0));
+ Assert.assertEquals(gg.generateBindings(new StringBuffer(), new StringBuffer(), new ToggleButtonHandler(), null, ToggleButton.class, new String[]{"isDown()"}, 0, null, "", new HashMap<GuixGenerator, JavaFile>()).get(0),ClickListener.class);
+ //tests a successful generation with an attribute as a binding
+ Assert.assertNotNull(gg.generateBindings(new StringBuffer(), new StringBuffer(), new ToggleButtonHandler(), null, ToggleButton.class, new String[]{"down"}, 0, null, "", new HashMap<GuixGenerator, JavaFile>()));
+ Assert.assertEquals(gg.generateBindings(new StringBuffer(), new StringBuffer(), new ToggleButtonHandler(), null, ToggleButton.class, new String[]{"down"}, 0, null, "", new HashMap<GuixGenerator, JavaFile>()).size(),1);
+ Assert.assertNotNull(gg.generateBindings(new StringBuffer(), new StringBuffer(), new ToggleButtonHandler(), null, ToggleButton.class, new String[]{"down"}, 0, null, "", new HashMap<GuixGenerator, JavaFile>()).get(0));
+ Assert.assertEquals(gg.generateBindings(new StringBuffer(), new StringBuffer(), new ToggleButtonHandler(), null, ToggleButton.class, new String[]{"down"}, 0, null, "", new HashMap<GuixGenerator, JavaFile>()).get(0),ClickListener.class);
+ //tests a successful generation with a method with the generic name as a binding
+ Assert.assertNotNull(gg.generateBindings(new StringBuffer(), new StringBuffer(), new ToggleButtonHandler(), null, ToggleButton.class, new String[]{"isSelected()"}, 0, null, "", new HashMap<GuixGenerator, JavaFile>()));
+ Assert.assertEquals(gg.generateBindings(new StringBuffer(), new StringBuffer(), new ToggleButtonHandler(), null, ToggleButton.class, new String[]{"isSelected()"}, 0, null, "", new HashMap<GuixGenerator, JavaFile>()).size(),1);
+ Assert.assertNotNull(gg.generateBindings(new StringBuffer(), new StringBuffer(), new ToggleButtonHandler(), null, ToggleButton.class, new String[]{"isSelected()"}, 0, null, "", new HashMap<GuixGenerator, JavaFile>()).get(0));
+ Assert.assertEquals(gg.generateBindings(new StringBuffer(), new StringBuffer(), new ToggleButtonHandler(), null, ToggleButton.class, new String[]{"isSelected()"}, 0, null, "", new HashMap<GuixGenerator, JavaFile>()).get(0),ClickListener.class);
+ //tests a successful generation with an attribute with the generic name as a binding
+ Assert.assertNotNull(gg.generateBindings(new StringBuffer(), new StringBuffer(), new ToggleButtonHandler(), null, ToggleButton.class, new String[]{"selected"}, 0, null, "", new HashMap<GuixGenerator, JavaFile>()));
+ Assert.assertEquals(gg.generateBindings(new StringBuffer(), new StringBuffer(), new ToggleButtonHandler(), null, ToggleButton.class, new String[]{"selected"}, 0, null, "", new HashMap<GuixGenerator, JavaFile>()).size(),1);
+ Assert.assertNotNull(gg.generateBindings(new StringBuffer(), new StringBuffer(), new ToggleButtonHandler(), null, ToggleButton.class, new String[]{"selected"}, 0, null, "", new HashMap<GuixGenerator, JavaFile>()).get(0));
+ Assert.assertEquals(gg.generateBindings(new StringBuffer(), new StringBuffer(), new ToggleButtonHandler(), null, ToggleButton.class, new String[]{"selected"}, 0, null, "", new HashMap<GuixGenerator, JavaFile>()).get(0),ClickListener.class);
+
+ //tests with a javafile parameter not null
+ //tests if the result is null without the taghandler associated to the field
+ JavaFile jf = new JavaFile();
+ jf.addField(new JavaField(Modifier.PRIVATE, "com.google.gwt.user.client.ui.ToggleButton", "button", null));
+ jf.addMethod(new JavaMethod(Modifier.PUBLIC, "com.google.gwt.user.client.ui.ToggleButton", "getButton", null, null, "", null));
+ Assert.assertNull(gg.generateBindings(new StringBuffer(), new StringBuffer(), null, jf, null, new String[]{"getButton()", "isDown()"}, 0, null, "", new HashMap<GuixGenerator, JavaFile>()));
+ //tests a successful generation with a method as a binding
+ jf = new JavaFile();
+ jf.addField(new JavaField(Modifier.PRIVATE, "com.google.gwt.user.client.ui.ToggleButton", "button", null, new ToggleButtonHandler()));
+ jf.addMethod(new JavaMethod(Modifier.PUBLIC, "com.google.gwt.user.client.ui.ToggleButton", "getButton", null, null, "", null));
+ Assert.assertNotNull(gg.generateBindings(new StringBuffer(), new StringBuffer(), null, jf, null, new String[]{"getButton()", "isDown()"}, 0, null, "", new HashMap<GuixGenerator, JavaFile>()));
+ Assert.assertEquals(gg.generateBindings(new StringBuffer(), new StringBuffer(), null, jf, null, new String[]{"getButton()", "isDown()"}, 0, null, "", new HashMap<GuixGenerator, JavaFile>()).size(),1);
+ Assert.assertNotNull(gg.generateBindings(new StringBuffer(), new StringBuffer(), null, jf, null, new String[]{"getButton()", "isDown()"}, 0, null, "", new HashMap<GuixGenerator, JavaFile>()).get(0));
+ Assert.assertEquals(gg.generateBindings(new StringBuffer(), new StringBuffer(), null, jf, null, new String[]{"getButton()", "isDown()"}, 0, null, "", new HashMap<GuixGenerator, JavaFile>()).get(0),ClickListener.class);
+ //tests a successful generation with an attribute as a binding
+ Assert.assertNotNull(gg.generateBindings(new StringBuffer(), new StringBuffer(), null, jf, null, new String[]{"button","down"}, 0, null, "", new HashMap<GuixGenerator, JavaFile>()));
+ Assert.assertEquals(gg.generateBindings(new StringBuffer(), new StringBuffer(), null, jf, null, new String[]{"button","down"}, 0, null, "", new HashMap<GuixGenerator, JavaFile>()).size(),1);
+ Assert.assertNotNull(gg.generateBindings(new StringBuffer(), new StringBuffer(), null, jf, null, new String[]{"button","down"}, 0, null, "", new HashMap<GuixGenerator, JavaFile>()).get(0));
+ Assert.assertEquals(gg.generateBindings(new StringBuffer(), new StringBuffer(), null, jf, null, new String[]{"button","down"}, 0, null, "", new HashMap<GuixGenerator, JavaFile>()).get(0),ClickListener.class);
+
+ //tests with a javafile parameter not null with an attribute whose type is another generated file
+ //tests if the result is null without the taghandler associated to the field
+ jf = new JavaFile();
+ jf.addField(new JavaField(Modifier.PRIVATE, "test.Test", "test", null));
+ jf.addMethod(new JavaMethod(Modifier.PUBLIC, "test.Test", "getTest", null, null, "", null));
+ JavaFile jf2 = new JavaFile(Modifier.PUBLIC, JavaFile.CLASS, "test", "Test", null, null);
+ jf2.addField(new JavaField(Modifier.PRIVATE, "com.google.gwt.user.client.ui.ToggleButton", "button", null));
+ jf2.addMethod(new JavaMethod(Modifier.PUBLIC, "com.google.gwt.user.client.ui.ToggleButton", "getButton", null, null, "", null));
+ Assert.assertNull(gg.generateBindings(new StringBuffer(), new StringBuffer(), null, jf, null, new String[]{"getTest()","getButton()","isDown()"}, 0, null, "", new HashMap<GuixGenerator, JavaFile>()));
+ //test without jf2 in the map of generators with JavaFile
+ jf2 = new JavaFile(Modifier.PUBLIC, JavaFile.CLASS, "test", "Test", null, null);
+ jf2.addField(new JavaField(Modifier.PRIVATE, "com.google.gwt.user.client.ui.ToggleButton", "button", null, new ToggleButtonHandler()));
+ jf2.addMethod(new JavaMethod(Modifier.PUBLIC, "com.google.gwt.user.client.ui.ToggleButton", "getButton", null, null, "", null));
+ Assert.assertNull(gg.generateBindings(new StringBuffer(), new StringBuffer(), null, jf, null, new String[]{"getTest()","getButton()","isDown()"}, 0, null, "", new HashMap<GuixGenerator, JavaFile>()));
+ Map<GuixGenerator,JavaFile> map = new HashMap<GuixGenerator, JavaFile>();
+ map.put(gg, jf2);
+ //tests a successful generation with a method as a binding
+ Assert.assertNotNull(gg.generateBindings(new StringBuffer(), new StringBuffer(), null, jf, null, new String[]{"getTest()","getButton()", "isDown()"}, 0, null, "", map));
+ Assert.assertEquals(gg.generateBindings(new StringBuffer(), new StringBuffer(), null, jf, null, new String[]{"getTest()","getButton()", "isDown()"}, 0, null, "", map).size(),1);
+ Assert.assertNotNull(gg.generateBindings(new StringBuffer(), new StringBuffer(), null, jf, null, new String[]{"getTest()","getButton()", "isDown()"}, 0, null, "", map).get(0));
+ Assert.assertEquals(gg.generateBindings(new StringBuffer(), new StringBuffer(), null, jf, null, new String[]{"getTest()","getButton()", "isDown()"}, 0, null, "", map).get(0),ClickListener.class);
+ //tests a successful generation with an attribute as a binding
+ Assert.assertNotNull(gg.generateBindings(new StringBuffer(), new StringBuffer(), null, jf, null, new String[]{"test","button","down"}, 0, null, "", map));
+ Assert.assertEquals(gg.generateBindings(new StringBuffer(), new StringBuffer(), null, jf, null, new String[]{"test","button","down"}, 0, null, "", map).size(),1);
+ Assert.assertNotNull(gg.generateBindings(new StringBuffer(), new StringBuffer(), null, jf, null, new String[]{"test","button","down"}, 0, null, "", map).get(0));
+ Assert.assertEquals(gg.generateBindings(new StringBuffer(), new StringBuffer(), null, jf, null, new String[]{"test","button","down"}, 0, null, "", map).get(0),ClickListener.class);
+ }
+
+}
1
0
r1511 - in trunk/jaxx-runtime-swing-widget/src/main: java/jaxx/runtime/swing/editor java/jaxx/runtime/swing/editor/config java/jaxx/runtime/swing/editor/config/model resources/icons
by tchemit@users.labs.libre-entreprise.org July 27, 2009
by tchemit@users.labs.libre-entreprise.org July 27, 2009
July 27, 2009
Author: tchemit
Date: 2009-07-27 22:27:58 +0200 (Mon, 27 Jul 2009)
New Revision: 1511
Added:
trunk/jaxx-runtime-swing-widget/src/main/java/jaxx/runtime/swing/editor/ColumnSelector.jaxx
trunk/jaxx-runtime-swing-widget/src/main/java/jaxx/runtime/swing/editor/config/
trunk/jaxx-runtime-swing-widget/src/main/java/jaxx/runtime/swing/editor/config/ConfigCategoryUI.css
trunk/jaxx-runtime-swing-widget/src/main/java/jaxx/runtime/swing/editor/config/ConfigCategoryUI.jaxx
trunk/jaxx-runtime-swing-widget/src/main/java/jaxx/runtime/swing/editor/config/ConfigTableEditor.java
trunk/jaxx-runtime-swing-widget/src/main/java/jaxx/runtime/swing/editor/config/ConfigTableRenderer.java
trunk/jaxx-runtime-swing-widget/src/main/java/jaxx/runtime/swing/editor/config/ConfigUI.css
trunk/jaxx-runtime-swing-widget/src/main/java/jaxx/runtime/swing/editor/config/ConfigUI.jaxx
trunk/jaxx-runtime-swing-widget/src/main/java/jaxx/runtime/swing/editor/config/ConfigUIBuilder.java
trunk/jaxx-runtime-swing-widget/src/main/java/jaxx/runtime/swing/editor/config/model/
trunk/jaxx-runtime-swing-widget/src/main/java/jaxx/runtime/swing/editor/config/model/CategoryModel.java
trunk/jaxx-runtime-swing-widget/src/main/java/jaxx/runtime/swing/editor/config/model/ConfigTableModel.java
trunk/jaxx-runtime-swing-widget/src/main/java/jaxx/runtime/swing/editor/config/model/ConfigUIModel.java
trunk/jaxx-runtime-swing-widget/src/main/java/jaxx/runtime/swing/editor/config/model/OptionModel.java
trunk/jaxx-runtime-swing-widget/src/main/resources/icons/action-config-quit.png
trunk/jaxx-runtime-swing-widget/src/main/resources/icons/action-config-reset.png
trunk/jaxx-runtime-swing-widget/src/main/resources/icons/action-config-save.png
Log:
normalize i18n keys in widgets, add ApplicationConfig ui to change preferences, degin of a ColumnSelector (should have a look in swingx...)
Added: trunk/jaxx-runtime-swing-widget/src/main/java/jaxx/runtime/swing/editor/ColumnSelector.jaxx
===================================================================
--- trunk/jaxx-runtime-swing-widget/src/main/java/jaxx/runtime/swing/editor/ColumnSelector.jaxx (rev 0)
+++ trunk/jaxx-runtime-swing-widget/src/main/java/jaxx/runtime/swing/editor/ColumnSelector.jaxx 2009-07-27 20:27:58 UTC (rev 1511)
@@ -0,0 +1,152 @@
+<!--
+
+/**
+ * *##% 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 implements='PropertyChangeListener, ActionListener'
+ layout='{new BorderLayout()}'
+ onFocusGained='button.requestFocus()'
+ onFocusLost='setPopupVisible(false)'>
+
+ <!-- table to works with -->
+ <Object id='myTable' javaBean='null'/>
+
+ <!-- internal state -->
+ <Boolean id='popupVisible' javaBean='false'/>
+
+ <!-- ui handler -->
+ <!--ColumnSelectorHandler id='handler' constructorParams='this'/-->
+
+ <JPopupMenu id='popup'
+ border='{new TitledBorder(_("i18neditor.popup.title"))}'
+ onPopupMenuWillBecomeInvisible='button.setSelected(false)'
+ onPopupMenuCanceled='button.setSelected(false)'>
+ <JLabel id='popupLabel' enabled='false' text='i18neditor.empty.locales'/>
+ </JPopupMenu>
+
+ <script><![CDATA[
+import javax.swing.table.TableColumn;
+import javax.swing.table.TableCellRenderer;
+import jaxx.runtime.swing.I18nTableCellRenderer;
+
+public static final String TABLE_PROPERTY = "myTable";
+public static final String POPUP_VISIBLE_PROPERTY = "popupVisible";
+
+@Override
+public void propertyChange(PropertyChangeEvent evt) {
+ String name = evt.getPropertyName();
+ if (log.isDebugEnabled()) {
+ log.debug(name+" <old:"+evt.getOldValue()+" - new:"+evt.getNewValue()+">");
+ }
+ //log.info(name+" <old:"+evt.getOldValue()+" - new:"+evt.getNewValue()+">");
+ if (TABLE_PROPERTY.equals(name)) {
+ // table has changed, rebuild the popup
+ try {
+
+ popup.removeAll();
+ JTable t = (JTable) evt.getNewValue();
+ if (t != null) {
+ log.info("table has changed ! " + t.getName());
+ for (int i = 0, columnCount = t.getColumnCount(); i < columnCount; i++) {
+ TableColumn column = t.getColumnModel().getColumn(i);
+ TableCellRenderer defaultRenderer = t.getTableHeader().getDefaultRenderer();
+ String columnName = column.getHeaderValue() + "";
+ if (defaultRenderer instanceof I18nTableCellRenderer) {
+ I18nTableCellRenderer renderer = (I18nTableCellRenderer) defaultRenderer;
+ columnName = _(renderer.getKeys()[i]);
+ }
+ JRadioButtonMenuItem b = new JRadioButtonMenuItem(columnName, null, true);
+ popup.add(b);
+ b.addActionListener(this);
+ b.putClientProperty("columnIndex", i);
+ b.putClientProperty("columnName", columnName);
+ b.putClientProperty("column", column);
+ }
+ }
+ } finally {
+ popup.invalidate();
+ }
+ return;
+ }
+ if (POPUP_VISIBLE_PROPERTY.equals(name)) {
+ Boolean newValue = (Boolean) evt.getNewValue();
+ if (newValue == null || !newValue) {
+ if (getPopup() != null && getPopup().isVisible()) {
+ getPopup().setVisible(false);
+ }
+ return;
+ }
+ if (!getPopup().isVisible()) {
+ SwingUtilities.invokeLater(showPopupRunnable);
+ }
+ return;
+ }
+
+}
+
+@Override
+public void actionPerformed(ActionEvent event) {
+ JRadioButtonMenuItem source = (JRadioButtonMenuItem) event.getSource();
+ boolean selected = source.isSelected();
+ TableColumn column = (TableColumn) source.getClientProperty("column");
+ Integer columnIndex = (Integer) source.getClientProperty("columnIndex");
+ String columnName = (String) source.getClientProperty("columnName");
+ log.info(columnName + ", selected : " + selected);
+ JTable t = (JTable) myTable;
+ if (selected) {
+ // reinject the column in table
+ t.getColumnModel().addColumn(column);
+ } else {
+ // remove column from table
+ t.getColumnModel().removeColumn(column);
+ }
+}
+
+protected Runnable showPopupRunnable = new Runnable() {
+ @Override
+ public void run() {
+ getPopup().pack();
+ Dimension dim = getPopup().getPreferredSize();
+ JToggleButton invoker = getButton();
+ getPopup().show(invoker, (int) (invoker.getPreferredSize().getWidth() - dim.getWidth()), invoker.getHeight());
+ }
+};
+
+
+addPropertyChangeListener(TABLE_PROPERTY,this);
+addPropertyChangeListener(POPUP_VISIBLE_PROPERTY,this);
+]]>
+ </script>
+ <JToolBar floatable='false'
+ opaque='false'
+ borderPainted='false'>
+ <JToggleButton
+ id='button'
+ toolTipText='columnselector.action.tip'
+ actionIcon='numbereditor-calculator'
+ constraints='BorderLayout.CENTER'
+ selected='{popup.isVisible()}'
+ focusable='true'
+ focusPainted='false'
+ borderPainted='false'
+ rolloverEnabled='false'
+ onItemStateChanged='if (event.getStateChange() == ItemEvent.SELECTED) { setPopupVisible(true); } else { popupVisible = false; }'/>
+ </JToolBar>
+</JPanel>
\ No newline at end of file
Added: trunk/jaxx-runtime-swing-widget/src/main/java/jaxx/runtime/swing/editor/config/ConfigCategoryUI.css
===================================================================
--- trunk/jaxx-runtime-swing-widget/src/main/java/jaxx/runtime/swing/editor/config/ConfigCategoryUI.css (rev 0)
+++ trunk/jaxx-runtime-swing-widget/src/main/java/jaxx/runtime/swing/editor/config/ConfigCategoryUI.css 2009-07-27 20:27:58 UTC (rev 1511)
@@ -0,0 +1,60 @@
+/**
+ * *##% 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>. ##%*
+*/
+
+#categoryLabelPanel {
+ background:{Color.WHITE};
+}
+
+#descriptionPane {
+ columnHeaderView:{new JLabel(_("config.descrition"), jaxx.runtime.Util.getUIManagerActionIcon("information"), 10)};
+}
+
+#description {
+ rows:3;
+ editable:false;
+ focusable:false;
+ font-size:10;
+ text:{_("config.no.option.selected")};
+}
+
+#tablePane {
+ columnHeaderView:{table.getTableHeader()};
+ verticalScrollBarPolicy:{ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS};
+horizontalScrollBarPolicy:{ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER};
+}
+
+#table {
+ rowSelectionAllowed:false;
+ autoCreateRowSorter:true;
+ autoResizeMode:{JTable.AUTO_RESIZE_ALL_COLUMNS};
+}
+
+#reset{
+ text:"config.action.reset";
+ toolTipText:"config.action.reset.tip";
+ actionIcon:"config-reset";
+ enabled:{getCategoryModel().isModified()};
+}
+
+#save{
+ text:"config.action.save";
+ toolTipText:"config.action.save.tip";
+ actionIcon:"config-save";
+ enabled:{getCategoryModel().isModified() && getCategoryModel().isValid()};
+}
Added: trunk/jaxx-runtime-swing-widget/src/main/java/jaxx/runtime/swing/editor/config/ConfigCategoryUI.jaxx
===================================================================
--- trunk/jaxx-runtime-swing-widget/src/main/java/jaxx/runtime/swing/editor/config/ConfigCategoryUI.jaxx (rev 0)
+++ trunk/jaxx-runtime-swing-widget/src/main/java/jaxx/runtime/swing/editor/config/ConfigCategoryUI.jaxx 2009-07-27 20:27:58 UTC (rev 1511)
@@ -0,0 +1,120 @@
+<!--
+
+/**
+ * *##% 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'/>
+
+ <script><![CDATA[
+import jaxx.runtime.SwingUtil;
+import jaxx.runtime.swing.editor.config.model.*;
+import jaxx.runtime.swing.editor.ColumnSelector;
+import static org.nuiton.i18n.I18n.n_;
+
+void $afterCompleteSetup() {
+ // prepare table
+ SwingUtil.setI18nTableHeaderRenderer(table,
+ n_("config.key"),
+ n_("config.key.tip"),
+ n_("config.value"),
+ n_("config.value.tip"),
+ n_("config.defaultValue"),
+ n_("config.defaultValue.tip"));
+
+ ConfigTableRenderer renderer = new ConfigTableRenderer();
+ SwingUtil.setTableColumnRenderer(table, 0, renderer);
+ SwingUtil.setTableColumnRenderer(table, 1, renderer);
+ SwingUtil.setTableColumnRenderer(table, 2, renderer);
+ Font f = table.getFont().deriveFont(Font.ITALIC | Font.BOLD);
+ int width = SwingUtil.computeTableColumnWidth(table, f, 0, "___*");
+ SwingUtil.fixTableColumnWidth(table, 0, width);
+ SwingUtil.setTableColumnEditor(table, 1, new ConfigTableEditor((ConfigTableModel) table.getModel()));
+ //TODO to be continued...
+ //columnSelector.setMyTable(table);
+ //tablePane.setCorner(ScrollPaneConstants.UPPER_RIGHT_CORNER, columnSelector);
+}
+
+protected void updateDescriptionText() {
+ OptionModel option;
+ if (selectionModel.isSelectionEmpty()) {
+ option = null;
+ } else {
+ int row = selectionModel.getAnchorSelectionIndex();
+ ConfigTableModel m = (ConfigTableModel) table.getModel();
+ option = m.getEntry(row);
+ if (log.isDebugEnabled()) {
+ log.debug(row + " : " + option);
+ }
+ }
+ StringBuilder buffer = new StringBuilder();
+ if (option == null) {
+ buffer.append(_("config.no.option.selected"));
+ } else {
+ buffer.append(_("config.option.label", option.getKey(), _(option.getDescription()))).append('\n');
+ if (option.isModified()) {
+ buffer.append(_("config.option.modified", option.getOriginalValue(), option.getValue())).append('\n');
+ }
+ if (option.isFinal()) {
+ buffer.append(_("config.option.final")).append('\n');
+ }
+ }
+ description.setText(buffer.toString());
+}
+]]>
+ </script>
+
+ <CategoryModel id='categoryModel' javaBean='getContextValue(CategoryModel.class)'/>
+
+ <ConfigTableModel id='tableModel' constructorParams='categoryModel'
+ onTableChanged='updateDescriptionText()'/>
+
+ <ListSelectionModel id='selectionModel' javaBean='new DefaultListSelectionModel()'
+ onValueChanged='if (!event.getValueIsAdjusting()) { updateDescriptionText(); }'/>
+
+ <!--<ColumnSelector id='columnSelector' />-->
+
+ <!-- categorie label -->
+ <JPanel id="categoryLabelPanel" constraints='BorderLayout.NORTH'>
+ <JLabel id='categoryLabel'/>
+ </JPanel>
+
+ <!-- table of options -->
+ <JScrollPane id='tablePane' constraints='BorderLayout.CENTER'>
+ <JTable id="table" constructorParams='tableModel'
+ selectionModel='{selectionModel}'/>
+ </JScrollPane>
+
+ <JPanel layout='{new BorderLayout()}' constraints='BorderLayout.SOUTH'>
+
+ <!-- description of selected option in table -->
+ <JScrollPane id="descriptionPane" constraints='BorderLayout.CENTER'>
+ <JTextArea id='description'/>
+ </JScrollPane>
+
+ <!-- actions of the category -->
+ <JPanel layout='{new GridLayout(1,0)}' constraints='BorderLayout.SOUTH'>
+ <JButton id='reset' onActionPerformed='getContextValue(ConfigUIModel.class).reset()'/>
+ <JButton id='save' onActionPerformed='getContextValue(ConfigUIModel.class).saveModified()'/>
+ </JPanel>
+ </JPanel>
+</JPanel>
Added: trunk/jaxx-runtime-swing-widget/src/main/java/jaxx/runtime/swing/editor/config/ConfigTableEditor.java
===================================================================
--- trunk/jaxx-runtime-swing-widget/src/main/java/jaxx/runtime/swing/editor/config/ConfigTableEditor.java (rev 0)
+++ trunk/jaxx-runtime-swing-widget/src/main/java/jaxx/runtime/swing/editor/config/ConfigTableEditor.java 2009-07-27 20:27:58 UTC (rev 1511)
@@ -0,0 +1,125 @@
+/*
+* *##% 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>. ##%* */
+package jaxx.runtime.swing.editor.config;
+
+import jaxx.runtime.swing.editor.config.model.ConfigTableModel;
+import javax.swing.DefaultCellEditor;
+import javax.swing.JTable;
+import javax.swing.event.CellEditorListener;
+import javax.swing.table.TableCellEditor;
+import java.awt.Component;
+import java.util.EventObject;
+import java.util.Locale;
+import jaxx.runtime.swing.editor.ClassCellEditor;
+import jaxx.runtime.swing.editor.EnumEditor;
+import jaxx.runtime.swing.editor.LocaleEditor;
+
+/**
+ * L'éditeur des valeurs des propriétés d'une configuration
+ *
+ * @author chemit
+ */
+public class ConfigTableEditor implements TableCellEditor {
+
+ protected TableCellEditor delegate;
+ protected ConfigTableModel model;
+
+ public ConfigTableEditor(ConfigTableModel model) {
+ this.model = model;
+ }
+
+ @Override
+ public Component getTableCellEditorComponent(JTable table, Object value, boolean isSelected, int row, int column) {
+ delegate = findDelegate(table, model.getEntry(row).getType());
+ return delegate.getTableCellEditorComponent(table, value, isSelected, row, column);
+ }
+
+ @Override
+ public Object getCellEditorValue() {
+ return !hasDelegate() ? null : delegate.getCellEditorValue();
+ }
+
+ @Override
+ public boolean isCellEditable(EventObject anEvent) {
+ return !hasDelegate() || delegate.isCellEditable(anEvent);
+ }
+
+ @Override
+ public boolean shouldSelectCell(EventObject anEvent) {
+ return hasDelegate() && delegate.shouldSelectCell(anEvent);
+ }
+
+ @Override
+ public boolean stopCellEditing() {
+ return !hasDelegate() || delegate.stopCellEditing();
+ }
+
+ @Override
+ public void cancelCellEditing() {
+ if (hasDelegate()) {
+ delegate.cancelCellEditing();
+ }
+ }
+
+ @Override
+ public void addCellEditorListener(CellEditorListener l) {
+ if (hasDelegate()) {
+ delegate.addCellEditorListener(l);
+ }
+ }
+
+ @Override
+ public void removeCellEditorListener(CellEditorListener l) {
+ if (hasDelegate()) {
+ delegate.removeCellEditorListener(l);
+ }
+ }
+
+ protected TableCellEditor findDelegate(JTable table, Class<?> type) {
+ TableCellEditor editor = table.getDefaultEditor(type);
+ TableCellEditor defaultEditor = table.getDefaultEditor(Object.class);
+ if (editor == defaultEditor) {
+ // find not a specialized editor for the type
+ if (type.isEnum()) {
+ // add a EnumEditor to table
+ editor = new DefaultCellEditor(EnumEditor.newEditor((Class<Enum>) type));
+ table.setDefaultEditor(type, editor);
+ } else if (type == Class.class) {
+ editor = new ClassCellEditor();
+ table.setDefaultEditor(type, editor);
+ } //else if (type == File.class){
+ // TODO a FileEditor
+ // table.setDefaultEditor(type, delegate);
+ //}
+ else if (type.equals(Locale.class)) {
+ editor = new DefaultCellEditor(LocaleEditor.newEditor());
+ table.setDefaultEditor(Locale.class, editor);
+ } else {
+ editor = table.getDefaultEditor(String.class);
+ }
+ }
+ if (editor == null) {
+ throw new IllegalStateException("could not find a editor for type +" + type);
+ }
+ return editor;
+ }
+
+ protected boolean hasDelegate() {
+ return delegate != null;
+ }
+}
Added: trunk/jaxx-runtime-swing-widget/src/main/java/jaxx/runtime/swing/editor/config/ConfigTableRenderer.java
===================================================================
--- trunk/jaxx-runtime-swing-widget/src/main/java/jaxx/runtime/swing/editor/config/ConfigTableRenderer.java (rev 0)
+++ trunk/jaxx-runtime-swing-widget/src/main/java/jaxx/runtime/swing/editor/config/ConfigTableRenderer.java 2009-07-27 20:27:58 UTC (rev 1511)
@@ -0,0 +1,112 @@
+/*
+ * *##% 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>. ##%* */
+package jaxx.runtime.swing.editor.config;
+
+import static org.nuiton.i18n.I18n._;
+
+import javax.swing.JComponent;
+import javax.swing.JTable;
+import javax.swing.table.DefaultTableCellRenderer;
+import javax.swing.table.TableCellRenderer;
+import java.awt.Color;
+import java.awt.Component;
+import java.awt.Font;
+import jaxx.runtime.swing.editor.config.model.ConfigTableModel;
+import jaxx.runtime.swing.editor.config.model.OptionModel;
+
+/**
+ * Pour le rendu du tableau des options d'une categorie
+ *
+ * @author chemit
+ * @see ConfigTableModel
+ */
+public class ConfigTableRenderer extends DefaultTableCellRenderer {
+
+ private static final long serialVersionUID = 1L;
+ protected static Color col;
+ protected static Font font;
+ protected static Font font2;
+
+ public ConfigTableRenderer() {
+ col = getForeground();
+ }
+
+ @Override
+ public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
+ int modelRow = table.convertRowIndexToModel(row);
+ int modelColumn = table.convertColumnIndexToModel(column);
+ ConfigTableModel model = (ConfigTableModel) table.getModel();
+ OptionModel key = model.getEntry(modelRow);
+ boolean isModified = key.isModified();
+
+ boolean isValid = key.isValid();
+
+ if (font == null) {
+ font = getFont();
+ font2 = font.deriveFont(Font.ITALIC | Font.BOLD);
+ }
+ Component cellRenderer = null;
+ switch (modelColumn) {
+ case 0:
+ cellRenderer = getKeyCellRenderer(table, value, isSelected, hasFocus, modelRow, modelColumn, key, isValid, isModified);
+ break;
+ case 1:
+ cellRenderer = getValueCellRenderer(table, value, isSelected, hasFocus, modelRow, modelColumn, key, isValid, isModified);
+ break;
+ case 2:
+ cellRenderer = getValueCellRenderer(table, value, isSelected, hasFocus, modelRow, modelColumn, key, isValid, isModified);
+ break;
+ default:
+ throw new IllegalStateException("no renderer find for column " + modelColumn);
+ }
+ return cellRenderer;
+ }
+
+ protected Component getKeyCellRenderer(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column, OptionModel key, boolean isValid, boolean isModified) {
+ String tooltip = _(key.getDescription());
+ Object originalValue = key.getOriginalValue();
+ boolean isFinal = key.isFinal();
+ if (isFinal) {
+ tooltip += " [" + _("config.unmodifiable") + ']';
+ }
+ if (isModified) {
+ String s = _("config.modified", originalValue);
+ value = value + " *";
+ tooltip += " [" + s + ']';
+ }
+ if (!isValid) {
+ String s2 = _("config.unvalid", originalValue, key.getType());
+ tooltip += " (" + s2 + ")";
+ value = value + " !";
+ }
+ JComponent result = (JComponent) super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column);
+ result.setToolTipText(tooltip);
+ result.setForeground(isValid ? col : Color.RED);
+ result.setFont(isModified || !isValid ? font2 : font);
+ result.setEnabled(!isFinal);
+ return result;
+ }
+
+ protected Component getValueCellRenderer(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column, OptionModel key, boolean isValid, boolean isModified) {
+ TableCellRenderer defaultRenderer = table.getDefaultRenderer(key.getType());
+
+ Component result;
+ result = defaultRenderer.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column);
+ return result;
+ }
+}
Added: trunk/jaxx-runtime-swing-widget/src/main/java/jaxx/runtime/swing/editor/config/ConfigUI.css
===================================================================
--- trunk/jaxx-runtime-swing-widget/src/main/java/jaxx/runtime/swing/editor/config/ConfigUI.css (rev 0)
+++ trunk/jaxx-runtime-swing-widget/src/main/java/jaxx/runtime/swing/editor/config/ConfigUI.css 2009-07-27 20:27:58 UTC (rev 1511)
@@ -0,0 +1,27 @@
+/**
+ * *##% 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>. ##%*
+*/
+#quit{
+ text:"config.action.quit";
+ toolTipText:"config.action.quit.tip";
+ actionIcon:"config-quit";
+}
+
+#categories{
+ tabPlacement:{JTabbedPane.LEFT};
+}
Added: trunk/jaxx-runtime-swing-widget/src/main/java/jaxx/runtime/swing/editor/config/ConfigUI.jaxx
===================================================================
--- trunk/jaxx-runtime-swing-widget/src/main/java/jaxx/runtime/swing/editor/config/ConfigUI.jaxx (rev 0)
+++ trunk/jaxx-runtime-swing-widget/src/main/java/jaxx/runtime/swing/editor/config/ConfigUI.jaxx 2009-07-27 20:27:58 UTC (rev 1511)
@@ -0,0 +1,72 @@
+<!--
+
+/**
+ * *##% 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'/>
+
+ <script><![CDATA[
+ import jaxx.runtime.swing.editor.config.model.ConfigUIModel;
+
+ categories.setModel(new DefaultSingleSelectionModel() {
+
+ private static final long serialVersionUID = 1L;
+
+ @Override
+ public void setSelectedIndex(int index) {
+ // check if catgeory can be quit
+ boolean canContinue = !isSelected() || ConfigUIBuilder.canQuitCategory(ConfigUI.this);
+ if (canContinue) {
+ if (log.isDebugEnabled()) {
+ log.debug("new index : " + index);
+ }
+ // was authorized to continue
+ super.setSelectedIndex(index);
+ }
+ }
+ });
+
+ protected void changeCategory(ChangeEvent e) {
+ JPanel p = (JPanel) getCategories().getSelectedComponent();
+ if (p == null) {
+ // pas de selection
+ return;
+ }
+ getModel().setCategory(p.getName());
+ getCategories().invalidate();
+ }
+ ]]>
+ </script>
+
+ <!-- le modele de l'ui -->
+ <ConfigUIModel id='model' javaBean='getContextValue(ConfigUIModel.class)'/>
+
+ <!-- les differentes categories de la configuration -->
+ <JTabbedPane id='categories' constraints='BorderLayout.CENTER'
+ onStateChanged='changeCategory(event)' />
+
+ <!-- pour quitter l'ui -->
+ <JPanel layout='{new GridLayout(1,0)}' constraints='BorderLayout.SOUTH'>
+ <JButton id='quit'/>
+ </JPanel>
+</JPanel>
Added: trunk/jaxx-runtime-swing-widget/src/main/java/jaxx/runtime/swing/editor/config/ConfigUIBuilder.java
===================================================================
--- trunk/jaxx-runtime-swing-widget/src/main/java/jaxx/runtime/swing/editor/config/ConfigUIBuilder.java (rev 0)
+++ trunk/jaxx-runtime-swing-widget/src/main/java/jaxx/runtime/swing/editor/config/ConfigUIBuilder.java 2009-07-27 20:27:58 UTC (rev 1511)
@@ -0,0 +1,220 @@
+/**
+ * *##% 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>. ##%*
+ */
+package jaxx.runtime.swing.editor.config;
+
+import java.awt.Frame;
+import java.awt.event.ActionEvent;
+import java.awt.event.WindowAdapter;
+import java.awt.event.WindowEvent;
+import javax.swing.AbstractAction;
+import javax.swing.Action;
+import javax.swing.JButton;
+import javax.swing.JComponent;
+import javax.swing.JDialog;
+import javax.swing.JOptionPane;
+import javax.swing.JRootPane;
+import javax.swing.KeyStroke;
+import jaxx.runtime.JAXXContext;
+import jaxx.runtime.JAXXInitialContext;
+import jaxx.runtime.SwingUtil;
+
+import jaxx.runtime.swing.editor.config.model.CategoryModel;
+import jaxx.runtime.swing.editor.config.model.ConfigUIModel;
+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._;
+
+/**
+ * La classe pour construire l'ui
+ * @author chemit
+ */
+public class ConfigUIBuilder {
+
+ public static final Log log = LogFactory.getLog(ConfigUIBuilder.class);
+
+ /**
+ * Construire l'ui de configuration (sous forme de panel)
+ *
+ * @param parentContext le context applicatif
+ * @param model le modele de l'ui de configuration
+ * @param defaultCategory la categorie a selectionner
+ * @return l'ui instanciate
+ */
+ public static ConfigUI newConfigUI(jaxx.runtime.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()) {
+
+ private static final long serialVersionUID = 1L;
+
+ @Override
+ public void actionPerformed(ActionEvent e) {
+ if (canQuitCategory(ui)) {
+ ui.getParentContainer(JDialog.class).dispose();
+ }
+ }
+ };
+ 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;
+ }
+
+ /**
+ * 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
+ */
+ public static void showConfigUI(final ConfigUI configUI, Frame ui, boolean undecorated) {
+ JDialog f = new JDialog(ui, true);
+ f.setTitle(_("config.title"));
+ f.add(configUI);
+ if (ui != null) {
+ f.setIconImage(ui.getIconImage());
+ }
+ // pour savoir si l'ui est autonome
+ configUI.putClientProperty("standalone", ui == null);
+
+ f.setDefaultCloseOperation(JDialog.DO_NOTHING_ON_CLOSE);
+ f.addWindowListener(new WindowAdapter() {
+
+ @Override
+ public void windowClosing(WindowEvent e) {
+
+ if (canQuitCategory(configUI)) {
+ e.getWindow().dispose();
+ }
+ }
+ });
+ f.setUndecorated(undecorated);
+ JRootPane rootPane = f.getRootPane();
+ rootPane.setDefaultButton(configUI.getQuit());
+ 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);
+ f.setVisible(true);
+ }
+
+ protected static boolean canQuitCategory(ConfigUI ui) {
+ boolean canContinue = true;
+ ConfigUIModel model = ui.getModel();
+ CategoryModel categoryModel = model.getCategoryModel();
+ String categoryName = _(categoryModel.getCategory());
+ if (!categoryModel.isValid()) {
+
+ // the category is not valid
+ // get all the invalid options
+
+ StringBuilder buffer = new StringBuilder();
+ buffer.append(_("config.message.quit.invalid.category", categoryName)).append('\n');
+ for (OptionModel m : categoryModel.getInvalidOptions()) {
+ buffer.append("\n- ").append(m.getKey());
+ }
+ buffer.append('\n');
+ int reponse = askUser(ui,
+ _("config.title.need.confirm"),
+ buffer.toString(),
+ JOptionPane.ERROR_MESSAGE,
+ new Object[]{
+ _("config.choice.continue"),
+ _("config.choice.cancel")},
+ 0);
+
+ switch (reponse) {
+ case JOptionPane.CLOSED_OPTION:
+ case 1:
+ canContinue = false;
+ break;
+ case 0:
+ if (categoryModel.isModified()) {
+ // wil reset category
+ model.reset();
+ }
+ break;
+ }
+ } else if (categoryModel.isModified()) {
+
+ // 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');
+ for (OptionModel m : categoryModel.getModifiedOptions()) {
+ buffer.append("\n- ").append(m.getKey());
+ }
+ buffer.append('\n');
+
+ int reponse = askUser(ui,
+ _("config.title.need.confirm"), buffer.toString(),
+ JOptionPane.WARNING_MESSAGE,
+ new Object[]{
+ _("config.choice.save"),
+ _("config.choice.doNotSave"),
+ _("config.choice.cancel")},
+ 0);
+
+ switch (reponse) {
+ case JOptionPane.CLOSED_OPTION:
+ case 2:
+ canContinue = false;
+ break;
+ case 0:
+ // will save ui
+ model.saveModified();
+ break;
+ case 1:
+ // wil reset ui
+ model.reset();
+ break;
+ }
+
+ }
+ return canContinue;
+ }
+
+ public static int askUser(ConfigUI parent, String title, String message, int typeMessage, Object[] options, int defaultOption) {
+
+ int response = JOptionPane.showOptionDialog(parent, message, title, JOptionPane.DEFAULT_OPTION, typeMessage, null, options, options[defaultOption]);
+ return response;
+ }
+}
Added: trunk/jaxx-runtime-swing-widget/src/main/java/jaxx/runtime/swing/editor/config/model/CategoryModel.java
===================================================================
--- trunk/jaxx-runtime-swing-widget/src/main/java/jaxx/runtime/swing/editor/config/model/CategoryModel.java (rev 0)
+++ trunk/jaxx-runtime-swing-widget/src/main/java/jaxx/runtime/swing/editor/config/model/CategoryModel.java 2009-07-27 20:27:58 UTC (rev 1511)
@@ -0,0 +1,165 @@
+/**
+ * *##% 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>. ##%*
+ */
+package jaxx.runtime.swing.editor.config.model;
+
+import java.beans.PropertyChangeListener;
+import java.beans.PropertyChangeSupport;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.Iterator;
+import java.util.List;
+
+/**
+ * le modele d'une categorie d'options.
+ *
+ * Une categorie est un ensemble d'options.
+ *
+ * @author tchemit
+ */
+public class CategoryModel implements Iterable<OptionModel> {
+
+ public static final String RELOAD_PROPERTY_NAME = "reload";
+ public static final String MODIFIED_PROPERTY_NAME = "modified";
+ public static final String VALID_PROPERTY_NAME = "valid";
+ /** category short name (i18n key) */
+ protected String category;
+ /** category long name (i18n key) */
+ protected String categoryLabel;
+ /** options of the category */
+ protected List<OptionModel> entries;
+ /** suport of modification */
+ protected PropertyChangeSupport pcs = new PropertyChangeSupport(this);
+
+ public CategoryModel(String category, String categoryLabel, OptionModel[] entries) {
+ super();
+ this.category = category;
+ this.categoryLabel = categoryLabel;
+ this.entries = Collections.unmodifiableList(Arrays.asList(entries));
+ }
+
+ public String getCategory() {
+ return category;
+ }
+
+ public String getCategoryLabel() {
+ return categoryLabel;
+ }
+
+ public List<OptionModel> getEntries() {
+ return entries;
+ }
+
+ public boolean isModified() {
+ boolean modified = false;
+ for (OptionModel m : this) {
+ if (m.isModified()) {
+ modified = true;
+ break;
+ }
+ }
+ return modified;
+ }
+
+ public boolean isValid() {
+ boolean valid = true;
+ for (OptionModel m : this) {
+ if (!m.isValid()) {
+ valid = false;
+ break;
+ }
+ }
+ return valid;
+ }
+
+ public void setValue(OptionModel key, Object val) {
+ boolean wasModified = isModified();
+ boolean wasValid = isValid();
+ key.setValue(val);
+ boolean modified = isModified();
+ boolean valid = isValid();
+ if (wasModified != modified) {
+ // change modified state
+ firePropertyChange(MODIFIED_PROPERTY_NAME, wasModified, modified);
+ }
+ if (wasValid != valid) {
+ // change valid state
+ firePropertyChange(VALID_PROPERTY_NAME, wasValid, valid);
+ }
+ }
+
+ @Override
+ public Iterator<OptionModel> iterator() {
+ return entries.iterator();
+ }
+
+ public List<OptionModel> getInvalidOptions() {
+
+ List<OptionModel> result = new ArrayList<OptionModel>();
+ for (OptionModel m : this) {
+ if (!m.isValid()) {
+ result.add(m);
+ }
+ }
+ return result;
+ }
+
+ public List<OptionModel> getModifiedOptions() {
+
+ List<OptionModel> result = new ArrayList<OptionModel>();
+ for (OptionModel m : this) {
+ if (m.isModified()) {
+ result.add(m);
+ }
+ }
+ return result;
+ }
+
+ public void firePropertyChange(String propertyName, Object oldValue, Object newValue) {
+ pcs.firePropertyChange(propertyName, oldValue, newValue);
+ }
+
+ public void addPropertyChangeListener(PropertyChangeListener listener) {
+ pcs.addPropertyChangeListener(listener);
+ }
+
+ public void addPropertyChangeListener(String propertyName, PropertyChangeListener listener) {
+ pcs.addPropertyChangeListener(propertyName, listener);
+ }
+
+ public void removePropertyChangeListener(PropertyChangeListener listener) {
+ pcs.removePropertyChangeListener(listener);
+ }
+
+ public void removePropertyChangeListener(String propertyName, PropertyChangeListener listener) {
+ pcs.removePropertyChangeListener(propertyName, listener);
+ }
+
+ public synchronized boolean hasListeners(String propertyName) {
+ return pcs.hasListeners(propertyName);
+ }
+
+ public synchronized PropertyChangeListener[] getPropertyChangeListeners(String propertyName) {
+ return pcs.getPropertyChangeListeners(propertyName);
+ }
+
+ public synchronized PropertyChangeListener[] getPropertyChangeListeners() {
+ return pcs.getPropertyChangeListeners();
+ }
+}
Added: trunk/jaxx-runtime-swing-widget/src/main/java/jaxx/runtime/swing/editor/config/model/ConfigTableModel.java
===================================================================
--- trunk/jaxx-runtime-swing-widget/src/main/java/jaxx/runtime/swing/editor/config/model/ConfigTableModel.java (rev 0)
+++ trunk/jaxx-runtime-swing-widget/src/main/java/jaxx/runtime/swing/editor/config/model/ConfigTableModel.java 2009-07-27 20:27:58 UTC (rev 1511)
@@ -0,0 +1,134 @@
+/**
+ * *##% 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>. ##%*
+ */
+package jaxx.runtime.swing.editor.config.model;
+
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
+import javax.swing.table.AbstractTableModel;
+import org.nuiton.util.ConverterUtil;
+
+/**
+ * le modele du tableau d'options pour une categorie donnee.
+ *
+ * Le modele se base sur le modele d'une categorie d'option.
+ *
+ * @author tchemit
+ *
+ * @see CategoryModel
+ */
+public class ConfigTableModel extends AbstractTableModel {
+
+ private static final long serialVersionUID = 1L;
+ private static final Class<?>[] columnClass = {String.class, Object.class, String.class};
+ /** le modele d'une categorie */
+ protected final CategoryModel categoryModel;
+
+ public ConfigTableModel(CategoryModel categoryModel) {
+ this.categoryModel = categoryModel;
+ // listen of property reload of the category model
+ // to known when to refresh table
+ this.categoryModel.addPropertyChangeListener(CategoryModel.RELOAD_PROPERTY_NAME, new PropertyChangeListener() {
+
+ @Override
+ public void propertyChange(PropertyChangeEvent evt) {
+ fireTableDataChanged();
+ }
+ });
+ }
+
+ public CategoryModel getCategoryModel() {
+ return categoryModel;
+ }
+
+ public OptionModel getEntry(int rowIndex) {
+ return categoryModel.getEntries().get(rowIndex);
+ }
+
+ @Override
+ public int getRowCount() {
+ return categoryModel.getEntries().size();
+ }
+
+ @Override
+ public int getColumnCount() {
+ return columnClass.length;
+ }
+
+ @Override
+ public Class<?> getColumnClass(int columnIndex) {
+ return columnClass[columnIndex];
+ }
+
+ @Override
+ public boolean isCellEditable(int rowIndex, int columnIndex) {
+ return columnIndex == 1 && !getEntry(rowIndex).isFinal();
+ }
+
+ @Override
+ public Object getValueAt(int row, int column) {
+ OptionModel key = getEntry(row);
+ Object value = null;
+ switch (column) {
+ case 0:
+ value = key.getKey();
+ break;
+ case 1:
+ value = key.getValue();
+ break;
+ case 2:
+ value = key.getDefaultValue();
+ if (value != null) {
+ value = ConverterUtil.convert(key.getType(), value);
+ }
+ break;
+ }
+ return value;
+// if (column == 0) {
+// return key.getKey();
+// }
+// return key.getValue();
+ }
+
+ @Override
+ public void setValueAt(Object aValue, int row, int column) {
+ if (column != 1) {
+ // seul la colonne 1 est editable (valeur de l'option)
+ throw new IllegalArgumentException("can not edit column " + column);
+ }
+ OptionModel key = getEntry(row);
+ Object val;
+ if (aValue == null || key.getType() == aValue.getClass()) {
+ val = aValue;
+ } else {
+ String valStr = String.valueOf(aValue).trim();
+ try {
+ val = ConverterUtil.convert(key.getType(), valStr);
+ if (val != null && val instanceof Integer) {
+ if (new Integer(0).equals(val) && !valStr.equals("0")) {
+ val = null;
+ }
+ }
+ } catch (Exception e) {
+ val = null;
+ }
+ }
+ categoryModel.setValue(key, val);
+ fireTableRowsUpdated(row, row);
+ }
+}
Added: trunk/jaxx-runtime-swing-widget/src/main/java/jaxx/runtime/swing/editor/config/model/ConfigUIModel.java
===================================================================
--- trunk/jaxx-runtime-swing-widget/src/main/java/jaxx/runtime/swing/editor/config/model/ConfigUIModel.java (rev 0)
+++ trunk/jaxx-runtime-swing-widget/src/main/java/jaxx/runtime/swing/editor/config/model/ConfigUIModel.java 2009-07-27 20:27:58 UTC (rev 1511)
@@ -0,0 +1,189 @@
+/**
+ * *##% 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>. ##%*
+ */
+package jaxx.runtime.swing.editor.config.model;
+
+import java.beans.PropertyChangeListener;
+import java.beans.PropertyChangeSupport;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+import org.nuiton.util.ApplicationConfig;
+import org.nuiton.util.ApplicationConfig.OptionDef;
+import static org.nuiton.i18n.I18n._;
+
+/**
+ * Le modele de l'ui des preferences.
+ *
+ * Ce modele contient les catégories des options.
+ *
+ * @author chemit
+ */
+public class ConfigUIModel implements Iterable<CategoryModel> {
+
+ public static final String CATEGORY_MODEL_PROPERTY_NAME = "categoryModel";
+ /** le dictionnaire des options disponibles par categorie */
+ protected final Map<String, CategoryModel> categories;
+ /** La configuration de l'application */
+ protected final ApplicationConfig config;
+ /** la cateogrie en cours d'utilisation */
+ protected CategoryModel categoryModel;
+ /** suport of modification */
+ protected final PropertyChangeSupport pcs = new PropertyChangeSupport(this);
+
+ public ConfigUIModel(ApplicationConfig config) {
+ this.config = config;
+ this.categories = new LinkedHashMap<String, CategoryModel>();
+ }
+
+ /**
+ * 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 keys les options de la categorie
+ */
+ public void addCategory(String category, String categoryLabel, OptionDef... keys) {
+ if (categories.containsKey(category)) {
+ throw new IllegalArgumentException(_("config.error.category.already.exists", category));
+ }
+ OptionModel[] entries = new OptionModel[keys.length];
+ int index = 0;
+ for (OptionDef d : keys) {
+ Object value = config.getOption(d);
+ OptionModel e = new OptionModel(d, value);
+ entries[index++] = e;
+ }
+ CategoryModel m = new CategoryModel(category, categoryLabel, entries);
+ categories.put(category, m);
+ }
+
+ /**
+ * Change la categorie en cours d'édition.
+ *
+ * @param category l'id de la categorie courante
+ */
+ public void setCategory(String category) {
+ if (!categories.containsKey(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());
+ }
+
+ @Override
+ public Iterator<CategoryModel> iterator() {
+ return categories.values().iterator();
+ }
+
+ public CategoryModel getCategoryModel() {
+ return categoryModel;
+ }
+
+ public void setCategoryModel(CategoryModel categoryModel) {
+ CategoryModel old = this.categoryModel;
+ this.categoryModel = categoryModel;
+ firePropertyChange(CATEGORY_MODEL_PROPERTY_NAME, old, categoryModel);
+ }
+
+ public void saveModified() {
+ // compute transients keys (to never be saved)
+ List<String> transients = new ArrayList<String>();
+
+ for (OptionModel option : categoryModel) {
+ if (option.isModified()) {
+ Object value = option.getValue();
+ //TODO TC-20090245 : should try to seek for a mutator, since
+ // mutator could have extra code to be done when modify an option
+ config.setOption(option.getKey(), value == null ? null : value.toString());
+ // this is the new original value
+ option.initValue(value);
+ }
+ if (option.isTransient()) {
+ transients.add(option.getKey());
+ }
+ }
+ // 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);
+ }
+
+ public void reset() {
+ // reset all modified options of the current category
+ for (OptionModel key : categoryModel) {
+ if (key.isModified()) {
+ key.initValue(key.getOriginalValue());
+ }
+ }
+ // 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);
+ }
+
+ public int getCategoryIndex(String category) {
+ int i = 0;
+ for (CategoryModel m : this) {
+ if (category.equals(m.getCategory())) {
+ return i;
+ }
+ i++;
+ }
+ // not found
+ return -1;
+ }
+
+ public void firePropertyChange(String propertyName, Object oldValue, Object newValue) {
+ pcs.firePropertyChange(propertyName, oldValue, newValue);
+ }
+
+ public void addPropertyChangeListener(PropertyChangeListener listener) {
+ pcs.addPropertyChangeListener(listener);
+ }
+
+ public void addPropertyChangeListener(String propertyName, PropertyChangeListener listener) {
+ pcs.addPropertyChangeListener(propertyName, listener);
+ }
+
+ public void removePropertyChangeListener(PropertyChangeListener listener) {
+ pcs.removePropertyChangeListener(listener);
+ }
+
+ public void removePropertyChangeListener(String propertyName, PropertyChangeListener listener) {
+ pcs.removePropertyChangeListener(propertyName, listener);
+ }
+
+ public synchronized boolean hasListeners(String propertyName) {
+ return pcs.hasListeners(propertyName);
+ }
+
+ public synchronized PropertyChangeListener[] getPropertyChangeListeners(String propertyName) {
+ return pcs.getPropertyChangeListeners(propertyName);
+ }
+
+ public synchronized PropertyChangeListener[] getPropertyChangeListeners() {
+ return pcs.getPropertyChangeListeners();
+ }
+}
Added: trunk/jaxx-runtime-swing-widget/src/main/java/jaxx/runtime/swing/editor/config/model/OptionModel.java
===================================================================
--- trunk/jaxx-runtime-swing-widget/src/main/java/jaxx/runtime/swing/editor/config/model/OptionModel.java (rev 0)
+++ trunk/jaxx-runtime-swing-widget/src/main/java/jaxx/runtime/swing/editor/config/model/OptionModel.java 2009-07-27 20:27:58 UTC (rev 1511)
@@ -0,0 +1,98 @@
+/**
+ * *##% 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>. ##%*
+ */
+package jaxx.runtime.swing.editor.config.model;
+
+import org.nuiton.util.ApplicationConfig.OptionDef;
+
+/**
+ * le modele d'une option de la configuration a editer.
+ *
+ * @author tchemit
+ */
+public class OptionModel implements OptionDef {
+
+ protected final OptionDef def;
+ protected boolean valid = true;
+ protected Object originalValue;
+ protected Object value;
+
+ protected OptionModel(OptionDef def, Object value) {
+ this.def = def;
+ initValue(value);
+ }
+
+ @Override
+ public String getKey() {
+ return def.getKey();
+ }
+
+ @Override
+ public Class<?> getType() {
+ return def.getType();
+ }
+
+ @Override
+ public String getDescription() {
+ return def.getDescription();
+ }
+
+ @Override
+ public String getDefaultValue() {
+ return def.getDefaultValue();
+ }
+
+ @Override
+ public boolean isTransient() {
+ return def.isTransient();
+ }
+
+ @Override
+ public boolean isFinal() {
+ return def.isFinal();
+ }
+
+ public Object getOriginalValue() {
+ return originalValue;
+ }
+
+ public Object getValue() {
+ return value;
+ }
+
+ public void setValue(Object value) {
+ this.value = value;
+ }
+
+ public boolean isModified() {
+ return !originalValue.equals(value);
+ }
+
+ public boolean isValid() {
+ return valid;
+ }
+
+ public void setValid(boolean valid) {
+ this.valid = valid;
+ }
+
+ public void initValue(Object originalValue) {
+ this.originalValue = originalValue;
+ this.value = originalValue;
+ }
+}
Added: trunk/jaxx-runtime-swing-widget/src/main/resources/icons/action-config-quit.png
===================================================================
(Binary files differ)
Property changes on: trunk/jaxx-runtime-swing-widget/src/main/resources/icons/action-config-quit.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/jaxx-runtime-swing-widget/src/main/resources/icons/action-config-reset.png
===================================================================
(Binary files differ)
Property changes on: trunk/jaxx-runtime-swing-widget/src/main/resources/icons/action-config-reset.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/jaxx-runtime-swing-widget/src/main/resources/icons/action-config-save.png
===================================================================
(Binary files differ)
Property changes on: trunk/jaxx-runtime-swing-widget/src/main/resources/icons/action-config-save.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
1
0
r1510 - in trunk: . jaxx-runtime-swing/src/main/java/jaxx/runtime jaxx-runtime-swing/src/main/java/jaxx/runtime/swing jaxx-runtime-swing-widget jaxx-runtime-swing-widget/src/main/java/jaxx/runtime/swing jaxx-runtime-swing-widget/src/main/java/jaxx/runtime/swing/editor jaxx-runtime-swing-widget/src/main/resources/i18n
by tchemit@users.labs.libre-entreprise.org July 27, 2009
by tchemit@users.labs.libre-entreprise.org July 27, 2009
July 27, 2009
Author: tchemit
Date: 2009-07-27 22:26:02 +0200 (Mon, 27 Jul 2009)
New Revision: 1510
Modified:
trunk/jaxx-runtime-swing-widget/
trunk/jaxx-runtime-swing-widget/pom.xml
trunk/jaxx-runtime-swing-widget/src/main/java/jaxx/runtime/swing/AboutPanel.jaxx
trunk/jaxx-runtime-swing-widget/src/main/java/jaxx/runtime/swing/ClockWidget.jaxx
trunk/jaxx-runtime-swing-widget/src/main/java/jaxx/runtime/swing/EntityComboBox.jaxx
trunk/jaxx-runtime-swing-widget/src/main/java/jaxx/runtime/swing/EntityComboBoxHandler.java
trunk/jaxx-runtime-swing-widget/src/main/java/jaxx/runtime/swing/ErrorDialogUI.jaxx
trunk/jaxx-runtime-swing-widget/src/main/java/jaxx/runtime/swing/MemoryStatusWidget.jaxx
trunk/jaxx-runtime-swing-widget/src/main/java/jaxx/runtime/swing/StatusMessagePanel.jaxx
trunk/jaxx-runtime-swing-widget/src/main/java/jaxx/runtime/swing/StatusMessagePanelHandler.java
trunk/jaxx-runtime-swing-widget/src/main/java/jaxx/runtime/swing/editor/I18nEditor.jaxx
trunk/jaxx-runtime-swing-widget/src/main/java/jaxx/runtime/swing/editor/NumberEditor.jaxx
trunk/jaxx-runtime-swing-widget/src/main/java/jaxx/runtime/swing/editor/NumberEditorHandler.java
trunk/jaxx-runtime-swing-widget/src/main/java/jaxx/runtime/swing/editor/NumberEditorPopup.css
trunk/jaxx-runtime-swing-widget/src/main/java/jaxx/runtime/swing/editor/TimeEditor.css
trunk/jaxx-runtime-swing-widget/src/main/java/jaxx/runtime/swing/editor/TimeEditor.jaxx
trunk/jaxx-runtime-swing-widget/src/main/java/jaxx/runtime/swing/editor/TimeEditorHandler.java
trunk/jaxx-runtime-swing-widget/src/main/resources/i18n/jaxx-runtime-swing-widget-en_GB.properties
trunk/jaxx-runtime-swing-widget/src/main/resources/i18n/jaxx-runtime-swing-widget-fr_FR.properties
trunk/jaxx-runtime-swing/src/main/java/jaxx/runtime/SwingUtil.java
trunk/jaxx-runtime-swing/src/main/java/jaxx/runtime/swing/I18nTableCellRenderer.java
trunk/pom.xml
Log:
normalize i18n keys in widgets, add ApplicationConfig ui to change preferences, degin of a ColumnSelector (should have a look in swingx...)
Modified: trunk/jaxx-runtime-swing/src/main/java/jaxx/runtime/SwingUtil.java
===================================================================
--- trunk/jaxx-runtime-swing/src/main/java/jaxx/runtime/SwingUtil.java 2009-07-24 08:00:05 UTC (rev 1509)
+++ trunk/jaxx-runtime-swing/src/main/java/jaxx/runtime/SwingUtil.java 2009-07-27 20:26:02 UTC (rev 1510)
@@ -5,6 +5,8 @@
import java.awt.Container;
import java.awt.Desktop;
import java.awt.Dimension;
+import java.awt.Font;
+import java.awt.FontMetrics;
import java.awt.Rectangle;
import java.beans.BeanInfo;
import java.beans.IntrospectionException;
@@ -184,6 +186,26 @@
combo.setItems(items);
}
+ public static int computeTableColumnWidth(JTable table, Font font, int columnIndex, String suffix) {
+ int width = 0;
+ if (font == null) {
+ font = table.getFont();
+ }
+// if (font == null) {
+// TableColumn column = table.getColumnModel().getColumn(columnIndex);
+// font = ((JComponent) column.getCellRenderer()).getFont();
+// }
+ FontMetrics fontMetrics = table.getFontMetrics(font);
+ for (int i = 0, rowCount = table.getRowCount(); i < rowCount; i++) {
+ String key = (String) table.getModel().getValueAt(i, 0);
+ int w = fontMetrics.stringWidth(key + suffix);
+ if (w > width) {
+ width = w;
+ }
+ }
+ return width;
+ }
+
public static void fixTableColumnWidth(JTable table, int columnIndex, int width) {
TableColumn column = table.getColumnModel().getColumn(columnIndex);
column.setMaxWidth(width);
Modified: trunk/jaxx-runtime-swing/src/main/java/jaxx/runtime/swing/I18nTableCellRenderer.java
===================================================================
--- trunk/jaxx-runtime-swing/src/main/java/jaxx/runtime/swing/I18nTableCellRenderer.java 2009-07-24 08:00:05 UTC (rev 1509)
+++ trunk/jaxx-runtime-swing/src/main/java/jaxx/runtime/swing/I18nTableCellRenderer.java 2009-07-27 20:26:02 UTC (rev 1510)
@@ -42,6 +42,7 @@
}
}
+ @Override
public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasfocus, int row, int column) {
if (column > keys.length) {
throw new IndexOutOfBoundsException("colum can not be greater than " + keys.length);
@@ -53,4 +54,13 @@
rendererComponent.setToolTipText(_(tips[index]));
return rendererComponent;
}
+
+ public String[] getKeys() {
+ return keys;
+ }
+
+ public String[] getTips() {
+ return tips;
+ }
+
}
Property changes on: trunk/jaxx-runtime-swing-widget
___________________________________________________________________
Modified: svn:ignore
- velocity.log
target
nbactions.xml
+ velocity.log
target
nbactions.xml
nbproject
Modified: trunk/jaxx-runtime-swing-widget/pom.xml
===================================================================
--- trunk/jaxx-runtime-swing-widget/pom.xml 2009-07-24 08:00:05 UTC (rev 1509)
+++ trunk/jaxx-runtime-swing-widget/pom.xml 2009-07-27 20:26:02 UTC (rev 1510)
@@ -58,6 +58,7 @@
<properties>
<jaxx.addSourcesToClassPath>true</jaxx.addSourcesToClassPath>
+ <!--jaxx.useUIManagerForIcon>true</jaxx.useUIManagerForIcon-->
</properties>
<build>
@@ -96,6 +97,7 @@
<groupId>org.nuiton.i18n</groupId>
<artifactId>maven-i18n-plugin</artifactId>
<configuration>
+ <silent>true</silent>
<entries>
<entry>
<basedir>${maven.gen.dir}/java/</basedir>
Modified: trunk/jaxx-runtime-swing-widget/src/main/java/jaxx/runtime/swing/AboutPanel.jaxx
===================================================================
--- trunk/jaxx-runtime-swing-widget/src/main/java/jaxx/runtime/swing/AboutPanel.jaxx 2009-07-24 08:00:05 UTC (rev 1509)
+++ trunk/jaxx-runtime-swing-widget/src/main/java/jaxx/runtime/swing/AboutPanel.jaxx 2009-07-27 20:26:02 UTC (rev 1510)
@@ -1,3 +1,25 @@
+<!--
+
+/**
+ * *##% 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>. ##%*
+ */
+
+-->
<Table insets='1'
background='{getBackgroundColor()}'
border='{BorderFactory.createLineBorder(Color.BLACK, 1)}'>
@@ -133,7 +155,7 @@
void $afterCompleteSetup() {
buildTopPanel();
- close.setText(_("lutinwidget.aboutframe.ok"));
+ close.setText(_("aboutframe.ok"));
}
]]>
@@ -156,7 +178,7 @@
<row>
<cell weighty='1' fill='both'>
<JTabbedPane id='tabs'>
- <tab title="lutinwidget.aboutframe.about">
+ <tab title="aboutframe.about">
<JScrollPane id='aboutContent' border='{null}'>
<JEditorPane contentType='text/html'
editable='false'
@@ -165,7 +187,7 @@
onHyperlinkUpdate='SwingUtil.openLink(event)'/>
</JScrollPane>
</tab>
- <tab title="lutinwidget.aboutframe.license">
+ <tab title="aboutframe.license">
<JScrollPane id='licenseContent' border='{null}'>
<JTextArea id='licenseTextArea'
editable='false'
@@ -174,7 +196,7 @@
text='{SwingUtil.getStringValue(getLicenseText())}'/>
</JScrollPane>
</tab>
- <tab title="lutinwidget.aboutframe.thirdparty">
+ <tab title="aboutframe.thirdparty">
<JScrollPane id='thirdpartyContent' border='{null}'>
<JTextArea id='thirdpartyTextArea'
editable='false'
@@ -199,4 +221,4 @@
</cell>
</row>
-</Table>
\ No newline at end of file
+</Table>
Modified: trunk/jaxx-runtime-swing-widget/src/main/java/jaxx/runtime/swing/ClockWidget.jaxx
===================================================================
--- trunk/jaxx-runtime-swing-widget/src/main/java/jaxx/runtime/swing/ClockWidget.jaxx 2009-07-24 08:00:05 UTC (rev 1509)
+++ trunk/jaxx-runtime-swing-widget/src/main/java/jaxx/runtime/swing/ClockWidget.jaxx 2009-07-27 20:26:02 UTC (rev 1510)
@@ -1,3 +1,25 @@
+<!--
+
+/**
+ * *##% 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>. ##%*
+ */
+
+-->
<JLabel implements='ActionListener'
foreground='{Color.BLACK}'
background='{Color.WHITE}'>
@@ -30,4 +52,4 @@
}
]]>
</script>
-</JLabel>
\ No newline at end of file
+</JLabel>
Modified: trunk/jaxx-runtime-swing-widget/src/main/java/jaxx/runtime/swing/EntityComboBox.jaxx
===================================================================
--- trunk/jaxx-runtime-swing-widget/src/main/java/jaxx/runtime/swing/EntityComboBox.jaxx 2009-07-24 08:00:05 UTC (rev 1509)
+++ trunk/jaxx-runtime-swing-widget/src/main/java/jaxx/runtime/swing/EntityComboBox.jaxx 2009-07-27 20:26:02 UTC (rev 1510)
@@ -1,3 +1,25 @@
+<!--
+
+/**
+ * *##% 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>. ##%*
+ */
+
+-->
<Table fill='both' insets='0'
onFocusGained='combobox.requestFocus()'
onFocusLost='hidePopup()'>
@@ -2,3 +24,2 @@
-<!--fill='both' insets='0'-->
<!-- auto complete property -->
@@ -42,7 +63,7 @@
<String id='popupTitleText' javaBean='null'/>
- <String id='i18nPrefix' javaBean='"observe.common."'/>
+ <String id='i18nPrefix' javaBean='"entitycombobox.common."'/>
<!-- popup to change sorted property-->
<JPopupMenu id='popup'
Modified: trunk/jaxx-runtime-swing-widget/src/main/java/jaxx/runtime/swing/EntityComboBoxHandler.java
===================================================================
--- trunk/jaxx-runtime-swing-widget/src/main/java/jaxx/runtime/swing/EntityComboBoxHandler.java 2009-07-24 08:00:05 UTC (rev 1509)
+++ trunk/jaxx-runtime-swing-widget/src/main/java/jaxx/runtime/swing/EntityComboBoxHandler.java 2009-07-27 20:26:02 UTC (rev 1510)
@@ -1,3 +1,21 @@
+/**
+ * *##% 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>. ##%*
+ */
package jaxx.runtime.swing;
import java.awt.Component;
@@ -306,7 +324,6 @@
//Container container = ui.getIndexesContainer();
for (int i = 0, max = decorator.getNbContext(); i < max; i++) {
String property = ui.getI18nPrefix() + decorator.getProperty(i);
-// String property = "observe.common." + decorator.getProperty(i);
String propertyI18n = _(property);
JRadioButtonMenuItem button = new JRadioButtonMenuItem(propertyI18n);
button.putClientProperty(JAXXButtonGroup.BUTTON8GROUP_CLIENT_PROPERTY, ui.getIndexes());
@@ -332,7 +349,6 @@
beanI18nKey = n_("entitycombobox.unknown.type");
} else {
beanI18nKey = ui.getI18nPrefix() + Introspector.decapitalize(internalClass.getSimpleName());
- //beanI18nKey = "observe.common." + Introspector.decapitalize(internalClass.getSimpleName());
}
String beanI18n = _(beanI18nKey);
title = _(title, beanI18n);
Modified: trunk/jaxx-runtime-swing-widget/src/main/java/jaxx/runtime/swing/ErrorDialogUI.jaxx
===================================================================
--- trunk/jaxx-runtime-swing-widget/src/main/java/jaxx/runtime/swing/ErrorDialogUI.jaxx 2009-07-24 08:00:05 UTC (rev 1509)
+++ trunk/jaxx-runtime-swing-widget/src/main/java/jaxx/runtime/swing/ErrorDialogUI.jaxx 2009-07-27 20:26:02 UTC (rev 1510)
@@ -1,3 +1,25 @@
+<!--
+
+/**
+ * *##% 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>. ##%*
+ */
+
+-->
<JDialog title='errorUI.title' modal='true'>
<script><![CDATA[
protected static ErrorDialogUI instance;
Modified: trunk/jaxx-runtime-swing-widget/src/main/java/jaxx/runtime/swing/MemoryStatusWidget.jaxx
===================================================================
--- trunk/jaxx-runtime-swing-widget/src/main/java/jaxx/runtime/swing/MemoryStatusWidget.jaxx 2009-07-24 08:00:05 UTC (rev 1509)
+++ trunk/jaxx-runtime-swing-widget/src/main/java/jaxx/runtime/swing/MemoryStatusWidget.jaxx 2009-07-27 20:26:02 UTC (rev 1510)
@@ -1,4 +1,26 @@
+<!--
+/**
+ * *##% 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>. ##%*
+ */
+
+-->
+
<JComponent implements='ActionListener'
foreground='{Color.BLACK}'
background='{Color.WHITE}'
@@ -56,7 +78,7 @@
g.fillRect(insets.left, insets.top, (int) ((float) width * fraction), height);
// No i18n string was :
// String str = usedMemory / 1024 + "/" + totalMemory / 1024 + "Mb";
- String str = _("lutinwidget.message.statusbar.memory", usedMemory / 1024, totalMemory / 1024);
+ String str = _("memorywidget.memory", usedMemory / 1024, totalMemory / 1024);
//FontRenderContext frc = new FontRenderContext(null, false, false);
Rectangle2D bounds = g.getFont().getStringBounds(str, frc);
Graphics g2 = g.create();
@@ -88,4 +110,4 @@
}
]]>
</script>
-</JComponent>
\ No newline at end of file
+</JComponent>
Modified: trunk/jaxx-runtime-swing-widget/src/main/java/jaxx/runtime/swing/StatusMessagePanel.jaxx
===================================================================
--- trunk/jaxx-runtime-swing-widget/src/main/java/jaxx/runtime/swing/StatusMessagePanel.jaxx 2009-07-24 08:00:05 UTC (rev 1509)
+++ trunk/jaxx-runtime-swing-widget/src/main/java/jaxx/runtime/swing/StatusMessagePanel.jaxx 2009-07-27 20:26:02 UTC (rev 1510)
@@ -1,4 +1,26 @@
+<!--
+/**
+ * *##% 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>. ##%*
+ */
+
+-->
+
<Table border='{BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.LOWERED)}'
insets='0'
implements='ActionListener'>
Modified: trunk/jaxx-runtime-swing-widget/src/main/java/jaxx/runtime/swing/StatusMessagePanelHandler.java
===================================================================
--- trunk/jaxx-runtime-swing-widget/src/main/java/jaxx/runtime/swing/StatusMessagePanelHandler.java 2009-07-24 08:00:05 UTC (rev 1509)
+++ trunk/jaxx-runtime-swing-widget/src/main/java/jaxx/runtime/swing/StatusMessagePanelHandler.java 2009-07-27 20:26:02 UTC (rev 1510)
@@ -1,3 +1,21 @@
+/**
+ * *##% 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>. ##%*
+ */
package jaxx.runtime.swing;
import java.awt.Color;
Modified: trunk/jaxx-runtime-swing-widget/src/main/java/jaxx/runtime/swing/editor/I18nEditor.jaxx
===================================================================
--- trunk/jaxx-runtime-swing-widget/src/main/java/jaxx/runtime/swing/editor/I18nEditor.jaxx 2009-07-24 08:00:05 UTC (rev 1509)
+++ trunk/jaxx-runtime-swing-widget/src/main/java/jaxx/runtime/swing/editor/I18nEditor.jaxx 2009-07-27 20:26:02 UTC (rev 1510)
@@ -1,4 +1,26 @@
+<!--
+/**
+ * *##% 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 implements='PropertyChangeListener, ActionListener'
id='content'
layout='{new BorderLayout()}'
@@ -186,4 +208,4 @@
]]>
</script>
-</JPanel>
\ No newline at end of file
+</JPanel>
Modified: trunk/jaxx-runtime-swing-widget/src/main/java/jaxx/runtime/swing/editor/NumberEditor.jaxx
===================================================================
--- trunk/jaxx-runtime-swing-widget/src/main/java/jaxx/runtime/swing/editor/NumberEditor.jaxx 2009-07-24 08:00:05 UTC (rev 1509)
+++ trunk/jaxx-runtime-swing-widget/src/main/java/jaxx/runtime/swing/editor/NumberEditor.jaxx 2009-07-27 20:26:02 UTC (rev 1510)
@@ -1,4 +1,26 @@
+<!--
+/**
+ * *##% 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()}'
onFocusGained='textField.requestFocus()'
onFocusLost='setPopupVisible(false);popup.setVisible(false);'
@@ -48,33 +70,33 @@
<JPanel layout='{new GridLayout(4,4)}'
border='{BorderFactory.createEmptyBorder(4, 4, 4, 4)}'
background='{Color.WHITE}'>
- <JButton text='7' onActionPerformed='addChar(event)' styleClass='digit'/>
- <JButton text='8' onActionPerformed='addChar(event)' styleClass='digit'/>
- <JButton text='9' onActionPerformed='addChar(event)' styleClass='digit'/>
+ <JButton text='numbereditor.7' onActionPerformed='addChar(event)' styleClass='digit'/>
+ <JButton text='numbereditor.8' onActionPerformed='addChar(event)' styleClass='digit'/>
+ <JButton text='numbereditor.9' onActionPerformed='addChar(event)' styleClass='digit'/>
<JButton text='numbereditor.clearAll' onActionPerformed='setModel(null)' styleClass='clear'
enabled='{!getModelText().isEmpty()}'/>
- <JButton text='4' onActionPerformed='addChar(event)' styleClass='digit'/>
- <JButton text='5' onActionPerformed='addChar(event)' styleClass='digit'/>
- <JButton text='6' onActionPerformed='addChar(event)' styleClass='digit'/>
+ <JButton text='numbereditor.4' onActionPerformed='addChar(event)' styleClass='digit'/>
+ <JButton text='numbereditor.5' onActionPerformed='addChar(event)' styleClass='digit'/>
+ <JButton text='numbereditor.6' onActionPerformed='addChar(event)' styleClass='digit'/>
<JButton text='numbereditor.clearOne' onActionPerformed='getHandler().removeChar()' styleClass='clear'
enabled='{!(getModelText().isEmpty() || textField.getCaretPosition() ==0 )}'/>
- <JButton text='1' onActionPerformed='addChar(event)' styleClass='digit'/>
- <JButton text='2' onActionPerformed='addChar(event)' styleClass='digit'/>
- <JButton text='3' onActionPerformed='addChar(event)' styleClass='digit'/>
+ <JButton text='numbereditor.1' onActionPerformed='addChar(event)' styleClass='digit'/>
+ <JButton text='numbereditor.2' onActionPerformed='addChar(event)' styleClass='digit'/>
+ <JButton text='numbereditor.3' onActionPerformed='addChar(event)' styleClass='digit'/>
<JButton enabled="false"/>
- <JButton text='0' onActionPerformed='addChar(event)' styleClass='digit'
+ <JButton text='numbereditor.0' onActionPerformed='addChar(event)' styleClass='digit'
enabled='{!getEditor().getModelText().equals("0")}'/>
<JButton id='toggleSign' text='numbereditor.toggleSign' styleClass='operator'
onActionPerformed='getHandler().toggleSign()'
enabled='{isUseSign() && !getEditor().getModelText().isEmpty()}'/>
- <JButton id='dot' text='.' styleClass='operator'
+ <JButton id='dot' text='numbereditor..' styleClass='operator'
onActionPerformed='addChar(event)'
enabled='{isUseFloat() && getEditor().getModelText().indexOf(".") == -1 }'/>
@@ -127,13 +149,6 @@
onKeyReleased='getHandler().setModel(textField.getText())'
onFocusGained='showPopup()'/>
- <!--JFormattedTextField id='textField' constraints='BorderLayout.CENTER'
- text='{getModelText()}'
- enabled='{isEnabled()}'
- onKeyReleased='getHandler().setModel(textField.getText())'
- focusLostBehavior='0'
- onFocusGained='showPopup()'/-->
-
<JToolBar constraints='BorderLayout.EAST'
floatable='false'
opaque='false'
@@ -149,4 +164,4 @@
onActionPerformed='getHandler().setPopupVisible(!popup.isVisible())'/>
</JToolBar>
-</JPanel>
\ No newline at end of file
+</JPanel>
Modified: trunk/jaxx-runtime-swing-widget/src/main/java/jaxx/runtime/swing/editor/NumberEditorHandler.java
===================================================================
--- trunk/jaxx-runtime-swing-widget/src/main/java/jaxx/runtime/swing/editor/NumberEditorHandler.java 2009-07-24 08:00:05 UTC (rev 1509)
+++ trunk/jaxx-runtime-swing-widget/src/main/java/jaxx/runtime/swing/editor/NumberEditorHandler.java 2009-07-27 20:26:02 UTC (rev 1510)
@@ -1,3 +1,21 @@
+/**
+ * *##% 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>. ##%*
+ */
package jaxx.runtime.swing.editor;
import java.awt.Dimension;
Modified: trunk/jaxx-runtime-swing-widget/src/main/java/jaxx/runtime/swing/editor/NumberEditorPopup.css
===================================================================
--- trunk/jaxx-runtime-swing-widget/src/main/java/jaxx/runtime/swing/editor/NumberEditorPopup.css 2009-07-24 08:00:05 UTC (rev 1509)
+++ trunk/jaxx-runtime-swing-widget/src/main/java/jaxx/runtime/swing/editor/NumberEditorPopup.css 2009-07-27 20:26:02 UTC (rev 1510)
@@ -1,3 +1,21 @@
+/**
+ * *##% 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>. ##%*
+ */
JButton {
font-size: 14;
focusPainted: false;
Modified: trunk/jaxx-runtime-swing-widget/src/main/java/jaxx/runtime/swing/editor/TimeEditor.css
===================================================================
--- trunk/jaxx-runtime-swing-widget/src/main/java/jaxx/runtime/swing/editor/TimeEditor.css 2009-07-24 08:00:05 UTC (rev 1509)
+++ trunk/jaxx-runtime-swing-widget/src/main/java/jaxx/runtime/swing/editor/TimeEditor.css 2009-07-27 20:26:02 UTC (rev 1510)
@@ -1,3 +1,21 @@
+/**
+ * *##% 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>. ##%*
+ */
#title{
text:{getLabel()};
horizontalAlignment:center;
@@ -10,7 +28,7 @@
}
#labelH {
- text:"H";
+ text:"timeeditor.H";
horizontalAlignment:center;
}
#minute{
Modified: trunk/jaxx-runtime-swing-widget/src/main/java/jaxx/runtime/swing/editor/TimeEditor.jaxx
===================================================================
--- trunk/jaxx-runtime-swing-widget/src/main/java/jaxx/runtime/swing/editor/TimeEditor.jaxx 2009-07-24 08:00:05 UTC (rev 1509)
+++ trunk/jaxx-runtime-swing-widget/src/main/java/jaxx/runtime/swing/editor/TimeEditor.jaxx 2009-07-27 20:26:02 UTC (rev 1510)
@@ -1,4 +1,26 @@
+<!--
+/**
+ * *##% 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='TimeEditor.css'/>
Modified: trunk/jaxx-runtime-swing-widget/src/main/java/jaxx/runtime/swing/editor/TimeEditorHandler.java
===================================================================
--- trunk/jaxx-runtime-swing-widget/src/main/java/jaxx/runtime/swing/editor/TimeEditorHandler.java 2009-07-24 08:00:05 UTC (rev 1509)
+++ trunk/jaxx-runtime-swing-widget/src/main/java/jaxx/runtime/swing/editor/TimeEditorHandler.java 2009-07-27 20:26:02 UTC (rev 1510)
@@ -1,3 +1,21 @@
+/**
+ * *##% 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>. ##%*
+ */
package jaxx.runtime.swing.editor;
import java.awt.event.MouseAdapter;
Modified: trunk/jaxx-runtime-swing-widget/src/main/resources/i18n/jaxx-runtime-swing-widget-en_GB.properties
===================================================================
--- trunk/jaxx-runtime-swing-widget/src/main/resources/i18n/jaxx-runtime-swing-widget-en_GB.properties 2009-07-24 08:00:05 UTC (rev 1509)
+++ trunk/jaxx-runtime-swing-widget/src/main/resources/i18n/jaxx-runtime-swing-widget-en_GB.properties 2009-07-27 20:26:02 UTC (rev 1510)
@@ -1,15 +1,39 @@
-.=.
-0=0
-1=1
-2=2
-3=3
-4=4
-5=5
-6=6
-7=7
-8=8
-9=9
-H=H
+aboutframe.about=About
+aboutframe.license=License
+aboutframe.ok=OK
+aboutframe.thirdparty=Third party
+columnselection.action.tip=
+columnselector.action.tip=
+config.action.quit=Quit
+config.action.quit.tip=Quit the configuration editor
+config.action.reset=Cancel
+config.action.reset.tip=Cancel the modifications for the category
+config.action.save=Save
+config.action.save.tip=Save the modifications for the category
+config.choice.cancel=Cancel
+config.choice.continue=Continue
+config.choice.doNotSave=Do not save
+config.choice.save=Save
+config.defaultValue=Default value
+config.defaultValue.tip=Default value of the option
+config.descrition=Description
+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.key=Key
+config.key.tip=Key of the option
+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.modified=Option was modified (previous value \: %1$s)
+config.no.option.selected=< No selected option >
+config.option.final=This option can not be modified
+config.option.label=Option '%1$s' (%2$s)
+config.option.modified=Value is modified < original value \: '%1$s' - new value \: '%2$s' >
+config.title=Preferences
+config.title.need.confirm=A confirmation is required
+config.unmodifiable=Can not be modified
+config.unvalid=Option is not valid \! (previous value \: %1$s, required type \: %2$s)
+config.value=Value
+config.value.tip=Value of the option
entitycombobox.action.reset.tip=Reset the selected value
entitycombobox.action.sort.tip=Change the sorted property
entitycombobox.popup.label=Object '%1$s'
@@ -24,13 +48,21 @@
i18neditor.popup.title=Change language
i18neditor.selected=Selected language \: %1$s
i18neditor.unselected=Select this langage \: %1$s
-lutinwidget.aboutframe.about=About
-lutinwidget.aboutframe.license=License
-lutinwidget.aboutframe.ok=OK
-lutinwidget.aboutframe.thirdparty=Third party
-lutinwidget.message.statusbar.memory=%d/%dMb
+memorywidget.memory=%d/%dMb
+numbereditor..=.
+numbereditor.0=0
+numbereditor.1=1
+numbereditor.2=2
+numbereditor.3=3
+numbereditor.4=4
+numbereditor.5=5
+numbereditor.6=6
+numbereditor.7=7
+numbereditor.8=8
+numbereditor.9=9
numbereditor.action.reset.tip=Reset
numbereditor.action.show.tip=Show numeric panel
numbereditor.clearAll=C
numbereditor.clearOne=CE
numbereditor.toggleSign=+/-
+timeeditor.H=H
Modified: trunk/jaxx-runtime-swing-widget/src/main/resources/i18n/jaxx-runtime-swing-widget-fr_FR.properties
===================================================================
--- trunk/jaxx-runtime-swing-widget/src/main/resources/i18n/jaxx-runtime-swing-widget-fr_FR.properties 2009-07-24 08:00:05 UTC (rev 1509)
+++ trunk/jaxx-runtime-swing-widget/src/main/resources/i18n/jaxx-runtime-swing-widget-fr_FR.properties 2009-07-27 20:26:02 UTC (rev 1510)
@@ -1,15 +1,40 @@
-.=.
-0=0
-1=1
-2=2
-3=3
-4=4
-5=5
-6=6
-7=7
-8=8
-9=9
-H=H
+aboutframe.about=\u00C0 propos
+aboutframe.license=Licence
+aboutframe.ok=OK
+aboutframe.thirdparty=Tierce partie
+columnselection.action.tip=
+columnselector.action.tip=
+config.action.quit=Quitter
+config.action.quit.tip=Quitter l'\u00E9diteur de configuration
+config.action.reset=Annuler
+config.action.reset.tip=Annuler les modifications de cette cat\u00E9gorie
+config.action.save=Enregistrer
+config.action.save.tip=Sauver les modifications de cette cat\u00E9gorie
+config.choice.cancel=Annuler
+config.choice.continue=Continuer
+config.choice.doNotSave=Ne pas enregistrer
+config.choice.save=Enregistrer
+config.defaultValue=Valeur par d\u00E9faut
+config.defaultValue.tip=Valeur par d\u00E9faut de l'option
+config.descrition=Description
+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.key=Clef
+config.key.tip=Clef de l'option
+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.modified=Option modifi\u00E9e (valeur originale \: %1$s)
+config.no.option.selected=< Pas d'option s\u00E9lectionn\u00E9e >
+config.option.final=Option non modifiable
+config.option.label=Option '%1$s' (%2$s)
+config.option.modified=Valeur modifi\u00E9e < nouvelle valeur \: '%1$s' - ancienne valeur \: '%2$s' >
+config.option.valid=Valeur non valide
+config.title=Pr\u00E9f\u00E9rences
+config.title.need.confirm=Une confirmation de votre part est requise...
+config.unmodifiable=Ne peut pas \u00EAtre modifi\u00E9
+config.unvalid=Option non valide (valeur originale \: %1$s, type requis \: %2$s)
+config.value=Valeur
+config.value.tip=Valeur de l'option
entitycombobox.action.reset.tip=R\u00E9initialiser la valeur de la liste d\u00E9roulante
entitycombobox.action.sort.tip=Modifier le tri de la liste d\u00E9roulante
entitycombobox.popup.label=Objet '%1$s'
@@ -24,13 +49,21 @@
i18neditor.popup.title=Changer de langue
i18neditor.selected=Langue actuellement utilis\u00E9e \: %1$s
i18neditor.unselected=Pour utiliser cette langue \: %1$s
-lutinwidget.aboutframe.about=\u00C0 propos
-lutinwidget.aboutframe.license=Licence
-lutinwidget.aboutframe.ok=OK
-lutinwidget.aboutframe.thirdparty=Tierce partie
-lutinwidget.message.statusbar.memory=%d/%dMo
+memorywidget.memory=%d/%dMo
+numbereditor..=.
+numbereditor.0=0
+numbereditor.1=1
+numbereditor.2=2
+numbereditor.3=3
+numbereditor.4=4
+numbereditor.5=5
+numbereditor.6=6
+numbereditor.7=7
+numbereditor.8=8
+numbereditor.9=9
numbereditor.action.reset.tip=R\u00E9initialiser
numbereditor.action.show.tip=Afficher le pav\u00E9 num\u00E9rique
numbereditor.clearAll=C
numbereditor.clearOne=CE
numbereditor.toggleSign=+/-
+timeeditor.H=H
Modified: trunk/pom.xml
===================================================================
--- trunk/pom.xml 2009-07-24 08:00:05 UTC (rev 1509)
+++ trunk/pom.xml 2009-07-27 20:26:02 UTC (rev 1510)
@@ -10,7 +10,7 @@
<parent>
<groupId>org.nuiton</groupId>
<artifactId>mavenpom</artifactId>
- <version>1.0.0-rc-4</version>
+ <version>1.0.0-rc-5-SNAPSHOT</version>
</parent>
<artifactId>jaxx</artifactId>
@@ -172,8 +172,8 @@
<!-- pour un muli module on doit fixer le projectId -->
<projectId>jaxx</projectId>
- <lutinutil.version>1.1.0-rc-8</lutinutil.version>
- <i18n.version>1.0.0-rc-4</i18n.version>
+ <lutinutil.version>1.1.0-rc-9-SNAPSHOT</lutinutil.version>
+ <i18n.version>1.0.0-rc-5-SNAPSHOT</i18n.version>
</properties>
1
0
r1532 - in trunk/guix-compiler-swing/src: main/java/org/nuiton/guix main/java/org/nuiton/guix/events main/java/org/nuiton/guix/generator test/java test/java/org test/java/org/nuiton test/java/org/nuiton/guix
by kmorin@users.labs.libre-entreprise.org July 27, 2009
by kmorin@users.labs.libre-entreprise.org July 27, 2009
July 27, 2009
Author: kmorin
Date: 2009-07-27 14:37:53 +0200 (Mon, 27 Jul 2009)
New Revision: 1532
Added:
trunk/guix-compiler-swing/src/main/java/org/nuiton/guix/SwingEventHandler.java
trunk/guix-compiler-swing/src/test/java/org/
trunk/guix-compiler-swing/src/test/java/org/nuiton/
trunk/guix-compiler-swing/src/test/java/org/nuiton/guix/
trunk/guix-compiler-swing/src/test/java/org/nuiton/guix/SwingEventHandlerTest.java
Removed:
trunk/guix-compiler-swing/src/main/java/org/nuiton/guix/events/SwingEventHandler.java
Modified:
trunk/guix-compiler-swing/src/main/java/org/nuiton/guix/generator/SwingAbstractClassGenerator.java
Log:
add not null parameters condition in SwingEventHandler's addEvent method
+ add test for SwingEventHandler methods
Copied: trunk/guix-compiler-swing/src/main/java/org/nuiton/guix/SwingEventHandler.java (from rev 1518, trunk/guix-compiler-swing/src/main/java/org/nuiton/guix/events/SwingEventHandler.java)
===================================================================
--- trunk/guix-compiler-swing/src/main/java/org/nuiton/guix/SwingEventHandler.java (rev 0)
+++ trunk/guix-compiler-swing/src/main/java/org/nuiton/guix/SwingEventHandler.java 2009-07-27 12:37:53 UTC (rev 1532)
@@ -0,0 +1,157 @@
+/**
+ * *##% guix-compiler-swing
+ * Copyright (C) 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 org.nuiton.guix;
+
+import java.beans.BeanInfo;
+import java.beans.EventSetDescriptor;
+import java.beans.IntrospectionException;
+import java.beans.Introspector;
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Method;
+import java.util.HashMap;
+import java.util.Map;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+/**
+ * Handles the Swing events
+ *
+ * @author kmorin
+ */
+public class SwingEventHandler {
+
+ /** log */
+ Log log = LogFactory.getLog(SwingEventHandler.class);
+ /** Maps EventSetDescriptors with a map of the listener method and actions to execute */
+ Map<EventSetDescriptor, Map<Method, String>> map = new HashMap<EventSetDescriptor, Map<Method, String>>();
+
+ /**
+ * Add an event to the map
+ *
+ * @param clazz the class of the object supposed to listen to the event
+ * @param name name of the event
+ * @param value code to execute when the events occurs
+ * @return true if the name corresponds with an event
+ * @throws java.beans.IntrospectionException if the JVM failed while getting the bean infos of the class
+ */
+ public boolean addEvent(Class clazz, String name, String value) throws IntrospectionException {
+ if(clazz == null || name == null || value == null) {
+ return false;
+ }
+
+ //get the bean info of the class
+ BeanInfo bi = Introspector.getBeanInfo(clazz);
+ //get the array of EventSetDescriptor of the class
+ EventSetDescriptor[] esds = bi.getEventSetDescriptors();
+
+ int i = 0;
+ int j = 0;
+ EventSetDescriptor esd = null;
+ Method method = null;
+
+ //while any event with the name "name" has been found, browse the EventSetDescriptors
+ while (i < esds.length && method == null) {
+ j = 0;
+ //get the listener methods of the EventSetDescriptor
+ Method[] methods = esds[i].getListenerMethods();
+ while (j < esds[i].getListenerMethods().length && method == null) {
+ if(methods[j].getName().equals(name)) {
+ method = methods[j];
+ esd = esds[i];
+ }
+ j++;
+ }
+ i++;
+ }
+ //if the event has been found in the bean info
+ if (method != null) {
+ //remove braces
+ while(value.startsWith("{") && value.endsWith("}")) {
+ value = value.substring(1, value.length() - 1);
+ }
+ //add final semicolon
+ if(!value.endsWith(";"))
+ value += ";";
+ //if the EventSetDescriptor has not been yet recorded for another event
+ if (map.get(esd) == null) {
+ Map<Method, String> methods = new HashMap<Method, String>();
+ methods.put(method, value);
+ map.put(esd, methods);
+ }
+ else if(map.get(esd).get(method) != null) {
+ map.get(esd).put(method, map.get(esd).get(method) + value);
+ }
+ else {
+ map.get(esd).put(method, value);
+ }
+ }
+ else
+ if(log.isWarnEnabled())
+ log.warn("Event " + name + " not found.");
+ return method != null;
+ }
+
+ /**
+ * Generates the code for all the events applied to an object
+ *
+ * @param object the objects to add the listeners
+ * @return the generated code
+ */
+ public String generate(String object) {
+ //result
+ StringBuffer result = new StringBuffer();
+ //for every EventSetDescriptor
+ for (EventSetDescriptor e : map.keySet()) {
+ //add new ListenerMethod
+ result.append(object)
+ .append(".")
+ .append(e.getAddListenerMethod().getName())
+ .append("(new ")
+ //if only one event is handled for this EventSetDescriptor then add a listener, else add an adapter
+ .append(e.getListenerMethods().length == 1 ?
+ e.getListenerType().getCanonicalName() :
+ e.getListenerType().getCanonicalName().replace("Listener", "Adapter"))
+ .append("() {\n");
+ //for every event handled for the EventSetDescriptor
+ for(Method m : map.get(e).keySet()) {
+ for(Annotation a : m.getDeclaredAnnotations())
+ result.append(a.toString()).append("\n");
+ //add the method that handles the event
+ result.append("public ")
+ .append(m.getReturnType().getCanonicalName())
+ .append(" ")
+ .append(m.getName())
+ .append("(");
+ for(Class clazz : m.getParameterTypes())
+ result.append(clazz.getCanonicalName())
+ .append(" ")
+ .append(Character.toLowerCase(clazz.getName().charAt(clazz.getName().lastIndexOf('.') + 1)))
+ .append(clazz.getName().substring(clazz.getName().lastIndexOf('.') + 2))
+ .append(", ");
+ result.delete(result.length() - 2, result.length())
+ .append(")")
+ .append("{\n")
+ .append(map.get(e).get(m))
+ .append("\n}\n");
+ }
+ result.append("});\n\n");
+ }
+ return result.toString();
+ }
+}
Property changes on: trunk/guix-compiler-swing/src/main/java/org/nuiton/guix/SwingEventHandler.java
___________________________________________________________________
Added: svn:mergeinfo
+
Deleted: trunk/guix-compiler-swing/src/main/java/org/nuiton/guix/events/SwingEventHandler.java
===================================================================
--- trunk/guix-compiler-swing/src/main/java/org/nuiton/guix/events/SwingEventHandler.java 2009-07-27 12:37:18 UTC (rev 1531)
+++ trunk/guix-compiler-swing/src/main/java/org/nuiton/guix/events/SwingEventHandler.java 2009-07-27 12:37:53 UTC (rev 1532)
@@ -1,152 +0,0 @@
-/**
- * *##% guix-compiler-swing
- * Copyright (C) 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 org.nuiton.guix.events;
-
-import java.beans.BeanInfo;
-import java.beans.EventSetDescriptor;
-import java.beans.IntrospectionException;
-import java.beans.Introspector;
-import java.lang.annotation.Annotation;
-import java.lang.reflect.Method;
-import java.util.HashMap;
-import java.util.Map;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-/**
- * Handles the Swing events
- *
- * @author kmorin
- */
-public class SwingEventHandler {
-
- /** log */
- Log log = LogFactory.getLog(SwingEventHandler.class);
- /** Maps EventSetDescriptors with a map of the listener method and actions to execute */
- Map<EventSetDescriptor, Map<Method, String>> map = new HashMap<EventSetDescriptor, Map<Method, String>>();
-
- /**
- * Add an event to the map
- *
- * @param clazz the class of the object...
- * @param name name of the event
- * @param value code to execute when the events occurs
- * @return true if the name corresponds with an event
- * @throws java.beans.IntrospectionException if the JVM failed while getting the bean infos of the class
- */
- public boolean addEvent(Class clazz, String name, String value) throws IntrospectionException {
- //get the bean info of the class
- BeanInfo bi = Introspector.getBeanInfo(clazz);
- //get the array of EventSetDescriptor of the class
- EventSetDescriptor[] esds = bi.getEventSetDescriptors();
-
- int i = 0;
- int j = 0;
- EventSetDescriptor esd = null;
- Method method = null;
-
- //while any event with the name "name" has been found, browse the EventSetDescriptors
- while (i < esds.length && method == null) {
- j = 0;
- //get the listener methods of the EventSetDescriptor
- Method[] methods = esds[i].getListenerMethods();
- while (j < esds[i].getListenerMethods().length && method == null) {
- if(methods[j].getName().equals(name)) {
- method = methods[j];
- esd = esds[i];
- }
- j++;
- }
- i++;
- }
- //if the event has been found in the bean info
- if (method != null) {
- //remove braces
- while(value.startsWith("{") && value.endsWith("}"))
- value = value.substring(1, value.length() - 1);
- //add final semicolon
- if(!value.endsWith(";"))
- value += ";";
- //if the EventSetDescriptor has not been yet recorded for another event
- if (map.get(esd) == null) {
- Map<Method, String> methods = new HashMap<Method, String>();
- methods.put(method, value);
- map.put(esd, methods);
- }
- else if(map.get(esd).get(method) != null) {
- map.get(esd).put(method, map.get(esd).get(method) + value);
- }
- else {
- map.get(esd).put(method, value);
- }
- }
- else
- if(log.isWarnEnabled())
- log.warn("Event " + name + " not found.");
- return method != null;
- }
-
- /**
- * Generates the code for all the events applied to an object
- *
- * @param object the objects to add the listeners
- * @return the generated code
- */
- public String generate(String object) {
- //result
- StringBuffer result = new StringBuffer();
- //for every EventSetDescriptor
- for (EventSetDescriptor e : map.keySet()) {
- //add new ListenerMethod
- result.append(object)
- .append(".")
- .append(e.getAddListenerMethod().getName())
- .append("(new ")
- //if only one event is handled for this EventSetDescriptor then add a listener, else add an adapter
- .append(e.getListenerMethods().length == 1 ?
- e.getListenerType().getCanonicalName() :
- e.getListenerType().getCanonicalName().replace("Listener", "Adapter"))
- .append("() {\n");
- //for every event handled for the EventSetDescriptor
- for(Method m : map.get(e).keySet()) {
- for(Annotation a : m.getDeclaredAnnotations())
- result.append(a.toString()).append("\n");
- //add the method that handles the event
- result.append("public ")
- .append(m.getReturnType().getCanonicalName())
- .append(" ")
- .append(m.getName())
- .append("(");
- for(Class clazz : m.getParameterTypes())
- result.append(clazz.getCanonicalName())
- .append(" ")
- .append(Character.toLowerCase(clazz.getName().charAt(clazz.getName().lastIndexOf('.') + 1)))
- .append(clazz.getName().substring(clazz.getName().lastIndexOf('.') + 2))
- .append(", ");
- result.delete(result.length() - 2, result.length())
- .append(")")
- .append("{\n")
- .append(map.get(e).get(m))
- .append("\n}\n");
- }
- result.append("});\n\n");
- }
- return result.toString();
- }
-}
Modified: trunk/guix-compiler-swing/src/main/java/org/nuiton/guix/generator/SwingAbstractClassGenerator.java
===================================================================
--- trunk/guix-compiler-swing/src/main/java/org/nuiton/guix/generator/SwingAbstractClassGenerator.java 2009-07-27 12:37:18 UTC (rev 1531)
+++ trunk/guix-compiler-swing/src/main/java/org/nuiton/guix/generator/SwingAbstractClassGenerator.java 2009-07-27 12:37:53 UTC (rev 1532)
@@ -34,7 +34,7 @@
import java.util.Map;
import java.util.Map.Entry;
import org.nuiton.guix.databinding.BindingUtils;
-import org.nuiton.guix.events.SwingEventHandler;
+import org.nuiton.guix.SwingEventHandler;
import org.nuiton.guix.model.AttributeDescriptor;
import org.nuiton.guix.model.ClassDescriptor;
import org.nuiton.guix.model.Rule;
@@ -539,7 +539,7 @@
* Transform the css attributes into AttributeDescriptors
*
* @param gmo the GuixModelObject which has got the css attributes
- * @param seh a SwingEventHandler
+ * @param seh a SwingEventHandlerTest
* @param clazz gmo's class
*/
private void processCSSAttributes(GuixModelObject gmo, SwingEventHandler seh, Class clazz) {
Added: trunk/guix-compiler-swing/src/test/java/org/nuiton/guix/SwingEventHandlerTest.java
===================================================================
--- trunk/guix-compiler-swing/src/test/java/org/nuiton/guix/SwingEventHandlerTest.java (rev 0)
+++ trunk/guix-compiler-swing/src/test/java/org/nuiton/guix/SwingEventHandlerTest.java 2009-07-27 12:37:53 UTC (rev 1532)
@@ -0,0 +1,79 @@
+/**
+ * *##% guix-compiler-swing
+ * Copyright (C) 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 org.nuiton.guix;
+
+import java.beans.IntrospectionException;
+import javax.swing.JComponent;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.junit.Test;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+
+/**
+ * Tests the methods of the class SwingEventTestHandler
+ *
+ * @author kmorin
+ */
+public class SwingEventHandlerTest {
+
+ Log log = LogFactory.getLog(SwingEventHandlerTest.class);
+
+ /**
+ * Tests the method addEvent
+ */
+ @Test
+ public void testAddEvent() {
+ SwingEventHandler seh = new SwingEventHandler();
+ try {
+ assertFalse(seh.addEvent(null, "", ""));
+ assertFalse(seh.addEvent(JComponent.class, null, ""));
+ assertFalse(seh.addEvent(JComponent.class, "", null));
+ assertTrue(seh.addEvent(JComponent.class, "propertyChange", "test1"));
+ assertTrue(seh.addEvent(JComponent.class, "propertyChange", "test2"));
+ assertFalse(seh.addEvent(JComponent.class, "azerty", ""));
+ }
+ catch (IntrospectionException eee) {
+ if(log.isErrorEnabled()) {
+ log.error(eee);
+ }
+ }
+ }
+
+ /**
+ * Tests the method generate
+ */
+ @Test
+ public void testGenerate() {
+ SwingEventHandler seh = new SwingEventHandler();
+ try {
+ assertNotNull(seh.generate(""));
+ assertEquals(seh.generate(""), "");
+ seh.addEvent(JComponent.class, "propertyChange", "");
+ assertTrue(seh.generate("").length() > 0);
+ }
+ catch (IntrospectionException eee) {
+ if(log.isErrorEnabled()) {
+ log.error(eee);
+ }
+ }
+ }
+}
1
0
r1531 - in trunk/guix-compiler-gwt/src: main/java/org/nuiton/guix main/java/org/nuiton/guix/events main/java/org/nuiton/guix/generator test/java test/java/org test/java/org/nuiton test/java/org/nuiton/guix
by kmorin@users.labs.libre-entreprise.org July 27, 2009
by kmorin@users.labs.libre-entreprise.org July 27, 2009
July 27, 2009
Author: kmorin
Date: 2009-07-27 14:37:18 +0200 (Mon, 27 Jul 2009)
New Revision: 1531
Added:
trunk/guix-compiler-gwt/src/main/java/org/nuiton/guix/GwtEventHandler.java
trunk/guix-compiler-gwt/src/test/java/org/
trunk/guix-compiler-gwt/src/test/java/org/nuiton/
trunk/guix-compiler-gwt/src/test/java/org/nuiton/guix/
trunk/guix-compiler-gwt/src/test/java/org/nuiton/guix/GwtEventHandlerTest.java
Removed:
trunk/guix-compiler-gwt/src/main/java/org/nuiton/guix/events/GwtEventHandler.java
Modified:
trunk/guix-compiler-gwt/src/main/java/org/nuiton/guix/generator/GwtAbstractClassGenerator.java
Log:
add not null parameters condition in GwtEventHandler's addEvent method
+ add test for GwtEventHandler methods
Copied: trunk/guix-compiler-gwt/src/main/java/org/nuiton/guix/GwtEventHandler.java (from rev 1518, trunk/guix-compiler-gwt/src/main/java/org/nuiton/guix/events/GwtEventHandler.java)
===================================================================
--- trunk/guix-compiler-gwt/src/main/java/org/nuiton/guix/GwtEventHandler.java (rev 0)
+++ trunk/guix-compiler-gwt/src/main/java/org/nuiton/guix/GwtEventHandler.java 2009-07-27 12:37:18 UTC (rev 1531)
@@ -0,0 +1,150 @@
+/**
+ * *##% guix-compiler-gwt
+ * Copyright (C) 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 org.nuiton.guix;
+
+import java.beans.BeanInfo;
+import java.beans.EventSetDescriptor;
+import java.beans.IntrospectionException;
+import java.beans.Introspector;
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Method;
+import java.util.HashMap;
+import java.util.Map;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+/**
+ * Handles the events of GWT
+ *
+ * @author kmorin
+ */
+public class GwtEventHandler {
+ /** log */
+ Log log = LogFactory.getLog(GwtEventHandler.class);
+ /** Maps EventSetDescriptors with a map of the listener method and actions to execute */
+ Map<EventSetDescriptor, Map<Method, String>> map = new HashMap<EventSetDescriptor, Map<Method, String>>();
+
+ /**
+ * Add an event to the map
+ *
+ * @param clazz the class of the object...
+ * @param name name of the event
+ * @param value code to execute when the events occurs
+ * @return true if the name corresponds with an event
+ * @throws java.beans.IntrospectionException if the JVM failed while getting the bean infos of the class
+ */
+ public boolean addEvent(Class clazz, String name, String value) throws IntrospectionException {
+ if(clazz == null || name == null || value == null) {
+ return false;
+ }
+ //get the bean info of the class
+ BeanInfo bi = Introspector.getBeanInfo(clazz);
+ //get the array of EventSetDescriptor of the class
+ EventSetDescriptor[] esds = bi.getEventSetDescriptors();
+
+ int i = 0;
+ int j = 0;
+ EventSetDescriptor esd = null;
+ Method method = null;
+
+ //while any event with the name "name" has been found, browse the EventSetDescriptors
+ while (i < esds.length && method == null) {
+ j = 0;
+ //get the listener methods of the EventSetDescriptor
+ Method[] methods = esds[i].getAddListenerMethod().getParameterTypes()[0].getMethods();
+ while (j < methods.length && method == null) {
+ if(methods[j].getName().equals(name)) {
+ method = methods[j];
+ esd = esds[i];
+ }
+ j++;
+ }
+ i++;
+ }
+ //if the event has been found in the bean info
+ if (method != null) {
+ //remove braces
+ while(value.startsWith("{") && value.endsWith("}"))
+ value = value.substring(1, value.length() - 1);
+ //add final semicolon
+ if(!value.endsWith(";"))
+ value += ";";
+ //if the EventSetDescriptor has not been yet recorded for another event
+ if (map.get(esd) == null) {
+ Map<Method, String> methods = new HashMap<Method, String>();
+ methods.put(method, value);
+ map.put(esd, methods);
+ }
+ else {
+ map.get(esd).put(method, value);
+ }
+ }
+ else if(log.isWarnEnabled()) {
+ log.warn("Event " + name + " not found.");
+ }
+ return method != null;
+ }
+
+ /**
+ * Generates the code for all the events applied to an object
+ *
+ * @param object the objects to add the listeners
+ * @return the generated code
+ */
+ public String generate(String object) {
+ //result
+ StringBuffer result = new StringBuffer();
+ //for each EventSetDescriptor
+ for (EventSetDescriptor e : map.keySet()) {
+ //add new ListenerMethod
+ result.append(object)
+ .append(".")
+ .append(e.getAddListenerMethod().getName())
+ .append("(new ")
+ .append(e.getListenerType().getCanonicalName())
+ //if only one event is handled for this EventSetDescriptor then add a listener, else add an adapter
+ .append(e.getAddListenerMethod().getParameterTypes()[0].getMethods().length == 1 ? "" : "Adapter")
+ .append("() {\n");
+ //for every event handled for the EventSetDescriptor
+ for(Method m : map.get(e).keySet()) {
+ for(Annotation a : m.getDeclaredAnnotations())
+ result.append(a.toString()).append("\n");
+ //add the method that handles the event
+ result.append("public ")
+ .append(m.getReturnType().getCanonicalName())
+ .append(" ")
+ .append(m.getName())
+ .append("(");
+ for(int n = 0 ; n < m.getParameterTypes().length ; n++) {
+ result.append(m.getParameterTypes()[n].getCanonicalName())
+ .append(" arg")
+ .append(n)
+ .append(", ");
+ }
+ result.delete(result.length() - 2, result.length())
+ .append(")")
+ .append("{\n")
+ .append(map.get(e).get(m))
+ .append("\n}\n");
+ }
+ result.append("});\n\n");
+ }
+ return result.toString();
+ }
+}
Property changes on: trunk/guix-compiler-gwt/src/main/java/org/nuiton/guix/GwtEventHandler.java
___________________________________________________________________
Added: svn:mergeinfo
+
Deleted: trunk/guix-compiler-gwt/src/main/java/org/nuiton/guix/events/GwtEventHandler.java
===================================================================
--- trunk/guix-compiler-gwt/src/main/java/org/nuiton/guix/events/GwtEventHandler.java 2009-07-27 07:29:15 UTC (rev 1530)
+++ trunk/guix-compiler-gwt/src/main/java/org/nuiton/guix/events/GwtEventHandler.java 2009-07-27 12:37:18 UTC (rev 1531)
@@ -1,147 +0,0 @@
-/**
- * *##% guix-compiler-gwt
- * Copyright (C) 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 org.nuiton.guix.events;
-
-import java.beans.BeanInfo;
-import java.beans.EventSetDescriptor;
-import java.beans.IntrospectionException;
-import java.beans.Introspector;
-import java.lang.annotation.Annotation;
-import java.lang.reflect.Method;
-import java.util.HashMap;
-import java.util.Map;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-/**
- * Handles the events of GWT
- *
- * @author kmorin
- */
-public class GwtEventHandler {
- /** log */
- Log log = LogFactory.getLog(GwtEventHandler.class);
- /** Maps EventSetDescriptors with a map of the listener method and actions to execute */
- Map<EventSetDescriptor, Map<Method, String>> map = new HashMap<EventSetDescriptor, Map<Method, String>>();
-
- /**
- * Add an event to the map
- *
- * @param clazz the class of the object...
- * @param name name of the event
- * @param value code to execute when the events occurs
- * @return true if the name corresponds with an event
- * @throws java.beans.IntrospectionException if the JVM failed while getting the bean infos of the class
- */
- public boolean addEvent(Class clazz, String name, String value) throws IntrospectionException {
- //get the bean info of the class
- BeanInfo bi = Introspector.getBeanInfo(clazz);
- //get the array of EventSetDescriptor of the class
- EventSetDescriptor[] esds = bi.getEventSetDescriptors();
-
- int i = 0;
- int j = 0;
- EventSetDescriptor esd = null;
- Method method = null;
-
- //while any event with the name "name" has been found, browse the EventSetDescriptors
- while (i < esds.length && method == null) {
- j = 0;
- //get the listener methods of the EventSetDescriptor
- Method[] methods = esds[i].getAddListenerMethod().getParameterTypes()[0].getMethods();
- while (j < methods.length && method == null) {
- if(methods[j].getName().equals(name)) {
- method = methods[j];
- esd = esds[i];
- }
- j++;
- }
- i++;
- }
- //if the event has been found in the bean info
- if (method != null) {
- //remove braces
- while(value.startsWith("{") && value.endsWith("}"))
- value = value.substring(1, value.length() - 1);
- //add final semicolon
- if(!value.endsWith(";"))
- value += ";";
- //if the EventSetDescriptor has not been yet recorded for another event
- if (map.get(esd) == null) {
- Map<Method, String> methods = new HashMap<Method, String>();
- methods.put(method, value);
- map.put(esd, methods);
- }
- else {
- map.get(esd).put(method, value);
- }
- }
- else
- if(log.isWarnEnabled())
- log.warn("Event " + name + " not found.");
- return method != null;
- }
-
- /**
- * Generates the code for all the events applied to an object
- *
- * @param object the objects to add the listeners
- * @return the generated code
- */
- public String generate(String object) {
- //result
- StringBuffer result = new StringBuffer();
- //for each EventSetDescriptor
- for (EventSetDescriptor e : map.keySet()) {
- //add new ListenerMethod
- result.append(object)
- .append(".")
- .append(e.getAddListenerMethod().getName())
- .append("(new ")
- .append(e.getListenerType().getCanonicalName())
- //if only one event is handled for this EventSetDescriptor then add a listener, else add an adapter
- .append(e.getAddListenerMethod().getParameterTypes()[0].getMethods().length == 1 ? "" : "Adapter")
- .append("() {\n");
- //for every event handled for the EventSetDescriptor
- for(Method m : map.get(e).keySet()) {
- for(Annotation a : m.getDeclaredAnnotations())
- result.append(a.toString()).append("\n");
- //add the method that handles the event
- result.append("public ")
- .append(m.getReturnType().getCanonicalName())
- .append(" ")
- .append(m.getName())
- .append("(");
- for(int n = 0 ; n < m.getParameterTypes().length ; n++) {
- result.append(m.getParameterTypes()[n].getCanonicalName())
- .append(" arg")
- .append(n)
- .append(", ");
- }
- result.delete(result.length() - 2, result.length())
- .append(")")
- .append("{\n")
- .append(map.get(e).get(m))
- .append("\n}\n");
- }
- result.append("});\n\n");
- }
- return result.toString();
- }
-}
Modified: trunk/guix-compiler-gwt/src/main/java/org/nuiton/guix/generator/GwtAbstractClassGenerator.java
===================================================================
--- trunk/guix-compiler-gwt/src/main/java/org/nuiton/guix/generator/GwtAbstractClassGenerator.java 2009-07-27 07:29:15 UTC (rev 1530)
+++ trunk/guix-compiler-gwt/src/main/java/org/nuiton/guix/generator/GwtAbstractClassGenerator.java 2009-07-27 12:37:18 UTC (rev 1531)
@@ -30,7 +30,7 @@
import java.util.List;
import java.util.Map;
import org.nuiton.guix.databinding.BindingUtils;
-import org.nuiton.guix.events.GwtEventHandler;
+import org.nuiton.guix.GwtEventHandler;
import org.nuiton.guix.model.AttributeDescriptor;
import org.nuiton.guix.model.ClassDescriptor;
import org.nuiton.guix.model.StyleSheet;
Added: trunk/guix-compiler-gwt/src/test/java/org/nuiton/guix/GwtEventHandlerTest.java
===================================================================
--- trunk/guix-compiler-gwt/src/test/java/org/nuiton/guix/GwtEventHandlerTest.java (rev 0)
+++ trunk/guix-compiler-gwt/src/test/java/org/nuiton/guix/GwtEventHandlerTest.java 2009-07-27 12:37:18 UTC (rev 1531)
@@ -0,0 +1,80 @@
+/**
+ * *##% guix-compiler-swing
+ * Copyright (C) 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 org.nuiton.guix;
+
+import com.google.gwt.user.client.ui.FocusWidget;
+import com.google.gwt.user.client.ui.Widget;
+import java.beans.IntrospectionException;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.junit.Test;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+
+/**
+ * Tests the methods of the class SwingEventTestHandler
+ *
+ * @author kmorin
+ */
+public class GwtEventHandlerTest {
+
+ Log log = LogFactory.getLog(GwtEventHandlerTest.class);
+
+ /**
+ * Tests the method addEvent
+ */
+ @Test
+ public void testAddEvent() {
+ GwtEventHandler geh = new GwtEventHandler();
+ try {
+ assertFalse(geh.addEvent(null, "", ""));
+ assertFalse(geh.addEvent(Widget.class, null, ""));
+ assertFalse(geh.addEvent(Widget.class, "", null));
+ assertTrue(geh.addEvent(FocusWidget.class, "onClick", "test1"));
+ assertTrue(geh.addEvent(FocusWidget.class, "onClick", "test2"));
+ assertFalse(geh.addEvent(FocusWidget.class, "azerty", ""));
+ }
+ catch (IntrospectionException eee) {
+ if(log.isErrorEnabled()) {
+ log.error(eee);
+ }
+ }
+ }
+
+ /**
+ * Tests the method generate
+ */
+ @Test
+ public void testGenerate() {
+ GwtEventHandler seh = new GwtEventHandler();
+ try {
+ assertNotNull(seh.generate(""));
+ assertEquals(seh.generate(""), "");
+ seh.addEvent(FocusWidget.class, "onClick", "");
+ assertTrue(seh.generate("").length() > 0);
+ }
+ catch (IntrospectionException eee) {
+ if(log.isErrorEnabled()) {
+ log.error(eee);
+ }
+ }
+ }
+}
1
0
r1530 - trunk/guix-compiler-swing/src/main/java/org/nuiton/guix/generator
by kmorin@users.labs.libre-entreprise.org July 27, 2009
by kmorin@users.labs.libre-entreprise.org July 27, 2009
July 27, 2009
Author: kmorin
Date: 2009-07-27 09:29:15 +0200 (Mon, 27 Jul 2009)
New Revision: 1530
Modified:
trunk/guix-compiler-swing/src/main/java/org/nuiton/guix/generator/SwingAbstractClassGenerator.java
Log:
removed the content of the initDataBinding method
Modified: trunk/guix-compiler-swing/src/main/java/org/nuiton/guix/generator/SwingAbstractClassGenerator.java
===================================================================
--- trunk/guix-compiler-swing/src/main/java/org/nuiton/guix/generator/SwingAbstractClassGenerator.java 2009-07-24 15:33:15 UTC (rev 1529)
+++ trunk/guix-compiler-swing/src/main/java/org/nuiton/guix/generator/SwingAbstractClassGenerator.java 2009-07-27 07:29:15 UTC (rev 1530)
@@ -125,9 +125,7 @@
jf.addMethod(new JavaMethod(Modifier.PUBLIC, "void", getMethodName(Method.COMPONENTS_TREE), null, null, methodBodies.get(Method.COMPONENTS_TREE), "components layout"));
//add databinding method
- StringBuffer dataBinding = new StringBuffer();
- dataBinding.append(methodBodies.get(Method.DATABINDING_INIT));
- jf.addMethod(new JavaMethod(Modifier.PUBLIC, "void", getMethodName(Method.DATABINDING_INIT), null, null, dataBinding.toString(), "initilization of databinding"));
+ jf.addMethod(new JavaMethod(Modifier.PUBLIC, "void", getMethodName(Method.DATABINDING_INIT), null, null, "", "initilization of databinding"));
//add script methods
for (JavaMethod m : (List<JavaMethod>) script.get(ScriptPart.METHODS)) {
1
0
r1529 - in trunk/guix-compiler-swing/src/main/java/org/nuiton/guix: generator tags/swing
by kmorin@users.labs.libre-entreprise.org July 24, 2009
by kmorin@users.labs.libre-entreprise.org July 24, 2009
July 24, 2009
Author: kmorin
Date: 2009-07-24 17:33:15 +0200 (Fri, 24 Jul 2009)
New Revision: 1529
Modified:
trunk/guix-compiler-swing/src/main/java/org/nuiton/guix/generator/SwingAbstractClassGenerator.java
trunk/guix-compiler-swing/src/main/java/org/nuiton/guix/generator/SwingGenerator.java
trunk/guix-compiler-swing/src/main/java/org/nuiton/guix/tags/swing/ApplicationHandler.java
trunk/guix-compiler-swing/src/main/java/org/nuiton/guix/tags/swing/ButtonHandler.java
trunk/guix-compiler-swing/src/main/java/org/nuiton/guix/tags/swing/ComponentHandler.java
trunk/guix-compiler-swing/src/main/java/org/nuiton/guix/tags/swing/FrameHandler.java
trunk/guix-compiler-swing/src/main/java/org/nuiton/guix/tags/swing/LabelHandler.java
trunk/guix-compiler-swing/src/main/java/org/nuiton/guix/tags/swing/MenuBarHandler.java
trunk/guix-compiler-swing/src/main/java/org/nuiton/guix/tags/swing/MenuHandler.java
trunk/guix-compiler-swing/src/main/java/org/nuiton/guix/tags/swing/MenuItemHandler.java
trunk/guix-compiler-swing/src/main/java/org/nuiton/guix/tags/swing/PanelHandler.java
trunk/guix-compiler-swing/src/main/java/org/nuiton/guix/tags/swing/RowHandler.java
trunk/guix-compiler-swing/src/main/java/org/nuiton/guix/tags/swing/SelectableButtonHandler.java
trunk/guix-compiler-swing/src/main/java/org/nuiton/guix/tags/swing/TabPanelHandler.java
trunk/guix-compiler-swing/src/main/java/org/nuiton/guix/tags/swing/TableHandler.java
trunk/guix-compiler-swing/src/main/java/org/nuiton/guix/tags/swing/TextComponentHandler.java
trunk/guix-compiler-swing/src/main/java/org/nuiton/guix/tags/swing/TextFieldHandler.java
trunk/guix-compiler-swing/src/main/java/org/nuiton/guix/tags/swing/ToggleButtonHandler.java
Log:
Comments + javadoc
Modified: trunk/guix-compiler-swing/src/main/java/org/nuiton/guix/generator/SwingAbstractClassGenerator.java
===================================================================
--- trunk/guix-compiler-swing/src/main/java/org/nuiton/guix/generator/SwingAbstractClassGenerator.java 2009-07-24 15:20:05 UTC (rev 1528)
+++ trunk/guix-compiler-swing/src/main/java/org/nuiton/guix/generator/SwingAbstractClassGenerator.java 2009-07-24 15:33:15 UTC (rev 1529)
@@ -80,6 +80,7 @@
script = sh.decomposeScript(gmo.getClassDescriptor().getScript());
}
+ @Override
public JavaFile generate() {
super.addImports(gmo);
@@ -171,7 +172,6 @@
private Map<Method, String> browseModelObjects(GuixModelObject gmo) throws ClassNotFoundException {
StringBuffer componentsCreation = new StringBuffer();
StringBuffer componentsTree = new StringBuffer();
- StringBuffer bindings = new StringBuffer();
SwingEventHandler seh = new SwingEventHandler();
//the class represented by gmo
Class clazz = null;
@@ -198,7 +198,7 @@
creationMethod.append(gmo.getId()).append(" = new ")
.append(clazz.getName()).append("(new java.awt.GridBagLayout());\n");
- constraint = processAttributes(clazz, gmo, bindings, creationMethod, null, seh, null, table);
+ constraint = processAttributes(clazz, gmo, creationMethod, null, seh, null, table);
//add the component to its parent
componentsTree.append(gmo.getParent().getId() == null ? "this" : gmo.getParent().getId()).append(".add(").append(gmo.getId());
@@ -242,7 +242,6 @@
Map<Method, String> methodBodies = browseModelObjects(cell.getChildren().get(0));
componentsCreation.append(methodBodies.get(Method.COMPONENTS_CREATION));
componentsTree.append(methodBodies.get(Method.COMPONENTS_TREE));
- bindings.append(methodBodies.get(Method.DATABINDING_INIT));
}
}
}
@@ -251,7 +250,7 @@
componentsCreation.append("create").append(capitalizedId).append("();\n");
}
- //if gmo represnts a menubar tag
+ //if gmo represents a menubar tag
else if (gmo.getClassDescriptor().getPackageName() == null && gmo.getClassDescriptor().getName().equalsIgnoreCase("MenuBar")) {
String capitalizedId = (gmo.getId().length() > 0) ? Character.toUpperCase(gmo.getId().charAt(0)) + gmo.getId().substring(1) : gmo.getId();
StringBuffer creationMethod = new StringBuffer();
@@ -266,7 +265,7 @@
creationMethod.append(gmo.getId()).append(" = new ")
.append(clazz.getName()).append("();\n");
- constraint = processAttributes(clazz, gmo, bindings, creationMethod, null, seh, null, menuBar);
+ constraint = processAttributes(clazz, gmo, creationMethod, null, seh, null, menuBar);
//add the component to its parent
componentsTree.append(gmo.getParent().getId() == null ? "this" : gmo.getParent().getId()).append(".setJMenuBar(").append(gmo.getId()).append(");\n");
@@ -277,13 +276,15 @@
Map<Method, String> methodBodies = browseModelObjects(child);
componentsCreation.append(methodBodies.get(Method.COMPONENTS_CREATION));
componentsTree.append(methodBodies.get(Method.COMPONENTS_TREE));
- bindings.append(methodBodies.get(Method.DATABINDING_INIT));
}
//create the menu
componentsCreation.append("create").append(capitalizedId).append("();\n");
}
else {
+ //TagHandler of gmo's class
TagHandler th = null;
+
+ //check if gmo's class has a TagHandler and get the class to generate instead
if(TagManager.getGuixClassHandler(gmo.getClassDescriptor().getName()) != null) {
try {
th = (TagHandler)TagManager.getGuixClassHandler(gmo.getClassDescriptor().getName()).newInstance();
@@ -300,6 +301,7 @@
}
}
}
+ //check if gmo's superclass has a TagHandler and get the class to generate instead
else if(gmo.getClassDescriptor().getSuperClass() != null && TagManager.getGuixClassHandler(gmo.getClassDescriptor().getSuperClass().getName()) != null) {
try {
th = (TagHandler)TagManager.getGuixClassHandler(gmo.getClassDescriptor().getSuperClass().getName()).newInstance();
@@ -318,7 +320,7 @@
}
ClassDescriptor cd = gmo.getClassDescriptor();
- //while the class hasn't been found and the classDescriptor is not null
+ //while cd represents a generated class, take cd's superclass
while (clazz == null && cd != null) {
try {
//get the class represented by cd
@@ -340,6 +342,7 @@
}
}
+ //if gmo has a TagHandler, add a field to the JavaFile with this TagHandler (used for the databinding generation)
if(gmo.getClassDescriptor().getPackageName() == null
&& th != null && th.getClassToGenerate() != null) {
jf.addField(new JavaField(Modifier.PRIVATE,
@@ -347,6 +350,7 @@
gmo.getId(), gmo.getJavadoc(), th),
true);
}
+ //if gmo is the root ModelObject, it equals "this"
else if(gmo.getId() == null) {
jf.addField(new JavaField(Modifier.PRIVATE,
(classes != null && classes.contains(gmo.getClassDescriptor().toString())) ? gmo.getClassDescriptor().toString() + "Abstract" : gmo.getClassDescriptor().toString(),
@@ -374,7 +378,7 @@
styleSheets.addAll(gmo.getStyleSheets());
}
- constraint = processAttributes(clazz, gmo, bindings, creationMethod, null, seh, null, th);
+ constraint = processAttributes(clazz, gmo, creationMethod, null, seh, null, th);
//if gmo is the child of a cell
if (!((gmo.getParent().getClassDescriptor().getPackageName() == null || gmo.getParent().getClassDescriptor().getPackageName().equals("org.nuiton.guix.tags.swing")) && gmo.getParent().getClassDescriptor().getName().equalsIgnoreCase("Cell"))) {
@@ -414,20 +418,18 @@
styleSheets.addAll(gmo.getStyleSheets());
}
- constraint = processAttributes(clazz, gmo, bindings, null, componentsTree, seh, layoutDefined, th);
+ constraint = processAttributes(clazz, gmo, null, componentsTree, seh, layoutDefined, th);
}
//browse the children of gmo
for (GuixModelObject child : gmo.getChildren()) {
Map<Method, String> methodBodies = browseModelObjects(child);
componentsCreation.append(methodBodies.get(Method.COMPONENTS_CREATION));
componentsTree.append(methodBodies.get(Method.COMPONENTS_TREE));
- bindings.append(methodBodies.get(Method.DATABINDING_INIT));
}
}
Map<Method, String> result = new HashMap<Method, String>();
result.put(Method.COMPONENTS_CREATION, componentsCreation.toString());
result.put(Method.COMPONENTS_TREE, componentsTree.toString());
- result.put(Method.DATABINDING_INIT, bindings.toString());
return result;
}
@@ -437,14 +439,14 @@
*
* @param clazz class represented by gmo
* @param gmo the GuixModelObject which contains the attribute
- * @param bindings the StringBuffer containing the code of the bindings of the attributes of gmo
* @param creationMethod the StringBuffer containing the code of the creation method for the object represented by gmo (null if gmo represents the first tag)
* @param componentsTree the StringBuffer containing the code of the settings of the attribute of the class (null if gmo does not represent the first tag)
* @param seh the event handler
* @param layoutDefined true if a layout has been defined
- * @return
+ * @param th gmo's TagHandler
+ * @return the value of the layout constraint, if any
*/
- private String processAttributes(Class clazz, GuixModelObject gmo, StringBuffer bindings, StringBuffer creationMethod,
+ private String processAttributes(Class clazz, GuixModelObject gmo, StringBuffer creationMethod,
StringBuffer componentsTree, SwingEventHandler seh, Boolean layoutDefined, TagHandler th) {
String constraint = null;
processCSSAttributes(gmo, seh, clazz);
@@ -535,92 +537,99 @@
return constraint;
}
+ /**
+ * Transform the css attributes into AttributeDescriptors
+ *
+ * @param gmo the GuixModelObject which has got the css attributes
+ * @param seh a SwingEventHandler
+ * @param clazz gmo's class
+ */
private void processCSSAttributes(GuixModelObject gmo, SwingEventHandler seh, Class clazz) {
Map<String, String> cssIds = new HashMap<String, String>();
- Map<String, String> cssStyleClasses = new HashMap<String, String>();
- Map<String, String> cssJavaClasses = new HashMap<String, String>();
- List<AttributeDescriptor> ads = new ArrayList<AttributeDescriptor>();
- for (StyleSheet ss : styleSheets) {
- for (Selector sel : ss.getSelectors()) {
- if((sel.getId() == null || sel.getId().equals(gmo.getId()))
- && (sel.getStyleClass() == null || sel.getStyleClass().equals(gmo.getStyleClass()))
- && (sel.getJavaClassName() == null || sel.getJavaClassName().equals(gmo.getClassDescriptor().getName()))) {
- boolean realAttribute = true;
- if (sel.getPseudoClass() != null && sel.getPseudoClass().startsWith("on") && Character.isUpperCase(sel.getPseudoClass().charAt(2))) {
- //the swing event does not start by "on"
- String lowerCaseAttribute = (sel.getPseudoClass().length() > 2) ? Character.toLowerCase(sel.getPseudoClass().charAt(2)) + sel.getPseudoClass().substring(3) : sel.getPseudoClass();
- StringBuffer eventAction = new StringBuffer();
+ Map<String, String> cssStyleClasses = new HashMap<String, String>();
+ Map<String, String> cssJavaClasses = new HashMap<String, String>();
+ List<AttributeDescriptor> ads = new ArrayList<AttributeDescriptor>();
+ for (StyleSheet ss : styleSheets) {
+ for (Selector sel : ss.getSelectors()) {
+ if((sel.getId() == null || sel.getId().equals(gmo.getId()))
+ && (sel.getStyleClass() == null || sel.getStyleClass().equals(gmo.getStyleClass()))
+ && (sel.getJavaClassName() == null || sel.getJavaClassName().equals(gmo.getClassDescriptor().getName()))) {
+ boolean realAttribute = true;
+ if (sel.getPseudoClass() != null && sel.getPseudoClass().startsWith("on") && Character.isUpperCase(sel.getPseudoClass().charAt(2))) {
+ //the swing event does not start by "on"
+ String lowerCaseAttribute = (sel.getPseudoClass().length() > 2) ? Character.toLowerCase(sel.getPseudoClass().charAt(2)) + sel.getPseudoClass().substring(3) : sel.getPseudoClass();
+ StringBuffer eventAction = new StringBuffer();
- for (Rule rule : sel.getRules()) {
- for (Entry<String, String> entry : rule.getProperties().entrySet()) {
- java.lang.reflect.Method[] methods = clazz.getMethods();
- String capitalizedAttribute = (entry.getKey().length() > 0) ? Character.toUpperCase(entry.getKey().charAt(0)) + entry.getKey().substring(1) : entry.getKey();
- int m = 0;
- //checks if the setter for this attribute exists
- while(m < methods.length && !methods[m].getName().equals("set" + capitalizedAttribute)) {
- m++;
- }
- //if yes
- if(m < methods.length) {
- //checks if the parameter of the setter is a String
- boolean addQuote = methods[m].getParameterTypes()[0].equals(String.class);
- //generates the code to set the attribute to object
- eventAction.append(gmo.getId()).append(".set").append(capitalizedAttribute).append("(").append(addQuote ? "\"" : "").append(entry.getValue()).append(addQuote ? "\"" : "").append(");\n");
- }
- else if(log.isErrorEnabled()) {
- log.error(entry.getKey() + " cannot be set.");
- }
- }
+ for (Rule rule : sel.getRules()) {
+ for (Entry<String, String> entry : rule.getProperties().entrySet()) {
+ java.lang.reflect.Method[] methods = clazz.getMethods();
+ String capitalizedAttribute = (entry.getKey().length() > 0) ? Character.toUpperCase(entry.getKey().charAt(0)) + entry.getKey().substring(1) : entry.getKey();
+ int m = 0;
+ //checks if the setter for this attribute exists
+ while(m < methods.length && !methods[m].getName().equals("set" + capitalizedAttribute)) {
+ m++;
}
- try {
- realAttribute = !seh.addEvent(clazz, lowerCaseAttribute, eventAction.toString());
+ //if yes
+ if(m < methods.length) {
+ //checks if the parameter of the setter is a String
+ boolean addQuote = methods[m].getParameterTypes()[0].equals(String.class);
+ //generates the code to set the attribute to object
+ eventAction.append(gmo.getId()).append(".set").append(capitalizedAttribute).append("(").append(addQuote ? "\"" : "").append(entry.getValue()).append(addQuote ? "\"" : "").append(");\n");
+ }
+ else if(log.isErrorEnabled()) {
+ log.error(entry.getKey() + " cannot be set.");
}
- catch (IntrospectionException ex) {
- if(log.isErrorEnabled()) {
- log.error("Error while adding event " + sel.getPseudoClass());
- }
+ }
+ }
+ try {
+ realAttribute = !seh.addEvent(clazz, lowerCaseAttribute, eventAction.toString());
+ }
+ catch (IntrospectionException ex) {
+ if(log.isErrorEnabled()) {
+ log.error("Error while adding event " + sel.getPseudoClass());
+ }
+ }
+ }
+ if(realAttribute) {
+ if (sel.getId() != null && sel.getId().equals(gmo.getId())) {
+ for (Rule rule : sel.getRules()) {
+ for (Entry<String, String> entry : rule.getProperties().entrySet()) {
+ cssIds.put(entry.getKey(), entry.getValue());
}
}
- if(realAttribute) {
- if (sel.getId() != null && sel.getId().equals(gmo.getId())) {
- for (Rule rule : sel.getRules()) {
- for (Entry<String, String> entry : rule.getProperties().entrySet()) {
- cssIds.put(entry.getKey(), entry.getValue());
- }
- }
+ }
+ else if (sel.getStyleClass() != null && sel.getStyleClass().equals(gmo.getStyleClass())) {
+ for (Rule rule : sel.getRules()) {
+ for (Entry<String, String> entry : rule.getProperties().entrySet()) {
+ cssStyleClasses.put(entry.getKey(), entry.getValue());
}
- else if (sel.getStyleClass() != null && sel.getStyleClass().equals(gmo.getStyleClass())) {
- for (Rule rule : sel.getRules()) {
- for (Entry<String, String> entry : rule.getProperties().entrySet()) {
- cssStyleClasses.put(entry.getKey(), entry.getValue());
- }
- }
+ }
+ }
+ else if (sel.getJavaClassName() != null && sel.getJavaClassName().equals(gmo.getClassDescriptor().getName())) {
+ for (Rule rule : sel.getRules()) {
+ for (Entry<String, String> entry : rule.getProperties().entrySet()) {
+ cssJavaClasses.put(entry.getKey(), entry.getValue());
}
- else if (sel.getJavaClassName() != null && sel.getJavaClassName().equals(gmo.getClassDescriptor().getName())) {
- for (Rule rule : sel.getRules()) {
- for (Entry<String, String> entry : rule.getProperties().entrySet()) {
- cssJavaClasses.put(entry.getKey(), entry.getValue());
- }
- }
- }
}
}
}
}
- for(Entry<String, String> entry : cssIds.entrySet()) {
- ads.add(new AttributeDescriptor(entry.getKey(), entry.getValue()));
- }
- for(Entry<String, String> entry : cssStyleClasses.entrySet()) {
- if(!cssIds.containsKey(entry.getKey())) {
- ads.add(new AttributeDescriptor(entry.getKey(), entry.getValue()));
- }
- }
- for(Entry<String, String> entry : cssJavaClasses.entrySet()) {
- if(!cssIds.containsKey(entry.getKey()) && !cssStyleClasses.containsKey(entry.getKey())) {
- ads.add(new AttributeDescriptor(entry.getKey(), entry.getValue()));
- }
- }
- gmo.getAttributeDescriptors().addAll(ads);
+ }
+ }
+ for(Entry<String, String> entry : cssIds.entrySet()) {
+ ads.add(new AttributeDescriptor(entry.getKey(), entry.getValue()));
+ }
+ for(Entry<String, String> entry : cssStyleClasses.entrySet()) {
+ if(!cssIds.containsKey(entry.getKey())) {
+ ads.add(new AttributeDescriptor(entry.getKey(), entry.getValue()));
+ }
+ }
+ for(Entry<String, String> entry : cssJavaClasses.entrySet()) {
+ if(!cssIds.containsKey(entry.getKey()) && !cssStyleClasses.containsKey(entry.getKey())) {
+ ads.add(new AttributeDescriptor(entry.getKey(), entry.getValue()));
+ }
+ }
+ gmo.getAttributeDescriptors().addAll(ads);
}
public Map<String, Map<String, String>> getBindings2Generate() {
Modified: trunk/guix-compiler-swing/src/main/java/org/nuiton/guix/generator/SwingGenerator.java
===================================================================
--- trunk/guix-compiler-swing/src/main/java/org/nuiton/guix/generator/SwingGenerator.java 2009-07-24 15:20:05 UTC (rev 1528)
+++ trunk/guix-compiler-swing/src/main/java/org/nuiton/guix/generator/SwingGenerator.java 2009-07-24 15:33:15 UTC (rev 1529)
@@ -22,14 +22,11 @@
import java.io.File;
import java.io.IOException;
import java.lang.annotation.Annotation;
-import java.lang.reflect.Array;
import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
-import javax.swing.JComponent;
-import javax.swing.JPanel;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.nuiton.guix.tags.TagHandler;
@@ -44,7 +41,7 @@
/** log */
protected Log log = LogFactory.getLog(SwingGenerator.class);
-
+ /** Maps the different generators with the file to save the generated JavaFile */
Map<SwingJavaFileGenerator, File> generators = new HashMap<SwingJavaFileGenerator, File>();
/**
@@ -124,21 +121,38 @@
@Override
public List<Class> generateBindings(StringBuffer dbCreation, StringBuffer dbDeletion, TagHandler prevTh, JavaFile jf, Class clazz,
String[] binding, int i, List<String> alreadyChecked, String methodToInvoke, Map<GuixGenerator,JavaFile> generatedFiles) {
+ //does the attribute or method to bind exists ?
boolean bindingExists = false;
+ //the return type of the binding
String returnType = null;
+ //the getter method for the binding
String getter = null;
+ //the JavaFile to pass as an argument to the next call of this method
JavaFile nextFile = null;
+ //the Class to pass as an argument to the next call of this method
Class nextClazz = null;
+ //the TagHandler of this binding
TagHandler th = null;
+ //ProxyEventInfo model of this binding
String model = null;
+ //Listener to add to the bound object
Class listener = null;
+ //the name of the listener adding method
String addMethod = null;
+ //the name of the listener removing method
String removeMethod = null;
+ //the Listener list result
List<Class> result = new ArrayList<Class>();
-
+
+ String realMethodName = null;
+ String realAttributename = null;
+
+ //if the part of the binding is a method
if(binding[i].endsWith(")")) {
- String realMethodName = binding[i].substring(0, binding[i].indexOf("("));
- String realAttributename = null;
+ //the method name is all what is before the first open bracket
+ realMethodName = binding[i].substring(0, binding[i].indexOf("("));
+ //if the parent of the method has a TagHandler, then check that the method is the generic method name for all the libraries
+ //or if it is the right name, and then determine the corresponding attribute
if(prevTh != null) {
if(binding[i].startsWith("get")) {
realAttributename = prevTh.getAttrToGenerate(Character.toLowerCase(binding[i].charAt(3)) + binding[i].substring(4, binding[i].indexOf("(")));
@@ -153,6 +167,7 @@
}
}
}
+ //if the method name is the real one, get the corresponding attribute name
if(realAttributename == null) {
if(binding[i].startsWith("get")) {
realAttributename = Character.toLowerCase(binding[i].charAt(3)) + binding[i].substring(4, binding[i].indexOf("("));
@@ -164,6 +179,7 @@
realAttributename = binding[i].substring(0, binding[i].indexOf("("));
}
}
+ //if the parent of the method is an instance of a generated class
if (jf != null) {
bindingExists = jf.getMethod(realMethodName, null) != null;
if (bindingExists) {
@@ -176,8 +192,7 @@
}
else {
try {
- clazz.getMethod(realMethodName, null);
- returnType = clazz.getMethod(realMethodName, null).getReturnType().getName();
+ returnType = clazz.getMethod(realMethodName, (Class[])null).getReturnType().getName();
bindingExists = true;
}
catch (NoSuchMethodException eee) {
@@ -185,15 +200,21 @@
}
}
getter = realMethodName + binding[i].substring(binding[i].indexOf("("));
+ //replace the value of the binding by the getter method
+ binding[i] = getter;
}
+ //if the part of the binding is an attribute
else {
- String realAttributename = null;
+ //if the parent of the attribute has a TagHandler, then check that the attribute is the generic attribute name for all the libraries
+ //or if it is the right name
if(prevTh != null) {
realAttributename = prevTh.getAttrToGenerate(binding[i]);
}
+ //if it is its real name
if(realAttributename == null) {
realAttributename = binding[i];
}
+ //if the parent of the attribute is an instance of a generated class
if (jf != null) {
bindingExists = jf.getMethod("get" + Character.toUpperCase(realAttributename.charAt(0)) + realAttributename.substring(1), null) != null || jf.getMethod("is" + Character.toUpperCase(realAttributename.charAt(0)) + realAttributename.substring(1), null) != null;
if (bindingExists) {
@@ -211,15 +232,13 @@
}
else {
try {
- clazz.getMethod("get" + Character.toUpperCase(realAttributename.charAt(0)) + realAttributename.substring(1), null);
- returnType = clazz.getMethod("get" + Character.toUpperCase(realAttributename.charAt(0)) + realAttributename.substring(1), null).getReturnType().getName();
+ returnType = clazz.getMethod("get" + Character.toUpperCase(realAttributename.charAt(0)) + realAttributename.substring(1), (Class[])null).getReturnType().getName();
getter = "get" + Character.toUpperCase(realAttributename.charAt(0)) + realAttributename.substring(1) + "()";
bindingExists = true;
}
catch (NoSuchMethodException eee) {
try {
- clazz.getMethod("is" + Character.toUpperCase(realAttributename.charAt(0)) + realAttributename.substring(1), null);
- returnType = clazz.getMethod("is" + Character.toUpperCase(realAttributename.charAt(0)) + realAttributename.substring(1), null).getReturnType().getName();
+ returnType = clazz.getMethod("is" + Character.toUpperCase(realAttributename.charAt(0)) + realAttributename.substring(1), (Class[])null).getReturnType().getName();
getter = "is" + Character.toUpperCase(realAttributename.charAt(0)) + realAttributename.substring(1) + "()";
bindingExists = true;
}
@@ -228,8 +247,11 @@
}
}
}
+ binding[i] = getter;
}
+ //if the binding binds an existing attribute or method
if(bindingExists) {
+ //if the object has a TagHandler
if(th != null) {
String getterWoBraces = getter.substring(0, getter.indexOf("("));
if(th.hasEventInfosAboutMethod(getterWoBraces)) {
@@ -244,6 +266,7 @@
removeMethod = "removePropertyChangeListener";
}
}
+ //if it is the last element of the binding and its parent has a taghandler
else if(i == binding.length - 1 && prevTh != null) {
String getterWoBraces = getter.substring(0, getter.indexOf("("));
if(prevTh.hasEventInfosAboutMethod(getterWoBraces)) {
@@ -263,10 +286,12 @@
addMethod = "addPropertyChangeListener";
removeMethod = "removePropertyChangeListener";
}
-
+
+ //starts to generate the code
dbCreation.append("if(");
dbDeletion.append("if(");
if(alreadyChecked != null && !alreadyChecked.isEmpty()) {
+ //add not null parent condition
for(int j = 0 ; j < alreadyChecked.size() ; j++) {
dbCreation.append(alreadyChecked.get(0));
dbDeletion.append(alreadyChecked.get(0));
@@ -368,6 +393,7 @@
alreadyChecked = new ArrayList<String>();
}
alreadyChecked.add(getter);
+ //if it is not the last element of the binding
if(i + 1 < binding.length) {
result.addAll(generateBindings(dbCreation, dbDeletion, th, nextFile, nextClazz, binding, i+1, alreadyChecked, methodToInvoke, generatedFiles));
}
Modified: trunk/guix-compiler-swing/src/main/java/org/nuiton/guix/tags/swing/ApplicationHandler.java
===================================================================
--- trunk/guix-compiler-swing/src/main/java/org/nuiton/guix/tags/swing/ApplicationHandler.java 2009-07-24 15:20:05 UTC (rev 1528)
+++ trunk/guix-compiler-swing/src/main/java/org/nuiton/guix/tags/swing/ApplicationHandler.java 2009-07-24 15:33:15 UTC (rev 1529)
@@ -1,13 +1,27 @@
-/*
- * To change this template, choose Tools | Templates
- * and open the template in the editor.
+/**
+ * *##% guix-compiler-swing
+ * Copyright (C) 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 org.nuiton.guix.tags.swing;
/**
+ * Handles the Application tag
*
- * @author kevin
+ * @author kmorin
*/
public class ApplicationHandler extends ComponentHandler {
@@ -15,6 +29,7 @@
super();
}
+ @Override
public Class getClassToGenerate() {
return javax.swing.JFrame.class;
}
Modified: trunk/guix-compiler-swing/src/main/java/org/nuiton/guix/tags/swing/ButtonHandler.java
===================================================================
--- trunk/guix-compiler-swing/src/main/java/org/nuiton/guix/tags/swing/ButtonHandler.java 2009-07-24 15:20:05 UTC (rev 1528)
+++ trunk/guix-compiler-swing/src/main/java/org/nuiton/guix/tags/swing/ButtonHandler.java 2009-07-24 15:33:15 UTC (rev 1529)
@@ -1,13 +1,27 @@
-/*
- * To change this template, choose Tools | Templates
- * and open the template in the editor.
+/**
+ * *##% guix-compiler-swing
+ * Copyright (C) 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 org.nuiton.guix.tags.swing;
/**
+ * Handles the Button tag
*
- * @author kevin
+ * @author kmorin
*/
public class ButtonHandler extends ComponentHandler {
Modified: trunk/guix-compiler-swing/src/main/java/org/nuiton/guix/tags/swing/ComponentHandler.java
===================================================================
--- trunk/guix-compiler-swing/src/main/java/org/nuiton/guix/tags/swing/ComponentHandler.java 2009-07-24 15:20:05 UTC (rev 1528)
+++ trunk/guix-compiler-swing/src/main/java/org/nuiton/guix/tags/swing/ComponentHandler.java 2009-07-24 15:33:15 UTC (rev 1529)
@@ -1,16 +1,31 @@
-/*
- * To change this template, choose Tools | Templates
- * and open the template in the editor.
+/**
+ * *##% guix-compiler-swing
+ * Copyright (C) 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 org.nuiton.guix.tags.swing;
-package org.nuiton.guix.tags.swing;
import java.awt.event.ComponentListener;
import java.awt.event.FocusListener;
import org.nuiton.guix.tags.DefaultTagHandler;
/**
+ * Super class of all the Swing TagHandlers
*
- * @author kevin
+ * @author kmorin
*/
public abstract class ComponentHandler extends DefaultTagHandler {
Modified: trunk/guix-compiler-swing/src/main/java/org/nuiton/guix/tags/swing/FrameHandler.java
===================================================================
--- trunk/guix-compiler-swing/src/main/java/org/nuiton/guix/tags/swing/FrameHandler.java 2009-07-24 15:20:05 UTC (rev 1528)
+++ trunk/guix-compiler-swing/src/main/java/org/nuiton/guix/tags/swing/FrameHandler.java 2009-07-24 15:33:15 UTC (rev 1529)
@@ -1,13 +1,27 @@
-/*
- * To change this template, choose Tools | Templates
- * and open the template in the editor.
+/**
+ * *##% guix-compiler-swing
+ * Copyright (C) 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 org.nuiton.guix.tags.swing;
/**
+ * Handles the Frame tag
*
- * @author kevin
+ * @author kmorin
*/
public class FrameHandler extends ComponentHandler {
@@ -15,6 +29,7 @@
super();
}
+ @Override
public Class getClassToGenerate() {
return javax.swing.JFrame.class;
}
Modified: trunk/guix-compiler-swing/src/main/java/org/nuiton/guix/tags/swing/LabelHandler.java
===================================================================
--- trunk/guix-compiler-swing/src/main/java/org/nuiton/guix/tags/swing/LabelHandler.java 2009-07-24 15:20:05 UTC (rev 1528)
+++ trunk/guix-compiler-swing/src/main/java/org/nuiton/guix/tags/swing/LabelHandler.java 2009-07-24 15:33:15 UTC (rev 1529)
@@ -1,13 +1,27 @@
-/*
- * To change this template, choose Tools | Templates
- * and open the template in the editor.
+/**
+ * *##% guix-compiler-swing
+ * Copyright (C) 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 org.nuiton.guix.tags.swing;
/**
+ * Handles the Label tag
*
- * @author kevin
+ * @author kmorin
*/
public class LabelHandler extends ComponentHandler {
Modified: trunk/guix-compiler-swing/src/main/java/org/nuiton/guix/tags/swing/MenuBarHandler.java
===================================================================
--- trunk/guix-compiler-swing/src/main/java/org/nuiton/guix/tags/swing/MenuBarHandler.java 2009-07-24 15:20:05 UTC (rev 1528)
+++ trunk/guix-compiler-swing/src/main/java/org/nuiton/guix/tags/swing/MenuBarHandler.java 2009-07-24 15:33:15 UTC (rev 1529)
@@ -1,13 +1,27 @@
-/*
- * To change this template, choose Tools | Templates
- * and open the template in the editor.
+/**
+ * *##% guix-compiler-swing
+ * Copyright (C) 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 org.nuiton.guix.tags.swing;
/**
+ * Handles the MenuBar tag
*
- * @author kevin
+ * @author kmorin
*/
public class MenuBarHandler extends ComponentHandler {
Modified: trunk/guix-compiler-swing/src/main/java/org/nuiton/guix/tags/swing/MenuHandler.java
===================================================================
--- trunk/guix-compiler-swing/src/main/java/org/nuiton/guix/tags/swing/MenuHandler.java 2009-07-24 15:20:05 UTC (rev 1528)
+++ trunk/guix-compiler-swing/src/main/java/org/nuiton/guix/tags/swing/MenuHandler.java 2009-07-24 15:33:15 UTC (rev 1529)
@@ -1,14 +1,29 @@
-/*
- * To change this template, choose Tools | Templates
- * and open the template in the editor.
+/**
+ * *##% guix-compiler-swing
+ * Copyright (C) 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 org.nuiton.guix.tags.swing;
-package org.nuiton.guix.tags.swing;
import javax.swing.event.MenuListener;
/**
+ * Handles the Menu tag
*
- * @author kevin
+ * @author kmorin
*/
public class MenuHandler extends ComponentHandler {
Modified: trunk/guix-compiler-swing/src/main/java/org/nuiton/guix/tags/swing/MenuItemHandler.java
===================================================================
--- trunk/guix-compiler-swing/src/main/java/org/nuiton/guix/tags/swing/MenuItemHandler.java 2009-07-24 15:20:05 UTC (rev 1528)
+++ trunk/guix-compiler-swing/src/main/java/org/nuiton/guix/tags/swing/MenuItemHandler.java 2009-07-24 15:33:15 UTC (rev 1529)
@@ -1,13 +1,27 @@
-/*
- * To change this template, choose Tools | Templates
- * and open the template in the editor.
+/**
+ * *##% guix-compiler-swing
+ * Copyright (C) 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 org.nuiton.guix.tags.swing;
/**
+ * Handles the MenuItem tag
*
- * @author kevin
+ * @author kmorin
*/
public class MenuItemHandler extends ComponentHandler {
Modified: trunk/guix-compiler-swing/src/main/java/org/nuiton/guix/tags/swing/PanelHandler.java
===================================================================
--- trunk/guix-compiler-swing/src/main/java/org/nuiton/guix/tags/swing/PanelHandler.java 2009-07-24 15:20:05 UTC (rev 1528)
+++ trunk/guix-compiler-swing/src/main/java/org/nuiton/guix/tags/swing/PanelHandler.java 2009-07-24 15:33:15 UTC (rev 1529)
@@ -1,13 +1,27 @@
-/*
- * To change this template, choose Tools | Templates
- * and open the template in the editor.
+/**
+ * *##% guix-compiler-swing
+ * Copyright (C) 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 org.nuiton.guix.tags.swing;
/**
+ * Handles the Panel tag
*
- * @author kevin
+ * @author kmorin
*/
public class PanelHandler extends ComponentHandler {
Modified: trunk/guix-compiler-swing/src/main/java/org/nuiton/guix/tags/swing/RowHandler.java
===================================================================
--- trunk/guix-compiler-swing/src/main/java/org/nuiton/guix/tags/swing/RowHandler.java 2009-07-24 15:20:05 UTC (rev 1528)
+++ trunk/guix-compiler-swing/src/main/java/org/nuiton/guix/tags/swing/RowHandler.java 2009-07-24 15:33:15 UTC (rev 1529)
@@ -24,7 +24,7 @@
/**
* Represents a row of a table
*
- * @author kevin
+ * @author kmorin
*/
public class RowHandler extends TableHandler {
Modified: trunk/guix-compiler-swing/src/main/java/org/nuiton/guix/tags/swing/SelectableButtonHandler.java
===================================================================
--- trunk/guix-compiler-swing/src/main/java/org/nuiton/guix/tags/swing/SelectableButtonHandler.java 2009-07-24 15:20:05 UTC (rev 1528)
+++ trunk/guix-compiler-swing/src/main/java/org/nuiton/guix/tags/swing/SelectableButtonHandler.java 2009-07-24 15:33:15 UTC (rev 1529)
@@ -1,14 +1,29 @@
-/*
- * To change this template, choose Tools | Templates
- * and open the template in the editor.
+/**
+ * *##% guix-compiler-swing
+ * Copyright (C) 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 org.nuiton.guix.tags.swing;
-package org.nuiton.guix.tags.swing;
import javax.swing.event.ChangeListener;
/**
+ * Superclass of all TagHandlers for the button which can be selected
*
- * @author kevin
+ * @author kmorin
*/
public class SelectableButtonHandler extends ButtonHandler {
Modified: trunk/guix-compiler-swing/src/main/java/org/nuiton/guix/tags/swing/TabPanelHandler.java
===================================================================
--- trunk/guix-compiler-swing/src/main/java/org/nuiton/guix/tags/swing/TabPanelHandler.java 2009-07-24 15:20:05 UTC (rev 1528)
+++ trunk/guix-compiler-swing/src/main/java/org/nuiton/guix/tags/swing/TabPanelHandler.java 2009-07-24 15:33:15 UTC (rev 1529)
@@ -1,15 +1,30 @@
-/*
- * To change this template, choose Tools | Templates
- * and open the template in the editor.
+/**
+ * *##% guix-compiler-swing
+ * Copyright (C) 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 org.nuiton.guix.tags.swing;
-package org.nuiton.guix.tags.swing;
import java.awt.event.ContainerListener;
import javax.swing.event.ChangeListener;
/**
+ * Handles the TabPanel tag
*
- * @author kevin
+ * @author kmorin
*/
public class TabPanelHandler extends ComponentHandler {
Modified: trunk/guix-compiler-swing/src/main/java/org/nuiton/guix/tags/swing/TableHandler.java
===================================================================
--- trunk/guix-compiler-swing/src/main/java/org/nuiton/guix/tags/swing/TableHandler.java 2009-07-24 15:20:05 UTC (rev 1528)
+++ trunk/guix-compiler-swing/src/main/java/org/nuiton/guix/tags/swing/TableHandler.java 2009-07-24 15:33:15 UTC (rev 1529)
@@ -28,7 +28,7 @@
/**
* Represents a table
*
- * @author kevin
+ * @author kmorin
*/
public class TableHandler extends PanelHandler {
Modified: trunk/guix-compiler-swing/src/main/java/org/nuiton/guix/tags/swing/TextComponentHandler.java
===================================================================
--- trunk/guix-compiler-swing/src/main/java/org/nuiton/guix/tags/swing/TextComponentHandler.java 2009-07-24 15:20:05 UTC (rev 1528)
+++ trunk/guix-compiler-swing/src/main/java/org/nuiton/guix/tags/swing/TextComponentHandler.java 2009-07-24 15:33:15 UTC (rev 1529)
@@ -1,14 +1,29 @@
-/*
- * To change this template, choose Tools | Templates
- * and open the template in the editor.
+/**
+ * *##% guix-compiler-swing
+ * Copyright (C) 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 org.nuiton.guix.tags.swing;
-package org.nuiton.guix.tags.swing;
import javax.swing.event.DocumentListener;
/**
+ * Superclass of all the text component TagHandlers
*
- * @author kevin
+ * @author kmorin
*/
public abstract class TextComponentHandler extends ComponentHandler {
Modified: trunk/guix-compiler-swing/src/main/java/org/nuiton/guix/tags/swing/TextFieldHandler.java
===================================================================
--- trunk/guix-compiler-swing/src/main/java/org/nuiton/guix/tags/swing/TextFieldHandler.java 2009-07-24 15:20:05 UTC (rev 1528)
+++ trunk/guix-compiler-swing/src/main/java/org/nuiton/guix/tags/swing/TextFieldHandler.java 2009-07-24 15:33:15 UTC (rev 1529)
@@ -1,13 +1,27 @@
-/*
- * To change this template, choose Tools | Templates
- * and open the template in the editor.
+/**
+ * *##% guix-compiler-swing
+ * Copyright (C) 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 org.nuiton.guix.tags.swing;
/**
+ * Handles the Textfield tag
*
- * @author kevin
+ * @author kmorin
*/
public class TextFieldHandler extends TextComponentHandler {
Modified: trunk/guix-compiler-swing/src/main/java/org/nuiton/guix/tags/swing/ToggleButtonHandler.java
===================================================================
--- trunk/guix-compiler-swing/src/main/java/org/nuiton/guix/tags/swing/ToggleButtonHandler.java 2009-07-24 15:20:05 UTC (rev 1528)
+++ trunk/guix-compiler-swing/src/main/java/org/nuiton/guix/tags/swing/ToggleButtonHandler.java 2009-07-24 15:33:15 UTC (rev 1529)
@@ -1,14 +1,27 @@
-/*
- * To change this template, choose Tools | Templates
- * and open the template in the editor.
+/**
+ * *##% guix-compiler-swing
+ * Copyright (C) 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 org.nuiton.guix.tags.swing;
-import javax.swing.event.ChangeListener;
/**
+ * Handles the ToggleButton tag
*
- * @author kevin
+ * @author kmorin
*/
public class ToggleButtonHandler extends SelectableButtonHandler {
1
0
r1528 - trunk/guix-compiler-gwt/src/main/java/org/nuiton/guix/generator
by kmorin@users.labs.libre-entreprise.org July 24, 2009
by kmorin@users.labs.libre-entreprise.org July 24, 2009
July 24, 2009
Author: kmorin
Date: 2009-07-24 17:20:05 +0200 (Fri, 24 Jul 2009)
New Revision: 1528
Modified:
trunk/guix-compiler-gwt/src/main/java/org/nuiton/guix/generator/GwtAbstractClassGenerator.java
trunk/guix-compiler-gwt/src/main/java/org/nuiton/guix/generator/GwtGenerator.java
Log:
Comments + javadoc
Modified: trunk/guix-compiler-gwt/src/main/java/org/nuiton/guix/generator/GwtAbstractClassGenerator.java
===================================================================
--- trunk/guix-compiler-gwt/src/main/java/org/nuiton/guix/generator/GwtAbstractClassGenerator.java 2009-07-24 15:19:02 UTC (rev 1527)
+++ trunk/guix-compiler-gwt/src/main/java/org/nuiton/guix/generator/GwtAbstractClassGenerator.java 2009-07-24 15:20:05 UTC (rev 1528)
@@ -18,16 +18,12 @@
*/
package org.nuiton.guix.generator;
-//~--- non-JDK imports --------------------------------------------------------
import com.google.gwt.user.client.ui.Label;
import com.google.gwt.user.client.ui.MenuBar;
import com.google.gwt.user.client.ui.TabPanel;
import java.beans.IntrospectionException;
import org.nuiton.guix.model.GuixModelObject;
-//~--- JDK imports ------------------------------------------------------------
-
-import java.io.File;
import java.lang.reflect.Modifier;
import java.util.ArrayList;
import java.util.HashMap;
@@ -52,7 +48,7 @@
/**
* Generates a GWT abstract class
*
- * @author morin
+ * @author kmorin
*/
public class GwtAbstractClassGenerator extends GwtJavaFileGenerator {
@@ -122,7 +118,7 @@
jf.addMethod(new JavaMethod(Modifier.PUBLIC, "void", getMethodName(Method.COMPONENTS_CREATION), null, null, methodBodies.get(Method.COMPONENTS_CREATION), "Components creation"));
jf.addMethod(new JavaMethod(Modifier.PUBLIC, "void", getMethodName(Method.COMPONENTS_TREE), null, null, methodBodies.get(Method.COMPONENTS_TREE), "Components initialization"));
- jf.addMethod(new JavaMethod(Modifier.PUBLIC, "void", getMethodName(Method.DATABINDING_INIT), null, null, "//TODO", "initilization of databinding"));
+ jf.addMethod(new JavaMethod(Modifier.PUBLIC, "void", getMethodName(Method.DATABINDING_INIT), null, null, "", "initilization of databinding"));
//add script methods
for (JavaMethod m : (List<JavaMethod>) script.get(ScriptPart.METHODS)) {
@@ -289,8 +285,10 @@
}
//if gmo represents a "normal" tag
else {
+ //TagHandler of gmo's class
TagHandler th = null;
-
+
+ //check if gmo's class has a TagHandler and get the class to generate instead
if(TagManager.getGuixClassHandler(gmo.getClassDescriptor().getName()) != null) {
try {
th = (TagHandler) TagManager.getGuixClassHandler(gmo.getClassDescriptor().getName()).newInstance();
@@ -307,6 +305,7 @@
}
}
}
+ //check if gmo's superclass has a TagHandler and get the class to generate instead
else if(gmo.getClassDescriptor().getSuperClass() != null && TagManager.getGuixClassHandler(gmo.getClassDescriptor().getSuperClass().getName()) != null) {
try {
th = (TagHandler) TagManager.getGuixClassHandler(gmo.getClassDescriptor().getSuperClass().getName()).newInstance();
@@ -323,9 +322,11 @@
}
}
}
-
+
+ //the GWT classloader
ClassLoader cl = Label.class.getClassLoader();
ClassDescriptor cd = gmo.getClassDescriptor();
+ //while cd represents a generated class, take cd's superclass
while (clazz == null && cd != null) {
try {
clazz = cl.loadClass(cd.getPackageName() + "." + cd.getName());
@@ -334,6 +335,7 @@
cd = cd.getSuperClass();
}
}
+ //if gmo's class or superclasses are not GWT classes, check with the System classloader
if (clazz == null) {
cl = ClassLoader.getSystemClassLoader();
cd = gmo.getClassDescriptor();
@@ -350,6 +352,7 @@
throw new ClassNotFoundException();
}
+ //if gmo has a TagHandler, add a field to the JavaFile with this TagHandler (used for the databinding generation)
if (gmo.getClassDescriptor().getPackageName() == null
&& TagManager.getGuixClassHandler(gmo.getClassDescriptor().getName()) != null) {
jf.addField(new JavaField(Modifier.FINAL | Modifier.PRIVATE,
@@ -358,7 +361,8 @@
((gmo.getConstructor() != null) ? gmo.getConstructor() : "") + ")", gmo.getJavadoc(), th),
false);
}
- else if(gmo.getId() == null) {
+ //if gmo is the root ModelObject, it equals "this"
+ else if(gmo.getParent() == null) {
jf.addField(new JavaField(Modifier.FINAL | Modifier.PRIVATE,
(classes != null && classes.contains(gmo.getClassDescriptor().toString())) ? gmo.getClassDescriptor().getPackageName() + ".client." + gmo.getClassDescriptor().getName() + "Abstract" : gmo.getClassDescriptor().getPackageName() + "." + gmo.getClassDescriptor().getName(),
gmo.getClassDescriptor().getName().toLowerCase(), "this", gmo.getJavadoc(), th),
@@ -371,7 +375,7 @@
((gmo.getConstructor() != null) ? gmo.getConstructor() : "") + ")", gmo.getJavadoc(), th),
false);
}
-
+ //if gmo is not the root ModelObject
if (gmo.getParent() != null) {
String capitalizedId = (gmo.getId().length() > 0) ? Character.toUpperCase(gmo.getId().charAt(0)) + gmo.getId().substring(1) : gmo.getId();
StringBuffer creationMethod = new StringBuffer();
@@ -379,11 +383,14 @@
componentsCreation.append("create").append(capitalizedId).append("();\n");
//if gmo is the child of a cell
if (gmo.getParent().getClassDescriptor().getPackageName() != null || !gmo.getParent().getClassDescriptor().getName().equalsIgnoreCase("Cell")) {
- componentsTree.append(gmo.getParent().getId() == null ? "this" : gmo.getParent().getId()).append(".add(").append(gmo.getId());
- if(tabName != null) {
- componentsTree.append(",").append(tabName);
+ //if gmo herits from widget
+ if(com.google.gwt.user.client.ui.Widget.class.isAssignableFrom(clazz)) {
+ componentsTree.append(gmo.getParent().getId() == null ? "this" : gmo.getParent().getId()).append(".add(").append(gmo.getId());
+ if(tabName != null) {
+ componentsTree.append(",").append(tabName);
+ }
+ componentsTree.append(");\n");
}
- componentsTree.append(");\n");
}
processAttributes(clazz, gmo, creationMethod, null, geh, th);
@@ -421,7 +428,7 @@
* @param creationMethod the StringBuffer containing the code of the creation method for the object represented by gmo (null if gmo represents the first tag)
* @param componentsTree the StringBuffer containing the code of the settings of the attribute of the class (null if gmo does not represent the first tag)
* @param geh the event handler
- * @return
+ * @param th gmo's TagHandler
*/
private void processAttributes(Class clazz, GuixModelObject gmo, StringBuffer creationMethod, StringBuffer componentsTree, GwtEventHandler geh, TagHandler th) {
//browses the attributes
@@ -472,8 +479,8 @@
componentsTree.append("this.set").append(capitalizedAttribute).append("(").append(addQuote ? "\"" : "").append(attr.getValue()).append(addQuote ? "\"" : "").append(");\n");
}
}
- else if (log.isErrorEnabled()) {
- log.error(attr.getName() + " cannot be set.");
+ else if (log.isWarnEnabled()) {
+ log.warn(attr.getName() + " cannot be set.");
}
}
}
@@ -497,6 +504,11 @@
}
}
+ /**
+ * Browse the MenuBar children and generate the code
+ * @param gmo the GuixModelObject representing the MenuBar
+ * @return A map containing the creation, initialization and bindings methods
+ */
private Map<Method, String> browseMenuBar(GuixModelObject gmo) {
StringBuffer componentsCreation = new StringBuffer("");
StringBuffer componentsTree = new StringBuffer("");
Modified: trunk/guix-compiler-gwt/src/main/java/org/nuiton/guix/generator/GwtGenerator.java
===================================================================
--- trunk/guix-compiler-gwt/src/main/java/org/nuiton/guix/generator/GwtGenerator.java 2009-07-24 15:19:02 UTC (rev 1527)
+++ trunk/guix-compiler-gwt/src/main/java/org/nuiton/guix/generator/GwtGenerator.java 2009-07-24 15:20:05 UTC (rev 1528)
@@ -22,8 +22,6 @@
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
-import java.io.FileReader;
-import java.io.FileWriter;
import java.io.IOException;
import java.lang.annotation.Annotation;
import java.lang.reflect.Method;
@@ -46,6 +44,7 @@
/** log */
private Log log = LogFactory.getLog(GwtGenerator.class);
+ /** Maps the different generators with the file to save the generated JavaFile */
Map<GwtJavaFileGenerator, File> generators = new HashMap<GwtJavaFileGenerator, File>();
@Override
@@ -151,21 +150,38 @@
@Override
public List<Class> generateBindings(StringBuffer dbCreation, StringBuffer dbDeletion, TagHandler prevTh, JavaFile jf, Class clazz,
String[] binding, int i, List<String> alreadyChecked, String methodToInvoke, Map<GuixGenerator, JavaFile> generatedFiles) {
+ //does the attribute or method to bind exists ?
boolean bindingExists = false;
+ //the return type of the binding
String returnType = null;
+ //the getter method for the binding
String getter = null;
+ //the JavaFile to pass as an argument to the next call of this method
JavaFile nextFile = null;
+ //the Class to pass as an argument to the next call of this method
Class nextClazz = null;
+ //the TagHandler of this binding
TagHandler th = null;
+ //ProxyEventInfo model of this binding
String model = null;
+ //Listener to add to the bound object
Class listener = null;
+ //the name of the listener adding method
String addMethod = null;
+ //the name of the listener removing method
String removeMethod = null;
+ //the Listener list result
List<Class> result = new ArrayList<Class>();
-
+
+ String realMethodName = null;
+ String realAttributename = null;
+
+ //if the part of the binding is a method
if (binding[i].endsWith(")")) {
- String realMethodName = binding[i].substring(0, binding[i].indexOf("("));
- String realAttributename = null;
+ //the method name is all what is before the first open bracket
+ realMethodName = binding[i].substring(0, binding[i].indexOf("("));
+ //if the parent of the method has a TagHandler, then check that the method is the generic method name for all the libraries
+ //or if it is the right name, and then determine the corresponding attribute
if(prevTh != null) {
if(binding[i].startsWith("get")) {
realAttributename = prevTh.getAttrToGenerate(Character.toLowerCase(binding[i].charAt(3)) + binding[i].substring(4, binding[i].indexOf("(")));
@@ -180,6 +196,7 @@
}
}
}
+ //if the method name is the real one, get the corresponding attribute name
if(realAttributename == null) {
if(binding[i].startsWith("get")) {
realAttributename = Character.toLowerCase(binding[i].charAt(3)) + binding[i].substring(4, binding[i].indexOf("("));
@@ -191,6 +208,7 @@
realAttributename = binding[i].substring(0, binding[i].indexOf("("));
}
}
+ //if the parent of the method is an instance of a generated class
if (jf != null) {
bindingExists = jf.getMethod(realMethodName, null) != null;
if (bindingExists) {
@@ -203,8 +221,7 @@
}
else {
try {
- clazz.getMethod(realMethodName, null);
- returnType = clazz.getMethod(realMethodName, null).getReturnType().getName();
+ returnType = clazz.getMethod(realMethodName, (Class[])null).getReturnType().getName();
bindingExists = true;
}
catch (NoSuchMethodException eee) {
@@ -212,16 +229,21 @@
}
}
getter = realMethodName + binding[i].substring(binding[i].indexOf("("));
+ //replace the value of the binding by the getter method
binding[i] = getter;
}
+ //if the part of the binding is an attribute
else {
- String realAttributename = null;
+ //if the parent of the attribute has a TagHandler, then check that the attribute is the generic attribute name for all the libraries
+ //or if it is the right name
if(prevTh != null) {
realAttributename = prevTh.getAttrToGenerate(binding[i]);
}
+ //if it is its real name
if(realAttributename == null) {
realAttributename = binding[i];
}
+ //if the parent of the attribute is an instance of a generated class
if (jf != null) {
bindingExists = jf.getMethod("get" + Character.toUpperCase(realAttributename.charAt(0)) + realAttributename.substring(1), null) != null || jf.getMethod("is" + Character.toUpperCase(realAttributename.charAt(0)) + realAttributename.substring(1), null) != null;
if (bindingExists) {
@@ -239,15 +261,13 @@
}
else {
try {
- clazz.getMethod("get" + Character.toUpperCase(realAttributename.charAt(0)) + realAttributename.substring(1), null);
- returnType = clazz.getMethod("get" + Character.toUpperCase(realAttributename.charAt(0)) + realAttributename.substring(1), null).getReturnType().getName();
+ returnType = clazz.getMethod("get" + Character.toUpperCase(realAttributename.charAt(0)) + realAttributename.substring(1), (Class[])null).getReturnType().getName();
getter = "get" + Character.toUpperCase(realAttributename.charAt(0)) + realAttributename.substring(1) + "()";
bindingExists = true;
}
catch (NoSuchMethodException eee) {
try {
- clazz.getMethod("is" + Character.toUpperCase(realAttributename.charAt(0)) + realAttributename.substring(1), null);
- returnType = clazz.getMethod("is" + Character.toUpperCase(realAttributename.charAt(0)) + realAttributename.substring(1), null).getReturnType().getName();
+ returnType = clazz.getMethod("is" + Character.toUpperCase(realAttributename.charAt(0)) + realAttributename.substring(1), (Class[])null).getReturnType().getName();
getter = "is" + Character.toUpperCase(realAttributename.charAt(0)) + realAttributename.substring(1) + "()";
bindingExists = true;
}
@@ -258,23 +278,28 @@
}
binding[i] = getter;
}
+ //if the binding binds an existing attribute or method
if (bindingExists) {
+ //if it is the last element of the binding and its parent has a taghandler
if (i == binding.length - 1 && prevTh != null) {
- String getterWoBraces = getter.substring(0, getter.indexOf("("));
- if (prevTh.hasEventInfosAboutMethod(getterWoBraces)) {
- model = prevTh.getEventInfosModelName(getterWoBraces);
- listener = prevTh.getEventInfosListenerClass(getterWoBraces);
- addMethod = prevTh.getEventInfosAddListenerMethodName(getterWoBraces);
- removeMethod = prevTh.getEventInfosRemoveListenerMethodName(getterWoBraces);
+ String getterWoBrackets = getter.substring(0, getter.indexOf("("));
+ //for GWT the only objects that can be bound are the ones which have got a TagHandler that defines methods which can be bound
+ if (prevTh.hasEventInfosAboutMethod(getterWoBrackets)) {
+ model = prevTh.getEventInfosModelName(getterWoBrackets);
+ listener = prevTh.getEventInfosListenerClass(getterWoBrackets);
+ addMethod = prevTh.getEventInfosAddListenerMethodName(getterWoBrackets);
+ removeMethod = prevTh.getEventInfosRemoveListenerMethodName(getterWoBrackets);
}
else {
- log.error("Impossible binding");
+ log.error("Impossible binding for the " + (realMethodName != null ? "method '" : "attribute '") + realAttributename + "' of the class '" + prevTh.getClassToGenerate().getName() + "'");
return null;
}
+ //starts to generate the code
dbCreation.append("if(");
dbDeletion.append("if(");
if (alreadyChecked != null && !alreadyChecked.isEmpty()) {
+ //add not null parent condition
for (int j = 0; j < alreadyChecked.size(); j++) {
dbCreation.append(alreadyChecked.get(0));
dbDeletion.append(alreadyChecked.get(0));
@@ -369,6 +394,7 @@
alreadyChecked = new ArrayList<String>();
}
alreadyChecked.add(getter);
+ //if it is not the last element of the binding
if (i + 1 < binding.length) {
return generateBindings(dbCreation, dbDeletion, th, nextFile, nextClazz, binding, i + 1, alreadyChecked, methodToInvoke, generatedFiles);
}
1
0
r1527 - in trunk/guix-compiler/src/main/java/org/nuiton/guix: . generator
by kmorin@users.labs.libre-entreprise.org July 24, 2009
by kmorin@users.labs.libre-entreprise.org July 24, 2009
July 24, 2009
Author: kmorin
Date: 2009-07-24 17:19:02 +0200 (Fri, 24 Jul 2009)
New Revision: 1527
Modified:
trunk/guix-compiler/src/main/java/org/nuiton/guix/GuixLauncher.java
trunk/guix-compiler/src/main/java/org/nuiton/guix/generator/GuixGenerator.java
trunk/guix-compiler/src/main/java/org/nuiton/guix/generator/JavaFileGenerator.java
Log:
Error handling + comments
Modified: trunk/guix-compiler/src/main/java/org/nuiton/guix/GuixLauncher.java
===================================================================
--- trunk/guix-compiler/src/main/java/org/nuiton/guix/GuixLauncher.java 2009-07-24 15:18:31 UTC (rev 1526)
+++ trunk/guix-compiler/src/main/java/org/nuiton/guix/GuixLauncher.java 2009-07-24 15:19:02 UTC (rev 1527)
@@ -262,96 +262,103 @@
//for each field which binds the value of others objects
for (String field : gen.getBindingsToGenerate().keySet()) {
for (String attr : gen.getBindingsToGenerate().get(field).keySet()) {
- dbCreation.append(dbCreation.length() != 0 ? "else if(\"" : "if(\"").append(field).append(".").append(attr).append("\".equals(_binding)) {\n");
- dbDeletion.append(dbDeletion.length() != 0 ? "else if(\"" : "if(\"").append(field).append(".").append(attr).append("\".equals(_binding)) {\n");
- dbProcess.append(dbProcess.length() != 0 ? "else if(\"" : "if(\"").append(field).append(".").append(attr).append("\".equals(_binding)) {\n").append(field).append(".set").append(Character.toUpperCase(attr.charAt(0))).append(attr.substring(1)).append("(");
- List<String[]> bindings = new ArrayList<String[]>();
- //the parser which decompose the binding into the different elements to bind
- JavaParser p = new JavaParser(new StringReader(gen.getBindingsToGenerate().get(field).get(attr)));
- //start parsing the binding value
- while (!p.Line()) {
- SimpleNode node = p.popNode();
- if (node != null) {
- //get the different elements to bind
- for (String s : browseNode(node)) {
- //decompose the element s into attributes
- List<String> l = new ArrayList<String>();
- //number of open brackets
- int parOuvertes = 0;
- StringBuffer read = new StringBuffer();
- for (char c : s.toCharArray()) {
- if (c == '(') {
- parOuvertes++;
- read.append(c);
- }
- else if (c == ')') {
- parOuvertes--;
- read.append(c);
- }
- else if (c == '.') {
- if (parOuvertes == 0) {
- l.add(read.toString());
- read = new StringBuffer();
+ try {
+ dbCreation.append(dbCreation.length() != 0 ? "else if(\"" : "if(\"").append(field).append(".").append(attr).append("\".equals(_binding)) {\n");
+ dbDeletion.append(dbDeletion.length() != 0 ? "else if(\"" : "if(\"").append(field).append(".").append(attr).append("\".equals(_binding)) {\n");
+ dbProcess.append(dbProcess.length() != 0 ? "else if(\"" : "if(\"").append(field).append(".").append(attr).append("\".equals(_binding)) {\n");
+ List<String[]> bindings = new ArrayList<String[]>();
+ //the parser which decompose the binding into the different elements to bind
+ JavaParser p = new JavaParser(new StringReader(gen.getBindingsToGenerate().get(field).get(attr)));
+ //start parsing the binding value
+ while (!p.Line()) {
+ SimpleNode node = p.popNode();
+ if (node != null) {
+ //get the different elements to bind
+ for (String s : browseNode(node)) {
+ //decompose the element s into attributes
+ List<String> l = new ArrayList<String>();
+ //number of open brackets
+ int parOuvertes = 0;
+ StringBuffer read = new StringBuffer();
+ for (char c : s.toCharArray()) {
+ if (c == '(') {
+ parOuvertes++;
+ read.append(c);
}
+ else if (c == ')') {
+ parOuvertes--;
+ read.append(c);
+ }
+ else if (c == '.') {
+ if (parOuvertes == 0) {
+ l.add(read.toString());
+ read = new StringBuffer();
+ }
+ else {
+ read.append(c);
+ }
+ }
else {
read.append(c);
}
}
- else {
- read.append(c);
- }
+ l.add(read.toString());
+ bindings.add(l.toArray(new String[l.size()]));
}
- l.add(read.toString());
- bindings.add(l.toArray(new String[l.size()]));
}
}
- }
- //generates the code
- List<Class> listeners = new ArrayList<Class>();
- for (String[] binding : bindings) {
- StringBuffer methodToInvoke = new StringBuffer();
- //the binding value before the generator changes it
- StringBuffer oldBinding = new StringBuffer();
- //generates the method name for calling the databinding process method
- for (String s : binding) {
- methodToInvoke.append(s.replaceAll("\\W", ""));
- oldBinding.append(s).append(".");
- }
- oldBinding.setLength(oldBinding.length() - 1);
- //generates the code and modify the simple attribute name in the binding by the getter
- listeners.addAll(gen.generateBindings(dbCreation, dbDeletion, null, jf, null, binding, 0, null, methodToInvoke.toString(), generatedFiles));
- //JavaArgument[] args = new JavaArgument[]{new JavaArgument(parameterType.getName(), "event")};
- //new value of the binding with the getters
- StringBuffer newBinding = new StringBuffer();
- for (String s : binding) {
- newBinding.append(s).append(".");
- }
- newBinding.setLength(newBinding.length() - 1);
- //replaces the old binding by the newer one
- gen.getBindingsToGenerate().get(field).put(attr, gen.getBindingsToGenerate().get(field).get(attr).replace(oldBinding.toString(), newBinding.toString()));
+ //generates the code
+ List<Class> listeners = new ArrayList<Class>();
+ for (String[] binding : bindings) {
+ StringBuffer methodToInvoke = new StringBuffer();
+ //the binding value before the generator changes it
+ StringBuffer oldBinding = new StringBuffer();
+ //generates the method name for calling the databinding process method
+ for (String s : binding) {
+ methodToInvoke.append(s.replaceAll("\\W", ""));
+ oldBinding.append(s).append(".");
+ }
+ oldBinding.setLength(oldBinding.length() - 1);
+ //generates the code and modify the simple attribute name in the binding by the getter
+ listeners.addAll(gen.generateBindings(dbCreation, dbDeletion, null, jf, null, binding, 0, null, methodToInvoke.toString(), generatedFiles));
+ //JavaArgument[] args = new JavaArgument[]{new JavaArgument(parameterType.getName(), "event")};
+ //new value of the binding with the getters
+ StringBuffer newBinding = new StringBuffer();
+ for (String s : binding) {
+ newBinding.append(s).append(".");
+ }
+ newBinding.setLength(newBinding.length() - 1);
+ //replaces the old binding by the newer one
+ gen.getBindingsToGenerate().get(field).put(attr, gen.getBindingsToGenerate().get(field).get(attr).replace(oldBinding.toString(), newBinding.toString()));
- //method called by the listener
- if (jf.getMethod("onChangeFrom" + methodToInvoke, /*args*/ null) == null) {
- jf.addMethod(new JavaMethod(Modifier.PUBLIC, "void", "onChangeFrom" + methodToInvoke.toString(), /*args*/ null, null, /*"_DataSource" + dataSourceNumber + ".propertyChange(null);"*/ "processDataBinding(\"" + field + "." + attr + "\");", null));
+ //method called by the listener
+ if (jf.getMethod("onChangeFrom" + methodToInvoke, /*args*/ null) == null) {
+ jf.addMethod(new JavaMethod(Modifier.PUBLIC, "void", "onChangeFrom" + methodToInvoke.toString(), /*args*/ null, null, /*"_DataSource" + dataSourceNumber + ".propertyChange(null);"*/ "processDataBinding(\"" + field + "." + attr + "\");", "Method called when the objects bound by '" + attr + "' of '" + field + "' change"));
+ }
+ else {
+ jf.getMethod("onChangeFrom" + methodToInvoke.toString(), /*args*/ null).appendBodyCode(/*"_DataSource" + dataSourceNumber + ".propertyChange(null);"*/"processDataBinding(\"" + field + "." + attr + "\");", "\n");
+ }
}
- else {
- jf.getMethod("onChangeFrom" + methodToInvoke.toString(), /*args*/ null).appendBodyCode(/*"_DataSource" + dataSourceNumber + ".propertyChange(null);"*/"processDataBinding(\"" + field + "." + attr + "\");", "\n");
+ dbCreation.append("}\n");
+ dbDeletion.append("}\n");
+ dbProcess.append(field).append(".set").append(Character.toUpperCase(attr.charAt(0))).append(attr.substring(1)).append("(").append(gen.getBindingsToGenerate().get(field).get(attr)).append(");\n}\n");
+ //if the binding got some elements to bind
+ if (listeners != null) {
+ //jf.addField(new JavaField(Modifier.PRIVATE, "java.beans.PropertyChangeListener", "_DataSource" + dataSourceNumber, "new org.nuiton.guix.runtime.DataBindingListener(this,\"" + field + "." + attr + "\")", null, null));
+ //method to init the databinding
+ jf.getMethod("initDataBinding", null).appendBodyCode("applyDataBinding(\"" + field + "." + attr + "\");", "\n");
+ // for (Class listener : listeners) {
+ // final List<Method> listenerMethods = Arrays.asList(listener.getMethods());
+ // Class parameterType = listenerMethods.get(0).getParameterTypes()[0];
+ // }
}
+ //dataSourceNumber++;
}
- dbCreation.append("}\n");
- dbDeletion.append("}\n");
- dbProcess.append(gen.getBindingsToGenerate().get(field).get(attr)).append(");\n}\n");
- //if the binding got some elements to bind
- if (listeners != null) {
- //jf.addField(new JavaField(Modifier.PRIVATE, "java.beans.PropertyChangeListener", "_DataSource" + dataSourceNumber, "new org.nuiton.guix.runtime.DataBindingListener(this,\"" + field + "." + attr + "\")", null, null));
- //method to init the databinding
- jf.getMethod("initDataBinding", null).appendBodyCode("applyDataBinding(\"" + field + "." + attr + "\");", "\n");
-// for (Class listener : listeners) {
-// final List<Method> listenerMethods = Arrays.asList(listener.getMethods());
-// Class parameterType = listenerMethods.get(0).getParameterTypes()[0];
-// }
+ catch(NullPointerException eee) {
+ dbCreation.append("}\n");
+ dbDeletion.append("}\n");
+ dbProcess.append("}\n");
}
- //dataSourceNumber++;
}
}
//if the generated file has a superclass which also is a generated class, apply the databinding of the superclass to the class
Modified: trunk/guix-compiler/src/main/java/org/nuiton/guix/generator/GuixGenerator.java
===================================================================
--- trunk/guix-compiler/src/main/java/org/nuiton/guix/generator/GuixGenerator.java 2009-07-24 15:18:31 UTC (rev 1526)
+++ trunk/guix-compiler/src/main/java/org/nuiton/guix/generator/GuixGenerator.java 2009-07-24 15:19:02 UTC (rev 1527)
@@ -140,6 +140,7 @@
/**
* Checks if the objects of the binding exist
+ * and determines which objects need a listener
*
* @param dbCreation the method code to apply the binding
* @param dbDeletion the method code to remove the binding
Modified: trunk/guix-compiler/src/main/java/org/nuiton/guix/generator/JavaFileGenerator.java
===================================================================
--- trunk/guix-compiler/src/main/java/org/nuiton/guix/generator/JavaFileGenerator.java 2009-07-24 15:18:31 UTC (rev 1526)
+++ trunk/guix-compiler/src/main/java/org/nuiton/guix/generator/JavaFileGenerator.java 2009-07-24 15:19:02 UTC (rev 1527)
@@ -67,9 +67,9 @@
}
/**
- * Generates and saves the class described by the GuixModelObject gmo
+ * Generates the JavaFile repesnting the class described by the GuixModelObject gmo
*
- * @param out the file to generate
+ * @return the generated JavaFile
*/
public abstract JavaFile generate();
1
0
Author: kmorin
Date: 2009-07-24 17:18:31 +0200 (Fri, 24 Jul 2009)
New Revision: 1526
Modified:
trunk/pom.xml
Log:
upgrade GWT version to 1.6.0
Modified: trunk/pom.xml
===================================================================
--- trunk/pom.xml 2009-07-24 08:57:21 UTC (rev 1525)
+++ trunk/pom.xml 2009-07-24 15:18:31 UTC (rev 1526)
@@ -205,7 +205,7 @@
<!-- libs version -->
<spring.version>2.0.5</spring.version>
<maven.version>2.0.10</maven.version>
- <gwt.version>1.5.3</gwt.version>
+ <gwt.version>1.6.0</gwt.version>
</properties>
1
0
r1525 - trunk/guix-compiler-swing/src/main/java/org/nuiton/guix/generator
by kmorin@users.labs.libre-entreprise.org July 24, 2009
by kmorin@users.labs.libre-entreprise.org July 24, 2009
July 24, 2009
Author: kmorin
Date: 2009-07-24 10:57:21 +0200 (Fri, 24 Jul 2009)
New Revision: 1525
Modified:
trunk/guix-compiler-swing/src/main/java/org/nuiton/guix/generator/SwingAbstractClassGenerator.java
trunk/guix-compiler-swing/src/main/java/org/nuiton/guix/generator/SwingGenerator.java
trunk/guix-compiler-swing/src/main/java/org/nuiton/guix/generator/SwingImplementationGenerator.java
trunk/guix-compiler-swing/src/main/java/org/nuiton/guix/generator/SwingInterfaceGenerator.java
Log:
changed the return type of the generate method from void to JavaFile
Modified: trunk/guix-compiler-swing/src/main/java/org/nuiton/guix/generator/SwingAbstractClassGenerator.java
===================================================================
--- trunk/guix-compiler-swing/src/main/java/org/nuiton/guix/generator/SwingAbstractClassGenerator.java 2009-07-24 08:57:09 UTC (rev 1524)
+++ trunk/guix-compiler-swing/src/main/java/org/nuiton/guix/generator/SwingAbstractClassGenerator.java 2009-07-24 08:57:21 UTC (rev 1525)
@@ -20,8 +20,6 @@
//~--- non-JDK imports --------------------------------------------------------
import java.beans.IntrospectionException;
-import java.io.File;
-import java.util.Map;
import org.nuiton.guix.tags.swing.MenuBarHandler;
;
import org.nuiton.guix.model.GuixModelObject;
@@ -82,8 +80,8 @@
script = sh.decomposeScript(gmo.getClassDescriptor().getScript());
}
- public JavaFile generates() {
- super.generate();
+ public JavaFile generate() {
+ super.addImports(gmo);
//add imports
for (String s : (List<String>) script.get(ScriptPart.IMPORTS)) {
@@ -625,11 +623,6 @@
gmo.getAttributeDescriptors().addAll(ads);
}
- @Override
- public void generate(File out) {
- throw new UnsupportedOperationException("Not supported yet.");
- }
-
public Map<String, Map<String, String>> getBindings2Generate() {
return bindings2Generate;
}
Modified: trunk/guix-compiler-swing/src/main/java/org/nuiton/guix/generator/SwingGenerator.java
===================================================================
--- trunk/guix-compiler-swing/src/main/java/org/nuiton/guix/generator/SwingGenerator.java 2009-07-24 08:57:09 UTC (rev 1524)
+++ trunk/guix-compiler-swing/src/main/java/org/nuiton/guix/generator/SwingGenerator.java 2009-07-24 08:57:21 UTC (rev 1525)
@@ -77,11 +77,11 @@
SwingAbstractClassGenerator sacg = new SwingAbstractClassGenerator(gmo, classes);
SwingImplementationGenerator simg = new SwingImplementationGenerator(gmo, classes);
- sing.generate(out);
+ sing.generate();
generators.put(sing, out);
- JavaFile jf = sacg.generates();
+ JavaFile jf = sacg.generate();
generators.put(sacg, outAbstract);
- simg.generate(outImpl);
+ simg.generate();
generators.put(simg, outImpl);
if (mainClass) {
Modified: trunk/guix-compiler-swing/src/main/java/org/nuiton/guix/generator/SwingImplementationGenerator.java
===================================================================
--- trunk/guix-compiler-swing/src/main/java/org/nuiton/guix/generator/SwingImplementationGenerator.java 2009-07-24 08:57:09 UTC (rev 1524)
+++ trunk/guix-compiler-swing/src/main/java/org/nuiton/guix/generator/SwingImplementationGenerator.java 2009-07-24 08:57:21 UTC (rev 1525)
@@ -18,12 +18,7 @@
*/
package org.nuiton.guix.generator;
-//~--- non-JDK imports --------------------------------------------------------
-
import org.nuiton.guix.model.GuixModelObject;
-
-//~--- JDK imports ------------------------------------------------------------
-
import java.io.File;
import java.lang.reflect.Modifier;
import java.util.List;
@@ -52,14 +47,14 @@
}
@Override
- public void generate(File out) {
- super.generate();
+ public JavaFile generate() {
+ super.addImports(gmo);
//add the constructor
jf.addMethod(new JavaMethod(Modifier.PUBLIC, null, gmo.getClassDescriptor().getName() + "Impl",
null, null, "super();", "Constructor"));
- saveFile(out);
+ return jf;
}
}
Modified: trunk/guix-compiler-swing/src/main/java/org/nuiton/guix/generator/SwingInterfaceGenerator.java
===================================================================
--- trunk/guix-compiler-swing/src/main/java/org/nuiton/guix/generator/SwingInterfaceGenerator.java 2009-07-24 08:57:09 UTC (rev 1524)
+++ trunk/guix-compiler-swing/src/main/java/org/nuiton/guix/generator/SwingInterfaceGenerator.java 2009-07-24 08:57:21 UTC (rev 1525)
@@ -52,8 +52,8 @@
}
@Override
- public void generate(File out) {
- super.generate();
+ public JavaFile generate() {
+ super.addImports(gmo);
addFields(gmo);
jf.addMethod(new JavaMethod(Modifier.PUBLIC, "void", "initialize", null, null, null, "initialization"));
jf.addMethod(new JavaMethod(Modifier.PUBLIC, "void", getMethodName(Method.BEFORE_CREATION), null, null, null, ""));
@@ -64,7 +64,7 @@
jf.addMethod(new JavaMethod(Modifier.PUBLIC, "void", getMethodName(Method.DATABINDING_INIT), null, null, null, "initilization of databinding"));
jf.addMethod(new JavaMethod(Modifier.PUBLIC, "void", getMethodName(Method.IN_THE_END), null, null, null, ""));
- saveFile(out);
+ return jf;
}
/**
1
0
r1524 - trunk/guix-compiler-gwt/src/main/java/org/nuiton/guix/generator
by kmorin@users.labs.libre-entreprise.org July 24, 2009
by kmorin@users.labs.libre-entreprise.org July 24, 2009
July 24, 2009
Author: kmorin
Date: 2009-07-24 10:57:09 +0200 (Fri, 24 Jul 2009)
New Revision: 1524
Modified:
trunk/guix-compiler-gwt/src/main/java/org/nuiton/guix/generator/GwtAbstractClassGenerator.java
trunk/guix-compiler-gwt/src/main/java/org/nuiton/guix/generator/GwtGenerator.java
trunk/guix-compiler-gwt/src/main/java/org/nuiton/guix/generator/GwtGenerator1.java
trunk/guix-compiler-gwt/src/main/java/org/nuiton/guix/generator/GwtImplementationGenerator.java
trunk/guix-compiler-gwt/src/main/java/org/nuiton/guix/generator/GwtInterfaceGenerator.java
Log:
changed the return type of the generate method from void to JavaFile
Modified: trunk/guix-compiler-gwt/src/main/java/org/nuiton/guix/generator/GwtAbstractClassGenerator.java
===================================================================
--- trunk/guix-compiler-gwt/src/main/java/org/nuiton/guix/generator/GwtAbstractClassGenerator.java 2009-07-24 08:56:54 UTC (rev 1523)
+++ trunk/guix-compiler-gwt/src/main/java/org/nuiton/guix/generator/GwtAbstractClassGenerator.java 2009-07-24 08:57:09 UTC (rev 1524)
@@ -81,9 +81,9 @@
script = sh.decomposeScript(gmo.getClassDescriptor().getScript());
}
- //@Override
- public JavaFile generates() {
- super.generate();
+ @Override
+ public JavaFile generate() {
+ super.addImports(gmo);
//add imports
for (String s : (List<String>) script.get(ScriptPart.IMPORTS)) {
@@ -587,9 +587,5 @@
return bindings2Generate;
}
- @Override
- public void generate(File out) {
- throw new UnsupportedOperationException("Not supported yet.");
- }
}
Modified: trunk/guix-compiler-gwt/src/main/java/org/nuiton/guix/generator/GwtGenerator.java
===================================================================
--- trunk/guix-compiler-gwt/src/main/java/org/nuiton/guix/generator/GwtGenerator.java 2009-07-24 08:56:54 UTC (rev 1523)
+++ trunk/guix-compiler-gwt/src/main/java/org/nuiton/guix/generator/GwtGenerator.java 2009-07-24 08:57:09 UTC (rev 1524)
@@ -111,11 +111,11 @@
ghg.generate(outHtmlMain);
}
- ging.generate(out);
+ ging.generate();
generators.put(ging, out);
- JavaFile jf = gacg.generates();
+ JavaFile jf = gacg.generate();
generators.put(gacg, outAbstract);
- gimg.generate(outImpl);
+ gimg.generate();
generators.put(gimg, outImpl);
serializer.startTag("", "bean");
Modified: trunk/guix-compiler-gwt/src/main/java/org/nuiton/guix/generator/GwtGenerator1.java
===================================================================
--- trunk/guix-compiler-gwt/src/main/java/org/nuiton/guix/generator/GwtGenerator1.java 2009-07-24 08:56:54 UTC (rev 1523)
+++ trunk/guix-compiler-gwt/src/main/java/org/nuiton/guix/generator/GwtGenerator1.java 2009-07-24 08:57:09 UTC (rev 1524)
@@ -87,11 +87,11 @@
ghg.generate(outHtmlMain);
}
- ging.generate(out);
+ ging.generate();
generators.put(ging, out);
- JavaFile jf = gacg.generates();
+ JavaFile jf = gacg.generate();
generators.put(gacg, outAbstract);
- gimg.generate(outImpl);
+ gimg.generate();
generators.put(gimg, outImpl);
serializer.startTag("", "bean");
Modified: trunk/guix-compiler-gwt/src/main/java/org/nuiton/guix/generator/GwtImplementationGenerator.java
===================================================================
--- trunk/guix-compiler-gwt/src/main/java/org/nuiton/guix/generator/GwtImplementationGenerator.java 2009-07-24 08:56:54 UTC (rev 1523)
+++ trunk/guix-compiler-gwt/src/main/java/org/nuiton/guix/generator/GwtImplementationGenerator.java 2009-07-24 08:57:09 UTC (rev 1524)
@@ -52,19 +52,11 @@
}
@Override
- public void generate(File out) {
- super.generate();
-
- //if (!gmo.getJavadoc().equals("")) {
- //sb.append("\n/**\n * ");
- //sb.append(gmo.getJavadoc());
- //sb.append("\n */");
- //}
-
+ public JavaFile generate() {
+ super.addImports(gmo);
jf.addMethod(new JavaMethod(Modifier.PUBLIC, null, gmo.getClassDescriptor().getName() + "Impl",
null, null, "super();", "Constructor"));
-
- saveFile(out);
+ return jf;
}
public void addMainMethod() {
Modified: trunk/guix-compiler-gwt/src/main/java/org/nuiton/guix/generator/GwtInterfaceGenerator.java
===================================================================
--- trunk/guix-compiler-gwt/src/main/java/org/nuiton/guix/generator/GwtInterfaceGenerator.java 2009-07-24 08:56:54 UTC (rev 1523)
+++ trunk/guix-compiler-gwt/src/main/java/org/nuiton/guix/generator/GwtInterfaceGenerator.java 2009-07-24 08:57:09 UTC (rev 1524)
@@ -52,8 +52,8 @@
}
@Override
- public void generate(File out) {
- super.generate();
+ public JavaFile generate() {
+ super.addImports(gmo);
addFields(gmo);
jf.addMethod(new JavaMethod(Modifier.PUBLIC, "void", "initialize", null, null, null, "initialization"));
@@ -65,7 +65,7 @@
jf.addMethod(new JavaMethod(Modifier.PUBLIC, "void", getMethodName(Method.DATABINDING_INIT), null, null, null, "initilization of databinding"));
jf.addMethod(new JavaMethod(Modifier.PUBLIC, "void", getMethodName(Method.IN_THE_END), null, null, null, ""));
- saveFile(out);
+ return jf;
}
/**
1
0
r1523 - trunk/guix-compiler/src/main/java/org/nuiton/guix/generator
by kmorin@users.labs.libre-entreprise.org July 24, 2009
by kmorin@users.labs.libre-entreprise.org July 24, 2009
July 24, 2009
Author: kmorin
Date: 2009-07-24 10:56:54 +0200 (Fri, 24 Jul 2009)
New Revision: 1523
Modified:
trunk/guix-compiler/src/main/java/org/nuiton/guix/generator/JavaFileGenerator.java
Log:
changed the return type of the generate method from void to JavaFile
Modified: trunk/guix-compiler/src/main/java/org/nuiton/guix/generator/JavaFileGenerator.java
===================================================================
--- trunk/guix-compiler/src/main/java/org/nuiton/guix/generator/JavaFileGenerator.java 2009-07-23 15:39:55 UTC (rev 1522)
+++ trunk/guix-compiler/src/main/java/org/nuiton/guix/generator/JavaFileGenerator.java 2009-07-24 08:56:54 UTC (rev 1523)
@@ -18,23 +18,16 @@
*/
package org.nuiton.guix.generator;
-//~--- non-JDK imports --------------------------------------------------------
-import java.util.logging.Level;
-import java.util.logging.Logger;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.nuiton.guix.model.GuixModelObject;
-//~--- JDK imports ------------------------------------------------------------
-
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
-import org.nuiton.guix.tags.TagHandler;
-import org.nuiton.guix.tags.TagManager;
/**
* Abstract class of all the generator which generate java files
@@ -78,16 +71,9 @@
*
* @param out the file to generate
*/
- public abstract void generate(File out);
+ public abstract JavaFile generate();
/**
- * Generates the class described by the GuixModelObject gmo
- */
- protected void generate() {
- addImports(gmo);
- }
-
- /**
* Add imports to the generated file
*
* @param gmo GuixModelObject which represents the class to generate
1
0
r1509 - trunk/jaxx-runtime-swing/src/main/java/jaxx/runtime/swing/editor
by tchemit@users.labs.libre-entreprise.org July 24, 2009
by tchemit@users.labs.libre-entreprise.org July 24, 2009
July 24, 2009
Author: tchemit
Date: 2009-07-24 10:00:05 +0200 (Fri, 24 Jul 2009)
New Revision: 1509
Added:
trunk/jaxx-runtime-swing/src/main/java/jaxx/runtime/swing/editor/ClassCellEditor.java
Modified:
trunk/jaxx-runtime-swing/src/main/java/jaxx/runtime/swing/editor/LocaleEditor.java
Log:
add ClassEditor (from commndline), remove deprecated on LocaleEditor (can be used under other circonstancies than changing language of an application)
Added: trunk/jaxx-runtime-swing/src/main/java/jaxx/runtime/swing/editor/ClassCellEditor.java
===================================================================
--- trunk/jaxx-runtime-swing/src/main/java/jaxx/runtime/swing/editor/ClassCellEditor.java (rev 0)
+++ trunk/jaxx-runtime-swing/src/main/java/jaxx/runtime/swing/editor/ClassCellEditor.java 2009-07-24 08:00:05 UTC (rev 1509)
@@ -0,0 +1,119 @@
+/*
+* *##% ui
+ * Copyright (C) 2008 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.swing.editor;
+
+import org.apache.commons.beanutils.Converter;
+import org.nuiton.util.ConverterUtil;
+
+import javax.swing.DefaultCellEditor;
+import javax.swing.JTable;
+import javax.swing.JTextField;
+import javax.swing.event.CellEditorListener;
+import javax.swing.table.TableCellEditor;
+import java.awt.Component;
+import java.util.EventObject;
+
+/**
+ * A class cell editor (fork from comandline project).
+ *
+ * @author chemit
+ */
+public class ClassCellEditor implements TableCellEditor {
+
+ protected TableCellEditor delegate;
+
+ @Override
+ public Component getTableCellEditorComponent(JTable table, Object value, boolean isSelected, int row, int column) {
+
+ String valStr = (value + "").trim();
+ if (valStr.equals("null")) {
+ valStr = "";
+ } else if (valStr.startsWith("class ")) {
+ valStr = valStr.substring(6);
+ }
+ Component comp;
+ comp = getDelegate().getTableCellEditorComponent(table, valStr, isSelected, row, column);
+ return comp;
+ }
+
+ @Override
+ public Object getCellEditorValue() {
+ Object o = !hasDelegate() ? null : delegate.getCellEditorValue();
+ if (o == null) {
+ return null;
+ }
+ Converter converter = ConverterUtil.getConverter(Class.class);
+
+ try {
+ if (converter != null) {
+ return converter.convert(Class.class, o);
+ }
+ o = Class.forName(o + "");
+ } catch (Exception e) {
+ o = null;
+ }
+ return o;
+ }
+
+ @Override
+ public boolean isCellEditable(EventObject anEvent) {
+ return !hasDelegate() || delegate.isCellEditable(anEvent);
+ }
+
+ @Override
+ public boolean shouldSelectCell(EventObject anEvent) {
+ return hasDelegate() && delegate.shouldSelectCell(anEvent);
+ }
+
+ @Override
+ public boolean stopCellEditing() {
+ return !hasDelegate() || delegate.stopCellEditing();
+ }
+
+ @Override
+ public void cancelCellEditing() {
+ if (hasDelegate()) {
+ delegate.cancelCellEditing();
+ }
+ }
+
+ @Override
+ public void addCellEditorListener(CellEditorListener l) {
+ if (hasDelegate()) {
+ delegate.addCellEditorListener(l);
+ }
+ }
+
+ @Override
+ public void removeCellEditorListener(CellEditorListener l) {
+ if (hasDelegate()) {
+ delegate.removeCellEditorListener(l);
+ }
+ }
+
+ protected TableCellEditor getDelegate() {
+ if (delegate == null) {
+ delegate = new DefaultCellEditor(new JTextField());
+ }
+ return delegate;
+ }
+
+ protected boolean hasDelegate() {
+ return delegate != null;
+ }
+}
Modified: trunk/jaxx-runtime-swing/src/main/java/jaxx/runtime/swing/editor/LocaleEditor.java
===================================================================
--- trunk/jaxx-runtime-swing/src/main/java/jaxx/runtime/swing/editor/LocaleEditor.java 2009-07-15 13:13:01 UTC (rev 1508)
+++ trunk/jaxx-runtime-swing/src/main/java/jaxx/runtime/swing/editor/LocaleEditor.java 2009-07-24 08:00:05 UTC (rev 1509)
@@ -31,7 +31,6 @@
*
* @author chemit
* @since 1.6.0
- * @deprecated prefer use the more sotisticated editor in jaxx-runtime-swing-widget module.
*/
public class LocaleEditor extends JComboBox {
1
0
r1522 - in trunk/guix-compiler-gwt/src/main/java/org/nuiton/guix: . generator tags/gwt
by kmorin@users.labs.libre-entreprise.org July 23, 2009
by kmorin@users.labs.libre-entreprise.org July 23, 2009
July 23, 2009
Author: kmorin
Date: 2009-07-23 17:39:55 +0200 (Thu, 23 Jul 2009)
New Revision: 1522
Modified:
trunk/guix-compiler-gwt/src/main/java/org/nuiton/guix/GwtGuixInitializer.java
trunk/guix-compiler-gwt/src/main/java/org/nuiton/guix/generator/GwtAbstractClassGenerator.java
trunk/guix-compiler-gwt/src/main/java/org/nuiton/guix/tags/gwt/ApplicationHandler.java
trunk/guix-compiler-gwt/src/main/java/org/nuiton/guix/tags/gwt/ButtonHandler.java
trunk/guix-compiler-gwt/src/main/java/org/nuiton/guix/tags/gwt/CellHandler.java
trunk/guix-compiler-gwt/src/main/java/org/nuiton/guix/tags/gwt/LabelHandler.java
trunk/guix-compiler-gwt/src/main/java/org/nuiton/guix/tags/gwt/MenuBarHandler.java
trunk/guix-compiler-gwt/src/main/java/org/nuiton/guix/tags/gwt/MenuHandler.java
trunk/guix-compiler-gwt/src/main/java/org/nuiton/guix/tags/gwt/MenuItemHandler.java
trunk/guix-compiler-gwt/src/main/java/org/nuiton/guix/tags/gwt/PanelHandler.java
trunk/guix-compiler-gwt/src/main/java/org/nuiton/guix/tags/gwt/RowHandler.java
trunk/guix-compiler-gwt/src/main/java/org/nuiton/guix/tags/gwt/TabPanelHandler.java
trunk/guix-compiler-gwt/src/main/java/org/nuiton/guix/tags/gwt/TableHandler.java
trunk/guix-compiler-gwt/src/main/java/org/nuiton/guix/tags/gwt/TextFieldHandler.java
trunk/guix-compiler-gwt/src/main/java/org/nuiton/guix/tags/gwt/ToggleButtonHandler.java
trunk/guix-compiler-gwt/src/main/java/org/nuiton/guix/tags/gwt/UIObjectHandler.java
Log:
Add javadoc + licences
Modified: trunk/guix-compiler-gwt/src/main/java/org/nuiton/guix/GwtGuixInitializer.java
===================================================================
--- trunk/guix-compiler-gwt/src/main/java/org/nuiton/guix/GwtGuixInitializer.java 2009-07-23 15:30:02 UTC (rev 1521)
+++ trunk/guix-compiler-gwt/src/main/java/org/nuiton/guix/GwtGuixInitializer.java 2009-07-23 15:39:55 UTC (rev 1522)
@@ -1,5 +1,5 @@
/**
- * *##% guix-compiler
+ * *##% guix-compiler-gwt
* Copyright (C) 2009 CodeLutin
*
* This program is free software: you can redistribute it and/or modify
@@ -39,7 +39,7 @@
/**
* Initialize the application
*
- * @author morin
+ * @author kmorin
*/
public class GwtGuixInitializer {
public static void initialize() {
@@ -59,5 +59,3 @@
}
}
-
-//~ Formatted by Jindent --- http://www.jindent.com
Modified: trunk/guix-compiler-gwt/src/main/java/org/nuiton/guix/generator/GwtAbstractClassGenerator.java
===================================================================
--- trunk/guix-compiler-gwt/src/main/java/org/nuiton/guix/generator/GwtAbstractClassGenerator.java 2009-07-23 15:30:02 UTC (rev 1521)
+++ trunk/guix-compiler-gwt/src/main/java/org/nuiton/guix/generator/GwtAbstractClassGenerator.java 2009-07-23 15:39:55 UTC (rev 1522)
@@ -47,7 +47,6 @@
import org.nuiton.guix.tags.gwt.MenuHandler;
import org.nuiton.guix.tags.gwt.MenuItemHandler;
import org.nuiton.guix.tags.gwt.RowHandler;
-import org.nuiton.guix.tags.gwt.TabPanelHandler;
import org.nuiton.guix.tags.gwt.TableHandler;
/**
Modified: trunk/guix-compiler-gwt/src/main/java/org/nuiton/guix/tags/gwt/ApplicationHandler.java
===================================================================
--- trunk/guix-compiler-gwt/src/main/java/org/nuiton/guix/tags/gwt/ApplicationHandler.java 2009-07-23 15:30:02 UTC (rev 1521)
+++ trunk/guix-compiler-gwt/src/main/java/org/nuiton/guix/tags/gwt/ApplicationHandler.java 2009-07-23 15:39:55 UTC (rev 1522)
@@ -1,13 +1,27 @@
-/*
- * To change this template, choose Tools | Templates
- * and open the template in the editor.
+/**
+ * *##% guix-compiler-gwt
+ * Copyright (C) 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 org.nuiton.guix.tags.gwt;
/**
+ * Handles the application tag
*
- * @author kevin
+ * @author kmorin
*/
public class ApplicationHandler extends UIObjectHandler {
Modified: trunk/guix-compiler-gwt/src/main/java/org/nuiton/guix/tags/gwt/ButtonHandler.java
===================================================================
--- trunk/guix-compiler-gwt/src/main/java/org/nuiton/guix/tags/gwt/ButtonHandler.java 2009-07-23 15:30:02 UTC (rev 1521)
+++ trunk/guix-compiler-gwt/src/main/java/org/nuiton/guix/tags/gwt/ButtonHandler.java 2009-07-23 15:39:55 UTC (rev 1522)
@@ -1,13 +1,27 @@
-/*
- * To change this template, choose Tools | Templates
- * and open the template in the editor.
+/**
+ * *##% guix-compiler-gwt
+ * Copyright (C) 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 org.nuiton.guix.tags.gwt;
/**
+ * Handles the Button tag
*
- * @author kevin
+ * @author kmorin
*/
public class ButtonHandler extends UIObjectHandler {
Modified: trunk/guix-compiler-gwt/src/main/java/org/nuiton/guix/tags/gwt/CellHandler.java
===================================================================
--- trunk/guix-compiler-gwt/src/main/java/org/nuiton/guix/tags/gwt/CellHandler.java 2009-07-23 15:30:02 UTC (rev 1521)
+++ trunk/guix-compiler-gwt/src/main/java/org/nuiton/guix/tags/gwt/CellHandler.java 2009-07-23 15:39:55 UTC (rev 1522)
@@ -1,5 +1,5 @@
/**
- * *##% guix-compiler-swing
+ * *##% guix-compiler-gwt
* Copyright (C) 2009 CodeLutin
*
* This program is free software: you can redistribute it and/or modify
@@ -24,7 +24,7 @@
/**
* Represents a cell of a table
*
- * @author kevin
+ * @author kmorin
*/
public class CellHandler extends TableHandler {
/** id of the object contained by the cell */
Modified: trunk/guix-compiler-gwt/src/main/java/org/nuiton/guix/tags/gwt/LabelHandler.java
===================================================================
--- trunk/guix-compiler-gwt/src/main/java/org/nuiton/guix/tags/gwt/LabelHandler.java 2009-07-23 15:30:02 UTC (rev 1521)
+++ trunk/guix-compiler-gwt/src/main/java/org/nuiton/guix/tags/gwt/LabelHandler.java 2009-07-23 15:39:55 UTC (rev 1522)
@@ -1,14 +1,27 @@
-/*
- * To change this template, choose Tools | Templates
- * and open the template in the editor.
+/**
+ * *##% guix-compiler-gwt
+ * Copyright (C) 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 org.nuiton.guix.tags.gwt;
-import com.google.gwt.user.client.EventListener;
/**
+ * Handles the Label tag
*
- * @author kevin
+ * @author kmorin
*/
public class LabelHandler extends UIObjectHandler {
Modified: trunk/guix-compiler-gwt/src/main/java/org/nuiton/guix/tags/gwt/MenuBarHandler.java
===================================================================
--- trunk/guix-compiler-gwt/src/main/java/org/nuiton/guix/tags/gwt/MenuBarHandler.java 2009-07-23 15:30:02 UTC (rev 1521)
+++ trunk/guix-compiler-gwt/src/main/java/org/nuiton/guix/tags/gwt/MenuBarHandler.java 2009-07-23 15:39:55 UTC (rev 1522)
@@ -1,14 +1,27 @@
-/*
- * To change this template, choose Tools | Templates
- * and open the template in the editor.
+/**
+ * *##% guix-compiler-gwt
+ * Copyright (C) 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 org.nuiton.guix.tags.gwt;
-import com.google.gwt.user.client.EventListener;
/**
+ * Handles the MenuBar tag
*
- * @author kevin
+ * @author kmorin
*/
public class MenuBarHandler extends UIObjectHandler {
Modified: trunk/guix-compiler-gwt/src/main/java/org/nuiton/guix/tags/gwt/MenuHandler.java
===================================================================
--- trunk/guix-compiler-gwt/src/main/java/org/nuiton/guix/tags/gwt/MenuHandler.java 2009-07-23 15:30:02 UTC (rev 1521)
+++ trunk/guix-compiler-gwt/src/main/java/org/nuiton/guix/tags/gwt/MenuHandler.java 2009-07-23 15:39:55 UTC (rev 1522)
@@ -1,13 +1,27 @@
-/*
- * To change this template, choose Tools | Templates
- * and open the template in the editor.
+/**
+ * *##% guix-compiler-gwt
+ * Copyright (C) 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 org.nuiton.guix.tags.gwt;
/**
+ * Handles the Menu tag
*
- * @author kevin
+ * @author kmorin
*/
public class MenuHandler extends UIObjectHandler {
Modified: trunk/guix-compiler-gwt/src/main/java/org/nuiton/guix/tags/gwt/MenuItemHandler.java
===================================================================
--- trunk/guix-compiler-gwt/src/main/java/org/nuiton/guix/tags/gwt/MenuItemHandler.java 2009-07-23 15:30:02 UTC (rev 1521)
+++ trunk/guix-compiler-gwt/src/main/java/org/nuiton/guix/tags/gwt/MenuItemHandler.java 2009-07-23 15:39:55 UTC (rev 1522)
@@ -1,13 +1,27 @@
-/*
- * To change this template, choose Tools | Templates
- * and open the template in the editor.
+/**
+ * *##% guix-compiler-gwt
+ * Copyright (C) 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 org.nuiton.guix.tags.gwt;
/**
+ * Handles the MenuItem tag
*
- * @author kevin
+ * @author kmorin
*/
public class MenuItemHandler extends UIObjectHandler {
Modified: trunk/guix-compiler-gwt/src/main/java/org/nuiton/guix/tags/gwt/PanelHandler.java
===================================================================
--- trunk/guix-compiler-gwt/src/main/java/org/nuiton/guix/tags/gwt/PanelHandler.java 2009-07-23 15:30:02 UTC (rev 1521)
+++ trunk/guix-compiler-gwt/src/main/java/org/nuiton/guix/tags/gwt/PanelHandler.java 2009-07-23 15:39:55 UTC (rev 1522)
@@ -1,13 +1,27 @@
-/*
- * To change this template, choose Tools | Templates
- * and open the template in the editor.
+/**
+ * *##% guix-compiler-gwt
+ * Copyright (C) 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 org.nuiton.guix.tags.gwt;
/**
+ * Handles Panel tag
*
- * @author kevin
+ * @author kmorin
*/
public class PanelHandler extends UIObjectHandler {
Modified: trunk/guix-compiler-gwt/src/main/java/org/nuiton/guix/tags/gwt/RowHandler.java
===================================================================
--- trunk/guix-compiler-gwt/src/main/java/org/nuiton/guix/tags/gwt/RowHandler.java 2009-07-23 15:30:02 UTC (rev 1521)
+++ trunk/guix-compiler-gwt/src/main/java/org/nuiton/guix/tags/gwt/RowHandler.java 2009-07-23 15:39:55 UTC (rev 1522)
@@ -1,5 +1,5 @@
/**
- * *##% guix-compiler-swing
+ * *##% guix-compiler-gwt
* Copyright (C) 2009 CodeLutin
*
* This program is free software: you can redistribute it and/or modify
@@ -24,7 +24,7 @@
/**
* Represents a row of a table
*
- * @author kevin
+ * @author kmorin
*/
public class RowHandler extends TableHandler {
Modified: trunk/guix-compiler-gwt/src/main/java/org/nuiton/guix/tags/gwt/TabPanelHandler.java
===================================================================
--- trunk/guix-compiler-gwt/src/main/java/org/nuiton/guix/tags/gwt/TabPanelHandler.java 2009-07-23 15:30:02 UTC (rev 1521)
+++ trunk/guix-compiler-gwt/src/main/java/org/nuiton/guix/tags/gwt/TabPanelHandler.java 2009-07-23 15:39:55 UTC (rev 1522)
@@ -1,13 +1,27 @@
-/*
- * To change this template, choose Tools | Templates
- * and open the template in the editor.
+/**
+ * *##% guix-compiler-gwt
+ * Copyright (C) 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 org.nuiton.guix.tags.gwt;
/**
+ * Handles TabPanel tags
*
- * @author kevin
+ * @author kmorin
*/
public class TabPanelHandler extends UIObjectHandler {
Modified: trunk/guix-compiler-gwt/src/main/java/org/nuiton/guix/tags/gwt/TableHandler.java
===================================================================
--- trunk/guix-compiler-gwt/src/main/java/org/nuiton/guix/tags/gwt/TableHandler.java 2009-07-23 15:30:02 UTC (rev 1521)
+++ trunk/guix-compiler-gwt/src/main/java/org/nuiton/guix/tags/gwt/TableHandler.java 2009-07-23 15:39:55 UTC (rev 1522)
@@ -1,5 +1,5 @@
/**
- * *##% guix-compiler-swing
+ * *##% guix-compiler-gwt
* Copyright (C) 2009 CodeLutin
*
* This program is free software: you can redistribute it and/or modify
@@ -28,7 +28,7 @@
/**
* Represents a table
*
- * @author kevin
+ * @author kmorin
*/
public class TableHandler extends UIObjectHandler {
Modified: trunk/guix-compiler-gwt/src/main/java/org/nuiton/guix/tags/gwt/TextFieldHandler.java
===================================================================
--- trunk/guix-compiler-gwt/src/main/java/org/nuiton/guix/tags/gwt/TextFieldHandler.java 2009-07-23 15:30:02 UTC (rev 1521)
+++ trunk/guix-compiler-gwt/src/main/java/org/nuiton/guix/tags/gwt/TextFieldHandler.java 2009-07-23 15:39:55 UTC (rev 1522)
@@ -1,14 +1,29 @@
-/*
- * To change this template, choose Tools | Templates
- * and open the template in the editor.
+/**
+ * *##% guix-compiler-gwt
+ * Copyright (C) 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 org.nuiton.guix.tags.gwt;
-package org.nuiton.guix.tags.gwt;
import com.google.gwt.user.client.ui.KeyboardListener;
/**
+ * Handles the Textfield tag
*
- * @author kevin
+ * @author kmorin
*/
public class TextFieldHandler extends UIObjectHandler {
Modified: trunk/guix-compiler-gwt/src/main/java/org/nuiton/guix/tags/gwt/ToggleButtonHandler.java
===================================================================
--- trunk/guix-compiler-gwt/src/main/java/org/nuiton/guix/tags/gwt/ToggleButtonHandler.java 2009-07-23 15:30:02 UTC (rev 1521)
+++ trunk/guix-compiler-gwt/src/main/java/org/nuiton/guix/tags/gwt/ToggleButtonHandler.java 2009-07-23 15:39:55 UTC (rev 1522)
@@ -1,14 +1,29 @@
-/*
- * To change this template, choose Tools | Templates
- * and open the template in the editor.
+/**
+ * *##% guix-compiler-gwt
+ * Copyright (C) 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 org.nuiton.guix.tags.gwt;
-package org.nuiton.guix.tags.gwt;
import com.google.gwt.user.client.ui.ClickListener;
/**
+ * Handles the ToggleButton tags
*
- * @author kevin
+ * @author kmorin
*/
public class ToggleButtonHandler extends ButtonHandler {
Modified: trunk/guix-compiler-gwt/src/main/java/org/nuiton/guix/tags/gwt/UIObjectHandler.java
===================================================================
--- trunk/guix-compiler-gwt/src/main/java/org/nuiton/guix/tags/gwt/UIObjectHandler.java 2009-07-23 15:30:02 UTC (rev 1521)
+++ trunk/guix-compiler-gwt/src/main/java/org/nuiton/guix/tags/gwt/UIObjectHandler.java 2009-07-23 15:39:55 UTC (rev 1522)
@@ -1,16 +1,29 @@
-/*
- * To change this template, choose Tools | Templates
- * and open the template in the editor.
+/**
+ * *##% guix-compiler-gwt
+ * Copyright (C) 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 org.nuiton.guix.tags.gwt;
-package org.nuiton.guix.tags.gwt;
-import com.google.gwt.user.client.EventListener;
-import com.google.gwt.user.client.ui.FocusListener;
import org.nuiton.guix.tags.DefaultTagHandler;
/**
+ * Contains the common parameters for all the GWT handlers
*
- * @author kevin
+ * @author kmorin
*/
public abstract class UIObjectHandler extends DefaultTagHandler {
1
0
r1521 - in trunk/guix-compiler/src/main/java/org/nuiton/guix: generator tags
by kmorin@users.labs.libre-entreprise.org July 23, 2009
by kmorin@users.labs.libre-entreprise.org July 23, 2009
July 23, 2009
Author: kmorin
Date: 2009-07-23 17:30:02 +0200 (Thu, 23 Jul 2009)
New Revision: 1521
Modified:
trunk/guix-compiler/src/main/java/org/nuiton/guix/generator/GuixGenerator.java
trunk/guix-compiler/src/main/java/org/nuiton/guix/tags/ApplicationHandler.java
trunk/guix-compiler/src/main/java/org/nuiton/guix/tags/DefaultTagHandler.java
trunk/guix-compiler/src/main/java/org/nuiton/guix/tags/PanelHandler.java
trunk/guix-compiler/src/main/java/org/nuiton/guix/tags/TagHandler.java
Log:
Add javadoc + licences
Modified: trunk/guix-compiler/src/main/java/org/nuiton/guix/generator/GuixGenerator.java
===================================================================
--- trunk/guix-compiler/src/main/java/org/nuiton/guix/generator/GuixGenerator.java 2009-07-23 14:46:10 UTC (rev 1520)
+++ trunk/guix-compiler/src/main/java/org/nuiton/guix/generator/GuixGenerator.java 2009-07-23 15:30:02 UTC (rev 1521)
@@ -50,9 +50,14 @@
protected List<File> cssFiles = null;
/** Name to give to the generated launcher*/
protected String launcherName = null;
- /** */
+ /** Maps the field name with a map of the attribute and its value */
protected Map<String,Map<String, String>> bindings2Generate = new HashMap<String,Map<String, String>>();
+ /**
+ * Generates a JavaFile
+ *
+ * @return the JavaFile generated
+ */
public abstract JavaFile generate();
public File getDestDir() {
@@ -128,8 +133,26 @@
this.bindings2Generate = bindings2Generate;
}
+ /**
+ * Saves the generated files
+ */
public abstract void saveFiles();
+ /**
+ * Checks if the objects of the binding exist
+ *
+ * @param dbCreation the method code to apply the binding
+ * @param dbDeletion the method code to remove the binding
+ * @param prevTh the TagHandler of the parent of the object inspected
+ * @param jf the javaFile of the inspected object (null if it is not a generated object)
+ * @param clazz the clazz of the inspected object (null if it is a generated object)
+ * @param binding the array containing the name of the objects to check
+ * @param i the index of the being checked object
+ * @param alreadyChecked list of the already checked objects
+ * @param methodToInvoke the name of the method which will process the databinding
+ * @param generatedFiles maps the GuixGenerator with its JavaFile
+ * @return the list of the listeners to add to the objects for the databinding
+ */
public abstract List<Class> generateBindings(StringBuffer dbCreation, StringBuffer dbDeletion, TagHandler prevTh, JavaFile jf,
Class clazz, String[] binding, int i, List<String> alreadyChecked, String methodToInvoke, Map<GuixGenerator,JavaFile> generatedFiles);
}
Modified: trunk/guix-compiler/src/main/java/org/nuiton/guix/tags/ApplicationHandler.java
===================================================================
--- trunk/guix-compiler/src/main/java/org/nuiton/guix/tags/ApplicationHandler.java 2009-07-23 14:46:10 UTC (rev 1520)
+++ trunk/guix-compiler/src/main/java/org/nuiton/guix/tags/ApplicationHandler.java 2009-07-23 15:30:02 UTC (rev 1521)
@@ -1,13 +1,27 @@
-/*
- * To change this template, choose Tools | Templates
- * and open the template in the editor.
+/**
+ * *##% guix-compiler
+ * Copyright (C) 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 org.nuiton.guix.tags;
/**
- *
- * @author kevin
+ * Application Handler for the tests
+ * @author kmorin
*/
public abstract class ApplicationHandler extends DefaultTagHandler {
Modified: trunk/guix-compiler/src/main/java/org/nuiton/guix/tags/DefaultTagHandler.java
===================================================================
--- trunk/guix-compiler/src/main/java/org/nuiton/guix/tags/DefaultTagHandler.java 2009-07-23 14:46:10 UTC (rev 1520)
+++ trunk/guix-compiler/src/main/java/org/nuiton/guix/tags/DefaultTagHandler.java 2009-07-23 15:30:02 UTC (rev 1521)
@@ -1,14 +1,27 @@
-/*
- * To change this template, choose Tools | Templates
- * and open the template in the editor.
+/**
+ * *##% guix-compiler
+ * Copyright (C) 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 org.nuiton.guix.tags;
-package org.nuiton.guix.tags;
import java.beans.BeanInfo;
import java.beans.EventSetDescriptor;
import java.beans.IntrospectionException;
import java.beans.Introspector;
-import java.beans.MethodDescriptor;
import java.beans.PropertyDescriptor;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
@@ -18,11 +31,13 @@
import org.nuiton.guix.UnsupportedAttributeException;
/**
+ * Default TagHandler, containing common methods for all the tags
*
- * @author kevin
+ * @author kmorin
*/
public abstract class DefaultTagHandler implements TagHandler {
+ /** Maps the common name for an attribute with its real name for the class to generate */
protected Map<String,String> attrMap = new HashMap<String,String>();
/** Maps property names to their respective ProxyEventInfos. */
Modified: trunk/guix-compiler/src/main/java/org/nuiton/guix/tags/PanelHandler.java
===================================================================
--- trunk/guix-compiler/src/main/java/org/nuiton/guix/tags/PanelHandler.java 2009-07-23 14:46:10 UTC (rev 1520)
+++ trunk/guix-compiler/src/main/java/org/nuiton/guix/tags/PanelHandler.java 2009-07-23 15:30:02 UTC (rev 1521)
@@ -1,13 +1,27 @@
-/*
- * To change this template, choose Tools | Templates
- * and open the template in the editor.
+/**
+ * *##% guix-compiler
+ * Copyright (C) 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 org.nuiton.guix.tags;
/**
+ * Panel Handler for the tests
*
- * @author kevin
+ * @author kmorin
*/
public abstract class PanelHandler extends DefaultTagHandler {
Modified: trunk/guix-compiler/src/main/java/org/nuiton/guix/tags/TagHandler.java
===================================================================
--- trunk/guix-compiler/src/main/java/org/nuiton/guix/tags/TagHandler.java 2009-07-23 14:46:10 UTC (rev 1520)
+++ trunk/guix-compiler/src/main/java/org/nuiton/guix/tags/TagHandler.java 2009-07-23 15:30:02 UTC (rev 1521)
@@ -1,13 +1,29 @@
-/*
- * To change this template, choose Tools | Templates
- * and open the template in the editor.
+/**
+ * *##% guix-compiler
+ * Copyright (C) 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 org.nuiton.guix.tags;
/**
+ * Interface of the tag handlers.
+ * It permits to get the right class or the right attribiute names to generate for the common tags.
+ * It also permits to know which listeners to add for the binding
*
- * @author kevin
+ * @author kmorin
*/
public interface TagHandler {
1
0
r1520 - in trunk/guix-compiler/src/main/java/org/nuiton/guix: . compiler generator
by kmorin@users.labs.libre-entreprise.org July 23, 2009
by kmorin@users.labs.libre-entreprise.org July 23, 2009
July 23, 2009
Author: kmorin
Date: 2009-07-23 16:46:10 +0200 (Thu, 23 Jul 2009)
New Revision: 1520
Modified:
trunk/guix-compiler/src/main/java/org/nuiton/guix/GuixLauncher.java
trunk/guix-compiler/src/main/java/org/nuiton/guix/compiler/GuixCompiler.java
trunk/guix-compiler/src/main/java/org/nuiton/guix/generator/JavaFile.java
Log:
Add null conditions to avoid NPE
Modified: trunk/guix-compiler/src/main/java/org/nuiton/guix/GuixLauncher.java
===================================================================
--- trunk/guix-compiler/src/main/java/org/nuiton/guix/GuixLauncher.java 2009-07-23 13:33:45 UTC (rev 1519)
+++ trunk/guix-compiler/src/main/java/org/nuiton/guix/GuixLauncher.java 2009-07-23 14:46:10 UTC (rev 1520)
@@ -420,7 +420,9 @@
}
return classDescriptor;
}
- classDescriptors.get(i).setPackageName(classDescriptor.getPackageName());
+ if(classDescriptor.getPackageName() != null) {
+ classDescriptors.get(i).setPackageName(classDescriptor.getPackageName());
+ }
if (classDescriptor.getScript() != null) {
if (classDescriptors.get(i).getScript() == null) {
classDescriptors.get(i).setScript(classDescriptor.getScript());
Modified: trunk/guix-compiler/src/main/java/org/nuiton/guix/compiler/GuixCompiler.java
===================================================================
--- trunk/guix-compiler/src/main/java/org/nuiton/guix/compiler/GuixCompiler.java 2009-07-23 13:33:45 UTC (rev 1519)
+++ trunk/guix-compiler/src/main/java/org/nuiton/guix/compiler/GuixCompiler.java 2009-07-23 14:46:10 UTC (rev 1520)
@@ -118,7 +118,6 @@
public GuixModelObject compile() {
if ((src != null) && (launcher != null)) {
try {
-
// Creation of the Xml parser
XmlPullParserFactory factory =
XmlPullParserFactory.newInstance(System.getProperty(XmlPullParserFactory.PROPERTY_NAME), null);
Modified: trunk/guix-compiler/src/main/java/org/nuiton/guix/generator/JavaFile.java
===================================================================
--- trunk/guix-compiler/src/main/java/org/nuiton/guix/generator/JavaFile.java 2009-07-23 13:33:45 UTC (rev 1519)
+++ trunk/guix-compiler/src/main/java/org/nuiton/guix/generator/JavaFile.java 2009-07-23 14:46:10 UTC (rev 1520)
@@ -189,7 +189,7 @@
public void addField(JavaField field, boolean javaBean) {
addSimpleField(field);
String id = field.getName();
- String capitalizedName = (id.length()>0)? Character.toUpperCase(id.charAt(0))+id.substring(1) : id;
+ String capitalizedName = (id != null && id.length()>0)? Character.toUpperCase(id.charAt(0))+id.substring(1) : id;
// add getter file
String content = (classType == INTERFACE) ? null : String.format(GETTER_PATTERN, id);
addMethod(new JavaMethod(Modifier.PUBLIC, field.getType(),
1
0
r1519 - in trunk: . guix-compiler/src/main/java/org/nuiton/guix guix-compiler/src/test guix-test-swing/src/main/java/org/nuiton/guix/demo
by kmorin@users.labs.libre-entreprise.org July 23, 2009
by kmorin@users.labs.libre-entreprise.org July 23, 2009
July 23, 2009
Author: kmorin
Date: 2009-07-23 15:33:45 +0200 (Thu, 23 Jul 2009)
New Revision: 1519
Removed:
trunk/guix-maven-plugin/
Modified:
trunk/guix-compiler/src/main/java/org/nuiton/guix/GuixLauncher.java
trunk/guix-compiler/src/test/test.guix
trunk/guix-test-swing/src/main/java/org/nuiton/guix/demo/GuixDemo.css
trunk/guix-test-swing/src/main/java/org/nuiton/guix/demo/GuixDemo.script
trunk/guix-test-swing/src/main/java/org/nuiton/guix/demo/GuixDemo2.guix
trunk/guix-test-swing/src/main/java/org/nuiton/guix/demo/GuixDemo3.guix
trunk/guix-test-swing/src/main/java/org/nuiton/guix/demo/JButton.css
Log:
Modified: trunk/guix-compiler/src/main/java/org/nuiton/guix/GuixLauncher.java
===================================================================
--- trunk/guix-compiler/src/main/java/org/nuiton/guix/GuixLauncher.java 2009-07-23 11:51:40 UTC (rev 1518)
+++ trunk/guix-compiler/src/main/java/org/nuiton/guix/GuixLauncher.java 2009-07-23 13:33:45 UTC (rev 1519)
@@ -188,8 +188,10 @@
}
}
+ //if the compilation successed
if (success) {
int i = 0;
+ //check if all the objects have an existing clas or a class being generated
while (success && i < classDescriptors.size()) {
success = (classDescriptors.get(i).getPackageName() != null || TagManager.getGuixClassHandler(classDescriptors.get(i).getName()) != null);
i++;
@@ -220,6 +222,7 @@
for (GuixModelObject mo : rootModelObjects.keySet()) {
try {
+ //init generator
GuixGenerator gen = (GuixGenerator) generatorClass.newInstance();
gen.setDestDir(destDir);
gen.setGmo(mo);
@@ -229,6 +232,7 @@
gen.setClasses(Arrays.asList(classNames));
gen.setLauncherName(launcherName);
gen.setCSSFiles(mo.getCssFiles());
+ //generates the file without databinding
JavaFile generatedFile = gen.generate();
if(generatedFile != null) {
generatedFiles.put(gen, generatedFile);
@@ -245,25 +249,34 @@
}
}
}
+ //generation of the databinding
for (GuixGenerator gen : generatedFiles.keySet()) {
- int dataSourceNumber = 0;
+ //int dataSourceNumber = 0;
+ //databinding creation method
StringBuffer dbCreation = new StringBuffer();
+ //databinding deletion method
StringBuffer dbDeletion = new StringBuffer();
+ //databinding execution method
StringBuffer dbProcess = new StringBuffer();
JavaFile jf = generatedFiles.get(gen);
+ //for each field which binds the value of others objects
for (String field : gen.getBindingsToGenerate().keySet()) {
for (String attr : gen.getBindingsToGenerate().get(field).keySet()) {
dbCreation.append(dbCreation.length() != 0 ? "else if(\"" : "if(\"").append(field).append(".").append(attr).append("\".equals(_binding)) {\n");
dbDeletion.append(dbDeletion.length() != 0 ? "else if(\"" : "if(\"").append(field).append(".").append(attr).append("\".equals(_binding)) {\n");
dbProcess.append(dbProcess.length() != 0 ? "else if(\"" : "if(\"").append(field).append(".").append(attr).append("\".equals(_binding)) {\n").append(field).append(".set").append(Character.toUpperCase(attr.charAt(0))).append(attr.substring(1)).append("(");
List<String[]> bindings = new ArrayList<String[]>();
+ //the parser which decompose the binding into the different elements to bind
JavaParser p = new JavaParser(new StringReader(gen.getBindingsToGenerate().get(field).get(attr)));
- //start parsing
+ //start parsing the binding value
while (!p.Line()) {
SimpleNode node = p.popNode();
if (node != null) {
+ //get the different elements to bind
for (String s : browseNode(node)) {
+ //decompose the element s into attributes
List<String> l = new ArrayList<String>();
+ //number of open brackets
int parOuvertes = 0;
StringBuffer read = new StringBuffer();
for (char c : s.toCharArray()) {
@@ -293,24 +306,31 @@
}
}
}
+ //generates the code
List<Class> listeners = new ArrayList<Class>();
for (String[] binding : bindings) {
StringBuffer methodToInvoke = new StringBuffer();
+ //the binding value before the generator changes it
StringBuffer oldBinding = new StringBuffer();
+ //generates the method name for calling the databinding process method
for (String s : binding) {
methodToInvoke.append(s.replaceAll("\\W", ""));
oldBinding.append(s).append(".");
}
oldBinding.setLength(oldBinding.length() - 1);
+ //generates the code and modify the simple attribute name in the binding by the getter
listeners.addAll(gen.generateBindings(dbCreation, dbDeletion, null, jf, null, binding, 0, null, methodToInvoke.toString(), generatedFiles));
//JavaArgument[] args = new JavaArgument[]{new JavaArgument(parameterType.getName(), "event")};
+ //new value of the binding with the getters
StringBuffer newBinding = new StringBuffer();
for (String s : binding) {
newBinding.append(s).append(".");
}
newBinding.setLength(newBinding.length() - 1);
+ //replaces the old binding by the newer one
gen.getBindingsToGenerate().get(field).put(attr, gen.getBindingsToGenerate().get(field).get(attr).replace(oldBinding.toString(), newBinding.toString()));
+ //method called by the listener
if (jf.getMethod("onChangeFrom" + methodToInvoke, /*args*/ null) == null) {
jf.addMethod(new JavaMethod(Modifier.PUBLIC, "void", "onChangeFrom" + methodToInvoke.toString(), /*args*/ null, null, /*"_DataSource" + dataSourceNumber + ".propertyChange(null);"*/ "processDataBinding(\"" + field + "." + attr + "\");", null));
}
@@ -321,17 +341,20 @@
dbCreation.append("}\n");
dbDeletion.append("}\n");
dbProcess.append(gen.getBindingsToGenerate().get(field).get(attr)).append(");\n}\n");
+ //if the binding got some elements to bind
if (listeners != null) {
//jf.addField(new JavaField(Modifier.PRIVATE, "java.beans.PropertyChangeListener", "_DataSource" + dataSourceNumber, "new org.nuiton.guix.runtime.DataBindingListener(this,\"" + field + "." + attr + "\")", null, null));
+ //method to init the databinding
jf.getMethod("initDataBinding", null).appendBodyCode("applyDataBinding(\"" + field + "." + attr + "\");", "\n");
- for (Class listener : listeners) {
- final List<Method> listenerMethods = Arrays.asList(listener.getMethods());
- Class parameterType = listenerMethods.get(0).getParameterTypes()[0];
- }
+// for (Class listener : listeners) {
+// final List<Method> listenerMethods = Arrays.asList(listener.getMethods());
+// Class parameterType = listenerMethods.get(0).getParameterTypes()[0];
+// }
}
- dataSourceNumber++;
+ //dataSourceNumber++;
}
}
+ //if the generated file has a superclass which also is a generated class, apply the databinding of the superclass to the class
if (generatedFiles.get(jf.getSuperClass()) != null) {
dbCreation.append("else {\nsuper.applyDataBinding(_binding);\n" +
"return;\n}");
@@ -342,10 +365,12 @@
"return;\n}\n" +
"activeBindings.add(_binding);\ntry{\n");
dbProcess.append("\n} finally {\nactiveBindings.remove(_binding);\n}\n");
+
jf.addField(new JavaField(Modifier.PRIVATE, "java.util.List<String>", "activeBindings", "new java.util.ArrayList<String>()", "List of the active bindings", null), false);
- jf.addMethod(new JavaMethod(Modifier.PUBLIC, "void", "applyDataBinding", new JavaArgument[]{new JavaArgument("String", "_binding")}, null, dbCreation.toString(), null));
- jf.addMethod(new JavaMethod(Modifier.PUBLIC, "void", "removeDataBinding", new JavaArgument[]{new JavaArgument("String", "_binding")}, null, dbDeletion.toString(), null));
- jf.addMethod(new JavaMethod(Modifier.PUBLIC, "void", "processDataBinding", new JavaArgument[]{new JavaArgument("String", "_binding")}, null, dbProcess.toString(), null));
+ jf.addMethod(new JavaMethod(Modifier.PUBLIC, "void", "applyDataBinding", new JavaArgument[]{new JavaArgument("String", "_binding")}, null, dbCreation.toString(), "Adds the listeners to the elements which are bound by another attribute"));
+ jf.addMethod(new JavaMethod(Modifier.PUBLIC, "void", "removeDataBinding", new JavaArgument[]{new JavaArgument("String", "_binding")}, null, dbDeletion.toString(), "Removes the listeners to the elements which are bound by another attribute"));
+ jf.addMethod(new JavaMethod(Modifier.PUBLIC, "void", "processDataBinding", new JavaArgument[]{new JavaArgument("String", "_binding")}, null, dbProcess.toString(), "Executes the binding instruction"));
+ //saves the files
gen.saveFiles();
}
serializer.endTag("", "beans");
@@ -427,9 +452,16 @@
return classDescriptors.get(i);
}
+ /**
+ * Decompose the binding into the different elements to bind
+ *
+ * @param node the Node being parsed
+ * @return the elements to bind
+ */
private List<String> browseNode(SimpleNode node) {
List<String> result = new ArrayList<String>();
for (int i = 0; i < node.jjtGetNumChildren(); i++) {
+ //if the child is not a String and are not parameters of a method
if (node.getChild(i).getId() == JavaParserTreeConstants.JJTPRIMARYEXPRESSION && !node.getChild(i).getText().trim().startsWith("(") && !node.getChild(i).getText().trim().startsWith("\"")) {
result.add(node.getChild(i).getText().trim());
}
Modified: trunk/guix-compiler/src/test/test.guix
===================================================================
--- trunk/guix-compiler/src/test/test.guix 2009-07-23 11:51:40 UTC (rev 1518)
+++ trunk/guix-compiler/src/test/test.guix 2009-07-23 13:33:45 UTC (rev 1519)
@@ -1,4 +1,4 @@
<?xml version='1.0' encoding='UTF-8' ?>
-<org.nuiton.guix.Test>
+<Application>
<Panel />
-</org.nuiton.guix.Test>
+</Application>
Modified: trunk/guix-test-swing/src/main/java/org/nuiton/guix/demo/GuixDemo.css
===================================================================
--- trunk/guix-test-swing/src/main/java/org/nuiton/guix/demo/GuixDemo.css 2009-07-23 11:51:40 UTC (rev 1518)
+++ trunk/guix-test-swing/src/main/java/org/nuiton/guix/demo/GuixDemo.css 2009-07-23 13:33:45 UTC (rev 1519)
@@ -1,16 +1,37 @@
-#button:{object . getText( ) . startsWith( "-" )}
+#button:{getText( ) . startsWith( "-" )}
{
- foreground: red;
+ foreground: "new java.awt.Color(0,255,0)";
}
#label
{
- background : blue;
+ foreground : "new java.awt.Color(0,120,255)";
}
-
-.bold
+#label:onMouseEntered
{
- font : bold;
+ foreground : "new java.awt.Color(255,120,0)";
}
+#label:onMouseExited
+{
+ foreground : "new java.awt.Color(0,120,255)";
+}
+
+JToolBar {
+ border : "new javax.swing.border.EtchedBorder()";
+ constraint : "BorderLayout.NORTH";
+}
+
+#tabPanel {
+ constraint : "BorderLayout.CENTER";
+ size : "800,400";
+}
+
+#bouton1, #textfield {
+ size: "100,35";
+}
+
+.table {
+ border : "new javax.swing.border.EtchedBorder()";
+}
Modified: trunk/guix-test-swing/src/main/java/org/nuiton/guix/demo/GuixDemo.script
===================================================================
--- trunk/guix-test-swing/src/main/java/org/nuiton/guix/demo/GuixDemo.script 2009-07-23 11:51:40 UTC (rev 1518)
+++ trunk/guix-test-swing/src/main/java/org/nuiton/guix/demo/GuixDemo.script 2009-07-23 13:33:45 UTC (rev 1519)
@@ -1,3 +1,3 @@
-public void testSameName() {
+static public void testSameName() {
System.out.println("load the script file with the same name");
}
Modified: trunk/guix-test-swing/src/main/java/org/nuiton/guix/demo/GuixDemo2.guix
===================================================================
--- trunk/guix-test-swing/src/main/java/org/nuiton/guix/demo/GuixDemo2.guix 2009-07-23 11:51:40 UTC (rev 1518)
+++ trunk/guix-test-swing/src/main/java/org/nuiton/guix/demo/GuixDemo2.guix 2009-07-23 13:33:45 UTC (rev 1519)
@@ -1,5 +1,5 @@
<?xml version='1.0' encoding='UTF-8' ?>
<!-- test javadoc Application -->
-<swing:JPanel xmlns:swing='javax.swing.*'>
- <swing:JToggleButton id="button" text="Push me" selected ="true" />
-</swing:JPanel>
+<Panel>
+ <ToggleButton id="button" text="Push me" selected="true" onClick='{System.out.println("test")}' />
+</Panel>
Modified: trunk/guix-test-swing/src/main/java/org/nuiton/guix/demo/GuixDemo3.guix
===================================================================
--- trunk/guix-test-swing/src/main/java/org/nuiton/guix/demo/GuixDemo3.guix 2009-07-23 11:51:40 UTC (rev 1518)
+++ trunk/guix-test-swing/src/main/java/org/nuiton/guix/demo/GuixDemo3.guix 2009-07-23 13:33:45 UTC (rev 1519)
@@ -1,4 +1,4 @@
<?xml version='1.0' encoding='UTF-8' ?>
<!-- test javadoc Application -->
-<swing:JButton xmlns:swing='javax.swing.*'>
-</swing:JButton>
+<Button text="GuixDemo3">
+</Button>
Modified: trunk/guix-test-swing/src/main/java/org/nuiton/guix/demo/JButton.css
===================================================================
--- trunk/guix-test-swing/src/main/java/org/nuiton/guix/demo/JButton.css 2009-07-23 11:51:40 UTC (rev 1518)
+++ trunk/guix-test-swing/src/main/java/org/nuiton/guix/demo/JButton.css 2009-07-23 13:33:45 UTC (rev 1519)
@@ -1,30 +1,9 @@
-JButton {
- font-size: 18;
- width: 80;
- height: 35;
-}
-
-JButton.digit {
- foreground: blue;
-}
-
-JButton#dot {
- font-size: 20;
-}
-
-JButton.operator {
- font-size: 16;
- foreground: #009900;
-}
-
-JButton.clear {
- foreground: red;
-}
-
-JButton:mouseover {
- font-weight: bold;
-}
-
-JButton.operator:mouseover {
- font-weight: normal;
+Button {
+ size: "80,35";
+ foreground: "new java.awt.Color(120,255,0)";
}
+
+Button:onActionPerformed {
+ text : "click !";
+}
+
1
0
r1518 - trunk/guix-test-swing/src/main/java/org/nuiton/guix
by kmorin@users.labs.libre-entreprise.org July 23, 2009
by kmorin@users.labs.libre-entreprise.org July 23, 2009
July 23, 2009
Author: kmorin
Date: 2009-07-23 13:51:40 +0200 (Thu, 23 Jul 2009)
New Revision: 1518
Removed:
trunk/guix-test-swing/src/main/java/org/nuiton/guix/GuixDemo.java
trunk/guix-test-swing/src/main/java/org/nuiton/guix/GuixDemo2.java
trunk/guix-test-swing/src/main/java/org/nuiton/guix/GuixDemo2Abstract.java
trunk/guix-test-swing/src/main/java/org/nuiton/guix/GuixDemo2Impl.java
trunk/guix-test-swing/src/main/java/org/nuiton/guix/GuixDemo3.java
trunk/guix-test-swing/src/main/java/org/nuiton/guix/GuixDemo3Abstract.java
trunk/guix-test-swing/src/main/java/org/nuiton/guix/GuixDemo3Impl.java
trunk/guix-test-swing/src/main/java/org/nuiton/guix/GuixDemoImpl.java
trunk/guix-test-swing/src/main/java/org/nuiton/guix/Main.java
Log:
Removes the java files
Deleted: trunk/guix-test-swing/src/main/java/org/nuiton/guix/GuixDemo.java
===================================================================
--- trunk/guix-test-swing/src/main/java/org/nuiton/guix/GuixDemo.java 2009-07-23 11:51:26 UTC (rev 1517)
+++ trunk/guix-test-swing/src/main/java/org/nuiton/guix/GuixDemo.java 2009-07-23 11:51:40 UTC (rev 1518)
@@ -1,96 +0,0 @@
-package org.nuiton.guix;
-
-import java.util.ArrayList;
-import javax.swing.JMenuBar;
-import javax.swing.JMenu;
-import javax.swing.JMenuItem;
-import javax.swing.JToolBar;
-import javax.swing.JButton;
-import javax.swing.JTabbedPane;
-import javax.swing.JPanel;
-import javax.swing.JTextField;
-import javax.swing.JLabel;
-import org.nuiton.guix.GuixDemo3Abstract;
-import org.nuiton.guix.GuixDemo2Abstract;
-
-/**
- * test javadoc Application
- */
-public interface GuixDemo {
- /*---------------------------------------------------------------------------------*/
- /*-- public acessor methods -------------------------------------------------------*/
- /*---------------------------------------------------------------------------------*/
-
- public JToolBar get$JToolBar5();
-
- public GuixDemo3Abstract getBt3();
-
- public GuixDemo3Abstract getBt31();
-
- public GuixDemo3Abstract getBt32();
-
- public GuixDemo3Abstract getBt34();
-
- public ArrayList getController();
-
- public GuixDemo2Abstract getGd2();
-
- public GuixDemo2Abstract getGd22();
-
- public javax.swing.JPanel getTable();
-
- /*---------------------------------------------------------------------------------*/
- /*-- public mutator methods -------------------------------------------------------*/
- /*---------------------------------------------------------------------------------*/
-
- public void set$JToolBar5(JToolBar newValue);
-
- public void setBt3(GuixDemo3Abstract newValue);
-
- public void setBt31(GuixDemo3Abstract newValue);
-
- public void setBt32(GuixDemo3Abstract newValue);
-
- public void setBt34(GuixDemo3Abstract newValue);
-
- public void setController(ArrayList newValue);
-
- public void setGd2(GuixDemo2Abstract newValue);
-
- public void setGd22(GuixDemo2Abstract newValue);
-
- public void setTable(javax.swing.JPanel newValue);
-
- /*---------------------------------------------------------------------------------*/
- /*-- public mutator methods -------------------------------------------------------*/
- /*---------------------------------------------------------------------------------*/
-
- public void beforeBinding();
-
- public void beforeCreation();
-
- public void beforeInitialization();
-
- /**
- * Components creation
- */
- public void componentsCreation();
-
- /**
- * components layout
- */
- public void componentsTree();
-
- public void inTheEnd();
-
- /**
- * initilization of databinding
- */
- public void initDataBinding();
-
- /**
- * initialization
- */
- public void initialize();
-
- }
\ No newline at end of file
Deleted: trunk/guix-test-swing/src/main/java/org/nuiton/guix/GuixDemo2.java
===================================================================
--- trunk/guix-test-swing/src/main/java/org/nuiton/guix/GuixDemo2.java 2009-07-23 11:51:26 UTC (rev 1517)
+++ trunk/guix-test-swing/src/main/java/org/nuiton/guix/GuixDemo2.java 2009-07-23 11:51:40 UTC (rev 1518)
@@ -1,41 +0,0 @@
-package org.nuiton.guix;
-
-import javax.swing.JToggleButton;
-
-/**
- * test javadoc Application
- */
-public interface GuixDemo2 {
- /*---------------------------------------------------------------------------------*/
- /*-- public mutator methods -------------------------------------------------------*/
- /*---------------------------------------------------------------------------------*/
-
- public void beforeBinding();
-
- public void beforeCreation();
-
- public void beforeInitialization();
-
- /**
- * Components creation
- */
- public void componentsCreation();
-
- /**
- * components layout
- */
- public void componentsTree();
-
- public void inTheEnd();
-
- /**
- * initilization of databinding
- */
- public void initDataBinding();
-
- /**
- * initialization
- */
- public void initialize();
-
- }
\ No newline at end of file
Deleted: trunk/guix-test-swing/src/main/java/org/nuiton/guix/GuixDemo2Abstract.java
===================================================================
--- trunk/guix-test-swing/src/main/java/org/nuiton/guix/GuixDemo2Abstract.java 2009-07-23 11:51:26 UTC (rev 1517)
+++ trunk/guix-test-swing/src/main/java/org/nuiton/guix/GuixDemo2Abstract.java 2009-07-23 11:51:40 UTC (rev 1518)
@@ -1,163 +0,0 @@
-package org.nuiton.guix;
-
-import javax.swing.JToggleButton;
-
-/**
- * test javadoc Application
- */
-public abstract class GuixDemo2Abstract extends javax.swing.JPanel implements GuixDemo2 {
- /**
- * List of the active bindings
- */
- private java.util.List<String> activeBindings = new java.util.ArrayList<String>();
- /**
- * test javadoc Application
- */
- private javax.swing.JToggleButton button;
- /**
- * test javadoc Application
- */
- private org.nuiton.guix.GuixDemo2Abstract guixdemo2 = this;
-
- /*---------------------------------------------------------------------------------*/
- /*-- Constructors -----------------------------------------------------------------*/
- /*---------------------------------------------------------------------------------*/
-
- /**
- * Constructor
- */
- public GuixDemo2Abstract() {
- initialize();
- }
-
- /*---------------------------------------------------------------------------------*/
- /*-- JAXXObject implementation ----------------------------------------------------*/
- /*---------------------------------------------------------------------------------*/
-
- public void applyDataBinding(String _binding) {
- processDataBinding(_binding);
- }
-
- public void firePropertyChange(String name, Object oldValue, Object newValue) {
- super.firePropertyChange(name, oldValue, newValue);
- }
-
- public void processDataBinding(String _binding) {
- if (activeBindings.contains(_binding)) {
- return;
- }
- activeBindings.add(_binding);
- try{
-
- } finally {
- activeBindings.remove(_binding);
- }
- }
-
- public void removeDataBinding(String _binding) {
-
- }
-
- /*---------------------------------------------------------------------------------*/
- /*-- public acessor methods -------------------------------------------------------*/
- /*---------------------------------------------------------------------------------*/
-
- public java.util.List<String> getActiveBindings() {
- return activeBindings;
- }
-
- public javax.swing.JToggleButton getButton() {
- return button;
- }
-
- public org.nuiton.guix.GuixDemo2Abstract getGuixdemo2() {
- return guixdemo2;
- }
-
- /*---------------------------------------------------------------------------------*/
- /*-- public mutator methods -------------------------------------------------------*/
- /*---------------------------------------------------------------------------------*/
-
- public void setButton(javax.swing.JToggleButton newValue) {
- this.button = newValue;
- }
-
- public void setGuixdemo2(org.nuiton.guix.GuixDemo2Abstract newValue) {
- this.guixdemo2 = newValue;
- }
-
- /*---------------------------------------------------------------------------------*/
- /*-- public mutator methods -------------------------------------------------------*/
- /*---------------------------------------------------------------------------------*/
-
- public void beforeBinding() {
-
- }
-
- public void beforeCreation() {
-
- }
-
- public void beforeInitialization() {
-
- }
-
- /**
- * Components creation
- */
- public void componentsCreation() {
- createButton();
- }
-
- /**
- * components layout
- */
- public void componentsTree() {
- this.setLayout(new java.awt.FlowLayout());
- this.add(button);
- }
-
- public void inTheEnd() {
-
- }
-
- /**
- * initilization of databinding
- */
- public void initDataBinding() {
-
- }
-
- /**
- * initialization
- */
- public void initialize() {
- beforeCreation();
- componentsCreation();
-
- beforeInitialization();
- componentsTree();
- beforeBinding();
- initDataBinding();
- inTheEnd();
- }
-
- /*---------------------------------------------------------------------------------*/
- /*-- ui creation methods ----------------------------------------------------------*/
- /*---------------------------------------------------------------------------------*/
-
- /**
- * button creation
- */
- private void createButton() {
- button = new javax.swing.JToggleButton();
- button.setText("Push me");
- button.setSelected(true);
- button.addActionListener(new java.awt.event.ActionListener() {
- public void actionPerformed(java.awt.event.ActionEvent actionEvent){
- System.out.println("test");
- }
- });
- }
-
- }
\ No newline at end of file
Deleted: trunk/guix-test-swing/src/main/java/org/nuiton/guix/GuixDemo2Impl.java
===================================================================
--- trunk/guix-test-swing/src/main/java/org/nuiton/guix/GuixDemo2Impl.java 2009-07-23 11:51:26 UTC (rev 1517)
+++ trunk/guix-test-swing/src/main/java/org/nuiton/guix/GuixDemo2Impl.java 2009-07-23 11:51:40 UTC (rev 1518)
@@ -1,20 +0,0 @@
-package org.nuiton.guix;
-
-import javax.swing.JToggleButton;
-
-/**
- * test javadoc Application
- */
-public class GuixDemo2Impl extends GuixDemo2Abstract {
- /*---------------------------------------------------------------------------------*/
- /*-- Constructors -----------------------------------------------------------------*/
- /*---------------------------------------------------------------------------------*/
-
- /**
- * Constructor
- */
- public GuixDemo2Impl() {
- super();
- }
-
- }
\ No newline at end of file
Deleted: trunk/guix-test-swing/src/main/java/org/nuiton/guix/GuixDemo3.java
===================================================================
--- trunk/guix-test-swing/src/main/java/org/nuiton/guix/GuixDemo3.java 2009-07-23 11:51:26 UTC (rev 1517)
+++ trunk/guix-test-swing/src/main/java/org/nuiton/guix/GuixDemo3.java 2009-07-23 11:51:40 UTC (rev 1518)
@@ -1,39 +0,0 @@
-package org.nuiton.guix;
-
-/**
- * test javadoc Application
- */
-public interface GuixDemo3 {
- /*---------------------------------------------------------------------------------*/
- /*-- public mutator methods -------------------------------------------------------*/
- /*---------------------------------------------------------------------------------*/
-
- public void beforeBinding();
-
- public void beforeCreation();
-
- public void beforeInitialization();
-
- /**
- * Components creation
- */
- public void componentsCreation();
-
- /**
- * components layout
- */
- public void componentsTree();
-
- public void inTheEnd();
-
- /**
- * initilization of databinding
- */
- public void initDataBinding();
-
- /**
- * initialization
- */
- public void initialize();
-
- }
\ No newline at end of file
Deleted: trunk/guix-test-swing/src/main/java/org/nuiton/guix/GuixDemo3Abstract.java
===================================================================
--- trunk/guix-test-swing/src/main/java/org/nuiton/guix/GuixDemo3Abstract.java 2009-07-23 11:51:26 UTC (rev 1517)
+++ trunk/guix-test-swing/src/main/java/org/nuiton/guix/GuixDemo3Abstract.java 2009-07-23 11:51:40 UTC (rev 1518)
@@ -1,131 +0,0 @@
-package org.nuiton.guix;
-
-/**
- * test javadoc Application
- */
-public abstract class GuixDemo3Abstract extends javax.swing.JButton implements GuixDemo3 {
- /**
- * List of the active bindings
- */
- private java.util.List<String> activeBindings = new java.util.ArrayList<String>();
- /**
- * test javadoc Application
- */
- private org.nuiton.guix.GuixDemo3Abstract guixdemo3 = this;
-
- /*---------------------------------------------------------------------------------*/
- /*-- Constructors -----------------------------------------------------------------*/
- /*---------------------------------------------------------------------------------*/
-
- /**
- * Constructor
- */
- public GuixDemo3Abstract() {
- initialize();
- }
-
- /*---------------------------------------------------------------------------------*/
- /*-- JAXXObject implementation ----------------------------------------------------*/
- /*---------------------------------------------------------------------------------*/
-
- public void applyDataBinding(String _binding) {
- processDataBinding(_binding);
- }
-
- public void firePropertyChange(String name, Object oldValue, Object newValue) {
- super.firePropertyChange(name, oldValue, newValue);
- }
-
- public void processDataBinding(String _binding) {
- if (activeBindings.contains(_binding)) {
- return;
- }
- activeBindings.add(_binding);
- try{
-
- } finally {
- activeBindings.remove(_binding);
- }
- }
-
- public void removeDataBinding(String _binding) {
-
- }
-
- /*---------------------------------------------------------------------------------*/
- /*-- public acessor methods -------------------------------------------------------*/
- /*---------------------------------------------------------------------------------*/
-
- public java.util.List<String> getActiveBindings() {
- return activeBindings;
- }
-
- public org.nuiton.guix.GuixDemo3Abstract getGuixdemo3() {
- return guixdemo3;
- }
-
- /*---------------------------------------------------------------------------------*/
- /*-- public mutator methods -------------------------------------------------------*/
- /*---------------------------------------------------------------------------------*/
-
- public void setGuixdemo3(org.nuiton.guix.GuixDemo3Abstract newValue) {
- this.guixdemo3 = newValue;
- }
-
- /*---------------------------------------------------------------------------------*/
- /*-- public mutator methods -------------------------------------------------------*/
- /*---------------------------------------------------------------------------------*/
-
- public void beforeBinding() {
-
- }
-
- public void beforeCreation() {
-
- }
-
- public void beforeInitialization() {
-
- }
-
- /**
- * Components creation
- */
- public void componentsCreation() {
-
- }
-
- /**
- * components layout
- */
- public void componentsTree() {
- this.setText("GuixDemo3");
- this.setLayout(new java.awt.FlowLayout());
- }
-
- public void inTheEnd() {
-
- }
-
- /**
- * initilization of databinding
- */
- public void initDataBinding() {
-
- }
-
- /**
- * initialization
- */
- public void initialize() {
- beforeCreation();
- componentsCreation();
-
- beforeInitialization();
- componentsTree();
- beforeBinding();
- initDataBinding();
- inTheEnd();
- }
-
- }
\ No newline at end of file
Deleted: trunk/guix-test-swing/src/main/java/org/nuiton/guix/GuixDemo3Impl.java
===================================================================
--- trunk/guix-test-swing/src/main/java/org/nuiton/guix/GuixDemo3Impl.java 2009-07-23 11:51:26 UTC (rev 1517)
+++ trunk/guix-test-swing/src/main/java/org/nuiton/guix/GuixDemo3Impl.java 2009-07-23 11:51:40 UTC (rev 1518)
@@ -1,18 +0,0 @@
-package org.nuiton.guix;
-
-/**
- * test javadoc Application
- */
-public class GuixDemo3Impl extends GuixDemo3Abstract {
- /*---------------------------------------------------------------------------------*/
- /*-- Constructors -----------------------------------------------------------------*/
- /*---------------------------------------------------------------------------------*/
-
- /**
- * Constructor
- */
- public GuixDemo3Impl() {
- super();
- }
-
- }
\ No newline at end of file
Deleted: trunk/guix-test-swing/src/main/java/org/nuiton/guix/GuixDemoImpl.java
===================================================================
--- trunk/guix-test-swing/src/main/java/org/nuiton/guix/GuixDemoImpl.java 2009-07-23 11:51:26 UTC (rev 1517)
+++ trunk/guix-test-swing/src/main/java/org/nuiton/guix/GuixDemoImpl.java 2009-07-23 11:51:40 UTC (rev 1518)
@@ -1,31 +0,0 @@
-package org.nuiton.guix;
-
-import java.util.ArrayList;
-import javax.swing.JMenuBar;
-import javax.swing.JMenu;
-import javax.swing.JMenuItem;
-import javax.swing.JToolBar;
-import javax.swing.JButton;
-import javax.swing.JTabbedPane;
-import javax.swing.JPanel;
-import javax.swing.JTextField;
-import javax.swing.JLabel;
-import org.nuiton.guix.GuixDemo3Abstract;
-import org.nuiton.guix.GuixDemo2Abstract;
-
-/**
- * test javadoc Application
- */
-public class GuixDemoImpl extends GuixDemoAbstract {
- /*---------------------------------------------------------------------------------*/
- /*-- Constructors -----------------------------------------------------------------*/
- /*---------------------------------------------------------------------------------*/
-
- /**
- * Constructor
- */
- public GuixDemoImpl() {
- super();
- }
-
- }
\ No newline at end of file
Deleted: trunk/guix-test-swing/src/main/java/org/nuiton/guix/Main.java
===================================================================
--- trunk/guix-test-swing/src/main/java/org/nuiton/guix/Main.java 2009-07-23 11:51:26 UTC (rev 1517)
+++ trunk/guix-test-swing/src/main/java/org/nuiton/guix/Main.java 2009-07-23 11:51:40 UTC (rev 1518)
@@ -1,19 +0,0 @@
-package org.nuiton.guix;
-
-import java.io.File;
-import org.springframework.beans.factory.ListableBeanFactory;
-import org.springframework.beans.factory.xml.XmlBeanFactory;
-import org.springframework.core.io.FileSystemResource;
-
-public class Main {
- /*---------------------------------------------------------------------------------*/
- /*-- Statics methods --------------------------------------------------------------*/
- /*---------------------------------------------------------------------------------*/
-
- public static void main(String[] args) {
- javax.swing.SwingUtilities.invokeLater(new Runnable() {public void run() {GuixDemoImpl main = new GuixDemoImpl();
- main.pack();
- main.setVisible(true);}});
- }
-
- }
\ No newline at end of file
1
0
r1517 - in trunk/guix-test-gwt/src/main/java/org/nuiton/guix: client public
by kmorin@users.labs.libre-entreprise.org July 23, 2009
by kmorin@users.labs.libre-entreprise.org July 23, 2009
July 23, 2009
Author: kmorin
Date: 2009-07-23 13:51:26 +0200 (Thu, 23 Jul 2009)
New Revision: 1517
Removed:
trunk/guix-test-gwt/src/main/java/org/nuiton/guix/client/GuixDemo.java
trunk/guix-test-gwt/src/main/java/org/nuiton/guix/client/GuixDemo2.java
trunk/guix-test-gwt/src/main/java/org/nuiton/guix/client/GuixDemo2Abstract.java
trunk/guix-test-gwt/src/main/java/org/nuiton/guix/client/GuixDemo2Impl.java
trunk/guix-test-gwt/src/main/java/org/nuiton/guix/client/GuixDemo3.java
trunk/guix-test-gwt/src/main/java/org/nuiton/guix/client/GuixDemo3Abstract.java
trunk/guix-test-gwt/src/main/java/org/nuiton/guix/client/GuixDemo3Impl.java
trunk/guix-test-gwt/src/main/java/org/nuiton/guix/client/GuixDemoAbstract.java
trunk/guix-test-gwt/src/main/java/org/nuiton/guix/client/GuixDemoImpl.java
trunk/guix-test-gwt/src/main/java/org/nuiton/guix/public/Application.css
trunk/guix-test-gwt/src/main/java/org/nuiton/guix/public/Application.html
trunk/guix-test-gwt/src/main/java/org/nuiton/guix/public/GuixDemo.css
trunk/guix-test-gwt/src/main/java/org/nuiton/guix/public/Index.html
Log:
Removes the java files
Deleted: trunk/guix-test-gwt/src/main/java/org/nuiton/guix/client/GuixDemo.java
===================================================================
--- trunk/guix-test-gwt/src/main/java/org/nuiton/guix/client/GuixDemo.java 2009-07-23 10:52:07 UTC (rev 1516)
+++ trunk/guix-test-gwt/src/main/java/org/nuiton/guix/client/GuixDemo.java 2009-07-23 11:51:26 UTC (rev 1517)
@@ -1,65 +0,0 @@
-package org.nuiton.guix.client;
-
-import com.google.gwt.user.client.ui.MenuBar;
-import com.google.gwt.user.client.ui.TabPanel;
-import com.google.gwt.user.client.ui.FlexTable;
-import com.google.gwt.user.client.ui.TextBox;
-import com.google.gwt.user.client.ui.Label;
-import org.nuiton.guix.client.GuixDemo3Abstract;
-import org.nuiton.guix.client.GuixDemo2Abstract;
-
-/**
- * test javadoc Application
- */
-public interface GuixDemo {
- /*---------------------------------------------------------------------------------*/
- /*-- public acessor methods -------------------------------------------------------*/
- /*---------------------------------------------------------------------------------*/
-
- public GuixDemo3Abstract getBt3();
-
- public GuixDemo3Abstract getBt31();
-
- public GuixDemo3Abstract getBt32();
-
- public GuixDemo3Abstract getBt34();
-
- public GuixDemo2Abstract getGd2();
-
- public GuixDemo2Abstract getGd22();
-
- public com.google.gwt.user.client.ui.FlexTable getTable1();
-
- /*---------------------------------------------------------------------------------*/
- /*-- public mutator methods -------------------------------------------------------*/
- /*---------------------------------------------------------------------------------*/
-
- public void beforeBinding();
-
- public void beforeCreation();
-
- public void beforeInitialization();
-
- /**
- * Components creation
- */
- public void componentsCreation();
-
- /**
- * components layout
- */
- public void componentsTree();
-
- public void inTheEnd();
-
- /**
- * initilization of databinding
- */
- public void initDataBinding();
-
- /**
- * initialization
- */
- public void initialize();
-
- }
\ No newline at end of file
Deleted: trunk/guix-test-gwt/src/main/java/org/nuiton/guix/client/GuixDemo2.java
===================================================================
--- trunk/guix-test-gwt/src/main/java/org/nuiton/guix/client/GuixDemo2.java 2009-07-23 10:52:07 UTC (rev 1516)
+++ trunk/guix-test-gwt/src/main/java/org/nuiton/guix/client/GuixDemo2.java 2009-07-23 11:51:26 UTC (rev 1517)
@@ -1,47 +0,0 @@
-package org.nuiton.guix.client;
-
-import com.google.gwt.user.client.ui.ToggleButton;
-
-/**
- * test javadoc Application
- */
-public interface GuixDemo2 {
- /*---------------------------------------------------------------------------------*/
- /*-- public acessor methods -------------------------------------------------------*/
- /*---------------------------------------------------------------------------------*/
-
- public ToggleButton getButton();
-
- /*---------------------------------------------------------------------------------*/
- /*-- public mutator methods -------------------------------------------------------*/
- /*---------------------------------------------------------------------------------*/
-
- public void beforeBinding();
-
- public void beforeCreation();
-
- public void beforeInitialization();
-
- /**
- * Components creation
- */
- public void componentsCreation();
-
- /**
- * components layout
- */
- public void componentsTree();
-
- public void inTheEnd();
-
- /**
- * initilization of databinding
- */
- public void initDataBinding();
-
- /**
- * initialization
- */
- public void initialize();
-
- }
\ No newline at end of file
Deleted: trunk/guix-test-gwt/src/main/java/org/nuiton/guix/client/GuixDemo2Abstract.java
===================================================================
--- trunk/guix-test-gwt/src/main/java/org/nuiton/guix/client/GuixDemo2Abstract.java 2009-07-23 10:52:07 UTC (rev 1516)
+++ trunk/guix-test-gwt/src/main/java/org/nuiton/guix/client/GuixDemo2Abstract.java 2009-07-23 11:51:26 UTC (rev 1517)
@@ -1,141 +0,0 @@
-package org.nuiton.guix.client;
-
-import com.google.gwt.user.client.ui.ToggleButton;
-
-/**
- * test javadoc Application
- */
-public abstract class GuixDemo2Abstract extends com.google.gwt.user.client.ui.FlowPanel implements GuixDemo2 {
- /**
- * List of the active bindings
- */
- private java.util.List<String> activeBindings = new java.util.ArrayList<String>();
- private final com.google.gwt.user.client.ui.ToggleButton button = new ToggleButton("Up","Down");
- /**
- * test javadoc Application
- */
- private final org.nuiton.guix.client.GuixDemo2Abstract guixdemo2 = this;
-
- /*---------------------------------------------------------------------------------*/
- /*-- Constructors -----------------------------------------------------------------*/
- /*---------------------------------------------------------------------------------*/
-
- /**
- * Constructor
- */
- public GuixDemo2Abstract() {
- initialize();
- }
-
- /*---------------------------------------------------------------------------------*/
- /*-- JAXXObject implementation ----------------------------------------------------*/
- /*---------------------------------------------------------------------------------*/
-
- public void applyDataBinding(String _binding) {
- processDataBinding(_binding);
- }
-
- public void processDataBinding(String _binding) {
- if (activeBindings.contains(_binding)) {
- return;
- }
- activeBindings.add(_binding);
- try{
-
- } finally {
- activeBindings.remove(_binding);
- }
- }
-
- public void removeDataBinding(String _binding) {
-
- }
-
- /*---------------------------------------------------------------------------------*/
- /*-- public acessor methods -------------------------------------------------------*/
- /*---------------------------------------------------------------------------------*/
-
- public java.util.List<String> getActiveBindings() {
- return activeBindings;
- }
-
- public com.google.gwt.user.client.ui.ToggleButton getButton() {
- return button;
- }
-
- public org.nuiton.guix.client.GuixDemo2Abstract getGuixdemo2() {
- return guixdemo2;
- }
-
- /*---------------------------------------------------------------------------------*/
- /*-- public mutator methods -------------------------------------------------------*/
- /*---------------------------------------------------------------------------------*/
-
- public void beforeBinding() {
-
- }
-
- public void beforeCreation() {
-
- }
-
- public void beforeInitialization() {
-
- }
-
- /**
- * Components creation
- */
- public void componentsCreation() {
- createButton();
- }
-
- /**
- * Components initialization
- */
- public void componentsTree() {
- this.add(button);
- }
-
- public void inTheEnd() {
-
- }
-
- /**
- * initilization of databinding
- */
- public void initDataBinding() {
- //TODO
- }
-
- /**
- * initialization
- */
- public void initialize() {
- beforeCreation();
- componentsCreation();
-
- beforeInitialization();
- componentsTree();
- beforeBinding();
- initDataBinding();
- inTheEnd();
- }
-
- /*---------------------------------------------------------------------------------*/
- /*-- ui creation methods ----------------------------------------------------------*/
- /*---------------------------------------------------------------------------------*/
-
- /**
- * button creation
- */
- private void createButton() {
- button.setDown(true);
- button.addClickListener(new com.google.gwt.user.client.ui.ClickListener() {
- public void onClick(com.google.gwt.user.client.ui.Widget arg0){
- System.out.println("hey dude !");
- }
- });
- }
-
- }
\ No newline at end of file
Deleted: trunk/guix-test-gwt/src/main/java/org/nuiton/guix/client/GuixDemo2Impl.java
===================================================================
--- trunk/guix-test-gwt/src/main/java/org/nuiton/guix/client/GuixDemo2Impl.java 2009-07-23 10:52:07 UTC (rev 1516)
+++ trunk/guix-test-gwt/src/main/java/org/nuiton/guix/client/GuixDemo2Impl.java 2009-07-23 11:51:26 UTC (rev 1517)
@@ -1,20 +0,0 @@
-package org.nuiton.guix.client;
-
-import com.google.gwt.user.client.ui.ToggleButton;
-
-/**
- * test javadoc Application
- */
-public class GuixDemo2Impl extends GuixDemo2Abstract {
- /*---------------------------------------------------------------------------------*/
- /*-- Constructors -----------------------------------------------------------------*/
- /*---------------------------------------------------------------------------------*/
-
- /**
- * Constructor
- */
- public GuixDemo2Impl() {
- super();
- }
-
- }
\ No newline at end of file
Deleted: trunk/guix-test-gwt/src/main/java/org/nuiton/guix/client/GuixDemo3.java
===================================================================
--- trunk/guix-test-gwt/src/main/java/org/nuiton/guix/client/GuixDemo3.java 2009-07-23 10:52:07 UTC (rev 1516)
+++ trunk/guix-test-gwt/src/main/java/org/nuiton/guix/client/GuixDemo3.java 2009-07-23 11:51:26 UTC (rev 1517)
@@ -1,39 +0,0 @@
-package org.nuiton.guix.client;
-
-/**
- * test javadoc Application
- */
-public interface GuixDemo3 {
- /*---------------------------------------------------------------------------------*/
- /*-- public mutator methods -------------------------------------------------------*/
- /*---------------------------------------------------------------------------------*/
-
- public void beforeBinding();
-
- public void beforeCreation();
-
- public void beforeInitialization();
-
- /**
- * Components creation
- */
- public void componentsCreation();
-
- /**
- * components layout
- */
- public void componentsTree();
-
- public void inTheEnd();
-
- /**
- * initilization of databinding
- */
- public void initDataBinding();
-
- /**
- * initialization
- */
- public void initialize();
-
- }
\ No newline at end of file
Deleted: trunk/guix-test-gwt/src/main/java/org/nuiton/guix/client/GuixDemo3Abstract.java
===================================================================
--- trunk/guix-test-gwt/src/main/java/org/nuiton/guix/client/GuixDemo3Abstract.java 2009-07-23 10:52:07 UTC (rev 1516)
+++ trunk/guix-test-gwt/src/main/java/org/nuiton/guix/client/GuixDemo3Abstract.java 2009-07-23 11:51:26 UTC (rev 1517)
@@ -1,118 +0,0 @@
-package org.nuiton.guix.client;
-
-/**
- * test javadoc Application
- */
-public abstract class GuixDemo3Abstract extends com.google.gwt.user.client.ui.Button implements GuixDemo3 {
- /**
- * List of the active bindings
- */
- private java.util.List<String> activeBindings = new java.util.ArrayList<String>();
- /**
- * test javadoc Application
- */
- private final org.nuiton.guix.client.GuixDemo3Abstract guixdemo3 = this;
-
- /*---------------------------------------------------------------------------------*/
- /*-- Constructors -----------------------------------------------------------------*/
- /*---------------------------------------------------------------------------------*/
-
- /**
- * Constructor
- */
- public GuixDemo3Abstract() {
- initialize();
- }
-
- /*---------------------------------------------------------------------------------*/
- /*-- JAXXObject implementation ----------------------------------------------------*/
- /*---------------------------------------------------------------------------------*/
-
- public void applyDataBinding(String _binding) {
- processDataBinding(_binding);
- }
-
- public void processDataBinding(String _binding) {
- if (activeBindings.contains(_binding)) {
- return;
- }
- activeBindings.add(_binding);
- try{
-
- } finally {
- activeBindings.remove(_binding);
- }
- }
-
- public void removeDataBinding(String _binding) {
-
- }
-
- /*---------------------------------------------------------------------------------*/
- /*-- public acessor methods -------------------------------------------------------*/
- /*---------------------------------------------------------------------------------*/
-
- public java.util.List<String> getActiveBindings() {
- return activeBindings;
- }
-
- public org.nuiton.guix.client.GuixDemo3Abstract getGuixdemo3() {
- return guixdemo3;
- }
-
- /*---------------------------------------------------------------------------------*/
- /*-- public mutator methods -------------------------------------------------------*/
- /*---------------------------------------------------------------------------------*/
-
- public void beforeBinding() {
-
- }
-
- public void beforeCreation() {
-
- }
-
- public void beforeInitialization() {
-
- }
-
- /**
- * Components creation
- */
- public void componentsCreation() {
-
- }
-
- /**
- * Components initialization
- */
- public void componentsTree() {
- this.setText("GuixDemo3");
- }
-
- public void inTheEnd() {
-
- }
-
- /**
- * initilization of databinding
- */
- public void initDataBinding() {
- //TODO
- }
-
- /**
- * initialization
- */
- public void initialize() {
- beforeCreation();
- componentsCreation();
-
- beforeInitialization();
- componentsTree();
- beforeBinding();
- initDataBinding();
- inTheEnd();
- }
-
- }
\ No newline at end of file
Deleted: trunk/guix-test-gwt/src/main/java/org/nuiton/guix/client/GuixDemo3Impl.java
===================================================================
--- trunk/guix-test-gwt/src/main/java/org/nuiton/guix/client/GuixDemo3Impl.java 2009-07-23 10:52:07 UTC (rev 1516)
+++ trunk/guix-test-gwt/src/main/java/org/nuiton/guix/client/GuixDemo3Impl.java 2009-07-23 11:51:26 UTC (rev 1517)
@@ -1,18 +0,0 @@
-package org.nuiton.guix.client;
-
-/**
- * test javadoc Application
- */
-public class GuixDemo3Impl extends GuixDemo3Abstract {
- /*---------------------------------------------------------------------------------*/
- /*-- Constructors -----------------------------------------------------------------*/
- /*---------------------------------------------------------------------------------*/
-
- /**
- * Constructor
- */
- public GuixDemo3Impl() {
- super();
- }
-
- }
\ No newline at end of file
Deleted: trunk/guix-test-gwt/src/main/java/org/nuiton/guix/client/GuixDemoAbstract.java
===================================================================
--- trunk/guix-test-gwt/src/main/java/org/nuiton/guix/client/GuixDemoAbstract.java 2009-07-23 10:52:07 UTC (rev 1516)
+++ trunk/guix-test-gwt/src/main/java/org/nuiton/guix/client/GuixDemoAbstract.java 2009-07-23 11:51:26 UTC (rev 1517)
@@ -1,502 +0,0 @@
-package org.nuiton.guix.client;
-
-import com.google.gwt.user.client.ui.MenuBar;
-import com.google.gwt.user.client.ui.TabPanel;
-import com.google.gwt.user.client.ui.FlexTable;
-import com.google.gwt.user.client.ui.TextBox;
-import com.google.gwt.user.client.ui.Label;
-import org.nuiton.guix.client.GuixDemo3Abstract;
-import org.nuiton.guix.client.GuixDemo2Abstract;
-import com.google.gwt.user.client.ui.Button;
-import com.google.gwt.user.client.Command;
-
-/**
- * test javadoc Application
- */
-public abstract class GuixDemoAbstract extends com.google.gwt.user.client.ui.VerticalPanel implements GuixDemo {
- private final com.google.gwt.user.client.ui.MenuBar $Menu2 = new MenuBar();
- private final com.google.gwt.user.client.ui.MenuBar $Menu4 = new MenuBar();
- private final com.google.gwt.user.client.ui.MenuBar $Menu6 = new MenuBar();
- private final MenuBar $MenuBar1 = new MenuBar();
- private final com.google.gwt.user.client.ui.TabPanel $TabPanel9 = new TabPanel();
- /**
- * List of the active bindings
- */
- private java.util.List<String> activeBindings = new java.util.ArrayList<String>();
- private final org.nuiton.guix.client.GuixDemo3Abstract bt3 = new GuixDemo3Impl();
- private final org.nuiton.guix.client.GuixDemo3Abstract bt31 = new GuixDemo3Impl();
- private final org.nuiton.guix.client.GuixDemo3Abstract bt32 = new GuixDemo3Impl();
- private final org.nuiton.guix.client.GuixDemo3Abstract bt34 = new GuixDemo3Impl();
- private final org.nuiton.guix.client.GuixDemo2Abstract gd2 = new GuixDemo2Impl();
- private final org.nuiton.guix.client.GuixDemo2Abstract gd22 = new GuixDemo2Impl();
- /**
- * test javadoc Application
- */
- private final org.nuiton.guix.client.GuixDemoAbstract guixdemo = this;
- private final com.google.gwt.user.client.ui.Label label = new Label();
- private final com.google.gwt.user.client.ui.Label label2 = new Label();
- private final com.google.gwt.user.client.ui.Label label3 = new Label();
- private final FlexTable table1 = new FlexTable();
- /**
- * javadoc textfield
- */
- private final com.google.gwt.user.client.ui.TextBox textfield = new TextBox();
-
- /* begin raw body code */
-
- private Button b = new Button("test");
- private Command cmd = new Command() {
- public void execute() {
- final com.google.gwt.user.client.ui.PopupPanel pp = new com.google.gwt.user.client.ui.PopupPanel(true);
- pp.add(new com.google.gwt.user.client.ui.Label("Action performed!"));
- pp.show();
- }
- };
- public enum Day {
- SUNDAY, MONDAY, TUESDAY, WEDNESDAY,
- THURSDAY, FRIDAY, SATURDAY
- }
-
- /* end raw body code */
-
- /*---------------------------------------------------------------------------------*/
- /*-- Constructors -----------------------------------------------------------------*/
- /*---------------------------------------------------------------------------------*/
-
- /**
- * Constructor
- */
- public GuixDemoAbstract() {
- initialize();
- }
-
- /*---------------------------------------------------------------------------------*/
- /*-- JAXXObject implementation ----------------------------------------------------*/
- /*---------------------------------------------------------------------------------*/
-
- public void applyDataBinding(String _binding) {
- if("textfield.enabled".equals(_binding)) {
- if(getGd2() != null && getGd2().getButton() != null) {
- getGd2().getButton().addClickListener(new com.google.gwt.user.client.ui.ClickListener() {
- public void onClick(com.google.gwt.user.client.ui.Widget arg0) {
- onChangeFromgd2getButtondown();
- }
- });
- }
- if(getGd22() != null && getGd22().getButton() != null) {
- getGd22().getButton().addClickListener(new com.google.gwt.user.client.ui.ClickListener() {
- public void onClick(com.google.gwt.user.client.ui.Widget arg0) {
- onChangeFromgd22buttonisSelected();
- }
- });
- }
- }
- else if("label.text".equals(_binding)) {
- if(getTextfield() != null) {
- getTextfield().addKeyboardListener(new com.google.gwt.user.client.ui.KeyboardListener() {
- public void onKeyDown(com.google.gwt.user.client.ui.Widget arg0, char arg1, int arg2) {
- onChangeFromtextfieldgetText();
- }
- public void onKeyPress(com.google.gwt.user.client.ui.Widget arg0, char arg1, int arg2) {
- onChangeFromtextfieldgetText();
- }
- public void onKeyUp(com.google.gwt.user.client.ui.Widget arg0, char arg1, int arg2) {
- onChangeFromtextfieldgetText();
- }
- });
- }
- }
-
- processDataBinding(_binding);
- }
-
- public void processDataBinding(String _binding) {
- if (activeBindings.contains(_binding)) {
- return;
- }
- activeBindings.add(_binding);
- try{
- if("textfield.enabled".equals(_binding)) {
- textfield.setEnabled(getGd2().getButton().isDown() && getGd22().getButton().isDown());
- }
- else if("label.text".equals(_binding)) {
- label.setText(getTextfield().getText());
- }
-
- } finally {
- activeBindings.remove(_binding);
- }
- }
-
- public void removeDataBinding(String _binding) {
- if("textfield.enabled".equals(_binding)) {
- if(getGd2() != null && getGd2().getButton() != null) {
- getGd2().getButton().removeClickListener(new com.google.gwt.user.client.ui.ClickListener() {
- public void onClick(com.google.gwt.user.client.ui.Widget arg0) {
- onChangeFromgd2getButtondown();
- }
- });
- }
- if(getGd22() != null && getGd22().getButton() != null) {
- getGd22().getButton().removeClickListener(new com.google.gwt.user.client.ui.ClickListener() {
- public void onClick(com.google.gwt.user.client.ui.Widget arg0) {
- onChangeFromgd22buttonisSelected();
- }
- });
- }
- }
- else if("label.text".equals(_binding)) {
- if(getTextfield() != null) {
- getTextfield().removeKeyboardListener(new com.google.gwt.user.client.ui.KeyboardListener() {
- public void onKeyDown(com.google.gwt.user.client.ui.Widget arg0, char arg1, int arg2) {
- onChangeFromtextfieldgetText();
- }
- public void onKeyPress(com.google.gwt.user.client.ui.Widget arg0, char arg1, int arg2) {
- onChangeFromtextfieldgetText();
- }
- public void onKeyUp(com.google.gwt.user.client.ui.Widget arg0, char arg1, int arg2) {
- onChangeFromtextfieldgetText();
- }
- });
- }
- }
- }
-
- /*---------------------------------------------------------------------------------*/
- /*-- public acessor methods -------------------------------------------------------*/
- /*---------------------------------------------------------------------------------*/
-
- public com.google.gwt.user.client.ui.MenuBar get$Menu2() {
- return $Menu2;
- }
-
- public com.google.gwt.user.client.ui.MenuBar get$Menu4() {
- return $Menu4;
- }
-
- public com.google.gwt.user.client.ui.MenuBar get$Menu6() {
- return $Menu6;
- }
-
- public MenuBar get$MenuBar1() {
- return $MenuBar1;
- }
-
- public com.google.gwt.user.client.ui.TabPanel get$TabPanel9() {
- return $TabPanel9;
- }
-
- public java.util.List<String> getActiveBindings() {
- return activeBindings;
- }
-
- public org.nuiton.guix.client.GuixDemo3Abstract getBt3() {
- return bt3;
- }
-
- public org.nuiton.guix.client.GuixDemo3Abstract getBt31() {
- return bt31;
- }
-
- public org.nuiton.guix.client.GuixDemo3Abstract getBt32() {
- return bt32;
- }
-
- public org.nuiton.guix.client.GuixDemo3Abstract getBt34() {
- return bt34;
- }
-
- public org.nuiton.guix.client.GuixDemo2Abstract getGd2() {
- return gd2;
- }
-
- public org.nuiton.guix.client.GuixDemo2Abstract getGd22() {
- return gd22;
- }
-
- public org.nuiton.guix.client.GuixDemoAbstract getGuixdemo() {
- return guixdemo;
- }
-
- public com.google.gwt.user.client.ui.Label getLabel() {
- return label;
- }
-
- public com.google.gwt.user.client.ui.Label getLabel2() {
- return label2;
- }
-
- public com.google.gwt.user.client.ui.Label getLabel3() {
- return label3;
- }
-
- public FlexTable getTable1() {
- return table1;
- }
-
- public com.google.gwt.user.client.ui.TextBox getTextfield() {
- return textfield;
- }
-
- /*---------------------------------------------------------------------------------*/
- /*-- public mutator methods -------------------------------------------------------*/
- /*---------------------------------------------------------------------------------*/
-
- public void beforeBinding() {
- this.add(b);
- }
-
- public void beforeCreation() {
- System.out.println("before Creation");
- }
-
- public void beforeInitialization() {
-
- }
-
- /**
- * Components creation
- */
- public void componentsCreation() {
- create$MenuBar1();
- create$TabPanel9();
- createTextfield();
- createLabel();
- createLabel2();
- createBt3();
- createBt31();
- createBt32();
- createBt34();
- createLabel3();
- createTable1();
- createGd2();
- createGd22();
- }
-
- /**
- * Components initialization
- */
- public void componentsTree() {
- this.add($MenuBar1);
- $MenuBar1.addItem("menu 1",$Menu2);
- $Menu2.addItem("item11",cmd);
- $Menu2.addItem("item12",cmd);
- $MenuBar1.addItem("menu 2",$Menu4);
- $Menu4.addItem("item21",cmd);
- $Menu4.addItem("item22",$Menu6);
- $Menu6.addItem("item221",cmd);
- $Menu6.addItem("item222",cmd);
- this.add($TabPanel9);
- $TabPanel9.add(table1,"Table");
- table1.getRowFormatter().addStyleName(0,"Row");
- table1.setWidget(0,0,textfield);
- table1.getFlexCellFormatter().setHorizontalAlignment(0,0,com.google.gwt.user.client.ui.HasHorizontalAlignment.ALIGN_DEFAULT);
- table1.getFlexCellFormatter().setVerticalAlignment(0,0,com.google.gwt.user.client.ui.HasVerticalAlignment.ALIGN_TOP);
- table1.getFlexCellFormatter().addStyleName(0,0, "Cell");
- table1.setWidget(0,1,label);
- table1.getFlexCellFormatter().setHorizontalAlignment(0,1,com.google.gwt.user.client.ui.HasHorizontalAlignment.ALIGN_DEFAULT);
- table1.getFlexCellFormatter().setVerticalAlignment(0,1,com.google.gwt.user.client.ui.HasVerticalAlignment.ALIGN_TOP);
- table1.getFlexCellFormatter().addStyleName(0,1, "Cell");
- table1.setWidget(0,2,label2);
- table1.getFlexCellFormatter().setRowSpan(0,2,3);
- table1.getFlexCellFormatter().setHorizontalAlignment(0,2,com.google.gwt.user.client.ui.HasHorizontalAlignment.ALIGN_DEFAULT);
- table1.getFlexCellFormatter().setVerticalAlignment(0,2,com.google.gwt.user.client.ui.HasVerticalAlignment.ALIGN_TOP);
- table1.getFlexCellFormatter().addStyleName(0,2, "Cell");
- table1.getRowFormatter().addStyleName(1,"Row");
- table1.setWidget(1,0,bt3);
- table1.getFlexCellFormatter().setColSpan(1,0,3);
- table1.getFlexCellFormatter().setHorizontalAlignment(1,0,com.google.gwt.user.client.ui.HasHorizontalAlignment.ALIGN_DEFAULT);
- table1.getFlexCellFormatter().setVerticalAlignment(1,0,com.google.gwt.user.client.ui.HasVerticalAlignment.ALIGN_TOP);
- table1.getFlexCellFormatter().addStyleName(1,0, "Cell");
- table1.getRowFormatter().addStyleName(2,"Row");
- table1.setWidget(2,0,bt31);
- table1.getFlexCellFormatter().setColSpan(2,0,2);
- table1.getFlexCellFormatter().setHorizontalAlignment(2,0,com.google.gwt.user.client.ui.HasHorizontalAlignment.ALIGN_DEFAULT);
- table1.getFlexCellFormatter().setVerticalAlignment(2,0,com.google.gwt.user.client.ui.HasVerticalAlignment.ALIGN_TOP);
- table1.getFlexCellFormatter().addStyleName(2,0, "Cell");
- table1.setWidget(2,2,bt32);
- table1.getFlexCellFormatter().setHorizontalAlignment(2,2,com.google.gwt.user.client.ui.HasHorizontalAlignment.ALIGN_DEFAULT);
- table1.getFlexCellFormatter().setVerticalAlignment(2,2,com.google.gwt.user.client.ui.HasVerticalAlignment.ALIGN_TOP);
- table1.getFlexCellFormatter().addStyleName(2,2, "Cell");
- table1.getRowFormatter().addStyleName(3,"Row");
- table1.setWidget(3,0,bt34);
- table1.getFlexCellFormatter().setColSpan(3,0,3);
- table1.getFlexCellFormatter().setHorizontalAlignment(3,0,com.google.gwt.user.client.ui.HasHorizontalAlignment.ALIGN_DEFAULT);
- table1.getFlexCellFormatter().setVerticalAlignment(3,0,com.google.gwt.user.client.ui.HasVerticalAlignment.ALIGN_TOP);
- table1.getFlexCellFormatter().addStyleName(3,0, "Cell");
- table1.getRowFormatter().addStyleName(4,"Row");
- table1.setWidget(4,0,label3);
- table1.getFlexCellFormatter().setColSpan(4,0,2);
- table1.getFlexCellFormatter().setHorizontalAlignment(4,0,com.google.gwt.user.client.ui.HasHorizontalAlignment.ALIGN_DEFAULT);
- table1.getFlexCellFormatter().setVerticalAlignment(4,0,com.google.gwt.user.client.ui.HasVerticalAlignment.ALIGN_TOP);
- table1.getFlexCellFormatter().addStyleName(4,0, "Cell");
- $TabPanel9.add(gd2,"GD2");
- $TabPanel9.add(gd22,"GD22");
- }
-
- public void inTheEnd() {
-
- }
-
- /**
- * initilization of databinding
- */
- public void initDataBinding() {
- //TODO
- applyDataBinding("textfield.enabled");
- applyDataBinding("label.text");
- }
-
- /**
- * initialization
- */
- public void initialize() {
- beforeCreation();
- componentsCreation();
- b.addClickListener(new com.google.gwt.user.client.ui.ClickListener() {
- public void onClick(com.google.gwt.user.client.ui.Widget sender) {
- if(gd2.getButton().isDown()) {
- table1.setSize(String.valueOf(com.google.gwt.user.client.Random.nextInt(800)),
- String.valueOf(com.google.gwt.user.client.Random.nextInt(400)));
- }
- }
- });
- beforeInitialization();
- componentsTree();
- beforeBinding();
- initDataBinding();
- inTheEnd();
- }
-
- public void onChangeFromgd22buttonisSelected() {
- processDataBinding("textfield.enabled");
- }
-
- public void onChangeFromgd2getButtondown() {
- processDataBinding("textfield.enabled");
- }
-
- public void onChangeFromtextfieldgetText() {
- processDataBinding("label.text");
- }
-
- /**
- *
- * test
- * @since 0.0.1
- *
- */
- public void test2(String test) throws NullPointerException, ArrayIndexOutOfBoundsException {
- System.out.println(test);
- }
-
- public void testSameName() {
- System.out.println("load the script file with the same name");
- }
-
- /*---------------------------------------------------------------------------------*/
- /*-- ui creation methods ----------------------------------------------------------*/
- /*---------------------------------------------------------------------------------*/
-
- /**
- * $MenuBar1 creation
- */
- private void create$MenuBar1() {
-
- }
-
- /**
- * $TabPanel9 creation
- */
- private void create$TabPanel9() {
- $TabPanel9.setSize("800px","400px");
- }
-
- /**
- * bt3 creation
- */
- private void createBt3() {
- bt3.setText("bt3");
- bt3.addClickListener(new com.google.gwt.user.client.ui.ClickListener() {
- public void onClick(com.google.gwt.user.client.ui.Widget arg0){
- System.out.println("beau gosse");
- }
- });
- }
-
- /**
- * bt31 creation
- */
- private void createBt31() {
- bt31.setText("bt31");
- }
-
- /**
- * bt32 creation
- */
- private void createBt32() {
- bt32.setText("bt32");
- }
-
- /**
- * bt34 creation
- */
- private void createBt34() {
- bt34.setText("bt34");
- }
-
- /**
- * gd2 creation
- */
- private void createGd2() {
-
- }
-
- /**
- * gd22 creation
- */
- private void createGd22() {
-
- }
-
- /**
- * label creation
- */
- private void createLabel() {
-
- }
-
- /**
- * label2 creation
- */
- private void createLabel2() {
- label2.setText("color");
- }
-
- /**
- * label3 creation
- */
- private void createLabel3() {
- label3.setText("color");
- }
-
- /**
- * table1 creation
- */
- private void createTable1() {
- table1.addStyleName("Table");
- }
-
- /**
- * textfield creation
- */
- private void createTextfield() {
- textfield.setText("test");
- textfield.addFocusListener(new com.google.gwt.user.client.ui.FocusListenerAdapter() {
- public void onFocus(com.google.gwt.user.client.ui.Widget arg0){
- System.out.println("dude !");
- }
- });
- }
-
- }
\ No newline at end of file
Deleted: trunk/guix-test-gwt/src/main/java/org/nuiton/guix/client/GuixDemoImpl.java
===================================================================
--- trunk/guix-test-gwt/src/main/java/org/nuiton/guix/client/GuixDemoImpl.java 2009-07-23 10:52:07 UTC (rev 1516)
+++ trunk/guix-test-gwt/src/main/java/org/nuiton/guix/client/GuixDemoImpl.java 2009-07-23 11:51:26 UTC (rev 1517)
@@ -1,34 +0,0 @@
-package org.nuiton.guix.client;
-
-import com.google.gwt.user.client.ui.MenuBar;
-import com.google.gwt.user.client.ui.TabPanel;
-import com.google.gwt.user.client.ui.FlexTable;
-import com.google.gwt.user.client.ui.TextBox;
-import com.google.gwt.user.client.ui.Label;
-import org.nuiton.guix.client.GuixDemo3Abstract;
-import org.nuiton.guix.client.GuixDemo2Abstract;
-
-/**
- * test javadoc Application
- */
-public class GuixDemoImpl extends GuixDemoAbstract implements com.google.gwt.core.client.EntryPoint {
- /*---------------------------------------------------------------------------------*/
- /*-- Constructors -----------------------------------------------------------------*/
- /*---------------------------------------------------------------------------------*/
-
- /**
- * Constructor
- */
- public GuixDemoImpl() {
- super();
- }
-
- /*---------------------------------------------------------------------------------*/
- /*-- public mutator methods -------------------------------------------------------*/
- /*---------------------------------------------------------------------------------*/
-
- public void onModuleLoad() {
- com.google.gwt.user.client.ui.RootPanel.get().add(this);
- }
-
- }
\ No newline at end of file
Deleted: trunk/guix-test-gwt/src/main/java/org/nuiton/guix/public/Application.css
===================================================================
--- trunk/guix-test-gwt/src/main/java/org/nuiton/guix/public/Application.css 2009-07-23 10:52:07 UTC (rev 1516)
+++ trunk/guix-test-gwt/src/main/java/org/nuiton/guix/public/Application.css 2009-07-23 11:51:26 UTC (rev 1517)
@@ -1,13 +0,0 @@
-/** Add css rules here for your application. */
-button {
- display: block;
- font-size: 16pt
-}
-
-.widePanel {
- width: 100%
-}
-
-img {
- margin-top: 20px;
-}
\ No newline at end of file
Deleted: trunk/guix-test-gwt/src/main/java/org/nuiton/guix/public/Application.html
===================================================================
--- trunk/guix-test-gwt/src/main/java/org/nuiton/guix/public/Application.html 2009-07-23 10:52:07 UTC (rev 1516)
+++ trunk/guix-test-gwt/src/main/java/org/nuiton/guix/public/Application.html 2009-07-23 11:51:26 UTC (rev 1517)
@@ -1,36 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
-<!-- The HTML 4.01 Transitional DOCTYPE declaration-->
-<!-- above set at the top of the file will set -->
-<!-- the browser's rendering engine into -->
-<!-- "Quirks Mode". Replacing this declaration -->
-<!-- with a "Standards Mode" doctype is supported, -->
-<!-- but may lead to some differences in layout. -->
-
-<html>
- <head>
- <meta http-equiv="content-type" content="text/html; charset=UTF-8">
- <!-- -->
- <!-- Any title is fine -->
- <!-- -->
- <title>Application</title>
-
- <!-- -->
- <!-- This script loads your compiled module. -->
- <!-- If you add any GWT meta tags, they must -->
- <!-- be added before this line. -->
- <!-- -->
- <script type="text/javascript" language="javascript" src="org.nuiton.guix.Application.nocache.js"></script>
- </head>
-
- <!-- -->
- <!-- The body can have arbitrary html, or -->
- <!-- you can leave the body empty if you want -->
- <!-- to create a completely dynamic UI. -->
- <!-- -->
- <body>
-
- <!-- OPTIONAL: include this if you want history support -->
- <iframe src="javascript:''" id="__gwt_historyFrame" tabIndex='-1' style="position:absolute;width:0;height:0;border:0"></iframe>
-
- </body>
-</html>
Deleted: trunk/guix-test-gwt/src/main/java/org/nuiton/guix/public/GuixDemo.css
===================================================================
--- trunk/guix-test-gwt/src/main/java/org/nuiton/guix/public/GuixDemo.css 2009-07-23 10:52:07 UTC (rev 1516)
+++ trunk/guix-test-gwt/src/main/java/org/nuiton/guix/public/GuixDemo.css 2009-07-23 11:51:26 UTC (rev 1517)
@@ -1,23 +0,0 @@
-#button
-{
- foreground: red;
-}
-
-.Cell {
- border: 1px solid black;
- font-weight: bold;
-}
-
-.Row {
- border: 2px outset red;
-}
-
-.Table {
-}
-
-
-.bold
-{
- font : bold;
-}
-
Deleted: trunk/guix-test-gwt/src/main/java/org/nuiton/guix/public/Index.html
===================================================================
--- trunk/guix-test-gwt/src/main/java/org/nuiton/guix/public/Index.html 2009-07-23 10:52:07 UTC (rev 1516)
+++ trunk/guix-test-gwt/src/main/java/org/nuiton/guix/public/Index.html 2009-07-23 11:51:26 UTC (rev 1517)
@@ -1,7 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?><!DOCTYPEHTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><!--The HTML 4.01 Transitional DOCTYPE declaration above set at the top of the file will set the browser's rendering engine into "Quirks Mode". Replacing this declaration with a "Standards Mode" doctype is supported, but may lead to some differences in layout.--><html>
- <head>
- <meta http-equiv="content-type" content="text/html; charset=UTF-8" />
- <title>Guix Demo</title><!--This script loads your compiled module. If you add any GWT meta tags, they must be added before this line.--><script type="text/javascript" language="javascript" src="org.nuiton.guix.Index.nocache.js" />
- </head><!--The body can have arbitrary html, or you can leave the body empty if you want to create a completely dynamic UI.--><body><!--OPTIONAL: include this if you want history support--><iframe src="javascript:''" id="__gwt_historyFrame" tabIndex="-1" style="position:absolute;width:0;height:0;border:0" />
- </body>
-</html>
\ No newline at end of file
1
0
r1516 - in trunk/maven-guix-plugin: . src/main/java/org/nuiton/guix
by kmorin@users.labs.libre-entreprise.org July 23, 2009
by kmorin@users.labs.libre-entreprise.org July 23, 2009
July 23, 2009
Author: kmorin
Date: 2009-07-23 12:52:07 +0200 (Thu, 23 Jul 2009)
New Revision: 1516
Modified:
trunk/maven-guix-plugin/pom.xml
trunk/maven-guix-plugin/src/main/java/org/nuiton/guix/GuixMojo.java
Log:
Add the target directory to the classpath
Modified: trunk/maven-guix-plugin/pom.xml
===================================================================
--- trunk/maven-guix-plugin/pom.xml 2009-07-23 10:51:30 UTC (rev 1515)
+++ trunk/maven-guix-plugin/pom.xml 2009-07-23 10:52:07 UTC (rev 1516)
@@ -42,13 +42,11 @@
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-plugin-api</artifactId>
- <scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-project</artifactId>
- <scope>provided</scope>
</dependency>
<!-- other dependencies -->
Modified: trunk/maven-guix-plugin/src/main/java/org/nuiton/guix/GuixMojo.java
===================================================================
--- trunk/maven-guix-plugin/src/main/java/org/nuiton/guix/GuixMojo.java 2009-07-23 10:51:30 UTC (rev 1515)
+++ trunk/maven-guix-plugin/src/main/java/org/nuiton/guix/GuixMojo.java 2009-07-23 10:52:07 UTC (rev 1516)
@@ -23,6 +23,7 @@
import org.apache.maven.plugin.AbstractMojo;
import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugin.MojoFailureException;
+import org.apache.maven.project.MavenProject;
import org.nuiton.guix.generator.GwtGenerator;
import org.nuiton.guix.generator.SwingGenerator;
@@ -30,32 +31,39 @@
* Launches the program
*
* @author morin
- * @goal testMojo
+ * @goal generate
+ * @phase process-sources
+ * @requiresDependencyResolution compile
+ * @requiresProject
*/
-public class GuixMojo extends AbstractMojo
-{
-
+public class GuixMojo extends AbstractMojo {
+
/**
- * Directory of the files to compile.
- * @parameter expression="${guix.guixFilesDir}" default-value="${maven.src.dir}/main/java"
- * @since 0.0.1
- */
+ * Project dependencies.
+ *
+ * @parameter default-value="${project}"
+ * @required
+ * @readonly
+ */
+ protected MavenProject project;
+ /**
+ * Directory of the files to compile.
+ * @parameter expression="${guix.guixFilesDir}" default-value="${maven.src.dir}/main/java"
+ * @since 0.0.1
+ */
private String guixFilesDir;
-
/**
* Directory of the generated files.
- * @parameter expression="${guix.targetDirectory}" default-value="generatedFiles"
+ * @parameter expression="${guix.targetDirectory}" default-value="${basedir}/target/generatedFiles"
* @since 0.0.1
*/
private String targetDirectory;
-
/**
* Directory of the generated files.
* @parameter expression="${guix.rootPackage}" default-value=""
* @since 0.0.1
*/
private String rootPackage;
-
/**
* Main class of the application to generate.
* @parameter expression="${guix.mainClass}"
@@ -63,14 +71,12 @@
* @since 0.0.1
*/
private String mainClass;
-
/**
* Generation language
* @parameter expression="${guix.generationLanguage}" default-value="Swing"
* @since 0.0.1
*/
private String generationLanguage;
-
/**
* Generation language
* @parameter expression="${guix.launcherName}" default-value="Main"
@@ -79,32 +85,36 @@
private String launcherName;
@Override
- public void execute() throws MojoExecutionException, MojoFailureException {
+ public void execute() throws MojoExecutionException, MojoFailureException {
File guixFilesDir = new File(this.guixFilesDir);
File targetDirectory = new File(this.targetDirectory);
Class generatorClass = null;
- if(generationLanguage.equalsIgnoreCase("Swing")) {
+ if (generationLanguage.equalsIgnoreCase("Swing")) {
generatorClass = SwingGenerator.class;
SwingGuixInitializer.initialize();
}
- else if(generationLanguage.equalsIgnoreCase("GWT")) {
+ else if (generationLanguage.equalsIgnoreCase("GWT")) {
generatorClass = GwtGenerator.class;
GwtGuixInitializer.initialize();
}
- if(!targetDirectory.exists())
+ if (!targetDirectory.exists()) {
targetDirectory.mkdirs();
-
- if(guixFilesDir.exists() && guixFilesDir.isDirectory()) {
+ }
+ fixCompileSourceRoots(targetDirectory);
+
+ if (guixFilesDir.exists() && guixFilesDir.isDirectory()) {
ArrayList<File> guixFiles = goDeeperInto(guixFilesDir);
GuixLauncher gcl = new GuixLauncher(guixFiles.toArray(
- new File[guixFiles.size()]),targetDirectory,rootPackage,
- guixFilesDir,mainClass,generatorClass,launcherName);
+ new File[guixFiles.size()]), targetDirectory, rootPackage,
+ guixFilesDir, mainClass, generatorClass, launcherName);
boolean result = gcl.compile();
-// if(result)
-// getLog().info("Compilation succeeded !");
-// else
-// getLog().error("Compilation failed...");
+ if (result) {
+ getLog().info("Compilation succeeded !");
+ }
+ else {
+ getLog().error("Compilation failed...");
+ }
getLog().info("Compilation over");
}
else {
@@ -115,11 +125,11 @@
private ArrayList<File> goDeeperInto(File dir) {
getLog().debug("goind deeper into " + dir.getPath());
ArrayList<File> result = new ArrayList<File>();
- for(File f : dir.listFiles()) {
- if(f.isDirectory() && !f.isHidden()) {
+ for (File f : dir.listFiles()) {
+ if (f.isDirectory() && !f.isHidden()) {
result.addAll(goDeeperInto(f));
}
- else if(f.getName().endsWith(".guix")) {
+ else if (f.getName().endsWith(".guix")) {
getLog().debug("found " + f.getName());
result.add(f);
}
@@ -127,4 +137,12 @@
return result;
}
+ protected void fixCompileSourceRoots(File targetDirectory) {
+ //fixme should remove this silly test when we will make real maven plugin tests :)
+ if (project != null) {
+ if (!project.getCompileSourceRoots().contains(targetDirectory.getPath())) {
+ project.addCompileSourceRoot(targetDirectory.getPath());
+ }
+ }
+ }
}
1
0
r1515 - in trunk/guix-test-swing: . src/main/java/org/nuiton/guix
by kmorin@users.labs.libre-entreprise.org July 23, 2009
by kmorin@users.labs.libre-entreprise.org July 23, 2009
July 23, 2009
Author: kmorin
Date: 2009-07-23 12:51:30 +0200 (Thu, 23 Jul 2009)
New Revision: 1515
Removed:
trunk/guix-test-swing/src/main/java/org/nuiton/guix/GuixDemoAbstract.java
Modified:
trunk/guix-test-swing/pom.xml
Log:
Update the example
Modified: trunk/guix-test-swing/pom.xml
===================================================================
--- trunk/guix-test-swing/pom.xml 2009-07-23 10:51:11 UTC (rev 1514)
+++ trunk/guix-test-swing/pom.xml 2009-07-23 10:51:30 UTC (rev 1515)
@@ -30,10 +30,6 @@
<groupId>org.springframework</groupId>
<artifactId>spring-beans</artifactId>
</dependency>
- <dependency>
- <groupId>net.java.dev.beansbinding</groupId>
- <artifactId>beansbinding</artifactId>
- </dependency>
<dependency>
<groupId>junit</groupId>
@@ -72,9 +68,23 @@
<!-- *** Build Environment ************************************** -->
<!-- ************************************************************* -->
-
-
<build>
+ <resources>
+ <resource>
+ <directory>src/main/java</directory>
+ <includes>
+ <include>**/*.guix</include>
+ <include>**/*.jaxx</include>
+ </includes>
+ </resource>
+ <resource>
+ <directory>src/main/resources</directory>
+ <includes>
+ <include>**/*</include>
+ </includes>
+ </resource>
+ </resources>
+
<pluginManagement>
<plugins>
@@ -100,8 +110,8 @@
<artifactId>maven-guix-plugin</artifactId>
<version>${project.version}</version>
<configuration>
- <guixFilesDir>guix-test-swing/src/main/java/org/nuiton/guix/demo/</guixFilesDir>
- <targetDirectory>guix-test-swing/target/generatedFiles/</targetDirectory>
+ <guixFilesDir>${project.basedir}/src/main/java/org/nuiton/guix/demo/</guixFilesDir>
+ <targetDirectory>${project.basedir}/target/generatedFiles/</targetDirectory>
<rootPackage>org.nuiton.guix</rootPackage>
<mainClass>org.nuiton.guix.GuixDemo</mainClass>
<launcherName>Main</launcherName>
@@ -109,9 +119,8 @@
</configuration>
<executions>
<execution>
- <phase>compile</phase>
<goals>
- <goal>testMojo</goal>
+ <goal>generate</goal>
</goals>
</execution>
</executions>
Deleted: trunk/guix-test-swing/src/main/java/org/nuiton/guix/GuixDemoAbstract.java
===================================================================
--- trunk/guix-test-swing/src/main/java/org/nuiton/guix/GuixDemoAbstract.java 2009-07-23 10:51:11 UTC (rev 1514)
+++ trunk/guix-test-swing/src/main/java/org/nuiton/guix/GuixDemoAbstract.java 2009-07-23 10:51:30 UTC (rev 1515)
@@ -1,806 +0,0 @@
-package org.nuiton.guix;
-
-import java.util.ArrayList;
-import javax.swing.JMenuBar;
-import javax.swing.JMenu;
-import javax.swing.JMenuItem;
-import javax.swing.JToolBar;
-import javax.swing.JButton;
-import javax.swing.JTabbedPane;
-import javax.swing.JPanel;
-import javax.swing.JTextField;
-import javax.swing.JLabel;
-import org.nuiton.guix.GuixDemo3Abstract;
-import org.nuiton.guix.GuixDemo2Abstract;
-import java.awt.Button;
-import java.awt.event.ActionListener;
-import java.awt.event.ActionEvent;
-import java.awt.BorderLayout;
-
-/**
- * test javadoc Application
- */
-public abstract class GuixDemoAbstract extends javax.swing.JFrame implements GuixDemo {
- private javax.swing.JButton $Button6;
- private javax.swing.JButton $Button7;
- private javax.swing.JToolBar $JToolBar5;
- private javax.swing.JMenu $Menu2;
- private javax.swing.JMenu $Menu4;
- private javax.swing.JMenuBar $MenuBar1;
- private javax.swing.JMenuItem $MenuItem3;
- /**
- * List of the active bindings
- */
- private java.util.List<String> activeBindings = new java.util.ArrayList<String>();
- private javax.swing.JButton bouton1;
- private org.nuiton.guix.GuixDemo3Abstract bt3;
- private org.nuiton.guix.GuixDemo3Abstract bt31;
- private org.nuiton.guix.GuixDemo3Abstract bt32;
- private org.nuiton.guix.GuixDemo3Abstract bt34;
- private java.util.ArrayList controller;
- private org.nuiton.guix.GuixDemo2Abstract gd2;
- private org.nuiton.guix.GuixDemo2Abstract gd22;
- /**
- * test javadoc Application
- */
- private org.nuiton.guix.GuixDemoAbstract guixdemo = this;
- private javax.swing.JMenuItem item1;
- private javax.swing.JLabel label;
- private javax.swing.JLabel label2;
- private javax.swing.JLabel label3;
- private javax.swing.JTabbedPane tabPanel;
- private javax.swing.JPanel table;
- /**
- * javadoc textfield
- */
- private javax.swing.JTextField textfield;
-
- /* begin raw body code */
-
- private Button b = new Button("test");
- public enum Day {
- SUNDAY, MONDAY, TUESDAY, WEDNESDAY,
- THURSDAY, FRIDAY, SATURDAY
- }
-
- /* end raw body code */
-
- /*---------------------------------------------------------------------------------*/
- /*-- Statics methods --------------------------------------------------------------*/
- /*---------------------------------------------------------------------------------*/
-
- public static void testSameName() {
- System.out.println("load the script file with the same name");
- }
-
- /*---------------------------------------------------------------------------------*/
- /*-- Constructors -----------------------------------------------------------------*/
- /*---------------------------------------------------------------------------------*/
-
- /**
- * Constructor
- */
- public GuixDemoAbstract() {
- initialize();
- }
-
- /*---------------------------------------------------------------------------------*/
- /*-- JAXXObject implementation ----------------------------------------------------*/
- /*---------------------------------------------------------------------------------*/
-
- public void applyDataBinding(String _binding) {
- if("textfield.enabled".equals(_binding)) {
- if(getGd2() != null) {
- getGd2().addPropertyChangeListener(new java.beans.PropertyChangeListener() {
- public void propertyChange(java.beans.PropertyChangeEvent arg0) {
- onChangeFromgetGd2getButtonisSelected();
- }
- });
- }
- if(getGd2() != null && getGd2().getButton() != null) {
- getGd2().getButton().addPropertyChangeListener(new java.beans.PropertyChangeListener() {
- public void propertyChange(java.beans.PropertyChangeEvent arg0) {
- onChangeFromgetGd2getButtonisSelected();
- }
- });
- }
- if(getGd2() != null && getGd2().getButton() != null) {
- getGd2().getButton().getModel().addChangeListener(new javax.swing.event.ChangeListener() {
- public void stateChanged(javax.swing.event.ChangeEvent arg0) {
- onChangeFromgetGd2getButtonisSelected();
- }
- });
- }
- if(getGd22() != null) {
- getGd22().addPropertyChangeListener(new java.beans.PropertyChangeListener() {
- public void propertyChange(java.beans.PropertyChangeEvent arg0) {
- onChangeFromgetGd22getButtonisSelected();
- }
- });
- }
- if(getGd22() != null && getGd22().getButton() != null) {
- getGd22().getButton().addPropertyChangeListener(new java.beans.PropertyChangeListener() {
- public void propertyChange(java.beans.PropertyChangeEvent arg0) {
- onChangeFromgetGd22getButtonisSelected();
- }
- });
- }
- if(getGd22() != null && getGd22().getButton() != null) {
- getGd22().getButton().getModel().addChangeListener(new javax.swing.event.ChangeListener() {
- public void stateChanged(javax.swing.event.ChangeEvent arg0) {
- onChangeFromgetGd22getButtonisSelected();
- }
- });
- }
- }
- else if("label.text".equals(_binding)) {
- if(getTextfield() != null) {
- getTextfield().addPropertyChangeListener(new java.beans.PropertyChangeListener() {
- public void propertyChange(java.beans.PropertyChangeEvent arg0) {
- onChangeFromtextfieldgetText();
- }
- });
- }
- if(getTextfield() != null) {
- getTextfield().getDocument().addDocumentListener(new javax.swing.event.DocumentListener() {
- public void insertUpdate(javax.swing.event.DocumentEvent arg0) {
- onChangeFromtextfieldgetText();
- }
- public void removeUpdate(javax.swing.event.DocumentEvent arg0) {
- onChangeFromtextfieldgetText();
- }
- public void changedUpdate(javax.swing.event.DocumentEvent arg0) {
- onChangeFromtextfieldgetText();
- }
- });
- }
- }
-
- processDataBinding(_binding);
- }
-
- public void firePropertyChange(String name, Object oldValue, Object newValue) {
- super.firePropertyChange(name, oldValue, newValue);
- }
-
- public void processDataBinding(String _binding) {
- if (activeBindings.contains(_binding)) {
- return;
- }
- activeBindings.add(_binding);
- try{
- if("textfield.enabled".equals(_binding)) {
- textfield.setEnabled(getGd2().getButton().isSelected() && getGd22().getButton().isSelected());
- }
- else if("label.text".equals(_binding)) {
- label.setText("label : " + textfield.getText());
- }
-
- } finally {
- activeBindings.remove(_binding);
- }
- }
-
- public void removeDataBinding(String _binding) {
- if("textfield.enabled".equals(_binding)) {
- if(getGd2() != null) {
- getGd2().removePropertyChangeListener(new java.beans.PropertyChangeListener() {
- public void propertyChange(java.beans.PropertyChangeEvent arg0) {
- onChangeFromgetGd2getButtonisSelected();
- }
- });
- }
- if(getGd2() != null && getGd2().getButton() != null) {
- getGd2().getButton().removePropertyChangeListener(new java.beans.PropertyChangeListener() {
- public void propertyChange(java.beans.PropertyChangeEvent arg0) {
- onChangeFromgetGd2getButtonisSelected();
- }
- });
- }
- if(getGd2() != null && getGd2().getButton() != null) {
- getGd2().getButton().getModel().removeChangeListener(new javax.swing.event.ChangeListener() {
- public void stateChanged(javax.swing.event.ChangeEvent arg0) {
- onChangeFromgetGd2getButtonisSelected();
- }
- });
- }
- if(getGd22() != null) {
- getGd22().removePropertyChangeListener(new java.beans.PropertyChangeListener() {
- public void propertyChange(java.beans.PropertyChangeEvent arg0) {
- onChangeFromgetGd22getButtonisSelected();
- }
- });
- }
- if(getGd22() != null && getGd22().getButton() != null) {
- getGd22().getButton().removePropertyChangeListener(new java.beans.PropertyChangeListener() {
- public void propertyChange(java.beans.PropertyChangeEvent arg0) {
- onChangeFromgetGd22getButtonisSelected();
- }
- });
- }
- if(getGd22() != null && getGd22().getButton() != null) {
- getGd22().getButton().getModel().removeChangeListener(new javax.swing.event.ChangeListener() {
- public void stateChanged(javax.swing.event.ChangeEvent arg0) {
- onChangeFromgetGd22getButtonisSelected();
- }
- });
- }
- }
- else if("label.text".equals(_binding)) {
- if(getTextfield() != null) {
- getTextfield().removePropertyChangeListener(new java.beans.PropertyChangeListener() {
- public void propertyChange(java.beans.PropertyChangeEvent arg0) {
- onChangeFromtextfieldgetText();
- }
- });
- }
- if(getTextfield() != null) {
- getTextfield().getDocument().removeDocumentListener(new javax.swing.event.DocumentListener() {
- public void insertUpdate(javax.swing.event.DocumentEvent arg0) {
- onChangeFromtextfieldgetText();
- }
- public void removeUpdate(javax.swing.event.DocumentEvent arg0) {
- onChangeFromtextfieldgetText();
- }
- public void changedUpdate(javax.swing.event.DocumentEvent arg0) {
- onChangeFromtextfieldgetText();
- }
- });
- }
- }
- }
-
- /*---------------------------------------------------------------------------------*/
- /*-- public acessor methods -------------------------------------------------------*/
- /*---------------------------------------------------------------------------------*/
-
- public javax.swing.JButton get$Button6() {
- return $Button6;
- }
-
- public javax.swing.JButton get$Button7() {
- return $Button7;
- }
-
- public javax.swing.JToolBar get$JToolBar5() {
- return $JToolBar5;
- }
-
- public javax.swing.JMenu get$Menu2() {
- return $Menu2;
- }
-
- public javax.swing.JMenu get$Menu4() {
- return $Menu4;
- }
-
- public javax.swing.JMenuBar get$MenuBar1() {
- return $MenuBar1;
- }
-
- public javax.swing.JMenuItem get$MenuItem3() {
- return $MenuItem3;
- }
-
- public java.util.List<String> getActiveBindings() {
- return activeBindings;
- }
-
- public javax.swing.JButton getBouton1() {
- return bouton1;
- }
-
- public org.nuiton.guix.GuixDemo3Abstract getBt3() {
- return bt3;
- }
-
- public org.nuiton.guix.GuixDemo3Abstract getBt31() {
- return bt31;
- }
-
- public org.nuiton.guix.GuixDemo3Abstract getBt32() {
- return bt32;
- }
-
- public org.nuiton.guix.GuixDemo3Abstract getBt34() {
- return bt34;
- }
-
- public java.util.ArrayList getController() {
- return controller;
- }
-
- public org.nuiton.guix.GuixDemo2Abstract getGd2() {
- return gd2;
- }
-
- public org.nuiton.guix.GuixDemo2Abstract getGd22() {
- return gd22;
- }
-
- public org.nuiton.guix.GuixDemoAbstract getGuixdemo() {
- return guixdemo;
- }
-
- public javax.swing.JMenuItem getItem1() {
- return item1;
- }
-
- public javax.swing.JLabel getLabel() {
- return label;
- }
-
- public javax.swing.JLabel getLabel2() {
- return label2;
- }
-
- public javax.swing.JLabel getLabel3() {
- return label3;
- }
-
- public javax.swing.JTabbedPane getTabPanel() {
- return tabPanel;
- }
-
- public javax.swing.JPanel getTable() {
- return table;
- }
-
- public javax.swing.JTextField getTextfield() {
- return textfield;
- }
-
- /*---------------------------------------------------------------------------------*/
- /*-- public mutator methods -------------------------------------------------------*/
- /*---------------------------------------------------------------------------------*/
-
- public void set$Button6(javax.swing.JButton newValue) {
- this.$Button6 = newValue;
- }
-
- public void set$Button7(javax.swing.JButton newValue) {
- this.$Button7 = newValue;
- }
-
- public void set$JToolBar5(javax.swing.JToolBar newValue) {
- this.$JToolBar5 = newValue;
- }
-
- public void set$Menu2(javax.swing.JMenu newValue) {
- this.$Menu2 = newValue;
- }
-
- public void set$Menu4(javax.swing.JMenu newValue) {
- this.$Menu4 = newValue;
- }
-
- public void set$MenuBar1(javax.swing.JMenuBar newValue) {
- this.$MenuBar1 = newValue;
- }
-
- public void set$MenuItem3(javax.swing.JMenuItem newValue) {
- this.$MenuItem3 = newValue;
- }
-
- public void setBouton1(javax.swing.JButton newValue) {
- this.bouton1 = newValue;
- }
-
- public void setBt3(org.nuiton.guix.GuixDemo3Abstract newValue) {
- this.bt3 = newValue;
- }
-
- public void setBt31(org.nuiton.guix.GuixDemo3Abstract newValue) {
- this.bt31 = newValue;
- }
-
- public void setBt32(org.nuiton.guix.GuixDemo3Abstract newValue) {
- this.bt32 = newValue;
- }
-
- public void setBt34(org.nuiton.guix.GuixDemo3Abstract newValue) {
- this.bt34 = newValue;
- }
-
- public void setController(java.util.ArrayList newValue) {
- this.controller = newValue;
- }
-
- public void setGd2(org.nuiton.guix.GuixDemo2Abstract newValue) {
- this.gd2 = newValue;
- }
-
- public void setGd22(org.nuiton.guix.GuixDemo2Abstract newValue) {
- this.gd22 = newValue;
- }
-
- public void setGuixdemo(org.nuiton.guix.GuixDemoAbstract newValue) {
- this.guixdemo = newValue;
- }
-
- public void setItem1(javax.swing.JMenuItem newValue) {
- this.item1 = newValue;
- }
-
- public void setLabel(javax.swing.JLabel newValue) {
- this.label = newValue;
- }
-
- public void setLabel2(javax.swing.JLabel newValue) {
- this.label2 = newValue;
- }
-
- public void setLabel3(javax.swing.JLabel newValue) {
- this.label3 = newValue;
- }
-
- public void setTabPanel(javax.swing.JTabbedPane newValue) {
- this.tabPanel = newValue;
- }
-
- public void setTable(javax.swing.JPanel newValue) {
- this.table = newValue;
- }
-
- public void setTextfield(javax.swing.JTextField newValue) {
- this.textfield = newValue;
- }
-
- /*---------------------------------------------------------------------------------*/
- /*-- public mutator methods -------------------------------------------------------*/
- /*---------------------------------------------------------------------------------*/
-
- public void beforeBinding() {
- this.add(b, BorderLayout.SOUTH);
- }
-
- public void beforeCreation() {
- System.out.println("before Creation");
- }
-
- public void beforeInitialization() {
-
- }
-
- /**
- * Components creation
- */
- public void componentsCreation() {
- createController();
- create$Menu2();
- createItem1();
- create$MenuItem3();
- create$Menu4();
- create$MenuBar1();
- create$JToolBar5();
- createBouton1();
- create$Button6();
- create$Button7();
- createTabPanel();
- createTextfield();
- createLabel();
- createLabel2();
- createBt3();
- createBt31();
- createBt32();
- createBt34();
- createLabel3();
- createTable();
- createGd2();
- createGd22();
- }
-
- /**
- * components layout
- */
- public void componentsTree() {
- this.setTitle("Guix Swing Demo");
- this.setSize(800,600);
- this.setLayout(new BorderLayout());
- this.setJMenuBar($MenuBar1);
- $MenuBar1.add($Menu2);
- $Menu2.add(item1);
- $Menu2.add($MenuItem3);
- $MenuBar1.add($Menu4);
- this.add($JToolBar5,BorderLayout.NORTH);
- $JToolBar5.add(bouton1);
- $JToolBar5.add($Button6);
- $JToolBar5.add($Button7);
- this.add(tabPanel,BorderLayout.CENTER);
- tabPanel.add(table);
- table.add(textfield, new java.awt.GridBagConstraints (0,0,1,1,0.0,0.0,java.awt.GridBagConstraints.FIRST_LINE_START,java.awt.GridBagConstraints.BOTH, new java.awt.Insets(1,1,1,1),1,1));
- table.add(label, new java.awt.GridBagConstraints (1,0,1,1,0.0,0.0,java.awt.GridBagConstraints.FIRST_LINE_START,java.awt.GridBagConstraints.BOTH, new java.awt.Insets(1,1,1,1),1,1));
- table.add(label2, new java.awt.GridBagConstraints (2,0,1,3,0.0,0.0,java.awt.GridBagConstraints.FIRST_LINE_START,java.awt.GridBagConstraints.BOTH, new java.awt.Insets(1,1,1,1),1,1));
- table.add(bt3, new java.awt.GridBagConstraints (3,1,3,1,0.0,0.0,java.awt.GridBagConstraints.FIRST_LINE_START,java.awt.GridBagConstraints.BOTH, new java.awt.Insets(0,0,0,0),1,1));
- table.add(bt31, new java.awt.GridBagConstraints (0,2,2,1,0.0,0.0,java.awt.GridBagConstraints.FIRST_LINE_START,java.awt.GridBagConstraints.BOTH, new java.awt.Insets(0,0,0,0),1,1));
- table.add(bt32, new java.awt.GridBagConstraints (3,2,1,1,0.0,0.0,java.awt.GridBagConstraints.FIRST_LINE_START,java.awt.GridBagConstraints.BOTH, new java.awt.Insets(2,2,2,2),1,1));
- table.add(bt34, new java.awt.GridBagConstraints (0,3,3,1,0.0,0.0,java.awt.GridBagConstraints.FIRST_LINE_START,java.awt.GridBagConstraints.BOTH, new java.awt.Insets(1,1,1,1),1,1));
- table.add(label3, new java.awt.GridBagConstraints (0,4,2,1,0.0,0.0,java.awt.GridBagConstraints.FIRST_LINE_START,java.awt.GridBagConstraints.BOTH, new java.awt.Insets(1,1,1,1),1,1));
- tabPanel.add(gd2);
- tabPanel.add(gd22);
- }
-
- public void inTheEnd() {
-
- }
-
- /**
- * initilization of databinding
- */
- public void initDataBinding() {
- applyDataBinding("textfield.enabled");
- applyDataBinding("label.text");
- }
-
- /**
- * initialization
- */
- public void initialize() {
- beforeCreation();
- componentsCreation();
- b.addActionListener(new ActionListener() {
- public void actionPerformed(ActionEvent arg0) {
- if(gd2.getButton().isSelected()) {
- java.util.Random r = new java.util.Random();
- table.setBackground(new java.awt.Color(r.nextInt(255), r.nextInt(255), r.nextInt(255)));
- }
- }
- });
- beforeInitialization();
- componentsTree();
- beforeBinding();
- initDataBinding();
- inTheEnd();
- }
-
- public void onChangeFromgetGd22getButtonisSelected() {
- processDataBinding("textfield.enabled");
- }
-
- public void onChangeFromgetGd2getButtonisSelected() {
- processDataBinding("textfield.enabled");
- }
-
- public void onChangeFromtextfieldgetText() {
- processDataBinding("label.text");
- }
-
- /**
- *
- * test
- * @since 0.0.1
- *
- */
- public void test2(String test) throws NullPointerException, ArrayIndexOutOfBoundsException {
- System.out.println(test);
- }
-
- /*---------------------------------------------------------------------------------*/
- /*-- ui creation methods ----------------------------------------------------------*/
- /*---------------------------------------------------------------------------------*/
-
- /**
- * $Button6 creation
- */
- private void create$Button6() {
- $Button6 = new javax.swing.JButton();
- $Button6.setText("bouton2");
- $Button6.setForeground(new java.awt.Color(120,255,0));
- $Button6.setSize(80,35);
- $Button6.addActionListener(new java.awt.event.ActionListener() {
- public void actionPerformed(java.awt.event.ActionEvent actionEvent){
- $Button6.setText("click !");
- ;System.out.println("Action [" + actionEvent.getActionCommand() + "] performed!");
- }
- });
- }
-
- /**
- * $Button7 creation
- */
- private void create$Button7() {
- $Button7 = new javax.swing.JButton();
- $Button7.setText("bouton3");
- $Button7.setForeground(new java.awt.Color(120,255,0));
- $Button7.setSize(80,35);
- $Button7.addActionListener(new java.awt.event.ActionListener() {
- public void actionPerformed(java.awt.event.ActionEvent actionEvent){
- $Button7.setText("click !");
- ;System.out.println("Action [" + actionEvent.getActionCommand() + "] performed!");
- }
- });
- }
-
- /**
- * $JToolBar5 creation
- */
- private void create$JToolBar5() {
- $JToolBar5 = new javax.swing.JToolBar();
- $JToolBar5.setBorder(new javax.swing.border.EtchedBorder());
- }
-
- /**
- * $Menu2 creation
- */
- private void create$Menu2() {
- $Menu2 = new javax.swing.JMenu("menu 1");
- }
-
- /**
- * $Menu4 creation
- */
- private void create$Menu4() {
- $Menu4 = new javax.swing.JMenu("menu 2");
- }
-
- /**
- * $MenuBar1 creation
- */
- private void create$MenuBar1() {
- $MenuBar1 = new javax.swing.JMenuBar();
- $MenuBar1.setBorder(new javax.swing.border.BevelBorder(javax.swing.border.BevelBorder.RAISED));
- }
-
- /**
- * $MenuItem3 creation
- */
- private void create$MenuItem3() {
- $MenuItem3 = new javax.swing.JMenuItem();
- $MenuItem3.setText("item2");
- $MenuItem3.addActionListener(new java.awt.event.ActionListener() {
- public void actionPerformed(java.awt.event.ActionEvent actionEvent){
- System.out.println("Action [" + actionEvent.getActionCommand() + "] performed!");
- }
- });
- }
-
- /**
- * bouton1 creation
- */
- private void createBouton1() {
- bouton1 = new javax.swing.JButton();
- bouton1.setText("bouton1");
- bouton1.setSize(100,35);
- bouton1.setForeground(new java.awt.Color(120,255,0));
- bouton1.addActionListener(new java.awt.event.ActionListener() {
- public void actionPerformed(java.awt.event.ActionEvent actionEvent){
- bouton1.setText("click !");
- ;System.out.println("Action [" + actionEvent.getActionCommand() + "] performed!");
- }
- });
- }
-
- /**
- * bt3 creation
- */
- private void createBt3() {
- bt3 = new org.nuiton.guix.GuixDemo3Impl();
- bt3.setText("bt3");
- bt3.addActionListener(new java.awt.event.ActionListener() {
- public void actionPerformed(java.awt.event.ActionEvent actionEvent){
- System.out.println("beau gosse");
- }
- });
- }
-
- /**
- * bt31 creation
- */
- private void createBt31() {
- bt31 = new org.nuiton.guix.GuixDemo3Impl();
- bt31.setText("bt31");
- }
-
- /**
- * bt32 creation
- */
- private void createBt32() {
- bt32 = new org.nuiton.guix.GuixDemo3Impl();
- bt32.setText("bt32");
- }
-
- /**
- * bt34 creation
- */
- private void createBt34() {
- bt34 = new org.nuiton.guix.GuixDemo3Impl();
- bt34.setText("bt34");
- }
-
- /**
- * controller creation
- */
- private void createController() {
- controller = new java.util.ArrayList();
- }
-
- /**
- * gd2 creation
- */
- private void createGd2() {
- gd2 = new org.nuiton.guix.GuixDemo2Impl();
- gd2.setName("GD2");
- }
-
- /**
- * gd22 creation
- */
- private void createGd22() {
- gd22 = new org.nuiton.guix.GuixDemo2Impl();
- gd22.setName("GD22");
- }
-
- /**
- * item1 creation
- */
- private void createItem1() {
- item1 = new javax.swing.JMenuItem();
- item1.setText("item1");
- }
-
- /**
- * label creation
- */
- private void createLabel() {
- label = new javax.swing.JLabel();
- label.setForeground(new java.awt.Color(0,120,255));
- label.addMouseListener(new java.awt.event.MouseAdapter() {
- public void mouseEntered(java.awt.event.MouseEvent mouseEvent){
- label.setForeground(new java.awt.Color(255,120,0));
- ;
- }
- public void mouseExited(java.awt.event.MouseEvent mouseEvent){
- label.setForeground(new java.awt.Color(0,120,255));
- ;
- }
- });
- }
-
- /**
- * label2 creation
- */
- private void createLabel2() {
- label2 = new javax.swing.JLabel();
- label2.setText("color");
- label2.setBackground(java.awt.Color.BLUE);
- }
-
- /**
- * label3 creation
- */
- private void createLabel3() {
- label3 = new javax.swing.JLabel();
- label3.setText("color");
- label3.setForeground(java.awt.Color.YELLOW);
- }
-
- /**
- * tabPanel creation
- */
- private void createTabPanel() {
- tabPanel = new javax.swing.JTabbedPane();
- tabPanel.setSize(800,400);
- }
-
- /**
- * table creation
- */
- private void createTable() {
- table = new javax.swing.JPanel(new java.awt.GridBagLayout());
- table.setName("Table");
- }
-
- /**
- * textfield creation
- */
- private void createTextfield() {
- textfield = new javax.swing.JTextField("test");
- textfield.setSize(100,35);
- textfield.addFocusListener(new java.awt.event.FocusAdapter() {
- public void focusGained(java.awt.event.FocusEvent focusEvent){
- System.out.println("dude !");
- }
- });
- }
-
- }
\ No newline at end of file
1
0
r1514 - in trunk/guix-test-gwt: . src/main/java/org/nuiton/guix src/main/java/org/nuiton/guix/demo
by kmorin@users.labs.libre-entreprise.org July 23, 2009
by kmorin@users.labs.libre-entreprise.org July 23, 2009
July 23, 2009
Author: kmorin
Date: 2009-07-23 12:51:11 +0200 (Thu, 23 Jul 2009)
New Revision: 1514
Added:
trunk/guix-test-gwt/hs_err_pid9288.log
Removed:
trunk/guix-test-gwt/src/main/java/org/nuiton/guix/Index.gwt.xml
Modified:
trunk/guix-test-gwt/nbactions.xml
trunk/guix-test-gwt/pom.xml
trunk/guix-test-gwt/src/main/java/org/nuiton/guix/demo/GuixDemo.css
trunk/guix-test-gwt/src/main/java/org/nuiton/guix/demo/GuixDemo2.guix
Log:
Update the example
Added: trunk/guix-test-gwt/hs_err_pid9288.log
===================================================================
--- trunk/guix-test-gwt/hs_err_pid9288.log (rev 0)
+++ trunk/guix-test-gwt/hs_err_pid9288.log 2009-07-23 10:51:11 UTC (rev 1514)
@@ -0,0 +1,710 @@
+#
+# A fatal error has been detected by the Java Runtime Environment:
+#
+# SIGSEGV (0xb) at pc=0x0002ac8e, pid=9288, tid=3076410256
+#
+# JRE version: 6.0_14-b08
+# Java VM: Java HotSpot(TM) Client VM (14.0-b16 mixed mode, sharing linux-x86 )
+# Problematic frame:
+# C 0x0002ac8e
+#
+# If you would like to submit a bug report, please visit:
+# http://java.sun.com/webapps/bugreport/crash.jsp
+# The crash happened outside the Java Virtual Machine in native code.
+# See problematic frame for where to report the bug.
+#
+
+--------------- T H R E A D ---------------
+
+Current thread (0x09d7a800): JavaThread "main" [_thread_in_native, id=9289, stack(0xb7594000,0xb75e5000)]
+
+siginfo:si_signo=SIGSEGV: si_errno=0, si_code=1 (SEGV_MAPERR), si_addr=0x0002ac8e
+
+Registers:
+EAX=0xb4c83f7e, EBX=0xb4ca02a0, ECX=0x09d7a910, EDX=0x8f97c488
+ESP=0xb75e3e9c, EBP=0xb75e3eb8, ESI=0x8f928334, EDI=0x09d7a800
+EIP=0x0002ac8e, CR2=0x0002ac8e, EFLAGS=0x00010296
+
+Top of Stack: (sp=0xb75e3e9c)
+0xb75e3e9c: b4c83fa2 09f3ded0 7fffffff 0a1b5f30
+0xb75e3eac: 00000007 8f9247e4 8f928338 b75e3efc
+0xb75e3ebc: b550af1d 09d7a910 b75e3f04 09f3ded0
+0xb75e3ecc: 7fffffff 0a1b5f30 00000007 b75e3ef8
+0xb75e3edc: b75e3edc 00000000 b75e3f18 8f97c488
+0xb75e3eec: 00000000 8f928338 00000000 b75e3f0c
+0xb75e3efc: b75e3f3c b5503ea9 8f97c3e8 b5509329
+0xb75e3f0c: 00000007 0a1b5f30 7fffffff 09f3ded0
+
+Instructions: (pc=0x0002ac8e)
+0x0002ac7e:
+[error occurred during error reporting (printing registers, top of stack, instructions near pc), id 0xb]
+
+Stack: [0xb7594000,0xb75e5000], sp=0xb75e3e9c, free space=319k
+Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
+C 0x0002ac8e
+j org.eclipse.swt.internal.gtk.OS._g_main_context_check(IIII)I+0
+j org.eclipse.swt.internal.gtk.OS.g_main_context_check(IIII)I+11
+j org.eclipse.swt.widgets.Display.sleep()Z+326
+j com.google.gwt.dev.GWTShell.sleep()V+4
+j com.google.gwt.dev.GWTShell.pumpEventLoop()V+23
+j com.google.gwt.dev.GWTShell.run()V+23
+j com.google.gwt.dev.GWTShell.main([Ljava/lang/String;)V+20
+v ~StubRoutines::call_stub
+V [libjvm.so+0x213560]
+V [libjvm.so+0x326f58]
+V [libjvm.so+0x2133bf]
+V [libjvm.so+0x2435c3]
+V [libjvm.so+0x23388c]
+C [java+0x1b98] JavaMain+0x2c8
+C [libpthread.so.0+0x64ff]
+
+Java frames: (J=compiled Java code, j=interpreted, Vv=VM code)
+j org.eclipse.swt.internal.gtk.OS._g_main_context_check(IIII)I+0
+j org.eclipse.swt.internal.gtk.OS.g_main_context_check(IIII)I+11
+j org.eclipse.swt.widgets.Display.sleep()Z+326
+j com.google.gwt.dev.GWTShell.sleep()V+4
+j com.google.gwt.dev.GWTShell.pumpEventLoop()V+23
+j com.google.gwt.dev.GWTShell.run()V+23
+j com.google.gwt.dev.GWTShell.main([Ljava/lang/String;)V+20
+v ~StubRoutines::call_stub
+
+--------------- P R O C E S S ---------------
+
+Java Threads: ( => current thread )
+ 0x0a360000 JavaThread "Java2D Disposer" daemon [_thread_blocked, id=9534, stack(0xb3b93000,0xb3be4000)]
+ 0x0a198000 JavaThread "http-8888-Monitor" [_thread_blocked, id=9528, stack(0xb39fe000,0xb3a4f000)]
+ 0x0a196800 JavaThread "http-8888-Processor4" daemon [_thread_blocked, id=9527, stack(0xb3a4f000,0xb3aa0000)]
+ 0x0a195400 JavaThread "http-8888-Processor3" daemon [_thread_in_native, id=9526, stack(0xb3aa0000,0xb3af1000)]
+ 0x0a190400 JavaThread "http-8888-Processor2" daemon [_thread_blocked, id=9525, stack(0xb3af1000,0xb3b42000)]
+ 0x0a18d400 JavaThread "http-8888-Processor1" daemon [_thread_blocked, id=9524, stack(0xb3b42000,0xb3b93000)]
+ 0x0a184000 JavaThread "ContainerBackgroundProcessor[StandardEngine[gwt]]" daemon [_thread_blocked, id=9523, stack(0xb3c7b000,0xb3ccc000)]
+ 0x0a0f8400 JavaThread "Timer-0" daemon [_thread_blocked, id=9437, stack(0xb3c2a000,0xb3c7b000)]
+ 0x09db8400 JavaThread "Low Memory Detector" daemon [_thread_blocked, id=9323, stack(0xb4dec000,0xb4e3d000)]
+ 0x09db5400 JavaThread "CompilerThread0" daemon [_thread_blocked, id=9320, stack(0xb4e3d000,0xb4ebe000)]
+ 0x09db3800 JavaThread "Signal Dispatcher" daemon [_thread_blocked, id=9316, stack(0xb4ebe000,0xb4f0f000)]
+ 0x09da5400 JavaThread "Finalizer" daemon [_thread_blocked, id=9306, stack(0xb511e000,0xb516f000)]
+ 0x09da0800 JavaThread "Reference Handler" daemon [_thread_blocked, id=9299, stack(0xb516f000,0xb51c0000)]
+=>0x09d7a800 JavaThread "main" [_thread_in_native, id=9289, stack(0xb7594000,0xb75e5000)]
+
+Other Threads:
+ 0x09d9ec00 VMThread [stack: 0xb51c0000,0xb5241000] [id=9292]
+ 0x09dba000 WatcherThread [stack: 0xb4d6b000,0xb4dec000] [id=9324]
+
+VM state:not at safepoint (normal execution)
+
+VM Mutex/Monitor currently owned by a thread: None
+
+Heap
+ def new generation total 6016K, used 1210K [0x6f890000, 0x6ff10000, 0x71ff0000)
+ eden space 5376K, 15% used [0x6f890000, 0x6f963d10, 0x6fdd0000)
+ from space 640K, 56% used [0x6fe70000, 0x6fecad30, 0x6ff10000)
+ to space 640K, 0% used [0x6fdd0000, 0x6fdd0000, 0x6fe70000)
+ tenured generation total 79656K, used 62270K [0x71ff0000, 0x76dba000, 0x8f890000)
+ the space 79656K, 78% used [0x71ff0000, 0x75cbfb60, 0x75cbfc00, 0x76dba000)
+ compacting perm gen total 13568K, used 13550K [0x8f890000, 0x905d0000, 0x93890000)
+ the space 13568K, 99% used [0x8f890000, 0x905cbbe8, 0x905cbc00, 0x905d0000)
+ ro space 8192K, 74% used [0x93890000, 0x93e89cc8, 0x93e89e00, 0x94090000)
+ rw space 12288K, 59% used [0x94090000, 0x947a7540, 0x947a7600, 0x94c90000)
+
+Dynamic libraries:
+08048000-08052000 r-xp 00000000 08:01 83627 /usr/lib/jvm/java-6-sun-1.6.0.14/jre/bin/java
+08052000-08053000 rwxp 00009000 08:01 83627 /usr/lib/jvm/java-6-sun-1.6.0.14/jre/bin/java
+09d74000-0a9d8000 rwxp 09d74000 00:00 0 [heap]
+6f890000-6ff10000 rwxp 6f890000 00:00 0
+6ff10000-71ff0000 rwxp 6ff10000 00:00 0
+71ff0000-76dba000 rwxp 71ff0000 00:00 0
+76dba000-8f890000 rwxp 76dba000 00:00 0
+8f890000-905d0000 rwxp 8f890000 00:00 0
+905d0000-93890000 rwxp 905d0000 00:00 0
+93890000-93e8a000 r-xs 00001000 08:01 24875 /usr/lib/jvm/java-6-sun-1.6.0.14/jre/lib/i386/client/classes.jsa
+93e8a000-94090000 rwxp 93e8a000 00:00 0
+94090000-947a8000 rwxp 005fb000 08:01 24875 /usr/lib/jvm/java-6-sun-1.6.0.14/jre/lib/i386/client/classes.jsa
+947a8000-94c90000 rwxp 947a8000 00:00 0
+94c90000-94d6e000 rwxp 00d13000 08:01 24875 /usr/lib/jvm/java-6-sun-1.6.0.14/jre/lib/i386/client/classes.jsa
+94d6e000-95090000 rwxp 94d6e000 00:00 0
+95090000-95098000 r-xs 00df1000 08:01 24875 /usr/lib/jvm/java-6-sun-1.6.0.14/jre/lib/i386/client/classes.jsa
+95098000-95490000 rwxp 95098000 00:00 0
+b037d000-b0384000 r-xs 00111000 08:01 84311 /usr/lib/jvm/java-6-sun-1.6.0.14/jre/lib/resources.jar
+b0384000-b03a5000 r-xp 00000000 08:01 120423 /usr/share/fonts/truetype/ttf-liberation/LiberationSans-Bold.ttf
+b03a5000-b043d000 r-xp 00000000 08:01 42112 /usr/share/fonts/truetype/ttf-dejavu/DejaVuSans.ttf
+b043d000-b045e000 r-xp 00000000 08:01 120771 /usr/share/fonts/truetype/ttf-liberation/LiberationSans-Regular.ttf
+b045e000-b0518000 r-xp 00000000 08:06 133226 /home/kevin/.m2/repository/com/google/gwt/gwt-dev/1.5.3/mozilla-1.7.12/components/libeditor.so
+b0518000-b051c000 rwxp 000b9000 08:06 133226 /home/kevin/.m2/repository/com/google/gwt/gwt-dev/1.5.3/mozilla-1.7.12/components/libeditor.so
+b051c000-b059b000 r-xp 00000000 08:01 83682 /usr/lib/jvm/java-6-sun-1.6.0.14/jre/lib/i386/libfontmanager.so
+b059b000-b05a6000 rwxp 0007e000 08:01 83682 /usr/lib/jvm/java-6-sun-1.6.0.14/jre/lib/i386/libfontmanager.so
+b05a6000-b05aa000 rwxp b05a6000 00:00 0
+b05aa000-b05ed000 r-xp 00000000 08:01 83677 /usr/lib/jvm/java-6-sun-1.6.0.14/jre/lib/i386/xawt/libmawt.so
+b05ed000-b05ef000 rwxp 00043000 08:01 83677 /usr/lib/jvm/java-6-sun-1.6.0.14/jre/lib/i386/xawt/libmawt.so
+b05ef000-b05f0000 rwxp b05ef000 00:00 0
+b05f0000-b0674000 r-xp 00000000 08:01 83674 /usr/lib/jvm/java-6-sun-1.6.0.14/jre/lib/i386/libawt.so
+b0674000-b067b000 rwxp 00084000 08:01 83674 /usr/lib/jvm/java-6-sun-1.6.0.14/jre/lib/i386/libawt.so
+b067b000-b069f000 rwxp b067b000 00:00 0
+b069f000-b06f0000 r-xp 00000000 08:01 42116 /usr/share/fonts/truetype/ttf-dejavu/DejaVuSerif.ttf
+b06f0000-b06f1000 ---p b06f0000 00:00 0
+b06f1000-b0ef1000 rwxp b06f1000 00:00 0
+b0ef1000-b0f25000 r-xp 00000000 08:06 133318 /home/kevin/.m2/repository/com/google/gwt/gwt-dev/1.5.3/mozilla-1.7.12/components/libmork.so
+b0f25000-b0f27000 rwxp 00034000 08:06 133318 /home/kevin/.m2/repository/com/google/gwt/gwt-dev/1.5.3/mozilla-1.7.12/components/libmork.so
+b0f27000-b0f2c000 r-xp 00000000 08:06 133553 /home/kevin/.m2/repository/com/google/gwt/gwt-dev/1.5.3/mozilla-1.7.12/components/libxpcom_compat_c.so
+b0f2c000-b0f2d000 rwxp 00005000 08:06 133553 /home/kevin/.m2/repository/com/google/gwt/gwt-dev/1.5.3/mozilla-1.7.12/components/libxpcom_compat_c.so
+b0f2d000-b0f42000 r-xp 00000000 08:06 133513 /home/kevin/.m2/repository/com/google/gwt/gwt-dev/1.5.3/mozilla-1.7.12/components/libprofile.so
+b0f42000-b0f43000 rwxp 00015000 08:06 133513 /home/kevin/.m2/repository/com/google/gwt/gwt-dev/1.5.3/mozilla-1.7.12/components/libprofile.so
+b0f43000-b0f5d000 r-xp 00000000 08:06 132123 /home/kevin/.m2/repository/com/google/gwt/gwt-dev/1.5.3/mozilla-1.7.12/libxpcom_compat.so
+b0f5d000-b0f5e000 rwxp 0001a000 08:06 132123 /home/kevin/.m2/repository/com/google/gwt/gwt-dev/1.5.3/mozilla-1.7.12/libxpcom_compat.so
+b0f5e000-b0f63000 r-xp 00000000 08:06 133521 /home/kevin/.m2/repository/com/google/gwt/gwt-dev/1.5.3/mozilla-1.7.12/components/libtxmgr.so
+b0f63000-b0f64000 rwxp 00004000 08:06 133521 /home/kevin/.m2/repository/com/google/gwt/gwt-dev/1.5.3/mozilla-1.7.12/components/libtxmgr.so
+b0f64000-b0f67000 r-xs 00035000 08:01 83642 /usr/lib/jvm/java-6-sun-1.6.0.14/jre/lib/ext/sunpkcs11.jar
+b0f67000-b0f6a000 r-xs 000cb000 08:01 115067 /usr/lib/jvm/java-6-sun-1.6.0.14/jre/lib/ext/localedata.jar
+b0f6a000-b0f6c000 r-xs 00001000 08:01 115066 /usr/lib/jvm/java-6-sun-1.6.0.14/jre/lib/ext/dnsns.jar
+b0f6c000-b0f6d000 ---p b0f6c000 00:00 0
+b0f6d000-b176d000 rwxp b0f6d000 00:00 0
+b176d000-b1777000 r-xp 00000000 08:06 133224 /home/kevin/.m2/repository/com/google/gwt/gwt-dev/1.5.3/mozilla-1.7.12/components/libcookie.so
+b1777000-b1778000 rwxp 00009000 08:06 133224 /home/kevin/.m2/repository/com/google/gwt/gwt-dev/1.5.3/mozilla-1.7.12/components/libcookie.so
+b1778000-b1779000 ---p b1778000 00:00 0
+b1779000-b1f79000 rwxp b1779000 00:00 0
+b1f79000-b1f84000 r-xp 00000000 08:06 133297 /home/kevin/.m2/repository/com/google/gwt/gwt-dev/1.5.3/mozilla-1.7.12/components/libjar50.so
+b1f84000-b1f85000 rwxp 0000a000 08:06 133297 /home/kevin/.m2/repository/com/google/gwt/gwt-dev/1.5.3/mozilla-1.7.12/components/libjar50.so
+b1f85000-b1feb000 r-xp 00000000 08:01 2601 /lib/libgcrypt.so.11.4.4
+b1feb000-b1fec000 r-xp 00065000 08:01 2601 /lib/libgcrypt.so.11.4.4
+b1fec000-b1fee000 rwxp 00066000 08:01 2601 /lib/libgcrypt.so.11.4.4
+b1fee000-b1ffe000 r-xp 00000000 08:01 10253 /usr/lib/libtasn1.so.3.0.16
+b1ffe000-b1fff000 r-xp 0000f000 08:01 10253 /usr/lib/libtasn1.so.3.0.16
+b1fff000-b2000000 rwxp 00010000 08:01 10253 /usr/lib/libtasn1.so.3.0.16
+b2000000-b20c3000 r-xp 00000000 08:01 9435 /usr/lib/libasound.so.2.0.0
+b20c3000-b20c5000 r-xp 000c2000 08:01 9435 /usr/lib/libasound.so.2.0.0
+b20c5000-b20c8000 rwxp 000c4000 08:01 9435 /usr/lib/libasound.so.2.0.0
+b20c8000-b20cc000 r-xp 00000000 08:01 9349 /usr/lib/libORBitCosNaming-2.so.0.1.0
+b20cc000-b20cd000 r-xp 00003000 08:01 9349 /usr/lib/libORBitCosNaming-2.so.0.1.0
+b20cd000-b20ce000 rwxp 00004000 08:01 9349 /usr/lib/libORBitCosNaming-2.so.0.1.0
+b20ce000-b20dd000 r-xp 00000000 08:01 9447 /usr/lib/libavahi-client.so.3.2.4
+b20dd000-b20de000 r-xp 0000e000 08:01 9447 /usr/lib/libavahi-client.so.3.2.4
+b20de000-b20df000 rwxp 0000f000 08:01 9447 /usr/lib/libavahi-client.so.3.2.4
+b20df000-b20e9000 r-xp 00000000 08:01 9449 /usr/lib/libavahi-common.so.3.5.0
+b20e9000-b20ea000 r-xp 00009000 08:01 9449 /usr/lib/libavahi-common.so.3.5.0
+b20ea000-b20eb000 rwxp 0000a000 08:01 9449 /usr/lib/libavahi-common.so.3.5.0
+b20eb000-b2182000 r-xp 00000000 08:01 9769 /usr/lib/libgnutls.so.26.4.6
+b2182000-b2187000 r-xp 00097000 08:01 9769 /usr/lib/libgnutls.so.26.4.6
+b2187000-b2188000 rwxp 0009c000 08:01 9769 /usr/lib/libgnutls.so.26.4.6
+b2188000-b22bd000 r-xp 00000000 08:01 10335 /usr/lib/libxml2.so.2.6.32
+b22bd000-b22be000 ---p 00135000 08:01 10335 /usr/lib/libxml2.so.2.6.32
+b22be000-b22c2000 r-xp 00135000 08:01 10335 /usr/lib/libxml2.so.2.6.32
+b22c2000-b22c3000 rwxp 00139000 08:01 10335 /usr/lib/libxml2.so.2.6.32
+b22c3000-b22c4000 rwxp b22c3000 00:00 0
+b22c4000-b22cc000 r-xp 00000000 08:01 2653 /lib/libpopt.so.0.0.0
+b22cc000-b22cd000 r-xp 00007000 08:01 2653 /lib/libpopt.so.0.0.0
+b22cd000-b22ce000 rwxp 00008000 08:01 2653 /lib/libpopt.so.0.0.0
+b22ce000-b22f0000 r-xp 00000000 08:01 9445 /usr/lib/libaudiofile.so.0.0.2
+b22f0000-b22f3000 rwxp 00021000 08:01 9445 /usr/lib/libaudiofile.so.0.0.2
+b22f3000-b22fc000 r-xp 00000000 08:01 9604 /usr/lib/libesd.so.0.2.39
+b22fc000-b22fd000 r-xp 00008000 08:01 9604 /usr/lib/libesd.so.0.2.39
+b22fd000-b22fe000 rwxp 00009000 08:01 9604 /usr/lib/libesd.so.0.2.39
+b22fe000-b2311000 r-xp 00000000 08:01 9472 /usr/lib/libbonobo-activation.so.4.0.0
+b2311000-b2312000 r-xp 00012000 08:01 9472 /usr/lib/libbonobo-activation.so.4.0.0
+b2312000-b2313000 rwxp 00013000 08:01 9472 /usr/lib/libbonobo-activation.so.4.0.0
+b2313000-b2314000 rwxp b2313000 00:00 0
+b2314000-b2366000 r-xp 00000000 08:01 9470 /usr/lib/libbonobo-2.so.0.0.0
+b2366000-b2369000 r-xp 00051000 08:01 9470 /usr/lib/libbonobo-2.so.0.0.0
+b2369000-b2370000 rwxp 00054000 08:01 9470 /usr/lib/libbonobo-2.so.0.0.0
+b2370000-b23c9000 r-xp 00000000 08:01 9763 /usr/lib/libgnomevfs-2.so.0.2400.1
+b23c9000-b23cb000 r-xp 00058000 08:01 9763 /usr/lib/libgnomevfs-2.so.0.2400.1
+b23cb000-b23cc000 rwxp 0005a000 08:01 9763 /usr/lib/libgnomevfs-2.so.0.2400.1
+b23cc000-b23cd000 rwxp b23cc000 00:00 0
+b23cd000-b23e1000 r-xp 00000000 08:01 9733 /usr/lib/libgnome-2.so.0.2600.0
+b23e1000-b23e2000 r-xp 00013000 08:01 9733 /usr/lib/libgnome-2.so.0.2600.0
+b23e2000-b23e3000 rwxp 00014000 08:01 9733 /usr/lib/libgnome-2.so.0.2600.0
+b23e4000-b23eb000 r-xp 00000000 08:06 133495 /home/kevin/.m2/repository/com/google/gwt/gwt-dev/1.5.3/mozilla-1.7.12/components/libp3p.so
+b23eb000-b23ec000 rwxp 00006000 08:06 133495 /home/kevin/.m2/repository/com/google/gwt/gwt-dev/1.5.3/mozilla-1.7.12/components/libp3p.so
+b23ec000-b23f5000 r-xp 00000000 08:01 76354 /usr/share/locale-langpack/fr/LC_MESSAGES/libgnome-2.0.mo
+b23f5000-b24b0000 r-xp 00000000 08:06 133523 /home/kevin/.m2/repository/com/google/gwt/gwt-dev/1.5.3/mozilla-1.7.12/components/libuconv.so
+b24b0000-b24b6000 rwxp 000bb000 08:06 133523 /home/kevin/.m2/repository/com/google/gwt/gwt-dev/1.5.3/mozilla-1.7.12/components/libuconv.so
+b24b6000-b24c0000 rwxp b24b6000 00:00 0
+b24c0000-b2519000 r-xp 00000000 08:06 133285 /home/kevin/.m2/repository/com/google/gwt/gwt-dev/1.5.3/mozilla-1.7.12/components/libhtmlpars.so
+b2519000-b251e000 rwxp 00058000 08:06 133285 /home/kevin/.m2/repository/com/google/gwt/gwt-dev/1.5.3/mozilla-1.7.12/components/libhtmlpars.so
+b251e000-b2535000 r-xp 00000000 08:06 133206 /home/kevin/.m2/repository/com/google/gwt/gwt-dev/1.5.3/mozilla-1.7.12/components/libchrome.so
+b2535000-b2536000 rwxp 00017000 08:06 133206 /home/kevin/.m2/repository/com/google/gwt/gwt-dev/1.5.3/mozilla-1.7.12/components/libchrome.so
+b2536000-b255f000 r-xp 00000000 08:06 133240 /home/kevin/.m2/repository/com/google/gwt/gwt-dev/1.5.3/mozilla-1.7.12/components/libgkplugin.so
+b255f000-b2561000 rwxp 00028000 08:06 133240 /home/kevin/.m2/repository/com/google/gwt/gwt-dev/1.5.3/mozilla-1.7.12/components/libgkplugin.so
+b2561000-b2579000 r-xp 00000000 08:06 133486 /home/kevin/.m2/repository/com/google/gwt/gwt-dev/1.5.3/mozilla-1.7.12/components/liboji.so
+b2579000-b257a000 rwxp 00017000 08:06 133486 /home/kevin/.m2/repository/com/google/gwt/gwt-dev/1.5.3/mozilla-1.7.12/components/liboji.so
+b257a000-b2593000 r-xp 00000000 08:06 132139 /home/kevin/.m2/repository/com/google/gwt/gwt-dev/1.5.3/mozilla-1.7.12/libjsj.so
+b2593000-b2595000 rwxp 00018000 08:06 132139 /home/kevin/.m2/repository/com/google/gwt/gwt-dev/1.5.3/mozilla-1.7.12/libjsj.so
+b2595000-b259c000 r-xp 00000000 08:06 133497 /home/kevin/.m2/repository/com/google/gwt/gwt-dev/1.5.3/mozilla-1.7.12/components/libpipboot.so
+b259c000-b259d000 rwxp 00007000 08:06 133497 /home/kevin/.m2/repository/com/google/gwt/gwt-dev/1.5.3/mozilla-1.7.12/components/libpipboot.so
+b259d000-b2610000 r-xp 00000000 08:06 133176 /home/kevin/.m2/repository/com/google/gwt/gwt-dev/1.5.3/mozilla-1.7.12/components/libappcomps.so
+b2610000-b2613000 rwxp 00073000 08:06 133176 /home/kevin/.m2/repository/com/google/gwt/gwt-dev/1.5.3/mozilla-1.7.12/components/libappcomps.so
+b2613000-b265f000 r-xp 00000000 08:06 133225 /home/kevin/.m2/repository/com/google/gwt/gwt-dev/1.5.3/mozilla-1.7.12/components/libdocshell.so
+b265f000-b2662000 rwxp 0004c000 08:06 133225 /home/kevin/.m2/repository/com/google/gwt/gwt-dev/1.5.3/mozilla-1.7.12/components/libdocshell.so
+b2662000-b2693000 r-xp 00000000 08:06 133238 /home/kevin/.m2/repository/com/google/gwt/gwt-dev/1.5.3/mozilla-1.7.12/components/libgfx_gtk.so
+b2693000-b2695000 rwxp 00031000 08:06 133238 /home/kevin/.m2/repository/com/google/gwt/gwt-dev/1.5.3/mozilla-1.7.12/components/libgfx_gtk.so
+b2695000-b26a6000 r-xp 00000000 08:06 133547 /home/kevin/.m2/repository/com/google/gwt/gwt-dev/1.5.3/mozilla-1.7.12/components/libwebbrwsr.so
+b26a6000-b26a7000 rwxp 00011000 08:06 133547 /home/kevin/.m2/repository/com/google/gwt/gwt-dev/1.5.3/mozilla-1.7.12/components/libwebbrwsr.so
+b26a7000-b26dd000 r-xp 00000000 08:01 74453 /lib/libdbus-1.so.3.4.0
+b26dd000-b26de000 r-xp 00035000 08:01 74453 /lib/libdbus-1.so.3.4.0
+b26de000-b26df000 rwxp 00036000 08:01 74453 /lib/libdbus-1.so.3.4.0
+b26df000-b26fb000 r-xp 00000000 08:01 9550 /usr/lib/libdbus-glib-1.so.2.1.0
+b26fb000-b26fc000 r-xp 0001b000 08:01 9550 /usr/lib/libdbus-glib-1.so.2.1.0
+b26fc000-b26fd000 rwxp 0001c000 08:01 9550 /usr/lib/libdbus-glib-1.so.2.1.0
+b26fd000-b2746000 r-xp 00000000 08:01 9345 /usr/lib/libORBit-2.so.0.1.0
+b2746000-b274e000 r-xp 00049000 08:01 9345 /usr/lib/libORBit-2.so.0.1.0
+b274e000-b2750000 rwxp 00051000 08:01 9345 /usr/lib/libORBit-2.so.0.1.0
+b2750000-b277e000 r-xp 00000000 08:01 9653 /usr/lib/libgconf-2.so.4.1.5
+b277e000-b277f000 ---p 0002e000 08:01 9653 /usr/lib/libgconf-2.so.4.1.5
+b277f000-b2780000 r-xp 0002e000 08:01 9653 /usr/lib/libgconf-2.so.4.1.5
+b2780000-b2782000 rwxp 0002f000 08:01 9653 /usr/lib/libgconf-2.so.4.1.5
+b2782000-b27aa000 r-xp 00000000 08:06 133551 /home/kevin/.m2/repository/com/google/gwt/gwt-dev/1.5.3/mozilla-1.7.12/components/libwidget_gtk2.so
+b27aa000-b27ad000 rwxp 00028000 08:06 133551 /home/kevin/.m2/repository/com/google/gwt/gwt-dev/1.5.3/mozilla-1.7.12/components/libwidget_gtk2.so
+b27ad000-b27b0000 r-xp 00000000 08:01 2688 /lib/libuuid.so.1.2
+b27b0000-b27b1000 r-xp 00002000 08:01 2688 /lib/libuuid.so.1.2
+b27b1000-b27b2000 rwxp 00003000 08:01 2688 /lib/libuuid.so.1.2
+b27b2000-b27c7000 r-xp 00000000 08:01 9322 /usr/lib/libICE.so.6.3.0
+b27c7000-b27c8000 rwxp 00014000 08:01 9322 /usr/lib/libICE.so.6.3.0
+b27c8000-b27ca000 rwxp b27c8000 00:00 0
+b27ca000-b2819000 r-xp 00000000 08:01 9400 /usr/lib/libXt.so.6.0.0
+b2819000-b281a000 r-xp 0004f000 08:01 9400 /usr/lib/libXt.so.6.0.0
+b281a000-b281d000 rwxp 00050000 08:01 9400 /usr/lib/libXt.so.6.0.0
+b281d000-b2820000 r-xp 00000000 08:01 2603 /lib/libgpg-error.so.0.3.0
+b2820000-b2821000 rwxp 00002000 08:01 2603 /lib/libgpg-error.so.0.3.0
+b2821000-b282e000 r-xp 00000000 08:06 133057 /home/kevin/.m2/repository/com/google/gwt/gwt-dev/1.5.3/libgwt-ll.so
+b282e000-b282f000 rwxp 0000c000 08:06 133057 /home/kevin/.m2/repository/com/google/gwt/gwt-dev/1.5.3/libgwt-ll.so
+b282f000-b2842000 r-xp 00000000 08:06 133303 /home/kevin/.m2/repository/com/google/gwt/gwt-dev/1.5.3/mozilla-1.7.12/components/libjsd.so
+b2842000-b2843000 rwxp 00013000 08:06 133303 /home/kevin/.m2/repository/com/google/gwt/gwt-dev/1.5.3/mozilla-1.7.12/components/libjsd.so
+b2843000-b286c000 r-xp 00000000 08:06 133514 /home/kevin/.m2/repository/com/google/gwt/gwt-dev/1.5.3/mozilla-1.7.12/components/librdf.so
+b286c000-b286e000 rwxp 00028000 08:06 133514 /home/kevin/.m2/repository/com/google/gwt/gwt-dev/1.5.3/mozilla-1.7.12/components/librdf.so
+b286e000-b289b000 r-xp 00000000 08:06 133288 /home/kevin/.m2/repository/com/google/gwt/gwt-dev/1.5.3/mozilla-1.7.12/components/libimglib2.so
+b289b000-b289c000 rwxp 0002d000 08:06 133288 /home/kevin/.m2/repository/com/google/gwt/gwt-dev/1.5.3/mozilla-1.7.12/components/libimglib2.so
+b289c000-b28d4000 r-xp 00000000 08:06 133287 /home/kevin/.m2/repository/com/google/gwt/gwt-dev/1.5.3/mozilla-1.7.12/components/libi18n.so
+b28d4000-b28d7000 rwxp 00037000 08:06 133287 /home/kevin/.m2/repository/com/google/gwt/gwt-dev/1.5.3/mozilla-1.7.12/components/libi18n.so
+b28d7000-b28d8000 ---p b28d7000 00:00 0
+b28d8000-b30d8000 rwxp b28d8000 00:00 0
+b30d8000-b311c000 r-xp 00000000 08:06 133554 /home/kevin/.m2/repository/com/google/gwt/gwt-dev/1.5.3/mozilla-1.7.12/components/libxpconnect.so
+b311c000-b311f000 rwxp 00043000 08:06 133554 /home/kevin/.m2/repository/com/google/gwt/gwt-dev/1.5.3/mozilla-1.7.12/components/libxpconnect.so
+b311f000-b3120000 rwxp b311f000 00:00 0
+b3120000-b3135000 r-xp 00000000 08:06 133203 /home/kevin/.m2/repository/com/google/gwt/gwt-dev/1.5.3/mozilla-1.7.12/components/libcaps.so
+b3135000-b3136000 rwxp 00014000 08:06 133203 /home/kevin/.m2/repository/com/google/gwt/gwt-dev/1.5.3/mozilla-1.7.12/components/libcaps.so
+b3136000-b3148000 r-xp 00000000 08:01 9380 /usr/lib/libXft.so.2.1.13
+b3148000-b3149000 r-xp 00011000 08:01 9380 /usr/lib/libXft.so.2.1.13
+b3149000-b314a000 rwxp 00012000 08:01 9380 /usr/lib/libXft.so.2.1.13
+b314a000-b3155000 r-xp 00000000 08:01 10088 /usr/lib/libpangox-1.0.so.0.2400.1
+b3155000-b3156000 r-xp 0000a000 08:01 10088 /usr/lib/libpangox-1.0.so.0.2400.1
+b3156000-b3157000 rwxp 0000b000 08:01 10088 /usr/lib/libpangox-1.0.so.0.2400.1
+b3157000-b3159000 r-xp 00000000 08:01 6211 /lib/tls/i686/cmov/libutil-2.9.so
+b3159000-b315a000 r-xp 00001000 08:01 6211 /lib/tls/i686/cmov/libutil-2.9.so
+b315a000-b315b000 rwxp 00002000 08:01 6211 /lib/tls/i686/cmov/libutil-2.9.so
+b315b000-b3162000 r-xp 00000000 08:01 9353 /usr/lib/libSM.so.6.0.0
+b3162000-b3163000 r-xp 00006000 08:01 9353 /usr/lib/libSM.so.6.0.0
+b3163000-b3164000 rwxp 00007000 08:01 9353 /usr/lib/libSM.so.6.0.0
+b3164000-b3168000 r-xp 00000000 08:06 132140 /home/kevin/.m2/repository/com/google/gwt/gwt-dev/1.5.3/mozilla-1.7.12/libgtkxtbin.so
+b3168000-b3169000 rwxp 00003000 08:06 132140 /home/kevin/.m2/repository/com/google/gwt/gwt-dev/1.5.3/mozilla-1.7.12/libgtkxtbin.so
+b3169000-b35e5000 r-xp 00000000 08:06 133239 /home/kevin/.m2/repository/com/google/gwt/gwt-dev/1.5.3/mozilla-1.7.12/components/libgklayout.so
+b35e5000-b3620000 rwxp 0047c000 08:06 133239 /home/kevin/.m2/repository/com/google/gwt/gwt-dev/1.5.3/mozilla-1.7.12/components/libgklayout.so
+b3620000-b3626000 rwxp b3620000 00:00 0
+b3626000-b36eb000 r-xp 00000000 08:06 133466 /home/kevin/.m2/repository/com/google/gwt/gwt-dev/1.5.3/mozilla-1.7.12/components/libnecko.so
+b36eb000-b36f1000 rwxp 000c4000 08:06 133466 /home/kevin/.m2/repository/com/google/gwt/gwt-dev/1.5.3/mozilla-1.7.12/components/libnecko.so
+b36f1000-b36fd000 r-xp 00000000 08:06 132136 /home/kevin/.m2/repository/com/google/gwt/gwt-dev/1.5.3/mozilla-1.7.12/libmozz.so
+b36fd000-b36ff000 rwxp 0000b000 08:06 132136 /home/kevin/.m2/repository/com/google/gwt/gwt-dev/1.5.3/mozilla-1.7.12/libmozz.so
+b36ff000-b3710000 r-xp 00000000 08:06 133512 /home/kevin/.m2/repository/com/google/gwt/gwt-dev/1.5.3/mozilla-1.7.12/components/libpref.so
+b3710000-b3711000 rwxp 00011000 08:06 133512 /home/kevin/.m2/repository/com/google/gwt/gwt-dev/1.5.3/mozilla-1.7.12/components/libpref.so
+b3711000-b37f5000 r-xp 00000000 08:01 10246 /usr/lib/libstdc++.so.6.0.10
+b37f5000-b37f9000 r-xp 000e3000 08:01 10246 /usr/lib/libstdc++.so.6.0.10
+b37f9000-b37fa000 rwxp 000e7000 08:01 10246 /usr/lib/libstdc++.so.6.0.10
+b37fa000-b3800000 rwxp b37fa000 00:00 0
+b3800000-b386d000 rwxp b3800000 00:00 0
+b386d000-b3900000 ---p b386d000 00:00 0
+b3900000-b3903000 r-xs 00027000 08:01 115065 /usr/lib/jvm/java-6-sun-1.6.0.14/jre/lib/ext/sunjce_provider.jar
+b3903000-b3908000 r-xp 00000000 08:06 133517 /home/kevin/.m2/repository/com/google/gwt/gwt-dev/1.5.3/mozilla-1.7.12/components/libsystem-pref.so
+b3908000-b3909000 rwxp 00005000 08:06 133517 /home/kevin/.m2/repository/com/google/gwt/gwt-dev/1.5.3/mozilla-1.7.12/components/libsystem-pref.so
+b3909000-b3918000 r-xp 00000000 08:06 133522 /home/kevin/.m2/repository/com/google/gwt/gwt-dev/1.5.3/mozilla-1.7.12/components/libtypeaheadfind.so
+b3918000-b3919000 rwxp 0000e000 08:06 133522 /home/kevin/.m2/repository/com/google/gwt/gwt-dev/1.5.3/mozilla-1.7.12/components/libtypeaheadfind.so
+b3919000-b3944000 r-xp 00000000 08:06 133233 /home/kevin/.m2/repository/com/google/gwt/gwt-dev/1.5.3/mozilla-1.7.12/components/libembedcomponents.so
+b3944000-b3946000 rwxp 0002a000 08:06 133233 /home/kevin/.m2/repository/com/google/gwt/gwt-dev/1.5.3/mozilla-1.7.12/components/libembedcomponents.so
+b3946000-b39c4000 r-xp 00000000 08:06 132137 /home/kevin/.m2/repository/com/google/gwt/gwt-dev/1.5.3/mozilla-1.7.12/libmozjs.so
+b39c4000-b39c8000 rwxp 0007e000 08:06 132137 /home/kevin/.m2/repository/com/google/gwt/gwt-dev/1.5.3/mozilla-1.7.12/libmozjs.so
+b39c8000-b39e9000 r-xp 00000000 08:06 132142 /home/kevin/.m2/repository/com/google/gwt/gwt-dev/1.5.3/mozilla-1.7.12/libgkgfx.so
+b39e9000-b39ea000 rwxp 00021000 08:06 132142 /home/kevin/.m2/repository/com/google/gwt/gwt-dev/1.5.3/mozilla-1.7.12/libgkgfx.so
+b39ea000-b39fd000 r-xp 00000000 08:06 133053 /home/kevin/.m2/repository/com/google/gwt/gwt-dev/1.5.3/libswt-mozilla-gtk-3235.so
+b39fd000-b39fe000 rwxp 00012000 08:06 133053 /home/kevin/.m2/repository/com/google/gwt/gwt-dev/1.5.3/libswt-mozilla-gtk-3235.so
+b39fe000-b3a01000 ---p b39fe000 00:00 0
+b3a01000-b3a4f000 rwxp b3a01000 00:00 0
+b3a4f000-b3a52000 ---p b3a4f000 00:00 0
+b3a52000-b3aa0000 rwxp b3a52000 00:00 0
+b3aa0000-b3aa3000 ---p b3aa0000 00:00 0
+b3aa3000-b3af1000 rwxp b3aa3000 00:00 0
+b3af1000-b3af4000 ---p b3af1000 00:00 0
+b3af4000-b3b42000 rwxp b3af4000 00:00 0
+b3b42000-b3b45000 ---p b3b42000 00:00 0
+b3b45000-b3b93000 rwxp b3b45000 00:00 0
+b3b93000-b3b96000 ---p b3b93000 00:00 0
+b3b96000-b3be4000 rwxp b3b96000 00:00 0
+b3be4000-b3bf6000 r-xp 00000000 08:01 6205 /lib/tls/i686/cmov/libresolv-2.9.so
+b3bf6000-b3bf7000 r-xp 00011000 08:01 6205 /lib/tls/i686/cmov/libresolv-2.9.so
+b3bf7000-b3bf8000 rwxp 00012000 08:01 6205 /lib/tls/i686/cmov/libresolv-2.9.so
+b3bf8000-b3bfa000 rwxp b3bf8000 00:00 0
+b3bfa000-b3bff000 r-xp 00000000 08:01 6192 /lib/tls/i686/cmov/libnss_dns-2.9.so
+b3bff000-b3c00000 r-xp 00004000 08:01 6192 /lib/tls/i686/cmov/libnss_dns-2.9.so
+b3c00000-b3c01000 rwxp 00005000 08:01 6192 /lib/tls/i686/cmov/libnss_dns-2.9.so
+b3c01000-b3c03000 r-xp 00000000 08:01 2629 /lib/libnss_mdns4_minimal.so.2
+b3c03000-b3c04000 rwxp 00001000 08:01 2629 /lib/libnss_mdns4_minimal.so.2
+b3c04000-b3c06000 r-xp 00000000 08:01 9453 /usr/lib/libavahi-glib.so.1.0.1
+b3c06000-b3c07000 r-xp 00001000 08:01 9453 /usr/lib/libavahi-glib.so.1.0.1
+b3c07000-b3c08000 rwxp 00002000 08:01 9453 /usr/lib/libavahi-glib.so.1.0.1
+b3c08000-b3c0e000 r-xp 00000000 08:01 10090 /usr/lib/libpangoxft-1.0.so.0.2400.1
+b3c0e000-b3c0f000 r-xp 00005000 08:01 10090 /usr/lib/libpangoxft-1.0.so.0.2400.1
+b3c0f000-b3c10000 rwxp 00006000 08:01 10090 /usr/lib/libpangoxft-1.0.so.0.2400.1
+b3c10000-b3c15000 r-xp 00000000 08:06 133051 /home/kevin/.m2/repository/com/google/gwt/gwt-dev/1.5.3/libswt-mozilla17-profile-gtk-3235.so
+b3c15000-b3c16000 rwxp 00004000 08:06 133051 /home/kevin/.m2/repository/com/google/gwt/gwt-dev/1.5.3/libswt-mozilla17-profile-gtk-3235.so
+b3c16000-b3c29000 r-xp 00000000 08:01 83663 /usr/lib/jvm/java-6-sun-1.6.0.14/jre/lib/i386/libnet.so
+b3c29000-b3c2a000 rwxp 00013000 08:01 83663 /usr/lib/jvm/java-6-sun-1.6.0.14/jre/lib/i386/libnet.so
+b3c2a000-b3c2d000 ---p b3c2a000 00:00 0
+b3c2d000-b3c7b000 rwxp b3c2d000 00:00 0
+b3c7b000-b3c7e000 ---p b3c7b000 00:00 0
+b3c7e000-b3ccc000 rwxp b3c7e000 00:00 0
+b3ccc000-b3d2c000 rwxs 00000000 00:09 8486940 /SYSV00000000 (deleted)
+b3d2c000-b3dc4000 r-xp 00000000 08:01 42112 /usr/share/fonts/truetype/ttf-dejavu/DejaVuSans.ttf
+b3dc4000-b3dc6000 r-xp 00000000 08:01 18012 /usr/lib/pango/1.6.0/modules/pango-basic-fc.so
+b3dc6000-b3dc7000 r-xp 00001000 08:01 18012 /usr/lib/pango/1.6.0/modules/pango-basic-fc.so
+b3dc7000-b3dc8000 rwxp 00002000 08:01 18012 /usr/lib/pango/1.6.0/modules/pango-basic-fc.so
+b3dc8000-b3dce000 r-xs 00000000 08:01 107678 /var/cache/fontconfig/945677eb7aeaf62f1d50efc3fb3ec7d8-x86.cache-2
+b3dce000-b3dd1000 r-xs 00000000 08:01 107687 /var/cache/fontconfig/e383d7ea5fbe662a33d9b44caf393297-x86.cache-2
+b3dd1000-b3dd4000 r-xs 00000000 08:01 122740 /var/cache/fontconfig/6eb3985aa4124903f6ff08ba781cd364-x86.cache-2
+b3dd4000-b3dd5000 r-xs 00000000 08:01 107673 /var/cache/fontconfig/4c73fe0c47614734b17d736dbde7580a-x86.cache-2
+b3dd5000-b3dd8000 r-xs 00000000 08:01 107679 /var/cache/fontconfig/a755afe4a08bf5b97852ceb7400b47bc-x86.cache-2
+b3dd8000-b3ddb000 r-xs 00000000 08:01 107675 /var/cache/fontconfig/6d41288fd70b0be22e8c3a91e032eec0-x86.cache-2
+b3ddb000-b3dde000 r-xs 00000000 08:01 107685 /var/cache/fontconfig/de156ccd2eddbdc19d37a45b8b2aac9c-x86.cache-2
+b3dde000-b3de6000 r-xs 00000000 08:01 107688 /var/cache/fontconfig/e3de0de479f42330eadf588a55fb5bf4-x86.cache-2
+b3de6000-b3df1000 r-xs 00000000 08:01 107668 /var/cache/fontconfig/0f34bcd4b6ee430af32735b75db7f02b-x86.cache-2
+b3df1000-b3df3000 r-xs 00000000 08:01 107684 /var/cache/fontconfig/ddd4086aec35a5275babba44bb759c3c-x86.cache-2
+b3df3000-b3df4000 r-xs 00000000 08:01 107671 /var/cache/fontconfig/4794a0821666d79190d59a36cb4f44b5-x86.cache-2
+b3df4000-b3dfb000 r-xs 00000000 08:01 107682 /var/cache/fontconfig/d52a8644073d54c13679302ca1180695-x86.cache-2
+b3dfb000-b3e01000 r-xs 00000000 08:01 107667 /var/cache/fontconfig/089dead882dea3570ffc31a9898cfb69-x86.cache-2
+b3e01000-b3e0e000 r-xs 00000000 08:01 163217 /var/cache/fontconfig/e13b20fdb08344e0e664864cc2ede53d-x86.cache-2
+b3e0e000-b3e10000 r-xs 00000000 08:01 122742 /var/cache/fontconfig/7ef2298fde41cc6eeb7af42e48b7d293-x86.cache-2
+b3e10000-b3e1e000 r-xs 00000000 08:01 163215 /var/cache/fontconfig/865f88548240fee46819705c6468c165-x86.cache-2
+b3e1e000-b3e29000 r-xp 00000000 08:01 76265 /usr/share/locale-langpack/fr/LC_MESSAGES/glib20.mo
+b3e29000-b3e4f000 r-xp 00000000 08:06 133056 /home/kevin/.m2/repository/com/google/gwt/gwt-dev/1.5.3/libswt-gtk-3235.so
+b3e4f000-b3e51000 rwxp 00025000 08:06 133056 /home/kevin/.m2/repository/com/google/gwt/gwt-dev/1.5.3/libswt-gtk-3235.so
+b3e51000-b3e52000 rwxp b3e51000 00:00 0
+b3e52000-b3e7a000 r-xp 00000000 08:01 12656 /usr/lib/gtk-2.0/2.10.0/engines/libclearlooks.so
+b3e7a000-b3e7b000 r-xp 00027000 08:01 12656 /usr/lib/gtk-2.0/2.10.0/engines/libclearlooks.so
+b3e7b000-b3e7c000 rwxp 00028000 08:01 12656 /usr/lib/gtk-2.0/2.10.0/engines/libclearlooks.so
+b3e7c000-b3e9e000 r-xp 00000000 08:01 76349 /usr/share/locale-langpack/fr/LC_MESSAGES/libc.mo
+b3e9e000-b3ea5000 r-xp 00000000 08:01 9982 /usr/lib/libltdl.so.7.2.0
+b3ea5000-b3ea6000 r-xp 00006000 08:01 9982 /usr/lib/libltdl.so.7.2.0
+b3ea6000-b3ea7000 rwxp 00007000 08:01 9982 /usr/lib/libltdl.so.7.2.0
+b3ea7000-b3eb3000 r-xp 00000000 08:01 10255 /usr/lib/libtdb.so.1.1.3
+b3eb3000-b3eb4000 r-xp 0000b000 08:01 10255 /usr/lib/libtdb.so.1.1.3
+b3eb4000-b3eb5000 rwxp 0000c000 08:01 10255 /usr/lib/libtdb.so.1.1.3
+b3eb5000-b3eb9000 r-xp 00000000 08:01 10062 /usr/lib/libogg.so.0.5.3
+b3eb9000-b3eba000 r-xp 00003000 08:01 10062 /usr/lib/libogg.so.0.5.3
+b3eba000-b3ebb000 rwxp 00004000 08:01 10062 /usr/lib/libogg.so.0.5.3
+b3ebb000-b3ed6000 r-xp 00000000 08:01 10296 /usr/lib/libvorbis.so.0.4.0
+b3ed6000-b3ed7000 r-xp 0001a000 08:01 10296 /usr/lib/libvorbis.so.0.4.0
+b3ed7000-b3ee5000 rwxp 0001b000 08:01 10296 /usr/lib/libvorbis.so.0.4.0
+b3ee5000-b3eec000 r-xp 00000000 08:01 10300 /usr/lib/libvorbisfile.so.3.2.0
+b3eec000-b3eed000 r-xp 00006000 08:01 10300 /usr/lib/libvorbisfile.so.3.2.0
+b3eed000-b3eee000 rwxp 00007000 08:01 10300 /usr/lib/libvorbisfile.so.3.2.0
+b3eee000-b3efb000 r-xp 00000000 08:01 9496 /usr/lib/libcanberra.so.0.1.4
+b3efb000-b3efc000 r-xp 0000d000 08:01 9496 /usr/lib/libcanberra.so.0.1.4
+b3efc000-b3efd000 rwxp 0000e000 08:01 9496 /usr/lib/libcanberra.so.0.1.4
+b3efd000-b3f00000 r-xp 00000000 08:01 9494 /usr/lib/libcanberra-gtk.so.0.0.4
+b3f00000-b3f01000 r-xp 00002000 08:01 9494 /usr/lib/libcanberra-gtk.so.0.0.4
+b3f01000-b3f02000 rwxp 00003000 08:01 9494 /usr/lib/libcanberra-gtk.so.0.0.4
+b3f03000-b3f05000 r-xp 00000000 08:01 11971 /usr/lib/gconv/UTF-16.so
+b3f05000-b3f06000 r-xp 00001000 08:01 11971 /usr/lib/gconv/UTF-16.so
+b3f06000-b3f07000 rwxp 00002000 08:01 11971 /usr/lib/gconv/UTF-16.so
+b3f07000-b3f08000 r-xp 00000000 08:01 12672 /usr/lib/gtk-2.0/2.10.0/immodules/im-cedilla.so
+b3f08000-b3f09000 r-xp 00000000 08:01 12672 /usr/lib/gtk-2.0/2.10.0/immodules/im-cedilla.so
+b3f09000-b3f0a000 rwxp 00001000 08:01 12672 /usr/lib/gtk-2.0/2.10.0/immodules/im-cedilla.so
+b3f0a000-b3f12000 r-xp 00000000 08:01 12664 /usr/lib/gtk-2.0/2.10.0/engines/libpixmap.so
+b3f12000-b3f13000 r-xp 00007000 08:01 12664 /usr/lib/gtk-2.0/2.10.0/engines/libpixmap.so
+b3f13000-b3f14000 rwxp 00008000 08:01 12664 /usr/lib/gtk-2.0/2.10.0/engines/libpixmap.so
+b3f14000-b3f18000 r-xp 00000000 08:01 12710 /usr/lib/gtk-2.0/modules/libcanberra-gtk-module.so
+b3f18000-b3f19000 r-xp 00003000 08:01 12710 /usr/lib/gtk-2.0/modules/libcanberra-gtk-module.so
+b3f19000-b3f1a000 rwxp 00004000 08:01 12710 /usr/lib/gtk-2.0/modules/libcanberra-gtk-module.so
+b3f1a000-b3f42000 r-xp 00000000 08:01 76309 /usr/share/locale-langpack/fr/LC_MESSAGES/gtk20-properties.mo
+b3f42000-b402d000 r-xp 00000000 08:01 13735 /usr/lib/locale/fr_FR.utf8/LC_COLLATE
+b402d000-b403a000 r-xp 00000000 08:01 2599 /lib/libgcc_s.so.1
+b403a000-b403b000 r-xp 0000c000 08:01 2599 /lib/libgcc_s.so.1
+b403b000-b403c000 rwxp 0000d000 08:01 2599 /lib/libgcc_s.so.1
+b403c000-b40ec000 r-xp 00000000 08:01 163682 /usr/lib/libstdc++.so.5.0.7
+b40ec000-b40f1000 rwxp 000af000 08:01 163682 /usr/lib/libstdc++.so.5.0.7
+b40f1000-b40f6000 rwxp b40f1000 00:00 0
+b40f6000-b40f7000 r-xp b40f6000 00:00 0
+b40f7000-b4108000 r-xp 00000000 08:01 76310 /usr/share/locale-langpack/fr/LC_MESSAGES/gtk20.mo
+b4108000-b41ba000 r-xp 00000000 08:06 132124 /home/kevin/.m2/repository/com/google/gwt/gwt-dev/1.5.3/mozilla-1.7.12/libxpcom.so
+b41ba000-b41c0000 rwxp 000b2000 08:06 132124 /home/kevin/.m2/repository/com/google/gwt/gwt-dev/1.5.3/mozilla-1.7.12/libxpcom.so
+b41c0000-b41f1000 r-xp 00000000 08:06 132134 /home/kevin/.m2/repository/com/google/gwt/gwt-dev/1.5.3/mozilla-1.7.12/libnspr4.so
+b41f1000-b41f3000 rwxp 00031000 08:06 132134 /home/kevin/.m2/repository/com/google/gwt/gwt-dev/1.5.3/mozilla-1.7.12/libnspr4.so
+b41f3000-b41f4000 rwxp b41f3000 00:00 0
+b41f4000-b41f8000 r-xp 00000000 08:01 9372 /usr/lib/libXdmcp.so.6.0.0
+b41f8000-b41f9000 rwxp 00003000 08:01 9372 /usr/lib/libXdmcp.so.6.0.0
+b41f9000-b421d000 r-xp 00000000 08:01 9618 /usr/lib/libexpat.so.1.5.2
+b421d000-b421f000 r-xp 00023000 08:01 9618 /usr/lib/libexpat.so.1.5.2
+b421f000-b4220000 rwxp 00025000 08:01 9618 /usr/lib/libexpat.so.1.5.2
+b4220000-b4238000 r-xp 00000000 08:01 2663 /lib/libselinux.so.1
+b4238000-b4239000 r-xp 00017000 08:01 2663 /lib/libselinux.so.1
+b4239000-b423a000 rwxp 00018000 08:01 2663 /lib/libselinux.so.1
+b423a000-b4240000 r-xp 00000000 08:01 81186 /usr/lib/libxcb-render.so.0.0.0
+b4240000-b4241000 r-xp 00005000 08:01 81186 /usr/lib/libxcb-render.so.0.0.0
+b4241000-b4242000 rwxp 00006000 08:01 81186 /usr/lib/libxcb-render.so.0.0.0
+b4242000-b4245000 r-xp 00000000 08:01 10325 /usr/lib/libxcb-render-util.so.0.0.0
+b4245000-b4246000 r-xp 00002000 08:01 10325 /usr/lib/libxcb-render-util.so.0.0.0
+b4246000-b4247000 rwxp 00003000 08:01 10325 /usr/lib/libxcb-render-util.so.0.0.0
+b4247000-b426b000 r-xp 00000000 08:01 10116 /usr/lib/libpng12.so.0.27.0
+b426b000-b426c000 r-xp 00023000 08:01 10116 /usr/lib/libpng12.so.0.27.0
+b426c000-b426d000 rwxp 00024000 08:01 10116 /usr/lib/libpng12.so.0.27.0
+b426d000-b4280000 r-xp 00000000 08:01 9558 /usr/lib/libdirect-1.0.so.0.1.0
+b4280000-b4281000 r-xp 00012000 08:01 9558 /usr/lib/libdirect-1.0.so.0.1.0
+b4281000-b4282000 rwxp 00013000 08:01 9558 /usr/lib/libdirect-1.0.so.0.1.0
+b4282000-b4289000 r-xp 00000000 08:01 9640 /usr/lib/libfusion-1.0.so.0.1.0
+b4289000-b428a000 r-xp 00006000 08:01 9640 /usr/lib/libfusion-1.0.so.0.1.0
+b428a000-b428b000 rwxp 00007000 08:01 9640 /usr/lib/libfusion-1.0.so.0.1.0
+b428b000-b42ef000 r-xp 00000000 08:01 9560 /usr/lib/libdirectfb-1.0.so.0.1.0
+b42ef000-b42f0000 r-xp 00063000 08:01 9560 /usr/lib/libdirectfb-1.0.so.0.1.0
+b42f0000-b42f1000 rwxp 00064000 08:01 9560 /usr/lib/libdirectfb-1.0.so.0.1.0
+b42f1000-b4331000 r-xp 00000000 08:01 10110 /usr/lib/libpixman-1.so.0.13.2
+b4331000-b4333000 r-xp 0003f000 08:01 10110 /usr/lib/libpixman-1.so.0.13.2
+b4333000-b4334000 rwxp 00041000 08:01 10110 /usr/lib/libpixman-1.so.0.13.2
+b4334000-b434c000 r-xp 00000000 08:01 33944 /usr/lib/libxcb.so.1.1.0
+b434c000-b434d000 r-xp 00017000 08:01 33944 /usr/lib/libxcb.so.1.1.0
+b434d000-b434e000 rwxp 00018000 08:01 33944 /usr/lib/libxcb.so.1.1.0
+b434e000-b4350000 r-xp 00000000 08:01 9361 /usr/lib/libXau.so.6.0.0
+b4350000-b4351000 r-xp 00001000 08:01 9361 /usr/lib/libXau.so.6.0.0
+b4351000-b4352000 rwxp 00002000 08:01 9361 /usr/lib/libXau.so.6.0.0
+b4352000-b4382000 r-xp 00000000 08:01 2649 /lib/libpcre.so.3.12.1
+b4382000-b4383000 r-xp 0002f000 08:01 2649 /lib/libpcre.so.3.12.1
+b4383000-b4384000 rwxp 00030000 08:01 2649 /lib/libpcre.so.3.12.1
+b4384000-b443a000 r-xp 00000000 08:01 9717 /usr/lib/libglib-2.0.so.0.2000.1
+b443a000-b443b000 r-xp 000b5000 08:01 9717 /usr/lib/libglib-2.0.so.0.2000.1
+b443b000-b443c000 rwxp 000b6000 08:01 9717 /usr/lib/libglib-2.0.so.0.2000.1
+b443c000-b443f000 r-xp 00000000 08:01 9729 /usr/lib/libgmodule-2.0.so.0.2000.1
+b443f000-b4440000 r-xp 00002000 08:01 9729 /usr/lib/libgmodule-2.0.so.0.2000.1
+b4440000-b4441000 rwxp 00003000 08:01 9729 /usr/lib/libgmodule-2.0.so.0.2000.1
+b4441000-b447d000 r-xp 00000000 08:01 9771 /usr/lib/libgobject-2.0.so.0.2000.1
+b447d000-b447e000 r-xp 0003b000 08:01 9771 /usr/lib/libgobject-2.0.so.0.2000.1
+b447e000-b447f000 rwxp 0003c000 08:01 9771 /usr/lib/libgobject-2.0.so.0.2000.1
+b447f000-b44aa000 r-xp 00000000 08:01 9628 /usr/lib/libfontconfig.so.1.3.0
+b44aa000-b44ab000 r-xp 0002a000 08:01 9628 /usr/lib/libfontconfig.so.1.3.0
+b44ab000-b44ac000 rwxp 0002b000 08:01 9628 /usr/lib/libfontconfig.so.1.3.0
+b44ac000-b44c0000 r-xp 00000000 08:01 2695 /lib/libz.so.1.2.3.3
+b44c0000-b44c1000 r-xp 00013000 08:01 2695 /lib/libz.so.1.2.3.3
+b44c1000-b44c2000 rwxp 00014000 08:01 2695 /lib/libz.so.1.2.3.3
+b44c2000-b4534000 r-xp 00000000 08:01 6233 /usr/lib/libfreetype.so.6.3.20
+b4534000-b4538000 r-xp 00071000 08:01 6233 /usr/lib/libfreetype.so.6.3.20
+b4538000-b4539000 rwxp 00075000 08:01 6233 /usr/lib/libfreetype.so.6.3.20
+b4539000-b4579000 r-xp 00000000 08:01 10080 /usr/lib/libpango-1.0.so.0.2400.1
+b4579000-b457a000 ---p 00040000 08:01 10080 /usr/lib/libpango-1.0.so.0.2400.1
+b457a000-b457b000 r-xp 00040000 08:01 10080 /usr/lib/libpango-1.0.so.0.2400.1
+b457b000-b457c000 rwxp 00041000 08:01 10080 /usr/lib/libpango-1.0.so.0.2400.1
+b457c000-b45a3000 r-xp 00000000 08:01 10084 /usr/lib/libpangoft2-1.0.so.0.2400.1
+b45a3000-b45a4000 r-xp 00026000 08:01 10084 /usr/lib/libpangoft2-1.0.so.0.2400.1
+b45a4000-b45a5000 rwxp 00027000 08:01 10084 /usr/lib/libpangoft2-1.0.so.0.2400.1
+b45a5000-b4610000 r-xp 00000000 08:01 9709 /usr/lib/libgio-2.0.so.0.2000.1
+b4610000-b4611000 ---p 0006b000 08:01 9709 /usr/lib/libgio-2.0.so.0.2000.1
+b4611000-b4612000 r-xp 0006b000 08:01 9709 /usr/lib/libgio-2.0.so.0.2000.1
+b4612000-b4613000 rwxp 0006c000 08:01 9709 /usr/lib/libgio-2.0.so.0.2000.1
+b4613000-b468a000 r-xp 00000000 08:01 9486 /usr/lib/libcairo.so.2.10800.6
+b468a000-b468c000 r-xp 00076000 08:01 9486 /usr/lib/libcairo.so.2.10800.6
+b468c000-b468d000 rwxp 00078000 08:01 9486 /usr/lib/libcairo.so.2.10800.6
+b468d000-b46a6000 r-xp 00000000 08:01 9441 /usr/lib/libatk-1.0.so.0.2609.1
+b46a6000-b46a7000 r-xp 00019000 08:01 9441 /usr/lib/libatk-1.0.so.0.2609.1
+b46a7000-b46a8000 rwxp 0001a000 08:01 9441 /usr/lib/libatk-1.0.so.0.2609.1
+b46a8000-b46ac000 r-xp 00000000 08:01 9376 /usr/lib/libXfixes.so.3.1.0
+b46ac000-b46ad000 rwxp 00003000 08:01 9376 /usr/lib/libXfixes.so.3.1.0
+b46ad000-b46af000 r-xp 00000000 08:01 9370 /usr/lib/libXdamage.so.1.1.0
+b46af000-b46b0000 rwxp 00001000 08:01 9370 /usr/lib/libXdamage.so.1.1.0
+b46b0000-b479a000 r-xp 00000000 08:01 9355 /usr/lib/libX11.so.6.2.0
+b479a000-b479b000 ---p 000ea000 08:01 9355 /usr/lib/libX11.so.6.2.0
+b479b000-b479c000 r-xp 000ea000 08:01 9355 /usr/lib/libX11.so.6.2.0
+b479c000-b479e000 rwxp 000eb000 08:01 9355 /usr/lib/libX11.so.6.2.0
+b479e000-b479f000 rwxp b479e000 00:00 0
+b479f000-b47a9000 r-xp 00000000 08:01 10082 /usr/lib/libpangocairo-1.0.so.0.2400.1
+b47a9000-b47aa000 r-xp 00009000 08:01 10082 /usr/lib/libpangocairo-1.0.so.0.2400.1
+b47aa000-b47ab000 rwxp 0000a000 08:01 10082 /usr/lib/libpangocairo-1.0.so.0.2400.1
+b47ab000-b47c3000 r-xp 00000000 08:01 9674 /usr/lib/libgdk_pixbuf-2.0.so.0.1600.1
+b47c3000-b47c4000 r-xp 00017000 08:01 9674 /usr/lib/libgdk_pixbuf-2.0.so.0.1600.1
+b47c4000-b47c5000 rwxp 00018000 08:01 9674 /usr/lib/libgdk_pixbuf-2.0.so.0.1600.1
+b47c5000-b47cd000 r-xp 00000000 08:01 9368 /usr/lib/libXcursor.so.1.0.2
+b47cd000-b47ce000 rwxp 00007000 08:01 9368 /usr/lib/libXcursor.so.1.0.2
+b47ce000-b47d4000 r-xp 00000000 08:01 9394 /usr/lib/libXrandr.so.2.2.0
+b47d4000-b47d5000 r-xp 00006000 08:01 9394 /usr/lib/libXrandr.so.2.2.0
+b47d5000-b47d6000 rwxp 00007000 08:01 9394 /usr/lib/libXrandr.so.2.2.0
+b47d6000-b47de000 r-xp 00000000 08:01 30975 /usr/lib/libXi.so.6.0.0
+b47de000-b47df000 r-xp 00007000 08:01 30975 /usr/lib/libXi.so.6.0.0
+b47df000-b47e0000 rwxp 00008000 08:01 30975 /usr/lib/libXi.so.6.0.0
+b47e0000-b47e8000 r-xp 00000000 08:01 9396 /usr/lib/libXrender.so.1.3.0
+b47e8000-b47e9000 r-xp 00007000 08:01 9396 /usr/lib/libXrender.so.1.3.0
+b47e9000-b47ea000 rwxp 00008000 08:01 9396 /usr/lib/libXrender.so.1.3.0
+b47ea000-b47f8000 r-xp 00000000 08:01 9374 /usr/lib/libXext.so.6.4.0
+b47f8000-b47f9000 r-xp 0000d000 08:01 9374 /usr/lib/libXext.so.6.4.0
+b47f9000-b47fa000 rwxp 0000e000 08:01 9374 /usr/lib/libXext.so.6.4.0
+b47fa000-b4883000 r-xp 00000000 08:01 9672 /usr/lib/libgdk-x11-2.0.so.0.1600.1
+b4883000-b4884000 ---p 00089000 08:01 9672 /usr/lib/libgdk-x11-2.0.so.0.1600.1
+b4884000-b4886000 r-xp 00089000 08:01 9672 /usr/lib/libgdk-x11-2.0.so.0.1600.1
+b4886000-b4887000 rwxp 0008b000 08:01 9672 /usr/lib/libgdk-x11-2.0.so.0.1600.1
+b4887000-b488b000 r-xp 00000000 08:01 9402 /usr/lib/libXtst.so.6.1.0
+b488b000-b488c000 r-xp 00004000 08:01 9402 /usr/lib/libXtst.so.6.1.0
+b488c000-b488d000 rwxp 00005000 08:01 9402 /usr/lib/libXtst.so.6.1.0
+b488d000-b4891000 r-xp 00000000 08:01 9849 /usr/lib/libgthread-2.0.so.0.2000.1
+b4891000-b4892000 r-xp 00003000 08:01 9849 /usr/lib/libgthread-2.0.so.0.2000.1
+b4892000-b4893000 rwxp 00004000 08:01 9849 /usr/lib/libgthread-2.0.so.0.2000.1
+b4893000-b4c3c000 r-xp 00000000 08:01 9853 /usr/lib/libgtk-x11-2.0.so.0.1600.1
+b4c3c000-b4c40000 r-xp 003a8000 08:01 9853 /usr/lib/libgtk-x11-2.0.so.0.1600.1
+b4c40000-b4c42000 rwxp 003ac000 08:01 9853 /usr/lib/libgtk-x11-2.0.so.0.1600.1
+b4c42000-b4c45000 rwxp b4c42000 00:00 0
+b4c45000-b4c48000 rwxs 00000000 00:09 8519711 /SYSV00000000 (deleted)
+b4c48000-b4c49000 r-xp 00000000 08:01 13715 /usr/lib/locale/fr_FR.utf8/LC_NUMERIC
+b4c49000-b4c4a000 r-xp 00000000 08:01 13718 /usr/lib/locale/fr_FR.utf8/LC_TIME
+b4c4a000-b4c4b000 r-xp 00000000 08:01 13709 /usr/lib/locale/fr_FR.utf8/LC_MONETARY
+b4c4b000-b4c4c000 r-xp 00000000 08:01 13693 /usr/lib/locale/fr_FR.utf8/LC_MESSAGES/SYS_LC_MESSAGES
+b4c4c000-b4c4d000 r-xp 00000000 08:01 13742 /usr/lib/locale/fr_FR.utf8/LC_PAPER
+b4c4d000-b4c4e000 r-xp 00000000 08:01 13701 /usr/lib/locale/fr_FR.utf8/LC_NAME
+b4c4e000-b4c50000 r-xp 00000000 08:06 132130 /home/kevin/.m2/repository/com/google/gwt/gwt-dev/1.5.3/mozilla-1.7.12/libplds4.so
+b4c50000-b4c51000 rwxp 00002000 08:06 132130 /home/kevin/.m2/repository/com/google/gwt/gwt-dev/1.5.3/mozilla-1.7.12/libplds4.so
+b4c51000-b4c55000 r-xp 00000000 08:06 132131 /home/kevin/.m2/repository/com/google/gwt/gwt-dev/1.5.3/mozilla-1.7.12/libplc4.so
+b4c55000-b4c56000 rwxp 00003000 08:06 132131 /home/kevin/.m2/repository/com/google/gwt/gwt-dev/1.5.3/mozilla-1.7.12/libplc4.so
+b4c56000-b4ca0000 r-xp 00000000 08:06 133050 /home/kevin/.m2/repository/com/google/gwt/gwt-dev/1.5.3/libswt-pi-gtk-3235.so
+b4ca0000-b4ca2000 rwxp 0004a000 08:06 133050 /home/kevin/.m2/repository/com/google/gwt/gwt-dev/1.5.3/libswt-pi-gtk-3235.so
+b4ca2000-b4d22000 r-xs 00903000 08:06 131558 /home/kevin/.m2/repository/com/google/gwt/gwt-dev/1.5.3/gwt-dev-1.5.3-linux.jar
+b4d22000-b4d6b000 r-xs 00297000 08:06 131547 /home/kevin/.m2/repository/com/google/gwt/gwt-user/1.5.3/gwt-user-1.5.3.jar
+b4d6b000-b4d6c000 ---p b4d6b000 00:00 0
+b4d6c000-b4dec000 rwxp b4d6c000 00:00 0
+b4dec000-b4def000 ---p b4dec000 00:00 0
+b4def000-b4e3d000 rwxp b4def000 00:00 0
+b4e3d000-b4e40000 ---p b4e3d000 00:00 0
+b4e40000-b4ebe000 rwxp b4e40000 00:00 0
+b4ebe000-b4ec1000 ---p b4ebe000 00:00 0
+b4ec1000-b4f42000 rwxp b4ec1000 00:00 0
+b4f42000-b50d8000 r-xs 02fb1000 08:01 109444 /usr/lib/jvm/java-6-sun-1.6.0.14/jre/lib/rt.jar
+b50d8000-b50df000 r-xs 00000000 08:01 11976 /usr/lib/gconv/gconv-modules.cache
+b50df000-b511e000 r-xp 00000000 08:01 13736 /usr/lib/locale/fr_FR.utf8/LC_CTYPE
+b511e000-b5121000 ---p b511e000 00:00 0
+b5121000-b516f000 rwxp b5121000 00:00 0
+b516f000-b5172000 ---p b516f000 00:00 0
+b5172000-b51c0000 rwxp b5172000 00:00 0
+b51c0000-b51c1000 ---p b51c0000 00:00 0
+b51c1000-b524f000 rwxp b51c1000 00:00 0
+b524f000-b5269000 rwxp b524f000 00:00 0
+b5269000-b5290000 rwxp b5269000 00:00 0
+b5290000-b5356000 rwxp b5290000 00:00 0
+b5356000-b535a000 rwxp b5356000 00:00 0
+b535a000-b5369000 rwxp b535a000 00:00 0
+b5369000-b5391000 rwxp b5369000 00:00 0
+b5391000-b5456000 rwxp b5391000 00:00 0
+b5456000-b545d000 rwxp b5456000 00:00 0
+b545d000-b5476000 rwxp b545d000 00:00 0
+b5476000-b5493000 rwxp b5476000 00:00 0
+b5493000-b5501000 rwxp b5493000 00:00 0
+b5501000-b5949000 rwxp b5501000 00:00 0
+b5949000-b7501000 rwxp b5949000 00:00 0
+b7501000-b7510000 r-xp 00000000 08:01 83659 /usr/lib/jvm/java-6-sun-1.6.0.14/jre/lib/i386/libzip.so
+b7510000-b7512000 rwxp 0000e000 08:01 83659 /usr/lib/jvm/java-6-sun-1.6.0.14/jre/lib/i386/libzip.so
+b7512000-b751c000 r-xp 00000000 08:01 6194 /lib/tls/i686/cmov/libnss_files-2.9.so
+b751c000-b751d000 r-xp 00009000 08:01 6194 /lib/tls/i686/cmov/libnss_files-2.9.so
+b751d000-b751e000 rwxp 0000a000 08:01 6194 /lib/tls/i686/cmov/libnss_files-2.9.so
+b751e000-b7527000 r-xp 00000000 08:01 6198 /lib/tls/i686/cmov/libnss_nis-2.9.so
+b7527000-b7528000 r-xp 00008000 08:01 6198 /lib/tls/i686/cmov/libnss_nis-2.9.so
+b7528000-b7529000 rwxp 00009000 08:01 6198 /lib/tls/i686/cmov/libnss_nis-2.9.so
+b7529000-b752a000 r-xp 00000000 08:01 13708 /usr/lib/locale/fr_FR.utf8/LC_ADDRESS
+b752a000-b752c000 r-xp 00000000 08:01 9366 /usr/lib/libXcomposite.so.1.0.0
+b752c000-b752d000 r-xp 00001000 08:01 9366 /usr/lib/libXcomposite.so.1.0.0
+b752d000-b752e000 rwxp 00002000 08:01 9366 /usr/lib/libXcomposite.so.1.0.0
+b752e000-b7533000 rwxp b752e000 00:00 0
+b7533000-b753b000 rwxs 00000000 08:01 10893 /tmp/hsperfdata_kevin/9288
+b753b000-b7550000 r-xp 00000000 08:01 6188 /lib/tls/i686/cmov/libnsl-2.9.so
+b7550000-b7551000 r-xp 00014000 08:01 6188 /lib/tls/i686/cmov/libnsl-2.9.so
+b7551000-b7552000 rwxp 00015000 08:01 6188 /lib/tls/i686/cmov/libnsl-2.9.so
+b7552000-b7554000 rwxp b7552000 00:00 0
+b7554000-b7555000 r-xp 00000000 08:01 13713 /usr/lib/locale/fr_FR.utf8/LC_TELEPHONE
+b7555000-b7556000 r-xp 00000000 08:01 13738 /usr/lib/locale/fr_FR.utf8/LC_MEASUREMENT
+b7556000-b755d000 r-xp 00000000 08:01 6190 /lib/tls/i686/cmov/libnss_compat-2.9.so
+b755d000-b755e000 r-xp 00006000 08:01 6190 /lib/tls/i686/cmov/libnss_compat-2.9.so
+b755e000-b755f000 rwxp 00007000 08:01 6190 /lib/tls/i686/cmov/libnss_compat-2.9.so
+b755f000-b7565000 r-xp 00000000 08:01 83645 /usr/lib/jvm/java-6-sun-1.6.0.14/jre/lib/i386/native_threads/libhpi.so
+b7565000-b7566000 rwxp 00006000 08:01 83645 /usr/lib/jvm/java-6-sun-1.6.0.14/jre/lib/i386/native_threads/libhpi.so
+b7566000-b7589000 r-xp 00000000 08:01 83656 /usr/lib/jvm/java-6-sun-1.6.0.14/jre/lib/i386/libjava.so
+b7589000-b758b000 rwxp 00023000 08:01 83656 /usr/lib/jvm/java-6-sun-1.6.0.14/jre/lib/i386/libjava.so
+b758b000-b7592000 r-xp 00000000 08:01 6207 /lib/tls/i686/cmov/librt-2.9.so
+b7592000-b7593000 r-xp 00006000 08:01 6207 /lib/tls/i686/cmov/librt-2.9.so
+b7593000-b7594000 rwxp 00007000 08:01 6207 /lib/tls/i686/cmov/librt-2.9.so
+b7594000-b7597000 ---p b7594000 00:00 0
+b7597000-b75e5000 rwxp b7597000 00:00 0
+b75e5000-b7609000 r-xp 00000000 08:01 6185 /lib/tls/i686/cmov/libm-2.9.so
+b7609000-b760a000 r-xp 00023000 08:01 6185 /lib/tls/i686/cmov/libm-2.9.so
+b760a000-b760b000 rwxp 00024000 08:01 6185 /lib/tls/i686/cmov/libm-2.9.so
+b760b000-b7a70000 r-xp 00000000 08:01 83651 /usr/lib/jvm/java-6-sun-1.6.0.14/jre/lib/i386/client/libjvm.so
+b7a70000-b7a90000 rwxp 00465000 08:01 83651 /usr/lib/jvm/java-6-sun-1.6.0.14/jre/lib/i386/client/libjvm.so
+b7a90000-b7eb1000 rwxp b7a90000 00:00 0
+b7eb1000-b800d000 r-xp 00000000 08:01 6177 /lib/tls/i686/cmov/libc-2.9.so
+b800d000-b800e000 ---p 0015c000 08:01 6177 /lib/tls/i686/cmov/libc-2.9.so
+b800e000-b8010000 r-xp 0015c000 08:01 6177 /lib/tls/i686/cmov/libc-2.9.so
+b8010000-b8011000 rwxp 0015e000 08:01 6177 /lib/tls/i686/cmov/libc-2.9.so
+b8011000-b8014000 rwxp b8011000 00:00 0
+b8014000-b8016000 r-xp 00000000 08:01 6183 /lib/tls/i686/cmov/libdl-2.9.so
+b8016000-b8017000 r-xp 00001000 08:01 6183 /lib/tls/i686/cmov/libdl-2.9.so
+b8017000-b8018000 rwxp 00002000 08:01 6183 /lib/tls/i686/cmov/libdl-2.9.so
+b8018000-b801f000 r-xp 00000000 08:01 83658 /usr/lib/jvm/java-6-sun-1.6.0.14/jre/lib/i386/jli/libjli.so
+b801f000-b8021000 rwxp 00006000 08:01 83658 /usr/lib/jvm/java-6-sun-1.6.0.14/jre/lib/i386/jli/libjli.so
+b8021000-b8022000 rwxp b8021000 00:00 0
+b8022000-b8037000 r-xp 00000000 08:01 6203 /lib/tls/i686/cmov/libpthread-2.9.so
+b8037000-b8038000 r-xp 00014000 08:01 6203 /lib/tls/i686/cmov/libpthread-2.9.so
+b8038000-b8039000 rwxp 00015000 08:01 6203 /lib/tls/i686/cmov/libpthread-2.9.so
+b8039000-b803b000 rwxp b8039000 00:00 0
+b803b000-b803c000 r-xp 00000000 08:01 13711 /usr/lib/locale/fr_FR.utf8/LC_IDENTIFICATION
+b803c000-b803e000 r-xp 00000000 08:01 9384 /usr/lib/libXinerama.so.1.0.0
+b803e000-b803f000 rwxp 00001000 08:01 9384 /usr/lib/libXinerama.so.1.0.0
+b803f000-b8040000 rwxp b803f000 00:00 0
+b8040000-b8041000 r-xp b8040000 00:00 0
+b8041000-b804c000 r-xp 00000000 08:01 83655 /usr/lib/jvm/java-6-sun-1.6.0.14/jre/lib/i386/libverify.so
+b804c000-b804d000 rwxp 0000b000 08:01 83655 /usr/lib/jvm/java-6-sun-1.6.0.14/jre/lib/i386/libverify.so
+b804d000-b804f000 rwxp b804d000 00:00 0
+b804f000-b8050000 r-xp b804f000 00:00 0 [vdso]
+b8050000-b806c000 r-xp 00000000 08:01 2557 /lib/ld-2.9.so
+b806c000-b806d000 r-xp 0001b000 08:01 2557 /lib/ld-2.9.so
+b806d000-b806e000 rwxp 0001c000 08:01 2557 /lib/ld-2.9.so
+bff59000-bff6e000 rwxp bffeb000 00:00 0 [stack]
+
+VM Arguments:
+jvm_args: -Xmx512m -Dcatalina.base=/home/kevin/Workspaces/NetBeansProjects/guix/trunk/guix-test-gwt/target/tomcat
+java_command: com.google.gwt.dev.GWTShell -gen /home/kevin/Workspaces/NetBeansProjects/guix/trunk/guix-test-gwt/target/.generated -logLevel INFO -style DETAILED -out /home/kevin/Workspaces/NetBeansProjects/guix/trunk/guix-test-gwt/target/guix-test-gwt-1.0.0-SNAPSHOT -port 8888 org.nuiton.guix.Index/Index.html
+Launcher Type: SUN_STANDARD
+
+Environment Variables:
+JAVA_HOME=/usr/lib/jvm/java-6-sun
+PATH=/home/kevin/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games
+USERNAME=kevin
+LD_LIBRARY_PATH=/usr/lib/jvm/java-6-sun-1.6.0.14/jre/lib/i386/client:/usr/lib/jvm/java-6-sun-1.6.0.14/jre/lib/i386:/usr/lib/jvm/java-6-sun-1.6.0.14/jre/../lib/i386
+SHELL=/bin/bash
+DISPLAY=:0.0
+
+Signal Handlers:
+SIGSEGV: [libjvm.so+0x3fc070], sa_mask[0]=0x7ffbfeff, sa_flags=0x10000004
+SIGBUS: [libjvm.so+0x3fc070], sa_mask[0]=0x7ffbfeff, sa_flags=0x10000004
+SIGFPE: [libjvm.so+0x325d30], sa_mask[0]=0x7ffbfeff, sa_flags=0x10000004
+SIGPIPE: SIG_IGN, sa_mask[0]=0x00001000, sa_flags=0x10000000
+SIGXFSZ: [libjvm.so+0x325d30], sa_mask[0]=0x7ffbfeff, sa_flags=0x10000004
+SIGILL: [libjvm.so+0x325d30], sa_mask[0]=0x7ffbfeff, sa_flags=0x10000004
+SIGUSR1: SIG_DFL, sa_mask[0]=0x00000000, sa_flags=0x00000000
+SIGUSR2: [libjvm.so+0x328920], sa_mask[0]=0x00000004, sa_flags=0x10000004
+SIGHUP: [libjvm.so+0x328650], sa_mask[0]=0x7ffbfeff, sa_flags=0x10000004
+SIGINT: SIG_IGN, sa_mask[0]=0x00000000, sa_flags=0x00000000
+SIGTERM: [libjvm.so+0x328650], sa_mask[0]=0x7ffbfeff, sa_flags=0x10000004
+SIGQUIT: [libjvm.so+0x328650], sa_mask[0]=0x7ffbfeff, sa_flags=0x10000004
+
+
+--------------- S Y S T E M ---------------
+
+OS:5.0
+
+uname:Linux 2.6.28-13-generic #45-Ubuntu SMP Tue Jun 30 19:49:51 UTC 2009 i686
+libc:glibc 2.9 NPTL 2.9
+rlimit: STACK 8192k, CORE 0k, NPROC infinity, NOFILE 1024, AS infinity
+load average:1,13 1,27 1,32
+
+CPU:total 1 (1 cores per cpu, 1 threads per core) family 15 model 127 stepping 2, cmov, cx8, fxsr, mmx, sse, sse2, sse3, mmxext, 3dnow, 3dnowext
+
+Memory: 4k page, physical 1930940k(77652k free), swap 5574512k(5563592k free)
+
+vm_info: Java HotSpot(TM) Client VM (14.0-b16) for linux-x86 JRE (1.6.0_14-b08), built on May 21 2009 02:01:47 by "java_re" with gcc 3.2.1-7a (J2SE release)
+
+time: Thu Jul 23 10:51:53 2009
+elapsed time: 111 seconds
+
Modified: trunk/guix-test-gwt/nbactions.xml
===================================================================
--- trunk/guix-test-gwt/nbactions.xml 2009-07-23 10:50:01 UTC (rev 1513)
+++ trunk/guix-test-gwt/nbactions.xml 2009-07-23 10:51:11 UTC (rev 1514)
@@ -7,4 +7,12 @@
<goal>gwt-maven:gwt</goal>
</goals>
</action>
+ <action>
+ <actionName>CUSTOM-clean gwt-maven:gwt</actionName>
+ <displayName>clean gwt-maven:gwt</displayName>
+ <goals>
+ <goal>clean</goal>
+ <goal>gwt-maven:gwt</goal>
+ </goals>
+ </action>
</actions>
Modified: trunk/guix-test-gwt/pom.xml
===================================================================
--- trunk/guix-test-gwt/pom.xml 2009-07-23 10:50:01 UTC (rev 1513)
+++ trunk/guix-test-gwt/pom.xml 2009-07-23 10:51:11 UTC (rev 1514)
@@ -57,8 +57,27 @@
<description>Guix test for GWT</description>
<build>
+ <resources>
+ <resource>
+ <directory>${project.basedir}/src/main/java</directory>
+ <includes>
+ <include>**/*</include>
+ </includes>
+ </resource>
+ <resource>
+ <directory>${project.basedir}/src/main/resources</directory>
+ <includes>
+ <include>**/*</include>
+ </includes>
+ </resource>
+ <resource>
+ <directory>${project.basedir}/target/generatedFiles</directory>
+ <includes>
+ <include>**/*</include>
+ </includes>
+ </resource>
+ </resources>
<plugins>
-
<!-- plugin i18n -->
<plugin>
<groupId>org.nuiton</groupId>
@@ -153,8 +172,8 @@
<artifactId>maven-guix-plugin</artifactId>
<version>${project.version}</version>
<configuration>
- <guixFilesDir>guix-test-gwt/src/main/java/org/nuiton/guix/demo/</guixFilesDir>
- <targetDirectory>guix-test-gwt/target/generatedFiles/</targetDirectory>
+ <guixFilesDir>${project.basedir}/src/main/java/org/nuiton/guix/demo/</guixFilesDir>
+ <targetDirectory>${project.basedir}/target/generatedFiles/</targetDirectory>
<rootPackage>org.nuiton.guix</rootPackage>
<mainClass>org.nuiton.guix.GuixDemo</mainClass>
<launcherName>org.nuiton.guix.Index</launcherName>
@@ -162,9 +181,8 @@
</configuration>
<executions>
<execution>
- <phase>compile</phase>
<goals>
- <goal>testMojo</goal>
+ <goal>generate</goal>
</goals>
</execution>
</executions>
Deleted: trunk/guix-test-gwt/src/main/java/org/nuiton/guix/Index.gwt.xml
===================================================================
--- trunk/guix-test-gwt/src/main/java/org/nuiton/guix/Index.gwt.xml 2009-07-23 10:50:01 UTC (rev 1513)
+++ trunk/guix-test-gwt/src/main/java/org/nuiton/guix/Index.gwt.xml 2009-07-23 10:51:11 UTC (rev 1514)
@@ -1,3 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?><module><!--Inherit the core Web Toolkit stuff.--><inherits name="com.google.gwt.user.User" />
- <inherits name="com.google.gwt.user.theme.dark.Dark" /><!--Specify the app entry point class.--><entry-point class="org.nuiton.guix.client.GuixDemoImpl" /><!--Specify the application specific style sheet.--><stylesheet src="GuixDemo.css" />
-</module>
\ No newline at end of file
Modified: trunk/guix-test-gwt/src/main/java/org/nuiton/guix/demo/GuixDemo.css
===================================================================
--- trunk/guix-test-gwt/src/main/java/org/nuiton/guix/demo/GuixDemo.css 2009-07-23 10:50:01 UTC (rev 1513)
+++ trunk/guix-test-gwt/src/main/java/org/nuiton/guix/demo/GuixDemo.css 2009-07-23 10:51:11 UTC (rev 1514)
@@ -1,16 +1,29 @@
#button:{object . getText( ) . startsWith( "-" )}
{
foreground: red;
-}
-
-#label
-{
- background : blue;
-}
-
+}
-.bold
-{
- font-weight : bold;
-}
-
+#label
+{
+ background : blue;
+}
+
+
+.bold
+{
+ font-weight : bold;
+}
+
+.Table
+{
+ border : 3px groove #FFF;
+}
+.Row
+{
+ border : 2px groove red;
+}
+.Cell
+{
+ border : 1px groove green;
+}
+
Modified: trunk/guix-test-gwt/src/main/java/org/nuiton/guix/demo/GuixDemo2.guix
===================================================================
--- trunk/guix-test-gwt/src/main/java/org/nuiton/guix/demo/GuixDemo2.guix 2009-07-23 10:50:01 UTC (rev 1513)
+++ trunk/guix-test-gwt/src/main/java/org/nuiton/guix/demo/GuixDemo2.guix 2009-07-23 10:51:11 UTC (rev 1514)
@@ -1,11 +1,11 @@
<?xml version='1.0' encoding='UTF-8' ?>
<!-- test javadoc Application -->
-<gwt:FlowPanel xmlns:gwt='com.google.gwt.user.client.ui.*'>
+<Panel>
<script>
public enum Day {
SUNDAY, MONDAY, TUESDAY, WEDNESDAY,
THURSDAY, FRIDAY, SATURDAY
}
</script>
- <gwt:ToggleButton id="button" constructor='"Up","Down"' down ="true" onClick='{System.out.println("hey dude !")}'/>
-</gwt:FlowPanel>
+ <ToggleButton id="button" constructor='"Up","Down"' down ="true" onClick='{System.out.println("hey dude !")}'/>
+</Panel>
1
0
July 23, 2009
Author: kmorin
Date: 2009-07-23 12:50:01 +0200 (Thu, 23 Jul 2009)
New Revision: 1513
Modified:
trunk/guix-compiler-swing/pom.xml
Log:
Removed the unuseful dependencies
Modified: trunk/guix-compiler-swing/pom.xml
===================================================================
--- trunk/guix-compiler-swing/pom.xml 2009-07-23 10:49:33 UTC (rev 1512)
+++ trunk/guix-compiler-swing/pom.xml 2009-07-23 10:50:01 UTC (rev 1513)
@@ -27,11 +27,6 @@
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
</dependency>
-
- <dependency>
- <groupId>net.java.dev.beansbinding</groupId>
- <artifactId>beansbinding</artifactId>
- </dependency>
<dependency>
<groupId>xpp3</groupId>
1
0
r1512 - trunk/guix-compiler-gwt/src/main/java/org/nuiton/guix/generator
by kmorin@users.labs.libre-entreprise.org July 23, 2009
by kmorin@users.labs.libre-entreprise.org July 23, 2009
July 23, 2009
Author: kmorin
Date: 2009-07-23 12:49:33 +0200 (Thu, 23 Jul 2009)
New Revision: 1512
Modified:
trunk/guix-compiler-gwt/src/main/java/org/nuiton/guix/generator/GwtConfigGenerator.java
trunk/guix-compiler-gwt/src/main/java/org/nuiton/guix/generator/GwtGenerator.java
trunk/guix-compiler-gwt/src/main/java/org/nuiton/guix/generator/GwtGenerator1.java
Log:
Added a list of cssfiles to the model object, in order to copy them to the target directory for GWT
Modified: trunk/guix-compiler-gwt/src/main/java/org/nuiton/guix/generator/GwtConfigGenerator.java
===================================================================
--- trunk/guix-compiler-gwt/src/main/java/org/nuiton/guix/generator/GwtConfigGenerator.java 2009-07-23 10:49:18 UTC (rev 1511)
+++ trunk/guix-compiler-gwt/src/main/java/org/nuiton/guix/generator/GwtConfigGenerator.java 2009-07-23 10:49:33 UTC (rev 1512)
@@ -21,6 +21,7 @@
import java.io.File;
import java.io.IOException;
import java.io.PrintWriter;
+import java.util.List;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.nuiton.guix.model.GuixModelObject;
@@ -37,6 +38,8 @@
/** GuixModelObject representing the main class */
private GuixModelObject gmo;
+ /** List of the CSS files needed of the generation */
+ protected List<File> cssFiles;
/** log */
private Log log = LogFactory.getLog(GwtConfigGenerator.class);
@@ -45,8 +48,9 @@
*
* @param gmo GuixModelObject representing the class to generate
*/
- public GwtConfigGenerator(GuixModelObject gmo) {
+ public GwtConfigGenerator(GuixModelObject gmo, List<File> cssFiles) {
this.gmo = gmo;
+ this.cssFiles = cssFiles;
}
/**
@@ -66,31 +70,34 @@
serializer.setProperty("http://xmlpull.org/v1/doc/properties.html#serializer-indentation", "\t");
serializer.startTag("", "module");
- serializer.comment("Inherit the core Web Toolkit stuff.");
- serializer.startTag("", "inherits");
- serializer.attribute("", "name", "com.google.gwt.user.User");
- serializer.endTag("","inherits");
+ serializer.comment("Inherit the core Web Toolkit stuff.");
+ serializer.startTag("", "inherits");
+ serializer.attribute("", "name", "com.google.gwt.user.User");
+ serializer.endTag("","inherits");
- serializer.startTag("", "inherits");
+ serializer.startTag("", "inherits");
int i = 0;
while(i < gmo.getAttributeDescriptors().size()
- && !gmo.getAttributeDescriptors().get(i).getName().equals("theme"))
+ && !gmo.getAttributeDescriptors().get(i).getName().equals("theme")) {
i++;
- serializer.attribute("", "name", i < gmo.getAttributeDescriptors().size() ?
- gmo.getAttributeDescriptors().get(i).getValue()
- : "com.google.gwt.user.theme.standard.Standard");
- serializer.endTag("","inherits");
+ }
+ serializer.attribute("", "name", i < gmo.getAttributeDescriptors().size() ?
+ gmo.getAttributeDescriptors().get(i).getValue()
+ : "com.google.gwt.user.theme.standard.Standard");
+ serializer.endTag("","inherits");
- serializer.comment("Specify the app entry point class.");
- serializer.startTag("","entry-point");
- serializer.attribute("", "class", gmo.getClassDescriptor().getPackageName()
- + ".client." + gmo.getClassDescriptor().getName() + "Impl");
- serializer.endTag("","entry-point");
+ serializer.comment("Specify the app entry point class.");
+ serializer.startTag("","entry-point");
+ serializer.attribute("", "class", gmo.getClassDescriptor().getPackageName()
+ + ".client." + gmo.getClassDescriptor().getName() + "Impl");
+ serializer.endTag("","entry-point");
- serializer.comment("Specify the application specific style sheet.");
+ serializer.comment("Specify the application specific style sheet.");
+ for(File f : cssFiles) {
serializer.startTag("", "stylesheet");
- serializer.attribute("","src",gmo.getClassDescriptor().getName() + ".css");
+ serializer.attribute("","src", f.getName());
serializer.endTag("", "stylesheet");
+ }
serializer.endTag("", "module");
serializer.endDocument();
Modified: trunk/guix-compiler-gwt/src/main/java/org/nuiton/guix/generator/GwtGenerator.java
===================================================================
--- trunk/guix-compiler-gwt/src/main/java/org/nuiton/guix/generator/GwtGenerator.java 2009-07-23 10:49:18 UTC (rev 1511)
+++ trunk/guix-compiler-gwt/src/main/java/org/nuiton/guix/generator/GwtGenerator.java 2009-07-23 10:49:33 UTC (rev 1512)
@@ -20,6 +20,10 @@
import com.google.gwt.user.client.ui.Label;
import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.FileReader;
+import java.io.FileWriter;
import java.io.IOException;
import java.lang.annotation.Annotation;
import java.lang.reflect.Method;
@@ -76,7 +80,7 @@
if (mainClass) {
gimg.addMainMethod();
- GwtConfigGenerator gcg = new GwtConfigGenerator(gmo);
+ GwtConfigGenerator gcg = new GwtConfigGenerator(gmo, getCSSFiles());
GwtHtmlGenerator ghg = new GwtHtmlGenerator(gmo, launcherName);
File outConfigMain = new File(destDir, launcherName.substring(launcherName.lastIndexOf('.') + 1) + ".gwt.xml");
File publicDir = new File(destDir, "public");
@@ -85,6 +89,25 @@
}
File outHtmlMain = new File(publicDir, launcherName.substring(launcherName.lastIndexOf('.') + 1) + ".html");
gcg.generate(outConfigMain);
+ for(File f : getCSSFiles()) {
+ try {
+ File fPublic = new File(publicDir, f.getName());
+ fPublic.createNewFile();
+ FileInputStream fis = new FileInputStream(f);
+ FileOutputStream fos = new FileOutputStream(fPublic);
+ // segment size : 0.5Mo
+ byte buffer[] = new byte[512*1024];
+ int read;
+ while((read = fis.read(buffer)) != -1) {
+ fos.write(buffer, 0, read);
+ }
+ fis.close();
+ fos.close();
+ }
+ catch(IOException eee) {
+ log.error(eee);
+ }
+ }
ghg.generate(outHtmlMain);
}
Modified: trunk/guix-compiler-gwt/src/main/java/org/nuiton/guix/generator/GwtGenerator1.java
===================================================================
--- trunk/guix-compiler-gwt/src/main/java/org/nuiton/guix/generator/GwtGenerator1.java 2009-07-23 10:49:18 UTC (rev 1511)
+++ trunk/guix-compiler-gwt/src/main/java/org/nuiton/guix/generator/GwtGenerator1.java 2009-07-23 10:49:33 UTC (rev 1512)
@@ -75,7 +75,7 @@
if (mainClass) {
gimg.addMainMethod();
- GwtConfigGenerator gcg = new GwtConfigGenerator(gmo);
+ GwtConfigGenerator gcg = new GwtConfigGenerator(gmo, getCSSFiles());
GwtHtmlGenerator ghg = new GwtHtmlGenerator(gmo, launcherName);
File outConfigMain = new File(destDir, launcherName.substring(launcherName.lastIndexOf('.') + 1) + ".gwt.xml");
File publicDir = new File(destDir, "public");
1
0
r1511 - in trunk/guix-compiler/src/main/java/org/nuiton/guix: . compiler generator model tags
by kmorin@users.labs.libre-entreprise.org July 23, 2009
by kmorin@users.labs.libre-entreprise.org July 23, 2009
July 23, 2009
Author: kmorin
Date: 2009-07-23 12:49:18 +0200 (Thu, 23 Jul 2009)
New Revision: 1511
Modified:
trunk/guix-compiler/src/main/java/org/nuiton/guix/GuixLauncher.java
trunk/guix-compiler/src/main/java/org/nuiton/guix/compiler/GuixCompiler.java
trunk/guix-compiler/src/main/java/org/nuiton/guix/generator/Generator.java
trunk/guix-compiler/src/main/java/org/nuiton/guix/generator/GuixGenerator.java
trunk/guix-compiler/src/main/java/org/nuiton/guix/model/GuixModelObject.java
trunk/guix-compiler/src/main/java/org/nuiton/guix/tags/StyleHandler.java
Log:
Added a list of cssfiles to the model object, in order to copy them to the target directory for GWT
Modified: trunk/guix-compiler/src/main/java/org/nuiton/guix/GuixLauncher.java
===================================================================
--- trunk/guix-compiler/src/main/java/org/nuiton/guix/GuixLauncher.java 2009-07-23 10:48:07 UTC (rev 1510)
+++ trunk/guix-compiler/src/main/java/org/nuiton/guix/GuixLauncher.java 2009-07-23 10:49:18 UTC (rev 1511)
@@ -64,27 +64,37 @@
protected List<String> guixFileClassNames = new ArrayList<String>();
/** Maps the root GuixModelObjects being compiled to the compiler instance
* handling the compilation. */
- protected Map<GuixModelObject, Long> rootModelObjects =
- new HashMap<GuixModelObject, Long>();
+ protected Map<GuixModelObject, Long> rootModelObjects = new HashMap<GuixModelObject, Long>();
/** CLassDescriptor met during the compilation */
- protected List<ClassDescriptor> classDescriptors =
- new ArrayList<ClassDescriptor>();
+ protected List<ClassDescriptor> classDescriptors = new ArrayList<ClassDescriptor>();
+ /** List of the compiled files */
private List<File> compiledFiles = new ArrayList<File>();
- private Map<GuixGenerator,JavaFile> generatedFiles = new HashMap<GuixGenerator,JavaFile>();
- protected int compilerCount;
+ /** Maps the generator with the generated JavaFile */
+ private Map<GuixGenerator, JavaFile> generatedFiles = new HashMap<GuixGenerator, JavaFile>();
+ /** Directory where to save the generated files */
private File targetDirectory;
+ /** Root package */
private String rootPackage;
+ /** Main class of the generated application */
private String mainClass;
- private Class generatorClass;
+ /** Class of teh generator to use */
+ private Class<? extends GuixGenerator> generatorClass;
+ /** Name of the class that will launch the application */
private String launcherName;
/**
* Constructor
*
* @param files the files to compile
+ * @param targetDirectory the directory where to save the generated files
+ * @param rootPackage teh root package
+ * @param baseDir directory containing the files to compile
+ * @param mainClass main class of the application
+ * @param generatorClass class of the generator
+ * @param launcherName name of the class that will launch the application
*/
public GuixLauncher(File[] files, File targetDirectory, String rootPackage,
- File baseDir, String mainClass, Class generatorClass, String launcherName) {
+ File baseDir, String mainClass, Class<? extends GuixGenerator> generatorClass, String launcherName) {
// Set up a simple configuration that logs on the console.
this.files = files;
this.targetDirectory = targetDirectory;
@@ -94,7 +104,7 @@
for (int i = 0; i < files.length; i++) {
String path = files[i].getAbsolutePath();
if (baseDir != null) {
- classNames[i] = rootPackage + "." + path.substring(baseDir.getAbsolutePath().length() + 1,
+ classNames[i] = (rootPackage.length() > 0 ? rootPackage + "." : "") + path.substring(baseDir.getAbsolutePath().length() + 1,
path.lastIndexOf('.')).replace(File.separatorChar, '.');
}
else {
@@ -111,13 +121,12 @@
}
/**
- * Compiled a set of files.
+ * Compiles a set of files.
*
* @return <code>true</code> if compilation succeeds,
* <code>false</code> otherwise
*/
public synchronized boolean compile() {
- compilerCount = 0;
File destDir = targetDirectory;
if (files != null) {
if (log.isInfoEnabled()) {
@@ -165,7 +174,6 @@
}
//compile the file
GuixCompiler compiler = new GuixCompiler(file, this, classPackage);
-
GuixModelObject rootModelObject = compiler.compile();
rootModelObjects.put(rootModelObject, compiler.getLastModification());
@@ -191,174 +199,164 @@
log.error("The class '" + classDescriptors.get(--i).getName() + "' has no package.");
}
}
- }
-
- if (generatorClass != null) {
- //creates the XML serializer for the spring conf
- XmlPullParserFactory factory =
- XmlPullParserFactory.newInstance(
- System.getProperty(XmlPullParserFactory.PROPERTY_NAME),
- null);
- XmlSerializer serializer = factory.newSerializer();
+ if (generatorClass != null) {
+ //creates the XML serializer for the spring conf
+ XmlPullParserFactory factory =
+ XmlPullParserFactory.newInstance(
+ System.getProperty(XmlPullParserFactory.PROPERTY_NAME),
+ null);
+ XmlSerializer serializer = factory.newSerializer();
- File config = new File(targetDirectory,"config.xml");
+ File config = new File(targetDirectory, "config.xml");
- serializer.setOutput(new PrintWriter(config));
- serializer.startDocument("UTF-8", null);
- serializer.setProperty("http://xmlpull.org/v1/doc/properties.html#serializer-line-separator", "\n");
- serializer.setProperty("http://xmlpull.org/v1/doc/properties.html#serializer-indentation", "\t");
- serializer.text("\n");
- serializer.docdecl(" beans SYSTEM \"http://www.springframework.org/dtd/spring-beans.dtd\"");
- serializer.text("\n");
- serializer.startTag("", "beans");
-
- for (GuixModelObject mo : rootModelObjects.keySet()) {
- try {
- GuixGenerator gen = (GuixGenerator) generatorClass.newInstance();
- gen.setDestDir(destDir);
- gen.setGmo(mo);
- gen.setLastModification(rootModelObjects.get(mo));
- gen.setMainClass((mo.getClassDescriptor().getPackageName() + "." + mo.getClassDescriptor().getName()).equals(mainClass));
- gen.setSerializer(serializer);
- gen.setClasses(Arrays.asList(classNames));
- gen.setLauncherName(launcherName);
- generatedFiles.put(gen,gen.generate());
+ serializer.setOutput(new PrintWriter(config));
+ serializer.startDocument("UTF-8", null);
+ serializer.setProperty("http://xmlpull.org/v1/doc/properties.html#serializer-line-separator", "\n");
+ serializer.setProperty("http://xmlpull.org/v1/doc/properties.html#serializer-indentation", "\t");
+ serializer.text("\n");
+ serializer.docdecl(" beans SYSTEM \"http://www.springframework.org/dtd/spring-beans.dtd\"");
+ serializer.text("\n");
+ serializer.startTag("", "beans");
+
+ for (GuixModelObject mo : rootModelObjects.keySet()) {
+ try {
+ GuixGenerator gen = (GuixGenerator) generatorClass.newInstance();
+ gen.setDestDir(destDir);
+ gen.setGmo(mo);
+ gen.setLastModification(rootModelObjects.get(mo));
+ gen.setMainClass((mo.getClassDescriptor().getPackageName() + "." + mo.getClassDescriptor().getName()).equals(mainClass));
+ gen.setSerializer(serializer);
+ gen.setClasses(Arrays.asList(classNames));
+ gen.setLauncherName(launcherName);
+ gen.setCSSFiles(mo.getCssFiles());
+ JavaFile generatedFile = gen.generate();
+ if(generatedFile != null) {
+ generatedFiles.put(gen, generatedFile);
+ }
+ }
+ catch (InstantiationException eee) {
+ if (log.isErrorEnabled()) {
+ log.error(eee);
+ }
+ }
+ catch (IllegalAccessException eee) {
+ if (log.isErrorEnabled()) {
+ log.error(eee);
+ }
+ }
}
- catch (InstantiationException eee) {
- if(log.isErrorEnabled())
- log.error(eee);
- }
- catch (IllegalAccessException eee) {
- if(log.isErrorEnabled())
- log.error(eee);
- }
- }
- for(GuixGenerator gen : generatedFiles.keySet()) {
- int dataSourceNumber = 0;
- StringBuffer dbCreation = new StringBuffer();
- StringBuffer dbDeletion = new StringBuffer();
- StringBuffer dbProcess = new StringBuffer();
- JavaFile jf = generatedFiles.get(gen);
- for(String field : gen.getBindingsToGenerate().keySet()) {
- for(String attr : gen.getBindingsToGenerate().get(field).keySet()) {
- dbCreation.append(dbCreation.length() != 0 ? "else if(\"" : "if(\"").append(field)
- .append(".").append(attr)
- .append("\".equals(_binding)) {\n");
- dbDeletion.append(dbDeletion.length() != 0 ? "else if(\"" : "if(\"").append(field)
- .append(".").append(attr)
- .append("\".equals(_binding)) {\n");
- dbProcess.append(dbProcess.length() != 0 ? "else if(\"" : "if(\"").append(field)
- .append(".").append(attr)
- .append("\".equals(_binding)) {\n")
- .append(field).append(".set")
- .append(Character.toUpperCase(attr.charAt(0)))
- .append(attr.substring(1))
- .append("(");
- List<String[]> bindings = new ArrayList<String[]>();
- JavaParser p = new JavaParser(new StringReader(gen.getBindingsToGenerate().get(field).get(attr)));
- //start parsing
- while (!p.Line()) {
- SimpleNode node = p.popNode();
- if (node != null) {
- for(String s : browseNode(node)) {
- List<String> l = new ArrayList<String>();
- int parOuvertes = 0;
- StringBuffer read = new StringBuffer();
- for(char c : s.toCharArray()) {
- if(c == '(') {
- parOuvertes++;
- read.append(c);
- }
- else if(c == ')') {
- parOuvertes--;
- read.append(c);
- }
- else if(c == '.') {
- if(parOuvertes == 0) {
- l.add(read.toString());
- read = new StringBuffer();
+ for (GuixGenerator gen : generatedFiles.keySet()) {
+ int dataSourceNumber = 0;
+ StringBuffer dbCreation = new StringBuffer();
+ StringBuffer dbDeletion = new StringBuffer();
+ StringBuffer dbProcess = new StringBuffer();
+ JavaFile jf = generatedFiles.get(gen);
+ for (String field : gen.getBindingsToGenerate().keySet()) {
+ for (String attr : gen.getBindingsToGenerate().get(field).keySet()) {
+ dbCreation.append(dbCreation.length() != 0 ? "else if(\"" : "if(\"").append(field).append(".").append(attr).append("\".equals(_binding)) {\n");
+ dbDeletion.append(dbDeletion.length() != 0 ? "else if(\"" : "if(\"").append(field).append(".").append(attr).append("\".equals(_binding)) {\n");
+ dbProcess.append(dbProcess.length() != 0 ? "else if(\"" : "if(\"").append(field).append(".").append(attr).append("\".equals(_binding)) {\n").append(field).append(".set").append(Character.toUpperCase(attr.charAt(0))).append(attr.substring(1)).append("(");
+ List<String[]> bindings = new ArrayList<String[]>();
+ JavaParser p = new JavaParser(new StringReader(gen.getBindingsToGenerate().get(field).get(attr)));
+ //start parsing
+ while (!p.Line()) {
+ SimpleNode node = p.popNode();
+ if (node != null) {
+ for (String s : browseNode(node)) {
+ List<String> l = new ArrayList<String>();
+ int parOuvertes = 0;
+ StringBuffer read = new StringBuffer();
+ for (char c : s.toCharArray()) {
+ if (c == '(') {
+ parOuvertes++;
+ read.append(c);
}
+ else if (c == ')') {
+ parOuvertes--;
+ read.append(c);
+ }
+ else if (c == '.') {
+ if (parOuvertes == 0) {
+ l.add(read.toString());
+ read = new StringBuffer();
+ }
+ else {
+ read.append(c);
+ }
+ }
else {
read.append(c);
}
}
- else {
- read.append(c);
- }
+ l.add(read.toString());
+ bindings.add(l.toArray(new String[l.size()]));
}
- l.add(read.toString());
- bindings.add(l.toArray(new String[l.size()]));
}
}
- }
- List<Class> listeners = new ArrayList<Class>();
- for(String[] binding : bindings) {
- StringBuffer methodToInvoke = new StringBuffer();
- StringBuffer oldBinding = new StringBuffer();
- for(String s : binding) {
- log.info("old : " + s);
- methodToInvoke.append(s.replaceAll("\\W", ""));
- oldBinding.append(s).append(".");
- }
- oldBinding.setLength(oldBinding.length() - 1);
- listeners.addAll(gen.generateBindings(dbCreation, dbDeletion, null, jf, null, binding, 0, null, methodToInvoke.toString(), generatedFiles));
- //JavaArgument[] args = new JavaArgument[]{new JavaArgument(parameterType.getName(), "event")};
- StringBuffer newBinding = new StringBuffer();
- for(String s : binding) {
- log.info("new : " + s);
- newBinding.append(s).append(".");
- }
- newBinding.setLength(newBinding.length() - 1);
- log.info(gen.getBindingsToGenerate().get(field).get(attr) + " : " + oldBinding + " - " + newBinding.toString());
- gen.getBindingsToGenerate().get(field)
- .put(attr, gen.getBindingsToGenerate().get(field).get(attr).replace(oldBinding.toString(), newBinding.toString()));
+ List<Class> listeners = new ArrayList<Class>();
+ for (String[] binding : bindings) {
+ StringBuffer methodToInvoke = new StringBuffer();
+ StringBuffer oldBinding = new StringBuffer();
+ for (String s : binding) {
+ methodToInvoke.append(s.replaceAll("\\W", ""));
+ oldBinding.append(s).append(".");
+ }
+ oldBinding.setLength(oldBinding.length() - 1);
+ listeners.addAll(gen.generateBindings(dbCreation, dbDeletion, null, jf, null, binding, 0, null, methodToInvoke.toString(), generatedFiles));
+ //JavaArgument[] args = new JavaArgument[]{new JavaArgument(parameterType.getName(), "event")};
+ StringBuffer newBinding = new StringBuffer();
+ for (String s : binding) {
+ newBinding.append(s).append(".");
+ }
+ newBinding.setLength(newBinding.length() - 1);
+ gen.getBindingsToGenerate().get(field).put(attr, gen.getBindingsToGenerate().get(field).get(attr).replace(oldBinding.toString(), newBinding.toString()));
- if (jf.getMethod("onChangeFrom" + methodToInvoke, /*args*/null) == null) {
- jf.addMethod(new JavaMethod(Modifier.PUBLIC, "void", "onChangeFrom" + methodToInvoke.toString(), /*args*/null, null, /*"_DataSource" + dataSourceNumber + ".propertyChange(null);"*/"processDataBinding(\"" + field + "." + attr + "\");", null));
+ if (jf.getMethod("onChangeFrom" + methodToInvoke, /*args*/ null) == null) {
+ jf.addMethod(new JavaMethod(Modifier.PUBLIC, "void", "onChangeFrom" + methodToInvoke.toString(), /*args*/ null, null, /*"_DataSource" + dataSourceNumber + ".propertyChange(null);"*/ "processDataBinding(\"" + field + "." + attr + "\");", null));
+ }
+ else {
+ jf.getMethod("onChangeFrom" + methodToInvoke.toString(), /*args*/ null).appendBodyCode(/*"_DataSource" + dataSourceNumber + ".propertyChange(null);"*/"processDataBinding(\"" + field + "." + attr + "\");", "\n");
+ }
}
- else {
- jf.getMethod("onChangeFrom" + methodToInvoke.toString(), /*args*/null).appendBodyCode(/*"_DataSource" + dataSourceNumber + ".propertyChange(null);"*/"processDataBinding(\"" + field + "." + attr + "\");", "\n");
+ dbCreation.append("}\n");
+ dbDeletion.append("}\n");
+ dbProcess.append(gen.getBindingsToGenerate().get(field).get(attr)).append(");\n}\n");
+ if (listeners != null) {
+ //jf.addField(new JavaField(Modifier.PRIVATE, "java.beans.PropertyChangeListener", "_DataSource" + dataSourceNumber, "new org.nuiton.guix.runtime.DataBindingListener(this,\"" + field + "." + attr + "\")", null, null));
+ jf.getMethod("initDataBinding", null).appendBodyCode("applyDataBinding(\"" + field + "." + attr + "\");", "\n");
+ for (Class listener : listeners) {
+ final List<Method> listenerMethods = Arrays.asList(listener.getMethods());
+ Class parameterType = listenerMethods.get(0).getParameterTypes()[0];
+ }
}
+ dataSourceNumber++;
}
- dbCreation.append("}\n");
- dbDeletion.append("}\n");
- dbProcess.append(gen.getBindingsToGenerate().get(field).get(attr))
- .append(");\n}\n");
- if(listeners != null) {
- //jf.addField(new JavaField(Modifier.PRIVATE, "java.beans.PropertyChangeListener", "_DataSource" + dataSourceNumber, "new org.nuiton.guix.runtime.DataBindingListener(this,\"" + field + "." + attr + "\")", null, null));
- jf.getMethod("initDataBinding", null).appendBodyCode("applyDataBinding(\"" + field + "." + attr + "\");", "\n");
- for(Class listener : listeners) {
- final List<Method> listenerMethods = Arrays.asList(listener.getMethods());
- Class parameterType = listenerMethods.get(0).getParameterTypes()[0];
- }
- }
- dataSourceNumber++;
}
+ if (generatedFiles.get(jf.getSuperClass()) != null) {
+ dbCreation.append("else {\nsuper.applyDataBinding(_binding);\n" +
+ "return;\n}");
+ dbDeletion.append("\nelse {\nsuper.removeDataBinding(_binding);\n}\n");
+ }
+ dbCreation.append("\nprocessDataBinding(_binding);");
+ dbProcess.insert(0, "if (activeBindings.contains(_binding)) {\n" +
+ "return;\n}\n" +
+ "activeBindings.add(_binding);\ntry{\n");
+ dbProcess.append("\n} finally {\nactiveBindings.remove(_binding);\n}\n");
+ jf.addField(new JavaField(Modifier.PRIVATE, "java.util.List<String>", "activeBindings", "new java.util.ArrayList<String>()", "List of the active bindings", null), false);
+ jf.addMethod(new JavaMethod(Modifier.PUBLIC, "void", "applyDataBinding", new JavaArgument[]{new JavaArgument("String", "_binding")}, null, dbCreation.toString(), null));
+ jf.addMethod(new JavaMethod(Modifier.PUBLIC, "void", "removeDataBinding", new JavaArgument[]{new JavaArgument("String", "_binding")}, null, dbDeletion.toString(), null));
+ jf.addMethod(new JavaMethod(Modifier.PUBLIC, "void", "processDataBinding", new JavaArgument[]{new JavaArgument("String", "_binding")}, null, dbProcess.toString(), null));
+ gen.saveFiles();
}
- if(generatedFiles.get(jf.getSuperClass()) != null) {
- dbCreation.append("else {\nsuper.applyDataBinding(_binding);\n" +
- "return;\n}");
- dbDeletion.append("\nelse {\nsuper.removeDataBinding(_binding);\n}\n");
+ serializer.endTag("", "beans");
+ serializer.endDocument();
+ }
+ else {
+ if (log.isWarnEnabled()) {
+ log.warn("No generation language given");
}
- dbCreation.append("\nprocessDataBinding(_binding);");
- dbProcess.insert(0, "if (activeBindings.contains(_binding)) {\n" +
- "return;\n}\n" +
- "activeBindings.add(_binding);\ntry{\n");
- dbProcess.append("\n} finally {\nactiveBindings.remove(_binding);\n}\n");
- jf.addField(new JavaField(Modifier.PRIVATE, "java.util.List<String>", "activeBindings", "new java.util.ArrayList<String>()", "List of the active bindings", null), false);
- jf.addMethod(new JavaMethod(Modifier.PUBLIC, "void", "applyDataBinding", new JavaArgument[]{new JavaArgument("String", "_binding")}, null, dbCreation.toString(), null));
- jf.addMethod(new JavaMethod(Modifier.PUBLIC, "void", "removeDataBinding", new JavaArgument[]{new JavaArgument("String", "_binding")}, null, dbDeletion.toString(), null));
- jf.addMethod(new JavaMethod(Modifier.PUBLIC, "void", "processDataBinding", new JavaArgument[]{new JavaArgument("String", "_binding")}, null, dbProcess.toString(), null));
- gen.saveFiles();
}
- serializer.endTag("", "beans");
- serializer.endDocument();
}
- else {
- if(log.isWarnEnabled()) {
- log.warn("No generation language given");
- }
- }
}
catch (Throwable e) {
e.printStackTrace();
@@ -374,7 +372,6 @@
}
}
-
/**
* Registers a ClassDescriptor
*
@@ -432,10 +429,8 @@
private List<String> browseNode(SimpleNode node) {
List<String> result = new ArrayList<String>();
- for(int i = 0 ; i < node.jjtGetNumChildren() ; i++) {
- if(node.getChild(i).getId() == JavaParserTreeConstants.JJTPRIMARYEXPRESSION
- && !node.getChild(i).getText().trim().startsWith("(")
- && !node.getChild(i).getText().trim().startsWith("\"")) {
+ for (int i = 0; i < node.jjtGetNumChildren(); i++) {
+ if (node.getChild(i).getId() == JavaParserTreeConstants.JJTPRIMARYEXPRESSION && !node.getChild(i).getText().trim().startsWith("(") && !node.getChild(i).getText().trim().startsWith("\"")) {
result.add(node.getChild(i).getText().trim());
}
result.addAll(browseNode(node.getChild(i)));
Modified: trunk/guix-compiler/src/main/java/org/nuiton/guix/compiler/GuixCompiler.java
===================================================================
--- trunk/guix-compiler/src/main/java/org/nuiton/guix/compiler/GuixCompiler.java 2009-07-23 10:48:07 UTC (rev 1510)
+++ trunk/guix-compiler/src/main/java/org/nuiton/guix/compiler/GuixCompiler.java 2009-07-23 10:49:18 UTC (rev 1511)
@@ -174,8 +174,8 @@
File styleFile = new File(src.getParentFile(), className + ".css");
if (styleFile.exists()) {
+ rootMO.getCssFiles().add(styleFile);
StyleSheet ss = styleHandler.autoDetectStyleFile(styleFile);
-
rootMO.getStyleSheets().add(ss);
lastModification = Math.max(lastModification, styleFile.lastModified());
}
@@ -260,6 +260,7 @@
}
if ((styleFile != null) && styleFile.exists()) {
+ rootMO.getCssFiles().add(styleFile);
lastModification = Math.max(lastModification, styleFile.lastModified());
}
Modified: trunk/guix-compiler/src/main/java/org/nuiton/guix/generator/Generator.java
===================================================================
--- trunk/guix-compiler/src/main/java/org/nuiton/guix/generator/Generator.java 2009-07-23 10:48:07 UTC (rev 1510)
+++ trunk/guix-compiler/src/main/java/org/nuiton/guix/generator/Generator.java 2009-07-23 10:49:18 UTC (rev 1511)
@@ -57,6 +57,10 @@
public void setClasses(List<String> classes);
+ public List<File> getCSSFiles();
+
+ public void setCSSFiles(List<File> cssFiles);
+
public String getLauncherName();
public void setLauncherName(String launcherName);
Modified: trunk/guix-compiler/src/main/java/org/nuiton/guix/generator/GuixGenerator.java
===================================================================
--- trunk/guix-compiler/src/main/java/org/nuiton/guix/generator/GuixGenerator.java 2009-07-23 10:48:07 UTC (rev 1510)
+++ trunk/guix-compiler/src/main/java/org/nuiton/guix/generator/GuixGenerator.java 2009-07-23 10:49:18 UTC (rev 1511)
@@ -46,6 +46,8 @@
protected XmlSerializer serializer = null;
/** List of the classes to generate */
protected List<String> classes = null;
+ /** List of the CSS files needed of the generation */
+ protected List<File> cssFiles = null;
/** Name to give to the generated launcher*/
protected String launcherName = null;
/** */
@@ -101,6 +103,15 @@
this.classes = classes;
}
+
+ public List<File> getCSSFiles() {
+ return cssFiles;
+ }
+
+ public void setCSSFiles(List<File> cssFiles) {
+ this.cssFiles = cssFiles;
+ }
+
public String getLauncherName() {
return launcherName;
}
Modified: trunk/guix-compiler/src/main/java/org/nuiton/guix/model/GuixModelObject.java
===================================================================
--- trunk/guix-compiler/src/main/java/org/nuiton/guix/model/GuixModelObject.java 2009-07-23 10:48:07 UTC (rev 1510)
+++ trunk/guix-compiler/src/main/java/org/nuiton/guix/model/GuixModelObject.java 2009-07-23 10:49:18 UTC (rev 1511)
@@ -21,6 +21,7 @@
//~--- JDK imports ------------------------------------------------------------
+import java.io.File;
import java.util.ArrayList;
import java.util.List;
@@ -43,6 +44,12 @@
*/
private List<StyleSheet> styleSheets = new ArrayList<StyleSheet>();
+ /**
+ * The stylesheets files associated to the object
+ * (in case the object is a root model object)
+ */
+ private List<File> cssFiles = new ArrayList<File>();
+
/** The descriptor the class of the object */
private ClassDescriptor classDescriptor;
@@ -139,6 +146,14 @@
this.styleSheets = styleSheets;
}
+ public List<File> getCssFiles() {
+ return cssFiles;
+ }
+
+ public void setCssFiles(List<File> cssFiles) {
+ this.cssFiles = cssFiles;
+ }
+
public String getStyleClass() {
return styleClass;
}
@@ -147,6 +162,3 @@
this.styleClass = styleClass;
}
}
-
-
-//~ Formatted by Jindent --- http://www.jindent.com
Modified: trunk/guix-compiler/src/main/java/org/nuiton/guix/tags/StyleHandler.java
===================================================================
--- trunk/guix-compiler/src/main/java/org/nuiton/guix/tags/StyleHandler.java 2009-07-23 10:48:07 UTC (rev 1510)
+++ trunk/guix-compiler/src/main/java/org/nuiton/guix/tags/StyleHandler.java 2009-07-23 10:49:18 UTC (rev 1511)
@@ -44,6 +44,7 @@
import java.util.HashMap;
import java.util.List;
import java.util.Map;
+import org.nuiton.guix.css.ParseException;
/**
* Handles the <code>style</code> tag.
*
@@ -277,24 +278,31 @@
// parses the CSS
CSSParser p = new CSSParser(new StringReader(stylesheetText));
- SimpleNode node = p.Stylesheet();
- List<Rule> rules = new ArrayList<Rule>();
+ try {
+ SimpleNode node = p.Stylesheet();
+ List<Rule> rules = new ArrayList<Rule>();
- // analyses each rule
- for (int i = 0; i < node.jjtGetNumChildren(); i++) {
- SimpleNode ruleNode = node.getChild(i);
- Rule rule = processRule(ruleNode);
+ // analyses each rule
+ for (int i = 0; i < node.jjtGetNumChildren(); i++) {
+ SimpleNode ruleNode = node.getChild(i);
+ Rule rule = processRule(ruleNode);
+ rules.add(rule);
- rules.add(rule);
- }
+ }
- StyleSheet styleSheet = new StyleSheet();
+ StyleSheet styleSheet = new StyleSheet();
- styleSheet.setRules(rules);
- styleSheet.setSelectors(selectors);
+ styleSheet.setRules(rules);
+ styleSheet.setSelectors(selectors);
- return styleSheet;
-
+ return styleSheet;
+
+ } catch(ParseException eee) {
+ if(log.isWarnEnabled()) {
+ log.warn(eee);
+ }
+ }
+ return null;
}
/**
1
0
Author: kmorin
Date: 2009-07-23 12:48:07 +0200 (Thu, 23 Jul 2009)
New Revision: 1510
Modified:
trunk/pom.xml
Log:
removed the unuseful dependencies
Modified: trunk/pom.xml
===================================================================
--- trunk/pom.xml 2009-07-22 13:44:11 UTC (rev 1509)
+++ trunk/pom.xml 2009-07-23 10:48:07 UTC (rev 1510)
@@ -120,12 +120,6 @@
</dependency>
<dependency>
- <groupId>net.java.dev.beansbinding</groupId>
- <artifactId>beansbinding</artifactId>
- <version>1.2.1</version>
- </dependency>
-
- <dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
<version>${spring.version}</version>
1
0
r1509 - in trunk/guix-test-gwt/src/main/java/org/nuiton/guix: client demo
by kmorin@users.labs.libre-entreprise.org July 22, 2009
by kmorin@users.labs.libre-entreprise.org July 22, 2009
July 22, 2009
Author: kmorin
Date: 2009-07-22 15:44:11 +0200 (Wed, 22 Jul 2009)
New Revision: 1509
Modified:
trunk/guix-test-gwt/src/main/java/org/nuiton/guix/client/GuixDemo.java
trunk/guix-test-gwt/src/main/java/org/nuiton/guix/client/GuixDemo2.java
trunk/guix-test-gwt/src/main/java/org/nuiton/guix/client/GuixDemo2Abstract.java
trunk/guix-test-gwt/src/main/java/org/nuiton/guix/client/GuixDemo2Impl.java
trunk/guix-test-gwt/src/main/java/org/nuiton/guix/client/GuixDemo3.java
trunk/guix-test-gwt/src/main/java/org/nuiton/guix/client/GuixDemo3Abstract.java
trunk/guix-test-gwt/src/main/java/org/nuiton/guix/client/GuixDemo3Impl.java
trunk/guix-test-gwt/src/main/java/org/nuiton/guix/client/GuixDemoAbstract.java
trunk/guix-test-gwt/src/main/java/org/nuiton/guix/client/GuixDemoImpl.java
trunk/guix-test-gwt/src/main/java/org/nuiton/guix/demo/GuixDemo.css
trunk/guix-test-gwt/src/main/java/org/nuiton/guix/demo/GuixDemo.guix
Log:
example with the binding
Modified: trunk/guix-test-gwt/src/main/java/org/nuiton/guix/client/GuixDemo.java
===================================================================
--- trunk/guix-test-gwt/src/main/java/org/nuiton/guix/client/GuixDemo.java 2009-07-22 13:10:50 UTC (rev 1508)
+++ trunk/guix-test-gwt/src/main/java/org/nuiton/guix/client/GuixDemo.java 2009-07-22 13:44:11 UTC (rev 1509)
@@ -12,52 +12,54 @@
* test javadoc Application
*/
public interface GuixDemo {
- /*---------------------------------------------------------------------------------*/
- /*-- public acessor methods -------------------------------------------------------*/
- /*---------------------------------------------------------------------------------*/
-
- public GuixDemo3Abstract getBt3();
-
- public GuixDemo3Abstract getBt31();
-
- public GuixDemo3Abstract getBt32();
-
- public GuixDemo3Abstract getBt34();
-
- public GuixDemo2Abstract getGd2();
-
- public com.google.gwt.user.client.ui.FlexTable getTable1();
-
- /*---------------------------------------------------------------------------------*/
- /*-- public mutator methods -------------------------------------------------------*/
- /*---------------------------------------------------------------------------------*/
-
- public void beforeBinding();
-
- public void beforeCreation();
-
- public void beforeInitialization();
-
- /**
- * Components creation
- */
- public void componentsCreation();
-
- /**
- * components layout
- */
- public void componentsTree();
-
- public void inTheEnd();
-
- /**
- * initilization of databinding
- */
- public void initDataBinding();
-
- /**
- * initialization
- */
- public void initialize();
-
-}
\ No newline at end of file
+ /*---------------------------------------------------------------------------------*/
+ /*-- public acessor methods -------------------------------------------------------*/
+ /*---------------------------------------------------------------------------------*/
+
+ public GuixDemo3Abstract getBt3();
+
+ public GuixDemo3Abstract getBt31();
+
+ public GuixDemo3Abstract getBt32();
+
+ public GuixDemo3Abstract getBt34();
+
+ public GuixDemo2Abstract getGd2();
+
+ public GuixDemo2Abstract getGd22();
+
+ public com.google.gwt.user.client.ui.FlexTable getTable1();
+
+ /*---------------------------------------------------------------------------------*/
+ /*-- public mutator methods -------------------------------------------------------*/
+ /*---------------------------------------------------------------------------------*/
+
+ public void beforeBinding();
+
+ public void beforeCreation();
+
+ public void beforeInitialization();
+
+ /**
+ * Components creation
+ */
+ public void componentsCreation();
+
+ /**
+ * components layout
+ */
+ public void componentsTree();
+
+ public void inTheEnd();
+
+ /**
+ * initilization of databinding
+ */
+ public void initDataBinding();
+
+ /**
+ * initialization
+ */
+ public void initialize();
+
+ }
\ No newline at end of file
Modified: trunk/guix-test-gwt/src/main/java/org/nuiton/guix/client/GuixDemo2.java
===================================================================
--- trunk/guix-test-gwt/src/main/java/org/nuiton/guix/client/GuixDemo2.java 2009-07-22 13:10:50 UTC (rev 1508)
+++ trunk/guix-test-gwt/src/main/java/org/nuiton/guix/client/GuixDemo2.java 2009-07-22 13:44:11 UTC (rev 1509)
@@ -6,36 +6,42 @@
* test javadoc Application
*/
public interface GuixDemo2 {
- /*---------------------------------------------------------------------------------*/
- /*-- public mutator methods -------------------------------------------------------*/
- /*---------------------------------------------------------------------------------*/
-
- public void beforeBinding();
-
- public void beforeCreation();
-
- public void beforeInitialization();
-
- /**
- * Components creation
- */
- public void componentsCreation();
-
- /**
- * components layout
- */
- public void componentsTree();
-
- public void inTheEnd();
-
- /**
- * initilization of databinding
- */
- public void initDataBinding();
-
- /**
- * initialization
- */
- public void initialize();
-
-}
\ No newline at end of file
+ /*---------------------------------------------------------------------------------*/
+ /*-- public acessor methods -------------------------------------------------------*/
+ /*---------------------------------------------------------------------------------*/
+
+ public ToggleButton getButton();
+
+ /*---------------------------------------------------------------------------------*/
+ /*-- public mutator methods -------------------------------------------------------*/
+ /*---------------------------------------------------------------------------------*/
+
+ public void beforeBinding();
+
+ public void beforeCreation();
+
+ public void beforeInitialization();
+
+ /**
+ * Components creation
+ */
+ public void componentsCreation();
+
+ /**
+ * components layout
+ */
+ public void componentsTree();
+
+ public void inTheEnd();
+
+ /**
+ * initilization of databinding
+ */
+ public void initDataBinding();
+
+ /**
+ * initialization
+ */
+ public void initialize();
+
+ }
\ No newline at end of file
Modified: trunk/guix-test-gwt/src/main/java/org/nuiton/guix/client/GuixDemo2Abstract.java
===================================================================
--- trunk/guix-test-gwt/src/main/java/org/nuiton/guix/client/GuixDemo2Abstract.java 2009-07-22 13:10:50 UTC (rev 1508)
+++ trunk/guix-test-gwt/src/main/java/org/nuiton/guix/client/GuixDemo2Abstract.java 2009-07-22 13:44:11 UTC (rev 1509)
@@ -6,100 +6,136 @@
* test javadoc Application
*/
public abstract class GuixDemo2Abstract extends com.google.gwt.user.client.ui.FlowPanel implements GuixDemo2 {
- /**
- * test javadoc Application
- */
- private final ToggleButton button = new ToggleButton();
-
- /*---------------------------------------------------------------------------------*/
- /*-- Constructors -----------------------------------------------------------------*/
- /*---------------------------------------------------------------------------------*/
-
- /**
- * Constructor
- */
- public GuixDemo2Abstract() {
- initialize();
- }
-
- /*---------------------------------------------------------------------------------*/
- /*-- public acessor methods -------------------------------------------------------*/
- /*---------------------------------------------------------------------------------*/
-
- public ToggleButton getButton() {
- return button;
- }
-
- /*---------------------------------------------------------------------------------*/
- /*-- public mutator methods -------------------------------------------------------*/
- /*---------------------------------------------------------------------------------*/
-
- public void beforeBinding() {
-
- }
-
- public void beforeCreation() {
-
- }
-
- public void beforeInitialization() {
-
- }
-
- /**
- * Components creation
- */
- public void componentsCreation() {
- createButton();
- }
-
- /**
- * Components initialization
- */
- public void componentsTree() {
- this.add(button);
- }
-
- public void inTheEnd() {
-
- }
-
- /**
- * initilization of databinding
- */
- public void initDataBinding() {
- //TODO
- }
-
- /**
- * initialization
- */
- public void initialize() {
- beforeCreation();
- componentsCreation();
-
- beforeInitialization();
- componentsTree();
- beforeBinding();
- initDataBinding();
- inTheEnd();
- }
-
- /*---------------------------------------------------------------------------------*/
- /*-- ui creation methods ----------------------------------------------------------*/
- /*---------------------------------------------------------------------------------*/
-
- /**
- * button creation
- */
- private void createButton() {
- button.setText("Push me");
- button.setDown(true);
- button.addClickListener(new com.google.gwt.user.client.ui.ClickListener() {
- public void onClick(com.google.gwt.user.client.ui.Widget widget){
- System.out.println("test");
- }
- });
- }
-
-}
\ No newline at end of file
+ /**
+ * List of the active bindings
+ */
+ private java.util.List<String> activeBindings = new java.util.ArrayList<String>();
+ private final com.google.gwt.user.client.ui.ToggleButton button = new ToggleButton("Up","Down");
+ /**
+ * test javadoc Application
+ */
+ private final org.nuiton.guix.client.GuixDemo2Abstract guixdemo2 = this;
+
+ /*---------------------------------------------------------------------------------*/
+ /*-- Constructors -----------------------------------------------------------------*/
+ /*---------------------------------------------------------------------------------*/
+
+ /**
+ * Constructor
+ */
+ public GuixDemo2Abstract() {
+ initialize();
+ }
+
+ /*---------------------------------------------------------------------------------*/
+ /*-- JAXXObject implementation ----------------------------------------------------*/
+ /*---------------------------------------------------------------------------------*/
+
+ public void applyDataBinding(String _binding) {
+ processDataBinding(_binding);
+ }
+
+ public void processDataBinding(String _binding) {
+ if (activeBindings.contains(_binding)) {
+ return;
+ }
+ activeBindings.add(_binding);
+ try{
+
+ } finally {
+ activeBindings.remove(_binding);
+ }
+ }
+
+ public void removeDataBinding(String _binding) {
+
+ }
+
+ /*---------------------------------------------------------------------------------*/
+ /*-- public acessor methods -------------------------------------------------------*/
+ /*---------------------------------------------------------------------------------*/
+
+ public java.util.List<String> getActiveBindings() {
+ return activeBindings;
+ }
+
+ public com.google.gwt.user.client.ui.ToggleButton getButton() {
+ return button;
+ }
+
+ public org.nuiton.guix.client.GuixDemo2Abstract getGuixdemo2() {
+ return guixdemo2;
+ }
+
+ /*---------------------------------------------------------------------------------*/
+ /*-- public mutator methods -------------------------------------------------------*/
+ /*---------------------------------------------------------------------------------*/
+
+ public void beforeBinding() {
+
+ }
+
+ public void beforeCreation() {
+
+ }
+
+ public void beforeInitialization() {
+
+ }
+
+ /**
+ * Components creation
+ */
+ public void componentsCreation() {
+ createButton();
+ }
+
+ /**
+ * Components initialization
+ */
+ public void componentsTree() {
+ this.add(button);
+ }
+
+ public void inTheEnd() {
+
+ }
+
+ /**
+ * initilization of databinding
+ */
+ public void initDataBinding() {
+ //TODO
+ }
+
+ /**
+ * initialization
+ */
+ public void initialize() {
+ beforeCreation();
+ componentsCreation();
+
+ beforeInitialization();
+ componentsTree();
+ beforeBinding();
+ initDataBinding();
+ inTheEnd();
+ }
+
+ /*---------------------------------------------------------------------------------*/
+ /*-- ui creation methods ----------------------------------------------------------*/
+ /*---------------------------------------------------------------------------------*/
+
+ /**
+ * button creation
+ */
+ private void createButton() {
+ button.setDown(true);
+ button.addClickListener(new com.google.gwt.user.client.ui.ClickListener() {
+ public void onClick(com.google.gwt.user.client.ui.Widget arg0){
+ System.out.println("hey dude !");
+ }
+ });
+ }
+
+ }
\ No newline at end of file
Modified: trunk/guix-test-gwt/src/main/java/org/nuiton/guix/client/GuixDemo2Impl.java
===================================================================
--- trunk/guix-test-gwt/src/main/java/org/nuiton/guix/client/GuixDemo2Impl.java 2009-07-22 13:10:50 UTC (rev 1508)
+++ trunk/guix-test-gwt/src/main/java/org/nuiton/guix/client/GuixDemo2Impl.java 2009-07-22 13:44:11 UTC (rev 1509)
@@ -6,15 +6,15 @@
* test javadoc Application
*/
public class GuixDemo2Impl extends GuixDemo2Abstract {
- /*---------------------------------------------------------------------------------*/
- /*-- Constructors -----------------------------------------------------------------*/
- /*---------------------------------------------------------------------------------*/
-
- /**
- * Constructor
- */
- public GuixDemo2Impl() {
- super();
- }
-
-}
\ No newline at end of file
+ /*---------------------------------------------------------------------------------*/
+ /*-- Constructors -----------------------------------------------------------------*/
+ /*---------------------------------------------------------------------------------*/
+
+ /**
+ * Constructor
+ */
+ public GuixDemo2Impl() {
+ super();
+ }
+
+ }
\ No newline at end of file
Modified: trunk/guix-test-gwt/src/main/java/org/nuiton/guix/client/GuixDemo3.java
===================================================================
--- trunk/guix-test-gwt/src/main/java/org/nuiton/guix/client/GuixDemo3.java 2009-07-22 13:10:50 UTC (rev 1508)
+++ trunk/guix-test-gwt/src/main/java/org/nuiton/guix/client/GuixDemo3.java 2009-07-22 13:44:11 UTC (rev 1509)
@@ -4,36 +4,36 @@
* test javadoc Application
*/
public interface GuixDemo3 {
- /*---------------------------------------------------------------------------------*/
- /*-- public mutator methods -------------------------------------------------------*/
- /*---------------------------------------------------------------------------------*/
-
- public void beforeBinding();
-
- public void beforeCreation();
-
- public void beforeInitialization();
-
- /**
- * Components creation
- */
- public void componentsCreation();
-
- /**
- * components layout
- */
- public void componentsTree();
-
- public void inTheEnd();
-
- /**
- * initilization of databinding
- */
- public void initDataBinding();
-
- /**
- * initialization
- */
- public void initialize();
-
-}
\ No newline at end of file
+ /*---------------------------------------------------------------------------------*/
+ /*-- public mutator methods -------------------------------------------------------*/
+ /*---------------------------------------------------------------------------------*/
+
+ public void beforeBinding();
+
+ public void beforeCreation();
+
+ public void beforeInitialization();
+
+ /**
+ * Components creation
+ */
+ public void componentsCreation();
+
+ /**
+ * components layout
+ */
+ public void componentsTree();
+
+ public void inTheEnd();
+
+ /**
+ * initilization of databinding
+ */
+ public void initDataBinding();
+
+ /**
+ * initialization
+ */
+ public void initialize();
+
+ }
\ No newline at end of file
Modified: trunk/guix-test-gwt/src/main/java/org/nuiton/guix/client/GuixDemo3Abstract.java
===================================================================
--- trunk/guix-test-gwt/src/main/java/org/nuiton/guix/client/GuixDemo3Abstract.java 2009-07-22 13:10:50 UTC (rev 1508)
+++ trunk/guix-test-gwt/src/main/java/org/nuiton/guix/client/GuixDemo3Abstract.java 2009-07-22 13:44:11 UTC (rev 1509)
@@ -4,70 +4,115 @@
* test javadoc Application
*/
public abstract class GuixDemo3Abstract extends com.google.gwt.user.client.ui.Button implements GuixDemo3 {
- /*---------------------------------------------------------------------------------*/
- /*-- Constructors -----------------------------------------------------------------*/
- /*---------------------------------------------------------------------------------*/
-
- /**
- * Constructor
- */
- public GuixDemo3Abstract() {
- initialize();
- }
-
- /*---------------------------------------------------------------------------------*/
- /*-- public mutator methods -------------------------------------------------------*/
- /*---------------------------------------------------------------------------------*/
-
- public void beforeBinding() {
-
- }
-
- public void beforeCreation() {
-
- }
-
- public void beforeInitialization() {
-
- }
-
- /**
- * Components creation
- */
- public void componentsCreation() {
-
- }
-
- /**
- * Components initialization
- */
- public void componentsTree() {
- this.setText("GuixDemo3");
- }
-
- public void inTheEnd() {
-
- }
-
- /**
- * initilization of databinding
- */
- public void initDataBinding() {
- //TODO
- }
-
- /**
- * initialization
- */
- public void initialize() {
- beforeCreation();
- componentsCreation();
-
- beforeInitialization();
- componentsTree();
- beforeBinding();
- initDataBinding();
- inTheEnd();
- }
-
-}
\ No newline at end of file
+ /**
+ * List of the active bindings
+ */
+ private java.util.List<String> activeBindings = new java.util.ArrayList<String>();
+ /**
+ * test javadoc Application
+ */
+ private final org.nuiton.guix.client.GuixDemo3Abstract guixdemo3 = this;
+
+ /*---------------------------------------------------------------------------------*/
+ /*-- Constructors -----------------------------------------------------------------*/
+ /*---------------------------------------------------------------------------------*/
+
+ /**
+ * Constructor
+ */
+ public GuixDemo3Abstract() {
+ initialize();
+ }
+
+ /*---------------------------------------------------------------------------------*/
+ /*-- JAXXObject implementation ----------------------------------------------------*/
+ /*---------------------------------------------------------------------------------*/
+
+ public void applyDataBinding(String _binding) {
+ processDataBinding(_binding);
+ }
+
+ public void processDataBinding(String _binding) {
+ if (activeBindings.contains(_binding)) {
+ return;
+ }
+ activeBindings.add(_binding);
+ try{
+
+ } finally {
+ activeBindings.remove(_binding);
+ }
+ }
+
+ public void removeDataBinding(String _binding) {
+
+ }
+
+ /*---------------------------------------------------------------------------------*/
+ /*-- public acessor methods -------------------------------------------------------*/
+ /*---------------------------------------------------------------------------------*/
+
+ public java.util.List<String> getActiveBindings() {
+ return activeBindings;
+ }
+
+ public org.nuiton.guix.client.GuixDemo3Abstract getGuixdemo3() {
+ return guixdemo3;
+ }
+
+ /*---------------------------------------------------------------------------------*/
+ /*-- public mutator methods -------------------------------------------------------*/
+ /*---------------------------------------------------------------------------------*/
+
+ public void beforeBinding() {
+
+ }
+
+ public void beforeCreation() {
+
+ }
+
+ public void beforeInitialization() {
+
+ }
+
+ /**
+ * Components creation
+ */
+ public void componentsCreation() {
+
+ }
+
+ /**
+ * Components initialization
+ */
+ public void componentsTree() {
+ this.setText("GuixDemo3");
+ }
+
+ public void inTheEnd() {
+
+ }
+
+ /**
+ * initilization of databinding
+ */
+ public void initDataBinding() {
+ //TODO
+ }
+
+ /**
+ * initialization
+ */
+ public void initialize() {
+ beforeCreation();
+ componentsCreation();
+
+ beforeInitialization();
+ componentsTree();
+ beforeBinding();
+ initDataBinding();
+ inTheEnd();
+ }
+
+ }
\ No newline at end of file
Modified: trunk/guix-test-gwt/src/main/java/org/nuiton/guix/client/GuixDemo3Impl.java
===================================================================
--- trunk/guix-test-gwt/src/main/java/org/nuiton/guix/client/GuixDemo3Impl.java 2009-07-22 13:10:50 UTC (rev 1508)
+++ trunk/guix-test-gwt/src/main/java/org/nuiton/guix/client/GuixDemo3Impl.java 2009-07-22 13:44:11 UTC (rev 1509)
@@ -4,15 +4,15 @@
* test javadoc Application
*/
public class GuixDemo3Impl extends GuixDemo3Abstract {
- /*---------------------------------------------------------------------------------*/
- /*-- Constructors -----------------------------------------------------------------*/
- /*---------------------------------------------------------------------------------*/
-
- /**
- * Constructor
- */
- public GuixDemo3Impl() {
- super();
- }
-
-}
\ No newline at end of file
+ /*---------------------------------------------------------------------------------*/
+ /*-- Constructors -----------------------------------------------------------------*/
+ /*---------------------------------------------------------------------------------*/
+
+ /**
+ * Constructor
+ */
+ public GuixDemo3Impl() {
+ super();
+ }
+
+ }
\ No newline at end of file
Modified: trunk/guix-test-gwt/src/main/java/org/nuiton/guix/client/GuixDemoAbstract.java
===================================================================
--- trunk/guix-test-gwt/src/main/java/org/nuiton/guix/client/GuixDemoAbstract.java 2009-07-22 13:10:50 UTC (rev 1508)
+++ trunk/guix-test-gwt/src/main/java/org/nuiton/guix/client/GuixDemoAbstract.java 2009-07-22 13:44:11 UTC (rev 1509)
@@ -9,360 +9,494 @@
import org.nuiton.guix.client.GuixDemo2Abstract;
import com.google.gwt.user.client.ui.Button;
import com.google.gwt.user.client.Command;
-import com.google.gwt.user.client.ui.PopupPanel;
/**
* test javadoc Application
*/
public abstract class GuixDemoAbstract extends com.google.gwt.user.client.ui.VerticalPanel implements GuixDemo {
- private final MenuBar $Menu2 = new MenuBar();
- private final MenuBar $Menu4 = new MenuBar();
- private final MenuBar $Menu6 = new MenuBar();
- private final MenuBar $MenuBar1 = new MenuBar();
- private final TabPanel $TabPanel9 = new TabPanel();
- private final GuixDemo3Abstract bt3 = new GuixDemo3Impl();
- private final GuixDemo3Abstract bt31 = new GuixDemo3Impl();
- private final GuixDemo3Abstract bt32 = new GuixDemo3Impl();
- private final GuixDemo3Abstract bt34 = new GuixDemo3Impl();
- private final GuixDemo2Abstract gd2 = new GuixDemo2Impl();
- private final Label label = new Label();
- private final Label label2 = new Label();
- private final Label label3 = new Label();
- private final FlexTable table1 = new FlexTable();
- /**
- * javadoc textfield
- */
- private final TextBox textfield = new TextBox();
-
- /* begin raw body code */
- private Button b = new Button("test");
- private Command cmd = new Command() {
- public void execute() {
- final com.google.gwt.user.client.ui.PopupPanel pp = new com.google.gwt.user.client.ui.PopupPanel(true);
- pp.add(new com.google.gwt.user.client.ui.Label("Action performed!"));
- pp.show();
- }
- };
- public enum Day {
- SUNDAY, MONDAY, TUESDAY, WEDNESDAY,
- THURSDAY, FRIDAY, SATURDAY
- }
- /* end raw body code */
- /*---------------------------------------------------------------------------------*/
- /*-- Statics methods --------------------------------------------------------------*/
- /*---------------------------------------------------------------------------------*/
-
- public static void testSameName() {
- System.out.println("load the script file with the same name");
- }
-
- /*---------------------------------------------------------------------------------*/
- /*-- Constructors -----------------------------------------------------------------*/
- /*---------------------------------------------------------------------------------*/
-
- /**
- * Constructor
- */
- public GuixDemoAbstract() {
- initialize();
- }
-
- /*---------------------------------------------------------------------------------*/
- /*-- public acessor methods -------------------------------------------------------*/
- /*---------------------------------------------------------------------------------*/
-
- public MenuBar get$Menu2() {
- return $Menu2;
- }
-
- public MenuBar get$Menu4() {
- return $Menu4;
- }
-
- public MenuBar get$Menu6() {
- return $Menu6;
- }
-
- public MenuBar get$MenuBar1() {
- return $MenuBar1;
- }
-
- public TabPanel get$TabPanel9() {
- return $TabPanel9;
- }
-
- public GuixDemo3Abstract getBt3() {
- return bt3;
- }
-
- public GuixDemo3Abstract getBt31() {
- return bt31;
- }
-
- public GuixDemo3Abstract getBt32() {
- return bt32;
- }
-
- public GuixDemo3Abstract getBt34() {
- return bt34;
- }
-
- public GuixDemo2Abstract getGd2() {
- return gd2;
- }
-
- public Label getLabel() {
- return label;
- }
-
- public Label getLabel2() {
- return label2;
- }
-
- public Label getLabel3() {
- return label3;
- }
-
- public FlexTable getTable1() {
- return table1;
- }
-
- public TextBox getTextfield() {
- return textfield;
- }
-
- /*---------------------------------------------------------------------------------*/
- /*-- public mutator methods -------------------------------------------------------*/
- /*---------------------------------------------------------------------------------*/
-
- public void beforeBinding() {
- this.add(b);
- }
-
- public void beforeCreation() {
- System.out.println("before Creation");
- }
-
- public void beforeInitialization() {
-
- }
-
- /**
- * Components creation
- */
- public void componentsCreation() {
- create$MenuBar1();
- create$TabPanel9();
- createTextfield();
- createLabel();
- createLabel2();
- createBt3();
- createBt31();
- createBt32();
- createBt34();
- createLabel3();
- createTable1();
- createGd2();
- }
-
- /**
- * Components initialization
- */
- public void componentsTree() {
- this.add($MenuBar1);
- $MenuBar1.addItem("menu 1",$Menu2);
- $Menu2.addItem("item11",cmd);
- $Menu2.addItem("item12",cmd);
- $MenuBar1.addItem("menu 2",$Menu4);
- $Menu4.addItem("item21",cmd);
- $Menu4.addItem("item22",$Menu6);
- $Menu6.addItem("item221",cmd);
- $Menu6.addItem("item222",cmd);
- this.add($TabPanel9);
- $TabPanel9.add(table1,"Table");
- table1.getRowFormatter().addStyleName(0,"Row");
- table1.setWidget(0,0,textfield);
- table1.getFlexCellFormatter().setHorizontalAlignment(0,0,com.google.gwt.user.client.ui.HasHorizontalAlignment.ALIGN_DEFAULT);
- table1.getFlexCellFormatter().setVerticalAlignment(0,0,com.google.gwt.user.client.ui.HasVerticalAlignment.ALIGN_TOP);
- table1.getFlexCellFormatter().addStyleName(0,0, "Cell");
- table1.setWidget(0,1,label);
- table1.getFlexCellFormatter().setHorizontalAlignment(0,1,com.google.gwt.user.client.ui.HasHorizontalAlignment.ALIGN_DEFAULT);
- table1.getFlexCellFormatter().setVerticalAlignment(0,1,com.google.gwt.user.client.ui.HasVerticalAlignment.ALIGN_TOP);
- table1.getFlexCellFormatter().addStyleName(0,1, "Cell");
- table1.setWidget(0,2,label2);
- table1.getFlexCellFormatter().setRowSpan(0,2,3);
- table1.getFlexCellFormatter().setHorizontalAlignment(0,2,com.google.gwt.user.client.ui.HasHorizontalAlignment.ALIGN_DEFAULT);
- table1.getFlexCellFormatter().setVerticalAlignment(0,2,com.google.gwt.user.client.ui.HasVerticalAlignment.ALIGN_TOP);
- table1.getFlexCellFormatter().addStyleName(0,2, "Cell");
- table1.getRowFormatter().addStyleName(1,"Row");
- table1.setWidget(1,0,bt3);
- table1.getFlexCellFormatter().setColSpan(1,0,3);
- table1.getFlexCellFormatter().setHorizontalAlignment(1,0,com.google.gwt.user.client.ui.HasHorizontalAlignment.ALIGN_DEFAULT);
- table1.getFlexCellFormatter().setVerticalAlignment(1,0,com.google.gwt.user.client.ui.HasVerticalAlignment.ALIGN_TOP);
- table1.getFlexCellFormatter().addStyleName(1,0, "Cell");
- table1.getRowFormatter().addStyleName(2,"Row");
- table1.setWidget(2,0,bt31);
- table1.getFlexCellFormatter().setColSpan(2,0,2);
- table1.getFlexCellFormatter().setHorizontalAlignment(2,0,com.google.gwt.user.client.ui.HasHorizontalAlignment.ALIGN_DEFAULT);
- table1.getFlexCellFormatter().setVerticalAlignment(2,0,com.google.gwt.user.client.ui.HasVerticalAlignment.ALIGN_TOP);
- table1.getFlexCellFormatter().addStyleName(2,0, "Cell");
- table1.setWidget(2,2,bt32);
- table1.getFlexCellFormatter().setHorizontalAlignment(2,2,com.google.gwt.user.client.ui.HasHorizontalAlignment.ALIGN_DEFAULT);
- table1.getFlexCellFormatter().setVerticalAlignment(2,2,com.google.gwt.user.client.ui.HasVerticalAlignment.ALIGN_TOP);
- table1.getFlexCellFormatter().addStyleName(2,2, "Cell");
- table1.getRowFormatter().addStyleName(3,"Row");
- table1.setWidget(3,0,bt34);
- table1.getFlexCellFormatter().setColSpan(3,0,3);
- table1.getFlexCellFormatter().setHorizontalAlignment(3,0,com.google.gwt.user.client.ui.HasHorizontalAlignment.ALIGN_DEFAULT);
- table1.getFlexCellFormatter().setVerticalAlignment(3,0,com.google.gwt.user.client.ui.HasVerticalAlignment.ALIGN_TOP);
- table1.getFlexCellFormatter().addStyleName(3,0, "Cell");
- table1.getRowFormatter().addStyleName(4,"Row");
- table1.setWidget(4,0,label3);
- table1.getFlexCellFormatter().setColSpan(4,0,2);
- table1.getFlexCellFormatter().setHorizontalAlignment(4,0,com.google.gwt.user.client.ui.HasHorizontalAlignment.ALIGN_DEFAULT);
- table1.getFlexCellFormatter().setVerticalAlignment(4,0,com.google.gwt.user.client.ui.HasVerticalAlignment.ALIGN_TOP);
- table1.getFlexCellFormatter().addStyleName(4,0, "Cell");
- $TabPanel9.add(gd2,"GD2");
- }
-
- public void inTheEnd() {
-
- }
-
- /**
- * initilization of databinding
- */
- public void initDataBinding() {
- //TODO
- }
-
- /**
- * initialization
- */
- public void initialize() {
- beforeCreation();
- componentsCreation();
- b.addClickListener(new com.google.gwt.user.client.ui.ClickListener() {
- public void onClick(com.google.gwt.user.client.ui.Widget sender) {
- if(gd2.getButton().isDown()) {
- table1.setSize(String.valueOf(com.google.gwt.user.client.Random.nextInt(800) + "px"),
- String.valueOf(com.google.gwt.user.client.Random.nextInt(400)) + "px");
- }
- }
- });
- beforeInitialization();
- componentsTree();
- beforeBinding();
- initDataBinding();
- inTheEnd();
- }
-
- /**
- *
- * test
- * @since 0.0.1
- *
- */
- public void test2(String test) throws NullPointerException, ArrayIndexOutOfBoundsException {
- System.out.println(test);
- }
-
- /*---------------------------------------------------------------------------------*/
- /*-- ui creation methods ----------------------------------------------------------*/
- /*---------------------------------------------------------------------------------*/
-
- /**
- * $MenuBar1 creation
- */
- private void create$MenuBar1() {
-
- }
-
- /**
- * $TabPanel9 creation
- */
- private void create$TabPanel9() {
- $TabPanel9.setSize("800px","400px");
- }
-
- /**
- * bt3 creation
- */
- private void createBt3() {
- bt3.setText("bt3");
- bt3.addClickListener(new com.google.gwt.user.client.ui.ClickListener() {
- public void onClick(com.google.gwt.user.client.ui.Widget widget){
- System.out.println("beau gosse");
- }
- });
- }
-
- /**
- * bt31 creation
- */
- private void createBt31() {
- bt31.setText("bt31");
- }
-
- /**
- * bt32 creation
- */
- private void createBt32() {
- bt32.setText("bt32");
- }
-
- /**
- * bt34 creation
- */
- private void createBt34() {
- bt34.setText("bt34");
- }
-
- /**
- * gd2 creation
- */
- private void createGd2() {
-
- }
-
- /**
- * label creation
- */
- private void createLabel() {
-
- }
-
- /**
- * label2 creation
- */
- private void createLabel2() {
- label2.setText("color");
- }
-
- /**
- * label3 creation
- */
- private void createLabel3() {
- label3.setText("color");
- }
-
- /**
- * table1 creation
- */
- private void createTable1() {
- table1.addStyleName("Table");
- }
-
- /**
- * textfield creation
- */
- private void createTextfield() {
- textfield.setText("test");
- textfield.addFocusListener(new com.google.gwt.user.client.ui.FocusListenerAdapter() {
- public void onFocus(com.google.gwt.user.client.ui.Widget widget){
- System.out.println("dude !");
- }
- });
- }
-
-}
\ No newline at end of file
+ private final com.google.gwt.user.client.ui.MenuBar $Menu2 = new MenuBar();
+ private final com.google.gwt.user.client.ui.MenuBar $Menu4 = new MenuBar();
+ private final com.google.gwt.user.client.ui.MenuBar $Menu6 = new MenuBar();
+ private final MenuBar $MenuBar1 = new MenuBar();
+ private final com.google.gwt.user.client.ui.TabPanel $TabPanel9 = new TabPanel();
+ /**
+ * List of the active bindings
+ */
+ private java.util.List<String> activeBindings = new java.util.ArrayList<String>();
+ private final org.nuiton.guix.client.GuixDemo3Abstract bt3 = new GuixDemo3Impl();
+ private final org.nuiton.guix.client.GuixDemo3Abstract bt31 = new GuixDemo3Impl();
+ private final org.nuiton.guix.client.GuixDemo3Abstract bt32 = new GuixDemo3Impl();
+ private final org.nuiton.guix.client.GuixDemo3Abstract bt34 = new GuixDemo3Impl();
+ private final org.nuiton.guix.client.GuixDemo2Abstract gd2 = new GuixDemo2Impl();
+ private final org.nuiton.guix.client.GuixDemo2Abstract gd22 = new GuixDemo2Impl();
+ /**
+ * test javadoc Application
+ */
+ private final org.nuiton.guix.client.GuixDemoAbstract guixdemo = this;
+ private final com.google.gwt.user.client.ui.Label label = new Label();
+ private final com.google.gwt.user.client.ui.Label label2 = new Label();
+ private final com.google.gwt.user.client.ui.Label label3 = new Label();
+ private final FlexTable table1 = new FlexTable();
+ /**
+ * javadoc textfield
+ */
+ private final com.google.gwt.user.client.ui.TextBox textfield = new TextBox();
+
+ /* begin raw body code */
+
+ private Button b = new Button("test");
+ private Command cmd = new Command() {
+ public void execute() {
+ final com.google.gwt.user.client.ui.PopupPanel pp = new com.google.gwt.user.client.ui.PopupPanel(true);
+ pp.add(new com.google.gwt.user.client.ui.Label("Action performed!"));
+ pp.show();
+ }
+ };
+ public enum Day {
+ SUNDAY, MONDAY, TUESDAY, WEDNESDAY,
+ THURSDAY, FRIDAY, SATURDAY
+ }
+
+ /* end raw body code */
+
+ /*---------------------------------------------------------------------------------*/
+ /*-- Constructors -----------------------------------------------------------------*/
+ /*---------------------------------------------------------------------------------*/
+
+ /**
+ * Constructor
+ */
+ public GuixDemoAbstract() {
+ initialize();
+ }
+
+ /*---------------------------------------------------------------------------------*/
+ /*-- JAXXObject implementation ----------------------------------------------------*/
+ /*---------------------------------------------------------------------------------*/
+
+ public void applyDataBinding(String _binding) {
+ if("textfield.enabled".equals(_binding)) {
+ if(getGd2() != null && getGd2().getButton() != null) {
+ getGd2().getButton().addClickListener(new com.google.gwt.user.client.ui.ClickListener() {
+ public void onClick(com.google.gwt.user.client.ui.Widget arg0) {
+ onChangeFromgd2getButtondown();
+ }
+ });
+ }
+ if(getGd22() != null && getGd22().getButton() != null) {
+ getGd22().getButton().addClickListener(new com.google.gwt.user.client.ui.ClickListener() {
+ public void onClick(com.google.gwt.user.client.ui.Widget arg0) {
+ onChangeFromgd22buttonisSelected();
+ }
+ });
+ }
+ }
+ else if("label.text".equals(_binding)) {
+ if(getTextfield() != null) {
+ getTextfield().addKeyboardListener(new com.google.gwt.user.client.ui.KeyboardListener() {
+ public void onKeyDown(com.google.gwt.user.client.ui.Widget arg0, char arg1, int arg2) {
+ onChangeFromtextfieldgetText();
+ }
+ public void onKeyPress(com.google.gwt.user.client.ui.Widget arg0, char arg1, int arg2) {
+ onChangeFromtextfieldgetText();
+ }
+ public void onKeyUp(com.google.gwt.user.client.ui.Widget arg0, char arg1, int arg2) {
+ onChangeFromtextfieldgetText();
+ }
+ });
+ }
+ }
+
+ processDataBinding(_binding);
+ }
+
+ public void processDataBinding(String _binding) {
+ if (activeBindings.contains(_binding)) {
+ return;
+ }
+ activeBindings.add(_binding);
+ try{
+ if("textfield.enabled".equals(_binding)) {
+ textfield.setEnabled(getGd2().getButton().isDown() && getGd22().getButton().isDown());
+ }
+ else if("label.text".equals(_binding)) {
+ label.setText(getTextfield().getText());
+ }
+
+ } finally {
+ activeBindings.remove(_binding);
+ }
+ }
+
+ public void removeDataBinding(String _binding) {
+ if("textfield.enabled".equals(_binding)) {
+ if(getGd2() != null && getGd2().getButton() != null) {
+ getGd2().getButton().removeClickListener(new com.google.gwt.user.client.ui.ClickListener() {
+ public void onClick(com.google.gwt.user.client.ui.Widget arg0) {
+ onChangeFromgd2getButtondown();
+ }
+ });
+ }
+ if(getGd22() != null && getGd22().getButton() != null) {
+ getGd22().getButton().removeClickListener(new com.google.gwt.user.client.ui.ClickListener() {
+ public void onClick(com.google.gwt.user.client.ui.Widget arg0) {
+ onChangeFromgd22buttonisSelected();
+ }
+ });
+ }
+ }
+ else if("label.text".equals(_binding)) {
+ if(getTextfield() != null) {
+ getTextfield().removeKeyboardListener(new com.google.gwt.user.client.ui.KeyboardListener() {
+ public void onKeyDown(com.google.gwt.user.client.ui.Widget arg0, char arg1, int arg2) {
+ onChangeFromtextfieldgetText();
+ }
+ public void onKeyPress(com.google.gwt.user.client.ui.Widget arg0, char arg1, int arg2) {
+ onChangeFromtextfieldgetText();
+ }
+ public void onKeyUp(com.google.gwt.user.client.ui.Widget arg0, char arg1, int arg2) {
+ onChangeFromtextfieldgetText();
+ }
+ });
+ }
+ }
+ }
+
+ /*---------------------------------------------------------------------------------*/
+ /*-- public acessor methods -------------------------------------------------------*/
+ /*---------------------------------------------------------------------------------*/
+
+ public com.google.gwt.user.client.ui.MenuBar get$Menu2() {
+ return $Menu2;
+ }
+
+ public com.google.gwt.user.client.ui.MenuBar get$Menu4() {
+ return $Menu4;
+ }
+
+ public com.google.gwt.user.client.ui.MenuBar get$Menu6() {
+ return $Menu6;
+ }
+
+ public MenuBar get$MenuBar1() {
+ return $MenuBar1;
+ }
+
+ public com.google.gwt.user.client.ui.TabPanel get$TabPanel9() {
+ return $TabPanel9;
+ }
+
+ public java.util.List<String> getActiveBindings() {
+ return activeBindings;
+ }
+
+ public org.nuiton.guix.client.GuixDemo3Abstract getBt3() {
+ return bt3;
+ }
+
+ public org.nuiton.guix.client.GuixDemo3Abstract getBt31() {
+ return bt31;
+ }
+
+ public org.nuiton.guix.client.GuixDemo3Abstract getBt32() {
+ return bt32;
+ }
+
+ public org.nuiton.guix.client.GuixDemo3Abstract getBt34() {
+ return bt34;
+ }
+
+ public org.nuiton.guix.client.GuixDemo2Abstract getGd2() {
+ return gd2;
+ }
+
+ public org.nuiton.guix.client.GuixDemo2Abstract getGd22() {
+ return gd22;
+ }
+
+ public org.nuiton.guix.client.GuixDemoAbstract getGuixdemo() {
+ return guixdemo;
+ }
+
+ public com.google.gwt.user.client.ui.Label getLabel() {
+ return label;
+ }
+
+ public com.google.gwt.user.client.ui.Label getLabel2() {
+ return label2;
+ }
+
+ public com.google.gwt.user.client.ui.Label getLabel3() {
+ return label3;
+ }
+
+ public FlexTable getTable1() {
+ return table1;
+ }
+
+ public com.google.gwt.user.client.ui.TextBox getTextfield() {
+ return textfield;
+ }
+
+ /*---------------------------------------------------------------------------------*/
+ /*-- public mutator methods -------------------------------------------------------*/
+ /*---------------------------------------------------------------------------------*/
+
+ public void beforeBinding() {
+ this.add(b);
+ }
+
+ public void beforeCreation() {
+ System.out.println("before Creation");
+ }
+
+ public void beforeInitialization() {
+
+ }
+
+ /**
+ * Components creation
+ */
+ public void componentsCreation() {
+ create$MenuBar1();
+ create$TabPanel9();
+ createTextfield();
+ createLabel();
+ createLabel2();
+ createBt3();
+ createBt31();
+ createBt32();
+ createBt34();
+ createLabel3();
+ createTable1();
+ createGd2();
+ createGd22();
+ }
+
+ /**
+ * Components initialization
+ */
+ public void componentsTree() {
+ this.add($MenuBar1);
+ $MenuBar1.addItem("menu 1",$Menu2);
+ $Menu2.addItem("item11",cmd);
+ $Menu2.addItem("item12",cmd);
+ $MenuBar1.addItem("menu 2",$Menu4);
+ $Menu4.addItem("item21",cmd);
+ $Menu4.addItem("item22",$Menu6);
+ $Menu6.addItem("item221",cmd);
+ $Menu6.addItem("item222",cmd);
+ this.add($TabPanel9);
+ $TabPanel9.add(table1,"Table");
+ table1.getRowFormatter().addStyleName(0,"Row");
+ table1.setWidget(0,0,textfield);
+ table1.getFlexCellFormatter().setHorizontalAlignment(0,0,com.google.gwt.user.client.ui.HasHorizontalAlignment.ALIGN_DEFAULT);
+ table1.getFlexCellFormatter().setVerticalAlignment(0,0,com.google.gwt.user.client.ui.HasVerticalAlignment.ALIGN_TOP);
+ table1.getFlexCellFormatter().addStyleName(0,0, "Cell");
+ table1.setWidget(0,1,label);
+ table1.getFlexCellFormatter().setHorizontalAlignment(0,1,com.google.gwt.user.client.ui.HasHorizontalAlignment.ALIGN_DEFAULT);
+ table1.getFlexCellFormatter().setVerticalAlignment(0,1,com.google.gwt.user.client.ui.HasVerticalAlignment.ALIGN_TOP);
+ table1.getFlexCellFormatter().addStyleName(0,1, "Cell");
+ table1.setWidget(0,2,label2);
+ table1.getFlexCellFormatter().setRowSpan(0,2,3);
+ table1.getFlexCellFormatter().setHorizontalAlignment(0,2,com.google.gwt.user.client.ui.HasHorizontalAlignment.ALIGN_DEFAULT);
+ table1.getFlexCellFormatter().setVerticalAlignment(0,2,com.google.gwt.user.client.ui.HasVerticalAlignment.ALIGN_TOP);
+ table1.getFlexCellFormatter().addStyleName(0,2, "Cell");
+ table1.getRowFormatter().addStyleName(1,"Row");
+ table1.setWidget(1,0,bt3);
+ table1.getFlexCellFormatter().setColSpan(1,0,3);
+ table1.getFlexCellFormatter().setHorizontalAlignment(1,0,com.google.gwt.user.client.ui.HasHorizontalAlignment.ALIGN_DEFAULT);
+ table1.getFlexCellFormatter().setVerticalAlignment(1,0,com.google.gwt.user.client.ui.HasVerticalAlignment.ALIGN_TOP);
+ table1.getFlexCellFormatter().addStyleName(1,0, "Cell");
+ table1.getRowFormatter().addStyleName(2,"Row");
+ table1.setWidget(2,0,bt31);
+ table1.getFlexCellFormatter().setColSpan(2,0,2);
+ table1.getFlexCellFormatter().setHorizontalAlignment(2,0,com.google.gwt.user.client.ui.HasHorizontalAlignment.ALIGN_DEFAULT);
+ table1.getFlexCellFormatter().setVerticalAlignment(2,0,com.google.gwt.user.client.ui.HasVerticalAlignment.ALIGN_TOP);
+ table1.getFlexCellFormatter().addStyleName(2,0, "Cell");
+ table1.setWidget(2,2,bt32);
+ table1.getFlexCellFormatter().setHorizontalAlignment(2,2,com.google.gwt.user.client.ui.HasHorizontalAlignment.ALIGN_DEFAULT);
+ table1.getFlexCellFormatter().setVerticalAlignment(2,2,com.google.gwt.user.client.ui.HasVerticalAlignment.ALIGN_TOP);
+ table1.getFlexCellFormatter().addStyleName(2,2, "Cell");
+ table1.getRowFormatter().addStyleName(3,"Row");
+ table1.setWidget(3,0,bt34);
+ table1.getFlexCellFormatter().setColSpan(3,0,3);
+ table1.getFlexCellFormatter().setHorizontalAlignment(3,0,com.google.gwt.user.client.ui.HasHorizontalAlignment.ALIGN_DEFAULT);
+ table1.getFlexCellFormatter().setVerticalAlignment(3,0,com.google.gwt.user.client.ui.HasVerticalAlignment.ALIGN_TOP);
+ table1.getFlexCellFormatter().addStyleName(3,0, "Cell");
+ table1.getRowFormatter().addStyleName(4,"Row");
+ table1.setWidget(4,0,label3);
+ table1.getFlexCellFormatter().setColSpan(4,0,2);
+ table1.getFlexCellFormatter().setHorizontalAlignment(4,0,com.google.gwt.user.client.ui.HasHorizontalAlignment.ALIGN_DEFAULT);
+ table1.getFlexCellFormatter().setVerticalAlignment(4,0,com.google.gwt.user.client.ui.HasVerticalAlignment.ALIGN_TOP);
+ table1.getFlexCellFormatter().addStyleName(4,0, "Cell");
+ $TabPanel9.add(gd2,"GD2");
+ $TabPanel9.add(gd22,"GD22");
+ }
+
+ public void inTheEnd() {
+
+ }
+
+ /**
+ * initilization of databinding
+ */
+ public void initDataBinding() {
+ //TODO
+ applyDataBinding("textfield.enabled");
+ applyDataBinding("label.text");
+ }
+
+ /**
+ * initialization
+ */
+ public void initialize() {
+ beforeCreation();
+ componentsCreation();
+ b.addClickListener(new com.google.gwt.user.client.ui.ClickListener() {
+ public void onClick(com.google.gwt.user.client.ui.Widget sender) {
+ if(gd2.getButton().isDown()) {
+ table1.setSize(String.valueOf(com.google.gwt.user.client.Random.nextInt(800)),
+ String.valueOf(com.google.gwt.user.client.Random.nextInt(400)));
+ }
+ }
+ });
+ beforeInitialization();
+ componentsTree();
+ beforeBinding();
+ initDataBinding();
+ inTheEnd();
+ }
+
+ public void onChangeFromgd22buttonisSelected() {
+ processDataBinding("textfield.enabled");
+ }
+
+ public void onChangeFromgd2getButtondown() {
+ processDataBinding("textfield.enabled");
+ }
+
+ public void onChangeFromtextfieldgetText() {
+ processDataBinding("label.text");
+ }
+
+ /**
+ *
+ * test
+ * @since 0.0.1
+ *
+ */
+ public void test2(String test) throws NullPointerException, ArrayIndexOutOfBoundsException {
+ System.out.println(test);
+ }
+
+ public void testSameName() {
+ System.out.println("load the script file with the same name");
+ }
+
+ /*---------------------------------------------------------------------------------*/
+ /*-- ui creation methods ----------------------------------------------------------*/
+ /*---------------------------------------------------------------------------------*/
+
+ /**
+ * $MenuBar1 creation
+ */
+ private void create$MenuBar1() {
+
+ }
+
+ /**
+ * $TabPanel9 creation
+ */
+ private void create$TabPanel9() {
+ $TabPanel9.setSize("800px","400px");
+ }
+
+ /**
+ * bt3 creation
+ */
+ private void createBt3() {
+ bt3.setText("bt3");
+ bt3.addClickListener(new com.google.gwt.user.client.ui.ClickListener() {
+ public void onClick(com.google.gwt.user.client.ui.Widget arg0){
+ System.out.println("beau gosse");
+ }
+ });
+ }
+
+ /**
+ * bt31 creation
+ */
+ private void createBt31() {
+ bt31.setText("bt31");
+ }
+
+ /**
+ * bt32 creation
+ */
+ private void createBt32() {
+ bt32.setText("bt32");
+ }
+
+ /**
+ * bt34 creation
+ */
+ private void createBt34() {
+ bt34.setText("bt34");
+ }
+
+ /**
+ * gd2 creation
+ */
+ private void createGd2() {
+
+ }
+
+ /**
+ * gd22 creation
+ */
+ private void createGd22() {
+
+ }
+
+ /**
+ * label creation
+ */
+ private void createLabel() {
+
+ }
+
+ /**
+ * label2 creation
+ */
+ private void createLabel2() {
+ label2.setText("color");
+ }
+
+ /**
+ * label3 creation
+ */
+ private void createLabel3() {
+ label3.setText("color");
+ }
+
+ /**
+ * table1 creation
+ */
+ private void createTable1() {
+ table1.addStyleName("Table");
+ }
+
+ /**
+ * textfield creation
+ */
+ private void createTextfield() {
+ textfield.setText("test");
+ textfield.addFocusListener(new com.google.gwt.user.client.ui.FocusListenerAdapter() {
+ public void onFocus(com.google.gwt.user.client.ui.Widget arg0){
+ System.out.println("dude !");
+ }
+ });
+ }
+
+ }
\ No newline at end of file
Modified: trunk/guix-test-gwt/src/main/java/org/nuiton/guix/client/GuixDemoImpl.java
===================================================================
--- trunk/guix-test-gwt/src/main/java/org/nuiton/guix/client/GuixDemoImpl.java 2009-07-22 13:10:50 UTC (rev 1508)
+++ trunk/guix-test-gwt/src/main/java/org/nuiton/guix/client/GuixDemoImpl.java 2009-07-22 13:44:11 UTC (rev 1509)
@@ -12,23 +12,23 @@
* test javadoc Application
*/
public class GuixDemoImpl extends GuixDemoAbstract implements com.google.gwt.core.client.EntryPoint {
- /*---------------------------------------------------------------------------------*/
- /*-- Constructors -----------------------------------------------------------------*/
- /*---------------------------------------------------------------------------------*/
-
- /**
- * Constructor
- */
- public GuixDemoImpl() {
- super();
- }
-
- /*---------------------------------------------------------------------------------*/
- /*-- public mutator methods -------------------------------------------------------*/
- /*---------------------------------------------------------------------------------*/
-
- public void onModuleLoad() {
- com.google.gwt.user.client.ui.RootPanel.get().add(this);
- }
-
-}
\ No newline at end of file
+ /*---------------------------------------------------------------------------------*/
+ /*-- Constructors -----------------------------------------------------------------*/
+ /*---------------------------------------------------------------------------------*/
+
+ /**
+ * Constructor
+ */
+ public GuixDemoImpl() {
+ super();
+ }
+
+ /*---------------------------------------------------------------------------------*/
+ /*-- public mutator methods -------------------------------------------------------*/
+ /*---------------------------------------------------------------------------------*/
+
+ public void onModuleLoad() {
+ com.google.gwt.user.client.ui.RootPanel.get().add(this);
+ }
+
+ }
\ No newline at end of file
Modified: trunk/guix-test-gwt/src/main/java/org/nuiton/guix/demo/GuixDemo.css
===================================================================
--- trunk/guix-test-gwt/src/main/java/org/nuiton/guix/demo/GuixDemo.css 2009-07-22 13:10:50 UTC (rev 1508)
+++ trunk/guix-test-gwt/src/main/java/org/nuiton/guix/demo/GuixDemo.css 2009-07-22 13:44:11 UTC (rev 1509)
@@ -11,6 +11,6 @@
.bold
{
- font : bold;
+ font-weight : bold;
}
Modified: trunk/guix-test-gwt/src/main/java/org/nuiton/guix/demo/GuixDemo.guix
===================================================================
--- trunk/guix-test-gwt/src/main/java/org/nuiton/guix/demo/GuixDemo.guix 2009-07-22 13:10:50 UTC (rev 1508)
+++ trunk/guix-test-gwt/src/main/java/org/nuiton/guix/demo/GuixDemo.guix 2009-07-22 13:44:11 UTC (rev 1509)
@@ -47,15 +47,15 @@
]]></script>
<MenuBar>
- <Menu text='menu 1'>
- <MenuItem id="item1" text="item11" command='cmd' />
- <MenuItem text="item12" command='cmd' />
+ <Menu text="menu 1">
+ <MenuItem id="item1" text="item11" action='cmd' />
+ <MenuItem text="item12" action='cmd' />
</Menu>
- <Menu text='menu 2'>
- <MenuItem text="item21" command='cmd' />
- <Menu text="item22">
- <MenuItem text="item221" command='cmd' />
- <MenuItem text="item222" command='cmd' />
+ <Menu text="menu 2">
+ <MenuItem text="item21" action='cmd' />
+ <Menu text='item22'>
+ <MenuItem text="item221" action='cmd' />
+ <MenuItem text="item222" action='cmd' />
</Menu>
</Menu>
</MenuBar>
@@ -64,7 +64,7 @@
<Row>
<Cell>
<!-- javadoc textfield -->
- <TextField id="textfield" text='test' enabled="{gd2.getButton().isSelected()}" onFocus='{System.out.println("dude !")}'/>
+ <TextField id="textfield" text='test' enabled="{gd2.getButton().down && gd22.button.isSelected()}" onFocus='{System.out.println("dude !")}'/>
</Cell>
<Cell>
<Label id="label" text="{textfield.getText()}" styleClass="bold" />
@@ -98,5 +98,6 @@
</Row>
</Table>
<GuixDemo2 id="gd2" name="GD2" />
+ <GuixDemo2 id="gd22" name="GD22" />
</TabPanel>
</Application>
1
0
r1508 - trunk/guix-test-swing/src/main/java/org/nuiton/guix
by kmorin@users.labs.libre-entreprise.org July 22, 2009
by kmorin@users.labs.libre-entreprise.org July 22, 2009
July 22, 2009
Author: kmorin
Date: 2009-07-22 15:10:50 +0200 (Wed, 22 Jul 2009)
New Revision: 1508
Added:
trunk/guix-test-swing/src/main/java/org/nuiton/guix/GuixDemo.java
trunk/guix-test-swing/src/main/java/org/nuiton/guix/GuixDemo2.java
trunk/guix-test-swing/src/main/java/org/nuiton/guix/GuixDemo2Abstract.java
trunk/guix-test-swing/src/main/java/org/nuiton/guix/GuixDemo2Impl.java
trunk/guix-test-swing/src/main/java/org/nuiton/guix/GuixDemo3.java
trunk/guix-test-swing/src/main/java/org/nuiton/guix/GuixDemo3Abstract.java
trunk/guix-test-swing/src/main/java/org/nuiton/guix/GuixDemo3Impl.java
trunk/guix-test-swing/src/main/java/org/nuiton/guix/GuixDemoAbstract.java
trunk/guix-test-swing/src/main/java/org/nuiton/guix/GuixDemoImpl.java
trunk/guix-test-swing/src/main/java/org/nuiton/guix/Main.java
Log:
example with the binding
Added: trunk/guix-test-swing/src/main/java/org/nuiton/guix/GuixDemo.java
===================================================================
--- trunk/guix-test-swing/src/main/java/org/nuiton/guix/GuixDemo.java (rev 0)
+++ trunk/guix-test-swing/src/main/java/org/nuiton/guix/GuixDemo.java 2009-07-22 13:10:50 UTC (rev 1508)
@@ -0,0 +1,96 @@
+package org.nuiton.guix;
+
+import java.util.ArrayList;
+import javax.swing.JMenuBar;
+import javax.swing.JMenu;
+import javax.swing.JMenuItem;
+import javax.swing.JToolBar;
+import javax.swing.JButton;
+import javax.swing.JTabbedPane;
+import javax.swing.JPanel;
+import javax.swing.JTextField;
+import javax.swing.JLabel;
+import org.nuiton.guix.GuixDemo3Abstract;
+import org.nuiton.guix.GuixDemo2Abstract;
+
+/**
+ * test javadoc Application
+ */
+public interface GuixDemo {
+ /*---------------------------------------------------------------------------------*/
+ /*-- public acessor methods -------------------------------------------------------*/
+ /*---------------------------------------------------------------------------------*/
+
+ public JToolBar get$JToolBar5();
+
+ public GuixDemo3Abstract getBt3();
+
+ public GuixDemo3Abstract getBt31();
+
+ public GuixDemo3Abstract getBt32();
+
+ public GuixDemo3Abstract getBt34();
+
+ public ArrayList getController();
+
+ public GuixDemo2Abstract getGd2();
+
+ public GuixDemo2Abstract getGd22();
+
+ public javax.swing.JPanel getTable();
+
+ /*---------------------------------------------------------------------------------*/
+ /*-- public mutator methods -------------------------------------------------------*/
+ /*---------------------------------------------------------------------------------*/
+
+ public void set$JToolBar5(JToolBar newValue);
+
+ public void setBt3(GuixDemo3Abstract newValue);
+
+ public void setBt31(GuixDemo3Abstract newValue);
+
+ public void setBt32(GuixDemo3Abstract newValue);
+
+ public void setBt34(GuixDemo3Abstract newValue);
+
+ public void setController(ArrayList newValue);
+
+ public void setGd2(GuixDemo2Abstract newValue);
+
+ public void setGd22(GuixDemo2Abstract newValue);
+
+ public void setTable(javax.swing.JPanel newValue);
+
+ /*---------------------------------------------------------------------------------*/
+ /*-- public mutator methods -------------------------------------------------------*/
+ /*---------------------------------------------------------------------------------*/
+
+ public void beforeBinding();
+
+ public void beforeCreation();
+
+ public void beforeInitialization();
+
+ /**
+ * Components creation
+ */
+ public void componentsCreation();
+
+ /**
+ * components layout
+ */
+ public void componentsTree();
+
+ public void inTheEnd();
+
+ /**
+ * initilization of databinding
+ */
+ public void initDataBinding();
+
+ /**
+ * initialization
+ */
+ public void initialize();
+
+ }
\ No newline at end of file
Added: trunk/guix-test-swing/src/main/java/org/nuiton/guix/GuixDemo2.java
===================================================================
--- trunk/guix-test-swing/src/main/java/org/nuiton/guix/GuixDemo2.java (rev 0)
+++ trunk/guix-test-swing/src/main/java/org/nuiton/guix/GuixDemo2.java 2009-07-22 13:10:50 UTC (rev 1508)
@@ -0,0 +1,41 @@
+package org.nuiton.guix;
+
+import javax.swing.JToggleButton;
+
+/**
+ * test javadoc Application
+ */
+public interface GuixDemo2 {
+ /*---------------------------------------------------------------------------------*/
+ /*-- public mutator methods -------------------------------------------------------*/
+ /*---------------------------------------------------------------------------------*/
+
+ public void beforeBinding();
+
+ public void beforeCreation();
+
+ public void beforeInitialization();
+
+ /**
+ * Components creation
+ */
+ public void componentsCreation();
+
+ /**
+ * components layout
+ */
+ public void componentsTree();
+
+ public void inTheEnd();
+
+ /**
+ * initilization of databinding
+ */
+ public void initDataBinding();
+
+ /**
+ * initialization
+ */
+ public void initialize();
+
+ }
\ No newline at end of file
Added: trunk/guix-test-swing/src/main/java/org/nuiton/guix/GuixDemo2Abstract.java
===================================================================
--- trunk/guix-test-swing/src/main/java/org/nuiton/guix/GuixDemo2Abstract.java (rev 0)
+++ trunk/guix-test-swing/src/main/java/org/nuiton/guix/GuixDemo2Abstract.java 2009-07-22 13:10:50 UTC (rev 1508)
@@ -0,0 +1,163 @@
+package org.nuiton.guix;
+
+import javax.swing.JToggleButton;
+
+/**
+ * test javadoc Application
+ */
+public abstract class GuixDemo2Abstract extends javax.swing.JPanel implements GuixDemo2 {
+ /**
+ * List of the active bindings
+ */
+ private java.util.List<String> activeBindings = new java.util.ArrayList<String>();
+ /**
+ * test javadoc Application
+ */
+ private javax.swing.JToggleButton button;
+ /**
+ * test javadoc Application
+ */
+ private org.nuiton.guix.GuixDemo2Abstract guixdemo2 = this;
+
+ /*---------------------------------------------------------------------------------*/
+ /*-- Constructors -----------------------------------------------------------------*/
+ /*---------------------------------------------------------------------------------*/
+
+ /**
+ * Constructor
+ */
+ public GuixDemo2Abstract() {
+ initialize();
+ }
+
+ /*---------------------------------------------------------------------------------*/
+ /*-- JAXXObject implementation ----------------------------------------------------*/
+ /*---------------------------------------------------------------------------------*/
+
+ public void applyDataBinding(String _binding) {
+ processDataBinding(_binding);
+ }
+
+ public void firePropertyChange(String name, Object oldValue, Object newValue) {
+ super.firePropertyChange(name, oldValue, newValue);
+ }
+
+ public void processDataBinding(String _binding) {
+ if (activeBindings.contains(_binding)) {
+ return;
+ }
+ activeBindings.add(_binding);
+ try{
+
+ } finally {
+ activeBindings.remove(_binding);
+ }
+ }
+
+ public void removeDataBinding(String _binding) {
+
+ }
+
+ /*---------------------------------------------------------------------------------*/
+ /*-- public acessor methods -------------------------------------------------------*/
+ /*---------------------------------------------------------------------------------*/
+
+ public java.util.List<String> getActiveBindings() {
+ return activeBindings;
+ }
+
+ public javax.swing.JToggleButton getButton() {
+ return button;
+ }
+
+ public org.nuiton.guix.GuixDemo2Abstract getGuixdemo2() {
+ return guixdemo2;
+ }
+
+ /*---------------------------------------------------------------------------------*/
+ /*-- public mutator methods -------------------------------------------------------*/
+ /*---------------------------------------------------------------------------------*/
+
+ public void setButton(javax.swing.JToggleButton newValue) {
+ this.button = newValue;
+ }
+
+ public void setGuixdemo2(org.nuiton.guix.GuixDemo2Abstract newValue) {
+ this.guixdemo2 = newValue;
+ }
+
+ /*---------------------------------------------------------------------------------*/
+ /*-- public mutator methods -------------------------------------------------------*/
+ /*---------------------------------------------------------------------------------*/
+
+ public void beforeBinding() {
+
+ }
+
+ public void beforeCreation() {
+
+ }
+
+ public void beforeInitialization() {
+
+ }
+
+ /**
+ * Components creation
+ */
+ public void componentsCreation() {
+ createButton();
+ }
+
+ /**
+ * components layout
+ */
+ public void componentsTree() {
+ this.setLayout(new java.awt.FlowLayout());
+ this.add(button);
+ }
+
+ public void inTheEnd() {
+
+ }
+
+ /**
+ * initilization of databinding
+ */
+ public void initDataBinding() {
+
+ }
+
+ /**
+ * initialization
+ */
+ public void initialize() {
+ beforeCreation();
+ componentsCreation();
+
+ beforeInitialization();
+ componentsTree();
+ beforeBinding();
+ initDataBinding();
+ inTheEnd();
+ }
+
+ /*---------------------------------------------------------------------------------*/
+ /*-- ui creation methods ----------------------------------------------------------*/
+ /*---------------------------------------------------------------------------------*/
+
+ /**
+ * button creation
+ */
+ private void createButton() {
+ button = new javax.swing.JToggleButton();
+ button.setText("Push me");
+ button.setSelected(true);
+ button.addActionListener(new java.awt.event.ActionListener() {
+ public void actionPerformed(java.awt.event.ActionEvent actionEvent){
+ System.out.println("test");
+ }
+ });
+ }
+
+ }
\ No newline at end of file
Added: trunk/guix-test-swing/src/main/java/org/nuiton/guix/GuixDemo2Impl.java
===================================================================
--- trunk/guix-test-swing/src/main/java/org/nuiton/guix/GuixDemo2Impl.java (rev 0)
+++ trunk/guix-test-swing/src/main/java/org/nuiton/guix/GuixDemo2Impl.java 2009-07-22 13:10:50 UTC (rev 1508)
@@ -0,0 +1,20 @@
+package org.nuiton.guix;
+
+import javax.swing.JToggleButton;
+
+/**
+ * test javadoc Application
+ */
+public class GuixDemo2Impl extends GuixDemo2Abstract {
+ /*---------------------------------------------------------------------------------*/
+ /*-- Constructors -----------------------------------------------------------------*/
+ /*---------------------------------------------------------------------------------*/
+
+ /**
+ * Constructor
+ */
+ public GuixDemo2Impl() {
+ super();
+ }
+
+ }
\ No newline at end of file
Added: trunk/guix-test-swing/src/main/java/org/nuiton/guix/GuixDemo3.java
===================================================================
--- trunk/guix-test-swing/src/main/java/org/nuiton/guix/GuixDemo3.java (rev 0)
+++ trunk/guix-test-swing/src/main/java/org/nuiton/guix/GuixDemo3.java 2009-07-22 13:10:50 UTC (rev 1508)
@@ -0,0 +1,39 @@
+package org.nuiton.guix;
+
+/**
+ * test javadoc Application
+ */
+public interface GuixDemo3 {
+ /*---------------------------------------------------------------------------------*/
+ /*-- public mutator methods -------------------------------------------------------*/
+ /*---------------------------------------------------------------------------------*/
+
+ public void beforeBinding();
+
+ public void beforeCreation();
+
+ public void beforeInitialization();
+
+ /**
+ * Components creation
+ */
+ public void componentsCreation();
+
+ /**
+ * components layout
+ */
+ public void componentsTree();
+
+ public void inTheEnd();
+
+ /**
+ * initilization of databinding
+ */
+ public void initDataBinding();
+
+ /**
+ * initialization
+ */
+ public void initialize();
+
+ }
\ No newline at end of file
Added: trunk/guix-test-swing/src/main/java/org/nuiton/guix/GuixDemo3Abstract.java
===================================================================
--- trunk/guix-test-swing/src/main/java/org/nuiton/guix/GuixDemo3Abstract.java (rev 0)
+++ trunk/guix-test-swing/src/main/java/org/nuiton/guix/GuixDemo3Abstract.java 2009-07-22 13:10:50 UTC (rev 1508)
@@ -0,0 +1,131 @@
+package org.nuiton.guix;
+
+/**
+ * test javadoc Application
+ */
+public abstract class GuixDemo3Abstract extends javax.swing.JButton implements GuixDemo3 {
+ /**
+ * List of the active bindings
+ */
+ private java.util.List<String> activeBindings = new java.util.ArrayList<String>();
+ /**
+ * test javadoc Application
+ */
+ private org.nuiton.guix.GuixDemo3Abstract guixdemo3 = this;
+
+ /*---------------------------------------------------------------------------------*/
+ /*-- Constructors -----------------------------------------------------------------*/
+ /*---------------------------------------------------------------------------------*/
+
+ /**
+ * Constructor
+ */
+ public GuixDemo3Abstract() {
+ initialize();
+ }
+
+ /*---------------------------------------------------------------------------------*/
+ /*-- JAXXObject implementation ----------------------------------------------------*/
+ /*---------------------------------------------------------------------------------*/
+
+ public void applyDataBinding(String _binding) {
+ processDataBinding(_binding);
+ }
+
+ public void firePropertyChange(String name, Object oldValue, Object newValue) {
+ super.firePropertyChange(name, oldValue, newValue);
+ }
+
+ public void processDataBinding(String _binding) {
+ if (activeBindings.contains(_binding)) {
+ return;
+ }
+ activeBindings.add(_binding);
+ try{
+
+ } finally {
+ activeBindings.remove(_binding);
+ }
+ }
+
+ public void removeDataBinding(String _binding) {
+
+ }
+
+ /*---------------------------------------------------------------------------------*/
+ /*-- public acessor methods -------------------------------------------------------*/
+ /*---------------------------------------------------------------------------------*/
+
+ public java.util.List<String> getActiveBindings() {
+ return activeBindings;
+ }
+
+ public org.nuiton.guix.GuixDemo3Abstract getGuixdemo3() {
+ return guixdemo3;
+ }
+
+ /*---------------------------------------------------------------------------------*/
+ /*-- public mutator methods -------------------------------------------------------*/
+ /*---------------------------------------------------------------------------------*/
+
+ public void setGuixdemo3(org.nuiton.guix.GuixDemo3Abstract newValue) {
+ this.guixdemo3 = newValue;
+ }
+
+ /*---------------------------------------------------------------------------------*/
+ /*-- public mutator methods -------------------------------------------------------*/
+ /*---------------------------------------------------------------------------------*/
+
+ public void beforeBinding() {
+
+ }
+
+ public void beforeCreation() {
+
+ }
+
+ public void beforeInitialization() {
+
+ }
+
+ /**
+ * Components creation
+ */
+ public void componentsCreation() {
+
+ }
+
+ /**
+ * components layout
+ */
+ public void componentsTree() {
+ this.setText("GuixDemo3");
+ this.setLayout(new java.awt.FlowLayout());
+ }
+
+ public void inTheEnd() {
+
+ }
+
+ /**
+ * initilization of databinding
+ */
+ public void initDataBinding() {
+
+ }
+
+ /**
+ * initialization
+ */
+ public void initialize() {
+ beforeCreation();
+ componentsCreation();
+
+ beforeInitialization();
+ componentsTree();
+ beforeBinding();
+ initDataBinding();
+ inTheEnd();
+ }
+
+ }
\ No newline at end of file
Added: trunk/guix-test-swing/src/main/java/org/nuiton/guix/GuixDemo3Impl.java
===================================================================
--- trunk/guix-test-swing/src/main/java/org/nuiton/guix/GuixDemo3Impl.java (rev 0)
+++ trunk/guix-test-swing/src/main/java/org/nuiton/guix/GuixDemo3Impl.java 2009-07-22 13:10:50 UTC (rev 1508)
@@ -0,0 +1,18 @@
+package org.nuiton.guix;
+
+/**
+ * test javadoc Application
+ */
+public class GuixDemo3Impl extends GuixDemo3Abstract {
+ /*---------------------------------------------------------------------------------*/
+ /*-- Constructors -----------------------------------------------------------------*/
+ /*---------------------------------------------------------------------------------*/
+
+ /**
+ * Constructor
+ */
+ public GuixDemo3Impl() {
+ super();
+ }
+
+ }
\ No newline at end of file
Added: trunk/guix-test-swing/src/main/java/org/nuiton/guix/GuixDemoAbstract.java
===================================================================
--- trunk/guix-test-swing/src/main/java/org/nuiton/guix/GuixDemoAbstract.java (rev 0)
+++ trunk/guix-test-swing/src/main/java/org/nuiton/guix/GuixDemoAbstract.java 2009-07-22 13:10:50 UTC (rev 1508)
@@ -0,0 +1,806 @@
+package org.nuiton.guix;
+
+import java.util.ArrayList;
+import javax.swing.JMenuBar;
+import javax.swing.JMenu;
+import javax.swing.JMenuItem;
+import javax.swing.JToolBar;
+import javax.swing.JButton;
+import javax.swing.JTabbedPane;
+import javax.swing.JPanel;
+import javax.swing.JTextField;
+import javax.swing.JLabel;
+import org.nuiton.guix.GuixDemo3Abstract;
+import org.nuiton.guix.GuixDemo2Abstract;
+import java.awt.Button;
+import java.awt.event.ActionListener;
+import java.awt.event.ActionEvent;
+import java.awt.BorderLayout;
+
+/**
+ * test javadoc Application
+ */
+public abstract class GuixDemoAbstract extends javax.swing.JFrame implements GuixDemo {
+ private javax.swing.JButton $Button6;
+ private javax.swing.JButton $Button7;
+ private javax.swing.JToolBar $JToolBar5;
+ private javax.swing.JMenu $Menu2;
+ private javax.swing.JMenu $Menu4;
+ private javax.swing.JMenuBar $MenuBar1;
+ private javax.swing.JMenuItem $MenuItem3;
+ /**
+ * List of the active bindings
+ */
+ private java.util.List<String> activeBindings = new java.util.ArrayList<String>();
+ private javax.swing.JButton bouton1;
+ private org.nuiton.guix.GuixDemo3Abstract bt3;
+ private org.nuiton.guix.GuixDemo3Abstract bt31;
+ private org.nuiton.guix.GuixDemo3Abstract bt32;
+ private org.nuiton.guix.GuixDemo3Abstract bt34;
+ private java.util.ArrayList controller;
+ private org.nuiton.guix.GuixDemo2Abstract gd2;
+ private org.nuiton.guix.GuixDemo2Abstract gd22;
+ /**
+ * test javadoc Application
+ */
+ private org.nuiton.guix.GuixDemoAbstract guixdemo = this;
+ private javax.swing.JMenuItem item1;
+ private javax.swing.JLabel label;
+ private javax.swing.JLabel label2;
+ private javax.swing.JLabel label3;
+ private javax.swing.JTabbedPane tabPanel;
+ private javax.swing.JPanel table;
+ /**
+ * javadoc textfield
+ */
+ private javax.swing.JTextField textfield;
+
+ /* begin raw body code */
+
+ private Button b = new Button("test");
+ public enum Day {
+ SUNDAY, MONDAY, TUESDAY, WEDNESDAY,
+ THURSDAY, FRIDAY, SATURDAY
+ }
+
+ /* end raw body code */
+
+ /*---------------------------------------------------------------------------------*/
+ /*-- Statics methods --------------------------------------------------------------*/
+ /*---------------------------------------------------------------------------------*/
+
+ public static void testSameName() {
+ System.out.println("load the script file with the same name");
+ }
+
+ /*---------------------------------------------------------------------------------*/
+ /*-- Constructors -----------------------------------------------------------------*/
+ /*---------------------------------------------------------------------------------*/
+
+ /**
+ * Constructor
+ */
+ public GuixDemoAbstract() {
+ initialize();
+ }
+
+ /*---------------------------------------------------------------------------------*/
+ /*-- JAXXObject implementation ----------------------------------------------------*/
+ /*---------------------------------------------------------------------------------*/
+
+ public void applyDataBinding(String _binding) {
+ if("textfield.enabled".equals(_binding)) {
+ if(getGd2() != null) {
+ getGd2().addPropertyChangeListener(new java.beans.PropertyChangeListener() {
+ public void propertyChange(java.beans.PropertyChangeEvent arg0) {
+ onChangeFromgetGd2getButtonisSelected();
+ }
+ });
+ }
+ if(getGd2() != null && getGd2().getButton() != null) {
+ getGd2().getButton().addPropertyChangeListener(new java.beans.PropertyChangeListener() {
+ public void propertyChange(java.beans.PropertyChangeEvent arg0) {
+ onChangeFromgetGd2getButtonisSelected();
+ }
+ });
+ }
+ if(getGd2() != null && getGd2().getButton() != null) {
+ getGd2().getButton().getModel().addChangeListener(new javax.swing.event.ChangeListener() {
+ public void stateChanged(javax.swing.event.ChangeEvent arg0) {
+ onChangeFromgetGd2getButtonisSelected();
+ }
+ });
+ }
+ if(getGd22() != null) {
+ getGd22().addPropertyChangeListener(new java.beans.PropertyChangeListener() {
+ public void propertyChange(java.beans.PropertyChangeEvent arg0) {
+ onChangeFromgetGd22getButtonisSelected();
+ }
+ });
+ }
+ if(getGd22() != null && getGd22().getButton() != null) {
+ getGd22().getButton().addPropertyChangeListener(new java.beans.PropertyChangeListener() {
+ public void propertyChange(java.beans.PropertyChangeEvent arg0) {
+ onChangeFromgetGd22getButtonisSelected();
+ }
+ });
+ }
+ if(getGd22() != null && getGd22().getButton() != null) {
+ getGd22().getButton().getModel().addChangeListener(new javax.swing.event.ChangeListener() {
+ public void stateChanged(javax.swing.event.ChangeEvent arg0) {
+ onChangeFromgetGd22getButtonisSelected();
+ }
+ });
+ }
+ }
+ else if("label.text".equals(_binding)) {
+ if(getTextfield() != null) {
+ getTextfield().addPropertyChangeListener(new java.beans.PropertyChangeListener() {
+ public void propertyChange(java.beans.PropertyChangeEvent arg0) {
+ onChangeFromtextfieldgetText();
+ }
+ });
+ }
+ if(getTextfield() != null) {
+ getTextfield().getDocument().addDocumentListener(new javax.swing.event.DocumentListener() {
+ public void insertUpdate(javax.swing.event.DocumentEvent arg0) {
+ onChangeFromtextfieldgetText();
+ }
+ public void removeUpdate(javax.swing.event.DocumentEvent arg0) {
+ onChangeFromtextfieldgetText();
+ }
+ public void changedUpdate(javax.swing.event.DocumentEvent arg0) {
+ onChangeFromtextfieldgetText();
+ }
+ });
+ }
+ }
+
+ processDataBinding(_binding);
+ }
+
+ public void firePropertyChange(String name, Object oldValue, Object newValue) {
+ super.firePropertyChange(name, oldValue, newValue);
+ }
+
+ public void processDataBinding(String _binding) {
+ if (activeBindings.contains(_binding)) {
+ return;
+ }
+ activeBindings.add(_binding);
+ try{
+ if("textfield.enabled".equals(_binding)) {
+ textfield.setEnabled(getGd2().getButton().isSelected() && getGd22().getButton().isSelected());
+ }
+ else if("label.text".equals(_binding)) {
+ label.setText("label : " + textfield.getText());
+ }
+
+ } finally {
+ activeBindings.remove(_binding);
+ }
+ }
+
+ public void removeDataBinding(String _binding) {
+ if("textfield.enabled".equals(_binding)) {
+ if(getGd2() != null) {
+ getGd2().removePropertyChangeListener(new java.beans.PropertyChangeListener() {
+ public void propertyChange(java.beans.PropertyChangeEvent arg0) {
+ onChangeFromgetGd2getButtonisSelected();
+ }
+ });
+ }
+ if(getGd2() != null && getGd2().getButton() != null) {
+ getGd2().getButton().removePropertyChangeListener(new java.beans.PropertyChangeListener() {
+ public void propertyChange(java.beans.PropertyChangeEvent arg0) {
+ onChangeFromgetGd2getButtonisSelected();
+ }
+ });
+ }
+ if(getGd2() != null && getGd2().getButton() != null) {
+ getGd2().getButton().getModel().removeChangeListener(new javax.swing.event.ChangeListener() {
+ public void stateChanged(javax.swing.event.ChangeEvent arg0) {
+ onChangeFromgetGd2getButtonisSelected();
+ }
+ });
+ }
+ if(getGd22() != null) {
+ getGd22().removePropertyChangeListener(new java.beans.PropertyChangeListener() {
+ public void propertyChange(java.beans.PropertyChangeEvent arg0) {
+ onChangeFromgetGd22getButtonisSelected();
+ }
+ });
+ }
+ if(getGd22() != null && getGd22().getButton() != null) {
+ getGd22().getButton().removePropertyChangeListener(new java.beans.PropertyChangeListener() {
+ public void propertyChange(java.beans.PropertyChangeEvent arg0) {
+ onChangeFromgetGd22getButtonisSelected();
+ }
+ });
+ }
+ if(getGd22() != null && getGd22().getButton() != null) {
+ getGd22().getButton().getModel().removeChangeListener(new javax.swing.event.ChangeListener() {
+ public void stateChanged(javax.swing.event.ChangeEvent arg0) {
+ onChangeFromgetGd22getButtonisSelected();
+ }
+ });
+ }
+ }
+ else if("label.text".equals(_binding)) {
+ if(getTextfield() != null) {
+ getTextfield().removePropertyChangeListener(new java.beans.PropertyChangeListener() {
+ public void propertyChange(java.beans.PropertyChangeEvent arg0) {
+ onChangeFromtextfieldgetText();
+ }
+ });
+ }
+ if(getTextfield() != null) {
+ getTextfield().getDocument().removeDocumentListener(new javax.swing.event.DocumentListener() {
+ public void insertUpdate(javax.swing.event.DocumentEvent arg0) {
+ onChangeFromtextfieldgetText();
+ }
+ public void removeUpdate(javax.swing.event.DocumentEvent arg0) {
+ onChangeFromtextfieldgetText();
+ }
+ public void changedUpdate(javax.swing.event.DocumentEvent arg0) {
+ onChangeFromtextfieldgetText();
+ }
+ });
+ }
+ }
+ }
+
+ /*---------------------------------------------------------------------------------*/
+ /*-- public acessor methods -------------------------------------------------------*/
+ /*---------------------------------------------------------------------------------*/
+
+ public javax.swing.JButton get$Button6() {
+ return $Button6;
+ }
+
+ public javax.swing.JButton get$Button7() {
+ return $Button7;
+ }
+
+ public javax.swing.JToolBar get$JToolBar5() {
+ return $JToolBar5;
+ }
+
+ public javax.swing.JMenu get$Menu2() {
+ return $Menu2;
+ }
+
+ public javax.swing.JMenu get$Menu4() {
+ return $Menu4;
+ }
+
+ public javax.swing.JMenuBar get$MenuBar1() {
+ return $MenuBar1;
+ }
+
+ public javax.swing.JMenuItem get$MenuItem3() {
+ return $MenuItem3;
+ }
+
+ public java.util.List<String> getActiveBindings() {
+ return activeBindings;
+ }
+
+ public javax.swing.JButton getBouton1() {
+ return bouton1;
+ }
+
+ public org.nuiton.guix.GuixDemo3Abstract getBt3() {
+ return bt3;
+ }
+
+ public org.nuiton.guix.GuixDemo3Abstract getBt31() {
+ return bt31;
+ }
+
+ public org.nuiton.guix.GuixDemo3Abstract getBt32() {
+ return bt32;
+ }
+
+ public org.nuiton.guix.GuixDemo3Abstract getBt34() {
+ return bt34;
+ }
+
+ public java.util.ArrayList getController() {
+ return controller;
+ }
+
+ public org.nuiton.guix.GuixDemo2Abstract getGd2() {
+ return gd2;
+ }
+
+ public org.nuiton.guix.GuixDemo2Abstract getGd22() {
+ return gd22;
+ }
+
+ public org.nuiton.guix.GuixDemoAbstract getGuixdemo() {
+ return guixdemo;
+ }
+
+ public javax.swing.JMenuItem getItem1() {
+ return item1;
+ }
+
+ public javax.swing.JLabel getLabel() {
+ return label;
+ }
+
+ public javax.swing.JLabel getLabel2() {
+ return label2;
+ }
+
+ public javax.swing.JLabel getLabel3() {
+ return label3;
+ }
+
+ public javax.swing.JTabbedPane getTabPanel() {
+ return tabPanel;
+ }
+
+ public javax.swing.JPanel getTable() {
+ return table;
+ }
+
+ public javax.swing.JTextField getTextfield() {
+ return textfield;
+ }
+
+ /*---------------------------------------------------------------------------------*/
+ /*-- public mutator methods -------------------------------------------------------*/
+ /*---------------------------------------------------------------------------------*/
+
+ public void set$Button6(javax.swing.JButton newValue) {
+ this.$Button6 = newValue;
+ }
+
+ public void set$Button7(javax.swing.JButton newValue) {
+ this.$Button7 = newValue;
+ }
+
+ public void set$JToolBar5(javax.swing.JToolBar newValue) {
+ this.$JToolBar5 = newValue;
+ }
+
+ public void set$Menu2(javax.swing.JMenu newValue) {
+ this.$Menu2 = newValue;
+ }
+
+ public void set$Menu4(javax.swing.JMenu newValue) {
+ this.$Menu4 = newValue;
+ }
+
+ public void set$MenuBar1(javax.swing.JMenuBar newValue) {
+ this.$MenuBar1 = newValue;
+ }
+
+ public void set$MenuItem3(javax.swing.JMenuItem newValue) {
+ this.$MenuItem3 = newValue;
+ }
+
+ public void setBouton1(javax.swing.JButton newValue) {
+ this.bouton1 = newValue;
+ }
+
+ public void setBt3(org.nuiton.guix.GuixDemo3Abstract newValue) {
+ this.bt3 = newValue;
+ }
+
+ public void setBt31(org.nuiton.guix.GuixDemo3Abstract newValue) {
+ this.bt31 = newValue;
+ }
+
+ public void setBt32(org.nuiton.guix.GuixDemo3Abstract newValue) {
+ this.bt32 = newValue;
+ }
+
+ public void setBt34(org.nuiton.guix.GuixDemo3Abstract newValue) {
+ this.bt34 = newValue;
+ }
+
+ public void setController(java.util.ArrayList newValue) {
+ this.controller = newValue;
+ }
+
+ public void setGd2(org.nuiton.guix.GuixDemo2Abstract newValue) {
+ this.gd2 = newValue;
+ }
+
+ public void setGd22(org.nuiton.guix.GuixDemo2Abstract newValue) {
+ this.gd22 = newValue;
+ }
+
+ public void setGuixdemo(org.nuiton.guix.GuixDemoAbstract newValue) {
+ this.guixdemo = newValue;
+ }
+
+ public void setItem1(javax.swing.JMenuItem newValue) {
+ this.item1 = newValue;
+ }
+
+ public void setLabel(javax.swing.JLabel newValue) {
+ this.label = newValue;
+ }
+
+ public void setLabel2(javax.swing.JLabel newValue) {
+ this.label2 = newValue;
+ }
+
+ public void setLabel3(javax.swing.JLabel newValue) {
+ this.label3 = newValue;
+ }
+
+ public void setTabPanel(javax.swing.JTabbedPane newValue) {
+ this.tabPanel = newValue;
+ }
+
+ public void setTable(javax.swing.JPanel newValue) {
+ this.table = newValue;
+ }
+
+ public void setTextfield(javax.swing.JTextField newValue) {
+ this.textfield = newValue;
+ }
+
+ /*---------------------------------------------------------------------------------*/
+ /*-- public mutator methods -------------------------------------------------------*/
+ /*---------------------------------------------------------------------------------*/
+
+ public void beforeBinding() {
+ this.add(b, BorderLayout.SOUTH);
+ }
+
+ public void beforeCreation() {
+ System.out.println("before Creation");
+ }
+
+ public void beforeInitialization() {
+
+ }
+
+ /**
+ * Components creation
+ */
+ public void componentsCreation() {
+ createController();
+ create$Menu2();
+ createItem1();
+ create$MenuItem3();
+ create$Menu4();
+ create$MenuBar1();
+ create$JToolBar5();
+ createBouton1();
+ create$Button6();
+ create$Button7();
+ createTabPanel();
+ createTextfield();
+ createLabel();
+ createLabel2();
+ createBt3();
+ createBt31();
+ createBt32();
+ createBt34();
+ createLabel3();
+ createTable();
+ createGd2();
+ createGd22();
+ }
+
+ /**
+ * components layout
+ */
+ public void componentsTree() {
+ this.setTitle("Guix Swing Demo");
+ this.setSize(800,600);
+ this.setLayout(new BorderLayout());
+ this.setJMenuBar($MenuBar1);
+ $MenuBar1.add($Menu2);
+ $Menu2.add(item1);
+ $Menu2.add($MenuItem3);
+ $MenuBar1.add($Menu4);
+ this.add($JToolBar5,BorderLayout.NORTH);
+ $JToolBar5.add(bouton1);
+ $JToolBar5.add($Button6);
+ $JToolBar5.add($Button7);
+ this.add(tabPanel,BorderLayout.CENTER);
+ tabPanel.add(table);
+ table.add(textfield, new java.awt.GridBagConstraints (0,0,1,1,0.0,0.0,java.awt.GridBagConstraints.FIRST_LINE_START,java.awt.GridBagConstraints.BOTH, new java.awt.Insets(1,1,1,1),1,1));
+ table.add(label, new java.awt.GridBagConstraints (1,0,1,1,0.0,0.0,java.awt.GridBagConstraints.FIRST_LINE_START,java.awt.GridBagConstraints.BOTH, new java.awt.Insets(1,1,1,1),1,1));
+ table.add(label2, new java.awt.GridBagConstraints (2,0,1,3,0.0,0.0,java.awt.GridBagConstraints.FIRST_LINE_START,java.awt.GridBagConstraints.BOTH, new java.awt.Insets(1,1,1,1),1,1));
+ table.add(bt3, new java.awt.GridBagConstraints (3,1,3,1,0.0,0.0,java.awt.GridBagConstraints.FIRST_LINE_START,java.awt.GridBagConstraints.BOTH, new java.awt.Insets(0,0,0,0),1,1));
+ table.add(bt31, new java.awt.GridBagConstraints (0,2,2,1,0.0,0.0,java.awt.GridBagConstraints.FIRST_LINE_START,java.awt.GridBagConstraints.BOTH, new java.awt.Insets(0,0,0,0),1,1));
+ table.add(bt32, new java.awt.GridBagConstraints (3,2,1,1,0.0,0.0,java.awt.GridBagConstraints.FIRST_LINE_START,java.awt.GridBagConstraints.BOTH, new java.awt.Insets(2,2,2,2),1,1));
+ table.add(bt34, new java.awt.GridBagConstraints (0,3,3,1,0.0,0.0,java.awt.GridBagConstraints.FIRST_LINE_START,java.awt.GridBagConstraints.BOTH, new java.awt.Insets(1,1,1,1),1,1));
+ table.add(label3, new java.awt.GridBagConstraints (0,4,2,1,0.0,0.0,java.awt.GridBagConstraints.FIRST_LINE_START,java.awt.GridBagConstraints.BOTH, new java.awt.Insets(1,1,1,1),1,1));
+ tabPanel.add(gd2);
+ tabPanel.add(gd22);
+ }
+
+ public void inTheEnd() {
+
+ }
+
+ /**
+ * initilization of databinding
+ */
+ public void initDataBinding() {
+ applyDataBinding("textfield.enabled");
+ applyDataBinding("label.text");
+ }
+
+ /**
+ * initialization
+ */
+ public void initialize() {
+ beforeCreation();
+ componentsCreation();
+ b.addActionListener(new ActionListener() {
+ public void actionPerformed(ActionEvent arg0) {
+ if(gd2.getButton().isSelected()) {
+ java.util.Random r = new java.util.Random();
+ table.setBackground(new java.awt.Color(r.nextInt(255), r.nextInt(255), r.nextInt(255)));
+ }
+ }
+ });
+ beforeInitialization();
+ componentsTree();
+ beforeBinding();
+ initDataBinding();
+ inTheEnd();
+ }
+
+ public void onChangeFromgetGd22getButtonisSelected() {
+ processDataBinding("textfield.enabled");
+ }
+
+ public void onChangeFromgetGd2getButtonisSelected() {
+ processDataBinding("textfield.enabled");
+ }
+
+ public void onChangeFromtextfieldgetText() {
+ processDataBinding("label.text");
+ }
+
+ /**
+ *
+ * test
+ * @since 0.0.1
+ *
+ */
+ public void test2(String test) throws NullPointerException, ArrayIndexOutOfBoundsException {
+ System.out.println(test);
+ }
+
+ /*---------------------------------------------------------------------------------*/
+ /*-- ui creation methods ----------------------------------------------------------*/
+ /*---------------------------------------------------------------------------------*/
+
+ /**
+ * $Button6 creation
+ */
+ private void create$Button6() {
+ $Button6 = new javax.swing.JButton();
+ $Button6.setText("bouton2");
+ $Button6.setForeground(new java.awt.Color(120,255,0));
+ $Button6.setSize(80,35);
+ $Button6.addActionListener(new java.awt.event.ActionListener() {
+ public void actionPerformed(java.awt.event.ActionEvent actionEvent){
+ $Button6.setText("click !");
+ ;System.out.println("Action [" + actionEvent.getActionCommand() + "] performed!");
+ }
+ });
+ }
+
+ /**
+ * $Button7 creation
+ */
+ private void create$Button7() {
+ $Button7 = new javax.swing.JButton();
+ $Button7.setText("bouton3");
+ $Button7.setForeground(new java.awt.Color(120,255,0));
+ $Button7.setSize(80,35);
+ $Button7.addActionListener(new java.awt.event.ActionListener() {
+ public void actionPerformed(java.awt.event.ActionEvent actionEvent){
+ $Button7.setText("click !");
+ ;System.out.println("Action [" + actionEvent.getActionCommand() + "] performed!");
+ }
+ });
+ }
+
+ /**
+ * $JToolBar5 creation
+ */
+ private void create$JToolBar5() {
+ $JToolBar5 = new javax.swing.JToolBar();
+ $JToolBar5.setBorder(new javax.swing.border.EtchedBorder());
+ }
+
+ /**
+ * $Menu2 creation
+ */
+ private void create$Menu2() {
+ $Menu2 = new javax.swing.JMenu("menu 1");
+ }
+
+ /**
+ * $Menu4 creation
+ */
+ private void create$Menu4() {
+ $Menu4 = new javax.swing.JMenu("menu 2");
+ }
+
+ /**
+ * $MenuBar1 creation
+ */
+ private void create$MenuBar1() {
+ $MenuBar1 = new javax.swing.JMenuBar();
+ $MenuBar1.setBorder(new javax.swing.border.BevelBorder(javax.swing.border.BevelBorder.RAISED));
+ }
+
+ /**
+ * $MenuItem3 creation
+ */
+ private void create$MenuItem3() {
+ $MenuItem3 = new javax.swing.JMenuItem();
+ $MenuItem3.setText("item2");
+ $MenuItem3.addActionListener(new java.awt.event.ActionListener() {
+ public void actionPerformed(java.awt.event.ActionEvent actionEvent){
+ System.out.println("Action [" + actionEvent.getActionCommand() + "] performed!");
+ }
+ });
+ }
+
+ /**
+ * bouton1 creation
+ */
+ private void createBouton1() {
+ bouton1 = new javax.swing.JButton();
+ bouton1.setText("bouton1");
+ bouton1.setSize(100,35);
+ bouton1.setForeground(new java.awt.Color(120,255,0));
+ bouton1.addActionListener(new java.awt.event.ActionListener() {
+ public void actionPerformed(java.awt.event.ActionEvent actionEvent){
+ bouton1.setText("click !");
+ ;System.out.println("Action [" + actionEvent.getActionCommand() + "] performed!");
+ }
+ });
+ }
+
+ /**
+ * bt3 creation
+ */
+ private void createBt3() {
+ bt3 = new org.nuiton.guix.GuixDemo3Impl();
+ bt3.setText("bt3");
+ bt3.addActionListener(new java.awt.event.ActionListener() {
+ public void actionPerformed(java.awt.event.ActionEvent actionEvent){
+ System.out.println("beau gosse");
+ }
+ });
+ }
+
+ /**
+ * bt31 creation
+ */
+ private void createBt31() {
+ bt31 = new org.nuiton.guix.GuixDemo3Impl();
+ bt31.setText("bt31");
+ }
+
+ /**
+ * bt32 creation
+ */
+ private void createBt32() {
+ bt32 = new org.nuiton.guix.GuixDemo3Impl();
+ bt32.setText("bt32");
+ }
+
+ /**
+ * bt34 creation
+ */
+ private void createBt34() {
+ bt34 = new org.nuiton.guix.GuixDemo3Impl();
+ bt34.setText("bt34");
+ }
+
+ /**
+ * controller creation
+ */
+ private void createController() {
+ controller = new java.util.ArrayList();
+ }
+
+ /**
+ * gd2 creation
+ */
+ private void createGd2() {
+ gd2 = new org.nuiton.guix.GuixDemo2Impl();
+ gd2.setName("GD2");
+ }
+
+ /**
+ * gd22 creation
+ */
+ private void createGd22() {
+ gd22 = new org.nuiton.guix.GuixDemo2Impl();
+ gd22.setName("GD22");
+ }
+
+ /**
+ * item1 creation
+ */
+ private void createItem1() {
+ item1 = new javax.swing.JMenuItem();
+ item1.setText("item1");
+ }
+
+ /**
+ * label creation
+ */
+ private void createLabel() {
+ label = new javax.swing.JLabel();
+ label.setForeground(new java.awt.Color(0,120,255));
+ label.addMouseListener(new java.awt.event.MouseAdapter() {
+ public void mouseEntered(java.awt.event.MouseEvent mouseEvent){
+ label.setForeground(new java.awt.Color(255,120,0));
+ ;
+ }
+ public void mouseExited(java.awt.event.MouseEvent mouseEvent){
+ label.setForeground(new java.awt.Color(0,120,255));
+ ;
+ }
+ });
+ }
+
+ /**
+ * label2 creation
+ */
+ private void createLabel2() {
+ label2 = new javax.swing.JLabel();
+ label2.setText("color");
+ label2.setBackground(java.awt.Color.BLUE);
+ }
+
+ /**
+ * label3 creation
+ */
+ private void createLabel3() {
+ label3 = new javax.swing.JLabel();
+ label3.setText("color");
+ label3.setForeground(java.awt.Color.YELLOW);
+ }
+
+ /**
+ * tabPanel creation
+ */
+ private void createTabPanel() {
+ tabPanel = new javax.swing.JTabbedPane();
+ tabPanel.setSize(800,400);
+ }
+
+ /**
+ * table creation
+ */
+ private void createTable() {
+ table = new javax.swing.JPanel(new java.awt.GridBagLayout());
+ table.setName("Table");
+ }
+
+ /**
+ * textfield creation
+ */
+ private void createTextfield() {
+ textfield = new javax.swing.JTextField("test");
+ textfield.setSize(100,35);
+ textfield.addFocusListener(new java.awt.event.FocusAdapter() {
+ public void focusGained(java.awt.event.FocusEvent focusEvent){
+ System.out.println("dude !");
+ }
+ });
+ }
+
+ }
\ No newline at end of file
Added: trunk/guix-test-swing/src/main/java/org/nuiton/guix/GuixDemoImpl.java
===================================================================
--- trunk/guix-test-swing/src/main/java/org/nuiton/guix/GuixDemoImpl.java (rev 0)
+++ trunk/guix-test-swing/src/main/java/org/nuiton/guix/GuixDemoImpl.java 2009-07-22 13:10:50 UTC (rev 1508)
@@ -0,0 +1,31 @@
+package org.nuiton.guix;
+
+import java.util.ArrayList;
+import javax.swing.JMenuBar;
+import javax.swing.JMenu;
+import javax.swing.JMenuItem;
+import javax.swing.JToolBar;
+import javax.swing.JButton;
+import javax.swing.JTabbedPane;
+import javax.swing.JPanel;
+import javax.swing.JTextField;
+import javax.swing.JLabel;
+import org.nuiton.guix.GuixDemo3Abstract;
+import org.nuiton.guix.GuixDemo2Abstract;
+
+/**
+ * test javadoc Application
+ */
+public class GuixDemoImpl extends GuixDemoAbstract {
+ /*---------------------------------------------------------------------------------*/
+ /*-- Constructors -----------------------------------------------------------------*/
+ /*---------------------------------------------------------------------------------*/
+
+ /**
+ * Constructor
+ */
+ public GuixDemoImpl() {
+ super();
+ }
+
+ }
\ No newline at end of file
Added: trunk/guix-test-swing/src/main/java/org/nuiton/guix/Main.java
===================================================================
--- trunk/guix-test-swing/src/main/java/org/nuiton/guix/Main.java (rev 0)
+++ trunk/guix-test-swing/src/main/java/org/nuiton/guix/Main.java 2009-07-22 13:10:50 UTC (rev 1508)
@@ -0,0 +1,19 @@
+package org.nuiton.guix;
+
+import java.io.File;
+import org.springframework.beans.factory.ListableBeanFactory;
+import org.springframework.beans.factory.xml.XmlBeanFactory;
+import org.springframework.core.io.FileSystemResource;
+
+public class Main {
+ /*---------------------------------------------------------------------------------*/
+ /*-- Statics methods --------------------------------------------------------------*/
+ /*---------------------------------------------------------------------------------*/
+
+ public static void main(String[] args) {
+ javax.swing.SwingUtilities.invokeLater(new Runnable() {public void run() {GuixDemoImpl main = new GuixDemoImpl();
+ main.pack();
+ main.setVisible(true);}});
+ }
+
+ }
\ No newline at end of file
1
0
r1507 - in trunk/guix-test-swing: . src/main/java/org/nuiton/guix src/main/java/org/nuiton/guix/demo
by kmorin@users.labs.libre-entreprise.org July 22, 2009
by kmorin@users.labs.libre-entreprise.org July 22, 2009
July 22, 2009
Author: kmorin
Date: 2009-07-22 15:10:33 +0200 (Wed, 22 Jul 2009)
New Revision: 1507
Added:
trunk/guix-test-swing/nbactions.xml
trunk/guix-test-swing/src/main/java/org/nuiton/guix/demo/Controller.java
Removed:
trunk/guix-test-swing/src/main/java/org/nuiton/guix/GuixDemo.java
trunk/guix-test-swing/src/main/java/org/nuiton/guix/GuixDemo2.java
trunk/guix-test-swing/src/main/java/org/nuiton/guix/GuixDemo2Abstract.java
trunk/guix-test-swing/src/main/java/org/nuiton/guix/GuixDemo2Impl.java
trunk/guix-test-swing/src/main/java/org/nuiton/guix/GuixDemo3.java
trunk/guix-test-swing/src/main/java/org/nuiton/guix/GuixDemo3Abstract.java
trunk/guix-test-swing/src/main/java/org/nuiton/guix/GuixDemo3Impl.java
trunk/guix-test-swing/src/main/java/org/nuiton/guix/GuixDemoAbstract.java
trunk/guix-test-swing/src/main/java/org/nuiton/guix/GuixDemoImpl.java
trunk/guix-test-swing/src/main/java/org/nuiton/guix/Main.java
Modified:
trunk/guix-test-swing/pom.xml
trunk/guix-test-swing/src/main/java/org/nuiton/guix/demo/GuixDemo.guix
Log:
example with the binding
Added: trunk/guix-test-swing/nbactions.xml
===================================================================
--- trunk/guix-test-swing/nbactions.xml (rev 0)
+++ trunk/guix-test-swing/nbactions.xml 2009-07-22 13:10:33 UTC (rev 1507)
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<actions>
+ <action>
+ <actionName>run</actionName>
+ <packagings>
+ <packaging>jar</packaging>
+ </packagings>
+ <goals>
+ <goal>process-classes</goal>
+ <goal>org.codehaus.mojo:exec-maven-plugin:1.1:exec</goal>
+ </goals>
+ <properties>
+ <exec.args>-classpath %classpath org.nuiton.guix.Main</exec.args>
+ <exec.executable>java</exec.executable>
+ </properties>
+ </action>
+ </actions>
Modified: trunk/guix-test-swing/pom.xml
===================================================================
--- trunk/guix-test-swing/pom.xml 2009-07-22 13:09:22 UTC (rev 1506)
+++ trunk/guix-test-swing/pom.xml 2009-07-22 13:10:33 UTC (rev 1507)
@@ -39,6 +39,14 @@
<groupId>junit</groupId>
<artifactId>junit</artifactId>
</dependency>
+
+ <!-- sibiling dependencies -->
+
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>guix-runtime-swing</artifactId>
+ <version>${project.version}</version>
+ </dependency>
</dependencies>
@@ -55,12 +63,36 @@
<packaging>jar</packaging>
+ <properties>
+ <maven.jar.main.class>org.nuiton.guix.Main</maven.jar.main.class>
+ </properties>
+
+
<!-- ************************************************************* -->
<!-- *** Build Environment ************************************** -->
<!-- ************************************************************* -->
-
+
+
+
<build>
+ <pluginManagement>
+ <plugins>
+ <plugin>
+ <artifactId>maven-jar-plugin</artifactId>
+ <configuration>
+ <archive>
+ <manifest>
+ <addClasspath>true</addClasspath>
+ <classpathPrefix>./lib/</classpathPrefix>
+ </manifest>
+ </archive>
+ </configuration>
+ </plugin>
+
+ </plugins>
+
+ </pluginManagement>
<plugins>
<plugin>
Deleted: trunk/guix-test-swing/src/main/java/org/nuiton/guix/GuixDemo.java
===================================================================
--- trunk/guix-test-swing/src/main/java/org/nuiton/guix/GuixDemo.java 2009-07-22 13:09:22 UTC (rev 1506)
+++ trunk/guix-test-swing/src/main/java/org/nuiton/guix/GuixDemo.java 2009-07-22 13:10:33 UTC (rev 1507)
@@ -1,87 +0,0 @@
-package org.nuiton.guix;
-
-import javax.swing.JMenuBar;
-import javax.swing.JMenu;
-import javax.swing.JMenuItem;
-import javax.swing.JToolBar;
-import javax.swing.JButton;
-import javax.swing.JTabbedPane;
-import javax.swing.JPanel;
-import javax.swing.JTextField;
-import javax.swing.JLabel;
-import org.nuiton.guix.GuixDemo3Abstract;
-import org.nuiton.guix.GuixDemo2Abstract;
-
-/**
- * test javadoc Application
- */
-public interface GuixDemo {
- /*---------------------------------------------------------------------------------*/
- /*-- public acessor methods -------------------------------------------------------*/
- /*---------------------------------------------------------------------------------*/
-
- public JToolBar get$JToolBar5();
-
- public GuixDemo3Abstract getBt3();
-
- public GuixDemo3Abstract getBt31();
-
- public GuixDemo3Abstract getBt32();
-
- public GuixDemo3Abstract getBt34();
-
- public GuixDemo2Abstract getGd2();
-
- public javax.swing.JPanel getTable();
-
- /*---------------------------------------------------------------------------------*/
- /*-- public mutator methods -------------------------------------------------------*/
- /*---------------------------------------------------------------------------------*/
-
- public void set$JToolBar5(JToolBar newValue);
-
- public void setBt3(GuixDemo3Abstract newValue);
-
- public void setBt31(GuixDemo3Abstract newValue);
-
- public void setBt32(GuixDemo3Abstract newValue);
-
- public void setBt34(GuixDemo3Abstract newValue);
-
- public void setGd2(GuixDemo2Abstract newValue);
-
- public void setTable(javax.swing.JPanel newValue);
-
- /*---------------------------------------------------------------------------------*/
- /*-- public mutator methods -------------------------------------------------------*/
- /*---------------------------------------------------------------------------------*/
-
- public void beforeBinding();
-
- public void beforeCreation();
-
- public void beforeInitialization();
-
- /**
- * Components creation
- */
- public void componentsCreation();
-
- /**
- * components layout
- */
- public void componentsTree();
-
- public void inTheEnd();
-
- /**
- * initilization of databinding
- */
- public void initDataBinding();
-
- /**
- * initialization
- */
- public void initialize();
-
-}
\ No newline at end of file
Deleted: trunk/guix-test-swing/src/main/java/org/nuiton/guix/GuixDemo2.java
===================================================================
--- trunk/guix-test-swing/src/main/java/org/nuiton/guix/GuixDemo2.java 2009-07-22 13:09:22 UTC (rev 1506)
+++ trunk/guix-test-swing/src/main/java/org/nuiton/guix/GuixDemo2.java 2009-07-22 13:10:33 UTC (rev 1507)
@@ -1,41 +0,0 @@
-package org.nuiton.guix;
-
-import javax.swing.JToggleButton;
-
-/**
- * test javadoc Application
- */
-public interface GuixDemo2 {
- /*---------------------------------------------------------------------------------*/
- /*-- public mutator methods -------------------------------------------------------*/
- /*---------------------------------------------------------------------------------*/
-
- public void beforeBinding();
-
- public void beforeCreation();
-
- public void beforeInitialization();
-
- /**
- * Components creation
- */
- public void componentsCreation();
-
- /**
- * components layout
- */
- public void componentsTree();
-
- public void inTheEnd();
-
- /**
- * initilization of databinding
- */
- public void initDataBinding();
-
- /**
- * initialization
- */
- public void initialize();
-
-}
\ No newline at end of file
Deleted: trunk/guix-test-swing/src/main/java/org/nuiton/guix/GuixDemo2Abstract.java
===================================================================
--- trunk/guix-test-swing/src/main/java/org/nuiton/guix/GuixDemo2Abstract.java 2009-07-22 13:09:22 UTC (rev 1506)
+++ trunk/guix-test-swing/src/main/java/org/nuiton/guix/GuixDemo2Abstract.java 2009-07-22 13:10:33 UTC (rev 1507)
@@ -1,127 +0,0 @@
-package org.nuiton.guix;
-
-import javax.swing.JToggleButton;
-
-/**
- * test javadoc Application
- */
-public abstract class GuixDemo2Abstract extends javax.swing.JPanel implements GuixDemo2 {
- /**
- * bindingGroup for databinding
- */
- private org.jdesktop.beansbinding.BindingGroup bindingGroup;
- /**
- * test javadoc Application
- */
- private JToggleButton button;
-
- /*---------------------------------------------------------------------------------*/
- /*-- Constructors -----------------------------------------------------------------*/
- /*---------------------------------------------------------------------------------*/
-
- /**
- * Constructor
- */
- public GuixDemo2Abstract() {
- initialize();
- }
-
- /*---------------------------------------------------------------------------------*/
- /*-- public acessor methods -------------------------------------------------------*/
- /*---------------------------------------------------------------------------------*/
-
- public org.jdesktop.beansbinding.BindingGroup getBindingGroup() {
- return bindingGroup;
- }
-
- public JToggleButton getButton() {
- return button;
- }
-
- /*---------------------------------------------------------------------------------*/
- /*-- public mutator methods -------------------------------------------------------*/
- /*---------------------------------------------------------------------------------*/
-
- public void setBindingGroup(org.jdesktop.beansbinding.BindingGroup newValue) {
- this.bindingGroup = newValue;
- }
-
- public void setButton(JToggleButton newValue) {
- this.button = newValue;
- }
-
- /*---------------------------------------------------------------------------------*/
- /*-- public mutator methods -------------------------------------------------------*/
- /*---------------------------------------------------------------------------------*/
-
- public void beforeBinding() {
-
- }
-
- public void beforeCreation() {
-
- }
-
- public void beforeInitialization() {
-
- }
-
- /**
- * Components creation
- */
- public void componentsCreation() {
- createButton();
- }
-
- /**
- * components layout
- */
- public void componentsTree() {
- this.setLayout(new java.awt.FlowLayout());
- this.add(button);
- }
-
- public void inTheEnd() {
-
- }
-
- /**
- * initilization of databinding
- */
- public void initDataBinding() {
- bindingGroup = new org.jdesktop.beansbinding.BindingGroup();
- }
-
- /**
- * initialization
- */
- public void initialize() {
- beforeCreation();
- componentsCreation();
-
- beforeInitialization();
- componentsTree();
- beforeBinding();
- initDataBinding();
- inTheEnd();
- }
-
- /*---------------------------------------------------------------------------------*/
- /*-- ui creation methods ----------------------------------------------------------*/
- /*---------------------------------------------------------------------------------*/
-
- /**
- * button creation
- */
- private void createButton() {
- button = new JToggleButton();
- button.setText("Push me");
- button.setSelected(true);
- button.addActionListener(new java.awt.event.ActionListener() {
- public void actionPerformed(java.awt.event.ActionEvent actionEvent){
- System.out.println("test");
- }
- });
- }
-
-}
\ No newline at end of file
Deleted: trunk/guix-test-swing/src/main/java/org/nuiton/guix/GuixDemo2Impl.java
===================================================================
--- trunk/guix-test-swing/src/main/java/org/nuiton/guix/GuixDemo2Impl.java 2009-07-22 13:09:22 UTC (rev 1506)
+++ trunk/guix-test-swing/src/main/java/org/nuiton/guix/GuixDemo2Impl.java 2009-07-22 13:10:33 UTC (rev 1507)
@@ -1,20 +0,0 @@
-package org.nuiton.guix;
-
-import javax.swing.JToggleButton;
-
-/**
- * test javadoc Application
- */
-public class GuixDemo2Impl extends GuixDemo2Abstract {
- /*---------------------------------------------------------------------------------*/
- /*-- Constructors -----------------------------------------------------------------*/
- /*---------------------------------------------------------------------------------*/
-
- /**
- * Constructor
- */
- public GuixDemo2Impl() {
- super();
- }
-
-}
\ No newline at end of file
Deleted: trunk/guix-test-swing/src/main/java/org/nuiton/guix/GuixDemo3.java
===================================================================
--- trunk/guix-test-swing/src/main/java/org/nuiton/guix/GuixDemo3.java 2009-07-22 13:09:22 UTC (rev 1506)
+++ trunk/guix-test-swing/src/main/java/org/nuiton/guix/GuixDemo3.java 2009-07-22 13:10:33 UTC (rev 1507)
@@ -1,39 +0,0 @@
-package org.nuiton.guix;
-
-/**
- * test javadoc Application
- */
-public interface GuixDemo3 {
- /*---------------------------------------------------------------------------------*/
- /*-- public mutator methods -------------------------------------------------------*/
- /*---------------------------------------------------------------------------------*/
-
- public void beforeBinding();
-
- public void beforeCreation();
-
- public void beforeInitialization();
-
- /**
- * Components creation
- */
- public void componentsCreation();
-
- /**
- * components layout
- */
- public void componentsTree();
-
- public void inTheEnd();
-
- /**
- * initilization of databinding
- */
- public void initDataBinding();
-
- /**
- * initialization
- */
- public void initialize();
-
-}
\ No newline at end of file
Deleted: trunk/guix-test-swing/src/main/java/org/nuiton/guix/GuixDemo3Abstract.java
===================================================================
--- trunk/guix-test-swing/src/main/java/org/nuiton/guix/GuixDemo3Abstract.java 2009-07-22 13:09:22 UTC (rev 1506)
+++ trunk/guix-test-swing/src/main/java/org/nuiton/guix/GuixDemo3Abstract.java 2009-07-22 13:10:33 UTC (rev 1507)
@@ -1,95 +0,0 @@
-package org.nuiton.guix;
-
-/**
- * test javadoc Application
- */
-public abstract class GuixDemo3Abstract extends javax.swing.JButton implements GuixDemo3 {
- /**
- * bindingGroup for databinding
- */
- private org.jdesktop.beansbinding.BindingGroup bindingGroup;
-
- /*---------------------------------------------------------------------------------*/
- /*-- Constructors -----------------------------------------------------------------*/
- /*---------------------------------------------------------------------------------*/
-
- /**
- * Constructor
- */
- public GuixDemo3Abstract() {
- initialize();
- }
-
- /*---------------------------------------------------------------------------------*/
- /*-- public acessor methods -------------------------------------------------------*/
- /*---------------------------------------------------------------------------------*/
-
- public org.jdesktop.beansbinding.BindingGroup getBindingGroup() {
- return bindingGroup;
- }
-
- /*---------------------------------------------------------------------------------*/
- /*-- public mutator methods -------------------------------------------------------*/
- /*---------------------------------------------------------------------------------*/
-
- public void setBindingGroup(org.jdesktop.beansbinding.BindingGroup newValue) {
- this.bindingGroup = newValue;
- }
-
- /*---------------------------------------------------------------------------------*/
- /*-- public mutator methods -------------------------------------------------------*/
- /*---------------------------------------------------------------------------------*/
-
- public void beforeBinding() {
-
- }
-
- public void beforeCreation() {
-
- }
-
- public void beforeInitialization() {
-
- }
-
- /**
- * Components creation
- */
- public void componentsCreation() {
-
- }
-
- /**
- * components layout
- */
- public void componentsTree() {
- this.setText("GuixDemo3");
- this.setLayout(new java.awt.FlowLayout());
- }
-
- public void inTheEnd() {
-
- }
-
- /**
- * initilization of databinding
- */
- public void initDataBinding() {
- bindingGroup = new org.jdesktop.beansbinding.BindingGroup();
- }
-
- /**
- * initialization
- */
- public void initialize() {
- beforeCreation();
- componentsCreation();
-
- beforeInitialization();
- componentsTree();
- beforeBinding();
- initDataBinding();
- inTheEnd();
- }
-
-}
\ No newline at end of file
Deleted: trunk/guix-test-swing/src/main/java/org/nuiton/guix/GuixDemo3Impl.java
===================================================================
--- trunk/guix-test-swing/src/main/java/org/nuiton/guix/GuixDemo3Impl.java 2009-07-22 13:09:22 UTC (rev 1506)
+++ trunk/guix-test-swing/src/main/java/org/nuiton/guix/GuixDemo3Impl.java 2009-07-22 13:10:33 UTC (rev 1507)
@@ -1,18 +0,0 @@
-package org.nuiton.guix;
-
-/**
- * test javadoc Application
- */
-public class GuixDemo3Impl extends GuixDemo3Abstract {
- /*---------------------------------------------------------------------------------*/
- /*-- Constructors -----------------------------------------------------------------*/
- /*---------------------------------------------------------------------------------*/
-
- /**
- * Constructor
- */
- public GuixDemo3Impl() {
- super();
- }
-
-}
\ No newline at end of file
Deleted: trunk/guix-test-swing/src/main/java/org/nuiton/guix/GuixDemoAbstract.java
===================================================================
--- trunk/guix-test-swing/src/main/java/org/nuiton/guix/GuixDemoAbstract.java 2009-07-22 13:09:22 UTC (rev 1506)
+++ trunk/guix-test-swing/src/main/java/org/nuiton/guix/GuixDemoAbstract.java 2009-07-22 13:10:33 UTC (rev 1507)
@@ -1,566 +0,0 @@
-package org.nuiton.guix;
-
-import javax.swing.JMenuBar;
-import javax.swing.JMenu;
-import javax.swing.JMenuItem;
-import javax.swing.JToolBar;
-import javax.swing.JButton;
-import javax.swing.JTabbedPane;
-import javax.swing.JPanel;
-import javax.swing.JTextField;
-import javax.swing.JLabel;
-import org.nuiton.guix.GuixDemo3Abstract;
-import org.nuiton.guix.GuixDemo2Abstract;
-import java.awt.Button;
-import java.awt.event.ActionListener;
-import java.awt.event.ActionEvent;
-import java.awt.BorderLayout;
-
-/**
- * test javadoc Application
- */
-public abstract class GuixDemoAbstract extends javax.swing.JFrame implements GuixDemo {
- private JButton $Button6;
- private JButton $Button7;
- private JButton $Button8;
- private JToolBar $JToolBar5;
- private JMenu $Menu2;
- private JMenu $Menu4;
- private JMenuBar $MenuBar1;
- private JMenuItem $MenuItem3;
- private JTabbedPane $TabPanel9;
- /**
- * bindingGroup for databinding
- */
- private org.jdesktop.beansbinding.BindingGroup bindingGroup;
- private GuixDemo3Abstract bt3;
- private GuixDemo3Abstract bt31;
- private GuixDemo3Abstract bt32;
- private GuixDemo3Abstract bt34;
- private GuixDemo2Abstract gd2;
- private JMenuItem item1;
- private JLabel label;
- private JLabel label2;
- private JLabel label3;
- private JPanel table;
- /**
- * javadoc textfield
- */
- private JTextField textfield;
-
- /* begin raw body code */
- private Button b = new Button("test");
- public enum Day {
- SUNDAY, MONDAY, TUESDAY, WEDNESDAY,
- THURSDAY, FRIDAY, SATURDAY
- }
- /* end raw body code */
- /*---------------------------------------------------------------------------------*/
- /*-- Statics methods --------------------------------------------------------------*/
- /*---------------------------------------------------------------------------------*/
-
- public static void testSameName() {
- System.out.println("load the script file with the same name");
- }
-
- /*---------------------------------------------------------------------------------*/
- /*-- Constructors -----------------------------------------------------------------*/
- /*---------------------------------------------------------------------------------*/
-
- /**
- * Constructor
- */
- public GuixDemoAbstract() {
- initialize();
- }
-
- /*---------------------------------------------------------------------------------*/
- /*-- public acessor methods -------------------------------------------------------*/
- /*---------------------------------------------------------------------------------*/
-
- public JButton get$Button6() {
- return $Button6;
- }
-
- public JButton get$Button7() {
- return $Button7;
- }
-
- public JButton get$Button8() {
- return $Button8;
- }
-
- public JToolBar get$JToolBar5() {
- return $JToolBar5;
- }
-
- public JMenu get$Menu2() {
- return $Menu2;
- }
-
- public JMenu get$Menu4() {
- return $Menu4;
- }
-
- public JMenuBar get$MenuBar1() {
- return $MenuBar1;
- }
-
- public JMenuItem get$MenuItem3() {
- return $MenuItem3;
- }
-
- public JTabbedPane get$TabPanel9() {
- return $TabPanel9;
- }
-
- public org.jdesktop.beansbinding.BindingGroup getBindingGroup() {
- return bindingGroup;
- }
-
- public GuixDemo3Abstract getBt3() {
- return bt3;
- }
-
- public GuixDemo3Abstract getBt31() {
- return bt31;
- }
-
- public GuixDemo3Abstract getBt32() {
- return bt32;
- }
-
- public GuixDemo3Abstract getBt34() {
- return bt34;
- }
-
- public GuixDemo2Abstract getGd2() {
- return gd2;
- }
-
- public JMenuItem getItem1() {
- return item1;
- }
-
- public JLabel getLabel() {
- return label;
- }
-
- public JLabel getLabel2() {
- return label2;
- }
-
- public JLabel getLabel3() {
- return label3;
- }
-
- public JPanel getTable() {
- return table;
- }
-
- public JTextField getTextfield() {
- return textfield;
- }
-
- /*---------------------------------------------------------------------------------*/
- /*-- public mutator methods -------------------------------------------------------*/
- /*---------------------------------------------------------------------------------*/
-
- public void set$Button6(JButton newValue) {
- this.$Button6 = newValue;
- }
-
- public void set$Button7(JButton newValue) {
- this.$Button7 = newValue;
- }
-
- public void set$Button8(JButton newValue) {
- this.$Button8 = newValue;
- }
-
- public void set$JToolBar5(JToolBar newValue) {
- this.$JToolBar5 = newValue;
- }
-
- public void set$Menu2(JMenu newValue) {
- this.$Menu2 = newValue;
- }
-
- public void set$Menu4(JMenu newValue) {
- this.$Menu4 = newValue;
- }
-
- public void set$MenuBar1(JMenuBar newValue) {
- this.$MenuBar1 = newValue;
- }
-
- public void set$MenuItem3(JMenuItem newValue) {
- this.$MenuItem3 = newValue;
- }
-
- public void set$TabPanel9(JTabbedPane newValue) {
- this.$TabPanel9 = newValue;
- }
-
- public void setBindingGroup(org.jdesktop.beansbinding.BindingGroup newValue) {
- this.bindingGroup = newValue;
- }
-
- public void setBt3(GuixDemo3Abstract newValue) {
- this.bt3 = newValue;
- }
-
- public void setBt31(GuixDemo3Abstract newValue) {
- this.bt31 = newValue;
- }
-
- public void setBt32(GuixDemo3Abstract newValue) {
- this.bt32 = newValue;
- }
-
- public void setBt34(GuixDemo3Abstract newValue) {
- this.bt34 = newValue;
- }
-
- public void setGd2(GuixDemo2Abstract newValue) {
- this.gd2 = newValue;
- }
-
- public void setItem1(JMenuItem newValue) {
- this.item1 = newValue;
- }
-
- public void setLabel(JLabel newValue) {
- this.label = newValue;
- }
-
- public void setLabel2(JLabel newValue) {
- this.label2 = newValue;
- }
-
- public void setLabel3(JLabel newValue) {
- this.label3 = newValue;
- }
-
- public void setTable(JPanel newValue) {
- this.table = newValue;
- }
-
- public void setTextfield(JTextField newValue) {
- this.textfield = newValue;
- }
-
- /*---------------------------------------------------------------------------------*/
- /*-- public mutator methods -------------------------------------------------------*/
- /*---------------------------------------------------------------------------------*/
-
- public void beforeBinding() {
- this.add(b, BorderLayout.SOUTH);
- }
-
- public void beforeCreation() {
- System.out.println("before Creation");
- }
-
- public void beforeInitialization() {
-
- }
-
- /**
- * Components creation
- */
- public void componentsCreation() {
- create$Menu2();
- createItem1();
- create$MenuItem3();
- create$Menu4();
- create$MenuBar1();
- create$JToolBar5();
- create$Button6();
- create$Button7();
- create$Button8();
- create$TabPanel9();
- createTextfield();
- createLabel();
- createLabel2();
- createBt3();
- createBt31();
- createBt32();
- createBt34();
- createLabel3();
- createTable();
- createGd2();
- }
-
- /**
- * components layout
- */
- public void componentsTree() {
- this.setTitle("Guix Swing Demo");
- this.setSize(800,600);
- this.setLayout(new BorderLayout());
- this.setJMenuBar($MenuBar1);
- $MenuBar1.add($Menu2);
- $Menu2.add(item1);
- $Menu2.add($MenuItem3);
- $MenuBar1.add($Menu4);
- this.add($JToolBar5,BorderLayout.NORTH);
- $JToolBar5.add($Button6);
- $JToolBar5.add($Button7);
- $JToolBar5.add($Button8);
- this.add($TabPanel9,BorderLayout.CENTER);
- $TabPanel9.add(table);
- table.add(textfield, new java.awt.GridBagConstraints (0,0,1,1,0.0,0.0,java.awt.GridBagConstraints.FIRST_LINE_START,java.awt.GridBagConstraints.BOTH, new java.awt.Insets(1,1,1,1),1,1));
- table.add(label, new java.awt.GridBagConstraints (1,0,1,1,0.0,0.0,java.awt.GridBagConstraints.FIRST_LINE_START,java.awt.GridBagConstraints.BOTH, new java.awt.Insets(1,1,1,1),1,1));
- table.add(label2, new java.awt.GridBagConstraints (2,0,1,3,0.0,0.0,java.awt.GridBagConstraints.FIRST_LINE_START,java.awt.GridBagConstraints.BOTH, new java.awt.Insets(1,1,1,1),1,1));
- table.add(bt3, new java.awt.GridBagConstraints (3,1,3,1,0.0,0.0,java.awt.GridBagConstraints.FIRST_LINE_START,java.awt.GridBagConstraints.BOTH, new java.awt.Insets(0,0,0,0),1,1));
- table.add(bt31, new java.awt.GridBagConstraints (0,2,2,1,0.0,0.0,java.awt.GridBagConstraints.FIRST_LINE_START,java.awt.GridBagConstraints.BOTH, new java.awt.Insets(0,0,0,0),1,1));
- table.add(bt32, new java.awt.GridBagConstraints (3,2,1,1,0.0,0.0,java.awt.GridBagConstraints.FIRST_LINE_START,java.awt.GridBagConstraints.BOTH, new java.awt.Insets(2,2,2,2),1,1));
- table.add(bt34, new java.awt.GridBagConstraints (0,3,3,1,0.0,0.0,java.awt.GridBagConstraints.FIRST_LINE_START,java.awt.GridBagConstraints.BOTH, new java.awt.Insets(1,1,1,1),1,1));
- table.add(label3, new java.awt.GridBagConstraints (0,4,2,1,0.0,0.0,java.awt.GridBagConstraints.FIRST_LINE_START,java.awt.GridBagConstraints.BOTH, new java.awt.Insets(1,1,1,1),1,1));
- $TabPanel9.add(gd2);
- }
-
- public void inTheEnd() {
-
- }
-
- /**
- * initilization of databinding
- */
- public void initDataBinding() {
- bindingGroup = new org.jdesktop.beansbinding.BindingGroup();
- bindingGroup.addBinding(
- org.jdesktop.beansbinding.Bindings.createAutoBinding(
- org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ,this,org.jdesktop.beansbinding.ELProperty.create("${gd2.button.selected}"),textfield,org.jdesktop.beansbinding.BeanProperty.create("enabled")));
- bindingGroup.bind();
- bindingGroup.addBinding(
- org.jdesktop.beansbinding.Bindings.createAutoBinding(
- org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ,this,org.jdesktop.beansbinding.ELProperty.create("${textfield.text}"),label,org.jdesktop.beansbinding.BeanProperty.create("text")));
- bindingGroup.bind();
- }
-
- /**
- * initialization
- */
- public void initialize() {
- beforeCreation();
- componentsCreation();
- b.addActionListener(new ActionListener() {
- public void actionPerformed(ActionEvent arg0) {
- if(gd2.getButton().isSelected()) {
- java.util.Random r = new java.util.Random();
- table.setBackground(new java.awt.Color(r.nextInt(255), r.nextInt(255), r.nextInt(255)));
- }
- }
- });
- beforeInitialization();
- componentsTree();
- beforeBinding();
- initDataBinding();
- inTheEnd();
- }
-
- /**
- *
- * test
- * @since 0.0.1
- *
- */
- public void test2(String test) throws NullPointerException, ArrayIndexOutOfBoundsException {
- System.out.println(test);
- }
-
- /*---------------------------------------------------------------------------------*/
- /*-- ui creation methods ----------------------------------------------------------*/
- /*---------------------------------------------------------------------------------*/
-
- /**
- * $Button6 creation
- */
- private void create$Button6() {
- $Button6 = new JButton();
- $Button6.setText("bouton1");
- $Button6.addActionListener(new java.awt.event.ActionListener() {
- public void actionPerformed(java.awt.event.ActionEvent actionEvent){
- System.out.println("Action [" + actionEvent.getActionCommand() + "] performed!");
- }
- });
- }
-
- /**
- * $Button7 creation
- */
- private void create$Button7() {
- $Button7 = new JButton();
- $Button7.setText("bouton2");
- $Button7.addActionListener(new java.awt.event.ActionListener() {
- public void actionPerformed(java.awt.event.ActionEvent actionEvent){
- System.out.println("Action [" + actionEvent.getActionCommand() + "] performed!");
- }
- });
- }
-
- /**
- * $Button8 creation
- */
- private void create$Button8() {
- $Button8 = new JButton();
- $Button8.setText("bouton3");
- $Button8.addActionListener(new java.awt.event.ActionListener() {
- public void actionPerformed(java.awt.event.ActionEvent actionEvent){
- System.out.println("Action [" + actionEvent.getActionCommand() + "] performed!");
- }
- });
- }
-
- /**
- * $JToolBar5 creation
- */
- private void create$JToolBar5() {
- $JToolBar5 = new JToolBar();
- $JToolBar5.setBorder(new javax.swing.border.EtchedBorder());
- }
-
- /**
- * $Menu2 creation
- */
- private void create$Menu2() {
- $Menu2 = new JMenu("menu 1");
- }
-
- /**
- * $Menu4 creation
- */
- private void create$Menu4() {
- $Menu4 = new JMenu("menu 2");
- }
-
- /**
- * $MenuBar1 creation
- */
- private void create$MenuBar1() {
- $MenuBar1 = new javax.swing.JMenuBar();
- $MenuBar1.setBorder(new javax.swing.border.BevelBorder(javax.swing.border.BevelBorder.RAISED));
- }
-
- /**
- * $MenuItem3 creation
- */
- private void create$MenuItem3() {
- $MenuItem3 = new JMenuItem();
- $MenuItem3.setText("item2");
- $MenuItem3.addActionListener(new java.awt.event.ActionListener() {
- public void actionPerformed(java.awt.event.ActionEvent actionEvent){
- System.out.println("Action [" + actionEvent.getActionCommand() + "] performed!");
- }
- });
- }
-
- /**
- * $TabPanel9 creation
- */
- private void create$TabPanel9() {
- $TabPanel9 = new JTabbedPane();
- $TabPanel9.setSize(800,400);
- }
-
- /**
- * bt3 creation
- */
- private void createBt3() {
- bt3 = new GuixDemo3Impl();
- bt3.setText("bt3");
- bt3.addMouseListener(new java.awt.event.MouseAdapter() {
- public void mouseClicked(java.awt.event.MouseEvent mouseEvent){
- System.out.println("beau gosse");
- }
- });
- }
-
- /**
- * bt31 creation
- */
- private void createBt31() {
- bt31 = new GuixDemo3Impl();
- bt31.setText("bt31");
- }
-
- /**
- * bt32 creation
- */
- private void createBt32() {
- bt32 = new GuixDemo3Impl();
- bt32.setText("bt32");
- }
-
- /**
- * bt34 creation
- */
- private void createBt34() {
- bt34 = new GuixDemo3Impl();
- bt34.setText("bt34");
- }
-
- /**
- * gd2 creation
- */
- private void createGd2() {
- gd2 = new GuixDemo2Impl();
- gd2.setName("GD2");
- }
-
- /**
- * item1 creation
- */
- private void createItem1() {
- item1 = new JMenuItem();
- item1.setText("item1");
- }
-
- /**
- * label creation
- */
- private void createLabel() {
- label = new JLabel();
- }
-
- /**
- * label2 creation
- */
- private void createLabel2() {
- label2 = new JLabel();
- label2.setText("color");
- label2.setBackground(java.awt.Color.BLUE);
- }
-
- /**
- * label3 creation
- */
- private void createLabel3() {
- label3 = new JLabel();
- label3.setText("color");
- label3.setForeground(java.awt.Color.YELLOW);
- }
-
- /**
- * table creation
- */
- private void createTable() {
- table = new javax.swing.JPanel(new java.awt.GridBagLayout());
- table.setName("Table");
- }
-
- /**
- * textfield creation
- */
- private void createTextfield() {
- textfield = new JTextField("test");
- textfield.addFocusListener(new java.awt.event.FocusAdapter() {
- public void focusGained(java.awt.event.FocusEvent focusEvent){
- System.out.println("dude !");
- }
- });
- }
-
-}
\ No newline at end of file
Deleted: trunk/guix-test-swing/src/main/java/org/nuiton/guix/GuixDemoImpl.java
===================================================================
--- trunk/guix-test-swing/src/main/java/org/nuiton/guix/GuixDemoImpl.java 2009-07-22 13:09:22 UTC (rev 1506)
+++ trunk/guix-test-swing/src/main/java/org/nuiton/guix/GuixDemoImpl.java 2009-07-22 13:10:33 UTC (rev 1507)
@@ -1,30 +0,0 @@
-package org.nuiton.guix;
-
-import javax.swing.JMenuBar;
-import javax.swing.JMenu;
-import javax.swing.JMenuItem;
-import javax.swing.JToolBar;
-import javax.swing.JButton;
-import javax.swing.JTabbedPane;
-import javax.swing.JPanel;
-import javax.swing.JTextField;
-import javax.swing.JLabel;
-import org.nuiton.guix.GuixDemo3Abstract;
-import org.nuiton.guix.GuixDemo2Abstract;
-
-/**
- * test javadoc Application
- */
-public class GuixDemoImpl extends GuixDemoAbstract {
- /*---------------------------------------------------------------------------------*/
- /*-- Constructors -----------------------------------------------------------------*/
- /*---------------------------------------------------------------------------------*/
-
- /**
- * Constructor
- */
- public GuixDemoImpl() {
- super();
- }
-
-}
\ No newline at end of file
Deleted: trunk/guix-test-swing/src/main/java/org/nuiton/guix/Main.java
===================================================================
--- trunk/guix-test-swing/src/main/java/org/nuiton/guix/Main.java 2009-07-22 13:09:22 UTC (rev 1506)
+++ trunk/guix-test-swing/src/main/java/org/nuiton/guix/Main.java 2009-07-22 13:10:33 UTC (rev 1507)
@@ -1,19 +0,0 @@
-package org.nuiton.guix;
-
-import java.io.File;
-import org.springframework.beans.factory.ListableBeanFactory;
-import org.springframework.beans.factory.xml.XmlBeanFactory;
-import org.springframework.core.io.FileSystemResource;
-
-public class Main {
- /*---------------------------------------------------------------------------------*/
- /*-- Statics methods --------------------------------------------------------------*/
- /*---------------------------------------------------------------------------------*/
-
- public static void main(String[] args) {
- javax.swing.SwingUtilities.invokeLater(new Runnable() {public void run() {GuixDemoImpl main = new GuixDemoImpl();
- main.pack();
- main.setVisible(true);}});
- }
-
-}
\ No newline at end of file
Added: trunk/guix-test-swing/src/main/java/org/nuiton/guix/demo/Controller.java
===================================================================
--- trunk/guix-test-swing/src/main/java/org/nuiton/guix/demo/Controller.java (rev 0)
+++ trunk/guix-test-swing/src/main/java/org/nuiton/guix/demo/Controller.java 2009-07-22 13:10:33 UTC (rev 1507)
@@ -0,0 +1,9 @@
+package org.nuiton.guix.demo;
+
+public class Controller {
+
+ public Controller() {
+ System.out.println("Dude, it's bloody raining");
+ }
+
+}
Modified: trunk/guix-test-swing/src/main/java/org/nuiton/guix/demo/GuixDemo.guix
===================================================================
--- trunk/guix-test-swing/src/main/java/org/nuiton/guix/demo/GuixDemo.guix 2009-07-22 13:09:22 UTC (rev 1506)
+++ trunk/guix-test-swing/src/main/java/org/nuiton/guix/demo/GuixDemo.guix 2009-07-22 13:10:33 UTC (rev 1507)
@@ -1,6 +1,7 @@
<?xml version='1.0' encoding='UTF-8' ?>
<!-- test javadoc Application -->
<Application title="Guix Swing Demo" size="800,600" layout="new BorderLayout()" xmlns:swing='javax.swing.*'>
+<style source="JButton.css" />
<script><![CDATA[
import java.awt.Button;
import java.awt.event.ActionListener;
@@ -40,33 +41,34 @@
}
]]></script>
+ <java.util.ArrayList id="controller" />
<MenuBar border="new javax.swing.border.BevelBorder(javax.swing.border.BevelBorder.RAISED)">
<Menu constructor='"menu 1"'>
<MenuItem id="item1" text="item1" />
- <MenuItem text="item2" onActionPerformed='{System.out.println("Action [" + actionEvent.getActionCommand()
+ <MenuItem text="item2" action='{System.out.println("Action [" + actionEvent.getActionCommand()
+ "] performed!");}' />
</Menu>
<Menu constructor='"menu 2"'>
</Menu>
</MenuBar>
- <swing:JToolBar border="new javax.swing.border.EtchedBorder()" constraint="BorderLayout.NORTH">
- <Button onActionPerformed='{System.out.println("Action [" + actionEvent.getActionCommand()
+ <swing:JToolBar>
+ <Button id="bouton1" onActionPerformed='{System.out.println("Action [" + actionEvent.getActionCommand()
+ "] performed!");}' text="bouton1" />
<Button onActionPerformed='{System.out.println("Action [" + actionEvent.getActionCommand()
+ "] performed!");}' text="bouton2" />
<Button onActionPerformed='{System.out.println("Action [" + actionEvent.getActionCommand()
+ "] performed!");}' text="bouton3" />
</swing:JToolBar>
- <TabPanel constraint="BorderLayout.CENTER" size="800,400">
+ <TabPanel id="tabPanel">
<Table id="table" insets="1,1,1,1" name="Table">
<Row>
<Cell>
<!-- javadoc textfield -->
- <TextField id="textfield" constructor='"test"' enabled="{gd2.getButton().isSelected()}" onFocusGained='{System.out.println("dude !")}'/>
+ <TextField id="textfield" constructor='"test"' enabled="{getGd2().getButton().isSelected() && getGd22().getButton().isSelected()}" onFocus='{System.out.println("dude !")}'/>
</Cell>
<Cell>
- <Label id="label" text="{textfield.getText()}" styleClass="bold" />
+ <Label id="label" text="label : {textfield.getText()}" styleClass="bold" />
</Cell>
<Cell rows='3'>
<Label id="label2" text="color" background="java.awt.Color.BLUE" />
@@ -74,7 +76,7 @@
</Row>
<Row insets="0,0,0,0">
<Cell columns="3">
- <GuixDemo3 id="bt3" text="bt3" onMouseClicked='{System.out.println("beau gosse")}'/>
+ <GuixDemo3 id="bt3" text="bt3" onClick='{System.out.println("beau gosse")}'/>
</Cell>
</Row>
<Row insets="0,0,0,0">
@@ -97,5 +99,6 @@
</Row>
</Table>
<GuixDemo2 id="gd2" name="GD2" />
+ <GuixDemo2 id="gd22" name="GD22" />
</TabPanel>
</Application>
1
0
r1506 - in trunk: . guix-runtime-swing guix-runtime-swing/src guix-runtime-swing/src/main guix-runtime-swing/src/main/java guix-runtime-swing/src/main/java/org guix-runtime-swing/src/main/java/org/nuiton guix-runtime-swing/src/main/java/org/nuiton/guix guix-runtime-swing/src/main/java/org/nuiton/guix/runtime guix-runtime-swing/src/main/java/org/nuiton/guix/runtime/swing guix-runtime-swing/src/test guix-runtime-swing/src/test/java guix-runtime-swing/src/test/java/org guix-runtime-swing/src/tes
by kmorin@users.labs.libre-entreprise.org July 22, 2009
by kmorin@users.labs.libre-entreprise.org July 22, 2009
July 22, 2009
Author: kmorin
Date: 2009-07-22 15:09:22 +0200 (Wed, 22 Jul 2009)
New Revision: 1506
Added:
trunk/guix-runtime-swing/
trunk/guix-runtime-swing/pom.xml
trunk/guix-runtime-swing/src/
trunk/guix-runtime-swing/src/main/
trunk/guix-runtime-swing/src/main/java/
trunk/guix-runtime-swing/src/main/java/org/
trunk/guix-runtime-swing/src/main/java/org/nuiton/
trunk/guix-runtime-swing/src/main/java/org/nuiton/guix/
trunk/guix-runtime-swing/src/main/java/org/nuiton/guix/runtime/
trunk/guix-runtime-swing/src/main/java/org/nuiton/guix/runtime/swing/
trunk/guix-runtime-swing/src/main/java/org/nuiton/guix/runtime/swing/DataBindingListener.java
trunk/guix-runtime-swing/src/main/java/org/nuiton/guix/runtime/swing/DataBindingUpdateListener.java
trunk/guix-runtime-swing/src/main/java/org/nuiton/guix/runtime/swing/GuixObject.java
trunk/guix-runtime-swing/src/main/java/org/nuiton/guix/runtime/swing/Util.java
trunk/guix-runtime-swing/src/main/resources/
trunk/guix-runtime-swing/src/test/
trunk/guix-runtime-swing/src/test/java/
trunk/guix-runtime-swing/src/test/java/org/
trunk/guix-runtime-swing/src/test/java/org/nuiton/
trunk/guix-runtime-swing/src/test/java/org/nuiton/guix/
trunk/guix-runtime-swing/src/test/java/org/nuiton/guix/AppTest.java
Log:
unuseful module
Property changes on: trunk/guix-runtime-swing
___________________________________________________________________
Added: svn:ignore
+ target
Added: trunk/guix-runtime-swing/pom.xml
===================================================================
--- trunk/guix-runtime-swing/pom.xml (rev 0)
+++ trunk/guix-runtime-swing/pom.xml 2009-07-22 13:09:22 UTC (rev 1506)
@@ -0,0 +1,47 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project>
+ <modelVersion>4.0.0</modelVersion>
+
+ <!-- ************************************************************* -->
+ <!-- *** POM Relationships *************************************** -->
+ <!-- ************************************************************* -->
+ <parent>
+ <groupId>org.nuiton</groupId>
+ <artifactId>guix</artifactId>
+ <version>1.0.0-SNAPSHOT</version>
+ </parent>
+
+ <groupId>org.nuiton.guix</groupId>
+ <artifactId>guix-runtime-swing</artifactId>
+
+ <dependencies>
+
+ <dependency>
+ <groupId>commons-logging</groupId>
+ <artifactId>commons-logging</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ </dependency>
+
+ </dependencies>
+
+ <!-- ************************************************************* -->
+ <!-- *** Project Information ************************************* -->
+ <!-- ************************************************************* -->
+ <name>guix-runtime-swing</name>
+ <description>Guix runtime</description>
+
+ <!-- ************************************************************* -->
+ <!-- *** Build Settings ****************************************** -->
+ <!-- ************************************************************* -->
+
+ <packaging>jar</packaging>
+
+ <!-- ************************************************************* -->
+ <!-- *** Build Environment ************************************** -->
+ <!-- ************************************************************* -->
+
+</project>
Added: trunk/guix-runtime-swing/src/main/java/org/nuiton/guix/runtime/swing/DataBindingListener.java
===================================================================
--- trunk/guix-runtime-swing/src/main/java/org/nuiton/guix/runtime/swing/DataBindingListener.java (rev 0)
+++ trunk/guix-runtime-swing/src/main/java/org/nuiton/guix/runtime/swing/DataBindingListener.java 2009-07-22 13:09:22 UTC (rev 1506)
@@ -0,0 +1,42 @@
+package org.nuiton.guix.runtime.swing;
+
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
+
+
+/**
+ * A <code>PropertyChangeListener</code> which processes a data binding when it receives a
+ * <code>PropertyChangeEvent</code>.
+ */
+public class DataBindingListener implements PropertyChangeListener {
+ private GuixObject object;
+ private String dest;
+
+ /**
+ * Creates a new <code>DataBindingListener</code> which will run the given data binding
+ * when it receives a <code>PropertyChangeEvent</code>.
+ *
+ * @param object the object in which the data binding exists
+ * @param dest the name of the data binding to run
+ */
+ public DataBindingListener(GuixObject object, String dest) {
+ this.object = object;
+ this.dest = dest;
+ }
+
+
+ /**
+ * Processes the data binding in response to a <code>PropertyChangeEvent</code>.
+ *
+ * @param e the event which triggered the binding
+ */
+ public void propertyChange(PropertyChangeEvent e) {
+ object.processDataBinding(dest);
+
+ // for now, handle dependency changes by always removing & reapplying
+ // the binding. We should be more efficient and only do this when it's
+ // actually necessary
+ object.removeDataBinding(dest);
+ object.applyDataBinding(dest);
+ }
+}
\ No newline at end of file
Added: trunk/guix-runtime-swing/src/main/java/org/nuiton/guix/runtime/swing/DataBindingUpdateListener.java
===================================================================
--- trunk/guix-runtime-swing/src/main/java/org/nuiton/guix/runtime/swing/DataBindingUpdateListener.java (rev 0)
+++ trunk/guix-runtime-swing/src/main/java/org/nuiton/guix/runtime/swing/DataBindingUpdateListener.java 2009-07-22 13:09:22 UTC (rev 1506)
@@ -0,0 +1,46 @@
+/*
+ * Copyright 2006 Ethan Nicholas. All rights reserved.
+ * Use is subject to license terms.
+ */
+package org.nuiton.guix.runtime.swing;
+
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
+
+
+/**
+ * A <code>PropertyChangeListener</code> which removes and re-applies a data binding
+ * when it receives a <code>PropertyChangeEvent</code>.
+ */
+public class DataBindingUpdateListener implements PropertyChangeListener {
+ private GuixObject object;
+ private String dest;
+
+ /**
+ * Creates a new <code>DataBindingUpdateListener</code> which will remove and re-apply a
+ * data binding when it receives a <code>PropertyChangeEvent</code>.
+ *
+ * @param object the object in which the data binding exists
+ * @param dest the name of the data binding to reapply
+ */
+ public DataBindingUpdateListener(GuixObject object, String dest) {
+ this.object = object;
+ this.dest = dest;
+ }
+
+
+ public String getBindingName() {
+ return dest;
+ }
+
+
+ /**
+ * Updates the data binding in response to a <code>PropertyChangeEvent</code>.
+ *
+ * @param e the event which triggered the binding
+ */
+ public void propertyChange(PropertyChangeEvent e) {
+ object.removeDataBinding(dest);
+ object.applyDataBinding(dest);
+ }
+}
\ No newline at end of file
Added: trunk/guix-runtime-swing/src/main/java/org/nuiton/guix/runtime/swing/GuixObject.java
===================================================================
--- trunk/guix-runtime-swing/src/main/java/org/nuiton/guix/runtime/swing/GuixObject.java (rev 0)
+++ trunk/guix-runtime-swing/src/main/java/org/nuiton/guix/runtime/swing/GuixObject.java 2009-07-22 13:09:22 UTC (rev 1506)
@@ -0,0 +1,46 @@
+package org.nuiton.guix.runtime.swing;
+
+/** The <code>GuixObject</code> interface is implemented by all classes produced by the Guix compiler. */
+public interface GuixObject {
+ /**
+ * Retrieves an object defined in an XML tag by its ID.
+ *
+ * @param id the id of the component to retrieve
+ * @return the object
+ */
+ //public Object getObjectById(String id);
+
+ /**
+ * Pretrieves the dictonary of knwon objects indexed by their ids.
+ *
+ * @return the dictonary of objects.
+ */
+ //public java.util.Map<String, Object> get$objectMap();
+
+ public void applyDataBinding(String id);
+
+
+ public void removeDataBinding(String id);
+
+ /**
+ * Processes a data binding by name. Data binding names are comprised of an object ID and a property name:
+ * for example, the data binding in the tag <code><JLabel id='label' text='{foo.getText()}'/></code> is
+ * named <code>"label.text"</code>. Processing a data binding causes it to reevaluate its expression, in this
+ * case <code>foo.getText()</code>.
+ *
+ * @param dest the name of the data binding to run
+ */
+ public void processDataBinding(String dest);
+
+
+ /**
+ * All <code>GuixObject</code> implements are capable of broadcasting <code>PropertyChangeEvent</code>, and
+ * furthermore (for technical reasons) must allow code in outside packages, specifically the Guix runtime,
+ * to trigger these events.
+ *
+ * @param name the name of the property which changed
+ * @param oldValue the old value of the property
+ * @param newValue the new value of the property
+ */
+ public void firePropertyChange(String name, Object oldValue, Object newValue);
+}
\ No newline at end of file
Added: trunk/guix-runtime-swing/src/main/java/org/nuiton/guix/runtime/swing/Util.java
===================================================================
--- trunk/guix-runtime-swing/src/main/java/org/nuiton/guix/runtime/swing/Util.java (rev 0)
+++ trunk/guix-runtime-swing/src/main/java/org/nuiton/guix/runtime/swing/Util.java 2009-07-22 13:09:22 UTC (rev 1506)
@@ -0,0 +1,117 @@
+/*
+ * To change this template, choose Tools | Templates
+ * and open the template in the editor.
+ */
+
+package org.nuiton.guix.runtime.swing;
+
+import java.awt.Event;
+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.ArrayList;
+import java.util.Arrays;
+import java.util.EventListener;
+import java.util.List;
+import java.util.Map;
+import java.util.WeakHashMap;
+
+/**
+ *
+ * @author kevin
+ */
+public class Util {
+ // Maps root objects to lists of event listeners
+ private static Map<Object, WeakReference<List<EventListenerDescriptor>>> eventListeners = new WeakHashMap<Object, WeakReference<List<EventListenerDescriptor>>>();
+
+
+
+ private static class EventListenerDescriptor {
+ Class listenerClass;
+ String listenerMethodName;
+ String methodName;
+ Object eventListener;
+ }
+
+ public static Object getEventListener(Class<? extends EventListener> listenerClass, final Object methodContainer, final String methodName) {
+ return getEventListener(listenerClass, null, methodContainer, methodName);
+ }
+
+
+ public static Object getEventListener(Class<? extends EventListener> 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 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() {
+ public Object invoke(Object proxy, Method method, Object[] args) {
+ String methodName = method.getName();
+ if ((listenerMethodName == null && listenerMethods.contains(method)) || methodName.equals(listenerMethodName)) {
+ try {
+ return targetMethod.invoke(methodContainer, args);
+ }
+ catch (IllegalAccessException e) {
+ throw new RuntimeException(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 descriptor.eventListener;
+ }
+ catch (NoSuchMethodException e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+}
Added: trunk/guix-runtime-swing/src/test/java/org/nuiton/guix/AppTest.java
===================================================================
--- trunk/guix-runtime-swing/src/test/java/org/nuiton/guix/AppTest.java (rev 0)
+++ trunk/guix-runtime-swing/src/test/java/org/nuiton/guix/AppTest.java 2009-07-22 13:09:22 UTC (rev 1506)
@@ -0,0 +1,38 @@
+package org.nuiton.guix;
+
+import junit.framework.Test;
+import junit.framework.TestCase;
+import junit.framework.TestSuite;
+
+/**
+ * Unit test for simple App.
+ */
+public class AppTest
+ extends TestCase
+{
+ /**
+ * Create the test case
+ *
+ * @param testName name of the test case
+ */
+ public AppTest( String testName )
+ {
+ super( testName );
+ }
+
+ /**
+ * @return the suite of tests being tested
+ */
+ public static Test suite()
+ {
+ return new TestSuite( AppTest.class );
+ }
+
+ /**
+ * Rigourous Test :-)
+ */
+ public void testApp()
+ {
+ assertTrue( true );
+ }
+}
1
0
r1505 - in trunk: . guix-runtime-gwt guix-runtime-gwt/src guix-runtime-gwt/src/main guix-runtime-gwt/src/main/java guix-runtime-gwt/src/main/java/org guix-runtime-gwt/src/main/java/org/nuiton guix-runtime-gwt/src/main/java/org/nuiton/guix guix-runtime-gwt/src/main/java/org/nuiton/guix/runtime guix-runtime-gwt/src/main/java/org/nuiton/guix/runtime/gwt guix-runtime-gwt/src/test guix-runtime-gwt/src/test/java guix-runtime-gwt/src/test/java/org guix-runtime-gwt/src/test/java/org/nuiton guix-runti
by kmorin@users.labs.libre-entreprise.org July 22, 2009
by kmorin@users.labs.libre-entreprise.org July 22, 2009
July 22, 2009
Author: kmorin
Date: 2009-07-22 15:09:02 +0200 (Wed, 22 Jul 2009)
New Revision: 1505
Added:
trunk/guix-runtime-gwt/
trunk/guix-runtime-gwt/pom.xml
trunk/guix-runtime-gwt/src/
trunk/guix-runtime-gwt/src/main/
trunk/guix-runtime-gwt/src/main/java/
trunk/guix-runtime-gwt/src/main/java/org/
trunk/guix-runtime-gwt/src/main/java/org/nuiton/
trunk/guix-runtime-gwt/src/main/java/org/nuiton/guix/
trunk/guix-runtime-gwt/src/main/java/org/nuiton/guix/runtime/
trunk/guix-runtime-gwt/src/main/java/org/nuiton/guix/runtime/gwt/
trunk/guix-runtime-gwt/src/main/java/org/nuiton/guix/runtime/gwt/DataBindingListener.java
trunk/guix-runtime-gwt/src/main/java/org/nuiton/guix/runtime/gwt/DataBindingUpdateListener.java
trunk/guix-runtime-gwt/src/main/java/org/nuiton/guix/runtime/gwt/GuixObject.java
trunk/guix-runtime-gwt/src/main/java/org/nuiton/guix/runtime/gwt/Runtime.gwt.xml
trunk/guix-runtime-gwt/src/main/java/org/nuiton/guix/runtime/gwt/Util.java
trunk/guix-runtime-gwt/src/main/resources/
trunk/guix-runtime-gwt/src/test/
trunk/guix-runtime-gwt/src/test/java/
trunk/guix-runtime-gwt/src/test/java/org/
trunk/guix-runtime-gwt/src/test/java/org/nuiton/
trunk/guix-runtime-gwt/src/test/java/org/nuiton/guix/
trunk/guix-runtime-gwt/src/test/java/org/nuiton/guix/AppTest.java
Log:
unuseful module
Property changes on: trunk/guix-runtime-gwt
___________________________________________________________________
Added: svn:ignore
+ target
Added: trunk/guix-runtime-gwt/pom.xml
===================================================================
--- trunk/guix-runtime-gwt/pom.xml (rev 0)
+++ trunk/guix-runtime-gwt/pom.xml 2009-07-22 13:09:02 UTC (rev 1505)
@@ -0,0 +1,47 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project>
+ <modelVersion>4.0.0</modelVersion>
+
+ <!-- ************************************************************* -->
+ <!-- *** POM Relationships *************************************** -->
+ <!-- ************************************************************* -->
+ <parent>
+ <groupId>org.nuiton</groupId>
+ <artifactId>guix</artifactId>
+ <version>1.0.0-SNAPSHOT</version>
+ </parent>
+
+ <groupId>org.nuiton.guix</groupId>
+ <artifactId>guix-runtime-gwt</artifactId>
+
+ <dependencies>
+
+ <dependency>
+ <groupId>commons-logging</groupId>
+ <artifactId>commons-logging</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ </dependency>
+
+ </dependencies>
+
+ <!-- ************************************************************* -->
+ <!-- *** Project Information ************************************* -->
+ <!-- ************************************************************* -->
+ <name>guix-runtime-gwt</name>
+ <description>Guix runtime</description>
+
+ <!-- ************************************************************* -->
+ <!-- *** Build Settings ****************************************** -->
+ <!-- ************************************************************* -->
+
+ <packaging>jar</packaging>
+
+ <!-- ************************************************************* -->
+ <!-- *** Build Environment ************************************** -->
+ <!-- ************************************************************* -->
+
+</project>
Added: trunk/guix-runtime-gwt/src/main/java/org/nuiton/guix/runtime/gwt/DataBindingListener.java
===================================================================
--- trunk/guix-runtime-gwt/src/main/java/org/nuiton/guix/runtime/gwt/DataBindingListener.java (rev 0)
+++ trunk/guix-runtime-gwt/src/main/java/org/nuiton/guix/runtime/gwt/DataBindingListener.java 2009-07-22 13:09:02 UTC (rev 1505)
@@ -0,0 +1,42 @@
+package org.nuiton.guix.runtime.gwt;
+
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
+
+
+/**
+ * A <code>PropertyChangeListener</code> which processes a data binding when it receives a
+ * <code>PropertyChangeEvent</code>.
+ */
+public class DataBindingListener implements PropertyChangeListener {
+ private GuixObject object;
+ private String dest;
+
+ /**
+ * Creates a new <code>DataBindingListener</code> which will run the given data binding
+ * when it receives a <code>PropertyChangeEvent</code>.
+ *
+ * @param object the object in which the data binding exists
+ * @param dest the name of the data binding to run
+ */
+ public DataBindingListener(GuixObject object, String dest) {
+ this.object = object;
+ this.dest = dest;
+ }
+
+
+ /**
+ * Processes the data binding in response to a <code>PropertyChangeEvent</code>.
+ *
+ * @param e the event which triggered the binding
+ */
+ public void propertyChange(PropertyChangeEvent e) {
+ object.processDataBinding(dest);
+
+ // for now, handle dependency changes by always removing & reapplying
+ // the binding. We should be more efficient and only do this when it's
+ // actually necessary
+ object.removeDataBinding(dest);
+ object.applyDataBinding(dest);
+ }
+}
\ No newline at end of file
Added: trunk/guix-runtime-gwt/src/main/java/org/nuiton/guix/runtime/gwt/DataBindingUpdateListener.java
===================================================================
--- trunk/guix-runtime-gwt/src/main/java/org/nuiton/guix/runtime/gwt/DataBindingUpdateListener.java (rev 0)
+++ trunk/guix-runtime-gwt/src/main/java/org/nuiton/guix/runtime/gwt/DataBindingUpdateListener.java 2009-07-22 13:09:02 UTC (rev 1505)
@@ -0,0 +1,46 @@
+/*
+ * Copyright 2006 Ethan Nicholas. All rights reserved.
+ * Use is subject to license terms.
+ */
+package org.nuiton.guix.runtime.gwt;
+
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
+
+
+/**
+ * A <code>PropertyChangeListener</code> which removes and re-applies a data binding
+ * when it receives a <code>PropertyChangeEvent</code>.
+ */
+public class DataBindingUpdateListener implements PropertyChangeListener {
+ private GuixObject object;
+ private String dest;
+
+ /**
+ * Creates a new <code>DataBindingUpdateListener</code> which will remove and re-apply a
+ * data binding when it receives a <code>PropertyChangeEvent</code>.
+ *
+ * @param object the object in which the data binding exists
+ * @param dest the name of the data binding to reapply
+ */
+ public DataBindingUpdateListener(GuixObject object, String dest) {
+ this.object = object;
+ this.dest = dest;
+ }
+
+
+ public String getBindingName() {
+ return dest;
+ }
+
+
+ /**
+ * Updates the data binding in response to a <code>PropertyChangeEvent</code>.
+ *
+ * @param e the event which triggered the binding
+ */
+ public void propertyChange(PropertyChangeEvent e) {
+ object.removeDataBinding(dest);
+ object.applyDataBinding(dest);
+ }
+}
\ No newline at end of file
Added: trunk/guix-runtime-gwt/src/main/java/org/nuiton/guix/runtime/gwt/GuixObject.java
===================================================================
--- trunk/guix-runtime-gwt/src/main/java/org/nuiton/guix/runtime/gwt/GuixObject.java (rev 0)
+++ trunk/guix-runtime-gwt/src/main/java/org/nuiton/guix/runtime/gwt/GuixObject.java 2009-07-22 13:09:02 UTC (rev 1505)
@@ -0,0 +1,35 @@
+package org.nuiton.guix.runtime.gwt;
+
+/** The <code>GuixObject</code> interface is implemented by all classes produced by the Guix compiler. */
+public interface GuixObject {
+ /**
+ * Retrieves an object defined in an XML tag by its ID.
+ *
+ * @param id the id of the component to retrieve
+ * @return the object
+ */
+ //public Object getObjectById(String id);
+
+ /**
+ * Pretrieves the dictonary of knwon objects indexed by their ids.
+ *
+ * @return the dictonary of objects.
+ */
+ //public java.util.Map<String, Object> get$objectMap();
+
+ public void applyDataBinding(String id);
+
+
+ public void removeDataBinding(String id);
+
+ /**
+ * Processes a data binding by name. Data binding names are comprised of an object ID and a property name:
+ * for example, the data binding in the tag <code><JLabel id='label' text='{foo.getText()}'/></code> is
+ * named <code>"label.text"</code>. Processing a data binding causes it to reevaluate its expression, in this
+ * case <code>foo.getText()</code>.
+ *
+ * @param dest the name of the data binding to run
+ */
+ public void processDataBinding(String dest);
+
+}
\ No newline at end of file
Added: trunk/guix-runtime-gwt/src/main/java/org/nuiton/guix/runtime/gwt/Runtime.gwt.xml
===================================================================
--- trunk/guix-runtime-gwt/src/main/java/org/nuiton/guix/runtime/gwt/Runtime.gwt.xml (rev 0)
+++ trunk/guix-runtime-gwt/src/main/java/org/nuiton/guix/runtime/gwt/Runtime.gwt.xml 2009-07-22 13:09:02 UTC (rev 1505)
@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<module>
+ <source path="org.nuiton.guix.runtime.gwt" />
+</module>
\ No newline at end of file
Added: trunk/guix-runtime-gwt/src/main/java/org/nuiton/guix/runtime/gwt/Util.java
===================================================================
--- trunk/guix-runtime-gwt/src/main/java/org/nuiton/guix/runtime/gwt/Util.java (rev 0)
+++ trunk/guix-runtime-gwt/src/main/java/org/nuiton/guix/runtime/gwt/Util.java 2009-07-22 13:09:02 UTC (rev 1505)
@@ -0,0 +1,117 @@
+/*
+ * To change this template, choose Tools | Templates
+ * and open the template in the editor.
+ */
+
+package org.nuiton.guix.runtime.gwt;
+
+import java.awt.Event;
+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.ArrayList;
+import java.util.Arrays;
+import java.util.EventListener;
+import java.util.List;
+import java.util.Map;
+import java.util.WeakHashMap;
+
+/**
+ *
+ * @author kevin
+ */
+public class Util {
+ // Maps root objects to lists of event listeners
+ private static Map<Object, WeakReference<List<EventListenerDescriptor>>> eventListeners = new WeakHashMap<Object, WeakReference<List<EventListenerDescriptor>>>();
+
+
+
+ private static class EventListenerDescriptor {
+ Class listenerClass;
+ String listenerMethodName;
+ String methodName;
+ Object eventListener;
+ }
+
+ public static Object getEventListener(Class<? extends EventListener> listenerClass, final Object methodContainer, final String methodName) {
+ return getEventListener(listenerClass, null, methodContainer, methodName);
+ }
+
+
+ public static Object getEventListener(Class<? extends EventListener> 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 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() {
+ public Object invoke(Object proxy, Method method, Object[] args) {
+ String methodName = method.getName();
+ if ((listenerMethodName == null && listenerMethods.contains(method)) || methodName.equals(listenerMethodName)) {
+ try {
+ return targetMethod.invoke(methodContainer, args);
+ }
+ catch (IllegalAccessException e) {
+ throw new RuntimeException(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 descriptor.eventListener;
+ }
+ catch (NoSuchMethodException e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+}
Added: trunk/guix-runtime-gwt/src/test/java/org/nuiton/guix/AppTest.java
===================================================================
--- trunk/guix-runtime-gwt/src/test/java/org/nuiton/guix/AppTest.java (rev 0)
+++ trunk/guix-runtime-gwt/src/test/java/org/nuiton/guix/AppTest.java 2009-07-22 13:09:02 UTC (rev 1505)
@@ -0,0 +1,38 @@
+package org.nuiton.guix;
+
+import junit.framework.Test;
+import junit.framework.TestCase;
+import junit.framework.TestSuite;
+
+/**
+ * Unit test for simple App.
+ */
+public class AppTest
+ extends TestCase
+{
+ /**
+ * Create the test case
+ *
+ * @param testName name of the test case
+ */
+ public AppTest( String testName )
+ {
+ super( testName );
+ }
+
+ /**
+ * @return the suite of tests being tested
+ */
+ public static Test suite()
+ {
+ return new TestSuite( AppTest.class );
+ }
+
+ /**
+ * Rigourous Test :-)
+ */
+ public void testApp()
+ {
+ assertTrue( true );
+ }
+}
1
0
r1504 - trunk/guix-compiler-swing/src/main/java/org/nuiton/guix/tags/swing
by kmorin@users.labs.libre-entreprise.org July 22, 2009
by kmorin@users.labs.libre-entreprise.org July 22, 2009
July 22, 2009
Author: kmorin
Date: 2009-07-22 15:08:35 +0200 (Wed, 22 Jul 2009)
New Revision: 1504
Added:
trunk/guix-compiler-swing/src/main/java/org/nuiton/guix/tags/swing/ApplicationHandler.java
Log:
I removed ApplicationHandler by mistake, recommit it
Added: trunk/guix-compiler-swing/src/main/java/org/nuiton/guix/tags/swing/ApplicationHandler.java
===================================================================
--- trunk/guix-compiler-swing/src/main/java/org/nuiton/guix/tags/swing/ApplicationHandler.java (rev 0)
+++ trunk/guix-compiler-swing/src/main/java/org/nuiton/guix/tags/swing/ApplicationHandler.java 2009-07-22 13:08:35 UTC (rev 1504)
@@ -0,0 +1,22 @@
+/*
+ * To change this template, choose Tools | Templates
+ * and open the template in the editor.
+ */
+
+package org.nuiton.guix.tags.swing;
+
+/**
+ *
+ * @author kevin
+ */
+public class ApplicationHandler extends ComponentHandler {
+
+ public ApplicationHandler() {
+ super();
+ }
+
+ public Class getClassToGenerate() {
+ return javax.swing.JFrame.class;
+ }
+
+}
1
0
r1503 - in trunk/guix-compiler-swing/src/main/java/org/nuiton/guix: . events generator tags/swing
by kmorin@users.labs.libre-entreprise.org July 22, 2009
by kmorin@users.labs.libre-entreprise.org July 22, 2009
July 22, 2009
Author: kmorin
Date: 2009-07-22 15:08:00 +0200 (Wed, 22 Jul 2009)
New Revision: 1503
Added:
trunk/guix-compiler-swing/src/main/java/org/nuiton/guix/tags/swing/ComponentHandler.java
trunk/guix-compiler-swing/src/main/java/org/nuiton/guix/tags/swing/FrameHandler.java
trunk/guix-compiler-swing/src/main/java/org/nuiton/guix/tags/swing/SelectableButtonHandler.java
trunk/guix-compiler-swing/src/main/java/org/nuiton/guix/tags/swing/TextComponentHandler.java
Removed:
trunk/guix-compiler-swing/src/main/java/org/nuiton/guix/tags/swing/ApplicationHandler.java
Modified:
trunk/guix-compiler-swing/src/main/java/org/nuiton/guix/SwingGuixInitializer.java
trunk/guix-compiler-swing/src/main/java/org/nuiton/guix/events/SwingEventHandler.java
trunk/guix-compiler-swing/src/main/java/org/nuiton/guix/generator/SwingAbstractClassGenerator.java
trunk/guix-compiler-swing/src/main/java/org/nuiton/guix/generator/SwingGenerator.java
trunk/guix-compiler-swing/src/main/java/org/nuiton/guix/tags/swing/ButtonHandler.java
trunk/guix-compiler-swing/src/main/java/org/nuiton/guix/tags/swing/CellHandler.java
trunk/guix-compiler-swing/src/main/java/org/nuiton/guix/tags/swing/LabelHandler.java
trunk/guix-compiler-swing/src/main/java/org/nuiton/guix/tags/swing/MenuBarHandler.java
trunk/guix-compiler-swing/src/main/java/org/nuiton/guix/tags/swing/MenuHandler.java
trunk/guix-compiler-swing/src/main/java/org/nuiton/guix/tags/swing/MenuItemHandler.java
trunk/guix-compiler-swing/src/main/java/org/nuiton/guix/tags/swing/PanelHandler.java
trunk/guix-compiler-swing/src/main/java/org/nuiton/guix/tags/swing/RowHandler.java
trunk/guix-compiler-swing/src/main/java/org/nuiton/guix/tags/swing/TabPanelHandler.java
trunk/guix-compiler-swing/src/main/java/org/nuiton/guix/tags/swing/TableHandler.java
trunk/guix-compiler-swing/src/main/java/org/nuiton/guix/tags/swing/TextFieldHandler.java
trunk/guix-compiler-swing/src/main/java/org/nuiton/guix/tags/swing/ToggleButtonHandler.java
Log:
Added the proxyEventInfo (to generate the binding)
Modified: trunk/guix-compiler-swing/src/main/java/org/nuiton/guix/SwingGuixInitializer.java
===================================================================
--- trunk/guix-compiler-swing/src/main/java/org/nuiton/guix/SwingGuixInitializer.java 2009-07-22 13:07:30 UTC (rev 1502)
+++ trunk/guix-compiler-swing/src/main/java/org/nuiton/guix/SwingGuixInitializer.java 2009-07-22 13:08:00 UTC (rev 1503)
@@ -22,7 +22,7 @@
//~--- non-JDK imports --------------------------------------------------------
import org.nuiton.guix.tags.swing.PanelHandler;
-import org.nuiton.guix.tags.swing.ApplicationHandler;
+import org.nuiton.guix.tags.swing.FrameHandler;
import org.nuiton.guix.tags.swing.CellHandler;
import org.nuiton.guix.tags.swing.RowHandler;
import org.nuiton.guix.tags.swing.TableHandler;
@@ -43,7 +43,8 @@
*/
public class SwingGuixInitializer {
public static void initialize() {
- TagManager.registerGuixClassHandler("Application", ApplicationHandler.class);
+ TagManager.registerGuixClassHandler("Application", FrameHandler.class);
+ TagManager.registerGuixClassHandler("Frame", FrameHandler.class);
TagManager.registerGuixClassHandler("Table", TableHandler.class);
TagManager.registerGuixClassHandler("Row", RowHandler.class);
TagManager.registerGuixClassHandler("Cell", CellHandler.class);
Modified: trunk/guix-compiler-swing/src/main/java/org/nuiton/guix/events/SwingEventHandler.java
===================================================================
--- trunk/guix-compiler-swing/src/main/java/org/nuiton/guix/events/SwingEventHandler.java 2009-07-22 13:07:30 UTC (rev 1502)
+++ trunk/guix-compiler-swing/src/main/java/org/nuiton/guix/events/SwingEventHandler.java 2009-07-22 13:08:00 UTC (rev 1503)
@@ -89,6 +89,9 @@
methods.put(method, value);
map.put(esd, methods);
}
+ else if(map.get(esd).get(method) != null) {
+ map.get(esd).put(method, map.get(esd).get(method) + value);
+ }
else {
map.get(esd).put(method, value);
}
Modified: trunk/guix-compiler-swing/src/main/java/org/nuiton/guix/generator/SwingAbstractClassGenerator.java
===================================================================
--- trunk/guix-compiler-swing/src/main/java/org/nuiton/guix/generator/SwingAbstractClassGenerator.java 2009-07-22 13:07:30 UTC (rev 1502)
+++ trunk/guix-compiler-swing/src/main/java/org/nuiton/guix/generator/SwingAbstractClassGenerator.java 2009-07-22 13:08:00 UTC (rev 1503)
@@ -19,7 +19,10 @@
package org.nuiton.guix.generator;
//~--- non-JDK imports --------------------------------------------------------
-import java.beans.IntrospectionException;import org.nuiton.guix.tags.swing.MenuBarHandler;
+import java.beans.IntrospectionException;
+import java.io.File;
+import java.util.Map;
+import org.nuiton.guix.tags.swing.MenuBarHandler;
;
import org.nuiton.guix.model.GuixModelObject;
@@ -58,6 +61,8 @@
List<StyleSheet> styleSheets = new ArrayList<StyleSheet>();
/** map of the different parts of the script associated with gmo */
Map<ScriptPart, Object> script;
+ /** Bindings to generate */
+ Map<String,Map<String, String>> bindings2Generate = new HashMap<String,Map<String, String>>();
/**
* Constructor
@@ -77,8 +82,7 @@
script = sh.decomposeScript(gmo.getClassDescriptor().getScript());
}
- @Override
- public void generate(File out) {
+ public JavaFile generates() {
super.generate();
//add imports
@@ -89,13 +93,11 @@
//add bodycode
jf.addBodyCode((String) script.get(ScriptPart.BODYCODE));
- //add bindinggroup
- jf.addField(new JavaField(Modifier.PRIVATE,
- "org.jdesktop.beansbinding.BindingGroup",
- "bindingGroup", "bindingGroup for databinding"),
- true);
- //add fields
- addFields(gmo);
+ //add implementation of firePropertyChange
+ JavaArgument[] args = new JavaArgument[]{new JavaArgument("String", "name"),
+ new JavaArgument("Object", "oldValue"),
+ new JavaArgument("Object", "newValue")};
+ jf.addMethod(new JavaMethod(Modifier.PUBLIC, "void", "firePropertyChange", args, null, "super.firePropertyChange(name, oldValue, newValue);", null));
//add constructor
jf.addMethod(new JavaMethod(Modifier.PUBLIC, null, gmo.getClassDescriptor().getName() + "Abstract",
@@ -124,7 +126,7 @@
jf.addMethod(new JavaMethod(Modifier.PUBLIC, "void", getMethodName(Method.COMPONENTS_TREE), null, null, methodBodies.get(Method.COMPONENTS_TREE), "components layout"));
//add databinding method
- StringBuffer dataBinding = new StringBuffer("bindingGroup = new org.jdesktop.beansbinding.BindingGroup();\n");
+ StringBuffer dataBinding = new StringBuffer();
dataBinding.append(methodBodies.get(Method.DATABINDING_INIT));
jf.addMethod(new JavaMethod(Modifier.PUBLIC, "void", getMethodName(Method.DATABINDING_INIT), null, null, dataBinding.toString(), "initilization of databinding"));
@@ -151,62 +153,18 @@
jf.addMethod(m);
}
}
- //set superclass and interface
- jf.setSuperClass(gmo.getClassDescriptor().getSuperClass().getPackageName() + "." + gmo.getClassDescriptor().getSuperClass().getName());
- jf.addInterface(gmo.getClassDescriptor().getName());
//saves the file
- saveFile(out);
+ //saveFile(out);
}
catch (ClassNotFoundException eee) {
if (log.isErrorEnabled()) {
log.error(eee);
}
}
+ return jf;
}
/**
- * Adds fields to the file to generate
- *
- * @param gmo the GuixModelObject to analyze
- */
- private void addFields(GuixModelObject gmo) {
- for (GuixModelObject child : gmo.getChildren()) {
- //if gmo represents a Guix tag
- if (child.getClassDescriptor().getPackageName() == null
- && TagManager.getGuixClassHandler(child.getClassDescriptor().getName()) != null) {
- Class clazz;
- try {
- TagHandler th = (TagHandler)TagManager.getGuixClassHandler(child.getClassDescriptor().getName()).newInstance();
- if(th.getClassToGenerate() != null) {
- clazz = th.getClassToGenerate();
- jf.addField(new JavaField(Modifier.PRIVATE,
- clazz.getSimpleName(),
- child.getId(), child.getJavadoc()),
- true);
- }
- }
- catch (InstantiationException eee) {
- if(log.isErrorEnabled()) {
- log.error(eee);
- }
- }
- catch (IllegalAccessException eee) {
- if(log.isErrorEnabled()) {
- log.error(eee);
- }
- }
- }
- else {
- jf.addField(new JavaField(Modifier.PRIVATE,
- (classes != null && classes.contains(child.getClassDescriptor().toString())) ? child.getClassDescriptor().getName() + "Abstract" : child.getClassDescriptor().getName(),
- child.getId(), child.getJavadoc()),
- true);
- }
- addFields(child);
- }
- }
-
- /**
* Browse the GuixModelObjects to add the creation, initialization and bindings methods to the file to gnerate
*
* @param gmo the GuixModelObject to analyze
@@ -233,11 +191,16 @@
TableHandler table = new TableHandler(gmo);
//the table is a JPanel
clazz = table.getClassToGenerate();
+
+ jf.addField(new JavaField(Modifier.PRIVATE,
+ clazz.getName(),
+ gmo.getId(), gmo.getJavadoc(), table),
+ true);
//the layout of the table is the GridBagLayout
creationMethod.append(gmo.getId()).append(" = new ")
.append(clazz.getName()).append("(new java.awt.GridBagLayout());\n");
- constraint = processAttributes(clazz, gmo, bindings, creationMethod, null, seh, null);
+ constraint = processAttributes(clazz, gmo, bindings, creationMethod, null, seh, null, table);
//add the component to its parent
componentsTree.append(gmo.getParent().getId() == null ? "this" : gmo.getParent().getId()).append(".add(").append(gmo.getId());
@@ -296,11 +259,16 @@
StringBuffer creationMethod = new StringBuffer();
MenuBarHandler menuBar = new MenuBarHandler();
clazz = menuBar.getClassToGenerate();
- //the layout of the table is the GridBagLayout
+
+ jf.addField(new JavaField(Modifier.PRIVATE,
+ clazz.getName(),
+ gmo.getId(), gmo.getJavadoc(), menuBar),
+ true);
+ //
creationMethod.append(gmo.getId()).append(" = new ")
.append(clazz.getName()).append("();\n");
- constraint = processAttributes(clazz, gmo, bindings, creationMethod, null, seh, null);
+ constraint = processAttributes(clazz, gmo, bindings, creationMethod, null, seh, null, menuBar);
//add the component to its parent
componentsTree.append(gmo.getParent().getId() == null ? "this" : gmo.getParent().getId()).append(".setJMenuBar(").append(gmo.getId()).append(");\n");
@@ -317,11 +285,11 @@
componentsCreation.append("create").append(capitalizedId).append("();\n");
}
else {
+ TagHandler th = null;
if(TagManager.getGuixClassHandler(gmo.getClassDescriptor().getName()) != null) {
try {
- clazz = ((TagHandler)TagManager.getGuixClassHandler(gmo.getClassDescriptor().getName()).newInstance()).getClassToGenerate();
- gmo.getClassDescriptor().setPackageName(clazz.getPackage().getName());
- gmo.getClassDescriptor().setName(clazz.getSimpleName());
+ th = (TagHandler)TagManager.getGuixClassHandler(gmo.getClassDescriptor().getName()).newInstance();
+ clazz = th.getClassToGenerate();
}
catch (InstantiationException eee) {
if(log.isErrorEnabled()) {
@@ -336,10 +304,8 @@
}
else if(gmo.getClassDescriptor().getSuperClass() != null && TagManager.getGuixClassHandler(gmo.getClassDescriptor().getSuperClass().getName()) != null) {
try {
- TagHandler th = (TagHandler)TagManager.getGuixClassHandler(gmo.getClassDescriptor().getSuperClass().getName()).newInstance();
+ th = (TagHandler)TagManager.getGuixClassHandler(gmo.getClassDescriptor().getSuperClass().getName()).newInstance();
clazz = th.getClassToGenerate();
- gmo.getClassDescriptor().getSuperClass().setPackageName(clazz.getPackage().getName());
- gmo.getClassDescriptor().getSuperClass().setName(clazz.getSimpleName());
}
catch (InstantiationException eee) {
if(log.isErrorEnabled()) {
@@ -352,6 +318,7 @@
}
}
}
+
ClassDescriptor cd = gmo.getClassDescriptor();
//while the class hasn't been found and the classDescriptor is not null
while (clazz == null && cd != null) {
@@ -366,19 +333,51 @@
}
//if the class hasn't been found
if (clazz == null) {
- throw new ClassNotFoundException();
+ File f = new File(gmo.getClassDescriptor().toString().replace('.', File.separatorChar));
+ if(f.exists()) {
+
+ }
+ else {
+ throw new ClassNotFoundException();
+ }
}
+ if(gmo.getClassDescriptor().getPackageName() == null
+ && th != null && th.getClassToGenerate() != null) {
+ jf.addField(new JavaField(Modifier.PRIVATE,
+ clazz.getName(),
+ gmo.getId(), gmo.getJavadoc(), th),
+ true);
+ }
+ else if(gmo.getId() == null) {
+ jf.addField(new JavaField(Modifier.PRIVATE,
+ (classes != null && classes.contains(gmo.getClassDescriptor().toString())) ? gmo.getClassDescriptor().toString() + "Abstract" : gmo.getClassDescriptor().toString(),
+ gmo.getClassDescriptor().getName().toLowerCase(), "this", gmo.getJavadoc(), th),
+ true);
+ }
+ else {
+ jf.addField(new JavaField(Modifier.PRIVATE,
+ (classes != null && classes.contains(gmo.getClassDescriptor().toString())) ? gmo.getClassDescriptor().toString() + "Abstract" : gmo.getClassDescriptor().toString(),
+ gmo.getId(), gmo.getJavadoc(), th),
+ true);
+ }
+
//if gmo does not represents the first tag
if (gmo.getParent() != null) {
//id with the first letter capitalized
String capitalizedId = (gmo.getId().length() > 0) ? Character.toUpperCase(gmo.getId().charAt(0)) + gmo.getId().substring(1) : gmo.getId();
StringBuffer creationMethod = new StringBuffer();
- creationMethod.append(gmo.getId()).append(" = new ").append(classes.contains(gmo.getClassDescriptor().toString()) ? gmo.getClassDescriptor().getName() + "Impl" : gmo.getClassDescriptor().getName()).append("(").append(gmo.getConstructor() != null ? gmo.getConstructor() : "").append(");\n");
+ creationMethod.append(gmo.getId()).append(" = new ").append(classes.contains(gmo.getClassDescriptor().toString()) ? gmo.getClassDescriptor().toString() + "Impl" : clazz.getName()).append("(").append(gmo.getConstructor() != null ? gmo.getConstructor() : "").append(");\n");
componentsCreation.append("create").append(capitalizedId).append("();\n");
- constraint = processAttributes(clazz, gmo, bindings, creationMethod, null, seh, null);
+ //FIXME
+ if (gmo.getStyleSheets() != null) {
+ styleSheets.addAll(gmo.getStyleSheets());
+ }
+
+ constraint = processAttributes(clazz, gmo, bindings, creationMethod, null, seh, null, th);
+
//if gmo is the child of a cell
if (!((gmo.getParent().getClassDescriptor().getPackageName() == null || gmo.getParent().getClassDescriptor().getPackageName().equals("org.nuiton.guix.tags.swing")) && gmo.getParent().getClassDescriptor().getName().equalsIgnoreCase("Cell"))) {
//if gmo represents a JMenuBar
@@ -388,29 +387,13 @@
}
else {
//add the component to its parent
- componentsTree.append(gmo.getParent().getId() == null ? "this" : gmo.getParent().getId()).append(".add(").append(gmo.getId());
- //with a constraint if it is not null
- if (constraint != null) {
- componentsTree.append(",").append(constraint);
- }
- componentsTree.append(");\n");
- }
- }
- //FIXME
- if (gmo.getStyleSheets() != null) {
- styleSheets.addAll(gmo.getStyleSheets());
- }
-
- for (StyleSheet ss : styleSheets) {
- for (Selector sel : ss.getSelectors()) {
- if ((sel.getJavaClassName() == null || sel.getJavaClassName().equals(gmo.getClassDescriptor().getPackageName() + "." + gmo.getClassDescriptor().getName())) && (sel.getId() == null || sel.getId().equals(gmo.getId())) //&& sel.getPseudoClass().equals("")
- && (sel.getStyleClass() == null || sel.getStyleClass().equals(gmo.getStyleClass()))) {
- for (Rule rule : sel.getRules()) {
- for (Entry<String, String> entry : rule.getProperties().entrySet()) {
- String capitalizedAttribute = (entry.getKey().length() > 0) ? Character.toUpperCase(entry.getKey().charAt(0)) + entry.getKey().substring(1) : entry.getKey();
- creationMethod.append(gmo.getId()).append(".set").append(capitalizedAttribute).append("(").append(entry.getValue()).append(");\n");
- }
+ if(java.awt.Component.class.isAssignableFrom(clazz)) {
+ componentsTree.append(gmo.getParent().getId() == null ? "this" : gmo.getParent().getId()).append(".add(").append(gmo.getId());
+ //with a constraint if it is not null
+ if (constraint != null) {
+ componentsTree.append(",").append(constraint);
}
+ componentsTree.append(");\n");
}
}
}
@@ -419,7 +402,21 @@
//if gmo represents the first tag
else {
boolean layoutDefined = false;
- constraint = processAttributes(clazz, gmo, bindings, null, componentsTree, seh, layoutDefined);
+ //set superclass and interface
+ if(th != null) {
+ jf.setSuperClass(th.getClassToGenerate().getName());
+ }
+ else {
+ jf.setSuperClass(gmo.getClassDescriptor().getSuperClass().getPackageName() + "." + gmo.getClassDescriptor().getSuperClass().getName());
+ }
+ jf.addInterface(gmo.getClassDescriptor().getName());
+
+ //FIXME
+ if (gmo.getStyleSheets() != null) {
+ styleSheets.addAll(gmo.getStyleSheets());
+ }
+
+ constraint = processAttributes(clazz, gmo, bindings, null, componentsTree, seh, layoutDefined, th);
}
//browse the children of gmo
for (GuixModelObject child : gmo.getChildren()) {
@@ -449,11 +446,15 @@
* @param layoutDefined true if a layout has been defined
* @return
*/
- private String processAttributes(Class clazz, GuixModelObject gmo, StringBuffer bindings, StringBuffer creationMethod, StringBuffer componentsTree, SwingEventHandler seh, Boolean layoutDefined) {
+ private String processAttributes(Class clazz, GuixModelObject gmo, StringBuffer bindings, StringBuffer creationMethod,
+ StringBuffer componentsTree, SwingEventHandler seh, Boolean layoutDefined, TagHandler th) {
String constraint = null;
+ processCSSAttributes(gmo, seh, clazz);
//browses the attributes
for (AttributeDescriptor attr : gmo.getAttributeDescriptors()) {
-
+ if(th != null && th.getAttrToGenerate(attr.getName()) != null) {
+ attr.setName(th.getAttrToGenerate(attr.getName()));
+ }
boolean addQuote = false;
//the attribute name with the first letter capitalized
String capitalizedAttribute = (attr.getName().length() > 0) ? Character.toUpperCase(attr.getName().charAt(0)) + attr.getName().substring(1) : attr.getName();
@@ -476,20 +477,23 @@
if (realAttribute) {
//get the code of the binding (removes braces mostly)
String binding = BindingUtils.processDataBindings(attr.getValue());
- //if the attribute binds the value of another component attribute
- if (binding != null) {
- bindings.append("bindingGroup.addBinding(\n").append("org.jdesktop.beansbinding.Bindings.createAutoBinding(\n" +
- "org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ,").append("this").append(",org.jdesktop.beansbinding.ELProperty.create(\"${").append(binding).append("}\"),").append(gmo.getId()).append(",org.jdesktop.beansbinding.BeanProperty.create(\"").append(attr.getName()).append("\")").append("));\n").append("bindingGroup.bind();\n");
+
+ java.lang.reflect.Method[] methods = clazz.getMethods();
+ int m = 0;
+ //checks if the setter for this attribute exists
+ while(m < methods.length && !methods[m].getName().equals("set" + capitalizedAttribute)) {
+ m++;
}
- else {
- java.lang.reflect.Method[] methods = clazz.getMethods();
- int m = 0;
- //checks if the setter for this attribute exists
- while(m < methods.length && !methods[m].getName().equals("set" + capitalizedAttribute))
- m++;
- //if yes
- if(m < methods.length) {
- //checks if the parameter of the setter is a String
+ //if yes
+ if(m < methods.length) {
+ //if the attribute binds the value of another component attribute
+ if (binding != null) {
+ if(!bindings2Generate.containsKey(gmo.getId())) {
+ bindings2Generate.put(gmo.getId(), new HashMap<String, String>());
+ }
+ bindings2Generate.get(gmo.getId()).put(attr.getName(), binding);
+ }
+ else { //checks if the parameter of the setter is a String
addQuote = methods[m].getParameterTypes()[0].equals(String.class);
//generates the code to set the attribute to object
if(creationMethod != null)
@@ -502,10 +506,10 @@
layoutDefined = true;
}
}
- else if(log.isErrorEnabled()) {
- log.error(attr.getName() + " cannot be set.");
- }
}
+ else if(log.isErrorEnabled()) {
+ log.error(attr.getName() + " cannot be set.");
+ }
}
}
catch (IntrospectionException ex) {
@@ -532,5 +536,103 @@
//return the constraint to put the object into its parent
return constraint;
}
+
+ private void processCSSAttributes(GuixModelObject gmo, SwingEventHandler seh, Class clazz) {
+ Map<String, String> cssIds = new HashMap<String, String>();
+ Map<String, String> cssStyleClasses = new HashMap<String, String>();
+ Map<String, String> cssJavaClasses = new HashMap<String, String>();
+ List<AttributeDescriptor> ads = new ArrayList<AttributeDescriptor>();
+ for (StyleSheet ss : styleSheets) {
+ for (Selector sel : ss.getSelectors()) {
+ if((sel.getId() == null || sel.getId().equals(gmo.getId()))
+ && (sel.getStyleClass() == null || sel.getStyleClass().equals(gmo.getStyleClass()))
+ && (sel.getJavaClassName() == null || sel.getJavaClassName().equals(gmo.getClassDescriptor().getName()))) {
+ boolean realAttribute = true;
+ if (sel.getPseudoClass() != null && sel.getPseudoClass().startsWith("on") && Character.isUpperCase(sel.getPseudoClass().charAt(2))) {
+ //the swing event does not start by "on"
+ String lowerCaseAttribute = (sel.getPseudoClass().length() > 2) ? Character.toLowerCase(sel.getPseudoClass().charAt(2)) + sel.getPseudoClass().substring(3) : sel.getPseudoClass();
+ StringBuffer eventAction = new StringBuffer();
+
+ for (Rule rule : sel.getRules()) {
+ for (Entry<String, String> entry : rule.getProperties().entrySet()) {
+ java.lang.reflect.Method[] methods = clazz.getMethods();
+ String capitalizedAttribute = (entry.getKey().length() > 0) ? Character.toUpperCase(entry.getKey().charAt(0)) + entry.getKey().substring(1) : entry.getKey();
+ int m = 0;
+ //checks if the setter for this attribute exists
+ while(m < methods.length && !methods[m].getName().equals("set" + capitalizedAttribute)) {
+ m++;
+ }
+ //if yes
+ if(m < methods.length) {
+ //checks if the parameter of the setter is a String
+ boolean addQuote = methods[m].getParameterTypes()[0].equals(String.class);
+ //generates the code to set the attribute to object
+ eventAction.append(gmo.getId()).append(".set").append(capitalizedAttribute).append("(").append(addQuote ? "\"" : "").append(entry.getValue()).append(addQuote ? "\"" : "").append(");\n");
+ }
+ else if(log.isErrorEnabled()) {
+ log.error(entry.getKey() + " cannot be set.");
+ }
+ }
+ }
+ try {
+ realAttribute = !seh.addEvent(clazz, lowerCaseAttribute, eventAction.toString());
+ }
+ catch (IntrospectionException ex) {
+ if(log.isErrorEnabled()) {
+ log.error("Error while adding event " + sel.getPseudoClass());
+ }
+ }
+ }
+ if(realAttribute) {
+ if (sel.getId() != null && sel.getId().equals(gmo.getId())) {
+ for (Rule rule : sel.getRules()) {
+ for (Entry<String, String> entry : rule.getProperties().entrySet()) {
+ cssIds.put(entry.getKey(), entry.getValue());
+ }
+ }
+ }
+ else if (sel.getStyleClass() != null && sel.getStyleClass().equals(gmo.getStyleClass())) {
+ for (Rule rule : sel.getRules()) {
+ for (Entry<String, String> entry : rule.getProperties().entrySet()) {
+ cssStyleClasses.put(entry.getKey(), entry.getValue());
+ }
+ }
+ }
+ else if (sel.getJavaClassName() != null && sel.getJavaClassName().equals(gmo.getClassDescriptor().getName())) {
+ for (Rule rule : sel.getRules()) {
+ for (Entry<String, String> entry : rule.getProperties().entrySet()) {
+ cssJavaClasses.put(entry.getKey(), entry.getValue());
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ for(Entry<String, String> entry : cssIds.entrySet()) {
+ ads.add(new AttributeDescriptor(entry.getKey(), entry.getValue()));
+ }
+ for(Entry<String, String> entry : cssStyleClasses.entrySet()) {
+ if(!cssIds.containsKey(entry.getKey())) {
+ ads.add(new AttributeDescriptor(entry.getKey(), entry.getValue()));
+ }
+ }
+ for(Entry<String, String> entry : cssJavaClasses.entrySet()) {
+ if(!cssIds.containsKey(entry.getKey()) && !cssStyleClasses.containsKey(entry.getKey())) {
+ ads.add(new AttributeDescriptor(entry.getKey(), entry.getValue()));
+ }
+ }
+ gmo.getAttributeDescriptors().addAll(ads);
+ }
+
+ @Override
+ public void generate(File out) {
+ throw new UnsupportedOperationException("Not supported yet.");
+ }
+
+ public Map<String, Map<String, String>> getBindings2Generate() {
+ return bindings2Generate;
+ }
+
}
Modified: trunk/guix-compiler-swing/src/main/java/org/nuiton/guix/generator/SwingGenerator.java
===================================================================
--- trunk/guix-compiler-swing/src/main/java/org/nuiton/guix/generator/SwingGenerator.java 2009-07-22 13:07:30 UTC (rev 1502)
+++ trunk/guix-compiler-swing/src/main/java/org/nuiton/guix/generator/SwingGenerator.java 2009-07-22 13:08:00 UTC (rev 1503)
@@ -18,10 +18,21 @@
*/
package org.nuiton.guix.generator;
+import java.beans.PropertyChangeListener;
import java.io.File;
import java.io.IOException;
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Array;
+import java.lang.reflect.Method;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import javax.swing.JComponent;
+import javax.swing.JPanel;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
+import org.nuiton.guix.tags.TagHandler;
/**
* Generates the interface, abstract class and implementation class
@@ -34,11 +45,14 @@
/** log */
protected Log log = LogFactory.getLog(SwingGenerator.class);
+ Map<SwingJavaFileGenerator, File> generators = new HashMap<SwingJavaFileGenerator, File>();
+
/**
* Generates the interface, abstract class and implementation class
* corresponding to the class described by the user.
*/
- public void generate() {
+ @Override
+ public JavaFile generate() {
String gmoClassName = gmo.getClassDescriptor().getName();
File out = new File(destDir, gmoClassName + ".java");
File outAbstract = new File(destDir, gmoClassName + "Abstract.java");
@@ -64,8 +78,11 @@
SwingImplementationGenerator simg = new SwingImplementationGenerator(gmo, classes);
sing.generate(out);
- sacg.generate(outAbstract);
+ generators.put(sing, out);
+ JavaFile jf = sacg.generates();
+ generators.put(sacg, outAbstract);
simg.generate(outImpl);
+ generators.put(simg, outImpl);
if (mainClass) {
SwingMainClassGenerator smcg = new SwingMainClassGenerator(gmo);
@@ -76,6 +93,10 @@
serializer.startTag("", "bean");
serializer.attribute("", "id", gmoClassName.replace(out.getName().charAt(0),
Character.toLowerCase(out.getName().charAt(0)))).attribute("", "class", gmoClassName + "Impl").attribute("", "singleton", "false").endTag("", "bean");
+
+ setBindingsToGenerate(sacg.getBindings2Generate());
+
+ return jf;
}
catch (IllegalArgumentException ex) {
log.error(ex);
@@ -90,5 +111,274 @@
else if (log.isWarnEnabled()) {
log.warn(gmo.getClassDescriptor().getName() + " has already been generated and is up to date.");
}
+ return null;
}
+
+ @Override
+ public void saveFiles() {
+ for(JavaFileGenerator gen : generators.keySet()) {
+ gen.saveFile(generators.get(gen));
+ }
+ }
+
+ @Override
+ public List<Class> generateBindings(StringBuffer dbCreation, StringBuffer dbDeletion, TagHandler prevTh, JavaFile jf, Class clazz,
+ String[] binding, int i, List<String> alreadyChecked, String methodToInvoke, Map<GuixGenerator,JavaFile> generatedFiles) {
+ boolean bindingExists = false;
+ String returnType = null;
+ String getter = null;
+ JavaFile nextFile = null;
+ Class nextClazz = null;
+ TagHandler th = null;
+ String model = null;
+ Class listener = null;
+ String addMethod = null;
+ String removeMethod = null;
+ List<Class> result = new ArrayList<Class>();
+
+ if(binding[i].endsWith(")")) {
+ String realMethodName = binding[i].substring(0, binding[i].indexOf("("));
+ String realAttributename = null;
+ if(prevTh != null) {
+ if(binding[i].startsWith("get")) {
+ realAttributename = prevTh.getAttrToGenerate(Character.toLowerCase(binding[i].charAt(3)) + binding[i].substring(4, binding[i].indexOf("(")));
+ if(realAttributename != null) {
+ realMethodName = "get" + Character.toUpperCase(realAttributename.charAt(0)) + realAttributename.substring(1);
+ }
+ }
+ else if(binding[i].startsWith("is")){
+ realAttributename = prevTh.getAttrToGenerate(Character.toLowerCase(binding[i].charAt(2)) + binding[i].substring(3, binding[i].indexOf("(")));
+ if(realAttributename != null) {
+ realMethodName = "is" + Character.toUpperCase(realAttributename.charAt(0)) + realAttributename.substring(1);
+ }
+ }
+ }
+ if(realAttributename == null) {
+ if(binding[i].startsWith("get")) {
+ realAttributename = Character.toLowerCase(binding[i].charAt(3)) + binding[i].substring(4, binding[i].indexOf("("));
+ }
+ else if(binding[i].startsWith("is")){
+ realAttributename = Character.toLowerCase(binding[i].charAt(2)) + binding[i].substring(3, binding[i].indexOf("("));
+ }
+ else {
+ realAttributename = binding[i].substring(0, binding[i].indexOf("("));
+ }
+ }
+ if (jf != null) {
+ bindingExists = jf.getMethod(realMethodName, null) != null;
+ if (bindingExists) {
+ returnType = jf.getMethod(realMethodName, null).getReturnType();
+ JavaField f = jf.getField(realAttributename);
+ if (f != null) {
+ th = f.getTagHandler();
+ }
+ }
+ }
+ else {
+ try {
+ clazz.getMethod(realMethodName, null);
+ returnType = clazz.getMethod(realMethodName, null).getReturnType().getName();
+ bindingExists = true;
+ }
+ catch (NoSuchMethodException eee) {
+ bindingExists = false;
+ }
+ }
+ getter = realMethodName + binding[i].substring(binding[i].indexOf("("));
+ }
+ else {
+ String realAttributename = null;
+ if(prevTh != null) {
+ realAttributename = prevTh.getAttrToGenerate(binding[i]);
+ }
+ if(realAttributename == null) {
+ realAttributename = binding[i];
+ }
+ if (jf != null) {
+ bindingExists = jf.getMethod("get" + Character.toUpperCase(realAttributename.charAt(0)) + realAttributename.substring(1), null) != null || jf.getMethod("is" + Character.toUpperCase(realAttributename.charAt(0)) + realAttributename.substring(1), null) != null;
+ if (bindingExists) {
+ returnType = jf.getMethod("get" + Character.toUpperCase(realAttributename.charAt(0)) + realAttributename.substring(1), null) != null ? jf.getMethod("get" + Character.toUpperCase(realAttributename.charAt(0)) + realAttributename.substring(1), null).getReturnType()
+ : jf.getMethod("is" + Character.toUpperCase(realAttributename.charAt(0)) + realAttributename.substring(1), null).getReturnType();
+ }
+
+ getter = jf.getMethod("get" + Character.toUpperCase(realAttributename.charAt(0)) + realAttributename.substring(1), null) != null ? "get" + Character.toUpperCase(realAttributename.charAt(0)) + realAttributename.substring(1) + "()"
+ : "is" + Character.toUpperCase(realAttributename.charAt(0)) + realAttributename.substring(1) + "()";
+
+ JavaField f = jf.getField(realAttributename);
+ if (f != null) {
+ th = f.getTagHandler();
+ }
+ }
+ else {
+ try {
+ clazz.getMethod("get" + Character.toUpperCase(realAttributename.charAt(0)) + realAttributename.substring(1), null);
+ returnType = clazz.getMethod("get" + Character.toUpperCase(realAttributename.charAt(0)) + realAttributename.substring(1), null).getReturnType().getName();
+ getter = "get" + Character.toUpperCase(realAttributename.charAt(0)) + realAttributename.substring(1) + "()";
+ bindingExists = true;
+ }
+ catch (NoSuchMethodException eee) {
+ try {
+ clazz.getMethod("is" + Character.toUpperCase(realAttributename.charAt(0)) + realAttributename.substring(1), null);
+ returnType = clazz.getMethod("is" + Character.toUpperCase(realAttributename.charAt(0)) + realAttributename.substring(1), null).getReturnType().getName();
+ getter = "is" + Character.toUpperCase(realAttributename.charAt(0)) + realAttributename.substring(1) + "()";
+ bindingExists = true;
+ }
+ catch (NoSuchMethodException eee2) {
+ bindingExists = false;
+ }
+ }
+ }
+ }
+ if(bindingExists) {
+ if(th != null) {
+ String getterWoBraces = getter.substring(0, getter.indexOf("("));
+ if(th.hasEventInfosAboutMethod(getterWoBraces)) {
+ model = th.getEventInfosModelName(getterWoBraces);
+ listener = th.getEventInfosListenerClass(getterWoBraces);
+ addMethod = th.getEventInfosAddListenerMethodName(getterWoBraces);
+ removeMethod = th.getEventInfosRemoveListenerMethodName(getterWoBraces);
+ }
+ else {
+ listener = PropertyChangeListener.class;
+ addMethod = "addPropertyChangeListener";
+ removeMethod = "removePropertyChangeListener";
+ }
+ }
+ else if(i == binding.length - 1 && prevTh != null) {
+ String getterWoBraces = getter.substring(0, getter.indexOf("("));
+ if(prevTh.hasEventInfosAboutMethod(getterWoBraces)) {
+ model = prevTh.getEventInfosModelName(getterWoBraces);
+ listener = prevTh.getEventInfosListenerClass(getterWoBraces);
+ addMethod = prevTh.getEventInfosAddListenerMethodName(getterWoBraces);
+ removeMethod = prevTh.getEventInfosRemoveListenerMethodName(getterWoBraces);
+ }
+ else {
+ listener = PropertyChangeListener.class;
+ addMethod = "addPropertyChangeListener";
+ removeMethod = "removePropertyChangeListener";
+ }
+ }
+ else {
+ listener = PropertyChangeListener.class;
+ addMethod = "addPropertyChangeListener";
+ removeMethod = "removePropertyChangeListener";
+ }
+
+ dbCreation.append("if(");
+ dbDeletion.append("if(");
+ if(alreadyChecked != null && !alreadyChecked.isEmpty()) {
+ for(int j = 0 ; j < alreadyChecked.size() ; j++) {
+ dbCreation.append(alreadyChecked.get(0));
+ dbDeletion.append(alreadyChecked.get(0));
+ for(int k = 1 ; k <= j ; k++) {
+ dbCreation.append(".").append(alreadyChecked.get(k));
+ dbDeletion.append(".").append(alreadyChecked.get(k));
+ }
+ dbCreation.append(" != null && ");
+ dbDeletion.append(" != null && ");
+ }
+
+ if(binding.length > alreadyChecked.size() + 1) {
+ for(int j = 0 ; j < alreadyChecked.size() ; j++) {
+ dbCreation.append(alreadyChecked.get(j)).append(".");
+ dbDeletion.append(alreadyChecked.get(j)).append(".");
+ }
+ dbCreation.append(getter).append(" != null");
+ dbDeletion.append(getter).append(" != null");
+ }
+ else {
+ dbCreation.delete(dbCreation.length() - 4, dbCreation.length());
+ dbDeletion.delete(dbDeletion.length() - 4, dbDeletion.length());
+ }
+ }
+ else {
+ dbCreation.append(getter).append(" != null");
+ dbDeletion.append(getter).append(" != null");
+ }
+ dbCreation.append(") {\n");
+ dbDeletion.append(") {\n");
+
+ if(alreadyChecked != null) {
+ for(int j = 0 ; j < alreadyChecked.size() ; j++) {
+ dbCreation.append(alreadyChecked.get(j)).append(".");
+ dbDeletion.append(alreadyChecked.get(j)).append(".");
+ }
+ }
+ if(model != null) {
+ dbCreation.append("get").append(Character.toUpperCase(model.charAt(0)))
+ .append(model.substring(1)).append("()");
+ dbDeletion.append("get").append(Character.toUpperCase(model.charAt(0)))
+ .append(model.substring(1)).append("()");
+ }
+ else {
+ dbCreation.append(getter);
+ dbDeletion.append(getter);
+ }
+// dbCreation.append(".").append(addMethod).append("((")
+// .append(listener.getName()).append(") org.nuiton.guix.runtime.Util.getEventListener(")
+// .append(listener.getName()).append(".class,this,\"onChangeFrom")
+// .append(methodToInvoke).append("\"));\n}\n");
+// dbDeletion.append(".").append(removeMethod).append("((")
+// .append(listener.getName()).append(") org.nuiton.guix.runtime.Util.getEventListener(")
+// .append(listener.getName()).append(".class,this,\"onChangeFrom")
+// .append(methodToInvoke).append("\"));\n}\n");
+
+ dbCreation.append(".").append(addMethod).append("(new ").append(listener.getName()).append("() {\n");
+ dbDeletion.append(".").append(removeMethod).append("(new ").append(listener.getName()).append("() {\n");
+ for(Method m : listener.getMethods()) {
+ StringBuffer sb = new StringBuffer();
+ for(Annotation a : m.getDeclaredAnnotations()) {
+ dbCreation.append(a.toString()).append("\n");
+ }
+ //add the method that handles the event
+ sb.append("public ")
+ .append(m.getReturnType().getCanonicalName())
+ .append(" ")
+ .append(m.getName())
+ .append("(");
+ for(int n = 0 ; n < m.getParameterTypes().length ; n++) {
+ sb.append(m.getParameterTypes()[n].getCanonicalName())
+ .append(" arg")
+ .append(n)
+ .append(", ");
+ }
+ sb.delete(sb.length() - 2, sb.length())
+ .append(")")
+ .append(" {\n")
+ .append("onChangeFrom").append(methodToInvoke)
+ .append("();\n}\n");
+ dbCreation.append(sb);
+ dbDeletion.append(sb);
+ }
+ dbCreation.append("});\n}\n");
+ dbDeletion.append("});\n}\n");
+
+ try {
+ nextClazz = Class.forName(returnType);
+ }
+ catch (ClassNotFoundException eee) {
+ for(JavaFile javaFile : generatedFiles.values()) {
+ if(returnType.equals(javaFile.getPackageName() + "." + javaFile.getClassName())) {
+ nextFile = javaFile;
+ break;
+ }
+ }
+ }
+ if(alreadyChecked == null){
+ alreadyChecked = new ArrayList<String>();
+ }
+ alreadyChecked.add(getter);
+ if(i + 1 < binding.length) {
+ result.addAll(generateBindings(dbCreation, dbDeletion, th, nextFile, nextClazz, binding, i+1, alreadyChecked, methodToInvoke, generatedFiles));
+ }
+ if(!result.contains(listener)) {
+ result.add(listener);
+ }
+ }
+ else if(log.isErrorEnabled()) {
+ log.error("unable to bind " + binding[i]);
+ }
+ return result;
+ }
+
}
Deleted: trunk/guix-compiler-swing/src/main/java/org/nuiton/guix/tags/swing/ApplicationHandler.java
===================================================================
--- trunk/guix-compiler-swing/src/main/java/org/nuiton/guix/tags/swing/ApplicationHandler.java 2009-07-22 13:07:30 UTC (rev 1502)
+++ trunk/guix-compiler-swing/src/main/java/org/nuiton/guix/tags/swing/ApplicationHandler.java 2009-07-22 13:08:00 UTC (rev 1503)
@@ -1,22 +0,0 @@
-/*
- * To change this template, choose Tools | Templates
- * and open the template in the editor.
- */
-
-package org.nuiton.guix.tags.swing;
-
-/**
- *
- * @author kevin
- */
-public class ApplicationHandler extends org.nuiton.guix.tags.ApplicationHandler {
-
- public ApplicationHandler() {
- super();
- }
-
- public Class getClassToGenerate() {
- return javax.swing.JFrame.class;
- }
-
-}
Modified: trunk/guix-compiler-swing/src/main/java/org/nuiton/guix/tags/swing/ButtonHandler.java
===================================================================
--- trunk/guix-compiler-swing/src/main/java/org/nuiton/guix/tags/swing/ButtonHandler.java 2009-07-22 13:07:30 UTC (rev 1502)
+++ trunk/guix-compiler-swing/src/main/java/org/nuiton/guix/tags/swing/ButtonHandler.java 2009-07-22 13:08:00 UTC (rev 1503)
@@ -9,8 +9,15 @@
*
* @author kevin
*/
-public class ButtonHandler extends org.nuiton.guix.tags.ButtonHandler {
+public class ButtonHandler extends ComponentHandler {
+ public ButtonHandler() {
+ super();
+ attrMap.put("onClick", "onActionPerformed");
+ attrMap.put("onLostFocus", "onFocusLost");
+ attrMap.put("onFocus", "onFocusGained");
+ }
+
@Override
public Class getClassToGenerate() {
return javax.swing.JButton.class;
Modified: trunk/guix-compiler-swing/src/main/java/org/nuiton/guix/tags/swing/CellHandler.java
===================================================================
--- trunk/guix-compiler-swing/src/main/java/org/nuiton/guix/tags/swing/CellHandler.java 2009-07-22 13:07:30 UTC (rev 1502)
+++ trunk/guix-compiler-swing/src/main/java/org/nuiton/guix/tags/swing/CellHandler.java 2009-07-22 13:08:00 UTC (rev 1503)
@@ -18,6 +18,7 @@
*/
package org.nuiton.guix.tags.swing;
+import org.nuiton.guix.model.AttributeDescriptor;
import org.nuiton.guix.model.GuixModelObject;
/**
@@ -25,8 +26,19 @@
*
* @author kevin
*/
-public class CellHandler extends org.nuiton.guix.tags.CellHandler {
+public class CellHandler extends TableHandler {
+ /** id of the object contained by the cell */
+ private String id = null;
+ /** number of columns of the cell */
+ private int columns = 1;
+ /** number of rows of the cell */
+ private int rows = 1;
+ /** index of the row */
+ private int row = -1;
+ /** index of the column */
+ private int column = -1;
+
/**
* Constructor
*/
@@ -40,7 +52,43 @@
* @param cell the GuixModelObject which represents the cell
*/
public CellHandler(GuixModelObject cell) {
- super(cell);
+ assert cell.getChildren().size() == 1;
+ id = cell.getChildren().get(0).getId();
+ for (AttributeDescriptor attr : cell.getAttributeDescriptors()) {
+ if (attr.getName().equals("columns")) {
+ columns = Integer.valueOf(attr.getValue());
+ }
+ else if (attr.getName().equals("column")) {
+ column = Integer.valueOf(attr.getValue());
+ }
+ else if (attr.getName().equals("rows")) {
+ rows = Integer.valueOf(attr.getValue());
+ }
+ else if (attr.getName().equals("weightx")) {
+ weightx = Double.valueOf(attr.getValue());
+ }
+ else if (attr.getName().equals("weighty")) {
+ weighty = Double.valueOf(attr.getValue());
+ }
+ else if (attr.getName().equals("ipadx")) {
+ ipadx = Integer.valueOf(attr.getValue());
+ }
+ else if (attr.getName().equals("ipady")) {
+ ipady = Integer.valueOf(attr.getValue());
+ }
+ else if (attr.getName().equals("halign")) {
+ horizontalAlignment = getHalign(attr.getValue());
+ }
+ else if (attr.getName().equals("valign")) {
+ verticalAlignment = getValign(attr.getValue());
+ }
+ else if (attr.getName().equals("fill")) {
+ fill = attr.getValue();
+ }
+ else if (attr.getName().equals("insets")) {
+ insets = attr.getValue();
+ }
+ }
}
/**
@@ -50,11 +98,81 @@
* @param row the row which contains the cell
*/
public CellHandler(GuixModelObject cell, RowHandler row) {
- super(cell,row);
+ this(cell);
+ //if the attributes that the row contains too have not been defined by the user within the cell,
+ //but have been defined in the row (or the table), set them
+ if (horizontalAlignment == null) {
+ horizontalAlignment = row.getHorizontalAlignment() == null ? TableHandler.DEFAULT_HORIZONTAL_ALIGNMENT : row.getHorizontalAlignment();
+ }
+ if (verticalAlignment == null) {
+ verticalAlignment = row.getVerticalAlignment() == null ? TableHandler.DEFAULT_VERTICAL_ALIGNMENT : row.getVerticalAlignment();
+ }
+ if (fill == null) {
+ fill = row.getFill() == null ? TableHandler.DEFAULT_FILL : row.getFill();
+ }
+ if (insets == null) {
+ insets = row.getInsets() == null ? TableHandler.DEFAULT_INSETS : row.getInsets();
+ }
+ if (ipadx == null) {
+ ipadx = row.getIpadx() == null ? TableHandler.DEFAULT_IPADX : row.getIpadx();
+ }
+ if (ipady == null) {
+ ipady = row.getIpady() == null ? TableHandler.DEFAULT_IPADY : row.getIpady();
+ }
+ if (weightx == null) {
+ weightx = row.getWeightx() == null ? TableHandler.DEFAULT_WEIGHTX : row.getWeightx();
+ }
+ if (weighty == null) {
+ weighty = row.getWeighty() == null ? TableHandler.DEFAULT_WEIGHTY : row.getWeighty();
+ }
+ if(this.row == -1) {
+ this.row = row.getRow() < 0 ? -1 : row.getRow();
+ }
}
@Override
public Class getClassToGenerate() {
return null;
}
+
+
+ public String getId() {
+ return id;
+ }
+
+ public void setId(String id) {
+ this.id = id;
+ }
+
+ public int getColumn() {
+ return column;
+ }
+
+ public void setColumn(int column) {
+ this.column = column;
+ }
+
+ public int getColumns() {
+ return columns;
+ }
+
+ public void setColumns(int columns) {
+ this.columns = columns;
+ }
+
+ public int getRow() {
+ return row;
+ }
+
+ public void setRow(int row) {
+ this.row = row;
+ }
+
+ public int getRows() {
+ return rows;
+ }
+
+ public void setRows(int rows) {
+ this.rows = rows;
+ }
}
Added: trunk/guix-compiler-swing/src/main/java/org/nuiton/guix/tags/swing/ComponentHandler.java
===================================================================
--- trunk/guix-compiler-swing/src/main/java/org/nuiton/guix/tags/swing/ComponentHandler.java (rev 0)
+++ trunk/guix-compiler-swing/src/main/java/org/nuiton/guix/tags/swing/ComponentHandler.java 2009-07-22 13:08:00 UTC (rev 1503)
@@ -0,0 +1,39 @@
+/*
+ * To change this template, choose Tools | Templates
+ * and open the template in the editor.
+ */
+
+package org.nuiton.guix.tags.swing;
+import java.awt.event.ComponentListener;
+import java.awt.event.FocusListener;
+import org.nuiton.guix.tags.DefaultTagHandler;
+
+/**
+ *
+ * @author kevin
+ */
+public abstract class ComponentHandler extends DefaultTagHandler {
+
+ public ComponentHandler() {
+ super();
+ configureProxyEventInfo();
+ attrMap.put("onLostFocus", "onFocusLost");
+ attrMap.put("onFocus", "onFocusGained");
+ }
+
+ @Override
+ protected void configureProxyEventInfo() {
+ super.configureProxyEventInfo();
+ addProxyEventInfo("hasFocus", FocusListener.class);
+ addProxyEventInfo("isVisible", ComponentListener.class);
+ addProxyEventInfo("getBounds", ComponentListener.class);
+ addProxyEventInfo("getLocation", ComponentListener.class);
+ addProxyEventInfo("getLocationOnScreen", ComponentListener.class);
+ addProxyEventInfo("getSize", ComponentListener.class);
+ addProxyEventInfo("getX", ComponentListener.class);
+ addProxyEventInfo("getY", ComponentListener.class);
+ addProxyEventInfo("getWidth", ComponentListener.class);
+ addProxyEventInfo("getHeight", ComponentListener.class);
+ }
+
+}
Added: trunk/guix-compiler-swing/src/main/java/org/nuiton/guix/tags/swing/FrameHandler.java
===================================================================
--- trunk/guix-compiler-swing/src/main/java/org/nuiton/guix/tags/swing/FrameHandler.java (rev 0)
+++ trunk/guix-compiler-swing/src/main/java/org/nuiton/guix/tags/swing/FrameHandler.java 2009-07-22 13:08:00 UTC (rev 1503)
@@ -0,0 +1,22 @@
+/*
+ * To change this template, choose Tools | Templates
+ * and open the template in the editor.
+ */
+
+package org.nuiton.guix.tags.swing;
+
+/**
+ *
+ * @author kevin
+ */
+public class FrameHandler extends ComponentHandler {
+
+ public FrameHandler() {
+ super();
+ }
+
+ public Class getClassToGenerate() {
+ return javax.swing.JFrame.class;
+ }
+
+}
Modified: trunk/guix-compiler-swing/src/main/java/org/nuiton/guix/tags/swing/LabelHandler.java
===================================================================
--- trunk/guix-compiler-swing/src/main/java/org/nuiton/guix/tags/swing/LabelHandler.java 2009-07-22 13:07:30 UTC (rev 1502)
+++ trunk/guix-compiler-swing/src/main/java/org/nuiton/guix/tags/swing/LabelHandler.java 2009-07-22 13:08:00 UTC (rev 1503)
@@ -9,7 +9,7 @@
*
* @author kevin
*/
-public class LabelHandler extends org.nuiton.guix.tags.LabelHandler {
+public class LabelHandler extends ComponentHandler {
/**
* Constructor
Modified: trunk/guix-compiler-swing/src/main/java/org/nuiton/guix/tags/swing/MenuBarHandler.java
===================================================================
--- trunk/guix-compiler-swing/src/main/java/org/nuiton/guix/tags/swing/MenuBarHandler.java 2009-07-22 13:07:30 UTC (rev 1502)
+++ trunk/guix-compiler-swing/src/main/java/org/nuiton/guix/tags/swing/MenuBarHandler.java 2009-07-22 13:08:00 UTC (rev 1503)
@@ -9,7 +9,7 @@
*
* @author kevin
*/
-public class MenuBarHandler extends org.nuiton.guix.tags.MenuBarHandler {
+public class MenuBarHandler extends ComponentHandler {
/**
* Constructor
Modified: trunk/guix-compiler-swing/src/main/java/org/nuiton/guix/tags/swing/MenuHandler.java
===================================================================
--- trunk/guix-compiler-swing/src/main/java/org/nuiton/guix/tags/swing/MenuHandler.java 2009-07-22 13:07:30 UTC (rev 1502)
+++ trunk/guix-compiler-swing/src/main/java/org/nuiton/guix/tags/swing/MenuHandler.java 2009-07-22 13:08:00 UTC (rev 1503)
@@ -4,12 +4,13 @@
*/
package org.nuiton.guix.tags.swing;
+import javax.swing.event.MenuListener;
/**
*
* @author kevin
*/
-public class MenuHandler extends org.nuiton.guix.tags.MenuHandler {
+public class MenuHandler extends ComponentHandler {
/**
* Constructor
@@ -23,4 +24,9 @@
return javax.swing.JMenu.class;
}
+ @Override
+ protected void configureProxyEventInfo() {
+ super.configureProxyEventInfo();
+ addProxyEventInfo("isSelected", MenuListener.class);
+ }
}
Modified: trunk/guix-compiler-swing/src/main/java/org/nuiton/guix/tags/swing/MenuItemHandler.java
===================================================================
--- trunk/guix-compiler-swing/src/main/java/org/nuiton/guix/tags/swing/MenuItemHandler.java 2009-07-22 13:07:30 UTC (rev 1502)
+++ trunk/guix-compiler-swing/src/main/java/org/nuiton/guix/tags/swing/MenuItemHandler.java 2009-07-22 13:08:00 UTC (rev 1503)
@@ -9,13 +9,14 @@
*
* @author kevin
*/
-public class MenuItemHandler extends org.nuiton.guix.tags.MenuItemHandler {
+public class MenuItemHandler extends ComponentHandler {
/**
* Constructor
*/
public MenuItemHandler() {
super();
+ attrMap.put("action", "onActionPerformed");
}
@Override
Modified: trunk/guix-compiler-swing/src/main/java/org/nuiton/guix/tags/swing/PanelHandler.java
===================================================================
--- trunk/guix-compiler-swing/src/main/java/org/nuiton/guix/tags/swing/PanelHandler.java 2009-07-22 13:07:30 UTC (rev 1502)
+++ trunk/guix-compiler-swing/src/main/java/org/nuiton/guix/tags/swing/PanelHandler.java 2009-07-22 13:08:00 UTC (rev 1503)
@@ -9,7 +9,7 @@
*
* @author kevin
*/
-public class PanelHandler extends org.nuiton.guix.tags.PanelHandler {
+public class PanelHandler extends ComponentHandler {
/**
* Constructor
Modified: trunk/guix-compiler-swing/src/main/java/org/nuiton/guix/tags/swing/RowHandler.java
===================================================================
--- trunk/guix-compiler-swing/src/main/java/org/nuiton/guix/tags/swing/RowHandler.java 2009-07-22 13:07:30 UTC (rev 1502)
+++ trunk/guix-compiler-swing/src/main/java/org/nuiton/guix/tags/swing/RowHandler.java 2009-07-22 13:08:00 UTC (rev 1503)
@@ -18,6 +18,7 @@
*/
package org.nuiton.guix.tags.swing;
+import org.nuiton.guix.model.AttributeDescriptor;
import org.nuiton.guix.model.GuixModelObject;
/**
@@ -25,7 +26,10 @@
*
* @author kevin
*/
-public class RowHandler extends org.nuiton.guix.tags.RowHandler {
+public class RowHandler extends TableHandler {
+
+ /** index of the row */
+ private int row = -1;
/**
* Constructor
@@ -34,25 +38,87 @@
super();
}
- /**
+ /**
* Constructor
*
* @param row the GuixModelObject which represents the row
*/
- public RowHandler(GuixModelObject row) {
- super(row);
- }
+ public RowHandler(GuixModelObject row) {
+ for (AttributeDescriptor attr : row.getAttributeDescriptors()) {
+ if (attr.getName().equals("row")) {
+ this.row = Integer.valueOf(attr.getValue());
+ }
+ else if (attr.getName().equals("weightx")) {
+ weightx = Double.valueOf(attr.getValue());
+ }
+ else if (attr.getName().equals("weighty")) {
+ weighty = Double.valueOf(attr.getValue());
+ }
+ else if (attr.getName().equals("ipadx")) {
+ ipadx = Integer.valueOf(attr.getValue());
+ }
+ else if (attr.getName().equals("ipady")) {
+ ipady = Integer.valueOf(attr.getValue());
+ }
+ else if (attr.getName().equals("halign")) {
+ horizontalAlignment = getHalign(attr.getValue());
+ }
+ else if (attr.getName().equals("valign")) {
+ verticalAlignment = getValign(attr.getValue());
+ }
+ else if (attr.getName().equals("fill")) {
+ fill = attr.getValue();
+ }
+ else if (attr.getName().equals("insets")) {
+ insets = attr.getValue();
+ }
+ }
+ }
- /**
+ /**
* Constructor
*
* @param row the GuixModelObject which represents the row
* @param table the table which contains the row
*/
- public RowHandler(GuixModelObject row, TableHandler table) {
- super(row, table);
+ public RowHandler(GuixModelObject row, TableHandler table) {
+ this(row);
+ //if the attributes that the table contains too have not been defined by the user within the row,
+ //but have been defined in the table, set them
+ if (horizontalAlignment == null) {
+ horizontalAlignment = table.getHorizontalAlignment() == null ? TableHandler.DEFAULT_HORIZONTAL_ALIGNMENT : table.getHorizontalAlignment();
+ }
+ if (verticalAlignment == null) {
+ verticalAlignment = table.getVerticalAlignment() == null ? TableHandler.DEFAULT_VERTICAL_ALIGNMENT : table.getVerticalAlignment();
+ }
+ if (fill == null) {
+ fill = table.getFill() == null ? TableHandler.DEFAULT_FILL : table.getFill();
+ }
+ if (insets == null) {
+ insets = table.getInsets() == null ? TableHandler.DEFAULT_INSETS : table.getInsets();
+ }
+ if (ipadx == null) {
+ ipadx = table.getIpadx() == null ? TableHandler.DEFAULT_IPADX : table.getIpadx();
+ }
+ if (ipady == null) {
+ ipady = table.getIpady() == null ? TableHandler.DEFAULT_IPADY : table.getIpady();
+ }
+ if (weightx == null) {
+ weightx = table.getWeightx() == null ? TableHandler.DEFAULT_WEIGHTX : table.getWeightx();
+ }
+ if (weighty == null) {
+ weighty = table.getWeighty() == null ? TableHandler.DEFAULT_WEIGHTY : table.getWeighty();
+ }
}
+ public int getRow() {
+ return row;
+ }
+
+ public void setRow(int row) {
+ this.row = row;
+ }
+
@Override
public Class getClassToGenerate() {
return null;
Added: trunk/guix-compiler-swing/src/main/java/org/nuiton/guix/tags/swing/SelectableButtonHandler.java
===================================================================
--- trunk/guix-compiler-swing/src/main/java/org/nuiton/guix/tags/swing/SelectableButtonHandler.java (rev 0)
+++ trunk/guix-compiler-swing/src/main/java/org/nuiton/guix/tags/swing/SelectableButtonHandler.java 2009-07-22 13:08:00 UTC (rev 1503)
@@ -0,0 +1,24 @@
+/*
+ * To change this template, choose Tools | Templates
+ * and open the template in the editor.
+ */
+
+package org.nuiton.guix.tags.swing;
+import javax.swing.event.ChangeListener;
+
+/**
+ *
+ * @author kevin
+ */
+public class SelectableButtonHandler extends ButtonHandler {
+
+ public SelectableButtonHandler() {
+ super();
+ }
+
+ @Override
+ public void configureProxyEventInfo() {
+ super.configureProxyEventInfo();
+ addProxyEventInfo("isSelected", ChangeListener.class, "model");
+ }
+}
Modified: trunk/guix-compiler-swing/src/main/java/org/nuiton/guix/tags/swing/TabPanelHandler.java
===================================================================
--- trunk/guix-compiler-swing/src/main/java/org/nuiton/guix/tags/swing/TabPanelHandler.java 2009-07-22 13:07:30 UTC (rev 1502)
+++ trunk/guix-compiler-swing/src/main/java/org/nuiton/guix/tags/swing/TabPanelHandler.java 2009-07-22 13:08:00 UTC (rev 1503)
@@ -4,12 +4,14 @@
*/
package org.nuiton.guix.tags.swing;
+import java.awt.event.ContainerListener;
+import javax.swing.event.ChangeListener;
/**
*
* @author kevin
*/
-public class TabPanelHandler extends org.nuiton.guix.tags.TabPanelHandler {
+public class TabPanelHandler extends ComponentHandler {
/**
* Constructor
@@ -23,4 +25,12 @@
return javax.swing.JTabbedPane.class;
}
+ @Override
+ public void configureProxyEventInfo() {
+ super.configureProxyEventInfo();
+ addProxyEventInfo("getSelectedIndex", ChangeListener.class);
+ addProxyEventInfo("getSelectedComponent", ChangeListener.class);
+ addProxyEventInfo("getTabCount", ContainerListener.class);
+ }
+
}
Modified: trunk/guix-compiler-swing/src/main/java/org/nuiton/guix/tags/swing/TableHandler.java
===================================================================
--- trunk/guix-compiler-swing/src/main/java/org/nuiton/guix/tags/swing/TableHandler.java 2009-07-22 13:07:30 UTC (rev 1502)
+++ trunk/guix-compiler-swing/src/main/java/org/nuiton/guix/tags/swing/TableHandler.java 2009-07-22 13:08:00 UTC (rev 1503)
@@ -22,6 +22,7 @@
import java.util.List;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
+import org.nuiton.guix.model.AttributeDescriptor;
import org.nuiton.guix.model.GuixModelObject;
/**
@@ -29,17 +30,41 @@
*
* @author kevin
*/
-public class TableHandler extends org.nuiton.guix.tags.TableHandler {
+public class TableHandler extends PanelHandler {
private static Log log = LogFactory.getLog(TableHandler.class);
public static String DEFAULT_ANCHOR = "java.awt.GridBagConstraints.FIRST_LINE_START";
+ protected enum VerticalAlignment {
+
+ ALIGN_TOP, ALIGN_MIDDLE, ALIGN_BOTTOM
+ }
+ protected enum HorizontalAlignment {
+
+ ALIGN_LEFT, ALIGN_CENTER, ALIGN_RIGHT, ALIGN_DEFAULT
+ }
+ public static final String DEFAULT_INSETS = "3, 3, 3, 3";
+ public static final HorizontalAlignment DEFAULT_HORIZONTAL_ALIGNMENT = HorizontalAlignment.ALIGN_DEFAULT;
+ public static final VerticalAlignment DEFAULT_VERTICAL_ALIGNMENT = VerticalAlignment.ALIGN_TOP;
+ public static final String DEFAULT_FILL = "java.awt.GridBagConstraints.BOTH";
+ public static final Integer DEFAULT_IPADX = 1;
+ public static final Integer DEFAULT_IPADY = 1;
+ public static final Double DEFAULT_WEIGHTX = 0.0;
+ public static final Double DEFAULT_WEIGHTY = 0.0;
+ protected Double weightx = null;
+ protected Double weighty = null;
+ protected Integer ipadx = null;
+ protected Integer ipady = null;
+ protected HorizontalAlignment horizontalAlignment = null;
+ protected VerticalAlignment verticalAlignment = null;
+ protected String fill = null;
+ protected String insets = null;
+
/**
* Constructor
*/
public TableHandler() {
- super();
}
/**
@@ -48,8 +73,136 @@
* @param table the GuixModelObject which represents the table
*/
public TableHandler(GuixModelObject table) {
- super(table);
+
+ for (AttributeDescriptor attr : table.getAttributeDescriptors()) {
+ if (attr.getName().equals("weightx")) {
+ weightx = Double.valueOf(attr.getValue());
+ }
+ else if (attr.getName().equals("weighty")) {
+ weighty = Double.valueOf(attr.getValue());
+ }
+ else if (attr.getName().equals("ipadx")) {
+ ipadx = Integer.valueOf(attr.getValue());
+ }
+ else if (attr.getName().equals("ipady")) {
+ ipady = Integer.valueOf(attr.getValue());
+ }
+ else if (attr.getName().equals("halign")) {
+ horizontalAlignment = getHalign(attr.getValue());
+ if (horizontalAlignment == null) {
+ if (log.isErrorEnabled()) {
+ log.error(table.getId() + "'s halign attribute has a wrong value : " + attr.getValue());
+ }
+ horizontalAlignment = HorizontalAlignment.ALIGN_DEFAULT;
+ }
+ }
+ else if (attr.getName().equals("valign")) {
+ verticalAlignment = getValign(attr.getValue());
+ if (verticalAlignment == null) {
+ if (log.isErrorEnabled()) {
+ log.error(table.getId() + "'s halign attribute has a wrong value : " + attr.getValue());
+ }
+ verticalAlignment = VerticalAlignment.ALIGN_TOP;
+ }
+ }
+ else if (attr.getName().equals("fill")) {
+ fill = attr.getValue();
+ }
+ else if (attr.getName().equals("insets")) {
+ insets = attr.getValue();
+ }
+ }
}
+
+ public HorizontalAlignment getHorizontalAlignment() {
+ return horizontalAlignment;
+ }
+
+ public void setHorizontalAlignment(HorizontalAlignment horizontalAlignment) {
+ this.horizontalAlignment = horizontalAlignment;
+ }
+
+ public VerticalAlignment getVerticalAlignment() {
+ return verticalAlignment;
+ }
+
+ public void setVerticalAlignment(VerticalAlignment verticalAlignment) {
+ this.verticalAlignment = verticalAlignment;
+ }
+
+ public String getFill() {
+ return fill;
+ }
+
+ public void setFill(String fill) {
+ this.fill = fill;
+ }
+
+ public String getInsets() {
+ return insets;
+ }
+
+ public void setInsets(String insets) {
+ this.insets = insets;
+ }
+
+ public Integer getIpadx() {
+ return ipadx;
+ }
+
+ public void setIpadx(Integer ipadx) {
+ this.ipadx = ipadx;
+ }
+
+ public Integer getIpady() {
+ return ipady;
+ }
+
+ public void setIpady(Integer ipady) {
+ this.ipady = ipady;
+ }
+
+ public Double getWeightx() {
+ return weightx;
+ }
+
+ public void setWeightx(Double weightx) {
+ this.weightx = weightx;
+ }
+
+ public Double getWeighty() {
+ return weighty;
+ }
+
+ public void setWeighty(Double weighty) {
+ this.weighty = weighty;
+ }
+
+ public HorizontalAlignment getHalign(String halign) {
+ if (halign.equalsIgnoreCase("left")) {
+ return HorizontalAlignment.ALIGN_LEFT;
+ }
+ if (halign.equalsIgnoreCase("right")) {
+ return HorizontalAlignment.ALIGN_RIGHT;
+ }
+ if (halign.equalsIgnoreCase("center")) {
+ return HorizontalAlignment.ALIGN_CENTER;
+ }
+ return null;
+ }
+
+ public VerticalAlignment getValign(String valign) {
+ if (valign.equalsIgnoreCase("top")) {
+ return VerticalAlignment.ALIGN_TOP;
+ }
+ if (valign.equalsIgnoreCase("bottom")) {
+ return VerticalAlignment.ALIGN_BOTTOM;
+ }
+ if (valign.equalsIgnoreCase("middle")) {
+ return VerticalAlignment.ALIGN_MIDDLE;
+ }
+ return null;
+ }
/**
* Creates a cell with the right column and generates the code to add it to the table
@@ -208,9 +361,4 @@
return null;
}
- @Override
- public Class getClassToGenerate() {
- return javax.swing.JPanel.class;
- }
-
}
Added: trunk/guix-compiler-swing/src/main/java/org/nuiton/guix/tags/swing/TextComponentHandler.java
===================================================================
--- trunk/guix-compiler-swing/src/main/java/org/nuiton/guix/tags/swing/TextComponentHandler.java (rev 0)
+++ trunk/guix-compiler-swing/src/main/java/org/nuiton/guix/tags/swing/TextComponentHandler.java 2009-07-22 13:08:00 UTC (rev 1503)
@@ -0,0 +1,24 @@
+/*
+ * To change this template, choose Tools | Templates
+ * and open the template in the editor.
+ */
+
+package org.nuiton.guix.tags.swing;
+import javax.swing.event.DocumentListener;
+
+/**
+ *
+ * @author kevin
+ */
+public abstract class TextComponentHandler extends ComponentHandler {
+
+ public TextComponentHandler() {
+ super();
+ }
+
+ @Override
+ public void configureProxyEventInfo() {
+ super.configureProxyEventInfo();
+ addProxyEventInfo("getText", DocumentListener.class, "document");
+ }
+}
Modified: trunk/guix-compiler-swing/src/main/java/org/nuiton/guix/tags/swing/TextFieldHandler.java
===================================================================
--- trunk/guix-compiler-swing/src/main/java/org/nuiton/guix/tags/swing/TextFieldHandler.java 2009-07-22 13:07:30 UTC (rev 1502)
+++ trunk/guix-compiler-swing/src/main/java/org/nuiton/guix/tags/swing/TextFieldHandler.java 2009-07-22 13:08:00 UTC (rev 1503)
@@ -9,7 +9,7 @@
*
* @author kevin
*/
-public class TextFieldHandler extends org.nuiton.guix.tags.TextFieldHandler {
+public class TextFieldHandler extends TextComponentHandler {
/**
* Constructor
Modified: trunk/guix-compiler-swing/src/main/java/org/nuiton/guix/tags/swing/ToggleButtonHandler.java
===================================================================
--- trunk/guix-compiler-swing/src/main/java/org/nuiton/guix/tags/swing/ToggleButtonHandler.java 2009-07-22 13:07:30 UTC (rev 1502)
+++ trunk/guix-compiler-swing/src/main/java/org/nuiton/guix/tags/swing/ToggleButtonHandler.java 2009-07-22 13:08:00 UTC (rev 1503)
@@ -4,16 +4,20 @@
*/
package org.nuiton.guix.tags.swing;
+import javax.swing.event.ChangeListener;
/**
*
* @author kevin
*/
-public class ToggleButtonHandler extends org.nuiton.guix.tags.ToggleButtonHandler {
+public class ToggleButtonHandler extends SelectableButtonHandler {
+ public ToggleButtonHandler() {
+ super();
+ }
+
@Override
public Class getClassToGenerate() {
return javax.swing.JToggleButton.class;
}
-
}
1
0
r1502 - in trunk/guix-compiler-gwt/src/main/java/org/nuiton/guix: events generator tags/gwt
by kmorin@users.labs.libre-entreprise.org July 22, 2009
by kmorin@users.labs.libre-entreprise.org July 22, 2009
July 22, 2009
Author: kmorin
Date: 2009-07-22 15:07:30 +0200 (Wed, 22 Jul 2009)
New Revision: 1502
Added:
trunk/guix-compiler-gwt/src/main/java/org/nuiton/guix/generator/GwtGenerator1.java
trunk/guix-compiler-gwt/src/main/java/org/nuiton/guix/tags/gwt/UIObjectHandler.java
Modified:
trunk/guix-compiler-gwt/src/main/java/org/nuiton/guix/events/GwtEventHandler.java
trunk/guix-compiler-gwt/src/main/java/org/nuiton/guix/generator/GwtAbstractClassGenerator.java
trunk/guix-compiler-gwt/src/main/java/org/nuiton/guix/generator/GwtGenerator.java
trunk/guix-compiler-gwt/src/main/java/org/nuiton/guix/generator/GwtInterfaceGenerator.java
trunk/guix-compiler-gwt/src/main/java/org/nuiton/guix/tags/gwt/ApplicationHandler.java
trunk/guix-compiler-gwt/src/main/java/org/nuiton/guix/tags/gwt/ButtonHandler.java
trunk/guix-compiler-gwt/src/main/java/org/nuiton/guix/tags/gwt/CellHandler.java
trunk/guix-compiler-gwt/src/main/java/org/nuiton/guix/tags/gwt/LabelHandler.java
trunk/guix-compiler-gwt/src/main/java/org/nuiton/guix/tags/gwt/MenuBarHandler.java
trunk/guix-compiler-gwt/src/main/java/org/nuiton/guix/tags/gwt/MenuHandler.java
trunk/guix-compiler-gwt/src/main/java/org/nuiton/guix/tags/gwt/MenuItemHandler.java
trunk/guix-compiler-gwt/src/main/java/org/nuiton/guix/tags/gwt/PanelHandler.java
trunk/guix-compiler-gwt/src/main/java/org/nuiton/guix/tags/gwt/RowHandler.java
trunk/guix-compiler-gwt/src/main/java/org/nuiton/guix/tags/gwt/TabPanelHandler.java
trunk/guix-compiler-gwt/src/main/java/org/nuiton/guix/tags/gwt/TableHandler.java
trunk/guix-compiler-gwt/src/main/java/org/nuiton/guix/tags/gwt/TextFieldHandler.java
trunk/guix-compiler-gwt/src/main/java/org/nuiton/guix/tags/gwt/ToggleButtonHandler.java
Log:
Added the proxyEventInfo
Modified: trunk/guix-compiler-gwt/src/main/java/org/nuiton/guix/events/GwtEventHandler.java
===================================================================
--- trunk/guix-compiler-gwt/src/main/java/org/nuiton/guix/events/GwtEventHandler.java 2009-07-22 13:06:43 UTC (rev 1501)
+++ trunk/guix-compiler-gwt/src/main/java/org/nuiton/guix/events/GwtEventHandler.java 2009-07-22 13:07:30 UTC (rev 1502)
@@ -128,12 +128,12 @@
.append(" ")
.append(m.getName())
.append("(");
- for(Class clazz : m.getParameterTypes())
- result.append(clazz.getCanonicalName())
- .append(" ")
- .append(Character.toLowerCase(clazz.getName().charAt(clazz.getName().lastIndexOf('.') + 1)))
- .append(clazz.getName().substring(clazz.getName().lastIndexOf('.') + 2))
- .append(", ");
+ for(int n = 0 ; n < m.getParameterTypes().length ; n++) {
+ result.append(m.getParameterTypes()[n].getCanonicalName())
+ .append(" arg")
+ .append(n)
+ .append(", ");
+ }
result.delete(result.length() - 2, result.length())
.append(")")
.append("{\n")
Modified: trunk/guix-compiler-gwt/src/main/java/org/nuiton/guix/generator/GwtAbstractClassGenerator.java
===================================================================
--- trunk/guix-compiler-gwt/src/main/java/org/nuiton/guix/generator/GwtAbstractClassGenerator.java 2009-07-22 13:06:43 UTC (rev 1501)
+++ trunk/guix-compiler-gwt/src/main/java/org/nuiton/guix/generator/GwtAbstractClassGenerator.java 2009-07-22 13:07:30 UTC (rev 1502)
@@ -19,10 +19,8 @@
package org.nuiton.guix.generator;
//~--- non-JDK imports --------------------------------------------------------
-import com.google.gwt.user.client.Command;
import com.google.gwt.user.client.ui.Label;
import com.google.gwt.user.client.ui.MenuBar;
-import com.google.gwt.user.client.ui.MenuItem;
import com.google.gwt.user.client.ui.TabPanel;
import java.beans.IntrospectionException;
import org.nuiton.guix.model.GuixModelObject;
@@ -46,6 +44,8 @@
import org.nuiton.guix.tags.TagManager;
import org.nuiton.guix.tags.gwt.CellHandler;
import org.nuiton.guix.tags.gwt.MenuBarHandler;
+import org.nuiton.guix.tags.gwt.MenuHandler;
+import org.nuiton.guix.tags.gwt.MenuItemHandler;
import org.nuiton.guix.tags.gwt.RowHandler;
import org.nuiton.guix.tags.gwt.TabPanelHandler;
import org.nuiton.guix.tags.gwt.TableHandler;
@@ -61,6 +61,8 @@
List<StyleSheet> styleSheets = new ArrayList<StyleSheet>();
/** map of the different parts of the script associated with gmo */
Map<ScriptPart, Object> script;
+ /** Bindings to generate */
+ Map<String,Map<String, String>> bindings2Generate = new HashMap<String,Map<String, String>>();
/**
* Constructor
@@ -80,8 +82,8 @@
script = sh.decomposeScript(gmo.getClassDescriptor().getScript());
}
- @Override
- public void generate(File out) {
+ //@Override
+ public JavaFile generates() {
super.generate();
//add imports
@@ -92,8 +94,11 @@
//add bodycode
jf.addBodyCode((String) script.get(ScriptPart.BODYCODE));
- //add fields
- addFields(gmo);
+// //add implementation of firePropertyChange
+// JavaArgument[] args = new JavaArgument[]{new JavaArgument("String", "name"),
+// new JavaArgument("Object", "oldValue"),
+// new JavaArgument("Object", "newValue")};
+// jf.addMethod(new JavaMethod(Modifier.PUBLIC, "void", "firePropertyChange", args, null, "super.firePropertyChange(name, oldValue, newValue);", null));
//add constructor
jf.addMethod(new JavaMethod(Modifier.PUBLIC, null, gmo.getClassDescriptor().getName() + "Abstract",
@@ -141,65 +146,18 @@
jf.addMethod(m);
}
}
- //set superclass and interface
- jf.setSuperClass(gmo.getClassDescriptor().getSuperClass().getPackageName() + "." + gmo.getClassDescriptor().getSuperClass().getName());
- jf.addInterface(gmo.getClassDescriptor().getName());
-
- //save the file
- saveFile(out);
+
+ return jf;
}
catch (ClassNotFoundException eee) {
if (log.isErrorEnabled()) {
log.error(eee);
}
}
+ return null;
}
/**
- * Adds fields to the file to generate
- *
- * @param gmo the GuixModelObject to analyze
- */
- private void addFields(GuixModelObject gmo) {
- for (GuixModelObject child : gmo.getChildren()) {
- //if gmo represents a Guix tag
- if (child.getClassDescriptor().getPackageName() == null
- && TagManager.getGuixClassHandler(child.getClassDescriptor().getName()) != null) {
- Class clazz;
- try {
- TagHandler th = (TagHandler)TagManager.getGuixClassHandler(child.getClassDescriptor().getName()).newInstance();
- if(th.getClassToGenerate() != null) {
- clazz = th.getClassToGenerate();
- jf.addField(new JavaField(Modifier.FINAL | Modifier.PRIVATE,
- clazz.getSimpleName(), child.getId(),
- " new " + clazz.getSimpleName() + "(" +
- ((child.getConstructor() != null) ? child.getConstructor() : "") + ")", child.getJavadoc()),
- false);
- }
- }
- catch (InstantiationException eee) {
- if(log.isErrorEnabled()) {
- log.error(eee);
- }
- }
- catch (IllegalAccessException eee) {
- if(log.isErrorEnabled()) {
- log.error(eee);
- }
- }
- }
- else {
- jf.addField(new JavaField(Modifier.FINAL | Modifier.PRIVATE,
- (classes != null && classes.contains(child.getClassDescriptor().toString())) ? child.getClassDescriptor().getName() + "Abstract" : child.getClassDescriptor().getName(),
- child.getId(), "new " + ((classes != null && classes.contains(child.getClassDescriptor().toString())) ? child.getClassDescriptor().getName() + "Impl" : child.getClassDescriptor().getName()) + "(" +
- ((child.getConstructor() != null) ? child.getConstructor() : "") + ")", child.getJavadoc()),
- false);
- }
- addFields(child);
- }
- }
-
- /**
* Browse the GuixModelObjects to add the creation, initialization and bindings methods to the file to gnerate
*
* @param gmo the GuixModelObject to analyze
@@ -214,7 +172,10 @@
String tabName = null;
Class clazz = null;
- if(gmo.getParent() != null && gmo.getParent().getClassDescriptor().toString().equals(TabPanel.class.getName())) {
+ if(gmo.getParent() != null
+ && (gmo.getParent().getClassDescriptor().toString().equals(TabPanel.class.getName())
+ || (gmo.getParent().getClassDescriptor().getPackageName() == null
+ && gmo.getParent().getClassDescriptor().getName().equals("TabPanel")))) {
int i = 0;
while(i < gmo.getAttributeDescriptors().size() && tabName == null) {
if(gmo.getAttributeDescriptors().get(i).getName().equalsIgnoreCase("name")) {
@@ -233,9 +194,15 @@
TableHandler table = new TableHandler(gmo);
//the table is a FlexPanel
clazz = table.getClassToGenerate();
+ jf.addField(new JavaField(Modifier.FINAL | Modifier.PRIVATE,
+ clazz.getSimpleName(), gmo.getId(),
+ " new " + clazz.getSimpleName() + "(" +
+ ((gmo.getConstructor() != null) ? gmo.getConstructor() : "") + ")", gmo.getJavadoc(), table),
+ false);
+
creationMethod.append(gmo.getId())
.append(".addStyleName(\"Table\");\n");
- processAttributes(clazz, gmo, creationMethod, null, geh);
+ processAttributes(clazz, gmo, creationMethod, null, geh, table);
//add the component to its parent
componentsTree.append(gmo.getParent().getId() == null ? "this" : gmo.getParent().getId()).append(".add(").append(gmo.getId());
@@ -270,7 +237,7 @@
//the cell can contain only one component
else if (cell.getChildren().size() != 1) {
if (log.isErrorEnabled()) {
- log.error("Cells must contain only one tag !");
+ log.error("Cells must contain only one tag ! : " + cell.getId() + " has " + cell.getChildren().size() + "children");
}
}
else {
@@ -295,8 +262,13 @@
StringBuffer creationMethod = new StringBuffer();
MenuBarHandler menuBar = new MenuBarHandler();
clazz = menuBar.getClassToGenerate();
+ jf.addField(new JavaField(Modifier.FINAL | Modifier.PRIVATE,
+ clazz.getSimpleName(), gmo.getId(),
+ " new " + clazz.getSimpleName() + "(" +
+ ((gmo.getConstructor() != null) ? gmo.getConstructor() : "") + ")", gmo.getJavadoc(), menuBar),
+ false);
- processAttributes(clazz, gmo, creationMethod, null, geh);
+ processAttributes(clazz, gmo, creationMethod, null, geh, menuBar);
//add the component to its parent
componentsTree.append(gmo.getParent().getId() == null ? "this" : gmo.getParent().getId()).append(".add(").append(gmo.getId());
@@ -318,11 +290,12 @@
}
//if gmo represents a "normal" tag
else {
+ TagHandler th = null;
+
if(TagManager.getGuixClassHandler(gmo.getClassDescriptor().getName()) != null) {
try {
- clazz = ((TagHandler)TagManager.getGuixClassHandler(gmo.getClassDescriptor().getName()).newInstance()).getClassToGenerate();
- gmo.getClassDescriptor().setPackageName(clazz.getPackage().getName());
- gmo.getClassDescriptor().setName(clazz.getSimpleName());
+ th = (TagHandler) TagManager.getGuixClassHandler(gmo.getClassDescriptor().getName()).newInstance();
+ clazz = th.getClassToGenerate();
}
catch (InstantiationException eee) {
if(log.isErrorEnabled()) {
@@ -337,10 +310,8 @@
}
else if(gmo.getClassDescriptor().getSuperClass() != null && TagManager.getGuixClassHandler(gmo.getClassDescriptor().getSuperClass().getName()) != null) {
try {
- TagHandler th = (TagHandler)TagManager.getGuixClassHandler(gmo.getClassDescriptor().getSuperClass().getName()).newInstance();
+ th = (TagHandler) TagManager.getGuixClassHandler(gmo.getClassDescriptor().getSuperClass().getName()).newInstance();
clazz = th.getClassToGenerate();
- gmo.getClassDescriptor().getSuperClass().setPackageName(clazz.getPackage().getName());
- gmo.getClassDescriptor().getSuperClass().setName(clazz.getSimpleName());
}
catch (InstantiationException eee) {
if(log.isErrorEnabled()) {
@@ -353,13 +324,14 @@
}
}
}
+
ClassLoader cl = Label.class.getClassLoader();
ClassDescriptor cd = gmo.getClassDescriptor();
while (clazz == null && cd != null) {
try {
clazz = cl.loadClass(cd.getPackageName() + "." + cd.getName());
}
- catch (ClassNotFoundException ex) {
+ catch (ClassNotFoundException eee) {
cd = cd.getSuperClass();
}
}
@@ -370,7 +342,7 @@
try {
clazz = cl.loadClass(cd.getPackageName() + "." + cd.getName());
}
- catch (ClassNotFoundException ex) {
+ catch (ClassNotFoundException eee) {
cd = cd.getSuperClass();
}
}
@@ -379,6 +351,28 @@
throw new ClassNotFoundException();
}
+ if (gmo.getClassDescriptor().getPackageName() == null
+ && TagManager.getGuixClassHandler(gmo.getClassDescriptor().getName()) != null) {
+ jf.addField(new JavaField(Modifier.FINAL | Modifier.PRIVATE,
+ clazz.getName(), gmo.getId(),
+ " new " + clazz.getSimpleName() + "(" +
+ ((gmo.getConstructor() != null) ? gmo.getConstructor() : "") + ")", gmo.getJavadoc(), th),
+ false);
+ }
+ else if(gmo.getId() == null) {
+ jf.addField(new JavaField(Modifier.FINAL | Modifier.PRIVATE,
+ (classes != null && classes.contains(gmo.getClassDescriptor().toString())) ? gmo.getClassDescriptor().getPackageName() + ".client." + gmo.getClassDescriptor().getName() + "Abstract" : gmo.getClassDescriptor().getPackageName() + "." + gmo.getClassDescriptor().getName(),
+ gmo.getClassDescriptor().getName().toLowerCase(), "this", gmo.getJavadoc(), th),
+ false);
+ }
+ else {
+ jf.addField(new JavaField(Modifier.FINAL | Modifier.PRIVATE,
+ (classes != null && classes.contains(gmo.getClassDescriptor().toString())) ? gmo.getClassDescriptor().getPackageName() + ".client." + gmo.getClassDescriptor().getName() + "Abstract" : gmo.getClassDescriptor().getPackageName() + "." + gmo.getClassDescriptor().getName(),
+ gmo.getId(), "new " + ((classes != null && classes.contains(gmo.getClassDescriptor().toString())) ? gmo.getClassDescriptor().getName() + "Impl" : gmo.getClassDescriptor().getName()) + "(" +
+ ((gmo.getConstructor() != null) ? gmo.getConstructor() : "") + ")", gmo.getJavadoc(), th),
+ false);
+ }
+
if (gmo.getParent() != null) {
String capitalizedId = (gmo.getId().length() > 0) ? Character.toUpperCase(gmo.getId().charAt(0)) + gmo.getId().substring(1) : gmo.getId();
StringBuffer creationMethod = new StringBuffer();
@@ -392,11 +386,19 @@
}
componentsTree.append(");\n");
}
- processAttributes(clazz, gmo, creationMethod, null, geh);
+ processAttributes(clazz, gmo, creationMethod, null, geh, th);
}
else {
- processAttributes(clazz, gmo, null, componentsTree, geh);
+ processAttributes(clazz, gmo, null, componentsTree, geh, th);
+ //set superclass and interface
+ if(th != null) {
+ jf.setSuperClass(th.getClassToGenerate().getName());
+ }
+ else {
+ jf.setSuperClass(gmo.getClassDescriptor().getSuperClass().getPackageName() + "." + gmo.getClassDescriptor().getSuperClass().getName());
+ }
+ jf.addInterface(gmo.getClassDescriptor().getName());
}
for (GuixModelObject child : gmo.getChildren()) {
Map<Method, String> methodBodies = browseModelObjects(child);
@@ -422,11 +424,13 @@
* @param geh the event handler
* @return
*/
- private void processAttributes(Class clazz, GuixModelObject gmo, StringBuffer creationMethod, StringBuffer componentsTree, GwtEventHandler geh) {
+ private void processAttributes(Class clazz, GuixModelObject gmo, StringBuffer creationMethod, StringBuffer componentsTree, GwtEventHandler geh, TagHandler th) {
//browses the attributes
for (AttributeDescriptor attr : gmo.getAttributeDescriptors()) {
-
boolean addQuote = false;
+ if(th != null && th.getAttrToGenerate(attr.getName()) != null) {
+ attr.setName(th.getAttrToGenerate(attr.getName()));
+ }
//the attribute name with the first letter capitalized
String capitalizedAttribute = (attr.getName().length() > 0) ? Character.toUpperCase(attr.getName().charAt(0)) + attr.getName().substring(1) : attr.getName();
//is the attribute a "real" attribute ? false if it represents an event or a constraint
@@ -444,8 +448,10 @@
String binding = BindingUtils.processDataBindings(attr.getValue());
//if the attribute binds the value of another component attribute
if (binding != null) {
-// bindings.append("bindingGroup.addBinding(\n").append("org.jdesktop.beansbinding.Bindings.createAutoBinding(\n" +
-// "org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ,").append("this").append(",org.jdesktop.beansbinding.ELProperty.create(\"${").append(binding).append("}\"),").append(gmo.getId()).append(",org.jdesktop.beansbinding.BeanProperty.create(\"").append(attr.getName()).append("\")").append("));\n").append("bindingGroup.bind();\n");
+ if(!bindings2Generate.containsKey(gmo.getId())) {
+ bindings2Generate.put(gmo.getId(), new HashMap<String, String>());
+ }
+ bindings2Generate.get(gmo.getId()).put(attr.getName(), binding);
}
else {
java.lang.reflect.Method[] methods = clazz.getMethods();
@@ -500,11 +506,21 @@
String text = null, cmd = null;
if(gmo.getClassDescriptor().getPackageName() == null && gmo.getClassDescriptor().getName().equals("Menu")) {
+ TagHandler th = new MenuHandler();
+ Class clazz = th.getClassToGenerate();
+ jf.addField(new JavaField(Modifier.FINAL | Modifier.PRIVATE,
+ clazz.getName(), gmo.getId(),
+ " new " + clazz.getSimpleName() + "(" +
+ ((gmo.getConstructor() != null) ? gmo.getConstructor() : "") + ")", gmo.getJavadoc(), th),
+ false);
for(AttributeDescriptor attr : gmo.getAttributeDescriptors()) {
if(attr.getName().equalsIgnoreCase("text")) {
text = attr.getValue();
}
else {
+ if(th.getAttrToGenerate(attr.getName()) != null) {
+ attr.setName(th.getAttrToGenerate(attr.getName()));
+ }
//the attribute name with the first letter capitalized
String capitalizedAttribute = (attr.getName().length() > 0) ? Character.toUpperCase(attr.getName().charAt(0)) + attr.getName().substring(1) : attr.getName();
@@ -536,14 +552,18 @@
}
}
else if(gmo.getClassDescriptor().getPackageName() == null && gmo.getClassDescriptor().getName().equals("MenuItem")) {
+ TagHandler th = new MenuItemHandler();
for(AttributeDescriptor attr : gmo.getAttributeDescriptors()) {
if(attr.getName().equalsIgnoreCase("text")) {
text = attr.getValue();
}
- if(attr.getName().equalsIgnoreCase("command")) {
+ if(attr.getName().equalsIgnoreCase("action")) {
cmd = attr.getValue();
}
else {
+ if(th.getAttrToGenerate(attr.getName()) != null) {
+ attr.setName(th.getAttrToGenerate(attr.getName()));
+ }
if (log.isErrorEnabled()) {
log.error(attr.getName() + " cannot be set.");
}
@@ -563,5 +583,14 @@
result.put(Method.DATABINDING_INIT, bindings.toString());
return result;
}
+
+ public Map<String, Map<String, String>> getBindings2Generate() {
+ return bindings2Generate;
+ }
+
+ @Override
+ public void generate(File out) {
+ throw new UnsupportedOperationException("Not supported yet.");
+ }
}
Modified: trunk/guix-compiler-gwt/src/main/java/org/nuiton/guix/generator/GwtGenerator.java
===================================================================
--- trunk/guix-compiler-gwt/src/main/java/org/nuiton/guix/generator/GwtGenerator.java 2009-07-22 13:06:43 UTC (rev 1501)
+++ trunk/guix-compiler-gwt/src/main/java/org/nuiton/guix/generator/GwtGenerator.java 2009-07-22 13:07:30 UTC (rev 1502)
@@ -18,10 +18,18 @@
*/
package org.nuiton.guix.generator;
+import com.google.gwt.user.client.ui.Label;
import java.io.File;
import java.io.IOException;
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Method;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
+import org.nuiton.guix.tags.TagHandler;
/**
* Generates the interface, abstract class and implementation class
@@ -34,13 +42,15 @@
/** log */
private Log log = LogFactory.getLog(GwtGenerator.class);
-
+ Map<GwtJavaFileGenerator, File> generators = new HashMap<GwtJavaFileGenerator, File>();
+
@Override
- public void generate() {
+ public JavaFile generate() {
String gmoClassName = gmo.getClassDescriptor().getName();
File outDir = new File(destDir, "client");
- if(!outDir.exists())
+ if (!outDir.exists()) {
outDir.mkdir();
+ }
File out = new File(outDir, gmoClassName + ".java");
File outAbstract = new File(outDir, gmoClassName + "Abstract.java");
File outImpl = new File(outDir, gmoClassName + "Impl.java");
@@ -69,21 +79,28 @@
GwtConfigGenerator gcg = new GwtConfigGenerator(gmo);
GwtHtmlGenerator ghg = new GwtHtmlGenerator(gmo, launcherName);
File outConfigMain = new File(destDir, launcherName.substring(launcherName.lastIndexOf('.') + 1) + ".gwt.xml");
- File publicDir = new File(destDir,"public");
- if(!publicDir.exists())
+ File publicDir = new File(destDir, "public");
+ if (!publicDir.exists()) {
publicDir.mkdir();
+ }
File outHtmlMain = new File(publicDir, launcherName.substring(launcherName.lastIndexOf('.') + 1) + ".html");
gcg.generate(outConfigMain);
ghg.generate(outHtmlMain);
}
ging.generate(out);
- gacg.generate(outAbstract);
+ generators.put(ging, out);
+ JavaFile jf = gacg.generates();
+ generators.put(gacg, outAbstract);
gimg.generate(outImpl);
+ generators.put(gimg, outImpl);
serializer.startTag("", "bean");
serializer.attribute("", "id", gmoClassName.replace(out.getName().charAt(0),
Character.toLowerCase(out.getName().charAt(0)))).attribute("", "class", gmoClassName + "Impl").attribute("", "singleton", "false").endTag("", "bean");
+ setBindingsToGenerate(gacg.getBindings2Generate());
+
+ return jf;
}
catch (IllegalArgumentException ex) {
log.error(ex);
@@ -98,6 +115,248 @@
else if (log.isWarnEnabled()) {
log.warn(gmo.getClassDescriptor().getName() + " has already been generated and is up to date.");
}
+ return null;
}
+ @Override
+ public void saveFiles() {
+ for (JavaFileGenerator gen : generators.keySet()) {
+ gen.saveFile(generators.get(gen));
+ }
+ }
+
+ @Override
+ public List<Class> generateBindings(StringBuffer dbCreation, StringBuffer dbDeletion, TagHandler prevTh, JavaFile jf, Class clazz,
+ String[] binding, int i, List<String> alreadyChecked, String methodToInvoke, Map<GuixGenerator, JavaFile> generatedFiles) {
+ boolean bindingExists = false;
+ String returnType = null;
+ String getter = null;
+ JavaFile nextFile = null;
+ Class nextClazz = null;
+ TagHandler th = null;
+ String model = null;
+ Class listener = null;
+ String addMethod = null;
+ String removeMethod = null;
+ List<Class> result = new ArrayList<Class>();
+
+ if (binding[i].endsWith(")")) {
+ String realMethodName = binding[i].substring(0, binding[i].indexOf("("));
+ String realAttributename = null;
+ if(prevTh != null) {
+ if(binding[i].startsWith("get")) {
+ realAttributename = prevTh.getAttrToGenerate(Character.toLowerCase(binding[i].charAt(3)) + binding[i].substring(4, binding[i].indexOf("(")));
+ if(realAttributename != null) {
+ realMethodName = "get" + Character.toUpperCase(realAttributename.charAt(0)) + realAttributename.substring(1);
+ }
+ }
+ else if(binding[i].startsWith("is")){
+ realAttributename = prevTh.getAttrToGenerate(Character.toLowerCase(binding[i].charAt(2)) + binding[i].substring(3, binding[i].indexOf("(")));
+ if(realAttributename != null) {
+ realMethodName = "is" + Character.toUpperCase(realAttributename.charAt(0)) + realAttributename.substring(1);
+ }
+ }
+ }
+ if(realAttributename == null) {
+ if(binding[i].startsWith("get")) {
+ realAttributename = Character.toLowerCase(binding[i].charAt(3)) + binding[i].substring(4, binding[i].indexOf("("));
+ }
+ else if(binding[i].startsWith("is")){
+ realAttributename = Character.toLowerCase(binding[i].charAt(2)) + binding[i].substring(3, binding[i].indexOf("("));
+ }
+ else {
+ realAttributename = binding[i].substring(0, binding[i].indexOf("("));
+ }
+ }
+ if (jf != null) {
+ bindingExists = jf.getMethod(realMethodName, null) != null;
+ if (bindingExists) {
+ returnType = jf.getMethod(realMethodName, null).getReturnType();
+ JavaField f = jf.getField(realAttributename);
+ if (f != null) {
+ th = f.getTagHandler();
+ }
+ }
+ }
+ else {
+ try {
+ clazz.getMethod(realMethodName, null);
+ returnType = clazz.getMethod(realMethodName, null).getReturnType().getName();
+ bindingExists = true;
+ }
+ catch (NoSuchMethodException eee) {
+ bindingExists = false;
+ }
+ }
+ getter = realMethodName + binding[i].substring(binding[i].indexOf("("));
+ binding[i] = getter;
+ }
+ else {
+ String realAttributename = null;
+ if(prevTh != null) {
+ realAttributename = prevTh.getAttrToGenerate(binding[i]);
+ }
+ if(realAttributename == null) {
+ realAttributename = binding[i];
+ }
+ if (jf != null) {
+ bindingExists = jf.getMethod("get" + Character.toUpperCase(realAttributename.charAt(0)) + realAttributename.substring(1), null) != null || jf.getMethod("is" + Character.toUpperCase(realAttributename.charAt(0)) + realAttributename.substring(1), null) != null;
+ if (bindingExists) {
+ returnType = jf.getMethod("get" + Character.toUpperCase(realAttributename.charAt(0)) + realAttributename.substring(1), null) != null ? jf.getMethod("get" + Character.toUpperCase(realAttributename.charAt(0)) + realAttributename.substring(1), null).getReturnType()
+ : jf.getMethod("is" + Character.toUpperCase(realAttributename.charAt(0)) + realAttributename.substring(1), null).getReturnType();
+ }
+
+ getter = jf.getMethod("get" + Character.toUpperCase(realAttributename.charAt(0)) + realAttributename.substring(1), null) != null ? "get" + Character.toUpperCase(realAttributename.charAt(0)) + realAttributename.substring(1) + "()"
+ : "is" + Character.toUpperCase(realAttributename.charAt(0)) + realAttributename.substring(1) + "()";
+
+ JavaField f = jf.getField(realAttributename);
+ if (f != null) {
+ th = f.getTagHandler();
+ }
+ }
+ else {
+ try {
+ clazz.getMethod("get" + Character.toUpperCase(realAttributename.charAt(0)) + realAttributename.substring(1), null);
+ returnType = clazz.getMethod("get" + Character.toUpperCase(realAttributename.charAt(0)) + realAttributename.substring(1), null).getReturnType().getName();
+ getter = "get" + Character.toUpperCase(realAttributename.charAt(0)) + realAttributename.substring(1) + "()";
+ bindingExists = true;
+ }
+ catch (NoSuchMethodException eee) {
+ try {
+ clazz.getMethod("is" + Character.toUpperCase(realAttributename.charAt(0)) + realAttributename.substring(1), null);
+ returnType = clazz.getMethod("is" + Character.toUpperCase(realAttributename.charAt(0)) + realAttributename.substring(1), null).getReturnType().getName();
+ getter = "is" + Character.toUpperCase(realAttributename.charAt(0)) + realAttributename.substring(1) + "()";
+ bindingExists = true;
+ }
+ catch (NoSuchMethodException eee2) {
+ bindingExists = false;
+ }
+ }
+ }
+ binding[i] = getter;
+ }
+ if (bindingExists) {
+ if (i == binding.length - 1 && prevTh != null) {
+ String getterWoBraces = getter.substring(0, getter.indexOf("("));
+ if (prevTh.hasEventInfosAboutMethod(getterWoBraces)) {
+ model = prevTh.getEventInfosModelName(getterWoBraces);
+ listener = prevTh.getEventInfosListenerClass(getterWoBraces);
+ addMethod = prevTh.getEventInfosAddListenerMethodName(getterWoBraces);
+ removeMethod = prevTh.getEventInfosRemoveListenerMethodName(getterWoBraces);
+ }
+ else {
+ log.error("Impossible binding");
+ return null;
+ }
+
+ dbCreation.append("if(");
+ dbDeletion.append("if(");
+ if (alreadyChecked != null && !alreadyChecked.isEmpty()) {
+ for (int j = 0; j < alreadyChecked.size(); j++) {
+ dbCreation.append(alreadyChecked.get(0));
+ dbDeletion.append(alreadyChecked.get(0));
+ for (int k = 1; k <= j; k++) {
+ dbCreation.append(".").append(alreadyChecked.get(k));
+ dbDeletion.append(".").append(alreadyChecked.get(k));
+ }
+ dbCreation.append(" != null && ");
+ dbDeletion.append(" != null && ");
+ }
+
+ if (binding.length > alreadyChecked.size() + 1) {
+ for (int j = 0; j < alreadyChecked.size(); j++) {
+ dbCreation.append(alreadyChecked.get(j)).append(".");
+ dbDeletion.append(alreadyChecked.get(j)).append(".");
+ }
+ dbCreation.append(getter).append(" != null");
+ dbDeletion.append(getter).append(" != null");
+ }
+ else {
+ dbCreation.delete(dbCreation.length() - 4, dbCreation.length());
+ dbDeletion.delete(dbDeletion.length() - 4, dbDeletion.length());
+ }
+ }
+ else {
+ dbCreation.append(getter).append(" != null");
+ dbDeletion.append(getter).append(" != null");
+ }
+ dbCreation.append(") {\n");
+ dbDeletion.append(") {\n");
+
+ if (alreadyChecked != null) {
+ for (int j = 0; j < alreadyChecked.size(); j++) {
+ dbCreation.append(alreadyChecked.get(j)).append(".");
+ dbDeletion.append(alreadyChecked.get(j)).append(".");
+ }
+ }
+ if (model != null) {
+ dbCreation.append("get").append(Character.toUpperCase(model.charAt(0))).append(model.substring(1)).append("()").append(".");
+ dbDeletion.append("get").append(Character.toUpperCase(model.charAt(0))).append(model.substring(1)).append("()").append(".");
+ }
+// dbCreation.append(addMethod).append("((").append(listener.getName()).append(") org.nuiton.guix.runtime.Util.getEventListener(").append(listener.getName()).append(".class,this,\"onChangeFrom").append(methodToInvoke).append("\"));\n}\n");
+// dbDeletion.append(removeMethod).append("((").append(listener.getName()).append(") org.nuiton.guix.runtime.Util.getEventListener(").append(listener.getName()).append(".class,this,\"onChangeFrom").append(methodToInvoke).append("\"));\n}\n");
+ dbCreation.append(addMethod).append("(new ").append(listener.getName()).append("() {\n");
+ dbDeletion.append(removeMethod).append("(new ").append(listener.getName()).append("() {\n");
+ for(Method m : listener.getMethods()) {
+ StringBuffer sb = new StringBuffer();
+ for(Annotation a : m.getDeclaredAnnotations()) {
+ dbCreation.append(a.toString()).append("\n");
+ }
+ //add the method that handles the event
+ sb.append("public ")
+ .append(m.getReturnType().getCanonicalName())
+ .append(" ")
+ .append(m.getName())
+ .append("(");
+ for(int n = 0 ; n < m.getParameterTypes().length ; n++) {
+ sb.append(m.getParameterTypes()[n].getCanonicalName())
+ .append(" arg")
+ .append(n)
+ .append(", ");
+ }
+ sb.delete(sb.length() - 2, sb.length())
+ .append(")")
+ .append(" {\n")
+ .append("onChangeFrom").append(methodToInvoke)
+ .append("();\n}\n");
+ dbCreation.append(sb);
+ dbDeletion.append(sb);
+ }
+ dbCreation.append("});\n}\n");
+ dbDeletion.append("});\n}\n");
+ }
+
+ try {
+ nextClazz = Label.class.getClassLoader().loadClass(returnType);
+ }
+ catch (ClassNotFoundException eee) {
+ try {
+ nextClazz = ClassLoader.getSystemClassLoader().loadClass(returnType);
+ }
+ catch (ClassNotFoundException eee2) {
+ for (JavaFile javaFile : generatedFiles.values()) {
+ if (returnType.equals(javaFile.getPackageName() + "." + javaFile.getClassName())) {
+ nextFile = javaFile;
+ break;
+ }
+ }
+ }
+ }
+ if (alreadyChecked == null) {
+ alreadyChecked = new ArrayList<String>();
+ }
+ alreadyChecked.add(getter);
+ if (i + 1 < binding.length) {
+ return generateBindings(dbCreation, dbDeletion, th, nextFile, nextClazz, binding, i + 1, alreadyChecked, methodToInvoke, generatedFiles);
+ }
+ else {
+ result.add(listener);
+ return result;
+ }
+ }
+ else if (log.isErrorEnabled()) {
+ log.error("unable to bind " + binding[i]);
+ }
+ return result;
+ }
}
Added: trunk/guix-compiler-gwt/src/main/java/org/nuiton/guix/generator/GwtGenerator1.java
===================================================================
--- trunk/guix-compiler-gwt/src/main/java/org/nuiton/guix/generator/GwtGenerator1.java (rev 0)
+++ trunk/guix-compiler-gwt/src/main/java/org/nuiton/guix/generator/GwtGenerator1.java 2009-07-22 13:07:30 UTC (rev 1502)
@@ -0,0 +1,303 @@
+/**
+ * *##% guix-compiler-gwt
+ * Copyright (C) 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 org.nuiton.guix.generator;
+
+import com.google.gwt.user.client.ui.Label;
+import java.beans.PropertyChangeListener;
+import java.io.File;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.nuiton.guix.tags.TagHandler;
+
+/**
+ * Generates the interface, abstract class and implementation class
+ * corresponding to the class described by the user,
+ * as well as the configuation file and html file if this class is the main class.
+ *
+ * @author kmorin
+ */
+public class GwtGenerator1 extends GuixGenerator {
+
+ /** log */
+ private Log log = LogFactory.getLog(GwtGenerator1.class);
+ Map<GwtJavaFileGenerator, File> generators = new HashMap<GwtJavaFileGenerator, File>();
+
+ @Override
+ public JavaFile generate() {
+ String gmoClassName = gmo.getClassDescriptor().getName();
+ File outDir = new File(destDir, "client");
+ if (!outDir.exists()) {
+ outDir.mkdir();
+ }
+ File out = new File(outDir, gmoClassName + ".java");
+ File outAbstract = new File(outDir, gmoClassName + "Abstract.java");
+ File outImpl = new File(outDir, gmoClassName + "Impl.java");
+
+ if (lastModification > out.lastModified()) {
+ try {
+ if (log.isInfoEnabled()) {
+ log.info("Generation of " + gmo.getClassDescriptor().getName());
+ }
+ if (!out.exists()) {
+ try {
+ out.createNewFile();
+ outAbstract.createNewFile();
+ outImpl.createNewFile();
+ }
+ catch (IOException ex) {
+ log.error(ex);
+ }
+ }
+ GwtInterfaceGenerator ging = new GwtInterfaceGenerator(gmo, classes);
+ GwtAbstractClassGenerator gacg = new GwtAbstractClassGenerator(gmo, classes);
+ GwtImplementationGenerator gimg = new GwtImplementationGenerator(gmo, classes);
+
+ if (mainClass) {
+ gimg.addMainMethod();
+ GwtConfigGenerator gcg = new GwtConfigGenerator(gmo);
+ GwtHtmlGenerator ghg = new GwtHtmlGenerator(gmo, launcherName);
+ File outConfigMain = new File(destDir, launcherName.substring(launcherName.lastIndexOf('.') + 1) + ".gwt.xml");
+ File publicDir = new File(destDir, "public");
+ if (!publicDir.exists()) {
+ publicDir.mkdir();
+ }
+ File outHtmlMain = new File(publicDir, launcherName.substring(launcherName.lastIndexOf('.') + 1) + ".html");
+ gcg.generate(outConfigMain);
+ ghg.generate(outHtmlMain);
+ }
+
+ ging.generate(out);
+ generators.put(ging, out);
+ JavaFile jf = gacg.generates();
+ generators.put(gacg, outAbstract);
+ gimg.generate(outImpl);
+ generators.put(gimg, outImpl);
+
+ serializer.startTag("", "bean");
+ serializer.attribute("", "id", gmoClassName.replace(out.getName().charAt(0),
+ Character.toLowerCase(out.getName().charAt(0)))).attribute("", "class", gmoClassName + "Impl").attribute("", "singleton", "false").endTag("", "bean");
+ setBindingsToGenerate(gacg.getBindings2Generate());
+
+ return jf;
+ }
+ catch (IllegalArgumentException ex) {
+ log.error(ex);
+ }
+ catch (IllegalStateException ex) {
+ log.error(ex);
+ }
+ catch (IOException ex) {
+ log.error(ex);
+ }
+ }
+ else if (log.isWarnEnabled()) {
+ log.warn(gmo.getClassDescriptor().getName() + " has already been generated and is up to date.");
+ }
+ return null;
+ }
+
+ @Override
+ public void saveFiles() {
+ for (JavaFileGenerator gen : generators.keySet()) {
+ gen.saveFile(generators.get(gen));
+ }
+ }
+
+ @Override
+ public List<Class> generateBindings(StringBuffer dbCreation, StringBuffer dbDeletion, TagHandler prevTh,
+ JavaFile jf, Class clazz,String[] binding, int i, List<String> alreadyChecked, String methodToInvoke, Map<GuixGenerator, JavaFile> generatedFiles) {
+ boolean bindingExists = false;
+ String returnType = null;
+ String getter = null;
+ JavaFile nextFile = null;
+ Class nextClazz = null;
+ TagHandler th = null;
+ String model = null;
+ Class listener = null;
+ String addMethod = null;
+ String removeMethod = null;
+ List<Class> result = new ArrayList<Class>();
+
+ if (binding[i].endsWith(")")) {
+ if (jf != null) {
+ bindingExists = jf.getMethod(binding[i].substring(0, binding[i].lastIndexOf("(")), null) != null;
+ if (bindingExists) {
+ returnType = jf.getMethod(binding[i].substring(0, binding[i].lastIndexOf("(")), null).getReturnType();
+ String s = binding[i];
+ if (s.startsWith("get")) {
+ s = Character.toLowerCase(s.charAt(3)) + s.substring(4, s.lastIndexOf("("));
+ }
+ else if (s.startsWith("is")) {
+ s = Character.toLowerCase(s.charAt(2)) + s.substring(3, s.lastIndexOf("("));
+ }
+ JavaField f = jf.getField(s);
+ if (f != null) {
+ th = f.getTagHandler();
+ }
+ }
+ }
+ else {
+ try {
+ clazz.getMethod(binding[i].substring(0, binding[i].lastIndexOf("(")), null);
+ returnType = clazz.getMethod(binding[i].substring(0, binding[i].lastIndexOf("(")), null).getReturnType().getName();
+ bindingExists = true;
+ }
+ catch (NoSuchMethodException eee) {
+ bindingExists = false;
+ }
+ }
+ getter = binding[i];
+ }
+ else {
+ if (jf != null) {
+ bindingExists = jf.getMethod("get" + Character.toUpperCase(binding[i].charAt(0)) + binding[i].substring(1), null) != null || jf.getMethod("is" + Character.toUpperCase(binding[i].charAt(0)) + binding[i].substring(1), null) != null;
+ if (bindingExists) {
+ returnType = jf.getMethod("get" + Character.toUpperCase(binding[i].charAt(0)) + binding[i].substring(1), null) != null ? jf.getMethod("get" + Character.toUpperCase(binding[i].charAt(0)) + binding[i].substring(1), null).getReturnType()
+ : jf.getMethod("is" + Character.toUpperCase(binding[i].charAt(0)) + binding[i].substring(1), null).getReturnType();
+ }
+
+ getter = jf.getMethod("get" + Character.toUpperCase(binding[i].charAt(0)) + binding[i].substring(1), null) != null ? "get" + Character.toUpperCase(binding[i].charAt(0)) + binding[i].substring(1) + "()"
+ : "is" + Character.toUpperCase(binding[i].charAt(0)) + binding[i].substring(1) + "()";
+
+ JavaField f = jf.getField(binding[i]);
+ if (f != null) {
+ th = f.getTagHandler();
+ }
+ }
+ else {
+ try {
+ clazz.getMethod("get" + Character.toUpperCase(binding[i].charAt(0)) + binding[i].substring(1), null);
+ returnType = clazz.getMethod("get" + Character.toUpperCase(binding[i].charAt(0)) + binding[i].substring(1), null).getReturnType().getName();
+ getter = "get" + Character.toUpperCase(binding[i].charAt(0)) + binding[i].substring(1) + "()";
+ bindingExists = true;
+ }
+ catch (NoSuchMethodException eee) {
+ try {
+ clazz.getMethod("is" + Character.toUpperCase(binding[i].charAt(0)) + binding[i].substring(1), null);
+ returnType = clazz.getMethod("is" + Character.toUpperCase(binding[i].charAt(0)) + binding[i].substring(1), null).getReturnType().getName();
+ getter = "is" + Character.toUpperCase(binding[i].charAt(0)) + binding[i].substring(1) + "()";
+ bindingExists = true;
+ }
+ catch (NoSuchMethodException eee2) {
+ bindingExists = false;
+ }
+ }
+ }
+ }
+ if (bindingExists) {
+ if (i == binding.length - 1 && prevTh != null) {
+ String getterWoBraces = getter.substring(0, getter.lastIndexOf("("));
+ if (prevTh.hasEventInfosAboutMethod(getterWoBraces)) {
+ model = prevTh.getEventInfosModelName(getterWoBraces);
+ listener = prevTh.getEventInfosListenerClass(getterWoBraces);
+ addMethod = prevTh.getEventInfosAddListenerMethodName(getterWoBraces);
+ removeMethod = prevTh.getEventInfosRemoveListenerMethodName(getterWoBraces);
+ }
+ else {
+ log.error("Impossible binding");
+ return null;
+ }
+
+ dbCreation.append("if(");
+ dbDeletion.append("if(");
+ if (alreadyChecked != null && !alreadyChecked.isEmpty()) {
+ for (int j = 0; j < alreadyChecked.size(); j++) {
+ dbCreation.append(alreadyChecked.get(0));
+ dbDeletion.append(alreadyChecked.get(0));
+ for (int k = 1; k <= j; k++) {
+ dbCreation.append(".").append(alreadyChecked.get(k));
+ dbDeletion.append(".").append(alreadyChecked.get(k));
+ }
+ dbCreation.append(" != null && ");
+ dbDeletion.append(" != null && ");
+ }
+
+ if (binding.length > alreadyChecked.size() + 1) {
+ for (int j = 0; j < alreadyChecked.size(); j++) {
+ dbCreation.append(alreadyChecked.get(j)).append(".");
+ dbDeletion.append(alreadyChecked.get(j)).append(".");
+ }
+ dbCreation.append(getter).append(" != null");
+ dbDeletion.append(getter).append(" != null");
+ }
+ else {
+ dbCreation.delete(dbCreation.length() - 4, dbCreation.length());
+ dbDeletion.delete(dbDeletion.length() - 4, dbDeletion.length());
+ }
+ }
+ else {
+ dbCreation.append(getter).append(" != null");
+ dbDeletion.append(getter).append(" != null");
+ }
+ dbCreation.append(") {\n");
+ dbDeletion.append(") {\n");
+
+ if (alreadyChecked != null) {
+ for (int j = 0; j < alreadyChecked.size(); j++) {
+ dbCreation.append(alreadyChecked.get(j)).append(".");
+ dbDeletion.append(alreadyChecked.get(j)).append(".");
+ }
+ }
+ if (model != null) {
+ dbCreation.append("get").append(Character.toUpperCase(model.charAt(0))).append(model.substring(1)).append("()").append(".");
+ dbDeletion.append("get").append(Character.toUpperCase(model.charAt(0))).append(model.substring(1)).append("()").append(".");
+ }
+ dbCreation.append(addMethod).append("((").append(listener.getName()).append(") org.nuiton.guix.runtime.Util.getEventListener(").append(listener.getName()).append(".class,this,\"onChangeFrom").append(methodToInvoke).append("\"));\n}\n");
+ dbDeletion.append(removeMethod).append("((").append(listener.getName()).append(") org.nuiton.guix.runtime.Util.getEventListener(").append(listener.getName()).append(".class,this,\"onChangeFrom").append(methodToInvoke).append("\"));\n}\n");
+ }
+
+ try {
+ nextClazz = Label.class.getClassLoader().loadClass(returnType);
+ }
+ catch (ClassNotFoundException eee) {
+ try {
+ nextClazz = ClassLoader.getSystemClassLoader().loadClass(returnType);
+ }
+ catch (ClassNotFoundException eee2) {
+ for (JavaFile javaFile : generatedFiles.values()) {
+ if (returnType.equals(javaFile.getPackageName() + "." + javaFile.getClassName())) {
+ nextFile = javaFile;
+ break;
+ }
+ }
+ }
+ }
+ if (alreadyChecked == null) {
+ alreadyChecked = new ArrayList<String>();
+ }
+ alreadyChecked.add(getter);
+ if (i + 1 < binding.length) {
+ return generateBindings(dbCreation, dbDeletion, th, nextFile, nextClazz,null, i + 1, alreadyChecked, methodToInvoke, generatedFiles);
+ }
+ else {
+ result.add(listener);
+ return result;
+ }
+ }
+ else if (log.isErrorEnabled()) {
+ log.error("unable to bind " + binding[i]);
+ }
+ return result;
+ }
+}
Modified: trunk/guix-compiler-gwt/src/main/java/org/nuiton/guix/generator/GwtInterfaceGenerator.java
===================================================================
--- trunk/guix-compiler-gwt/src/main/java/org/nuiton/guix/generator/GwtInterfaceGenerator.java 2009-07-22 13:06:43 UTC (rev 1501)
+++ trunk/guix-compiler-gwt/src/main/java/org/nuiton/guix/generator/GwtInterfaceGenerator.java 2009-07-22 13:07:30 UTC (rev 1502)
@@ -48,8 +48,7 @@
JavaFile.INTERFACE,
gmo.getClassDescriptor().getPackageName() + ".client",
gmo.getClassDescriptor().getName(),
- null,
- gmo.getJavadoc());
+ null, gmo.getJavadoc());
}
@Override
Modified: trunk/guix-compiler-gwt/src/main/java/org/nuiton/guix/tags/gwt/ApplicationHandler.java
===================================================================
--- trunk/guix-compiler-gwt/src/main/java/org/nuiton/guix/tags/gwt/ApplicationHandler.java 2009-07-22 13:06:43 UTC (rev 1501)
+++ trunk/guix-compiler-gwt/src/main/java/org/nuiton/guix/tags/gwt/ApplicationHandler.java 2009-07-22 13:07:30 UTC (rev 1502)
@@ -9,7 +9,7 @@
*
* @author kevin
*/
-public class ApplicationHandler extends org.nuiton.guix.tags.ApplicationHandler {
+public class ApplicationHandler extends UIObjectHandler {
public ApplicationHandler() {
super();
Modified: trunk/guix-compiler-gwt/src/main/java/org/nuiton/guix/tags/gwt/ButtonHandler.java
===================================================================
--- trunk/guix-compiler-gwt/src/main/java/org/nuiton/guix/tags/gwt/ButtonHandler.java 2009-07-22 13:06:43 UTC (rev 1501)
+++ trunk/guix-compiler-gwt/src/main/java/org/nuiton/guix/tags/gwt/ButtonHandler.java 2009-07-22 13:07:30 UTC (rev 1502)
@@ -9,8 +9,12 @@
*
* @author kevin
*/
-public class ButtonHandler extends org.nuiton.guix.tags.ButtonHandler {
+public class ButtonHandler extends UIObjectHandler {
+ public ButtonHandler() {
+ super();
+ }
+
@Override
public Class getClassToGenerate() {
return com.google.gwt.user.client.ui.Button.class;
Modified: trunk/guix-compiler-gwt/src/main/java/org/nuiton/guix/tags/gwt/CellHandler.java
===================================================================
--- trunk/guix-compiler-gwt/src/main/java/org/nuiton/guix/tags/gwt/CellHandler.java 2009-07-22 13:06:43 UTC (rev 1501)
+++ trunk/guix-compiler-gwt/src/main/java/org/nuiton/guix/tags/gwt/CellHandler.java 2009-07-22 13:07:30 UTC (rev 1502)
@@ -18,6 +18,7 @@
*/
package org.nuiton.guix.tags.gwt;
+import org.nuiton.guix.model.AttributeDescriptor;
import org.nuiton.guix.model.GuixModelObject;
/**
@@ -25,8 +26,18 @@
*
* @author kevin
*/
-public class CellHandler extends org.nuiton.guix.tags.CellHandler {
-
+public class CellHandler extends TableHandler {
+ /** id of the object contained by the cell */
+ private String id = null;
+ /** number of columns of the cell */
+ private int columns = 1;
+ /** number of rows of the cell */
+ private int rows = 1;
+ /** index of the row */
+ private int row = -1;
+ /** index of the column */
+ private int column = -1;
+
/**
* Constructor
*/
@@ -40,7 +51,43 @@
* @param cell the GuixModelObject which represents the cell
*/
public CellHandler(GuixModelObject cell) {
- super(cell);
+ assert cell.getChildren().size() == 1;
+ id = cell.getChildren().get(0).getId();
+ for (AttributeDescriptor attr : cell.getAttributeDescriptors()) {
+ if (attr.getName().equals("columns")) {
+ columns = Integer.valueOf(attr.getValue());
+ }
+ else if (attr.getName().equals("column")) {
+ column = Integer.valueOf(attr.getValue());
+ }
+ else if (attr.getName().equals("rows")) {
+ rows = Integer.valueOf(attr.getValue());
+ }
+ else if (attr.getName().equals("weightx")) {
+ weightx = Double.valueOf(attr.getValue());
+ }
+ else if (attr.getName().equals("weighty")) {
+ weighty = Double.valueOf(attr.getValue());
+ }
+ else if (attr.getName().equals("ipadx")) {
+ ipadx = Integer.valueOf(attr.getValue());
+ }
+ else if (attr.getName().equals("ipady")) {
+ ipady = Integer.valueOf(attr.getValue());
+ }
+ else if (attr.getName().equals("halign")) {
+ horizontalAlignment = getHalign(attr.getValue());
+ }
+ else if (attr.getName().equals("valign")) {
+ verticalAlignment = getValign(attr.getValue());
+ }
+ else if (attr.getName().equals("fill")) {
+ fill = attr.getValue();
+ }
+ else if (attr.getName().equals("insets")) {
+ insets = attr.getValue();
+ }
+ }
}
/**
@@ -50,13 +97,82 @@
* @param row the row which contains the cell
*/
public CellHandler(GuixModelObject cell, RowHandler row) {
- super(cell,row);
+ this(cell);
+ //if the attributes that the row contains too have not been defined by the user within the cell,
+ //but have been defined in the row (or the table), set them
+ if (horizontalAlignment == null) {
+ horizontalAlignment = row.getHorizontalAlignment() == null ? TableHandler.DEFAULT_HORIZONTAL_ALIGNMENT : row.getHorizontalAlignment();
+ }
+ if (verticalAlignment == null) {
+ verticalAlignment = row.getVerticalAlignment() == null ? TableHandler.DEFAULT_VERTICAL_ALIGNMENT : row.getVerticalAlignment();
+ }
+ if (fill == null) {
+ fill = row.getFill() == null ? TableHandler.DEFAULT_FILL : row.getFill();
+ }
+ if (insets == null) {
+ insets = row.getInsets() == null ? TableHandler.DEFAULT_INSETS : row.getInsets();
+ }
+ if (ipadx == null) {
+ ipadx = row.getIpadx() == null ? TableHandler.DEFAULT_IPADX : row.getIpadx();
+ }
+ if (ipady == null) {
+ ipady = row.getIpady() == null ? TableHandler.DEFAULT_IPADY : row.getIpady();
+ }
+ if (weightx == null) {
+ weightx = row.getWeightx() == null ? TableHandler.DEFAULT_WEIGHTX : row.getWeightx();
+ }
+ if (weighty == null) {
+ weighty = row.getWeighty() == null ? TableHandler.DEFAULT_WEIGHTY : row.getWeighty();
+ }
+ if(this.row == -1) {
+ this.row = row.getRow() < 0 ? -1 : row.getRow();
+ }
}
+
+ public String getId() {
+ return id;
+ }
+
+ public void setId(String id) {
+ this.id = id;
+ }
+
+ public int getColumn() {
+ return column;
+ }
+
+ public void setColumn(int column) {
+ this.column = column;
+ }
+
+ public int getColumns() {
+ return columns;
+ }
+
+ public void setColumns(int columns) {
+ this.columns = columns;
+ }
+
+ public int getRow() {
+ return row;
+ }
+
+ public void setRow(int row) {
+ this.row = row;
+ }
+
+ public int getRows() {
+ return rows;
+ }
+
+ public void setRows(int rows) {
+ this.rows = rows;
+ }
+
@Override
public Class getClassToGenerate() {
return null;
}
-
}
Modified: trunk/guix-compiler-gwt/src/main/java/org/nuiton/guix/tags/gwt/LabelHandler.java
===================================================================
--- trunk/guix-compiler-gwt/src/main/java/org/nuiton/guix/tags/gwt/LabelHandler.java 2009-07-22 13:06:43 UTC (rev 1501)
+++ trunk/guix-compiler-gwt/src/main/java/org/nuiton/guix/tags/gwt/LabelHandler.java 2009-07-22 13:07:30 UTC (rev 1502)
@@ -4,12 +4,13 @@
*/
package org.nuiton.guix.tags.gwt;
+import com.google.gwt.user.client.EventListener;
/**
*
* @author kevin
*/
-public class LabelHandler extends org.nuiton.guix.tags.LabelHandler {
+public class LabelHandler extends UIObjectHandler {
/**
* Constructor
Modified: trunk/guix-compiler-gwt/src/main/java/org/nuiton/guix/tags/gwt/MenuBarHandler.java
===================================================================
--- trunk/guix-compiler-gwt/src/main/java/org/nuiton/guix/tags/gwt/MenuBarHandler.java 2009-07-22 13:06:43 UTC (rev 1501)
+++ trunk/guix-compiler-gwt/src/main/java/org/nuiton/guix/tags/gwt/MenuBarHandler.java 2009-07-22 13:07:30 UTC (rev 1502)
@@ -4,12 +4,13 @@
*/
package org.nuiton.guix.tags.gwt;
+import com.google.gwt.user.client.EventListener;
/**
*
* @author kevin
*/
-public class MenuBarHandler extends org.nuiton.guix.tags.MenuBarHandler {
+public class MenuBarHandler extends UIObjectHandler {
/**
* Constructor
Modified: trunk/guix-compiler-gwt/src/main/java/org/nuiton/guix/tags/gwt/MenuHandler.java
===================================================================
--- trunk/guix-compiler-gwt/src/main/java/org/nuiton/guix/tags/gwt/MenuHandler.java 2009-07-22 13:06:43 UTC (rev 1501)
+++ trunk/guix-compiler-gwt/src/main/java/org/nuiton/guix/tags/gwt/MenuHandler.java 2009-07-22 13:07:30 UTC (rev 1502)
@@ -9,7 +9,7 @@
*
* @author kevin
*/
-public class MenuHandler extends org.nuiton.guix.tags.MenuHandler {
+public class MenuHandler extends UIObjectHandler {
/**
* Constructor
Modified: trunk/guix-compiler-gwt/src/main/java/org/nuiton/guix/tags/gwt/MenuItemHandler.java
===================================================================
--- trunk/guix-compiler-gwt/src/main/java/org/nuiton/guix/tags/gwt/MenuItemHandler.java 2009-07-22 13:06:43 UTC (rev 1501)
+++ trunk/guix-compiler-gwt/src/main/java/org/nuiton/guix/tags/gwt/MenuItemHandler.java 2009-07-22 13:07:30 UTC (rev 1502)
@@ -9,13 +9,14 @@
*
* @author kevin
*/
-public class MenuItemHandler extends org.nuiton.guix.tags.MenuItemHandler {
+public class MenuItemHandler extends UIObjectHandler {
/**
* Constructor
*/
public MenuItemHandler() {
super();
+ attrMap.put("action", "command");
}
@Override
Modified: trunk/guix-compiler-gwt/src/main/java/org/nuiton/guix/tags/gwt/PanelHandler.java
===================================================================
--- trunk/guix-compiler-gwt/src/main/java/org/nuiton/guix/tags/gwt/PanelHandler.java 2009-07-22 13:06:43 UTC (rev 1501)
+++ trunk/guix-compiler-gwt/src/main/java/org/nuiton/guix/tags/gwt/PanelHandler.java 2009-07-22 13:07:30 UTC (rev 1502)
@@ -9,7 +9,7 @@
*
* @author kevin
*/
-public class PanelHandler extends org.nuiton.guix.tags.PanelHandler {
+public class PanelHandler extends UIObjectHandler {
/**
* Constructor
Modified: trunk/guix-compiler-gwt/src/main/java/org/nuiton/guix/tags/gwt/RowHandler.java
===================================================================
--- trunk/guix-compiler-gwt/src/main/java/org/nuiton/guix/tags/gwt/RowHandler.java 2009-07-22 13:06:43 UTC (rev 1501)
+++ trunk/guix-compiler-gwt/src/main/java/org/nuiton/guix/tags/gwt/RowHandler.java 2009-07-22 13:07:30 UTC (rev 1502)
@@ -18,6 +18,7 @@
*/
package org.nuiton.guix.tags.gwt;
+import org.nuiton.guix.model.AttributeDescriptor;
import org.nuiton.guix.model.GuixModelObject;
/**
@@ -25,7 +26,10 @@
*
* @author kevin
*/
-public class RowHandler extends org.nuiton.guix.tags.RowHandler {
+public class RowHandler extends TableHandler {
+
+ /** index of the row */
+ private int row = -1;
/**
* Constructor
@@ -40,7 +44,35 @@
* @param row the GuixModelObject which represents the row
*/
public RowHandler(GuixModelObject row) {
- super(row);
+ for (AttributeDescriptor attr : row.getAttributeDescriptors()) {
+ if (attr.getName().equals("row")) {
+ this.row = Integer.valueOf(attr.getValue());
+ }
+ else if (attr.getName().equals("weightx")) {
+ weightx = Double.valueOf(attr.getValue());
+ }
+ else if (attr.getName().equals("weighty")) {
+ weighty = Double.valueOf(attr.getValue());
+ }
+ else if (attr.getName().equals("ipadx")) {
+ ipadx = Integer.valueOf(attr.getValue());
+ }
+ else if (attr.getName().equals("ipady")) {
+ ipady = Integer.valueOf(attr.getValue());
+ }
+ else if (attr.getName().equals("halign")) {
+ horizontalAlignment = getHalign(attr.getValue());
+ }
+ else if (attr.getName().equals("valign")) {
+ verticalAlignment = getValign(attr.getValue());
+ }
+ else if (attr.getName().equals("fill")) {
+ fill = attr.getValue();
+ }
+ else if (attr.getName().equals("insets")) {
+ insets = attr.getValue();
+ }
+ }
}
/**
@@ -50,11 +82,45 @@
* @param table the table which contains the row
*/
public RowHandler(GuixModelObject row, TableHandler table) {
- super(row, table);
+ this(row);
+ //if the attributes that the table contains too have not been defined by the user within the row,
+ //but have been defined in the table, set them
+ if (horizontalAlignment == null) {
+ horizontalAlignment = table.getHorizontalAlignment() == null ? TableHandler.DEFAULT_HORIZONTAL_ALIGNMENT : table.getHorizontalAlignment();
+ }
+ if (verticalAlignment == null) {
+ verticalAlignment = table.getVerticalAlignment() == null ? TableHandler.DEFAULT_VERTICAL_ALIGNMENT : table.getVerticalAlignment();
+ }
+ if (fill == null) {
+ fill = table.getFill() == null ? TableHandler.DEFAULT_FILL : table.getFill();
+ }
+ if (insets == null) {
+ insets = table.getInsets() == null ? TableHandler.DEFAULT_INSETS : table.getInsets();
+ }
+ if (ipadx == null) {
+ ipadx = table.getIpadx() == null ? TableHandler.DEFAULT_IPADX : table.getIpadx();
+ }
+ if (ipady == null) {
+ ipady = table.getIpady() == null ? TableHandler.DEFAULT_IPADY : table.getIpady();
+ }
+ if (weightx == null) {
+ weightx = table.getWeightx() == null ? TableHandler.DEFAULT_WEIGHTX : table.getWeightx();
+ }
+ if (weighty == null) {
+ weighty = table.getWeighty() == null ? TableHandler.DEFAULT_WEIGHTY : table.getWeighty();
+ }
}
@Override
public Class getClassToGenerate() {
return null;
}
+
+ public int getRow() {
+ return row;
+ }
+
+ public void setRow(int row) {
+ this.row = row;
+ }
}
Modified: trunk/guix-compiler-gwt/src/main/java/org/nuiton/guix/tags/gwt/TabPanelHandler.java
===================================================================
--- trunk/guix-compiler-gwt/src/main/java/org/nuiton/guix/tags/gwt/TabPanelHandler.java 2009-07-22 13:06:43 UTC (rev 1501)
+++ trunk/guix-compiler-gwt/src/main/java/org/nuiton/guix/tags/gwt/TabPanelHandler.java 2009-07-22 13:07:30 UTC (rev 1502)
@@ -9,7 +9,7 @@
*
* @author kevin
*/
-public class TabPanelHandler extends org.nuiton.guix.tags.TabPanelHandler {
+public class TabPanelHandler extends UIObjectHandler {
/**
* Constructor
Modified: trunk/guix-compiler-gwt/src/main/java/org/nuiton/guix/tags/gwt/TableHandler.java
===================================================================
--- trunk/guix-compiler-gwt/src/main/java/org/nuiton/guix/tags/gwt/TableHandler.java 2009-07-22 13:06:43 UTC (rev 1501)
+++ trunk/guix-compiler-gwt/src/main/java/org/nuiton/guix/tags/gwt/TableHandler.java 2009-07-22 13:07:30 UTC (rev 1502)
@@ -22,6 +22,7 @@
import java.util.List;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
+import org.nuiton.guix.model.AttributeDescriptor;
import org.nuiton.guix.model.GuixModelObject;
/**
@@ -29,10 +30,35 @@
*
* @author kevin
*/
-public class TableHandler extends org.nuiton.guix.tags.TableHandler {
+public class TableHandler extends UIObjectHandler {
private static Log log = LogFactory.getLog(TableHandler.class);
+ protected enum VerticalAlignment {
+
+ ALIGN_TOP, ALIGN_MIDDLE, ALIGN_BOTTOM
+ }
+ protected enum HorizontalAlignment {
+
+ ALIGN_LEFT, ALIGN_CENTER, ALIGN_RIGHT, ALIGN_DEFAULT
+ }
+ public static final String DEFAULT_INSETS = "3, 3, 3, 3";
+ public static final HorizontalAlignment DEFAULT_HORIZONTAL_ALIGNMENT = HorizontalAlignment.ALIGN_DEFAULT;
+ public static final VerticalAlignment DEFAULT_VERTICAL_ALIGNMENT = VerticalAlignment.ALIGN_TOP;
+ public static final String DEFAULT_FILL = "java.awt.GridBagConstraints.BOTH";
+ public static final Integer DEFAULT_IPADX = 1;
+ public static final Integer DEFAULT_IPADY = 1;
+ public static final Double DEFAULT_WEIGHTX = 0.0;
+ public static final Double DEFAULT_WEIGHTY = 0.0;
+ protected Double weightx = null;
+ protected Double weighty = null;
+ protected Integer ipadx = null;
+ protected Integer ipady = null;
+ protected HorizontalAlignment horizontalAlignment = null;
+ protected VerticalAlignment verticalAlignment = null;
+ protected String fill = null;
+ protected String insets = null;
+
/**
* Constructor
*/
@@ -46,9 +72,137 @@
* @param table the GuixModelObject which represents the table
*/
public TableHandler(GuixModelObject table) {
- super(table);
+ for (AttributeDescriptor attr : table.getAttributeDescriptors()) {
+ if (attr.getName().equals("weightx")) {
+ weightx = Double.valueOf(attr.getValue());
+ }
+ else if (attr.getName().equals("weighty")) {
+ weighty = Double.valueOf(attr.getValue());
+ }
+ else if (attr.getName().equals("ipadx")) {
+ ipadx = Integer.valueOf(attr.getValue());
+ }
+ else if (attr.getName().equals("ipady")) {
+ ipady = Integer.valueOf(attr.getValue());
+ }
+ else if (attr.getName().equals("halign")) {
+ horizontalAlignment = getHalign(attr.getValue());
+ if (horizontalAlignment == null) {
+ if (log.isErrorEnabled()) {
+ log.error(table.getId() + "'s halign attribute has a wrong value : " + attr.getValue());
+ }
+ horizontalAlignment = HorizontalAlignment.ALIGN_DEFAULT;
+ }
+ }
+ else if (attr.getName().equals("valign")) {
+ verticalAlignment = getValign(attr.getValue());
+ if (verticalAlignment == null) {
+ if (log.isErrorEnabled()) {
+ log.error(table.getId() + "'s halign attribute has a wrong value : " + attr.getValue());
+ }
+ verticalAlignment = VerticalAlignment.ALIGN_TOP;
+ }
+ }
+ else if (attr.getName().equals("fill")) {
+ fill = attr.getValue();
+ }
+ else if (attr.getName().equals("insets")) {
+ insets = attr.getValue();
+ }
+ }
}
-
+
+
+ public HorizontalAlignment getHorizontalAlignment() {
+ return horizontalAlignment;
+ }
+
+ public void setHorizontalAlignment(HorizontalAlignment horizontalAlignment) {
+ this.horizontalAlignment = horizontalAlignment;
+ }
+
+ public VerticalAlignment getVerticalAlignment() {
+ return verticalAlignment;
+ }
+
+ public void setVerticalAlignment(VerticalAlignment verticalAlignment) {
+ this.verticalAlignment = verticalAlignment;
+ }
+
+ public String getFill() {
+ return fill;
+ }
+
+ public void setFill(String fill) {
+ this.fill = fill;
+ }
+
+ public String getInsets() {
+ return insets;
+ }
+
+ public void setInsets(String insets) {
+ this.insets = insets;
+ }
+
+ public Integer getIpadx() {
+ return ipadx;
+ }
+
+ public void setIpadx(Integer ipadx) {
+ this.ipadx = ipadx;
+ }
+
+ public Integer getIpady() {
+ return ipady;
+ }
+
+ public void setIpady(Integer ipady) {
+ this.ipady = ipady;
+ }
+
+ public Double getWeightx() {
+ return weightx;
+ }
+
+ public void setWeightx(Double weightx) {
+ this.weightx = weightx;
+ }
+
+ public Double getWeighty() {
+ return weighty;
+ }
+
+ public void setWeighty(Double weighty) {
+ this.weighty = weighty;
+ }
+
+ public HorizontalAlignment getHalign(String halign) {
+ if (halign.equalsIgnoreCase("left")) {
+ return HorizontalAlignment.ALIGN_LEFT;
+ }
+ if (halign.equalsIgnoreCase("right")) {
+ return HorizontalAlignment.ALIGN_RIGHT;
+ }
+ if (halign.equalsIgnoreCase("center")) {
+ return HorizontalAlignment.ALIGN_CENTER;
+ }
+ return null;
+ }
+
+ public VerticalAlignment getValign(String valign) {
+ if (valign.equalsIgnoreCase("top")) {
+ return VerticalAlignment.ALIGN_TOP;
+ }
+ if (valign.equalsIgnoreCase("bottom")) {
+ return VerticalAlignment.ALIGN_BOTTOM;
+ }
+ if (valign.equalsIgnoreCase("middle")) {
+ return VerticalAlignment.ALIGN_MIDDLE;
+ }
+ return null;
+ }
+
/**
* Creates a cell with the right column and generates the code to add it to the table
*
Modified: trunk/guix-compiler-gwt/src/main/java/org/nuiton/guix/tags/gwt/TextFieldHandler.java
===================================================================
--- trunk/guix-compiler-gwt/src/main/java/org/nuiton/guix/tags/gwt/TextFieldHandler.java 2009-07-22 13:06:43 UTC (rev 1501)
+++ trunk/guix-compiler-gwt/src/main/java/org/nuiton/guix/tags/gwt/TextFieldHandler.java 2009-07-22 13:07:30 UTC (rev 1502)
@@ -4,12 +4,13 @@
*/
package org.nuiton.guix.tags.gwt;
+import com.google.gwt.user.client.ui.KeyboardListener;
/**
*
* @author kevin
*/
-public class TextFieldHandler extends org.nuiton.guix.tags.TextFieldHandler {
+public class TextFieldHandler extends UIObjectHandler {
/**
* Constructor
@@ -23,4 +24,9 @@
return com.google.gwt.user.client.ui.TextBox.class;
}
+ @Override
+ public void configureProxyEventInfo() {
+ super.configureProxyEventInfo();
+ addProxyEventInfo("getText", KeyboardListener.class);
+ }
}
Modified: trunk/guix-compiler-gwt/src/main/java/org/nuiton/guix/tags/gwt/ToggleButtonHandler.java
===================================================================
--- trunk/guix-compiler-gwt/src/main/java/org/nuiton/guix/tags/gwt/ToggleButtonHandler.java 2009-07-22 13:06:43 UTC (rev 1501)
+++ trunk/guix-compiler-gwt/src/main/java/org/nuiton/guix/tags/gwt/ToggleButtonHandler.java 2009-07-22 13:07:30 UTC (rev 1502)
@@ -4,16 +4,27 @@
*/
package org.nuiton.guix.tags.gwt;
+import com.google.gwt.user.client.ui.ClickListener;
/**
*
* @author kevin
*/
-public class ToggleButtonHandler extends org.nuiton.guix.tags.ToggleButtonHandler {
+public class ToggleButtonHandler extends ButtonHandler {
+ public ToggleButtonHandler() {
+ super();
+ attrMap.put("selected", "down");
+ }
+
@Override
public Class getClassToGenerate() {
return com.google.gwt.user.client.ui.ToggleButton.class;
}
+ @Override
+ public void configureProxyEventInfo() {
+ super.configureProxyEventInfo();
+ addProxyEventInfo("isDown", ClickListener.class);
+ }
}
Added: trunk/guix-compiler-gwt/src/main/java/org/nuiton/guix/tags/gwt/UIObjectHandler.java
===================================================================
--- trunk/guix-compiler-gwt/src/main/java/org/nuiton/guix/tags/gwt/UIObjectHandler.java (rev 0)
+++ trunk/guix-compiler-gwt/src/main/java/org/nuiton/guix/tags/gwt/UIObjectHandler.java 2009-07-22 13:07:30 UTC (rev 1502)
@@ -0,0 +1,22 @@
+/*
+ * To change this template, choose Tools | Templates
+ * and open the template in the editor.
+ */
+
+package org.nuiton.guix.tags.gwt;
+import com.google.gwt.user.client.EventListener;
+import com.google.gwt.user.client.ui.FocusListener;
+import org.nuiton.guix.tags.DefaultTagHandler;
+
+/**
+ *
+ * @author kevin
+ */
+public abstract class UIObjectHandler extends DefaultTagHandler {
+
+ public UIObjectHandler() {
+ super();
+ configureProxyEventInfo();
+ }
+
+}
1
0
r1501 - trunk/guix-compiler/src/main/java/org/nuiton/guix/tags
by kmorin@users.labs.libre-entreprise.org July 22, 2009
by kmorin@users.labs.libre-entreprise.org July 22, 2009
July 22, 2009
Author: kmorin
Date: 2009-07-22 15:06:43 +0200 (Wed, 22 Jul 2009)
New Revision: 1501
Added:
trunk/guix-compiler/src/main/java/org/nuiton/guix/tags/ApplicationHandler.java
trunk/guix-compiler/src/main/java/org/nuiton/guix/tags/PanelHandler.java
Log:
Removed the general taghandlers (I kept the one useful for the tests)
Generation of the binding after the generation of the non-dynamic code : I made a copy of GuixLauncher working with DataBinding and DataSource classes, but it seems to be working without
Added: trunk/guix-compiler/src/main/java/org/nuiton/guix/tags/ApplicationHandler.java
===================================================================
--- trunk/guix-compiler/src/main/java/org/nuiton/guix/tags/ApplicationHandler.java (rev 0)
+++ trunk/guix-compiler/src/main/java/org/nuiton/guix/tags/ApplicationHandler.java 2009-07-22 13:06:43 UTC (rev 1501)
@@ -0,0 +1,20 @@
+/*
+ * To change this template, choose Tools | Templates
+ * and open the template in the editor.
+ */
+
+package org.nuiton.guix.tags;
+
+/**
+ *
+ * @author kevin
+ */
+public abstract class ApplicationHandler extends DefaultTagHandler {
+
+ /**
+ * Constructor
+ */
+ public ApplicationHandler() {
+
+ }
+}
Added: trunk/guix-compiler/src/main/java/org/nuiton/guix/tags/PanelHandler.java
===================================================================
--- trunk/guix-compiler/src/main/java/org/nuiton/guix/tags/PanelHandler.java (rev 0)
+++ trunk/guix-compiler/src/main/java/org/nuiton/guix/tags/PanelHandler.java 2009-07-22 13:06:43 UTC (rev 1501)
@@ -0,0 +1,20 @@
+/*
+ * To change this template, choose Tools | Templates
+ * and open the template in the editor.
+ */
+
+package org.nuiton.guix.tags;
+
+/**
+ *
+ * @author kevin
+ */
+public abstract class PanelHandler extends DefaultTagHandler {
+
+ /**
+ * Constructor
+ */
+ public PanelHandler() {
+
+ }
+}
1
0
r1500 - in trunk/guix-compiler/src/main/java/org/nuiton/guix: . databinding generator model parser tags
by kmorin@users.labs.libre-entreprise.org July 22, 2009
by kmorin@users.labs.libre-entreprise.org July 22, 2009
July 22, 2009
Author: kmorin
Date: 2009-07-22 15:06:26 +0200 (Wed, 22 Jul 2009)
New Revision: 1500
Added:
trunk/guix-compiler/src/main/java/org/nuiton/guix/GuixLauncher1.java
trunk/guix-compiler/src/main/java/org/nuiton/guix/databinding/DataBinding.java
trunk/guix-compiler/src/main/java/org/nuiton/guix/databinding/DataSource.java
Removed:
trunk/guix-compiler/src/main/java/org/nuiton/guix/tags/ApplicationHandler.java
trunk/guix-compiler/src/main/java/org/nuiton/guix/tags/ButtonHandler.java
trunk/guix-compiler/src/main/java/org/nuiton/guix/tags/CellHandler.java
trunk/guix-compiler/src/main/java/org/nuiton/guix/tags/LabelHandler.java
trunk/guix-compiler/src/main/java/org/nuiton/guix/tags/MenuBarHandler.java
trunk/guix-compiler/src/main/java/org/nuiton/guix/tags/MenuHandler.java
trunk/guix-compiler/src/main/java/org/nuiton/guix/tags/MenuItemHandler.java
trunk/guix-compiler/src/main/java/org/nuiton/guix/tags/PanelHandler.java
trunk/guix-compiler/src/main/java/org/nuiton/guix/tags/RowHandler.java
trunk/guix-compiler/src/main/java/org/nuiton/guix/tags/TabPanelHandler.java
trunk/guix-compiler/src/main/java/org/nuiton/guix/tags/TableHandler.java
trunk/guix-compiler/src/main/java/org/nuiton/guix/tags/TextFieldHandler.java
trunk/guix-compiler/src/main/java/org/nuiton/guix/tags/ToggleButtonHandler.java
Modified:
trunk/guix-compiler/src/main/java/org/nuiton/guix/GuixInitializer.java
trunk/guix-compiler/src/main/java/org/nuiton/guix/GuixLauncher.java
trunk/guix-compiler/src/main/java/org/nuiton/guix/databinding/BindingUtils.java
trunk/guix-compiler/src/main/java/org/nuiton/guix/generator/Generator.java
trunk/guix-compiler/src/main/java/org/nuiton/guix/generator/GuixGenerator.java
trunk/guix-compiler/src/main/java/org/nuiton/guix/generator/JavaField.java
trunk/guix-compiler/src/main/java/org/nuiton/guix/generator/JavaFile.java
trunk/guix-compiler/src/main/java/org/nuiton/guix/generator/JavaFileGenerator.java
trunk/guix-compiler/src/main/java/org/nuiton/guix/generator/JavaMethod.java
trunk/guix-compiler/src/main/java/org/nuiton/guix/model/ClassDescriptor.java
trunk/guix-compiler/src/main/java/org/nuiton/guix/parser/SimpleNode.java
trunk/guix-compiler/src/main/java/org/nuiton/guix/tags/DefaultTagHandler.java
trunk/guix-compiler/src/main/java/org/nuiton/guix/tags/StyleHandler.java
trunk/guix-compiler/src/main/java/org/nuiton/guix/tags/TagHandler.java
Log:
Removed the general taghandlers (I kept the one useful for the tests)
Generation of the binding after the generation of the non-dynamic code : I made a copy of GuixLauncher working with DataBinding and DataSource classes, but it seems to be working without
Modified: trunk/guix-compiler/src/main/java/org/nuiton/guix/GuixInitializer.java
===================================================================
--- trunk/guix-compiler/src/main/java/org/nuiton/guix/GuixInitializer.java 2009-07-22 13:03:32 UTC (rev 1499)
+++ trunk/guix-compiler/src/main/java/org/nuiton/guix/GuixInitializer.java 2009-07-22 13:06:26 UTC (rev 1500)
@@ -22,19 +22,8 @@
//~--- non-JDK imports --------------------------------------------------------
import org.nuiton.guix.tags.ApplicationHandler;
-import org.nuiton.guix.tags.ButtonHandler;
-import org.nuiton.guix.tags.CellHandler;
-import org.nuiton.guix.tags.LabelHandler;
-import org.nuiton.guix.tags.MenuBarHandler;
-import org.nuiton.guix.tags.MenuHandler;
-import org.nuiton.guix.tags.MenuItemHandler;
-import org.nuiton.guix.tags.RowHandler;
-import org.nuiton.guix.tags.TableHandler;
import org.nuiton.guix.tags.PanelHandler;
-import org.nuiton.guix.tags.TabPanelHandler;
import org.nuiton.guix.tags.TagManager;
-import org.nuiton.guix.tags.TextFieldHandler;
-import org.nuiton.guix.tags.ToggleButtonHandler;
/**
* Initialize the application
@@ -44,18 +33,7 @@
public class GuixInitializer {
public static void initialize() {
TagManager.registerGuixClassHandler("Application", ApplicationHandler.class);
- TagManager.registerGuixClassHandler("Table", TableHandler.class);
- TagManager.registerGuixClassHandler("Row", RowHandler.class);
- TagManager.registerGuixClassHandler("Cell", CellHandler.class);
TagManager.registerGuixClassHandler("Panel", PanelHandler.class);
- TagManager.registerGuixClassHandler("Button", ButtonHandler.class);
- TagManager.registerGuixClassHandler("TextField", TextFieldHandler.class);
- TagManager.registerGuixClassHandler("Label", LabelHandler.class);
- TagManager.registerGuixClassHandler("ToggleButton", ToggleButtonHandler.class);
- TagManager.registerGuixClassHandler("TabPanel", TabPanelHandler.class);
- TagManager.registerGuixClassHandler("MenuBar", MenuBarHandler.class);
- TagManager.registerGuixClassHandler("Menu", MenuHandler.class);
- TagManager.registerGuixClassHandler("MenuItem", MenuItemHandler.class);
}
}
Modified: trunk/guix-compiler/src/main/java/org/nuiton/guix/GuixLauncher.java
===================================================================
--- trunk/guix-compiler/src/main/java/org/nuiton/guix/GuixLauncher.java 2009-07-22 13:03:32 UTC (rev 1499)
+++ trunk/guix-compiler/src/main/java/org/nuiton/guix/GuixLauncher.java 2009-07-22 13:06:26 UTC (rev 1500)
@@ -21,6 +21,9 @@
import org.nuiton.guix.compiler.GuixCompiler;
import java.io.File;
import java.io.PrintWriter;
+import java.io.StringReader;
+import java.lang.reflect.Method;
+import java.lang.reflect.Modifier;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
@@ -28,10 +31,16 @@
import java.util.Map;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import org.nuiton.guix.generator.Generator;
import org.nuiton.guix.generator.GuixGenerator;
+import org.nuiton.guix.generator.JavaArgument;
+import org.nuiton.guix.generator.JavaField;
+import org.nuiton.guix.generator.JavaFile;
+import org.nuiton.guix.generator.JavaMethod;
import org.nuiton.guix.model.ClassDescriptor;
import org.nuiton.guix.model.GuixModelObject;
+import org.nuiton.guix.parser.JavaParser;
+import org.nuiton.guix.parser.JavaParserTreeConstants;
+import org.nuiton.guix.parser.SimpleNode;
import org.nuiton.guix.tags.TagManager;
import org.xmlpull.v1.XmlPullParserFactory;
import org.xmlpull.v1.XmlSerializer;
@@ -61,6 +70,7 @@
protected List<ClassDescriptor> classDescriptors =
new ArrayList<ClassDescriptor>();
private List<File> compiledFiles = new ArrayList<File>();
+ private Map<GuixGenerator,JavaFile> generatedFiles = new HashMap<GuixGenerator,JavaFile>();
protected int compilerCount;
private File targetDirectory;
private String rootPackage;
@@ -204,7 +214,7 @@
for (GuixModelObject mo : rootModelObjects.keySet()) {
try {
- Generator gen = (GuixGenerator) generatorClass.newInstance();
+ GuixGenerator gen = (GuixGenerator) generatorClass.newInstance();
gen.setDestDir(destDir);
gen.setGmo(mo);
gen.setLastModification(rootModelObjects.get(mo));
@@ -212,7 +222,7 @@
gen.setSerializer(serializer);
gen.setClasses(Arrays.asList(classNames));
gen.setLauncherName(launcherName);
- gen.generate();
+ generatedFiles.put(gen,gen.generate());
}
catch (InstantiationException eee) {
if(log.isErrorEnabled())
@@ -222,11 +232,124 @@
if(log.isErrorEnabled())
log.error(eee);
}
- catch (NullPointerException eee) {
- if(log.isErrorEnabled())
- log.error(eee);
- eee.printStackTrace();
+ }
+ for(GuixGenerator gen : generatedFiles.keySet()) {
+ int dataSourceNumber = 0;
+ StringBuffer dbCreation = new StringBuffer();
+ StringBuffer dbDeletion = new StringBuffer();
+ StringBuffer dbProcess = new StringBuffer();
+ JavaFile jf = generatedFiles.get(gen);
+ for(String field : gen.getBindingsToGenerate().keySet()) {
+ for(String attr : gen.getBindingsToGenerate().get(field).keySet()) {
+ dbCreation.append(dbCreation.length() != 0 ? "else if(\"" : "if(\"").append(field)
+ .append(".").append(attr)
+ .append("\".equals(_binding)) {\n");
+ dbDeletion.append(dbDeletion.length() != 0 ? "else if(\"" : "if(\"").append(field)
+ .append(".").append(attr)
+ .append("\".equals(_binding)) {\n");
+ dbProcess.append(dbProcess.length() != 0 ? "else if(\"" : "if(\"").append(field)
+ .append(".").append(attr)
+ .append("\".equals(_binding)) {\n")
+ .append(field).append(".set")
+ .append(Character.toUpperCase(attr.charAt(0)))
+ .append(attr.substring(1))
+ .append("(");
+ List<String[]> bindings = new ArrayList<String[]>();
+ JavaParser p = new JavaParser(new StringReader(gen.getBindingsToGenerate().get(field).get(attr)));
+ //start parsing
+ while (!p.Line()) {
+ SimpleNode node = p.popNode();
+ if (node != null) {
+ for(String s : browseNode(node)) {
+ List<String> l = new ArrayList<String>();
+ int parOuvertes = 0;
+ StringBuffer read = new StringBuffer();
+ for(char c : s.toCharArray()) {
+ if(c == '(') {
+ parOuvertes++;
+ read.append(c);
+ }
+ else if(c == ')') {
+ parOuvertes--;
+ read.append(c);
+ }
+ else if(c == '.') {
+ if(parOuvertes == 0) {
+ l.add(read.toString());
+ read = new StringBuffer();
+ }
+ else {
+ read.append(c);
+ }
+ }
+ else {
+ read.append(c);
+ }
+ }
+ l.add(read.toString());
+ bindings.add(l.toArray(new String[l.size()]));
+ }
+ }
+ }
+ List<Class> listeners = new ArrayList<Class>();
+ for(String[] binding : bindings) {
+ StringBuffer methodToInvoke = new StringBuffer();
+ StringBuffer oldBinding = new StringBuffer();
+ for(String s : binding) {
+ log.info("old : " + s);
+ methodToInvoke.append(s.replaceAll("\\W", ""));
+ oldBinding.append(s).append(".");
+ }
+ oldBinding.setLength(oldBinding.length() - 1);
+ listeners.addAll(gen.generateBindings(dbCreation, dbDeletion, null, jf, null, binding, 0, null, methodToInvoke.toString(), generatedFiles));
+ //JavaArgument[] args = new JavaArgument[]{new JavaArgument(parameterType.getName(), "event")};
+ StringBuffer newBinding = new StringBuffer();
+ for(String s : binding) {
+ log.info("new : " + s);
+ newBinding.append(s).append(".");
+ }
+ newBinding.setLength(newBinding.length() - 1);
+ log.info(gen.getBindingsToGenerate().get(field).get(attr) + " : " + oldBinding + " - " + newBinding.toString());
+ gen.getBindingsToGenerate().get(field)
+ .put(attr, gen.getBindingsToGenerate().get(field).get(attr).replace(oldBinding.toString(), newBinding.toString()));
+
+ if (jf.getMethod("onChangeFrom" + methodToInvoke, /*args*/null) == null) {
+ jf.addMethod(new JavaMethod(Modifier.PUBLIC, "void", "onChangeFrom" + methodToInvoke.toString(), /*args*/null, null, /*"_DataSource" + dataSourceNumber + ".propertyChange(null);"*/"processDataBinding(\"" + field + "." + attr + "\");", null));
+ }
+ else {
+ jf.getMethod("onChangeFrom" + methodToInvoke.toString(), /*args*/null).appendBodyCode(/*"_DataSource" + dataSourceNumber + ".propertyChange(null);"*/"processDataBinding(\"" + field + "." + attr + "\");", "\n");
+ }
+ }
+ dbCreation.append("}\n");
+ dbDeletion.append("}\n");
+ dbProcess.append(gen.getBindingsToGenerate().get(field).get(attr))
+ .append(");\n}\n");
+ if(listeners != null) {
+ //jf.addField(new JavaField(Modifier.PRIVATE, "java.beans.PropertyChangeListener", "_DataSource" + dataSourceNumber, "new org.nuiton.guix.runtime.DataBindingListener(this,\"" + field + "." + attr + "\")", null, null));
+ jf.getMethod("initDataBinding", null).appendBodyCode("applyDataBinding(\"" + field + "." + attr + "\");", "\n");
+ for(Class listener : listeners) {
+ final List<Method> listenerMethods = Arrays.asList(listener.getMethods());
+ Class parameterType = listenerMethods.get(0).getParameterTypes()[0];
+ }
+ }
+ dataSourceNumber++;
+ }
}
+ if(generatedFiles.get(jf.getSuperClass()) != null) {
+ dbCreation.append("else {\nsuper.applyDataBinding(_binding);\n" +
+ "return;\n}");
+ dbDeletion.append("\nelse {\nsuper.removeDataBinding(_binding);\n}\n");
+ }
+ dbCreation.append("\nprocessDataBinding(_binding);");
+ dbProcess.insert(0, "if (activeBindings.contains(_binding)) {\n" +
+ "return;\n}\n" +
+ "activeBindings.add(_binding);\ntry{\n");
+ dbProcess.append("\n} finally {\nactiveBindings.remove(_binding);\n}\n");
+ jf.addField(new JavaField(Modifier.PRIVATE, "java.util.List<String>", "activeBindings", "new java.util.ArrayList<String>()", "List of the active bindings", null), false);
+ jf.addMethod(new JavaMethod(Modifier.PUBLIC, "void", "applyDataBinding", new JavaArgument[]{new JavaArgument("String", "_binding")}, null, dbCreation.toString(), null));
+ jf.addMethod(new JavaMethod(Modifier.PUBLIC, "void", "removeDataBinding", new JavaArgument[]{new JavaArgument("String", "_binding")}, null, dbDeletion.toString(), null));
+ jf.addMethod(new JavaMethod(Modifier.PUBLIC, "void", "processDataBinding", new JavaArgument[]{new JavaArgument("String", "_binding")}, null, dbProcess.toString(), null));
+ gen.saveFiles();
}
serializer.endTag("", "beans");
serializer.endDocument();
@@ -251,6 +374,7 @@
}
}
+
/**
* Registers a ClassDescriptor
*
@@ -305,4 +429,17 @@
}
return classDescriptors.get(i);
}
+
+ private List<String> browseNode(SimpleNode node) {
+ List<String> result = new ArrayList<String>();
+ for(int i = 0 ; i < node.jjtGetNumChildren() ; i++) {
+ if(node.getChild(i).getId() == JavaParserTreeConstants.JJTPRIMARYEXPRESSION
+ && !node.getChild(i).getText().trim().startsWith("(")
+ && !node.getChild(i).getText().trim().startsWith("\"")) {
+ result.add(node.getChild(i).getText().trim());
+ }
+ result.addAll(browseNode(node.getChild(i)));
+ }
+ return result;
+ }
}
Added: trunk/guix-compiler/src/main/java/org/nuiton/guix/GuixLauncher1.java
===================================================================
--- trunk/guix-compiler/src/main/java/org/nuiton/guix/GuixLauncher1.java (rev 0)
+++ trunk/guix-compiler/src/main/java/org/nuiton/guix/GuixLauncher1.java 2009-07-22 13:06:26 UTC (rev 1500)
@@ -0,0 +1,372 @@
+/**
+ * *##% guix-compiler
+ * Copyright (C) 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 org.nuiton.guix;
+
+import java.beans.BeanInfo;
+import java.beans.PropertyChangeListener;
+import org.nuiton.guix.compiler.GuixCompiler;
+import java.io.File;
+import java.io.PrintWriter;
+import java.lang.reflect.Method;
+import java.lang.reflect.Modifier;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.EventListener;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.nuiton.guix.generator.Generator;
+import org.nuiton.guix.generator.GuixGenerator;
+import org.nuiton.guix.generator.JavaArgument;
+import org.nuiton.guix.generator.JavaField;
+import org.nuiton.guix.generator.JavaFile;
+import org.nuiton.guix.generator.JavaMethod;
+import org.nuiton.guix.model.ClassDescriptor;
+import org.nuiton.guix.model.GuixModelObject;
+import org.nuiton.guix.tags.TagHandler;
+import org.nuiton.guix.tags.TagManager;
+import org.xmlpull.v1.XmlPullParserFactory;
+import org.xmlpull.v1.XmlSerializer;
+
+/**
+ * Launch Guix files compilation
+ *
+ * @author morin
+ */
+public class GuixLauncher1 {
+
+ /** log */
+ protected static final Log log = LogFactory.getLog(GuixLauncher1.class);
+ /** original list of files to compile */
+ protected final File[] files;
+ /** original list of classes to compile */
+ protected final String[] classNames;
+ /** Files to be treated while compilation. */
+ protected List<File> guixFiles = new ArrayList<File>();
+ /** Class names corresponding to the files in the guixFiles list. */
+ protected List<String> guixFileClassNames = new ArrayList<String>();
+ /** Maps the root GuixModelObjects being compiled to the compiler instance
+ * handling the compilation. */
+ protected Map<GuixModelObject, Long> rootModelObjects =
+ new HashMap<GuixModelObject, Long>();
+ /** CLassDescriptor met during the compilation */
+ protected List<ClassDescriptor> classDescriptors =
+ new ArrayList<ClassDescriptor>();
+ private List<File> compiledFiles = new ArrayList<File>();
+ private Map<GuixGenerator,JavaFile> generatedFiles = new HashMap<GuixGenerator,JavaFile>();
+ protected int compilerCount;
+ private File targetDirectory;
+ private String rootPackage;
+ private String mainClass;
+ private Class generatorClass;
+ private String launcherName;
+
+ /**
+ * Constructor
+ *
+ * @param files the files to compile
+ */
+ public GuixLauncher1(File[] files, File targetDirectory, String rootPackage,
+ File baseDir, String mainClass, Class generatorClass, String launcherName) {
+ // Set up a simple configuration that logs on the console.
+ this.files = files;
+ this.targetDirectory = targetDirectory;
+ this.rootPackage = rootPackage != null ? rootPackage : "";
+ if (files != null) {
+ classNames = new String[files.length];
+ for (int i = 0; i < files.length; i++) {
+ String path = files[i].getAbsolutePath();
+ if (baseDir != null) {
+ classNames[i] = rootPackage + "." + path.substring(baseDir.getAbsolutePath().length() + 1,
+ path.lastIndexOf('.')).replace(File.separatorChar, '.');
+ }
+ else {
+ classNames[i] = path.substring(0, path.lastIndexOf('.'));
+ }
+ }
+ }
+ else {
+ classNames = null;
+ }
+ this.mainClass = mainClass != null ? mainClass : "";
+ this.launcherName = launcherName != null ? launcherName : "Main";
+ this.generatorClass = generatorClass;
+ }
+
+ /**
+ * Compiled a set of files.
+ *
+ * @return <code>true</code> if compilation succeeds,
+ * <code>false</code> otherwise
+ */
+ public synchronized boolean compile() {
+ compilerCount = 0;
+ File destDir = targetDirectory;
+ if (files != null) {
+ if (log.isInfoEnabled()) {
+ log.info("Start compiling");
+ }
+ guixFiles.addAll(Arrays.asList(files));
+ guixFileClassNames.addAll(Arrays.asList(classNames));
+ boolean success = true;
+
+ try {
+ assert guixFiles.size() == guixFileClassNames.size();
+
+ for (int i = 0; i < guixFiles.size(); i++) {
+ File file = guixFiles.get(i);
+ String className = guixFileClassNames.get(i);
+
+ //if we have not compiled the file yet
+ if (!compiledFiles.contains(file)) {
+ if (log.isInfoEnabled()) {
+ log.info("Compiling class " + className);
+ }
+ compiledFiles.add(file);
+
+ String classPackage;
+ if (targetDirectory != null) {
+ int dotPos = className.lastIndexOf(".");
+ if (dotPos != -1) {
+ destDir = new File(targetDirectory, className.substring(0, dotPos).replace('.', File.separatorChar));
+ classPackage = className.substring(0, dotPos);
+ }
+ else {
+ destDir = new File(targetDirectory, className);
+ classPackage = className;
+ }
+ if (!destDir.exists() && !destDir.mkdirs()) {
+ if (log.isWarnEnabled()) {
+ log.warn("couldn't create directory " + destDir);
+ }
+ continue;
+ }
+ }
+ else {
+ destDir = file.getParentFile();
+ classPackage = destDir.getAbsolutePath().replace(File.separatorChar, '.');
+ }
+ //compile the file
+ // GuixCompiler compiler = new GuixCompiler(file, this, classPackage);
+ GuixCompiler compiler = null;
+
+ GuixModelObject rootModelObject = compiler.compile();
+ rootModelObjects.put(rootModelObject, compiler.getLastModification());
+
+ if (compiler.isFailed()) {
+ success = false;
+ }
+ }
+ else {
+ if (log.isWarnEnabled()) {
+ log.warn(file.getName() + " has already been compiled.");
+ }
+ }
+ }
+
+ if (success) {
+ int i = 0;
+ while (success && i < classDescriptors.size()) {
+ success = (classDescriptors.get(i).getPackageName() != null || TagManager.getGuixClassHandler(classDescriptors.get(i).getName()) != null);
+ i++;
+ }
+ if (!success) {
+ if (log.isErrorEnabled()) {
+ log.error("The class '" + classDescriptors.get(--i).getName() + "' has no package.");
+ }
+ }
+ }
+
+ if (generatorClass != null) {
+ //creates the XML serializer for the spring conf
+ XmlPullParserFactory factory =
+ XmlPullParserFactory.newInstance(
+ System.getProperty(XmlPullParserFactory.PROPERTY_NAME),
+ null);
+ XmlSerializer serializer = factory.newSerializer();
+
+ File config = new File(targetDirectory,"config.xml");
+
+ serializer.setOutput(new PrintWriter(config));
+ serializer.startDocument("UTF-8", null);
+ serializer.setProperty("http://xmlpull.org/v1/doc/properties.html#serializer-line-separator", "\n");
+ serializer.setProperty("http://xmlpull.org/v1/doc/properties.html#serializer-indentation", "\t");
+ serializer.text("\n");
+ serializer.docdecl(" beans SYSTEM \"http://www.springframework.org/dtd/spring-beans.dtd\"");
+ serializer.text("\n");
+ serializer.startTag("", "beans");
+
+ for (GuixModelObject mo : rootModelObjects.keySet()) {
+ try {
+ GuixGenerator gen = (GuixGenerator) generatorClass.newInstance();
+ gen.setDestDir(destDir);
+ gen.setGmo(mo);
+ gen.setLastModification(rootModelObjects.get(mo));
+ gen.setMainClass((mo.getClassDescriptor().getPackageName() + "." + mo.getClassDescriptor().getName()).equals(mainClass));
+ gen.setSerializer(serializer);
+ gen.setClasses(Arrays.asList(classNames));
+ gen.setLauncherName(launcherName);
+ generatedFiles.put(gen,gen.generate());
+ }
+ catch (InstantiationException eee) {
+ if(log.isErrorEnabled())
+ log.error(eee);
+ }
+ catch (IllegalAccessException eee) {
+ if(log.isErrorEnabled())
+ log.error(eee);
+ }
+ }
+ for(GuixGenerator gen : generatedFiles.keySet()) {
+ int dataSourceNumber = 0;
+ StringBuffer dbCreation = new StringBuffer();
+ StringBuffer dbDeletion = new StringBuffer();
+ StringBuffer dbProcess = new StringBuffer();
+ JavaFile jf = generatedFiles.get(gen);
+ for(String field : gen.getBindingsToGenerate().keySet()) {
+ for(String attr : gen.getBindingsToGenerate().get(field).keySet()) {
+ dbCreation.append(dbCreation.length() != 0 ? "else if(\"" : "if(\"").append(field)
+ .append(".").append(attr)
+ .append("\".equals(_binding)) {\n");
+ dbDeletion.append(dbDeletion.length() != 0 ? "else if(\"" : "if(\"").append(field)
+ .append(".").append(attr)
+ .append("\".equals(_binding)) {\n");
+ dbProcess.append(dbProcess.length() != 0 ? "else if(\"" : "if(\"").append(field)
+ .append(".").append(attr)
+ .append("\".equals(_binding)) {\n")
+ .append(field).append(".set")
+ .append(Character.toUpperCase(attr.charAt(0)))
+ .append(attr.substring(1))
+ .append("(");
+ String[] binding = gen.getBindingsToGenerate().get(field).get(attr).split("\\s*\\.\\s*");
+ String methodToInvoke = gen.getBindingsToGenerate().get(field).get(attr).replaceAll("\\W", "");
+ List<Class> listeners = gen.generateBindings(dbCreation, dbDeletion, null, jf, null,null, 0, null, methodToInvoke, generatedFiles);
+ dbCreation.append("}\n");
+ dbDeletion.append("}\n");
+ dbProcess.append(");\n}\n");
+ if(listeners != null) {
+ jf.addField(new JavaField(Modifier.PRIVATE, "java.beans.PropertyChangeListener", "_DataSource" + dataSourceNumber, "new org.nuiton.guix.runtime.DataBindingListener(this,\"" + field + "." + attr + "\")", null, null));
+ jf.getMethod("initDataBinding", null).appendBodyCode("applyDataBinding(\"" + field + "." + attr + "\");", "\n");
+ for(Class listener : listeners) {
+ final List<Method> listenerMethods = Arrays.asList(listener.getMethods());
+ Class parameterType = listenerMethods.get(0).getParameterTypes()[0];
+ JavaArgument[] args = new JavaArgument[]{new JavaArgument(parameterType.getName(), "event")};
+ if (jf.getMethod("onChangeFrom" + methodToInvoke, args) == null) {
+ jf.addMethod(new JavaMethod(Modifier.PUBLIC, "void", "onChangeFrom" + methodToInvoke, args, null, "_DataSource" + dataSourceNumber + ".propertyChange(null);", null));
+ }
+ else {
+ jf.getMethod("onChangeFrom" + methodToInvoke, args).appendBodyCode("_DataSource" + dataSourceNumber + ".propertyChange(null);", "\n");
+ }
+ }
+ }
+ dataSourceNumber++;
+ }
+ }
+ if(generatedFiles.get(jf.getSuperClass()) != null) {
+ dbCreation.append("else {\nsuper.applyDataBinding(_binding);\n" +
+ "return;\n}");
+ dbDeletion.append("\nelse {\nsuper.removeDataBinding(_binding);\n}\n");
+ }
+ dbCreation.append("\nprocessDataBinding(_binding);");
+ jf.addMethod(new JavaMethod(Modifier.PUBLIC, "void", "applyDataBinding", new JavaArgument[]{new JavaArgument("String", "_binding")}, null, dbCreation.toString(), null));
+ jf.addMethod(new JavaMethod(Modifier.PUBLIC, "void", "removeDataBinding", new JavaArgument[]{new JavaArgument("String", "_binding")}, null, dbDeletion.toString(), null));
+ jf.addMethod(new JavaMethod(Modifier.PUBLIC, "void", "processDataBinding", new JavaArgument[]{new JavaArgument("String", "_binding")}, null, dbProcess.toString(), null));
+ gen.saveFiles();
+ }
+ serializer.endTag("", "beans");
+ serializer.endDocument();
+ }
+ else {
+ if(log.isWarnEnabled()) {
+ log.warn("No generation language given");
+ }
+ }
+ }
+ catch (Throwable e) {
+ e.printStackTrace();
+ return false;
+ }
+ return success;
+ }
+ else {
+ if (log.isWarnEnabled()) {
+ log.warn("No file to compile");
+ }
+ return true;
+ }
+ }
+
+
+ /**
+ * Registers a ClassDescriptor
+ *
+ * @param classDescriptor the ClassDescripor to register
+ * @return false if another ClassDescriptor with the same classname
+ * and package has a different script or superclass
+ */
+ public ClassDescriptor registerClassDescriptor(ClassDescriptor classDescriptor) {
+ if (classDescriptor == null || classDescriptor.getName() == null) {
+ return null;
+ }
+ int i = 0;
+ while (i < classDescriptors.size() && (!classDescriptors.get(i).getName().equals(classDescriptor.getName()) || (classDescriptors.get(i).getPackageName() != null && classDescriptor.getPackageName() != null && !classDescriptors.get(i).getPackageName().equals(classDescriptor.getPackageName())))) {
+ i++;
+ }
+ //if the ClassDescriptor does not exist
+ if (i >= classDescriptors.size()) {
+ classDescriptors.add(classDescriptor);
+ if (log.isDebugEnabled()) {
+ log.debug("new ClassDescriptor " + classDescriptor + " inserted");
+ }
+ return classDescriptor;
+ }
+ classDescriptors.get(i).setPackageName(classDescriptor.getPackageName());
+ if (classDescriptor.getScript() != null) {
+ if (classDescriptors.get(i).getScript() == null) {
+ classDescriptors.get(i).setScript(classDescriptor.getScript());
+ if (log.isDebugEnabled()) {
+ log.debug("add script to ClassDescriptor " + classDescriptor);
+ }
+ }
+ else if (!classDescriptors.get(i).getScript().equals(classDescriptor.getScript())) {
+ if (log.isDebugEnabled()) {
+ log.error("ClassDescriptor " + classDescriptor + " script already defined and different !");
+ }
+ return null;
+ }
+ }
+ if (classDescriptor.getSuperClass() != null) {
+ if (classDescriptors.get(i).getSuperClass() == null) {
+ classDescriptors.get(i).setSuperClass(classDescriptor.getSuperClass());
+ if (log.isDebugEnabled()) {
+ log.debug("add superclass to ClassDescriptor " + classDescriptor);
+ }
+ }
+ else if (!classDescriptors.get(i).getSuperClass().equals(classDescriptor.getSuperClass())) {
+ if (log.isErrorEnabled()) {
+ log.error("ClassDescriptor " + classDescriptor + " superclass already defined and different !");
+ }
+ return null;
+ }
+ }
+ return classDescriptors.get(i);
+ }
+}
Modified: trunk/guix-compiler/src/main/java/org/nuiton/guix/databinding/BindingUtils.java
===================================================================
--- trunk/guix-compiler/src/main/java/org/nuiton/guix/databinding/BindingUtils.java 2009-07-22 13:03:32 UTC (rev 1499)
+++ trunk/guix-compiler/src/main/java/org/nuiton/guix/databinding/BindingUtils.java 2009-07-22 13:06:26 UTC (rev 1500)
@@ -88,24 +88,25 @@
expression.append(escapeJavaString(stringValue.substring(lastPos)));
expression.append('"');
}
-
- StringBuffer el = new StringBuffer();
- Pattern p = Pattern .compile("\\.(get|is)([A-Z])([a-zA-Z0-9]*)\\(\\)");
- Matcher m = p.matcher(expression.toString());
- int mEnd = 0;
- if(m.find()) {
- do {
- el.append(expression.toString().substring(mEnd, m.start()))
- .append(".");
- mEnd = m.end();
- el.append(m.group(2).toLowerCase())
- .append(m.group(3));
- } while (m.find());
- }
- else {
- el.append(expression.toString());
- }
- return el.toString().length() > 0 ? el.toString().substring(0, el.toString().length()) : el.toString();
+//
+// StringBuffer el = new StringBuffer();
+// Pattern p = Pattern .compile("\\.(get|is)([A-Z])([a-zA-Z0-9]*)\\(\\)");
+// Matcher m = p.matcher(expression.toString());
+// int mEnd = 0;
+// if(m.find()) {
+// do {
+// el.append(expression.toString().substring(mEnd, m.start()))
+// .append(".");
+// mEnd = m.end();
+// el.append(m.group(2).toLowerCase())
+// .append(m.group(3));
+// } while (m.find());
+// }
+// else {
+// el.append(expression.toString());
+// }
+// return el.toString().length() > 0 ? el.toString().substring(0, el.toString().length()) : el.toString();
+ return expression.toString();
}
return null;
}
Added: trunk/guix-compiler/src/main/java/org/nuiton/guix/databinding/DataBinding.java
===================================================================
--- trunk/guix-compiler/src/main/java/org/nuiton/guix/databinding/DataBinding.java (rev 0)
+++ trunk/guix-compiler/src/main/java/org/nuiton/guix/databinding/DataBinding.java 2009-07-22 13:06:26 UTC (rev 1500)
@@ -0,0 +1,92 @@
+/*
+ * Copyright 2006 Ethan Nicholas. All rights reserved.
+ * Use is subject to license terms.
+ */
+package org.nuiton.guix.databinding;
+
+import org.nuiton.guix.CompilerException;
+import org.nuiton.guix.compiler.GuixCompiler;
+
+/**
+ * Represents a data binding in a JAXX file. <code>DataBinding</code> uses {@link DataSource} to
+ * track changes to a source expression and update the destination.
+ */
+public class DataBinding {
+ private String id;
+
+ /** The DatSource which tracks source expression changes. */
+ private DataSource dataSource;
+
+ /** The data binding destination in the form <code><id>.<propertyName></code>. */
+ private String dest;
+
+ /**
+ * A Java snippet which will cause the destination property to be updated with the current value of
+ * the binding.
+ */
+ private String assignment;
+
+ /** The current <code>GuixCompiler</code>. */
+ private GuixCompiler compiler;
+
+
+ /**
+ * Creates a new data binding.
+ *
+ * @param source the Java source code for the data binding expression
+ * @param dest the data binding destination in the form <code><id>.<propertyName></code>
+ * @param assignment Java snippet which will cause the destination property to be updated with the current value of the binding
+ * @param compiler the current <code>JAXXCompiler</code>
+ */
+ public DataBinding(String source, String dest, String assignment, GuixCompiler compiler) {
+ this.id = dest;
+ this.dataSource = new DataSource(id, source);
+ this.dest = dest;
+ this.assignment = assignment;
+ this.compiler = compiler;
+ }
+
+
+ public String getId() {
+ return id;
+ }
+
+
+ /**
+ * Compiles the data binding expression. This method calls methods in <code>JAXXCompiler</code>
+ * to add the Java code that performs the data binding setup.
+ *
+ * @param quickNoDependencies true to optimize bindings with no dependencies by simply running them at startup time
+ * @return <code>true</code> if the expression has dependencies, <code>false</code> otherwise
+ * @throws CompilerException if a compilation error occurs
+ */
+// public boolean compile(boolean quickNoDependencies) throws CompilerException {
+// // DataSource.compile handles all of the listener additions
+// boolean result = dataSource.compile("new jaxx.runtime.DataBindingListener(" + compiler.getRootObject().getJavaCode() + ", " + TypeManager.getJavaCode(id) + ")");
+//
+// if (!result && quickNoDependencies) {
+// if (!dest.endsWith(".layout")) // layout is specially handled early in the chain
+// {
+// compiler.appendInitDataBindings(assignment + JAXXCompiler.getLineSeparator());
+// }
+// return false; // no dependencies, just a static expression
+// }
+// if (compiler.haveProcessDataBinding()) {
+// compiler.appendProcessDataBinding(" else ");
+// } else {
+// compiler.appendProcessDataBinding(" ");
+// }
+// compiler.appendProcessDataBinding("if (" + TypeManager.getJavaCode(id) + ".equals($dest)) {" + JAXXCompiler.getLineSeparator());
+// String objectCode = dataSource.getObjectCode();
+// if (objectCode != null) {
+// compiler.appendProcessDataBinding(" if (" + objectCode + " != null) {" + JAXXCompiler.getLineSeparator());
+// compiler.appendProcessDataBinding(" ");
+// }
+// compiler.appendProcessDataBinding(" " + assignment.trim());
+// if (objectCode != null) {
+// compiler.appendProcessDataBinding(JAXXCompiler.getLineSeparator() + " }");
+// }
+// compiler.appendProcessDataBinding(JAXXCompiler.getLineSeparator() + " }");
+// return true;
+// }
+}
\ No newline at end of file
Added: trunk/guix-compiler/src/main/java/org/nuiton/guix/databinding/DataSource.java
===================================================================
--- trunk/guix-compiler/src/main/java/org/nuiton/guix/databinding/DataSource.java (rev 0)
+++ trunk/guix-compiler/src/main/java/org/nuiton/guix/databinding/DataSource.java 2009-07-22 13:06:26 UTC (rev 1500)
@@ -0,0 +1,460 @@
+/*
+ * Copyright 2006 Ethan Nicholas. All rights reserved.
+ * Use is subject to license terms.
+ */
+package org.nuiton.guix.databinding;
+
+import java.beans.Introspector;
+import java.beans.PropertyChangeListener;
+import java.io.StringReader;
+import java.lang.reflect.Modifier;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.List;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.nuiton.guix.CompilerException;
+import org.nuiton.guix.UnsupportedAttributeException;
+import org.nuiton.guix.generator.JavaField;
+import org.nuiton.guix.parser.JavaParser;
+import org.nuiton.guix.parser.JavaParserConstants;
+import org.nuiton.guix.parser.JavaParserTreeConstants;
+import org.nuiton.guix.parser.SimpleNode;
+import org.nuiton.guix.tags.DefaultTagHandler;
+import org.nuiton.guix.tags.TagHandler;
+import org.nuiton.guix.tags.TagManager;
+
+/**
+ * Represents a Java expression which fires a <code>PropertyChangeEvent</code> when it can be
+ * determined that its value may have changed. Events are fired on a "best effort" basis, and events
+ * may either be fired too often (the value has not actually changed) or not often enough (the value
+ * changed but no event was fired).
+ */
+public class DataSource {
+ private class NULL {
+ } // type attached to "null" constants in parsed expressions
+
+ private Log log = LogFactory.getLog(DataSource.class);
+
+ private String id;
+
+ /** The Java source code for the expression. */
+ private String source;
+
+ /** The current <code>JAXXCompiler</code>. */
+ //private JAXXCompiler compiler;
+
+ /** List of symbols which this data source expression depends on. */
+ private List<String> dependencySymbols = new ArrayList<String>();
+
+ private StringBuffer addListenerCode = new StringBuffer();
+ private StringBuffer removeListenerCode = new StringBuffer();
+ private boolean compiled;
+
+ /** the delegate of property to be required */
+ private String objectCode;
+
+ /**
+ * Creates a new data source. After creating a <code>DataSource</code>, use {@link #compile}
+ * to cause it to function at runtime.
+ *
+ * @param id the DataSource's id
+ * @param source the Java source code for the data source expression
+ * @param compiler the current <code>JAXXCompiler</code>
+ */
+ public DataSource(String id, String source) {
+ this.id = id;
+ this.source = source;
+ }
+
+
+ public String getId() {
+ return id;
+ }
+
+ public String getSource() {
+ return source;
+ }
+
+ public String getObjectCode() {
+ return objectCode;
+ }
+
+ /**
+ * Compiles the data source expression and listener. This method calls methods in <code>JAXXCompiler</code>
+ * to add the Java code that performs the data source setup. Adding listeners to <code>DataSource</code> is
+ * slightly more complicated than with ordinary classes, because <code>DataSource</code> only exists at compile
+ * time. You must pass in a Java expression which evaluates to a <code>PropertyChangeListener</code>; this
+ * expression will be compiled and evaluated at runtime to yield the <code>DataSource's</code> listener.
+ *
+ * @param propertyChangeListenerCode Java code snippet which evaluates to a <code>PropertyChangeListener</code>
+ * @return <code>true</code> if the expression has dependencies, <code>false</code> otherwise
+ * @throws CompilerException if a compilation error occurs
+ */
+// public boolean compile(String propertyChangeListenerCode) throws CompilerException {
+// if (compiled) {
+// throw new IllegalStateException(this + " has already been compiled");
+// }
+// String id = "";
+// JavaParser p = new JavaParser(new StringReader(source + ";"));
+// while (!p.Line()) {
+// SimpleNode node = p.popNode();
+// scanNode(node, id);
+// }
+//
+// if (dependencySymbols.size() > 0) {
+// //TC 20081108 prefer add a real JavaField instead of raw code
+// //compiler.appendBodyCode("private PropertyChangeListener " + id + " = " + propertyChangeListenerCode + ";\n");
+// compiler.addSimpleField(new JavaField(Modifier.PRIVATE, PropertyChangeListener.class.getName(), id, propertyChangeListenerCode));
+// }
+//
+// compileListeners();
+// compiled = true;
+//
+// return dependencySymbols.size() > 0;
+// }
+//
+// /** @return a list of symbols on which this data source depends. */
+// public Collection<String> getDependencies() {
+// return Collections.unmodifiableList(dependencySymbols);
+// }
+//
+// /**
+// * Examines a node to identify any dependencies it contains.
+// *
+// * @param node node to scan
+// * @param listenerId id of listener
+// * @throws jaxx.CompilerException ?
+// */
+// private void scanNode(SimpleNode node, String listenerId) throws CompilerException {
+// switch (node.getId()) {
+// case JavaParserTreeConstants.JJTMETHODDECLARATION:
+// break;
+// case JavaParserTreeConstants.JJTFIELDDECLARATION:
+// break;
+//
+// default:
+// int count = node.jjtGetNumChildren();
+// for (int i = 0; i < count; i++) {
+// scanNode(node.getChild(i), listenerId);
+// }
+// determineNodeType(node, listenerId);
+// }
+// }
+//
+// private Class determineLiteralType(SimpleNode node) {
+// assert node.getId() == JavaParserTreeConstants.JJTLITERAL;
+// if (node.jjtGetNumChildren() == 1) {
+// int id = node.getChild(0).getId();
+// if (id == JavaParserTreeConstants.JJTBOOLEANLITERAL) {
+// return boolean.class;
+// }
+// if (id == JavaParserTreeConstants.JJTNULLLITERAL) {
+// return null;
+// }
+// throw new RuntimeException("Expected BooleanLiteral or NullLiteral, found " + JavaParserTreeConstants.jjtNodeName[id]);
+// }
+// int id = node.firstToken.kind;
+// switch (id) {
+// case JavaParserConstants.INTEGER_LITERAL:
+// if (node.firstToken.image.toLowerCase().endsWith("l")) {
+// return long.class;
+// }
+// return int.class;
+// case JavaParserConstants.CHARACTER_LITERAL:
+// return char.class;
+// case JavaParserConstants.FLOATING_POINT_LITERAL:
+// if (node.firstToken.image.toLowerCase().endsWith("f")) {
+// return float.class;
+// }
+// return double.class;
+// case JavaParserConstants.STRING_LITERAL:
+// return String.class;
+// default:
+// throw new RuntimeException("Expected literal token, found " + JavaParserConstants.tokenImage[id]);
+// }
+// }
+//
+// /**
+// * Scans through a compound symbol (foo.bar.baz) to identify and track all trackable pieces of it.
+// *
+// * @param symbol symbol to scan
+// * @param contextClass current class context
+// * @param isMethod flag to search a method
+// * @param listenerId id of the listener
+// * @return the type of the symbol (or null if it could not be determined).
+// */
+// private Class scanCompoundSymbol(String symbol, Class contextClass, boolean isMethod, String listenerId) {
+// String[] tokens = symbol.split("\\s*\\.\\s*");
+// StringBuffer currentSymbol = new StringBuffer();
+// StringBuffer tokensSeenSoFar = new StringBuffer();
+// boolean accepted; // if this ends up false, it means we weren't able to figure out
+// // which object the method is being invoked on
+// boolean recognizeClassNames = true;
+// for (int j = 0; j < tokens.length - (isMethod ? 1 : 0); j++) {
+// accepted = false;
+//
+// if (tokensSeenSoFar.length() > 0) {
+// tokensSeenSoFar.append('.');
+// }
+// tokensSeenSoFar.append(tokens[j]);
+// if (currentSymbol.length() > 0) {
+// currentSymbol.append('.');
+// }
+// currentSymbol.append(tokens[j]);
+//
+// if (currentSymbol.indexOf(".") == -1) {
+// String memberName = currentSymbol.toString();
+// CompiledObject object = compiler.getCompiledObject(memberName);
+// if (object != null) {
+// contextClass = object.getObjectClass();
+// currentSymbol.setLength(0);
+// accepted = true;
+// recognizeClassNames = false;
+// } else {
+// try {
+// FieldDescriptor field = contextClass.getFieldDescriptor(memberName);
+// trackMemberIfPossible(tokensSeenSoFar.toString(), contextClass, field.getName(), false, listenerId);
+// contextClass = field.getType();
+// currentSymbol.setLength(0);
+// accepted = true;
+// recognizeClassNames = false;
+// }
+// catch (NoSuchFieldException e) {
+// if (j == 0 || j == 1 && tokens[0].equals(compiler.getRootObject().getId())) { // still in root context
+// FieldDescriptor[] newFields = compiler.getScriptFields();
+// for (FieldDescriptor newField : newFields) {
+// if (newField.getName().equals(memberName)) {
+// addListener(tokensSeenSoFar.toString(),
+// null,
+// "addPropertyChangeListener(\"" + memberName + "\", " + listenerId + ");" + JAXXCompiler.getLineSeparator(),
+// "removePropertyChangeListener(\"" + memberName + "\", " + listenerId + ");" + JAXXCompiler.getLineSeparator());
+// contextClass = newField.getType();
+// assert contextClass != null : "script field '" + memberName + "' is defined, but has type null";
+// currentSymbol.setLength(0);
+// accepted = true;
+// recognizeClassNames = false;
+// break;
+// }
+// }
+// }
+// }
+// }
+// }
+// if (currentSymbol.length() > 0 && recognizeClassNames) {
+// contextClass = TagManager.resolveClass(currentSymbol.toString(), compiler);
+// if (contextClass != null) {
+// currentSymbol.setLength(0);
+// //accepted = true;
+// //recognizeClassNames = false;
+// // TODO: for now we don't handle statics
+// return null;
+// }
+// }
+// if (!accepted) {
+// return null;
+// }
+// }
+//
+// return contextClass;
+// }
+//
+// /**
+// * Adds type information to nodes where possible, and as a side effect adds event listeners to nodes which
+// * can be tracked.
+// *
+// * @param expression the node to scan
+// * @param listenerId id of the listener
+// * @return the class descriptor of the return type or null
+// */
+// private Class determineExpressionType(SimpleNode expression, String listenerId) {
+// assert expression.getId() == JavaParserTreeConstants.JJTPRIMARYEXPRESSION;
+// SimpleNode prefix = expression.getChild(0);
+// if (prefix.jjtGetNumChildren() == 1) {
+// int type = prefix.getChild(0).getId();
+// if (type == JavaParserTreeConstants.JJTLITERAL || type == JavaParserTreeConstants.JJTEXPRESSION) {
+// prefix.setJavaType(prefix.getChild(0).getJavaType());
+// } else if (type == JavaParserTreeConstants.JJTNAME && expression.jjtGetNumChildren() == 1) // name with no arguments after it
+// {
+// prefix.setJavaType(scanCompoundSymbol(prefix.getText().trim(), compiler.getRootObject().getObjectClass(), false, listenerId));
+// }
+// }
+//
+// if (expression.jjtGetNumChildren() == 1) {
+// return prefix.getJavaType();
+// }
+//
+// Class contextClass = prefix.getJavaType();
+// if (contextClass == null) {
+// contextClass = compiler.getRootObject().getObjectClass();
+// }
+// String lastNode = prefix.getText().trim();
+//
+// for (int i = 1; i < expression.jjtGetNumChildren(); i++) {
+// SimpleNode suffix = expression.getChild(i);
+// if (suffix.jjtGetNumChildren() == 1 && suffix.getChild(0).getId() == JavaParserTreeConstants.JJTARGUMENTS) {
+// if (suffix.getChild(0).jjtGetNumChildren() == 0) { // at the moment only no-argument methods are trackable
+// contextClass = scanCompoundSymbol(lastNode, contextClass, true, listenerId);
+// if (contextClass == null) {
+// return null;
+// }
+// int dotPos = lastNode.lastIndexOf(".");
+// String objectCode = dotPos == -1 ? "" : lastNode.substring(0, dotPos);
+// for (int j = i - 2; j >= 0; j--) {
+// objectCode = expression.getChild(j).getText() + objectCode;
+// }
+// if (objectCode.length() == 0) {
+// objectCode = compiler.getRootObject().getJavaCode();
+// }
+// String methodName = lastNode.substring(dotPos + 1).trim();
+// try {
+// MethodDescriptor method = contextClass.getMethodDescriptor(methodName);
+// trackMemberIfPossible(objectCode, contextClass, method.getName(), true, listenerId);
+// return method.getReturnType();
+// }
+// catch (NoSuchMethodException e) {
+// // happens for methods defined in the current JAXX file via scripts
+// String propertyName = null;
+// if (methodName.startsWith("is")) {
+// propertyName = Introspector.decapitalize(methodName.substring("is".length()));
+// } else if (methodName.startsWith("get")) {
+// propertyName = Introspector.decapitalize(methodName.substring("get".length()));
+// }
+// if (propertyName != null) {
+// MethodDescriptor[] newMethods = compiler.getScriptMethods();
+// for (MethodDescriptor newMethod : newMethods) {
+// if (newMethod.getName().equals(methodName)) {
+// addListener(compiler.getRootObject().getId(),
+// null,
+// "addPropertyChangeListener(\"" + propertyName + "\", " + listenerId + ");" + JAXXCompiler.getLineSeparator(),
+// "removePropertyChangeListener(\"" + propertyName + "\", " + listenerId + ");" + JAXXCompiler.getLineSeparator());
+// contextClass = newMethod.getReturnType();
+// break;
+// }
+// }
+// }
+// }
+// }
+// }
+// lastNode = suffix.getText().trim();
+// if (lastNode.startsWith(".")) {
+// lastNode = lastNode.substring(1);
+// }
+// }
+//
+// return null;
+// }
+//
+//// private void trackMemberIfPossible(String objectCode, Class objectClass, String memberName, boolean method, String listenerId) {
+//// if (objectClass.isInterface()) // might be technically possible to track in some cases, but for now
+//// {
+//// return; // we can't create a DefaultObjectHandler for interfaces
+//// }
+////
+//// TagHandler handler = (TagHandler)TagManager.getGuixClassHandler(objectClass.getName()).newInstance();
+//// try {
+//// if (handler.isMemberBound(memberName)) {
+//// addListener(objectCode + "." + memberName + (method ? "()" : ""),
+//// objectCode,
+//// handler.getAddMemberListenerCode(objectCode, id, memberName, listenerId, compiler),
+//// handler.getRemoveMemberListenerCode(objectCode, id, memberName, listenerId, compiler));
+//// }
+//// }
+//// catch (UnsupportedAttributeException e) {
+//// // ignore -- this is thrown for methods like toString(), for which there is no tracking and
+//// // no setting support
+//// }
+//// }
+//
+// /**
+// * Adds type information to nodes where possible, and as a side effect adds event listeners to nodes which
+// * can be tracked.
+// *
+// * @param node node to scan
+// * @param listenerId the listener id
+// */
+// private void determineNodeType(SimpleNode node, String listenerId) {
+// Class type = null;
+// if (node.jjtGetNumChildren() == 1) {
+// type = node.getChild(0).getJavaType();
+// }
+// switch (node.getId()) {
+// case JavaParserTreeConstants.JJTCLASSORINTERFACETYPE:
+// type = Class.class;
+// break;
+// case JavaParserTreeConstants.JJTPRIMARYEXPRESSION:
+// type = determineExpressionType(node, listenerId);
+// break;
+// case JavaParserTreeConstants.JJTLITERAL:
+// type = determineLiteralType(node);
+// break;
+// case JavaParserTreeConstants.JJTCASTEXPRESSION:
+// try {
+// type = Class.forName(node.getChild(0).getText());
+// }
+// catch (ClassNotFoundException eee) {
+// if(log.isErrorEnabled()) {
+// log.error(eee);
+// }
+// }
+// break;
+// }
+// node.setJavaType(type);
+// }
+//
+// private void addListener(String dependencySymbol, String objectCode, String addCode, String removeCode) {
+// this.objectCode = objectCode;
+// if (!dependencySymbols.contains(dependencySymbol)) {
+// dependencySymbols.add(dependencySymbol);
+// if (objectCode != null) {
+// addListenerCode.append("if (").append(objectCode).append(" != null) {").append(JAXXCompiler.getLineSeparator());
+// addListenerCode.append(" ");
+// }
+// addListenerCode.append(" ").append(addCode);
+// if (objectCode != null) {
+// addListenerCode.append(" ").append("}");
+// }
+//
+// if (objectCode != null) {
+// removeListenerCode.append("if (").append(objectCode).append(" != null) {").append(JAXXCompiler.getLineSeparator());
+// removeListenerCode.append(" ");
+// }
+// removeListenerCode.append(" ").append(removeCode);
+// if (objectCode != null) {
+// removeListenerCode.append(" }");
+// }
+// }
+// }
+//
+// private void compileListeners() {
+// String javaCodeId = TypeManager.getJavaCode(id);
+// if (addListenerCode.length() > 0) {
+// if (compiler.haveApplyDataBinding()) {
+// compiler.appendApplyDataBinding(" else ");
+// }
+// compiler.appendApplyDataBinding("if (" + javaCodeId + ".equals($binding)) {" + JAXXCompiler.getLineSeparator());
+// compiler.appendApplyDataBinding(" " + addListenerCode + JAXXCompiler.getLineSeparator());
+// compiler.appendApplyDataBinding("}");
+// //if (compiler.applyDataBinding.length() > 0)
+// // compiler.applyDataBinding.append("else ");
+// //compiler.applyDataBinding.append("if ($binding.equals(").append(TypeManager.getJavaCode(id)).append(")) {").append(JAXXCompiler.getLineSeparator());
+// //compiler.applyDataBinding.append(" ").append(addListenerCode).append(JAXXCompiler.getLineSeparator());
+// //compiler.applyDataBinding.append("}").append(JAXXCompiler.getLineSeparator());
+// }
+//
+// if (removeListenerCode.length() > 0) {
+// if (compiler.haveRemoveDataBinding()) {
+// compiler.appendRemoveDataBinding(" else ");
+// }
+// compiler.appendRemoveDataBinding("if (" + javaCodeId + ".equals($binding)) {" + JAXXCompiler.getLineSeparator());
+// compiler.appendRemoveDataBinding(" " + removeListenerCode + JAXXCompiler.getLineSeparator());
+// compiler.appendRemoveDataBinding("}");
+// //if (compiler.removeDataBinding.length() > 0)
+// // compiler.removeDataBinding.append("else ");
+// //compiler.removeDataBinding.append("if ($binding.equals(").append(TypeManager.getJavaCode(id)).append(")) {").append(JAXXCompiler.getLineSeparator());
+// //compiler.removeDataBinding.append(" ").append(removeListenerCode).append(JAXXCompiler.getLineSeparator());
+// //compiler.removeDataBinding.append("}").append(JAXXCompiler.getLineSeparator());
+// }
+// }
+}
Modified: trunk/guix-compiler/src/main/java/org/nuiton/guix/generator/Generator.java
===================================================================
--- trunk/guix-compiler/src/main/java/org/nuiton/guix/generator/Generator.java 2009-07-22 13:03:32 UTC (rev 1499)
+++ trunk/guix-compiler/src/main/java/org/nuiton/guix/generator/Generator.java 2009-07-22 13:06:26 UTC (rev 1500)
@@ -31,7 +31,7 @@
*/
public interface Generator {
- public void generate();
+ public JavaFile generate();
public File getDestDir();
Modified: trunk/guix-compiler/src/main/java/org/nuiton/guix/generator/GuixGenerator.java
===================================================================
--- trunk/guix-compiler/src/main/java/org/nuiton/guix/generator/GuixGenerator.java 2009-07-22 13:03:32 UTC (rev 1499)
+++ trunk/guix-compiler/src/main/java/org/nuiton/guix/generator/GuixGenerator.java 2009-07-22 13:06:26 UTC (rev 1500)
@@ -20,8 +20,11 @@
package org.nuiton.guix.generator;
import java.io.File;
+import java.util.HashMap;
import java.util.List;
+import java.util.Map;
import org.nuiton.guix.model.GuixModelObject;
+import org.nuiton.guix.tags.TagHandler;
import org.xmlpull.v1.XmlSerializer;
/**
@@ -45,8 +48,10 @@
protected List<String> classes = null;
/** Name to give to the generated launcher*/
protected String launcherName = null;
+ /** */
+ protected Map<String,Map<String, String>> bindings2Generate = new HashMap<String,Map<String, String>>();
- public abstract void generate();
+ public abstract JavaFile generate();
public File getDestDir() {
return destDir;
@@ -104,4 +109,16 @@
this.launcherName = launcherName;
}
+ public Map<String,Map<String, String>> getBindingsToGenerate() {
+ return bindings2Generate;
+ }
+
+ public void setBindingsToGenerate(Map<String,Map<String, String>> bindings2Generate) {
+ this.bindings2Generate = bindings2Generate;
+ }
+
+ public abstract void saveFiles();
+
+ public abstract List<Class> generateBindings(StringBuffer dbCreation, StringBuffer dbDeletion, TagHandler prevTh, JavaFile jf,
+ Class clazz, String[] binding, int i, List<String> alreadyChecked, String methodToInvoke, Map<GuixGenerator,JavaFile> generatedFiles);
}
Modified: trunk/guix-compiler/src/main/java/org/nuiton/guix/generator/JavaField.java
===================================================================
--- trunk/guix-compiler/src/main/java/org/nuiton/guix/generator/JavaField.java 2009-07-22 13:03:32 UTC (rev 1499)
+++ trunk/guix-compiler/src/main/java/org/nuiton/guix/generator/JavaField.java 2009-07-22 13:06:26 UTC (rev 1500)
@@ -20,6 +20,7 @@
import java.lang.reflect.Modifier;
import java.util.Comparator;
+import org.nuiton.guix.tags.TagHandler;
/**
* Represents a field in a Java source file being generated for output. <code>JavaFields</code> are created
@@ -32,6 +33,7 @@
private String name;
private String initializer;
private String javaDoc;
+ private TagHandler tagHandler;
/**
@@ -44,10 +46,23 @@
* @param name the field's name
*/
public JavaField(int modifiers, String type, String name, String javaDoc) {
- this(modifiers, type, name, null, javaDoc);
+ this(modifiers, type, name, null, javaDoc, null);
}
+ /**
+ * Constructs a new <code>JavaField</code>. The <code>modifiers</code> parameter is a bit mask of the
+ * constants from {@link java.lang.reflect.Modifier}, and the <code>type</code> of the field should be
+ * represented as it would appear in Java source code.
+ *
+ * @param modifiers the modifier keywords that should appear as part of the field's declaration
+ * @param type the type of the field as it would appear in Java source code
+ * @param name the field's name
+ */
+ public JavaField(int modifiers, String type, String name, String javaDoc, TagHandler tagHanlder) {
+ this(modifiers, type, name, null, javaDoc, tagHanlder);
+ }
+
/**
* Constructs a new <code>JavaField</code>. The <code>modifiers</code> parameter is a bit mask of the
* constants from <code>java.lang.reflect.Modifier</code>, and the <code>type</code> of the field should be
@@ -60,12 +75,13 @@
* @param name the field's name
* @param initializer the initial value of the field, as it would appear in Java source code
*/
- public JavaField(int modifiers, String type, String name, String initializer, String javaDoc) {
+ public JavaField(int modifiers, String type, String name, String initializer, String javaDoc, TagHandler tagHandler) {
this.modifiers = modifiers;
this.type = type;
this.name = name;
this.initializer = initializer;
this.javaDoc = javaDoc;
+ this.tagHandler = tagHandler;
}
@@ -100,7 +116,11 @@
return type;
}
+ public TagHandler getTagHandler() {
+ return tagHandler;
+ }
+
/**
* Returns the Java source code for this field.
*
Modified: trunk/guix-compiler/src/main/java/org/nuiton/guix/generator/JavaFile.java
===================================================================
--- trunk/guix-compiler/src/main/java/org/nuiton/guix/generator/JavaFile.java 2009-07-22 13:03:32 UTC (rev 1499)
+++ trunk/guix-compiler/src/main/java/org/nuiton/guix/generator/JavaFile.java 2009-07-22 13:06:26 UTC (rev 1500)
@@ -27,6 +27,8 @@
import java.util.EnumMap;
import java.util.List;
import java.util.Map.Entry;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
/**
* A Java source file being generated for output. Once the class is completely initialized, use the
@@ -156,6 +158,30 @@
return methods.toArray(new JavaMethod[methods.size()]);
}
+ public JavaMethod getMethod(String methodName, JavaArgument[] args) {
+ for(JavaMethod method : methods) {
+ if(method.getName().equals(methodName)) {
+ if(method.getArguments() == null && args == null) {
+ return method;
+ }
+ else if (method.getArguments().length == args.length) {
+ boolean samesame = true;
+ for(int i = 0 ; i < args.length ; i++) {
+ if(!args[i].getName().equals(method.getArguments()[i].getName())
+ || !args[i].getType().equals(method.getArguments()[i].getType())) {
+ samesame = false;
+ break;
+ }
+ }
+ if(samesame) {
+ return method;
+ }
+ }
+ }
+ }
+ return null;
+ }
+
public void addField(JavaField field) {
addField(field, false);
}
@@ -190,31 +216,48 @@
return fields.toArray(new JavaField[fields.size()]);
}
+ public JavaField getField(String fieldName) {
+ for(JavaField field : fields) {
+ if(field.getName().equals(fieldName)) {
+ return field;
+ }
+ }
+ return null;
+ }
- public static String addIndentation(String source, int indentation, String lineSeparator) {
- return indent(source, indentation, false, lineSeparator);
+
+ public static String addIndentation(String source, String lineSeparator) {
+ return indent(source, false, lineSeparator);
}
- public static String setIndentation(String source, int indentation, String lineSeparator) {
- return indent(source, indentation, true, lineSeparator);
+ public static String setIndentation(String source, String lineSeparator) {
+ return indent(source, true, lineSeparator);
}
- public static String indent(String source, int indentation, boolean trim, String lineSeparator) {
+ public static String indent(String source, boolean trim, String lineSeparator) {
if (trim) {
source = source.trim();
}
- char[] spaces = new char[indentation];
- Arrays.fill(spaces, ' ');
+ char[] spaces = new char[1];
+ Arrays.fill(spaces, '\t');
StringBuffer result = new StringBuffer();
String[] lines = source.split(System.getProperty("line.separator") + "|\n");
for (int i = 0; i < lines.length; i++) {
if (i > 0) {
result.append(lineSeparator);
}
+ if(lines[i].equals(lines[i].trim()) && (lines[i].trim().startsWith("}") || lines[i].trim().endsWith("}"))) {
+ spaces = new char[spaces.length - 1];
+ Arrays.fill(spaces, '\t');
+ }
result.append(spaces);
result.append(trim ? lines[i].trim() : lines[i]);
+ if(lines[i].equals(lines[i].trim()) && lines[i].trim().endsWith("{")) {
+ spaces = new char[spaces.length + 1];
+ Arrays.fill(spaces, '\t');
+ }
}
return result.toString();
}
@@ -226,32 +269,31 @@
public String getClassBody(String lineSeparator) {
- StringBuffer result = new StringBuffer();
+ StringBuffer result = new StringBuffer("\t");
if (classType != INTERFACE && fields.size() > 0) {
java.util.Collections.sort(fields); // sort fields
for (JavaField field : fields) {
- result.append(addIndentation(field.toString(lineSeparator), 4, lineSeparator));
- result.append(lineSeparator);
+ result.append(field.toString(lineSeparator));
}
result.append(lineSeparator);
}
if (rawBodyCode.length() > 0) {
- result.append(addIndentation("/* begin raw body code */\n", 4, lineSeparator));
+ result.append("/* begin raw body code */\n");
String s = rawBodyCode.toString();
if (!s.startsWith(lineSeparator)) {
result.append(lineSeparator);
}
- result.append(addIndentation(s, 4, lineSeparator));
+ result.append(s);
result.append(lineSeparator);
- result.append(addIndentation("/* end raw body code */", 4, lineSeparator));
- result.append(lineSeparator);
+ result.append("/* end raw body code */");
+ result.append(lineSeparator).append(lineSeparator);
}
for (JavaFile innerClass : innerClasses) {
- result.append(addIndentation(innerClass.toString(), 4, lineSeparator));
+ result.append(innerClass.toString());
result.append(lineSeparator).append(lineSeparator);
}
@@ -263,7 +305,11 @@
}
map.clear();
- return result.toString();
+ Pattern p = Pattern.compile("\\n");
+ //System.out.println(result.toString());
+ Matcher m = p.matcher(result.toString());
+ return m.replaceAll("\n\t");
+
}
Modified: trunk/guix-compiler/src/main/java/org/nuiton/guix/generator/JavaFileGenerator.java
===================================================================
--- trunk/guix-compiler/src/main/java/org/nuiton/guix/generator/JavaFileGenerator.java 2009-07-22 13:03:32 UTC (rev 1499)
+++ trunk/guix-compiler/src/main/java/org/nuiton/guix/generator/JavaFileGenerator.java 2009-07-22 13:06:26 UTC (rev 1500)
@@ -98,7 +98,7 @@
* Fills and saves the generated file
* @param out the file to record
*/
- protected void saveFile(File out) {
+ public void saveFile(File out) {
FileWriter fw = null;
try {
fw = new FileWriter(out);
Modified: trunk/guix-compiler/src/main/java/org/nuiton/guix/generator/JavaMethod.java
===================================================================
--- trunk/guix-compiler/src/main/java/org/nuiton/guix/generator/JavaMethod.java 2009-07-22 13:03:32 UTC (rev 1499)
+++ trunk/guix-compiler/src/main/java/org/nuiton/guix/generator/JavaMethod.java 2009-07-22 13:06:26 UTC (rev 1500)
@@ -27,6 +27,8 @@
import java.util.EnumSet;
import java.util.Iterator;
import java.util.List;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
/**
* Represents a method in a Java source file being generated for output. <code>JavaMethods</code> are created
@@ -240,7 +242,7 @@
if (bodyCode != null) {
result.append(" {");
result.append(lineSeparator);
- String formattedBodyCode = JavaFile.addIndentation(bodyCode.toString().trim(), 4, lineSeparator);
+ String formattedBodyCode = JavaFile.addIndentation(bodyCode.toString().trim(), lineSeparator);
if (formattedBodyCode.length() > 0) {
result.append(formattedBodyCode);
result.append(lineSeparator);
@@ -408,10 +410,10 @@
if (methods.isEmpty()) {
return;
}
- buffer.append(JavaFile.addIndentation(header, 4, lineSeparator));
+ buffer.append(header);
buffer.append(lineSeparator).append(lineSeparator);
for (JavaMethod method : methods) {
- buffer.append(JavaFile.addIndentation(method.toString(lineSeparator), 4, lineSeparator));
+ buffer.append(method.toString(lineSeparator));
buffer.append(lineSeparator).append(lineSeparator);
}
}
Modified: trunk/guix-compiler/src/main/java/org/nuiton/guix/model/ClassDescriptor.java
===================================================================
--- trunk/guix-compiler/src/main/java/org/nuiton/guix/model/ClassDescriptor.java 2009-07-22 13:03:32 UTC (rev 1499)
+++ trunk/guix-compiler/src/main/java/org/nuiton/guix/model/ClassDescriptor.java 2009-07-22 13:06:26 UTC (rev 1500)
@@ -18,6 +18,7 @@
*/
package org.nuiton.guix.model;
+import org.nuiton.guix.tags.TagHandler;
/**
* Descriptor of a class found in the guix files.
@@ -94,5 +95,3 @@
}
}
-
-//~ Formatted by Jindent --- http://www.jindent.com
Modified: trunk/guix-compiler/src/main/java/org/nuiton/guix/parser/SimpleNode.java
===================================================================
--- trunk/guix-compiler/src/main/java/org/nuiton/guix/parser/SimpleNode.java 2009-07-22 13:03:32 UTC (rev 1499)
+++ trunk/guix-compiler/src/main/java/org/nuiton/guix/parser/SimpleNode.java 2009-07-22 13:06:26 UTC (rev 1500)
@@ -10,7 +10,7 @@
protected Node[] children;
public Token firstToken;
protected int id;
- private ClassDescriptor javaType;
+ private Class javaType;
public Token lastToken;
protected Node parent;
protected JavaParser parser;
@@ -44,11 +44,11 @@
return (SimpleNode) parent;
}
- public ClassDescriptor getJavaType() {
+ public Class getJavaType() {
return javaType;
}
- public void setJavaType(ClassDescriptor javaType) {
+ public void setJavaType(Class javaType) {
this.javaType = javaType;
}
Deleted: trunk/guix-compiler/src/main/java/org/nuiton/guix/tags/ApplicationHandler.java
===================================================================
--- trunk/guix-compiler/src/main/java/org/nuiton/guix/tags/ApplicationHandler.java 2009-07-22 13:03:32 UTC (rev 1499)
+++ trunk/guix-compiler/src/main/java/org/nuiton/guix/tags/ApplicationHandler.java 2009-07-22 13:06:26 UTC (rev 1500)
@@ -1,20 +0,0 @@
-/*
- * To change this template, choose Tools | Templates
- * and open the template in the editor.
- */
-
-package org.nuiton.guix.tags;
-
-/**
- *
- * @author kevin
- */
-public abstract class ApplicationHandler extends DefaultTagHandler {
-
- /**
- * Constructor
- */
- public ApplicationHandler() {
-
- }
-}
Deleted: trunk/guix-compiler/src/main/java/org/nuiton/guix/tags/ButtonHandler.java
===================================================================
--- trunk/guix-compiler/src/main/java/org/nuiton/guix/tags/ButtonHandler.java 2009-07-22 13:03:32 UTC (rev 1499)
+++ trunk/guix-compiler/src/main/java/org/nuiton/guix/tags/ButtonHandler.java 2009-07-22 13:06:26 UTC (rev 1500)
@@ -1,20 +0,0 @@
-/*
- * To change this template, choose Tools | Templates
- * and open the template in the editor.
- */
-
-package org.nuiton.guix.tags;
-
-/**
- *
- * @author kevin
- */
-public abstract class ButtonHandler extends DefaultTagHandler {
-
- /**
- * Constructor
- */
- public ButtonHandler() {
-
- }
-}
Deleted: trunk/guix-compiler/src/main/java/org/nuiton/guix/tags/CellHandler.java
===================================================================
--- trunk/guix-compiler/src/main/java/org/nuiton/guix/tags/CellHandler.java 2009-07-22 13:03:32 UTC (rev 1499)
+++ trunk/guix-compiler/src/main/java/org/nuiton/guix/tags/CellHandler.java 2009-07-22 13:06:26 UTC (rev 1500)
@@ -1,173 +0,0 @@
-/**
- * *##% guix-compiler-swing
- * Copyright (C) 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 org.nuiton.guix.tags;
-
-import org.nuiton.guix.model.AttributeDescriptor;
-import org.nuiton.guix.model.GuixModelObject;
-
-/**
- * Represents a cell of a table
- *
- * @author kevin
- */
-public abstract class CellHandler extends TableHandler {
-
- /** id of the object contained by the cell */
- private String id = null;
- /** number of columns of the cell */
- private int columns = 1;
- /** number of rows of the cell */
- private int rows = 1;
- /** index of the row */
- private int row = -1;
- /** index of the column */
- private int column = -1;
-
- /**
- * Constructor
- */
- public CellHandler() {
-
- }
-
- /**
- * Constructor
- *
- * @param cell the GuixModelObject which represents the cell
- */
- public CellHandler(GuixModelObject cell) {
- assert cell.getChildren().size() == 1;
- id = cell.getChildren().get(0).getId();
- for (AttributeDescriptor attr : cell.getAttributeDescriptors()) {
- if (attr.getName().equals("columns")) {
- columns = Integer.valueOf(attr.getValue());
- }
- else if (attr.getName().equals("column")) {
- column = Integer.valueOf(attr.getValue());
- }
- else if (attr.getName().equals("rows")) {
- rows = Integer.valueOf(attr.getValue());
- }
- else if (attr.getName().equals("weightx")) {
- weightx = Double.valueOf(attr.getValue());
- }
- else if (attr.getName().equals("weighty")) {
- weighty = Double.valueOf(attr.getValue());
- }
- else if (attr.getName().equals("ipadx")) {
- ipadx = Integer.valueOf(attr.getValue());
- }
- else if (attr.getName().equals("ipady")) {
- ipady = Integer.valueOf(attr.getValue());
- }
- else if (attr.getName().equals("halign")) {
- horizontalAlignment = getHalign(attr.getValue());
- }
- else if (attr.getName().equals("valign")) {
- verticalAlignment = getValign(attr.getValue());
- }
- else if (attr.getName().equals("fill")) {
- fill = attr.getValue();
- }
- else if (attr.getName().equals("insets")) {
- insets = attr.getValue();
- }
- }
- }
-
- /**
- * Constructor
- *
- * @param cell the GuixModelObject which represents the cell
- * @param row the row which contains the cell
- */
- public CellHandler(GuixModelObject cell, RowHandler row) {
- this(cell);
- //if the attributes that the row contains too have not been defined by the user within the cell,
- //but have been defined in the row (or the table), set them
- if (horizontalAlignment == null) {
- horizontalAlignment = row.getHorizontalAlignment() == null ? TableHandler.DEFAULT_HORIZONTAL_ALIGNMENT : row.getHorizontalAlignment();
- }
- if (verticalAlignment == null) {
- verticalAlignment = row.getVerticalAlignment() == null ? TableHandler.DEFAULT_VERTICAL_ALIGNMENT : row.getVerticalAlignment();
- }
- if (fill == null) {
- fill = row.getFill() == null ? TableHandler.DEFAULT_FILL : row.getFill();
- }
- if (insets == null) {
- insets = row.getInsets() == null ? TableHandler.DEFAULT_INSETS : row.getInsets();
- }
- if (ipadx == null) {
- ipadx = row.getIpadx() == null ? TableHandler.DEFAULT_IPADX : row.getIpadx();
- }
- if (ipady == null) {
- ipady = row.getIpady() == null ? TableHandler.DEFAULT_IPADY : row.getIpady();
- }
- if (weightx == null) {
- weightx = row.getWeightx() == null ? TableHandler.DEFAULT_WEIGHTX : row.getWeightx();
- }
- if (weighty == null) {
- weighty = row.getWeighty() == null ? TableHandler.DEFAULT_WEIGHTY : row.getWeighty();
- }
- if(this.row == -1) {
- this.row = row.getRow() < 0 ? -1 : row.getRow();
- }
- }
-
- public String getId() {
- return id;
- }
-
- public void setId(String id) {
- this.id = id;
- }
-
- public int getColumn() {
- return column;
- }
-
- public void setColumn(int column) {
- this.column = column;
- }
-
- public int getColumns() {
- return columns;
- }
-
- public void setColumns(int columns) {
- this.columns = columns;
- }
-
- public int getRow() {
- return row;
- }
-
- public void setRow(int row) {
- this.row = row;
- }
-
- public int getRows() {
- return rows;
- }
-
- public void setRows(int rows) {
- this.rows = rows;
- }
-
-}
Modified: trunk/guix-compiler/src/main/java/org/nuiton/guix/tags/DefaultTagHandler.java
===================================================================
--- trunk/guix-compiler/src/main/java/org/nuiton/guix/tags/DefaultTagHandler.java 2009-07-22 13:03:32 UTC (rev 1499)
+++ trunk/guix-compiler/src/main/java/org/nuiton/guix/tags/DefaultTagHandler.java 2009-07-22 13:06:26 UTC (rev 1500)
@@ -4,6 +4,18 @@
*/
package org.nuiton.guix.tags;
+import java.beans.BeanInfo;
+import java.beans.EventSetDescriptor;
+import java.beans.IntrospectionException;
+import java.beans.Introspector;
+import java.beans.MethodDescriptor;
+import java.beans.PropertyDescriptor;
+import java.lang.reflect.Field;
+import java.lang.reflect.Method;
+import java.lang.reflect.Modifier;
+import java.util.HashMap;
+import java.util.Map;
+import org.nuiton.guix.UnsupportedAttributeException;
/**
*
@@ -11,4 +23,248 @@
*/
public abstract class DefaultTagHandler implements TagHandler {
+ protected Map<String,String> attrMap = new HashMap<String,String>();
+
+ /** Maps property names to their respective ProxyEventInfos. */
+ private Map<String, ProxyEventInfo> eventInfos;
+
+ /** The JAXXBeanInfo for the beanClass. */
+ protected BeanInfo beanInfo;
+
+ /** Maps property names to their respective JAXXPropertyDescriptors. */
+ private Map<String, PropertyDescriptor> properties;
+
+ /** Maps event names to their respective JAXXEventSetDescriptors. */
+ private Map<String, EventSetDescriptor> events;
+
+ /**
+ * Encapsulates information about a "proxy event handler", which is an event handler that
+ * fires PropertyChangeEvents when it is triggered. ProxyEventInfos simplify the data binding
+ * system by allowing all dependencies to fire the same kind of event even if they would
+ * normally throw something else, like <code>DocumentEvent</code>.
+ */
+ private class ProxyEventInfo {
+ /** The name of the method or field being proxied, e.g. "getText". */
+ String memberName;
+
+ /** The "actual" event listener for the property in question, e.g. DocumentListener. */
+ Class listenerClass;
+
+ /**
+ * In cases where a different object (such as a model) is more directly responsible for
+ * managing the property, this is the name of the property where that object can be
+ * found, e.g. "document" (which is turned into a call to "getDocument()"). This property
+ * is also treated as a dependency of the data binding expression, and any updates to it
+ * (assuming it is bound) will cause the listener to be removed from the old value and
+ * attached to the new value, and the data binding to be processed.
+ */
+ String modelName;
+
+ /** The name of the method used to add the "native" event listener, e.g. "addDocumentListener". */
+ String addMethod;
+
+ /** The name of the method used to remove the "native" event listener, e.g. "removeDocumentListener". */
+ String removeMethod;
+ }
+
+ /**
+ * Performs introspection on the beanClass and stores the results.
+ *
+ * @throws java.beans.IntrospectionException
+ * TODO
+ */
+ protected void init() throws IntrospectionException {
+ if (beanInfo == null) {
+ // perform introspection & cache the results
+ beanInfo = Introspector.getBeanInfo(getClassToGenerate());
+
+ PropertyDescriptor[] propertiesArray = beanInfo.getPropertyDescriptors();
+ properties = new HashMap<String, PropertyDescriptor>();
+ for (int i = propertiesArray.length - 1; i >= 0; i--) {
+ properties.put(propertiesArray[i].getName(), propertiesArray[i]);
+ }
+
+ EventSetDescriptor[] eventsArray = beanInfo.getEventSetDescriptors();
+ events = new HashMap<String, EventSetDescriptor>();
+ for (int i = eventsArray.length - 1; i >= 0; i--) {
+ Method[] methods = eventsArray[i].getListenerMethods();
+ for (Method method : methods) {
+ events.put(method.getName(), eventsArray[i]);
+ }
+ }
+
+ configureProxyEventInfo();
+ }
+ }
+
+ /**
+ * Configures the event handling for members which do not fire <code>PropertyChangeEvent</code> when
+ * modified. The default implementation does nothing. Subclasses should override this method to call
+ * <code>addProxyEventInfo</code> for each member which requires special handling.
+ */
+ protected void configureProxyEventInfo() {
+
+ }
+
+
+ /**
+ * Configures a proxy event handler which fires <code>PropertyChangeEvents</code> when a non-bound
+ * member is updated. This is necessary for all fields (which cannot be bound) and for methods that are
+ * not bound property <code>get</code> methods. The proxy event handler will attach the specified kind
+ * of listener to the class and fire a <code>PropertyChangeEvent</code> whenever the listener receives
+ * any kind of event.
+ * <p/>
+ * Even though this method can theoretically be applied to fields (in addition to methods), it would be an
+ * unusual situation in which that would actually work -- as fields cannot fire events when modified, it would
+ * be difficult to have a listener that was always notified when a field value changed.
+ *
+ * @param memberName the name of the field or method being proxied
+ * @param listenerClass the type of listener which receives events when the field or method is updated
+ */
+ public void addProxyEventInfo(String memberName, Class listenerClass) {
+ addProxyEventInfo(memberName, listenerClass, null);
+ }
+
+
+ /**
+ * Configures a proxy event handler which fires <code>PropertyChangeEvents</code> when a non-bound
+ * member is updated. This is necessary for all fields (which cannot be bound) and for methods that are
+ * not bound property <code>get</code> methods. This variant attaches a listener to a property of the
+ * object (such as <code>model</code>) and not the object itself, which is useful when there is a model
+ * that is the "real" container of the information. The proxy event handler will attach the specified kind
+ * of listener to the property's value (retrieved using the property's <code>get</code> method) and fire
+ * a <code>PropertyChangeEvent</code> whenever the listener receives any kind of event.
+ * <p/>
+ * If the property is itself bound (typically the case with models), any updates to the property's value will
+ * cause the listener to be removed from the old property value and reattached to the new property value,
+ * as well as cause a <code>PropertyChangeEvent</code> to be fired.
+ * <p/>
+ * Even though this method can theoretically be applied to fields (in addition to methods), it would be an
+ * unusual situation in which that would actually work -- as fields cannot fire events when modified, it would
+ * be difficult to have a listener that was always notified when a field value changed.
+ *
+ * @param memberName the name of the field or method being proxied
+ * @param listenerClass the type of listener which receives events when the field or method is updated
+ * @param modelName the JavaBeans-style name of the model property
+ */
+ public void addProxyEventInfo(String memberName, Class listenerClass, String modelName) {
+ String listenerName = listenerClass.getName();
+ listenerName = listenerName.substring(listenerName.lastIndexOf(".") + 1);
+ addProxyEventInfo(memberName, listenerClass, modelName, "add" + listenerName, "remove" + listenerName);
+ }
+
+ /**
+ * Configures a proxy event handler which fires <code>PropertyChangeEvents</code> when a non-bound
+ * member is updated. This is necessary for all fields (which cannot be bound) and for methods that are
+ * not bound property <code>get</code> methods. This variant attaches a listener to a property of the
+ * object (such as <code>model</code>) and not the object itself, which is useful when there is a model
+ * that is the "real" container of the information. The proxy event handler will attach the specified kind
+ * of listener to the property's value (retrieved using the property's <code>get</code> method) and fire
+ * a <code>PropertyChangeEvent</code> whenever the listener receives any kind of event.
+ * <p/>
+ * If the property is itself bound (typically the case with models), any updates to the property's value will
+ * cause the listener to be removed from the old property value and reattached to the new property value,
+ * as well as cause a <code>PropertyChangeEvent</code> to be fired.
+ * <p/>
+ * This variant of <code>addProxyEventInfo</code> allows the names of the methods that add and remove
+ * the event listener to be specified, in cases where the names are not simply <code>add<listenerClassName></code>
+ * and <code>remove<listenerClassName></code>.
+ * <p/>
+ * Even though this method can theoretically be applied to fields (in addition to methods), it would be an
+ * unusual situation in which that would actually work -- as fields cannot fire events when modified, it would
+ * be difficult to have a listener that was always notified when a field value changed.
+ *
+ * @param memberName the name of the field or method being proxied
+ * @param listenerClass the type of listener which receives events when the field or method is updated
+ * @param modelName the JavaBeans-style name of the model property
+ * @param addMethod add method name
+ * @param removeMethod remove method name
+ */
+ public void addProxyEventInfo(String memberName, Class listenerClass,
+ String modelName, String addMethod, String removeMethod) {
+ ProxyEventInfo info = new ProxyEventInfo();
+ info.memberName = memberName;
+ info.listenerClass = listenerClass;
+ info.modelName = modelName;
+ info.addMethod = addMethod;
+ info.removeMethod = removeMethod;
+ if (eventInfos == null) {
+ eventInfos = new HashMap<String, ProxyEventInfo>();
+ }
+ eventInfos.put(memberName, info);
+ }
+
+ @Override
+ public boolean hasEventInfosAboutMethod(String methodName) {
+ return eventInfos != null && eventInfos.get(methodName) != null;
+ }
+
+ @Override
+ public Class getEventInfosListenerClass(String methodName) {
+ return eventInfos.get(methodName) != null ? eventInfos.get(methodName).listenerClass : null;
+ }
+
+ @Override
+ public String getEventInfosAddListenerMethodName(String methodName) {
+ return eventInfos.get(methodName) != null ? eventInfos.get(methodName).addMethod : null;
+ }
+
+ @Override
+ public String getEventInfosRemoveListenerMethodName(String methodName) {
+ return eventInfos.get(methodName) != null ? eventInfos.get(methodName).removeMethod : null;
+ }
+
+ @Override
+ public String getEventInfosModelName(String methodName) {
+ return eventInfos.get(methodName) != null ? eventInfos.get(methodName).modelName : null;
+ }
+
+ @Override
+ public String getAttrToGenerate(String attr) {
+ return attrMap.get(attr);
+ }
+
+ /**
+ * @param name ?
+ * @return <code>true</code> if the named member is <i>bound</i> (fires <code>PropertyChangeEvent</code>
+ * when modified). Members are either fields (represented by the simple name of the field) or <code>get/is</code>
+ * methods (represented by the simple name of the method, <b>not</b> the simplified JavaBeans-style name).
+ * Methods which are not actually bound in their native class, but for which proxy events have been
+ * configured (such as <code>JTextField.getText</code>, return <code>true</code>.
+ * @throws jaxx.UnsupportedAttributeException
+ * ?
+ */
+ @Override
+ public boolean isMemberBound(String member) throws UnsupportedAttributeException {
+ try {
+ init();
+ } catch (IntrospectionException e) {
+ throw new RuntimeException(e);
+ }
+
+ if (eventInfos != null && eventInfos.containsKey(member)) {
+ return true;
+ }
+
+ if (member.equals("getClass")) {
+ return false;
+ }
+
+ String propertyName = null;
+ if (member.startsWith("get")) {
+ propertyName = Introspector.decapitalize(member.substring("get".length()));
+ } else if (member.startsWith("is")) {
+ propertyName = Introspector.decapitalize(member.substring("is".length()));
+ }
+ PropertyDescriptor property = propertyName != null ? properties.get(propertyName) : null;
+ if (property != null) {
+ return property.isBound();
+ }
+ try {
+ Field field = getClassToGenerate().getField(member);
+ return Modifier.isFinal(field.getModifiers()); // final fields might as well be considered bound -- they can't be modified anyway
+ } catch (NoSuchFieldException e) {
+ throw new UnsupportedAttributeException("cannot find property '" + member + "' of " + getClassToGenerate());
+ }
+ }
}
Deleted: trunk/guix-compiler/src/main/java/org/nuiton/guix/tags/LabelHandler.java
===================================================================
--- trunk/guix-compiler/src/main/java/org/nuiton/guix/tags/LabelHandler.java 2009-07-22 13:03:32 UTC (rev 1499)
+++ trunk/guix-compiler/src/main/java/org/nuiton/guix/tags/LabelHandler.java 2009-07-22 13:06:26 UTC (rev 1500)
@@ -1,21 +0,0 @@
-/*
- * To change this template, choose Tools | Templates
- * and open the template in the editor.
- */
-
-package org.nuiton.guix.tags;
-
-/**
- *
- * @author kevin
- */
-public abstract class LabelHandler extends DefaultTagHandler {
-
- /**
- * Constructor
- */
- public LabelHandler() {
-
- }
-
-}
Deleted: trunk/guix-compiler/src/main/java/org/nuiton/guix/tags/MenuBarHandler.java
===================================================================
--- trunk/guix-compiler/src/main/java/org/nuiton/guix/tags/MenuBarHandler.java 2009-07-22 13:03:32 UTC (rev 1499)
+++ trunk/guix-compiler/src/main/java/org/nuiton/guix/tags/MenuBarHandler.java 2009-07-22 13:06:26 UTC (rev 1500)
@@ -1,21 +0,0 @@
-/*
- * To change this template, choose Tools | Templates
- * and open the template in the editor.
- */
-
-package org.nuiton.guix.tags;
-
-/**
- *
- * @author kevin
- */
-public abstract class MenuBarHandler extends DefaultTagHandler {
-
- /**
- * Constructor
- */
- public MenuBarHandler() {
-
- }
-
-}
Deleted: trunk/guix-compiler/src/main/java/org/nuiton/guix/tags/MenuHandler.java
===================================================================
--- trunk/guix-compiler/src/main/java/org/nuiton/guix/tags/MenuHandler.java 2009-07-22 13:03:32 UTC (rev 1499)
+++ trunk/guix-compiler/src/main/java/org/nuiton/guix/tags/MenuHandler.java 2009-07-22 13:06:26 UTC (rev 1500)
@@ -1,21 +0,0 @@
-/*
- * To change this template, choose Tools | Templates
- * and open the template in the editor.
- */
-
-package org.nuiton.guix.tags;
-
-/**
- *
- * @author kevin
- */
-public abstract class MenuHandler extends DefaultTagHandler {
-
- /**
- * Constructor
- */
- public MenuHandler() {
-
- }
-
-}
Deleted: trunk/guix-compiler/src/main/java/org/nuiton/guix/tags/MenuItemHandler.java
===================================================================
--- trunk/guix-compiler/src/main/java/org/nuiton/guix/tags/MenuItemHandler.java 2009-07-22 13:03:32 UTC (rev 1499)
+++ trunk/guix-compiler/src/main/java/org/nuiton/guix/tags/MenuItemHandler.java 2009-07-22 13:06:26 UTC (rev 1500)
@@ -1,21 +0,0 @@
-/*
- * To change this template, choose Tools | Templates
- * and open the template in the editor.
- */
-
-package org.nuiton.guix.tags;
-
-/**
- *
- * @author kevin
- */
-public abstract class MenuItemHandler extends DefaultTagHandler {
-
- /**
- * Constructor
- */
- public MenuItemHandler() {
-
- }
-
-}
Deleted: trunk/guix-compiler/src/main/java/org/nuiton/guix/tags/PanelHandler.java
===================================================================
--- trunk/guix-compiler/src/main/java/org/nuiton/guix/tags/PanelHandler.java 2009-07-22 13:03:32 UTC (rev 1499)
+++ trunk/guix-compiler/src/main/java/org/nuiton/guix/tags/PanelHandler.java 2009-07-22 13:06:26 UTC (rev 1500)
@@ -1,20 +0,0 @@
-/*
- * To change this template, choose Tools | Templates
- * and open the template in the editor.
- */
-
-package org.nuiton.guix.tags;
-
-/**
- *
- * @author kevin
- */
-public abstract class PanelHandler extends DefaultTagHandler {
-
- /**
- * Constructor
- */
- public PanelHandler() {
-
- }
-}
Deleted: trunk/guix-compiler/src/main/java/org/nuiton/guix/tags/RowHandler.java
===================================================================
--- trunk/guix-compiler/src/main/java/org/nuiton/guix/tags/RowHandler.java 2009-07-22 13:03:32 UTC (rev 1499)
+++ trunk/guix-compiler/src/main/java/org/nuiton/guix/tags/RowHandler.java 2009-07-22 13:06:26 UTC (rev 1500)
@@ -1,122 +0,0 @@
-/**
- * *##% guix-compiler-swing
- * Copyright (C) 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 org.nuiton.guix.tags;
-
-import org.nuiton.guix.model.AttributeDescriptor;
-import org.nuiton.guix.model.GuixModelObject;
-
-/**
- * Represents a row of a table
- *
- * @author kevin
- */
-public abstract class RowHandler extends TableHandler {
-
- /** index of the row */
- private int row = -1;
-
- /**
- * Constructor
- */
- public RowHandler() {
-
- }
-
- /**
- * Constructor
- *
- * @param row the GuixModelObject which represents the row
- */
- public RowHandler(GuixModelObject row) {
- for (AttributeDescriptor attr : row.getAttributeDescriptors()) {
- if (attr.getName().equals("row")) {
- this.row = Integer.valueOf(attr.getValue());
- }
- else if (attr.getName().equals("weightx")) {
- weightx = Double.valueOf(attr.getValue());
- }
- else if (attr.getName().equals("weighty")) {
- weighty = Double.valueOf(attr.getValue());
- }
- else if (attr.getName().equals("ipadx")) {
- ipadx = Integer.valueOf(attr.getValue());
- }
- else if (attr.getName().equals("ipady")) {
- ipady = Integer.valueOf(attr.getValue());
- }
- else if (attr.getName().equals("halign")) {
- horizontalAlignment = getHalign(attr.getValue());
- }
- else if (attr.getName().equals("valign")) {
- verticalAlignment = getValign(attr.getValue());
- }
- else if (attr.getName().equals("fill")) {
- fill = attr.getValue();
- }
- else if (attr.getName().equals("insets")) {
- insets = attr.getValue();
- }
- }
- }
-
- /**
- * Constructor
- *
- * @param row the GuixModelObject which represents the row
- * @param table the table which contains the row
- */
- public RowHandler(GuixModelObject row, TableHandler table) {
- this(row);
- //if the attributes that the table contains too have not been defined by the user within the row,
- //but have been defined in the table, set them
- if (horizontalAlignment == null) {
- horizontalAlignment = table.getHorizontalAlignment() == null ? TableHandler.DEFAULT_HORIZONTAL_ALIGNMENT : table.getHorizontalAlignment();
- }
- if (verticalAlignment == null) {
- verticalAlignment = table.getVerticalAlignment() == null ? TableHandler.DEFAULT_VERTICAL_ALIGNMENT : table.getVerticalAlignment();
- }
- if (fill == null) {
- fill = table.getFill() == null ? TableHandler.DEFAULT_FILL : table.getFill();
- }
- if (insets == null) {
- insets = table.getInsets() == null ? TableHandler.DEFAULT_INSETS : table.getInsets();
- }
- if (ipadx == null) {
- ipadx = table.getIpadx() == null ? TableHandler.DEFAULT_IPADX : table.getIpadx();
- }
- if (ipady == null) {
- ipady = table.getIpady() == null ? TableHandler.DEFAULT_IPADY : table.getIpady();
- }
- if (weightx == null) {
- weightx = table.getWeightx() == null ? TableHandler.DEFAULT_WEIGHTX : table.getWeightx();
- }
- if (weighty == null) {
- weighty = table.getWeighty() == null ? TableHandler.DEFAULT_WEIGHTY : table.getWeighty();
- }
- }
-
- public int getRow() {
- return row;
- }
-
- public void setRow(int row) {
- this.row = row;
- }
-
-}
Modified: trunk/guix-compiler/src/main/java/org/nuiton/guix/tags/StyleHandler.java
===================================================================
--- trunk/guix-compiler/src/main/java/org/nuiton/guix/tags/StyleHandler.java 2009-07-22 13:03:32 UTC (rev 1499)
+++ trunk/guix-compiler/src/main/java/org/nuiton/guix/tags/StyleHandler.java 2009-07-22 13:06:26 UTC (rev 1500)
@@ -90,6 +90,7 @@
* with the same name as the class
*/
public StyleSheet autoDetectStyleFile(File styleFile) throws IOException {
+ selectors = new ArrayList<Selector>();
return processStylesheet(loadStyleFile(styleFile));
}
@@ -109,6 +110,7 @@
public StyleSheet compileStyle(XmlPullParser xpp, File styleFile) throws IOException, XmlPullParserException {
StyleSheet result = null;
StringBuffer style = new StringBuffer();
+ selectors = new ArrayList<Selector>();
if ((styleFile != null) && styleFile.exists()) {
style.append(loadStyleFile(styleFile));
@@ -150,7 +152,6 @@
* which rules will be applied to
*/
protected Selector processSelector(SimpleNode selector) {
-
// chack if it is a selector
if (selector.getId() != CSSParserTreeConstants.JJTSELECTOR) {
throw new IllegalArgumentException("argument node is not a Selector");
Deleted: trunk/guix-compiler/src/main/java/org/nuiton/guix/tags/TabPanelHandler.java
===================================================================
--- trunk/guix-compiler/src/main/java/org/nuiton/guix/tags/TabPanelHandler.java 2009-07-22 13:03:32 UTC (rev 1499)
+++ trunk/guix-compiler/src/main/java/org/nuiton/guix/tags/TabPanelHandler.java 2009-07-22 13:06:26 UTC (rev 1500)
@@ -1,20 +0,0 @@
-/*
- * To change this template, choose Tools | Templates
- * and open the template in the editor.
- */
-
-package org.nuiton.guix.tags;
-
-/**
- *
- * @author kevin
- */
-public abstract class TabPanelHandler extends DefaultTagHandler {
-
- /**
- * Constructor
- */
- public TabPanelHandler() {
-
- }
-}
Deleted: trunk/guix-compiler/src/main/java/org/nuiton/guix/tags/TableHandler.java
===================================================================
--- trunk/guix-compiler/src/main/java/org/nuiton/guix/tags/TableHandler.java 2009-07-22 13:03:32 UTC (rev 1499)
+++ trunk/guix-compiler/src/main/java/org/nuiton/guix/tags/TableHandler.java 2009-07-22 13:06:26 UTC (rev 1500)
@@ -1,202 +0,0 @@
-/**
- * *##% guix-compiler-swing
- * Copyright (C) 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 org.nuiton.guix.tags;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.nuiton.guix.model.AttributeDescriptor;
-import org.nuiton.guix.model.GuixModelObject;
-
-/**
- * Represents a table
- *
- * @author kevin
- */
-public abstract class TableHandler extends DefaultTagHandler {
-
- private static Log log = LogFactory.getLog(TableHandler.class);
-
- protected enum VerticalAlignment {
-
- ALIGN_TOP, ALIGN_MIDDLE, ALIGN_BOTTOM
- }
- protected enum HorizontalAlignment {
-
- ALIGN_LEFT, ALIGN_CENTER, ALIGN_RIGHT, ALIGN_DEFAULT
- }
- public static final String DEFAULT_INSETS = "3, 3, 3, 3";
- public static final HorizontalAlignment DEFAULT_HORIZONTAL_ALIGNMENT = HorizontalAlignment.ALIGN_DEFAULT;
- public static final VerticalAlignment DEFAULT_VERTICAL_ALIGNMENT = VerticalAlignment.ALIGN_TOP;
- public static final String DEFAULT_FILL = "java.awt.GridBagConstraints.BOTH";
- public static final Integer DEFAULT_IPADX = 1;
- public static final Integer DEFAULT_IPADY = 1;
- public static final Double DEFAULT_WEIGHTX = 0.0;
- public static final Double DEFAULT_WEIGHTY = 0.0;
- protected Double weightx = null;
- protected Double weighty = null;
- protected Integer ipadx = null;
- protected Integer ipady = null;
- protected HorizontalAlignment horizontalAlignment = null;
- protected VerticalAlignment verticalAlignment = null;
- protected String fill = null;
- protected String insets = null;
-
- /**
- * Constructor
- */
- public TableHandler() {
- }
-
- /**
- * Constructor
- *
- * @param table the GuixModelObject which represents the table
- */
- public TableHandler(GuixModelObject table) {
-
- for (AttributeDescriptor attr : table.getAttributeDescriptors()) {
- if (attr.getName().equals("weightx")) {
- weightx = Double.valueOf(attr.getValue());
- }
- else if (attr.getName().equals("weighty")) {
- weighty = Double.valueOf(attr.getValue());
- }
- else if (attr.getName().equals("ipadx")) {
- ipadx = Integer.valueOf(attr.getValue());
- }
- else if (attr.getName().equals("ipady")) {
- ipady = Integer.valueOf(attr.getValue());
- }
- else if (attr.getName().equals("halign")) {
- horizontalAlignment = getHalign(attr.getValue());
- if (horizontalAlignment == null) {
- if (log.isErrorEnabled()) {
- log.error(table.getId() + "'s halign attribute has a wrong value : " + attr.getValue());
- }
- horizontalAlignment = HorizontalAlignment.ALIGN_DEFAULT;
- }
- }
- else if (attr.getName().equals("valign")) {
- verticalAlignment = getValign(attr.getValue());
- if (verticalAlignment == null) {
- if (log.isErrorEnabled()) {
- log.error(table.getId() + "'s halign attribute has a wrong value : " + attr.getValue());
- }
- verticalAlignment = VerticalAlignment.ALIGN_TOP;
- }
- }
- else if (attr.getName().equals("fill")) {
- fill = attr.getValue();
- }
- else if (attr.getName().equals("insets")) {
- insets = attr.getValue();
- }
- }
- }
-
- public HorizontalAlignment getHorizontalAlignment() {
- return horizontalAlignment;
- }
-
- public void setHorizontalAlignment(HorizontalAlignment horizontalAlignment) {
- this.horizontalAlignment = horizontalAlignment;
- }
-
- public VerticalAlignment getVerticalAlignment() {
- return verticalAlignment;
- }
-
- public void setVerticalAlignment(VerticalAlignment verticalAlignment) {
- this.verticalAlignment = verticalAlignment;
- }
-
- public String getFill() {
- return fill;
- }
-
- public void setFill(String fill) {
- this.fill = fill;
- }
-
- public String getInsets() {
- return insets;
- }
-
- public void setInsets(String insets) {
- this.insets = insets;
- }
-
- public Integer getIpadx() {
- return ipadx;
- }
-
- public void setIpadx(Integer ipadx) {
- this.ipadx = ipadx;
- }
-
- public Integer getIpady() {
- return ipady;
- }
-
- public void setIpady(Integer ipady) {
- this.ipady = ipady;
- }
-
- public Double getWeightx() {
- return weightx;
- }
-
- public void setWeightx(Double weightx) {
- this.weightx = weightx;
- }
-
- public Double getWeighty() {
- return weighty;
- }
-
- public void setWeighty(Double weighty) {
- this.weighty = weighty;
- }
-
- public HorizontalAlignment getHalign(String halign) {
- if (halign.equalsIgnoreCase("left")) {
- return HorizontalAlignment.ALIGN_LEFT;
- }
- if (halign.equalsIgnoreCase("right")) {
- return HorizontalAlignment.ALIGN_RIGHT;
- }
- if (halign.equalsIgnoreCase("center")) {
- return HorizontalAlignment.ALIGN_CENTER;
- }
- return null;
- }
-
- public VerticalAlignment getValign(String valign) {
- if (valign.equalsIgnoreCase("top")) {
- return VerticalAlignment.ALIGN_TOP;
- }
- if (valign.equalsIgnoreCase("bottom")) {
- return VerticalAlignment.ALIGN_BOTTOM;
- }
- if (valign.equalsIgnoreCase("middle")) {
- return VerticalAlignment.ALIGN_MIDDLE;
- }
- return null;
- }
-}
Modified: trunk/guix-compiler/src/main/java/org/nuiton/guix/tags/TagHandler.java
===================================================================
--- trunk/guix-compiler/src/main/java/org/nuiton/guix/tags/TagHandler.java 2009-07-22 13:03:32 UTC (rev 1499)
+++ trunk/guix-compiler/src/main/java/org/nuiton/guix/tags/TagHandler.java 2009-07-22 13:06:26 UTC (rev 1500)
@@ -12,4 +12,18 @@
public interface TagHandler {
public Class getClassToGenerate();
+
+ public String getAttrToGenerate(String attr);
+
+ public boolean hasEventInfosAboutMethod(String methodName);
+
+ public Class getEventInfosListenerClass(String methodName);
+
+ public String getEventInfosAddListenerMethodName(String methodName);
+
+ public String getEventInfosRemoveListenerMethodName(String methodName);
+
+ public String getEventInfosModelName(String methodName);
+
+ public boolean isMemberBound(String member);
}
Deleted: trunk/guix-compiler/src/main/java/org/nuiton/guix/tags/TextFieldHandler.java
===================================================================
--- trunk/guix-compiler/src/main/java/org/nuiton/guix/tags/TextFieldHandler.java 2009-07-22 13:03:32 UTC (rev 1499)
+++ trunk/guix-compiler/src/main/java/org/nuiton/guix/tags/TextFieldHandler.java 2009-07-22 13:06:26 UTC (rev 1500)
@@ -1,21 +0,0 @@
-/*
- * To change this template, choose Tools | Templates
- * and open the template in the editor.
- */
-
-package org.nuiton.guix.tags;
-
-/**
- *
- * @author kevin
- */
-public abstract class TextFieldHandler extends DefaultTagHandler {
-
- /**
- * Constructor
- */
- public TextFieldHandler() {
-
- }
-
-}
Deleted: trunk/guix-compiler/src/main/java/org/nuiton/guix/tags/ToggleButtonHandler.java
===================================================================
--- trunk/guix-compiler/src/main/java/org/nuiton/guix/tags/ToggleButtonHandler.java 2009-07-22 13:03:32 UTC (rev 1499)
+++ trunk/guix-compiler/src/main/java/org/nuiton/guix/tags/ToggleButtonHandler.java 2009-07-22 13:06:26 UTC (rev 1500)
@@ -1,20 +0,0 @@
-/*
- * To change this template, choose Tools | Templates
- * and open the template in the editor.
- */
-
-package org.nuiton.guix.tags;
-
-/**
- *
- * @author kevin
- */
-public abstract class ToggleButtonHandler extends DefaultTagHandler {
-
- /**
- * Constructor
- */
- public ToggleButtonHandler() {
-
- }
-}
1
0
Author: kmorin
Date: 2009-07-22 15:03:32 +0200 (Wed, 22 Jul 2009)
New Revision: 1499
Modified:
trunk/pom.xml
Log:
Add the runtime modules (probably unuseful but in case)
Modified: trunk/pom.xml
===================================================================
--- trunk/pom.xml 2009-06-26 14:33:53 UTC (rev 1498)
+++ trunk/pom.xml 2009-07-22 13:03:32 UTC (rev 1499)
@@ -18,11 +18,12 @@
<modules>
<module>guix-compiler</module>
<module>guix-compiler-swing</module>
- <module>guix-runtime</module>
+ <module>guix-compiler-gwt</module>
+ <module>guix-runtime-swing</module>
+ <module>guix-runtime-gwt</module>
<module>maven-guix-plugin</module>
<module>guix-test-swing</module>
- <module>guix-test-gwt</module>
- <module>guix-compiler-gwt</module>
+ <module>guix-test-gwt</module>
</modules>
1
0
July 15, 2009
Author: sletellier
Date: 2009-07-15 15:13:01 +0200 (Wed, 15 Jul 2009)
New Revision: 1508
Added:
tags/jaxx-1.5.1/
Log:
Adding tag jaxx-1.5.1
Property changes on: tags/jaxx-1.5.1
___________________________________________________________________
Added: svn:ignore
+ *.ipr
*.iws
*.iml
target
catalog.xml
*.log
Added: svn:mergeinfo
+
1
0
r1507 - in branches/1.5.X: . jaxx-compiler-api jaxx-compiler-swing jaxx-compiler-validator jaxx-example jaxx-runtime-api jaxx-runtime-swing jaxx-runtime-swing-widget jaxx-runtime-validator jaxx-runtime-validator-swing jaxx-swing-action maven-jaxx-plugin
by sletellier@users.labs.libre-entreprise.org July 15, 2009
by sletellier@users.labs.libre-entreprise.org July 15, 2009
July 15, 2009
Author: sletellier
Date: 2009-07-15 15:00:13 +0200 (Wed, 15 Jul 2009)
New Revision: 1507
Modified:
branches/1.5.X/jaxx-compiler-api/pom.xml
branches/1.5.X/jaxx-compiler-swing/pom.xml
branches/1.5.X/jaxx-compiler-validator/pom.xml
branches/1.5.X/jaxx-example/pom.xml
branches/1.5.X/jaxx-runtime-api/pom.xml
branches/1.5.X/jaxx-runtime-swing-widget/pom.xml
branches/1.5.X/jaxx-runtime-swing/pom.xml
branches/1.5.X/jaxx-runtime-validator-swing/pom.xml
branches/1.5.X/jaxx-runtime-validator/pom.xml
branches/1.5.X/jaxx-swing-action/pom.xml
branches/1.5.X/maven-jaxx-plugin/pom.xml
branches/1.5.X/pom.xml
Log:
Change version to 1.5.1
Modified: branches/1.5.X/jaxx-compiler-api/pom.xml
===================================================================
--- branches/1.5.X/jaxx-compiler-api/pom.xml 2009-07-15 12:43:48 UTC (rev 1506)
+++ branches/1.5.X/jaxx-compiler-api/pom.xml 2009-07-15 13:00:13 UTC (rev 1507)
@@ -10,7 +10,7 @@
<parent>
<groupId>org.codelutin</groupId>
<artifactId>jaxx</artifactId>
- <version>1.5.1-SNAPSHOT</version>
+ <version>1.5.1</version>
</parent>
<groupId>org.codelutin.jaxx</groupId>
Modified: branches/1.5.X/jaxx-compiler-swing/pom.xml
===================================================================
--- branches/1.5.X/jaxx-compiler-swing/pom.xml 2009-07-15 12:43:48 UTC (rev 1506)
+++ branches/1.5.X/jaxx-compiler-swing/pom.xml 2009-07-15 13:00:13 UTC (rev 1507)
@@ -10,7 +10,7 @@
<parent>
<groupId>org.codelutin</groupId>
<artifactId>jaxx</artifactId>
- <version>1.5.1-SNAPSHOT</version>
+ <version>1.5.1</version>
</parent>
<groupId>org.codelutin.jaxx</groupId>
Modified: branches/1.5.X/jaxx-compiler-validator/pom.xml
===================================================================
--- branches/1.5.X/jaxx-compiler-validator/pom.xml 2009-07-15 12:43:48 UTC (rev 1506)
+++ branches/1.5.X/jaxx-compiler-validator/pom.xml 2009-07-15 13:00:13 UTC (rev 1507)
@@ -10,7 +10,7 @@
<parent>
<groupId>org.codelutin</groupId>
<artifactId>jaxx</artifactId>
- <version>1.5.1-SNAPSHOT</version>
+ <version>1.5.1</version>
</parent>
<groupId>org.codelutin.jaxx</groupId>
Modified: branches/1.5.X/jaxx-example/pom.xml
===================================================================
--- branches/1.5.X/jaxx-example/pom.xml 2009-07-15 12:43:48 UTC (rev 1506)
+++ branches/1.5.X/jaxx-example/pom.xml 2009-07-15 13:00:13 UTC (rev 1507)
@@ -10,7 +10,7 @@
<parent>
<groupId>org.codelutin</groupId>
<artifactId>jaxx</artifactId>
- <version>1.5.1-SNAPSHOT</version>
+ <version>1.5.1</version>
</parent>
<groupId>org.codelutin.jaxx</groupId>
@@ -286,4 +286,4 @@
</profile>
</profiles>
-</project>
\ No newline at end of file
+</project>
Modified: branches/1.5.X/jaxx-runtime-api/pom.xml
===================================================================
--- branches/1.5.X/jaxx-runtime-api/pom.xml 2009-07-15 12:43:48 UTC (rev 1506)
+++ branches/1.5.X/jaxx-runtime-api/pom.xml 2009-07-15 13:00:13 UTC (rev 1507)
@@ -10,7 +10,7 @@
<parent>
<groupId>org.codelutin</groupId>
<artifactId>jaxx</artifactId>
- <version>1.5.1-SNAPSHOT</version>
+ <version>1.5.1</version>
</parent>
<groupId>org.codelutin.jaxx</groupId>
Modified: branches/1.5.X/jaxx-runtime-swing/pom.xml
===================================================================
--- branches/1.5.X/jaxx-runtime-swing/pom.xml 2009-07-15 12:43:48 UTC (rev 1506)
+++ branches/1.5.X/jaxx-runtime-swing/pom.xml 2009-07-15 13:00:13 UTC (rev 1507)
@@ -10,7 +10,7 @@
<parent>
<groupId>org.codelutin</groupId>
<artifactId>jaxx</artifactId>
- <version>1.5.1-SNAPSHOT</version>
+ <version>1.5.1</version>
</parent>
<groupId>org.codelutin.jaxx</groupId>
Modified: branches/1.5.X/jaxx-runtime-swing-widget/pom.xml
===================================================================
--- branches/1.5.X/jaxx-runtime-swing-widget/pom.xml 2009-07-15 12:43:48 UTC (rev 1506)
+++ branches/1.5.X/jaxx-runtime-swing-widget/pom.xml 2009-07-15 13:00:13 UTC (rev 1507)
@@ -10,7 +10,7 @@
<parent>
<groupId>org.codelutin</groupId>
<artifactId>jaxx</artifactId>
- <version>1.5.1-SNAPSHOT</version>
+ <version>1.5.1</version>
</parent>
<groupId>org.codelutin.jaxx</groupId>
@@ -119,4 +119,4 @@
<url>http://labs.libre-entreprise.org/plugins/scmsvn/viewcvs.php/jaxx/tags/jaxx-…</url>
</scm>
-</project>
\ No newline at end of file
+</project>
Modified: branches/1.5.X/jaxx-runtime-validator/pom.xml
===================================================================
--- branches/1.5.X/jaxx-runtime-validator/pom.xml 2009-07-15 12:43:48 UTC (rev 1506)
+++ branches/1.5.X/jaxx-runtime-validator/pom.xml 2009-07-15 13:00:13 UTC (rev 1507)
@@ -10,7 +10,7 @@
<parent>
<groupId>org.codelutin</groupId>
<artifactId>jaxx</artifactId>
- <version>1.5.1-SNAPSHOT</version>
+ <version>1.5.1</version>
</parent>
<groupId>org.codelutin.jaxx</groupId>
Modified: branches/1.5.X/jaxx-runtime-validator-swing/pom.xml
===================================================================
--- branches/1.5.X/jaxx-runtime-validator-swing/pom.xml 2009-07-15 12:43:48 UTC (rev 1506)
+++ branches/1.5.X/jaxx-runtime-validator-swing/pom.xml 2009-07-15 13:00:13 UTC (rev 1507)
@@ -10,7 +10,7 @@
<parent>
<groupId>org.codelutin</groupId>
<artifactId>jaxx</artifactId>
- <version>1.5.1-SNAPSHOT</version>
+ <version>1.5.1</version>
</parent>
<groupId>org.codelutin.jaxx</groupId>
Modified: branches/1.5.X/jaxx-swing-action/pom.xml
===================================================================
--- branches/1.5.X/jaxx-swing-action/pom.xml 2009-07-15 12:43:48 UTC (rev 1506)
+++ branches/1.5.X/jaxx-swing-action/pom.xml 2009-07-15 13:00:13 UTC (rev 1507)
@@ -11,7 +11,7 @@
<parent>
<groupId>org.codelutin</groupId>
<artifactId>jaxx</artifactId>
- <version>1.5.1-SNAPSHOT</version>
+ <version>1.5.1</version>
</parent>
<groupId>org.codelutin.jaxx</groupId>
Modified: branches/1.5.X/maven-jaxx-plugin/pom.xml
===================================================================
--- branches/1.5.X/maven-jaxx-plugin/pom.xml 2009-07-15 12:43:48 UTC (rev 1506)
+++ branches/1.5.X/maven-jaxx-plugin/pom.xml 2009-07-15 13:00:13 UTC (rev 1507)
@@ -10,7 +10,7 @@
<parent>
<groupId>org.codelutin</groupId>
<artifactId>jaxx</artifactId>
- <version>1.5.1-SNAPSHOT</version>
+ <version>1.5.1</version>
</parent>
<groupId>org.codelutin.jaxx</groupId>
@@ -149,4 +149,4 @@
<url>http://labs.libre-entreprise.org/plugins/scmsvn/viewcvs.php/jaxx/tags/jaxx-…</url>
</scm>
-</project>
\ No newline at end of file
+</project>
Modified: branches/1.5.X/pom.xml
===================================================================
--- branches/1.5.X/pom.xml 2009-07-15 12:43:48 UTC (rev 1506)
+++ branches/1.5.X/pom.xml 2009-07-15 13:00:13 UTC (rev 1507)
@@ -14,7 +14,7 @@
<groupId>org.codelutin</groupId>
<artifactId>jaxx</artifactId>
- <version>1.5.1-SNAPSHOT</version>
+ <version>1.5.1</version>
<modules>
<module>jaxx-runtime-api</module>
@@ -272,4 +272,4 @@
</profile>
</profiles>
-</project>
\ No newline at end of file
+</project>
1
0
Author: sletellier
Date: 2009-07-15 14:43:48 +0200 (Wed, 15 Jul 2009)
New Revision: 1506
Modified:
branches/1.5.X/changelog.txt
Log:
Updated to 1.5.1
Modified: branches/1.5.X/changelog.txt
===================================================================
--- branches/1.5.X/changelog.txt 2009-07-15 12:27:01 UTC (rev 1505)
+++ branches/1.5.X/changelog.txt 2009-07-15 12:43:48 UTC (rev 1506)
@@ -1,3 +1,6 @@
+1.5.1
+ * 20090715 [sletellier] - correct bug in JAXXList, now they can be unselected (null value)
+
1.5
* 20090506 [chemit] - super-pom has no dependencies, use lutinutil 1.0.5
* 20090404 [chemit] - introduce module jaxx-runtime-swing-widget for swing widgets designed with jaxx.
@@ -27,4 +30,4 @@
0.7 chemit 20081210
* 20081210 [chemit] use lutinutil 1.0 and lutinproject 3.2
- * 20081207 [chemit] use lutinproject 3.1
\ No newline at end of file
+ * 20081207 [chemit] use lutinproject 3.1
1
0
r1505 - in trunk: . jaxx-compiler jaxx-example jaxx-runtime-api jaxx-runtime-swing jaxx-runtime-swing-widget jaxx-swing-action maven-jaxx-plugin
by sletellier@users.labs.libre-entreprise.org July 15, 2009
by sletellier@users.labs.libre-entreprise.org July 15, 2009
July 15, 2009
Author: sletellier
Date: 2009-07-15 14:27:01 +0200 (Wed, 15 Jul 2009)
New Revision: 1505
Modified:
trunk/jaxx-compiler/pom.xml
trunk/jaxx-example/pom.xml
trunk/jaxx-runtime-api/pom.xml
trunk/jaxx-runtime-swing-widget/pom.xml
trunk/jaxx-runtime-swing/pom.xml
trunk/jaxx-swing-action/pom.xml
trunk/maven-jaxx-plugin/pom.xml
trunk/pom.xml
Log:
[maven-release-plugin] rollback the release of jaxx-1.7.1
Modified: trunk/jaxx-compiler/pom.xml
===================================================================
--- trunk/jaxx-compiler/pom.xml 2009-07-15 11:24:59 UTC (rev 1504)
+++ trunk/jaxx-compiler/pom.xml 2009-07-15 12:27:01 UTC (rev 1505)
@@ -10,7 +10,7 @@
<parent>
<groupId>org.nuiton</groupId>
<artifactId>jaxx</artifactId>
- <version>1.7.2-SNAPSHOT</version>
+ <version>1.7.1-SNAPSHOT</version>
</parent>
<groupId>org.nuiton.jaxx</groupId>
Modified: trunk/jaxx-example/pom.xml
===================================================================
--- trunk/jaxx-example/pom.xml 2009-07-15 11:24:59 UTC (rev 1504)
+++ trunk/jaxx-example/pom.xml 2009-07-15 12:27:01 UTC (rev 1505)
@@ -10,7 +10,7 @@
<parent>
<groupId>org.nuiton</groupId>
<artifactId>jaxx</artifactId>
- <version>1.7.2-SNAPSHOT</version>
+ <version>1.7.1-SNAPSHOT</version>
</parent>
<groupId>org.nuiton.jaxx</groupId>
Modified: trunk/jaxx-runtime-api/pom.xml
===================================================================
--- trunk/jaxx-runtime-api/pom.xml 2009-07-15 11:24:59 UTC (rev 1504)
+++ trunk/jaxx-runtime-api/pom.xml 2009-07-15 12:27:01 UTC (rev 1505)
@@ -10,7 +10,7 @@
<parent>
<groupId>org.nuiton</groupId>
<artifactId>jaxx</artifactId>
- <version>1.7.2-SNAPSHOT</version>
+ <version>1.7.1-SNAPSHOT</version>
</parent>
<groupId>org.nuiton.jaxx</groupId>
Modified: trunk/jaxx-runtime-swing/pom.xml
===================================================================
--- trunk/jaxx-runtime-swing/pom.xml 2009-07-15 11:24:59 UTC (rev 1504)
+++ trunk/jaxx-runtime-swing/pom.xml 2009-07-15 12:27:01 UTC (rev 1505)
@@ -10,7 +10,7 @@
<parent>
<groupId>org.nuiton</groupId>
<artifactId>jaxx</artifactId>
- <version>1.7.2-SNAPSHOT</version>
+ <version>1.7.1-SNAPSHOT</version>
</parent>
<groupId>org.nuiton.jaxx</groupId>
Modified: trunk/jaxx-runtime-swing-widget/pom.xml
===================================================================
--- trunk/jaxx-runtime-swing-widget/pom.xml 2009-07-15 11:24:59 UTC (rev 1504)
+++ trunk/jaxx-runtime-swing-widget/pom.xml 2009-07-15 12:27:01 UTC (rev 1505)
@@ -10,7 +10,7 @@
<parent>
<groupId>org.nuiton</groupId>
<artifactId>jaxx</artifactId>
- <version>1.7.2-SNAPSHOT</version>
+ <version>1.7.1-SNAPSHOT</version>
</parent>
<groupId>org.nuiton.jaxx</groupId>
Modified: trunk/jaxx-swing-action/pom.xml
===================================================================
--- trunk/jaxx-swing-action/pom.xml 2009-07-15 11:24:59 UTC (rev 1504)
+++ trunk/jaxx-swing-action/pom.xml 2009-07-15 12:27:01 UTC (rev 1505)
@@ -11,7 +11,7 @@
<parent>
<groupId>org.nuiton</groupId>
<artifactId>jaxx</artifactId>
- <version>1.7.2-SNAPSHOT</version>
+ <version>1.7.1-SNAPSHOT</version>
</parent>
<groupId>org.nuiton.jaxx</groupId>
Modified: trunk/maven-jaxx-plugin/pom.xml
===================================================================
--- trunk/maven-jaxx-plugin/pom.xml 2009-07-15 11:24:59 UTC (rev 1504)
+++ trunk/maven-jaxx-plugin/pom.xml 2009-07-15 12:27:01 UTC (rev 1505)
@@ -10,7 +10,7 @@
<parent>
<groupId>org.nuiton</groupId>
<artifactId>jaxx</artifactId>
- <version>1.7.2-SNAPSHOT</version>
+ <version>1.7.1-SNAPSHOT</version>
</parent>
<groupId>org.nuiton.jaxx</groupId>
Modified: trunk/pom.xml
===================================================================
--- trunk/pom.xml 2009-07-15 11:24:59 UTC (rev 1504)
+++ trunk/pom.xml 2009-07-15 12:27:01 UTC (rev 1505)
@@ -14,7 +14,7 @@
</parent>
<artifactId>jaxx</artifactId>
- <version>1.7.2-SNAPSHOT</version>
+ <version>1.7.1-SNAPSHOT</version>
<modules>
<module>jaxx-runtime-api</module>
1
0
r1504 - in trunk: . jaxx-compiler jaxx-example jaxx-runtime-api jaxx-runtime-swing jaxx-runtime-swing-widget jaxx-swing-action maven-jaxx-plugin
by sletellier@users.labs.libre-entreprise.org July 15, 2009
by sletellier@users.labs.libre-entreprise.org July 15, 2009
July 15, 2009
Author: sletellier
Date: 2009-07-15 13:24:59 +0200 (Wed, 15 Jul 2009)
New Revision: 1504
Modified:
trunk/jaxx-compiler/pom.xml
trunk/jaxx-example/pom.xml
trunk/jaxx-runtime-api/pom.xml
trunk/jaxx-runtime-swing-widget/pom.xml
trunk/jaxx-runtime-swing/pom.xml
trunk/jaxx-swing-action/pom.xml
trunk/maven-jaxx-plugin/pom.xml
trunk/pom.xml
Log:
[maven-release-plugin] prepare for next development iteration
Modified: trunk/jaxx-compiler/pom.xml
===================================================================
--- trunk/jaxx-compiler/pom.xml 2009-07-15 11:24:55 UTC (rev 1503)
+++ trunk/jaxx-compiler/pom.xml 2009-07-15 11:24:59 UTC (rev 1504)
@@ -10,7 +10,7 @@
<parent>
<groupId>org.nuiton</groupId>
<artifactId>jaxx</artifactId>
- <version>1.7.1</version>
+ <version>1.7.2-SNAPSHOT</version>
</parent>
<groupId>org.nuiton.jaxx</groupId>
Modified: trunk/jaxx-example/pom.xml
===================================================================
--- trunk/jaxx-example/pom.xml 2009-07-15 11:24:55 UTC (rev 1503)
+++ trunk/jaxx-example/pom.xml 2009-07-15 11:24:59 UTC (rev 1504)
@@ -10,7 +10,7 @@
<parent>
<groupId>org.nuiton</groupId>
<artifactId>jaxx</artifactId>
- <version>1.7.1</version>
+ <version>1.7.2-SNAPSHOT</version>
</parent>
<groupId>org.nuiton.jaxx</groupId>
Modified: trunk/jaxx-runtime-api/pom.xml
===================================================================
--- trunk/jaxx-runtime-api/pom.xml 2009-07-15 11:24:55 UTC (rev 1503)
+++ trunk/jaxx-runtime-api/pom.xml 2009-07-15 11:24:59 UTC (rev 1504)
@@ -10,7 +10,7 @@
<parent>
<groupId>org.nuiton</groupId>
<artifactId>jaxx</artifactId>
- <version>1.7.1</version>
+ <version>1.7.2-SNAPSHOT</version>
</parent>
<groupId>org.nuiton.jaxx</groupId>
Modified: trunk/jaxx-runtime-swing/pom.xml
===================================================================
--- trunk/jaxx-runtime-swing/pom.xml 2009-07-15 11:24:55 UTC (rev 1503)
+++ trunk/jaxx-runtime-swing/pom.xml 2009-07-15 11:24:59 UTC (rev 1504)
@@ -10,7 +10,7 @@
<parent>
<groupId>org.nuiton</groupId>
<artifactId>jaxx</artifactId>
- <version>1.7.1</version>
+ <version>1.7.2-SNAPSHOT</version>
</parent>
<groupId>org.nuiton.jaxx</groupId>
Modified: trunk/jaxx-runtime-swing-widget/pom.xml
===================================================================
--- trunk/jaxx-runtime-swing-widget/pom.xml 2009-07-15 11:24:55 UTC (rev 1503)
+++ trunk/jaxx-runtime-swing-widget/pom.xml 2009-07-15 11:24:59 UTC (rev 1504)
@@ -10,7 +10,7 @@
<parent>
<groupId>org.nuiton</groupId>
<artifactId>jaxx</artifactId>
- <version>1.7.1</version>
+ <version>1.7.2-SNAPSHOT</version>
</parent>
<groupId>org.nuiton.jaxx</groupId>
Modified: trunk/jaxx-swing-action/pom.xml
===================================================================
--- trunk/jaxx-swing-action/pom.xml 2009-07-15 11:24:55 UTC (rev 1503)
+++ trunk/jaxx-swing-action/pom.xml 2009-07-15 11:24:59 UTC (rev 1504)
@@ -11,7 +11,7 @@
<parent>
<groupId>org.nuiton</groupId>
<artifactId>jaxx</artifactId>
- <version>1.7.1</version>
+ <version>1.7.2-SNAPSHOT</version>
</parent>
<groupId>org.nuiton.jaxx</groupId>
Modified: trunk/maven-jaxx-plugin/pom.xml
===================================================================
--- trunk/maven-jaxx-plugin/pom.xml 2009-07-15 11:24:55 UTC (rev 1503)
+++ trunk/maven-jaxx-plugin/pom.xml 2009-07-15 11:24:59 UTC (rev 1504)
@@ -10,7 +10,7 @@
<parent>
<groupId>org.nuiton</groupId>
<artifactId>jaxx</artifactId>
- <version>1.7.1</version>
+ <version>1.7.2-SNAPSHOT</version>
</parent>
<groupId>org.nuiton.jaxx</groupId>
Modified: trunk/pom.xml
===================================================================
--- trunk/pom.xml 2009-07-15 11:24:55 UTC (rev 1503)
+++ trunk/pom.xml 2009-07-15 11:24:59 UTC (rev 1504)
@@ -14,7 +14,7 @@
</parent>
<artifactId>jaxx</artifactId>
- <version>1.7.1</version>
+ <version>1.7.2-SNAPSHOT</version>
<modules>
<module>jaxx-runtime-api</module>
@@ -200,9 +200,9 @@
<!-- Source control management. -->
<scm>
- <connection>scm:svn:http://svn.nuiton.org/svn/jaxx/tags/jaxx-1.7.1</connection>
- <developerConnection>scm:svn:http://svn.nuiton.org/svn/jaxx/tags/jaxx-1.7.1</developerConnection>
- <url>http://www.nuiton.org/repositories/browse/jaxx/tags/jaxx-1.7.1</url>
+ <connection>scm:svn:http://svn.nuiton.org/svn/jaxx/trunk</connection>
+ <developerConnection>scm:svn:http://svn.nuiton.org/svn/jaxx/trunk</developerConnection>
+ <url>http://www.nuiton.org/repositories/browse/jaxx/trunk</url>
</scm>
</project>
1
0
July 15, 2009
Author: sletellier
Date: 2009-07-15 13:24:55 +0200 (Wed, 15 Jul 2009)
New Revision: 1503
Added:
tags/jaxx-1.7.1/
Log:
[maven-scm] copy for tag jaxx-1.7.1
Property changes on: tags/jaxx-1.7.1
___________________________________________________________________
Added: svn:ignore
+ *.ipr
*.iws
*.iml
target
catalog.xml
*.log
Added: svn:mergeinfo
+
1
0
r1502 - in trunk: . jaxx-compiler jaxx-example jaxx-runtime-api jaxx-runtime-swing jaxx-runtime-swing-widget jaxx-swing-action maven-jaxx-plugin
by sletellier@users.labs.libre-entreprise.org July 15, 2009
by sletellier@users.labs.libre-entreprise.org July 15, 2009
July 15, 2009
Author: sletellier
Date: 2009-07-15 13:24:50 +0200 (Wed, 15 Jul 2009)
New Revision: 1502
Modified:
trunk/jaxx-compiler/pom.xml
trunk/jaxx-example/pom.xml
trunk/jaxx-runtime-api/pom.xml
trunk/jaxx-runtime-swing-widget/pom.xml
trunk/jaxx-runtime-swing/pom.xml
trunk/jaxx-swing-action/pom.xml
trunk/maven-jaxx-plugin/pom.xml
trunk/pom.xml
Log:
[maven-release-plugin] prepare release jaxx-1.7.1
Modified: trunk/jaxx-compiler/pom.xml
===================================================================
--- trunk/jaxx-compiler/pom.xml 2009-07-15 11:17:28 UTC (rev 1501)
+++ trunk/jaxx-compiler/pom.xml 2009-07-15 11:24:50 UTC (rev 1502)
@@ -10,7 +10,7 @@
<parent>
<groupId>org.nuiton</groupId>
<artifactId>jaxx</artifactId>
- <version>1.7.1-SNAPSHOT</version>
+ <version>1.7.1</version>
</parent>
<groupId>org.nuiton.jaxx</groupId>
Modified: trunk/jaxx-example/pom.xml
===================================================================
--- trunk/jaxx-example/pom.xml 2009-07-15 11:17:28 UTC (rev 1501)
+++ trunk/jaxx-example/pom.xml 2009-07-15 11:24:50 UTC (rev 1502)
@@ -10,7 +10,7 @@
<parent>
<groupId>org.nuiton</groupId>
<artifactId>jaxx</artifactId>
- <version>1.7.1-SNAPSHOT</version>
+ <version>1.7.1</version>
</parent>
<groupId>org.nuiton.jaxx</groupId>
Modified: trunk/jaxx-runtime-api/pom.xml
===================================================================
--- trunk/jaxx-runtime-api/pom.xml 2009-07-15 11:17:28 UTC (rev 1501)
+++ trunk/jaxx-runtime-api/pom.xml 2009-07-15 11:24:50 UTC (rev 1502)
@@ -10,7 +10,7 @@
<parent>
<groupId>org.nuiton</groupId>
<artifactId>jaxx</artifactId>
- <version>1.7.1-SNAPSHOT</version>
+ <version>1.7.1</version>
</parent>
<groupId>org.nuiton.jaxx</groupId>
Modified: trunk/jaxx-runtime-swing/pom.xml
===================================================================
--- trunk/jaxx-runtime-swing/pom.xml 2009-07-15 11:17:28 UTC (rev 1501)
+++ trunk/jaxx-runtime-swing/pom.xml 2009-07-15 11:24:50 UTC (rev 1502)
@@ -10,7 +10,7 @@
<parent>
<groupId>org.nuiton</groupId>
<artifactId>jaxx</artifactId>
- <version>1.7.1-SNAPSHOT</version>
+ <version>1.7.1</version>
</parent>
<groupId>org.nuiton.jaxx</groupId>
Modified: trunk/jaxx-runtime-swing-widget/pom.xml
===================================================================
--- trunk/jaxx-runtime-swing-widget/pom.xml 2009-07-15 11:17:28 UTC (rev 1501)
+++ trunk/jaxx-runtime-swing-widget/pom.xml 2009-07-15 11:24:50 UTC (rev 1502)
@@ -10,7 +10,7 @@
<parent>
<groupId>org.nuiton</groupId>
<artifactId>jaxx</artifactId>
- <version>1.7.1-SNAPSHOT</version>
+ <version>1.7.1</version>
</parent>
<groupId>org.nuiton.jaxx</groupId>
Modified: trunk/jaxx-swing-action/pom.xml
===================================================================
--- trunk/jaxx-swing-action/pom.xml 2009-07-15 11:17:28 UTC (rev 1501)
+++ trunk/jaxx-swing-action/pom.xml 2009-07-15 11:24:50 UTC (rev 1502)
@@ -11,7 +11,7 @@
<parent>
<groupId>org.nuiton</groupId>
<artifactId>jaxx</artifactId>
- <version>1.7.1-SNAPSHOT</version>
+ <version>1.7.1</version>
</parent>
<groupId>org.nuiton.jaxx</groupId>
Modified: trunk/maven-jaxx-plugin/pom.xml
===================================================================
--- trunk/maven-jaxx-plugin/pom.xml 2009-07-15 11:17:28 UTC (rev 1501)
+++ trunk/maven-jaxx-plugin/pom.xml 2009-07-15 11:24:50 UTC (rev 1502)
@@ -10,7 +10,7 @@
<parent>
<groupId>org.nuiton</groupId>
<artifactId>jaxx</artifactId>
- <version>1.7.1-SNAPSHOT</version>
+ <version>1.7.1</version>
</parent>
<groupId>org.nuiton.jaxx</groupId>
Modified: trunk/pom.xml
===================================================================
--- trunk/pom.xml 2009-07-15 11:17:28 UTC (rev 1501)
+++ trunk/pom.xml 2009-07-15 11:24:50 UTC (rev 1502)
@@ -14,7 +14,7 @@
</parent>
<artifactId>jaxx</artifactId>
- <version>1.7.1-SNAPSHOT</version>
+ <version>1.7.1</version>
<modules>
<module>jaxx-runtime-api</module>
@@ -200,9 +200,9 @@
<!-- Source control management. -->
<scm>
- <connection>scm:svn:http://svn.nuiton.org/svn/jaxx/trunk</connection>
- <developerConnection>scm:svn:http://svn.nuiton.org/svn/jaxx/trunk</developerConnection>
- <url>http://www.nuiton.org/repositories/browse/jaxx/trunk</url>
+ <connection>scm:svn:http://svn.nuiton.org/svn/jaxx/tags/jaxx-1.7.1</connection>
+ <developerConnection>scm:svn:http://svn.nuiton.org/svn/jaxx/tags/jaxx-1.7.1</developerConnection>
+ <url>http://www.nuiton.org/repositories/browse/jaxx/tags/jaxx-1.7.1</url>
</scm>
</project>
1
0
r1501 - trunk/jaxx-runtime-swing/src/main/java/jaxx/runtime/swing
by sletellier@users.labs.libre-entreprise.org July 15, 2009
by sletellier@users.labs.libre-entreprise.org July 15, 2009
July 15, 2009
Author: sletellier
Date: 2009-07-15 13:17:28 +0200 (Wed, 15 Jul 2009)
New Revision: 1501
Modified:
trunk/jaxx-runtime-swing/src/main/java/jaxx/runtime/swing/JAXXList.java
Log:
Adding null selection
Modified: trunk/jaxx-runtime-swing/src/main/java/jaxx/runtime/swing/JAXXList.java
===================================================================
--- trunk/jaxx-runtime-swing/src/main/java/jaxx/runtime/swing/JAXXList.java 2009-07-09 15:46:12 UTC (rev 1500)
+++ trunk/jaxx-runtime-swing/src/main/java/jaxx/runtime/swing/JAXXList.java 2009-07-15 11:17:28 UTC (rev 1501)
@@ -283,21 +283,27 @@
* @param values Objects must be selected in the list
*/
public void setSelectedValues(Object[] values) {
- List<Integer> selectedIndices = new ArrayList<Integer>();
- ListModel model = getModel();
- for (int i = 0; i < model.getSize(); i++) {
- Object o = model.getElementAt(i);
- for (Object value : values) {
- if (o.equals(value)) {
- selectedIndices.add(i);
- break;
+ if (values != null){
+ List<Integer> selectedIndices = new ArrayList<Integer>();
+ ListModel model = getModel();
+ for (int i = 0; i < model.getSize(); i++) {
+ Object o = model.getElementAt(i);
+ for (Object value : values) {
+ if (o.equals(value)) {
+ selectedIndices.add(i);
+ break;
+ }
}
}
+ int[] ints = new int[selectedIndices.size()];
+ for (int i = 0; i < ints.length; i++) {
+ ints[i] = selectedIndices.get(i).intValue();
+ }
+ setSelectedIndices(ints);
}
- int[] ints = new int[selectedIndices.size()];
- for (int i = 0; i < ints.length; i++) {
- ints[i] = selectedIndices.get(i).intValue();
+ else{
+ // No selection if values is null
+ setSelectedIndex(-1);
}
- setSelectedIndices(ints);
}
}
1
0
Author: tchemit
Date: 2009-07-09 17:46:12 +0200 (Thu, 09 Jul 2009)
New Revision: 1500
Modified:
trunk/changelog.txt
Log:
changelog + commit test...
Modified: trunk/changelog.txt
===================================================================
--- trunk/changelog.txt 2009-07-09 15:44:02 UTC (rev 1499)
+++ trunk/changelog.txt 2009-07-09 15:46:12 UTC (rev 1500)
@@ -1,3 +1,5 @@
+1.7.1
+
1.7.0
* reorganize modules
1
0