bprocessor-commit Mailing List for B-processor (Page 173)
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: Jesper P. <je...@us...> - 2005-07-15 09:44:55
|
Update of /cvsroot/bprocessor/tools/jogl/macosx In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19576/macosx Modified Files: libjogl.jnilib libjogl_cg.jnilib Log Message: JOGL 1.1.1 Index: libjogl.jnilib =================================================================== RCS file: /cvsroot/bprocessor/tools/jogl/macosx/libjogl.jnilib,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 Binary files /tmp/cvsiwK1Xk and /tmp/cvsejwGMT differ Index: libjogl_cg.jnilib =================================================================== RCS file: /cvsroot/bprocessor/tools/jogl/macosx/libjogl_cg.jnilib,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 Binary files /tmp/cvsAM0beM and /tmp/cvs21T1cl differ |
From: Jesper P. <je...@us...> - 2005-07-15 09:44:54
|
Update of /cvsroot/bprocessor/tools/jogl/win32 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19576/win32 Modified Files: jogl.dll jogl_cg.dll Log Message: JOGL 1.1.1 Index: jogl_cg.dll =================================================================== RCS file: /cvsroot/bprocessor/tools/jogl/win32/jogl_cg.dll,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 Binary files /tmp/cvsoBz6Bg and /tmp/cvsB1RvUP differ Index: jogl.dll =================================================================== RCS file: /cvsroot/bprocessor/tools/jogl/win32/jogl.dll,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 Binary files /tmp/cvsdhgSCo and /tmp/cvsBfoq1X differ |
From: Jesper P. <je...@us...> - 2005-07-14 13:05:37
|
Update of /cvsroot/bprocessor/kernel/src/net/sourceforge/bprocessor/kernel In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30964/src/net/sourceforge/bprocessor/kernel Modified Files: KernelClassLoader.java Log Message: getAbsolutePath() contains the leading / Index: KernelClassLoader.java =================================================================== RCS file: /cvsroot/bprocessor/kernel/src/net/sourceforge/bprocessor/kernel/KernelClassLoader.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** KernelClassLoader.java 12 Jul 2005 06:48:42 -0000 1.2 --- KernelClassLoader.java 14 Jul 2005 13:05:28 -0000 1.3 *************** *** 145,149 **** */ private URL getURL(JarFile jf, JarEntry je) throws MalformedURLException { ! StringBuffer url = new StringBuffer("jar:file:/"); url = url.append(new File(".").getAbsolutePath()); url = url.append("/"); --- 145,149 ---- */ private URL getURL(JarFile jf, JarEntry je) throws MalformedURLException { ! StringBuffer url = new StringBuffer("jar:file:"); url = url.append(new File(".").getAbsolutePath()); url = url.append("/"); |
From: Jesper P. <je...@us...> - 2005-07-14 09:55:13
|
Update of /cvsroot/bprocessor/build/bin In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27943 Modified Files: bprocessor.bat Log Message: Added GL path Index: bprocessor.bat =================================================================== RCS file: /cvsroot/bprocessor/build/bin/bprocessor.bat,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** bprocessor.bat 27 Jun 2005 09:32:45 -0000 1.1.1.1 --- bprocessor.bat 14 Jul 2005 09:55:03 -0000 1.2 *************** *** 2,6 **** if "%JAVA_HOME%" == "" goto error ! "%JAVA_HOME%\bin\java" -jar kernel.jar goto end --- 2,6 ---- if "%JAVA_HOME%" == "" goto error ! "%JAVA_HOME%\bin\java" -Djava.library.path=library/win32 -jar kernel.jar goto end |
From: Jesper P. <je...@us...> - 2005-07-14 09:52:51
|
Update of /cvsroot/bprocessor/CVSROOT In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27453 Modified Files: modules Log Message: Added GL module Index: modules =================================================================== RCS file: /cvsroot/bprocessor/CVSROOT/modules,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** modules 27 Jun 2005 09:34:37 -0000 1.2 --- modules 14 Jul 2005 09:52:37 -0000 1.3 *************** *** 25,29 **** # can be useful for creating a module that consists of many directories # spread out over the entire source repository. ! all -a build kernel model gui tools build build --- 25,29 ---- # can be useful for creating a module that consists of many directories # spread out over the entire source repository. ! all -a build kernel model gui gl tools build build *************** *** 31,33 **** --- 31,34 ---- model model gui gui + gl gl tools tools |
From: rimestad <rim...@us...> - 2005-07-14 09:51:42
|
Update of /cvsroot/bprocessor/build/bin In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27191 Modified Files: bprocessor.sh Log Message: Use correct path for MacOSX Index: bprocessor.sh =================================================================== RCS file: /cvsroot/bprocessor/build/bin/bprocessor.sh,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** bprocessor.sh 27 Jun 2005 09:32:45 -0000 1.1.1.1 --- bprocessor.sh 14 Jul 2005 09:51:32 -0000 1.2 *************** *** 7,9 **** fi ! $JAVA_HOME/bin/java -jar kernel.jar --- 7,16 ---- fi ! OS=$OSTYPE ! LIBDIR=library/linux ! ! if [ $OS != "linux" ]; then ! LIBDIR=library/macosx ! fi ! ! $JAVA_HOME/bin/java -Djava.library.path=$LIBDIR -jar kernel.jar |
From: rimestad <rim...@us...> - 2005-07-14 09:51:09
|
Update of /cvsroot/bprocessor/build In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27060 Modified Files: build.xml Log Message: Added GL module to build Index: build.xml =================================================================== RCS file: /cvsroot/bprocessor/build/build.xml,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** build.xml 27 Jun 2005 09:32:45 -0000 1.1.1.1 --- build.xml 14 Jul 2005 09:50:58 -0000 1.2 *************** *** 7,13 **** --- 7,16 ---- <property name="script.dir" value="${basedir}/bin"/> + <property name="tools.dir" value="${basedir}/../tools"/> + <property name="kernel.dir" value="${basedir}/../kernel"/> <property name="model.dir" value="${basedir}/../model"/> <property name="gui.dir" value="${basedir}/../gui"/> + <property name="gl.dir" value="${basedir}/../gl"/> <property name="release.dir" value="${basedir}/dist"/> *************** *** 21,24 **** --- 24,28 ---- <ant dir="${model.dir}" target="clean"/> <ant dir="${gui.dir}" target="clean"/> + <ant dir="${gl.dir}" target="clean"/> </target> *************** *** 32,35 **** --- 36,40 ---- <ant dir="${model.dir}" target="dist"/> <ant dir="${gui.dir}" target="dist"/> + <ant dir="${gl.dir}" target="dist"/> <copy todir="${release.dir}"> *************** *** 53,56 **** --- 58,69 ---- </fileset> </copy> + <copy todir="${release.dir}/library"> + <fileset dir="${tools.dir}/jogl"/> + </copy> + <copy todir="${release.dir}/plugin"> + <fileset dir="${gl.dir}/dist"> + <include name="**/*"/> + </fileset> + </copy> <chmod dir="${release.dir}" perm="ugo+rx" |
From: Jesper P. <je...@us...> - 2005-07-12 06:48:50
|
Update of /cvsroot/bprocessor/kernel/src/net/sourceforge/bprocessor/kernel In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31899/src/net/sourceforge/bprocessor/kernel Modified Files: KernelClassLoader.java Log Message: Load classes the hard way to work around InputStream problems Index: KernelClassLoader.java =================================================================== RCS file: /cvsroot/bprocessor/kernel/src/net/sourceforge/bprocessor/kernel/KernelClassLoader.java,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** KernelClassLoader.java 27 Jun 2005 09:12:30 -0000 1.1.1.1 --- KernelClassLoader.java 12 Jul 2005 06:48:42 -0000 1.2 *************** *** 214,221 **** if (ln.equals(name)) { try { ! log.debug("Loading class : " + name); InputStream is = jf.getInputStream(je); ! byte[] bytes = new byte[is.available()]; ! is.read(bytes); result = defineClass(name, bytes, 0, bytes.length); resolveClass(result); --- 214,231 ---- if (ln.equals(name)) { try { ! if (log.isDebugEnabled()) { ! log.debug("Loading class : " + name + " from " + je.getName()); ! } InputStream is = jf.getInputStream(je); ! int avail = is.available(); ! byte[] bytes = new byte[avail]; ! int index = 0; ! int i = is.read(); ! while (i != -1) { ! bytes[index] = (byte)i; ! i = is.read(); ! index += 1; ! } ! is.close(); result = defineClass(name, bytes, 0, bytes.length); resolveClass(result); |
From: Jesper P. <je...@us...> - 2005-07-11 11:20:21
|
Update of /cvsroot/bprocessor/kernel/src/net/sourceforge/bprocessor/kernel/notification In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8377 Modified Files: Notification.java Log Message: Added keys for element and part Index: Notification.java =================================================================== RCS file: /cvsroot/bprocessor/kernel/src/net/sourceforge/bprocessor/kernel/notification/Notification.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** Notification.java 1 Jul 2005 11:29:38 -0000 1.2 --- Notification.java 11 Jul 2005 11:20:06 -0000 1.3 *************** *** 46,49 **** --- 46,79 ---- public static final String CONSTRUCTION_SPACE_MODIFIED = "constructionspace.modified"; + /** Element created */ + public static final String ELEMENT_CREATED = "element.created"; + + /** Element deleted */ + public static final String ELEMENT_DELETED = "element.deleted"; + + /** Element renamed */ + public static final String ELEMENT_RENAMED = "element.renamed"; + + /** Element selected */ + public static final String ELEMENT_SELECTED = "element.selected"; + + /** Element modified */ + public static final String ELEMENT_MODIFIED = "element.modified"; + + /** Part created */ + public static final String PART_CREATED = "part.created"; + + /** Part deleted */ + public static final String PART_DELETED = "part.deleted"; + + /** Part renamed */ + public static final String PART_RENAMED = "part.renamed"; + + /** Part selected */ + public static final String PART_SELECTED = "part.selected"; + + /** Part modified */ + public static final String PART_MODIFIED = "part.modified"; + /** Surface created */ public static final String SURFACE_CREATED = "surface.created"; |
From: rimestad <rim...@us...> - 2005-07-11 09:32:33
|
Update of /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19202 Modified Files: Surface.java Log Message: added reference to contour Index: Surface.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Surface.java,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** Surface.java 27 Jun 2005 09:31:14 -0000 1.1.1.1 --- Surface.java 11 Jul 2005 09:32:23 -0000 1.2 *************** *** 32,35 **** --- 32,38 ---- private Set domains; + /** The contour relationship */ + private Set contours; + /** * Constructor for persistence layer *************** *** 46,49 **** --- 49,53 ---- setName(name); setDomains(new HashSet()); + setContours(new HashSet()); } *************** *** 95,98 **** --- 99,118 ---- this.domains = domains; } + + /** + * Get the contours + * @return The contours + */ + public Set getContours() { + return contours; + } + + /** + * Set the contours + * @param contours The contours + */ + public void setContours(Set contours) { + this.contours = contours; + } /** |
From: rimestad <rim...@us...> - 2005-07-11 09:31:37
|
Update of /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18710 Added Files: Contour.java ContourFacade.java EdgeFacade.java Edge.java Vertex.java VertexFacade.java Log Message: Initial import --- NEW FILE: ContourFacade.java --- //--------------------------------------------------------------------------------- // $Id: ContourFacade.java,v 1.1 2005/07/11 09:31:23 rimestad 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.Collections; import java.util.HashSet; import java.util.Iterator; import java.util.Set; import org.apache.log4j.Logger; /** * Facade for contour */ public class ContourFacade { /** The logger */ private static Logger log = Logger.getLogger(ContourFacade.class); /** The instance */ private static ContourFacade instance; /** Contours */ private Set contours; /** * Constructor */ private ContourFacade() { contours = new HashSet(); } /** * Get the instance * @return The instance */ public static synchronized ContourFacade getInstance() { if (instance == null) { instance = new ContourFacade(); } return instance; } /** * Add a contour * @param c The contour */ public synchronized void add(Contour c) { contours.add(c); } /** * Remove a contour * @param c The contour */ public synchronized void remove(Contour c) { contours.remove(c); } /** * Find all contours * @return The contours (unmodifiable) */ public Set findAll() { return Collections.unmodifiableSet(contours); } /** * Find a contour by id * @param id The id * @return The contour */ public synchronized Contour findById(Long id) { Iterator it = contours.iterator(); while (it.hasNext()) { Contour c = (Contour)it.next(); if (c.getId().equals(id)) { return c; } } return null; } /** * Find a contour by name * @param name The name * @return The contour */ public synchronized Contour findByName(String name) { Iterator it = contours.iterator(); while (it.hasNext()) { Contour c = (Contour)it.next(); if (c.getName().equals(name)) { return c; } } return null; } } --- NEW FILE: VertexFacade.java --- //--------------------------------------------------------------------------------- // $Id: VertexFacade.java,v 1.1 2005/07/11 09:31:24 rimestad 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.Collections; import java.util.HashSet; import java.util.Iterator; import java.util.Set; import org.apache.log4j.Logger; /** * Facade for vertex */ public class VertexFacade { /** The logger */ private static Logger log = Logger.getLogger(VertexFacade.class); /** The instance */ private static VertexFacade instance; /** Vertexs */ private Set vertexs; /** * Constructor */ private VertexFacade() { vertexs = new HashSet(); } /** * Get the instance * @return The instance */ public static synchronized VertexFacade getInstance() { if (instance == null) { instance = new VertexFacade(); } return instance; } /** * Add a vertex * @param v The vertex */ public synchronized void add(Vertex v) { vertexs.add(v); } /** * Remove a vertex * @param v The vertex */ public synchronized void remove(Vertex v) { vertexs.remove(v); } /** * Find all vertexs * @return The vertexs (unmodifiable) */ public Set findAll() { return Collections.unmodifiableSet(vertexs); } /** * Find a vertex by id * @param id The id * @return The vertex */ public synchronized Vertex findById(Long id) { Iterator it = vertexs.iterator(); while (it.hasNext()) { Vertex v = (Vertex)it.next(); if (v.getId().equals(id)) { return v; } } return null; } /** * Find a vertex by name * @param name The name * @return The vertex */ public synchronized Vertex findByName(String name) { Iterator it = vertexs.iterator(); while (it.hasNext()) { Vertex v = (Vertex)it.next(); if (v.getName().equals(name)) { return v; } } return null; } } --- NEW FILE: Edge.java --- //--------------------------------------------------------------------------------- // $Id: Edge.java,v 1.1 2005/07/11 09:31:23 rimestad 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.io.Serializable; import java.util.HashSet; import java.util.Set; import org.apache.log4j.Logger; /** * The edge */ public class Edge implements Serializable { /** The logger */ private static Logger log = Logger.getLogger(Edge.class); /** Id generator */ private static long l = 0; /** The id */ private Long id; /** The name */ private String name; /** The start vertex */ private Vertex from; /** The end vertex */ private Vertex to; /** The contour relationship */ private Set contours; /** * Constructor for persistence layer */ Edge() { } /** * Constructor * @param name The name */ public Edge(String name) { setId(new Long(l++)); setName(name); setFrom(new Vertex()); setTo(new Vertex()); setContours(new HashSet()); } /** * Get the id * @return The id */ public Long getId() { return id; } /** * Set the id * @param id The id */ private void setId(Long id) { this.id = id; } /** * Get the name * @return The name */ public String getName() { return name; } /** * Set the name * @param name The name */ public void setName(String name) { this.name = name; } /** * Get the to vertex * @return The end vertex */ public Vertex getTo() { return to; } /** * Set the to vertex * @param to The begin vertex */ public void setTo(Vertex to) { this.to = to; } /** * Get the from vertex * @return The begin vertex */ public Vertex getFrom() { return from; } /** * Set the from vertex * @param from The end vertex */ public void setFrom(Vertex from) { this.from = from; } /** * Get the contours * @return The contours */ public Set getContours() { return contours; } /** * Set the contours * @param contours The contours */ public void setContours(Set contours) { this.contours = contours; } /** * Return the hash code of the object * @return The hash */ public int hashCode() { return id.hashCode(); } /** * Indicates whether some other object is equal to this one. * @param o The other object * @return True if equal; otherwise false */ public boolean equals(Object o) { if (!(o instanceof Edge)) { return false; } Edge e = (Edge)o; return this.id.equals(e.getId()); } } --- NEW FILE: Vertex.java --- //--------------------------------------------------------------------------------- // $Id: Vertex.java,v 1.1 2005/07/11 09:31:24 rimestad 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.io.Serializable; import java.util.HashSet; import java.util.Set; import org.apache.log4j.Logger; /** * The vertex */ public class Vertex implements Serializable { /** The logger */ private static Logger log = Logger.getLogger(Vertex.class); /** Id generator */ private static long l = 0; /** The id */ private Long id; /** The name */ private String name; /** The x coordinate */ private double x; /** The y coordinate */ private double y; /** The z coordinate */ private double z; /** The w coordinate */ private double w; /** The edge relationship */ private Set edges; /** * Constructor for persistence layer */ Vertex() { } /** * Constructor * @param name The name */ public Vertex(String name) { setId(new Long(l++)); setName(name); setX(0.0); setY(0.0); setZ(0.0); setW(0.0); setEdges(new HashSet()); } /** * Get the id * @return The id */ public Long getId() { return id; } /** * Set the id * @param id The id */ private void setId(Long id) { this.id = id; } /** * Get the name * @return The name */ public String getName() { return name; } /** * Set the name * @param name The name */ public void setName(String name) { this.name = name; } /** * Get the x coordinate * @return The x coordinate */ public double getX() { return x; } /** * Set the x coordinate * @param x The x coordinate */ private void setX(double x) { this.x = x; } /** * Get the y coordinate * @return The y coordinate */ public double getY() { return y; } /** * Set the y coordinate * @param y The y coordinate */ private void setY(double y) { this.y = y; } /** * Get the z coordinate * @return The z coordinate */ public double getZ() { return z; } /** * Set the z coordinate * @param z The z coordinate */ private void setZ(double z) { this.z = z; } /** * Get the w coordinate * @return The w coordinate */ public double getW() { return w; } /** * Set the w coordinate * @param w The w coordinate */ private void setW(double w) { this.w = w; } /** * Get the edges * @return The edges */ public Set getEdges() { return edges; } /** * Set the edges * @param edges The edges */ public void setEdges(Set edges) { this.edges = edges; } /** * Return the hash code of the object * @return The hash */ public int hashCode() { return id.hashCode(); } /** * Indicates whether some other object is equal to this one. * @param o The other object * @return True if equal; otherwise false */ public boolean equals(Object o) { if (!(o instanceof Vertex)) { return false; } Vertex v = (Vertex)o; return this.id.equals(v.getId()); } } --- NEW FILE: Contour.java --- //--------------------------------------------------------------------------------- // $Id: Contour.java,v 1.1 2005/07/11 09:31:23 rimestad 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.io.Serializable; import java.util.ArrayList; import java.util.List; import org.apache.log4j.Logger; /** * The contour */ public class Contour implements Serializable { /** The logger */ private static Logger log = Logger.getLogger(Contour.class); /** Id generator */ private static long l = 0; /** The id */ private Long id; /** The name */ private String name; /** The edges relationship */ private List edges; /** * Constructor for persistence layer */ Contour() { } /** * Constructor * @param name The name */ public Contour(String name) { setId(new Long(l++)); setName(name); setEdges(new ArrayList()); } /** * Get the id * @return The id */ public Long getId() { return id; } /** * Set the id * @param id The id */ private void setId(Long id) { this.id = id; } /** * Get the name * @return The name */ public String getName() { return name; } /** * Set the name * @param name The name */ public void setName(String name) { this.name = name; } /** * Get the edges * @return The edges */ public List getEdges() { return edges; } /** * Set the edges * @param edges The edges */ public void setEdges(List edges) { this.edges = edges; } /** * Return the hash code of the object * @return The hash */ public int hashCode() { return id.hashCode(); } /** * Indicates whether some other object is equal to this one. * @param o The other object * @return True if equal; otherwise false */ public boolean equals(Object o) { if (!(o instanceof Contour)) { return false; } Contour c = (Contour)o; return this.id.equals(c.getId()); } } --- NEW FILE: EdgeFacade.java --- //--------------------------------------------------------------------------------- // $Id: EdgeFacade.java,v 1.1 2005/07/11 09:31:23 rimestad 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.Collections; import java.util.HashSet; import java.util.Iterator; import java.util.Set; import org.apache.log4j.Logger; /** * Facade for edge */ public class EdgeFacade { /** The logger */ private static Logger log = Logger.getLogger(EdgeFacade.class); /** The instance */ private static EdgeFacade instance; /** Edges */ private Set edges; /** * Constructor */ private EdgeFacade() { edges = new HashSet(); } /** * Get the instance * @return The instance */ public static synchronized EdgeFacade getInstance() { if (instance == null) { instance = new EdgeFacade(); } return instance; } /** * Add a edge * @param e The edge */ public synchronized void add(Edge e) { edges.add(e); } /** * Remove a edge * @param e The edge */ public synchronized void remove(Edge e) { edges.remove(e); } /** * Find all edges * @return The edges (unmodifiable) */ public Set findAll() { return Collections.unmodifiableSet(edges); } /** * Find a edge by id * @param id The id * @return The edge */ public synchronized Edge findById(Long id) { Iterator it = edges.iterator(); while (it.hasNext()) { Edge e = (Edge)it.next(); if (e.getId().equals(id)) { return e; } } return null; } /** * Find a edge by name * @param name The name * @return The edge */ public synchronized Edge findByName(String name) { Iterator it = edges.iterator(); while (it.hasNext()) { Edge e = (Edge)it.next(); if (e.getName().equals(name)) { return e; } } return null; } } |
From: Jesper P. <je...@us...> - 2005-07-11 08:48:38
|
Update of /cvsroot/bprocessor/tools/checkstyle In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26275 Modified Files: checkstyle.jar Log Message: Checkstyle 4.0beta4 Index: checkstyle.jar =================================================================== RCS file: /cvsroot/bprocessor/tools/checkstyle/checkstyle.jar,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 Binary files /tmp/cvsnf2atv and /tmp/cvs42cjJ5 differ |
From: Jesper P. <je...@us...> - 2005-07-11 08:42:33
|
Update of /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui/actions In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22803 Added Files: ToolsDetachActionListener.java Log Message: Initial import --- NEW FILE: ToolsDetachActionListener.java --- //--------------------------------------------------------------------------------- // $Id: ToolsDetachActionListener.java,v 1.1 2005/07/11 08:42:23 jews Exp $ // // Copyright (c) 2005 The BProcessor Team (http://bprocessor.sourceforge.net) // Released under the Lesser GNU Public License v2.1 //--------------------------------------------------------------------------------- package net.sourceforge.bprocessor.gui.actions; import net.sourceforge.bprocessor.model.ConstructionSpace; import net.sourceforge.bprocessor.model.ConstructionSpaceFacade; import net.sourceforge.bprocessor.model.Element; import net.sourceforge.bprocessor.model.ElementFacade; import net.sourceforge.bprocessor.model.FunctionalSpace; import net.sourceforge.bprocessor.model.FunctionalSpaceFacade; import net.sourceforge.bprocessor.model.Part; import net.sourceforge.bprocessor.model.PartFacade; import net.sourceforge.bprocessor.model.Surface; import net.sourceforge.bprocessor.model.SurfaceFacade; import java.awt.BorderLayout; import java.awt.GridLayout; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.ItemEvent; import java.awt.event.ItemListener; import java.util.Collection; import java.util.Iterator; import java.util.Vector; import javax.swing.JButton; import javax.swing.JComboBox; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JList; import javax.swing.JPanel; import javax.swing.JScrollPane; import javax.swing.event.ListSelectionEvent; import javax.swing.event.ListSelectionListener; import org.apache.log4j.Logger; /** * The tools->detach action listener */ public class ToolsDetachActionListener implements ActionListener { /** The logger */ private static Logger log = Logger.getLogger(ToolsDetachActionListener.class); /** Functional spaces constant */ private static final String FUNCTIONAL_SPACES = "Functional spaces"; /** Construction spaces constant */ private static final String CONSTRUCTION_SPACES = "Construction spaces"; /** Surfaces constant */ private static final String SURFACES = "Surfaces"; /** Elements constant */ private static final String ELEMENTS = "Elements"; /** Parts constant */ private static final String PARTS = "Parts"; /** * ToolsDetachActionListener */ public ToolsDetachActionListener() { } /** * Action performed * @param e The action event */ public void actionPerformed(ActionEvent e) { final JFrame frame = new JFrame("Detach"); final JComboBox leftSelector = new JComboBox(); final JList leftValues = new JList(); final JComboBox rightSelector = new JComboBox(); final JList rightValues = new JList(); leftValues.addListSelectionListener(new LeftValuesListener(leftSelector, leftValues, rightSelector, rightValues)); leftSelector.addItem(FUNCTIONAL_SPACES); leftSelector.addItem(CONSTRUCTION_SPACES); leftSelector.addItem(ELEMENTS); leftSelector.addItem(PARTS); leftSelector.addItemListener(new LeftSelectorListener(leftSelector, leftValues, rightSelector)); Vector leftValuesData = new Vector(); FunctionalSpaceFacade fsf = FunctionalSpaceFacade.getInstance(); Collection spaces = fsf.findAll(); Iterator it = spaces.iterator(); while (it.hasNext()) { FunctionalSpace fs = (FunctionalSpace)it.next(); leftValuesData.add(new ValueHolder(fs.getId(), fs.getName())); } leftValues.setListData(leftValuesData); JLabel l = new JLabel("-x"); rightSelector.addItem(SURFACES); rightSelector.addItem(ELEMENTS); rightSelector.addItemListener(new RightSelectorListener(leftSelector, leftValues, rightSelector, rightValues)); Vector rightValuesData = new Vector(); rightValues.setListData(rightValuesData); JButton ok = new JButton("Ok"); ok.addActionListener(new DetachAction(leftSelector, leftValues, rightSelector, rightValues, frame)); JButton cancel = new JButton("Cancel"); cancel.addActionListener(new ActionListener() { /** * Action performed * @param event The event */ public void actionPerformed(ActionEvent event) { frame.dispose(); } }); frame.getContentPane().setLayout(new GridLayout(3, 3)); JPanel p1 = new JPanel(); p1.setLayout(new BorderLayout()); p1.add(leftSelector, BorderLayout.SOUTH); frame.getContentPane().add(p1); frame.getContentPane().add(new JLabel("")); JPanel p2 = new JPanel(); p2.setLayout(new BorderLayout()); p2.add(rightSelector, BorderLayout.SOUTH); frame.getContentPane().add(p2); frame.getContentPane().add(new JScrollPane(leftValues), BorderLayout.CENTER); frame.getContentPane().add(l); frame.getContentPane().add(new JScrollPane(rightValues), BorderLayout.CENTER); JPanel p3 = new JPanel(); p3.setLayout(new BorderLayout()); p3.add(ok, BorderLayout.SOUTH); frame.getContentPane().add(p3); frame.getContentPane().add(new JLabel("")); JPanel p4 = new JPanel(); p4.setLayout(new BorderLayout()); p4.add(cancel, BorderLayout.SOUTH); frame.getContentPane().add(p4); frame.setSize(600, 400); frame.show(); } /** * Left values listener */ class LeftValuesListener implements ListSelectionListener { /** The left selector */ private JComboBox leftSelector; /** The left values */ private JList leftValues; /** The right selector */ private JComboBox rightSelector; /** The right values */ private JList rightValues; /** * Constructor * @param leftSelector The left selector * @param leftValues The left list * @param rightSelector The right selector * @param rightValues The right list */ LeftValuesListener(JComboBox leftSelector, JList leftValues, JComboBox rightSelector, JList rightValues) { this.leftSelector = leftSelector; this.leftValues = leftValues; this.rightSelector = rightSelector; this.rightValues = rightValues; } /** * Value changed * @param event The event */ public void valueChanged(ListSelectionEvent event) { String lsname = (String)leftSelector.getSelectedItem(); String rsname = (String)rightSelector.getSelectedItem(); ValueHolder lsvalue = (ValueHolder)leftValues.getSelectedValue(); if (lsvalue != null) { if (lsname.equals(FUNCTIONAL_SPACES)) { FunctionalSpaceFacade fsf = FunctionalSpaceFacade.getInstance(); FunctionalSpace fs = fsf.findById(lsvalue.getId()); if (rsname.equals(SURFACES)) { Vector rightValuesData = new Vector(); Collection surfaces = fs.getSurfaces(); Iterator it = surfaces.iterator(); while (it.hasNext()) { Surface s = (Surface)it.next(); rightValuesData.add(new ValueHolder(s.getId(), s.getName())); } rightValues.setListData(rightValuesData); } else if (rsname.equals(ELEMENTS)) { Vector rightValuesData = new Vector(); Collection elements = fs.getElements(); Iterator it = elements.iterator(); while (it.hasNext()) { Element e = (Element)it.next(); rightValuesData.add(new ValueHolder(e.getId(), e.getName())); } rightValues.setListData(rightValuesData); } } else if (lsname.equals(CONSTRUCTION_SPACES)) { ConstructionSpaceFacade csf = ConstructionSpaceFacade.getInstance(); ConstructionSpace cs = csf.findById(lsvalue.getId()); if (rsname.equals(SURFACES)) { Vector rightValuesData = new Vector(); Collection surfaces = cs.getSurfaces(); Iterator it = surfaces.iterator(); while (it.hasNext()) { Surface s = (Surface)it.next(); rightValuesData.add(new ValueHolder(s.getId(), s.getName())); } rightValues.setListData(rightValuesData); } else if (rsname.equals(ELEMENTS)) { Vector rightValuesData = new Vector(); Collection elements = cs.getElements(); Iterator it = elements.iterator(); while (it.hasNext()) { Element e = (Element)it.next(); rightValuesData.add(new ValueHolder(e.getId(), e.getName())); } rightValues.setListData(rightValuesData); } } else if (lsname.equals(ELEMENTS)) { ElementFacade ef = ElementFacade.getInstance(); Element e = ef.findById(lsvalue.getId()); if (rsname.equals(SURFACES)) { Vector rightValuesData = new Vector(); Collection surfaces = e.getSurfaces(); Iterator it = surfaces.iterator(); while (it.hasNext()) { Surface s = (Surface)it.next(); rightValuesData.add(new ValueHolder(s.getId(), s.getName())); } rightValues.setListData(rightValuesData); } else if (rsname.equals(PARTS)) { Vector rightValuesData = new Vector(); Collection elements = e.getParts(); Iterator it = elements.iterator(); while (it.hasNext()) { Part p = (Part)it.next(); rightValuesData.add(new ValueHolder(p.getId(), p.getName())); } rightValues.setListData(rightValuesData); } } else if (lsname.equals(PARTS)) { PartFacade pf = PartFacade.getInstance(); Part p = pf.findById(lsvalue.getId()); if (rsname.equals(SURFACES)) { Vector rightValuesData = new Vector(); Collection surfaces = p.getSurfaces(); Iterator it = surfaces.iterator(); while (it.hasNext()) { Surface s = (Surface)it.next(); rightValuesData.add(new ValueHolder(s.getId(), s.getName())); } rightValues.setListData(rightValuesData); } } } } } /** * Left selector listener */ class LeftSelectorListener implements ItemListener { /** The left selector */ private JComboBox leftSelector; /** The left values */ private JList leftValues; /** The right selector */ private JComboBox rightSelector; /** Last value */ private String last; /** * Constructor * @param leftSelector The left selector * @param leftValues The left list * @param rightSelector The right selector */ LeftSelectorListener(JComboBox leftSelector, JList leftValues, JComboBox rightSelector) { this.leftSelector = leftSelector; this.leftValues = leftValues; this.rightSelector = rightSelector; } /** * Item state changed * @param event The event */ public void itemStateChanged(ItemEvent event) { String current = (String)leftSelector.getSelectedItem(); if (!current.equals(last)) { Vector leftValuesData = new Vector(); if (current.equals(FUNCTIONAL_SPACES)) { FunctionalSpaceFacade fsf = FunctionalSpaceFacade.getInstance(); Collection spaces = fsf.findAll(); Iterator it = spaces.iterator(); while (it.hasNext()) { FunctionalSpace fs = (FunctionalSpace)it.next(); leftValuesData.add(new ValueHolder(fs.getId(), fs.getName())); } rightSelector.removeAllItems(); rightSelector.addItem(SURFACES); rightSelector.addItem(ELEMENTS); } else if (current.equals(CONSTRUCTION_SPACES)) { ConstructionSpaceFacade csf = ConstructionSpaceFacade.getInstance(); Collection spaces = csf.findAll(); Iterator it = spaces.iterator(); while (it.hasNext()) { ConstructionSpace cs = (ConstructionSpace)it.next(); leftValuesData.add(new ValueHolder(cs.getId(), cs.getName())); } rightSelector.removeAllItems(); rightSelector.addItem(SURFACES); rightSelector.addItem(ELEMENTS); } else if (current.equals(ELEMENTS)) { ElementFacade ef = ElementFacade.getInstance(); Collection elements = ef.findAll(); Iterator it = elements.iterator(); while (it.hasNext()) { Element e = (Element)it.next(); leftValuesData.add(new ValueHolder(e.getId(), e.getName())); } rightSelector.removeAllItems(); rightSelector.addItem(SURFACES); rightSelector.addItem(PARTS); } else if (current.equals(PARTS)) { PartFacade pf = PartFacade.getInstance(); Collection parts = pf.findAll(); Iterator it = parts.iterator(); while (it.hasNext()) { Part p = (Part)it.next(); leftValuesData.add(new ValueHolder(p.getId(), p.getName())); } rightSelector.removeAllItems(); rightSelector.addItem(SURFACES); } leftValues.setListData(leftValuesData); last = current; } } } /** * Right selector listener */ class RightSelectorListener implements ItemListener { /** The left selector */ private JComboBox leftSelector; /** The left values */ private JList leftValues; /** The right selector */ private JComboBox rightSelector; /** The right values */ private JList rightValues; /** Last value */ private String last; /** * Constructor * @param leftSelector The left selector * @param leftValues The left list * @param rightSelector The right selector * @param rightValues The right list */ RightSelectorListener(JComboBox leftSelector, JList leftValues, JComboBox rightSelector, JList rightValues) { this.leftSelector = leftSelector; this.leftValues = leftValues; this.rightSelector = rightSelector; this.rightValues = rightValues; } /** * Item state changed * @param event The event */ public void itemStateChanged(ItemEvent event) { String current = (String)rightSelector.getSelectedItem(); if (current != null && !current.equals(last)) { Vector rightValuesData = new Vector(); ValueHolder lsvalue = (ValueHolder)leftValues.getSelectedValue(); if (lsvalue != null) { String lsname = (String)leftSelector.getSelectedItem(); String rsname = (String)rightSelector.getSelectedItem(); if (lsname.equals(FUNCTIONAL_SPACES)) { FunctionalSpaceFacade fsf = FunctionalSpaceFacade.getInstance(); FunctionalSpace fs = fsf.findById(lsvalue.getId()); if (rsname.equals(SURFACES)) { Collection surfaces = fs.getSurfaces(); Iterator it = surfaces.iterator(); while (it.hasNext()) { Surface s = (Surface)it.next(); rightValuesData.add(new ValueHolder(s.getId(), s.getName())); } } else if (rsname.equals(ELEMENTS)) { Collection elements = fs.getElements(); Iterator it = elements.iterator(); while (it.hasNext()) { Element e = (Element)it.next(); rightValuesData.add(new ValueHolder(e.getId(), e.getName())); } } } else if (lsname.equals(CONSTRUCTION_SPACES)) { ConstructionSpaceFacade csf = ConstructionSpaceFacade.getInstance(); ConstructionSpace cs = csf.findById(lsvalue.getId()); if (rsname.equals(SURFACES)) { Collection surfaces = cs.getSurfaces(); Iterator it = surfaces.iterator(); while (it.hasNext()) { Surface s = (Surface)it.next(); rightValuesData.add(new ValueHolder(s.getId(), s.getName())); } } else if (rsname.equals(ELEMENTS)) { Collection elements = cs.getElements(); Iterator it = elements.iterator(); while (it.hasNext()) { Element e = (Element)it.next(); rightValuesData.add(new ValueHolder(e.getId(), e.getName())); } } } else if (lsname.equals(ELEMENTS)) { ElementFacade ef = ElementFacade.getInstance(); Element e = ef.findById(lsvalue.getId()); if (rsname.equals(SURFACES)) { Collection surfaces = e.getSurfaces(); Iterator it = surfaces.iterator(); while (it.hasNext()) { Surface s = (Surface)it.next(); rightValuesData.add(new ValueHolder(s.getId(), s.getName())); } } else if (rsname.equals(PARTS)) { Collection elements = e.getParts(); Iterator it = elements.iterator(); while (it.hasNext()) { Part p = (Part)it.next(); rightValuesData.add(new ValueHolder(p.getId(), p.getName())); } } } else if (lsname.equals(PARTS)) { PartFacade pf = PartFacade.getInstance(); Part p = pf.findById(lsvalue.getId()); if (rsname.equals(SURFACES)) { Collection surfaces = p.getSurfaces(); Iterator it = surfaces.iterator(); while (it.hasNext()) { Surface s = (Surface)it.next(); rightValuesData.add(new ValueHolder(s.getId(), s.getName())); } } } } rightValues.setListData(rightValuesData); last = current; } } } /** * Detach action */ class DetachAction implements ActionListener { /** The left selector */ private JComboBox leftSelector; /** The left values */ private JList leftValues; /** The right selector */ private JComboBox rightSelector; /** The right values */ private JList rightValues; /** The frame */ private JFrame frame; /** * Constructor * @param leftSelector The left selector * @param leftValues The left list * @param rightSelector The right selector * @param rightValues The right list * @param frame The frame */ DetachAction(JComboBox leftSelector, JList leftValues, JComboBox rightSelector, JList rightValues, JFrame frame) { this.leftSelector = leftSelector; this.leftValues = leftValues; this.rightSelector = rightSelector; this.rightValues = rightValues; this.frame = frame; } /** * Action performed * @param event The event */ public void actionPerformed(ActionEvent event) { String lsname = (String)leftSelector.getSelectedItem(); String rsname = (String)rightSelector.getSelectedItem(); ValueHolder lsvalue = (ValueHolder)leftValues.getSelectedValue(); ValueHolder rsvalue = (ValueHolder)rightValues.getSelectedValue(); if (lsvalue != null && rsvalue != null) { if (lsname.equals(FUNCTIONAL_SPACES)) { FunctionalSpaceFacade fsf = FunctionalSpaceFacade.getInstance(); FunctionalSpace fs = fsf.findById(lsvalue.getId()); if (rsname.equals(SURFACES)) { SurfaceFacade sf = SurfaceFacade.getInstance(); Surface s = sf.findById(rsvalue.getId()); fs.getSurfaces().remove(s); } else if (rsname.equals(ELEMENTS)) { ElementFacade ef = ElementFacade.getInstance(); Element e = ef.findById(rsvalue.getId()); fs.getElements().remove(e); } } else if (lsname.equals(CONSTRUCTION_SPACES)) { ConstructionSpaceFacade csf = ConstructionSpaceFacade.getInstance(); ConstructionSpace cs = csf.findById(lsvalue.getId()); if (rsname.equals(SURFACES)) { SurfaceFacade sf = SurfaceFacade.getInstance(); Surface s = sf.findById(rsvalue.getId()); cs.getSurfaces().remove(s); } else if (rsname.equals(ELEMENTS)) { ElementFacade ef = ElementFacade.getInstance(); Element e = ef.findById(rsvalue.getId()); cs.getElements().remove(e); } } else if (lsname.equals(ELEMENTS)) { ElementFacade ef = ElementFacade.getInstance(); Element e = ef.findById(lsvalue.getId()); if (rsname.equals(SURFACES)) { SurfaceFacade sf = SurfaceFacade.getInstance(); Surface s = sf.findById(rsvalue.getId()); e.getSurfaces().remove(s); } else if (rsname.equals(PARTS)) { PartFacade pf = PartFacade.getInstance(); Part p = pf.findById(rsvalue.getId()); e.getParts().remove(p); } } else if (lsname.equals(PARTS)) { PartFacade pf = PartFacade.getInstance(); Part p = pf.findById(lsvalue.getId()); if (rsname.equals(SURFACES)) { SurfaceFacade sf = SurfaceFacade.getInstance(); Surface s = sf.findById(rsvalue.getId()); p.getSurfaces().remove(s); } } } if (log.isDebugEnabled()) { log.debug("Detaching: " + rsvalue + " from " + lsvalue); } frame.dispose(); } } /** * Value holder class */ class ValueHolder { /** The id */ private Long id; /** The name */ private String name; /** * Constructor * @param id The id * @param name The name */ ValueHolder(Long id, String name) { this.id = id; this.name = name; } /** * Get the id * @return The id */ Long getId() { return id; } /** * Get the name * @return The name */ String getName() { return name; } /** * String representation * @return The representation */ public String toString() { return name; } } } |
From: Jesper P. <je...@us...> - 2005-07-11 08:42:10
|
Update of /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui/actions In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22609 Added Files: ToolsJoinActionListener.java Log Message: Initial import --- NEW FILE: ToolsJoinActionListener.java --- //--------------------------------------------------------------------------------- // $Id: ToolsJoinActionListener.java,v 1.1 2005/07/11 08:41:59 jews Exp $ // // Copyright (c) 2005 The BProcessor Team (http://bprocessor.sourceforge.net) // Released under the Lesser GNU Public License v2.1 //--------------------------------------------------------------------------------- package net.sourceforge.bprocessor.gui.actions; import net.sourceforge.bprocessor.model.ConstructionSpace; import net.sourceforge.bprocessor.model.ConstructionSpaceFacade; import net.sourceforge.bprocessor.model.Element; import net.sourceforge.bprocessor.model.ElementFacade; import net.sourceforge.bprocessor.model.FunctionalSpace; import net.sourceforge.bprocessor.model.FunctionalSpaceFacade; import net.sourceforge.bprocessor.model.Part; import net.sourceforge.bprocessor.model.PartFacade; import net.sourceforge.bprocessor.model.Surface; import net.sourceforge.bprocessor.model.SurfaceFacade; import java.awt.BorderLayout; import java.awt.GridLayout; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.ItemEvent; import java.awt.event.ItemListener; import java.util.Collection; import java.util.Iterator; import java.util.Vector; import javax.swing.JButton; import javax.swing.JComboBox; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JList; import javax.swing.JPanel; import javax.swing.JScrollPane; import org.apache.log4j.Logger; /** * The tools->join action listener */ public class ToolsJoinActionListener implements ActionListener { /** The logger */ private static Logger log = Logger.getLogger(ToolsJoinActionListener.class); /** Functional spaces constant */ private static final String FUNCTIONAL_SPACES = "Functional spaces"; /** Construction spaces constant */ private static final String CONSTRUCTION_SPACES = "Construction spaces"; /** Surfaces constant */ private static final String SURFACES = "Surfaces"; /** Elements constant */ private static final String ELEMENTS = "Elements"; /** Parts constant */ private static final String PARTS = "Parts"; /** * ToolsJoinActionListener */ public ToolsJoinActionListener() { } /** * Action performed * @param e The action event */ public void actionPerformed(ActionEvent e) { final JFrame frame = new JFrame("Join"); final JComboBox leftSelector = new JComboBox(); final JList leftValues = new JList(); final JComboBox rightSelector = new JComboBox(); final JList rightValues = new JList(); leftSelector.addItem(SURFACES); leftSelector.addItem(ELEMENTS); leftSelector.addItem(PARTS); leftSelector.addItemListener(new LeftSelectorListener(leftSelector, leftValues, rightSelector)); Vector leftValuesData = new Vector(); SurfaceFacade sf = SurfaceFacade.getInstance(); Collection surfaces = sf.findAll(); Iterator it = surfaces.iterator(); while (it.hasNext()) { Surface s = (Surface)it.next(); leftValuesData.add(new ValueHolder(s.getId(), s.getName())); } leftValues.setListData(leftValuesData); JLabel l = new JLabel("->"); rightSelector.addItem(FUNCTIONAL_SPACES); rightSelector.addItem(CONSTRUCTION_SPACES); rightSelector.addItem(ELEMENTS); rightSelector.addItem(PARTS); rightSelector.addItemListener(new RightSelectorListener(rightSelector, rightValues)); Vector rightValuesData = new Vector(); FunctionalSpaceFacade fsf = FunctionalSpaceFacade.getInstance(); Collection fss = fsf.findAll(); it = fss.iterator(); while (it.hasNext()) { FunctionalSpace fs = (FunctionalSpace)it.next(); rightValuesData.add(new ValueHolder(fs.getId(), fs.getName())); } rightValues.setListData(rightValuesData); JButton ok = new JButton("Ok"); ok.addActionListener(new JoinAction(leftSelector, leftValues, rightSelector, rightValues, frame)); JButton cancel = new JButton("Cancel"); cancel.addActionListener(new ActionListener() { /** * Action performed * @param event The event */ public void actionPerformed(ActionEvent event) { frame.dispose(); } }); frame.getContentPane().setLayout(new GridLayout(3, 3)); JPanel p1 = new JPanel(); p1.setLayout(new BorderLayout()); p1.add(leftSelector, BorderLayout.SOUTH); frame.getContentPane().add(p1); frame.getContentPane().add(new JLabel("")); JPanel p2 = new JPanel(); p2.setLayout(new BorderLayout()); p2.add(rightSelector, BorderLayout.SOUTH); frame.getContentPane().add(p2); frame.getContentPane().add(new JScrollPane(leftValues), BorderLayout.CENTER); frame.getContentPane().add(l); frame.getContentPane().add(new JScrollPane(rightValues), BorderLayout.CENTER); JPanel p3 = new JPanel(); p3.setLayout(new BorderLayout()); p3.add(ok, BorderLayout.SOUTH); frame.getContentPane().add(p3); frame.getContentPane().add(new JLabel("")); JPanel p4 = new JPanel(); p4.setLayout(new BorderLayout()); p4.add(cancel, BorderLayout.SOUTH); frame.getContentPane().add(p4); frame.setSize(600, 400); frame.show(); } /** * Left selector listener */ class LeftSelectorListener implements ItemListener { /** The left selector */ private JComboBox leftSelector; /** The left values */ private JList leftValues; /** The right selector */ private JComboBox rightSelector; /** Last value */ private String last; /** * Constructor * @param leftSelector The left selector * @param leftValues The left list * @param rightSelector The right selector */ LeftSelectorListener(JComboBox leftSelector, JList leftValues, JComboBox rightSelector) { this.leftSelector = leftSelector; this.leftValues = leftValues; this.rightSelector = rightSelector; } /** * Item state changed * @param event The event */ public void itemStateChanged(ItemEvent event) { String current = (String)leftSelector.getSelectedItem(); if (!current.equals(last)) { Vector leftValuesData = new Vector(); if (current.equals(SURFACES)) { SurfaceFacade sf = SurfaceFacade.getInstance(); Collection surfaces = sf.findAll(); Iterator it = surfaces.iterator(); while (it.hasNext()) { Surface s = (Surface)it.next(); leftValuesData.add(new ValueHolder(s.getId(), s.getName())); } rightSelector.removeAllItems(); rightSelector.addItem(FUNCTIONAL_SPACES); rightSelector.addItem(CONSTRUCTION_SPACES); rightSelector.addItem(ELEMENTS); rightSelector.addItem(PARTS); } else if (current.equals(ELEMENTS)) { ElementFacade ef = ElementFacade.getInstance(); Collection elements = ef.findAll(); Iterator it = elements.iterator(); while (it.hasNext()) { Element e = (Element)it.next(); leftValuesData.add(new ValueHolder(e.getId(), e.getName())); } rightSelector.removeAllItems(); rightSelector.addItem(FUNCTIONAL_SPACES); rightSelector.addItem(CONSTRUCTION_SPACES); } else if (current.equals(PARTS)) { PartFacade pf = PartFacade.getInstance(); Collection parts = pf.findAll(); Iterator it = parts.iterator(); while (it.hasNext()) { Part p = (Part)it.next(); leftValuesData.add(new ValueHolder(p.getId(), p.getName())); } rightSelector.removeAllItems(); rightSelector.addItem(ELEMENTS); } leftValues.setListData(leftValuesData); last = current; } } } /** * Right selector listener */ class RightSelectorListener implements ItemListener { /** The right selector */ private JComboBox rightSelector; /** The right values */ private JList rightValues; /** Last value */ private String last; /** * Constructor * @param rightSelector The right selector * @param rightValues The right list */ RightSelectorListener(JComboBox rightSelector, JList rightValues) { this.rightSelector = rightSelector; this.rightValues = rightValues; } /** * Item state changed * @param event The event */ public void itemStateChanged(ItemEvent event) { String current = (String)rightSelector.getSelectedItem(); if (current != null && !current.equals(last)) { Vector rightValuesData = new Vector(); if (current.equals(FUNCTIONAL_SPACES)) { FunctionalSpaceFacade fsf = FunctionalSpaceFacade.getInstance(); Collection fss = fsf.findAll(); Iterator it = fss.iterator(); while (it.hasNext()) { FunctionalSpace fs = (FunctionalSpace)it.next(); rightValuesData.add(new ValueHolder(fs.getId(), fs.getName())); } } else if (current.equals(CONSTRUCTION_SPACES)) { ConstructionSpaceFacade csf = ConstructionSpaceFacade.getInstance(); Collection css = csf.findAll(); Iterator it = css.iterator(); while (it.hasNext()) { ConstructionSpace cs = (ConstructionSpace)it.next(); rightValuesData.add(new ValueHolder(cs.getId(), cs.getName())); } } else if (current.equals(ELEMENTS)) { ElementFacade ef = ElementFacade.getInstance(); Collection elements = ef.findAll(); Iterator it = elements.iterator(); while (it.hasNext()) { Element e = (Element)it.next(); rightValuesData.add(new ValueHolder(e.getId(), e.getName())); } } else if (current.equals(PARTS)) { PartFacade pf = PartFacade.getInstance(); Collection parts = pf.findAll(); Iterator it = parts.iterator(); while (it.hasNext()) { Part p = (Part)it.next(); rightValuesData.add(new ValueHolder(p.getId(), p.getName())); } } rightValues.setListData(rightValuesData); last = current; } } } /** * Join action */ class JoinAction implements ActionListener { /** The left selector */ private JComboBox leftSelector; /** The left values */ private JList leftValues; /** The right selector */ private JComboBox rightSelector; /** The right values */ private JList rightValues; /** The frame */ private JFrame frame; /** * Constructor * @param leftSelector The left selector * @param leftValues The left list * @param rightSelector The right selector * @param rightValues The right list * @param frame The frame */ JoinAction(JComboBox leftSelector, JList leftValues, JComboBox rightSelector, JList rightValues, JFrame frame) { this.leftSelector = leftSelector; this.leftValues = leftValues; this.rightSelector = rightSelector; this.rightValues = rightValues; this.frame = frame; } /** * Action performed * @param event The event */ public void actionPerformed(ActionEvent event) { String lsname = (String)leftSelector.getSelectedItem(); String rsname = (String)rightSelector.getSelectedItem(); ValueHolder lsvalue = (ValueHolder)leftValues.getSelectedValue(); ValueHolder rsvalue = (ValueHolder)rightValues.getSelectedValue(); if (lsvalue != null && rsvalue != null) { if (lsname.equals(SURFACES)) { SurfaceFacade sf = SurfaceFacade.getInstance(); Surface s = sf.findById(lsvalue.getId()); if (rsname.equals(FUNCTIONAL_SPACES)) { FunctionalSpaceFacade fsf = FunctionalSpaceFacade.getInstance(); FunctionalSpace fs = fsf.findById(rsvalue.getId()); fs.getSurfaces().add(s); } else if (rsname.equals(CONSTRUCTION_SPACES)) { ConstructionSpaceFacade csf = ConstructionSpaceFacade.getInstance(); ConstructionSpace cs = csf.findById(rsvalue.getId()); cs.getSurfaces().add(s); } else if (rsname.equals(ELEMENTS)) { ElementFacade ef = ElementFacade.getInstance(); Element e = ef.findById(rsvalue.getId()); e.getSurfaces().add(s); } else if (rsname.equals(PARTS)) { PartFacade pf = PartFacade.getInstance(); Part p = pf.findById(rsvalue.getId()); p.getSurfaces().add(s); } } else if (lsname.equals(ELEMENTS)) { ElementFacade ef = ElementFacade.getInstance(); Element e = ef.findById(lsvalue.getId()); if (rsname.equals(FUNCTIONAL_SPACES)) { FunctionalSpaceFacade fsf = FunctionalSpaceFacade.getInstance(); FunctionalSpace fs = fsf.findById(rsvalue.getId()); fs.getElements().add(e); } else if (rsname.equals(CONSTRUCTION_SPACES)) { ConstructionSpaceFacade csf = ConstructionSpaceFacade.getInstance(); ConstructionSpace cs = csf.findById(rsvalue.getId()); cs.getElements().add(e); } } else if (lsname.equals(PARTS)) { PartFacade pf = PartFacade.getInstance(); Part p = pf.findById(lsvalue.getId()); if (rsname.equals(ELEMENTS)) { ElementFacade ef = ElementFacade.getInstance(); Element e = ef.findById(rsvalue.getId()); e.getParts().add(p); } } } if (log.isDebugEnabled()) { log.debug("Joining: " + lsvalue + " with " + rsvalue); } frame.dispose(); } } /** * Value holder class */ class ValueHolder { /** The id */ private Long id; /** The name */ private String name; /** * Constructor * @param id The id * @param name The name */ ValueHolder(Long id, String name) { this.id = id; this.name = name; } /** * Get the id * @return The id */ Long getId() { return id; } /** * Get the name * @return The name */ String getName() { return name; } /** * String representation * @return The representation */ public String toString() { return name; } } } |
From: Jesper P. <je...@us...> - 2005-07-11 08:41:36
|
Update of /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22322 Modified Files: GUI.java Log Message: Enable elements and parts. Changed panel to a component Index: GUI.java =================================================================== RCS file: /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui/GUI.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** GUI.java 1 Jul 2005 11:26:57 -0000 1.3 --- GUI.java 11 Jul 2005 08:41:23 -0000 1.4 *************** *** 14,17 **** --- 14,19 ---- import net.sourceforge.bprocessor.gui.actions.CreateSurfaceActionListener; import net.sourceforge.bprocessor.gui.actions.FileExitActionListener; + import net.sourceforge.bprocessor.gui.actions.ToolsDetachActionListener; + import net.sourceforge.bprocessor.gui.actions.ToolsJoinActionListener; import net.sourceforge.bprocessor.gui.attrview.AttributeView; import net.sourceforge.bprocessor.gui.treeview.SpacesTreeView; *************** *** 19,24 **** import java.awt.BorderLayout; import java.awt.event.KeyEvent; - import javax.swing.JComponent; import javax.swing.JFrame; import javax.swing.JMenu; --- 21,26 ---- import java.awt.BorderLayout; + import java.awt.Component; import java.awt.event.KeyEvent; import javax.swing.JFrame; import javax.swing.JMenu; *************** *** 184,188 **** createElement.setMnemonic(KeyEvent.VK_E); createElement.addActionListener(new CreateElementActionListener()); - createElement.setEnabled(false); create.add(createElement); --- 186,189 ---- *************** *** 190,194 **** createPart.setMnemonic(KeyEvent.VK_P); createPart.addActionListener(new CreatePartActionListener()); - createPart.setEnabled(false); create.add(createPart); --- 191,194 ---- *************** *** 206,215 **** JMenuItem toolsJoin = new JMenuItem("Join"); toolsJoin.setMnemonic(KeyEvent.VK_J); ! toolsJoin.setEnabled(false); tools.add(toolsJoin); JMenuItem toolsDetach = new JMenuItem("Detach"); toolsDetach.setMnemonic(KeyEvent.VK_D); ! toolsDetach.setEnabled(false); tools.add(toolsDetach); --- 206,215 ---- JMenuItem toolsJoin = new JMenuItem("Join"); toolsJoin.setMnemonic(KeyEvent.VK_J); ! toolsJoin.addActionListener(new ToolsJoinActionListener()); tools.add(toolsJoin); JMenuItem toolsDetach = new JMenuItem("Detach"); toolsDetach.setMnemonic(KeyEvent.VK_D); ! toolsDetach.addActionListener(new ToolsDetachActionListener()); tools.add(toolsDetach); *************** *** 284,288 **** * @param placement The panel placement */ ! public void registerPanel(JComponent panel, Integer placement) { if (placement.equals(SPLIT_LEFT)) { splitPaneLeftRight.remove(1); --- 284,288 ---- * @param placement The panel placement */ ! public void registerPanel(Component panel, Integer placement) { if (placement.equals(SPLIT_LEFT)) { splitPaneLeftRight.remove(1); *************** *** 290,294 **** } else if (placement.equals(SPLIT_MIDDLE)) { splitPaneMiddleRight.remove(1); ! splitPaneMiddleRight.setLeftComponent(new JScrollPane(panel)); } else { splitPaneMiddleRight.remove(2); --- 290,294 ---- } else if (placement.equals(SPLIT_MIDDLE)) { splitPaneMiddleRight.remove(1); ! splitPaneMiddleRight.setLeftComponent(panel); } else { splitPaneMiddleRight.remove(2); |
From: Jesper P. <je...@us...> - 2005-07-11 08:40:48
|
Update of /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui/actions In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21852 Modified Files: CreateElementActionListener.java CreatePartActionListener.java Log Message: Generate notification Index: CreatePartActionListener.java =================================================================== RCS file: /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui/actions/CreatePartActionListener.java,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** CreatePartActionListener.java 27 Jun 2005 09:32:23 -0000 1.1.1.1 --- CreatePartActionListener.java 11 Jul 2005 08:40:21 -0000 1.2 *************** *** 7,10 **** --- 7,12 ---- package net.sourceforge.bprocessor.gui.actions; + import net.sourceforge.bprocessor.kernel.notification.Notification; + import net.sourceforge.bprocessor.kernel.notification.Notifier; import net.sourceforge.bprocessor.gui.GUI; import net.sourceforge.bprocessor.model.Part; *************** *** 48,51 **** --- 50,56 ---- pf.add(p); + + Notification n = new Notification(Notification.PART_CREATED, p.getId()); + Notifier.getInstance().sendNotification(n); } } Index: CreateElementActionListener.java =================================================================== RCS file: /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui/actions/CreateElementActionListener.java,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** CreateElementActionListener.java 27 Jun 2005 09:32:23 -0000 1.1.1.1 --- CreateElementActionListener.java 11 Jul 2005 08:40:21 -0000 1.2 *************** *** 7,10 **** --- 7,12 ---- package net.sourceforge.bprocessor.gui.actions; + import net.sourceforge.bprocessor.kernel.notification.Notification; + import net.sourceforge.bprocessor.kernel.notification.Notifier; import net.sourceforge.bprocessor.gui.GUI; import net.sourceforge.bprocessor.model.Element; *************** *** 48,51 **** --- 50,56 ---- ef.add(el); + + Notification n = new Notification(Notification.ELEMENT_CREATED, el.getId()); + Notifier.getInstance().sendNotification(n); } } |
From: Jesper P. <je...@us...> - 2005-07-11 08:39:42
|
Update of /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui/attrview In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21470 Modified Files: AttributeView.java Log Message: Added support for elements and parts Index: AttributeView.java =================================================================== RCS file: /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui/attrview/AttributeView.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** AttributeView.java 5 Jul 2005 09:41:34 -0000 1.3 --- AttributeView.java 11 Jul 2005 08:39:32 -0000 1.4 *************** *** 11,15 **** --- 11,17 ---- import net.sourceforge.bprocessor.kernel.notification.Notifier; import net.sourceforge.bprocessor.model.ConstructionSpaceFacade; + import net.sourceforge.bprocessor.model.ElementFacade; import net.sourceforge.bprocessor.model.FunctionalSpaceFacade; + import net.sourceforge.bprocessor.model.PartFacade; import net.sourceforge.bprocessor.model.SurfaceFacade; *************** *** 79,82 **** --- 81,100 ---- repaint(); + } else if (type.equals(Notification.ELEMENT_SELECTED)) { + ElementFacade ef = ElementFacade.getInstance(); + + current = ef.findById(n.getObject()); + + ap.display(current); + + repaint(); + } else if (type.equals(Notification.PART_SELECTED)) { + PartFacade pf = PartFacade.getInstance(); + + current = pf.findById(n.getObject()); + + ap.display(current); + + repaint(); } else if (type.equals(Notification.SURFACE_SELECTED)) { SurfaceFacade sf = SurfaceFacade.getInstance(); *************** *** 98,101 **** --- 116,121 ---- if (type.equals(Notification.FUNCTIONAL_SPACE_SELECTED) || type.equals(Notification.CONSTRUCTION_SPACE_SELECTED) || + type.equals(Notification.ELEMENT_SELECTED) || + type.equals(Notification.PART_SELECTED) || type.equals(Notification.SURFACE_SELECTED)) { return true; |
From: Jesper P. <je...@us...> - 2005-07-05 09:41:43
|
Update of /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui/attrview In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8042/src/net/sourceforge/bprocessor/gui/attrview Modified Files: AttributeView.java Log Message: Use variable current to retrieve attribute info Index: AttributeView.java =================================================================== RCS file: /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui/attrview/AttributeView.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** AttributeView.java 1 Jul 2005 11:26:12 -0000 1.2 --- AttributeView.java 5 Jul 2005 09:41:34 -0000 1.3 *************** *** 128,132 **** List components = new ArrayList(); ! Method[] methods = d.getClass().getMethods(); for (int i = 0; i < methods.length; i++) { Method m = methods[i]; --- 128,132 ---- List components = new ArrayList(); ! Method[] methods = current.getClass().getMethods(); for (int i = 0; i < methods.length; i++) { Method m = methods[i]; *************** *** 136,140 **** if (returnTypeSupported(m.getReturnType())) { try { ! components.add(new JLabel(m.invoke(d, (Object[])null).toString())); if (name.length() > 4) { names.add(new JLabel(name.substring(3, 4).toUpperCase() + name.substring(4))); --- 136,140 ---- if (returnTypeSupported(m.getReturnType())) { try { ! components.add(new JLabel(m.invoke(current, (Object[])null).toString())); if (name.length() > 4) { names.add(new JLabel(name.substring(3, 4).toUpperCase() + name.substring(4))); |
From: Jesper P. <je...@us...> - 2005-07-01 11:30:10
|
Update of /cvsroot/bprocessor/kernel/src/net/sourceforge/bprocessor/kernel/notification In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6445 Modified Files: Notifier.java Log Message: Added debug statements Index: Notifier.java =================================================================== RCS file: /cvsroot/bprocessor/kernel/src/net/sourceforge/bprocessor/kernel/notification/Notifier.java,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** Notifier.java 27 Jun 2005 09:12:30 -0000 1.1.1.1 --- Notifier.java 1 Jul 2005 11:30:00 -0000 1.2 *************** *** 49,52 **** --- 49,55 ---- */ public synchronized void addListener(NotificationListener l) { + if (log.isDebugEnabled()) { + log.debug("Adding: " + l); + } listeners.add(l); } *************** *** 57,60 **** --- 60,66 ---- */ public synchronized void removeListener(NotificationListener l) { + if (log.isDebugEnabled()) { + log.debug("Removing: " + l); + } listeners.remove(l); } *************** *** 65,68 **** --- 71,77 ---- */ public synchronized void sendNotification(Notification n) { + if (log.isDebugEnabled()) { + log.debug("Sending: " + n); + } Iterator it = listeners.iterator(); while (it.hasNext()) { |
From: Jesper P. <je...@us...> - 2005-07-01 11:29:49
|
Update of /cvsroot/bprocessor/kernel/src/net/sourceforge/bprocessor/kernel/notification In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6321 Modified Files: Notification.java Log Message: Added keys for surface Index: Notification.java =================================================================== RCS file: /cvsroot/bprocessor/kernel/src/net/sourceforge/bprocessor/kernel/notification/Notification.java,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** Notification.java 27 Jun 2005 09:12:30 -0000 1.1.1.1 --- Notification.java 1 Jul 2005 11:29:38 -0000 1.2 *************** *** 46,49 **** --- 46,64 ---- public static final String CONSTRUCTION_SPACE_MODIFIED = "constructionspace.modified"; + /** Surface created */ + public static final String SURFACE_CREATED = "surface.created"; + + /** Surface deleted */ + public static final String SURFACE_DELETED = "surface.deleted"; + + /** Surface renamed */ + public static final String SURFACE_RENAMED = "surface.renamed"; + + /** Surface selected */ + public static final String SURFACE_SELECTED = "surface.selected"; + + /** Surface modified */ + public static final String SURFACE_MODIFIED = "surface.modified"; + /** The type */ private String type; |
From: Jesper P. <je...@us...> - 2005-07-01 11:29:08
|
Update of /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui/actions In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5972 Modified Files: CreateSurfaceActionListener.java Log Message: Send notification when creating Index: CreateSurfaceActionListener.java =================================================================== RCS file: /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui/actions/CreateSurfaceActionListener.java,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** CreateSurfaceActionListener.java 27 Jun 2005 09:32:23 -0000 1.1.1.1 --- CreateSurfaceActionListener.java 1 Jul 2005 11:29:00 -0000 1.2 *************** *** 7,10 **** --- 7,12 ---- package net.sourceforge.bprocessor.gui.actions; + import net.sourceforge.bprocessor.kernel.notification.Notification; + import net.sourceforge.bprocessor.kernel.notification.Notifier; import net.sourceforge.bprocessor.gui.GUI; import net.sourceforge.bprocessor.model.Surface; *************** *** 48,51 **** --- 50,56 ---- sf.add(s); + + Notification n = new Notification(Notification.SURFACE_CREATED, s.getId()); + Notifier.getInstance().sendNotification(n); } } |
From: Jesper P. <je...@us...> - 2005-07-01 11:28:11
|
Update of /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui/treeview In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5343 Added Files: SurfacesTreeView.java Log Message: Initial import --- NEW FILE: SurfacesTreeView.java --- //--------------------------------------------------------------------------------- // $Id: SurfacesTreeView.java,v 1.1 2005/07/01 11:28:01 jews Exp $ // // Copyright (c) 2005 The BProcessor Team (http://bprocessor.sourceforge.net) // Released under the Lesser GNU Public License v2.1 //--------------------------------------------------------------------------------- package net.sourceforge.bprocessor.gui.treeview; import net.sourceforge.bprocessor.kernel.notification.Notification; 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; import java.awt.event.MouseListener; import java.util.ArrayList; import java.util.Enumeration; import java.util.Iterator; import java.util.List; import java.util.Vector; import javax.swing.event.TreeModelEvent; import javax.swing.event.TreeModelListener; import javax.swing.tree.TreeModel; import javax.swing.tree.TreeNode; import javax.swing.tree.TreePath; import org.apache.log4j.Logger; /** * The surfaces tree view */ public class SurfacesTreeView extends TreeView implements NotificationListener { /** The logger */ private static Logger log = Logger.getLogger(SurfacesTreeView.class); /** * Constructor */ public SurfacesTreeView() { super(); setModel(new SurfaceModel()); addMouseListener(new MouseAdaptor()); Notifier.getInstance().addListener(this); } /** * Handle a notification * @param n The notification */ public void handleNotification(Notification n) { if (log.isDebugEnabled()) { log.debug(n); } String type = n.getType(); if (type.equals(Notification.SURFACE_CREATED)) { SurfaceFacade sf = SurfaceFacade.getInstance(); Surface s = sf.findById(n.getObject()); RootNode rn = (RootNode)getModel().getRoot(); SurfaceNode sn = new SurfaceNode(n.getObject(), s.getName(), rn); rn.add(sn); TreePath tp = new TreePath(new Object[] {rn}); getModel().valueForPathChanged(tp, sn); } } /** * Should the listener handle this notification * @param type The notification type * @return True if it should handle it; otherwise false */ public boolean isNotificationEnabled(String type) { if (type.equals(Notification.SURFACE_CREATED) || type.equals(Notification.SURFACE_DELETED) || type.equals(Notification.SURFACE_RENAMED) || type.equals(Notification.SURFACE_SELECTED) || type.equals(Notification.SURFACE_MODIFIED)) { return true; } return false; } /** * The surface model */ class SurfaceModel implements TreeModel { /** The tree listeners */ private List listeners; /** The root */ private RootNode root; /** * Constructor */ SurfaceModel() { this.listeners = new ArrayList(); this.root = new RootNode(); } /** * Adds a tree model listener * @param l The listener */ public void addTreeModelListener(TreeModelListener l) { listeners.add(l); } /** * Removes a tree model listener * @param l The listener */ public void removeTreeModelListener(TreeModelListener l) { listeners.remove(l); } /** * Get the child of a parent * @param parent The parent * @param index The child index * @return The child */ public Object getChild(Object parent, int index) { TreeNode n = root.findNode(parent); if (n != null) { if (index < n.getChildCount()) { return n.getChildAt(index); } } return null; } /** * Get the child count of a parent * @param parent The parent * @return The child count */ public int getChildCount(Object parent) { TreeNode n = root.findNode(parent); if (n != null) { return n.getChildCount(); } return 0; } /** * Get the index of the child * @param parent The parent * @param child The child * @return The index */ public int getIndexOfChild(Object parent, Object child) { TreeNode n = root.findNode(parent); if (n != null) { return n.getIndex((TreeNode)child); } return -1; } /** * Get the root of the model * @return The root */ public Object getRoot() { return root; } /** * Is the node a leaf * @param node The node * @return True if leaf; otherwise false */ public boolean isLeaf(Object node) { TreeNode n = root.findNode(node); if (n != null) { return n.isLeaf(); } return true; } /** * The value for a path has changed * @param path The path * @param newValue The new value */ public void valueForPathChanged(TreePath path, Object newValue) { Iterator it = listeners.iterator(); TreeModelEvent e = new TreeModelEvent(newValue, path); while (it.hasNext()) { TreeModelListener l = (TreeModelListener)it.next(); l.treeStructureChanged(e); } } } /** * Generic node */ abstract class GenericNode implements TreeNode { /** Type: Root */ static final int TYPE_ROOT = 0; /** Type: Surface */ static final int TYPE_SURFACE = 1; /** Type */ private int type; /** * Constructor * @param type The type */ GenericNode(int type) { this.type = type; } /** * Get the children of this node * @return The children */ public abstract Enumeration children(); /** * Does this node allow children * @return True for yes; otherwise false */ public abstract boolean getAllowsChildren(); /** * Get the child at a given position * @param childIndex The index * @return The child node */ public abstract TreeNode getChildAt(int childIndex); /** * Get the child count * @return The count */ public abstract int getChildCount(); /** * Get the index of a node * @param node The node * @return The index */ public abstract int getIndex(TreeNode node); /** * Get the parent of this node * @return The parent */ public abstract TreeNode getParent(); /** * Is this node a leaf ? * @return True if leaf; otherwise false */ public abstract boolean isLeaf(); /** * Find a node * @param o The object * @return The node or null if not found */ public GenericNode findNode(Object o) { if (this == o) { return this; } Enumeration e = children(); while (e.hasMoreElements()) { GenericNode gn = (GenericNode)e.nextElement(); GenericNode result = gn.findNode(o); if (result != null) { return result; } } return null; } /** * Get the type of the node * @return The type */ public int getType() { return type; } } /** * Root node */ class RootNode extends GenericNode { /** Surface nodes */ private Vector nodes; /** * Constructor */ RootNode() { super(GenericNode.TYPE_ROOT); this.nodes = new Vector(); } /** * Add a surface * @param s The surface */ public void add(SurfaceNode s) { nodes.add(s); } /** * Remove a surface * @param s The surface */ public void remove(SurfaceNode s) { nodes.remove(s); } /** * Get the children of this node * @return The children */ public Enumeration children() { return nodes.elements(); } /** * Does this node allow children * @return True for yes; otherwise false */ public boolean getAllowsChildren() { return true; } /** * Get the child at a given position * @param childIndex The index * @return The child node */ public TreeNode getChildAt(int childIndex) { return (TreeNode)nodes.elementAt(childIndex); } /** * Get the child count * @return The count */ public int getChildCount() { return nodes.size(); } /** * Get the index of a node * @param node The node * @return The index */ public int getIndex(TreeNode node) { return nodes.indexOf(node); } /** * Get the parent of this node * @return The parent */ public TreeNode getParent() { return null; } /** * Is this node a leaf ? * @return True if leaf; otherwise false */ public boolean isLeaf() { return false; } /** * String representation * @return The representation */ public String toString() { return "Surfaces"; } } /** * Surface node */ class SurfaceNode extends GenericNode { /** The object id */ private Long id; /** The name */ private String name; /** The parent */ private RootNode parent; /** Surface nodes */ private Vector nodes; /** * Constructor * @param id The id of the object * @param name The name * @param parent The parent */ SurfaceNode(Long id, String name, RootNode parent) { super(GenericNode.TYPE_SURFACE); this.id = id; this.name = name; this.parent = parent; this.nodes = new Vector(); } /** * Get the id * @return The id */ public Long getId() { return id; } /** * Get the name * @return The name */ public String getName() { return name; } /** * Set the name * @param name The name */ public void setName(String name) { this.name = name; } /** * Get the children of this node * @return The children */ public Enumeration children() { return nodes.elements(); } /** * Does this node allow children * @return True for yes; otherwise false */ public boolean getAllowsChildren() { return true; } /** * Get the child at a given position * @param childIndex The index * @return The child node */ public TreeNode getChildAt(int childIndex) { return (TreeNode)nodes.elementAt(childIndex); } /** * Get the child count * @return The count */ public int getChildCount() { return nodes.size(); } /** * Get the index of a node * @param node The node * @return The index */ public int getIndex(TreeNode node) { return nodes.indexOf(node); } /** * Get the parent of this node * @return The parent */ public TreeNode getParent() { return parent; } /** * Is this node a leaf ? * @return True if leaf; otherwise false */ public boolean isLeaf() { return false; } /** * String representation * @return The representation */ public String toString() { return getName(); } } /** * Mouse adaptor */ class MouseAdaptor implements MouseListener { /** * Mouse clicked * @param e The mouse event */ public void mouseClicked(MouseEvent e) { } /** * Mouse button was pressed * @param e The mouse event */ public void mousePressed(MouseEvent e) { int selRow = getRowForLocation(e.getX(), e.getY()); TreePath selPath = getPathForLocation(e.getX(), e.getY()); if (selRow != -1) { GenericNode gn = (GenericNode)selPath.getLastPathComponent(); if (gn.getType() == GenericNode.TYPE_SURFACE) { SurfaceNode sn = (SurfaceNode)gn; Notification n = new Notification(Notification.SURFACE_SELECTED, sn.getId()); Notifier.getInstance().sendNotification(n); } } } /** * Mouse button was released * @param e The mouse event */ public void mouseReleased(MouseEvent e) { } /** * Mouse exit * @param e The mouse event */ public void mouseExited(MouseEvent e) { } /** * Mouse enter * @param e The mouse event */ public void mouseEntered(MouseEvent e) { } } } |
From: Jesper P. <je...@us...> - 2005-07-01 11:27:08
|
Update of /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4890 Modified Files: GUI.java Log Message: Added support for Surfaces Index: GUI.java =================================================================== RCS file: /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui/GUI.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** GUI.java 1 Jul 2005 06:40:16 -0000 1.2 --- GUI.java 1 Jul 2005 11:26:57 -0000 1.3 *************** *** 16,19 **** --- 16,20 ---- import net.sourceforge.bprocessor.gui.attrview.AttributeView; import net.sourceforge.bprocessor.gui.treeview.SpacesTreeView; + import net.sourceforge.bprocessor.gui.treeview.SurfacesTreeView; import java.awt.BorderLayout; *************** *** 195,199 **** createSurface.setMnemonic(KeyEvent.VK_S); createSurface.addActionListener(new CreateSurfaceActionListener()); - createSurface.setEnabled(false); create.add(createSurface); --- 196,199 ---- *************** *** 271,274 **** --- 271,275 ---- JTabbedPane tp = new JTabbedPane(JTabbedPane.TOP); tp.addTab("Spaces", new SpacesTreeView()); + tp.addTab("Surfaces", new SurfacesTreeView()); registerPanel(tp, SPLIT_LEFT); |
From: Jesper P. <je...@us...> - 2005-07-01 11:26:24
|
Update of /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui/attrview In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4465 Modified Files: AttributeView.java Log Message: Added support for Surfaces Index: AttributeView.java =================================================================== RCS file: /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui/attrview/AttributeView.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** AttributeView.java 1 Jul 2005 06:43:38 -0000 1.1 --- AttributeView.java 1 Jul 2005 11:26:12 -0000 1.2 *************** *** 11,16 **** import net.sourceforge.bprocessor.kernel.notification.Notifier; import net.sourceforge.bprocessor.model.ConstructionSpaceFacade; - import net.sourceforge.bprocessor.model.Domain; import net.sourceforge.bprocessor.model.FunctionalSpaceFacade; import java.awt.GridLayout; --- 11,16 ---- import net.sourceforge.bprocessor.kernel.notification.Notifier; import net.sourceforge.bprocessor.model.ConstructionSpaceFacade; import net.sourceforge.bprocessor.model.FunctionalSpaceFacade; + import net.sourceforge.bprocessor.model.SurfaceFacade; import java.awt.GridLayout; *************** *** 36,40 **** /** Current object */ ! private Domain current; /** --- 36,40 ---- /** Current object */ ! private Object current; /** *************** *** 79,82 **** --- 79,90 ---- repaint(); + } else if (type.equals(Notification.SURFACE_SELECTED)) { + SurfaceFacade sf = SurfaceFacade.getInstance(); + + current = sf.findById(n.getObject()); + + ap.display(current); + + repaint(); } } *************** *** 89,93 **** public boolean isNotificationEnabled(String type) { if (type.equals(Notification.FUNCTIONAL_SPACE_SELECTED) || ! type.equals(Notification.CONSTRUCTION_SPACE_SELECTED)) { return true; } --- 97,102 ---- public boolean isNotificationEnabled(String type) { if (type.equals(Notification.FUNCTIONAL_SPACE_SELECTED) || ! type.equals(Notification.CONSTRUCTION_SPACE_SELECTED) || ! type.equals(Notification.SURFACE_SELECTED)) { return true; } *************** *** 99,104 **** */ class AttributesPanel extends JPanel { ! /** Current domain */ ! private Domain current; /** --- 108,113 ---- */ class AttributesPanel extends JPanel { ! /** Current object */ ! private Object current; /** *************** *** 110,118 **** /** ! * Display the domain ! * @param d The domain */ ! void display(Domain d) { ! current = d; List names = new ArrayList(); --- 119,127 ---- /** ! * Display the object ! * @param o The object */ ! void display(Object o) { ! current = o; List names = new ArrayList(); |
From: Jesper P. <je...@us...> - 2005-07-01 06:43:47
|
Update of /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui/attrview In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26505 Added Files: AttributeView.java package.html Log Message: Initial import --- NEW FILE: package.html --- <body> This package defines functionality to show attributes for an object </body> --- NEW FILE: AttributeView.java --- //--------------------------------------------------------------------------------- // $Id: AttributeView.java,v 1.1 2005/07/01 06:43:38 jews Exp $ // // Copyright (c) 2005 The BProcessor Team (http://bprocessor.sourceforge.net) // Released under the Lesser GNU Public License v2.1 //--------------------------------------------------------------------------------- package net.sourceforge.bprocessor.gui.attrview; import net.sourceforge.bprocessor.kernel.notification.Notification; import net.sourceforge.bprocessor.kernel.notification.NotificationListener; import net.sourceforge.bprocessor.kernel.notification.Notifier; import net.sourceforge.bprocessor.model.ConstructionSpaceFacade; import net.sourceforge.bprocessor.model.Domain; import net.sourceforge.bprocessor.model.FunctionalSpaceFacade; import java.awt.GridLayout; import java.lang.reflect.Method; import java.util.ArrayList; import java.util.List; import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.JTabbedPane; import org.apache.log4j.Logger; /** * The attribute view */ public class AttributeView extends JTabbedPane implements NotificationListener { /** The logger */ private static Logger log = Logger.getLogger(AttributeView.class); /** The attributes panel */ private AttributesPanel ap; /** Current object */ private Domain current; /** * Constructor */ public AttributeView() { super(); ap = new AttributesPanel(); addTab("Attributes", ap); current = null; Notifier.getInstance().addListener(this); } /** * Handle a notification * @param n The notification */ public void handleNotification(Notification n) { if (log.isDebugEnabled()) { log.debug(n); } String type = n.getType(); if (type.equals(Notification.FUNCTIONAL_SPACE_SELECTED)) { FunctionalSpaceFacade fsf = FunctionalSpaceFacade.getInstance(); current = fsf.findById(n.getObject()); ap.display(current); repaint(); } else if (type.equals(Notification.CONSTRUCTION_SPACE_SELECTED)) { ConstructionSpaceFacade csf = ConstructionSpaceFacade.getInstance(); current = csf.findById(n.getObject()); ap.display(current); repaint(); } } /** * Should the listener handle this notification * @param type The notification type * @return True if it should handle it; otherwise false */ public boolean isNotificationEnabled(String type) { if (type.equals(Notification.FUNCTIONAL_SPACE_SELECTED) || type.equals(Notification.CONSTRUCTION_SPACE_SELECTED)) { return true; } return false; } /** * Attributes panel */ class AttributesPanel extends JPanel { /** Current domain */ private Domain current; /** * Constructor */ AttributesPanel() { current = null; } /** * Display the domain * @param d The domain */ void display(Domain d) { current = d; List names = new ArrayList(); List components = new ArrayList(); Method[] methods = d.getClass().getMethods(); for (int i = 0; i < methods.length; i++) { Method m = methods[i]; String name = m.getName(); if (name.startsWith("get")) { if (!name.endsWith("Id") && !name.endsWith("Class")) { if (returnTypeSupported(m.getReturnType())) { try { components.add(new JLabel(m.invoke(d, (Object[])null).toString())); if (name.length() > 4) { names.add(new JLabel(name.substring(3, 4).toUpperCase() + name.substring(4))); } else { names.add(new JLabel(name.substring(3, 4).toUpperCase())); } } catch (Exception e) { // Cant be accessed } } } } } removeAll(); setLayout(new GridLayout(names.size(), 2)); for (int i = 0; i < names.size(); i++) { add((JLabel)names.get(i)); add((JLabel)components.get(i)); } } /** * Return type supported * @param c The class for the return type * @return True if supported; otherwise false */ private boolean returnTypeSupported(Class c) { String n = c.getName(); if (n.equals("java.lang.String") || n.equals("java.lang.Integer") || n.equals("java.lang.Double") || n.equals("java.lang.Float") || n.equals("java.lang.Short") || n.equals("java.lang.Boolean") || n.equals("java.lang.Byte") || n.equals("java.lang.Long") || n.equals(Integer.TYPE.getName()) || n.equals(Double.TYPE.getName()) || n.equals(Float.TYPE.getName()) || n.equals(Short.TYPE.getName()) || n.equals(Boolean.TYPE.getName()) || n.equals(Byte.TYPE.getName()) || n.equals(Long.TYPE.getName())) { return true; } return false; } } } |