2 * This file is part of the LibreOffice project.
4 * This Source Code Form is subject to the terms of the Mozilla Public
5 * License, v. 2.0. If a copy of the MPL was not distributed with this
6 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 * This file incorporates work covered by the following license notice:
10 * Licensed to the Apache Software Foundation (ASF) under one or more
11 * contributor license agreements. See the NOTICE file distributed
12 * with this work for additional information regarding copyright
13 * ownership. The ASF licenses this file to you under the Apache
14 * License, Version 2.0 (the "License"); you may not use this file
15 * except in compliance with the License. You may obtain a copy of
16 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 import com
.sun
.star
.awt
.tree
.XMutableTreeDataModel
;
21 import com
.sun
.star
.awt
.tree
.XMutableTreeNode
;
22 import com
.sun
.star
.text
.XTextDocument
;
23 import com
.sun
.star
.uno
.UnoRuntime
;
24 import com
.sun
.star
.uno
.XInterface
;
26 import java
.io
.PrintWriter
;
29 import lib
.TestEnvironment
;
30 import lib
.TestParameters
;
32 import util
.WriterTools
;
36 public class MutableTreeDataModel
extends TestCase
{
37 private static XTextDocument xTextDoc
;
38 private static XInterface oObj
= null;
41 * Creates StarOffice Writer document.
44 protected void initialize(TestParameters tParam
, PrintWriter log
) {
45 log
.println("creating a textdocument");
46 xTextDoc
= WriterTools
.createTextDoc(
51 * Disposes StarOffice Writer document.
54 protected void cleanup(TestParameters tParam
, PrintWriter log
) {
55 log
.println(" disposing xTextDoc ");
57 util
.DesktopTools
.closeDoc(xTextDoc
);
61 protected synchronized TestEnvironment
createTestEnvironment(TestParameters Param
,
65 oObj
= (XInterface
) Param
.getMSF().createInstance(
66 "com.sun.star.awt.tree.MutableTreeDataModel");
67 } catch (Exception e
) {
71 "creating a new environment for MutableTreeDataModel object");
73 TestEnvironment tEnv
= new TestEnvironment(oObj
);
75 tEnv
.addObjRelation("OBJNAME", "toolkit.MutableTreeDataModel");
76 log
.println("ImplementationName: " + utils
.getImplName(oObj
));
78 tEnv
.addObjRelation("XTreeDataModelListenerEvent", new XTreeDataModelListenerEvent());
81 } // finish method getTestEnvironment
83 private class XTreeDataModelListenerEvent
implements ifc
.awt
.tree
._XTreeDataModel
.XTreeDataModelListenerEvent
{
85 public void fireEvent(){
87 XMutableTreeDataModel xModel
= UnoRuntime
.queryInterface(XMutableTreeDataModel
.class, oObj
);
88 XMutableTreeNode node
= xModel
.createNode("EventNode", true);
91 } catch (com
.sun
.star
.lang
.IllegalArgumentException ex
) {
92 log
.println("ERROR: could not preform event: " + ex
.toString());
98 } // finish class UnoControlListBoxModel