protected TestEnvironment createTestEnvironment(TestParameters Param,
PrintWriter log) {
XInterface oObj = null;
XWindowPeer the_win = null;
XToolkit the_kit = null;
XDevice aDevice = null;
XGraphics aGraphic = null;
XControl aControl = null;
//Insert a ControlShape and get the ControlModel
XControlShape aShape = FormTools.createUnoControlShape(xTextDoc, 3000,
4500, 15000,
10000,
"PatternField",
"UnoControlPatternField");
WriterTools.getDrawPage(xTextDoc).add((XShape) aShape);
XControlModel the_Model = aShape.getControl();
XControlShape aShape2 = FormTools.createControlShape(xTextDoc, 3000,
4500, 5000, 10000,
"TextField");
WriterTools.getDrawPage(xTextDoc).add((XShape) aShape2);
XControlModel the_Model2 = aShape2.getControl();
//Try to query XControlAccess
XControlAccess the_access = (XControlAccess) UnoRuntime.queryInterface(
XControlAccess.class,
xTextDoc.getCurrentController());
//get the PatternFieldControl for the needed Object relations
try {
oObj = the_access.getControl(the_Model);
aControl = the_access.getControl(the_Model2);
the_win = the_access.getControl(the_Model).getPeer();
the_kit = the_win.getToolkit();
aDevice = the_kit.createScreenCompatibleDevice(200, 200);
aGraphic = aDevice.createGraphics();
} catch (Exception e) {
log.println("Couldn't get PatternFieldControl");
e.printStackTrace(log);
throw new StatusException("Couldn't get PatternFieldControl", e);
}