Index: lutingenerator/src/java/org/codelutin/generator/models/ui/xml/UIModelConstraintImpl.java diff -u lutingenerator/src/java/org/codelutin/generator/models/ui/xml/UIModelConstraintImpl.java:1.5 lutingenerator/src/java/org/codelutin/generator/models/ui/xml/UIModelConstraintImpl.java:1.6 --- lutingenerator/src/java/org/codelutin/generator/models/ui/xml/UIModelConstraintImpl.java:1.5 Tue Aug 10 17:00:48 2004 +++ lutingenerator/src/java/org/codelutin/generator/models/ui/xml/UIModelConstraintImpl.java Fri May 25 16:14:20 2007 @@ -23,66 +23,63 @@ * * @author Benjamin Poussin Copyright Code Lutin * - * @version $Revision: 1.5 $ + * @version $Revision: 1.6 $ * - * Mise a jour: $Date: 2004/08/10 17:00:48 $ par : $Author: mazelier $ + * Mise a jour: $Date: 2007/05/25 16:14:20 $ par : $Author: chatellier $ */ package org.codelutin.generator.models.ui.xml; -import org.codelutin.generator.models.ui.UIModel; -import org.codelutin.generator.models.ui.UIModelObject; import org.codelutin.generator.models.ui.UIModelConstraint; public class UIModelConstraintImpl implements UIModelConstraint { // UIModelConstraintImpl - protected UIModel model = null; + // protected UIModel model = null; + // protected UIModelObject parent = null; - protected UIModelObject parent = null; - - // valeur de la constraint de type UIModelObject ou String (cas du - // borderLayout) - protected Object value = null; - - public UIModelConstraintImpl(UIModel model, UIModelObject parent) { - this.model = model; - this.parent = parent; - } - - public UIModelObjectImpl parsetObject(UIModelObjectImpl value) { - if (value == null) { - return new UIModelObjectImpl(model, parent); - } - - this.value = value; - return value; - } - - public void parsetString(String value) { - this.value = value; - } - - /** - * Returns the value of this constraint. the value returned can be an - * instance of UIModelObject or String or null - * - * @return the value of this constraint. - */ - public Object getValue() { - return value; - } - - /** - * Returns the value of this constraint if the type is String else return - * null - * - * @return the value of this constraint. - */ - public String getStringValue() { - if (value instanceof String) - return (String) value; - return null; - } + // valeur de la constraint de type UIModelObject ou String (cas du + // borderLayout) + protected Object value = null; + + public UIModelConstraintImpl() { + // this.model = model; + // this.parent = parent; + } + + public void setObject(UIModelObjectImpl value) { + // if (value == null) { + // return new UIModelObjectImpl(model, parent); + // } + + this.value = value; + // return value; + } + + public void setString(String value) { + this.value = value; + } + + /** + * Returns the value of this constraint. the value returned can be an + * instance of UIModelObject or String or null + * + * @return the value of this constraint. + */ + public Object getValue() { + return value; + } + + /** + * Returns the value of this constraint if the type is String else return + * null + * + * @return the value of this constraint. + */ + public String getStringValue() { + if (value instanceof String) + return (String) value; + return null; + } } // UIModelConstraintImpl Index: lutingenerator/src/java/org/codelutin/generator/models/ui/xml/UIModelChildImpl.java diff -u lutingenerator/src/java/org/codelutin/generator/models/ui/xml/UIModelChildImpl.java:1.2 lutingenerator/src/java/org/codelutin/generator/models/ui/xml/UIModelChildImpl.java:1.3 --- lutingenerator/src/java/org/codelutin/generator/models/ui/xml/UIModelChildImpl.java:1.2 Tue Aug 10 17:00:48 2004 +++ lutingenerator/src/java/org/codelutin/generator/models/ui/xml/UIModelChildImpl.java Fri May 25 16:14:20 2007 @@ -23,70 +23,69 @@ * * @author Benjamin Poussin * Copyright Code Lutin - * @version $Revision: 1.2 $ + * @version $Revision: 1.3 $ * - * Mise a jour: $Date: 2004/08/10 17:00:48 $ - * par : $Author: mazelier $ + * Mise a jour: $Date: 2007/05/25 16:14:20 $ + * par : $Author: chatellier $ */ package org.codelutin.generator.models.ui.xml; -import org.codelutin.generator.models.ui.UIModel; -import org.codelutin.generator.models.ui.UIModelObject; import org.codelutin.generator.models.ui.UIModelChild; import org.codelutin.generator.models.ui.UIModelConstraint; +import org.codelutin.generator.models.ui.UIModelObject; public class UIModelChildImpl implements UIModelChild { // UIModelChildImpl - protected UIModel model = null; - protected UIModelObject parent = null; - - protected UIModelObject object = null; - protected UIModelConstraintImpl constraint = null; + // protected UIModel model = null; + // protected UIModelObject parent = null; - public UIModelChildImpl(UIModel model, UIModelObject parent) { - this.model = model; - this.parent = parent; - } - - public UIModelObject parsetObject(UIModelObject object) { - if(object == null) { - return new UIModelObjectImpl(model, parent); - } - - this.object = object; - return object; - } - - public UIModelConstraintImpl parsetLayout(UIModelConstraintImpl constraint) { - if (constraint == null) - return new UIModelConstraintImpl(model, parent); - - this.constraint = constraint; - return constraint; - } - - /** - * Returns a UIModelObject for this child. - * @see UIModelObject - * - * @return a UIModelObject for this child. - */ - public UIModelObject getObject() { - return object; - } - - /** - * Returns a UIModelConstraint for this child - * @see UIModelConstraint - * - * @return a UIModelConstraint for this child. - */ - public UIModelConstraint getConstraint() { - return constraint; - } + protected UIModelObject object = null; + protected UIModelConstraintImpl constraint = null; + public UIModelChildImpl() { + super(); + } + + public void setObject(UIModelObject object) { + // if(object == null) { + // return new UIModelObjectImpl(model, parent); + // } + + this.object = object; + // return object; + } + + public void setLayout(UIModelConstraintImpl constraint) { + // if (constraint == null) + // return new UIModelConstraintImpl(model, parent); + + this.constraint = constraint; + // return constraint; + } + + /** + * Returns a UIModelObject for this child. + * + * @see UIModelObject + * + * @return a UIModelObject for this child. + */ + public UIModelObject getObject() { + return object; + } + + /** + * Returns a UIModelConstraint for this child + * + * @see UIModelConstraint + * + * @return a UIModelConstraint for this child. + */ + public UIModelConstraint getConstraint() { + return constraint; + } } // UIModelChildImpl Index: lutingenerator/src/java/org/codelutin/generator/models/ui/xml/UIModelEventImpl.java diff -u lutingenerator/src/java/org/codelutin/generator/models/ui/xml/UIModelEventImpl.java:1.5 lutingenerator/src/java/org/codelutin/generator/models/ui/xml/UIModelEventImpl.java:1.6 --- lutingenerator/src/java/org/codelutin/generator/models/ui/xml/UIModelEventImpl.java:1.5 Tue Aug 10 17:00:48 2004 +++ lutingenerator/src/java/org/codelutin/generator/models/ui/xml/UIModelEventImpl.java Fri May 25 16:14:20 2007 @@ -23,90 +23,99 @@ * * @author Benjamin Poussin * Copyright Code Lutin - * @version $Revision: 1.5 $ + * @version $Revision: 1.6 $ * - * Mise a jour: $Date: 2004/08/10 17:00:48 $ - * par : $Author: mazelier $ + * Mise a jour: $Date: 2007/05/25 16:14:20 $ + * par : $Author: chatellier $ */ package org.codelutin.generator.models.ui.xml; -import org.codelutin.generator.models.ui.UIModel; import org.codelutin.generator.models.ui.UIModelEvent; public class UIModelEventImpl implements UIModelEvent { // UIModelEventImpl - protected UIModel model = null; + //protected UIModel model = null; - protected String addMethod = null; - protected String source = null; - protected String action = null; - protected String handler = null; - protected String argument = null; - - public UIModelEventImpl(UIModel model) { - this.model = model; - } - - public void parsetAddmethod(String addMethod) { - this.addMethod = addMethod; - } - - public void parsetSource(String source) { - this.source = source; - } - - public void parsetAction(String action) { - this.action = action; - } - - public void parsetHandler(String handler) { - this.handler = handler; - } - - public void parsetArgument(String argument) { - this.argument = argument; - } - - /** - * Return the method which will have the EventHandler in parameter - * @return String - */ - public String getAddMethod() { - return addMethod; - } - - /** - * Return the listener interface to create a proxy for - * @return String - */ - public String getSource() { - return source; - } - - /** - * Return the name of the method in the listener interface that should trigger the action - * @return String - */ - public String getAction() { - return action; - } - - /** - * Return the name of a writable method on the target - * @return String - */ - public String getHandler() { - return handler; - } - - /** - * Return the name of a readable property of the incoming event - * @return String - */ - public String getArgument() { - return argument; - } + protected String addMethod = null; + + protected String source = null; + + protected String action = null; + + protected String handler = null; + + protected String argument = null; + + public UIModelEventImpl() { + super(); + } + + public void setAddmethod(String addMethod) { + this.addMethod = addMethod; + } + + public void setSource(String source) { + this.source = source; + } + + public void setAction(String action) { + this.action = action; + } + + public void setHandler(String handler) { + this.handler = handler; + } + + public void setArgument(String argument) { + this.argument = argument; + } + + /** + * Return the method which will have the EventHandler in parameter + * + * @return String + */ + public String getAddMethod() { + return addMethod; + } + + /** + * Return the listener interface to create a proxy for + * + * @return String + */ + public String getSource() { + return source; + } + + /** + * Return the name of the method in the listener interface that should + * trigger the action + * + * @return String + */ + public String getAction() { + return action; + } + + /** + * Return the name of a writable method on the target + * + * @return String + */ + public String getHandler() { + return handler; + } + + /** + * Return the name of a readable property of the incoming event + * + * @return String + */ + public String getArgument() { + return argument; + } } // UIModelEventImpl Index: lutingenerator/src/java/org/codelutin/generator/models/ui/xml/UIModelImpl.java diff -u lutingenerator/src/java/org/codelutin/generator/models/ui/xml/UIModelImpl.java:1.3 lutingenerator/src/java/org/codelutin/generator/models/ui/xml/UIModelImpl.java:1.4 --- lutingenerator/src/java/org/codelutin/generator/models/ui/xml/UIModelImpl.java:1.3 Mon Jun 7 16:11:21 2004 +++ lutingenerator/src/java/org/codelutin/generator/models/ui/xml/UIModelImpl.java Fri May 25 16:14:20 2007 @@ -23,16 +23,18 @@ * * @author Benjamin Poussin * Copyright Code Lutin - * @version $Revision: 1.3 $ + * @version $Revision: 1.4 $ * - * Mise a jour: $Date: 2004/06/07 16:11:21 $ - * par : $Author: mazelier $ + * Mise a jour: $Date: 2007/05/25 16:14:20 $ + * par : $Author: chatellier $ */ package org.codelutin.generator.models.ui.xml; -import java.util.HashMap; import java.util.Collection; +import java.util.HashMap; +import java.util.Map; + import org.codelutin.generator.models.ui.UIModel; import org.codelutin.generator.models.ui.UIModelObject; @@ -42,35 +44,46 @@ protected String packageUIModel = null; protected UIModelObjectImpl root = null; - /** Contient tous les objets du model. - * key: nom de l'objet; value: l'objet - */ - protected HashMap objects = new HashMap(); + /** + * Contient tous les objets du model. + * key: nom de l'objet; value: l'objet + */ + protected Map objects = new HashMap(); public UIModelImpl() { + super(); } - public void parsetVersion(String version) { + public void setVersion(String version) { this.version = version; } - public void parsetPackage(String packageUIModel) { + public void setPackage(String packageUIModel) { this.packageUIModel = packageUIModel; } - public UIModelObjectImpl parsetObject(UIModelObjectImpl object) { - if (object == null) { - return new UIModelObjectImpl(this, null); - } + /** + * TODO pas setObject, mais addObject + * TODO il y aurait ambiguite lors de l'appel par digester + * @param object + */ + public void setObject(UIModelObjectImpl object) { + //if (object == null) { + // return new UIModelObjectImpl(this, null); + //} + + // set model and parent + object.setParent(null); + object.setModel(this); + root = object; addObject(root); - return object; + //return object; } /** * Method used to add objects in this model * @see UIModelObject - * */ public void addObject(UIModelObject object) { if(object.getName() != null){ @@ -113,7 +126,7 @@ * * @return a Collection containing all UIModelObjects for this ui model. */ - public Collection getObjects() { + public Collection getObjects() { return objects.values(); } Index: lutingenerator/src/java/org/codelutin/generator/models/ui/xml/UIModelArgumentsImpl.java diff -u lutingenerator/src/java/org/codelutin/generator/models/ui/xml/UIModelArgumentsImpl.java:1.3 lutingenerator/src/java/org/codelutin/generator/models/ui/xml/UIModelArgumentsImpl.java:1.4 --- lutingenerator/src/java/org/codelutin/generator/models/ui/xml/UIModelArgumentsImpl.java:1.3 Wed Jun 9 15:55:07 2004 +++ lutingenerator/src/java/org/codelutin/generator/models/ui/xml/UIModelArgumentsImpl.java Fri May 25 16:14:20 2007 @@ -23,86 +23,87 @@ * * @author Benjamin Poussin * Copyright Code Lutin - * @version $Revision: 1.3 $ + * @version $Revision: 1.4 $ * - * Mise a jour: $Date: 2004/06/09 15:55:07 $ - * par : $Author: mazelier $ + * Mise a jour: $Date: 2007/05/25 16:14:20 $ + * par : $Author: chatellier $ */ package org.codelutin.generator.models.ui.xml; -import org.codelutin.generator.models.ui.UIModel; -import org.codelutin.generator.models.ui.UIModelObject; -import org.codelutin.generator.models.ui.UIModelArguments; import java.util.ArrayList; +import java.util.List; + +import org.codelutin.generator.models.ui.UIModelArguments; +import org.codelutin.generator.models.ui.UIModelObject; public class UIModelArgumentsImpl implements UIModelArguments { // UIModelArgumentsImpl - protected UIModel model = null; - protected UIModelObject parent = null; - // Liste des arguments de differents types (object, int, bool, String, ...) - protected ArrayList arguments = new ArrayList(); - - public UIModelArgumentsImpl(UIModel model, UIModelObject parent) { - this.model = model; - this.parent = parent; - } - - public UIModelObject parsetObject(UIModelObject value) { - if(value == null) { - return new UIModelObjectImpl(model, parent); - } - - arguments.add(value); - return value; - } - - public void parsetInt(Integer value) { - arguments.add(value); - } - - public void parsetBoolean(Boolean value) { - arguments.add(value); - } - - public void parsetChar(Character value) { - arguments.add(value); - } - - public void parsetString(String value) { - arguments.add(value); - } - - public void parsetLong(Long value) { - arguments.add(value); - } - - public void parsetFloat(Float value) { - arguments.add(value); - } - - public void parsetByte(Byte value) { - arguments.add(value); - } - - public void parsetShort(Short value) { - arguments.add(value); - } - - public void parsetDouble(Double value) { - arguments.add(value); - } - - /** - * Returns a arguments list. - * @see UIModelObject - * This list can contain UIModelObject or a primitive type - * - * @return a arguments list. - */ - public ArrayList getArguments(){ - return arguments; - } + // protected UIModel model = null; + // protected UIModelObject parent = null; + // Liste des arguments de differents types (object, int, bool, String, ...) + protected List arguments = new ArrayList(); + + public UIModelArgumentsImpl() { + super(); + } + + public void addObject(UIModelObject value) { + // if(value == null) { + // return new UIModelObjectImpl(model, parent); + // } + + arguments.add(value); + // return value; + } + + public void addInt(Integer value) { + arguments.add(value); + } + + public void addBoolean(Boolean value) { + arguments.add(value); + } + + public void addChar(Character value) { + arguments.add(value); + } + + public void addString(String value) { + arguments.add(value); + } + + public void addLong(Long value) { + arguments.add(value); + } + + public void addFloat(Float value) { + arguments.add(value); + } + + public void addByte(Byte value) { + arguments.add(value); + } + + public void addShort(Short value) { + arguments.add(value); + } + + public void addDouble(Double value) { + arguments.add(value); + } + + /** + * Returns a arguments list. + * + * @see UIModelObject This list can contain UIModelObject or a primitive + * type + * + * @return a arguments list. + */ + public List getArguments() { + return arguments; + } } // UIModelArgumentsImpl Index: lutingenerator/src/java/org/codelutin/generator/models/ui/xml/UIModelPropertyImpl.java diff -u lutingenerator/src/java/org/codelutin/generator/models/ui/xml/UIModelPropertyImpl.java:1.5 lutingenerator/src/java/org/codelutin/generator/models/ui/xml/UIModelPropertyImpl.java:1.6 --- lutingenerator/src/java/org/codelutin/generator/models/ui/xml/UIModelPropertyImpl.java:1.5 Wed Jun 30 13:27:25 2004 +++ lutingenerator/src/java/org/codelutin/generator/models/ui/xml/UIModelPropertyImpl.java Fri May 25 16:14:20 2007 @@ -23,152 +23,159 @@ * * @author Benjamin Poussin * Copyright Code Lutin - * @version $Revision: 1.5 $ + * @version $Revision: 1.6 $ * - * Mise a jour: $Date: 2004/06/30 13:27:25 $ - * par : $Author: pineau $ + * Mise a jour: $Date: 2007/05/25 16:14:20 $ + * par : $Author: chatellier $ */ package org.codelutin.generator.models.ui.xml; -import org.codelutin.generator.models.ui.UIModel; -import org.codelutin.generator.models.ui.UIModelObject; import org.codelutin.generator.models.ui.UIModelProperty; public class UIModelPropertyImpl implements UIModelProperty { // UIModelPropertyImpl - protected UIModel model = null; - protected UIModelObject parent = null; + // protected UIModel model = null; + // protected UIModelObject parent = null; - protected String name = null; - protected UIModelArgumentsImpl arguments = null; + protected String name = null; + protected UIModelArgumentsImpl arguments = null; - public UIModelPropertyImpl(UIModel model, UIModelObject parent) { - this.model = model; - this.parent = parent; - } - - public void parsetName(String name) { - this.name = name; - } - - public UIModelArgumentsImpl parsetArguments(UIModelArgumentsImpl argument) { - if (argument == null) { - return new UIModelArgumentsImpl(model, parent); - } - - this.arguments = argument; - return argument; - } - - /** - * Returns the name of this property. - * - * @return the name of this property. - */ - public String getName() { - return name; - } - - /** - * Returns the value of this property. - * the value returned can be an instance of UIModelObject - * or String or Integer or Boolean or Character - * @return the value of this property. - */ - public Object getValue() { - int i = (arguments.getArguments().size())-1; - return arguments.getArguments().get(i); - } - - /** - * Returns the index of this property if it's indexed property - * - * @return the index of this property. - */ - public int getIndex() throws Exception{ - if (isIndexed()) { - return ((Integer)arguments.getArguments().get(0)).intValue(); - } - throw new Exception("Impossible d'obtenir l'index d'une propriete non indexee"); - } - - public boolean isIndexed() { - return arguments.getArguments().size() >= 2; - } - - /** - * Returns the value of this property if the type is int - * @return the value of this property. - */ - public int getIntValue() { - return ((Integer)getValue()).intValue(); - } - - /** - * Returns the value of this property if the type is boolean - * @return the value of this property. - */ - public boolean getBooleanValue() { - return ((Boolean)getValue()).booleanValue(); - } - - /** - * Returns the value of this property if the type is char - * @return the value of this property. - */ - public char getCharValue() { - return ((Character)getValue()).charValue(); - } - - /** - * Returns the value of this property if the type is String - * @return the value of this property. - */ - public String getStringValue() { - return getValue().toString(); - } - - /** - * Returns the value of this property if the type is byte - * @return the value of this property. - */ - public byte getByteValue() { - return ((Byte)getValue()).byteValue(); - } - - /** - * Returns the value of this property if the type is long - * @return the value of this property. - */ - public long getLongValue() { - return ((Long)getValue()).longValue(); - } - - /** - * Returns the value of this property if the type is short - * @return the value of this property. - */ - public short getShortValue() { - return ((Short)getValue()).shortValue(); - } - - /** - * Returns the value of this property if the type is float - * @return the value of this property. - */ - public float getFloatValue() { - return ((Float)getValue()).floatValue(); - } - - /** - * Returns the value of this property if the type is double - * @return the value of this property. - */ - public double getDoubleValue() { - return ((Double)getValue()).doubleValue(); - } + public UIModelPropertyImpl() { + super(); + } + + public void setName(String name) { + this.name = name; + } + + public void setArguments(UIModelArgumentsImpl argument) { + // if (argument == null) { + // return new UIModelArgumentsImpl(model, parent); + // } + + this.arguments = argument; + // return argument; + } + + /** + * Returns the name of this property. + * + * @return the name of this property. + */ + public String getName() { + return name; + } + + /** + * Returns the value of this property. the value returned can be an instance + * of UIModelObject or String or Integer or Boolean or Character + * + * @return the value of this property. + */ + public Object getValue() { + int i = (arguments.getArguments().size()) - 1; + return arguments.getArguments().get(i); + } + + /** + * Returns the index of this property if it's indexed property + * + * @return the index of this property. + */ + public int getIndex() throws Exception { + if (isIndexed()) { + return ((Integer) arguments.getArguments().get(0)).intValue(); + } + throw new Exception( + "Impossible d'obtenir l'index d'une propriete non indexee"); + } + + public boolean isIndexed() { + return arguments.getArguments().size() >= 2; + } + + /** + * Returns the value of this property if the type is int + * + * @return the value of this property. + */ + public int getIntValue() { + return ((Integer) getValue()).intValue(); + } + + /** + * Returns the value of this property if the type is boolean + * + * @return the value of this property. + */ + public boolean getBooleanValue() { + return ((Boolean) getValue()).booleanValue(); + } + + /** + * Returns the value of this property if the type is char + * + * @return the value of this property. + */ + public char getCharValue() { + return ((Character) getValue()).charValue(); + } + + /** + * Returns the value of this property if the type is String + * + * @return the value of this property. + */ + public String getStringValue() { + return getValue().toString(); + } + + /** + * Returns the value of this property if the type is byte + * + * @return the value of this property. + */ + public byte getByteValue() { + return ((Byte) getValue()).byteValue(); + } + + /** + * Returns the value of this property if the type is long + * + * @return the value of this property. + */ + public long getLongValue() { + return ((Long) getValue()).longValue(); + } + + /** + * Returns the value of this property if the type is short + * + * @return the value of this property. + */ + public short getShortValue() { + return ((Short) getValue()).shortValue(); + } + + /** + * Returns the value of this property if the type is float + * + * @return the value of this property. + */ + public float getFloatValue() { + return ((Float) getValue()).floatValue(); + } + + /** + * Returns the value of this property if the type is double + * + * @return the value of this property. + */ + public double getDoubleValue() { + return ((Double) getValue()).doubleValue(); + } } // UIModelPropertyImpl Index: lutingenerator/src/java/org/codelutin/generator/models/ui/xml/UIModelObjectImpl.java diff -u lutingenerator/src/java/org/codelutin/generator/models/ui/xml/UIModelObjectImpl.java:1.7 lutingenerator/src/java/org/codelutin/generator/models/ui/xml/UIModelObjectImpl.java:1.8 --- lutingenerator/src/java/org/codelutin/generator/models/ui/xml/UIModelObjectImpl.java:1.7 Wed Jan 4 13:29:11 2006 +++ lutingenerator/src/java/org/codelutin/generator/models/ui/xml/UIModelObjectImpl.java Fri May 25 16:14:20 2007 @@ -23,17 +23,19 @@ * * @author Benjamin Poussin Copyright Code Lutin * - * @version $Revision: 1.7 $ + * @version $Revision: 1.8 $ * - * Mise a jour: $Date: 2006/01/04 13:29:11 $ par : $Author: bpoussin $ + * Mise a jour: $Date: 2007/05/25 16:14:20 $ par : $Author: chatellier $ */ package org.codelutin.generator.models.ui.xml; import java.util.ArrayList; import java.util.Collection; +import java.util.List; import org.codelutin.generator.models.ui.UIModel; +import org.codelutin.generator.models.ui.UIModelChild; import org.codelutin.generator.models.ui.UIModelConstraint; import org.codelutin.generator.models.ui.UIModelEvent; import org.codelutin.generator.models.ui.UIModelObject; @@ -41,219 +43,223 @@ public class UIModelObjectImpl implements UIModelObject { // UIModelObjectImpl - protected UIModel model = null; + protected UIModel model = null; - protected UIModelObject parent = null; + protected UIModelObject parent = null; - protected UIModelConstraint constraint = null; + protected UIModelConstraint constraint = null; - protected String type = null; + protected String type = null; - protected String name = null; - - protected UIModelArgumentsImpl arguments = null; - - protected ArrayList properties = new ArrayList(); - - protected ArrayList events = new ArrayList(); - - /** Collection de UIModelObject */ - protected ArrayList children = new ArrayList(); - - public UIModelObjectImpl(UIModel model, UIModelObject parent) { - this.model = model; - this.parent = parent; - } - - public void parsetClass(String type) { - this.type = type; - } - - public UIModelArgumentsImpl parsetArguments(UIModelArgumentsImpl argument) { - if (argument == null) { - return new UIModelArgumentsImpl(model, this); - } - - this.arguments = argument; - return argument; - } - - public UIModelPropertyImpl parsetProperty(UIModelPropertyImpl property) { - if (property == null) { - return new UIModelPropertyImpl(model, this); - } - - if (property.getValue() instanceof UIModelObjectImpl) { - getUIModel().addObject((UIModelObject)property.getValue()); - } - - if (property.getName().equals("name")) { - name = property.getStringValue(); - } - properties.add(property); - return property; - } - - public UIModelEventImpl parsetEvent(UIModelEventImpl event) { - if (event == null) { - return new UIModelEventImpl(model); - } - - events.add(event); - return event; - } - - public UIModelChildImpl parsetChild(UIModelChildImpl child) { - if (child == null) { - return new UIModelChildImpl(model, this); - } - - UIModelObjectImpl childObject = (UIModelObjectImpl) child.getObject(); - UIModelConstraintImpl childConstraint = (UIModelConstraintImpl) child - .getConstraint(); - childObject.setConstraint(childConstraint); - - getUIModel().addObject(childObject); - - children.add(child); - return child; - } - - /** - * Returns the uimodel of this object. - * - * @return the uimodel of this object. - */ - public UIModel getUIModel() { - return model; - } - - public void setConstraint(UIModelConstraintImpl constraint) { - this.constraint = constraint; - } - - /** - * Returns the parent of this object. Returns null if this object is root - * - * @return the parent of this object. - */ - public UIModelObject getParent() { - return parent; - } - - /** - * Returns the type of this object. - * - * @return the type of this object. - */ - public String getType() { - return type; - } - - /** - * Returns the value of the property "name" of this object - * - * @return the name of this object. - */ - public String getName() { - return name; - } - - /** - * Returns the constraint of this object - * - * @see UIModelConstraint - * - * @return the constraint of this object. - */ - public UIModelConstraint getConstraint() { - return constraint; - } - - /** - * Returns all arguments defined on this object. if this objects hasn't - * arguments return null This collection can contain UIModelObject or a - * primitive type - * - * @return a Collection containing all arguments for this object. - */ - public Collection getArguments() { - if (arguments != null) - return arguments.getArguments(); - return new ArrayList(); - } - - /** - * Returns all properties defined on this object. - * - * @see UIModelProperty - * - * @return a Collection containing all UIModelProperties for this object. - */ - public Collection getProperties() { - return properties; - } - - /** - * Returns the property defined on this object. - * - * @see UIModelProperty - * @param String - * the name of the property which must be returned - * @return a UIModelProperty for this object with the . - */ - public UIModelProperty getProperty(String name) { - - UIModelProperty property = null; - int position = 0; - - while (position < properties.size()) { - - property = (UIModelProperty) properties.get(position); - - if (property.getName().equals(name)) { - break; - } - position++; - } - - if (position >= properties.size()) { - throw new IllegalStateException("Propriete " + name - + " inexistante pour l'objet " + this.name); - } - return property; - } - - /** - * Returns all events defined on this object. - * - * @see UIModelEvent - * - * @return a Collection containing all UIModelEvents for this object. - */ - public Collection getEvents() { - return events; - } - - /** - * Returns all children defined on this object. - * - * @return a Collection containing all UIModelObject for this object. - */ - public Collection getChildren() { - return children; - } - - /** - * Returns the uimodel of this object. - * - * @see UIModel - * - * @return the uimodel of this object. - */ - public UIModel getModel() { - return model; - } + protected String name = null; + + protected UIModelArgumentsImpl arguments = null; + + protected List properties = new ArrayList(); + + protected List events = new ArrayList(); + + /** Collection de UIModelObject */ + protected List children = new ArrayList(); + + public UIModelObjectImpl() { + super(); + } + + public void setClass(String type) { + this.type = type; + } + + public void setArguments(UIModelArgumentsImpl argument) { + // if (argument == null) { + // return new UIModelArgumentsImpl(model, this); + // } + + this.arguments = argument; + // return argument; + } + + public void addProperty(UIModelPropertyImpl property) { + // if (property == null) { + // return new UIModelPropertyImpl(model, this); + // } + + if (property.getValue() instanceof UIModelObjectImpl) { + getModel().addObject((UIModelObject) property.getValue()); + } + + if (property.getName().equals("name")) { + name = property.getStringValue(); + } + properties.add(property); + // return property; + } + + public void addEvent(UIModelEventImpl event) { + // if (event == null) { + // return new UIModelEventImpl(model); + // } + + events.add(event); + // return event; + } + + public void addChild(UIModelChildImpl child) { + // if (child == null) { + // return new UIModelChildImpl(model, this); + // } + + UIModelObjectImpl childObject = (UIModelObjectImpl) child.getObject(); + UIModelConstraintImpl childConstraint = (UIModelConstraintImpl) child + .getConstraint(); + childObject.setConstraint(childConstraint); + + getModel().addObject(childObject); + + children.add(child); + // return child; + } + + public void setConstraint(UIModelConstraintImpl constraint) { + this.constraint = constraint; + } + + /** + * Returns the parent of this object. Returns null if this object is root + * + * @return the parent of this object. + */ + public UIModelObject getParent() { + return parent; + } + + /** + * Set the parent of this object. + */ + public void setParent(UIModelObject parent) { + this.parent = parent; + } + + /** + * Returns the type of this object. + * + * @return the type of this object. + */ + public String getType() { + return type; + } + + /** + * Returns the value of the property "name" of this object + * + * @return the name of this object. + */ + public String getName() { + return name; + } + + /** + * Returns the constraint of this object + * + * @see UIModelConstraint + * + * @return the constraint of this object. + */ + public UIModelConstraint getConstraint() { + return constraint; + } + + /** + * Returns all arguments defined on this object. if this objects hasn't + * arguments return null This collection can contain UIModelObject or a + * primitive type + * + * @return a Collection containing all arguments for this object. + */ + public Collection getArguments() { + if (arguments != null) + return arguments.getArguments(); + return new ArrayList(); + } + + /** + * Returns all properties defined on this object. + * + * @see UIModelProperty + * + * @return a Collection containing all UIModelProperties for this object. + */ + public Collection getProperties() { + return properties; + } + + /** + * Returns the property defined on this object. + * + * @see UIModelProperty + * @param String + * the name of the property which must be returned + * @return a UIModelProperty for this object with the . + */ + public UIModelProperty getProperty(String name) { + + UIModelProperty property = null; + int position = 0; + + while (position < properties.size()) { + + property = (UIModelProperty) properties.get(position); + + if (property.getName().equals(name)) { + break; + } + position++; + } + + if (position >= properties.size()) { + throw new IllegalStateException("Propriete " + name + + " inexistante pour l'objet " + this.name); + } + return property; + } + + /** + * Returns all events defined on this object. + * + * @see UIModelEvent + * + * @return a Collection containing all UIModelEvents for this object. + */ + public Collection getEvents() { + return events; + } + + /** + * Returns all children defined on this object. + * + * @return a Collection containing all UIModelObject for this object. + */ + public Collection getChildren() { + return children; + } + + /** + * Returns the uimodel of this object. + * + * @see UIModel + * + * @return the uimodel of this object. + */ + public UIModel getModel() { + return model; + } + + /** + * Set model + */ + public void setModel(UIModel model) { + this.model = model; + } } // UIModelObjectImpl Index: lutingenerator/src/java/org/codelutin/generator/models/ui/xml/DigesterUIModelRuleSet.java diff -u /dev/null lutingenerator/src/java/org/codelutin/generator/models/ui/xml/DigesterUIModelRuleSet.java:1.1 --- /dev/null Fri May 25 16:14:27 2007 +++ lutingenerator/src/java/org/codelutin/generator/models/ui/xml/DigesterUIModelRuleSet.java Fri May 25 16:14:20 2007 @@ -0,0 +1,71 @@ +/* *##% + * Copyright (C) 2007 Code Lutin + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * 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 Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + *##%*/ + +package org.codelutin.generator.models.ui.xml; + +import org.apache.commons.digester.Digester; +import org.apache.commons.digester.RuleSetBase; + +/** + * DigesterUIModelRules + * + * Definit principalement : - la classe d'implementation a utiliser pour chaque + * noeud - la methode a appeler apres chaque noeud + * + * Ce jeu de regle ne cree pas l'element racine. Il doit etre cree et ajoute a + * la pile digester avant l'appel a Digester.parse(File). + * + * Exemple: + * UIModel monModel = new UIModelImpl() + * Digester d = new Digester(); + * d.push(monModel); + * d.parse(file); + * + * + * @author chatellier + * @version $Revision: 1.1 $ + * + * Last update : $Date: 2007/05/25 16:14:20 $ By : $Author: chatellier $ + */ +public class DigesterUIModelRuleSet extends RuleSetBase { + + protected String prefix = null; + + public DigesterUIModelRuleSet() { + this(""); + } + + public DigesterUIModelRuleSet(String prefix) { + super(); + this.prefix = prefix; + this.namespaceURI = "http://www.codelutin.org/lutingenerator/uiModel"; + } + + /* + * (non-Javadoc) + * + * @see org.apache.commons.digester.RuleSetBase#addRuleInstances(org.apache.commons.digester.Digester) + */ + @Override + public void addRuleInstances(Digester d) { + + // FIXME pas d'exemple pour pouvoir definir les regles + + } + +}