diff options
-rw-r--r-- | src/classes/share/javax/media/j3d/SoundScheduler.java | 4 | ||||
-rw-r--r-- | src/classes/share/javax/media/j3d/View.java | 23 | ||||
-rw-r--r-- | src/classes/share/javax/media/j3d/VirtualUniverse.java | 78 |
3 files changed, 42 insertions, 63 deletions
diff --git a/src/classes/share/javax/media/j3d/SoundScheduler.java b/src/classes/share/javax/media/j3d/SoundScheduler.java index c66a3ff..4d71162 100644 --- a/src/classes/share/javax/media/j3d/SoundScheduler.java +++ b/src/classes/share/javax/media/j3d/SoundScheduler.java @@ -1056,9 +1056,9 @@ class SoundScheduler extends J3dStructure { nRetainedSounds++; } // XXXX: sync canvases - Enumeration canvases = view.getAllCanvas3Ds(); + Enumeration<Canvas3D> canvases = view.getAllCanvas3Ds(); while (canvases.hasMoreElements()) { - Canvas3D canvas = (Canvas3D)canvases.nextElement(); + Canvas3D canvas = canvases.nextElement(); GraphicsContext3D graphicsContext = canvas.getGraphicsContext3D(); Enumeration nonretainedSounds = graphicsContext.getAllSounds(); while (nonretainedSounds.hasMoreElements()) { diff --git a/src/classes/share/javax/media/j3d/View.java b/src/classes/share/javax/media/j3d/View.java index edbf680..18d58b8 100644 --- a/src/classes/share/javax/media/j3d/View.java +++ b/src/classes/share/javax/media/j3d/View.java @@ -703,7 +703,7 @@ public class View extends Object { // window upper left corner location in pixels relative to screen // // Use getCanvases() to access this - private Vector canvases = new Vector(3); +private Vector<Canvas3D> canvases = new Vector<Canvas3D>(3); // // The current universe associated with this view @@ -1135,7 +1135,7 @@ public class View extends Object { // CYCLOPEAN_EYE_VIEW mode then throw exception. synchronized (canvasList) { for (int i=canvases.size()-1; i>=0; i--) { - Canvas3D c3d = (Canvas3D)canvases.elementAt(i); + Canvas3D c3d = canvases.elementAt(i); if ((c3d.monoscopicViewPolicy == View.CYCLOPEAN_EYE_VIEW) && (!c3d.useStereo)){ @@ -2151,7 +2151,7 @@ public class View extends Object { synchronized(canvasList) { if (canvas3D.getView() != null) throw new IllegalSharingException(J3dI18N.getString("View10")); - cv = (Canvas3D) canvases.elementAt(index); + cv = canvases.elementAt(index); canvases.setElementAt(canvas3D, index); removeFromCanvasList(cv); addToCanvasList(canvas3D); @@ -2183,7 +2183,7 @@ public class View extends Object { * Gets the enumeration object of all the Canvas3Ds. * @return the enumeration object of all the Canvas3Ds. */ - public Enumeration getAllCanvas3Ds(){ + public Enumeration<Canvas3D> getAllCanvas3Ds(){ return canvases.elements(); } @@ -2286,7 +2286,7 @@ public class View extends Object { Canvas3D cv; synchronized(canvasList) { - cv = (Canvas3D) canvases.elementAt(index); + cv = canvases.elementAt(index); canvases.removeElementAt(index); removeFromCanvasList(cv); @@ -2440,7 +2440,7 @@ public class View extends Object { Canvas3D newCachedCanvases[] = new Canvas3D[len]; for (int i=0; i < len; i++) { - newCachedCanvases[i] = (Canvas3D) canvases.get(i); + newCachedCanvases[i] = canvases.get(i); } // Do this in one instruction so there is no need to // synchronized getCanvases() @@ -2915,7 +2915,7 @@ public class View extends Object { if (inCanvasCallback) { synchronized (canvasList) { for (int i=canvases.size()-1; i>=0; i--) { - if (((Canvas3D)canvases.elementAt(i)).screen.renderer == me) { + if (canvases.elementAt(i).screen.renderer == me) { throw new IllegalStateException(J3dI18N.getString(s1)); } } @@ -3007,7 +3007,7 @@ public class View extends Object { Thread me = Thread.currentThread(); synchronized (canvasList) { for (int i= canvases.size()-1; i>=0; i--) { - Canvas3D cv = (Canvas3D)canvases.elementAt(i); + Canvas3D cv = canvases.elementAt(i); if (cv.screen.renderer == me) { throw new IllegalStateException(J3dI18N.getString(s1)); @@ -3142,8 +3142,7 @@ public class View extends Object { synchronized (canvasList) { int i = canvases.size()-1; while (i>=0) { - Screen3D scr = - ((Canvas3D)canvases.elementAt(i--)).getScreen3D(); + Screen3D scr = canvases.elementAt(i--).getScreen3D(); if (scr != null) scr.updateViewCache(); } @@ -3196,7 +3195,7 @@ public class View extends Object { synchronized (canvasList) { for (i=canvases.size()-1; i>=0; i--) { - Canvas3D cv = (Canvas3D)canvases.elementAt(i); + Canvas3D cv = canvases.elementAt(i); if (cv.active) { if (!activeStatus && (universeCount > resetUnivCount)) { @@ -3377,7 +3376,7 @@ public class View extends Object { void reset() { for (int i=0; i < canvases.size(); i++) { - ((Canvas3D) canvases.get(i)).reset(); + canvases.get(i).reset(); } // reset the renderBinReady flag diff --git a/src/classes/share/javax/media/j3d/VirtualUniverse.java b/src/classes/share/javax/media/j3d/VirtualUniverse.java index b8fd79a..d5c395c 100644 --- a/src/classes/share/javax/media/j3d/VirtualUniverse.java +++ b/src/classes/share/javax/media/j3d/VirtualUniverse.java @@ -728,8 +728,6 @@ synchronized ViewPlatformRetained[] getViewPlatformList() { } void disableFocusEvents() { - Enumeration cvs; - Canvas3D cv; ViewPlatformRetained vp; View views[]; ViewPlatformRetained[] vps = getViewPlatformList(); @@ -740,9 +738,9 @@ synchronized ViewPlatformRetained[] getViewPlatformList() { vp = vps[i]; views = vp.getViewList(); for (int j=views.length-1; j>=0; j--) { - cvs = views[j].getAllCanvas3Ds(); + Enumeration<Canvas3D> cvs = views[j].getAllCanvas3Ds(); while(cvs.hasMoreElements()) { - cv = (Canvas3D) cvs.nextElement(); + Canvas3D cv = cvs.nextElement(); // offscreen canvas does not have event catcher if (cv.eventCatcher != null) cv.eventCatcher.disableFocusEvents(); @@ -754,8 +752,6 @@ synchronized ViewPlatformRetained[] getViewPlatformList() { } void enableFocusEvents() { - Enumeration cvs; - Canvas3D cv; ViewPlatformRetained vp; View views[]; ViewPlatformRetained[] vps = getViewPlatformList(); @@ -766,9 +762,9 @@ synchronized ViewPlatformRetained[] getViewPlatformList() { vp = vps[i]; views = vp.getViewList(); for (int j=views.length-1; j>=0; j--) { - cvs = views[j].getAllCanvas3Ds(); + Enumeration<Canvas3D> cvs = views[j].getAllCanvas3Ds(); while(cvs.hasMoreElements()) { - cv = (Canvas3D) cvs.nextElement(); + Canvas3D cv = cvs.nextElement(); // offscreen canvas does not have event catcher if (cv.eventCatcher != null) cv.eventCatcher.enableFocusEvents(); @@ -780,8 +776,6 @@ synchronized ViewPlatformRetained[] getViewPlatformList() { void disableKeyEvents() { - Enumeration cvs; - Canvas3D cv; ViewPlatformRetained vp; ViewPlatformRetained[] vps = getViewPlatformList(); View views[]; @@ -793,9 +787,9 @@ synchronized ViewPlatformRetained[] getViewPlatformList() { vp = vps[i]; views = vp.getViewList(); for (int j=views.length-1; j>=0; j--) { - cvs = views[j].getAllCanvas3Ds(); + Enumeration<Canvas3D> cvs = views[j].getAllCanvas3Ds(); while(cvs.hasMoreElements()) { - cv = (Canvas3D) cvs.nextElement(); + Canvas3D cv = cvs.nextElement(); // offscreen canvas does not have event catcher if (cv.eventCatcher != null) cv.eventCatcher.disableKeyEvents(); @@ -807,8 +801,6 @@ synchronized ViewPlatformRetained[] getViewPlatformList() { void enableKeyEvents() { - Enumeration cvs; - Canvas3D cv; ViewPlatformRetained vp; ViewPlatformRetained[] vps = getViewPlatformList(); View views[]; @@ -820,9 +812,9 @@ synchronized ViewPlatformRetained[] getViewPlatformList() { vp = vps[i]; views = vp.getViewList(); for (int j=views.length-1; j>=0; j--) { - cvs = views[j].getAllCanvas3Ds(); + Enumeration<Canvas3D> cvs = views[j].getAllCanvas3Ds(); while(cvs.hasMoreElements()) { - cv = (Canvas3D) cvs.nextElement(); + Canvas3D cv = cvs.nextElement(); // offscreen canvas does not have event catcher if (cv.eventCatcher != null) cv.eventCatcher.enableKeyEvents(); @@ -834,8 +826,6 @@ synchronized ViewPlatformRetained[] getViewPlatformList() { void disableMouseEvents() { - Enumeration cvs; - Canvas3D cv; View views[]; ViewPlatformRetained vp; ViewPlatformRetained[] vps = getViewPlatformList(); @@ -847,9 +837,9 @@ synchronized ViewPlatformRetained[] getViewPlatformList() { vp = vps[i]; views = vp.getViewList(); for (int j=views.length-1; j>=0; j--) { - cvs = views[j].getAllCanvas3Ds(); + Enumeration<Canvas3D> cvs = views[j].getAllCanvas3Ds(); while(cvs.hasMoreElements()) { - cv = (Canvas3D) cvs.nextElement(); + Canvas3D cv = cvs.nextElement(); // offscreen canvas does not have event catcher if (cv.eventCatcher != null) cv.eventCatcher.disableMouseEvents(); @@ -860,8 +850,6 @@ synchronized ViewPlatformRetained[] getViewPlatformList() { } void enableMouseEvents() { - Enumeration cvs; - Canvas3D cv; View views[]; ViewPlatformRetained vp; ViewPlatformRetained[] vps = getViewPlatformList(); @@ -873,9 +861,9 @@ synchronized ViewPlatformRetained[] getViewPlatformList() { vp = vps[i]; views = vp.getViewList(); for (int j=views.length-1; j>=0; j--) { - cvs = views[j].getAllCanvas3Ds(); + Enumeration<Canvas3D> cvs = views[j].getAllCanvas3Ds(); while(cvs.hasMoreElements()) { - cv = (Canvas3D) cvs.nextElement(); + Canvas3D cv = cvs.nextElement(); // offscreen canvas does not have event catcher if (cv.eventCatcher != null) cv.eventCatcher.enableMouseEvents(); @@ -887,8 +875,6 @@ synchronized ViewPlatformRetained[] getViewPlatformList() { void disableMouseMotionEvents() { - Enumeration cvs; - Canvas3D cv; View views[]; ViewPlatformRetained vp; ViewPlatformRetained[] vps = getViewPlatformList(); @@ -900,9 +886,9 @@ synchronized ViewPlatformRetained[] getViewPlatformList() { vp = vps[i]; views = vp.getViewList(); for (int j=views.length-1; j>=0; j--) { - cvs = views[j].getAllCanvas3Ds(); + Enumeration<Canvas3D> cvs = views[j].getAllCanvas3Ds(); while(cvs.hasMoreElements()) { - cv = (Canvas3D) cvs.nextElement(); + Canvas3D cv = cvs.nextElement(); // offscreen canvas does not have event catcher if (cv.eventCatcher != null) cv.eventCatcher.disableMouseMotionEvents(); @@ -913,8 +899,6 @@ synchronized ViewPlatformRetained[] getViewPlatformList() { } void enableMouseMotionEvents() { - Enumeration cvs; - Canvas3D cv; View views[]; ViewPlatformRetained vp; ViewPlatformRetained[] vps = getViewPlatformList(); @@ -926,9 +910,9 @@ synchronized ViewPlatformRetained[] getViewPlatformList() { vp = vps[i]; views = vp.getViewList(); for (int j=views.length-1; j>=0; j--) { - cvs = views[j].getAllCanvas3Ds(); + Enumeration<Canvas3D> cvs = views[j].getAllCanvas3Ds(); while(cvs.hasMoreElements()) { - cv = (Canvas3D) cvs.nextElement(); + Canvas3D cv = cvs.nextElement(); // offscreen canvas does not have event catcher if (cv.eventCatcher != null) cv.eventCatcher.enableMouseMotionEvents(); @@ -939,8 +923,6 @@ synchronized ViewPlatformRetained[] getViewPlatformList() { } void disableMouseWheelEvents() { - Enumeration cvs; - Canvas3D cv; View views[]; ViewPlatformRetained vp; ViewPlatformRetained[] vps = getViewPlatformList(); @@ -952,9 +934,9 @@ synchronized ViewPlatformRetained[] getViewPlatformList() { vp = vps[i]; views = vp.getViewList(); for (int j=views.length-1; j>=0; j--) { - cvs = views[j].getAllCanvas3Ds(); + Enumeration<Canvas3D> cvs = views[j].getAllCanvas3Ds(); while(cvs.hasMoreElements()) { - cv = (Canvas3D) cvs.nextElement(); + Canvas3D cv = cvs.nextElement(); // offscreen canvas does not have event catcher if (cv.eventCatcher != null) cv.eventCatcher.disableMouseWheelEvents(); @@ -965,8 +947,6 @@ synchronized ViewPlatformRetained[] getViewPlatformList() { } void enableMouseWheelEvents() { - Enumeration cvs; - Canvas3D cv; View views[]; ViewPlatformRetained vp; ViewPlatformRetained[] vps = getViewPlatformList(); @@ -978,9 +958,9 @@ synchronized ViewPlatformRetained[] getViewPlatformList() { vp = vps[i]; views = vp.getViewList(); for (int j=views.length-1; j>=0; j--) { - cvs = views[j].getAllCanvas3Ds(); + Enumeration<Canvas3D> cvs = views[j].getAllCanvas3Ds(); while(cvs.hasMoreElements()) { - cv = (Canvas3D) cvs.nextElement(); + Canvas3D cv = cvs.nextElement(); // offscreen canvas does not have event catcher if (cv.eventCatcher != null) cv.eventCatcher.enableMouseWheelEvents(); @@ -1079,9 +1059,9 @@ synchronized ViewPlatformRetained[] getViewPlatformList() { return; } - if (structureChangeListenerSet == null) { - structureChangeListenerSet = new HashSet(); - } + if (structureChangeListenerSet == null) { + structureChangeListenerSet = new HashSet<GraphStructureChangeListener>(); + } synchronized(structureChangeListenerSet) { structureChangeListenerSet.add(listener); @@ -1193,9 +1173,9 @@ synchronized ViewPlatformRetained[] getViewPlatformList() { return; } - if (shaderErrorListenerSet == null) { - shaderErrorListenerSet = new HashSet(); - } + if (shaderErrorListenerSet == null) { + shaderErrorListenerSet = new HashSet<ShaderErrorListener>(); + } synchronized(shaderErrorListenerSet) { shaderErrorListenerSet.add(listener); @@ -1281,9 +1261,9 @@ synchronized ViewPlatformRetained[] getViewPlatformList() { return; } - if (renderingErrorListenerSet == null) { - renderingErrorListenerSet = new HashSet(); - } + if (renderingErrorListenerSet == null) { + renderingErrorListenerSet = new HashSet<RenderingErrorListener>(); + } synchronized(renderingErrorListenerSet) { renderingErrorListenerSet.add(listener); |