Kaydet (Commit) 01c04247 authored tarafından Noel Grandin's avatar Noel Grandin

remove unnecessary use of Java reflection

Change-Id: I1cbbd8ee34684ec0fd74cd59529276b31eb7d1c2
üst 1cb2573c
...@@ -21,7 +21,6 @@ package integration.forms; ...@@ -21,7 +21,6 @@ package integration.forms;
import com.sun.star.beans.NamedValue; import com.sun.star.beans.NamedValue;
import com.sun.star.beans.XPropertySet; import com.sun.star.beans.XPropertySet;
import com.sun.star.container.XIndexContainer; import com.sun.star.container.XIndexContainer;
import java.lang.reflect.Method;
import com.sun.star.uno.UnoRuntime; import com.sun.star.uno.UnoRuntime;
import com.sun.star.lang.XMultiServiceFactory; import com.sun.star.lang.XMultiServiceFactory;
...@@ -156,16 +155,14 @@ public class MasterDetailForms extends complexlib.ComplexTestCase implements com ...@@ -156,16 +155,14 @@ public class MasterDetailForms extends complexlib.ComplexTestCase implements com
loadDetail.addLoadListener( this ); loadDetail.addLoadListener( this );
// wait until the detail form is loaded // wait until the detail form is loaded
operateMasterAndWaitForDetailForm( loadMaster.getClass().getMethod( "load", new Class[] {} ), loadMaster, new Object[] { } ); loadMaster.load();
impl_waitForLoadedEvent();
// okay, now the master form should be on the first record // okay, now the master form should be on the first record
assure( "wrong form state after loading (ID1)", m_masterResult.getInt(1) == 1 ); assure( "wrong form state after loading (ID1)", m_masterResult.getInt(1) == 1 );
assure( "wrong form state after loading (ID2)", m_masterResult.getInt(2) == 1 ); assure( "wrong form state after loading (ID2)", m_masterResult.getInt(2) == 1 );
assure( "wrong form state after loading (value)", m_masterResult.getString(3).equals( "First Record" ) ); assure( "wrong form state after loading (value)", m_masterResult.getString(3).equals( "First Record" ) );
// the "XResultSet.next" method
Method methodNext = m_masterResult.getClass().getMethod( "next" , new Class[] {} );
// the values in the linked fields should be identical // the values in the linked fields should be identical
int expectedDetailRowCounts[] = { 2, 1 }; int expectedDetailRowCounts[] = { 2, 1 };
do do
...@@ -178,7 +175,9 @@ public class MasterDetailForms extends complexlib.ComplexTestCase implements com ...@@ -178,7 +175,9 @@ public class MasterDetailForms extends complexlib.ComplexTestCase implements com
assure( "wrong number of records in detail form, for master form at pos " + masterPos, assure( "wrong number of records in detail form, for master form at pos " + masterPos,
((Integer)m_detailForm.getPropertyValue( "RowCount" )).intValue() == expectedDetailRowCounts[ masterPos - 1 ] ); ((Integer)m_detailForm.getPropertyValue( "RowCount" )).intValue() == expectedDetailRowCounts[ masterPos - 1 ] );
operateMasterAndWaitForDetailForm( methodNext, m_masterResult, new Object[] {} ); if (!m_masterResult.next())
return;
impl_waitForLoadedEvent();
} }
while ( !m_masterResult.isAfterLast() ); while ( !m_masterResult.isAfterLast() );
assure( "wrong number of records in master form", 2 == ((Integer)m_masterForm.getPropertyValue( "RowCount" )).intValue() ); assure( "wrong number of records in master form", 2 == ((Integer)m_masterForm.getPropertyValue( "RowCount" )).intValue() );
...@@ -341,28 +340,6 @@ public class MasterDetailForms extends complexlib.ComplexTestCase implements com ...@@ -341,28 +340,6 @@ public class MasterDetailForms extends complexlib.ComplexTestCase implements com
return column; return column;
} }
/* ------------------------------------------------------------------ */
/** executes an operation on the master, and waits until the detail form has been (re)loaded aferwards
*/
private void operateMasterAndWaitForDetailForm( Method _masterMethod, Object _masterInterface, Object[] _methodParameters ) throws SQLException
{
Object result;
try
{
result = _masterMethod.invoke( _masterInterface, _methodParameters );
}
catch( java.lang.Exception e )
{
throw new SQLException( "invoking " + _masterMethod.getName() + " failed",new Object(), "", 0, new Object() );
}
if ( _masterMethod.getReturnType().getName().equals( "boolean" ) )
if ( !((Boolean)result).booleanValue() )
return;
impl_waitForLoadedEvent();
}
private void impl_waitForLoadedEvent() private void impl_waitForLoadedEvent()
{ {
synchronized( m_waitForLoad ) synchronized( m_waitForLoad )
......
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