jdk/src/share/classes/sun/tools/jconsole/VMPanel.java
author xdono
Wed, 02 Jul 2008 12:55:45 -0700
changeset 715 f16baef3a20e
parent 55 5ecee29e98d8
child 5506 202f599c92aa
permissions -rw-r--r--
6719955: Update copyright year Summary: Update copyright year for files that have been modified in 2008 Reviewed-by: ohair, tbell
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     1
/*
715
f16baef3a20e 6719955: Update copyright year
xdono
parents: 55
diff changeset
     2
 * Copyright 2004-2008 Sun Microsystems, Inc.  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
90ce3da70b43 Initial load
duke
parents:
diff changeset
     7
 * published by the Free Software Foundation.  Sun designates this
90ce3da70b43 Initial load
duke
parents:
diff changeset
     8
 * particular file as subject to the "Classpath" exception as provided
90ce3da70b43 Initial load
duke
parents:
diff changeset
     9
 * by Sun in the LICENSE file that accompanied this code.
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
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    21
 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    22
 * CA 95054 USA or visit www.sun.com if you need additional information or
90ce3da70b43 Initial load
duke
parents:
diff changeset
    23
 * have any questions.
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.beans.*;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    31
import java.io.*;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    32
import java.lang.reflect.*;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    33
import java.util.*;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    34
import java.util.List;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    35
import java.util.Timer;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    36
90ce3da70b43 Initial load
duke
parents:
diff changeset
    37
import javax.swing.*;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    38
import javax.swing.plaf.*;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    39
90ce3da70b43 Initial load
duke
parents:
diff changeset
    40
import com.sun.tools.jconsole.JConsolePlugin;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    41
import com.sun.tools.jconsole.JConsoleContext;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    42
import static com.sun.tools.jconsole.JConsoleContext.ConnectionState.*;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    43
90ce3da70b43 Initial load
duke
parents:
diff changeset
    44
import static sun.tools.jconsole.ProxyClient.*;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    45
90ce3da70b43 Initial load
duke
parents:
diff changeset
    46
@SuppressWarnings("serial")
90ce3da70b43 Initial load
duke
parents:
diff changeset
    47
public class VMPanel extends JTabbedPane implements PropertyChangeListener {
55
5ecee29e98d8 6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents: 2
diff changeset
    48
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    49
    private ProxyClient proxyClient;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    50
    private Timer timer;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    51
    private int updateInterval;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    52
    private String hostName;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    53
    private int port;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    54
    private int vmid;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    55
    private String userName;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    56
    private String password;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    57
    private String url;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    58
    private VMInternalFrame vmIF = null;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    59
    private static final String windowsLaF =
55
5ecee29e98d8 6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents: 2
diff changeset
    60
            "com.sun.java.swing.plaf.windows.WindowsLookAndFeel";
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    61
    private static ArrayList<TabInfo> tabInfos = new ArrayList<TabInfo>();
90ce3da70b43 Initial load
duke
parents:
diff changeset
    62
    private boolean wasConnected = false;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    63
90ce3da70b43 Initial load
duke
parents:
diff changeset
    64
    // The everConnected flag keeps track of whether the window can be
90ce3da70b43 Initial load
duke
parents:
diff changeset
    65
    // closed if the user clicks Cancel after a failed connection attempt.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    66
    //
90ce3da70b43 Initial load
duke
parents:
diff changeset
    67
    private boolean everConnected = false;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    68
90ce3da70b43 Initial load
duke
parents:
diff changeset
    69
    // The initialUpdate flag is used to enable/disable tabs each time
90ce3da70b43 Initial load
duke
parents:
diff changeset
    70
    // a connect or reconnect takes place. This flag avoids having to
90ce3da70b43 Initial load
duke
parents:
diff changeset
    71
    // enable/disable tabs on each update call.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    72
    //
90ce3da70b43 Initial load
duke
parents:
diff changeset
    73
    private boolean initialUpdate = true;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    74
90ce3da70b43 Initial load
duke
parents:
diff changeset
    75
    // Each VMPanel has its own instance of the JConsolePlugin
90ce3da70b43 Initial load
duke
parents:
diff changeset
    76
    // A map of JConsolePlugin to the previous SwingWorker
55
5ecee29e98d8 6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents: 2
diff changeset
    77
    private Map<JConsolePlugin, SwingWorker<?, ?>> plugins = null;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    78
    private boolean pluginTabsAdded = false;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    79
90ce3da70b43 Initial load
duke
parents:
diff changeset
    80
    // Update these only on the EDT
90ce3da70b43 Initial load
duke
parents:
diff changeset
    81
    private JOptionPane optionPane;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    82
    private JProgressBar progressBar;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    83
    private long time0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    84
90ce3da70b43 Initial load
duke
parents:
diff changeset
    85
    static {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    86
        tabInfos.add(new TabInfo(OverviewTab.class, OverviewTab.getTabName(), true));
55
5ecee29e98d8 6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents: 2
diff changeset
    87
        tabInfos.add(new TabInfo(MemoryTab.class, MemoryTab.getTabName(), true));
5ecee29e98d8 6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents: 2
diff changeset
    88
        tabInfos.add(new TabInfo(ThreadTab.class, ThreadTab.getTabName(), true));
5ecee29e98d8 6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents: 2
diff changeset
    89
        tabInfos.add(new TabInfo(ClassTab.class, ClassTab.getTabName(), true));
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    90
        tabInfos.add(new TabInfo(SummaryTab.class, SummaryTab.getTabName(), true));
55
5ecee29e98d8 6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents: 2
diff changeset
    91
        tabInfos.add(new TabInfo(MBeansTab.class, MBeansTab.getTabName(), true));
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    92
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    93
90ce3da70b43 Initial load
duke
parents:
diff changeset
    94
    public static TabInfo[] getTabInfos() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    95
        return tabInfos.toArray(new TabInfo[tabInfos.size()]);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    96
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    97
90ce3da70b43 Initial load
duke
parents:
diff changeset
    98
    VMPanel(ProxyClient proxyClient, int updateInterval) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    99
        this.proxyClient = proxyClient;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   100
        this.updateInterval = updateInterval;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   101
        this.hostName = proxyClient.getHostName();
55
5ecee29e98d8 6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents: 2
diff changeset
   102
        this.port = proxyClient.getPort();
5ecee29e98d8 6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents: 2
diff changeset
   103
        this.vmid = proxyClient.getVmid();
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   104
        this.userName = proxyClient.getUserName();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   105
        this.password = proxyClient.getPassword();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   106
        this.url = proxyClient.getUrl();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   107
90ce3da70b43 Initial load
duke
parents:
diff changeset
   108
        for (TabInfo tabInfo : tabInfos) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   109
            if (tabInfo.tabVisible) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   110
                addTab(tabInfo);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   111
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   112
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   113
55
5ecee29e98d8 6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents: 2
diff changeset
   114
        plugins = new LinkedHashMap<JConsolePlugin, SwingWorker<?, ?>>();
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   115
        for (JConsolePlugin p : JConsole.getPlugins()) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   116
            p.setContext(proxyClient);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   117
            plugins.put(p, null);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   118
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   119
90ce3da70b43 Initial load
duke
parents:
diff changeset
   120
        Utilities.updateTransparency(this);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   121
90ce3da70b43 Initial load
duke
parents:
diff changeset
   122
        ToolTipManager.sharedInstance().registerComponent(this);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   123
90ce3da70b43 Initial load
duke
parents:
diff changeset
   124
        // Start listening to connection state events
90ce3da70b43 Initial load
duke
parents:
diff changeset
   125
        //
90ce3da70b43 Initial load
duke
parents:
diff changeset
   126
        proxyClient.addPropertyChangeListener(this);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   127
90ce3da70b43 Initial load
duke
parents:
diff changeset
   128
        addMouseListener(new MouseAdapter() {
55
5ecee29e98d8 6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents: 2
diff changeset
   129
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   130
            public void mouseClicked(MouseEvent e) {
55
5ecee29e98d8 6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents: 2
diff changeset
   131
                if (connectedIconBounds != null && (e.getModifiers() & MouseEvent.BUTTON1_MASK) != 0 && connectedIconBounds.contains(e.getPoint())) {
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   132
90ce3da70b43 Initial load
duke
parents:
diff changeset
   133
                    if (isConnected()) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   134
                        disconnect();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   135
                        wasConnected = false;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   136
                    } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   137
                        connect();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   138
                    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   139
                    repaint();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   140
                }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   141
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   142
        });
90ce3da70b43 Initial load
duke
parents:
diff changeset
   143
90ce3da70b43 Initial load
duke
parents:
diff changeset
   144
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   145
    private static Icon connectedIcon16 =
55
5ecee29e98d8 6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents: 2
diff changeset
   146
            new ImageIcon(VMPanel.class.getResource("resources/connected16.png"));
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   147
    private static Icon connectedIcon24 =
55
5ecee29e98d8 6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents: 2
diff changeset
   148
            new ImageIcon(VMPanel.class.getResource("resources/connected24.png"));
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   149
    private static Icon disconnectedIcon16 =
55
5ecee29e98d8 6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents: 2
diff changeset
   150
            new ImageIcon(VMPanel.class.getResource("resources/disconnected16.png"));
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   151
    private static Icon disconnectedIcon24 =
55
5ecee29e98d8 6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents: 2
diff changeset
   152
            new ImageIcon(VMPanel.class.getResource("resources/disconnected24.png"));
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   153
    private Rectangle connectedIconBounds;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   154
90ce3da70b43 Initial load
duke
parents:
diff changeset
   155
    // Override to increase right inset for tab area,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   156
    // in order to reserve space for the connect toggle.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   157
    public void setUI(TabbedPaneUI ui) {
55
5ecee29e98d8 6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents: 2
diff changeset
   158
        Insets insets = (Insets) UIManager.getLookAndFeelDefaults().get("TabbedPane.tabAreaInsets");
5ecee29e98d8 6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents: 2
diff changeset
   159
        insets = (Insets) insets.clone();
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   160
        insets.right += connectedIcon24.getIconWidth() + 8;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   161
        UIManager.put("TabbedPane.tabAreaInsets", insets);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   162
        super.setUI(ui);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   163
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   164
90ce3da70b43 Initial load
duke
parents:
diff changeset
   165
    // Override to paint the connect toggle
90ce3da70b43 Initial load
duke
parents:
diff changeset
   166
    protected void paintComponent(Graphics g) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   167
        super.paintComponent(g);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   168
90ce3da70b43 Initial load
duke
parents:
diff changeset
   169
        Icon icon;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   170
        Component c0 = getComponent(0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   171
        if (c0 != null && c0.getY() > 24) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   172
            icon = isConnected() ? connectedIcon24 : disconnectedIcon24;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   173
        } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   174
            icon = isConnected() ? connectedIcon16 : disconnectedIcon16;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   175
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   176
        Insets insets = getInsets();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   177
        int x = getWidth() - insets.right - icon.getIconWidth() - 4;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   178
        int y = insets.top;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   179
        if (c0 != null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   180
            y = (c0.getY() - icon.getIconHeight()) / 2;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   181
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   182
        icon.paintIcon(this, g, x, y);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   183
        connectedIconBounds = new Rectangle(x, y, icon.getIconWidth(), icon.getIconHeight());
90ce3da70b43 Initial load
duke
parents:
diff changeset
   184
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   185
90ce3da70b43 Initial load
duke
parents:
diff changeset
   186
    public String getToolTipText(MouseEvent event) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   187
        if (connectedIconBounds.contains(event.getPoint())) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   188
            if (isConnected()) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   189
                return getText("Connected. Click to disconnect.");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   190
            } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   191
                return getText("Disconnected. Click to connect.");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   192
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   193
        } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   194
            return super.getToolTipText(event);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   195
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   196
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   197
90ce3da70b43 Initial load
duke
parents:
diff changeset
   198
    private synchronized void addTab(TabInfo tabInfo) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   199
        Tab tab = instantiate(tabInfo);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   200
        if (tab != null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   201
            addTab(tabInfo.name, tab);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   202
        } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   203
            tabInfo.tabVisible = false;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   204
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   205
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   206
90ce3da70b43 Initial load
duke
parents:
diff changeset
   207
    private synchronized void insertTab(TabInfo tabInfo, int index) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   208
        Tab tab = instantiate(tabInfo);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   209
        if (tab != null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   210
            insertTab(tabInfo.name, null, tab, null, index);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   211
        } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   212
            tabInfo.tabVisible = false;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   213
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   214
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   215
90ce3da70b43 Initial load
duke
parents:
diff changeset
   216
    public synchronized void removeTabAt(int index) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   217
        super.removeTabAt(index);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   218
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   219
90ce3da70b43 Initial load
duke
parents:
diff changeset
   220
    private Tab instantiate(TabInfo tabInfo) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   221
        try {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   222
            Constructor con = tabInfo.tabClass.getConstructor(VMPanel.class);
55
5ecee29e98d8 6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents: 2
diff changeset
   223
            return (Tab) con.newInstance(this);
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   224
        } catch (Exception ex) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   225
            System.err.println(ex);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   226
            return null;
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
    boolean isConnected() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   231
        return proxyClient.isConnected();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   232
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   233
90ce3da70b43 Initial load
duke
parents:
diff changeset
   234
    public int getUpdateInterval() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   235
        return updateInterval;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   236
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   237
90ce3da70b43 Initial load
duke
parents:
diff changeset
   238
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   239
     * WARNING NEVER CALL THIS METHOD TO MAKE JMX REQUEST
90ce3da70b43 Initial load
duke
parents:
diff changeset
   240
     * IF  assertThread == false.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   241
     * DISPATCHER THREAD IS NOT ASSERTED.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   242
     * IT IS USED TO MAKE SOME LOCAL MANIPULATIONS.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   243
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   244
    ProxyClient getProxyClient(boolean assertThread) {
55
5ecee29e98d8 6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents: 2
diff changeset
   245
        if (assertThread) {
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   246
            return getProxyClient();
55
5ecee29e98d8 6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents: 2
diff changeset
   247
        } else {
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   248
            return proxyClient;
55
5ecee29e98d8 6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents: 2
diff changeset
   249
        }
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   250
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   251
90ce3da70b43 Initial load
duke
parents:
diff changeset
   252
    public ProxyClient getProxyClient() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   253
        String threadClass = Thread.currentThread().getClass().getName();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   254
        if (threadClass.equals("java.awt.EventDispatchThread")) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   255
            String msg = "Calling VMPanel.getProxyClient() from the Event Dispatch Thread!";
90ce3da70b43 Initial load
duke
parents:
diff changeset
   256
            new RuntimeException(msg).printStackTrace();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   257
            System.exit(1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   258
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   259
        return proxyClient;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   260
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   261
90ce3da70b43 Initial load
duke
parents:
diff changeset
   262
    public void cleanUp() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   263
        //proxyClient.disconnect();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   264
        for (Tab tab : getTabs()) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   265
            tab.dispose();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   266
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   267
        for (JConsolePlugin p : plugins.keySet()) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   268
            p.dispose();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   269
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   270
        // Cancel pending update tasks
90ce3da70b43 Initial load
duke
parents:
diff changeset
   271
        //
90ce3da70b43 Initial load
duke
parents:
diff changeset
   272
        if (timer != null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   273
            timer.cancel();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   274
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   275
        // Stop listening to connection state events
90ce3da70b43 Initial load
duke
parents:
diff changeset
   276
        //
90ce3da70b43 Initial load
duke
parents:
diff changeset
   277
        proxyClient.removePropertyChangeListener(this);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   278
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   279
90ce3da70b43 Initial load
duke
parents:
diff changeset
   280
    // Call on EDT
90ce3da70b43 Initial load
duke
parents:
diff changeset
   281
    public void connect() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   282
        if (isConnected()) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   283
            // create plugin tabs if not done
90ce3da70b43 Initial load
duke
parents:
diff changeset
   284
            createPluginTabs();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   285
            // Notify tabs
90ce3da70b43 Initial load
duke
parents:
diff changeset
   286
            fireConnectedChange(true);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   287
            // Enable/disable tabs on initial update
90ce3da70b43 Initial load
duke
parents:
diff changeset
   288
            initialUpdate = true;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   289
            // Start/Restart update timer on connect/reconnect
90ce3da70b43 Initial load
duke
parents:
diff changeset
   290
            startUpdateTimer();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   291
        } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   292
            new Thread("VMPanel.connect") {
55
5ecee29e98d8 6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents: 2
diff changeset
   293
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   294
                public void run() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   295
                    proxyClient.connect();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   296
                }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   297
            }.start();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   298
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   299
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   300
90ce3da70b43 Initial load
duke
parents:
diff changeset
   301
    // Call on EDT
90ce3da70b43 Initial load
duke
parents:
diff changeset
   302
    public void disconnect() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   303
        proxyClient.disconnect();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   304
        updateFrameTitle();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   305
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   306
90ce3da70b43 Initial load
duke
parents:
diff changeset
   307
    // Called on EDT
90ce3da70b43 Initial load
duke
parents:
diff changeset
   308
    public void propertyChange(PropertyChangeEvent ev) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   309
        String prop = ev.getPropertyName();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   310
90ce3da70b43 Initial load
duke
parents:
diff changeset
   311
        if (prop == CONNECTION_STATE_PROPERTY) {
55
5ecee29e98d8 6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents: 2
diff changeset
   312
            ConnectionState oldState = (ConnectionState) ev.getOldValue();
5ecee29e98d8 6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents: 2
diff changeset
   313
            ConnectionState newState = (ConnectionState) ev.getNewValue();
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   314
            switch (newState) {
55
5ecee29e98d8 6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents: 2
diff changeset
   315
                case CONNECTING:
5ecee29e98d8 6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents: 2
diff changeset
   316
                    onConnecting();
5ecee29e98d8 6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents: 2
diff changeset
   317
                    break;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   318
55
5ecee29e98d8 6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents: 2
diff changeset
   319
                case CONNECTED:
5ecee29e98d8 6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents: 2
diff changeset
   320
                    if (progressBar != null) {
5ecee29e98d8 6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents: 2
diff changeset
   321
                        progressBar.setIndeterminate(false);
5ecee29e98d8 6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents: 2
diff changeset
   322
                        progressBar.setValue(100);
5ecee29e98d8 6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents: 2
diff changeset
   323
                    }
5ecee29e98d8 6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents: 2
diff changeset
   324
                    closeOptionPane();
5ecee29e98d8 6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents: 2
diff changeset
   325
                    updateFrameTitle();
5ecee29e98d8 6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents: 2
diff changeset
   326
                    // create tabs if not done
5ecee29e98d8 6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents: 2
diff changeset
   327
                    createPluginTabs();
5ecee29e98d8 6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents: 2
diff changeset
   328
                    repaint();
5ecee29e98d8 6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents: 2
diff changeset
   329
                    // Notify tabs
5ecee29e98d8 6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents: 2
diff changeset
   330
                    fireConnectedChange(true);
5ecee29e98d8 6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents: 2
diff changeset
   331
                    // Enable/disable tabs on initial update
5ecee29e98d8 6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents: 2
diff changeset
   332
                    initialUpdate = true;
5ecee29e98d8 6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents: 2
diff changeset
   333
                    // Start/Restart update timer on connect/reconnect
5ecee29e98d8 6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents: 2
diff changeset
   334
                    startUpdateTimer();
5ecee29e98d8 6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents: 2
diff changeset
   335
                    break;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   336
55
5ecee29e98d8 6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents: 2
diff changeset
   337
                case DISCONNECTED:
5ecee29e98d8 6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents: 2
diff changeset
   338
                    if (progressBar != null) {
5ecee29e98d8 6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents: 2
diff changeset
   339
                        progressBar.setIndeterminate(false);
5ecee29e98d8 6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents: 2
diff changeset
   340
                        progressBar.setValue(0);
5ecee29e98d8 6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents: 2
diff changeset
   341
                        closeOptionPane();
5ecee29e98d8 6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents: 2
diff changeset
   342
                    }
5ecee29e98d8 6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents: 2
diff changeset
   343
                    vmPanelDied();
5ecee29e98d8 6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents: 2
diff changeset
   344
                    if (oldState == ConnectionState.CONNECTED) {
5ecee29e98d8 6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents: 2
diff changeset
   345
                        // Notify tabs
5ecee29e98d8 6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents: 2
diff changeset
   346
                        fireConnectedChange(false);
5ecee29e98d8 6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents: 2
diff changeset
   347
                    }
5ecee29e98d8 6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents: 2
diff changeset
   348
                    break;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   349
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   350
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   351
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   352
90ce3da70b43 Initial load
duke
parents:
diff changeset
   353
    // Called on EDT
90ce3da70b43 Initial load
duke
parents:
diff changeset
   354
    private void onConnecting() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   355
        time0 = System.currentTimeMillis();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   356
55
5ecee29e98d8 6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents: 2
diff changeset
   357
        final JConsole jc = (JConsole) SwingUtilities.getWindowAncestor(this);
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   358
90ce3da70b43 Initial load
duke
parents:
diff changeset
   359
        String connectionName = getConnectionName();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   360
        progressBar = new JProgressBar();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   361
        progressBar.setIndeterminate(true);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   362
        JPanel progressPanel = new JPanel(new FlowLayout(FlowLayout.CENTER));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   363
        progressPanel.add(progressBar);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   364
90ce3da70b43 Initial load
duke
parents:
diff changeset
   365
        Object[] message = {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   366
            "<html><h3>" + getText("connectingTo1", connectionName) + "</h3></html>",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   367
            progressPanel,
55
5ecee29e98d8 6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents: 2
diff changeset
   368
            "<html><b>" + getText("connectingTo2", connectionName) + "</b></html>"
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   369
        };
90ce3da70b43 Initial load
duke
parents:
diff changeset
   370
90ce3da70b43 Initial load
duke
parents:
diff changeset
   371
        optionPane =
55
5ecee29e98d8 6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents: 2
diff changeset
   372
                SheetDialog.showOptionDialog(this,
5ecee29e98d8 6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents: 2
diff changeset
   373
                message,
5ecee29e98d8 6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents: 2
diff changeset
   374
                JOptionPane.DEFAULT_OPTION,
5ecee29e98d8 6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents: 2
diff changeset
   375
                JOptionPane.INFORMATION_MESSAGE, null,
5ecee29e98d8 6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents: 2
diff changeset
   376
                new String[]{getText("Cancel")},
5ecee29e98d8 6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents: 2
diff changeset
   377
                0);
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   378
90ce3da70b43 Initial load
duke
parents:
diff changeset
   379
90ce3da70b43 Initial load
duke
parents:
diff changeset
   380
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   381
90ce3da70b43 Initial load
duke
parents:
diff changeset
   382
    // Called on EDT
90ce3da70b43 Initial load
duke
parents:
diff changeset
   383
    private void closeOptionPane() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   384
        if (optionPane != null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   385
            new Thread("VMPanel.sleeper") {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   386
                public void run() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   387
                    long elapsed = System.currentTimeMillis() - time0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   388
                    if (elapsed < 2000) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   389
                        try {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   390
                            sleep(2000 - elapsed);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   391
                        } catch (InterruptedException ex) {
55
5ecee29e98d8 6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents: 2
diff changeset
   392
                        // Ignore
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   393
                        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   394
                    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   395
                    SwingUtilities.invokeLater(new Runnable() {
55
5ecee29e98d8 6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents: 2
diff changeset
   396
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   397
                        public void run() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   398
                            optionPane.setVisible(false);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   399
                            progressBar = null;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   400
                        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   401
                    });
90ce3da70b43 Initial load
duke
parents:
diff changeset
   402
                }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   403
            }.start();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   404
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   405
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   406
90ce3da70b43 Initial load
duke
parents:
diff changeset
   407
    void updateFrameTitle() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   408
        VMInternalFrame vmIF = getFrame();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   409
        if (vmIF != null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   410
            String displayName = getDisplayName();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   411
            if (!proxyClient.isConnected()) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   412
                displayName = getText("ConnectionName (disconnected)", displayName);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   413
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   414
            vmIF.setTitle(displayName);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   415
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   416
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   417
90ce3da70b43 Initial load
duke
parents:
diff changeset
   418
    private VMInternalFrame getFrame() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   419
        if (vmIF == null) {
55
5ecee29e98d8 6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents: 2
diff changeset
   420
            vmIF = (VMInternalFrame) SwingUtilities.getAncestorOfClass(VMInternalFrame.class,
5ecee29e98d8 6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents: 2
diff changeset
   421
                    this);
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   422
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   423
        return vmIF;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   424
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   425
90ce3da70b43 Initial load
duke
parents:
diff changeset
   426
    // TODO: this method is not needed when all JConsole tabs
90ce3da70b43 Initial load
duke
parents:
diff changeset
   427
    // are migrated to use the new JConsolePlugin API.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   428
    //
90ce3da70b43 Initial load
duke
parents:
diff changeset
   429
    // A thread safe clone of all JConsole tabs
90ce3da70b43 Initial load
duke
parents:
diff changeset
   430
    synchronized List<Tab> getTabs() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   431
        ArrayList<Tab> list = new ArrayList<Tab>();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   432
        int n = getTabCount();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   433
        for (int i = 0; i < n; i++) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   434
            Component c = getComponentAt(i);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   435
            if (c instanceof Tab) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   436
                list.add((Tab) c);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   437
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   438
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   439
        return list;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   440
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   441
90ce3da70b43 Initial load
duke
parents:
diff changeset
   442
    private void startUpdateTimer() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   443
        if (timer != null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   444
            timer.cancel();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   445
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   446
        TimerTask timerTask = new TimerTask() {
55
5ecee29e98d8 6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents: 2
diff changeset
   447
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   448
            public void run() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   449
                update();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   450
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   451
        };
55
5ecee29e98d8 6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents: 2
diff changeset
   452
        String timerName = "Timer-" + getConnectionName();
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   453
        timer = new Timer(timerName, true);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   454
        timer.schedule(timerTask, 0, updateInterval);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   455
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   456
90ce3da70b43 Initial load
duke
parents:
diff changeset
   457
    // Call on EDT
90ce3da70b43 Initial load
duke
parents:
diff changeset
   458
    private void vmPanelDied() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   459
        disconnect();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   460
55
5ecee29e98d8 6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents: 2
diff changeset
   461
        final JConsole jc = (JConsole) SwingUtilities.getWindowAncestor(this);
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   462
90ce3da70b43 Initial load
duke
parents:
diff changeset
   463
        JOptionPane optionPane;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   464
55
5ecee29e98d8 6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents: 2
diff changeset
   465
        final String connectStr = getText("Connect");
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   466
        final String reconnectStr = getText("Reconnect");
55
5ecee29e98d8 6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents: 2
diff changeset
   467
        final String cancelStr = getText("Cancel");
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   468
90ce3da70b43 Initial load
duke
parents:
diff changeset
   469
        String msgTitle, msgExplanation, buttonStr;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   470
90ce3da70b43 Initial load
duke
parents:
diff changeset
   471
        if (wasConnected) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   472
            wasConnected = false;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   473
            msgTitle = getText("connectionLost1");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   474
            msgExplanation = getText("connectionLost2", getConnectionName());
90ce3da70b43 Initial load
duke
parents:
diff changeset
   475
            buttonStr = reconnectStr;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   476
        } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   477
            msgTitle = getText("connectionFailed1");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   478
            msgExplanation = getText("connectionFailed2", getConnectionName());
90ce3da70b43 Initial load
duke
parents:
diff changeset
   479
            buttonStr = connectStr;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   480
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   481
90ce3da70b43 Initial load
duke
parents:
diff changeset
   482
        optionPane =
55
5ecee29e98d8 6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents: 2
diff changeset
   483
                SheetDialog.showOptionDialog(this,
5ecee29e98d8 6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents: 2
diff changeset
   484
                "<html><h3>" + msgTitle + "</h3>" +
5ecee29e98d8 6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents: 2
diff changeset
   485
                "<b>" + msgExplanation + "</b>",
5ecee29e98d8 6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents: 2
diff changeset
   486
                JOptionPane.DEFAULT_OPTION,
5ecee29e98d8 6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents: 2
diff changeset
   487
                JOptionPane.WARNING_MESSAGE, null,
5ecee29e98d8 6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents: 2
diff changeset
   488
                new String[]{buttonStr, cancelStr},
5ecee29e98d8 6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents: 2
diff changeset
   489
                0);
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   490
90ce3da70b43 Initial load
duke
parents:
diff changeset
   491
        optionPane.addPropertyChangeListener(new PropertyChangeListener() {
55
5ecee29e98d8 6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents: 2
diff changeset
   492
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   493
            public void propertyChange(PropertyChangeEvent event) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   494
                if (event.getPropertyName().equals(JOptionPane.VALUE_PROPERTY)) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   495
                    Object value = event.getNewValue();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   496
90ce3da70b43 Initial load
duke
parents:
diff changeset
   497
                    if (value == reconnectStr || value == connectStr) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   498
                        connect();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   499
                    } else if (!everConnected) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   500
                        try {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   501
                            getFrame().setClosed(true);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   502
                        } catch (PropertyVetoException ex) {
55
5ecee29e98d8 6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents: 2
diff changeset
   503
                        // Should not happen, but can be ignored.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   504
                        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   505
                    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   506
                }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   507
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   508
        });
90ce3da70b43 Initial load
duke
parents:
diff changeset
   509
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   510
90ce3da70b43 Initial load
duke
parents:
diff changeset
   511
    // Note: This method is called on a TimerTask thread. Any GUI manipulation
90ce3da70b43 Initial load
duke
parents:
diff changeset
   512
    // must be performed with invokeLater() or invokeAndWait().
90ce3da70b43 Initial load
duke
parents:
diff changeset
   513
    private Object lockObject = new Object();
55
5ecee29e98d8 6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents: 2
diff changeset
   514
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   515
    private void update() {
55
5ecee29e98d8 6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents: 2
diff changeset
   516
        synchronized (lockObject) {
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   517
            if (!isConnected()) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   518
                if (wasConnected) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   519
                    EventQueue.invokeLater(new Runnable() {
55
5ecee29e98d8 6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents: 2
diff changeset
   520
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   521
                        public void run() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   522
                            vmPanelDied();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   523
                        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   524
                    });
90ce3da70b43 Initial load
duke
parents:
diff changeset
   525
                }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   526
                wasConnected = false;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   527
                return;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   528
            } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   529
                wasConnected = true;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   530
                everConnected = true;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   531
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   532
            proxyClient.flush();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   533
            List<Tab> tabs = getTabs();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   534
            final int n = tabs.size();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   535
            for (int i = 0; i < n; i++) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   536
                final int index = i;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   537
                try {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   538
                    if (!proxyClient.isDead()) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   539
                        // Update tab
90ce3da70b43 Initial load
duke
parents:
diff changeset
   540
                        //
90ce3da70b43 Initial load
duke
parents:
diff changeset
   541
                        tabs.get(index).update();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   542
                        // Enable tab on initial update
90ce3da70b43 Initial load
duke
parents:
diff changeset
   543
                        //
90ce3da70b43 Initial load
duke
parents:
diff changeset
   544
                        if (initialUpdate) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   545
                            EventQueue.invokeLater(new Runnable() {
55
5ecee29e98d8 6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents: 2
diff changeset
   546
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   547
                                public void run() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   548
                                    setEnabledAt(index, true);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   549
                                }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   550
                            });
90ce3da70b43 Initial load
duke
parents:
diff changeset
   551
                        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   552
                    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   553
                } catch (Exception e) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   554
                    // Disable tab on initial update
90ce3da70b43 Initial load
duke
parents:
diff changeset
   555
                    //
90ce3da70b43 Initial load
duke
parents:
diff changeset
   556
                    if (initialUpdate) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   557
                        EventQueue.invokeLater(new Runnable() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   558
                            public void run() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   559
                                setEnabledAt(index, false);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   560
                            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   561
                        });
90ce3da70b43 Initial load
duke
parents:
diff changeset
   562
                    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   563
                }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   564
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   565
90ce3da70b43 Initial load
duke
parents:
diff changeset
   566
            // plugin GUI update
90ce3da70b43 Initial load
duke
parents:
diff changeset
   567
            for (JConsolePlugin p : plugins.keySet()) {
55
5ecee29e98d8 6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents: 2
diff changeset
   568
                SwingWorker<?, ?> sw = p.newSwingWorker();
5ecee29e98d8 6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents: 2
diff changeset
   569
                SwingWorker<?, ?> prevSW = plugins.get(p);
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   570
                // schedule SwingWorker to run only if the previous
90ce3da70b43 Initial load
duke
parents:
diff changeset
   571
                // SwingWorker has finished its task and it hasn't started.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   572
                if (prevSW == null || prevSW.isDone()) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   573
                    if (sw == null || sw.getState() == SwingWorker.StateValue.PENDING) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   574
                        plugins.put(p, sw);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   575
                        if (sw != null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   576
                            sw.execute();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   577
                        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   578
                    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   579
                }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   580
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   581
55
5ecee29e98d8 6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents: 2
diff changeset
   582
            // Set the first enabled tab in the tab's list
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   583
            // as the selected tab on initial update
90ce3da70b43 Initial load
duke
parents:
diff changeset
   584
            //
90ce3da70b43 Initial load
duke
parents:
diff changeset
   585
            if (initialUpdate) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   586
                EventQueue.invokeLater(new Runnable() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   587
                    public void run() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   588
                        // Select first enabled tab if current tab isn't.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   589
                        int index = getSelectedIndex();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   590
                        if (index < 0 || !isEnabledAt(index)) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   591
                            for (int i = 0; i < n; i++) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   592
                                if (isEnabledAt(i)) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   593
                                    setSelectedIndex(i);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   594
                                    break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   595
                                }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   596
                            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   597
                        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   598
                    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   599
                });
90ce3da70b43 Initial load
duke
parents:
diff changeset
   600
                initialUpdate = false;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   601
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   602
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   603
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   604
90ce3da70b43 Initial load
duke
parents:
diff changeset
   605
    public String getHostName() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   606
        return hostName;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   607
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   608
90ce3da70b43 Initial load
duke
parents:
diff changeset
   609
    public int getPort() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   610
        return port;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   611
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   612
90ce3da70b43 Initial load
duke
parents:
diff changeset
   613
    public String getUserName() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   614
        return userName;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   615
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   616
90ce3da70b43 Initial load
duke
parents:
diff changeset
   617
    public String getUrl() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   618
        return url;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   619
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   620
90ce3da70b43 Initial load
duke
parents:
diff changeset
   621
    public String getPassword() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   622
        return password;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   623
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   624
90ce3da70b43 Initial load
duke
parents:
diff changeset
   625
    public String getConnectionName() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   626
        return proxyClient.connectionName();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   627
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   628
90ce3da70b43 Initial load
duke
parents:
diff changeset
   629
    public String getDisplayName() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   630
        return proxyClient.getDisplayName();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   631
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   632
90ce3da70b43 Initial load
duke
parents:
diff changeset
   633
    static class TabInfo {
55
5ecee29e98d8 6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents: 2
diff changeset
   634
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   635
        Class<? extends Tab> tabClass;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   636
        String name;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   637
        boolean tabVisible;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   638
90ce3da70b43 Initial load
duke
parents:
diff changeset
   639
        TabInfo(Class<? extends Tab> tabClass, String name, boolean tabVisible) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   640
            this.tabClass = tabClass;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   641
            this.name = name;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   642
            this.tabVisible = tabVisible;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   643
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   644
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   645
90ce3da70b43 Initial load
duke
parents:
diff changeset
   646
    // Convenience methods
90ce3da70b43 Initial load
duke
parents:
diff changeset
   647
    private static String getText(String key, Object... args) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   648
        return Resources.getText(key, args);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   649
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   650
90ce3da70b43 Initial load
duke
parents:
diff changeset
   651
    private void createPluginTabs() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   652
        // add plugin tabs if not done
90ce3da70b43 Initial load
duke
parents:
diff changeset
   653
        if (!pluginTabsAdded) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   654
            for (JConsolePlugin p : plugins.keySet()) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   655
                Map<String, JPanel> tabs = p.getTabs();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   656
                for (Map.Entry<String, JPanel> e : tabs.entrySet()) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   657
                    addTab(e.getKey(), e.getValue());
90ce3da70b43 Initial load
duke
parents:
diff changeset
   658
                }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   659
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   660
            pluginTabsAdded = true;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   661
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   662
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   663
90ce3da70b43 Initial load
duke
parents:
diff changeset
   664
    private void fireConnectedChange(boolean connected) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   665
        for (Tab tab : getTabs()) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   666
            tab.firePropertyChange(JConsoleContext.CONNECTION_STATE_PROPERTY, !connected, connected);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   667
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   668
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   669
}