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