/** complex test case for Base's application UI
*/ publicclass Beamer extends TestCase
{
private XModel docModel;
@Before
@Override publicvoid before() throws Exception, java.lang.Exception
{ // load it into a frame final Object object = getMSF().createInstance("com.sun.star.frame.Desktop"); final XComponentLoader xComponentLoader = UnoRuntime.queryInterface(XComponentLoader.class, object); final XComponent loadedComponent = xComponentLoader.loadComponentFromURL("private:factory/swriter", "_blank", 0, new PropertyValue[0]); // get the controller, which provides access to various UI operations
docModel = UnoRuntime.queryInterface(XModel.class, loadedComponent);
}
@After
@Override publicvoid after()
{
}
@Test publicvoid testBeamer() throws Exception, java.lang.Exception
{ final XController controller = docModel.getCurrentController(); final XFrame frame = controller.getFrame(); final XDispatchProvider dispatchP = UnoRuntime.queryInterface(XDispatchProvider.class, frame);
URL command = new URL();
command.Complete = ".uno:ViewDataSourceBrowser";
final XDispatch dispatch = dispatchP.queryDispatch(command, "_self", FrameSearchFlag.AUTO);
assertNotNull(dispatch);
dispatch.dispatch(command, new PropertyValue[0]);
final PropertyValue[] props = new PropertyValue[]
{ new PropertyValue("DataSourceName", 0, "Bibliography", PropertyState.DIRECT_VALUE), new PropertyValue("CommandType", 0, Integer.valueOf(CommandType.TABLE), PropertyState.DIRECT_VALUE), new PropertyValue("Command", 0, "biblio", PropertyState.DIRECT_VALUE)
};
final XFrame beamer = frame.findFrame("_beamer", 0);
assertNotNull(beamer); final XGlobalEventBroadcaster evtBc = theGlobalEventBroadcaster.get(
getComponentContext());
XEnumeration enumeration = evtBc.createEnumeration(); int count = -1; while (enumeration.hasMoreElements())
{
enumeration.nextElement();
++count;
} final XSelectionSupplier selSup = UnoRuntime.queryInterface(XSelectionSupplier.class, beamer.getController());
selSup.select(props); final com.sun.star.util.XCloseable close = UnoRuntime.queryInterface(com.sun.star.util.XCloseable.class, frame);
close.close(false);
enumeration = evtBc.createEnumeration(); int count2 = 0; while (enumeration.hasMoreElements())
{
enumeration.nextElement();
++count2;
}
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.