1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: TabControllerModel.java,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
32 import com
.sun
.star
.drawing
.XControlShape
;
33 import com
.sun
.star
.lang
.XMultiServiceFactory
;
34 import com
.sun
.star
.text
.XTextDocument
;
35 import com
.sun
.star
.uno
.XInterface
;
37 import java
.io
.PrintWriter
;
39 import lib
.StatusException
;
41 import lib
.TestEnvironment
;
42 import lib
.TestParameters
;
44 import util
.FormTools
;
45 import util
.WriterTools
;
49 public class TabControllerModel
extends TestCase
{
50 private static XTextDocument xTextDoc
;
52 protected void initialize(TestParameters param
, PrintWriter log
) {
54 log
.println("creating a textdocument");
55 xTextDoc
= WriterTools
.createTextDoc(
56 (XMultiServiceFactory
) param
.getMSF());
57 } catch (Exception e
) {
58 e
.printStackTrace(log
);
59 throw new StatusException("Couldn't create document", e
);
63 protected void cleanup(TestParameters param
, PrintWriter log
) {
64 log
.println("disposing xTextDoc");
65 util
.DesktopTools
.closeDoc(xTextDoc
);
69 public TestEnvironment
createTestEnvironment(TestParameters param
,
71 XInterface oObj
= null;
73 log
.println("inserting some ControlShapes");
75 XControlShape shape1
= FormTools
.createControlShape(xTextDoc
, 3000,
78 XControlShape shape2
= FormTools
.createControlShape(xTextDoc
, 5000,
83 oObj
= (XInterface
) ((XMultiServiceFactory
) param
.getMSF()).createInstance(
84 "com.sun.star.awt.TabControllerModel");
85 } catch (Exception e
) {
86 e
.printStackTrace(log
);
87 throw new StatusException("Couldn't create " +
88 "TabControllerModel", e
);
91 log
.println("creating a new environment for TabControllerModel");
93 TestEnvironment tEnv
= new TestEnvironment(oObj
);
95 tEnv
.addObjRelation("OBJNAME",
96 "stardiv.vcl.controlmodel.TabController");
97 tEnv
.addObjRelation("Model1", shape1
.getControl());
98 tEnv
.addObjRelation("Model2", shape2
.getControl());
101 //Object Relation for XPersistObject
102 tEnv
.addObjRelation("noPS", new Boolean(true));
104 System
.out
.println("ImplementationName: " + utils
.getImplName(oObj
));
107 } // finish method getTestEnvironment
108 } // finish class TabControllerModel