// wait until the detail form is loaded
loadMaster.load();
impl_waitForLoadedEvent();
// 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 (ID2)", m_masterResult.getInt(2) == 1 );
assure( "wrong form state after loading (value)", m_masterResult.getString(3).equals( "First Record" ) );
// the values in the linked fields should be identical int expectedDetailRowCounts[] = { 2, 1 }; do
{
verifyColumnValueIdentity( "ID1", "FK_ID1" );
verifyColumnValueIdentity( "ID2", "FK_ID2" );
m_detailResult.last(); int masterPos = m_masterResult.getRow();
assure( "wrong number of records in detail form, for master form at pos " + masterPos,
((Integer)m_detailForm.getPropertyValue( "RowCount" )).intValue() == expectedDetailRowCounts[ masterPos - 1 ] );
if (!m_masterResult.next()) return;
impl_waitForLoadedEvent();
} while ( !m_masterResult.isAfterLast() );
assure( "wrong number of records in master form", 2 == ((Integer)m_masterForm.getPropertyValue( "RowCount" )).intValue() );
} finally
{ if ( databaseDocument != null )
databaseDocument.closeAndDelete();
impl_cleanUpStep();
}
}
// now that we set up this, do the actual tests // First, https://bz.apache.org/ooo/show_bug.cgi?id=105235 described the problem // that default values in the sub form didn't work when the master form was navigated to a row // for which no detail records were present, and the default of the column/control is the same // as the last known value.
// so, take the current value of the "Name" column, and set it as default value ...
String defaultValue = m_detailResult.getString( 2 );
nameColumn.setPropertyValue( "DefaultText", defaultValue ); // ... then move to the second main form row ...
m_masterResult.absolute( 2 );
impl_waitForLoadedEvent(); // ... which should result in an empty sub form ...
assure( "test precondition not met: The second master form record is expected to have no detail records, " + "else the test becomes meaningless", impl_isNewRecord( m_detailForm ) ); // ... and in the "Name" column having the proper text
String actualValue = (String)nameColumn.getPropertyValue( "Text" );
assureEquals( "#i105235#: default value in sub form not working (not propagated to column model)", defaultValue, actualValue ); // However, checking the column model's value alone is not enough - we need to ensure it is properly // propagated to the control.
XGridFieldDataSupplier gridData = subDocument.getCurrentView().getControl(
gridControlModel, XGridFieldDataSupplier.class );
actualValue = (String)(gridData.queryFieldData( 0, Type.STRING )[1]);
assureEquals( "#i105235#: default value in sub form not working (not propagated to column)", defaultValue, actualValue );
} finally
{ if ( subComponentCommands != null )
{
XComponentSupplier componentSupplier = UnoRuntime.queryInterface( XComponentSupplier.class, subComponentCommands );
XModifiable modifySubComponent = UnoRuntime.queryInterface( XModifiable.class, componentSupplier.getComponent() );
modifySubComponent.setModified( false );
Command command = new Command();
command.Name = "close";
subComponentCommands.execute( command, subComponentCommands.createCommandIdentifier(), null );
}
privatevoid impl_waitForLoadedEvent()
{ synchronized( m_waitForLoad )
{ while ( !m_loaded )
{ try { m_waitForLoad.wait(); } catch( InterruptedException e ) { }
} // reset the flag for the next time
m_loaded = false;
}
}
/** assures that the (integer) values in the given columns of our master and detail forms are identical
*/ privatevoid verifyColumnValueIdentity( final String masterColName, final String detailColName ) throws SQLException
{
XColumnLocate locateMasterCols = UnoRuntime.queryInterface( XColumnLocate.class, m_masterForm );
XColumnLocate locateDetailCols = UnoRuntime.queryInterface( XColumnLocate.class, m_detailForm );
int masterValue = m_masterResult.getInt( locateMasterCols.findColumn( masterColName ) ); int detailValue = m_detailResult.getInt( locateDetailCols.findColumn( detailColName ) );
assure( "values in linked column pair " + detailColName + "->" + masterColName + " (" +
detailValue + "->" + masterValue + ") do not match (master position: " + m_masterResult.getRow() + ")!",
masterValue == detailValue );
}
¤ Diese beiden folgenden Angebotsgruppen bietet das Unternehmen0.9Angebot
(Wie Sie bei der Firma Beratungs- und Dienstleistungen beauftragen können 2026-10-03)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.