Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32293/src/net/sourceforge/bprocessor/gl
Modified Files:
GLView.java
Log Message:
Added notification handler, to update view on events.
Index: GLView.java
===================================================================
RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/GLView.java,v
retrieving revision 1.24
retrieving revision 1.25
diff -C2 -d -r1.24 -r1.25
*** GLView.java 20 Nov 2005 19:33:52 -0000 1.24
--- GLView.java 21 Nov 2005 09:50:51 -0000 1.25
***************
*** 42,46 ****
* The 3D display
*/
! public class GLView implements MouseListener {
/** The logger */
private static Logger log = Logger.getLogger(GLView.class);
--- 42,46 ----
* The 3D display
*/
! public class GLView implements MouseListener, NotificationListener {
/** The logger */
private static Logger log = Logger.getLogger(GLView.class);
***************
*** 63,66 ****
--- 63,67 ----
public GLView() {
log.info("Using JOGL version " + Version.getVersion());
+ Notifier.getInstance().addListener(this);
GLCapabilities glCap = new GLCapabilities();
glCap.setDoubleBuffered(true);
***************
*** 313,315 ****
--- 314,345 ----
}
+
+ /**
+ * Handle a notification
+ * @param n The notification
+ */
+ public void handleNotification(Notification n) {
+ 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_CREATED) ||
+ type.equals(Notification.FUNCTIONAL_SPACE_DELETED) ||
+ type.equals(Notification.FUNCTIONAL_SPACE_SELECTED) ||
+ type.equals(Notification.FUNCTIONAL_SPACE_DESELECTED) ||
+ type.equals(Notification.FUNCTIONAL_SPACE_MODIFIED) ||
+ type.equals(Notification.CONSTRUCTION_SPACE_CREATED) ||
+ type.equals(Notification.CONSTRUCTION_SPACE_DELETED) ||
+ type.equals(Notification.CONSTRUCTION_SPACE_SELECTED) ||
+ type.equals(Notification.CONSTRUCTION_SPACE_DESELECTED) ||
+ type.equals(Notification.CONSTRUCTION_SPACE_MODIFIED)) {
+ return true;
+ }
+ return false;
+ }
}
|