From c7a9d4a6bd53ed7d61731770f2f10e8b9fd435f9 Mon Sep 17 00:00:00 2001 From: Fuwn Date: Thu, 12 Feb 2026 22:33:32 -0800 Subject: Initial commit --- NET/worlds/console/StatisticsWindow.java | 91 ++++++++++++++++++++++++++++++++ 1 file changed, 91 insertions(+) create mode 100644 NET/worlds/console/StatisticsWindow.java (limited to 'NET/worlds/console/StatisticsWindow.java') diff --git a/NET/worlds/console/StatisticsWindow.java b/NET/worlds/console/StatisticsWindow.java new file mode 100644 index 0000000..a206d6c --- /dev/null +++ b/NET/worlds/console/StatisticsWindow.java @@ -0,0 +1,91 @@ +package NET.worlds.console; + +import java.awt.Dimension; +import java.awt.Event; +import java.awt.Frame; +import java.awt.GridBagConstraints; +import java.awt.GridBagLayout; +import java.awt.List; +import java.awt.Point; + +public class StatisticsWindow extends Frame implements MainCallback, MainTerminalCallback, TreeCallback { + private static final long serialVersionUID = 2184104724858956037L; + Tree _tree = new Tree(this); + List _list = new List(10, false); + StatMan _lastStat; + + public StatisticsWindow(java.awt.Window parent) { + super("Statistics Manager"); + GridBagLayout gbag = new GridBagLayout(); + this.setLayout(gbag); + GridBagConstraints c = new GridBagConstraints(); + c.fill = 1; + c.weightx = 0.4; + c.weighty = 1.0; + c.gridwidth = 1; + c.gridheight = 0; + gbag.setConstraints(this._tree, c); + this.add(this._tree); + c.weightx = 0.6; + c.gridwidth = 0; + gbag.setConstraints(this._list, c); + this.add(this._list); + this.pack(); + Point loc = parent.location(); + Dimension size = parent.getSize(); + this.reshape(loc.x + (size.width - 512) / 2, loc.y + (size.height - 240) / 2, 512, 240); + this.show(); + StatisticsRoot root = StatisticsRoot.getNode(); + root.setTree(this._tree); + StatTreeNode rootNode = new StatTreeNode(root, null); + this._tree.change(rootNode, rootNode.getObject()); + StatMemNode.getNode(); + StatNetRefNode.getNode(); + this._tree.change(rootNode, StatRateNode.getNode()); + Main.register(this); + } + + @Override + public boolean handleEvent(Event ev) { + switch (ev.id) { + case 201: + if (this._lastStat != null) { + this._lastStat.releaseList(false); + } + + this._lastStat = null; + this.dispose(); + return true; + default: + return super.handleEvent(ev); + } + } + + @Override + public void treeChange(Object obj) { + if (this._lastStat != null) { + this._lastStat.releaseList(false); + } + + this._lastStat = (StatMan)obj; + this._lastStat.grabList(this._list); + } + + @Override + public void treeFocusChanged(boolean hasFocus) { + } + + @Override + public void mainCallback() { + } + + @Override + public void terminalCallback() { + if (this._lastStat != null) { + this._lastStat.releaseList(true); + } + + this._lastStat = null; + Main.unregister(this); + } +} -- cgit v1.2.3