cid#1607171 Data race condition
[LibreOffice.git] / odk / examples / java / Inspector / SwingUnoNode.java
blobc1d84d85e29a176f84645d547c77ed43ec2405e9
1 /* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*************************************************************************
4 * The Contents of this file are made available subject to the terms of
5 * the BSD license.
7 * Copyright 2000, 2010 Oracle and/or its affiliates.
8 * All rights reserved.
10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions
12 * are met:
13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer.
15 * 2. Redistributions in binary form must reproduce the above copyright
16 * notice, this list of conditions and the following disclaimer in the
17 * documentation and/or other materials provided with the distribution.
18 * 3. Neither the name of Sun Microsystems, Inc. nor the names of its
19 * contributors may be used to endorse or promote products derived
20 * from this software without specific prior written permission.
22 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
23 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
24 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
25 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
26 * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
27 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
28 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
29 * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
30 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
31 * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
32 * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
34 *************************************************************************/
35 import com.sun.star.uno.Type;
36 import javax.swing.tree.TreeNode;
39 public class SwingUnoNode extends HideableMutableTreeNode implements XUnoNode{
40 private UnoNode m_oUnoNode;
42 /** Creates a new instance of SwingUnoNode */
43 public SwingUnoNode(Object _oUnoObject) {
44 super();
45 m_oUnoNode = new UnoNode(_oUnoObject);
49 public SwingUnoNode(Object _oUnoObject, Type _aType) {
50 super();
51 m_oUnoNode = new UnoNode(_oUnoObject, _aType);
52 if (_aType != null){
53 this.setLabel(_aType.getTypeName());
58 public Object getUnoObject(){
59 return m_oUnoNode.getUnoObject();
62 public void setVisible(String _sFilter){
63 boolean bisVisible = isFilterApplicable(_sFilter);
64 super.setVisible(bisVisible);
67 public boolean isFilterApplicable(String _sFilter) {
68 return m_oUnoNode.isFilterApplicable(_sFilter, getName());
71 public void setParameterObjects(Object[] _oParamObjects) {
72 m_oUnoNode.setParameterObjects(_oParamObjects);
75 public void openIdlDescription(String _SDKPath) {
76 m_oUnoNode.openIdlDescription(_SDKPath, getClassName());
79 public Object[] getParameterObjects() {
80 return m_oUnoNode.getParameterObjects();
83 public String getClassName(){
84 String sClassName = m_oUnoNode.getClassName();
85 if (sClassName.equals("")){
86 TreeNode oTreeNode = getParent();
87 if (oTreeNode != null){
88 if (oTreeNode instanceof XUnoNode){
89 SwingUnoNode oUnoNode = (SwingUnoNode) oTreeNode;
90 sClassName = oUnoNode.getClassName();
94 return sClassName;
97 public String getAnchor() {
98 return m_oUnoNode.getAnchor();
102 public void setFoldable(boolean _bIsFoldable){
103 if (_bIsFoldable){
104 addDummyNode();
106 else{
107 removeDummyNode();
112 public XUnoNode getParentNode(){
113 return (SwingUnoNode) super.getParent();
117 public void addChildNode(XUnoNode _xUnoNode) {
118 super.add((SwingUnoNode) _xUnoNode);
121 public void setLabel(String _sLabel){
122 super.setUserObject(_sLabel);
123 this.m_oUnoNode.setLabel(_sLabel);
126 public String getLabel(){
127 return (String) super.getUserObject();
131 @Override
132 public int getChildCount(){
133 return super.getChildCount();
137 public XUnoNode getChild(int _i){
138 return (SwingUnoNode) super.getChildAt(_i);
141 public int getNodeType(){
142 return m_oUnoNode.getNodeType();
145 public void setNodeType(int _nNodeType){
146 m_oUnoNode.setNodeType(_nNodeType);
150 public String getName(){
151 return getClassName();
155 public Type getUnoType(){
156 return m_oUnoNode.getUnoType();
160 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */