1*ae15d43aSAndrew Rist /************************************************************** 2*ae15d43aSAndrew Rist * 3*ae15d43aSAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 4*ae15d43aSAndrew Rist * or more contributor license agreements. See the NOTICE file 5*ae15d43aSAndrew Rist * distributed with this work for additional information 6*ae15d43aSAndrew Rist * regarding copyright ownership. The ASF licenses this file 7*ae15d43aSAndrew Rist * to you under the Apache License, Version 2.0 (the 8*ae15d43aSAndrew Rist * "License"); you may not use this file except in compliance 9*ae15d43aSAndrew Rist * with the License. You may obtain a copy of the License at 10*ae15d43aSAndrew Rist * 11*ae15d43aSAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12*ae15d43aSAndrew Rist * 13*ae15d43aSAndrew Rist * Unless required by applicable law or agreed to in writing, 14*ae15d43aSAndrew Rist * software distributed under the License is distributed on an 15*ae15d43aSAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16*ae15d43aSAndrew Rist * KIND, either express or implied. See the License for the 17*ae15d43aSAndrew Rist * specific language governing permissions and limitations 18*ae15d43aSAndrew Rist * under the License. 19*ae15d43aSAndrew Rist * 20*ae15d43aSAndrew Rist *************************************************************/ 21*ae15d43aSAndrew Rist 22cdf0e10cSrcweir import javax.swing.tree.TreePath; 23cdf0e10cSrcweir 24cdf0e10cSrcweir 25cdf0e10cSrcweir public class SwingTreePathProvider implements XTreePathProvider { 26cdf0e10cSrcweir TreePath m_aTreePath; 27cdf0e10cSrcweir 28cdf0e10cSrcweir /** Creates a new instance of TreePathProvider */ SwingTreePathProvider(TreePath _aTreePath)29cdf0e10cSrcweir public SwingTreePathProvider(TreePath _aTreePath) { 30cdf0e10cSrcweir m_aTreePath = _aTreePath; 31cdf0e10cSrcweir } 32cdf0e10cSrcweir 33cdf0e10cSrcweir getLastPathComponent()34cdf0e10cSrcweir public XUnoNode getLastPathComponent(){ 35cdf0e10cSrcweir return (XUnoNode) m_aTreePath.getLastPathComponent(); 36cdf0e10cSrcweir } 37cdf0e10cSrcweir 38cdf0e10cSrcweir getPathComponent(int i)39cdf0e10cSrcweir public XUnoNode getPathComponent(int i){ 40cdf0e10cSrcweir return (XUnoNode) m_aTreePath.getPathComponent(i); 41cdf0e10cSrcweir } 42cdf0e10cSrcweir getPathCount()43cdf0e10cSrcweir public int getPathCount(){ 44cdf0e10cSrcweir return m_aTreePath.getPathCount(); 45cdf0e10cSrcweir } 46cdf0e10cSrcweir 47cdf0e10cSrcweir getParentPath()48cdf0e10cSrcweir public XTreePathProvider getParentPath(){ 49cdf0e10cSrcweir return new SwingTreePathProvider(m_aTreePath.getParentPath()); 50cdf0e10cSrcweir } 51cdf0e10cSrcweir 52cdf0e10cSrcweir pathByAddingChild(XUnoNode _oUnoNode)53cdf0e10cSrcweir public XTreePathProvider pathByAddingChild(XUnoNode _oUnoNode){ 54cdf0e10cSrcweir TreePath aTreePath = m_aTreePath.pathByAddingChild(_oUnoNode); 55cdf0e10cSrcweir return new SwingTreePathProvider(aTreePath); 56cdf0e10cSrcweir } 57cdf0e10cSrcweir getSwingTreePath()58cdf0e10cSrcweir public TreePath getSwingTreePath(){ 59cdf0e10cSrcweir return m_aTreePath; 60cdf0e10cSrcweir } 61cdf0e10cSrcweir } 62