{
// Clear the attributes table!
DefaultTableModel model = (DefaultTableModel)table.getModel();
model.setRowCount(0);
DefaultMutableTreeNode node = (DefaultMutableTreeNode)tree.getLastSelectedPathComponent();
if(node == null)
return;
// Show the current node attributes into the table!
Object nodeValue = node.getUserObject();
if(nodeValue instanceof ContentNodeValue)
{showContentAttributes(((ContentNodeValue)nodeValue).getContent(), model);}
else if(nodeValue instanceof PageNodeValue)
{showPageAttributes(((PageNodeValue)nodeValue).getPage().getContents(), model);}
pack(table);
}
}
);
tree.addTreeWillExpandListener(
new TreeWillExpandListener()
{
@Override
public void treeWillCollapse(TreeExpansionEvent event) throws ExpandVetoException
{/* NOOP */}
@Override
public void treeWillExpand(TreeExpansionEvent event) throws ExpandVetoException
{
DefaultMutableTreeNode node = (DefaultMutableTreeNode)event.getPath().getLastPathComponent();
Object nodeValue = node.getUserObject();
if(nodeValue instanceof PageNodeValue)
{
// Content placeholder?
if(((DefaultMutableTreeNode)node.getFirstChild()).getUserObject() == null)
{
// Remove the content placeholder!
node.removeAllChildren();
// Create the page content nodes!
createContentNodes(
((PageNodeValue)nodeValue).getPage().getContents(),
node