Update of /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui/treeview
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9443/src/net/sourceforge/bprocessor/gui/treeview
Modified Files:
SpacesTreeView.java SurfacesTreeView.java
Log Message:
Add basic support for DESELECTED notifications from the mouse
Index: SurfacesTreeView.java
===================================================================
RCS file: /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui/treeview/SurfacesTreeView.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** SurfacesTreeView.java 13 Sep 2005 17:24:22 -0000 1.5
--- SurfacesTreeView.java 22 Sep 2005 12:25:31 -0000 1.6
***************
*** 541,544 ****
--- 541,546 ----
*/
class MouseAdaptor implements MouseListener {
+ /** The selected node */
+ private GenericNode gn;
/**
***************
*** 555,561 ****
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;
--- 557,574 ----
public void mousePressed(MouseEvent e) {
int selRow = getRowForLocation(e.getX(), e.getY());
if (selRow != -1) {
! TreePath selPath = getPathForLocation(e.getX(), e.getY());
!
! if (gn != null) {
! if (gn.getType() == GenericNode.TYPE_SURFACE) {
! SurfaceNode sn = (SurfaceNode)gn;
!
! Notification n = new Notification(Notification.SURFACE_DESELECTED, sn.getId());
! Notifier.getInstance().sendNotification(n);
! }
! }
!
! gn = (GenericNode)selPath.getLastPathComponent();
!
if (gn.getType() == GenericNode.TYPE_SURFACE) {
SurfaceNode sn = (SurfaceNode)gn;
Index: SpacesTreeView.java
===================================================================
RCS file: /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui/treeview/SpacesTreeView.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** SpacesTreeView.java 13 Sep 2005 17:45:05 -0000 1.5
--- SpacesTreeView.java 22 Sep 2005 12:25:31 -0000 1.6
***************
*** 1515,1518 ****
--- 1515,1520 ----
*/
class MouseAdaptor implements MouseListener {
+ /** The selected node */
+ private GenericNode gn;
/**
***************
*** 1529,1535 ****
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_SPACE) {
SpaceNode sn = (SpaceNode)gn;
--- 1531,1563 ----
public void mousePressed(MouseEvent e) {
int selRow = getRowForLocation(e.getX(), e.getY());
if (selRow != -1) {
! TreePath selPath = getPathForLocation(e.getX(), e.getY());
!
! if (gn != null) {
! if (gn.getType() == GenericNode.TYPE_SPACE) {
! SpaceNode sn = (SpaceNode)gn;
!
! if (sn.isFunctional()) {
! Notification n =
! new Notification(Notification.FUNCTIONAL_SPACE_DESELECTED, sn.getId());
! Notifier.getInstance().sendNotification(n);
! } else {
! Notification n =
! new Notification(Notification.CONSTRUCTION_SPACE_DESELECTED, sn.getId());
! Notifier.getInstance().sendNotification(n);
! }
! } else if (gn.getType() == GenericNode.TYPE_ELEMENT) {
! Notification n = new Notification(Notification.ELEMENT_DESELECTED, gn.getId());
! Notifier.getInstance().sendNotification(n);
! } else if (gn.getType() == GenericNode.TYPE_PART) {
! Notification n = new Notification(Notification.PART_DESELECTED, gn.getId());
! Notifier.getInstance().sendNotification(n);
! } else if (gn.getType() == GenericNode.TYPE_SURFACE) {
! Notification n = new Notification(Notification.SURFACE_DESELECTED, gn.getId());
! Notifier.getInstance().sendNotification(n);
! }
! }
!
! gn = (GenericNode)selPath.getLastPathComponent();
if (gn.getType() == GenericNode.TYPE_SPACE) {
SpaceNode sn = (SpaceNode)gn;
|