summaryrefslogtreecommitdiff
path: root/toolkit
diff options
context:
space:
mode:
authorNoel Grandin <noel@peralex.com>2013-05-03 14:35:04 +0200
committerNoel Grandin <noel@peralex.com>2013-05-06 11:45:50 +0200
commit587c59fbc931b12f4d63d077a78bcaa43ffbf83d (patch)
treec1984991960664faf41ea3e32e3804404aecb22d /toolkit
parent95e1ecbf89f75e2b298b931c3cc2e0d5655c31ed (diff)
Java cleanup, Convert Vector to ArrayList
Change-Id: I323a6625f93347e69f3114fc10cb04dc759a539f
Diffstat (limited to 'toolkit')
-rw-r--r--toolkit/test/accessibility/AccTreeNode.java24
-rw-r--r--toolkit/test/accessibility/AccessibilityTree.java26
-rw-r--r--toolkit/test/accessibility/AccessibilityTreeModel.java18
-rw-r--r--toolkit/test/accessibility/AccessibilityTreeModelBase.java9
-rw-r--r--toolkit/test/accessibility/AccessibleTreeCellRenderer.java24
-rw-r--r--toolkit/test/accessibility/AccessibleTreeNode.java7
-rw-r--r--toolkit/test/accessibility/SelectionDialog.java22
-rw-r--r--toolkit/test/accessibility/VectorNode.java9
-rw-r--r--toolkit/test/accessibility/ov/ObjectViewContainer.java24
9 files changed, 96 insertions, 67 deletions
diff --git a/toolkit/test/accessibility/AccTreeNode.java b/toolkit/test/accessibility/AccTreeNode.java
index 47cd3924b7bd..a1ed20702953 100644
--- a/toolkit/test/accessibility/AccTreeNode.java
+++ b/toolkit/test/accessibility/AccTreeNode.java
@@ -16,9 +16,17 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
+import java.util.ArrayList;
+
+import com.sun.star.accessibility.XAccessible;
+import com.sun.star.accessibility.XAccessibleComponent;
+import com.sun.star.accessibility.XAccessibleContext;
+import com.sun.star.accessibility.XAccessibleEditableText;
+import com.sun.star.accessibility.XAccessibleExtendedComponent;
+import com.sun.star.accessibility.XAccessibleSelection;
+import com.sun.star.accessibility.XAccessibleTable;
+import com.sun.star.accessibility.XAccessibleText;
import com.sun.star.uno.UnoRuntime;
-import com.sun.star.accessibility.*;
-import java.util.Vector;
/**
* The node type for the AccessibleTreeModel.
@@ -40,7 +48,7 @@ class AccTreeNode
public int mnChildCount;
}
/// NodeHandlers for this node
- private Vector<HandlerDescriptor> maHandlers;
+ private ArrayList<HandlerDescriptor> maHandlers;
// The accessible context of this node.
private XAccessible mxAccessible;
@@ -58,7 +66,7 @@ class AccTreeNode
{
super (aDisplay, aParent);
- maHandlers = new Vector<HandlerDescriptor>(5);
+ maHandlers = new ArrayList<HandlerDescriptor>(5);
mxContext = xContext;
mxAccessible = xAccessible;
}
@@ -276,7 +284,7 @@ class AccTreeNode
/** iterate over handlers until the child is found */
- public void getActions(Vector<String> aActions)
+ public void getActions(java.util.List<String> aActions)
{
for(int i = 0; i < maHandlers.size(); i++)
{
@@ -338,14 +346,14 @@ class AccTreeNode
The returned array containes the indices of the updated children
and can be used to create a TreeModelEvent.
*/
- public Vector<Integer> updateChildren (java.lang.Class class1)
+ public java.util.List<Integer> updateChildren (java.lang.Class class1)
{
return updateChildren (class1, null);
}
- public Vector<Integer> updateChildren (java.lang.Class class1, java.lang.Class<AccessibleExtendedComponentHandler> class2)
+ public java.util.List<Integer> updateChildren (java.lang.Class class1, java.lang.Class<AccessibleExtendedComponentHandler> class2)
{
- Vector<Integer> aChildIndices = new Vector<Integer>();
+ ArrayList<Integer> aChildIndices = new ArrayList<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 071181d1d620..4d90adf1b2c2 100644
--- a/toolkit/test/accessibility/AccessibilityTree.java
+++ b/toolkit/test/accessibility/AccessibilityTree.java
@@ -16,13 +16,21 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-import com.sun.star.accessibility.*;
-import java.util.Vector;
-import java.awt.*;
-import java.awt.event.*;
-import javax.swing.*;
-import javax.swing.tree.*;
-import javax.swing.event.*;
+import java.awt.Cursor;
+import java.awt.event.ActionEvent;
+import java.awt.event.MouseAdapter;
+import java.awt.event.MouseEvent;
+import java.util.ArrayList;
+
+import javax.swing.AbstractAction;
+import javax.swing.JPopupMenu;
+import javax.swing.JTree;
+import javax.swing.event.TreeExpansionEvent;
+import javax.swing.event.TreeExpansionListener;
+import javax.swing.event.TreeWillExpandListener;
+import javax.swing.tree.TreePath;
+
+import com.sun.star.accessibility.XAccessibleContext;
@@ -252,7 +260,7 @@ public class AccessibilityTree
{
AccTreeNode aNode = (AccTreeNode)aObject;
- Vector<String> aActions = new Vector<String>();
+ ArrayList<String> aActions = new ArrayList<String>();
aMenu.add (new AccessibilityTree.ShapeExpandAction(maTree, aNode));
aMenu.add (new AccessibilityTree.SubtreeExpandAction(maTree, aNode));
@@ -260,7 +268,7 @@ public class AccessibilityTree
for( int i = 0; i < aActions.size(); i++ )
{
aMenu.add( new NodeAction(
- aActions.elementAt(i).toString(),
+ aActions.get(i).toString(),
aNode, i ) );
}
}
diff --git a/toolkit/test/accessibility/AccessibilityTreeModel.java b/toolkit/test/accessibility/AccessibilityTreeModel.java
index 9c3a868b3bce..8d54cd66fb85 100644
--- a/toolkit/test/accessibility/AccessibilityTreeModel.java
+++ b/toolkit/test/accessibility/AccessibilityTreeModel.java
@@ -16,14 +16,16 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
+import java.util.ArrayList;
+
import javax.swing.event.TreeModelEvent;
import javax.swing.event.TreeModelListener;
import javax.swing.tree.TreePath;
-
-import java.util.Vector;
-import com.sun.star.accessibility.*;
-
+import com.sun.star.accessibility.XAccessible;
+import com.sun.star.accessibility.XAccessibleContext;
+import com.sun.star.accessibility.XAccessibleEventBroadcaster;
+import com.sun.star.accessibility.XAccessibleEventListener;
import com.sun.star.uno.UnoRuntime;
public class AccessibilityTreeModel
@@ -292,7 +294,7 @@ public class AccessibilityTreeModel
*/
protected Object[] createPath (AccessibleTreeNode aNode)
{
- Vector<AccessibleTreeNode> aPath = new Vector<AccessibleTreeNode>();
+ ArrayList<AccessibleTreeNode> aPath = new ArrayList<AccessibleTreeNode>();
aNode.createPath (aPath);
return aPath.toArray();
}
@@ -391,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<Integer> aChildIndices)
+ protected TreeModelEvent createChangeEvent (AccTreeNode aNode, java.util.List<Integer> aChildIndices)
{
// Build a list of child objects that are indicated by the given indices.
int nCount = aChildIndices.size();
@@ -399,7 +401,7 @@ public class AccessibilityTreeModel
int nChildIndices[] = new int[nCount];
for (int i=0; i<nCount; i++)
{
- int nIndex = aChildIndices.elementAt(i);
+ int nIndex = aChildIndices.get(i);
aChildObjects[i] = aNode.getChild (nIndex);
nChildIndices[i] = nIndex;
}
@@ -493,7 +495,7 @@ public class AccessibilityTreeModel
{
aNode = (AccTreeNode) aTreeNode;
// Get list of affected children.
- Vector<Integer> aChildIndices = (aNode).updateChildren (
+ java.util.List<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 264ac3b0d308..b15379e7d994 100644
--- a/toolkit/test/accessibility/AccessibilityTreeModelBase.java
+++ b/toolkit/test/accessibility/AccessibilityTreeModelBase.java
@@ -16,10 +16,11 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-import javax.swing.tree.TreeModel;
+import java.util.ArrayList;
+
import javax.swing.event.TreeModelListener;
+import javax.swing.tree.TreeModel;
import javax.swing.tree.TreePath;
-import java.util.Vector;
public class AccessibilityTreeModelBase
implements TreeModel
@@ -27,7 +28,7 @@ public class AccessibilityTreeModelBase
public AccessibilityTreeModelBase ()
{
setRoot (null);
- maTMListeners = new Vector<TreeModelListener>();
+ maTMListeners = new ArrayList<TreeModelListener>();
}
public synchronized void addTreeModelListener(TreeModelListener l)
@@ -132,7 +133,7 @@ public class AccessibilityTreeModelBase
// The list of TreeModelListener objects.
- protected Vector<TreeModelListener> maTMListeners;
+ protected ArrayList<TreeModelListener> maTMListeners;
// The root node of the tree. Use setRoot to change it.
private AccessibleTreeNode maRoot = null;
diff --git a/toolkit/test/accessibility/AccessibleTreeCellRenderer.java b/toolkit/test/accessibility/AccessibleTreeCellRenderer.java
index 169fe9691b2a..43705abb055e 100644
--- a/toolkit/test/accessibility/AccessibleTreeCellRenderer.java
+++ b/toolkit/test/accessibility/AccessibleTreeCellRenderer.java
@@ -16,12 +16,14 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-import javax.swing.tree.DefaultTreeCellRenderer;
-import javax.swing.tree.TreePath;
-import javax.swing.JTree;
import java.awt.Color;
import java.awt.Component;
-import java.util.Vector;
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.swing.JTree;
+import javax.swing.tree.DefaultTreeCellRenderer;
+import javax.swing.tree.TreePath;
public class AccessibleTreeCellRenderer
@@ -30,7 +32,7 @@ public class AccessibleTreeCellRenderer
public Color
maDefaultColor,
maChangedColor;
- protected Vector<Boolean>
+ protected ArrayList<Boolean>
maChangedLines;
@@ -39,7 +41,7 @@ public class AccessibleTreeCellRenderer
{
maDefaultColor = Color.black;
maChangedColor = Color.red;
- maChangedLines = new Vector<Boolean> ();
+ maChangedLines = new ArrayList<Boolean> ();
}
public Component getTreeCellRendererComponent (
@@ -56,7 +58,7 @@ public class AccessibleTreeCellRenderer
expanded, leaf, row,
hasFocus);
- if (maChangedLines.size()<=row || maChangedLines.elementAt (row) == null)
+ if (maChangedLines.size()<=row || maChangedLines.get (row) == null)
setTextNonSelectionColor (maDefaultColor);
else
setTextNonSelectionColor (maChangedColor);
@@ -76,8 +78,8 @@ public class AccessibleTreeCellRenderer
*/
public void addChangedLine (int nRow)
{
- if (maChangedLines.size() <= nRow)
- maChangedLines.setSize (nRow+1);
+ while (maChangedLines.size() <= nRow)
+ maChangedLines.add(null);
nRow -= 1; // row index is one to large for some reason.
maChangedLines.set (nRow, true);
}
@@ -90,11 +92,11 @@ public class AccessibleTreeCellRenderer
The JTree that is used to transform the given TreePath objects
into rows.
*/
- public void addChangedNodes (Vector<TreePath> aChangedNodes, JTree aTree)
+ public void addChangedNodes (List<TreePath> aChangedNodes, JTree aTree)
{
for (int i=0; i<aChangedNodes.size(); i++)
{
- TreePath aPath = aChangedNodes.elementAt (i);
+ TreePath aPath = aChangedNodes.get (i);
int nRow = aTree.getRowForPath (aPath);
addChangedLine (nRow);
}
diff --git a/toolkit/test/accessibility/AccessibleTreeNode.java b/toolkit/test/accessibility/AccessibleTreeNode.java
index ff77f4a5f9a1..b0a8a782c017 100644
--- a/toolkit/test/accessibility/AccessibleTreeNode.java
+++ b/toolkit/test/accessibility/AccessibleTreeNode.java
@@ -16,7 +16,8 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-import java.util.Vector;
+import java.util.ArrayList;
+
import com.sun.star.lang.IndexOutOfBoundsException;
/**
@@ -82,7 +83,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<AccessibleTreeNode> aPath)
+ public void createPath (java.util.List<AccessibleTreeNode> aPath)
{
if (maParent != null)
maParent.createPath (aPath);
@@ -91,7 +92,7 @@ class AccessibleTreeNode
public Object[] createPath ()
{
- Vector<AccessibleTreeNode> aPath = new Vector<AccessibleTreeNode> (1);
+ ArrayList<AccessibleTreeNode> aPath = new ArrayList<AccessibleTreeNode> (1);
createPath (aPath);
return aPath.toArray();
}
diff --git a/toolkit/test/accessibility/SelectionDialog.java b/toolkit/test/accessibility/SelectionDialog.java
index b5272646a02d..5ca8ca846654 100644
--- a/toolkit/test/accessibility/SelectionDialog.java
+++ b/toolkit/test/accessibility/SelectionDialog.java
@@ -16,17 +16,27 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
+import java.awt.BorderLayout;
+import java.awt.Container;
+import java.awt.Dimension;
+import java.awt.FlowLayout;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.util.Vector;
+
+import javax.swing.JButton;
+import javax.swing.JDialog;
+import javax.swing.JLabel;
+import javax.swing.JList;
+import javax.swing.JOptionPane;
+import javax.swing.JPanel;
+import javax.swing.ListSelectionModel;
+
import com.sun.star.accessibility.XAccessible;
import com.sun.star.accessibility.XAccessibleContext;
import com.sun.star.accessibility.XAccessibleSelection;
import com.sun.star.lang.IndexOutOfBoundsException;
-import javax.swing.*;
-import java.awt.*;
-import java.util.Vector;
-import java.awt.event.ActionListener;
-import java.awt.event.ActionEvent;
-
/**
* Display a dialog with a list-box of children and select/deselect buttons
*/
diff --git a/toolkit/test/accessibility/VectorNode.java b/toolkit/test/accessibility/VectorNode.java
index ed5e6524f0b4..2a63b81dad0d 100644
--- a/toolkit/test/accessibility/VectorNode.java
+++ b/toolkit/test/accessibility/VectorNode.java
@@ -16,8 +16,9 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
+import java.util.ArrayList;
+
import com.sun.star.lang.IndexOutOfBoundsException;
-import java.util.Vector;
/** The VectorNode class is a simple container whose list of children is
managed entirely by its owner.
@@ -25,13 +26,13 @@ import java.util.Vector;
class VectorNode
extends StringNode
{
- private Vector<AccessibleTreeNode> maChildren;
+ private ArrayList<AccessibleTreeNode> maChildren;
public VectorNode (String sDisplayObject, AccessibleTreeNode aParent)
{
super (sDisplayObject, aParent);
- maChildren = new Vector<AccessibleTreeNode> ();
+ maChildren = new ArrayList<AccessibleTreeNode> ();
}
public void addChild (AccessibleTreeNode aChild)
@@ -47,7 +48,7 @@ class VectorNode
public AccessibleTreeNode getChild (int nIndex)
throws IndexOutOfBoundsException
{
- return maChildren.elementAt (nIndex);
+ return maChildren.get(nIndex);
}
public boolean removeChild (int nIndex)
diff --git a/toolkit/test/accessibility/ov/ObjectViewContainer.java b/toolkit/test/accessibility/ov/ObjectViewContainer.java
index d9a9e816be1f..e4e0d205e7ad 100644
--- a/toolkit/test/accessibility/ov/ObjectViewContainer.java
+++ b/toolkit/test/accessibility/ov/ObjectViewContainer.java
@@ -19,22 +19,18 @@
package ov;
import java.awt.Component;
-import java.awt.GridBagLayout;
import java.awt.GridBagConstraints;
+import java.awt.GridBagLayout;
import java.awt.Insets;
-
-import java.util.Vector;
-
-import java.lang.reflect.Method;
-import java.lang.NoSuchMethodException;
-import java.lang.IllegalAccessException;
import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.util.ArrayList;
+import javax.swing.BorderFactory;
import javax.swing.JPanel;
import javax.swing.JTree;
-import javax.swing.BorderFactory;
-import javax.swing.border.Border;
import javax.swing.border.BevelBorder;
+import javax.swing.border.Border;
import com.sun.star.accessibility.XAccessibleContext;
@@ -44,7 +40,7 @@ public class ObjectViewContainer
{
public ObjectViewContainer ()
{
- maViewTemplates = new Vector<Class> ();
+ maViewTemplates = new ArrayList<Class> ();
maViewBorder = BorderFactory.createBevelBorder (BevelBorder.RAISED);
setLayout (new GridBagLayout ());
@@ -75,7 +71,7 @@ public class ObjectViewContainer
{
try
{
- Class aViewClass = maViewTemplates.elementAt (i);
+ Class aViewClass = maViewTemplates.get (i);
Method aCreateMethod = aViewClass.getDeclaredMethod (
"Create", new Class[] {
ObjectViewContainer.class,
@@ -112,7 +108,7 @@ public class ObjectViewContainer
public void RegisterView (Class aObjectViewClass)
{
System.out.println ("registering " + aObjectViewClass);
- maViewTemplates.addElement (aObjectViewClass);
+ maViewTemplates.add(aObjectViewClass);
}
/** Replace one view class with another.
@@ -121,7 +117,7 @@ public class ObjectViewContainer
{
int nIndex = maViewTemplates.indexOf (aObjectViewClass);
if (nIndex >= 0)
- maViewTemplates.setElementAt (aSubstitution, nIndex);
+ maViewTemplates.set (nIndex, aSubstitution);
}
/** Add an object view and place it below all previously added views.
@@ -176,5 +172,5 @@ public class ObjectViewContainer
private JTree maTree;
private Border maViewBorder;
/// List of view templates which are instantiated when new object is set.
- private Vector<Class> maViewTemplates;
+ private ArrayList<Class> maViewTemplates;
}