Buix-commits
Threads by month
- ----- 2026 -----
- June
- May
- April
- March
- February
- January
- ----- 2025 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2010 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2009 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2008 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2007 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2006 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2005 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2004 -----
- December
- November
- October
- September
- August
- 1440 discussions
r1528 - trunk/guix-compiler-gwt/src/main/java/org/nuiton/guix/generator
by kmorin@users.labs.libre-entreprise.org 24 Jul '09
by kmorin@users.labs.libre-entreprise.org 24 Jul '09
24 Jul '09
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 24 Jul '09
by kmorin@users.labs.libre-entreprise.org 24 Jul '09
24 Jul '09
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 24 Jul '09
by kmorin@users.labs.libre-entreprise.org 24 Jul '09
24 Jul '09
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 24 Jul '09
by kmorin@users.labs.libre-entreprise.org 24 Jul '09
24 Jul '09
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 24 Jul '09
by kmorin@users.labs.libre-entreprise.org 24 Jul '09
24 Jul '09
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 24 Jul '09
by tchemit@users.labs.libre-entreprise.org 24 Jul '09
24 Jul '09
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 23 Jul '09
by kmorin@users.labs.libre-entreprise.org 23 Jul '09
23 Jul '09
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 23 Jul '09
by kmorin@users.labs.libre-entreprise.org 23 Jul '09
23 Jul '09
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 23 Jul '09
by kmorin@users.labs.libre-entreprise.org 23 Jul '09
23 Jul '09
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