diff options
author | Noel Grandin <noel@peralex.com> | 2013-05-03 14:35:04 +0200 |
---|---|---|
committer | Noel Grandin <noel@peralex.com> | 2013-05-06 11:45:50 +0200 |
commit | 587c59fbc931b12f4d63d077a78bcaa43ffbf83d (patch) | |
tree | c1984991960664faf41ea3e32e3804404aecb22d | |
parent | 95e1ecbf89f75e2b298b931c3cc2e0d5655c31ed (diff) |
Java cleanup, Convert Vector to ArrayList
Change-Id: I323a6625f93347e69f3114fc10cb04dc759a539f
52 files changed, 462 insertions, 423 deletions
diff --git a/bean/test/applet/oooapplet/OOoViewer.java b/bean/test/applet/oooapplet/OOoViewer.java index e09f78e88821..6ea9270b199f 100644 --- a/bean/test/applet/oooapplet/OOoViewer.java +++ b/bean/test/applet/oooapplet/OOoViewer.java @@ -124,7 +124,7 @@ public class OOoViewer extends Applet { final class CustomURLClassLoader extends URLClassLoader { - private Vector<URL> resourcePaths; + private ArrayList<URL> resourcePaths; public CustomURLClassLoader( URL[] urls ) { super( urls ); @@ -163,7 +163,7 @@ final class CustomURLClassLoader extends URLClassLoader { } public void addResourcePath(URL rurl) { - if (resourcePaths == null) resourcePaths = new Vector<URL>(); + if (resourcePaths == null) resourcePaths = new ArrayList<URL>(); resourcePaths.add(rurl); } @@ -175,10 +175,8 @@ final class CustomURLClassLoader extends URLClassLoader { return result; } - URL u = null; URI uri = null; - for (Enumeration<URL> e = resourcePaths.elements(); e.hasMoreElements();) { - u = e.nextElement(); + for (URL u : resourcePaths) { if (u.getProtocol().startsWith("file")){ try { File f1 = new File(u.getPath()); diff --git a/embeddedobj/test/Container1/EmbedContApp.java b/embeddedobj/test/Container1/EmbedContApp.java index 737267a19a15..89dc27cf397f 100644 --- a/embeddedobj/test/Container1/EmbedContApp.java +++ b/embeddedobj/test/Container1/EmbedContApp.java @@ -125,7 +125,6 @@ public class EmbedContApp extends Applet private String m_aLinkURI; private Object m_oActionsNumberLock; - private Vector m_aActionsList; private Timer m_aTimer; private boolean m_bDestroyed = false; diff --git a/forms/qa/complex/forms/CheckOGroupBoxModel.java b/forms/qa/complex/forms/CheckOGroupBoxModel.java index 33b6c2ed3dcd..62b97c9d9e70 100644 --- a/forms/qa/complex/forms/CheckOGroupBoxModel.java +++ b/forms/qa/complex/forms/CheckOGroupBoxModel.java @@ -17,31 +17,35 @@ */ package complex.forms; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; + +import java.util.ArrayList; + +import org.junit.After; +import org.junit.AfterClass; +import org.junit.Before; +import org.junit.BeforeClass; +import org.junit.Test; +import org.openoffice.test.OfficeConnection; + +import util.FormTools; +import util.SOfficeFactory; +import util.ValueChanger; + import com.sun.star.beans.Property; import com.sun.star.beans.PropertyAttribute; import com.sun.star.beans.PropertyChangeEvent; import com.sun.star.beans.XMultiPropertySet; import com.sun.star.beans.XPropertiesChangeListener; -import com.sun.star.lang.EventObject; import com.sun.star.drawing.XControlShape; +import com.sun.star.lang.EventObject; import com.sun.star.lang.XComponent; import com.sun.star.lang.XMultiServiceFactory; import com.sun.star.uno.UnoRuntime; -// import complexlib.ComplexTestCase; import com.sun.star.util.CloseVetoException; import com.sun.star.util.XCloseable; -import java.util.Vector; -import util.FormTools; -import util.SOfficeFactory; -import util.ValueChanger; - -import org.junit.After; -import org.junit.AfterClass; -import org.junit.Before; -import org.junit.BeforeClass; -import org.junit.Test; -import org.openoffice.test.OfficeConnection; -import static org.junit.Assert.*; +// import complexlib.ComplexTestCase; /** */ @@ -130,7 +134,7 @@ public class CheckOGroupBoxModel Property[] properties = m_xPropSet.getPropertySetInfo().getProperties(); String[] testPropsNames = null; - Vector<String> tNames = new Vector<String>(); + ArrayList<String> tNames = new ArrayList<String>(); for (int i = 0; i < properties.length; i++) { diff --git a/forms/qa/integration/forms/ListBox.java b/forms/qa/integration/forms/ListBox.java index acdfc71fbfef..d6c574973fa9 100644 --- a/forms/qa/integration/forms/ListBox.java +++ b/forms/qa/integration/forms/ListBox.java @@ -17,6 +17,10 @@ */ package integration.forms; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.Map; + import com.sun.star.awt.XListBox; import com.sun.star.beans.XPropertySet; import com.sun.star.container.XChild; @@ -32,13 +36,11 @@ import com.sun.star.sdbc.XParameters; import com.sun.star.sdbc.XPreparedStatement; import com.sun.star.uno.Exception; import com.sun.star.uno.UnoRuntime; + import connectivity.tools.HsqlColumnDescriptor; import connectivity.tools.HsqlDatabase; import connectivity.tools.HsqlTableDescriptor; import connectivity.tools.sdb.Connection; -import java.util.HashMap; -import java.util.Map; -import java.util.Vector; public class ListBox extends TestCase { @@ -175,10 +177,10 @@ public class ListBox extends TestCase final String[] keyTypes = fieldDefinitions[0]; final String[] keyCreationArgs = fieldDefinitions[1]; - Vector< HsqlColumnDescriptor > foreignKeyColumns = new Vector< HsqlColumnDescriptor >(); + ArrayList< HsqlColumnDescriptor > foreignKeyColumns = new ArrayList< HsqlColumnDescriptor >(); foreignKeyColumns.add( new HsqlColumnDescriptor( "ID", "integer", HsqlColumnDescriptor.PRIMARY ) ); - Vector< String[] > foreignKeyValues = new Vector< String[] >(); + ArrayList< String[] > foreignKeyValues = new ArrayList< String[] >(); StringBuffer foreignKeyInsertSQL = new StringBuffer(); foreignKeyInsertSQL.append( "INSERT INTO \"" + m_foreignKeyTableName + "\" VALUES (?" ); diff --git a/nlpsolver/src/com/sun/star/comp/Calc/NLPSolver/DEPSSolverImpl.java b/nlpsolver/src/com/sun/star/comp/Calc/NLPSolver/DEPSSolverImpl.java index 6c549268c135..523ae209ca9a 100644 --- a/nlpsolver/src/com/sun/star/comp/Calc/NLPSolver/DEPSSolverImpl.java +++ b/nlpsolver/src/com/sun/star/comp/Calc/NLPSolver/DEPSSolverImpl.java @@ -27,22 +27,23 @@ package com.sun.star.comp.Calc.NLPSolver; -import com.sun.star.comp.Calc.NLPSolver.dialogs.IEvolutionarySolverStatusDialog; -import com.sun.star.lang.IllegalArgumentException; -import com.sun.star.uno.XComponentContext; -import com.sun.star.lib.uno.helper.Factory; -import com.sun.star.lang.XSingleComponentFactory; -import com.sun.star.registry.XRegistryKey; import java.util.logging.Level; import java.util.logging.Logger; + import net.adaptivebox.deps.DEPSAgent; import net.adaptivebox.deps.behavior.DEGTBehavior; import net.adaptivebox.deps.behavior.PSGTBehavior; import net.adaptivebox.global.IUpdateCycleEngine; -import net.adaptivebox.knowledge.ILibEngine; import net.adaptivebox.knowledge.Library; import net.adaptivebox.knowledge.SearchPoint; +import com.sun.star.comp.Calc.NLPSolver.dialogs.IEvolutionarySolverStatusDialog; +import com.sun.star.lang.IllegalArgumentException; +import com.sun.star.lang.XSingleComponentFactory; +import com.sun.star.lib.uno.helper.Factory; +import com.sun.star.registry.XRegistryKey; +import com.sun.star.uno.XComponentContext; + public final class DEPSSolverImpl extends BaseEvolutionarySolver implements com.sun.star.lang.XServiceInfo diff --git a/odk/examples/DevelopersGuide/Forms/ButtonOperator.java b/odk/examples/DevelopersGuide/Forms/ButtonOperator.java index a447381a2c69..3d121589d8e6 100644 --- a/odk/examples/DevelopersGuide/Forms/ButtonOperator.java +++ b/odk/examples/DevelopersGuide/Forms/ButtonOperator.java @@ -32,6 +32,8 @@ * *************************************************************************/ // java base stuff +import java.util.ArrayList; + import com.sun.star.awt.ActionEvent; import com.sun.star.awt.XActionListener; import com.sun.star.awt.XButton; @@ -42,7 +44,6 @@ import com.sun.star.form.runtime.XFormOperations; import com.sun.star.lang.EventObject; import com.sun.star.uno.UnoRuntime; import com.sun.star.uno.XComponentContext; -import java.util.Vector; /**************************************************************************/ @@ -55,7 +56,7 @@ public class ButtonOperator implements XActionListener, XFeatureInvalidation private XPropertySet m_form; private XFormOperations m_formOperations; - private Vector<XPropertySet> m_aButtons; + private ArrayList<XPropertySet> m_aButtons; /* ------------------------------------------------------------------ */ /** ctor @@ -65,7 +66,7 @@ public class ButtonOperator implements XActionListener, XFeatureInvalidation m_componentContext = xCtx; m_aDocument = aDocument; m_form = _form; - m_aButtons = new Vector<XPropertySet>(); + m_aButtons = new ArrayList<XPropertySet>(); } /* ------------------------------------------------------------------ */ @@ -89,7 +90,7 @@ public class ButtonOperator implements XActionListener, XFeatureInvalidation { for ( int i=0; i < m_aButtons.size(); ++i ) { - XPropertySet button = m_aButtons.elementAt( i ); + XPropertySet button = m_aButtons.get( i ); if ( _formFeature == getAssociatedFormFeature( button ) ) return button; } @@ -104,7 +105,7 @@ public class ButtonOperator implements XActionListener, XFeatureInvalidation int nPos = -1; for ( int i=0; ( i < m_aButtons.size() ) && ( -1 == nPos ); ++i ) { - if ( xButton.equals( m_aButtons.elementAt( i ) ) ) + if ( xButton.equals( m_aButtons.get( i ) ) ) nPos = i; } return nPos; @@ -207,9 +208,8 @@ public class ButtonOperator implements XActionListener, XFeatureInvalidation public void invalidateAllFeatures() throws com.sun.star.uno.RuntimeException { - for ( int i=0; i < m_aButtons.size(); ++i ) + for ( XPropertySet buttonModel : m_aButtons ) { - XPropertySet buttonModel = m_aButtons.elementAt( i ); updateButtonState( buttonModel, getAssociatedFormFeature( buttonModel ) ); } } diff --git a/odk/examples/DevelopersGuide/Forms/SalesFilter.java b/odk/examples/DevelopersGuide/Forms/SalesFilter.java index e4c516160d0f..33053db662ca 100644 --- a/odk/examples/DevelopersGuide/Forms/SalesFilter.java +++ b/odk/examples/DevelopersGuide/Forms/SalesFilter.java @@ -362,7 +362,7 @@ class SalesFilter implements XActionListener, XPropertyChangeListener, XResetLis String[] aOldFilterItems = (String[])m_xFilterList.getPropertyValue( "StringItemList" ); // translate this into a vector - much more comfort to work with a vector than with an array .... - java.util.Vector aFilterItems = new java.util.Vector(); + java.util.ArrayList aFilterItems = new java.util.ArrayList(); for ( int i=0; i<aOldFilterItems.length; ++i ) aFilterItems.add( aOldFilterItems[i] ); @@ -384,7 +384,7 @@ class SalesFilter implements XActionListener, XPropertyChangeListener, XResetLis if ( aFilterItems.size() > 10 ) // (6 standard items + 5 user defined items) { // the first (and thus oldes) user defined item - aFilterItems.removeElementAt( 6 ); + aFilterItems.remove( 6 ); // keep our date vector synchron m_aFilterDates.removeElementAt( 6 ); } @@ -397,7 +397,7 @@ class SalesFilter implements XActionListener, XPropertyChangeListener, XResetLis m_bAdjustingFilterList = true; String[] aNewFilterItems = new String[ aFilterItems.size() ]; for ( int i=0; i<aFilterItems.size(); ++i ) - aNewFilterItems[i] = (String)aFilterItems.elementAt( i ); + aNewFilterItems[i] = (String)aFilterItems.get( i ); m_xFilterList.setPropertyValue( "StringItemList", aNewFilterItems ); m_bAdjustingFilterList = false; diff --git a/odk/examples/DevelopersGuide/OfficeDev/DesktopEnvironment/IOnewayLink.java b/odk/examples/DevelopersGuide/OfficeDev/DesktopEnvironment/IOnewayLink.java index 180137c9f61c..0ab7aa0cd606 100644 --- a/odk/examples/DevelopersGuide/OfficeDev/DesktopEnvironment/IOnewayLink.java +++ b/odk/examples/DevelopersGuide/OfficeDev/DesktopEnvironment/IOnewayLink.java @@ -32,7 +32,7 @@ * *************************************************************************/ -import java.util.Vector; +import java.util.ArrayList; // __________ Implementation __________ @@ -64,5 +64,5 @@ public interface IOnewayLink * Note: Atomic types (e.g. int, long) will be transported as objects * too (Integer, Long)! */ - public abstract void execOneway( int nRequest, Vector<Object> lParams ); + public abstract void execOneway( int nRequest, ArrayList<Object> lParams ); } diff --git a/odk/examples/DevelopersGuide/OfficeDev/DesktopEnvironment/Interceptor.java b/odk/examples/DevelopersGuide/OfficeDev/DesktopEnvironment/Interceptor.java index c9fe4f38c33f..628cc587c83d 100644 --- a/odk/examples/DevelopersGuide/OfficeDev/DesktopEnvironment/Interceptor.java +++ b/odk/examples/DevelopersGuide/OfficeDev/DesktopEnvironment/Interceptor.java @@ -34,7 +34,7 @@ // __________ Imports __________ -import java.util.Vector; +import java.util.ArrayList; import com.sun.star.frame.FrameActionEvent; import com.sun.star.uno.UnoRuntime; @@ -160,7 +160,7 @@ public class Interceptor implements com.sun.star.frame.XFrameActionListener, * @param lParams * the vector with all packed parameters of the original request */ - public void execOneway(/*IN*/ int nRequest,/*IN*/ Vector<Object> lParams ) + public void execOneway(/*IN*/ int nRequest,/*IN*/ ArrayList<Object> lParams ) { synchronized(this) { @@ -234,7 +234,7 @@ public class Interceptor implements com.sun.star.frame.XFrameActionListener, return; // pack the event and start thread - which call us back later - Vector<Object> lOutParams = new Vector<Object>(); + ArrayList<Object> lOutParams = new ArrayList<Object>(); lOutParams.add(aEvent); OnewayExecutor aExecutor = new OnewayExecutor( this , @@ -272,7 +272,7 @@ public class Interceptor implements com.sun.star.frame.XFrameActionListener, lInURL[0] = aURL ; lInArguments[0] = lArguments; - Vector<Object> lOutParams = OnewayExecutor.encodeDispatch( + ArrayList<Object> lOutParams = OnewayExecutor.encodeDispatch( lInURL , lInArguments ); OnewayExecutor aExecutor = new OnewayExecutor( this , diff --git a/odk/examples/DevelopersGuide/OfficeDev/DesktopEnvironment/OnewayExecutor.java b/odk/examples/DevelopersGuide/OfficeDev/DesktopEnvironment/OnewayExecutor.java index 0f48ede996ae..2861b23bde3a 100644 --- a/odk/examples/DevelopersGuide/OfficeDev/DesktopEnvironment/OnewayExecutor.java +++ b/odk/examples/DevelopersGuide/OfficeDev/DesktopEnvironment/OnewayExecutor.java @@ -32,7 +32,7 @@ * *************************************************************************/ -import java.util.Vector; +import java.util.ArrayList; // __________ Implementation __________ @@ -76,7 +76,7 @@ class OnewayExecutor extends Thread */ private IOnewayLink m_rLink ; private int m_nRequest ; - private Vector<Object> m_lParams ; + private ArrayList<Object> m_lParams ; // _______________________________ @@ -102,7 +102,7 @@ class OnewayExecutor extends Thread */ public OnewayExecutor( IOnewayLink rLink , int nRequest , - Vector<Object> lParams ) + ArrayList<Object> lParams ) { m_rLink = rLink ; m_nRequest = nRequest; @@ -144,13 +144,13 @@ class OnewayExecutor extends Thread // _______________________________ - public static Vector<Object> encodeDispatch( + public static ArrayList<Object> encodeDispatch( com.sun.star.util.URL[] aURL, com.sun.star.beans.PropertyValue[][] lArgs) { int nLength = lArgs.length+1; int nPos = 0; - Vector<Object> lParams = new Vector<Object>(nLength); + ArrayList<Object> lParams = new ArrayList<Object>(nLength); lParams.add( aURL[0] ); --nLength; @@ -165,7 +165,7 @@ class OnewayExecutor extends Thread } public static void decodeDispatch( - Vector<Object> lParams, + ArrayList<Object> lParams, com.sun.star.util.URL[] aURL, com.sun.star.beans.PropertyValue[][] lArgs) { @@ -173,12 +173,12 @@ class OnewayExecutor extends Thread int nPos = 0; lArgs[0] = new com.sun.star.beans.PropertyValue[nLength]; - aURL[0] = (com.sun.star.util.URL) lParams.elementAt(0); + aURL[0] = (com.sun.star.util.URL) lParams.get(0); while (nPos<nLength) { lArgs[0][nPos] = (com.sun.star.beans.PropertyValue) - (lParams.elementAt(nPos+1)); + (lParams.get(nPos+1)); ++nPos; } } diff --git a/odk/examples/DevelopersGuide/OfficeDev/DesktopEnvironment/StatusListener.java b/odk/examples/DevelopersGuide/OfficeDev/DesktopEnvironment/StatusListener.java index fd79205cfaa3..5de834dac847 100644 --- a/odk/examples/DevelopersGuide/OfficeDev/DesktopEnvironment/StatusListener.java +++ b/odk/examples/DevelopersGuide/OfficeDev/DesktopEnvironment/StatusListener.java @@ -35,7 +35,7 @@ // __________ Imports __________ import java.awt.Component; -import java.util.Vector; +import java.util.ArrayList; import javax.swing.JCheckBox; import javax.swing.JLabel; @@ -166,7 +166,7 @@ class StatusListener implements com.sun.star.frame.XStatusListener, * @param lParams * the vector with all packed parameters of the original request */ - public void execOneway(/*IN*/ int nRequest,/*IN*/ Vector<Object> lParams ) + public void execOneway(/*IN*/ int nRequest,/*IN*/ ArrayList<Object> lParams ) { synchronized(this) { @@ -213,7 +213,7 @@ class StatusListener implements com.sun.star.frame.XStatusListener, if (! bHandle) return; - Vector<Object> lOutParams = new Vector<Object>(); + ArrayList<Object> lOutParams = new ArrayList<Object>(); lOutParams.add(aEvent); OnewayExecutor aExecutor = new OnewayExecutor( this , diff --git a/odk/examples/DevelopersGuide/OfficeDev/DesktopEnvironment/ViewContainer.java b/odk/examples/DevelopersGuide/OfficeDev/DesktopEnvironment/ViewContainer.java index c2fbff2cde91..e9f396e1c0a2 100644 --- a/odk/examples/DevelopersGuide/OfficeDev/DesktopEnvironment/ViewContainer.java +++ b/odk/examples/DevelopersGuide/OfficeDev/DesktopEnvironment/ViewContainer.java @@ -74,8 +74,8 @@ public class ViewContainer extends Thread */ private ViewContainer() { - mlViews = new Vector<Object>(); - mlListener = new Vector<IShutdownListener>(); + mlViews = new ArrayList<Object>(); + mlListener = new ArrayList<IShutdownListener>(); mbShutdownActive = false ; Runtime.getRuntime().addShutdownHook(this); } @@ -204,9 +204,8 @@ public class ViewContainer extends Thread IShutdownListener aListener = null; synchronized(mlListener) { - try{ - aListener = mlListener.firstElement(); - } catch(java.util.NoSuchElementException exEmpty) {} + if (!mlListener.isEmpty()) + aListener = mlListener.get(0); } if (aListener==null) break; @@ -258,7 +257,7 @@ public class ViewContainer extends Thread */ public static boolean mbInplace = false ; private static ViewContainer maSingleton = null ; - private Vector<Object> mlViews ; - private Vector<IShutdownListener> mlListener ; + private ArrayList<Object> mlViews ; + private ArrayList<IShutdownListener> mlListener ; private boolean mbShutdownActive ; } diff --git a/odk/examples/DevelopersGuide/Spreadsheet/ExampleAddIn.java b/odk/examples/DevelopersGuide/Spreadsheet/ExampleAddIn.java index 388e4890bbd2..47cc018ac2e4 100644 --- a/odk/examples/DevelopersGuide/Spreadsheet/ExampleAddIn.java +++ b/odk/examples/DevelopersGuide/Spreadsheet/ExampleAddIn.java @@ -38,7 +38,7 @@ class ExampleAddInResult implements com.sun.star.sheet.XVolatileResult { private String aName; private int nValue; - private java.util.Vector<XResultListener> aListeners = new java.util.Vector<XResultListener>(); + private java.util.ArrayList<XResultListener> aListeners = new java.util.ArrayList<XResultListener>(); public ExampleAddInResult( String aNewName ) { @@ -56,7 +56,7 @@ class ExampleAddInResult implements com.sun.star.sheet.XVolatileResult public void addResultListener(com.sun.star.sheet.XResultListener aListener) { - aListeners.addElement( aListener ); + aListeners.add( aListener ); // immediately notify of initial value aListener.modified( getResult() ); @@ -64,7 +64,7 @@ class ExampleAddInResult implements com.sun.star.sheet.XVolatileResult public void removeResultListener(com.sun.star.sheet.XResultListener aListener) { - aListeners.removeElement( aListener ); + aListeners.remove( aListener ); } public void incrementValue() @@ -72,10 +72,8 @@ class ExampleAddInResult implements com.sun.star.sheet.XVolatileResult ++nValue; com.sun.star.sheet.ResultEvent aEvent = getResult(); - java.util.Enumeration<XResultListener> aEnum = aListeners.elements(); - while (aEnum.hasMoreElements()) - aEnum.nextElement().modified( - aEvent); + for( XResultListener l : aListeners) + l.modified(aEvent); } } diff --git a/odk/examples/DevelopersGuide/UCB/ChildrenRetriever.java b/odk/examples/DevelopersGuide/UCB/ChildrenRetriever.java index 00591ec4bc58..03a45bae9c23 100644 --- a/odk/examples/DevelopersGuide/UCB/ChildrenRetriever.java +++ b/odk/examples/DevelopersGuide/UCB/ChildrenRetriever.java @@ -32,19 +32,18 @@ * *************************************************************************/ +import java.util.ArrayList; +import java.util.StringTokenizer; + +import com.sun.star.beans.Property; +import com.sun.star.sdbc.XResultSet; +import com.sun.star.sdbc.XRow; import com.sun.star.ucb.OpenCommandArgument2; import com.sun.star.ucb.OpenMode; import com.sun.star.ucb.XContent; import com.sun.star.ucb.XContentAccess; import com.sun.star.ucb.XDynamicResultSet; -import com.sun.star.beans.Property; import com.sun.star.uno.UnoRuntime; -import com.sun.star.sdbc.XRow; -import com.sun.star.sdbc.XResultSet; - -import java.util.Vector; -import java.util.Enumeration; -import java.util.StringTokenizer; /** * Retrieve the Children of a UCB Folder Content @@ -57,7 +56,7 @@ public class ChildrenRetriever { private Helper m_helper; private XContent m_content; private String m_contenturl = ""; - private Vector<String> m_propnames = new Vector<String>(); + private ArrayList<String> m_propnames = new ArrayList<String>(); /** * Constructor. Create a new connection with the specific args to a running office @@ -87,30 +86,30 @@ public class ChildrenRetriever { * This method requires the main and the optional arguments to be set in order to work. * See Constructor. * - *@return Vector Returns children properties values if values successfully retrieved, + *@return Returns children properties values if values successfully retrieved, * null otherwise *@exception com.sun.star.ucb.CommandAbortedException *@exception com.sun.star.uno.Exception */ - public Vector<Vector<Object>> getChildren() + public ArrayList<ArrayList<Object>> getChildren() throws com.sun.star.ucb.CommandAbortedException, com.sun.star.uno.Exception { - Vector<String> properties = getProperties(); + ArrayList<String> properties = getProperties(); return getChildren ( properties ); } /** * Open a folder content, get properties values for the properties. * - *@param Vector Properties - *@return Vector Returns children properties values if values successfully retrieved, + *@param properties + *@return Returns children properties values if values successfully retrieved, * null otherwise *@exception com.sun.star.ucb.CommandAbortedException *@exception com.sun.star.uno.Exception */ - public Vector<Vector<Object>> getChildren( Vector<String> properties ) + public ArrayList<ArrayList<Object>> getChildren( ArrayList<String> properties ) throws com.sun.star.ucb.CommandAbortedException, com.sun.star.uno.Exception { - Vector<Vector<Object>> result = null; + ArrayList<ArrayList<Object>> result = null; if ( m_content != null ) { int size = 0; if ( properties != null && !properties.isEmpty()) { @@ -140,7 +139,7 @@ public class ChildrenRetriever { XDynamicResultSet.class, m_helper.executeCommand( m_content, "open", arg )); XResultSet resultSet = set.getStaticResultSet(); - result = new Vector<Vector<Object>>(); + result = new ArrayList<ArrayList<Object>>(); ///////////////////////////////////////////////////////////////////// // Iterate over children, access children and property values... @@ -153,7 +152,7 @@ public class ChildrenRetriever { XRow row = UnoRuntime.queryInterface( XRow.class, resultSet ); do { - Vector<Object> propsValues = new Vector<Object>(); + ArrayList<Object> propsValues = new ArrayList<Object>(); // Obtain URL of child. String id = contentAccess.queryContentIdentifierString(); @@ -187,7 +186,7 @@ public class ChildrenRetriever { * *@return String That contains the properties */ - public Vector<String> getProperties() { + public ArrayList<String> getProperties() { return m_propnames; } @@ -240,10 +239,8 @@ public class ChildrenRetriever { /** * Print all properties out contained in vector . - * - *@param Vector */ - public void printLine( Vector<Object> props ) { + public void printLine( ArrayList<Object> props ) { int limit; while ( !props.isEmpty() ) { String print = ""; @@ -305,7 +302,7 @@ public class ChildrenRetriever { ChildrenRetriever access = new ChildrenRetriever( args ); // Get the properties Title and IsFolder for the children. - Vector<Vector<Object>> result = access.getChildren(); + ArrayList<ArrayList<Object>> result = access.getChildren(); String tempPrint = "\nChildren of resource " + access.getContentURL(); int size = tempPrint.length(); @@ -318,9 +315,9 @@ public class ChildrenRetriever { if ( result != null && !result.isEmpty() ) { - Vector<Object> cont = new Vector<Object>(); + ArrayList<Object> cont = new ArrayList<Object>(); cont.add("URL:"); - Vector<String> props = access.getProperties(); + ArrayList<String> props = access.getProperties(); size = props.size(); for ( int i = 0; i < size; i++ ) { Object obj = props.get( i ); @@ -329,8 +326,7 @@ public class ChildrenRetriever { } access.printLine(cont); System.out.println( "\n" ); - for ( Enumeration<Vector<Object>> e = result.elements(); e.hasMoreElements(); ) { - Vector<Object> propsV = e.nextElement(); + for ( ArrayList<Object> propsV : result ) { access.printLine( propsV ); } } diff --git a/odk/examples/DevelopersGuide/UCB/PropertiesComposer.java b/odk/examples/DevelopersGuide/UCB/PropertiesComposer.java index 794502262ff2..19a11139bad8 100644 --- a/odk/examples/DevelopersGuide/UCB/PropertiesComposer.java +++ b/odk/examples/DevelopersGuide/UCB/PropertiesComposer.java @@ -32,7 +32,7 @@ * *************************************************************************/ -import java.util.Vector; +import java.util.ArrayList; import java.util.StringTokenizer; import com.sun.star.beans.PropertyValue; @@ -49,8 +49,8 @@ public class PropertiesComposer { private Helper m_helper; private XContent m_content; private String m_contenturl = ""; - private Vector<String> m_propNames = new Vector<String>(); - private Vector<String> m_propValues = new Vector<String>(); + private ArrayList<String> m_propNames = new ArrayList<String>(); + private ArrayList<String> m_propValues = new ArrayList<String>(); /** * Constructor. @@ -89,22 +89,22 @@ public class PropertiesComposer { */ public Object[] setProperties() throws com.sun.star.ucb.CommandAbortedException, com.sun.star.uno.Exception { - Vector<String> properties = getProperties(); - Vector<String> propertyValues = getPropertyValues(); + ArrayList<String> properties = getProperties(); + ArrayList<String> propertyValues = getPropertyValues(); return setProperties( properties, propertyValues ); } /** * Set values of the properties. * - *@param Vector Properties - *@param Vector Properties value + *@param properties + *@param propertiesValue *@return Object[] Returns null or instance object of com.sun.star.uno.Any * if values successfully seted, properties otherwise *@exception com.sun.star.ucb.CommandAbortedException *@exception com.sun.star.uno.Exception */ - public Object[] setProperties( Vector<String> properties, Vector<String> propertiesValues ) + public Object[] setProperties( ArrayList<String> properties, ArrayList<String> propertiesValues ) throws com.sun.star.ucb.CommandAbortedException, com.sun.star.uno.Exception { Object[] result = null; @@ -161,7 +161,7 @@ public class PropertiesComposer { * *@return Vector That contains the properties names */ - public Vector<String> getProperties() { + public ArrayList<String> getProperties() { return m_propNames; } @@ -170,7 +170,7 @@ public class PropertiesComposer { * *@return Vector That contains the properties values */ - public Vector<String> getPropertyValues() { + public ArrayList<String> getPropertyValues() { return m_propValues; } @@ -263,8 +263,8 @@ public class PropertiesComposer { try { PropertiesComposer setProp = new PropertiesComposer( args ); - Vector<String> properties = setProp.getProperties(); - Vector<String> propertiesValues = setProp.getPropertyValues(); + ArrayList<String> properties = setProp.getProperties(); + ArrayList<String> propertiesValues = setProp.getPropertyValues(); Object[] result = setProp.setProperties( properties, propertiesValues ); String tempPrint = "\nSetting properties of resource " + setProp.getContentURL(); diff --git a/odk/examples/DevelopersGuide/UCB/PropertiesRetriever.java b/odk/examples/DevelopersGuide/UCB/PropertiesRetriever.java index 49f0fa2a3604..002d5c4e6cc2 100644 --- a/odk/examples/DevelopersGuide/UCB/PropertiesRetriever.java +++ b/odk/examples/DevelopersGuide/UCB/PropertiesRetriever.java @@ -32,13 +32,13 @@ * *************************************************************************/ -import java.util.Vector; +import java.util.ArrayList; import java.util.StringTokenizer; import com.sun.star.beans.Property; +import com.sun.star.sdbc.XRow; import com.sun.star.ucb.XContent; import com.sun.star.uno.UnoRuntime; -import com.sun.star.sdbc.XRow; /** @@ -52,7 +52,7 @@ public class PropertiesRetriever { private Helper m_helper; private XContent m_content; private String m_contenturl = ""; - private Vector<String> m_propNames = new Vector<String>(); + private ArrayList<String> m_propNames = new ArrayList<String>(); /** * Constructor. @@ -87,9 +87,9 @@ public class PropertiesRetriever { *@exception com.sun.star.ucb.CommandAbortedException *@exception com.sun.star.uno.Exception */ - public Vector<Object> getPropertyValues() + public ArrayList<Object> getPropertyValues() throws com.sun.star.ucb.CommandAbortedException, com.sun.star.uno.Exception { - Vector<String> properties = getProperties(); + ArrayList<String> properties = getProperties(); return getPropertyValues ( properties ); } @@ -101,9 +101,9 @@ public class PropertiesRetriever { *@exception com.sun.star.ucb.CommandAbortedException *@exception com.sun.star.uno.Exception */ - public Vector<Object> getPropertyValues( Vector<String> properties ) + public ArrayList<Object> getPropertyValues( ArrayList<String> properties ) throws com.sun.star.ucb.CommandAbortedException, com.sun.star.uno.Exception { - Vector<Object> m_propValues = null; + ArrayList<Object> m_propValues = null; if ( m_content != null && properties != null && !properties.isEmpty() ) { int size = properties.size(); @@ -124,7 +124,7 @@ public class PropertiesRetriever { UnoRuntime.queryInterface( XRow.class, m_helper.executeCommand( m_content,"getPropertyValues", props )); - m_propValues = new Vector<Object>(); + m_propValues = new ArrayList<Object>(); /* Extract values from row object. Note that the @@ -155,7 +155,7 @@ public class PropertiesRetriever { * *@return Vector That contains the properties */ - public Vector<String> getProperties() { + public ArrayList<String> getProperties() { return m_propNames; } @@ -222,8 +222,8 @@ public class PropertiesRetriever { "--------------------------------------------------------------" ); try { PropertiesRetriever obtProperty = new PropertiesRetriever( args ); - Vector<String> properties = obtProperty.getProperties(); - Vector<Object> propertiesValues = obtProperty.getPropertyValues( properties ); + ArrayList<String> properties = obtProperty.getProperties(); + ArrayList<Object> propertiesValues = obtProperty.getPropertyValues( properties ); String tempPrint = "\nProperties of resource " + obtProperty.getContentURL(); int size = tempPrint.length(); diff --git a/odk/examples/java/EmbedDocument/EmbeddedObject/OwnEmbeddedObject.java b/odk/examples/java/EmbedDocument/EmbeddedObject/OwnEmbeddedObject.java index cdf3c290199e..b38bb8c3b56f 100644 --- a/odk/examples/java/EmbedDocument/EmbeddedObject/OwnEmbeddedObject.java +++ b/odk/examples/java/EmbedDocument/EmbeddedObject/OwnEmbeddedObject.java @@ -16,27 +16,25 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -import com.sun.star.uno.UnoRuntime; -import com.sun.star.uno.XComponentContext; -import com.sun.star.lang.XMultiComponentFactory; -import com.sun.star.lang.XMultiServiceFactory; -import com.sun.star.uno.AnyConverter; -import com.sun.star.lib.uno.helper.WeakBase; -import com.sun.star.io.XStream; -import com.sun.star.io.XOutputStream; +import java.awt.Dimension; +import java.util.ArrayList; + +import com.sun.star.beans.XPropertySet; +import com.sun.star.container.XNameAccess; +import com.sun.star.embed.VisualRepresentation; +import com.sun.star.embed.XStorage; +import com.sun.star.embed.XTransactedObject; import com.sun.star.io.XInputStream; +import com.sun.star.io.XOutputStream; +import com.sun.star.io.XStream; import com.sun.star.io.XTruncate; -import com.sun.star.beans.XPropertySet; import com.sun.star.lang.XComponent; -import com.sun.star.embed.VisualRepresentation; -import com.sun.star.container.XNameAccess; - - -import com.sun.star.embed.*; - -import java.util.Vector; -import java.awt.Dimension; -import java.lang.Integer; +import com.sun.star.lang.XMultiComponentFactory; +import com.sun.star.lang.XMultiServiceFactory; +import com.sun.star.lib.uno.helper.WeakBase; +import com.sun.star.uno.AnyConverter; +import com.sun.star.uno.UnoRuntime; +import com.sun.star.uno.XComponentContext; public final class OwnEmbeddedObject extends WeakBase implements com.sun.star.embed.XEmbedPersist, @@ -59,7 +57,7 @@ public final class OwnEmbeddedObject extends WeakBase protected EditorFrame m_aEditorFrame; - protected Vector<Object> m_aListeners; + protected ArrayList<Object> m_aListeners; com.sun.star.embed.VerbDescriptor[] m_pOwnVerbs; @@ -68,10 +66,10 @@ public final class OwnEmbeddedObject extends WeakBase Dimension m_aObjSize; // ------------------------------------------------------------- - protected Vector<Object> GetListeners() + protected ArrayList<Object> GetListeners() { if ( m_aListeners == null ) - m_aListeners = new Vector<Object>( 10, 10 ); + m_aListeners = new ArrayList<Object>(10); return m_aListeners; } diff --git a/odk/examples/java/Inspector/HideableTreeModel.java b/odk/examples/java/Inspector/HideableTreeModel.java index 44c208c8be3a..0184e24b8aed 100644 --- a/odk/examples/java/Inspector/HideableTreeModel.java +++ b/odk/examples/java/Inspector/HideableTreeModel.java @@ -18,15 +18,18 @@ import java.util.ArrayList; import java.util.Enumeration; -import java.util.Vector; -import javax.swing.*; -import javax.swing.event.*; -import javax.swing.tree.*; + +import javax.swing.JTree; +import javax.swing.event.TreeModelEvent; +import javax.swing.event.TreeModelListener; +import javax.swing.tree.TreeModel; +import javax.swing.tree.TreeNode; +import javax.swing.tree.TreePath; public class HideableTreeModel implements TreeModel { - private Vector<TreeModelListener> modelListeners = new Vector<TreeModelListener>(); + private ArrayList<TreeModelListener> modelListeners = new ArrayList<TreeModelListener>(); private Object root = null; @@ -72,12 +75,12 @@ public class HideableTreeModel implements TreeModel { public void addTreeModelListener(TreeModelListener l) { - modelListeners.addElement(l); + modelListeners.add(l); } public void removeTreeModelListener(TreeModelListener l) { - modelListeners.removeElement(l); + modelListeners.remove(l); } @@ -135,28 +138,28 @@ public class HideableTreeModel implements TreeModel { protected void fireTreeNodesChanged(TreeModelEvent event) { - for(int i = 0; i < modelListeners.size(); i++) { - modelListeners.elementAt(i).treeNodesChanged(event); + for(TreeModelListener l : modelListeners) { + l.treeNodesChanged(event); } } protected void fireTreeNodesInserted(TreeModelEvent event) { - for(int i = 0; i < modelListeners.size(); i++) { - modelListeners.elementAt(i).treeNodesInserted(event); + for(TreeModelListener l : modelListeners) { + l.treeNodesInserted(event); } } protected void fireTreeNodesRemoved(TreeModelEvent event) { - for(int i = 0; i < modelListeners.size(); i++) { - modelListeners.elementAt(i).treeNodesRemoved(event); + for(TreeModelListener l : modelListeners) { + l.treeNodesRemoved(event); } } protected void fireTreeStructureChanged(TreeModelEvent event) { - for(int i = 0; i < modelListeners.size(); i++) { - modelListeners.elementAt(i).treeStructureChanged(event); + for(TreeModelListener l : modelListeners) { + l.treeStructureChanged(event); } } diff --git a/odk/examples/java/Inspector/Inspector.java b/odk/examples/java/Inspector/Inspector.java index 3b5052d7041b..137a08019f70 100644 --- a/odk/examples/java/Inspector/Inspector.java +++ b/odk/examples/java/Inspector/Inspector.java @@ -32,6 +32,13 @@ * *************************************************************************/ +import java.util.ArrayList; +import java.util.HashMap; +import java.util.Iterator; +import java.util.Set; + +import org.openoffice.XInstanceInspector; + import com.sun.star.awt.Rectangle; import com.sun.star.awt.XMessageBox; import com.sun.star.awt.XMessageBoxFactory; @@ -56,11 +63,6 @@ import com.sun.star.uno.XComponentContext; import com.sun.star.util.CloseVetoException; import com.sun.star.util.XChangesBatch; import com.sun.star.util.XCloseable; -import java.util.HashMap; -import java.util.Iterator; -import java.util.Set; -import java.util.Vector; -import org.openoffice.XInstanceInspector; /** The purpose of this class is to provide a factory for creating the service @@ -79,7 +81,7 @@ public class Inspector{ static private final String __serviceName = "org.openoffice.InstanceInspector"; private HashMap<String, String> aApplicationHashMap = new HashMap<String, String>(); private String sTitle = "Object Inspector"; - private Vector<XComponent> aHiddenDocuments = new Vector<XComponent>(); + private ArrayList<XComponent> aHiddenDocuments = new ArrayList<XComponent>(); // private String[] sApplicationDocUrls = new String[]{"private:factory/swriter", "private:factory/scalc", "private:factory/simpress", "private:factory/sdraw", "private:factory/sbase"}; // private String[] sApplicationDocNames = new String[]{"Text Document", "Spreadsheet", "Presentation", "Drawing", "Database"}; private XComponentContext m_xComponentContext; diff --git a/odk/examples/java/Inspector/Introspector.java b/odk/examples/java/Inspector/Introspector.java index e8c80cf5c82d..79b90d4ef859 100644 --- a/odk/examples/java/Inspector/Introspector.java +++ b/odk/examples/java/Inspector/Introspector.java @@ -32,6 +32,9 @@ * *************************************************************************/ +import java.util.ArrayList; +import java.util.List; + import com.sun.star.beans.IllegalTypeException; import com.sun.star.beans.MethodConcept; import com.sun.star.beans.Property; @@ -66,8 +69,6 @@ import com.sun.star.uno.TypeClass; import com.sun.star.uno.UnoRuntime; import com.sun.star.uno.XComponentContext; import com.sun.star.util.URL; -import java.util.List; -import java.util.Vector; public class Introspector extends WeakBase{ @@ -160,7 +161,7 @@ public class Introspector extends WeakBase{ public Object[] getUnoObjectsOfContainer(Object _oUnoParentObject) { Object[] oRetComponents = null; try { - Vector<Object> oRetComponentsVector = new Vector<Object>(); + ArrayList<Object> oRetComponentsVector = new ArrayList<Object>(); XIntrospectionAccess xIntrospectionAccessObject = getXIntrospectionAccess(_oUnoParentObject); if ( xIntrospectionAccessObject != null ) { XEnumerationAccess xEnumerationAccess = UnoRuntime.queryInterface(XEnumerationAccess.class, xIntrospectionAccessObject.queryAdapter( new Type( XEnumerationAccess.class ) ) ); @@ -260,7 +261,7 @@ public class Introspector extends WeakBase{ protected Property[] getProperties(Object _oUnoObject, String _sServiceName){ Property[] aProperties = getProperties(_oUnoObject); List<Property> aListOfProperties = java.util.Arrays.asList(aProperties); - Vector<Property> aPropertiesVector = new Vector<Property>(aListOfProperties); + ArrayList<Property> aPropertiesVector = new ArrayList<Property>(aListOfProperties); if (aProperties != null){ XPropertyTypeDescription[] xPropertyTypeDescriptions = getPropertyDescriptionsOfService(_sServiceName); for (int i = aProperties.length - 1; i >= 0; i--){ @@ -278,7 +279,7 @@ public class Introspector extends WeakBase{ protected Type[] getInterfaces(Object _oUnoObject, String _sServiceName){ Type[] aTypes = getInterfaces(_oUnoObject); List<Type> aListOfTypes = java.util.Arrays.asList(aTypes); - Vector<Type> aTypesVector = new Vector<Type>(aListOfTypes); + ArrayList<Type> aTypesVector = new ArrayList<Type>(aListOfTypes); if (aTypes != null){ XInterfaceTypeDescription[] xInterfaceTypeDescriptions = getInterfaceDescriptionsOfService(_sServiceName); for (int i = aTypes.length - 1; i >= 0; i--){ diff --git a/odk/examples/java/Inspector/MethodParametersDialog.java b/odk/examples/java/Inspector/MethodParametersDialog.java index 8a261b1d98b6..6a43c697ad0d 100644 --- a/odk/examples/java/Inspector/MethodParametersDialog.java +++ b/odk/examples/java/Inspector/MethodParametersDialog.java @@ -32,15 +32,13 @@ * *************************************************************************/ -import com.sun.star.reflection.ParamInfo; -import com.sun.star.reflection.XIdlMethod; -import com.sun.star.uno.TypeClass; import java.awt.BorderLayout; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.KeyAdapter; import java.awt.event.KeyEvent; -import java.util.Vector; +import java.util.ArrayList; + import javax.swing.JButton; import javax.swing.JComboBox; import javax.swing.JComponent; @@ -49,6 +47,10 @@ import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.JTextField; +import com.sun.star.reflection.ParamInfo; +import com.sun.star.reflection.XIdlMethod; +import com.sun.star.uno.TypeClass; + public class MethodParametersDialog extends JDialog{ private javax.swing.JPanel jPnlParamContainer; private ParameterPanel[] m_aParameterPanels; @@ -76,7 +78,7 @@ public class MethodParametersDialog extends JDialog{ } - public Vector<Object> getMethodObjects() { + public ArrayList<Object> getMethodObjects() { super.setModal(true); addBorderPanel(getContentPane(), BorderLayout.NORTH); addBorderPanel(getContentPane(), BorderLayout.WEST); @@ -105,7 +107,7 @@ public class MethodParametersDialog extends JDialog{ m_aParameterPanels[0].getInputComponent().requestFocusInWindow(); setVisible(true); if (!bisdiposed){ - Vector<Object> aMethodObjects = new Vector<Object>(); + ArrayList<Object> aMethodObjects = new ArrayList<Object>(); for (int i = 0; i < m_aParameterPanels.length; i++){ aMethodObjects.add(m_aParameterPanels[i].getValue()); } diff --git a/odk/examples/java/Inspector/SourceCodeGenerator.java b/odk/examples/java/Inspector/SourceCodeGenerator.java index 45431bd86f38..4e6f3bc30115 100644 --- a/odk/examples/java/Inspector/SourceCodeGenerator.java +++ b/odk/examples/java/Inspector/SourceCodeGenerator.java @@ -32,6 +32,10 @@ * *************************************************************************/ +import java.util.ArrayList; +import java.util.Enumeration; +import java.util.Hashtable; + import com.sun.star.reflection.ParamInfo; import com.sun.star.reflection.XIdlClass; import com.sun.star.reflection.XIdlMethod; @@ -40,15 +44,12 @@ import com.sun.star.uno.Any; import com.sun.star.uno.AnyConverter; import com.sun.star.uno.Type; import com.sun.star.uno.TypeClass; -import java.util.Enumeration; -import java.util.Hashtable; -import java.util.Vector; public class SourceCodeGenerator { - private Vector<String> sExceptions = new Vector<String>(); - Vector<String> sHeaderStatements = new HeaderStatements(); + private ArrayList<String> sExceptions = new ArrayList<String>(); + ArrayList<String> sHeaderStatements = new HeaderStatements(); private XLanguageSourceCodeGenerator m_xLanguageSourceCodeGenerator; private String sHeaderCode = ""; private String sStatementCode = ""; @@ -61,7 +62,7 @@ public class SourceCodeGenerator { private final String SUNOOBJECTNAME = "oUnobject"; private final String SUNOSTRUCTNAME = "aUnoStruct"; private Introspector m_oIntrospector; - private Vector<XTreePathProvider> aTreepathProviders = new Vector<XTreePathProvider>(); + private ArrayList<XTreePathProvider> aTreepathProviders = new ArrayList<XTreePathProvider>(); private XTreePathProvider xTreepathProvider = null; private boolean baddExceptionHandling = false; private boolean bXPropertySetExceptionsAreAdded = false; @@ -361,7 +362,7 @@ public class SourceCodeGenerator { } - private class HeaderStatements extends Vector<String> { + private class HeaderStatements extends ArrayList<String> { public boolean contains(String _oElement){ String sCompName = _oElement; diff --git a/odk/examples/java/Inspector/SwingUnoMethodNode.java b/odk/examples/java/Inspector/SwingUnoMethodNode.java index 3f67de3a2096..92bebe505e1c 100644 --- a/odk/examples/java/Inspector/SwingUnoMethodNode.java +++ b/odk/examples/java/Inspector/SwingUnoMethodNode.java @@ -31,11 +31,12 @@ * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * *************************************************************************/ -import com.sun.star.reflection.XIdlMethod; -import com.sun.star.uno.TypeClass; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; -import java.util.Vector; +import java.util.ArrayList; + +import com.sun.star.reflection.XIdlMethod; +import com.sun.star.uno.TypeClass; @@ -120,7 +121,7 @@ public class SwingUnoMethodNode extends SwingUnoNode implements ActionListener, openIdlDescription(m_xDialogProvider.getIDLPath()); } - public Vector<Object> getMethodObjects(){ + public ArrayList<Object> getMethodObjects(){ MethodParametersDialog oMethodParametersDialog = new MethodParametersDialog(this); oMethodParametersDialog.addActionListener(this); return oMethodParametersDialog.getMethodObjects(); diff --git a/odk/examples/java/Inspector/UnoMethodNode.java b/odk/examples/java/Inspector/UnoMethodNode.java index c02261f5efe3..69bb58e4d2d9 100644 --- a/odk/examples/java/Inspector/UnoMethodNode.java +++ b/odk/examples/java/Inspector/UnoMethodNode.java @@ -37,7 +37,6 @@ import com.sun.star.reflection.ParamMode; import com.sun.star.reflection.XIdlClass; import com.sun.star.reflection.XIdlMethod; import com.sun.star.uno.TypeClass; -import java.util.Vector; public class UnoMethodNode extends UnoNode{ XIdlMethod m_xIdlMethod = null; @@ -93,7 +92,7 @@ public class UnoMethodNode extends UnoNode{ m_bisInvoked = true; } else{ - Vector<Object> oUnoMethodObjects = m_xUnoMethodNode.getMethodObjects(); + java.util.List<Object> oUnoMethodObjects = m_xUnoMethodNode.getMethodObjects(); if (oUnoMethodObjects != null){ for (int i = 0; i < getXIdlMethod().getParameterInfos().length; i++){ this.m_oParamObjects[i] = oUnoMethodObjects.get(i); diff --git a/odk/examples/java/Inspector/UnoNode.java b/odk/examples/java/Inspector/UnoNode.java index dac2e82ed58d..76592251405f 100644 --- a/odk/examples/java/Inspector/UnoNode.java +++ b/odk/examples/java/Inspector/UnoNode.java @@ -32,6 +32,9 @@ * *************************************************************************/ +import java.util.ArrayList; +import java.util.List; + import com.sun.star.beans.PropertyValue; import com.sun.star.frame.FrameSearchFlag; import com.sun.star.frame.XDesktop; @@ -52,8 +55,6 @@ import com.sun.star.uno.UnoRuntime; import com.sun.star.uno.XComponentContext; import com.sun.star.util.URL; import com.sun.star.util.XURLTransformer; -import java.util.List; -import java.util.Vector; public class UnoNode{ @@ -270,7 +271,7 @@ public class UnoNode{ private static String[] removeMandatoryServiceNames(String[] _sServiceNames){ try{ List<String> aList = java.util.Arrays.asList(_sServiceNames); - Vector<String> aVector = new Vector<String>(aList); + ArrayList<String> aVector = new ArrayList<String>(aList); for (int n = 0; n < _sServiceNames.length; n++){ String[] sDelServiceNames = getMandatoryServiceNames(_sServiceNames[n]); for (int m = 0; m < sDelServiceNames.length; m++){ diff --git a/odk/examples/java/Inspector/XUnoMethodNode.java b/odk/examples/java/Inspector/XUnoMethodNode.java index eee0cb023a18..c0186f5e99b7 100644 --- a/odk/examples/java/Inspector/XUnoMethodNode.java +++ b/odk/examples/java/Inspector/XUnoMethodNode.java @@ -34,7 +34,6 @@ import com.sun.star.reflection.XIdlMethod; import com.sun.star.uno.TypeClass; -import java.util.Vector; public interface XUnoMethodNode extends XUnoNode { @@ -59,7 +58,7 @@ public interface XUnoMethodNode extends XUnoNode { public boolean isPrimitive(); - public Vector<Object> getMethodObjects(); + public java.util.List<Object> getMethodObjects(); public boolean isFoldable(); diff --git a/odk/examples/java/ToDo/ToDo.java b/odk/examples/java/ToDo/ToDo.java index fa457156978a..71854936f895 100644 --- a/odk/examples/java/ToDo/ToDo.java +++ b/odk/examples/java/ToDo/ToDo.java @@ -32,37 +32,37 @@ * *************************************************************************/ -import com.sun.star.lib.uno.helper.Factory; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Calendar; +import java.util.GregorianCalendar; + +import com.sun.star.beans.XPropertySet; +import com.sun.star.container.XIndexAccess; import com.sun.star.lang.XMultiComponentFactory; -import com.sun.star.lang.XSingleComponentFactory; import com.sun.star.lang.XMultiServiceFactory; import com.sun.star.lang.XServiceInfo; +import com.sun.star.lang.XSingleComponentFactory; +import com.sun.star.lib.uno.helper.Factory; import com.sun.star.lib.uno.helper.WeakBase; -import com.sun.star.uno.UnoRuntime; -import com.sun.star.uno.XComponentContext; -// addintional interfaces used by the implementation -import com.sun.star.sheet.XSpreadsheetDocument; -import com.sun.star.sheet.XSpreadsheet; import com.sun.star.sheet.XCellRangeMovement; import com.sun.star.sheet.XFunctionAccess; -import com.sun.star.container.XIndexAccess; -import com.sun.star.table.XCellRange; -import com.sun.star.table.XCell; +import com.sun.star.sheet.XSpreadsheet; +import com.sun.star.sheet.XSpreadsheetDocument; import com.sun.star.table.CellAddress; import com.sun.star.table.CellRangeAddress; +import com.sun.star.table.XCell; +import com.sun.star.table.XCellRange; import com.sun.star.table.XColumnRowRange; import com.sun.star.table.XTableRows; -import com.sun.star.beans.XPropertySet; -import com.sun.star.text.XTextRange; import com.sun.star.text.XSimpleText; -import com.sun.star.text.XTextCursor; import com.sun.star.text.XText; +import com.sun.star.text.XTextCursor; import com.sun.star.text.XTextField; - -import java.util.GregorianCalendar; -import java.util.Calendar; -import java.util.Vector; -import java.util.Arrays; +import com.sun.star.text.XTextRange; +import com.sun.star.uno.UnoRuntime; +import com.sun.star.uno.XComponentContext; +// addintional interfaces used by the implementation /** This class capsulates the class, that implements the minimal component, a * factory for creating the service (<CODE>__getServiceFactory</CODE>) and a @@ -208,7 +208,7 @@ public class ToDo { objectFunctionAccess ); // Creating vector for holidays - Vector<Object> vectorHolidays = new Vector<Object>(); + ArrayList<Object> vectorHolidays = new ArrayList<Object>(); // Get the Official Holidays this.getOfficialHolidays( vectorHolidays, xcellrange, @@ -706,7 +706,7 @@ public class ToDo { * @param intYear Year to calculate the official holidays. */ public void getOfficialHolidays( - Vector<Object> vectorHolidays, + ArrayList<Object> vectorHolidays, XCellRange xcellrange, XFunctionAccess xfunctionaccess, int intYear ) { @@ -729,7 +729,7 @@ public class ToDo { dEasterSunday.doubleValue()); // New-year - vectorHolidays.addElement( xfunctionaccess.callFunction( + vectorHolidays.add( xfunctionaccess.callFunction( "DATE", new Object[] { new Integer( intYear ), @@ -737,15 +737,15 @@ public class ToDo { new Integer( 1 ) } )); // Good Friday - vectorHolidays.addElement( + vectorHolidays.add( new Double( intEasterSunday - 2 ) ); // Easter monday - vectorHolidays.addElement( + vectorHolidays.add( new Double( intEasterSunday + 1 ) ); // Labour Day - vectorHolidays.addElement( xfunctionaccess.callFunction( + vectorHolidays.add( xfunctionaccess.callFunction( "DATE", new Object[] { new Integer( intYear ), @@ -753,13 +753,13 @@ public class ToDo { new Integer( 1 ) } )); // Ascension Day - vectorHolidays.addElement(new Double(intEasterSunday + 39 )); + vectorHolidays.add(new Double(intEasterSunday + 39 )); // Pentecost monday - vectorHolidays.addElement(new Double(intEasterSunday + 50 )); + vectorHolidays.add(new Double(intEasterSunday + 50 )); // German Unification - vectorHolidays.addElement( xfunctionaccess.callFunction( + vectorHolidays.add( xfunctionaccess.callFunction( "DATE", new Object[] { new Integer( intYear ), @@ -767,7 +767,7 @@ public class ToDo { new Integer( 3 ) } )); // Christmas Day First - vectorHolidays.addElement( xfunctionaccess.callFunction( + vectorHolidays.add( xfunctionaccess.callFunction( "DATE", new Object[] { new Integer( intYear ), @@ -775,7 +775,7 @@ public class ToDo { new Integer( 25 ) } )); // Christmas Day Second - vectorHolidays.addElement( xfunctionaccess.callFunction( + vectorHolidays.add( xfunctionaccess.callFunction( "DATE", new Object[] { new Integer( intYear ), @@ -841,7 +841,7 @@ public class ToDo { * @param xcellrange Providing the cells. * @param xfunctionaccess Provides the access to functions of the Calc. */ - public void getPrivateHolidays( Vector<Object> vectorHolidays, + public void getPrivateHolidays( ArrayList<Object> vectorHolidays, XCellRange xcellrange, XFunctionAccess xfunctionaccess ) { try { @@ -856,7 +856,7 @@ public class ToDo { while ( dHolidayStart != 0 ) { if ( dHolidayEnd == 0 ) { - vectorHolidays.addElement( + vectorHolidays.add( new Integer( (int) Math.round( dHolidayStart ) ) ); } @@ -865,7 +865,7 @@ public class ToDo { dHolidayStart ); intHoliday <= (int) Math.round( dHolidayEnd ); intHoliday++ ) { - vectorHolidays.addElement( new Double( intHoliday ) ); + vectorHolidays.add( new Double( intHoliday ) ); } } diff --git a/qadevOOo/tests/java/ifc/beans/_XPropertySet.java b/qadevOOo/tests/java/ifc/beans/_XPropertySet.java index 20940d0381db..1c808d0fed96 100644 --- a/qadevOOo/tests/java/ifc/beans/_XPropertySet.java +++ b/qadevOOo/tests/java/ifc/beans/_XPropertySet.java @@ -18,7 +18,7 @@ package ifc.beans; -import java.util.Vector; +import java.util.ArrayList; import lib.MultiMethodTest; import util.ValueChanger; @@ -96,9 +96,9 @@ public class _XPropertySet extends MultiMethodTest { * Constrained, Bound and Normal. */ private final class PropsToTest { - Vector< String > constrained = new Vector< String >(); - Vector< String > bound = new Vector< String >(); - Vector< String > normal = new Vector< String >(); + ArrayList< String > constrained = new ArrayList< String >(); + ArrayList< String > bound = new ArrayList< String >(); + ArrayList< String > normal = new ArrayList< String >(); } private final PropsToTest PTT = new PropsToTest(); diff --git a/scripting/examples/java/Newsgroup/PostNewsgroup.java b/scripting/examples/java/Newsgroup/PostNewsgroup.java index a0bb9f9c06e9..697b52a66a62 100644 --- a/scripting/examples/java/Newsgroup/PostNewsgroup.java +++ b/scripting/examples/java/Newsgroup/PostNewsgroup.java @@ -329,7 +329,7 @@ public class PostNewsgroup extends JFrame { // Copy all newsgroups into a vector for comparison // Alter entries (to include host name) if duplication is found - Vector vector = new Vector( subscribedNewsgroups.length ); + ArrayList vector = new ArrayList( subscribedNewsgroups.length ); for(int i=0; i < subscribedNewsgroups.length; i++ ) { vector.add( subscribedNewsgroups[i].getNewsgroupName() ); diff --git a/scripting/examples/java/Newsgroup/SubscribedNewsgroups.java b/scripting/examples/java/Newsgroup/SubscribedNewsgroups.java index bc1bb24bce6a..f5140690c924 100644 --- a/scripting/examples/java/Newsgroup/SubscribedNewsgroups.java +++ b/scripting/examples/java/Newsgroup/SubscribedNewsgroups.java @@ -118,7 +118,7 @@ public class SubscribedNewsgroups { } //System.out.println("mailrc files found"); - Vector subscribed = new Vector(); + ArrayList subscribed = new ArrayList(); // Get the newsgroups in each mailrc file for( int i=0; i < allMailrcs.length; i++ ) { @@ -201,7 +201,7 @@ public class SubscribedNewsgroups { LineNumberReader in = null; try { in = new LineNumberReader( new FileReader( mailrcfile ) ); - Vector groups = new Vector(); + ArrayList groups = new ArrayList(); String inString = ""; int line = 0; while( inString != null ) @@ -232,7 +232,7 @@ public class SubscribedNewsgroups { // Finds all the mailrc files for all the given News directories private static File[] findMailrcFiles(File[] newsDirs) { - Vector allFiles = new Vector(); + ArrayList allFiles = new ArrayList(); for( int i=0; i < newsDirs.length; i++ ) { diff --git a/scripting/java/com/sun/star/script/framework/container/ParcelDescriptor.java b/scripting/java/com/sun/star/script/framework/container/ParcelDescriptor.java index 20ac568827eb..70db0b39b680 100644 --- a/scripting/java/com/sun/star/script/framework/container/ParcelDescriptor.java +++ b/scripting/java/com/sun/star/script/framework/container/ParcelDescriptor.java @@ -17,28 +17,29 @@ */ package com.sun.star.script.framework.container; +import java.io.ByteArrayInputStream; import java.io.File; -import java.io.InputStream; -import java.io.OutputStream; import java.io.FileInputStream; +import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.IOException; -import java.io.FileNotFoundException; -import java.io.ByteArrayInputStream; - +import java.io.InputStream; +import java.io.OutputStream; import java.util.ArrayList; -import java.util.Map; import java.util.HashMap; import java.util.Hashtable; -import java.util.Enumeration; import java.util.Iterator; +import java.util.Map; +import org.w3c.dom.CharacterData; +import org.w3c.dom.DOMException; +import org.w3c.dom.Document; +import org.w3c.dom.Element; +import org.w3c.dom.NodeList; // import javax.xml.parsers.DocumentBuilderFactory; // import javax.xml.parsers.DocumentBuilder; // import javax.xml.parsers.ParserConfigurationException; -import org.w3c.dom.*; - public class ParcelDescriptor { // File name to be used for parcel descriptor files @@ -294,10 +295,10 @@ public class ParcelDescriptor { addScriptEntry(scripts[i]); } - public void setScriptEntries(Enumeration<ScriptEntry> scripts) { + public void setScriptEntries(Iterator<ScriptEntry> scripts) { clearEntries(); - while (scripts.hasMoreElements()) - addScriptEntry(scripts.nextElement()); + while (scripts.hasNext()) + addScriptEntry(scripts.next()); } public String getLanguageProperty(String name) { diff --git a/scripting/java/org/openoffice/idesupport/JavaFinder.java b/scripting/java/org/openoffice/idesupport/JavaFinder.java index 8c0071844fe9..846481857848 100644 --- a/scripting/java/org/openoffice/idesupport/JavaFinder.java +++ b/scripting/java/org/openoffice/idesupport/JavaFinder.java @@ -20,14 +20,15 @@ package org.openoffice.idesupport; import java.io.File; import java.io.IOException; -import java.util.ArrayList; -import java.util.Enumeration; -import java.util.Vector; import java.lang.reflect.Method; import java.lang.reflect.Modifier; +import java.net.MalformedURLException; import java.net.URL; import java.net.URLClassLoader; -import java.net.MalformedURLException; +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; + import org.openoffice.idesupport.zip.ParcelZipper; import com.sun.star.script.framework.container.ScriptEntry; @@ -41,11 +42,11 @@ public class JavaFinder implements MethodFinder { private static final String FIRST_PARAM = "drafts.com.sun.star.script.framework.runtime.XScriptContext"; - private Vector<String> classpath = null; + private List<String> classpath = null; private JavaFinder() {} - private JavaFinder(Vector<String> classpath) { + private JavaFinder(List<String> classpath) { this.classpath = classpath; } @@ -59,7 +60,7 @@ public class JavaFinder implements MethodFinder { return finder; } - public static JavaFinder getInstance(Vector<String> classpath) { + public static JavaFinder getInstance(List<String> classpath) { return new JavaFinder(classpath); } @@ -136,7 +137,7 @@ public class JavaFinder implements MethodFinder { for (int i = 0; i < len; i++) { try { - String s = classpath.elementAt(i); + String s = classpath.get(i); s = SVersionRCFile.toFileURL(s); if (s != null) @@ -154,10 +155,10 @@ public class JavaFinder implements MethodFinder { files.add(basedir); try { - Enumeration offices = SVersionRCFile.createInstance().getVersions(); + Iterator<OfficeInstallation> offices = SVersionRCFile.createInstance().getVersions(); - while (offices.hasMoreElements()) { - OfficeInstallation oi = (OfficeInstallation)offices.nextElement(); + while (offices.hasNext()) { + OfficeInstallation oi = offices.next(); String unoil = SVersionRCFile.getPathForUnoil(oi.getPath()); if (unoil != null) { diff --git a/scripting/java/org/openoffice/idesupport/LocalOffice.java b/scripting/java/org/openoffice/idesupport/LocalOffice.java index ffbbb3fbee36..f28e36ad3c9e 100644 --- a/scripting/java/org/openoffice/idesupport/LocalOffice.java +++ b/scripting/java/org/openoffice/idesupport/LocalOffice.java @@ -20,7 +20,7 @@ package org.openoffice.idesupport; import java.io.File; import java.net.ConnectException; -import java.util.Vector; +import java.util.ArrayList; /** * LocalOffice represents a connection to the local office. @@ -43,12 +43,12 @@ public class LocalOffice public static final LocalOffice create( ClassLoader parent, String officePath, int port) { - Vector<String> path = new Vector<String>(); - path.addElement(officePath + "/program/classes/ridl.jar"); - path.addElement(officePath + "/program/classes/jurt.jar"); - path.addElement(officePath + "/program/classes/unoil.jar"); - path.addElement(officePath + "/program/classes/juh.jar"); - path.addElement(System.getProperties().getProperty("netbeans.home") + + ArrayList<String> path = new ArrayList<String>(); + path.add(officePath + "/program/classes/ridl.jar"); + path.add(officePath + "/program/classes/jurt.jar"); + path.add(officePath + "/program/classes/unoil.jar"); + path.add(officePath + "/program/classes/juh.jar"); + path.add(System.getProperties().getProperty("netbeans.home") + File.separator + "modules" + File.separator + "ext" + File.separator + "localoffice.jar"); diff --git a/scripting/java/org/openoffice/idesupport/OfficeDocument.java b/scripting/java/org/openoffice/idesupport/OfficeDocument.java index 72e17c68ff33..cbb36c53233a 100644 --- a/scripting/java/org/openoffice/idesupport/OfficeDocument.java +++ b/scripting/java/org/openoffice/idesupport/OfficeDocument.java @@ -18,10 +18,15 @@ package org.openoffice.idesupport; -import java.io.*; -import java.util.zip.*; -import java.util.Vector; +import java.io.File; +import java.io.IOException; +import java.util.ArrayList; import java.util.Enumeration; +import java.util.Iterator; +import java.util.zip.ZipEntry; +import java.util.zip.ZipException; +import java.util.zip.ZipFile; + import org.openoffice.idesupport.zip.ParcelZipper; public class OfficeDocument @@ -51,9 +56,9 @@ public class OfficeDocument return false; } - public Enumeration<String> getParcels() { + public Iterator<String> getParcels() { - Vector<String> parcels = new Vector<String>(); + ArrayList<String> parcels = new ArrayList<String>(); ZipFile zp = null; try @@ -90,7 +95,7 @@ public class OfficeDocument } } - return parcels.elements(); + return parcels.iterator(); } public boolean removeParcel(String parcelName) { diff --git a/scripting/java/org/openoffice/idesupport/SVersionRCFile.java b/scripting/java/org/openoffice/idesupport/SVersionRCFile.java index 9e7bbe209ce4..149eca0e0101 100644 --- a/scripting/java/org/openoffice/idesupport/SVersionRCFile.java +++ b/scripting/java/org/openoffice/idesupport/SVersionRCFile.java @@ -18,14 +18,14 @@ package org.openoffice.idesupport; -import java.io.File; import java.io.BufferedReader; +import java.io.File; +import java.io.FileNotFoundException; import java.io.FileReader; import java.io.IOException; -import java.io.FileNotFoundException; -import java.util.Vector; +import java.util.ArrayList; import java.util.HashMap; -import java.util.Enumeration; +import java.util.Iterator; import java.util.StringTokenizer; public class SVersionRCFile { @@ -61,7 +61,7 @@ public class SVersionRCFile { private File sversionrc = null; private OfficeInstallation defaultversion = null; - private Vector<OfficeInstallation> versions = null; + private ArrayList<OfficeInstallation> versions = null; private long lastModified = 0; public SVersionRCFile() { @@ -70,7 +70,7 @@ public class SVersionRCFile { public SVersionRCFile(String name) { sversionrc = new File(name); - versions = new Vector<OfficeInstallation>(5); + versions = new ArrayList<OfficeInstallation>(5); } public static SVersionRCFile createInstance() { @@ -99,7 +99,7 @@ public class SVersionRCFile { return defaultversion; } - public Enumeration<OfficeInstallation> getVersions() throws IOException { + public Iterator<OfficeInstallation> getVersions() throws IOException { long l = sversionrc.lastModified(); @@ -119,7 +119,7 @@ public class SVersionRCFile { br.close(); } } - return versions.elements(); + return versions.iterator(); } private void load(BufferedReader br) throws IOException { @@ -209,8 +209,7 @@ public class SVersionRCFile { else ov = new SVersionRCFile(args[0]); - Enumeration<OfficeInstallation> enumer; - + Iterator<OfficeInstallation> enumer; try { enumer = ov.getVersions(); } @@ -219,8 +218,8 @@ public class SVersionRCFile { return; } - while (enumer.hasMoreElements()) { - OfficeInstallation oi = enumer.nextElement(); + while (enumer.hasNext()) { + OfficeInstallation oi = enumer.next(); System.out.println("Name: " + oi.getName() + ", Path: " + oi.getPath() + ", URL: " + oi.getURL()); } diff --git a/scripting/java/org/openoffice/idesupport/ui/ConfigurePanel.java b/scripting/java/org/openoffice/idesupport/ui/ConfigurePanel.java index b1842d9079f4..72d98823864b 100644 --- a/scripting/java/org/openoffice/idesupport/ui/ConfigurePanel.java +++ b/scripting/java/org/openoffice/idesupport/ui/ConfigurePanel.java @@ -18,34 +18,32 @@ package org.openoffice.idesupport.ui; +import java.awt.BorderLayout; +import java.awt.GridBagConstraints; +import java.awt.GridBagLayout; +import java.awt.Insets; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; import java.io.File; import java.io.IOException; +import java.util.ArrayList; +import java.util.Iterator; -import java.util.Vector; -import java.util.Enumeration; - -import javax.swing.JPanel; -import javax.swing.JButton; import javax.swing.AbstractButton; import javax.swing.ImageIcon; +import javax.swing.JButton; +import javax.swing.JPanel; import javax.swing.border.LineBorder; -import java.awt.BorderLayout; -import java.awt.GridBagLayout; -import java.awt.GridBagConstraints; -import java.awt.Insets; -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; +import org.openoffice.idesupport.zip.ParcelZipper; import com.sun.star.script.framework.container.ParcelDescriptor; import com.sun.star.script.framework.container.ScriptEntry; -import org.openoffice.idesupport.zip.ParcelZipper; - public class ConfigurePanel extends JPanel { private File basedir; - private Vector<String> classpath; + private ArrayList<String> classpath; private ParcelDescriptor descriptor; private MethodPanel methodPanel; @@ -54,7 +52,7 @@ public class ConfigurePanel extends JPanel { public static final String DIALOG_TITLE = "Choose What to Export as Scripts"; - public ConfigurePanel(String basedir, Vector<String> classpath, + public ConfigurePanel(String basedir, ArrayList<String> classpath, ParcelDescriptor descriptor) { this.basedir = new File(basedir); @@ -63,7 +61,7 @@ public class ConfigurePanel extends JPanel { initUI(); } - public ConfigurePanel(String basedir, Vector<String> classpath) + public ConfigurePanel(String basedir, ArrayList<String> classpath) throws IOException { this.basedir = new File(basedir); @@ -73,7 +71,7 @@ public class ConfigurePanel extends JPanel { initUI(); } - public void reload(String basedir, Vector<String> classpath, + public void reload(String basedir, ArrayList<String> classpath, ParcelDescriptor descriptor) { if (basedir != null) @@ -91,7 +89,7 @@ public class ConfigurePanel extends JPanel { scriptPanel.reload(descriptor.getScriptEntries()); } - public void reload(String basedir, Vector<String> classpath) + public void reload(String basedir, ArrayList<String> classpath) throws IOException { if (basedir != null) @@ -109,7 +107,7 @@ public class ConfigurePanel extends JPanel { } public ParcelDescriptor getConfiguration() throws Exception { - Enumeration<ScriptEntry> scripts = scriptPanel.getScriptEntries(); + Iterator<ScriptEntry> scripts = scriptPanel.getScriptEntries(); descriptor.setScriptEntries(scripts); return descriptor; } diff --git a/scripting/java/org/openoffice/idesupport/ui/MethodPanel.java b/scripting/java/org/openoffice/idesupport/ui/MethodPanel.java index 9bc31edc30e2..362948c3a82b 100644 --- a/scripting/java/org/openoffice/idesupport/ui/MethodPanel.java +++ b/scripting/java/org/openoffice/idesupport/ui/MethodPanel.java @@ -18,22 +18,25 @@ package org.openoffice.idesupport.ui; +import java.awt.BorderLayout; import java.io.File; -import java.util.Vector; +import java.util.ArrayList; + +import javax.swing.JLabel; +import javax.swing.JList; import javax.swing.JPanel; import javax.swing.JScrollPane; -import javax.swing.JList; -import javax.swing.JLabel; -import java.awt.BorderLayout; -import com.sun.star.script.framework.container.ScriptEntry; -import org.openoffice.idesupport.MethodFinder; + import org.openoffice.idesupport.ExtensionFinder; import org.openoffice.idesupport.JavaFinder; +import org.openoffice.idesupport.MethodFinder; + +import com.sun.star.script.framework.container.ScriptEntry; public class MethodPanel extends JPanel { private File basedir; - private Vector<String> classpath; + private ArrayList<String> classpath; private final static String FIRST_PARAM = "drafts.com.sun.star.script.framework.runtime.XScriptContext"; @@ -42,7 +45,7 @@ public class MethodPanel extends JPanel { private JList list; private ScriptEntry[] values; - public MethodPanel(File basedir, Vector<String> classpath, String language) { + public MethodPanel(File basedir, ArrayList<String> classpath, String language) { this.basedir = basedir; this.classpath = classpath; @@ -50,7 +53,7 @@ public class MethodPanel extends JPanel { initUI(); } - public void reload(File basedir, Vector<String> classpath, String language) { + public void reload(File basedir, ArrayList<String> classpath, String language) { this.basedir = basedir; this.classpath = classpath; @@ -103,11 +106,11 @@ public class MethodPanel extends JPanel { final String[] columnNames = {"Method", "Language"}; - private Vector methods; + private ArrayList methods; private int nextRow; public MethodTableModel() { - methods = new Vector(11); + methods = new ArrayList(11); } public int getColumnCount() { diff --git a/scripting/java/org/openoffice/idesupport/ui/ScriptPanel.java b/scripting/java/org/openoffice/idesupport/ui/ScriptPanel.java index f34dd4806bdf..9804e5920c7f 100644 --- a/scripting/java/org/openoffice/idesupport/ui/ScriptPanel.java +++ b/scripting/java/org/openoffice/idesupport/ui/ScriptPanel.java @@ -18,22 +18,21 @@ package org.openoffice.idesupport.ui; -import java.util.Vector; -import java.util.Enumeration; - import java.awt.BorderLayout; -import java.awt.event.FocusEvent; import java.awt.event.FocusAdapter; +import java.awt.event.FocusEvent; +import java.util.ArrayList; +import java.util.Iterator; +import javax.swing.DefaultCellEditor; +import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.JScrollPane; -import javax.swing.JLabel; -import javax.swing.JTextField; import javax.swing.JTable; -import javax.swing.DefaultCellEditor; +import javax.swing.JTextField; +import javax.swing.table.AbstractTableModel; import javax.swing.table.TableCellEditor; import javax.swing.table.TableColumn; -import javax.swing.table.AbstractTableModel; import com.sun.star.script.framework.container.ScriptEntry; @@ -81,7 +80,7 @@ public class ScriptPanel extends JPanel { model.removeAll(); } - public Enumeration<ScriptEntry> getScriptEntries() { + public Iterator<ScriptEntry> getScriptEntries() { return model.getScriptEntries(); } @@ -121,13 +120,13 @@ public class ScriptPanel extends JPanel { final String[] columnNames = {"Exported Method", "Script Name"}; - private Vector<ScriptEntry> scripts; + private ArrayList<ScriptEntry> scripts; private int nextRow; public ScriptTableModel(ScriptEntry[] entries) { - scripts = new Vector<ScriptEntry>(entries.length + 11); + scripts = new ArrayList<ScriptEntry>(entries.length + 11); for (int i = 0; i < entries.length; i++) { - scripts.addElement(entries[i]); + scripts.add(entries[i]); } nextRow = entries.length; } @@ -145,32 +144,32 @@ public class ScriptPanel extends JPanel { } public void add(ScriptEntry entry) { - scripts.addElement(entry); + scripts.add(entry); fireTableRowsInserted(nextRow, nextRow); nextRow++; } public void remove(int row) { - scripts.removeElementAt(row); + scripts.remove(row); fireTableRowsDeleted(row, row); nextRow--; } public void removeAll() { - scripts.removeAllElements(); + scripts.clear(); fireTableRowsDeleted(0, nextRow); nextRow = 0; } - public Enumeration<ScriptEntry> getScriptEntries() { - return scripts.elements(); + public Iterator<ScriptEntry> getScriptEntries() { + return scripts.iterator(); } public Object getValueAt(int row, int col) { String result = ""; ScriptEntry entry; - entry = scripts.elementAt(row); + entry = scripts.get(row); if (col == 0) result = entry.getLanguageName(); @@ -188,7 +187,7 @@ public class ScriptPanel extends JPanel { } public void setValueAt(Object value, int row, int col) { - ScriptEntry entry = scripts.elementAt(row); + ScriptEntry entry = scripts.get(row); entry.setLogicalName((String)value); fireTableCellUpdated(row, col); } diff --git a/scripting/java/org/openoffice/netbeans/modules/office/actions/BuildParcelAction.java b/scripting/java/org/openoffice/netbeans/modules/office/actions/BuildParcelAction.java index 9a29c514b3cd..db68ba7f874a 100644 --- a/scripting/java/org/openoffice/netbeans/modules/office/actions/BuildParcelAction.java +++ b/scripting/java/org/openoffice/netbeans/modules/office/actions/BuildParcelAction.java @@ -41,7 +41,7 @@ public class BuildParcelAction extends BuildAllAction { FrameworkJarChecker.mountDependencies(); for (int i = 0; i < activatedNodes.length; i++) { - Vector v = new Vector(1); + ArrayList v = new ArrayList(1); v.addElement(activatedNodes[i]); CompilerJob job = createJob(v.elements(), Compiler.DEPTH_INFINITE); diff --git a/scripting/java/org/openoffice/netbeans/modules/office/actions/ParcelFolderSupport.java b/scripting/java/org/openoffice/netbeans/modules/office/actions/ParcelFolderSupport.java index 96657215b149..fb0268024451 100644 --- a/scripting/java/org/openoffice/netbeans/modules/office/actions/ParcelFolderSupport.java +++ b/scripting/java/org/openoffice/netbeans/modules/office/actions/ParcelFolderSupport.java @@ -211,7 +211,7 @@ public class ParcelFolderSupport implements ParcelFolderCookie } private Vector getConfigureClasspath() { - Vector result = new Vector(); + ArrayList result = new ArrayList(); String classpath = NbClassPath.createRepositoryPath().getClassPath(); if ( System.getProperty( "os.name" ).startsWith( "Windows" ) ) diff --git a/scripting/workben/installer/IdeUpdater.java b/scripting/workben/installer/IdeUpdater.java index 604decb63537..63cb0c2d389b 100644 --- a/scripting/workben/installer/IdeUpdater.java +++ b/scripting/workben/installer/IdeUpdater.java @@ -36,7 +36,7 @@ public class IdeUpdater extends Thread { private JLabel statusLabel; - private Vector<InstallListener> listeners; + private ArrayList<InstallListener> listeners; private Thread internalThread; private boolean threadSuspended; private JProgressBar progressBar; @@ -59,7 +59,7 @@ public class IdeUpdater extends Thread { System.out.println( "IdeUpdater installPath is " + installPath + " isNetbeansPath is " + isNetbeansPath ); this.installPath = installPath; this.statusLabel = statusLabel; - listeners = new Vector<InstallListener>(); + listeners = new ArrayList<InstallListener>(); threadSuspended = false; progressBar=pBar; progressBar.setStringPainted(true); @@ -150,17 +150,15 @@ public class IdeUpdater extends Thread { public void addInstallListener(InstallListener listener) { - listeners.addElement(listener); + listeners.add(listener); }// addInstallListener private void onInstallComplete() { - Enumeration<InstallListener> e = listeners.elements(); - while (e.hasMoreElements()) + for( InstallListener l : listeners) { - InstallListener listener = e.nextElement(); - listener.installationComplete(null); + l.installationComplete(null); } }// onInstallComplete diff --git a/scripting/workben/installer/XmlUpdater.java b/scripting/workben/installer/XmlUpdater.java index fedd1d96ef33..884c0e323ece 100644 --- a/scripting/workben/installer/XmlUpdater.java +++ b/scripting/workben/installer/XmlUpdater.java @@ -33,7 +33,7 @@ public class XmlUpdater extends Thread { private JLabel statusLabel; - private Vector<InstallListener> listeners; + private ArrayList<InstallListener> listeners; private Thread internalThread; private boolean threadSuspended; private JProgressBar progressBar; @@ -102,7 +102,7 @@ public class XmlUpdater extends Thread { this.statusLabel = statusLabel; this.netInstall = netInstall; this.bindingsInstall = bindingsInstall; - listeners = new Vector<InstallListener>(); + listeners = new ArrayList<InstallListener>(); threadSuspended = false; progressBar=pBar; progressBar.setStringPainted(true); @@ -421,17 +421,15 @@ public class XmlUpdater extends Thread { public void addInstallListener(InstallListener listener) { - listeners.addElement(listener); + listeners.add(listener); }// addInstallListener private void onInstallComplete() { - Enumeration<InstallListener> e = listeners.elements(); - while (e.hasMoreElements()) + for (InstallListener l : listeners) { - InstallListener listener = e.nextElement(); - listener.installationComplete(null); + l.installationComplete(null); } }// onInstallComplete diff --git a/sfx2/qa/complex/sfx2/DocumentEvents.java b/sfx2/qa/complex/sfx2/DocumentEvents.java index a60e8ff228f7..f6978a5bd87e 100755 --- a/sfx2/qa/complex/sfx2/DocumentEvents.java +++ b/sfx2/qa/complex/sfx2/DocumentEvents.java @@ -1,5 +1,17 @@ package complex.sfx2; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.assertArrayEquals; + +import java.util.ArrayList; +import java.util.logging.Level; +import java.util.logging.Logger; + +import org.junit.After; +import org.junit.Before; +import org.junit.Test; +import org.openoffice.test.tools.OfficeDocument; + import com.sun.star.document.DocumentEvent; import com.sun.star.document.XDocumentEventBroadcaster; import com.sun.star.document.XDocumentEventListener; @@ -10,14 +22,6 @@ import com.sun.star.uno.UnoRuntime; import com.sun.star.util.CloseVetoException; import com.sun.star.util.XCloseListener; import com.sun.star.util.XCloseable; -import java.util.Vector; -import java.util.logging.Level; -import java.util.logging.Logger; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; -import static org.junit.Assert.*; -import org.openoffice.test.tools.OfficeDocument; public class DocumentEvents extends JUnitBasedTest { @@ -193,5 +197,5 @@ public class DocumentEvents extends JUnitBasedTest }; private OfficeDocument m_document = null; - final private Vector< CloseEventType > m_observedCloseEvents = new Vector<DocumentEvents.CloseEventType>(); + final private ArrayList< CloseEventType > m_observedCloseEvents = new ArrayList<DocumentEvents.CloseEventType>(); } 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; } |