Thread: [Bprocessor-commit] model/src/net/sourceforge/bprocessor/model Description.java,NONE,1.1 Edge.java,1
Status: Pre-Alpha
Brought to you by:
henryml
From: Nikolaj B. <nbr...@us...> - 2006-02-28 02:26:31
|
Update of /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17289/src/net/sourceforge/bprocessor/model Modified Files: Edge.java Vertex.java Surface.java ConstructionSpace.java Space.java FunctionalSpace.java Attribute.java Added Files: Description.java Log Message: All that is displayed in the attribute view should now be parametric Index: FunctionalSpace.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/FunctionalSpace.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** FunctionalSpace.java 13 Jan 2006 11:29:26 -0000 1.4 --- FunctionalSpace.java 28 Feb 2006 02:26:25 -0000 1.5 *************** *** 7,10 **** --- 7,14 ---- package net.sourceforge.bprocessor.model; + import java.util.ArrayList; + import java.util.Iterator; + import java.util.List; + import org.apache.log4j.Logger; *************** *** 17,21 **** * column="SPACE_ID" */ ! public class FunctionalSpace extends Space { /** The logger */ private static Logger log = Logger.getLogger(FunctionalSpace.class); --- 21,25 ---- * column="SPACE_ID" */ ! public class FunctionalSpace extends Space implements Parametric { /** The logger */ private static Logger log = Logger.getLogger(FunctionalSpace.class); *************** *** 97,99 **** --- 101,139 ---- return "FunctionalSpace[" + super.toString() + "]"; } + + /** + * Set the attributes of the object to the values in the list + * @param attributes The attributes to set + */ + public void setAttributes(List attributes) { + Iterator iter = attributes.iterator(); + while (iter.hasNext()) { + Attribute a = (Attribute)iter.next(); + if (a.getName().equals("Name")) { + setName((String)a.getValue()); + } else if (a.getName().equals("Description")) { + setDescription(((String)a.getValue().toString())); + } else { + log.error("Wrong attribute for the object " + a); + } + } + } + + /** + * Return a list of the attributes in the object + * @return the list of attributes for the object + */ + public List getAttributes() { + ArrayList res = new ArrayList(); + res.add(new Attribute("Name", getName())); + res.add(new Attribute("Description", getDescription())); + return res; + } + + /** + * @see net.sourceforge.bprocessor.model.Parametric#getGeneralName() + */ + public String getGeneralName() { + return "Functional Space"; + } } Index: Surface.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Surface.java,v retrieving revision 1.74 retrieving revision 1.75 diff -C2 -d -r1.74 -r1.75 *** Surface.java 23 Feb 2006 14:05:13 -0000 1.74 --- Surface.java 28 Feb 2006 02:26:25 -0000 1.75 *************** *** 27,31 **** * usage="read-write" */ ! public class Surface extends Geometric { /** The logger */ private static Logger log = Logger.getLogger(Surface.class); --- 27,31 ---- * usage="read-write" */ ! public class Surface extends Geometric implements Parametric { /** The logger */ private static Logger log = Logger.getLogger(Surface.class); *************** *** 922,924 **** --- 922,972 ---- return getName() + "[" + edges.size() + "]"; } + + + /** + * Set the attributes of the object to the values in the list + * @param attributes The attributes to set + */ + public void setAttributes(List attributes) { + Iterator iter = attributes.iterator(); + while (iter.hasNext()) { + Attribute a = (Attribute)iter.next(); + if (a.getName().equals("Name")) { + continue; + } else if (a.getName().equals("Exterior")) { + continue; + } else if (a.getName().equals("Holes")) { + continue; + } else { + log.error("Wrong attribute for the object " + a); + } + } + } + + /** + * Return a list of the attributes in the object + * @return the list of attributes for the object + */ + public List getAttributes() { + ArrayList res = new ArrayList(); + res.add(new Attribute("Name", getName(), false)); + if (isInner()) { + res.add(new Attribute("Exterior", getExterior(), false)); + } else { + if (holes != null) { + Iterator iterElems = holes.iterator(); + while (iterElems.hasNext()) { + res.add(new Attribute("Hole", iterElems.next(), false)); + } + } + } + return res; + } + + /** + * @see net.sourceforge.bprocessor.model.Parametric#getGeneralName() + */ + public String getGeneralName() { + return "Surface"; + } } Index: Edge.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Edge.java,v retrieving revision 1.37 retrieving revision 1.38 diff -C2 -d -r1.37 -r1.38 *** Edge.java 23 Feb 2006 14:05:13 -0000 1.37 --- Edge.java 28 Feb 2006 02:26:25 -0000 1.38 *************** *** 469,473 **** public List getAttributes() { ArrayList res = new ArrayList(); ! res.add(new Attribute("Name", getName())); res.add(new Attribute("Length", new Double(getLength()))); return res; --- 469,473 ---- public List getAttributes() { ArrayList res = new ArrayList(); ! res.add(new Attribute("Name", getName(), false)); res.add(new Attribute("Length", new Double(getLength()))); return res; Index: Attribute.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Attribute.java,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** Attribute.java 9 Feb 2006 11:52:04 -0000 1.7 --- Attribute.java 28 Feb 2006 02:26:25 -0000 1.8 *************** *** 68,71 **** --- 68,82 ---- /** + * Constructor + * @param name The name + * @param value The value + * @param b Is editable + */ + public Attribute(String name, Object value, boolean b) { + this(name, value); + setEditable(b); + } + + /** * @return Returns the name. */ Index: Space.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Space.java,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** Space.java 8 Feb 2006 10:10:14 -0000 1.18 --- Space.java 28 Feb 2006 02:26:25 -0000 1.19 *************** *** 25,31 **** private String name; /** The Discription */ ! private String description; ! /** The attributes */ ! private Set attributes; /** The envelope (a set of surfaces) */ private Set envelope; --- 25,31 ---- private String name; /** The Discription */ ! private Description description; ! /** The attributes ! private Set attributes; */ /** The envelope (a set of surfaces) */ private Set envelope; *************** *** 51,55 **** super(); setName(name); ! setDescription(""); } --- 51,55 ---- super(); setName(name); ! description = new Description(""); } *************** *** 95,99 **** */ public void setDescription(String des) { ! this.description = des; } --- 95,99 ---- */ public void setDescription(String des) { ! this.description = new Description(des); } *************** *** 103,107 **** * @hibernate.property */ ! public String getDescription() { return description; } --- 103,107 ---- * @hibernate.property */ ! public Description getDescription() { return description; } *************** *** 118,133 **** * @hibernate.one-to-many * class="net.sourceforge.bprocessor.model.Attribute" ! */ public Set getAttributes() { return attributes; ! } /** * Set the attributes * @param attributes The attributes ! */ public void setAttributes(Set attributes) { this.attributes = attributes; ! } /** --- 118,133 ---- * @hibernate.one-to-many * class="net.sourceforge.bprocessor.model.Attribute" ! public Set getAttributes() { return attributes; ! } */ /** * Set the attributes * @param attributes The attributes ! public void setAttributes(Set attributes) { this.attributes = attributes; ! } */ /** Index: Vertex.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Vertex.java,v retrieving revision 1.27 retrieving revision 1.28 diff -C2 -d -r1.27 -r1.28 *** Vertex.java 23 Feb 2006 14:05:13 -0000 1.27 --- Vertex.java 28 Feb 2006 02:26:25 -0000 1.28 *************** *** 367,371 **** public List getAttributes() { ArrayList res = new ArrayList(); ! res.add(new Attribute("Name", getName())); res.add(new Attribute("X", new Double(getX()))); res.add(new Attribute("Y", new Double(getY()))); --- 367,372 ---- public List getAttributes() { ArrayList res = new ArrayList(); ! ! res.add(new Attribute("Name", getName(), false)); res.add(new Attribute("X", new Double(getX()))); res.add(new Attribute("Y", new Double(getY()))); --- NEW FILE: Description.java --- //--------------------------------------------------------------------------------- // $Id: Description.java,v 1.1 2006/02/28 02:26:25 nbramsen Exp $ // // Copyright (c) 2005 The BProcessor Team (http://bprocessor.sourceforge.net) // Released under the Lesser GNU Public License v2.1 //--------------------------------------------------------------------------------- package net.sourceforge.bprocessor.model; /** * The Description class */ public class Description { /** The current description */ private String description; /** * Constructor * @param des is the Description */ public Description(String des) { description = des; } /** * Return the descriptoin * @return The description in string format */ public String toString() { return description.toString(); } } Index: ConstructionSpace.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/ConstructionSpace.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** ConstructionSpace.java 13 Jan 2006 11:29:26 -0000 1.4 --- ConstructionSpace.java 28 Feb 2006 02:26:25 -0000 1.5 *************** *** 7,10 **** --- 7,14 ---- package net.sourceforge.bprocessor.model; + import java.util.ArrayList; + import java.util.Iterator; + import java.util.List; + import org.apache.log4j.Logger; *************** *** 17,21 **** * column="SPACE_ID" */ ! public class ConstructionSpace extends Space { /** The logger */ private static Logger log = Logger.getLogger(ConstructionSpace.class); --- 21,25 ---- * column="SPACE_ID" */ ! public class ConstructionSpace extends Space implements Parametric { /** The logger */ private static Logger log = Logger.getLogger(ConstructionSpace.class); *************** *** 97,99 **** --- 101,139 ---- return "ConstructionSpace[" + super.toString() + "]"; } + + /** + * Set the attributes of the object to the values in the list + * @param attributes The attributes to set + */ + public void setAttributes(List attributes) { + Iterator iter = attributes.iterator(); + while (iter.hasNext()) { + Attribute a = (Attribute)iter.next(); + if (a.getName().equals("Name")) { + setName((String)a.getValue()); + } else if (a.getName().equals("Description")) { + setDescription(((String)a.getValue().toString())); + } else { + log.error("Wrong attribute for the object " + a); + } + } + } + + /** + * Return a list of the attributes in the object + * @return the list of attributes for the object + */ + public List getAttributes() { + ArrayList res = new ArrayList(); + res.add(new Attribute("Name", getName())); + res.add(new Attribute("Description", getDescription())); + return res; + } + + /** + * @see net.sourceforge.bprocessor.model.Parametric#getGeneralName() + */ + public String getGeneralName() { + return "Construction Space"; + } } |