Index: lutingenerator/src/java/org/codelutin/generator/models/ui/javaxml/JavaXMLParser.java diff -u lutingenerator/src/java/org/codelutin/generator/models/ui/javaxml/JavaXMLParser.java:1.5 lutingenerator/src/java/org/codelutin/generator/models/ui/javaxml/JavaXMLParser.java:1.6 --- lutingenerator/src/java/org/codelutin/generator/models/ui/javaxml/JavaXMLParser.java:1.5 Wed Sep 8 15:46:20 2004 +++ lutingenerator/src/java/org/codelutin/generator/models/ui/javaxml/JavaXMLParser.java Thu Sep 23 08:38:43 2004 @@ -23,9 +23,9 @@ * * @author Benjamin Poussin * Copyright Code Lutin -* @version $Revision: 1.5 $ +* @version $Revision: 1.6 $ * -* Mise a jour: $Date: 2004/09/08 15:46:20 $ +* Mise a jour: $Date: 2004/09/23 08:38:43 $ * par : $Author: mazelier $ */ @@ -162,10 +162,10 @@ } /* liste des events de l'objet courant - les evenements sont decrits par un tag - addMethod sera utilisee pour decrire l'event - sous ce tag un objet de type EventHandler avec sa methode create - dessous on trouve l'ensemble des proprietes de l'event (source, action ...)*/ + les evenements sont decrits par un tag + addMethod sera utilisee pour decrire l'event + sous ce tag un objet de type EventHandler avec sa methode create + dessous on trouve l'ensemble des proprietes de l'event (source, action ...)*/ List eventsElement = current.selectNodes("void/object[@class=\"java.beans.EventHandler\" and @method=\"create\"]"); for(Iterator i = eventsElement.iterator(); i.hasNext();){ @@ -251,13 +251,13 @@ /* Modele d'un event - - source - target - handler - arguments (attention ou ) - action - + + source + target + handler + arguments (attention ou ) + action + */ // parfois il n'y aura pas d'arguments et il est possible que handler soit vide ! @@ -303,44 +303,78 @@ // sous l'objet courant, on cherche la methode add du tag void puis on recupere l'objet se trouvant sous ce tag. L'enfant est alors identifie par un id ou idref (si l'objet a deja ete defini) List childrenElement = current.selectNodes("void[@method=\"add\"]/object"); - for(Iterator i = childrenElement.iterator(); i.hasNext();){ - Element childElem = (Element)i.next(); - String id = childElem.attributeValue("idref"); - // selectionner l'enfant qui possede le meme id que l'idref - // cet enfant se trouve dans les descendants du noeud root - if(childElem.attributeValue("idref") != null){ - childElem = (Element)rootElement.selectSingleNode("descendant::[@id=\""+id+"\"]"); - } - UIModelObjectImpl child = parseObject(childElem, parent); - id = childElem.attributeValue("id"); + if (!childrenElement.isEmpty()){ - // selectionner la constraint - // sous la propriete layout de l'objet, il y a l'argument object layout - // sous cet objet layout, se trouve la methode addLayoutComponent - // avec object ajoute au container avec un idref qui doit etre identique a l'un des enfants vus precedemment (definis dans la methode add) (cet objet est toujours en premiere position - // en deuxieme position se trouve la constrainte du premier object (string ou object) - Element constraintElem = (Element)current.selectSingleNode("descendant::void[@property=\"layout\"]/object[(@class)]/void[@method=\"addLayoutComponent\"]/object[1][(@idref=\""+id+"\") or (@id=\""+id+"\")]/../*[2][(self::object) or (self::string)]"); - - // ATTENTION : dans l'expression XPath on trouve deux conditions car dans le cas des panels generes l'argument de la proptriete layout n'apparait pas, nous n'avons pas du determine l'origine de l'erreur - if(constraintElem==null){ - constraintElem = (Element)current.selectSingleNode("descendant::void[@property=\"layout\"]/void[@method=\"addLayoutComponent\"]/object[1][(@idref=\""+id+"\") or (@id=\""+id+"\")]/../*[2][(self::object) or (self::string)]"); - } + for(Iterator i = childrenElement.iterator(); i.hasNext();){ + + Element childElem = (Element)i.next(); + String id = childElem.attributeValue("idref"); + // selectionner l'enfant qui possede le meme id que l'idref + // cet enfant se trouve dans les descendants du noeud root + if(childElem.attributeValue("idref") != null){ + childElem = (Element)rootElement.selectSingleNode("descendant::[@id=\""+id+"\"]"); + } + UIModelObjectImpl child = parseObject(childElem, parent); + id = childElem.attributeValue("id"); + + // selectionner la constraint + // sous la propriete layout de l'objet, il y a l'argument object layout + // sous cet objet layout, se trouve la methode addLayoutComponent + // avec object ajoute au container avec un idref qui doit etre identique a l'un des enfants vus precedemment (definis dans la methode add) (cet objet est toujours en premiere position + // en deuxieme position se trouve la constrainte du premier object (string ou object) + Element constraintElem = (Element)current.selectSingleNode("descendant::void[@property=\"layout\"]/object[(@class)]/void[@method=\"addLayoutComponent\"]/object[1][(@idref=\""+id+"\") or (@id=\""+id+"\")]/../*[2][(self::object) or (self::string)]"); + + // ATTENTION : dans l'expression XPath on trouve deux conditions car dans le cas des panels generes l'argument de la proptriete layout n'apparait pas, nous n'avons pas du determine l'origine de l'erreur + if(constraintElem==null){ + constraintElem = (Element)current.selectSingleNode("descendant::void[@property=\"layout\"]/void[@method=\"addLayoutComponent\"]/object[1][(@idref=\""+id+"\") or (@id=\""+id+"\")]/../*[2][(self::object) or (self::string)]"); + } + + UIModelConstraintImpl constraint = null; + + if(constraintElem != null){ + constraint = parseConstraint(constraintElem, parent); + } + + // uimodelChild est compose un child et d'une contrainte + UIModelChildImpl ch = new UIModelChildImpl(); + ch.setObject(child); + ch.setConstraint(constraint); + + //child.setConstraint(constraint); - UIModelConstraintImpl constraint = null; + result.add(ch); - if(constraintElem != null){ - constraint = parseConstraint(constraintElem, parent); } + }else{ + + childrenElement = current.selectNodes("void[@property=\"layout\"]/void[@method=\"addLayoutComponent\"]"); + + for(Iterator i = childrenElement.iterator(); i.hasNext();){ - // uimodelChild est compose un child et d'une contrainte - UIModelChildImpl ch = new UIModelChildImpl(); - ch.setObject(child); - ch.setConstraint(constraint); + Element objElem = (Element)i.next(); + Element childElem = (Element)objElem.selectSingleNode("object[1]"); + UIModelObjectImpl child = parseObject(childElem, parent); - //child.setConstraint(constraint); + Element constraintElem = (Element)current.selectSingleNode("*[2][(self::object) or (self::string)]"); - result.add(ch); + UIModelConstraintImpl constraint = null; + + if(constraintElem != null){ + constraint = parseConstraint(constraintElem, parent); + } + + // uimodelChild est compose un child et d'une contrainte + UIModelChildImpl ch = new UIModelChildImpl(); + ch.setObject(child); + ch.setConstraint(constraint); + + //child.setConstraint(constraint); + + result.add(ch); + + } } + return result; }