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 {
participants (1)
-
kmorin@users.labs.libre-entreprise.org