Update ooo320-m1
[ooovba.git] / odk / examples / java / Inspector / SwingUnoNode.java
blob5b8f47cfa8b1ba225dea839d950ad1a096f5e298
1 /*************************************************************************
3 * $RCSfile: SwingUnoNode.java,v $
5 * $Revision: 1.3 $
7 * last change: $Author: rt $ $Date: 2007-04-04 09:21:53 $
9 * The Contents of this file are made available subject to the terms of
10 * the BSD license.
12 * Copyright (c) 2003 by Sun Microsystems, Inc.
13 * All rights reserved.
15 * Redistribution and use in source and binary forms, with or without
16 * modification, are permitted provided that the following conditions
17 * are met:
18 * 1. Redistributions of source code must retain the above copyright
19 * notice, this list of conditions and the following disclaimer.
20 * 2. Redistributions in binary form must reproduce the above copyright
21 * notice, this list of conditions and the following disclaimer in the
22 * documentation and/or other materials provided with the distribution.
23 * 3. Neither the name of Sun Microsystems, Inc. nor the names of its
24 * contributors may be used to endorse or promote products derived
25 * from this software without specific prior written permission.
27 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
28 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
29 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
30 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
31 * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
32 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
33 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
34 * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
35 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
36 * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
37 * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
39 *************************************************************************/
40 import com.sun.star.uno.Type;
41 import javax.swing.tree.TreeNode;
44 public class SwingUnoNode extends HideableMutableTreeNode implements XUnoNode{
45 private UnoNode m_oUnoNode;
47 /** Creates a new instance of SwingUnoNode */
48 public SwingUnoNode(Object _oUnoObject) {
49 super();
50 m_oUnoNode = new UnoNode(_oUnoObject);
54 public SwingUnoNode(Object _oUnoObject, Type _aType) {
55 super();
56 m_oUnoNode = new UnoNode(_oUnoObject, _aType);
57 if (_aType != null){
58 this.setLabel(_aType.getTypeName());
63 public Object getUnoObject(){
64 return m_oUnoNode.getUnoObject();
67 public void setVisible(String _sFilter){
68 boolean bisVisible = isFilterApplicable(_sFilter);
69 super.setVisible(bisVisible);
72 public boolean isFilterApplicable(String _sFilter) {
73 return m_oUnoNode.isFilterApplicable(_sFilter, getName());
76 public void setParameterObjects(Object[] _oParamObjects) {
77 m_oUnoNode.setParameterObjects(_oParamObjects);
80 public void openIdlDescription(String _SDKPath) {
81 m_oUnoNode.openIdlDescription(_SDKPath, getClassName(), getAnchor());
84 public Object[] getParameterObjects() {
85 return m_oUnoNode.getParameterObjects();
88 public String getClassName(){
89 String sClassName = m_oUnoNode.getClassName();
90 if (sClassName.equals("")){
91 TreeNode oTreeNode = getParent();
92 if (oTreeNode != null){
93 if (oTreeNode instanceof XUnoNode){
94 SwingUnoNode oUnoNode = (SwingUnoNode) oTreeNode;
95 sClassName = oUnoNode.getClassName();
99 return sClassName;
102 public String getAnchor() {
103 return m_oUnoNode.getAnchor();
107 public void setFoldable(boolean _bIsFoldable){
108 if (_bIsFoldable){
109 addDummyNode();
111 else{
112 removeDummyNode();
117 public XUnoNode getParentNode(){
118 return (SwingUnoNode) super.getParent();
122 public void addChildNode(XUnoNode _xUnoNode) {
123 super.add((SwingUnoNode) _xUnoNode);
126 public void setLabel(String _sLabel){
127 super.setUserObject(_sLabel);
128 this.m_oUnoNode.setLabel(_sLabel);
131 public String getLabel(){
132 return (String) super.getUserObject();
136 public int getChildCount(){
137 return super.getChildCount();
141 public XUnoNode getChild(int _i){
142 return (SwingUnoNode) super.getChildAt(_i);
145 public int getNodeType(){
146 return m_oUnoNode.getNodeType();
149 public void setNodeType(int _nNodeType){
150 m_oUnoNode.setNodeType(_nNodeType);
154 public String getName(){
155 return getClassName();
159 public Type getUnoType(){
160 return m_oUnoNode.getUnoType();