}
// create the dialog control and set the model
Object dialog = xMultiComponentFactory.createInstanceWithContext(
"com.sun.star.awt.UnoControlDialog", _xComponentContext );
XControl xControl = ( XControl )UnoRuntime.queryInterface(
XControl.class, dialog );
XControlModel xControlModel = ( XControlModel )UnoRuntime.queryInterface(
XControlModel.class, dialogModel );
xControl.setModel( xControlModel );
// add an action listener to the button control
XControlContainer xControlCont = ( XControlContainer )UnoRuntime.queryInterface(
XControlContainer.class, dialog );
// Add to yes button
Object objectButton = xControlCont.getControl( _runButtonName );
XButton xButton = ( XButton )UnoRuntime.queryInterface(
XButton.class, objectButton );
xButton.addActionListener( new ActionListenerImpl( xControlCont, _runButtonName ) );
// add to no button
objectButton = xControlCont.getControl( _doNotRunButtonName );
xButton = ( XButton )UnoRuntime.queryInterface(
XButton.class, objectButton );
xButton.addActionListener( new ActionListenerImpl( xControlCont, _doNotRunButtonName ) );
if ( checkBoxDialog )
{
// add to checkbox
Object objectCheckBox = xControlCont.getControl( _checkBoxName );
XCheckBox xCheckBox = ( XCheckBox )UnoRuntime.queryInterface(
XCheckBox.class, objectCheckBox );
xCheckBox.addItemListener((XItemListener) new ItemListenerImpl( xControlCont ) );
}
// create a peer
Object toolkit = xMultiComponentFactory.createInstanceWithContext(
"com.sun.star.awt.ExtToolkit", _xComponentContext );
XToolkit xToolkit = ( XToolkit )UnoRuntime.queryInterface(
XToolkit.class, toolkit );
XWindow xWindow = ( XWindow )UnoRuntime.queryInterface(
XWindow.class, xControl );
xWindow.setVisible( false );
xControl.createPeer( xToolkit, null );
// return the dialog
XDialog xDialog = ( XDialog )UnoRuntime.queryInterface(
XDialog.class, dialog );
return xDialog;