1818import javax .swing .border .SoftBevelBorder ;
1919
2020import org .cyberpwn .react .network .NetworkedServer ;
21+ import org .cyberpwn .react .ui .Grapher ;
2122import org .cyberpwn .react .ui .JXTabbedPane ;
23+ import org .cyberpwn .react .util .F ;
24+ import org .cyberpwn .react .util .GList ;
25+ import org .cyberpwn .react .util .GMap ;
2226
2327import net .miginfocom .swing .MigLayout ;
2428
2529public class ServerTab
2630{
2731 private NetworkedServer ns ;
2832
33+ private JLabel lblTps ;
34+ private JLabel lblMbUsed ;
35+ private JLabel lblGcminute ;
36+ private JLabel lblMahs ;
37+ private JLabel lblUsingSpigot ;
38+ private JLabel lblOnline ;
39+ private JLabel lblmsPing ;
40+
41+ private JPanel TPS ;
42+ private Grapher GTPS ;
43+ private GList <Double > DTPS ;
44+
2945 public ServerTab (JFrame frame , NetworkedServer server , JXTabbedPane tabbedPane )
3046 {
3147 this .ns = server ;
48+ this .DTPS = new GList <Double >().qadd (20.0 );
3249
3350 JPanel panel = new JPanel ();
3451 tabbedPane .addTab (ns .getName (), new ImageIcon (ReactClient .class .getResource ("/org/cyberpwn/react/ui/server-mini.png" )), panel , null );
@@ -52,21 +69,17 @@ public ServerTab(JFrame frame, NetworkedServer server, JXTabbedPane tabbedPane)
5269 lblServerName .setFont (new Font ("Segoe UI Light" , Font .PLAIN , 35 ));
5370 panel_5 .add (lblServerName , "cell 0 0" );
5471
55- JLabel lblUsingSpigot = new JLabel ("Using Spigot 1.8.8" );
72+ lblUsingSpigot = new JLabel ("Using Spigot 1.8.8" );
5673 lblUsingSpigot .setFont (new Font ("Segoe UI Light" , Font .PLAIN , 18 ));
5774 panel_5 .add (lblUsingSpigot , "cell 0 1" );
5875
59- JLabel lblOnline = new JLabel ("146 Players Online" );
76+ lblOnline = new JLabel ("146 Players Online" );
6077 lblOnline .setFont (new Font ("Segoe UI Light" , Font .PLAIN , 18 ));
6178 panel_5 .add (lblOnline , "cell 0 2" );
6279
63- JLabel lblHours = new JLabel ("7 Hours Uptime" );
64- lblHours .setFont (new Font ("Segoe UI Light" , Font .PLAIN , 18 ));
65- panel_5 .add (lblHours , "cell 0 3" );
66-
67- JLabel lblmsPing = new JLabel ("43 Plugins" );
80+ lblmsPing = new JLabel ("43 Plugins" );
6881 lblmsPing .setFont (new Font ("Segoe UI Light" , Font .PLAIN , 18 ));
69- panel_5 .add (lblmsPing , "cell 0 4 " );
82+ panel_5 .add (lblmsPing , "cell 0 3 " );
7083
7184 JPanel panel_8 = new JPanel ();
7285 panel_8 .setBorder (new SoftBevelBorder (BevelBorder .RAISED , null , null , null , null ));
@@ -120,14 +133,16 @@ public void mouseReleased(MouseEvent e)
120133 lblCpuLoad .setFont (new Font ("Segoe UI Light" , Font .PLAIN , 35 ));
121134 panel_7 .add (lblCpuLoad , "flowx,cell 0 0" );
122135
123- JLabel lblTps = new JLabel ("20 TPS (99% Stable)" );
136+ lblTps = new JLabel ("20 TPS (99% Stable)" );
124137 lblTps .setFont (new Font ("Segoe UI Light" , Font .PLAIN , 18 ));
125138 panel_7 .add (lblTps , "cell 1 0" );
126139
127- JPanel panel_10 = new JPanel ();
128- panel_10 .setBorder (new SoftBevelBorder (BevelBorder .LOWERED , null , null , null , null ));
129- panel_10 .setBackground (Color .DARK_GRAY );
130- panel_7 .add (panel_10 , "cell 0 1 2 2,grow" );
140+ TPS = new JPanel ();
141+ TPS .setBorder (new SoftBevelBorder (BevelBorder .LOWERED , null , null , null , null ));
142+ TPS .setBackground (Color .DARK_GRAY );
143+ panel_7 .add (TPS , "cell 0 1 2 2,grow" );
144+ GTPS = new Grapher (TPS .getWidth (), TPS .getHeight (), 20 , Color .CYAN , new GList <Double >().qadd (1.0 ));
145+ TPS .add (GTPS );
131146
132147 JPanel panel_13 = new JPanel ();
133148 tabbedPane_2 .addTab ("Memory" , null , panel_13 , null );
@@ -143,7 +158,7 @@ public void mouseReleased(MouseEvent e)
143158 lblMemory .setFont (new Font ("Segoe UI Light" , Font .PLAIN , 35 ));
144159 panel_14 .add (lblMemory , "cell 0 0" );
145160
146- JLabel lblMbUsed = new JLabel ("683 MB Used" );
161+ lblMbUsed = new JLabel ("683 MB Used" );
147162 lblMbUsed .setFont (new Font ("Segoe UI Light" , Font .PLAIN , 18 ));
148163 panel_14 .add (lblMbUsed , "cell 1 0" );
149164
@@ -162,7 +177,7 @@ public void mouseReleased(MouseEvent e)
162177 lblGarbage .setFont (new Font ("Segoe UI Light" , Font .PLAIN , 35 ));
163178 panel_16 .add (lblGarbage , "cell 0 0" );
164179
165- JLabel lblGcminute = new JLabel ("9 GC/Minute" );
180+ lblGcminute = new JLabel ("9 GC/Minute" );
166181 lblGcminute .setFont (new Font ("Segoe UI Light" , Font .PLAIN , 18 ));
167182 panel_16 .add (lblGcminute , "cell 1 0" );
168183
@@ -181,7 +196,7 @@ public void mouseReleased(MouseEvent e)
181196 lblState .setFont (new Font ("Segoe UI Light" , Font .PLAIN , 35 ));
182197 panel_15 .add (lblState , "cell 0 0" );
183198
184- JLabel lblMahs = new JLabel ("264 MAH/s" );
199+ lblMahs = new JLabel ("264 MAH/s" );
185200 lblMahs .setFont (new Font ("Segoe UI Light" , Font .PLAIN , 18 ));
186201 panel_15 .add (lblMahs , "cell 1 0" );
187202
@@ -210,7 +225,7 @@ public void mouseReleased(MouseEvent e)
210225 list .setSelectionMode (ListSelectionModel .SINGLE_SELECTION );
211226 panel_12 .add (list , "cell 0 1 2 1,grow" );
212227
213- JLabel lblNewLabel = new JLabel ("Executing \" Purge Chunks \" (33%) " );
228+ JLabel lblNewLabel = new JLabel ("Not Yet Implemented " );
214229 lblNewLabel .setFont (new Font ("Segoe UI Light" , Font .PLAIN , 18 ));
215230 panel_12 .add (lblNewLabel , "cell 0 2" );
216231
@@ -228,13 +243,51 @@ public void mouseReleased(MouseEvent e)
228243 panel_3 .add (panel_18 , "cell 0 0 2 2,grow" );
229244 panel_18 .setLayout (new MigLayout ("" , "[]" , "[][]" ));
230245
231- JLabel lblNoIssuesFound = new JLabel ("No Issues Found" );
246+ JLabel lblNoIssuesFound = new JLabel ("No Issues Found (NOT YET IMPLEMENTED) " );
232247 lblNoIssuesFound .setFont (new Font ("Segoe UI Light" , Font .PLAIN , 35 ));
233248 panel_18 .add (lblNoIssuesFound , "cell 0 0" );
234249
235250 JLabel lblNewLabel_1 = new JLabel ("Looks Like this server is doing fine for the moment!" );
236251 lblNewLabel_1 .setFont (new Font ("Segoe UI Light" , Font .PLAIN , 18 ));
237252 panel_18 .add (lblNewLabel_1 , "cell 0 1" );
253+ }
254+
255+ public void push (GMap <String , Double > sample )
256+ {
257+ lblUsingSpigot .setText ("Using " + ns .getVersionBukkit ());
258+ lblTps .setText (F .f (sample .get ("tps" ), 2 ) + " TPS (" + F .pc (sample .get ("stability" ), 0 ) + " Stable)" );
259+ lblGcminute .setText (F .f (sample .get ("spms" )) + " GC/Minute" );
260+ lblMahs .setText (F .f (sample .get ("mah/s" )) + " MAH/s" );
261+ lblMbUsed .setText (F .mem (sample .get ("mem" ).longValue ()) + " Used" );
262+ lblOnline .setText (F .f (sample .get ("plr" )) + " Players Online" );
263+ lblmsPing .setText (F .f (sample .get ("plg" )) + " Loaded Plugins" );
264+
265+ DTPS .add (sample .get ("tps" ));
238266
267+ if (DTPS .size () > 64 )
268+ {
269+ DTPS .remove (0 );
270+ }
271+
272+ GTPS .setWidth (TPS .getWidth ());
273+ GTPS .setHeight (TPS .getHeight ());
274+ GTPS .setData (DTPS );
275+ GTPS .repaint ();
276+ TPS .repaint ();
239277 }
278+
279+ /*
280+ >> liq/s : 0.0
281+ >> tnt/s : 0.0
282+ >> drops : 31.0
283+ >> hist : 1.0
284+ >> chk/s : 10.6
285+ >> rct : 501220.2773345846
286+ >> red/s : 0.0
287+ >> chunks : 0.0
288+ >> mb/p : 29.857142857142858
289+ >> ents : 190.0
290+ >> cgen/s : 2.0
291+ >> chunkmem : 0.0
292+ */
240293}
0 commit comments