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

Java cleanup, generic and simplify

The code here is passing stuff around in lists of Object, but even
so, it was doing so in a very convoluted way.

Change-Id: I608a066138bde2b659a52f6e6148ac754f75ac74
üst ef0e7694
......@@ -65,5 +65,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<?> lParams );
public abstract void execOneway( int nRequest, Vector<Object> lParams );
}
......@@ -162,7 +162,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<?> lParams )
public void execOneway(/*IN*/ int nRequest,/*IN*/ Vector<Object> lParams )
{
synchronized(this)
{
......@@ -181,11 +181,9 @@ public class Interceptor implements com.sun.star.frame.XFrameActionListener,
{
com.sun.star.util.URL[] lOutURL = new com.sun.star.util.URL[1];
com.sun.star.beans.PropertyValue[][] lOutProps = new com.sun.star.beans.PropertyValue[1][];
Vector[] lInParams = new Vector[1];
lInParams[0] = lParams;
OnewayExecutor.codeDispatch( OnewayExecutor.DECODE_PARAMS ,
lInParams ,
OnewayExecutor.decodeDispatch(
lParams ,
lOutURL ,
lOutProps );
impl_dispatch(lOutURL[0],lOutProps[0]);
......@@ -238,7 +236,7 @@ public class Interceptor implements com.sun.star.frame.XFrameActionListener,
return;
// pack the event and start thread - which call us back later
Vector<FrameActionEvent> lOutParams = new Vector<FrameActionEvent>();
Vector<Object> lOutParams = new Vector<Object>();
lOutParams.add(aEvent);
OnewayExecutor aExecutor = new OnewayExecutor( (IOnewayLink)this ,
......@@ -271,19 +269,17 @@ public class Interceptor implements com.sun.star.frame.XFrameActionListener,
return;
}
Vector[] lOutParams = new Vector[1];
com.sun.star.util.URL[] lInURL = new com.sun.star.util.URL[1];
com.sun.star.beans.PropertyValue[][] lInArguments = new com.sun.star.beans.PropertyValue[1][];
lInURL[0] = aURL ;
lInArguments[0] = lArguments;
OnewayExecutor.codeDispatch( OnewayExecutor.ENCODE_PARAMS ,
lOutParams ,
Vector<Object> lOutParams = OnewayExecutor.encodeDispatch(
lInURL ,
lInArguments );
OnewayExecutor aExecutor = new OnewayExecutor( (IOnewayLink)this ,
OnewayExecutor.REQUEST_DISPATCH ,
lOutParams[0] );
lOutParams );
aExecutor.start();
}
......
......@@ -77,7 +77,7 @@ class OnewayExecutor extends Thread
*/
private IOnewayLink m_rLink ;
private int m_nRequest ;
private Vector<?> m_lParams ;
private Vector<Object> m_lParams ;
// _______________________________
......@@ -103,7 +103,7 @@ class OnewayExecutor extends Thread
*/
public OnewayExecutor( IOnewayLink rLink ,
int nRequest ,
Vector<?> lParams )
Vector<Object> lParams )
{
m_rLink = rLink ;
m_nRequest = nRequest;
......@@ -138,48 +138,49 @@ class OnewayExecutor extends Thread
/**
* static helper!
* To make convertion of the generic parameter list to the original
* one easier - you can use this helper methods. They know how suchlist
* To make conversion of the generic parameter list to the original
* one easier - you can use this helper methods. They know how such list
* must be coded. It's not a must to use it - but you can ...
*/
// _______________________________
public static void codeDispatch(
boolean bEncode, Vector[] lParams,
public static Vector<Object> encodeDispatch(
com.sun.star.util.URL[] aURL,
com.sun.star.beans.PropertyValue[][] lArgs)
{
if (bEncode)
{
int nLength = lArgs.length+1;
int nPos = 0;
lParams[0] = new Vector<Object>(nLength);
int nLength = lArgs.length+1;
int nPos = 0;
Vector<Object> lParams = new Vector<Object>(nLength);
lParams[0].add( (Object)aURL[0] );
--nLength;
lParams.add( aURL[0] );
--nLength;
while (nLength>0)
{
lParams[0].add( (Object)lArgs[0][nPos] );
--nLength;
++nPos ;
}
}
else
while (nLength>0)
{
int nLength = lParams[0].size()-1;
lParams.add( lArgs[0][nPos] );
--nLength;
++nPos ;
}
return lParams;
}
public static void decodeDispatch(
Vector<Object> lParams,
com.sun.star.util.URL[] aURL,
com.sun.star.beans.PropertyValue[][] lArgs)
{
int nLength = lParams.size()-1;
int nPos = 0;
lArgs[0] = new com.sun.star.beans.PropertyValue[nLength];
aURL[0] = (com.sun.star.util.URL)(lParams[0].elementAt(0));
aURL[0] = (com.sun.star.util.URL) lParams.elementAt(0);
while (nPos<nLength)
{
lArgs[0][nPos] = (com.sun.star.beans.PropertyValue)
(lParams[0].elementAt(nPos+1));
(lParams.elementAt(nPos+1));
++nPos;
}
}
}
}
......@@ -167,7 +167,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<?> lParams )
public void execOneway(/*IN*/ int nRequest,/*IN*/ Vector<Object> lParams )
{
synchronized(this)
{
......@@ -214,7 +214,7 @@ class StatusListener implements com.sun.star.frame.XStatusListener,
if (! bHandle)
return;
Vector<FrameActionEvent> lOutParams = new Vector<FrameActionEvent>();
Vector<Object> lOutParams = new Vector<Object>();
lOutParams.add(aEvent);
OnewayExecutor aExecutor = new OnewayExecutor( (IOnewayLink)this ,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment