mirror of
https://github.com/overcuriousity/autopsy-flatpak.git
synced 2025-07-15 09:17:42 +00:00
4961 prevent leaking this in constructor when setting up listeners
This commit is contained in:
parent
d730cb714a
commit
23a02fbce4
@ -155,15 +155,17 @@ final class HexView extends JPanel implements CaretListener {
|
|||||||
this._hexView.setText(hexSB.toString());
|
this._hexView.setText(hexSB.toString());
|
||||||
this._asciiView.setText(asciiSB.toString());
|
this._asciiView.setText(asciiSB.toString());
|
||||||
|
|
||||||
this._hexView.addCaretListener(this);
|
|
||||||
this._asciiView.addCaretListener(this);
|
|
||||||
|
|
||||||
this._asciiView.setSelectedTextColor(this._asciiView.getForeground());
|
this._asciiView.setSelectedTextColor(this._asciiView.getForeground());
|
||||||
this._hexView.setSelectedTextColor(this._asciiView.getForeground());
|
this._hexView.setSelectedTextColor(this._asciiView.getForeground());
|
||||||
this._highlightColor = this._hexView.getSelectionColor();
|
this._highlightColor = this._hexView.getSelectionColor();
|
||||||
this._highlighterPainter = new DefaultHighlighter.DefaultHighlightPainter(this._highlightColor);
|
this._highlighterPainter = new DefaultHighlighter.DefaultHighlightPainter(this._highlightColor);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void addCaretListeners() {
|
||||||
|
this._hexView.addCaretListener(this);
|
||||||
|
this._asciiView.addCaretListener(this);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* clearHighlight removes any colors applied to the text views.
|
* clearHighlight removes any colors applied to the text views.
|
||||||
*/
|
*/
|
||||||
|
@ -116,6 +116,7 @@ public final class RejTreeValueView extends RejTreeNodeView {
|
|||||||
}
|
}
|
||||||
default: {
|
default: {
|
||||||
HexView hexView = new HexView(data.getAsRawData());
|
HexView hexView = new HexView(data.getAsRawData());
|
||||||
|
hexView.addCaretListeners();
|
||||||
hexView.setBorder(BorderFactory.createTitledBorder("Value"));
|
hexView.setBorder(BorderFactory.createTitledBorder("Value"));
|
||||||
valueComponent = hexView;
|
valueComponent = hexView;
|
||||||
break;
|
break;
|
||||||
|
@ -62,8 +62,6 @@ final class RejTreeView extends JScrollPane implements TreeExpansionListener, Tr
|
|||||||
this._tree_model.setAsksAllowsChildren(true);
|
this._tree_model.setAsksAllowsChildren(true);
|
||||||
|
|
||||||
this._tree = new JTree(this._tree_model);
|
this._tree = new JTree(this._tree_model);
|
||||||
this._tree.addTreeExpansionListener(this);
|
|
||||||
this._tree.addTreeSelectionListener(this);
|
|
||||||
|
|
||||||
// here's a bit of a hack to force the children to be loaded and shown
|
// here's a bit of a hack to force the children to be loaded and shown
|
||||||
this._tree.collapsePath(new TreePath(rootNode.getPath()));
|
this._tree.collapsePath(new TreePath(rootNode.getPath()));
|
||||||
@ -73,6 +71,11 @@ final class RejTreeView extends JScrollPane implements TreeExpansionListener, Tr
|
|||||||
setPreferredSize(new Dimension(250, 400));
|
setPreferredSize(new Dimension(250, 400));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void addTreeListeners() {
|
||||||
|
this._tree.addTreeExpansionListener(this);
|
||||||
|
this._tree.addTreeSelectionListener(this);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* getTreeNode creates a TreeNode from a RejTreeNode, settings the
|
* getTreeNode creates a TreeNode from a RejTreeNode, settings the
|
||||||
* appropriate fields.
|
* appropriate fields.
|
||||||
|
@ -41,6 +41,7 @@ public final class RejView extends JPanel implements RejTreeNodeSelectionListene
|
|||||||
this._hive = hive;
|
this._hive = hive;
|
||||||
// have to do these cause they're final
|
// have to do these cause they're final
|
||||||
this._tree_view = new RejTreeView(this._hive);
|
this._tree_view = new RejTreeView(this._hive);
|
||||||
|
this._tree_view.addTreeListeners();
|
||||||
this._splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT,
|
this._splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT,
|
||||||
this._tree_view, new JPanel());
|
this._tree_view, new JPanel());
|
||||||
this.setupUI();
|
this.setupUI();
|
||||||
@ -52,6 +53,7 @@ public final class RejView extends JPanel implements RejTreeNodeSelectionListene
|
|||||||
|
|
||||||
// have to do these cause they're final
|
// have to do these cause they're final
|
||||||
this._tree_view = new RejTreeView(this._hive);
|
this._tree_view = new RejTreeView(this._hive);
|
||||||
|
this._tree_view.addTreeListeners();
|
||||||
this._splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT,
|
this._splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT,
|
||||||
this._tree_view, new JPanel());
|
this._tree_view, new JPanel());
|
||||||
this.setupUI();
|
this.setupUI();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user