xref: /AOO41X/main/odk/examples/java/Inspector/SwingUnoFacetteNode.java (revision 45ef6fe1924d02a50cf49b401b032f05a6968308)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 import com.sun.star.reflection.XIdlMethod;
25 import com.sun.star.uno.Type;
26 import com.sun.star.uno.XComponentContext;
27 import javax.swing.tree.DefaultMutableTreeNode;
28 
29 public class SwingUnoFacetteNode extends SwingUnoNode implements XUnoFacetteNode{
30     String m_sFilter = "";
31 
32     /** Creates a new instance of UnoMethodNode */
33     public SwingUnoFacetteNode(Object _oUnoObject){
34         super(_oUnoObject);
35         setFoldable(true);
36     }
37 
38 
39     public String getFilter(){
40         return m_sFilter;
41     }
42 
43     public void setFilter(String _sFilter){
44         m_sFilter = _sFilter;
45     }
46 
47     public String getName(){
48         return toString();
49     }
50 
51 // TODO The implementation of the following methods is not really robust and should be changed!!!
52     public boolean isMethodNode(){
53         return ((String) getUserObject()).equals(SMETHODDESCRIPTION);
54     }
55 
56     public boolean isPropertyNode(){
57         String sNodeDescription = (String) getUserObject();
58         return ((sNodeDescription.equals(SPROPERTYDESCRIPTION)) || (sNodeDescription.equals(SPROPERTYINFODESCRIPTION)) || (sNodeDescription.equals(SPROPERTYVALUEDESCRIPTION)));
59     }
60 
61     public boolean isContainerNode(){
62         return ((String) getUserObject()).equals(SCONTAINERDESCRIPTION);
63     }
64 
65     public boolean isServiceNode(){
66         return ((String) getUserObject()).equals(SSERVICEDESCRIPTION);
67     }
68 
69     public boolean isInterfaceNode(){
70         return ((String) getUserObject()).equals(SINTERFACEDESCRIPTION);
71     }
72 }
73 
74