15a16,17 > import CH.ifa.draw.util.CollectionsFactory; > 16a19 > import java.util.List; 39a43,49 > /** > * A tool can have a drawing view on which it operates > * independingly of the currently active drawing view. > * For example, if a tool can be used > */ > private DrawingView myDrawingView; > 62c72 < * Activates the tool for the given view. This method is called --- > * Activates the tool for use on the given view. This method is called 65,66c75,78 < * Since tools will be disabled unless they are useable, there will always < * be an active view when this method is called. based on isUsable() --- > * Since tools will be disabled unless it is useable, there will always > * be an active view when this is called. based on isUsable() > * Tool should never be activated if the view is null. > * Ideally, the dditor should take care of that. 69,71c81,83 < if (view() != null) { < view().clearSelection(); < view().checkDamage(); --- > if (getActiveView() != null) { > getActiveView().clearSelection(); > getActiveView().checkDamage(); 80a93 > * An inactive tool should never be deactivated 84,85c97,98 < if (view() != null) { < view().setCursor(Cursor.getDefaultCursor()); --- > if (getActiveView() != null) { > getActiveView().setCursor(Cursor.getDefaultCursor()); 122a136 > setView((DrawingView)e.getSource()); 134a149,152 > // setView(null);//This must be fixed!!! the view should not be held onto after mouse up?? > //unlike super.mousedown which is usually called immediately after a sub classes mouse down > //method starts, super.mouseup should probably be called last before the method ends? > //it must if its going to set the view to null. getting messy. 155a174,177 > public Drawing getActiveDrawing() { > return getActiveView().drawing(); > } > 162a185,188 > protected void setEditor(DrawingEditor newDrawingEditor) { > myDrawingEditor = newDrawingEditor; > } > 166a193,200 > return myDrawingView; > } > > protected void setView(DrawingView newDrawingView) { > myDrawingView = newDrawingView; > } > > public DrawingView getActiveView() { 259c293 < setUsable((view() != null) && view().isInteractive()); --- > setUsable((getActiveView() != null) && getActiveView().isInteractive()); 264c298 < private Vector myRegisteredListeners; --- > private List myRegisteredListeners; 268c302 < myRegisteredListeners = new Vector(); --- > myRegisteredListeners = CollectionsFactory.current().createList(); 273,275c307,309 < Enumeration le = myRegisteredListeners.elements(); < while (le.hasMoreElements()) { < ((ToolListener)le.nextElement()).toolUsable(new EventObject(myObservedTool)); --- > Iterator iter = myRegisteredListeners.iterator(); > while (iter.hasNext()) { > ((ToolListener)iter.next()).toolUsable(new EventObject(myObservedTool)); 280,282c314,316 < Enumeration le = myRegisteredListeners.elements(); < while (le.hasMoreElements()) { < ((ToolListener)le.nextElement()).toolUnusable(new EventObject(myObservedTool)); --- > Iterator iter = myRegisteredListeners.iterator(); > while (iter.hasNext()) { > ((ToolListener)iter.next()).toolUnusable(new EventObject(myObservedTool)); 287,289c321,323 < Enumeration le = myRegisteredListeners.elements(); < while (le.hasMoreElements()) { < ((ToolListener)le.nextElement()).toolActivated(new EventObject(myObservedTool)); --- > Iterator iter = myRegisteredListeners.iterator(); > while (iter.hasNext()) { > ((ToolListener)iter.next()).toolActivated(new EventObject(myObservedTool)); 294,296c328,330 < Enumeration le = myRegisteredListeners.elements(); < while (le.hasMoreElements()) { < ((ToolListener)le.nextElement()).toolDeactivated(new EventObject(myObservedTool)); --- > Iterator iter = myRegisteredListeners.iterator(); > while (iter.hasNext()) { > ((ToolListener)iter.next()).toolDeactivated(new EventObject(myObservedTool)); 301,303c335,337 < Enumeration le = myRegisteredListeners.elements(); < while (le.hasMoreElements()) { < ((ToolListener)le.nextElement()).toolEnabled(new EventObject(myObservedTool)); --- > Iterator iter = myRegisteredListeners.iterator(); > while (iter.hasNext()) { > ((ToolListener)iter.next()).toolEnabled(new EventObject(myObservedTool)); 308,310c342,344 < Enumeration le = myRegisteredListeners.elements(); < while (le.hasMoreElements()) { < ((ToolListener)le.nextElement()).toolDisabled(new EventObject(myObservedTool)); --- > Iterator iter = myRegisteredListeners.iterator(); > while (iter.hasNext()) { > ((ToolListener)iter.next()).toolDisabled(new EventObject(myObservedTool));