public TestEnvironment createTestEnvironment(TestParameters param,
PrintWriter log) {
// create Object Relations -------------------------------------------
XInterface oObj = null;
XControlShape shape = null;
XControlModel model = null;
XControlAccess access = null;
XWindow anotherWindow = null;
// for XControl
XWindowPeer the_win = null;
XToolkit the_kit = null;
XControlContainer ctrlCont = null;
XGraphics aGraphic = null;
// create 3 XControls
// create first XControl
shape = FormTools.createControlShape(xTextDoc, 3000, 4500, 15000,
10000, "TextField");
WriterTools.getDrawPage(xTextDoc).add((XShape) shape);
model = shape.getControl();
access = (XControlAccess) UnoRuntime.queryInterface(
XControlAccess.class, xTextDoc.getCurrentController());
try {
xCtrl = access.getControl(model);
} catch (Exception e) {
e.printStackTrace(log);
throw new StatusException("Couldn't create XControl", e);
}
// create second XControl
shape = FormTools.createControlShape(xTextDoc, 3000, 4500, 15000,
10000, "TextField");
WriterTools.getDrawPage(xTextDoc).add((XShape) shape);
model = shape.getControl();
access = (XControlAccess) UnoRuntime.queryInterface(
XControlAccess.class, xTextDoc.getCurrentController());
try {
xCtrl1 = access.getControl(model);
} catch (Exception e) {
e.printStackTrace(log);
throw new StatusException("Couldn't create XControl", e);
}
// create third XControl
shape = FormTools.createControlShape(xTextDoc, 3000, 4500, 15000,
10000, "CommandButton");
WriterTools.getDrawPage(xTextDoc).add((XShape) shape);
model = shape.getControl();
access = (XControlAccess) UnoRuntime.queryInterface(
XControlAccess.class, xTextDoc.getCurrentController());
try {
xCtrl2 = access.getControl(model);
} catch (Exception e) {
e.printStackTrace(log);
throw new StatusException("Couldn't create XControl", e);
}
// create XToolkit, XWindowPeer, XDevice
//Insert a ControlShape and get the ControlModel
XControlShape aShape = FormTools.createUnoControlShape(xTextDoc, 3000,
4500, 15000,
10000,
"CommandButton",
"UnoControlButton");
WriterTools.getDrawPage(xTD2).add((XShape) aShape);
XControlModel the_Model = aShape.getControl();
//Try to query XControlAccess
XControlAccess the_access = (XControlAccess) UnoRuntime.queryInterface(
XControlAccess.class,
xTD2.getCurrentController());