Skip to content

Commit

Permalink
Implement correct reset functionality to clear display when closing c…
Browse files Browse the repository at this point in the history
…urrent file or opening a new one. This fixes Bug #7
  • Loading branch information
Jmcleodfoss committed Oct 28, 2020
1 parent 1f03a7c commit 3c45ba7
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,27 @@
@SuppressWarnings("serial")
class BlockBTreeDisplay extends BTreeWithData
{
/** The current block's contents */
private BlockDescriptionDisplay blockDescriptionDisplay;

/** Construct a BTreeWithData object with the appropriate orientation and contents for the block B-tree display. */
BlockBTreeDisplay()
{
super(JSplitPane.HORIZONTAL_SPLIT);
setDataView(new BlockDescriptionDisplay(tree));
blockDescriptionDisplay = new BlockDescriptionDisplay(tree);
setDataView(blockDescriptionDisplay);
}

/** Get the tree model for the block B-tree. */
TreeModel treeModel()
{
return (TreeModel)pstExplorer.pst().blockBTree;
}

/** Clear the tree model. */
void reset()
{
super.reset();
blockDescriptionDisplay.reset();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,15 @@
@SuppressWarnings("serial")
class NodeBTreeDisplay extends BTreeWithData
{
/** The current node's contents */
private NodeDescriptionDisplay nodeDescriptionDisplay;

/** Construct a BTreeWithData object with the given orientation and content pane. */
protected NodeBTreeDisplay(JFrame parentFrame)
{
super(JSplitPane.HORIZONTAL_SPLIT);
setDataView(new NodeDescriptionDisplay(tree, parentFrame));
nodeDescriptionDisplay = new NodeDescriptionDisplay(tree, parentFrame);
setDataView(nodeDescriptionDisplay);
}

/** Update the views when a new file is read in.
Expand All @@ -29,4 +33,11 @@ public void fileLoaded(final PST pst)
tree.setModel(treeModel());
}
}

/** Clear the tree model. */
void reset()
{
super.reset();
nodeDescriptionDisplay.reset();
}
}

0 comments on commit 3c45ba7

Please sign in to comment.