Treecontrol

From Apache OpenOffice Wiki
Revision as of 12:32, 7 September 2006 by Cl@openoffice.org (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search


Using the DefaultTreeModel

Reference< ComponentContext > xCC(...);

// create the root node with the text value "root node text"

Reference< XMutableTreeNode > xRootNode( MutableTreeNode::create2( Any( OUString( "root node text" ) ) ) );

// add two child nodes with text
xRootNode.appendChild( MutableTreeNode::create2( Any( OUString( "child 1" ) ) ) );
xRootNode.appendChild( MutableTreeNode::create2( Any( OUString( "child 2" ) ) ) );

// create the default tree model with the root node
Reference< XDefaultTreeModel > xDefaultTreeModel( DefaultTreeModel::create2( xRootNode ) );
Personal tools