bprocessor-commit Mailing List for B-processor (Page 156)
Status: Pre-Alpha
Brought to you by:
henryml
You can subscribe to this list here.
2005 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
(12) |
Jul
(117) |
Aug
(151) |
Sep
(157) |
Oct
(81) |
Nov
(117) |
Dec
(119) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2006 |
Jan
(183) |
Feb
(130) |
Mar
(117) |
Apr
(61) |
May
(82) |
Jun
(45) |
Jul
(149) |
Aug
(173) |
Sep
(199) |
Oct
(165) |
Nov
(107) |
Dec
(137) |
2007 |
Jan
(124) |
Feb
(58) |
Mar
(123) |
Apr
(80) |
May
(130) |
Jun
(64) |
Jul
(31) |
Aug
(42) |
Sep
(114) |
Oct
(167) |
Nov
(239) |
Dec
(200) |
2008 |
Jan
(43) |
Feb
(43) |
Mar
(4) |
Apr
(9) |
May
(5) |
Jun
(1) |
Jul
(3) |
Aug
(3) |
Sep
(13) |
Oct
(9) |
Nov
(12) |
Dec
|
2009 |
Jan
|
Feb
(20) |
Mar
(7) |
Apr
(12) |
May
(34) |
Jun
(72) |
Jul
|
Aug
(3) |
Sep
(31) |
Oct
(2) |
Nov
(8) |
Dec
(4) |
2010 |
Jan
(5) |
Feb
(32) |
Mar
(8) |
Apr
(7) |
May
(36) |
Jun
|
Jul
(11) |
Aug
(15) |
Sep
(7) |
Oct
(2) |
Nov
(13) |
Dec
(80) |
2011 |
Jan
|
Feb
|
Mar
(8) |
Apr
(12) |
May
(32) |
Jun
(9) |
Jul
(5) |
Aug
|
Sep
(2) |
Oct
|
Nov
|
Dec
(8) |
2012 |
Jan
|
Feb
|
Mar
(3) |
Apr
(5) |
May
(2) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2013 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(22) |
Jun
(5) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: Michael L. <he...@us...> - 2005-10-11 12:05:08
|
Update of /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32410/src/net/sourceforge/bprocessor/model Modified Files: Surface.java DatabaseFacade.java CoordinateSystem.java Log Message: Implementation of Surface.direction() Index: Surface.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Surface.java,v retrieving revision 1.38 retrieving revision 1.39 diff -C2 -d -r1.38 -r1.39 *** Surface.java 10 Oct 2005 12:13:42 -0000 1.38 --- Surface.java 11 Oct 2005 12:04:51 -0000 1.39 *************** *** 16,19 **** --- 16,20 ---- import org.apache.log4j.Logger; + /** * The surface *************** *** 266,276 **** */ public int direction() { ! /* ! * TODO To Calculate direction ! */ return 0; } /** * Get the inner surfaces * @return The inner surfaces --- 267,310 ---- */ public int direction() { ! return 0; } /** + * Compute the traversed angle of this Surface + * @return The angle + */ + public double angle() { + List vertexlist = getVertices(); + + CoordinateSystem coordinateSystem = coordinateSystem(); + vertexlist = coordinateSystem.translate(vertexlist); + + vertexlist.remove(vertexlist.size() - 1); + Vertex first = (Vertex) vertexlist.get(0); + Vertex last = (Vertex) vertexlist.get(vertexlist.size() - 1); + vertexlist.add(first); + vertexlist.add(0, last); + Vertex[] vertices = new Vertex[vertexlist.size()]; + vertexlist.toArray(vertices); + + double tetra = 0.0; + System.out.println("--- start ---"); + System.out.print("size: "); + System.out.println(vertices.length); + for (int i = 1; i <= (vertices.length - 2); i++) { + double dxi = vertices[i + 1].getX() - vertices[i].getX(); + double dxi1 = vertices[i].getX() - vertices[i - 1].getX(); + double dyi = vertices[i + 1].getY() - vertices[i].getY(); + double dyi1 = vertices[i].getY() - vertices[i - 1].getY(); + double tetrai = Math.atan2((dxi * dyi1 - dxi1 * dyi), (dxi * dxi1 + dyi * dyi1)); + System.out.println(tetrai); + tetra += tetrai; + } + System.out.println("--- end ---"); + return tetra; + } + + /** * Get the inner surfaces * @return The inner surfaces *************** *** 671,680 **** if (edges.size() > 1) { Vertex i, j, n, origin; Edge e0 = (Edge) edges.get(0); Edge e1 = (Edge) edges.get(1); ! origin = e0.getFrom(); ! i = e0.getTo().minus(origin);; i.scale(1 / i.length()); ! Vertex v = e1.getTo().minus(e1.getFrom()); n = i.cross(v); n.scale(1 / n.length()); --- 705,720 ---- if (edges.size() > 1) { Vertex i, j, n, origin; + Edge e0 = (Edge) edges.get(0); Edge e1 = (Edge) edges.get(1); ! Vertex v0, v1, v2; ! v0 = getFirtVertex(); ! v1 = e0.otherVertex(v0); ! v2 = e1.otherVertex(v1); ! ! origin = v0; ! i = v1.minus(v0); i.scale(1 / i.length()); ! Vertex v = v2.minus(v1); n = i.cross(v); n.scale(1 / n.length()); Index: CoordinateSystem.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/CoordinateSystem.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** CoordinateSystem.java 22 Sep 2005 14:10:47 -0000 1.2 --- CoordinateSystem.java 11 Oct 2005 12:04:51 -0000 1.3 *************** *** 8,11 **** --- 8,15 ---- package net.sourceforge.bprocessor.model; + import java.util.ArrayList; + import java.util.Iterator; + import java.util.List; + /** * The CoordinateSystem is represented by *************** *** 111,113 **** --- 115,132 ---- return v; } + + /** + * Translate all vertices in the list + * @param vertices The list of vertices + * @return The translated list + */ + public List translate(List vertices) { + List result = new ArrayList(); + Iterator iter = vertices.iterator(); + while (iter.hasNext()) { + Vertex current = (Vertex) iter.next(); + result.add(translate(current)); + } + return result; + } } Index: DatabaseFacade.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/DatabaseFacade.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** DatabaseFacade.java 6 Oct 2005 08:20:32 -0000 1.2 --- DatabaseFacade.java 11 Oct 2005 12:04:51 -0000 1.3 *************** *** 27,31 **** public static synchronized DatabaseFacade getInstance() { if (instance == null) { ! instance = new SQLFacade(); } return instance; --- 27,31 ---- public static synchronized DatabaseFacade getInstance() { if (instance == null) { ! instance = new MemoryFacade(); } return instance; |
From: Michael L. <he...@us...> - 2005-10-07 05:52:55
|
Update of /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22550/src/net/sourceforge/bprocessor/model Modified Files: Vertex.java MemoryFacade.java Log Message: MemoryFacade now implemented Index: Vertex.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Vertex.java,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** Vertex.java 6 Oct 2005 11:11:07 -0000 1.13 --- Vertex.java 7 Oct 2005 05:52:48 -0000 1.14 *************** *** 189,193 **** public Set getEdges() { Set result = new HashSet(); ! Set edges = EdgeFacade.getInstance().findAll(); Iterator iter = edges.iterator(); while (iter.hasNext()) { --- 189,193 ---- public Set getEdges() { Set result = new HashSet(); ! Set edges = Project.getInstance().getEdges(); Iterator iter = edges.iterator(); while (iter.hasNext()) { Index: MemoryFacade.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/MemoryFacade.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** MemoryFacade.java 6 Oct 2005 11:11:07 -0000 1.1 --- MemoryFacade.java 7 Oct 2005 05:52:48 -0000 1.2 *************** *** 8,12 **** --- 8,15 ---- package net.sourceforge.bprocessor.model; + import java.util.Collection; import java.util.HashMap; + import java.util.HashSet; + import java.util.Iterator; import java.util.Set; *************** *** 17,31 **** /** The vertices */ ! private HashMap vertices; /** The edges */ ! private HashMap edges; /** The surfaces */ ! private HashMap surfaces; /** The domains */ ! private HashMap domains; ! /** --- 20,41 ---- /** The vertices */ ! private HashMap vertices = new HashMap(); ! /** The vertex id */ ! private long vertexId; /** The edges */ ! private HashMap edges = new HashMap(); ! /** The edge id */ ! private long edgeId; /** The surfaces */ ! private HashMap surfaces = new HashMap(); ! /** The surface id */ ! private long surfaceId; /** The domains */ ! private HashMap domains = new HashMap(); ! /** The domain id */ ! private long domainId; /** *************** *** 34,37 **** --- 44,57 ---- */ public void intern(Object o) { + //System.out.println("intern " + o.toString()); + if (o instanceof Vertex) { + intern((Vertex) o); + } else if (o instanceof Edge) { + intern((Edge) o); + } else if (o instanceof Surface) { + intern((Surface) o); + } else if (o instanceof Domain) { + intern((Domain) o); + } } *************** *** 41,44 **** --- 61,97 ---- */ private void intern(Vertex v) { + v.setId(new Long(vertexId++)); + vertices.put(v.getId(), v); + //System.out.println("v-intern " + v.toString()); + } + + /** + * Intern an Edge + * @param e The Edge + */ + private void intern(Edge e) { + e.setId(new Long(edgeId++)); + edges.put(e.getId(), e); + //System.out.println("e-intern " + e.toString()); + } + + /** + * Intern a Surface + * @param s The Surface + */ + private void intern(Surface s) { + s.setId(new Long(surfaceId++)); + surfaces.put(s.getId(), s); + //System.out.println("s-intern " + s.toString()); + } + + /** + * Intern a Domain + * @param d The Domain + */ + private void intern(Domain d) { + d.setId(new Long(domainId++)); + domains.put(d.getId(), d); + //System.out.println("d-intern " + d.toString()); } *************** *** 53,62 **** /** * Remove an Object ! * @param o The Object */ public void remove(Object o) { ! } /** * Find an attribute by id --- 106,160 ---- /** * Remove an Object ! * @param o The object */ public void remove(Object o) { ! if (o instanceof Vertex) { ! remove((Vertex) o); ! } else if (o instanceof Edge) { ! remove((Edge) o); ! } else if (o instanceof Surface) { ! remove((Surface) o); ! } else if (o instanceof Domain) { ! remove((Domain) o); ! } ! } ! ! /** ! * Remove a Vertex ! * @param v The Vertex ! */ ! private void remove(Vertex v) { ! vertices.remove(v.getId()); ! v.setId(null); ! } ! ! /** ! * Remove an Edge ! * @param e The Edge ! */ ! private void remove(Edge e) { ! edges.remove(e.getId()); ! e.setId(null); ! } ! ! /** ! * Intern a Surface ! * @param s The Surface ! */ ! private void remove(Surface s) { ! surfaces.remove(s.getId()); ! s.setId(null); ! } ! ! /** ! * Remove a Domain ! * @param d The Domain ! */ ! private void remove(Domain d) { ! domains.remove(d.getId()); ! d.setId(null); } + /** * Find an attribute by id *************** *** 73,77 **** */ public Set getConstructionSpaces() { ! return null; } --- 171,175 ---- */ public Set getConstructionSpaces() { ! return filter(domains.values(), ConstructionSpace.class); } *************** *** 82,86 **** */ public ConstructionSpace findConstructionSpaceById(Long id) { ! return null; } --- 180,184 ---- */ public ConstructionSpace findConstructionSpaceById(Long id) { ! return (ConstructionSpace) domains.get(id); } *************** *** 90,94 **** */ public Set getDomains() { ! return null; } --- 188,192 ---- */ public Set getDomains() { ! return new HashSet(domains.values()); } *************** *** 99,103 **** */ public Domain findDomainById(Long id) { ! return null; } --- 197,201 ---- */ public Domain findDomainById(Long id) { ! return (Domain) domains.get(id); } *************** *** 107,111 **** */ public Set getEdges() { ! return null; } --- 205,209 ---- */ public Set getEdges() { ! return new HashSet(edges.values()); } *************** *** 116,120 **** */ public Edge findEdgeById(Long id) { ! return null; } --- 214,218 ---- */ public Edge findEdgeById(Long id) { ! return (Edge) edges.get(id); } *************** *** 124,128 **** */ public Set getElements() { ! return null; } --- 222,226 ---- */ public Set getElements() { ! return filter(domains.values(), Element.class); } *************** *** 133,137 **** */ public Element findElementById(Long id) { ! return null; } --- 231,235 ---- */ public Element findElementById(Long id) { ! return (Element) domains.get(id); } *************** *** 141,145 **** */ public Set getFunctionalSpaces() { ! return null; } --- 239,243 ---- */ public Set getFunctionalSpaces() { ! return filter(domains.values(), FunctionalSpace.class); } *************** *** 150,154 **** */ public FunctionalSpace findFunctionalSpaceById(Long id) { ! return null; } --- 248,252 ---- */ public FunctionalSpace findFunctionalSpaceById(Long id) { ! return (FunctionalSpace) domains.get(id); } *************** *** 158,162 **** */ public Set getParts() { ! return null; } --- 256,260 ---- */ public Set getParts() { ! return filter(domains.values(), Part.class); } *************** *** 167,171 **** */ public Part findPartById(Long id) { ! return null; } --- 265,269 ---- */ public Part findPartById(Long id) { ! return (Part) domains.get(id); } *************** *** 175,179 **** */ public Set getSurfaces() { ! return null; } --- 273,277 ---- */ public Set getSurfaces() { ! return new HashSet(surfaces.values()); } *************** *** 184,188 **** */ public Surface findSurfaceById(Long id) { ! return null; } --- 282,286 ---- */ public Surface findSurfaceById(Long id) { ! return (Surface) surfaces.get(id); } *************** *** 192,196 **** */ public Set getVertices() { ! return null; } --- 290,294 ---- */ public Set getVertices() { ! return new HashSet(vertices.values()); } *************** *** 201,206 **** */ public Vertex findVertexById(Long id) { ! return null; } } --- 299,321 ---- */ public Vertex findVertexById(Long id) { ! return (Vertex) vertices.get(id); } + /** + * Make a set of objects in values of the specified clarse + * @param values The values to filter + * @param clarse The class + * @return The set + */ + private Set filter(Collection values, Class clarse) { + HashSet result = new HashSet(); + Iterator iter = values.iterator(); + while (iter.hasNext()) { + Object current = iter.next(); + if (current.getClass() == clarse) { + result.add(result); + } + } + return result; + } } |
From: Michael L. <he...@us...> - 2005-10-06 11:11:30
|
Update of /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23105/src/net/sourceforge/bprocessor/model Modified Files: Edge.java Vertex.java Domain.java Surface.java Added Files: MemoryFacade.java Log Message: Started implementation of simple memory based storage of objects Index: Domain.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Domain.java,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** Domain.java 5 Oct 2005 10:04:23 -0000 1.10 --- Domain.java 6 Oct 2005 11:11:07 -0000 1.11 *************** *** 58,62 **** * @param id The id */ ! private void setId(Long id) { this.id = id; } --- 58,62 ---- * @param id The id */ ! public void setId(Long id) { this.id = id; } Index: Surface.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Surface.java,v retrieving revision 1.36 retrieving revision 1.37 diff -C2 -d -r1.36 -r1.37 *** Surface.java 5 Oct 2005 10:04:23 -0000 1.36 --- Surface.java 6 Oct 2005 11:11:07 -0000 1.37 *************** *** 98,102 **** * @param id The id */ ! private void setId(Long id) { this.id = id; } --- 98,102 ---- * @param id The id */ ! public void setId(Long id) { this.id = id; } Index: Edge.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Edge.java,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** Edge.java 30 Sep 2005 12:47:46 -0000 1.13 --- Edge.java 6 Oct 2005 11:11:07 -0000 1.14 *************** *** 84,88 **** * @param id The id */ ! private void setId(Long id) { this.id = id; } --- 84,88 ---- * @param id The id */ ! public void setId(Long id) { this.id = id; } --- NEW FILE: MemoryFacade.java --- //--------------------------------------------------------------------------------- // $Id: MemoryFacade.java,v 1.1 2005/10/06 11:11:07 henryml 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; import java.util.HashMap; import java.util.Set; /** * The MemoryFacade */ public class MemoryFacade extends DatabaseFacade { /** The vertices */ private HashMap vertices; /** The edges */ private HashMap edges; /** The surfaces */ private HashMap surfaces; /** The domains */ private HashMap domains; /** * Intern an Object * @param o The object */ public void intern(Object o) { } /** * Intern a Vertex * @param v The Vertex */ private void intern(Vertex v) { } /** * Update an object * @param o The object */ public void update(Object o) { } /** * Remove an Object * @param o The Object */ public void remove(Object o) { } /** * Find an attribute by id * @param id The id * @return The Attribute */ public Attribute findAttributeById(Long id) { return null; } /** * Get construction spaces * @return the Construction spaces */ public Set getConstructionSpaces() { return null; } /** * Find a construction space by id * @param id The id * @return The construction space */ public ConstructionSpace findConstructionSpaceById(Long id) { return null; } /** * Get all domains * @return The domains */ public Set getDomains() { return null; } /** * Find domain by ID * @param id The id * @return The Domain */ public Domain findDomainById(Long id) { return null; } /** * Get all edges * @return The edges */ public Set getEdges() { return null; } /** * Find edge by id * @param id The id * @return The edge */ public Edge findEdgeById(Long id) { return null; } /** * Get all elements * @return The elements */ public Set getElements() { return null; } /** * Find element by id * @param id the ID * @return The element */ public Element findElementById(Long id) { return null; } /** * Get all functional spaces * @return the Functional spaces */ public Set getFunctionalSpaces() { return null; } /** * Find functional space by id * @param id The id * @return The functional space */ public FunctionalSpace findFunctionalSpaceById(Long id) { return null; } /** * Get all parts * @return The parts */ public Set getParts() { return null; } /** * Find part by id * @param id The id * @return The part */ public Part findPartById(Long id) { return null; } /** * Get all surfaces * @return The surfaces */ public Set getSurfaces() { return null; } /** * Find surface by id * @param id The id * @return The surface */ public Surface findSurfaceById(Long id) { return null; } /** * Get all vertices * @return The vertices */ public Set getVertices() { return null; } /** * Find vertix by id * @param id The id * @return The Vertex */ public Vertex findVertexById(Long id) { return null; } } Index: Vertex.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Vertex.java,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** Vertex.java 30 Sep 2005 12:47:46 -0000 1.12 --- Vertex.java 6 Oct 2005 11:11:07 -0000 1.13 *************** *** 93,97 **** * @param id The id */ ! private void setId(Long id) { this.id = id; } --- 93,97 ---- * @param id The id */ ! public void setId(Long id) { this.id = id; } |
From: Michael L. <he...@us...> - 2005-10-06 08:20:41
|
Update of /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13798/src/net/sourceforge/bprocessor/model Modified Files: DatabaseFacade.java Added Files: SQLFacade.java Log Message: DatabaseFacade has been split into abstract super class "DatabaseFacade" and concrete implementation "SQLFacade". Other implementations can be added by changing what instance is created in DatabaseFacade.getInstance() Index: DatabaseFacade.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/DatabaseFacade.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** DatabaseFacade.java 5 Oct 2005 08:05:36 -0000 1.1 --- DatabaseFacade.java 6 Oct 2005 08:20:32 -0000 1.2 *************** *** 6,26 **** //--------------------------------------------------------------------------------- - package net.sourceforge.bprocessor.model; import java.util.Set; - import net.sourceforge.bprocessor.model.db.HibernateUtil; - - import org.apache.log4j.Logger; - import org.hibernate.Session; - import org.hibernate.Transaction; - /** ! * Facade for database */ ! public class DatabaseFacade { ! /** The logger */ ! private static Logger log = Logger.getLogger(DatabaseFacade.class); /** The instance */ --- 6,19 ---- //--------------------------------------------------------------------------------- package net.sourceforge.bprocessor.model; import java.util.Set; /** ! * Database interface ! * */ ! ! public abstract class DatabaseFacade { /** The instance */ *************** *** 34,38 **** public static synchronized DatabaseFacade getInstance() { if (instance == null) { ! instance = new DatabaseFacade(); } return instance; --- 27,31 ---- public static synchronized DatabaseFacade getInstance() { if (instance == null) { ! instance = new SQLFacade(); } return instance; *************** *** 43,108 **** * @param o The object */ ! public void intern(Object o) { ! HibernateUtil hu = HibernateUtil.getInstance(); ! Transaction tx = null; ! try { ! Session session = hu.currentSession(); ! tx = session.beginTransaction(); ! session.save(o); ! tx.commit(); ! } catch (Exception ex) { ! if (tx != null) { ! tx.rollback(); ! } ! log.error(ex.getMessage(), ex); ! } finally { ! hu.closeSession(); ! } ! } ! /** * Update an object * @param o The object */ ! public void update(Object o) { ! HibernateUtil hu = HibernateUtil.getInstance(); ! Transaction tx = null; ! try { ! Session session = hu.currentSession(); ! tx = session.beginTransaction(); ! session.update(o); ! tx.commit(); ! } catch (Exception ex) { ! if (tx != null) { ! tx.rollback(); ! } ! log.error(ex.getMessage(), ex); ! } finally { ! hu.closeSession(); ! } ! } ! /** * Remove and object * @param o The object */ ! public void remove(Object o) { ! HibernateUtil hu = HibernateUtil.getInstance(); ! Transaction tx = null; ! try { ! Session session = hu.currentSession(); ! tx = session.beginTransaction(); ! session.delete(o); ! tx.commit(); ! } catch (Exception ex) { ! if (tx != null) { ! tx.rollback(); ! } ! log.error(ex.getMessage(), ex); ! } finally { ! hu.closeSession(); ! } ! } ! /** * Find a attribute by id --- 36,53 ---- * @param o The object */ ! public abstract void intern(Object o); ! /** * Update an object * @param o The object */ ! public abstract void update(Object o); ! /** * Remove and object * @param o The object */ ! public abstract void remove(Object o); ! /** * Find a attribute by id *************** *** 110,124 **** * @return The attribute */ ! public Attribute findAttributeById(Long id) { ! return AttributeFacade.getInstance().findById(id); ! } ! /** * Find all construction spaces * @return The construction spaces */ ! public Set getConstructionSpaces() { ! return ConstructionSpaceFacade.getInstance().findAll(); ! } /** --- 55,65 ---- * @return The attribute */ ! public abstract Attribute findAttributeById(Long id); ! /** * Find all construction spaces * @return The construction spaces */ ! public abstract Set getConstructionSpaces(); /** *************** *** 127,133 **** * @return The construction space */ ! public ConstructionSpace findConstructionSpaceById(Long id) { ! return ConstructionSpaceFacade.getInstance().findById(id); ! } /** --- 68,72 ---- * @return The construction space */ ! public abstract ConstructionSpace findConstructionSpaceById(Long id); /** *************** *** 135,142 **** * @return the set of all domains */ ! public Set getDomains() { ! return DomainFacade.getInstance().findAll(); ! } ! /** * Find a domain by id --- 74,79 ---- * @return the set of all domains */ ! public abstract Set getDomains(); ! /** * Find a domain by id *************** *** 144,158 **** * @return The domain */ ! public Domain findDomainById(Long id) { ! return DomainFacade.getInstance().findById(id); ! } ! /** * Find all edges * @return The edges */ ! public Set getEdges() { ! return EdgeFacade.getInstance().findAll(); ! } /** --- 81,91 ---- * @return The domain */ ! public abstract Domain findDomainById(Long id); ! /** * Find all edges * @return The edges */ ! public abstract Set getEdges(); /** *************** *** 161,167 **** * @return The edge */ ! public Edge findEdgeById(Long id) { ! return EdgeFacade.getInstance().findById(id); ! } /** --- 94,98 ---- * @return The edge */ ! public abstract Edge findEdgeById(Long id); /** *************** *** 169,175 **** * @return The elements */ ! public Set getElements() { ! return ElementFacade.getInstance().findAll(); ! } /** --- 100,104 ---- * @return The elements */ ! public abstract Set getElements(); /** *************** *** 178,192 **** * @return The element */ ! public Element findElementById(Long id) { ! return ElementFacade.getInstance().findById(id); ! } ! /** * Find all functional spaces * @return The functional spaces */ ! public Set getFunctionalSpaces() { ! return FunctionalSpaceFacade.getInstance().findAll(); ! } /** --- 107,117 ---- * @return The element */ ! public abstract Element findElementById(Long id); ! /** * Find all functional spaces * @return The functional spaces */ ! public abstract Set getFunctionalSpaces(); /** *************** *** 195,201 **** * @return The functional space */ ! public FunctionalSpace findFunctionalSpaceById(Long id) { ! return FunctionalSpaceFacade.getInstance().findById(id); ! } /** --- 120,124 ---- * @return The functional space */ ! public abstract FunctionalSpace findFunctionalSpaceById(Long id); /** *************** *** 203,209 **** * @return The parts */ ! public Set getParts() { ! return PartFacade.getInstance().findAll(); ! } /** --- 126,130 ---- * @return The parts */ ! public abstract Set getParts(); /** *************** *** 212,218 **** * @return The part */ ! public Part findPartById(Long id) { ! return PartFacade.getInstance().findById(id); ! } /** --- 133,137 ---- * @return The part */ ! public abstract Part findPartById(Long id); /** *************** *** 220,226 **** * @return The surfaces */ ! public Set getSurfaces() { ! return SurfaceFacade.getInstance().findAll(); ! } /** --- 139,143 ---- * @return The surfaces */ ! public abstract Set getSurfaces(); /** *************** *** 229,235 **** * @return The surface */ ! public Surface findSurfaceById(Long id) { ! return SurfaceFacade.getInstance().findById(id); ! } /** --- 146,150 ---- * @return The surface */ ! public abstract Surface findSurfaceById(Long id); /** *************** *** 237,243 **** * @return The vertexs */ ! public Set getVertices() { ! return VertexFacade.getInstance().findAll(); ! } /** --- 152,156 ---- * @return The vertexs */ ! public abstract Set getVertices(); /** *************** *** 246,251 **** * @return The vertex */ ! public Vertex findVertexById(Long id) { ! return VertexFacade.getInstance().findById(id); ! } } --- 159,162 ---- * @return The vertex */ ! public abstract Vertex findVertexById(Long id); } --- NEW FILE: SQLFacade.java --- //--------------------------------------------------------------------------------- // $Id: SQLFacade.java,v 1.1 2005/10/06 08:20:32 henryml 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; import java.util.Set; import net.sourceforge.bprocessor.model.db.HibernateUtil; import org.apache.log4j.Logger; import org.hibernate.Session; import org.hibernate.Transaction; /** * Facade for database */ public class SQLFacade extends DatabaseFacade { /** The logger */ private static Logger log = Logger.getLogger(SQLFacade.class); /** * Insert an object into the database * @param o The object */ public void intern(Object o) { HibernateUtil hu = HibernateUtil.getInstance(); Transaction tx = null; try { Session session = hu.currentSession(); tx = session.beginTransaction(); session.save(o); tx.commit(); } catch (Exception ex) { if (tx != null) { tx.rollback(); } log.error(ex.getMessage(), ex); } finally { hu.closeSession(); } } /** * Update an object * @param o The object */ public void update(Object o) { HibernateUtil hu = HibernateUtil.getInstance(); Transaction tx = null; try { Session session = hu.currentSession(); tx = session.beginTransaction(); session.update(o); tx.commit(); } catch (Exception ex) { if (tx != null) { tx.rollback(); } log.error(ex.getMessage(), ex); } finally { hu.closeSession(); } } /** * Remove and object * @param o The object */ public void remove(Object o) { HibernateUtil hu = HibernateUtil.getInstance(); Transaction tx = null; try { Session session = hu.currentSession(); tx = session.beginTransaction(); session.delete(o); tx.commit(); } catch (Exception ex) { if (tx != null) { tx.rollback(); } log.error(ex.getMessage(), ex); } finally { hu.closeSession(); } } /** * Find a attribute by id * @param id The id * @return The attribute */ public Attribute findAttributeById(Long id) { return AttributeFacade.getInstance().findById(id); } /** * Find all construction spaces * @return The construction spaces */ public Set getConstructionSpaces() { return ConstructionSpaceFacade.getInstance().findAll(); } /** * Find a construction space by id * @param id The id * @return The construction space */ public ConstructionSpace findConstructionSpaceById(Long id) { return ConstructionSpaceFacade.getInstance().findById(id); } /** * Find all domains * @return the set of all domains */ public Set getDomains() { return DomainFacade.getInstance().findAll(); } /** * Find a domain by id * @param id The id * @return The domain */ public Domain findDomainById(Long id) { return DomainFacade.getInstance().findById(id); } /** * Find all edges * @return The edges */ public Set getEdges() { return EdgeFacade.getInstance().findAll(); } /** * Find an edge by id * @param id The id * @return The edge */ public Edge findEdgeById(Long id) { return EdgeFacade.getInstance().findById(id); } /** * Find all elements * @return The elements */ public Set getElements() { return ElementFacade.getInstance().findAll(); } /** * Find a element by id * @param id The id * @return The element */ public Element findElementById(Long id) { return ElementFacade.getInstance().findById(id); } /** * Find all functional spaces * @return The functional spaces */ public Set getFunctionalSpaces() { return FunctionalSpaceFacade.getInstance().findAll(); } /** * Find a functional space by id * @param id The id * @return The functional space */ public FunctionalSpace findFunctionalSpaceById(Long id) { return FunctionalSpaceFacade.getInstance().findById(id); } /** * Find all parts * @return The parts */ public Set getParts() { return PartFacade.getInstance().findAll(); } /** * Find a part by id * @param id The id * @return The part */ public Part findPartById(Long id) { return PartFacade.getInstance().findById(id); } /** * Find all surfaces * @return The surfaces */ public Set getSurfaces() { return SurfaceFacade.getInstance().findAll(); } /** * Find a surface by id * @param id The id * @return The surface */ public Surface findSurfaceById(Long id) { return SurfaceFacade.getInstance().findById(id); } /** * Find all vertexs * @return The vertexs */ public Set getVertices() { return VertexFacade.getInstance().findAll(); } /** * Find a vertex by id * @param id The id * @return The vertex */ public Vertex findVertexById(Long id) { return VertexFacade.getInstance().findById(id); } } |
From: Michael L. <he...@us...> - 2005-10-05 10:04:39
|
Update of /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16698/src/net/sourceforge/bprocessor/model Modified Files: Domain.java Surface.java Log Message: Fixed some usages of Facade objects.. Index: Surface.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Surface.java,v retrieving revision 1.35 retrieving revision 1.36 diff -C2 -d -r1.35 -r1.36 *** Surface.java 30 Sep 2005 17:59:13 -0000 1.35 --- Surface.java 5 Oct 2005 10:04:23 -0000 1.36 *************** *** 291,295 **** newFrom = from.copy(); map.put(from.getId(), newFrom); ! VertexFacade.getInstance().create(newFrom); } newEdge.setFrom(newFrom); --- 291,295 ---- newFrom = from.copy(); map.put(from.getId(), newFrom); ! Project.getInstance().intern(newFrom); } newEdge.setFrom(newFrom); *************** *** 299,310 **** newTo = to.copy(); map.put(to.getId(), newTo); ! VertexFacade.getInstance().create(newTo); } newEdge.setTo(newTo); ! EdgeFacade.getInstance().create(newEdge); edges.add(newEdge); } surface.setEdges(edges); ! SurfaceFacade.getInstance().create(surface); return surface; } --- 299,310 ---- newTo = to.copy(); map.put(to.getId(), newTo); ! Project.getInstance().intern(newTo); } newEdge.setTo(newTo); ! Project.getInstance().intern(newEdge); edges.add(newEdge); } surface.setEdges(edges); ! Project.getInstance().intern(surface); return surface; } *************** *** 404,408 **** } } ! SurfaceFacade.getInstance().update(this); } --- 404,408 ---- } } ! Project.getInstance().update(this); } Index: Domain.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Domain.java,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** Domain.java 30 Sep 2005 17:58:06 -0000 1.9 --- Domain.java 5 Oct 2005 10:04:23 -0000 1.10 *************** *** 148,152 **** if (s != null && s.contains(surface)) { s.remove(surface); ! DomainFacade.getInstance().update(this); return true; } --- 148,152 ---- if (s != null && s.contains(surface)) { s.remove(surface); ! Project.getInstance().update(this); return true; } |
From: Michael L. <he...@us...> - 2005-10-05 08:05:49
|
Update of /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24041/src/net/sourceforge/bprocessor/model Modified Files: DomainFacade.java PartFacade.java EdgeFacade.java ConstructionSpaceFacade.java ElementFacade.java AttributeFacade.java VertexFacade.java SurfaceFacade.java Project.java FunctionalSpaceFacade.java Added Files: DatabaseFacade.java Log Message: Project now uses DatabaseFacade instead of EdgeFacade etc. Index: ConstructionSpaceFacade.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/ConstructionSpaceFacade.java,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** ConstructionSpaceFacade.java 3 Oct 2005 08:34:37 -0000 1.13 --- ConstructionSpaceFacade.java 5 Oct 2005 08:05:36 -0000 1.14 *************** *** 45,124 **** } ! /** ! * Create a construction space ! * @param c The construction space ! */ ! public synchronized void create(ConstructionSpace c) { ! HibernateUtil hu = HibernateUtil.getInstance(); ! Transaction tx = null; ! try { ! Session session = hu.currentSession(); ! tx = session.beginTransaction(); ! ! session.save(c); ! ! tx.commit(); ! ! ! } catch (Exception ex) { ! if (tx != null) { ! tx.rollback(); ! } ! log.error(ex.getMessage(), ex); ! } finally { ! hu.closeSession(); ! } ! } ! ! /** ! * Update a construction space ! * @param c The construction space ! */ ! public synchronized void update(ConstructionSpace c) { ! HibernateUtil hu = HibernateUtil.getInstance(); ! Transaction tx = null; ! try { ! Session session = hu.currentSession(); ! tx = session.beginTransaction(); ! ! session.update(c); ! ! tx.commit(); ! } catch (Exception ex) { ! if (tx != null) { ! tx.rollback(); ! } ! log.error(ex.getMessage(), ex); ! } finally { ! hu.closeSession(); ! } ! } ! ! /** ! * Remove a construction space ! * @param c The construction space ! */ ! public synchronized void remove(ConstructionSpace c) { ! HibernateUtil hu = HibernateUtil.getInstance(); ! Transaction tx = null; ! ! try { ! Session session = hu.currentSession(); ! tx = session.beginTransaction(); ! ! session.delete(c); ! ! tx.commit(); ! ! } catch (Exception ex) { ! if (tx != null) { ! tx.rollback(); ! } ! log.error(ex.getMessage(), ex); ! } finally { ! hu.closeSession(); ! } ! } ! /** * Find all construction spaces --- 45,49 ---- } ! /** * Find all construction spaces Index: ElementFacade.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/ElementFacade.java,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** ElementFacade.java 3 Oct 2005 08:34:37 -0000 1.8 --- ElementFacade.java 5 Oct 2005 08:05:36 -0000 1.9 *************** *** 44,125 **** return instance; } ! ! /** ! * Create an element ! * @param e The element ! */ ! public synchronized void create(Element e) { ! HibernateUtil hu = HibernateUtil.getInstance(); ! Transaction tx = null; ! try { ! Session session = hu.currentSession(); ! tx = session.beginTransaction(); ! ! session.save(e); ! ! tx.commit(); ! ! ! } catch (Exception ex) { ! if (tx != null) { ! tx.rollback(); ! } ! log.error(ex.getMessage(), ex); ! } finally { ! hu.closeSession(); ! } ! } ! ! /** ! * Update an element ! * @param e The element ! */ ! public synchronized void update(Element e) { ! HibernateUtil hu = HibernateUtil.getInstance(); ! Transaction tx = null; ! try { ! Session session = hu.currentSession(); ! tx = session.beginTransaction(); ! ! session.update(e); ! ! tx.commit(); ! ! ! } catch (Exception ex) { ! if (tx != null) { ! tx.rollback(); ! } ! log.error(ex.getMessage(), ex); ! } finally { ! hu.closeSession(); ! } ! } ! ! /** ! * Remove an element ! * @param e The element ! */ ! public synchronized void remove(Element e) { ! HibernateUtil hu = HibernateUtil.getInstance(); ! Transaction tx = null; ! try { ! Session session = hu.currentSession(); ! tx = session.beginTransaction(); ! ! session.delete(e); ! ! tx.commit(); ! ! } catch (Exception ex) { ! if (tx != null) { ! tx.rollback(); ! } ! log.error(ex.getMessage(), ex); ! } finally { ! hu.closeSession(); ! } ! } ! /** * Find all elements --- 44,48 ---- return instance; } ! /** * Find all elements Index: AttributeFacade.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/AttributeFacade.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** AttributeFacade.java 30 Sep 2005 11:35:06 -0000 1.3 --- AttributeFacade.java 5 Oct 2005 08:05:36 -0000 1.4 *************** *** 39,115 **** return instance; } ! ! /** ! * Create an attribute ! * @param a The attribute ! */ ! public synchronized void create(Attribute a) { ! HibernateUtil hu = HibernateUtil.getInstance(); ! Transaction tx = null; ! try { ! Session session = hu.currentSession(); ! tx = session.beginTransaction(); ! ! session.save(a); ! ! tx.commit(); ! } catch (Exception ex) { ! if (tx != null) { ! tx.rollback(); ! } ! log.error(ex.getMessage(), ex); ! } finally { ! hu.closeSession(); ! } ! } ! ! /** ! * Update an attribute ! * @param a The attribute ! */ ! public synchronized void update(Attribute a) { ! HibernateUtil hu = HibernateUtil.getInstance(); ! Transaction tx = null; ! try { ! Session session = hu.currentSession(); ! tx = session.beginTransaction(); ! ! session.update(a); ! ! tx.commit(); ! } catch (Exception ex) { ! if (tx != null) { ! tx.rollback(); ! } ! log.error(ex.getMessage(), ex); ! } finally { ! hu.closeSession(); ! } ! } ! ! /** ! * Remove an attribute ! * @param a The attribute ! */ ! public synchronized void remove(Attribute a) { ! HibernateUtil hu = HibernateUtil.getInstance(); ! Transaction tx = null; ! try { ! Session session = hu.currentSession(); ! tx = session.beginTransaction(); ! ! session.delete(a); ! ! tx.commit(); ! } catch (Exception ex) { ! if (tx != null) { ! tx.rollback(); ! } ! log.error(ex.getMessage(), ex); ! } finally { ! hu.closeSession(); ! } ! } ! /** * Find a attribute by id --- 39,43 ---- return instance; } ! /** * Find a attribute by id --- NEW FILE: DatabaseFacade.java --- //--------------------------------------------------------------------------------- // $Id: DatabaseFacade.java,v 1.1 2005/10/05 08:05:36 henryml 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; import java.util.Set; import net.sourceforge.bprocessor.model.db.HibernateUtil; import org.apache.log4j.Logger; import org.hibernate.Session; import org.hibernate.Transaction; /** * Facade for database */ public class DatabaseFacade { /** The logger */ private static Logger log = Logger.getLogger(DatabaseFacade.class); /** The instance */ private static DatabaseFacade instance; /** * Get the instance * @return The instance */ public static synchronized DatabaseFacade getInstance() { if (instance == null) { instance = new DatabaseFacade(); } return instance; } /** * Insert an object into the database * @param o The object */ public void intern(Object o) { HibernateUtil hu = HibernateUtil.getInstance(); Transaction tx = null; try { Session session = hu.currentSession(); tx = session.beginTransaction(); session.save(o); tx.commit(); } catch (Exception ex) { if (tx != null) { tx.rollback(); } log.error(ex.getMessage(), ex); } finally { hu.closeSession(); } } /** * Update an object * @param o The object */ public void update(Object o) { HibernateUtil hu = HibernateUtil.getInstance(); Transaction tx = null; try { Session session = hu.currentSession(); tx = session.beginTransaction(); session.update(o); tx.commit(); } catch (Exception ex) { if (tx != null) { tx.rollback(); } log.error(ex.getMessage(), ex); } finally { hu.closeSession(); } } /** * Remove and object * @param o The object */ public void remove(Object o) { HibernateUtil hu = HibernateUtil.getInstance(); Transaction tx = null; try { Session session = hu.currentSession(); tx = session.beginTransaction(); session.delete(o); tx.commit(); } catch (Exception ex) { if (tx != null) { tx.rollback(); } log.error(ex.getMessage(), ex); } finally { hu.closeSession(); } } /** * Find a attribute by id * @param id The id * @return The attribute */ public Attribute findAttributeById(Long id) { return AttributeFacade.getInstance().findById(id); } /** * Find all construction spaces * @return The construction spaces */ public Set getConstructionSpaces() { return ConstructionSpaceFacade.getInstance().findAll(); } /** * Find a construction space by id * @param id The id * @return The construction space */ public ConstructionSpace findConstructionSpaceById(Long id) { return ConstructionSpaceFacade.getInstance().findById(id); } /** * Find all domains * @return the set of all domains */ public Set getDomains() { return DomainFacade.getInstance().findAll(); } /** * Find a domain by id * @param id The id * @return The domain */ public Domain findDomainById(Long id) { return DomainFacade.getInstance().findById(id); } /** * Find all edges * @return The edges */ public Set getEdges() { return EdgeFacade.getInstance().findAll(); } /** * Find an edge by id * @param id The id * @return The edge */ public Edge findEdgeById(Long id) { return EdgeFacade.getInstance().findById(id); } /** * Find all elements * @return The elements */ public Set getElements() { return ElementFacade.getInstance().findAll(); } /** * Find a element by id * @param id The id * @return The element */ public Element findElementById(Long id) { return ElementFacade.getInstance().findById(id); } /** * Find all functional spaces * @return The functional spaces */ public Set getFunctionalSpaces() { return FunctionalSpaceFacade.getInstance().findAll(); } /** * Find a functional space by id * @param id The id * @return The functional space */ public FunctionalSpace findFunctionalSpaceById(Long id) { return FunctionalSpaceFacade.getInstance().findById(id); } /** * Find all parts * @return The parts */ public Set getParts() { return PartFacade.getInstance().findAll(); } /** * Find a part by id * @param id The id * @return The part */ public Part findPartById(Long id) { return PartFacade.getInstance().findById(id); } /** * Find all surfaces * @return The surfaces */ public Set getSurfaces() { return SurfaceFacade.getInstance().findAll(); } /** * Find a surface by id * @param id The id * @return The surface */ public Surface findSurfaceById(Long id) { return SurfaceFacade.getInstance().findById(id); } /** * Find all vertexs * @return The vertexs */ public Set getVertices() { return VertexFacade.getInstance().findAll(); } /** * Find a vertex by id * @param id The id * @return The vertex */ public Vertex findVertexById(Long id) { return VertexFacade.getInstance().findById(id); } } Index: Project.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Project.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** Project.java 3 Oct 2005 08:34:37 -0000 1.3 --- Project.java 5 Oct 2005 08:05:36 -0000 1.4 *************** *** 46,50 **** */ public void intern(Attribute a) { ! AttributeFacade.getInstance().create(a); } --- 46,50 ---- */ public void intern(Attribute a) { ! DatabaseFacade.getInstance().intern((Object) a); } *************** *** 54,58 **** */ public void update(Attribute a) { ! AttributeFacade.getInstance().update(a); } --- 54,58 ---- */ public void update(Attribute a) { ! DatabaseFacade.getInstance().update(a); } *************** *** 62,66 **** */ public void remove(Attribute a) { ! AttributeFacade.getInstance().remove(a); } --- 62,66 ---- */ public void remove(Attribute a) { ! DatabaseFacade.getInstance().remove(a); } *************** *** 71,75 **** */ public Attribute findAttributeById(Long id) { ! return AttributeFacade.getInstance().findById(id); } --- 71,75 ---- */ public Attribute findAttributeById(Long id) { ! return DatabaseFacade.getInstance().findAttributeById(id); } *************** *** 79,83 **** */ public void intern(ConstructionSpace c) { ! ConstructionSpaceFacade.getInstance().create(c); Notification n = new Notification(Notification.CONSTRUCTION_SPACE_CREATED, c.getId()); Notifier.getInstance().sendNotification(n); --- 79,83 ---- */ public void intern(ConstructionSpace c) { ! DatabaseFacade.getInstance().intern((Object) c); Notification n = new Notification(Notification.CONSTRUCTION_SPACE_CREATED, c.getId()); Notifier.getInstance().sendNotification(n); *************** *** 89,93 **** */ public void update(ConstructionSpace c) { ! ConstructionSpaceFacade.getInstance().update(c); Notification n = new Notification(Notification.CONSTRUCTION_SPACE_MODIFIED, c.getId()); Notifier.getInstance().sendNotification(n); --- 89,93 ---- */ public void update(ConstructionSpace c) { ! DatabaseFacade.getInstance().update(c); Notification n = new Notification(Notification.CONSTRUCTION_SPACE_MODIFIED, c.getId()); Notifier.getInstance().sendNotification(n); *************** *** 108,122 **** if (back == c) { surface.setBackDomain(null); ! SurfaceFacade.getInstance().update(surface); } else { Domain front = surface.getFrontDomain(); if (front == c) { surface.setFrontDomain(null); ! SurfaceFacade.getInstance().update(surface); } } } } ! ConstructionSpaceFacade.getInstance().remove(c); Notification n = new Notification(Notification.CONSTRUCTION_SPACE_DELETED, c.getId()); Notifier.getInstance().sendNotification(n); --- 108,122 ---- if (back == c) { surface.setBackDomain(null); ! DatabaseFacade.getInstance().update(surface); } else { Domain front = surface.getFrontDomain(); if (front == c) { surface.setFrontDomain(null); ! DatabaseFacade.getInstance().update(surface); } } } } ! DatabaseFacade.getInstance().remove(c); Notification n = new Notification(Notification.CONSTRUCTION_SPACE_DELETED, c.getId()); Notifier.getInstance().sendNotification(n); *************** *** 128,132 **** */ public Set getConstructionSpaces() { ! return ConstructionSpaceFacade.getInstance().findAll(); } --- 128,132 ---- */ public Set getConstructionSpaces() { ! return DatabaseFacade.getInstance().getConstructionSpaces(); } *************** *** 137,141 **** */ public ConstructionSpace findConstructionSpaceById(Long id) { ! return ConstructionSpaceFacade.getInstance().findById(id); } --- 137,141 ---- */ public ConstructionSpace findConstructionSpaceById(Long id) { ! return DatabaseFacade.getInstance().findConstructionSpaceById(id); } *************** *** 146,154 **** public void update(Domain domain) { if (domain instanceof ConstructionSpace) { ! ConstructionSpaceFacade.getInstance().update((ConstructionSpace)domain); Notification n = new Notification(Notification.CONSTRUCTION_SPACE_MODIFIED, domain.getId()); Notifier.getInstance().sendNotification(n); } else if (domain instanceof FunctionalSpace) { ! FunctionalSpaceFacade.getInstance().update((FunctionalSpace)domain); Notification n = new Notification(Notification.FUNCTIONAL_SPACE_MODIFIED, domain.getId()); Notifier.getInstance().sendNotification(n); --- 146,154 ---- public void update(Domain domain) { if (domain instanceof ConstructionSpace) { ! DatabaseFacade.getInstance().update((ConstructionSpace)domain); Notification n = new Notification(Notification.CONSTRUCTION_SPACE_MODIFIED, domain.getId()); Notifier.getInstance().sendNotification(n); } else if (domain instanceof FunctionalSpace) { ! DatabaseFacade.getInstance().update((FunctionalSpace)domain); Notification n = new Notification(Notification.FUNCTIONAL_SPACE_MODIFIED, domain.getId()); Notifier.getInstance().sendNotification(n); *************** *** 157,161 **** } else if (domain instanceof Part) { ! PartFacade.getInstance().update((Part)domain); Notification n = new Notification(Notification.PART_MODIFIED, domain.getId()); Notifier.getInstance().sendNotification(n); --- 157,161 ---- } else if (domain instanceof Part) { ! DatabaseFacade.getInstance().update((Part)domain); Notification n = new Notification(Notification.PART_MODIFIED, domain.getId()); Notifier.getInstance().sendNotification(n); *************** *** 170,174 **** */ public Set getDomains() { ! return DomainFacade.getInstance().findAll(); } --- 170,174 ---- */ public Set getDomains() { ! return DatabaseFacade.getInstance().getDomains(); } *************** *** 179,183 **** */ public Domain findDomainById(Long id) { ! return DomainFacade.getInstance().findById(id); } --- 179,183 ---- */ public Domain findDomainById(Long id) { ! return DatabaseFacade.getInstance().findDomainById(id); } *************** *** 187,191 **** */ public void intern(Edge e) { ! EdgeFacade.getInstance().create(e); Notification n = new Notification(Notification.EDGE_CREATED, e.getId()); Notifier.getInstance().sendNotification(n); --- 187,191 ---- */ public void intern(Edge e) { ! DatabaseFacade.getInstance().intern((Object) e); Notification n = new Notification(Notification.EDGE_CREATED, e.getId()); Notifier.getInstance().sendNotification(n); *************** *** 197,201 **** */ public void update(Edge e) { ! EdgeFacade.getInstance().update(e); Notification n = new Notification(Notification.EDGE_MODIFIED, e.getId()); Notifier.getInstance().sendNotification(n); --- 197,201 ---- */ public void update(Edge e) { ! DatabaseFacade.getInstance().update(e); Notification n = new Notification(Notification.EDGE_MODIFIED, e.getId()); Notifier.getInstance().sendNotification(n); *************** *** 207,211 **** */ public void remove(Edge e) { ! EdgeFacade.getInstance().remove(e); Notification n = new Notification(Notification.EDGE_DELETED, e.getId()); Notifier.getInstance().sendNotification(n); --- 207,211 ---- */ public void remove(Edge e) { ! DatabaseFacade.getInstance().remove(e); Notification n = new Notification(Notification.EDGE_DELETED, e.getId()); Notifier.getInstance().sendNotification(n); *************** *** 217,221 **** */ public Set getEdges() { ! return EdgeFacade.getInstance().findAll(); } --- 217,221 ---- */ public Set getEdges() { ! return DatabaseFacade.getInstance().getEdges(); } *************** *** 226,230 **** */ public Edge findEdgeById(Long id) { ! return EdgeFacade.getInstance().findById(id); } --- 226,230 ---- */ public Edge findEdgeById(Long id) { ! return DatabaseFacade.getInstance().findEdgeById(id); } *************** *** 234,238 **** */ public void intern(Element e) { ! ElementFacade.getInstance().create(e); Notification n = new Notification(Notification.ELEMENT_CREATED, e.getId()); Notifier.getInstance().sendNotification(n); --- 234,238 ---- */ public void intern(Element e) { ! DatabaseFacade.getInstance().intern((Object) e); Notification n = new Notification(Notification.ELEMENT_CREATED, e.getId()); Notifier.getInstance().sendNotification(n); *************** *** 244,248 **** */ public void update(Element e) { ! ElementFacade.getInstance().update(e); Notification n = new Notification(Notification.ELEMENT_MODIFIED, e.getId()); Notifier.getInstance().sendNotification(n); --- 244,248 ---- */ public void update(Element e) { ! DatabaseFacade.getInstance().update(e); Notification n = new Notification(Notification.ELEMENT_MODIFIED, e.getId()); Notifier.getInstance().sendNotification(n); *************** *** 254,258 **** */ public void remove(Element e) { ! ElementFacade.getInstance().remove(e); Notification n = new Notification(Notification.ELEMENT_DELETED, e.getId()); Notifier.getInstance().sendNotification(n); --- 254,258 ---- */ public void remove(Element e) { ! DatabaseFacade.getInstance().remove(e); Notification n = new Notification(Notification.ELEMENT_DELETED, e.getId()); Notifier.getInstance().sendNotification(n); *************** *** 264,268 **** */ public Set getElements() { ! return ElementFacade.getInstance().findAll(); } --- 264,268 ---- */ public Set getElements() { ! return DatabaseFacade.getInstance().getElements(); } *************** *** 273,277 **** */ public Element findElementById(Long id) { ! return ElementFacade.getInstance().findById(id); } --- 273,277 ---- */ public Element findElementById(Long id) { ! return DatabaseFacade.getInstance().findElementById(id); } *************** *** 281,285 **** */ public void intern(FunctionalSpace f) { ! FunctionalSpaceFacade.getInstance().create(f); Notification n = new Notification(Notification.FUNCTIONAL_SPACE_CREATED, f.getId()); Notifier.getInstance().sendNotification(n); --- 281,285 ---- */ public void intern(FunctionalSpace f) { ! DatabaseFacade.getInstance().intern((Object) f); Notification n = new Notification(Notification.FUNCTIONAL_SPACE_CREATED, f.getId()); Notifier.getInstance().sendNotification(n); *************** *** 291,295 **** */ public void update(FunctionalSpace f) { ! FunctionalSpaceFacade.getInstance().update(f); } --- 291,295 ---- */ public void update(FunctionalSpace f) { ! DatabaseFacade.getInstance().update(f); } *************** *** 308,322 **** if (back == f) { surface.setBackDomain(null); ! SurfaceFacade.getInstance().update(surface); } else { Domain front = surface.getFrontDomain(); if (front == f) { surface.setFrontDomain(null); ! SurfaceFacade.getInstance().update(surface); } } } } ! FunctionalSpaceFacade.getInstance().remove(f); Notification n = new Notification(Notification.FUNCTIONAL_SPACE_DELETED, f.getId()); Notifier.getInstance().sendNotification(n); --- 308,322 ---- if (back == f) { surface.setBackDomain(null); ! DatabaseFacade.getInstance().update(surface); } else { Domain front = surface.getFrontDomain(); if (front == f) { surface.setFrontDomain(null); ! DatabaseFacade.getInstance().update(surface); } } } } ! DatabaseFacade.getInstance().remove(f); Notification n = new Notification(Notification.FUNCTIONAL_SPACE_DELETED, f.getId()); Notifier.getInstance().sendNotification(n); *************** *** 328,332 **** */ public Set getFunctionalSpaces() { ! return FunctionalSpaceFacade.getInstance().findAll(); } --- 328,332 ---- */ public Set getFunctionalSpaces() { ! return DatabaseFacade.getInstance().getFunctionalSpaces(); } *************** *** 337,341 **** */ public FunctionalSpace findFunctionalSpaceById(Long id) { ! return FunctionalSpaceFacade.getInstance().findById(id); } --- 337,341 ---- */ public FunctionalSpace findFunctionalSpaceById(Long id) { ! return DatabaseFacade.getInstance().findFunctionalSpaceById(id); } *************** *** 345,349 **** */ public void intern(Part p) { ! PartFacade.getInstance().create(p); Notification n = new Notification(Notification.PART_CREATED, p.getId()); Notifier.getInstance().sendNotification(n); --- 345,349 ---- */ public void intern(Part p) { ! DatabaseFacade.getInstance().intern((Object) p); Notification n = new Notification(Notification.PART_CREATED, p.getId()); Notifier.getInstance().sendNotification(n); *************** *** 355,359 **** */ public void update(Part p) { ! PartFacade.getInstance().update(p); } --- 355,359 ---- */ public void update(Part p) { ! DatabaseFacade.getInstance().update(p); } *************** *** 363,367 **** */ public void remove(Part p) { ! PartFacade.getInstance().remove(p); Notification n = new Notification(Notification.PART_DELETED, p.getId()); Notifier.getInstance().sendNotification(n); --- 363,367 ---- */ public void remove(Part p) { ! DatabaseFacade.getInstance().remove(p); Notification n = new Notification(Notification.PART_DELETED, p.getId()); Notifier.getInstance().sendNotification(n); *************** *** 373,377 **** */ public Set getParts() { ! return PartFacade.getInstance().findAll(); } --- 373,377 ---- */ public Set getParts() { ! return DatabaseFacade.getInstance().getParts(); } *************** *** 382,386 **** */ public Part findPartById(Long id) { ! return PartFacade.getInstance().findById(id); } --- 382,386 ---- */ public Part findPartById(Long id) { ! return DatabaseFacade.getInstance().findPartById(id); } *************** *** 390,394 **** */ public void intern(Surface s) { ! SurfaceFacade.getInstance().create(s); Notification n = new Notification(Notification.SURFACE_CREATED, s.getId()); Notifier.getInstance().sendNotification(n); --- 390,394 ---- */ public void intern(Surface s) { ! DatabaseFacade.getInstance().intern((Object) s); Notification n = new Notification(Notification.SURFACE_CREATED, s.getId()); Notifier.getInstance().sendNotification(n); *************** *** 400,404 **** */ public void update(Surface s) { ! SurfaceFacade.getInstance().update(s); Notification n = new Notification(Notification.SURFACE_MODIFIED, s.getId()); Notifier.getInstance().sendNotification(n); --- 400,404 ---- */ public void update(Surface s) { ! DatabaseFacade.getInstance().update(s); Notification n = new Notification(Notification.SURFACE_MODIFIED, s.getId()); Notifier.getInstance().sendNotification(n); *************** *** 416,420 **** if (back != null) { if (back.removeSurface(s)) { ! DomainFacade.getInstance().update(back); } s.setBackDomain(null); --- 416,420 ---- if (back != null) { if (back.removeSurface(s)) { ! DatabaseFacade.getInstance().update(back); } s.setBackDomain(null); *************** *** 423,432 **** if (front != null) { if (front.removeSurface(s)) { ! DomainFacade.getInstance().update(front); } s.setFrontDomain(null); } ! SurfaceFacade.getInstance().remove(s); Notification n = new Notification(Notification.SURFACE_DELETED, s.getId()); Notifier.getInstance().sendNotification(n); --- 423,432 ---- if (front != null) { if (front.removeSurface(s)) { ! DatabaseFacade.getInstance().update(front); } s.setFrontDomain(null); } ! DatabaseFacade.getInstance().remove(s); Notification n = new Notification(Notification.SURFACE_DELETED, s.getId()); Notifier.getInstance().sendNotification(n); *************** *** 438,442 **** */ public Set getSurfaces() { ! return SurfaceFacade.getInstance().findAll(); } --- 438,442 ---- */ public Set getSurfaces() { ! return DatabaseFacade.getInstance().getSurfaces(); } *************** *** 447,451 **** */ public Surface findSurfaceById(Long id) { ! return SurfaceFacade.getInstance().findById(id); } --- 447,451 ---- */ public Surface findSurfaceById(Long id) { ! return DatabaseFacade.getInstance().findSurfaceById(id); } *************** *** 455,459 **** */ public void intern(Vertex v) { ! VertexFacade.getInstance().create(v); Notification n = new Notification(Notification.VERTEX_CREATED, v.getId()); Notifier.getInstance().sendNotification(n); --- 455,459 ---- */ public void intern(Vertex v) { ! DatabaseFacade.getInstance().intern((Object) v); Notification n = new Notification(Notification.VERTEX_CREATED, v.getId()); Notifier.getInstance().sendNotification(n); *************** *** 465,469 **** */ public void update(Vertex v) { ! VertexFacade.getInstance().update(v); Notification n = new Notification(Notification.VERTEX_MODIFIED, v.getId()); Notifier.getInstance().sendNotification(n); --- 465,469 ---- */ public void update(Vertex v) { ! DatabaseFacade.getInstance().update(v); Notification n = new Notification(Notification.VERTEX_MODIFIED, v.getId()); Notifier.getInstance().sendNotification(n); *************** *** 475,479 **** */ public void remove(Vertex v) { ! VertexFacade.getInstance().remove(v); Notification n = new Notification(Notification.VERTEX_DELETED, v.getId()); Notifier.getInstance().sendNotification(n); --- 475,479 ---- */ public void remove(Vertex v) { ! DatabaseFacade.getInstance().remove(v); Notification n = new Notification(Notification.VERTEX_DELETED, v.getId()); Notifier.getInstance().sendNotification(n); *************** *** 485,489 **** */ public Set getVertices() { ! return VertexFacade.getInstance().findAll(); } --- 485,489 ---- */ public Set getVertices() { ! return DatabaseFacade.getInstance().getVertices(); } *************** *** 494,498 **** */ public Vertex findVertexById(Long id) { ! return VertexFacade.getInstance().findById(id); } --- 494,498 ---- */ public Vertex findVertexById(Long id) { ! return DatabaseFacade.getInstance().findVertexById(id); } Index: DomainFacade.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/DomainFacade.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** DomainFacade.java 30 Sep 2005 11:15:34 -0000 1.5 --- DomainFacade.java 5 Oct 2005 08:05:36 -0000 1.6 *************** *** 43,64 **** return instance; } - - /** - * Update the Domain - * @param domain The domain to update - */ - public synchronized void update(Domain domain) { - if (domain instanceof ConstructionSpace) { - ConstructionSpaceFacade.getInstance().update((ConstructionSpace)domain); - } else if (domain instanceof FunctionalSpace) { - FunctionalSpaceFacade.getInstance().update((FunctionalSpace)domain); - } else if (domain instanceof Element) { - ElementFacade.getInstance().update((Element)domain); - } else if (domain instanceof Part) { - PartFacade.getInstance().update((Part)domain); - } else { - log.error("Unsupported type: " + domain.getClass().getName()); - } - } /** --- 43,46 ---- Index: SurfaceFacade.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/SurfaceFacade.java,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** SurfaceFacade.java 3 Oct 2005 08:34:37 -0000 1.14 --- SurfaceFacade.java 5 Oct 2005 08:05:36 -0000 1.15 *************** *** 45,125 **** /** - * Create a surface - * @param s The surface - */ - public synchronized void create(Surface s) { - HibernateUtil hu = HibernateUtil.getInstance(); - Transaction tx = null; - try { - Session session = hu.currentSession(); - tx = session.beginTransaction(); - - session.save(s); - - tx.commit(); - - - } catch (Exception ex) { - if (tx != null) { - tx.rollback(); - } - log.error(ex.getMessage(), ex); - } finally { - hu.closeSession(); - } - } - - /** - * Update a surface - * @param s The surface - */ - public synchronized void update(Surface s) { - HibernateUtil hu = HibernateUtil.getInstance(); - Transaction tx = null; - try { - Session session = hu.currentSession(); - tx = session.beginTransaction(); - - session.update(s); - - tx.commit(); - - - } catch (Exception ex) { - if (tx != null) { - tx.rollback(); - } - log.error(ex.getMessage(), ex); - } finally { - hu.closeSession(); - } - } - - /** - * Remove a surface - * @param s The surface - */ - public synchronized void remove(Surface s) { - - HibernateUtil hu = HibernateUtil.getInstance(); - Transaction tx = null; - try { - Session session = hu.currentSession(); - tx = session.beginTransaction(); - - session.delete(s); - - tx.commit(); - } catch (Exception ex) { - if (tx != null) { - tx.rollback(); - } - log.error(ex.getMessage(), ex); - } finally { - hu.closeSession(); - } - } - - /** * Find all surfaces * @return The surfaces --- 45,48 ---- Index: VertexFacade.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/VertexFacade.java,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** VertexFacade.java 3 Oct 2005 08:34:37 -0000 1.11 --- VertexFacade.java 5 Oct 2005 08:05:36 -0000 1.12 *************** *** 46,127 **** /** - * Create a vertex - * @param v The vertex - */ - public synchronized void create(Vertex v) { - HibernateUtil hu = HibernateUtil.getInstance(); - Transaction tx = null; - try { - Session session = hu.currentSession(); - tx = session.beginTransaction(); - - session.save(v); - - tx.commit(); - - - } catch (Exception ex) { - if (tx != null) { - tx.rollback(); - } - log.error(ex.getMessage(), ex); - } finally { - hu.closeSession(); - } - } - - /** - * Update a vertex - * @param v The vertex - */ - public synchronized void update(Vertex v) { - HibernateUtil hu = HibernateUtil.getInstance(); - Transaction tx = null; - try { - Session session = hu.currentSession(); - tx = session.beginTransaction(); - - session.update(v); - - tx.commit(); - - - } catch (Exception ex) { - if (tx != null) { - tx.rollback(); - } - log.error(ex.getMessage(), ex); - } finally { - hu.closeSession(); - } - } - - /** - * Remove a vertex - * @param v The vertex - */ - public synchronized void remove(Vertex v) { - HibernateUtil hu = HibernateUtil.getInstance(); - Transaction tx = null; - try { - Session session = hu.currentSession(); - tx = session.beginTransaction(); - - session.delete(v); - - tx.commit(); - - - } catch (Exception ex) { - if (tx != null) { - tx.rollback(); - } - log.error(ex.getMessage(), ex); - } finally { - hu.closeSession(); - } - } - - /** * Find all vertexs * @return The vertexs --- 46,49 ---- Index: PartFacade.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/PartFacade.java,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** PartFacade.java 3 Oct 2005 08:34:37 -0000 1.8 --- PartFacade.java 5 Oct 2005 08:05:36 -0000 1.9 *************** *** 46,127 **** /** - * Create a part - * @param p The part - */ - public synchronized void create(Part p) { - HibernateUtil hu = HibernateUtil.getInstance(); - Transaction tx = null; - try { - Session session = hu.currentSession(); - tx = session.beginTransaction(); - - session.save(p); - - tx.commit(); - - - } catch (Exception ex) { - if (tx != null) { - tx.rollback(); - } - log.error(ex.getMessage(), ex); - } finally { - hu.closeSession(); - } - } - - /** - * Update a part - * @param p The part - */ - public synchronized void update(Part p) { - HibernateUtil hu = HibernateUtil.getInstance(); - Transaction tx = null; - try { - Session session = hu.currentSession(); - tx = session.beginTransaction(); - - session.update(p); - - tx.commit(); - - - } catch (Exception ex) { - if (tx != null) { - tx.rollback(); - } - log.error(ex.getMessage(), ex); - } finally { - hu.closeSession(); - } - } - - /** - * Remove a part - * @param p The part - */ - public synchronized void remove(Part p) { - HibernateUtil hu = HibernateUtil.getInstance(); - Transaction tx = null; - try { - Session session = hu.currentSession(); - tx = session.beginTransaction(); - - session.delete(p); - - tx.commit(); - - - } catch (Exception ex) { - if (tx != null) { - tx.rollback(); - } - log.error(ex.getMessage(), ex); - } finally { - hu.closeSession(); - } - } - - /** * Find all parts * @return The parts --- 46,49 ---- Index: EdgeFacade.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/EdgeFacade.java,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** EdgeFacade.java 3 Oct 2005 08:34:37 -0000 1.10 --- EdgeFacade.java 5 Oct 2005 08:05:36 -0000 1.11 *************** *** 44,126 **** return instance; } ! ! /** ! * Create an edge ! * @param e The edge ! */ ! public synchronized void create(Edge e) { ! HibernateUtil hu = HibernateUtil.getInstance(); ! Transaction tx = null; ! try { ! Session session = hu.currentSession(); ! tx = session.beginTransaction(); ! ! session.save(e); ! ! tx.commit(); ! ! ! } catch (Exception ex) { ! if (tx != null) { ! tx.rollback(); ! } ! log.error(ex.getMessage(), ex); ! } finally { ! hu.closeSession(); ! } ! } ! ! /** ! * Update an edge ! * @param e The edge ! */ ! public synchronized void update(Edge e) { ! HibernateUtil hu = HibernateUtil.getInstance(); ! Transaction tx = null; ! try { ! Session session = hu.currentSession(); ! tx = session.beginTransaction(); ! ! session.update(e); ! ! tx.commit(); ! ! ! } catch (Exception ex) { ! if (tx != null) { ! tx.rollback(); ! } ! log.error(ex.getMessage(), ex); ! } finally { ! hu.closeSession(); ! } ! } ! ! /** ! * Remove an edge ! * @param e The edge ! */ ! public synchronized void remove(Edge e) { ! HibernateUtil hu = HibernateUtil.getInstance(); ! Transaction tx = null; ! try { ! Session session = hu.currentSession(); ! tx = session.beginTransaction(); ! ! session.delete(e); ! ! tx.commit(); ! ! ! } catch (Exception ex) { ! if (tx != null) { ! tx.rollback(); ! } ! log.error(ex.getMessage(), ex); ! } finally { ! hu.closeSession(); ! } ! } ! /** * Find all edges --- 44,48 ---- return instance; } ! /** * Find all edges Index: FunctionalSpaceFacade.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/FunctionalSpaceFacade.java,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** FunctionalSpaceFacade.java 3 Oct 2005 08:34:37 -0000 1.13 --- FunctionalSpaceFacade.java 5 Oct 2005 08:05:36 -0000 1.14 *************** *** 44,127 **** return instance; } ! ! /** ! * Create a functional space ! * @param f The functional space ! */ ! public synchronized void create(FunctionalSpace f) { ! HibernateUtil hu = HibernateUtil.getInstance(); ! Transaction tx = null; ! try { ! Session session = hu.currentSession(); ! tx = session.beginTransaction(); ! ! session.save(f); ! ! tx.commit(); ! ! ! } catch (Exception ex) { ! if (tx != null) { ! tx.rollback(); ! } ! log.error(ex.getMessage(), ex); ! } finally { ! hu.closeSession(); ! } ! } ! ! /** ! * Update a functional space ! * @param f The functional space ! */ ! public synchronized void update(FunctionalSpace f) { ! HibernateUtil hu = HibernateUtil.getInstance(); ! Transaction tx = null; ! try { ! Session session = hu.currentSession(); ! tx = session.beginTransaction(); ! ! session.update(f); ! ! tx.commit(); ! ! ! } catch (Exception ex) { ! if (tx != null) { ! tx.rollback(); ! } ! log.error(ex.getMessage(), ex); ! } finally { ! hu.closeSession(); ! } ! } ! ! /** ! * Remove a functional space ! * @param f The functional space ! */ ! public synchronized void remove(FunctionalSpace f) { ! HibernateUtil hu = HibernateUtil.getInstance(); ! Transaction tx = null; ! ! try { ! Session session = hu.currentSession(); ! tx = session.beginTransaction(); ! ! session.delete(f); ! ! tx.commit(); ! ! ! } catch (Exception ex) { ! if (tx != null) { ! tx.rollback(); ! } ! log.error(ex.getMessage(), ex); ! } finally { ! hu.closeSession(); ! } ! } ! /** * Find all functional spaces --- 44,48 ---- return instance; } ! /** * Find all functional spaces |
From: Michael L. <he...@us...> - 2005-10-04 08:03:34
|
Update of /cvsroot/bprocessor/build In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15420 Modified Files: build.xml Log Message: Added JDCB support for PostgreSQL Index: build.xml =================================================================== RCS file: /cvsroot/bprocessor/build/build.xml,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** build.xml 23 Sep 2005 09:58:52 -0000 1.6 --- build.xml 4 Oct 2005 08:03:26 -0000 1.7 *************** *** 100,103 **** --- 100,106 ---- <fileset dir="${tools.dir}/oscache"/> </copy> + <copy todir="${release.dir}/library"> + <fileset dir="${tools.dir}/postgresql"/> + </copy> <copy todir="${release.dir}/plugin"> <fileset dir="${gl.dir}/dist"> |
From: Michael L. <he...@us...> - 2005-10-04 08:02:57
|
Update of /cvsroot/bprocessor/tools In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15203 Added Files: .project Log Message: Added JDCB support for PostgreSQL --- NEW FILE: .project --- <?xml version="1.0" encoding="UTF-8"?> <projectDescription> <name>tools</name> <comment></comment> <projects> </projects> <buildSpec> </buildSpec> <natures> </natures> </projectDescription> |
From: Michael L. <he...@us...> - 2005-10-04 08:02:57
|
Update of /cvsroot/bprocessor/tools/postgresql In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15203/postgresql Added Files: postgresql-8.0-312.jdbc3.jar Log Message: Added JDCB support for PostgreSQL --- NEW FILE: postgresql-8.0-312.jdbc3.jar --- (This appears to be a binary file; contents omitted.) |
From: Michael L. <he...@us...> - 2005-10-04 08:02:48
|
Update of /cvsroot/bprocessor/tools/postgresql In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15180/postgresql Log Message: Directory /cvsroot/bprocessor/tools/postgresql added to the repository |
From: Nordholt <nor...@us...> - 2005-10-03 18:45:03
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16563 Modified Files: AbstractView.java Log Message: surfaces with functional spaces on both sides are transparent. The spaces labels are colored differently for functional spaces than construction Index: AbstractView.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view/AbstractView.java,v retrieving revision 1.40 retrieving revision 1.41 diff -C2 -d -r1.40 -r1.41 *** AbstractView.java 2 Oct 2005 14:48:22 -0000 1.40 --- AbstractView.java 3 Oct 2005 18:44:50 -0000 1.41 *************** *** 12,15 **** --- 12,16 ---- import net.sourceforge.bprocessor.model.CoordinateSystem; import net.sourceforge.bprocessor.model.FunctionalSpace; + import net.sourceforge.bprocessor.model.ConstructionSpace; import net.sourceforge.bprocessor.model.Plane; import net.sourceforge.bprocessor.model.Edge; *************** *** 449,453 **** gl.glVertex3d(frontAnchor.getX(), frontAnchor.getY(), frontAnchor.getZ()); gl.glEnd(); ! gl.glColor3d(0.2, 0.2, 0.2); if (clickable) { pushName(gl, "front"); --- 450,460 ---- gl.glVertex3d(frontAnchor.getX(), frontAnchor.getY(), frontAnchor.getZ()); gl.glEnd(); ! if (frontDomain instanceof FunctionalSpace) { ! gl.glColor3d(0.2, 0.2, 0.5); ! } else if (frontDomain instanceof ConstructionSpace) { ! gl.glColor3d(0.8, 0.2, 0.4); ! } else { ! gl.glColor3d(0.2, 0.2, 0.2); ! } if (clickable) { pushName(gl, "front"); *************** *** 473,477 **** gl.glVertex3d(backAnchor.getX(), backAnchor.getY(), backAnchor.getZ()); gl.glEnd(); ! gl.glColor3d(0.2, 0.2, 0.2); if (clickable) { pushName(gl, "back"); --- 480,490 ---- gl.glVertex3d(backAnchor.getX(), backAnchor.getY(), backAnchor.getZ()); gl.glEnd(); ! if (backDomain instanceof FunctionalSpace) { ! gl.glColor3d(0.2, 0.2, 0.5); ! } else if (backDomain instanceof ConstructionSpace) { ! gl.glColor3d(0.8, 0.2, 0.4); ! } else { ! gl.glColor3d(0.2, 0.2, 0.2); ! } if (clickable) { pushName(gl, "back"); *************** *** 635,639 **** Surface s = (Surface)it.next(); if (!selection.contains(s)) { ! drawSurface(s); } } --- 648,660 ---- Surface s = (Surface)it.next(); if (!selection.contains(s)) { ! if ((s.getBackDomain() instanceof FunctionalSpace) && ! (s.getFrontDomain() instanceof FunctionalSpace)) { ! gl.glEnable(GL.GL_POLYGON_STIPPLE); ! gl.glPolygonStipple(transparency); ! drawSurface(s); ! gl.glDisable(GL.GL_POLYGON_STIPPLE); ! } else { ! drawSurface(s); ! } } } *************** *** 680,689 **** */ private void drawSurface(Surface s) { - if (s.getIsInner() && - s.getBackDomain() instanceof FunctionalSpace && - s.getFrontDomain() instanceof FunctionalSpace) { - gl.glEnable(GL.GL_POLYGON_STIPPLE); - gl.glPolygonStipple(transparency); - } GLUtesselator tess = glu.gluNewTess(); GLUtesselatorCallback cb = new Callback(); --- 701,704 ---- *************** *** 722,726 **** glu.gluTessEndPolygon(tess); glu.gluDeleteTess(tess); - gl.glDisable(GL.GL_POLYGON_STIPPLE); } --- 737,740 ---- |
From: Nordholt <nor...@us...> - 2005-10-03 18:41:42
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15539 Modified Files: ExtrusionTool.java Log Message: removed bug when extruding surfaces with functional spaces attached Index: ExtrusionTool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/ExtrusionTool.java,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** ExtrusionTool.java 2 Oct 2005 14:48:23 -0000 1.19 --- ExtrusionTool.java 3 Oct 2005 18:41:34 -0000 1.20 *************** *** 195,202 **** private Surface extendSurface(Surface extendSurf) { // HAVE TO BE CHANGED IN FUTURE RELEASE ! Domain newCSpace = extendSurf.getBackDomain(); ! if (newCSpace == null) { ! newCSpace = new ConstructionSpace("innerSpace"); ! Project.getInstance().intern((ConstructionSpace) newCSpace); } Domain outer = extendSurf.getFrontDomain(); --- 195,202 ---- private Surface extendSurface(Surface extendSurf) { // HAVE TO BE CHANGED IN FUTURE RELEASE ! Domain newSpace = extendSurf.getBackDomain(); ! if (newSpace == null) { ! newSpace = new ConstructionSpace("innerSpace"); ! Project.getInstance().intern((ConstructionSpace) newSpace); } Domain outer = extendSurf.getFrontDomain(); *************** *** 207,212 **** List edges = extendSurf.getEdges(); List top = new ArrayList(edges.size()); ! newCSpace.addSurface(extendSurf); ! extendSurf.setBackDomain(newCSpace); Iterator i = edges.iterator(); Edge current = null; --- 207,212 ---- List edges = extendSurf.getEdges(); List top = new ArrayList(edges.size()); ! newSpace.addSurface(extendSurf); ! extendSurf.setBackDomain(newSpace); Iterator i = edges.iterator(); Edge current = null; *************** *** 263,268 **** } Surface sur = createSurface(newEdges); ! newCSpace.addSurface(sur); ! sur.setFrontDomain(newCSpace); newEdges = new ArrayList(); --- 263,268 ---- } Surface sur = createSurface(newEdges); ! newSpace.addSurface(sur); ! sur.setFrontDomain(newSpace); newEdges = new ArrayList(); *************** *** 281,288 **** } //moving this line to the top ! Project.getInstance().update(newCSpace); Surface topSurf = createSurface(top); ! newCSpace.addSurface(topSurf); ! topSurf.setFrontDomain(newCSpace); Notification n = new Notification(Notification.SURFACE_SELECTED, topSurf.getId()); Notifier.getInstance().sendNotification(n); --- 281,288 ---- } //moving this line to the top ! Project.getInstance().update(newSpace); Surface topSurf = createSurface(top); ! newSpace.addSurface(topSurf); ! topSurf.setFrontDomain(newSpace); Notification n = new Notification(Notification.SURFACE_SELECTED, topSurf.getId()); Notifier.getInstance().sendNotification(n); *************** *** 293,297 **** } Notifier.getInstance().sendNotification(n); ! n = new Notification(Notification.CONSTRUCTION_SPACE_MODIFIED, newCSpace.getId()); Notifier.getInstance().sendNotification(n); --- 293,301 ---- } Notifier.getInstance().sendNotification(n); ! if (newSpace instanceof ConstructionSpace) { ! n = new Notification(Notification.CONSTRUCTION_SPACE_MODIFIED, newSpace.getId()); ! } else if (newSpace instanceof FunctionalSpace) { ! n = new Notification(Notification.FUNCTIONAL_SPACE_MODIFIED, newSpace.getId()); ! } Notifier.getInstance().sendNotification(n); |
From: Nordholt <nor...@us...> - 2005-10-03 18:40:02
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15078 Modified Files: SelectTool.java Log Message: made inner class listeners for the popup menu. Now popup has submenu groupings and create new feature Index: SelectTool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/SelectTool.java,v retrieving revision 1.29 retrieving revision 1.30 diff -C2 -d -r1.29 -r1.30 *** SelectTool.java 3 Oct 2005 13:32:14 -0000 1.29 --- SelectTool.java 3 Oct 2005 18:39:54 -0000 1.30 *************** *** 9,13 **** import net.sourceforge.bprocessor.gl.GLView; import net.sourceforge.bprocessor.gl.view.View; - import net.sourceforge.bprocessor.gl.DomainPopupListener; import net.sourceforge.bprocessor.kernel.notification.Notification; --- 9,12 ---- *************** *** 22,34 **** import net.sourceforge.bprocessor.model.FunctionalSpace; import net.sourceforge.bprocessor.model.ConstructionSpace; import java.awt.event.ActionListener; import java.awt.event.MouseEvent; import java.awt.event.KeyEvent; import java.awt.event.InputEvent; - import java.awt.event.MouseListener; import javax.swing.JPopupMenu; import javax.swing.JMenuItem; import java.util.Iterator; --- 21,38 ---- import net.sourceforge.bprocessor.model.FunctionalSpace; import net.sourceforge.bprocessor.model.ConstructionSpace; + import net.sourceforge.bprocessor.model.Space; + + import net.sourceforge.bprocessor.gui.GUI; import java.awt.event.ActionListener; + import java.awt.event.ActionEvent; import java.awt.event.MouseEvent; import java.awt.event.KeyEvent; import java.awt.event.InputEvent; import javax.swing.JPopupMenu; import javax.swing.JMenuItem; + import javax.swing.JMenu; + import javax.swing.JOptionPane; import java.util.Iterator; *************** *** 132,147 **** surface = (Surface)o; } } - while (domIt.hasNext()) { - Domain domain = (Domain)domIt.next(); - JMenuItem domainItem = new JMenuItem(domain.getName()); - ActionListener ml = new DomainPopupListener(domain, - surface, - side.equals("front")); - domainItem.addActionListener(ml); - pp.add(domainItem); - } - pp.pack(); - glv.popup(pp, e.getX(), e.getY()); } else if (target == null) { Iterator it = new HashSet(selection).iterator(); --- 136,185 ---- surface = (Surface)o; } + JMenuItem noneItem = new JMenuItem("NONE"); + ActionListener noneListener = new DomainPopupListener(null, + surface, + side.equals("front")); + noneItem.addActionListener(noneListener); + pp.add(noneItem); + pp.addSeparator(); + JMenu createSub = new JMenu("Create"); + JMenuItem createFuncItem = new JMenuItem("New Functional Space"); + ActionListener funcListener = new CreateSpaceActionListener(surface, + side.equals("front"), + true); + createFuncItem.addActionListener(funcListener); + createSub.add(createFuncItem); + + JMenuItem createConstItem = new JMenuItem("New Construction Space"); + ActionListener constListener = new CreateSpaceActionListener(surface, + side.equals("front"), + false); + createConstItem.addActionListener(constListener); + createSub.add(createConstItem); + + pp.add(createSub); + pp.addSeparator(); + JMenu funcMenu = new JMenu("Functional Spaces"); + JMenu constMenu = new JMenu("Construction Spaces"); + while (domIt.hasNext()) { + Domain domain = (Domain)domIt.next(); + if (domain instanceof Space) { + JMenuItem domainItem = new JMenuItem(domain.getName()); + ActionListener ml = new DomainPopupListener(domain, + surface, + side.equals("front")); + domainItem.addActionListener(ml); + if (domain instanceof FunctionalSpace) { + funcMenu.add(domainItem); + } else { + constMenu.add(domainItem); + } + } + } + pp.add(funcMenu); + pp.add(constMenu); + pp.pack(); + glv.popup(pp, e.getX(), e.getY()); } } else if (target == null) { Iterator it = new HashSet(selection).iterator(); *************** *** 346,348 **** --- 384,521 ---- return false; } + + /** + * The listener for the domain popup menu. + */ + private class DomainPopupListener implements ActionListener { + + /** The domain */ + private Domain domain; + + /** The Surface */ + private Surface surface; + + /** Boolean telling if this is for the front or back of the surface*/ + private boolean front; + + /** + * Constructs a listener for an item in the domain popup that assigns the given domain to + * the given side of a surface. + * @param domain the domain + * @param surface the surface + * @param front werther or not this popup for the front of the back of the surface + */ + public DomainPopupListener(Domain domain, Surface surface, boolean front) { + this.domain = domain; + this.surface = surface; + this.front = front; + } + + /** + * Invoked when an action is performed + * @param arg0 an action event + */ + public void actionPerformed(ActionEvent arg0) { + if (front) { + Domain oldFront = surface.getFrontDomain(); + surface.setFrontDomain(domain); + if (domain != null) { + domain.addSurface(surface); + } + if (oldFront != null) { + Project.getInstance().update(oldFront); + } + } else { + Domain oldBack = surface.getBackDomain(); + surface.setBackDomain(domain); + if (domain != null) { + domain.addSurface(surface); + } + if (oldBack != null) { + Project.getInstance().update(oldBack); + } + } + if (domain != null) { + Project.getInstance().update(domain); + } + + Project.getInstance().update(surface); + } + } + + /** + * The create functional space action listener for the domain popupmenu. + */ + public class CreateSpaceActionListener implements ActionListener { + + /** The Surface */ + private Surface surface; + + /** Boolean telling if this is for the front or back of the surface*/ + private boolean front; + + /** Boolean telling if this is for creating functional or construction spaces*/ + private boolean functional; + + /** + * CreateSpaceActionListener + * @param surface the surface this listener is associated with + * @param front should be true if this listener is associated with the front-side of the surface + * @param functional should be true this listener is for creating functional spaces. Otherwise + * it will be for construction spaces. + */ + public CreateSpaceActionListener(Surface surface, boolean front, boolean functional) { + this.surface = surface; + this.front = front; + this.functional = functional; + } + + /** + * Action performed + * @param e The action event + */ + public void actionPerformed(ActionEvent e) { + String result; + if (functional) { + result = JOptionPane.showInputDialog(GUI.getInstance(), + "Name", + "Create Functional Space", + JOptionPane.QUESTION_MESSAGE); + } else { + result = JOptionPane.showInputDialog(GUI.getInstance(), + "Name", + "Create Construction Space", + JOptionPane.QUESTION_MESSAGE); + } + if (log.isDebugEnabled()) { + log.debug("Input: " + result); + } + + if (result != null && !result.trim().equals("")) { + Space space; + if (functional) { + space = new FunctionalSpace(result.trim()); + Project.getInstance().intern((FunctionalSpace)space); + } else { + space = new ConstructionSpace(result.trim()); + Project.getInstance().intern((ConstructionSpace)space); + } + + Domain old; + if (front) { + old = surface.getFrontDomain(); + surface.setFrontDomain(space); + } else { + old = surface.getBackDomain(); + surface.setBackDomain(space); + } + space.addSurface(surface); + Project.getInstance().update(space); + if (old != null) { + Project.getInstance().update(old); + } + } + } + } } + |
From: Nordholt <nor...@us...> - 2005-10-03 18:36:41
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14096 Removed Files: DomainPopupListener.java Log Message: moved as inner class of selecttool --- DomainPopupListener.java DELETED --- |
From: Michael L. <he...@us...> - 2005-10-03 13:32:22
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32402/src/net/sourceforge/bprocessor/gl Modified Files: DomainPopupListener.java Log Message: Changed from MouseAdapter to ActionListener Index: DomainPopupListener.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/DomainPopupListener.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** DomainPopupListener.java 30 Sep 2005 17:52:43 -0000 1.1 --- DomainPopupListener.java 3 Oct 2005 13:32:14 -0000 1.2 *************** *** 13,17 **** import net.sourceforge.bprocessor.model.SurfaceFacade; ! import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; --- 13,18 ---- import net.sourceforge.bprocessor.model.SurfaceFacade; ! import java.awt.event.ActionEvent; ! import java.awt.event.ActionListener; import java.awt.event.MouseEvent; *************** *** 22,26 **** * The listener for the domain popup menu. */ ! public class DomainPopupListener extends MouseAdapter { /** The Log */ private static Logger log = Logger.getLogger(GLView.class); --- 23,27 ---- * The listener for the domain popup menu. */ ! public class DomainPopupListener implements ActionListener { /** The Log */ private static Logger log = Logger.getLogger(GLView.class); *************** *** 63,66 **** --- 64,83 ---- DomainFacade.getInstance().update(domain); SurfaceFacade.getInstance().update(surface); + } + + /* (non-Javadoc) + * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent) + */ + public void actionPerformed(ActionEvent arg0) { + // TODO Auto-generated method stub + if (front) { + surface.setFrontDomain(domain); + domain.addSurface(surface); + } else { + surface.setBackDomain(domain); + domain.addSurface(surface); + } + DomainFacade.getInstance().update(domain); + SurfaceFacade.getInstance().update(surface); } } |
From: Michael L. <he...@us...> - 2005-10-03 13:32:22
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32402/src/net/sourceforge/bprocessor/gl/tool Modified Files: SelectTool.java Log Message: Changed from MouseAdapter to ActionListener Index: SelectTool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/SelectTool.java,v retrieving revision 1.28 retrieving revision 1.29 diff -C2 -d -r1.28 -r1.29 *** SelectTool.java 2 Oct 2005 14:48:23 -0000 1.28 --- SelectTool.java 3 Oct 2005 13:32:14 -0000 1.29 *************** *** 23,26 **** --- 23,27 ---- import net.sourceforge.bprocessor.model.ConstructionSpace; + import java.awt.event.ActionListener; import java.awt.event.MouseEvent; import java.awt.event.KeyEvent; *************** *** 135,142 **** Domain domain = (Domain)domIt.next(); JMenuItem domainItem = new JMenuItem(domain.getName()); ! MouseListener ml = new DomainPopupListener(domain, surface, side.equals("front")); ! domainItem.addMouseListener(ml); pp.add(domainItem); } --- 136,143 ---- Domain domain = (Domain)domIt.next(); JMenuItem domainItem = new JMenuItem(domain.getName()); ! ActionListener ml = new DomainPopupListener(domain, surface, side.equals("front")); ! domainItem.addActionListener(ml); pp.add(domainItem); } |
From: Michael L. <he...@us...> - 2005-10-03 08:34:49
|
Update of /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3756/src/net/sourceforge/bprocessor/model Modified Files: PartFacade.java EdgeFacade.java ConstructionSpaceFacade.java ElementFacade.java VertexFacade.java SurfaceFacade.java Project.java FunctionalSpaceFacade.java Log Message: Moved remove and notification functionality from *Facade to Project Index: ConstructionSpaceFacade.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/ConstructionSpaceFacade.java,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** ConstructionSpaceFacade.java 30 Sep 2005 11:35:06 -0000 1.12 --- ConstructionSpaceFacade.java 3 Oct 2005 08:34:37 -0000 1.13 *************** *** 7,12 **** package net.sourceforge.bprocessor.model; - import net.sourceforge.bprocessor.kernel.notification.Notification; - import net.sourceforge.bprocessor.kernel.notification.Notifier; import net.sourceforge.bprocessor.model.db.HibernateUtil; --- 7,10 ---- *************** *** 62,67 **** tx.commit(); ! Notification n = new Notification(Notification.CONSTRUCTION_SPACE_CREATED, c.getId()); ! Notifier.getInstance().sendNotification(n); } catch (Exception ex) { if (tx != null) { --- 60,64 ---- tx.commit(); ! } catch (Exception ex) { if (tx != null) { *************** *** 88,94 **** tx.commit(); - - Notification n = new Notification(Notification.CONSTRUCTION_SPACE_MODIFIED, c.getId()); - Notifier.getInstance().sendNotification(n); } catch (Exception ex) { if (tx != null) { --- 85,88 ---- *************** *** 108,132 **** HibernateUtil hu = HibernateUtil.getInstance(); Transaction tx = null; ! ! //setting references to this space to null ! Set surfaces = c.getSurfaces(); ! if (surfaces != null) { ! Iterator surfIt = surfaces.iterator(); ! while (surfIt.hasNext()) { ! Surface surface = (Surface)surfIt.next(); ! Domain back = surface.getBackDomain(); ! if (back == c) { ! surface.setBackDomain(null); ! SurfaceFacade.getInstance().update(surface); ! } else { ! Domain front = surface.getFrontDomain(); ! if (front == c) { ! surface.setFrontDomain(null); ! SurfaceFacade.getInstance().update(surface); ! } ! } ! } ! } ! try { Session session = hu.currentSession(); --- 102,106 ---- HibernateUtil hu = HibernateUtil.getInstance(); Transaction tx = null; ! try { Session session = hu.currentSession(); *************** *** 137,142 **** tx.commit(); - Notification n = new Notification(Notification.CONSTRUCTION_SPACE_DELETED, c.getId()); - Notifier.getInstance().sendNotification(n); } catch (Exception ex) { if (tx != null) { --- 111,114 ---- Index: ElementFacade.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/ElementFacade.java,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** ElementFacade.java 30 Sep 2005 11:35:06 -0000 1.7 --- ElementFacade.java 3 Oct 2005 08:34:37 -0000 1.8 *************** *** 7,12 **** package net.sourceforge.bprocessor.model; - import net.sourceforge.bprocessor.kernel.notification.Notification; - import net.sourceforge.bprocessor.kernel.notification.Notifier; import net.sourceforge.bprocessor.model.db.HibernateUtil; --- 7,10 ---- *************** *** 62,67 **** tx.commit(); ! Notification n = new Notification(Notification.ELEMENT_CREATED, e.getId()); ! Notifier.getInstance().sendNotification(n); } catch (Exception ex) { if (tx != null) { --- 60,64 ---- tx.commit(); ! } catch (Exception ex) { if (tx != null) { *************** *** 89,94 **** tx.commit(); ! Notification n = new Notification(Notification.ELEMENT_MODIFIED, e.getId()); ! Notifier.getInstance().sendNotification(n); } catch (Exception ex) { if (tx != null) { --- 86,90 ---- tx.commit(); ! } catch (Exception ex) { if (tx != null) { *************** *** 116,121 **** tx.commit(); - Notification n = new Notification(Notification.ELEMENT_DELETED, e.getId()); - Notifier.getInstance().sendNotification(n); } catch (Exception ex) { if (tx != null) { --- 112,115 ---- Index: Project.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Project.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** Project.java 2 Oct 2005 14:36:30 -0000 1.2 --- Project.java 3 Oct 2005 08:34:37 -0000 1.3 *************** *** 12,15 **** --- 12,18 ---- import java.util.Set; + import net.sourceforge.bprocessor.kernel.notification.Notification; + import net.sourceforge.bprocessor.kernel.notification.Notifier; + import org.apache.log4j.Logger; /** *************** *** 77,80 **** --- 80,85 ---- public void intern(ConstructionSpace c) { ConstructionSpaceFacade.getInstance().create(c); + Notification n = new Notification(Notification.CONSTRUCTION_SPACE_CREATED, c.getId()); + Notifier.getInstance().sendNotification(n); } *************** *** 85,88 **** --- 90,95 ---- public void update(ConstructionSpace c) { ConstructionSpaceFacade.getInstance().update(c); + Notification n = new Notification(Notification.CONSTRUCTION_SPACE_MODIFIED, c.getId()); + Notifier.getInstance().sendNotification(n); } *************** *** 92,96 **** --- 99,124 ---- */ public void remove(ConstructionSpace c) { + // setting references to this space to null + Set surfaces = c.getSurfaces(); + if (surfaces != null) { + Iterator surfIt = surfaces.iterator(); + while (surfIt.hasNext()) { + Surface surface = (Surface)surfIt.next(); + Domain back = surface.getBackDomain(); + if (back == c) { + surface.setBackDomain(null); + SurfaceFacade.getInstance().update(surface); + } else { + Domain front = surface.getFrontDomain(); + if (front == c) { + surface.setFrontDomain(null); + SurfaceFacade.getInstance().update(surface); + } + } + } + } ConstructionSpaceFacade.getInstance().remove(c); + Notification n = new Notification(Notification.CONSTRUCTION_SPACE_DELETED, c.getId()); + Notifier.getInstance().sendNotification(n); } *************** *** 119,128 **** if (domain instanceof ConstructionSpace) { ConstructionSpaceFacade.getInstance().update((ConstructionSpace)domain); } else if (domain instanceof FunctionalSpace) { FunctionalSpaceFacade.getInstance().update((FunctionalSpace)domain); } else if (domain instanceof Element) { ! ElementFacade.getInstance().update((Element)domain); } else if (domain instanceof Part) { PartFacade.getInstance().update((Part)domain); } else { log.error("Unsupported type: " + domain.getClass().getName()); --- 147,163 ---- if (domain instanceof ConstructionSpace) { ConstructionSpaceFacade.getInstance().update((ConstructionSpace)domain); + Notification n = new Notification(Notification.CONSTRUCTION_SPACE_MODIFIED, domain.getId()); + Notifier.getInstance().sendNotification(n); } else if (domain instanceof FunctionalSpace) { FunctionalSpaceFacade.getInstance().update((FunctionalSpace)domain); + Notification n = new Notification(Notification.FUNCTIONAL_SPACE_MODIFIED, domain.getId()); + Notifier.getInstance().sendNotification(n); } else if (domain instanceof Element) { ! update((Element)domain); ! } else if (domain instanceof Part) { PartFacade.getInstance().update((Part)domain); + Notification n = new Notification(Notification.PART_MODIFIED, domain.getId()); + Notifier.getInstance().sendNotification(n); } else { log.error("Unsupported type: " + domain.getClass().getName()); *************** *** 153,156 **** --- 188,193 ---- public void intern(Edge e) { EdgeFacade.getInstance().create(e); + Notification n = new Notification(Notification.EDGE_CREATED, e.getId()); + Notifier.getInstance().sendNotification(n); } *************** *** 161,164 **** --- 198,203 ---- public void update(Edge e) { EdgeFacade.getInstance().update(e); + Notification n = new Notification(Notification.EDGE_MODIFIED, e.getId()); + Notifier.getInstance().sendNotification(n); } *************** *** 169,172 **** --- 208,213 ---- public void remove(Edge e) { EdgeFacade.getInstance().remove(e); + Notification n = new Notification(Notification.EDGE_DELETED, e.getId()); + Notifier.getInstance().sendNotification(n); } *************** *** 194,197 **** --- 235,240 ---- public void intern(Element e) { ElementFacade.getInstance().create(e); + Notification n = new Notification(Notification.ELEMENT_CREATED, e.getId()); + Notifier.getInstance().sendNotification(n); } *************** *** 202,205 **** --- 245,250 ---- public void update(Element e) { ElementFacade.getInstance().update(e); + Notification n = new Notification(Notification.ELEMENT_MODIFIED, e.getId()); + Notifier.getInstance().sendNotification(n); } *************** *** 210,213 **** --- 255,260 ---- public void remove(Element e) { ElementFacade.getInstance().remove(e); + Notification n = new Notification(Notification.ELEMENT_DELETED, e.getId()); + Notifier.getInstance().sendNotification(n); } *************** *** 235,238 **** --- 282,287 ---- public void intern(FunctionalSpace f) { FunctionalSpaceFacade.getInstance().create(f); + Notification n = new Notification(Notification.FUNCTIONAL_SPACE_CREATED, f.getId()); + Notifier.getInstance().sendNotification(n); } *************** *** 250,254 **** --- 299,324 ---- */ public void remove(FunctionalSpace f) { + // setting references to this space to null + Set surfaces = f.getSurfaces(); + if (surfaces != null) { + Iterator surfIt = surfaces.iterator(); + while (surfIt.hasNext()) { + Surface surface = (Surface)surfIt.next(); + Domain back = surface.getBackDomain(); + if (back == f) { + surface.setBackDomain(null); + SurfaceFacade.getInstance().update(surface); + } else { + Domain front = surface.getFrontDomain(); + if (front == f) { + surface.setFrontDomain(null); + SurfaceFacade.getInstance().update(surface); + } + } + } + } FunctionalSpaceFacade.getInstance().remove(f); + Notification n = new Notification(Notification.FUNCTIONAL_SPACE_DELETED, f.getId()); + Notifier.getInstance().sendNotification(n); } *************** *** 276,279 **** --- 346,351 ---- public void intern(Part p) { PartFacade.getInstance().create(p); + Notification n = new Notification(Notification.PART_CREATED, p.getId()); + Notifier.getInstance().sendNotification(n); } *************** *** 292,295 **** --- 364,369 ---- public void remove(Part p) { PartFacade.getInstance().remove(p); + Notification n = new Notification(Notification.PART_DELETED, p.getId()); + Notifier.getInstance().sendNotification(n); } *************** *** 317,320 **** --- 391,396 ---- public void intern(Surface s) { SurfaceFacade.getInstance().create(s); + Notification n = new Notification(Notification.SURFACE_CREATED, s.getId()); + Notifier.getInstance().sendNotification(n); } *************** *** 325,328 **** --- 401,406 ---- public void update(Surface s) { SurfaceFacade.getInstance().update(s); + Notification n = new Notification(Notification.SURFACE_MODIFIED, s.getId()); + Notifier.getInstance().sendNotification(n); } *************** *** 332,336 **** --- 410,434 ---- */ public void remove(Surface s) { + // to make it safe to remove a surface we need to remove it + //from any domain to which it belongs. + + Domain back = s.getBackDomain(); + if (back != null) { + if (back.removeSurface(s)) { + DomainFacade.getInstance().update(back); + } + s.setBackDomain(null); + } + Domain front = s.getFrontDomain(); + if (front != null) { + if (front.removeSurface(s)) { + DomainFacade.getInstance().update(front); + } + s.setFrontDomain(null); + } + SurfaceFacade.getInstance().remove(s); + Notification n = new Notification(Notification.SURFACE_DELETED, s.getId()); + Notifier.getInstance().sendNotification(n); } *************** *** 358,361 **** --- 456,461 ---- public void intern(Vertex v) { VertexFacade.getInstance().create(v); + Notification n = new Notification(Notification.VERTEX_CREATED, v.getId()); + Notifier.getInstance().sendNotification(n); } *************** *** 366,369 **** --- 466,471 ---- public void update(Vertex v) { VertexFacade.getInstance().update(v); + Notification n = new Notification(Notification.VERTEX_MODIFIED, v.getId()); + Notifier.getInstance().sendNotification(n); } *************** *** 374,377 **** --- 476,481 ---- public void remove(Vertex v) { VertexFacade.getInstance().remove(v); + Notification n = new Notification(Notification.VERTEX_DELETED, v.getId()); + Notifier.getInstance().sendNotification(n); } Index: SurfaceFacade.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/SurfaceFacade.java,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** SurfaceFacade.java 30 Sep 2005 12:47:46 -0000 1.13 --- SurfaceFacade.java 3 Oct 2005 08:34:37 -0000 1.14 *************** *** 7,12 **** package net.sourceforge.bprocessor.model; - import net.sourceforge.bprocessor.kernel.notification.Notification; - import net.sourceforge.bprocessor.kernel.notification.Notifier; import net.sourceforge.bprocessor.model.db.HibernateUtil; --- 7,10 ---- *************** *** 61,66 **** tx.commit(); ! Notification n = new Notification(Notification.SURFACE_CREATED, s.getId()); ! Notifier.getInstance().sendNotification(n); } catch (Exception ex) { if (tx != null) { --- 59,63 ---- tx.commit(); ! } catch (Exception ex) { if (tx != null) { *************** *** 88,93 **** tx.commit(); ! Notification n = new Notification(Notification.SURFACE_MODIFIED, s.getId()); ! Notifier.getInstance().sendNotification(n); } catch (Exception ex) { if (tx != null) { --- 85,89 ---- tx.commit(); ! } catch (Exception ex) { if (tx != null) { *************** *** 105,126 **** */ public synchronized void remove(Surface s) { - //to make it safe to remove a surface we need to remove it - //from any domain to which it belongs. - Domain back = s.getBackDomain(); - if (back != null) { - if (back.removeSurface(s)) { - DomainFacade.getInstance().update(back); - } - s.setBackDomain(null); - } - Domain front = s.getFrontDomain(); - if (front != null) { - if (front.removeSurface(s)) { - DomainFacade.getInstance().update(front); - } - s.setFrontDomain(null); - } - HibernateUtil hu = HibernateUtil.getInstance(); Transaction tx = null; --- 101,105 ---- *************** *** 132,138 **** tx.commit(); - - Notification n = new Notification(Notification.SURFACE_DELETED, s.getId()); - Notifier.getInstance().sendNotification(n); } catch (Exception ex) { if (tx != null) { --- 111,114 ---- Index: VertexFacade.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/VertexFacade.java,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** VertexFacade.java 30 Sep 2005 12:47:46 -0000 1.10 --- VertexFacade.java 3 Oct 2005 08:34:37 -0000 1.11 *************** *** 7,12 **** package net.sourceforge.bprocessor.model; - import net.sourceforge.bprocessor.kernel.notification.Notification; - import net.sourceforge.bprocessor.kernel.notification.Notifier; import net.sourceforge.bprocessor.model.db.HibernateUtil; --- 7,10 ---- *************** *** 62,67 **** tx.commit(); ! Notification n = new Notification(Notification.VERTEX_CREATED, v.getId()); ! Notifier.getInstance().sendNotification(n); } catch (Exception ex) { if (tx != null) { --- 60,64 ---- tx.commit(); ! } catch (Exception ex) { if (tx != null) { *************** *** 89,94 **** tx.commit(); ! Notification n = new Notification(Notification.VERTEX_MODIFIED, v.getId()); ! Notifier.getInstance().sendNotification(n); } catch (Exception ex) { if (tx != null) { --- 86,90 ---- tx.commit(); ! } catch (Exception ex) { if (tx != null) { *************** *** 116,121 **** tx.commit(); ! Notification n = new Notification(Notification.VERTEX_DELETED, v.getId()); ! Notifier.getInstance().sendNotification(n); } catch (Exception ex) { if (tx != null) { --- 112,116 ---- tx.commit(); ! } catch (Exception ex) { if (tx != null) { Index: PartFacade.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/PartFacade.java,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** PartFacade.java 30 Sep 2005 11:35:06 -0000 1.7 --- PartFacade.java 3 Oct 2005 08:34:37 -0000 1.8 *************** *** 7,12 **** package net.sourceforge.bprocessor.model; - import net.sourceforge.bprocessor.kernel.notification.Notification; - import net.sourceforge.bprocessor.kernel.notification.Notifier; import net.sourceforge.bprocessor.model.db.HibernateUtil; --- 7,10 ---- *************** *** 62,67 **** tx.commit(); ! Notification n = new Notification(Notification.PART_CREATED, p.getId()); ! Notifier.getInstance().sendNotification(n); } catch (Exception ex) { if (tx != null) { --- 60,64 ---- tx.commit(); ! } catch (Exception ex) { if (tx != null) { *************** *** 89,94 **** tx.commit(); ! Notification n = new Notification(Notification.PART_MODIFIED, p.getId()); ! Notifier.getInstance().sendNotification(n); } catch (Exception ex) { if (tx != null) { --- 86,90 ---- tx.commit(); ! } catch (Exception ex) { if (tx != null) { *************** *** 116,121 **** tx.commit(); ! Notification n = new Notification(Notification.PART_DELETED, p.getId()); ! Notifier.getInstance().sendNotification(n); } catch (Exception ex) { if (tx != null) { --- 112,116 ---- tx.commit(); ! } catch (Exception ex) { if (tx != null) { Index: EdgeFacade.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/EdgeFacade.java,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** EdgeFacade.java 30 Sep 2005 12:47:46 -0000 1.9 --- EdgeFacade.java 3 Oct 2005 08:34:37 -0000 1.10 *************** *** 7,12 **** package net.sourceforge.bprocessor.model; - import net.sourceforge.bprocessor.kernel.notification.Notification; - import net.sourceforge.bprocessor.kernel.notification.Notifier; import net.sourceforge.bprocessor.model.db.HibernateUtil; --- 7,10 ---- *************** *** 62,67 **** tx.commit(); ! Notification n = new Notification(Notification.EDGE_CREATED, e.getId()); ! Notifier.getInstance().sendNotification(n); } catch (Exception ex) { if (tx != null) { --- 60,64 ---- tx.commit(); ! } catch (Exception ex) { if (tx != null) { *************** *** 89,94 **** tx.commit(); ! Notification n = new Notification(Notification.EDGE_MODIFIED, e.getId()); ! Notifier.getInstance().sendNotification(n); } catch (Exception ex) { if (tx != null) { --- 86,90 ---- tx.commit(); ! } catch (Exception ex) { if (tx != null) { *************** *** 116,121 **** tx.commit(); ! Notification n = new Notification(Notification.EDGE_DELETED, e.getId()); ! Notifier.getInstance().sendNotification(n); } catch (Exception ex) { if (tx != null) { --- 112,116 ---- tx.commit(); ! } catch (Exception ex) { if (tx != null) { Index: FunctionalSpaceFacade.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/FunctionalSpaceFacade.java,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** FunctionalSpaceFacade.java 30 Sep 2005 11:35:06 -0000 1.12 --- FunctionalSpaceFacade.java 3 Oct 2005 08:34:37 -0000 1.13 *************** *** 7,12 **** package net.sourceforge.bprocessor.model; - import net.sourceforge.bprocessor.kernel.notification.Notification; - import net.sourceforge.bprocessor.kernel.notification.Notifier; import net.sourceforge.bprocessor.model.db.HibernateUtil; --- 7,10 ---- *************** *** 62,67 **** tx.commit(); ! Notification n = new Notification(Notification.FUNCTIONAL_SPACE_CREATED, f.getId()); ! Notifier.getInstance().sendNotification(n); } catch (Exception ex) { if (tx != null) { --- 60,64 ---- tx.commit(); ! } catch (Exception ex) { if (tx != null) { *************** *** 89,94 **** tx.commit(); ! Notification n = new Notification(Notification.FUNCTIONAL_SPACE_MODIFIED, f.getId()); ! Notifier.getInstance().sendNotification(n); } catch (Exception ex) { if (tx != null) { --- 86,90 ---- tx.commit(); ! } catch (Exception ex) { if (tx != null) { *************** *** 108,132 **** HibernateUtil hu = HibernateUtil.getInstance(); Transaction tx = null; ! ! //setting references to this space to null ! Set surfaces = f.getSurfaces(); ! if (surfaces != null) { ! Iterator surfIt = surfaces.iterator(); ! while (surfIt.hasNext()) { ! Surface surface = (Surface)surfIt.next(); ! Domain back = surface.getBackDomain(); ! if (back == f) { ! surface.setBackDomain(null); ! SurfaceFacade.getInstance().update(surface); ! } else { ! Domain front = surface.getFrontDomain(); ! if (front == f) { ! surface.setFrontDomain(null); ! SurfaceFacade.getInstance().update(surface); ! } ! } ! } ! } ! try { Session session = hu.currentSession(); --- 104,108 ---- HibernateUtil hu = HibernateUtil.getInstance(); Transaction tx = null; ! try { Session session = hu.currentSession(); *************** *** 137,142 **** tx.commit(); ! Notification n = new Notification(Notification.FUNCTIONAL_SPACE_DELETED, f.getId()); ! Notifier.getInstance().sendNotification(n); } catch (Exception ex) { if (tx != null) { --- 113,117 ---- tx.commit(); ! } catch (Exception ex) { if (tx != null) { |
From: Michael L. <he...@us...> - 2005-10-02 21:32:28
|
Update of /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/xml In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2573/src/net/sourceforge/bprocessor/model/xml Modified Files: PersistenceManager.java Log Message: All access to database now through the Project instance Index: PersistenceManager.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/xml/PersistenceManager.java,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** PersistenceManager.java 30 Sep 2005 11:35:06 -0000 1.9 --- PersistenceManager.java 2 Oct 2005 14:36:30 -0000 1.10 *************** *** 7,21 **** package net.sourceforge.bprocessor.model.xml; - import net.sourceforge.bprocessor.model.AttributeFacade; import net.sourceforge.bprocessor.model.ConstructionSpace; - import net.sourceforge.bprocessor.model.ConstructionSpaceFacade; - import net.sourceforge.bprocessor.model.DomainFacade; - import net.sourceforge.bprocessor.model.EdgeFacade; - import net.sourceforge.bprocessor.model.ElementFacade; import net.sourceforge.bprocessor.model.FunctionalSpace; ! import net.sourceforge.bprocessor.model.FunctionalSpaceFacade; ! import net.sourceforge.bprocessor.model.PartFacade; ! import net.sourceforge.bprocessor.model.SurfaceFacade; ! import net.sourceforge.bprocessor.model.VertexFacade; import net.sourceforge.bprocessor.model.xml.impl.AttributeImpl; --- 7,13 ---- package net.sourceforge.bprocessor.model.xml; import net.sourceforge.bprocessor.model.ConstructionSpace; import net.sourceforge.bprocessor.model.FunctionalSpace; ! import net.sourceforge.bprocessor.model.Project; import net.sourceforge.bprocessor.model.xml.impl.AttributeImpl; *************** *** 135,139 **** new net.sourceforge.bprocessor.model.Attribute(a.getName(), a.getType(), a.getValue()); ! AttributeFacade.getInstance().create(am); mapper.put(new Long(a.getId()), am.getId()); --- 127,131 ---- new net.sourceforge.bprocessor.model.Attribute(a.getName(), a.getType(), a.getValue()); ! Project.getInstance().intern(am); mapper.put(new Long(a.getId()), am.getId()); *************** *** 154,158 **** ConstructionSpace csm = new ConstructionSpace(cs.getName()); ! ConstructionSpaceFacade.getInstance().create(csm); mapper.put(new Long(cs.getId()), csm.getId()); --- 146,150 ---- ConstructionSpace csm = new ConstructionSpace(cs.getName()); ! Project.getInstance().intern(csm); mapper.put(new Long(cs.getId()), csm.getId()); *************** *** 171,175 **** FunctionalSpace fsm = new FunctionalSpace(fs.getName()); ! FunctionalSpaceFacade.getInstance().create(fsm); mapper.put(new Long(fs.getId()), fsm.getId()); --- 163,167 ---- FunctionalSpace fsm = new FunctionalSpace(fs.getName()); ! Project.getInstance().intern(fsm); mapper.put(new Long(fs.getId()), fsm.getId()); *************** *** 190,194 **** new net.sourceforge.bprocessor.model.Element(e.getName()); ! ElementFacade.getInstance().create(em); mapper.put(new Long(e.getId()), em.getId()); --- 182,186 ---- new net.sourceforge.bprocessor.model.Element(e.getName()); ! Project.getInstance().intern(em); mapper.put(new Long(e.getId()), em.getId()); *************** *** 209,213 **** new net.sourceforge.bprocessor.model.Part(p.getName()); ! PartFacade.getInstance().create(pm); mapper.put(new Long(p.getId()), pm.getId()); --- 201,205 ---- new net.sourceforge.bprocessor.model.Part(p.getName()); ! Project.getInstance().intern(pm); mapper.put(new Long(p.getId()), pm.getId()); *************** *** 232,236 **** sm.setIsInner(s.isIsinner()); ! SurfaceFacade.getInstance().create(sm); mapper.put(new Long(s.getId()), sm.getId()); --- 224,228 ---- sm.setIsInner(s.isIsinner()); ! Project.getInstance().intern(sm); mapper.put(new Long(s.getId()), sm.getId()); *************** *** 251,255 **** new net.sourceforge.bprocessor.model.Edge(e.getName()); ! EdgeFacade.getInstance().create(em); mapper.put(new Long(e.getId()), em.getId()); --- 243,247 ---- new net.sourceforge.bprocessor.model.Edge(e.getName()); ! Project.getInstance().intern(em); mapper.put(new Long(e.getId()), em.getId()); *************** *** 275,279 **** vm.setW(v.getW()); ! VertexFacade.getInstance().create(vm); mapper.put(new Long(v.getId()), vm.getId()); --- 267,271 ---- vm.setW(v.getW()); ! Project.getInstance().intern(vm); mapper.put(new Long(v.getId()), vm.getId()); *************** *** 293,297 **** Long id = (Long)mapper.get(new Long(cs.getId())); ConstructionSpace csm = ! ConstructionSpaceFacade.getInstance().findById(id); List as = cs.getAttributeref(); --- 285,289 ---- Long id = (Long)mapper.get(new Long(cs.getId())); ConstructionSpace csm = ! Project.getInstance().findConstructionSpaceById(id); List as = cs.getAttributeref(); *************** *** 314,318 **** Long sid = (Long)mapper.get((Long)iss.next()); net.sourceforge.bprocessor.model.Surface s = ! SurfaceFacade.getInstance().findById(sid); sr.add(s); } --- 306,310 ---- Long sid = (Long)mapper.get((Long)iss.next()); net.sourceforge.bprocessor.model.Surface s = ! Project.getInstance().findSurfaceById(sid); sr.add(s); } *************** *** 326,335 **** Long eid = (Long)mapper.get((Long)ies.next()); net.sourceforge.bprocessor.model.Element e = ! ElementFacade.getInstance().findById(eid); er.add(e); } csm.setElements(er); } ! ConstructionSpaceFacade.getInstance().update(csm); } } --- 318,327 ---- Long eid = (Long)mapper.get((Long)ies.next()); net.sourceforge.bprocessor.model.Element e = ! Project.getInstance().findElementById(eid); er.add(e); } csm.setElements(er); } ! Project.getInstance().update(csm); } } *************** *** 347,351 **** Long id = (Long)mapper.get(new Long(fs.getId())); FunctionalSpace fsm = ! FunctionalSpaceFacade.getInstance().findById(id); List as = fs.getAttributeref(); --- 339,343 ---- Long id = (Long)mapper.get(new Long(fs.getId())); FunctionalSpace fsm = ! Project.getInstance().findFunctionalSpaceById(id); List as = fs.getAttributeref(); *************** *** 368,372 **** Long sid = (Long)mapper.get((Long)iss.next()); net.sourceforge.bprocessor.model.Surface s = ! SurfaceFacade.getInstance().findById(sid); sr.add(s); } --- 360,364 ---- Long sid = (Long)mapper.get((Long)iss.next()); net.sourceforge.bprocessor.model.Surface s = ! Project.getInstance().findSurfaceById(sid); sr.add(s); } *************** *** 380,389 **** Long eid = (Long)mapper.get((Long)ies.next()); net.sourceforge.bprocessor.model.Element e = ! ElementFacade.getInstance().findById(eid); er.add(e); } fsm.setElements(er); } ! FunctionalSpaceFacade.getInstance().update(fsm); } } --- 372,381 ---- Long eid = (Long)mapper.get((Long)ies.next()); net.sourceforge.bprocessor.model.Element e = ! Project.getInstance().findElementById(eid); er.add(e); } fsm.setElements(er); } ! Project.getInstance().update(fsm); } } *************** *** 402,406 **** Long id = (Long)mapper.get(new Long(e.getId())); net.sourceforge.bprocessor.model.Element em = ! ElementFacade.getInstance().findById(id); List as = e.getAttributeref(); --- 394,398 ---- Long id = (Long)mapper.get(new Long(e.getId())); net.sourceforge.bprocessor.model.Element em = ! Project.getInstance().findElementById(id); List as = e.getAttributeref(); *************** *** 423,427 **** Long sid = (Long)mapper.get((Long)iss.next()); net.sourceforge.bprocessor.model.Surface s = ! SurfaceFacade.getInstance().findById(sid); sr.add(s); } --- 415,419 ---- Long sid = (Long)mapper.get((Long)iss.next()); net.sourceforge.bprocessor.model.Surface s = ! Project.getInstance().findSurfaceById(sid); sr.add(s); } *************** *** 435,444 **** Long pid = (Long)mapper.get((Long)ips.next()); net.sourceforge.bprocessor.model.Part p = ! PartFacade.getInstance().findById(pid); pr.add(p); } em.setParts(pr); } ! ElementFacade.getInstance().update(em); } } --- 427,436 ---- Long pid = (Long)mapper.get((Long)ips.next()); net.sourceforge.bprocessor.model.Part p = ! Project.getInstance().findPartById(pid); pr.add(p); } em.setParts(pr); } ! Project.getInstance().update(em); } } *************** *** 457,461 **** Long id = (Long)mapper.get(new Long(p.getId())); net.sourceforge.bprocessor.model.Part pm = ! PartFacade.getInstance().findById(id); List as = p.getAttributeref(); --- 449,453 ---- Long id = (Long)mapper.get(new Long(p.getId())); net.sourceforge.bprocessor.model.Part pm = ! Project.getInstance().findPartById(id); List as = p.getAttributeref(); *************** *** 478,487 **** Long sid = (Long)mapper.get((Long)iss.next()); net.sourceforge.bprocessor.model.Surface s = ! SurfaceFacade.getInstance().findById(sid); sr.add(s); } pm.setSurfaces(sr); } ! PartFacade.getInstance().update(pm); } } --- 470,479 ---- Long sid = (Long)mapper.get((Long)iss.next()); net.sourceforge.bprocessor.model.Surface s = ! Project.getInstance().findSurfaceById(sid); sr.add(s); } pm.setSurfaces(sr); } ! Project.getInstance().update(pm); } } *************** *** 500,504 **** Long id = (Long)mapper.get(new Long(s.getId())); net.sourceforge.bprocessor.model.Surface sm = ! SurfaceFacade.getInstance().findById(id); List es = s.getEdgeref(); --- 492,496 ---- Long id = (Long)mapper.get(new Long(s.getId())); net.sourceforge.bprocessor.model.Surface sm = ! Project.getInstance().findSurfaceById(id); List es = s.getEdgeref(); *************** *** 509,513 **** Long eid = (Long)mapper.get((Long)ies.next()); net.sourceforge.bprocessor.model.Edge e = ! EdgeFacade.getInstance().findById(eid); er.add(e); } --- 501,505 ---- Long eid = (Long)mapper.get((Long)ies.next()); net.sourceforge.bprocessor.model.Edge e = ! Project.getInstance().findEdgeById(eid); er.add(e); } *************** *** 522,526 **** Long isid = (Long)mapper.get((Long)iiss.next()); net.sourceforge.bprocessor.model.Surface is = ! SurfaceFacade.getInstance().findById(isid); isr.add(is); } --- 514,518 ---- Long isid = (Long)mapper.get((Long)iiss.next()); net.sourceforge.bprocessor.model.Surface is = ! Project.getInstance().findSurfaceById(isid); isr.add(is); } *************** *** 529,539 **** Long bid = (Long)(mapper.get(new Long(s.getBackdomainref()))); if (bid != null) { ! sm.setBackDomain(DomainFacade.getInstance().findById(bid)); } Long fid = (Long)(mapper.get(new Long(s.getFrontdomainref()))); if (fid != null) { ! sm.setFrontDomain(DomainFacade.getInstance().findById(fid)); } ! SurfaceFacade.getInstance().update(sm); } } --- 521,531 ---- Long bid = (Long)(mapper.get(new Long(s.getBackdomainref()))); if (bid != null) { ! sm.setBackDomain(Project.getInstance().findDomainById(bid)); } Long fid = (Long)(mapper.get(new Long(s.getFrontdomainref()))); if (fid != null) { ! sm.setFrontDomain(Project.getInstance().findDomainById(fid)); } ! Project.getInstance().update(sm); } } *************** *** 552,567 **** Long id = (Long)mapper.get(new Long(e.getId())); net.sourceforge.bprocessor.model.Edge em = ! EdgeFacade.getInstance().findById(id); Long vid = (Long)mapper.get(new Long(e.getVertexfromref())); net.sourceforge.bprocessor.model.Vertex v = ! VertexFacade.getInstance().findById(vid); em.setFrom(v); vid = (Long)mapper.get(new Long(e.getVertextoref())); ! v = VertexFacade.getInstance().findById(vid); em.setTo(v); ! EdgeFacade.getInstance().update(em); } } --- 544,559 ---- Long id = (Long)mapper.get(new Long(e.getId())); net.sourceforge.bprocessor.model.Edge em = ! Project.getInstance().findEdgeById(id); Long vid = (Long)mapper.get(new Long(e.getVertexfromref())); net.sourceforge.bprocessor.model.Vertex v = ! Project.getInstance().findVertexById(vid); em.setFrom(v); vid = (Long)mapper.get(new Long(e.getVertextoref())); ! v = Project.getInstance().findVertexById(vid); em.setTo(v); ! Project.getInstance().update(em); } } *************** *** 580,584 **** Long id = (Long)mapper.get(new Long(v.getId())); net.sourceforge.bprocessor.model.Vertex vm = ! VertexFacade.getInstance().findById(id); } } --- 572,576 ---- Long id = (Long)mapper.get(new Long(v.getId())); net.sourceforge.bprocessor.model.Vertex vm = ! Project.getInstance().findVertexById(id); } } *************** *** 614,642 **** mapper.put(KEY_DOMAIN, new HashMap()); ! ConstructionSpaceFacade csf = ConstructionSpaceFacade.getInstance(); ! EdgeFacade edf = EdgeFacade.getInstance(); ! ElementFacade ef = ElementFacade.getInstance(); ! FunctionalSpaceFacade fsf = FunctionalSpaceFacade.getInstance(); ! PartFacade pf = PartFacade.getInstance(); ! SurfaceFacade sf = SurfaceFacade.getInstance(); ! VertexFacade vf = VertexFacade.getInstance(); // Save all objects ! saveConstructionSpace(bp, csf.findAll()); ! saveEdge(bp, edf.findAll()); ! saveElement(bp, ef.findAll()); ! saveFunctionalSpace(bp, fsf.findAll()); ! savePart(bp, pf.findAll()); ! saveSurface(bp, sf.findAll()); ! saveVertex(bp, vf.findAll()); // Save all references ! saveRefConstructionSpace(bp, csf.findAll()); ! saveRefEdge(bp, edf.findAll()); ! saveRefElement(bp, ef.findAll()); ! saveRefFunctionalSpace(bp, fsf.findAll()); ! saveRefPart(bp, pf.findAll()); ! saveRefSurface(bp, sf.findAll()); ! saveRefVertex(bp, vf.findAll()); saveFile(bp, fos); --- 606,629 ---- mapper.put(KEY_DOMAIN, new HashMap()); ! Project project = Project.getInstance(); // Save all objects ! saveConstructionSpace(bp, project.getConstructionSpaces()); ! saveEdge(bp, project.getEdges()); ! saveElement(bp, project.getElements()); ! saveFunctionalSpace(bp, project.getFunctionalSpaces()); ! savePart(bp, project.getParts()); ! saveSurface(bp, project.getSurfaces()); ! saveVertex(bp, project.getVertices()); // Save all references ! ! saveRefConstructionSpace(bp, project.getConstructionSpaces()); ! saveRefEdge(bp, project.getEdges()); ! saveRefElement(bp, project.getElements()); ! saveRefFunctionalSpace(bp, project.getFunctionalSpaces()); ! saveRefPart(bp, project.getParts()); ! saveRefSurface(bp, project.getSurfaces()); ! saveRefVertex(bp, project.getVertices()); saveFile(bp, fos); |
From: Michael L. <he...@us...> - 2005-10-02 21:11:58
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4745/src/net/sourceforge/bprocessor/gl Modified Files: GLView.java Log Message: All access to database now through the Project instance Index: GLView.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/GLView.java,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** GLView.java 30 Sep 2005 17:52:06 -0000 1.16 --- GLView.java 2 Oct 2005 14:48:23 -0000 1.17 *************** *** 11,16 **** import net.sourceforge.bprocessor.gl.view.View; import net.sourceforge.bprocessor.gl.view.ViewFactory; - import net.sourceforge.bprocessor.model.EdgeFacade; import net.sourceforge.bprocessor.model.Edge; import net.sourceforge.bprocessor.kernel.notification.NotificationListener; import net.sourceforge.bprocessor.kernel.notification.Notification; --- 11,16 ---- import net.sourceforge.bprocessor.gl.view.View; import net.sourceforge.bprocessor.gl.view.ViewFactory; import net.sourceforge.bprocessor.model.Edge; + import net.sourceforge.bprocessor.model.Project; import net.sourceforge.bprocessor.kernel.notification.NotificationListener; import net.sourceforge.bprocessor.kernel.notification.Notification; *************** *** 227,231 **** public void handleNotification(Notification n) { if (n.getType().equals(Notification.EDGE_SELECTED)) { ! Edge e = (Edge)(EdgeFacade.getInstance().findById(n.getObject())); setText(e.getLength()); } else if (n.getType().equals(Notification.EDGE_DESELECTED)) { --- 227,231 ---- public void handleNotification(Notification n) { if (n.getType().equals(Notification.EDGE_SELECTED)) { ! Edge e = (Project.getInstance().findEdgeById(n.getObject())); setText(e.getLength()); } else if (n.getType().equals(Notification.EDGE_DESELECTED)) { |
From: Michael L. <he...@us...> - 2005-10-02 21:06:34
|
Update of /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2573/src/net/sourceforge/bprocessor/model Modified Files: Project.java Log Message: All access to database now through the Project instance Index: Project.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Project.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** Project.java 21 Sep 2005 07:29:30 -0000 1.1 --- Project.java 2 Oct 2005 14:36:30 -0000 1.2 *************** *** 9,17 **** import java.util.HashSet; import java.util.Set; - import org.apache.log4j.Logger; - /** * The Project --- 9,16 ---- import java.util.HashSet; + import java.util.Iterator; import java.util.Set; import org.apache.log4j.Logger; /** * The Project *************** *** 27,55 **** /** The instance */ private static Project instance; /** ! * Create a vertex ! * @param v The Vertex */ ! void create(Vertex v) { } /** * Update a vertex * @param v The vertex */ ! public synchronized void update(Vertex v) { } /** * Remove a vertex * @param v The vertex */ ! public synchronized void remove(Vertex v) { } /** * Find all vertexs * @return The vertexs */ ! public Set findAll() { ! Set result = new HashSet(); ! return result; } /** * Find a vertex by id --- 26,387 ---- /** The instance */ private static Project instance; + /** ! * Get the instance ! * @return The instance */ ! public static synchronized Project getInstance() { ! if (instance == null) { ! instance = new Project(); ! } ! return instance; ! } ! ! /** ! * Intern an attribute ! * @param a The attribute ! */ ! public void intern(Attribute a) { ! AttributeFacade.getInstance().create(a); ! } ! ! /** ! * Update an attribute ! * @param a The attribute ! */ ! public void update(Attribute a) { ! AttributeFacade.getInstance().update(a); ! } ! ! /** ! * Remove an attribute ! * @param a The attribute ! */ ! public void remove(Attribute a) { ! AttributeFacade.getInstance().remove(a); ! } ! ! /** ! * Find a attribute by id ! * @param id The id ! * @return The attribute ! */ ! public Attribute findAttributeById(Long id) { ! return AttributeFacade.getInstance().findById(id); ! } ! ! /** ! * Create a construction space ! * @param c The construction space ! */ ! public void intern(ConstructionSpace c) { ! ConstructionSpaceFacade.getInstance().create(c); ! } ! ! /** ! * Update a construction space ! * @param c The construction space ! */ ! public void update(ConstructionSpace c) { ! ConstructionSpaceFacade.getInstance().update(c); ! } ! ! /** ! * Remove a construction space ! * @param c The construction space ! */ ! public void remove(ConstructionSpace c) { ! ConstructionSpaceFacade.getInstance().remove(c); ! } ! ! /** ! * Find all construction spaces ! * @return The construction spaces ! */ ! public Set getConstructionSpaces() { ! return ConstructionSpaceFacade.getInstance().findAll(); ! } ! ! /** ! * Find a construction space by id ! * @param id The id ! * @return The construction space ! */ ! public ConstructionSpace findConstructionSpaceById(Long id) { ! return ConstructionSpaceFacade.getInstance().findById(id); ! } ! ! /** ! * Update the Domain ! * @param domain The domain to update ! */ ! public void update(Domain domain) { ! if (domain instanceof ConstructionSpace) { ! ConstructionSpaceFacade.getInstance().update((ConstructionSpace)domain); ! } else if (domain instanceof FunctionalSpace) { ! FunctionalSpaceFacade.getInstance().update((FunctionalSpace)domain); ! } else if (domain instanceof Element) { ! ElementFacade.getInstance().update((Element)domain); ! } else if (domain instanceof Part) { ! PartFacade.getInstance().update((Part)domain); ! } else { ! log.error("Unsupported type: " + domain.getClass().getName()); ! } ! } ! ! /** ! * Find all domains ! * @return the set of all domains ! */ ! public Set getDomains() { ! return DomainFacade.getInstance().findAll(); ! } ! ! /** ! * Find a domain by id ! * @param id The id ! * @return The domain ! */ ! public Domain findDomainById(Long id) { ! return DomainFacade.getInstance().findById(id); ! } ! ! /** ! * Intern an edge ! * @param e The edge ! */ ! public void intern(Edge e) { ! EdgeFacade.getInstance().create(e); ! } ! ! /** ! * Update an edge ! * @param e The edge ! */ ! public void update(Edge e) { ! EdgeFacade.getInstance().update(e); ! } ! ! /** ! * Remove an edge ! * @param e The edge ! */ ! public void remove(Edge e) { ! EdgeFacade.getInstance().remove(e); ! } ! ! /** ! * Find all edges ! * @return The edges ! */ ! public Set getEdges() { ! return EdgeFacade.getInstance().findAll(); ! } ! ! /** ! * Find an edge by id ! * @param id The id ! * @return The edge ! */ ! public Edge findEdgeById(Long id) { ! return EdgeFacade.getInstance().findById(id); ! } ! ! /** ! * Intern an element ! * @param e The element ! */ ! public void intern(Element e) { ! ElementFacade.getInstance().create(e); ! } ! ! /** ! * Update an element ! * @param e The element ! */ ! public void update(Element e) { ! ElementFacade.getInstance().update(e); ! } ! ! /** ! * Remove an element ! * @param e The element ! */ ! public void remove(Element e) { ! ElementFacade.getInstance().remove(e); ! } ! ! /** ! * Find all elements ! * @return The elements ! */ ! public Set getElements() { ! return ElementFacade.getInstance().findAll(); ! } ! ! /** ! * Find a element by id ! * @param id The id ! * @return The element ! */ ! public Element findElementById(Long id) { ! return ElementFacade.getInstance().findById(id); ! } ! ! /** ! * Intern a functional space ! * @param f The functional space ! */ ! public void intern(FunctionalSpace f) { ! FunctionalSpaceFacade.getInstance().create(f); ! } ! ! /** ! * Update a functional space ! * @param f The functional space ! */ ! public void update(FunctionalSpace f) { ! FunctionalSpaceFacade.getInstance().update(f); ! } ! ! /** ! * Remove a functional space ! * @param f The functional space ! */ ! public void remove(FunctionalSpace f) { ! FunctionalSpaceFacade.getInstance().remove(f); ! } ! ! /** ! * Find all functional spaces ! * @return The functional spaces ! */ ! public Set getFunctionalSpaces() { ! return FunctionalSpaceFacade.getInstance().findAll(); ! } ! ! /** ! * Find a functional space by id ! * @param id The id ! * @return The functional space ! */ ! public FunctionalSpace findFunctionalSpaceById(Long id) { ! return FunctionalSpaceFacade.getInstance().findById(id); ! } ! ! /** ! * Intern a part ! * @param p The part ! */ ! public void intern(Part p) { ! PartFacade.getInstance().create(p); ! } ! ! /** ! * Update a part ! * @param p The part ! */ ! public void update(Part p) { ! PartFacade.getInstance().update(p); ! } ! ! /** ! * Remove a part ! * @param p The part ! */ ! public void remove(Part p) { ! PartFacade.getInstance().remove(p); ! } ! ! /** ! * Find all parts ! * @return The parts ! */ ! public Set getParts() { ! return PartFacade.getInstance().findAll(); ! } ! ! /** ! * Find a part by id ! * @param id The id ! * @return The part ! */ ! public Part findPartById(Long id) { ! return PartFacade.getInstance().findById(id); ! } ! ! /** ! * Intern a surface ! * @param s The surface ! */ ! public void intern(Surface s) { ! SurfaceFacade.getInstance().create(s); ! } ! ! /** ! * Update a surface ! * @param s The surface ! */ ! public void update(Surface s) { ! SurfaceFacade.getInstance().update(s); ! } ! ! /** ! * Remove a surface ! * @param s The surface ! */ ! public void remove(Surface s) { ! SurfaceFacade.getInstance().remove(s); ! } ! ! /** ! * Find all surfaces ! * @return The surfaces ! */ ! public Set getSurfaces() { ! return SurfaceFacade.getInstance().findAll(); ! } ! ! /** ! * Find a surface by id ! * @param id The id ! * @return The surface ! */ ! public Surface findSurfaceById(Long id) { ! return SurfaceFacade.getInstance().findById(id); ! } ! ! /** ! * Intern a vertex ! * @param v The vertex ! */ ! public void intern(Vertex v) { ! VertexFacade.getInstance().create(v); ! } ! /** * Update a vertex * @param v The vertex */ ! public void update(Vertex v) { ! VertexFacade.getInstance().update(v); } + /** * Remove a vertex * @param v The vertex */ ! public void remove(Vertex v) { ! VertexFacade.getInstance().remove(v); } + /** * Find all vertexs * @return The vertexs */ ! public Set getVertices() { ! return VertexFacade.getInstance().findAll(); } + /** * Find a vertex by id *************** *** 57,73 **** * @return The vertex */ ! public synchronized Vertex findById(Long id) { ! Vertex result = null; ! return result; ! } ! /** ! * Find a vertex by name ! * @param name The name ! * @return The vertex ! */ ! public Vertex findByName(String name) { ! Vertex result = null; ! return result; } /** * Find vertex based upon location and delta --- 389,396 ---- * @return The vertex */ ! public Vertex findVertexById(Long id) { ! return VertexFacade.getInstance().findById(id); } + /** * Find vertex based upon location and delta *************** *** 80,83 **** --- 403,417 ---- public Set findByLocation(double x, double y, double z, double delta) { Set result = new HashSet(); + Set vertices = getVertices(); + Iterator iter = vertices.iterator(); + double limit = delta; + Vertex tester = new Vertex("", x, y, z); + while (iter.hasNext()) { + Vertex current = (Vertex) iter.next(); + double distance = current.distance(tester); + if (distance <= limit) { + result.add(current); + } + } return result; } |
From: Nordholt <nor...@us...> - 2005-10-02 20:39:23
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21409 Modified Files: AbstractView.java Log Message: added support for clicking the domain labels and did some clean up Index: AbstractView.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view/AbstractView.java,v retrieving revision 1.38 retrieving revision 1.39 diff -C2 -d -r1.38 -r1.39 *** AbstractView.java 29 Sep 2005 15:05:02 -0000 1.38 --- AbstractView.java 30 Sep 2005 17:56:16 -0000 1.39 *************** *** 14,22 **** import net.sourceforge.bprocessor.model.Edge; import net.sourceforge.bprocessor.model.EdgeFacade; ! import net.sourceforge.bprocessor.model.Space; import net.sourceforge.bprocessor.model.Vertex; import net.sourceforge.bprocessor.model.VertexFacade; import net.sourceforge.bprocessor.model.Surface; import net.sourceforge.bprocessor.model.SurfaceFacade; import java.util.ArrayList; --- 14,23 ---- import net.sourceforge.bprocessor.model.Edge; import net.sourceforge.bprocessor.model.EdgeFacade; ! import net.sourceforge.bprocessor.model.Domain; import net.sourceforge.bprocessor.model.Vertex; import net.sourceforge.bprocessor.model.VertexFacade; import net.sourceforge.bprocessor.model.Surface; import net.sourceforge.bprocessor.model.SurfaceFacade; + import net.sourceforge.bprocessor.model.FunctionalSpace; import java.util.ArrayList; *************** *** 262,283 **** if (glv.getTool() instanceof SelectTool) { - //gl.glDisable(GL.GL_DEPTH_TEST); - //gl.glDisable(GL.GL_LIGHTING); decorateSelection(); } if (glv.getTool() instanceof SelectTool) { gl.glMatrixMode(GL.GL_PROJECTION); gl.glLoadIdentity(); glu.gluOrtho2D(0, width, 0, height); gl.glMatrixMode(GL.GL_MODELVIEW); ! gl.glLoadIdentity(); ! labelSelection(); } ! //drawTextBox(200, 200, "Space 1"); ! ! ! gl.glGetIntegerv(GL.GL_RENDER_MODE, mode); ! if (mode[0] == GL.GL_SELECT) { gl.glFlush(); --- 263,284 ---- if (glv.getTool() instanceof SelectTool) { decorateSelection(); } + gl.glGetIntegerv(GL.GL_RENDER_MODE, mode); + if (glv.getTool() instanceof SelectTool) { gl.glMatrixMode(GL.GL_PROJECTION); gl.glLoadIdentity(); + if (mode[0] == GL.GL_SELECT) { + int[] viewport = new int[] {0, 0, (int)width, (int)height}; + glu.gluPickMatrix(x, viewport[3] - y, 5, 5, viewport); + } glu.gluOrtho2D(0, width, 0, height); gl.glMatrixMode(GL.GL_MODELVIEW); ! gl.glLoadIdentity(); ! labelSelection(mode[0] == GL.GL_SELECT); } ! if (mode[0] == GL.GL_SELECT) { gl.glFlush(); *************** *** 388,413 **** * Put labels on a Surface * @param surface The Surface */ ! void labelSurface(Surface surface) { Vertex from = surface.center(); - // CoordinateSystem system = surface.coordinateSystem(); - // Vertex n = system.getN(); Vertex n = surface.normal(); n.scale(1 / n.length()); Vertex spot = from.add(n); Transformation transformation = transformation(); ! Space frontSpace = (Space) surface.getFrontDomain(); ! Space backSpace = (Space) surface.getBackDomain(); String frontName; String backName; ! if (frontSpace != null) { ! frontName = frontSpace.getName(); } else { frontName = "None"; } ! if (backSpace != null) { ! backName = backSpace.getName(); } else { backName = "None"; --- 389,413 ---- * Put labels on a Surface * @param surface The Surface + * @param clickable if true clicking the labels brings up dialog. */ ! void labelSurface(Surface surface, boolean clickable) { Vertex from = surface.center(); Vertex n = surface.normal(); n.scale(1 / n.length()); Vertex spot = from.add(n); Transformation transformation = transformation(); ! Domain frontDomain = surface.getFrontDomain(); ! Domain backDomain = surface.getBackDomain(); String frontName; String backName; ! if (frontDomain != null) { ! frontName = frontDomain.getName(); } else { frontName = "None"; } ! if (backDomain != null) { ! backName = backDomain.getName(); } else { backName = "None"; *************** *** 424,428 **** Vertex backTextAnchor; ! if (front.getX() > back.getX()) { frontAnchor = new Vertex("", front.getX() + 40, front.getY() + 10, front.getZ()); --- 424,429 ---- Vertex backTextAnchor; ! int backSign; ! int frontSign; if (front.getX() > back.getX()) { frontAnchor = new Vertex("", front.getX() + 40, front.getY() + 10, front.getZ()); *************** *** 430,441 **** backAnchor = new Vertex("", back.getX() - 40, back.getY() + 10, back.getZ()); backTextAnchor = new Vertex("", backAnchor.getX() - backWidth, ! backAnchor.getY(), backAnchor.getZ()); } else { frontAnchor = new Vertex("", front.getX() - 40, front.getY() + 10, front.getZ()); frontTextAnchor = new Vertex("", frontAnchor.getX() - frontWidth, ! frontAnchor.getY(), frontAnchor.getZ()); backAnchor = new Vertex("", back.getX() + 40, back.getY() + 10, back.getZ()); backTextAnchor = backAnchor; } gl.glLineWidth(1.0f); --- 431,447 ---- backAnchor = new Vertex("", back.getX() - 40, back.getY() + 10, back.getZ()); backTextAnchor = new Vertex("", backAnchor.getX() - backWidth, ! backAnchor.getY(), backAnchor.getZ()); ! frontSign = 1; ! backSign = -1; } else { frontAnchor = new Vertex("", front.getX() - 40, front.getY() + 10, front.getZ()); frontTextAnchor = new Vertex("", frontAnchor.getX() - frontWidth, ! frontAnchor.getY(), frontAnchor.getZ()); backAnchor = new Vertex("", back.getX() + 40, back.getY() + 10, back.getZ()); backTextAnchor = backAnchor; + frontSign = -1; + backSign = 1; } + gl.glLineWidth(1.0f); *************** *** 446,450 **** gl.glEnd(); gl.glColor3d(0.2, 0.2, 0.2); ! drawString(frontTextAnchor.getX(), frontTextAnchor.getY(), frontName); gl.glColor3d(0.4, 0.4, 0.4); gl.glBegin(GL.GL_LINES); --- 452,473 ---- gl.glEnd(); gl.glColor3d(0.2, 0.2, 0.2); ! if (clickable) { ! pushName(gl, "front"); ! gl.glBegin(GL.GL_POLYGON); ! gl.glVertex3d(frontAnchor.getX(), frontAnchor.getY(), frontAnchor.getZ()); ! gl.glVertex3d(frontAnchor.getX() + (frontSign * frontWidth), ! frontAnchor.getY(), ! frontAnchor.getZ()); ! gl.glVertex3d(frontAnchor.getX() + (frontSign * frontWidth), ! frontAnchor.getY() + 18, ! frontAnchor.getZ()); ! gl.glVertex3d(frontAnchor.getX(), ! frontAnchor.getY() + 18, ! frontAnchor.getZ()); ! gl.glEnd(); ! popName(gl); ! } else { ! drawString(frontTextAnchor.getX(), frontTextAnchor.getY(), frontName); ! } gl.glColor3d(0.4, 0.4, 0.4); gl.glBegin(GL.GL_LINES); *************** *** 453,463 **** gl.glEnd(); gl.glColor3d(0.2, 0.2, 0.2); ! drawString(backTextAnchor.getX(), backTextAnchor.getY(), backName); } /** * Put labels on the selection */ ! void labelSelection() { Collection selection = glv.getTool().getSelection(); if (selection.size() == 1) { --- 476,506 ---- gl.glEnd(); gl.glColor3d(0.2, 0.2, 0.2); ! if (clickable) { ! pushName(gl, "back"); ! gl.glBegin(GL.GL_POLYGON); ! gl.glVertex3d(backAnchor.getX(), ! backAnchor.getY(), ! backAnchor.getZ()); ! gl.glVertex3d(backAnchor.getX() + (backSign * backWidth), ! backAnchor.getY(), ! backAnchor.getZ()); ! gl.glVertex3d(backAnchor.getX() + (backSign * backWidth), ! backAnchor.getY() + 18, ! backAnchor.getZ()); ! gl.glVertex3d(backAnchor.getX(), ! backAnchor.getY(), ! backAnchor.getZ()); ! gl.glEnd(); ! popName(gl); ! } else { ! drawString(backTextAnchor.getX(), backTextAnchor.getY(), backName); ! } } /** * Put labels on the selection + * @param clickable if true clicking the labels brings up dialog. */ ! void labelSelection(boolean clickable) { Collection selection = glv.getTool().getSelection(); if (selection.size() == 1) { *************** *** 466,470 **** Object current = iter.next(); if (current instanceof Surface) { ! labelSurface((Surface) current); } } --- 509,513 ---- Object current = iter.next(); if (current instanceof Surface) { ! labelSurface((Surface) current, clickable); } } *************** *** 639,642 **** --- 682,691 ---- */ private void drawSurface(Surface s) { + if (s.getIsInner() && + s.getBackDomain() instanceof FunctionalSpace && + s.getFrontDomain() instanceof FunctionalSpace) { + gl.glEnable(GL.GL_POLYGON_STIPPLE); + gl.glPolygonStipple(transparency); + } GLUtesselator tess = glu.gluNewTess(); GLUtesselatorCallback cb = new Callback(); *************** *** 646,650 **** glu.gluTessCallback(tess, GLU.GLU_TESS_END, cb); glu.gluTessCallback(tess, GLU.GLU_TESS_VERTEX, cb); ! //Contours contained in an even number of contours are filled glu.gluTessProperty(tess, GLU.GLU_TESS_WINDING_RULE, GLU.GLU_TESS_WINDING_ODD); --- 695,699 ---- glu.gluTessCallback(tess, GLU.GLU_TESS_END, cb); glu.gluTessCallback(tess, GLU.GLU_TESS_VERTEX, cb); ! //Contours contained in an even number of contours are filled glu.gluTessProperty(tess, GLU.GLU_TESS_WINDING_RULE, GLU.GLU_TESS_WINDING_ODD); *************** *** 675,678 **** --- 724,728 ---- glu.gluTessEndPolygon(tess); glu.gluDeleteTess(tess); + gl.glDisable(GL.GL_POLYGON_STIPPLE); } *************** *** 926,932 **** /** * Processes the select buffer ! * @return the ID of the closest hit */ ! private Long processSelect() { //Processing hits int bufferOffset = 0; --- 976,982 ---- /** * Processes the select buffer ! * @return the ID of the closest hit and -1 of no hit. */ ! private int processSelect() { //Processing hits int bufferOffset = 0; *************** *** 934,939 **** long zMax = 0xFFFFFFFFL; double nearest = 1.0; ! Long id = null; ! Integer intId; for (int i = 0; i < hits; i++) { names = selectBuffer.get(bufferOffset); --- 984,988 ---- long zMax = 0xFFFFFFFFL; double nearest = 1.0; ! int id = -1; for (int i = 0; i < hits; i++) { names = selectBuffer.get(bufferOffset); *************** *** 948,953 **** if (near < nearest) { nearest = near; ! id = new Long((new Integer(selectBuffer.get(bufferOffset))).longValue()); ! } bufferOffset += names; --- 997,1001 ---- if (near < nearest) { nearest = near; ! id = selectBuffer.get(bufferOffset); } bufferOffset += names; *************** *** 957,965 **** } ! if (id != null) { ! return id; ! } else { ! return null; ! } } --- 1005,1009 ---- } ! return id; } *************** *** 968,979 **** * @param x the x coordinate of the point in mouse coordinates * @param y the y coordinate of the point in mouse coordinates ! * @return a Long id of the object under the point, null if no object is there */ public Object getObjectAtPoint(double x, double y) { ! Long id = null; this.x = x; this.y = y; ! // indicating that I am trying to pick(used in camera) picking = 10; selectMode = ALL; --- 1012,1023 ---- * @param x the x coordinate of the point in mouse coordinates * @param y the y coordinate of the point in mouse coordinates ! * @return The object under the point, null if no object is there */ public Object getObjectAtPoint(double x, double y) { ! int id; this.x = x; this.y = y; ! // indicating that I am trying to pick picking = 10; selectMode = ALL; *************** *** 981,986 **** glv.repaint(true); id = processSelect(); ! if (id != null) { ! Object o = getName(id.intValue()); clearNames(); return o; --- 1025,1030 ---- glv.repaint(true); id = processSelect(); ! if (id != -1) { ! Object o = getName(id); clearNames(); return o; *************** *** 988,994 **** clearNames(); return null; ! } ! ! } --- 1032,1036 ---- clearNames(); return null; ! } } |
From: Michael L. <he...@us...> - 2005-10-02 19:55:02
|
Update of /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui/treeview In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2655/src/net/sourceforge/bprocessor/gui/treeview Modified Files: SurfacesTreeView.java SpacesTreeView.java Log Message: All access to database now through the Project instance Index: SurfacesTreeView.java =================================================================== RCS file: /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui/treeview/SurfacesTreeView.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** SurfacesTreeView.java 22 Sep 2005 12:25:31 -0000 1.6 --- SurfacesTreeView.java 2 Oct 2005 14:37:10 -0000 1.7 *************** *** 10,15 **** import net.sourceforge.bprocessor.kernel.notification.NotificationListener; import net.sourceforge.bprocessor.kernel.notification.Notifier; import net.sourceforge.bprocessor.model.Surface; - import net.sourceforge.bprocessor.model.SurfaceFacade; import java.awt.event.MouseEvent; --- 10,15 ---- import net.sourceforge.bprocessor.kernel.notification.NotificationListener; import net.sourceforge.bprocessor.kernel.notification.Notifier; + import net.sourceforge.bprocessor.model.Project; import net.sourceforge.bprocessor.model.Surface; import java.awt.event.MouseEvent; *************** *** 60,64 **** if (type.equals(Notification.SURFACE_CREATED)) { ! Surface s = SurfaceFacade.getInstance().findById(n.getObject()); RootNode rn = (RootNode)getModel().getRoot(); SurfaceNode sn = new SurfaceNode(n.getObject(), s.getName(), rn); --- 60,64 ---- if (type.equals(Notification.SURFACE_CREATED)) { ! Surface s = Project.getInstance().findSurfaceById(n.getObject()); RootNode rn = (RootNode)getModel().getRoot(); SurfaceNode sn = new SurfaceNode(n.getObject(), s.getName(), rn); Index: SpacesTreeView.java =================================================================== RCS file: /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui/treeview/SpacesTreeView.java,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** SpacesTreeView.java 30 Sep 2005 07:59:59 -0000 1.7 --- SpacesTreeView.java 2 Oct 2005 14:37:10 -0000 1.8 *************** *** 11,19 **** import net.sourceforge.bprocessor.kernel.notification.Notifier; import net.sourceforge.bprocessor.model.ConstructionSpace; - import net.sourceforge.bprocessor.model.ConstructionSpaceFacade; import net.sourceforge.bprocessor.model.Element; import net.sourceforge.bprocessor.model.FunctionalSpace; - import net.sourceforge.bprocessor.model.FunctionalSpaceFacade; import net.sourceforge.bprocessor.model.Part; import net.sourceforge.bprocessor.model.Space; import net.sourceforge.bprocessor.model.Surface; --- 11,18 ---- import net.sourceforge.bprocessor.kernel.notification.Notifier; import net.sourceforge.bprocessor.model.ConstructionSpace; import net.sourceforge.bprocessor.model.Element; import net.sourceforge.bprocessor.model.FunctionalSpace; import net.sourceforge.bprocessor.model.Part; + import net.sourceforge.bprocessor.model.Project; import net.sourceforge.bprocessor.model.Space; import net.sourceforge.bprocessor.model.Surface; *************** *** 72,77 **** if (type.equals(Notification.FUNCTIONAL_SPACE_CREATED)) { ! FunctionalSpaceFacade fsf = FunctionalSpaceFacade.getInstance(); ! FunctionalSpace fs = fsf.findById(n.getObject()); RootNode rn = (RootNode)getModel().getRoot(); --- 71,75 ---- if (type.equals(Notification.FUNCTIONAL_SPACE_CREATED)) { ! FunctionalSpace fs = Project.getInstance().findFunctionalSpaceById(n.getObject()); RootNode rn = (RootNode)getModel().getRoot(); *************** *** 87,95 **** if (type.equals(Notification.FUNCTIONAL_SPACE_MODIFIED)) { ! FunctionalSpaceFacade fsf = FunctionalSpaceFacade.getInstance(); ! space = fsf.findById(n.getObject()); } else { ! ConstructionSpaceFacade csf = ConstructionSpaceFacade.getInstance(); ! space = csf.findById(n.getObject()); } --- 85,91 ---- if (type.equals(Notification.FUNCTIONAL_SPACE_MODIFIED)) { ! space = Project.getInstance().findFunctionalSpaceById(n.getObject()); } else { ! space = Project.getInstance().findConstructionSpaceById(n.getObject()); } *************** *** 149,154 **** } else if (type.equals(Notification.CONSTRUCTION_SPACE_CREATED)) { ! ConstructionSpaceFacade csf = ConstructionSpaceFacade.getInstance(); ! ConstructionSpace cs = csf.findById(n.getObject()); RootNode rn = (RootNode)getModel().getRoot(); --- 145,149 ---- } else if (type.equals(Notification.CONSTRUCTION_SPACE_CREATED)) { ! ConstructionSpace cs = Project.getInstance().findConstructionSpaceById(n.getObject()); RootNode rn = (RootNode)getModel().getRoot(); |
From: Michael L. <he...@us...> - 2005-10-02 19:53:01
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4745/src/net/sourceforge/bprocessor/gl/tool Modified Files: AbstractTool.java PencilTool.java ExtrusionTool.java SelectTool.java Log Message: All access to database now through the Project instance Index: SelectTool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/SelectTool.java,v retrieving revision 1.27 retrieving revision 1.28 diff -C2 -d -r1.27 -r1.28 *** SelectTool.java 30 Sep 2005 17:54:36 -0000 1.27 --- SelectTool.java 2 Oct 2005 14:48:23 -0000 1.28 *************** *** 16,30 **** import net.sourceforge.bprocessor.model.Domain; - import net.sourceforge.bprocessor.model.DomainFacade; import net.sourceforge.bprocessor.model.Edge; ! import net.sourceforge.bprocessor.model.EdgeFacade; import net.sourceforge.bprocessor.model.Vertex; - import net.sourceforge.bprocessor.model.VertexFacade; import net.sourceforge.bprocessor.model.Surface; - import net.sourceforge.bprocessor.model.SurfaceFacade; - import net.sourceforge.bprocessor.model.FunctionalSpaceFacade; import net.sourceforge.bprocessor.model.FunctionalSpace; import net.sourceforge.bprocessor.model.ConstructionSpace; - import net.sourceforge.bprocessor.model.ConstructionSpaceFacade; import java.awt.event.MouseEvent; --- 16,25 ---- import net.sourceforge.bprocessor.model.Domain; import net.sourceforge.bprocessor.model.Edge; ! import net.sourceforge.bprocessor.model.Project; import net.sourceforge.bprocessor.model.Vertex; import net.sourceforge.bprocessor.model.Surface; import net.sourceforge.bprocessor.model.FunctionalSpace; import net.sourceforge.bprocessor.model.ConstructionSpace; import java.awt.event.MouseEvent; *************** *** 37,41 **** import java.util.Iterator; - //import java.util.ArrayList; import java.util.Set; import java.util.HashSet; --- 32,35 ---- *************** *** 100,104 **** if (e.getButton() == MouseEvent.BUTTON1) { if (e.getClickCount() >= 2 && target instanceof Surface) { ! DomainFacade df = DomainFacade.getInstance(); Set ds = new HashSet(); Surface surf = (Surface) target; --- 94,98 ---- if (e.getButton() == MouseEvent.BUTTON1) { if (e.getClickCount() >= 2 && target instanceof Surface) { ! Project df = Project.getInstance(); Set ds = new HashSet(); Surface surf = (Surface) target; *************** *** 128,132 **** String side = (String)target; JPopupMenu pp = new JPopupMenu(side); ! Set domains = DomainFacade.getInstance().findAll(); Iterator domIt = domains.iterator(); Iterator selIt = new HashSet(selection).iterator(); --- 122,126 ---- String side = (String)target; JPopupMenu pp = new JPopupMenu(side); ! Set domains = Project.getInstance().getDomains(); Iterator domIt = domains.iterator(); Iterator selIt = new HashSet(selection).iterator(); *************** *** 254,283 **** public void handleNotification(Notification n) { if (n.getType().equals(Notification.VERTEX_SELECTED)) { ! Object o = VertexFacade.getInstance().findById(n.getObject()); if (!selection.contains(o)) { selection.add(o); } } else if (n.getType().equals(Notification.VERTEX_DESELECTED)) { ! Object o = VertexFacade.getInstance().findById(n.getObject()); if (selection.contains(o)) { selection.remove(o); } } else if (n.getType().equals(Notification.EDGE_SELECTED)) { ! Object o = EdgeFacade.getInstance().findById(n.getObject()); if (!selection.contains(o)) { selection.add(o); } } else if (n.getType().equals(Notification.EDGE_DESELECTED)) { ! Object o = EdgeFacade.getInstance().findById(n.getObject()); if (selection.contains(o)) { selection.remove(o); } } else if (n.getType().equals(Notification.SURFACE_SELECTED)) { ! Object o = SurfaceFacade.getInstance().findById(n.getObject()); if (!selection.contains(o)) { selection.add(o); } } else if (n.getType().equals(Notification.SURFACE_DESELECTED)) { ! Object o = SurfaceFacade.getInstance().findById(n.getObject()); if (selection.contains(o)) { selection.remove(o); --- 248,277 ---- public void handleNotification(Notification n) { if (n.getType().equals(Notification.VERTEX_SELECTED)) { ! Vertex o = Project.getInstance().findVertexById(n.getObject()); if (!selection.contains(o)) { selection.add(o); } } else if (n.getType().equals(Notification.VERTEX_DESELECTED)) { ! Vertex o = Project.getInstance().findVertexById(n.getObject()); if (selection.contains(o)) { selection.remove(o); } } else if (n.getType().equals(Notification.EDGE_SELECTED)) { ! Edge o = Project.getInstance().findEdgeById(n.getObject()); if (!selection.contains(o)) { selection.add(o); } } else if (n.getType().equals(Notification.EDGE_DESELECTED)) { ! Edge o = Project.getInstance().findEdgeById(n.getObject()); if (selection.contains(o)) { selection.remove(o); } } else if (n.getType().equals(Notification.SURFACE_SELECTED)) { ! Surface o = Project.getInstance().findSurfaceById(n.getObject()); if (!selection.contains(o)) { selection.add(o); } } else if (n.getType().equals(Notification.SURFACE_DESELECTED)) { ! Surface o = Project.getInstance().findSurfaceById(n.getObject()); if (selection.contains(o)) { selection.remove(o); *************** *** 285,289 **** } else if (n.getType().equals(Notification.FUNCTIONAL_SPACE_SELECTED)) { FunctionalSpace fs = ! (FunctionalSpace)FunctionalSpaceFacade.getInstance().findById(n.getObject()); Set s = fs.getSurfaces(); Iterator it = s.iterator(); --- 279,283 ---- } else if (n.getType().equals(Notification.FUNCTIONAL_SPACE_SELECTED)) { FunctionalSpace fs = ! Project.getInstance().findFunctionalSpaceById(n.getObject()); Set s = fs.getSurfaces(); Iterator it = s.iterator(); *************** *** 296,300 **** } else if (n.getType().equals(Notification.FUNCTIONAL_SPACE_DESELECTED)) { FunctionalSpace fs = ! (FunctionalSpace)FunctionalSpaceFacade.getInstance().findById(n.getObject()); Set s = fs.getSurfaces(); Iterator it = s.iterator(); --- 290,294 ---- } else if (n.getType().equals(Notification.FUNCTIONAL_SPACE_DESELECTED)) { FunctionalSpace fs = ! Project.getInstance().findFunctionalSpaceById(n.getObject()); Set s = fs.getSurfaces(); Iterator it = s.iterator(); *************** *** 307,311 **** } else if (n.getType().equals(Notification.CONSTRUCTION_SPACE_SELECTED)) { ConstructionSpace cs = ! (ConstructionSpace)ConstructionSpaceFacade.getInstance().findById(n.getObject()); Set s = cs.getSurfaces(); Iterator it = s.iterator(); --- 301,305 ---- } else if (n.getType().equals(Notification.CONSTRUCTION_SPACE_SELECTED)) { ConstructionSpace cs = ! Project.getInstance().findConstructionSpaceById(n.getObject()); Set s = cs.getSurfaces(); Iterator it = s.iterator(); *************** *** 318,322 **** } else if (n.getType().equals(Notification.CONSTRUCTION_SPACE_DESELECTED)) { ConstructionSpace cs = ! (ConstructionSpace)ConstructionSpaceFacade.getInstance().findById(n.getObject()); Set s = cs.getSurfaces(); Iterator it = s.iterator(); --- 312,316 ---- } else if (n.getType().equals(Notification.CONSTRUCTION_SPACE_DESELECTED)) { ConstructionSpace cs = ! Project.getInstance().findConstructionSpaceById(n.getObject()); Set s = cs.getSurfaces(); Iterator it = s.iterator(); Index: ExtrusionTool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/ExtrusionTool.java,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** ExtrusionTool.java 30 Sep 2005 12:47:09 -0000 1.18 --- ExtrusionTool.java 2 Oct 2005 14:48:23 -0000 1.19 *************** *** 16,26 **** import net.sourceforge.bprocessor.model.Edge; import net.sourceforge.bprocessor.model.Surface; import net.sourceforge.bprocessor.model.Vertex; import net.sourceforge.bprocessor.model.ConstructionSpace; - import net.sourceforge.bprocessor.model.ConstructionSpaceFacade; import net.sourceforge.bprocessor.model.FunctionalSpace; import net.sourceforge.bprocessor.model.Domain; - import net.sourceforge.bprocessor.model.DomainFacade; import net.sourceforge.bprocessor.model.Plane; --- 16,25 ---- import net.sourceforge.bprocessor.model.Edge; + import net.sourceforge.bprocessor.model.Project; import net.sourceforge.bprocessor.model.Surface; import net.sourceforge.bprocessor.model.Vertex; import net.sourceforge.bprocessor.model.ConstructionSpace; import net.sourceforge.bprocessor.model.FunctionalSpace; import net.sourceforge.bprocessor.model.Domain; import net.sourceforge.bprocessor.model.Plane; *************** *** 199,203 **** if (newCSpace == null) { newCSpace = new ConstructionSpace("innerSpace"); ! ConstructionSpaceFacade.getInstance().create((ConstructionSpace) newCSpace); } Domain outer = extendSurf.getFrontDomain(); --- 198,202 ---- if (newCSpace == null) { newCSpace = new ConstructionSpace("innerSpace"); ! Project.getInstance().intern((ConstructionSpace) newCSpace); } Domain outer = extendSurf.getFrontDomain(); *************** *** 282,286 **** } //moving this line to the top ! DomainFacade.getInstance().update(newCSpace); Surface topSurf = createSurface(top); newCSpace.addSurface(topSurf); --- 281,285 ---- } //moving this line to the top ! Project.getInstance().update(newCSpace); Surface topSurf = createSurface(top); newCSpace.addSurface(topSurf); Index: PencilTool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/PencilTool.java,v retrieving revision 1.23 retrieving revision 1.24 diff -C2 -d -r1.23 -r1.24 *** PencilTool.java 29 Sep 2005 21:02:34 -0000 1.23 --- PencilTool.java 2 Oct 2005 14:48:23 -0000 1.24 *************** *** 18,30 **** import net.sourceforge.bprocessor.gl.view.View; import net.sourceforge.bprocessor.model.Edge; - import net.sourceforge.bprocessor.model.EdgeFacade; import net.sourceforge.bprocessor.model.Plane; import net.sourceforge.bprocessor.model.Surface; - import net.sourceforge.bprocessor.model.SurfaceFacade; import net.sourceforge.bprocessor.model.Vertex; - import net.sourceforge.bprocessor.model.VertexFacade; - import net.sourceforge.bprocessor.model.FunctionalSpaceFacade; import net.sourceforge.bprocessor.model.FunctionalSpace; - import net.sourceforge.bprocessor.model.ConstructionSpaceFacade; import net.sourceforge.bprocessor.model.ConstructionSpace; import net.sourceforge.bprocessor.model.Space; --- 18,26 ---- import net.sourceforge.bprocessor.gl.view.View; import net.sourceforge.bprocessor.model.Edge; import net.sourceforge.bprocessor.model.Plane; + import net.sourceforge.bprocessor.model.Project; import net.sourceforge.bprocessor.model.Surface; import net.sourceforge.bprocessor.model.Vertex; import net.sourceforge.bprocessor.model.FunctionalSpace; import net.sourceforge.bprocessor.model.ConstructionSpace; import net.sourceforge.bprocessor.model.Space; *************** *** 84,88 **** if (vertex.getId() == null) { vertex.setName("V" + vertexNum++); ! VertexFacade.getInstance().create(vertex); } } --- 80,84 ---- if (vertex.getId() == null) { vertex.setName("V" + vertexNum++); ! Project.getInstance().intern(vertex); } } *************** *** 94,98 **** protected void intern(Edge edge) { if (edge.getId() == null) { ! EdgeFacade.getInstance().create(edge); edges.add(edge); } --- 90,94 ---- protected void intern(Edge edge) { if (edge.getId() == null) { ! Project.getInstance().intern(edge); edges.add(edge); } *************** *** 118,122 **** protected void intern(Surface surface) { if (surface.getId() == null) { ! SurfaceFacade.getInstance().create(surface); } } --- 114,118 ---- protected void intern(Surface surface) { if (surface.getId() == null) { ! Project.getInstance().intern(surface); } } *************** *** 173,178 **** if (exterior != null) { exterior.addHole(surface); ! SurfaceFacade.getInstance().update(exterior); ! SurfaceFacade.getInstance().update(surface); } --- 169,174 ---- if (exterior != null) { exterior.addHole(surface); ! Project.getInstance().update(exterior); ! Project.getInstance().update(surface); } *************** *** 183,189 **** } if (sp instanceof ConstructionSpace) { ! ConstructionSpaceFacade.getInstance().update((ConstructionSpace)sp); } else if (sp instanceof FunctionalSpace) { ! FunctionalSpaceFacade.getInstance().update((FunctionalSpace)sp); } else { //log.warn("No space was found"); --- 179,185 ---- } if (sp instanceof ConstructionSpace) { ! Project.getInstance().update((ConstructionSpace)sp); } else if (sp instanceof FunctionalSpace) { ! Project.getInstance().update((FunctionalSpace)sp); } else { //log.warn("No space was found"); *************** *** 300,304 **** snap(current); } ! Set vertices = VertexFacade.getInstance().findByLocation (current.getX(), current.getY(), current.getZ(), 0.0); if (!vertices.isEmpty()) { --- 296,300 ---- snap(current); } ! Set vertices = Project.getInstance().findByLocation (current.getX(), current.getY(), current.getZ(), 0.0); if (!vertices.isEmpty()) { *************** *** 459,463 **** */ private Space findSpace(Surface s) { ! Set set = FunctionalSpaceFacade.getInstance().findAll(); Iterator it = set.iterator(); while (it.hasNext()) { --- 455,459 ---- */ private Space findSpace(Surface s) { ! Set set = Project.getInstance().getFunctionalSpaces(); Iterator it = set.iterator(); while (it.hasNext()) { Index: AbstractTool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/AbstractTool.java,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 *** AbstractTool.java 30 Sep 2005 16:30:59 -0000 1.21 --- AbstractTool.java 2 Oct 2005 14:48:22 -0000 1.22 *************** *** 8,16 **** import net.sourceforge.bprocessor.model.Edge; ! import net.sourceforge.bprocessor.model.EdgeFacade; import net.sourceforge.bprocessor.model.Surface; - import net.sourceforge.bprocessor.model.SurfaceFacade; import net.sourceforge.bprocessor.model.Vertex; - import net.sourceforge.bprocessor.model.VertexFacade; import net.sourceforge.bprocessor.gl.view.View; import net.sourceforge.bprocessor.gl.GLView; --- 8,14 ---- import net.sourceforge.bprocessor.model.Edge; ! import net.sourceforge.bprocessor.model.Project; import net.sourceforge.bprocessor.model.Surface; import net.sourceforge.bprocessor.model.Vertex; import net.sourceforge.bprocessor.gl.view.View; import net.sourceforge.bprocessor.gl.GLView; *************** *** 261,271 **** Vertex v = new Vertex("V" + vertexNum); vertexNum++; ! VertexFacade.getInstance().create(v); v.setX(coord[0]); v.setY(coord[1]); v.setZ(coord[2]); ! ! VertexFacade.getInstance().update(v); return v; --- 259,268 ---- Vertex v = new Vertex("V" + vertexNum); vertexNum++; ! v.setX(coord[0]); v.setY(coord[1]); v.setZ(coord[2]); ! Project.getInstance().intern(v); return v; *************** *** 287,291 **** v.setZ(coord[2]); ! VertexFacade.getInstance().update(v); } else { log.error("[updateVertex] wrong argument length was: " + coord.length); --- 284,288 ---- v.setZ(coord[2]); ! Project.getInstance().update(v); } else { log.error("[updateVertex] wrong argument length was: " + coord.length); *************** *** 298,302 **** */ protected void removeVertex(Vertex v) { ! VertexFacade.getInstance().remove(v); } --- 295,299 ---- */ protected void removeVertex(Vertex v) { ! Project.getInstance().remove(v); } *************** *** 308,320 **** */ protected Edge createEdge(Vertex from, Vertex to) { ! Edge e = new Edge("E" + edgeNum); ! edgeNum++; ! EdgeFacade.getInstance().create(e); ! e.setTo(to); e.setFrom(from); ! ! EdgeFacade.getInstance().update(e); ! return e; } --- 305,312 ---- */ protected Edge createEdge(Vertex from, Vertex to) { ! Edge e = new Edge("E" + edgeNum++); e.setTo(to); e.setFrom(from); ! Project.getInstance().intern(e); return e; } *************** *** 325,329 **** */ protected void removeEdge(Edge e) { ! EdgeFacade.getInstance().remove(e); } --- 317,321 ---- */ protected void removeEdge(Edge e) { ! Project.getInstance().remove(e); } *************** *** 333,337 **** */ protected void updateEdge(Edge e) { ! EdgeFacade.getInstance().update(e); } --- 325,329 ---- */ protected void updateEdge(Edge e) { ! Project.getInstance().update(e); } *************** *** 342,353 **** */ protected Surface createSurface(List list) { ! Surface s = new Surface("S" + surfaceNum); ! surfaceNum++; ! SurfaceFacade.getInstance().create(s); ! s.setEdges(list); ! ! SurfaceFacade.getInstance().update(s); ! return s; } --- 334,340 ---- */ protected Surface createSurface(List list) { ! Surface s = new Surface("S" + surfaceNum++); s.setEdges(list); ! Project.getInstance().intern(s); return s; } *************** *** 358,362 **** */ protected void removeSurface(Surface s) { ! SurfaceFacade.getInstance().remove(s); } --- 345,349 ---- */ protected void removeSurface(Surface s) { ! Project.getInstance().remove(s); } *************** *** 371,375 **** //checking if this is a hole in some surface an thus must removed before deleted //consider method that does not have to get all surfaces. ! Set surfaces = SurfaceFacade.getInstance().findAll(); Iterator surfIt = surfaces.iterator(); while (surfIt.hasNext()) { --- 358,362 ---- //checking if this is a hole in some surface an thus must removed before deleted //consider method that does not have to get all surfaces. ! Set surfaces = Project.getInstance().getSurfaces(); Iterator surfIt = surfaces.iterator(); while (surfIt.hasNext()) { *************** *** 382,386 **** if (innerSurf == surface) { surf.removeHole(surface); ! SurfaceFacade.getInstance().update(surf); } } --- 369,373 ---- if (innerSurf == surface) { surf.removeHole(surface); ! Project.getInstance().update(surf); } } |
From: Michael L. <he...@us...> - 2005-10-02 19:46:02
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4745/src/net/sourceforge/bprocessor/gl/view Modified Files: AbstractView.java Log Message: All access to database now through the Project instance Index: AbstractView.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view/AbstractView.java,v retrieving revision 1.39 retrieving revision 1.40 diff -C2 -d -r1.39 -r1.40 *** AbstractView.java 30 Sep 2005 17:56:16 -0000 1.39 --- AbstractView.java 2 Oct 2005 14:48:22 -0000 1.40 *************** *** 11,23 **** import net.sourceforge.bprocessor.model.CoordinateSystem; import net.sourceforge.bprocessor.model.Plane; import net.sourceforge.bprocessor.model.Edge; ! import net.sourceforge.bprocessor.model.EdgeFacade; import net.sourceforge.bprocessor.model.Domain; import net.sourceforge.bprocessor.model.Vertex; - import net.sourceforge.bprocessor.model.VertexFacade; import net.sourceforge.bprocessor.model.Surface; - import net.sourceforge.bprocessor.model.SurfaceFacade; - import net.sourceforge.bprocessor.model.FunctionalSpace; import java.util.ArrayList; --- 11,21 ---- import net.sourceforge.bprocessor.model.CoordinateSystem; + import net.sourceforge.bprocessor.model.FunctionalSpace; import net.sourceforge.bprocessor.model.Plane; import net.sourceforge.bprocessor.model.Edge; ! import net.sourceforge.bprocessor.model.Project; import net.sourceforge.bprocessor.model.Domain; import net.sourceforge.bprocessor.model.Vertex; import net.sourceforge.bprocessor.model.Surface; import java.util.ArrayList; *************** *** 521,527 **** protected void drawAll(GLDrawable gld) { ! Set surfaces = SurfaceFacade.getInstance().findAll(); ! Set edges = EdgeFacade.getInstance().findAll(); ! Set vertices = VertexFacade.getInstance().findAll(); Collection selection = glv.getTool().getSelection(); --- 519,525 ---- protected void drawAll(GLDrawable gld) { ! Set surfaces = Project.getInstance().getSurfaces(); ! Set edges = Project.getInstance().getEdges(); ! Set vertices = Project.getInstance().getVertices(); Collection selection = glv.getTool().getSelection(); *************** *** 547,551 **** gl.glColor3fv(SELECTED_COLOR); if (o instanceof Vertex) { ! Vertex v = VertexFacade.getInstance().findById(((Vertex)o).getId()); gl.glPointSize(5.0f); gl.glBegin(GL.GL_POINTS); --- 545,549 ---- gl.glColor3fv(SELECTED_COLOR); if (o instanceof Vertex) { ! Vertex v = (Vertex) o; gl.glPointSize(5.0f); gl.glBegin(GL.GL_POINTS); *************** *** 554,558 **** gl.glPointSize(1.0f); } else if (o instanceof Edge) { ! Edge e = EdgeFacade.getInstance().findById(((Edge)o).getId()); Vertex to = e.getTo(); Vertex from = e.getFrom(); --- 552,556 ---- gl.glPointSize(1.0f); } else if (o instanceof Edge) { ! Edge e = (Edge) o; Vertex to = e.getTo(); Vertex from = e.getFrom(); *************** *** 564,568 **** gl.glEnable(GL.GL_POLYGON_STIPPLE); gl.glPolygonStipple(transparency); ! Surface s = SurfaceFacade.getInstance().findById(((Surface)o).getId()); drawSurface(s); gl.glDisable(GL.GL_POLYGON_STIPPLE); --- 562,566 ---- gl.glEnable(GL.GL_POLYGON_STIPPLE); gl.glPolygonStipple(transparency); ! Surface s = (Surface) o; drawSurface(s); gl.glDisable(GL.GL_POLYGON_STIPPLE); *************** *** 792,796 **** */ private void drawEdges(GLDrawable gld) { ! Set edges = EdgeFacade.getInstance().findAll(); GL gl = gld.getGL(); GLU glu = gld.getGLU(); --- 790,794 ---- */ private void drawEdges(GLDrawable gld) { ! Set edges = Project.getInstance().getEdges(); GL gl = gld.getGL(); GLU glu = gld.getGLU(); *************** *** 809,813 **** */ private void drawSurfaces(GLDrawable gld) { ! Set surfaces = SurfaceFacade.getInstance().findAll(); GL gl = gld.getGL(); GLU glu = gld.getGLU(); --- 807,811 ---- */ private void drawSurfaces(GLDrawable gld) { ! Set surfaces = Project.getInstance().getSurfaces(); GL gl = gld.getGL(); GLU glu = gld.getGLU(); |
From: Nordholt <nor...@us...> - 2005-10-02 19:28:26
|
Update of /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui/actions In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23177/actions Modified Files: ToolsDetachActionListener.java Log Message: made temporary changes to prevent crashes Index: ToolsDetachActionListener.java =================================================================== RCS file: /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui/actions/ToolsDetachActionListener.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** ToolsDetachActionListener.java 28 Jul 2005 06:54:41 -0000 1.2 --- ToolsDetachActionListener.java 30 Sep 2005 18:02:42 -0000 1.3 *************** *** 567,570 **** --- 567,571 ---- Surface s = sf.findById(rsvalue.getId()); + s.removeDomain(fs); fs.getSurfaces().remove(s); fsf.update(fs); *************** *** 584,587 **** --- 585,589 ---- Surface s = sf.findById(rsvalue.getId()); + s.removeDomain(cs); cs.getSurfaces().remove(s); csf.update(cs); *************** *** 601,604 **** --- 603,607 ---- Surface s = sf.findById(rsvalue.getId()); + s.removeDomain(e); e.getSurfaces().remove(s); ef.update(e); *************** *** 618,621 **** --- 621,625 ---- Surface s = sf.findById(rsvalue.getId()); + s.removeDomain(p); p.getSurfaces().remove(s); pf.update(p); |