diff options
author | Noel Grandin <noel@peralex.com> | 2012-09-07 10:23:54 +0200 |
---|---|---|
committer | Michael Stahl <mstahl@redhat.com> | 2012-09-10 23:43:38 +0200 |
commit | 0f1dba83596b5e8e19203892cb1334b6bbe8f147 (patch) | |
tree | 325c31fa8dae055097e2352b8de07e78643d26e0 /odk | |
parent | b89ae706c2b959dd41e821abc2efe1d4ba79de81 (diff) |
Java5 cleanup, cleanup Vector and ArrayList to use generics
Change-Id: I7c2a3346f5c089424377302e1029b6f6aa971d76
Diffstat (limited to 'odk')
5 files changed, 24 insertions, 24 deletions
diff --git a/odk/examples/DevelopersGuide/Accessibility/EventHandler.java b/odk/examples/DevelopersGuide/Accessibility/EventHandler.java index 3bfaa87cb3a8..852a9e8ed222 100644 --- a/odk/examples/DevelopersGuide/Accessibility/EventHandler.java +++ b/odk/examples/DevelopersGuide/Accessibility/EventHandler.java @@ -52,7 +52,7 @@ public class EventHandler mnTopWindowCount = 0; maListenerProxy = new EventListenerProxy (this); maConnectionTask = new ConnectionTask (maListenerProxy); - maObjectDisplays = new Vector (); + maObjectDisplays = new Vector<IAccessibleObjectDisplay> (); } public synchronized void addObjectDisplay (IAccessibleObjectDisplay aDisplay) @@ -148,7 +148,7 @@ public class EventHandler for (int i=0; i<maObjectDisplays.size(); i++) { IAccessibleObjectDisplay aDisplay = - (IAccessibleObjectDisplay)maObjectDisplays.get(i); + maObjectDisplays.get(i); if (aDisplay != null) aDisplay.setAccessibleObject (xContext); } @@ -179,7 +179,7 @@ public class EventHandler for (int i=0; i<maObjectDisplays.size(); i++) { IAccessibleObjectDisplay aDisplay = - (IAccessibleObjectDisplay)maObjectDisplays.get(i); + maObjectDisplays.get(i); if (aDisplay != null) aDisplay.setAccessibleObject (null); } @@ -285,7 +285,7 @@ public class EventHandler for (int i=0; i<maObjectDisplays.size(); i++) { IAccessibleObjectDisplay aDisplay = - (IAccessibleObjectDisplay)maObjectDisplays.get(i); + maObjectDisplays.get(i); if (aDisplay != null) aDisplay.updateAccessibleObject (mxFocusedObject); } @@ -437,7 +437,7 @@ public class EventHandler ways such as showing a graphical representation or some textual descriptions. */ - private Vector maObjectDisplays; + private Vector<IAccessibleObjectDisplay> maObjectDisplays; /** The timer task that attempts in regular intervals to connect to a running Office application. diff --git a/odk/examples/DevelopersGuide/Accessibility/EventListenerProxy.java b/odk/examples/DevelopersGuide/Accessibility/EventListenerProxy.java index 273f6146a6cc..77d85b9a79ec 100644 --- a/odk/examples/DevelopersGuide/Accessibility/EventListenerProxy.java +++ b/odk/examples/DevelopersGuide/Accessibility/EventListenerProxy.java @@ -66,7 +66,7 @@ class EventListenerProxy mbAsynchron = true; if (mbAsynchron) { - maEventQueue = new LinkedList(); + maEventQueue = new LinkedList<Runnable>(); new Thread (this, "EventListenerProxy").start(); } } @@ -105,7 +105,7 @@ class EventListenerProxy synchronized (maEventQueue) { if (maEventQueue.size() > 0) - aEvent = (Runnable)maEventQueue.removeFirst(); + aEvent = maEventQueue.removeFirst(); else aEvent = null; } @@ -174,7 +174,7 @@ class EventListenerProxy public void run() { maListener.windowOpened ( - (XAccessible) UnoRuntime.queryInterface( + UnoRuntime.queryInterface( XAccessible.class, aEvent.Source)); } @@ -192,7 +192,7 @@ class EventListenerProxy public void run() { maListener.windowClosed ( - (XAccessible) UnoRuntime.queryInterface( + UnoRuntime.queryInterface( XAccessible.class, aEvent.Source)); } @@ -219,7 +219,7 @@ class EventListenerProxy The queue object will also serve as lock for the consumer/producer type syncronization. */ - private LinkedList maEventQueue; + private LinkedList<Runnable> maEventQueue; /** This is the actual listener that the events will eventually forwarded to. */ diff --git a/odk/examples/DevelopersGuide/Accessibility/TextualDisplay.java b/odk/examples/DevelopersGuide/Accessibility/TextualDisplay.java index 02699e239d84..17e0021023f0 100644 --- a/odk/examples/DevelopersGuide/Accessibility/TextualDisplay.java +++ b/odk/examples/DevelopersGuide/Accessibility/TextualDisplay.java @@ -154,8 +154,8 @@ class TextualDisplay // Try to cast the given accessible context to the // XAccessibleComponent interface. XAccessibleComponent xComponent = - (XAccessibleComponent)UnoRuntime.queryInterface( - XAccessibleComponent.class, xContext); + UnoRuntime.queryInterface( + XAccessibleComponent.class, xContext); if (xComponent != null) { Point aLocation = xComponent.getLocationOnScreen(); @@ -179,7 +179,7 @@ class TextualDisplay private String showParents (XAccessibleContext xContext) { // Create the path from the given object to its tree's root. - Vector aPathToRoot = new Vector(); + Vector<XAccessibleContext> aPathToRoot = new Vector<XAccessibleContext>(); while (xContext != null) { aPathToRoot.add (xContext); @@ -203,7 +203,7 @@ class TextualDisplay String sIndentation = new String (); for (int i=aPathToRoot.size()-1; i>=0; i--) { - XAccessibleContext xParentContext = (XAccessibleContext)aPathToRoot.get(i); + XAccessibleContext xParentContext = aPathToRoot.get(i); String sParentName = xParentContext.getAccessibleName(); if (sParentName.length() == 0) sParentName = "<unnamed> / Role " diff --git a/odk/examples/DevelopersGuide/Forms/ButtonOperator.java b/odk/examples/DevelopersGuide/Forms/ButtonOperator.java index 3b792e28ea22..f88d5b662115 100644 --- a/odk/examples/DevelopersGuide/Forms/ButtonOperator.java +++ b/odk/examples/DevelopersGuide/Forms/ButtonOperator.java @@ -55,7 +55,7 @@ public class ButtonOperator implements XActionListener, XFeatureInvalidation private XPropertySet m_form; private XFormOperations m_formOperations; - private Vector m_aButtons; + private Vector<XPropertySet> m_aButtons; /* ------------------------------------------------------------------ */ /** ctor @@ -65,7 +65,7 @@ public class ButtonOperator implements XActionListener, XFeatureInvalidation m_componentContext = xCtx; m_aDocument = aDocument; m_form = _form; - m_aButtons = new Vector(); + m_aButtons = new Vector<XPropertySet>(); } /* ------------------------------------------------------------------ */ @@ -89,7 +89,7 @@ public class ButtonOperator implements XActionListener, XFeatureInvalidation { for ( int i=0; i < m_aButtons.size(); ++i ) { - XPropertySet button = (XPropertySet)m_aButtons.elementAt( i ); + XPropertySet button = m_aButtons.elementAt( i ); if ( _formFeature == getAssociatedFormFeature( button ) ) return button; } @@ -119,7 +119,7 @@ public class ButtonOperator implements XActionListener, XFeatureInvalidation DocumentViewHelper aCurrentView = m_aDocument.getCurrentView(); // add a listener so we get noticed if the user presses the button - XButton xButtonControl = (XButton)UnoRuntime.queryInterface( XButton.class, + XButton xButtonControl = UnoRuntime.queryInterface( XButton.class, aCurrentView.getFormControl( _buttonModel ) ); xButtonControl.addActionListener( this ); @@ -215,7 +215,7 @@ public class ButtonOperator implements XActionListener, XFeatureInvalidation { for ( int i=0; i < m_aButtons.size(); ++i ) { - XPropertySet buttonModel = (XPropertySet)m_aButtons.elementAt( i ); + XPropertySet buttonModel = m_aButtons.elementAt( i ); updateButtonState( buttonModel, getAssociatedFormFeature( buttonModel ) ); } } diff --git a/odk/examples/DevelopersGuide/Forms/TableCellTextBinding.java b/odk/examples/DevelopersGuide/Forms/TableCellTextBinding.java index bacb72240257..4b9fc6b84cdf 100644 --- a/odk/examples/DevelopersGuide/Forms/TableCellTextBinding.java +++ b/odk/examples/DevelopersGuide/Forms/TableCellTextBinding.java @@ -45,15 +45,15 @@ public class TableCellTextBinding private String m_newCellText; private String m_lastKnownCellText; private boolean m_haveNewCellText; - private java.util.List m_listeners; + private java.util.List<XModifyListener> m_listeners; /** Creates a new instance of TableCellTextBinding */ public TableCellTextBinding( XCell cell ) { - m_cellText = (XTextRange)UnoRuntime.queryInterface( XTextRange.class, cell ); + m_cellText = UnoRuntime.queryInterface( XTextRange.class, cell ); m_newCellText = new String(); - m_listeners = new java.util.LinkedList(); + m_listeners = new java.util.LinkedList<XModifyListener>(); start(); } @@ -161,10 +161,10 @@ public class TableCellTextBinding { com.sun.star.lang.EventObject eventSource = new com.sun.star.lang.EventObject( this ); - java.util.Iterator loop = m_listeners.iterator(); + java.util.Iterator<XModifyListener> loop = m_listeners.iterator(); while ( loop.hasNext() ) { - ((XModifyListener)loop.next()).modified( eventSource ); + loop.next().modified( eventSource ); } } } |