/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
@SuppressWarnings("serial")
private int updateInterval;
private int port;
private boolean wasConnected = false;
private boolean shouldUseSSL = true;
private boolean userDisconnected = false;
// The everConnected flag keeps track of whether the window can be
// closed if the user clicks Cancel after a failed connection attempt.
//
private boolean everConnected = false;
// a connect or reconnect takes place. This flag avoids having to
//
private boolean initialUpdate = true;
// Each VMPanel has its own instance of the JConsolePlugin
// A map of JConsolePlugin to the previous SwingWorker
private boolean pluginTabsAdded = false;
// Update these only on the EDT
private long time0;
static {
}
}
this.proxyClient = proxyClient;
this.updateInterval = updateInterval;
if (tabInfo.tabVisible) {
}
}
}
Utilities.updateTransparency(this);
// Start listening to connection state events
//
addMouseListener(new MouseAdapter() {
public void mouseClicked(MouseEvent e) {
if (connectedIconBounds != null && (e.getModifiers() & MouseEvent.BUTTON1_MASK) != 0 && connectedIconBounds.contains(e.getPoint())) {
if (isConnected()) {
userDisconnected = true;
disconnect();
wasConnected = false;
} else {
connect();
}
repaint();
}
}
});
}
// Override to increase right inset for tab area,
// in order to reserve space for the connect toggle.
}
// Override to paint the connect toggle
super.paintComponent(g);
} else {
}
}
}
if (isConnected()) {
} else {
}
} else {
return super.getToolTipText(event);
}
}
} else {
tabInfo.tabVisible = false;
}
}
} else {
tabInfo.tabVisible = false;
}
}
super.removeTabAt(index);
}
try {
return null;
}
}
boolean isConnected() {
return proxyClient.isConnected();
}
public int getUpdateInterval() {
return updateInterval;
}
/**
* WARNING NEVER CALL THIS METHOD TO MAKE JMX REQUEST
* IF assertThread == false.
* DISPATCHER THREAD IS NOT ASSERTED.
* IT IS USED TO MAKE SOME LOCAL MANIPULATIONS.
*/
if (assertThread) {
return getProxyClient();
} else {
return proxyClient;
}
}
}
return proxyClient;
}
public void cleanUp() {
//proxyClient.disconnect();
}
p.dispose();
}
// Cancel pending update tasks
//
}
// Stop listening to connection state events
//
}
// Call on EDT
public void connect() {
if (isConnected()) {
// create plugin tabs if not done
// Notify tabs
fireConnectedChange(true);
initialUpdate = true;
} else {
new Thread("VMPanel.connect") {
public void run() {
}
}.start();
}
}
// Call on EDT
public void disconnect() {
}
// Called on EDT
if (prop == CONNECTION_STATE_PROPERTY) {
switch (newState) {
case CONNECTING:
onConnecting();
break;
case CONNECTED:
if (progressBar != null) {
progressBar.setIndeterminate(false);
}
// create tabs if not done
repaint();
// Notify tabs
fireConnectedChange(true);
initialUpdate = true;
break;
case DISCONNECTED:
if (progressBar != null) {
progressBar.setIndeterminate(false);
}
vmPanelDied();
// Notify tabs
fireConnectedChange(false);
}
break;
}
}
}
// Called on EDT
private void onConnecting() {
SwingUtilities.getWindowAncestor(this);
progressBar = new JProgressBar();
progressBar.setIndeterminate(true);
};
SheetDialog.showOptionDialog(this,
0);
}
// Called on EDT
private void closeOptionPane() {
if (optionPane != null) {
new Thread("VMPanel.sleeper") {
public void run() {
if (elapsed < 2000) {
try {
} catch (InterruptedException ex) {
// Ignore
}
}
public void run() {
optionPane.setVisible(false);
progressBar = null;
}
});
}
}.start();
}
}
void updateFrameTitle() {
if (!proxyClient.isConnected()) {
}
}
}
this);
}
return vmIF;
}
// TODO: this method is not needed when all JConsole tabs
// are migrated to use the new JConsolePlugin API.
//
// A thread safe clone of all JConsole tabs
int n = getTabCount();
for (int i = 0; i < n; i++) {
Component c = getComponentAt(i);
if (c instanceof Tab) {
}
}
return list;
}
private void startUpdateTimer() {
}
public void run() {
update();
}
};
}
// Call on EDT
private void vmPanelDied() {
disconnect();
if (userDisconnected) {
userDisconnected = false;
return;
}
if (wasConnected) {
wasConnected = false;
} else if (shouldUseSSL) {
} else {
}
SheetDialog.showOptionDialog(this,
0);
connect();
shouldUseSSL = false;
connect();
} else if (!everConnected) {
try {
} catch (PropertyVetoException ex) {
// Should not happen, but can be ignored.
}
}
}
}
});
}
// Note: This method is called on a TimerTask thread. Any GUI manipulation
// must be performed with invokeLater() or invokeAndWait().
private void update() {
synchronized (lockObject) {
if (!isConnected()) {
if (wasConnected) {
public void run() {
vmPanelDied();
}
});
}
wasConnected = false;
return;
} else {
wasConnected = true;
everConnected = true;
}
proxyClient.flush();
for (int i = 0; i < n; i++) {
final int index = i;
try {
if (!proxyClient.isDead()) {
// Update tab
//
// Enable tab on initial update
//
if (initialUpdate) {
public void run() {
setEnabledAt(index, true);
}
});
}
}
} catch (Exception e) {
// Disable tab on initial update
//
if (initialUpdate) {
public void run() {
setEnabledAt(index, false);
}
});
}
}
}
// plugin GUI update
// schedule SwingWorker to run only if the previous
// SwingWorker has finished its task and it hasn't started.
}
}
}
}
// Set the first enabled tab in the tab's list
// as the selected tab on initial update
//
if (initialUpdate) {
public void run() {
// Select first enabled tab if current tab isn't.
int index = getSelectedIndex();
for (int i = 0; i < n; i++) {
if (isEnabledAt(i)) {
setSelectedIndex(i);
break;
}
}
}
}
});
initialUpdate = false;
}
}
}
return hostName;
}
public int getPort() {
return port;
}
return userName;
}
return url;
}
return password;
}
return proxyClient.connectionName();
}
return proxyClient.getDisplayName();
}
static class TabInfo {
boolean tabVisible;
this.tabVisible = tabVisible;
}
}
private void createPluginTabs() {
// add plugin tabs if not done
if (!pluginTabsAdded) {
}
}
pluginTabsAdded = true;
}
}
}
}
}