1 import javax.swing.tree.TreePath; 2 3 4 public class SwingTreePathProvider implements XTreePathProvider { 5 TreePath m_aTreePath; 6 7 /** Creates a new instance of TreePathProvider */ 8 public SwingTreePathProvider(TreePath _aTreePath) { 9 m_aTreePath = _aTreePath; 10 } 11 12 13 public XUnoNode getLastPathComponent(){ 14 return (XUnoNode) m_aTreePath.getLastPathComponent(); 15 } 16 17 18 public XUnoNode getPathComponent(int i){ 19 return (XUnoNode) m_aTreePath.getPathComponent(i); 20 } 21 22 public int getPathCount(){ 23 return m_aTreePath.getPathCount(); 24 } 25 26 27 public XTreePathProvider getParentPath(){ 28 return new SwingTreePathProvider(m_aTreePath.getParentPath()); 29 } 30 31 32 public XTreePathProvider pathByAddingChild(XUnoNode _oUnoNode){ 33 TreePath aTreePath = m_aTreePath.pathByAddingChild(_oUnoNode); 34 return new SwingTreePathProvider(aTreePath); 35 } 36 37 public TreePath getSwingTreePath(){ 38 return m_aTreePath; 39 } 40 } 41