jdk/src/share/classes/sun/tools/jconsole/ClassTab.java
author alanb
Fri, 02 Nov 2012 15:50:11 +0000
changeset 14342 8435a30053c1
parent 12851 3334e1c781d0
permissions -rw-r--r--
7197491: update copyright year to match last edit in jdk8 jdk repository Reviewed-by: chegar, ksrini
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     1
/*
14342
8435a30053c1 7197491: update copyright year to match last edit in jdk8 jdk repository
alanb
parents: 12851
diff changeset
     2
 * Copyright (c) 2004, 2012, Oracle and/or its affiliates. All rights reserved.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
90ce3da70b43 Initial load
duke
parents:
diff changeset
     4
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
90ce3da70b43 Initial load
duke
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
     7
 * published by the Free Software Foundation.  Oracle designates this
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     8
 * particular file as subject to the "Classpath" exception as provided
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
     9
 * by Oracle in the LICENSE file that accompanied this code.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    10
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    11
 * This code is distributed in the hope that it will be useful, but WITHOUT
90ce3da70b43 Initial load
duke
parents:
diff changeset
    12
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
90ce3da70b43 Initial load
duke
parents:
diff changeset
    13
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
90ce3da70b43 Initial load
duke
parents:
diff changeset
    14
 * version 2 for more details (a copy is included in the LICENSE file that
90ce3da70b43 Initial load
duke
parents:
diff changeset
    15
 * accompanied this code).
90ce3da70b43 Initial load
duke
parents:
diff changeset
    16
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    17
 * You should have received a copy of the GNU General Public License version
90ce3da70b43 Initial load
duke
parents:
diff changeset
    18
 * 2 along with this work; if not, write to the Free Software Foundation,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    19
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    20
 *
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    21
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    22
 * or visit www.oracle.com if you need additional information or have any
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    23
 * questions.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    24
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    25
90ce3da70b43 Initial load
duke
parents:
diff changeset
    26
package sun.tools.jconsole;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    27
90ce3da70b43 Initial load
duke
parents:
diff changeset
    28
import java.awt.*;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    29
import java.awt.event.*;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    30
import java.io.*;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    31
import java.lang.management.*;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    32
import java.lang.reflect.*;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    33
90ce3da70b43 Initial load
duke
parents:
diff changeset
    34
import javax.swing.*;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    35
import javax.swing.border.*;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    36
12851
3334e1c781d0 7017818: NLS: JConsoleResources.java cannot be handled by translation team
egahlin
parents: 5506
diff changeset
    37
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    38
import java.util.concurrent.*;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    39
90ce3da70b43 Initial load
duke
parents:
diff changeset
    40
import static sun.tools.jconsole.Formatter.*;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    41
import static sun.tools.jconsole.Utilities.*;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    42
90ce3da70b43 Initial load
duke
parents:
diff changeset
    43
90ce3da70b43 Initial load
duke
parents:
diff changeset
    44
@SuppressWarnings("serial")
90ce3da70b43 Initial load
duke
parents:
diff changeset
    45
class ClassTab extends Tab implements ActionListener {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    46
    PlotterPanel loadedClassesMeter;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    47
    TimeComboBox timeComboBox;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    48
    private JCheckBox verboseCheckBox;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    49
    private HTMLPane details;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    50
    private ClassOverviewPanel overviewPanel;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    51
    private boolean plotterListening = false;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    52
90ce3da70b43 Initial load
duke
parents:
diff changeset
    53
    private static final String loadedPlotterKey        = "loaded";
90ce3da70b43 Initial load
duke
parents:
diff changeset
    54
    private static final String totalLoadedPlotterKey   = "totalLoaded";
90ce3da70b43 Initial load
duke
parents:
diff changeset
    55
    private static final Color  loadedPlotterColor      = Plotter.defaultColor;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    56
    private static final Color  totalLoadedPlotterColor = Color.red;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    57
90ce3da70b43 Initial load
duke
parents:
diff changeset
    58
    /*
90ce3da70b43 Initial load
duke
parents:
diff changeset
    59
      Hierarchy of panels and layouts for this tab:
90ce3da70b43 Initial load
duke
parents:
diff changeset
    60
90ce3da70b43 Initial load
duke
parents:
diff changeset
    61
        ClassTab (BorderLayout)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    62
90ce3da70b43 Initial load
duke
parents:
diff changeset
    63
            North:  topPanel (BorderLayout)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    64
90ce3da70b43 Initial load
duke
parents:
diff changeset
    65
                        Center: controlPanel (FlowLayout)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    66
                                    timeComboBox
90ce3da70b43 Initial load
duke
parents:
diff changeset
    67
90ce3da70b43 Initial load
duke
parents:
diff changeset
    68
                        East:   topRightPanel (FlowLayout)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    69
                                    verboseCheckBox
90ce3da70b43 Initial load
duke
parents:
diff changeset
    70
90ce3da70b43 Initial load
duke
parents:
diff changeset
    71
            Center: plotterPanel (BorderLayout)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    72
90ce3da70b43 Initial load
duke
parents:
diff changeset
    73
                        Center: plotter
90ce3da70b43 Initial load
duke
parents:
diff changeset
    74
90ce3da70b43 Initial load
duke
parents:
diff changeset
    75
            South:  bottomPanel (BorderLayout)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    76
90ce3da70b43 Initial load
duke
parents:
diff changeset
    77
                        Center: details
90ce3da70b43 Initial load
duke
parents:
diff changeset
    78
    */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    79
90ce3da70b43 Initial load
duke
parents:
diff changeset
    80
    public static String getTabName() {
12851
3334e1c781d0 7017818: NLS: JConsoleResources.java cannot be handled by translation team
egahlin
parents: 5506
diff changeset
    81
        return Messages.CLASSES;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    82
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    83
90ce3da70b43 Initial load
duke
parents:
diff changeset
    84
    public ClassTab(VMPanel vmPanel) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    85
        super(vmPanel, getTabName());
90ce3da70b43 Initial load
duke
parents:
diff changeset
    86
90ce3da70b43 Initial load
duke
parents:
diff changeset
    87
        setLayout(new BorderLayout(0, 0));
90ce3da70b43 Initial load
duke
parents:
diff changeset
    88
        setBorder(new EmptyBorder(4, 4, 3, 4));
90ce3da70b43 Initial load
duke
parents:
diff changeset
    89
90ce3da70b43 Initial load
duke
parents:
diff changeset
    90
        JPanel topPanel     = new JPanel(new BorderLayout());
90ce3da70b43 Initial load
duke
parents:
diff changeset
    91
        JPanel plotterPanel = new JPanel(new BorderLayout());
90ce3da70b43 Initial load
duke
parents:
diff changeset
    92
        JPanel bottomPanel  = new JPanel(new BorderLayout());
90ce3da70b43 Initial load
duke
parents:
diff changeset
    93
90ce3da70b43 Initial load
duke
parents:
diff changeset
    94
        add(topPanel,     BorderLayout.NORTH);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    95
        add(plotterPanel, BorderLayout.CENTER);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    96
        add(bottomPanel,  BorderLayout.SOUTH);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    97
90ce3da70b43 Initial load
duke
parents:
diff changeset
    98
        JPanel controlPanel = new JPanel(new FlowLayout(FlowLayout.CENTER, 20, 5));
90ce3da70b43 Initial load
duke
parents:
diff changeset
    99
        topPanel.add(controlPanel, BorderLayout.CENTER);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   100
12851
3334e1c781d0 7017818: NLS: JConsoleResources.java cannot be handled by translation team
egahlin
parents: 5506
diff changeset
   101
        verboseCheckBox = new JCheckBox(Messages.VERBOSE_OUTPUT);
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   102
        verboseCheckBox.addActionListener(this);
12851
3334e1c781d0 7017818: NLS: JConsoleResources.java cannot be handled by translation team
egahlin
parents: 5506
diff changeset
   103
        verboseCheckBox.setToolTipText(Messages.VERBOSE_OUTPUT_TOOLTIP);
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   104
        JPanel topRightPanel = new JPanel();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   105
        topRightPanel.setBorder(new EmptyBorder(0, 65-8, 0, 70));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   106
        topRightPanel.add(verboseCheckBox);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   107
        topPanel.add(topRightPanel, BorderLayout.AFTER_LINE_ENDS);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   108
12851
3334e1c781d0 7017818: NLS: JConsoleResources.java cannot be handled by translation team
egahlin
parents: 5506
diff changeset
   109
        loadedClassesMeter = new PlotterPanel(Messages.NUMBER_OF_LOADED_CLASSES,
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   110
                                              Plotter.Unit.NONE, false);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   111
        loadedClassesMeter.plotter.createSequence(loadedPlotterKey,
12851
3334e1c781d0 7017818: NLS: JConsoleResources.java cannot be handled by translation team
egahlin
parents: 5506
diff changeset
   112
                                                  Messages.LOADED,
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   113
                                                  loadedPlotterColor,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   114
                                                  true);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   115
        loadedClassesMeter.plotter.createSequence(totalLoadedPlotterKey,
12851
3334e1c781d0 7017818: NLS: JConsoleResources.java cannot be handled by translation team
egahlin
parents: 5506
diff changeset
   116
                                                  Messages.TOTAL_LOADED,
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   117
                                                  totalLoadedPlotterColor,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   118
                                                  true);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   119
        setAccessibleName(loadedClassesMeter.plotter,
12851
3334e1c781d0 7017818: NLS: JConsoleResources.java cannot be handled by translation team
egahlin
parents: 5506
diff changeset
   120
                          Messages.CLASS_TAB_LOADED_CLASSES_PLOTTER_ACCESSIBLE_NAME);
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   121
        plotterPanel.add(loadedClassesMeter);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   122
90ce3da70b43 Initial load
duke
parents:
diff changeset
   123
        timeComboBox = new TimeComboBox(loadedClassesMeter.plotter);
12851
3334e1c781d0 7017818: NLS: JConsoleResources.java cannot be handled by translation team
egahlin
parents: 5506
diff changeset
   124
        controlPanel.add(new LabeledComponent(Messages.TIME_RANGE_COLON,
3334e1c781d0 7017818: NLS: JConsoleResources.java cannot be handled by translation team
egahlin
parents: 5506
diff changeset
   125
                                              Resources.getMnemonicInt(Messages.TIME_RANGE_COLON),
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   126
                                              timeComboBox));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   127
90ce3da70b43 Initial load
duke
parents:
diff changeset
   128
        LabeledComponent.layout(plotterPanel);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   129
12851
3334e1c781d0 7017818: NLS: JConsoleResources.java cannot be handled by translation team
egahlin
parents: 5506
diff changeset
   130
        bottomPanel.setBorder(new CompoundBorder(new TitledBorder(Messages.DETAILS),
3334e1c781d0 7017818: NLS: JConsoleResources.java cannot be handled by translation team
egahlin
parents: 5506
diff changeset
   131
                                                 new EmptyBorder(10, 10, 10, 10)));
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   132
90ce3da70b43 Initial load
duke
parents:
diff changeset
   133
        details = new HTMLPane();
12851
3334e1c781d0 7017818: NLS: JConsoleResources.java cannot be handled by translation team
egahlin
parents: 5506
diff changeset
   134
        setAccessibleName(details, Messages.DETAILS);
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   135
        JScrollPane scrollPane = new JScrollPane(details);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   136
        scrollPane.setPreferredSize(new Dimension(0, 150));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   137
        bottomPanel.add(scrollPane, BorderLayout.SOUTH);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   138
90ce3da70b43 Initial load
duke
parents:
diff changeset
   139
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   140
90ce3da70b43 Initial load
duke
parents:
diff changeset
   141
    public void actionPerformed(ActionEvent ev) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   142
        final boolean b = verboseCheckBox.isSelected();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   143
        workerAdd(new Runnable() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   144
            public void run() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   145
                ProxyClient proxyClient = vmPanel.getProxyClient();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   146
                try {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   147
                    proxyClient.getClassLoadingMXBean().setVerbose(b);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   148
                } catch (UndeclaredThrowableException e) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   149
                    proxyClient.markAsDead();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   150
                } catch (IOException ex) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   151
                    // Ignore
90ce3da70b43 Initial load
duke
parents:
diff changeset
   152
                }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   153
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   154
        });
90ce3da70b43 Initial load
duke
parents:
diff changeset
   155
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   156
90ce3da70b43 Initial load
duke
parents:
diff changeset
   157
90ce3da70b43 Initial load
duke
parents:
diff changeset
   158
    public SwingWorker<?, ?> newSwingWorker() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   159
        final ProxyClient proxyClient = vmPanel.getProxyClient();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   160
90ce3da70b43 Initial load
duke
parents:
diff changeset
   161
        if (!plotterListening) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   162
            proxyClient.addWeakPropertyChangeListener(loadedClassesMeter.plotter);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   163
            plotterListening = true;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   164
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   165
90ce3da70b43 Initial load
duke
parents:
diff changeset
   166
        return new SwingWorker<Boolean, Object>() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   167
            private long clCount, cuCount, ctCount;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   168
            private boolean isVerbose;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   169
            private String detailsStr;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   170
            private long timeStamp;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   171
90ce3da70b43 Initial load
duke
parents:
diff changeset
   172
            public Boolean doInBackground() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   173
                try {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   174
                    ClassLoadingMXBean classLoadingMBean = proxyClient.getClassLoadingMXBean();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   175
90ce3da70b43 Initial load
duke
parents:
diff changeset
   176
                    clCount = classLoadingMBean.getLoadedClassCount();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   177
                    cuCount = classLoadingMBean.getUnloadedClassCount();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   178
                    ctCount = classLoadingMBean.getTotalLoadedClassCount();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   179
                    isVerbose = classLoadingMBean.isVerbose();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   180
                    detailsStr = formatDetails();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   181
                    timeStamp = System.currentTimeMillis();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   182
90ce3da70b43 Initial load
duke
parents:
diff changeset
   183
                    return true;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   184
                } catch (UndeclaredThrowableException e) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   185
                    proxyClient.markAsDead();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   186
                    return false;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   187
                } catch (IOException e) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   188
                    return false;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   189
                }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   190
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   191
90ce3da70b43 Initial load
duke
parents:
diff changeset
   192
            protected void done() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   193
                try {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   194
                    if (get()) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   195
                        loadedClassesMeter.plotter.addValues(timeStamp, clCount, ctCount);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   196
90ce3da70b43 Initial load
duke
parents:
diff changeset
   197
                        if (overviewPanel != null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   198
                            overviewPanel.updateClassInfo(ctCount, clCount);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   199
                            overviewPanel.getPlotter().addValues(timeStamp, clCount);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   200
                        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   201
90ce3da70b43 Initial load
duke
parents:
diff changeset
   202
                        loadedClassesMeter.setValueLabel(clCount + "");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   203
                        verboseCheckBox.setSelected(isVerbose);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   204
                        details.setText(detailsStr);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   205
                    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   206
                } catch (InterruptedException ex) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   207
                } catch (ExecutionException ex) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   208
                    if (JConsole.isDebug()) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   209
                        ex.printStackTrace();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   210
                    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   211
                }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   212
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   213
90ce3da70b43 Initial load
duke
parents:
diff changeset
   214
            private String formatDetails() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   215
                String text = "<table cellspacing=0 cellpadding=0>";
90ce3da70b43 Initial load
duke
parents:
diff changeset
   216
90ce3da70b43 Initial load
duke
parents:
diff changeset
   217
                long time = System.currentTimeMillis();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   218
                String timeStamp = formatDateTime(time);
12851
3334e1c781d0 7017818: NLS: JConsoleResources.java cannot be handled by translation team
egahlin
parents: 5506
diff changeset
   219
                text += newRow(Messages.TIME, timeStamp);
3334e1c781d0 7017818: NLS: JConsoleResources.java cannot be handled by translation team
egahlin
parents: 5506
diff changeset
   220
                text += newRow(Messages.CURRENT_CLASSES_LOADED, justify(clCount, 5));
3334e1c781d0 7017818: NLS: JConsoleResources.java cannot be handled by translation team
egahlin
parents: 5506
diff changeset
   221
                text += newRow(Messages.TOTAL_CLASSES_LOADED,   justify(ctCount, 5));
3334e1c781d0 7017818: NLS: JConsoleResources.java cannot be handled by translation team
egahlin
parents: 5506
diff changeset
   222
                text += newRow(Messages.TOTAL_CLASSES_UNLOADED, justify(cuCount, 5));
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   223
90ce3da70b43 Initial load
duke
parents:
diff changeset
   224
                return text;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   225
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   226
        };
90ce3da70b43 Initial load
duke
parents:
diff changeset
   227
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   228
90ce3da70b43 Initial load
duke
parents:
diff changeset
   229
90ce3da70b43 Initial load
duke
parents:
diff changeset
   230
    OverviewPanel[] getOverviewPanels() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   231
        if (overviewPanel == null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   232
            overviewPanel = new ClassOverviewPanel();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   233
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   234
        return new OverviewPanel[] { overviewPanel };
90ce3da70b43 Initial load
duke
parents:
diff changeset
   235
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   236
90ce3da70b43 Initial load
duke
parents:
diff changeset
   237
    private static class ClassOverviewPanel extends OverviewPanel {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   238
        ClassOverviewPanel() {
12851
3334e1c781d0 7017818: NLS: JConsoleResources.java cannot be handled by translation team
egahlin
parents: 5506
diff changeset
   239
            super(Messages.CLASSES, loadedPlotterKey, Messages.LOADED, null);
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   240
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   241
90ce3da70b43 Initial load
duke
parents:
diff changeset
   242
        private void updateClassInfo(long total, long loaded) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   243
            long unloaded = (total - loaded);
12851
3334e1c781d0 7017818: NLS: JConsoleResources.java cannot be handled by translation team
egahlin
parents: 5506
diff changeset
   244
            getInfoLabel().setText(Resources.format(Messages.CLASS_TAB_INFO_LABEL_FORMAT,
3334e1c781d0 7017818: NLS: JConsoleResources.java cannot be handled by translation team
egahlin
parents: 5506
diff changeset
   245
                                   loaded, unloaded, total));
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   246
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   247
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   248
}