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 import com.sun.star.reflection.XIdlMethod;
24 import com.sun.star.uno.TypeClass;
25 import java.awt.event.ActionEvent;
26 import java.awt.event.ActionListener;
27 import java.util.Vector;
28 
29 
30 
31 public class SwingUnoMethodNode extends SwingUnoNode implements ActionListener, XUnoMethodNode{
32 
33     private UnoMethodNode m_oUnoMethodNode;
34     private XDialogProvider m_xDialogProvider = null;
35 
SwingUnoMethodNode(XIdlMethod _xIdlMethod, Object _oUnoObject, XDialogProvider _xDialogProvider)36     public SwingUnoMethodNode(XIdlMethod _xIdlMethod, Object _oUnoObject, XDialogProvider _xDialogProvider) {
37         super(_oUnoObject);
38         m_oUnoMethodNode = new UnoMethodNode(_xIdlMethod, _oUnoObject, this);
39         m_xDialogProvider = _xDialogProvider;
40         setUserObject(m_oUnoMethodNode.getNodeDescription());
41         if (m_oUnoMethodNode.isFoldable()){
42             setFoldable(true);
43         }
44     }
45 
isFoldable()46     public boolean isFoldable(){
47         return m_oUnoMethodNode.isFoldable();
48     }
49 
getName()50     public String getName(){
51         return m_oUnoMethodNode.getName();
52     }
53 
getClassName()54     public String getClassName(){
55         String sClassName = "";
56         sClassName = getXIdlMethod().getDeclaringClass().getName();
57         if (sClassName.equals("")){
58             sClassName = super.getClassName();
59         }
60         return sClassName;
61     }
62 
getAnchor()63     public String getAnchor(){
64         return m_oUnoMethodNode.getAnchor();
65     }
66 
invoke(Object _oUnoObject, Object[] _oParameters)67     public Object invoke(Object _oUnoObject, Object[] _oParameters) throws com.sun.star.uno.Exception{
68         return m_oUnoMethodNode.invoke(_oUnoObject, _oParameters);
69     }
70 
71 
getLastParameterObjects()72     public Object[] getLastParameterObjects(){
73         return m_oUnoMethodNode.getLastParameterObjects();
74     }
75 
getLastUnoReturnObject()76     public Object getLastUnoReturnObject(){
77         return m_oUnoMethodNode.getLastUnoReturnObject();
78     }
79 
getTypeClass()80     public TypeClass getTypeClass() {
81         return m_oUnoMethodNode.getTypeClass();
82     }
83 
getXIdlMethod()84     public XIdlMethod getXIdlMethod() {
85         return m_oUnoMethodNode.getXIdlMethod();
86     }
87 
hasParameters()88     public boolean hasParameters() {
89         return m_oUnoMethodNode.hasParameters();
90     }
91 
invoke()92     public Object invoke()  throws com.sun.star.uno.Exception{
93         return m_oUnoMethodNode.invoke();
94     }
95 
isInvoked()96     public boolean isInvoked() {
97         return m_oUnoMethodNode.isInvoked();
98     }
99 
isInvokable()100     public boolean isInvokable(){
101         return m_oUnoMethodNode.isInvokable();
102     }
103 
isPrimitive()104     public boolean isPrimitive() {
105         return m_oUnoMethodNode.isPrimitive();
106     }
107 
actionPerformed(ActionEvent e)108     public void actionPerformed(ActionEvent e){
109         openIdlDescription(m_xDialogProvider.getIDLPath());
110     }
111 
getMethodObjects()112     public Vector getMethodObjects(){
113         MethodParametersDialog oMethodParametersDialog = new MethodParametersDialog(this);
114         oMethodParametersDialog.addActionListener(this);
115         return oMethodParametersDialog.getMethodObjects();
116     }
117 
118 
getParameterDescription()119     public String getParameterDescription(){
120         return m_oUnoMethodNode.getParameterDescription();
121     }
122 
123 
getStandardMethodDescription()124     public String getStandardMethodDescription(){
125         return m_oUnoMethodNode.getStandardMethodDescription();
126     }
127 }