Update of /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui/treeview
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25204/src/net/sourceforge/bprocessor/gui/treeview
Modified Files:
GenericTreeView.java
Log Message:
Selection refactored. Selection is now a special observable collection. Views responds to changed in the selection.
Index: GenericTreeView.java
===================================================================
RCS file: /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui/treeview/GenericTreeView.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** GenericTreeView.java 4 Jan 2006 14:29:55 -0000 1.5
--- GenericTreeView.java 6 Jan 2006 15:36:19 -0000 1.6
***************
*** 18,27 ****
import javax.swing.tree.TreePath;
- import net.sourceforge.bprocessor.kernel.notification.Notification;
- import net.sourceforge.bprocessor.kernel.notification.Notifier;
import net.sourceforge.bprocessor.model.Edge;
import net.sourceforge.bprocessor.model.Entity;
import net.sourceforge.bprocessor.model.Observer;
import net.sourceforge.bprocessor.model.Project;
import net.sourceforge.bprocessor.model.Space;
import net.sourceforge.bprocessor.model.Surface;
--- 18,26 ----
import javax.swing.tree.TreePath;
import net.sourceforge.bprocessor.model.Edge;
import net.sourceforge.bprocessor.model.Entity;
import net.sourceforge.bprocessor.model.Observer;
import net.sourceforge.bprocessor.model.Project;
+ import net.sourceforge.bprocessor.model.Selection;
import net.sourceforge.bprocessor.model.Space;
import net.sourceforge.bprocessor.model.Surface;
***************
*** 102,142 ****
*/
public void select(Object target) {
! if (selection != null) {
! if (selection instanceof Space) {
! Space space = (Space) selection;
! if (space.isFunctionalSpace()) {
! Notification n =
! new Notification(Notification.FUNCTIONAL_SPACE_DESELECTED, space.getId());
! Notifier.getInstance().sendNotification(n);
! } else {
! Notification n =
! new Notification(Notification.CONSTRUCTION_SPACE_DESELECTED, space.getId());
! Notifier.getInstance().sendNotification(n);
! }
! } else if (selection instanceof Surface) {
! Surface surface = (Surface) selection;
! Notification n = new Notification(Notification.SURFACE_DESELECTED, surface.getId());
! Notifier.getInstance().sendNotification(n);
! }
! }
! selection = target;
! if (selection != null) {
! if (selection instanceof Space) {
! Space space = (Space) selection;
! if (space.isFunctionalSpace()) {
! Notification n =
! new Notification(Notification.FUNCTIONAL_SPACE_SELECTED, space.getId());
! Notifier.getInstance().sendNotification(n);
! } else {
! Notification n =
! new Notification(Notification.CONSTRUCTION_SPACE_SELECTED, space.getId());
! Notifier.getInstance().sendNotification(n);
! }
! } else if (selection instanceof Surface) {
! Surface surface = (Surface) selection;
! Notification n = new Notification(Notification.SURFACE_SELECTED, surface.getId());
! Notifier.getInstance().sendNotification(n);
! }
! }
}
--- 101,105 ----
*/
public void select(Object target) {
! Selection.primary().set(target);
}
|