[Bprocessor-commit] gui/src/net/sourceforge/bprocessor/gui/treeview SurfacesTreeView.java,1.4,1.5
Status: Pre-Alpha
Brought to you by:
henryml
From: Nordholt <nor...@us...> - 2005-09-13 17:24:30
|
Update of /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui/treeview In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16262 Modified Files: SurfacesTreeView.java Log Message: added backin code to show surfaces in tree Index: SurfacesTreeView.java =================================================================== RCS file: /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui/treeview/SurfacesTreeView.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** SurfacesTreeView.java 12 Sep 2005 18:15:13 -0000 1.4 --- SurfacesTreeView.java 13 Sep 2005 17:24:22 -0000 1.5 *************** *** 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.Surface; ! import net.sourceforge.bprocessor.model.SurfaceFacade; import java.awt.event.MouseEvent; *************** *** 60,80 **** if (type.equals(Notification.SURFACE_CREATED)) { ! /* ! commenting this code out to prevent exceptions raised by the ! "findById" call. It works, but I honestly dont know why! ! My guess is the id of the surface created(the one in the notification) ! can be a surface that is not yet ! in the database, thus causing findById to fail. ! ! 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); ! */ } else if (type.equals(Notification.SURFACE_DELETED)) { Long deletedId = n.getObject(); --- 60,69 ---- 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); ! rn.add(sn); ! TreePath tp = new TreePath(new Object[] {rn}); ! getModel().valueForPathChanged(tp, sn); } else if (type.equals(Notification.SURFACE_DELETED)) { Long deletedId = n.getObject(); |