Kaydet (Commit) 0f1dba83 authored tarafından Noel Grandin's avatar Noel Grandin Kaydeden (comit) Michael Stahl

Java5 cleanup, cleanup Vector and ArrayList to use generics

Change-Id: I7c2a3346f5c089424377302e1029b6f6aa971d76
üst b89ae706
...@@ -52,7 +52,7 @@ public class EventHandler ...@@ -52,7 +52,7 @@ public class EventHandler
mnTopWindowCount = 0; mnTopWindowCount = 0;
maListenerProxy = new EventListenerProxy (this); maListenerProxy = new EventListenerProxy (this);
maConnectionTask = new ConnectionTask (maListenerProxy); maConnectionTask = new ConnectionTask (maListenerProxy);
maObjectDisplays = new Vector (); maObjectDisplays = new Vector<IAccessibleObjectDisplay> ();
} }
public synchronized void addObjectDisplay (IAccessibleObjectDisplay aDisplay) public synchronized void addObjectDisplay (IAccessibleObjectDisplay aDisplay)
...@@ -148,7 +148,7 @@ public class EventHandler ...@@ -148,7 +148,7 @@ public class EventHandler
for (int i=0; i<maObjectDisplays.size(); i++) for (int i=0; i<maObjectDisplays.size(); i++)
{ {
IAccessibleObjectDisplay aDisplay = IAccessibleObjectDisplay aDisplay =
(IAccessibleObjectDisplay)maObjectDisplays.get(i); maObjectDisplays.get(i);
if (aDisplay != null) if (aDisplay != null)
aDisplay.setAccessibleObject (xContext); aDisplay.setAccessibleObject (xContext);
} }
...@@ -179,7 +179,7 @@ public class EventHandler ...@@ -179,7 +179,7 @@ public class EventHandler
for (int i=0; i<maObjectDisplays.size(); i++) for (int i=0; i<maObjectDisplays.size(); i++)
{ {
IAccessibleObjectDisplay aDisplay = IAccessibleObjectDisplay aDisplay =
(IAccessibleObjectDisplay)maObjectDisplays.get(i); maObjectDisplays.get(i);
if (aDisplay != null) if (aDisplay != null)
aDisplay.setAccessibleObject (null); aDisplay.setAccessibleObject (null);
} }
...@@ -285,7 +285,7 @@ public class EventHandler ...@@ -285,7 +285,7 @@ public class EventHandler
for (int i=0; i<maObjectDisplays.size(); i++) for (int i=0; i<maObjectDisplays.size(); i++)
{ {
IAccessibleObjectDisplay aDisplay = IAccessibleObjectDisplay aDisplay =
(IAccessibleObjectDisplay)maObjectDisplays.get(i); maObjectDisplays.get(i);
if (aDisplay != null) if (aDisplay != null)
aDisplay.updateAccessibleObject (mxFocusedObject); aDisplay.updateAccessibleObject (mxFocusedObject);
} }
...@@ -437,7 +437,7 @@ public class EventHandler ...@@ -437,7 +437,7 @@ public class EventHandler
ways such as showing a graphical representation or some textual ways such as showing a graphical representation or some textual
descriptions. descriptions.
*/ */
private Vector maObjectDisplays; private Vector<IAccessibleObjectDisplay> maObjectDisplays;
/** The timer task that attempts in regular intervals to connect to a /** The timer task that attempts in regular intervals to connect to a
running Office application. running Office application.
......
...@@ -66,7 +66,7 @@ class EventListenerProxy ...@@ -66,7 +66,7 @@ class EventListenerProxy
mbAsynchron = true; mbAsynchron = true;
if (mbAsynchron) if (mbAsynchron)
{ {
maEventQueue = new LinkedList(); maEventQueue = new LinkedList<Runnable>();
new Thread (this, "EventListenerProxy").start(); new Thread (this, "EventListenerProxy").start();
} }
} }
...@@ -105,7 +105,7 @@ class EventListenerProxy ...@@ -105,7 +105,7 @@ class EventListenerProxy
synchronized (maEventQueue) synchronized (maEventQueue)
{ {
if (maEventQueue.size() > 0) if (maEventQueue.size() > 0)
aEvent = (Runnable)maEventQueue.removeFirst(); aEvent = maEventQueue.removeFirst();
else else
aEvent = null; aEvent = null;
} }
...@@ -174,7 +174,7 @@ class EventListenerProxy ...@@ -174,7 +174,7 @@ class EventListenerProxy
public void run() public void run()
{ {
maListener.windowOpened ( maListener.windowOpened (
(XAccessible) UnoRuntime.queryInterface( UnoRuntime.queryInterface(
XAccessible.class, XAccessible.class,
aEvent.Source)); aEvent.Source));
} }
...@@ -192,7 +192,7 @@ class EventListenerProxy ...@@ -192,7 +192,7 @@ class EventListenerProxy
public void run() public void run()
{ {
maListener.windowClosed ( maListener.windowClosed (
(XAccessible) UnoRuntime.queryInterface( UnoRuntime.queryInterface(
XAccessible.class, XAccessible.class,
aEvent.Source)); aEvent.Source));
} }
...@@ -219,7 +219,7 @@ class EventListenerProxy ...@@ -219,7 +219,7 @@ class EventListenerProxy
The queue object will also serve as lock for the consumer/producer type The queue object will also serve as lock for the consumer/producer type
syncronization. syncronization.
*/ */
private LinkedList maEventQueue; private LinkedList<Runnable> maEventQueue;
/** This is the actual listener that the events will eventually forwarded to. /** This is the actual listener that the events will eventually forwarded to.
*/ */
......
...@@ -154,7 +154,7 @@ class TextualDisplay ...@@ -154,7 +154,7 @@ class TextualDisplay
// Try to cast the given accessible context to the // Try to cast the given accessible context to the
// XAccessibleComponent interface. // XAccessibleComponent interface.
XAccessibleComponent xComponent = XAccessibleComponent xComponent =
(XAccessibleComponent)UnoRuntime.queryInterface( UnoRuntime.queryInterface(
XAccessibleComponent.class, xContext); XAccessibleComponent.class, xContext);
if (xComponent != null) if (xComponent != null)
{ {
...@@ -179,7 +179,7 @@ class TextualDisplay ...@@ -179,7 +179,7 @@ class TextualDisplay
private String showParents (XAccessibleContext xContext) private String showParents (XAccessibleContext xContext)
{ {
// Create the path from the given object to its tree's root. // 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) while (xContext != null)
{ {
aPathToRoot.add (xContext); aPathToRoot.add (xContext);
...@@ -203,7 +203,7 @@ class TextualDisplay ...@@ -203,7 +203,7 @@ class TextualDisplay
String sIndentation = new String (); String sIndentation = new String ();
for (int i=aPathToRoot.size()-1; i>=0; i--) for (int i=aPathToRoot.size()-1; i>=0; i--)
{ {
XAccessibleContext xParentContext = (XAccessibleContext)aPathToRoot.get(i); XAccessibleContext xParentContext = aPathToRoot.get(i);
String sParentName = xParentContext.getAccessibleName(); String sParentName = xParentContext.getAccessibleName();
if (sParentName.length() == 0) if (sParentName.length() == 0)
sParentName = "<unnamed> / Role " sParentName = "<unnamed> / Role "
......
...@@ -55,7 +55,7 @@ public class ButtonOperator implements XActionListener, XFeatureInvalidation ...@@ -55,7 +55,7 @@ public class ButtonOperator implements XActionListener, XFeatureInvalidation
private XPropertySet m_form; private XPropertySet m_form;
private XFormOperations m_formOperations; private XFormOperations m_formOperations;
private Vector m_aButtons; private Vector<XPropertySet> m_aButtons;
/* ------------------------------------------------------------------ */ /* ------------------------------------------------------------------ */
/** ctor /** ctor
...@@ -65,7 +65,7 @@ public class ButtonOperator implements XActionListener, XFeatureInvalidation ...@@ -65,7 +65,7 @@ public class ButtonOperator implements XActionListener, XFeatureInvalidation
m_componentContext = xCtx; m_componentContext = xCtx;
m_aDocument = aDocument; m_aDocument = aDocument;
m_form = _form; m_form = _form;
m_aButtons = new Vector(); m_aButtons = new Vector<XPropertySet>();
} }
/* ------------------------------------------------------------------ */ /* ------------------------------------------------------------------ */
...@@ -89,7 +89,7 @@ public class ButtonOperator implements XActionListener, XFeatureInvalidation ...@@ -89,7 +89,7 @@ public class ButtonOperator implements XActionListener, XFeatureInvalidation
{ {
for ( int i=0; i < m_aButtons.size(); ++i ) 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 ) ) if ( _formFeature == getAssociatedFormFeature( button ) )
return button; return button;
} }
...@@ -119,7 +119,7 @@ public class ButtonOperator implements XActionListener, XFeatureInvalidation ...@@ -119,7 +119,7 @@ public class ButtonOperator implements XActionListener, XFeatureInvalidation
DocumentViewHelper aCurrentView = m_aDocument.getCurrentView(); DocumentViewHelper aCurrentView = m_aDocument.getCurrentView();
// add a listener so we get noticed if the user presses the button // 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 ) ); aCurrentView.getFormControl( _buttonModel ) );
xButtonControl.addActionListener( this ); xButtonControl.addActionListener( this );
...@@ -215,7 +215,7 @@ public class ButtonOperator implements XActionListener, XFeatureInvalidation ...@@ -215,7 +215,7 @@ public class ButtonOperator implements XActionListener, XFeatureInvalidation
{ {
for ( int i=0; i < m_aButtons.size(); ++i ) 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 ) ); updateButtonState( buttonModel, getAssociatedFormFeature( buttonModel ) );
} }
} }
......
...@@ -45,15 +45,15 @@ public class TableCellTextBinding ...@@ -45,15 +45,15 @@ public class TableCellTextBinding
private String m_newCellText; private String m_newCellText;
private String m_lastKnownCellText; private String m_lastKnownCellText;
private boolean m_haveNewCellText; private boolean m_haveNewCellText;
private java.util.List m_listeners; private java.util.List<XModifyListener> m_listeners;
/** Creates a new instance of TableCellTextBinding */ /** Creates a new instance of TableCellTextBinding */
public TableCellTextBinding( XCell cell ) public TableCellTextBinding( XCell cell )
{ {
m_cellText = (XTextRange)UnoRuntime.queryInterface( XTextRange.class, cell ); m_cellText = UnoRuntime.queryInterface( XTextRange.class, cell );
m_newCellText = new String(); m_newCellText = new String();
m_listeners = new java.util.LinkedList(); m_listeners = new java.util.LinkedList<XModifyListener>();
start(); start();
} }
...@@ -161,10 +161,10 @@ public class TableCellTextBinding ...@@ -161,10 +161,10 @@ public class TableCellTextBinding
{ {
com.sun.star.lang.EventObject eventSource = new com.sun.star.lang.EventObject( this ); 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() ) while ( loop.hasNext() )
{ {
((XModifyListener)loop.next()).modified( eventSource ); loop.next().modified( eventSource );
} }
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment