/**************************************************************
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*
*************************************************************/
package ifc.awt.tree;
import com.sun.star.awt.tree.TreeDataModelEvent;
import com.sun.star.awt.tree.XMutableTreeNode;
import com.sun.star.awt.tree.XTreeDataModel;
import com.sun.star.awt.tree.XTreeDataModelListener;
import com.sun.star.awt.tree.XTreeNode;
import com.sun.star.lang.EventObject;
import lib.MultiMethodTest;
import lib.Status;
import lib.StatusException;
/**
* Testing com.sun.star.awt.tree.XTreeDataModel
* interface methods :
*
createNode()
setRoot()
* Test is NOT multithread compilant.
*
* @see com.sun.star.awt.tree.XTreeDataModel
*/
public class _XTreeDataModel extends MultiMethodTest {
public XTreeDataModel oObj = null;
private XMutableTreeNode mNewNode = null;
XTreeDataModelListener mListener1 = new myEventListener1();
XTreeDataModelListener mListener2 = new myEventListener2();
XTreeDataModelListenerEvent mListenerEvent = null;
boolean mTreeStructureChanged1 = false;
boolean mTreeStructureChanged2 = false;
public static interface XTreeDataModelListenerEvent{
public void fireEvent();
}
public class myEventListener1 implements XTreeDataModelListener{
public void treeNodesChanged(TreeDataModelEvent treeDataModelEvent) {
log.println("Listener 1: treeNodesChanged");
}
public void treeNodesInserted(TreeDataModelEvent treeDataModelEvent) {
log.println("Listener 1: treeNodesInserted");
}
public void treeNodesRemoved(TreeDataModelEvent treeDataModelEvent) {
log.println("Listener 1: treeNodesRemoved");
}
public void treeStructureChanged(TreeDataModelEvent treeDataModelEvent) {
log.println("Listener 1: treeStructureChanged");
mTreeStructureChanged1 = true;
}
public void disposing(EventObject eventObject) {
log.println("Listener 1: disposing");
}
}
public class myEventListener2 implements XTreeDataModelListener{
public void treeNodesChanged(TreeDataModelEvent treeDataModelEvent) {
log.println("Listener 2: treeNodesChanged");
}
public void treeNodesInserted(TreeDataModelEvent treeDataModelEvent) {
log.println("Listener 2: treeNodesInserted");
}
public void treeNodesRemoved(TreeDataModelEvent treeDataModelEvent) {
log.println("Listener 2: treeNodesRemoved");
}
public void treeStructureChanged(TreeDataModelEvent treeDataModelEvent) {
log.println("Listener 2: treeStructureChanged");
mTreeStructureChanged2 = true;
}
public void disposing(EventObject eventObject) {
log.println("Listener 2: disposing");
}
}
public void before(){
mListenerEvent = (XTreeDataModelListenerEvent) tEnv.getObjRelation("XTreeDataModelListenerEvent");
if (mListenerEvent == null) {
throw new StatusException(Status.failed("ERROR: could not get object relation 'XTreeDataModelListenerEvent'\n" +
"This object relation must be kind of 'ifc.awt.tree._XTreeDataModel.XTreeDataModelListenerEvent'"));
}
}
/**
* Gets the title and compares it to the value set in
* setTitle
method test.
* Has OK status is set/get values are equal. * The following method tests are to be completed successfully before : *
setTitle