diff options
Diffstat (limited to 'toolkit/test')
42 files changed, 199 insertions, 186 deletions
diff --git a/toolkit/test/accessibility/AccTreeNode.java b/toolkit/test/accessibility/AccTreeNode.java index 6224ce2cbc47..c97225752b2d 100644 --- a/toolkit/test/accessibility/AccTreeNode.java +++ b/toolkit/test/accessibility/AccTreeNode.java @@ -40,7 +40,7 @@ class AccTreeNode public int mnChildCount; } /// NodeHandlers for this node - private Vector maHandlers; + private Vector<HandlerDescriptor> maHandlers; // The accessible context of this node. private XAccessible mxAccessible; @@ -58,7 +58,7 @@ class AccTreeNode { super (aDisplay, aParent); - maHandlers = new Vector(5); + maHandlers = new Vector<HandlerDescriptor>(5); mxContext = xContext; mxAccessible = xAccessible; } @@ -72,7 +72,7 @@ class AccTreeNode for (int i=0; i<maHandlers.size(); i++) { System.out.println ("replacing handler " + i); - HandlerDescriptor aDescriptor = (HandlerDescriptor)maHandlers.get(i); + HandlerDescriptor aDescriptor = maHandlers.get(i); aDescriptor.maHandler = aDescriptor.maHandler.createHandler (mxContext); aDescriptor.mnChildCount = aDescriptor.maHandler.getChildCount (this); @@ -87,7 +87,7 @@ class AccTreeNode public XAccessibleComponent getComponent () { if (mxComponent == null && mxContext != null) - mxComponent = (XAccessibleComponent)UnoRuntime.queryInterface( + mxComponent = UnoRuntime.queryInterface( XAccessibleComponent.class, mxContext); return mxComponent; } @@ -97,7 +97,7 @@ class AccTreeNode if (mxComponent == null) getComponent(); if (mxComponent != null) - return (XAccessibleExtendedComponent)UnoRuntime.queryInterface( + return UnoRuntime.queryInterface( XAccessibleExtendedComponent.class, mxComponent); else return null; @@ -106,21 +106,21 @@ class AccTreeNode public XAccessibleText getText () { if (mxText == null && mxContext != null) - mxText = (XAccessibleText)UnoRuntime.queryInterface( + mxText = UnoRuntime.queryInterface( XAccessibleText.class, mxContext); return mxText; } public XAccessibleEditableText getEditText () { - return (XAccessibleEditableText)UnoRuntime.queryInterface( + return UnoRuntime.queryInterface( XAccessibleEditableText.class, mxContext); } public XAccessibleTable getTable () { if (mxTable == null && mxContext != null) - mxTable = (XAccessibleTable)UnoRuntime.queryInterface( + mxTable = UnoRuntime.queryInterface( XAccessibleTable.class, mxContext); return mxTable; } @@ -129,14 +129,14 @@ class AccTreeNode public XAccessible getAccessible() { if ((mxAccessible == null) && (mxContext != null)) - mxAccessible = (XAccessible)UnoRuntime.queryInterface( + mxAccessible = UnoRuntime.queryInterface( XAccessible.class, mxContext); return mxAccessible; } public XAccessibleSelection getSelection () { - return (XAccessibleSelection)UnoRuntime.queryInterface( + return UnoRuntime.queryInterface( XAccessibleSelection.class, mxContext); } @@ -150,7 +150,7 @@ class AccTreeNode /** iterate over handlers and return child sum */ protected HandlerDescriptor getHandlerDescriptor (int i) { - HandlerDescriptor aDescriptor = (HandlerDescriptor)maHandlers.get(i); + HandlerDescriptor aDescriptor = maHandlers.get(i); if (aDescriptor.mnChildCount < 0) aDescriptor.mnChildCount = aDescriptor.maHandler.getChildCount (this); @@ -276,7 +276,7 @@ class AccTreeNode /** iterate over handlers until the child is found */ - public void getActions(Vector aActions) + public void getActions(Vector<String> aActions) { for(int i = 0; i < maHandlers.size(); i++) { @@ -338,14 +338,14 @@ class AccTreeNode The returned array containes the indices of the updated children and can be used to create a TreeModelEvent. */ - public Vector updateChildren (java.lang.Class class1) + public Vector<Integer> updateChildren (java.lang.Class class1) { return updateChildren (class1, null); } - public Vector updateChildren (java.lang.Class class1, java.lang.Class class2) + public Vector<Integer> updateChildren (java.lang.Class class1, java.lang.Class<AccessibleExtendedComponentHandler> class2) { - Vector aChildIndices = new Vector(); + Vector<Integer> aChildIndices = new Vector<Integer>(); int nOffset = 0; for(int i=0; i < maHandlers.size(); i++) { diff --git a/toolkit/test/accessibility/AccessibilityTree.java b/toolkit/test/accessibility/AccessibilityTree.java index f1c4ffc024b0..071181d1d620 100644 --- a/toolkit/test/accessibility/AccessibilityTree.java +++ b/toolkit/test/accessibility/AccessibilityTree.java @@ -252,7 +252,7 @@ public class AccessibilityTree { AccTreeNode aNode = (AccTreeNode)aObject; - Vector aActions = new Vector(); + Vector<String> aActions = new Vector<String>(); aMenu.add (new AccessibilityTree.ShapeExpandAction(maTree, aNode)); aMenu.add (new AccessibilityTree.SubtreeExpandAction(maTree, aNode)); diff --git a/toolkit/test/accessibility/AccessibilityTreeModel.java b/toolkit/test/accessibility/AccessibilityTreeModel.java index fd4d961833cb..12ff8a6195d7 100644 --- a/toolkit/test/accessibility/AccessibilityTreeModel.java +++ b/toolkit/test/accessibility/AccessibilityTreeModel.java @@ -100,7 +100,7 @@ public class AccessibilityTreeModel { if (maCanvas != null) maCanvas.removeNode (aNode); - removeAccListener ((AccTreeNode)aNode); + removeAccListener (aNode); } }); maNodeMap.Clear (); @@ -294,7 +294,7 @@ public class AccessibilityTreeModel */ protected Object[] createPath (AccessibleTreeNode aNode) { - Vector aPath = new Vector(); + Vector<AccessibleTreeNode> aPath = new Vector<AccessibleTreeNode>(); aNode.createPath (aPath); return aPath.toArray(); } @@ -310,7 +310,7 @@ public class AccessibilityTreeModel { for(int i = 0; i < maTMListeners.size(); i++) { - ((TreeModelListener)maTMListeners.get(i)).treeNodesChanged(e); + maTMListeners.get(i).treeNodesChanged(e); } } @@ -318,7 +318,7 @@ public class AccessibilityTreeModel { for(int i = 0; i < maTMListeners.size(); i++) { - ((TreeModelListener)maTMListeners.get(i)).treeNodesInserted(e); + maTMListeners.get(i).treeNodesInserted(e); } } @@ -326,7 +326,7 @@ public class AccessibilityTreeModel { for(int i = 0; i < maTMListeners.size(); i++) { - ((TreeModelListener)maTMListeners.get(i)).treeNodesRemoved(e); + maTMListeners.get(i).treeNodesRemoved(e); } } @@ -334,7 +334,7 @@ public class AccessibilityTreeModel { for(int i = 0; i < maTMListeners.size(); i++) { - ((TreeModelListener)maTMListeners.get(i)).treeStructureChanged(e); + maTMListeners.get(i).treeStructureChanged(e); } } @@ -393,7 +393,7 @@ public class AccessibilityTreeModel /** Create a TreeModelEvent that indicates changes at those children of the specified node with the specified indices. */ - protected TreeModelEvent createChangeEvent (AccTreeNode aNode, Vector aChildIndices) + protected TreeModelEvent createChangeEvent (AccTreeNode aNode, Vector<Integer> aChildIndices) { // Build a list of child objects that are indicated by the given indices. int nCount = aChildIndices.size(); @@ -401,7 +401,7 @@ public class AccessibilityTreeModel int nChildIndices[] = new int[nCount]; for (int i=0; i<nCount; i++) { - int nIndex = ((Integer)aChildIndices.elementAt(i)).intValue(); + int nIndex = aChildIndices.elementAt(i).intValue(); aChildObjects[i] = aNode.getChild (nIndex); nChildIndices[i] = nIndex; } @@ -424,7 +424,7 @@ public class AccessibilityTreeModel { for(int i = 0; i < maTMListeners.size(); i++) { - fire( (TreeModelListener)maTMListeners.get(i) ); + fire( maTMListeners.get(i) ); } } @@ -436,7 +436,7 @@ public class AccessibilityTreeModel protected XAccessibleEventBroadcaster getBroadcaster (Object aObject) { if (aObject instanceof AccTreeNode) - return (XAccessibleEventBroadcaster) UnoRuntime.queryInterface ( + return UnoRuntime.queryInterface ( XAccessibleEventBroadcaster.class, ((AccTreeNode)aObject).getContext()); else return null; @@ -485,7 +485,7 @@ public class AccessibilityTreeModel xSource. */ public AccTreeNode updateNode (XAccessibleContext xSource, - java.lang.Class class1, java.lang.Class class2) + java.lang.Class class1, java.lang.Class<AccessibleExtendedComponentHandler> class2) { AccessibleTreeNode aTreeNode = maNodeMap.GetNode (xSource); AccTreeNode aNode = null; @@ -495,7 +495,7 @@ public class AccessibilityTreeModel { aNode = (AccTreeNode) aTreeNode; // Get list of affected children. - Vector aChildIndices = (aNode).updateChildren ( + Vector<Integer> aChildIndices = (aNode).updateChildren ( class1, class2); // Fire events that these children may have changed. fireTreeNodesChanged ( diff --git a/toolkit/test/accessibility/AccessibilityTreeModelBase.java b/toolkit/test/accessibility/AccessibilityTreeModelBase.java index b34711bea232..264ac3b0d308 100644 --- a/toolkit/test/accessibility/AccessibilityTreeModelBase.java +++ b/toolkit/test/accessibility/AccessibilityTreeModelBase.java @@ -27,7 +27,7 @@ public class AccessibilityTreeModelBase public AccessibilityTreeModelBase () { setRoot (null); - maTMListeners = new Vector(); + maTMListeners = new Vector<TreeModelListener>(); } public synchronized void addTreeModelListener(TreeModelListener l) @@ -132,7 +132,7 @@ public class AccessibilityTreeModelBase // The list of TreeModelListener objects. - protected Vector maTMListeners; + protected Vector<TreeModelListener> maTMListeners; // The root node of the tree. Use setRoot to change it. private AccessibleTreeNode maRoot = null; diff --git a/toolkit/test/accessibility/AccessibilityWorkBench.java b/toolkit/test/accessibility/AccessibilityWorkBench.java index 74541a7e1f2b..43365d5a9fe3 100644 --- a/toolkit/test/accessibility/AccessibilityWorkBench.java +++ b/toolkit/test/accessibility/AccessibilityWorkBench.java @@ -541,7 +541,7 @@ public class AccessibilityWorkBench // XEventListener public void disposing( com.sun.star.lang.EventObject aSourceObj ) { - XFrame xFrame = (XFrame)UnoRuntime.queryInterface(XFrame.class, aSourceObj.Source); + XFrame xFrame = UnoRuntime.queryInterface(XFrame.class, aSourceObj.Source); if( xFrame != null ) System.out.println("frame disposed"); diff --git a/toolkit/test/accessibility/AccessibleActionHandler.java b/toolkit/test/accessibility/AccessibleActionHandler.java index d89928384dc9..e30627c6801d 100644 --- a/toolkit/test/accessibility/AccessibleActionHandler.java +++ b/toolkit/test/accessibility/AccessibleActionHandler.java @@ -27,8 +27,8 @@ class AccessibleActionHandler public NodeHandler createHandler (XAccessibleContext xContext) { XAccessibleAction xEComponent = - (XAccessibleAction) UnoRuntime.queryInterface ( - XAccessibleAction.class, xContext); + UnoRuntime.queryInterface ( + XAccessibleAction.class, xContext); if (xEComponent != null) return new AccessibleActionHandler (xEComponent); else @@ -47,7 +47,7 @@ class AccessibleActionHandler protected static XAccessibleAction getAction (AccTreeNode aParent) { - return (XAccessibleAction) UnoRuntime.queryInterface ( + return UnoRuntime.queryInterface ( XAccessibleAction.class, aParent.getContext()); } diff --git a/toolkit/test/accessibility/AccessibleCellHandler.java b/toolkit/test/accessibility/AccessibleCellHandler.java index 673612481278..c3a8ab91b689 100644 --- a/toolkit/test/accessibility/AccessibleCellHandler.java +++ b/toolkit/test/accessibility/AccessibleCellHandler.java @@ -33,8 +33,8 @@ class AccessibleCellHandler extends NodeHandler if (xParent != null) { XAccessibleTable xTable = - (XAccessibleTable) UnoRuntime.queryInterface ( - XAccessibleTable.class, xParent.getAccessibleContext()); + UnoRuntime.queryInterface ( + XAccessibleTable.class, xParent.getAccessibleContext()); if (xTable != null) aCellHandler = new AccessibleCellHandler (xTable); } @@ -55,7 +55,7 @@ class AccessibleCellHandler extends NodeHandler protected static XAccessibleTable getTable(Object aObject) { - return (XAccessibleTable) UnoRuntime.queryInterface ( + return UnoRuntime.queryInterface ( XAccessibleTable.class, aObject); } diff --git a/toolkit/test/accessibility/AccessibleComponentHandler.java b/toolkit/test/accessibility/AccessibleComponentHandler.java index 1a1920508161..2c4476417893 100644 --- a/toolkit/test/accessibility/AccessibleComponentHandler.java +++ b/toolkit/test/accessibility/AccessibleComponentHandler.java @@ -28,8 +28,8 @@ class AccessibleComponentHandler public NodeHandler createHandler (XAccessibleContext xContext) { XAccessibleComponent xComponent = - (XAccessibleComponent) UnoRuntime.queryInterface ( - XAccessibleComponent.class, xContext); + UnoRuntime.queryInterface ( + XAccessibleComponent.class, xContext); if (xComponent != null) return new AccessibleComponentHandler (xComponent); else diff --git a/toolkit/test/accessibility/AccessibleEditableTextHandler.java b/toolkit/test/accessibility/AccessibleEditableTextHandler.java index 1f2d32c209c8..8fb8b843c3d8 100644 --- a/toolkit/test/accessibility/AccessibleEditableTextHandler.java +++ b/toolkit/test/accessibility/AccessibleEditableTextHandler.java @@ -26,8 +26,8 @@ class AccessibleEditableTextHandler extends NodeHandler public NodeHandler createHandler (XAccessibleContext xContext) { XAccessibleEditableText xText = - (XAccessibleEditableText) UnoRuntime.queryInterface ( - XAccessibleEditableText.class, xContext); + UnoRuntime.queryInterface ( + XAccessibleEditableText.class, xContext); if (xText != null) return new AccessibleEditableTextHandler (xText); else @@ -46,7 +46,7 @@ class AccessibleEditableTextHandler extends NodeHandler protected static XAccessibleEditableText getEText (AccTreeNode aNode) { - return (XAccessibleEditableText) UnoRuntime.queryInterface ( + return UnoRuntime.queryInterface ( XAccessibleEditableText.class, aNode.getContext()); } diff --git a/toolkit/test/accessibility/AccessibleExtendedComponentHandler.java b/toolkit/test/accessibility/AccessibleExtendedComponentHandler.java index c5e84edd71e8..6bfbc48ef391 100644 --- a/toolkit/test/accessibility/AccessibleExtendedComponentHandler.java +++ b/toolkit/test/accessibility/AccessibleExtendedComponentHandler.java @@ -27,8 +27,8 @@ class AccessibleExtendedComponentHandler public NodeHandler createHandler (XAccessibleContext xContext) { XAccessibleExtendedComponent xEComponent = - (XAccessibleExtendedComponent) UnoRuntime.queryInterface ( - XAccessibleExtendedComponent.class, xContext); + UnoRuntime.queryInterface ( + XAccessibleExtendedComponent.class, xContext); if (xEComponent != null) return new AccessibleExtendedComponentHandler (xEComponent); else @@ -47,7 +47,7 @@ class AccessibleExtendedComponentHandler private static XAccessibleExtendedComponent getComponent (AccTreeNode aNode) { - return (XAccessibleExtendedComponent) UnoRuntime.queryInterface ( + return UnoRuntime.queryInterface ( XAccessibleExtendedComponent.class, aNode.getContext()); } diff --git a/toolkit/test/accessibility/AccessibleHyperlinkHandler.java b/toolkit/test/accessibility/AccessibleHyperlinkHandler.java index d961f2adbb10..e1869a59ee99 100644 --- a/toolkit/test/accessibility/AccessibleHyperlinkHandler.java +++ b/toolkit/test/accessibility/AccessibleHyperlinkHandler.java @@ -26,8 +26,8 @@ class AccessibleHyperlinkHandler extends AccessibleTreeHandler public NodeHandler createHandler (XAccessibleContext xContext) { XAccessibleHyperlink xLink = - (XAccessibleHyperlink) UnoRuntime.queryInterface ( - XAccessibleHyperlink.class, xContext); + UnoRuntime.queryInterface ( + XAccessibleHyperlink.class, xContext); if (xLink != null) return new AccessibleHyperlinkHandler (xLink); else @@ -47,8 +47,8 @@ class AccessibleHyperlinkHandler extends AccessibleTreeHandler protected XAccessibleHyperlink getHyperlink(Object aObject) { XAccessibleHyperlink xHyperlink = - (XAccessibleHyperlink) UnoRuntime.queryInterface ( - XAccessibleHyperlink.class, aObject); + UnoRuntime.queryInterface ( + XAccessibleHyperlink.class, aObject); return xHyperlink; } diff --git a/toolkit/test/accessibility/AccessibleHypertextHandler.java b/toolkit/test/accessibility/AccessibleHypertextHandler.java index a43f11e29494..adcd19827a1e 100644 --- a/toolkit/test/accessibility/AccessibleHypertextHandler.java +++ b/toolkit/test/accessibility/AccessibleHypertextHandler.java @@ -26,8 +26,8 @@ class AccessibleHypertextHandler extends AccessibleTreeHandler public NodeHandler createHandler (XAccessibleContext xContext) { XAccessibleHypertext xText = - (XAccessibleHypertext) UnoRuntime.queryInterface ( - XAccessibleHypertext.class, xContext); + UnoRuntime.queryInterface ( + XAccessibleHypertext.class, xContext); if (xText != null) return new AccessibleHypertextHandler (xText); else @@ -47,8 +47,8 @@ class AccessibleHypertextHandler extends AccessibleTreeHandler protected static XAccessibleHypertext getHypertext (AccTreeNode aNode) { XAccessibleHypertext xHypertext = - (XAccessibleHypertext) UnoRuntime.queryInterface ( - XAccessibleHypertext.class, aNode.getContext()); + UnoRuntime.queryInterface ( + XAccessibleHypertext.class, aNode.getContext()); return xHypertext; } diff --git a/toolkit/test/accessibility/AccessibleImageHandler.java b/toolkit/test/accessibility/AccessibleImageHandler.java index 4091466b95dc..f9c40998dc03 100644 --- a/toolkit/test/accessibility/AccessibleImageHandler.java +++ b/toolkit/test/accessibility/AccessibleImageHandler.java @@ -26,8 +26,8 @@ class AccessibleImageHandler extends NodeHandler public NodeHandler createHandler (XAccessibleContext xContext) { XAccessibleImage xImage = - (XAccessibleImage) UnoRuntime.queryInterface ( - XAccessibleImage.class, xContext); + UnoRuntime.queryInterface ( + XAccessibleImage.class, xContext); if (xImage != null) return new AccessibleImageHandler (xImage); else @@ -46,7 +46,7 @@ class AccessibleImageHandler extends NodeHandler protected static XAccessibleImage getImage (AccTreeNode aNode) { - return (XAccessibleImage) UnoRuntime.queryInterface ( + return UnoRuntime.queryInterface ( XAccessibleImage.class, aNode.getContext()); } diff --git a/toolkit/test/accessibility/AccessibleRelationHandler.java b/toolkit/test/accessibility/AccessibleRelationHandler.java index 9ce6a010296d..6882f2648f71 100644 --- a/toolkit/test/accessibility/AccessibleRelationHandler.java +++ b/toolkit/test/accessibility/AccessibleRelationHandler.java @@ -82,8 +82,8 @@ class AccessibleRelationHandler { Object aTarget = aRelation.TargetSet[j]; XAccessible xAccTarget = - (XAccessible)UnoRuntime.queryInterface( - XAccessible.class, aTarget ); + UnoRuntime.queryInterface( + XAccessible.class, aTarget ); if( xAccTarget == null ) { aBuffer.append( aTarget.toString() ); diff --git a/toolkit/test/accessibility/AccessibleSelectionHandler.java b/toolkit/test/accessibility/AccessibleSelectionHandler.java index 9c90ae1b1aa3..4791444d5a6a 100644 --- a/toolkit/test/accessibility/AccessibleSelectionHandler.java +++ b/toolkit/test/accessibility/AccessibleSelectionHandler.java @@ -30,8 +30,8 @@ class AccessibleSelectionHandler public NodeHandler createHandler( XAccessibleContext xContext ) { XAccessibleSelection xSelection = - (XAccessibleSelection) UnoRuntime.queryInterface( - XAccessibleSelection.class, xContext); + UnoRuntime.queryInterface( + XAccessibleSelection.class, xContext); return (xSelection == null) ? null : new AccessibleSelectionHandler(xSelection); } diff --git a/toolkit/test/accessibility/AccessibleTableHandler.java b/toolkit/test/accessibility/AccessibleTableHandler.java index 64eb84f46425..372c2cb5a26f 100644 --- a/toolkit/test/accessibility/AccessibleTableHandler.java +++ b/toolkit/test/accessibility/AccessibleTableHandler.java @@ -26,8 +26,8 @@ class AccessibleTableHandler extends NodeHandler public NodeHandler createHandler (XAccessibleContext xContext) { XAccessibleTable xTable = - (XAccessibleTable) UnoRuntime.queryInterface ( - XAccessibleTable.class, xContext); + UnoRuntime.queryInterface ( + XAccessibleTable.class, xContext); if (xTable != null) return new AccessibleTableHandler (xTable); else @@ -46,7 +46,7 @@ class AccessibleTableHandler extends NodeHandler protected static XAccessibleTable getTable(Object aObject) { - return (XAccessibleTable) UnoRuntime.queryInterface ( + return UnoRuntime.queryInterface ( XAccessibleTable.class, aObject); } diff --git a/toolkit/test/accessibility/AccessibleTextHandler.java b/toolkit/test/accessibility/AccessibleTextHandler.java index bea1d8ab5706..46b4b69d4b4c 100644 --- a/toolkit/test/accessibility/AccessibleTextHandler.java +++ b/toolkit/test/accessibility/AccessibleTextHandler.java @@ -53,7 +53,7 @@ class AccessibleTextHandler extends NodeHandler { public NodeHandler createHandler (XAccessibleContext xContext) { - XAccessibleText xText = (XAccessibleText) UnoRuntime.queryInterface ( + XAccessibleText xText = UnoRuntime.queryInterface ( XAccessibleText.class, xContext); if (xText != null) return new AccessibleTextHandler (xText); diff --git a/toolkit/test/accessibility/AccessibleTreeCellRenderer.java b/toolkit/test/accessibility/AccessibleTreeCellRenderer.java index a4823539767e..03b7d938e19d 100644 --- a/toolkit/test/accessibility/AccessibleTreeCellRenderer.java +++ b/toolkit/test/accessibility/AccessibleTreeCellRenderer.java @@ -30,7 +30,7 @@ public class AccessibleTreeCellRenderer public Color maDefaultColor, maChangedColor; - protected Vector + protected Vector<Boolean> maChangedLines; @@ -39,7 +39,7 @@ public class AccessibleTreeCellRenderer { maDefaultColor = Color.black; maChangedColor = Color.red; - maChangedLines = new Vector (); + maChangedLines = new Vector<Boolean> (); } public Component getTreeCellRendererComponent ( @@ -90,11 +90,11 @@ public class AccessibleTreeCellRenderer The JTree that is used to transform the given TreePath objects into rows. */ - public void addChangedNodes (Vector aChangedNodes, JTree aTree) + public void addChangedNodes (Vector<TreePath> aChangedNodes, JTree aTree) { for (int i=0; i<aChangedNodes.size(); i++) { - TreePath aPath = (TreePath)aChangedNodes.elementAt (i); + TreePath aPath = aChangedNodes.elementAt (i); int nRow = aTree.getRowForPath (aPath); addChangedLine (nRow); } diff --git a/toolkit/test/accessibility/AccessibleTreeNode.java b/toolkit/test/accessibility/AccessibleTreeNode.java index f8a69f7807e4..ff77f4a5f9a1 100644 --- a/toolkit/test/accessibility/AccessibleTreeNode.java +++ b/toolkit/test/accessibility/AccessibleTreeNode.java @@ -82,7 +82,7 @@ class AccessibleTreeNode /** Create a path to this node by first asking the parent for its path and then appending this object. */ - public void createPath (java.util.Vector aPath) + public void createPath (java.util.Vector<AccessibleTreeNode> aPath) { if (maParent != null) maParent.createPath (aPath); @@ -91,7 +91,7 @@ class AccessibleTreeNode public Object[] createPath () { - Vector aPath = new Vector (1); + Vector<AccessibleTreeNode> aPath = new Vector<AccessibleTreeNode> (1); createPath (aPath); return aPath.toArray(); } diff --git a/toolkit/test/accessibility/AccessibleUNOHandler.java b/toolkit/test/accessibility/AccessibleUNOHandler.java index 68c09af47b4b..8af27d19b25d 100644 --- a/toolkit/test/accessibility/AccessibleUNOHandler.java +++ b/toolkit/test/accessibility/AccessibleUNOHandler.java @@ -50,7 +50,7 @@ class AccessibleUNOHandler { XServiceInfo xServiceInfo = null; if (aNode instanceof AccTreeNode) - xServiceInfo = (XServiceInfo)UnoRuntime.queryInterface( + xServiceInfo = UnoRuntime.queryInterface( XServiceInfo.class, ((AccTreeNode)aNode).getContext()); return xServiceInfo; } @@ -58,7 +58,7 @@ class AccessibleUNOHandler { XTypeProvider xTypeProvider = null; if (aNode instanceof AccTreeNode) - xTypeProvider = (XTypeProvider)UnoRuntime.queryInterface( + xTypeProvider = UnoRuntime.queryInterface( XTypeProvider.class, ((AccTreeNode)aNode).getContext()); return xTypeProvider; } diff --git a/toolkit/test/accessibility/Canvas.java b/toolkit/test/accessibility/Canvas.java index 9fbce196150c..5c6fd0c4f3aa 100644 --- a/toolkit/test/accessibility/Canvas.java +++ b/toolkit/test/accessibility/Canvas.java @@ -16,13 +16,27 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -import java.util.*; -import java.awt.*; -import java.awt.event.*; -import javax.swing.*; -import javax.swing.tree.*; -import javax.swing.event.TreeSelectionListener; +import java.awt.Color; +import java.awt.Dimension; +import java.awt.Graphics; +import java.awt.Graphics2D; +import java.awt.Rectangle; +import java.awt.RenderingHints; +import java.awt.Toolkit; +import java.awt.event.InputEvent; +import java.awt.event.MouseEvent; +import java.awt.event.MouseListener; +import java.awt.event.MouseMotionListener; import java.awt.geom.Rectangle2D; +import java.util.ArrayList; +import java.util.List; + +import javax.swing.JPanel; +import javax.swing.JScrollPane; +import javax.swing.JTree; +import javax.swing.JViewport; +import javax.swing.event.TreeSelectionListener; +import javax.swing.tree.TreePath; /** This canvas displays accessible objects graphically. Each accessible object with graphical representation is represented by an @@ -42,10 +56,9 @@ class Canvas public Canvas () { super (true); - maObjects = new java.util.HashMap (); - maNodes = new Vector (); - maObjectList = new Vector (); - maContexts = new Vector (); + maObjects = new java.util.HashMap<AccTreeNode, CanvasShape> (); + maNodes = new ArrayList<AccTreeNode> (); + maObjectList = new ArrayList<CanvasShape> (); addMouseListener (this); addMouseMotionListener (this); maBoundingBox = new Rectangle (0,0,100,100); @@ -81,7 +94,7 @@ class Canvas { maNodes.add (aNode); - CanvasShape aObject = (CanvasShape) maObjects.get (aNode); + CanvasShape aObject = maObjects.get (aNode); if (aObject == null) { aObject = new CanvasShape (aNode); @@ -117,7 +130,7 @@ class Canvas int i = maNodes.indexOf (aNode); if (i != -1) { - CanvasShape aObject = (CanvasShape)maObjects.get(aNode); + CanvasShape aObject = maObjects.get(aNode); if (aObject != null) aObject.update(); } @@ -125,7 +138,7 @@ class Canvas public void updateNodeGeometry (AccTreeNode aNode) { - CanvasShape aObject = (CanvasShape)maObjects.get(aNode); + CanvasShape aObject = maObjects.get(aNode); if (aObject != null) aObject.updateGeometry(); } @@ -133,7 +146,7 @@ class Canvas public void clear () { while (maNodes.size() > 0) - removeNode ((AccTreeNode)maNodes.elementAt(0)); + removeNode (maNodes.get(0)); maNodes.clear(); maObjects.clear(); @@ -234,7 +247,7 @@ class Canvas boolean bShowText = getShowText(); for (int i=0; i<nCount; i++) { - CanvasShape aCanvasShape = (CanvasShape)maObjectList.elementAt(i); + CanvasShape aCanvasShape = maObjectList.get(i); aCanvasShape.paint ( g2, mnHOffset, mnVOffset, mnScale, @@ -384,7 +397,7 @@ class Canvas int nCount = maObjectList.size(); for (int i=nCount-1; i>=0; --i) { - CanvasShape aObject = (CanvasShape)maObjectList.elementAt(i); + CanvasShape aObject = maObjectList.get(i); if (aObject != null) if (aObject.contains (e.getX(),e.getY())) { @@ -429,7 +442,7 @@ class Canvas Object aObject = aPath.getLastPathComponent(); if (aObject instanceof AccTreeNode) { - CanvasShape aCanvasShape = (CanvasShape)maObjects.get ((AccTreeNode)aObject); + CanvasShape aCanvasShape = maObjects.get (aObject); if (highlightObject (aCanvasShape)) repaint(); } @@ -445,11 +458,11 @@ class Canvas mnScale; private CanvasShape maActiveObject; - private java.util.HashMap + private java.util.HashMap<AccTreeNode, CanvasShape> maObjects; - private Vector - maObjectList, - maContexts, + private List<CanvasShape> + maObjectList; + private List<AccTreeNode> maNodes; private Rectangle maBoundingBox; diff --git a/toolkit/test/accessibility/ChildEventHandler.java b/toolkit/test/accessibility/ChildEventHandler.java index c16a91c07700..b39a1568ecb8 100644 --- a/toolkit/test/accessibility/ChildEventHandler.java +++ b/toolkit/test/accessibility/ChildEventHandler.java @@ -28,9 +28,9 @@ class ChildEventHandler public ChildEventHandler (AccessibleEventObject aEvent, AccessibilityTreeModel aTreeModel) { super (aEvent, aTreeModel); - mxOldChild = (XAccessible)UnoRuntime.queryInterface( + mxOldChild = UnoRuntime.queryInterface( XAccessible.class, aEvent.OldValue); - mxNewChild = (XAccessible)UnoRuntime.queryInterface( + mxNewChild = UnoRuntime.queryInterface( XAccessible.class, aEvent.NewValue); } diff --git a/toolkit/test/accessibility/EventHandler.java b/toolkit/test/accessibility/EventHandler.java index f927990caa5b..ed1a7adb4a8e 100644 --- a/toolkit/test/accessibility/EventHandler.java +++ b/toolkit/test/accessibility/EventHandler.java @@ -36,11 +36,11 @@ class EventHandler mnEventId = aEvent.EventId; - mxEventSource = (XAccessibleContext)UnoRuntime.queryInterface( + mxEventSource = UnoRuntime.queryInterface( XAccessibleContext.class, aEvent.Source); if (mxEventSource == null) { - XAccessible xAccessible = (XAccessible)UnoRuntime.queryInterface( + XAccessible xAccessible = UnoRuntime.queryInterface( XAccessible.class, aEvent.Source); if (xAccessible != null) mxEventSource = xAccessible.getAccessibleContext(); diff --git a/toolkit/test/accessibility/EventQueue.java b/toolkit/test/accessibility/EventQueue.java index 71c742f3897c..5366001f3b39 100644 --- a/toolkit/test/accessibility/EventQueue.java +++ b/toolkit/test/accessibility/EventQueue.java @@ -67,8 +67,8 @@ class EventQueue private EventQueue () { maMonitor = new Boolean (true); - maRegularQueue = new LinkedList(); - maDisposingQueue = new LinkedList(); + maRegularQueue = new LinkedList<Runnable>(); + maDisposingQueue = new LinkedList<Runnable>(); new Thread(this, "AWB.EventQueue").start(); } @@ -87,13 +87,13 @@ class EventQueue { if (maDisposingQueue.size() > 0) { - aEvent = (Runnable)maDisposingQueue.removeFirst(); + aEvent = maDisposingQueue.removeFirst(); if (mbVerbose) System.out.println ("delivering disposing event " + aEvent); } else if (maRegularQueue.size() > 0) { - aEvent = (Runnable)maRegularQueue.removeFirst(); + aEvent = maRegularQueue.removeFirst(); if (mbVerbose) System.out.println ("delivering regular event " + aEvent); } @@ -134,8 +134,8 @@ class EventQueue private static EventQueue maInstance = null; private Object maMonitor; - private LinkedList maRegularQueue; - private LinkedList maDisposingQueue; + private LinkedList<Runnable> maRegularQueue; + private LinkedList<Runnable> maDisposingQueue; } diff --git a/toolkit/test/accessibility/GeometryEventHandler.java b/toolkit/test/accessibility/GeometryEventHandler.java index 883a886ba9e7..1c2fea0f8b36 100644 --- a/toolkit/test/accessibility/GeometryEventHandler.java +++ b/toolkit/test/accessibility/GeometryEventHandler.java @@ -44,7 +44,7 @@ class GeometryEventHandler if (aCanvas != null) { // Iterate over all nodes in the sub-tree rooted in aNode. - LinkedList aShapeQueue = new LinkedList(); + LinkedList<Object> aShapeQueue = new LinkedList<Object>(); aShapeQueue.addLast (aNode); while (aShapeQueue.size() > 0) { diff --git a/toolkit/test/accessibility/HelpWindow.java b/toolkit/test/accessibility/HelpWindow.java index 51300c6d8cae..4d15114874ce 100644 --- a/toolkit/test/accessibility/HelpWindow.java +++ b/toolkit/test/accessibility/HelpWindow.java @@ -84,7 +84,7 @@ class HelpWindow try { maCurrentHistoryEntry = -1; - maHistory = new LinkedList(); + maHistory = new LinkedList<URL>(); maFrame = new JFrame (); maFrame.addWindowListener (new WindowAdapter () @@ -175,7 +175,7 @@ class HelpWindow i = maHistory.size()-1; if (i != maCurrentHistoryEntry) { - URL aURL = (URL)maHistory.get (i); + URL aURL = maHistory.get (i); try { maContent.setPage (aURL); @@ -195,7 +195,7 @@ class HelpWindow private static HelpWindow maInstance = null; private JFrame maFrame; private JEditorPane maContent; - private LinkedList maHistory; + private LinkedList<URL> maHistory; private int maCurrentHistoryEntry; private JButton maPrevButton; private JButton maNextButton; diff --git a/toolkit/test/accessibility/InformationWriter.java b/toolkit/test/accessibility/InformationWriter.java index 0667cbe121c8..994d84ca42be 100644 --- a/toolkit/test/accessibility/InformationWriter.java +++ b/toolkit/test/accessibility/InformationWriter.java @@ -68,7 +68,7 @@ public class InformationWriter { try { - XPropertySet xPropertySet = (XPropertySet) UnoRuntime.queryInterface( + XPropertySet xPropertySet = UnoRuntime.queryInterface( XPropertySet.class, xObject); MessageArea.println (prefix + xPropertySet.getPropertyValue (name)); @@ -86,25 +86,25 @@ public class InformationWriter { try { - XIndexAccess xShapeList = (XIndexAccess) UnoRuntime.queryInterface( + XIndexAccess xShapeList = UnoRuntime.queryInterface( XIndexAccess.class, xPage); MessageArea.println ("There are " + xShapeList.getCount() + " shapes"); for (int i=0; i<xShapeList.getCount(); i++) { - XShape xShape = (XShape) UnoRuntime.queryInterface( + XShape xShape = UnoRuntime.queryInterface( XShape.class, xShapeList.getByIndex (i)); XShapeDescriptor xShapeDescriptor = - (XShapeDescriptor) UnoRuntime.queryInterface( - XShapeDescriptor.class, xShape); + UnoRuntime.queryInterface( + XShapeDescriptor.class, xShape); String sName = xShapeDescriptor.getShapeType (); MessageArea.println (" shape " + i + " : " + sName); XPropertySet xPropertySet = - (XPropertySet) UnoRuntime.queryInterface( - XPropertySet.class, xShape); + UnoRuntime.queryInterface( + XPropertySet.class, xShape); Integer nZOrder = (Integer) xPropertySet.getPropertyValue ("ZOrder"); MessageArea.println (" zorder = " + nZOrder); @@ -127,7 +127,7 @@ public class InformationWriter try { MessageArea.println ("Services:"); - XMultiServiceFactory xMSF = (XMultiServiceFactory) UnoRuntime.queryInterface ( + XMultiServiceFactory xMSF = UnoRuntime.queryInterface ( XMultiServiceFactory.class, xObject ); @@ -157,7 +157,7 @@ public class InformationWriter { System.out.println ("Info:"); // Use interface XServiceName to retrieve name of (main) service. - XServiceName xSN = (XServiceName) UnoRuntime.queryInterface ( + XServiceName xSN = UnoRuntime.queryInterface ( XServiceName.class, xObject); if (xSN == null) MessageArea.println (" interface XServiceName not supported"); @@ -168,7 +168,7 @@ public class InformationWriter // Use interface XServiceInfo to retrieve information about // supported services. - XServiceInfo xSI = (XServiceInfo) UnoRuntime.queryInterface ( + XServiceInfo xSI = UnoRuntime.queryInterface ( XServiceInfo.class, xObject); if (xSI == null) MessageArea.println (" interface XServiceInfo not supported"); @@ -196,7 +196,7 @@ public class InformationWriter MessageArea.println ("Interfaces:"); // Use interface XTypeProvider to retrieve a list of supported // interfaces. - XTypeProvider xTP = (XTypeProvider) UnoRuntime.queryInterface ( + XTypeProvider xTP = UnoRuntime.queryInterface ( XTypeProvider.class, xObject); if (xTP == null) MessageArea.println (" interface XTypeProvider not supported"); @@ -232,13 +232,13 @@ public class InformationWriter // Get XAccessibleContext object if given object does not // already support this interface. XAccessibleContext xContext - = (XAccessibleContext) UnoRuntime.queryInterface ( - XAccessibleContext.class, xObject); + = UnoRuntime.queryInterface ( + XAccessibleContext.class, xObject); if (xContext == null) { XAccessible xAccessible - = (XAccessible) UnoRuntime.queryInterface ( - XAccessible.class, xObject); + = UnoRuntime.queryInterface ( + XAccessible.class, xObject); if (xAccessible == null) { MessageArea.println (sIndent + "given object " + xObject @@ -292,8 +292,8 @@ public class InformationWriter if (xStateSet != null) { XIndexAccess xStates = - (XIndexAccess) UnoRuntime.queryInterface ( - XIndexAccess.class, xStateSet); + UnoRuntime.queryInterface ( + XIndexAccess.class, xStateSet); MessageArea.print (xStates.getCount() + " ("); for (int i=0; i<xStates.getCount(); i++) { @@ -332,8 +332,8 @@ public class InformationWriter try { XAccessibleComponent xComponent = - (XAccessibleComponent) UnoRuntime.queryInterface ( - XAccessibleComponent.class, xObject); + UnoRuntime.queryInterface ( + XAccessibleComponent.class, xObject); // Print information about the accessible context. if (xComponent != null) @@ -397,7 +397,7 @@ public class InformationWriter public void showProperties (XInterface xObject) { - XPropertySet xSet = (XPropertySet) UnoRuntime.queryInterface ( + XPropertySet xSet = UnoRuntime.queryInterface ( XPropertySet.class, xObject); if (xSet == null) MessageArea.println ("object does not support XPropertySet"); diff --git a/toolkit/test/accessibility/NodeHandler.java b/toolkit/test/accessibility/NodeHandler.java index 39f897eab094..18c127fb5d48 100644 --- a/toolkit/test/accessibility/NodeHandler.java +++ b/toolkit/test/accessibility/NodeHandler.java @@ -26,7 +26,7 @@ abstract class NodeHandler { /** This vector is used as cache for the child objects. */ - protected Vector maChildList; + protected Vector<AccessibleTreeNode> maChildList; public abstract NodeHandler createHandler ( @@ -34,7 +34,7 @@ abstract class NodeHandler public NodeHandler () { - maChildList = new Vector (); + maChildList = new Vector<AccessibleTreeNode> (); } /** Clear the cache of child objects. @@ -43,7 +43,7 @@ abstract class NodeHandler { synchronized (maChildList) { - maChildList = new Vector (); + maChildList = new Vector<AccessibleTreeNode> (); } } @@ -70,7 +70,7 @@ abstract class NodeHandler { synchronized (maChildList) { - AccessibleTreeNode aChild = (AccessibleTreeNode)maChildList.get(nIndex); + AccessibleTreeNode aChild = maChildList.get(nIndex); if (aChild == null) { aChild = createChild (aParent, nIndex); @@ -86,7 +86,7 @@ abstract class NodeHandler { synchronized (maChildList) { - return (AccessibleTreeNode)maChildList.get(nIndex); + return maChildList.get(nIndex); } } diff --git a/toolkit/test/accessibility/NodeMap.java b/toolkit/test/accessibility/NodeMap.java index c0fb9189196f..6050aa2ef276 100644 --- a/toolkit/test/accessibility/NodeMap.java +++ b/toolkit/test/accessibility/NodeMap.java @@ -32,7 +32,7 @@ class NodeMap { public NodeMap () { - maXAccessibleToNode = new HashMap (); + maXAccessibleToNode = new HashMap<XAccessibleContext, AccessibleTreeNode> (); } /** Clear the whole map. @@ -48,7 +48,7 @@ class NodeMap */ public boolean InsertNode (XAccessibleContext xContext, AccessibleTreeNode aNode) { - AccessibleTreeNode aPreviousNode = (AccessibleTreeNode)maXAccessibleToNode.put ( + AccessibleTreeNode aPreviousNode = maXAccessibleToNode.put ( xContext, aNode); return aPreviousNode != aNode; @@ -95,7 +95,7 @@ class NodeMap AccessibleTreeNode GetNode (XAccessibleContext xContext) { - return (AccessibleTreeNode)maXAccessibleToNode.get (xContext); + return maXAccessibleToNode.get (xContext); } AccessibleTreeNode GetNode (Object aObject) @@ -126,5 +126,5 @@ class NodeMap - private HashMap maXAccessibleToNode; + private HashMap<XAccessibleContext, AccessibleTreeNode> maXAccessibleToNode; } diff --git a/toolkit/test/accessibility/OfficeConnection.java b/toolkit/test/accessibility/OfficeConnection.java index 7a432e53ea1b..916edfc40efe 100644 --- a/toolkit/test/accessibility/OfficeConnection.java +++ b/toolkit/test/accessibility/OfficeConnection.java @@ -81,12 +81,12 @@ public class OfficeConnection // Create a URL Resolver. XMultiServiceFactory aLocalServiceManager = com.sun.star.comp.helper.Bootstrap.createSimpleServiceManager(); - XUnoUrlResolver aURLResolver = (XUnoUrlResolver) UnoRuntime.queryInterface ( + XUnoUrlResolver aURLResolver = UnoRuntime.queryInterface ( XUnoUrlResolver.class, aLocalServiceManager.createInstance ("com.sun.star.bridge.UnoUrlResolver") ); - maServiceManager = (XMultiServiceFactory) UnoRuntime.queryInterface ( + maServiceManager = UnoRuntime.queryInterface ( XMultiServiceFactory.class, aURLResolver.resolve (sConnectString) ); diff --git a/toolkit/test/accessibility/QueuedListener.java b/toolkit/test/accessibility/QueuedListener.java index 76c95fa50e0f..5235da380cd7 100644 --- a/toolkit/test/accessibility/QueuedListener.java +++ b/toolkit/test/accessibility/QueuedListener.java @@ -31,11 +31,11 @@ class QueuedListener public void disposing( final EventObject aEvent) { - XAccessibleContext xContext = (XAccessibleContext)UnoRuntime.queryInterface( + XAccessibleContext xContext = UnoRuntime.queryInterface( XAccessibleContext.class, aEvent.Source); if (xContext == null) { - XAccessible xAccessible = (XAccessible)UnoRuntime.queryInterface( + XAccessible xAccessible = UnoRuntime.queryInterface( XAccessible.class, aEvent.Source); if (xAccessible != null) xContext = xAccessible.getAccessibleContext(); diff --git a/toolkit/test/accessibility/SelectionDialog.java b/toolkit/test/accessibility/SelectionDialog.java index 042e47ff70d5..b5272646a02d 100644 --- a/toolkit/test/accessibility/SelectionDialog.java +++ b/toolkit/test/accessibility/SelectionDialog.java @@ -98,13 +98,13 @@ class SelectionDialog extends JDialog /** Get a list of all children */ - private Vector GetChildrenList () + private Vector<String> GetChildrenList () { mxSelection = maNode.getSelection(); XAccessibleContext xContext = maNode.getContext(); int nCount = xContext.getAccessibleChildCount(); - Vector aChildVector = new Vector(); + Vector<String> aChildVector = new Vector<String>(); for(int i = 0; i < nCount; i++) { try diff --git a/toolkit/test/accessibility/SimpleOffice.java b/toolkit/test/accessibility/SimpleOffice.java index 6dfcab9c21d6..634169141f71 100644 --- a/toolkit/test/accessibility/SimpleOffice.java +++ b/toolkit/test/accessibility/SimpleOffice.java @@ -73,8 +73,8 @@ public class SimpleOffice { // Load the document from the specified URL. XComponentLoader xLoader = - (XComponentLoader)UnoRuntime.queryInterface( - XComponentLoader.class, mxDesktop); + UnoRuntime.queryInterface( + XComponentLoader.class, mxDesktop); XComponent xComponent = xLoader.loadComponentFromURL ( URL, @@ -83,7 +83,7 @@ public class SimpleOffice new PropertyValue[0] ); - xModel = (XModel) UnoRuntime.queryInterface( + xModel = UnoRuntime.queryInterface( XModel.class, xComponent); } catch (java.lang.NullPointerException e) @@ -108,13 +108,13 @@ public class SimpleOffice try { XTasksSupplier xTasksSupplier = - (XTasksSupplier) UnoRuntime.queryInterface( - XTasksSupplier.class, mxDesktop); + UnoRuntime.queryInterface( + XTasksSupplier.class, mxDesktop); XEnumerationAccess xEA = xTasksSupplier.getTasks(); XEnumeration xE = xEA.createEnumeration(); while (xE.hasMoreElements()) { - XTask xTask = (XTask) UnoRuntime.queryInterface( + XTask xTask = UnoRuntime.queryInterface( XTask.class, xE.nextElement()); MessageArea.print (xTask.getName()); } @@ -130,7 +130,7 @@ public class SimpleOffice public XModel getModel (XDrawView xView) { - XController xController = (XController) UnoRuntime.queryInterface( + XController xController = UnoRuntime.queryInterface( XController.class, xView); if (xController != null) return xController.getModel(); @@ -158,7 +158,7 @@ public class SimpleOffice MessageArea.println ("Connected successfully."); // Create a new desktop. - mxDesktop = (XDesktop) UnoRuntime.queryInterface( + mxDesktop = UnoRuntime.queryInterface( XDesktop.class, xMSF.createInstance ("com.sun.star.frame.Desktop") ); @@ -185,7 +185,7 @@ public class SimpleOffice XMultiServiceFactory xMSF = aConnection.getServiceManager (); if (xMSF != null) { - xToolkit = (XExtendedToolkit) UnoRuntime.queryInterface( + xToolkit = UnoRuntime.queryInterface( XExtendedToolkit.class, xMSF.createInstance ("stardiv.Toolkit.VCLXToolkit") ); @@ -206,7 +206,7 @@ public class SimpleOffice XAccessible xAccessible = null; try { - xAccessible = (XAccessible) UnoRuntime.queryInterface( + xAccessible = UnoRuntime.queryInterface( XAccessible.class, xObject); } catch (Exception e) @@ -252,7 +252,7 @@ public class SimpleOffice */ public XWindow getCurrentWindow () { - return getCurrentWindow ((XModel) UnoRuntime.queryInterface( + return getCurrentWindow (UnoRuntime.queryInterface( XModel.class, getDesktop())); } @@ -290,7 +290,7 @@ public class SimpleOffice */ public XDrawPage getCurrentDrawPage () { - return getCurrentDrawPage ((XDrawView) UnoRuntime.queryInterface( + return getCurrentDrawPage (UnoRuntime.queryInterface( XDrawView.class, getCurrentView())); } @@ -345,7 +345,7 @@ public class SimpleOffice if (xController == null) MessageArea.println ("can't get controller to retrieve current view"); - xView = (XDrawView) UnoRuntime.queryInterface( + xView = UnoRuntime.queryInterface( XDrawView.class, xController); if (xView == null) MessageArea.println ("could not cast controller into view"); @@ -364,7 +364,7 @@ public class SimpleOffice // Return the accessible object of the document window. public static XAccessible getAccessibleDocumentWindow (XDrawPage xPage) { - XIndexAccess xShapeList = (XIndexAccess) UnoRuntime.queryInterface( + XIndexAccess xShapeList = UnoRuntime.queryInterface( XIndexAccess.class, xPage); if (xShapeList.getCount() > 0) { @@ -374,11 +374,11 @@ public class SimpleOffice // the object directly is implemented. XShape xShape = null; try{ - xShape = (XShape) UnoRuntime.queryInterface( + xShape = UnoRuntime.queryInterface( XShape.class, xShapeList.getByIndex (0)); } catch (Exception e) {} - XAccessible xAccessible = (XAccessible) UnoRuntime.queryInterface ( + XAccessible xAccessible = UnoRuntime.queryInterface ( XAccessible.class, xShape); return xAccessible; } diff --git a/toolkit/test/accessibility/TextUpdateListener.java b/toolkit/test/accessibility/TextUpdateListener.java index beb2995d28c0..3f22c6e5a66f 100644 --- a/toolkit/test/accessibility/TextUpdateListener.java +++ b/toolkit/test/accessibility/TextUpdateListener.java @@ -92,8 +92,8 @@ class TextUpdateListener implements TreeModelListener { // is this text editable? if not, fudge you and return XAccessibleEditableText xEdit = - (XAccessibleEditableText) UnoRuntime.queryInterface ( - XAccessibleEditableText.class, xText); + UnoRuntime.queryInterface ( + XAccessibleEditableText.class, xText); if (xEdit == null) return false; diff --git a/toolkit/test/accessibility/TopWindowListener.java b/toolkit/test/accessibility/TopWindowListener.java index 32d56dc11d45..46cc4429ea83 100644 --- a/toolkit/test/accessibility/TopWindowListener.java +++ b/toolkit/test/accessibility/TopWindowListener.java @@ -168,7 +168,7 @@ class TopWindowListener { if (maModel != null) { - XWindow xWindow = (XWindow) UnoRuntime.queryInterface( + XWindow xWindow = UnoRuntime.queryInterface( XWindow.class, aEvent.Source); if (xWindow == null) System.out.println ("event source is no XWindow"); @@ -191,7 +191,7 @@ class TopWindowListener { if (maModel != null) { - XWindow xWindow = (XWindow) UnoRuntime.queryInterface( + XWindow xWindow = UnoRuntime.queryInterface( XWindow.class, aEvent.Source); if (xWindow == null) System.out.println ("event source is no XWindow"); diff --git a/toolkit/test/accessibility/VectorNode.java b/toolkit/test/accessibility/VectorNode.java index 08d4f3369547..ed5e6524f0b4 100644 --- a/toolkit/test/accessibility/VectorNode.java +++ b/toolkit/test/accessibility/VectorNode.java @@ -25,13 +25,13 @@ import java.util.Vector; class VectorNode extends StringNode { - private Vector maChildren; + private Vector<AccessibleTreeNode> maChildren; public VectorNode (String sDisplayObject, AccessibleTreeNode aParent) { super (sDisplayObject, aParent); - maChildren = new Vector (); + maChildren = new Vector<AccessibleTreeNode> (); } public void addChild (AccessibleTreeNode aChild) @@ -47,7 +47,7 @@ class VectorNode public AccessibleTreeNode getChild (int nIndex) throws IndexOutOfBoundsException { - return (AccessibleTreeNode)maChildren.elementAt (nIndex); + return maChildren.elementAt (nIndex); } public boolean removeChild (int nIndex) diff --git a/toolkit/test/accessibility/ov/FocusView.java b/toolkit/test/accessibility/ov/FocusView.java index da47eb293fcc..fa87ef5a7d92 100644 --- a/toolkit/test/accessibility/ov/FocusView.java +++ b/toolkit/test/accessibility/ov/FocusView.java @@ -45,7 +45,7 @@ public class FocusView ObjectViewContainer aContainer, XAccessibleContext xContext) { - XAccessibleComponent xComponent = (XAccessibleComponent)UnoRuntime.queryInterface( + XAccessibleComponent xComponent = UnoRuntime.queryInterface( XAccessibleComponent.class, xContext); if (xComponent != null) return new FocusView (aContainer); @@ -80,7 +80,7 @@ public class FocusView */ public void SetObject (XAccessibleContext xObject) { - mxComponent = (XAccessibleComponent)UnoRuntime.queryInterface( + mxComponent = UnoRuntime.queryInterface( XAccessibleComponent.class, xObject); super.SetObject (xObject); } diff --git a/toolkit/test/accessibility/ov/ListeningObjectView.java b/toolkit/test/accessibility/ov/ListeningObjectView.java index 9b6e59a6dd2f..1b17ef973d3e 100644 --- a/toolkit/test/accessibility/ov/ListeningObjectView.java +++ b/toolkit/test/accessibility/ov/ListeningObjectView.java @@ -44,8 +44,8 @@ abstract class ListeningObjectView { super.SetObject (xContext); XAccessibleEventBroadcaster xBroadcaster = - (XAccessibleEventBroadcaster)UnoRuntime.queryInterface( - XAccessibleEventBroadcaster.class, xContext); + UnoRuntime.queryInterface( + XAccessibleEventBroadcaster.class, xContext); if (xBroadcaster != null) xBroadcaster.addEventListener (this); } @@ -58,8 +58,8 @@ abstract class ListeningObjectView { super.Destroy (); XAccessibleEventBroadcaster xBroadcaster = - (XAccessibleEventBroadcaster)UnoRuntime.queryInterface( - XAccessibleEventBroadcaster.class, mxContext); + UnoRuntime.queryInterface( + XAccessibleEventBroadcaster.class, mxContext); if (xBroadcaster != null) xBroadcaster.removeEventListener (this); } diff --git a/toolkit/test/accessibility/ov/ObjectViewContainer.java b/toolkit/test/accessibility/ov/ObjectViewContainer.java index 49916d6cc1f8..d9a9e816be1f 100644 --- a/toolkit/test/accessibility/ov/ObjectViewContainer.java +++ b/toolkit/test/accessibility/ov/ObjectViewContainer.java @@ -44,7 +44,7 @@ public class ObjectViewContainer { public ObjectViewContainer () { - maViewTemplates = new Vector (); + maViewTemplates = new Vector<Class> (); maViewBorder = BorderFactory.createBevelBorder (BevelBorder.RAISED); setLayout (new GridBagLayout ()); @@ -75,7 +75,7 @@ public class ObjectViewContainer { try { - Class aViewClass = (Class)maViewTemplates.elementAt (i); + Class aViewClass = maViewTemplates.elementAt (i); Method aCreateMethod = aViewClass.getDeclaredMethod ( "Create", new Class[] { ObjectViewContainer.class, @@ -176,5 +176,5 @@ public class ObjectViewContainer private JTree maTree; private Border maViewBorder; /// List of view templates which are instantiated when new object is set. - private Vector maViewTemplates; + private Vector<Class> maViewTemplates; } diff --git a/toolkit/test/accessibility/ov/SelectionView.java b/toolkit/test/accessibility/ov/SelectionView.java index ba5b2df8eec3..e6a06d7593c6 100644 --- a/toolkit/test/accessibility/ov/SelectionView.java +++ b/toolkit/test/accessibility/ov/SelectionView.java @@ -56,7 +56,7 @@ class SelectionView ObjectViewContainer aContainer, XAccessibleContext xContext) { - XAccessibleSelection xSelection = (XAccessibleSelection)UnoRuntime.queryInterface( + XAccessibleSelection xSelection = UnoRuntime.queryInterface( XAccessibleSelection.class, xContext); if (xSelection != null) return new SelectionView(aContainer); @@ -129,7 +129,7 @@ class SelectionView public void SetObject (XAccessibleContext xContext) { - mxSelection = (XAccessibleSelection)UnoRuntime.queryInterface( + mxSelection = UnoRuntime.queryInterface( XAccessibleSelection.class, xContext); super.SetObject (xContext); } diff --git a/toolkit/test/accessibility/ov/TextView.java b/toolkit/test/accessibility/ov/TextView.java index d5a551ef4f30..c93e6086e2f4 100644 --- a/toolkit/test/accessibility/ov/TextView.java +++ b/toolkit/test/accessibility/ov/TextView.java @@ -38,7 +38,7 @@ public class TextView ObjectViewContainer aContainer, XAccessibleContext xContext) { - XAccessibleText xText = (XAccessibleText)UnoRuntime.queryInterface( + XAccessibleText xText = UnoRuntime.queryInterface( XAccessibleText.class, xContext); if (xText != null) return new TextView (aContainer); @@ -86,7 +86,7 @@ public class TextView */ public void SetObject (XAccessibleContext xObject) { - mxText = (XAccessibleText)UnoRuntime.queryInterface( + mxText = UnoRuntime.queryInterface( XAccessibleText.class, xObject); super.SetObject (xObject); } diff --git a/toolkit/test/accessibility/tools/NameProvider.java b/toolkit/test/accessibility/tools/NameProvider.java index 4f1611685560..ccd735610001 100644 --- a/toolkit/test/accessibility/tools/NameProvider.java +++ b/toolkit/test/accessibility/tools/NameProvider.java @@ -40,7 +40,7 @@ public class NameProvider */ public static String getStateName (int nStateId) { - return (String)maStateMap.get (new Integer(nStateId)); + return maStateMap.get (new Integer(nStateId)); } @@ -55,7 +55,7 @@ public class NameProvider */ public static String getEventName (int nEventId) { - return (String)maEventMap.get (new Integer(nEventId)); + return maEventMap.get (new Integer(nEventId)); } @@ -70,7 +70,7 @@ public class NameProvider */ public static String getRoleName (int nRole) { - return (String)maRoleMap.get (new Integer(nRole)); + return maRoleMap.get (new Integer(nRole)); } @@ -85,14 +85,14 @@ public class NameProvider */ public static String getRelationName (int nRelation) { - return (String)maRelationMap.get (new Integer(nRelation)); + return maRelationMap.get (new Integer(nRelation)); } - private static HashMap maStateMap = new HashMap(); - private static HashMap maEventMap = new HashMap(); - private static HashMap maRoleMap = new HashMap(); - private static HashMap maRelationMap = new HashMap(); + private static HashMap<Integer, String> maStateMap = new HashMap<Integer, String>(); + private static HashMap<Integer, String> maEventMap = new HashMap<Integer, String>(); + private static HashMap<Integer, String> maRoleMap = new HashMap<Integer, String>(); + private static HashMap<Integer, String> maRelationMap = new HashMap<Integer, String>(); static { maStateMap.put (new Integer (AccessibleStateType.INVALID), "INVALID"); |