overallSessions.setText(Integer.toString(Session.getOverallSessions())); activeSessions.setText(Integer.toString(Session.getActiveSessions())); requestCount.setText(Integer.toString(WingServlet.getRequestCount())); uptime.setText(getUptimeString(WingServlet.getUptime()));
overallSessions.setText(Integer.toString(WingsStatistics.getStatistics().getOverallSessionCount())); activeSessions.setText(Integer.toString(WingsStatistics.getStatistics().getActiveSessionCount())); requestCount.setText(Integer.toString(WingsStatistics.getStatistics().getRequestCount())); uptime.setText(getUptimeString(WingsStatistics.getStatistics().getUptime()));
    public SComponent createExample() {        final SButton gc = new SButton("gc");        final SProgressBar infoBar = new SProgressBar();        final SLabel totalMemory = new SLabel();        final SLabel freeMemory = new SLabel();        final SLabel usedMemory = new SLabel();        final SLabel overallSessions = new SLabel();        final SLabel activeSessions = new SLabel();        final SLabel uptime = new SLabel();        final SLabel requestCount = new SLabel();        final SPanel panel = new SPanel();        gc.addActionListener(new ActionListener() {                public void actionPerformed(ActionEvent e) {                    System.gc();                }            });        SRenderListener renderListener = new SRenderListener() {                public void startRendering(SRenderEvent e) {                    long free = Runtime.getRuntime().freeMemory();                    long total = Runtime.getRuntime().totalMemory();                                   infoBar.setMaximum((int)total);                    infoBar.setValue((int)(total-free));                    infoBar.setString(getByteString(total-free));                                        totalMemory.setText(getByteString(total));                    freeMemory.setText(getByteString(free));                    usedMemory.setText(getByteString(total-free));                    overallSessions.setText(Integer.toString(Session.getOverallSessions()));                    activeSessions.setText(Integer.toString(Session.getActiveSessions()));                    requestCount.setText(Integer.toString(WingServlet.getRequestCount()));                    uptime.setText(getUptimeString(WingServlet.getUptime()));                }                                public void doneRendering(SRenderEvent e) {}            };        panel.addRenderListener(renderListener);        infoBar.setUnfilledColor(java.awt.Color.gray);        infoBar.setFilledColor(java.awt.Color.red);        infoBar.setForeground(java.awt.Color.red);        infoBar.setBorderColor(java.awt.Color.black);        infoBar.setStringPainted(true);        infoBar.setPreferredSize(new SDimension(200,5));        try {            java.net.URL templateURL =                 getClass().getResource("/wingset/templates/MemUsageExample.thtml");            STemplateLayout layout = new STemplateLayout(templateURL);            panel.setLayout(layout);        } catch ( Exception ex ) {            ex.printStackTrace();        }        panel.add(gc, "GC");        panel.add(infoBar, "InfoBar");        panel.add(totalMemory, "TotalMemory");        panel.add(freeMemory, "FreeMemory");        panel.add(usedMemory, "UsedMemory");        panel.add(activeSessions, "ActiveSessions");        panel.add(overallSessions, "OverallSessions");        panel.add(requestCount, "RequestCount");        panel.add(uptime, "Uptime");        return panel;    }