MCPcopy Create free account
hub / github.com/BombusMod/BombusMod / StatsWindow

Class StatsWindow

src/main/java/Statistic/StatsWindow.java:46–136  ·  view source on GitHub ↗

@author ad

Source from the content-addressed store, hash-verified

44 * @author ad
45 */
46public class StatsWindow
47 extends DefForm {
48
49
50 Stats st=Stats.getInstance();
51
52 public MenuCommand cmdClear = new MenuCommand(SR.MS_CLEAR, MenuCommand.SCREEN, 2, RosterIcons.ICON_CLEAR);
53//#ifdef CLIPBOARD
54 MenuCommand cmdCopy = new MenuCommand(SR.MS_COPY, MenuCommand.SCREEN, 1, RosterIcons.ICON_COPY);
55 MenuCommand cmdCopyPlus = new MenuCommand("+ "+SR.MS_COPY, MenuCommand.SCREEN, 2, RosterIcons.ICON_COPYPLUS);
56//#endif
57
58 MultiLine item=null;
59
60 /**
61 * Creates a new instance of StatsWindow
62 */
63 public StatsWindow() {
64 super(SR.MS_STATS);
65 item=new MultiLine(SR.MS_ALL, StringUtils.getSizeString(st.getAllTraffic())); item.selectable=true; itemsList.addElement(item);
66
67 item=new MultiLine(SR.MS_PREVIOUS_, StringUtils.getSizeString(st.getLatest())); item.selectable=true; itemsList.addElement(item);
68
69 item=new MultiLine(SR.MS_CURRENT, StringUtils.getSizeString(Stats.getCurrentTraffic())); item.selectable=true; itemsList.addElement(item);
70//#if ZLIB
71//# if (StaticData.getInstance().roster.isLoggedIn()) {
72//# item=new MultiLine(SR.MS_COMPRESSION, StaticData.getInstance().getTheStream().getStreamStats()); item.selectable=true; itemsList.addElement(item);
73//# }
74//#
75//# if (StaticData.getInstance().roster.isLoggedIn()) {
76//# item=new MultiLine(SR.MS_CONNECTED, StaticData.getInstance().getTheStream().getConnectionData()); item.selectable=true; itemsList.addElement(item);
77//# }
78//#endif
79 item=new MultiLine(SR.MS_CONN, Integer.toString(st.getSessionsCount())); item.selectable=true; itemsList.addElement(item);
80
81 item=new MultiLine(SR.MS_STARTED, Roster.startTime); item.selectable=true; itemsList.addElement(item);
82 }
83
84 public void commandState() {
85 menuCommands.removeAllElements();
86//#ifdef CLIPBOARD
87 addMenuCommand(cmdCopy);
88 if (!ClipBoardIO.getInstance().isEmpty()) {
89 addMenuCommand(cmdCopyPlus);
90 }
91
92//#endif
93 addMenuCommand(cmdClear);
94 }
95
96 public void menuAction(MenuCommand command, VirtualList displayable) {
97//#ifdef CLIPBOARD
98 if (command == cmdCopy) {
99 try {
100 String str = ((MultiLine) getFocusedObject()).toString();
101 if (str == null)
102 str = "";
103 ClipBoardIO.getInstance().setClipBoard(str);

Callers

nothing calls this directly

Calls 1

getInstanceMethod · 0.95

Tested by

no test coverage detected