1*34dd1e25SAndrew Rist /************************************************************** 2*34dd1e25SAndrew Rist * 3*34dd1e25SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 4*34dd1e25SAndrew Rist * or more contributor license agreements. See the NOTICE file 5*34dd1e25SAndrew Rist * distributed with this work for additional information 6*34dd1e25SAndrew Rist * regarding copyright ownership. The ASF licenses this file 7*34dd1e25SAndrew Rist * to you under the Apache License, Version 2.0 (the 8*34dd1e25SAndrew Rist * "License"); you may not use this file except in compliance 9*34dd1e25SAndrew Rist * with the License. You may obtain a copy of the License at 10*34dd1e25SAndrew Rist * 11*34dd1e25SAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12*34dd1e25SAndrew Rist * 13*34dd1e25SAndrew Rist * Unless required by applicable law or agreed to in writing, 14*34dd1e25SAndrew Rist * software distributed under the License is distributed on an 15*34dd1e25SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16*34dd1e25SAndrew Rist * KIND, either express or implied. See the License for the 17*34dd1e25SAndrew Rist * specific language governing permissions and limitations 18*34dd1e25SAndrew Rist * under the License. 19*34dd1e25SAndrew Rist * 20*34dd1e25SAndrew Rist *************************************************************/ 21*34dd1e25SAndrew Rist 22*34dd1e25SAndrew Rist 23cdf0e10cSrcweir 24cdf0e10cSrcweir import com.sun.star.beans.Property; 25cdf0e10cSrcweir import com.sun.star.beans.PropertyValue; 26cdf0e10cSrcweir import com.sun.star.lang.NullPointerException; 27cdf0e10cSrcweir import com.sun.star.reflection.XConstantTypeDescription; 28cdf0e10cSrcweir import com.sun.star.reflection.XIdlMethod; 29cdf0e10cSrcweir import com.sun.star.uno.AnyConverter; 30cdf0e10cSrcweir import com.sun.star.uno.Type; 31cdf0e10cSrcweir import java.awt.BorderLayout; 32cdf0e10cSrcweir import java.awt.Container; 33cdf0e10cSrcweir import java.awt.Dimension; 34cdf0e10cSrcweir import java.awt.event.KeyAdapter; 35cdf0e10cSrcweir import java.awt.event.KeyEvent; 36cdf0e10cSrcweir import java.awt.event.MouseAdapter; 37cdf0e10cSrcweir import java.awt.event.MouseEvent; 38cdf0e10cSrcweir import javax.swing.JLabel; 39cdf0e10cSrcweir import javax.swing.JPanel; 40cdf0e10cSrcweir import javax.swing.JProgressBar; 41cdf0e10cSrcweir import javax.swing.JScrollBar; 42cdf0e10cSrcweir import javax.swing.JScrollPane; 43cdf0e10cSrcweir import javax.swing.JSplitPane; 44cdf0e10cSrcweir import javax.swing.JTextArea; 45cdf0e10cSrcweir import javax.swing.JTextField; 46cdf0e10cSrcweir import javax.swing.JTree; 47cdf0e10cSrcweir import javax.swing.event.TreeSelectionEvent; 48cdf0e10cSrcweir import javax.swing.event.TreeSelectionListener; 49cdf0e10cSrcweir import javax.swing.event.TreeWillExpandListener; 50cdf0e10cSrcweir import javax.swing.tree.DefaultTreeSelectionModel; 51cdf0e10cSrcweir import javax.swing.tree.ExpandVetoException; 52cdf0e10cSrcweir import javax.swing.tree.TreePath; 53cdf0e10cSrcweir import javax.swing.tree.TreeSelectionModel; 54cdf0e10cSrcweir 55cdf0e10cSrcweir 56cdf0e10cSrcweir 57cdf0e10cSrcweir public class SwingTreeControlProvider implements XTreeControlProvider{ 58cdf0e10cSrcweir private JTextArea jtxtGeneratedSourceCode = new JTextArea(); 59cdf0e10cSrcweir private JTextField jtxtFilter = new JTextField(); 60cdf0e10cSrcweir private javax.swing.JLabel jlblFilter = new javax.swing.JLabel("Set a filter"); 61cdf0e10cSrcweir private JPanel jPnlBottom = new JPanel(new BorderLayout()); 62cdf0e10cSrcweir private JPanel jPanelProgress = new JPanel(new BorderLayout()); 63cdf0e10cSrcweir private JPanel jPnlPath = new JPanel(new BorderLayout()); 64cdf0e10cSrcweir private JLabel jLblPath = new JLabel("Generated source code"); 65cdf0e10cSrcweir private JProgressBar jProgressBar1 = new JProgressBar(); 66cdf0e10cSrcweir private JTree jTree = new javax.swing.JTree(); 67cdf0e10cSrcweir private XDialogProvider m_xDialogProvider; 68cdf0e10cSrcweir private HideableTreeModel treeModel; 69cdf0e10cSrcweir private UnoTreeRenderer oUnoTreeRenderer; 70cdf0e10cSrcweir private InspectorPane m_oInspectorPane; 71cdf0e10cSrcweir private Object oUserDefinedObject = null; 72cdf0e10cSrcweir private boolean bIsUserDefined = false; 73cdf0e10cSrcweir private SwingUnoNode oRootNode; 74cdf0e10cSrcweir 75cdf0e10cSrcweir private final int nDIALOGWIDTH = 800; 76cdf0e10cSrcweir 77cdf0e10cSrcweir 78cdf0e10cSrcweir SwingTreeControlProvider(XDialogProvider _xDialogProvider)79cdf0e10cSrcweir public SwingTreeControlProvider(XDialogProvider _xDialogProvider){ 80cdf0e10cSrcweir m_xDialogProvider = _xDialogProvider; 81cdf0e10cSrcweir } 82cdf0e10cSrcweir 83cdf0e10cSrcweir addInspectorPane(InspectorPane _oInspectorPane)84cdf0e10cSrcweir public void addInspectorPane(InspectorPane _oInspectorPane){ 85cdf0e10cSrcweir m_oInspectorPane = _oInspectorPane; 86cdf0e10cSrcweir } 87cdf0e10cSrcweir getInspectorPane()88cdf0e10cSrcweir public InspectorPane getInspectorPane() throws NullPointerException{ 89cdf0e10cSrcweir if (m_oInspectorPane == null){ 90cdf0e10cSrcweir throw new NullPointerException("InspectorPage has not been added to TreeControl"); 91cdf0e10cSrcweir } 92cdf0e10cSrcweir else{ 93cdf0e10cSrcweir return m_oInspectorPane; 94cdf0e10cSrcweir } 95cdf0e10cSrcweir } 96cdf0e10cSrcweir ComponentSelector(Object _oRootObject, String _sRootTreeNodeName)97cdf0e10cSrcweir private void ComponentSelector(Object _oRootObject, String _sRootTreeNodeName) { 98cdf0e10cSrcweir String sTreeNodeName = _sRootTreeNodeName; 99cdf0e10cSrcweir oRootNode = new SwingUnoNode(_oRootObject); 100cdf0e10cSrcweir oRootNode.setLabel(_sRootTreeNodeName); 101cdf0e10cSrcweir treeModel = new HideableTreeModel(oRootNode); 102cdf0e10cSrcweir jTree.setModel(treeModel); 103cdf0e10cSrcweir jTree.setRootVisible(true); 104cdf0e10cSrcweir jTree.setVisible(true); 105cdf0e10cSrcweir oRootNode.setFoldable(true); 106cdf0e10cSrcweir enableFilterElements(null); 107cdf0e10cSrcweir } 108cdf0e10cSrcweir 109cdf0e10cSrcweir 110cdf0e10cSrcweir insertTopPanel(JPanel _jPnlCenter)111cdf0e10cSrcweir private void insertTopPanel(JPanel _jPnlCenter){ 112cdf0e10cSrcweir javax.swing.JPanel jPnlTop = new javax.swing.JPanel(new BorderLayout(10, 10)); 113cdf0e10cSrcweir jPnlTop.setPreferredSize(new java.awt.Dimension(nDIALOGWIDTH, 20)); 114cdf0e10cSrcweir jlblFilter.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT); 115cdf0e10cSrcweir jlblFilter.setHorizontalTextPosition(javax.swing.SwingConstants.RIGHT); 116cdf0e10cSrcweir jPnlTop.add(jlblFilter, java.awt.BorderLayout.WEST); 117cdf0e10cSrcweir jtxtFilter.setHorizontalAlignment(javax.swing.JTextField.LEFT); 118cdf0e10cSrcweir jtxtFilter.setPreferredSize(new java.awt.Dimension(200, 10)); 119cdf0e10cSrcweir jtxtFilter.addKeyListener(new InspectorKeyFilterAdapter()); 120cdf0e10cSrcweir jPnlTop.add(jtxtFilter, java.awt.BorderLayout.CENTER); 121cdf0e10cSrcweir _jPnlCenter.add(jPnlTop, java.awt.BorderLayout.NORTH); 122cdf0e10cSrcweir } 123cdf0e10cSrcweir 124cdf0e10cSrcweir insertBottomPanel(JSplitPane _jSplitPane)125cdf0e10cSrcweir private void insertBottomPanel(JSplitPane _jSplitPane){ //JPanel _jPnlCenter){ 126cdf0e10cSrcweir jtxtGeneratedSourceCode.setTabSize(4); 127cdf0e10cSrcweir jtxtGeneratedSourceCode.getAccessibleContext().setAccessibleName("generated SourceCode"); 128cdf0e10cSrcweir JScrollPane jScrollPane = new JScrollPane(jtxtGeneratedSourceCode); 129cdf0e10cSrcweir jScrollPane.setPreferredSize(new Dimension(nDIALOGWIDTH,205)); 130cdf0e10cSrcweir jtxtGeneratedSourceCode.setEditable(false); 131cdf0e10cSrcweir _jSplitPane.setBottomComponent(jScrollPane); 132cdf0e10cSrcweir } 133cdf0e10cSrcweir insertBorderPanes(Container _cp)134cdf0e10cSrcweir private void insertBorderPanes(Container _cp){ 135cdf0e10cSrcweir JPanel jPnlEast = new JPanel(new BorderLayout()); 136cdf0e10cSrcweir JPanel jPnlNorth = new JPanel(new BorderLayout()); 137cdf0e10cSrcweir JPanel jPnlSouth = new JPanel(new BorderLayout()); 138cdf0e10cSrcweir JPanel jPnlWest = new JPanel(new BorderLayout()); 139cdf0e10cSrcweir _cp.add(jPnlNorth, java.awt.BorderLayout.NORTH); 140cdf0e10cSrcweir jPnlWest.setPreferredSize(new java.awt.Dimension(10, 10)); 141cdf0e10cSrcweir _cp.add(jPnlWest, java.awt.BorderLayout.WEST); 142cdf0e10cSrcweir jPnlEast.setPreferredSize(new java.awt.Dimension(10, 10)); 143cdf0e10cSrcweir _cp.add(jPnlEast, java.awt.BorderLayout.EAST); 144cdf0e10cSrcweir jPnlSouth.setPreferredSize(new java.awt.Dimension(10, 10)); 145cdf0e10cSrcweir _cp.add(jPnlSouth, java.awt.BorderLayout.SOUTH); 146cdf0e10cSrcweir } 147cdf0e10cSrcweir 148cdf0e10cSrcweir enableFilterElements(XUnoNode _oUnoNode)149cdf0e10cSrcweir public String enableFilterElements(XUnoNode _oUnoNode){ 150cdf0e10cSrcweir String sFilter =""; 151cdf0e10cSrcweir boolean bIsFacetteNode = isFacetteNode(_oUnoNode); 152cdf0e10cSrcweir this.jtxtFilter.setEnabled(bIsFacetteNode); 153cdf0e10cSrcweir this.jlblFilter.setEnabled(bIsFacetteNode); 154cdf0e10cSrcweir sFilter = m_oInspectorPane.getFilter(_oUnoNode); 155cdf0e10cSrcweir jtxtFilter.setText(sFilter); 156cdf0e10cSrcweir return sFilter; 157cdf0e10cSrcweir } 158cdf0e10cSrcweir 159cdf0e10cSrcweir 160cdf0e10cSrcweir private class InspectorKeyFilterAdapter extends KeyAdapter{ keyReleased(KeyEvent e)161cdf0e10cSrcweir public void keyReleased(KeyEvent e){ 162cdf0e10cSrcweir String sFilter = jtxtFilter.getText(); 163cdf0e10cSrcweir SwingTreePathProvider oSwingTreePathProvider = new SwingTreePathProvider(jTree.getSelectionPath()); 164cdf0e10cSrcweir XUnoNode oUnoNode = oSwingTreePathProvider.getLastPathComponent(); 165cdf0e10cSrcweir if (oUnoNode instanceof XUnoFacetteNode){ 166cdf0e10cSrcweir m_oInspectorPane.applyFilter((XUnoFacetteNode) oUnoNode, sFilter); 167cdf0e10cSrcweir } 168cdf0e10cSrcweir } 169cdf0e10cSrcweir } 170cdf0e10cSrcweir 171cdf0e10cSrcweir 172cdf0e10cSrcweir 173cdf0e10cSrcweir /** Inspect the given object for methods, properties, interfaces, and 174cdf0e10cSrcweir * services. 175cdf0e10cSrcweir * @param a The object to inspect 176cdf0e10cSrcweir * @throws RuntimeException If 177cdf0e10cSrcweir */ inspect(java.lang.Object _oUserDefinedObject, String _sTitle)178cdf0e10cSrcweir public Object inspect(java.lang.Object _oUserDefinedObject, String _sTitle) throws com.sun.star.uno.RuntimeException { 179cdf0e10cSrcweir JPanel jPnlContainer = new javax.swing.JPanel(new BorderLayout(10, 10)); 180cdf0e10cSrcweir try { 181cdf0e10cSrcweir javax.swing.JPanel jPnlCenter = new javax.swing.JPanel(); 182cdf0e10cSrcweir bIsUserDefined = (_oUserDefinedObject != null); 183cdf0e10cSrcweir if (bIsUserDefined){ 184cdf0e10cSrcweir oUserDefinedObject = _oUserDefinedObject; 185cdf0e10cSrcweir m_oInspectorPane.setTitle(_sTitle); 186cdf0e10cSrcweir } 187cdf0e10cSrcweir javax.swing.JScrollPane jScrollPane1 = new javax.swing.JScrollPane(); 188cdf0e10cSrcweir TreeSelectionModel tsm = new DefaultTreeSelectionModel(); 189cdf0e10cSrcweir tsm.setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION); 190cdf0e10cSrcweir jTree.setSelectionModel(tsm); 191cdf0e10cSrcweir jTree.setVisible(false); 192cdf0e10cSrcweir jPnlCenter.setLayout(new java.awt.BorderLayout(10, 10)); 193cdf0e10cSrcweir jPnlCenter.getAccessibleContext().setAccessibleName("inspection tab view"); 194cdf0e10cSrcweir insertTopPanel(jPnlCenter); 195cdf0e10cSrcweir jScrollPane1.setViewportView(jTree); 196cdf0e10cSrcweir jScrollPane1.setPreferredSize(new java.awt.Dimension(600, 600)); 197cdf0e10cSrcweir jScrollPane1.getAccessibleContext().setAccessibleName("API view scroll pane"); 198cdf0e10cSrcweir 199cdf0e10cSrcweir JScrollBar jHScrollBar = jScrollPane1.createHorizontalScrollBar(); 200cdf0e10cSrcweir jHScrollBar.getAccessibleContext().setAccessibleName("API view horizontal scroll bar"); 201cdf0e10cSrcweir jScrollPane1.setHorizontalScrollBar(jHScrollBar); 202cdf0e10cSrcweir 203cdf0e10cSrcweir JScrollBar jVScrollBar = jScrollPane1.createVerticalScrollBar(); 204cdf0e10cSrcweir jVScrollBar.getAccessibleContext().setAccessibleName("API view vertical scroll bar"); 205cdf0e10cSrcweir jScrollPane1.setVerticalScrollBar(jVScrollBar); 206cdf0e10cSrcweir 207cdf0e10cSrcweir JSplitPane jSplitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT); 208cdf0e10cSrcweir jSplitPane.setTopComponent(jScrollPane1); 209cdf0e10cSrcweir jPnlCenter.add(jSplitPane, java.awt.BorderLayout.CENTER); 210cdf0e10cSrcweir jSplitPane.setDividerLocation(500); 211cdf0e10cSrcweir insertBottomPanel(jSplitPane); 212cdf0e10cSrcweir UnoTreeRenderer oUnoTreeRenderer = new UnoTreeRenderer(); 213cdf0e10cSrcweir jTree.setCellRenderer(oUnoTreeRenderer); 214cdf0e10cSrcweir jTree.addTreeSelectionListener( 215cdf0e10cSrcweir new TreeSelectionListener() { 216cdf0e10cSrcweir public void valueChanged(TreeSelectionEvent event) { 217cdf0e10cSrcweir TreePath tp = event.getNewLeadSelectionPath(); 218cdf0e10cSrcweir if (tp != null){ 219cdf0e10cSrcweir XUnoNode oUnoNode = getSelectedNode(); 220cdf0e10cSrcweir String sFilter = enableFilterElements(oUnoNode); 221cdf0e10cSrcweir } 222cdf0e10cSrcweir } 223cdf0e10cSrcweir } 224cdf0e10cSrcweir ); 225cdf0e10cSrcweir // Add KeyListener for help 226cdf0e10cSrcweir jTree.addKeyListener( new java.awt.event.KeyAdapter() { 227cdf0e10cSrcweir public void keyReleased(java.awt.event.KeyEvent event) { 228cdf0e10cSrcweir if ( event.getKeyCode() == KeyEvent.VK_F1 ) { 229cdf0e10cSrcweir // function key F1 pressed 230cdf0e10cSrcweir TreePath aTreePath = jTree.getSelectionPath(); 231cdf0e10cSrcweir SwingUnoNode oUnoNode = (SwingUnoNode) aTreePath.getLastPathComponent(); 232cdf0e10cSrcweir oUnoNode.openIdlDescription(m_xDialogProvider.getIDLPath()); 233cdf0e10cSrcweir } 234cdf0e10cSrcweir } 235cdf0e10cSrcweir }); 236cdf0e10cSrcweir jTree.addMouseListener(new MouseAdapter() { 237cdf0e10cSrcweir public void mousePressed (MouseEvent e) { 238cdf0e10cSrcweir if (e.isPopupTrigger()){ 239cdf0e10cSrcweir m_oInspectorPane.showPopUpMenu(e.getComponent(), e.getX(), e.getY()); 240cdf0e10cSrcweir } 241cdf0e10cSrcweir //unfortunately under Windows the method "isPopupTrigger" always returns false 242cdf0e10cSrcweir else if ((e.getModifiersEx() & MouseEvent.BUTTON3_DOWN_MASK) == MouseEvent.BUTTON3_DOWN_MASK){ 243cdf0e10cSrcweir m_oInspectorPane.showPopUpMenu(e.getComponent(), e.getX(), e.getY()); 244cdf0e10cSrcweir } 245cdf0e10cSrcweir } 246cdf0e10cSrcweir }); 247cdf0e10cSrcweir jPnlContainer.add(jPnlCenter, java.awt.BorderLayout.CENTER); 248cdf0e10cSrcweir insertBorderPanes(jPnlContainer); 249cdf0e10cSrcweir if (this.bIsUserDefined){ 250cdf0e10cSrcweir ComponentSelector(oUserDefinedObject, m_oInspectorPane.getTitle()); 251cdf0e10cSrcweir } 252cdf0e10cSrcweir m_xDialogProvider.addInspectorPage(m_oInspectorPane.getTitle(), jPnlContainer); 253cdf0e10cSrcweir addTreeExpandListener(); 254cdf0e10cSrcweir } 255cdf0e10cSrcweir catch( Exception exception ) { 256cdf0e10cSrcweir exception.printStackTrace(System.out); 257cdf0e10cSrcweir } 258cdf0e10cSrcweir return jPnlContainer; 259cdf0e10cSrcweir } 260cdf0e10cSrcweir getModel()261cdf0e10cSrcweir public HideableTreeModel getModel(){ 262cdf0e10cSrcweir return treeModel; 263cdf0e10cSrcweir } 264cdf0e10cSrcweir 265cdf0e10cSrcweir addTreeExpandListener()266cdf0e10cSrcweir public void addTreeExpandListener(){ 267cdf0e10cSrcweir jTree.addTreeWillExpandListener( 268cdf0e10cSrcweir new TreeWillExpandListener() { 269cdf0e10cSrcweir public void treeWillExpand(javax.swing.event.TreeExpansionEvent event) throws javax.swing.tree.ExpandVetoException { 270cdf0e10cSrcweir SwingTreePathProvider oSwingTreePathProvider = new SwingTreePathProvider(event.getPath()); 271cdf0e10cSrcweir XUnoNode oUnoNode = oSwingTreePathProvider.getLastPathComponent(); 272cdf0e10cSrcweir if (!m_oInspectorPane.expandNode(oUnoNode, oSwingTreePathProvider)){ 273cdf0e10cSrcweir throw new ExpandVetoException(event); 274cdf0e10cSrcweir } 275cdf0e10cSrcweir } 276cdf0e10cSrcweir 277cdf0e10cSrcweir public void treeWillCollapse( javax.swing.event.TreeExpansionEvent evt) throws javax.swing.tree.ExpandVetoException { 278cdf0e10cSrcweir } 279cdf0e10cSrcweir }); 280cdf0e10cSrcweir } 281cdf0e10cSrcweir 282cdf0e10cSrcweir setSourceCode(String _sSourceCode)283cdf0e10cSrcweir public void setSourceCode(String _sSourceCode){ 284cdf0e10cSrcweir jtxtGeneratedSourceCode.setText(_sSourceCode); 285cdf0e10cSrcweir } 286cdf0e10cSrcweir 287cdf0e10cSrcweir getSelectedPath()288cdf0e10cSrcweir public XTreePathProvider getSelectedPath(){ 289cdf0e10cSrcweir return new SwingTreePathProvider(jTree.getSelectionPath()); 290cdf0e10cSrcweir } 291cdf0e10cSrcweir 292cdf0e10cSrcweir expandPath(XTreePathProvider _xTreePathProvider)293cdf0e10cSrcweir public void expandPath(XTreePathProvider _xTreePathProvider) throws ClassCastException{ 294cdf0e10cSrcweir SwingTreePathProvider oSwingTreePathProvider = (SwingTreePathProvider) _xTreePathProvider; 295cdf0e10cSrcweir jTree.expandPath(oSwingTreePathProvider.getSwingTreePath()); 296cdf0e10cSrcweir } 297cdf0e10cSrcweir 298cdf0e10cSrcweir getSelectedNode()299cdf0e10cSrcweir public XUnoNode getSelectedNode(){ 300cdf0e10cSrcweir XUnoNode oUnoNode = null; 301cdf0e10cSrcweir TreePath aTreePath = jTree.getSelectionPath(); 302cdf0e10cSrcweir Object oNode = aTreePath.getLastPathComponent(); 303cdf0e10cSrcweir if (oNode instanceof XUnoNode){ 304cdf0e10cSrcweir oUnoNode = (XUnoNode) oNode; 305cdf0e10cSrcweir } 306cdf0e10cSrcweir return oUnoNode; 307cdf0e10cSrcweir } 308cdf0e10cSrcweir 309cdf0e10cSrcweir nodeInserted(XUnoNode _oParentNode, XUnoNode _oChildNode, int index)310cdf0e10cSrcweir public void nodeInserted(XUnoNode _oParentNode, XUnoNode _oChildNode, int index) { 311cdf0e10cSrcweir getModel().nodeInserted(_oParentNode, _oChildNode, _oParentNode.getChildCount()-1); 312cdf0e10cSrcweir } 313cdf0e10cSrcweir 314cdf0e10cSrcweir nodeChanged(XUnoNode _oNode)315cdf0e10cSrcweir public void nodeChanged(XUnoNode _oNode) { 316cdf0e10cSrcweir getModel().nodeChanged(_oNode); 317cdf0e10cSrcweir } 318cdf0e10cSrcweir 319cdf0e10cSrcweir setNodeVisible(Object node, boolean v)320cdf0e10cSrcweir public boolean setNodeVisible(Object node, boolean v) { 321cdf0e10cSrcweir return getModel().setNodeVisible(node, v); 322cdf0e10cSrcweir } 323cdf0e10cSrcweir 324cdf0e10cSrcweir isPropertyNode(XUnoNode _oUnoNode)325cdf0e10cSrcweir public boolean isPropertyNode(XUnoNode _oUnoNode){ 326cdf0e10cSrcweir return (_oUnoNode instanceof SwingUnoPropertyNode); 327cdf0e10cSrcweir } 328cdf0e10cSrcweir 329cdf0e10cSrcweir isMethodNode(XUnoNode _oUnoNode)330cdf0e10cSrcweir public boolean isMethodNode(XUnoNode _oUnoNode){ 331cdf0e10cSrcweir return (_oUnoNode instanceof SwingUnoMethodNode); 332cdf0e10cSrcweir } 333cdf0e10cSrcweir 334cdf0e10cSrcweir isFacetteNode(XUnoNode _oUnoNode)335cdf0e10cSrcweir public boolean isFacetteNode(XUnoNode _oUnoNode){ 336cdf0e10cSrcweir return (_oUnoNode instanceof SwingUnoFacetteNode); 337cdf0e10cSrcweir } 338cdf0e10cSrcweir 339cdf0e10cSrcweir addUnoNode(Object _oUnoObject)340cdf0e10cSrcweir public XUnoNode addUnoNode(Object _oUnoObject){ 341cdf0e10cSrcweir return new SwingUnoNode(_oUnoObject); 342cdf0e10cSrcweir } 343cdf0e10cSrcweir 344cdf0e10cSrcweir addUnoNode(Object _oUnoObject, Type _aType)345cdf0e10cSrcweir public XUnoNode addUnoNode(Object _oUnoObject, Type _aType){ 346cdf0e10cSrcweir return new SwingUnoNode(_oUnoObject, _aType); 347cdf0e10cSrcweir } 348cdf0e10cSrcweir 349cdf0e10cSrcweir addUnoFacetteNode(XUnoNode _oParentNode, String _sNodeDescription, Object _oUnoObject)350cdf0e10cSrcweir public XUnoFacetteNode addUnoFacetteNode(XUnoNode _oParentNode, String _sNodeDescription, Object _oUnoObject){ 351cdf0e10cSrcweir SwingUnoFacetteNode oSwingUnoFacetteNode = new SwingUnoFacetteNode(_oUnoObject); 352cdf0e10cSrcweir oSwingUnoFacetteNode.setLabel(_sNodeDescription); 353cdf0e10cSrcweir if (_oParentNode != null){ 354cdf0e10cSrcweir ((SwingUnoNode) _oParentNode).addChildNode(oSwingUnoFacetteNode); 355cdf0e10cSrcweir } 356cdf0e10cSrcweir return oSwingUnoFacetteNode; 357cdf0e10cSrcweir } 358cdf0e10cSrcweir 359cdf0e10cSrcweir addMethodNode(Object _objectElement, XIdlMethod _xIdlMethod)360cdf0e10cSrcweir public XUnoMethodNode addMethodNode(Object _objectElement, XIdlMethod _xIdlMethod){ 361cdf0e10cSrcweir SwingUnoMethodNode oSwingUnoMethodNode = new SwingUnoMethodNode(_xIdlMethod, _objectElement, m_xDialogProvider); 362cdf0e10cSrcweir return oSwingUnoMethodNode; 363cdf0e10cSrcweir } 364cdf0e10cSrcweir 365cdf0e10cSrcweir addUnoPropertyNodeWithName(Property _aProperty)366cdf0e10cSrcweir public XUnoPropertyNode addUnoPropertyNodeWithName(Property _aProperty){ 367cdf0e10cSrcweir SwingUnoPropertyNode oUnoPropertyNode = new SwingUnoPropertyNode(_aProperty); 368cdf0e10cSrcweir oUnoPropertyNode.setLabel("Name: " + _aProperty.Name); 369cdf0e10cSrcweir return oUnoPropertyNode; 370cdf0e10cSrcweir } 371cdf0e10cSrcweir 372cdf0e10cSrcweir addUnoPropertyNodeWithHandle(Property _aProperty)373cdf0e10cSrcweir public XUnoPropertyNode addUnoPropertyNodeWithHandle(Property _aProperty){ 374cdf0e10cSrcweir SwingUnoPropertyNode oUnoPropertyNode = new SwingUnoPropertyNode(_aProperty); 375cdf0e10cSrcweir oUnoPropertyNode.setLabel("Handle: " + _aProperty.Handle); 376cdf0e10cSrcweir return oUnoPropertyNode; 377cdf0e10cSrcweir } 378cdf0e10cSrcweir 379cdf0e10cSrcweir addUnoPropertyNodeWithType(Property _aProperty)380cdf0e10cSrcweir public XUnoPropertyNode addUnoPropertyNodeWithType(Property _aProperty){ 381cdf0e10cSrcweir SwingUnoPropertyNode oUnoPropertyNode = new SwingUnoPropertyNode(_aProperty); 382cdf0e10cSrcweir oUnoPropertyNode.setLabel("Type: " + _aProperty.Type.getTypeName()); 383cdf0e10cSrcweir return oUnoPropertyNode; 384cdf0e10cSrcweir } 385cdf0e10cSrcweir 386cdf0e10cSrcweir addUnoPropertyNodeWithAttributesDescription(Property _aProperty)387cdf0e10cSrcweir public XUnoPropertyNode addUnoPropertyNodeWithAttributesDescription(Property _aProperty){ 388cdf0e10cSrcweir SwingUnoPropertyNode oUnoPropertyNode = new SwingUnoPropertyNode(_aProperty); 389cdf0e10cSrcweir XConstantTypeDescription[] xPropertyAttributesTypeDescriptions = Introspector.getIntrospector().getFieldsOfConstantGroup("com.sun.star.beans.PropertyAttribute"); 390cdf0e10cSrcweir String sDisplay = Introspector.getIntrospector().getConstantDisplayString((int) _aProperty.Attributes, xPropertyAttributesTypeDescriptions, "Attributes: "); 391cdf0e10cSrcweir oUnoPropertyNode.setLabel(sDisplay); 392cdf0e10cSrcweir return oUnoPropertyNode; 393cdf0e10cSrcweir } 394cdf0e10cSrcweir 395cdf0e10cSrcweir addUnoPropertyNode(Object _oUnoObject, Property _aProperty)396cdf0e10cSrcweir public XUnoPropertyNode addUnoPropertyNode(Object _oUnoObject, Property _aProperty){ 397cdf0e10cSrcweir SwingUnoPropertyNode oUnoPropertyNode = new SwingUnoPropertyNode(_aProperty, _oUnoObject, null); 398cdf0e10cSrcweir oUnoPropertyNode.setPropertyNodeType(XUnoPropertyNode.nPROPERTYSETINFOTYPE); 399cdf0e10cSrcweir oUnoPropertyNode.setLabel(UnoPropertyNode.getStandardPropertyDescription(_aProperty, null)); 400cdf0e10cSrcweir return oUnoPropertyNode; 401cdf0e10cSrcweir } 402cdf0e10cSrcweir 403cdf0e10cSrcweir addUnoPropertyNode(Object _oUnoObject, Property _aProperty, Object _oUnoReturnObject)404cdf0e10cSrcweir public XUnoPropertyNode addUnoPropertyNode(Object _oUnoObject, Property _aProperty, Object _oUnoReturnObject){ 405cdf0e10cSrcweir SwingUnoPropertyNode oUnoPropertyNode = new SwingUnoPropertyNode(_aProperty, _oUnoObject, _oUnoReturnObject); 406cdf0e10cSrcweir oUnoPropertyNode.setLabel(UnoPropertyNode.getStandardPropertyDescription(_aProperty, _oUnoReturnObject)); 407cdf0e10cSrcweir return oUnoPropertyNode; 408cdf0e10cSrcweir } 409cdf0e10cSrcweir 410cdf0e10cSrcweir addUnoPropertyNode(Object _oUnoObject, PropertyValue _aPropertyValue, Object _oReturnObject)411cdf0e10cSrcweir public XUnoPropertyNode addUnoPropertyNode(Object _oUnoObject, PropertyValue _aPropertyValue, Object _oReturnObject){ 412cdf0e10cSrcweir SwingUnoPropertyNode oUnoPropertyNode = new SwingUnoPropertyNode(_aPropertyValue, _oUnoObject, _oReturnObject); 413cdf0e10cSrcweir oUnoPropertyNode.setLabel(UnoPropertyNode.getStandardPropertyValueDescription(_aPropertyValue)); 414cdf0e10cSrcweir return oUnoPropertyNode; 415cdf0e10cSrcweir } 416cdf0e10cSrcweir } 417