1 /*************************************************************************
3 * $RCSfile: SwingUnoMethodNode.java,v $
7 * last change: $Author: rt $ $Date: 2007-04-04 09:21:25 $
9 * The Contents of this file are made available subject to the terms of
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
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
.reflection
.XIdlMethod
;
41 import com
.sun
.star
.uno
.TypeClass
;
42 import java
.awt
.event
.ActionEvent
;
43 import java
.awt
.event
.ActionListener
;
44 import java
.util
.Vector
;
48 public class SwingUnoMethodNode
extends SwingUnoNode
implements ActionListener
, XUnoMethodNode
{
50 private UnoMethodNode m_oUnoMethodNode
;
51 private XDialogProvider m_xDialogProvider
= null;
53 public SwingUnoMethodNode(XIdlMethod _xIdlMethod
, Object _oUnoObject
, XDialogProvider _xDialogProvider
) {
55 m_oUnoMethodNode
= new UnoMethodNode(_xIdlMethod
, _oUnoObject
, this);
56 m_xDialogProvider
= _xDialogProvider
;
57 setUserObject(m_oUnoMethodNode
.getNodeDescription());
58 if (m_oUnoMethodNode
.isFoldable()){
63 public boolean isFoldable(){
64 return m_oUnoMethodNode
.isFoldable();
67 public String
getName(){
68 return m_oUnoMethodNode
.getName();
71 public String
getClassName(){
72 String sClassName
= "";
73 sClassName
= getXIdlMethod().getDeclaringClass().getName();
74 if (sClassName
.equals("")){
75 sClassName
= super.getClassName();
80 public String
getAnchor(){
81 return m_oUnoMethodNode
.getAnchor();
84 public Object
invoke(Object _oUnoObject
, Object
[] _oParameters
) throws com
.sun
.star
.uno
.Exception
{
85 return m_oUnoMethodNode
.invoke(_oUnoObject
, _oParameters
);
89 public Object
[] getLastParameterObjects(){
90 return m_oUnoMethodNode
.getLastParameterObjects();
93 public Object
getLastUnoReturnObject(){
94 return m_oUnoMethodNode
.getLastUnoReturnObject();
97 public TypeClass
getTypeClass() {
98 return m_oUnoMethodNode
.getTypeClass();
101 public XIdlMethod
getXIdlMethod() {
102 return m_oUnoMethodNode
.getXIdlMethod();
105 public boolean hasParameters() {
106 return m_oUnoMethodNode
.hasParameters();
109 public Object
invoke() throws com
.sun
.star
.uno
.Exception
{
110 return m_oUnoMethodNode
.invoke();
113 public boolean isInvoked() {
114 return m_oUnoMethodNode
.isInvoked();
117 public boolean isInvokable(){
118 return m_oUnoMethodNode
.isInvokable();
121 public boolean isPrimitive() {
122 return m_oUnoMethodNode
.isPrimitive();
125 public void actionPerformed(ActionEvent e
){
126 openIdlDescription(m_xDialogProvider
.getIDLPath());
129 public Vector
getMethodObjects(){
130 MethodParametersDialog oMethodParametersDialog
= new MethodParametersDialog(this);
131 oMethodParametersDialog
.addActionListener(this);
132 return oMethodParametersDialog
.getMethodObjects();
136 public String
getParameterDescription(){
137 return m_oUnoMethodNode
.getParameterDescription();
141 public String
getStandardMethodDescription(){
142 return m_oUnoMethodNode
.getStandardMethodDescription();