bump product version to 5.0.4.1
[LibreOffice.git] / qadevOOo / tests / java / mod / _toolkit / MutableTreeDataModel.java
blob5a403d252550dce0f9ac615399387b0c48afff2f
1 /*
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 .
18 package mod._toolkit;
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;
28 import lib.TestCase;
29 import lib.TestEnvironment;
30 import lib.TestParameters;
32 import util.WriterTools;
33 import util.utils;
36 public class MutableTreeDataModel extends TestCase {
37 private static XTextDocument xTextDoc;
38 private static XInterface oObj = null;
40 /**
41 * Creates StarOffice Writer document.
43 @Override
44 protected void initialize(TestParameters tParam, PrintWriter log) {
45 log.println("creating a textdocument");
46 xTextDoc = WriterTools.createTextDoc(
47 tParam.getMSF());
50 /**
51 * Disposes StarOffice Writer document.
53 @Override
54 protected void cleanup(TestParameters tParam, PrintWriter log) {
55 log.println(" disposing xTextDoc ");
57 util.DesktopTools.closeDoc(xTextDoc);
60 @Override
61 protected synchronized TestEnvironment createTestEnvironment(TestParameters Param,
62 PrintWriter log) {
64 try {
65 oObj = (XInterface) Param.getMSF().createInstance(
66 "com.sun.star.awt.tree.MutableTreeDataModel");
67 } catch (Exception e) {
70 log.println(
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());
80 return tEnv;
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);
89 try {
90 xModel.setRoot(node);
91 } catch (com.sun.star.lang.IllegalArgumentException ex) {
92 log.println("ERROR: could not preform event: " + ex.toString());
93 ex.printStackTrace();
98 } // finish class UnoControlListBoxModel