< prev index next >

src/share/classes/sun/tools/jconsole/inspector/XSheet.java

Print this page
rev 1501 : 7017818: NLS: JConsoleResources.java cannot be handled by translation team
Reviewed-by: mchung, mfang

@@ -34,11 +34,10 @@
 import javax.swing.border.*;
 import javax.swing.tree.*;
 import sun.tools.jconsole.*;
 import sun.tools.jconsole.inspector.XNodeInfo.Type;
 
-import static sun.tools.jconsole.Resources.*;
 import static sun.tools.jconsole.Utilities.*;
 
 @SuppressWarnings("serial")
 public class XSheet extends JPanel
         implements ActionListener, NotificationListener {

@@ -92,32 +91,28 @@
         add(mainPanel, BorderLayout.CENTER);
         // add south panel to XSheet
         southPanel = new JPanel();
         add(southPanel, BorderLayout.SOUTH);
         // create the refresh button
-        String refreshButtonKey = "MBeansTab.refreshAttributesButton";
-        refreshButton = new JButton(getText(refreshButtonKey));
-        refreshButton.setMnemonic(getMnemonicInt(refreshButtonKey));
-        refreshButton.setToolTipText(getText(refreshButtonKey + ".toolTip"));
+        refreshButton = new JButton(Messages.MBEANS_TAB_REFRESH_ATTRIBUTES_BUTTON);
+        refreshButton.setMnemonic(Resources.getMnemonicInt(Messages.MBEANS_TAB_REFRESH_ATTRIBUTES_BUTTON));
+        refreshButton.setToolTipText(Messages.MBEANS_TAB_REFRESH_ATTRIBUTES_BUTTON_TOOLTIP);
         refreshButton.addActionListener(this);
         // create the clear button
-        String clearButtonKey = "MBeansTab.clearNotificationsButton";
-        clearButton = new JButton(getText(clearButtonKey));
-        clearButton.setMnemonic(getMnemonicInt(clearButtonKey));
-        clearButton.setToolTipText(getText(clearButtonKey + ".toolTip"));
+        clearButton = new JButton(Messages.MBEANS_TAB_CLEAR_NOTIFICATIONS_BUTTON);
+        clearButton.setMnemonic(Resources.getMnemonicInt(Messages.MBEANS_TAB_CLEAR_NOTIFICATIONS_BUTTON));
+        clearButton.setToolTipText(Messages.MBEANS_TAB_CLEAR_NOTIFICATIONS_BUTTON_TOOLTIP);
         clearButton.addActionListener(this);
         // create the subscribe button
-        String subscribeButtonKey = "MBeansTab.subscribeNotificationsButton";
-        subscribeButton = new JButton(getText(subscribeButtonKey));
-        subscribeButton.setMnemonic(getMnemonicInt(subscribeButtonKey));
-        subscribeButton.setToolTipText(getText(subscribeButtonKey + ".toolTip"));
+        subscribeButton = new JButton(Messages.MBEANS_TAB_SUBSCRIBE_NOTIFICATIONS_BUTTON);
+        subscribeButton.setMnemonic(Resources.getMnemonicInt(Messages.MBEANS_TAB_SUBSCRIBE_NOTIFICATIONS_BUTTON));
+        subscribeButton.setToolTipText(Messages.MBEANS_TAB_SUBSCRIBE_NOTIFICATIONS_BUTTON_TOOLTIP);
         subscribeButton.addActionListener(this);
         // create the unsubscribe button
-        String unsubscribeButtonKey = "MBeansTab.unsubscribeNotificationsButton";
-        unsubscribeButton = new JButton(getText(unsubscribeButtonKey));
-        unsubscribeButton.setMnemonic(getMnemonicInt(unsubscribeButtonKey));
-        unsubscribeButton.setToolTipText(getText(unsubscribeButtonKey + ".toolTip"));
+        unsubscribeButton = new JButton(Messages.MBEANS_TAB_UNSUBSCRIBE_NOTIFICATIONS_BUTTON);
+        unsubscribeButton.setMnemonic(Resources.getMnemonicInt(Messages.MBEANS_TAB_UNSUBSCRIBE_NOTIFICATIONS_BUTTON));
+        unsubscribeButton.setToolTipText(Messages.MBEANS_TAB_UNSUBSCRIBE_NOTIFICATIONS_BUTTON_TOOLTIP);
         unsubscribeButton.addActionListener(this);
         // create XMBeanAttributes container
         mbeanAttributes = new XMBeanAttributes(mbeansTab);
         // create XMBeanOperations container
         mbeanOperations = new XMBeanOperations(mbeansTab);

@@ -186,11 +181,11 @@
                     mbeanInfo.addMBeanInfo(mbean, mbean.getMBeanInfo());
                 } catch (Throwable ex) {
                     EventQueue.invokeLater(new ThreadDialog(
                             XSheet.this,
                             ex.getMessage(),
-                            Resources.getText("Problem displaying MBean"),
+                            Messages.PROBLEM_DISPLAYING_MBEAN,
                             JOptionPane.ERROR_MESSAGE));
                     return;
                 }
                 EventQueue.invokeLater(new Runnable() {
                     public void run() {

@@ -226,11 +221,11 @@
                                     null, null, null));
                         } catch (Exception e) {
                             EventQueue.invokeLater(new ThreadDialog(
                                     XSheet.this,
                                     e.getMessage(),
-                                    Resources.getText("Problem displaying MBean"),
+                                    Messages.PROBLEM_DISPLAYING_MBEAN,
                                     JOptionPane.ERROR_MESSAGE));
                             return;
                         }
                         EventQueue.invokeLater(new Runnable() {
                             public void run() {

@@ -240,11 +235,11 @@
                                         new JPanel(new BorderLayout());
                                 JPanel attributeBorderPanel =
                                         new JPanel(new BorderLayout());
                                 attributeBorderPanel.setBorder(
                                         BorderFactory.createTitledBorder(
-                                        Resources.getText("Attribute value")));
+                                            Messages.ATTRIBUTE_VALUE));
                                 JPanel attributeValuePanel =
                                         new JPanel(new BorderLayout());
                                 attributeValuePanel.setBorder(
                                         LineBorder.createGrayLineBorder());
                                 attributeValuePanel.add(mba.getTableHeader(),

@@ -284,20 +279,20 @@
                             null, new MBeanOperationInfo[] {mboi}, null));
                 } catch (Exception e) {
                     EventQueue.invokeLater(new ThreadDialog(
                             XSheet.this,
                             e.getMessage(),
-                            Resources.getText("Problem displaying MBean"),
+                            Messages.PROBLEM_DISPLAYING_MBEAN,
                             JOptionPane.ERROR_MESSAGE));
                     return;
                 }
                 invalidate();
                 mainPanel.removeAll();
                 JPanel operationPanel = new JPanel(new BorderLayout());
                 JPanel operationBorderPanel = new JPanel(new BorderLayout());
                 operationBorderPanel.setBorder(BorderFactory.createTitledBorder(
-                        Resources.getText("Operation invocation")));
+                        Messages.OPERATION_INVOCATION));
                 operationBorderPanel.add(new JScrollPane(mbo));
                 operationPanel.add(operationBorderPanel, BorderLayout.NORTH);
                 mbi.addMBeanOperationInfo(mboi);
                 operationPanel.add(mbi, BorderLayout.CENTER);
                 mainPanel.add(operationPanel, BorderLayout.CENTER);

@@ -334,21 +329,21 @@
                     mba.loadAttributes(mbean, mbean.getMBeanInfo());
                 } catch (Throwable ex) {
                     EventQueue.invokeLater(new ThreadDialog(
                             XSheet.this,
                             ex.getMessage(),
-                            Resources.getText("Problem displaying MBean"),
+                            Messages.PROBLEM_DISPLAYING_MBEAN,
                             JOptionPane.ERROR_MESSAGE));
                     return;
                 }
                 EventQueue.invokeLater(new Runnable() {
                     public void run() {
                         invalidate();
                         mainPanel.removeAll();
                         JPanel borderPanel = new JPanel(new BorderLayout());
                         borderPanel.setBorder(BorderFactory.createTitledBorder(
-                                Resources.getText("Attribute values")));
+                                Messages.ATTRIBUTE_VALUES));
                         borderPanel.add(new JScrollPane(mba));
                         mainPanel.add(borderPanel, BorderLayout.CENTER);
                         // add the refresh button to the south panel
                         southPanel.removeAll();
                         southPanel.add(refreshButton, BorderLayout.SOUTH);

@@ -376,21 +371,21 @@
                     mbo.loadOperations(mbean, mbean.getMBeanInfo());
                 } catch (Throwable ex) {
                     EventQueue.invokeLater(new ThreadDialog(
                             XSheet.this,
                             ex.getMessage(),
-                            Resources.getText("Problem displaying MBean"),
+                            Messages.PROBLEM_DISPLAYING_MBEAN,
                             JOptionPane.ERROR_MESSAGE));
                     return;
                 }
                 EventQueue.invokeLater(new Runnable() {
                     public void run() {
                         invalidate();
                         mainPanel.removeAll();
                         JPanel borderPanel = new JPanel(new BorderLayout());
                         borderPanel.setBorder(BorderFactory.createTitledBorder(
-                                Resources.getText("Operation invocation")));
+                                Messages.OPERATION_INVOCATION));
                         borderPanel.add(new JScrollPane(mbo));
                         mainPanel.add(borderPanel, BorderLayout.CENTER);
                         southPanel.setVisible(false);
                         southPanel.removeAll();
                         validate();

@@ -417,21 +412,21 @@
                     updateNotifications();
                 } catch (Throwable ex) {
                     EventQueue.invokeLater(new ThreadDialog(
                             XSheet.this,
                             ex.getMessage(),
-                            Resources.getText("Problem displaying MBean"),
+                            Messages.PROBLEM_DISPLAYING_MBEAN,
                             JOptionPane.ERROR_MESSAGE));
                     return;
                 }
                 EventQueue.invokeLater(new Runnable() {
                     public void run() {
                         invalidate();
                         mainPanel.removeAll();
                         JPanel borderPanel = new JPanel(new BorderLayout());
                         borderPanel.setBorder(BorderFactory.createTitledBorder(
-                                Resources.getText("Notification buffer")));
+                                               Messages.NOTIFICATION_BUFFER));
                         borderPanel.add(new JScrollPane(mbn));
                         mainPanel.add(borderPanel, BorderLayout.CENTER);
                         // add the subscribe/unsubscribe/clear buttons to
                         // the south panel
                         southPanel.removeAll();

@@ -503,11 +498,11 @@
     /**
      * Update notification node label in MBean tree: "Notifications[received]".
      */
     private void updateReceivedNotifications(
             DefaultMutableTreeNode emitter, long received, boolean bold) {
-        String text = Resources.getText("Notifications") + "[" + received + "]";
+        String text = Messages.NOTIFICATIONS + "[" + received + "]";
         DefaultMutableTreeNode selectedNode = (DefaultMutableTreeNode)
         mbeansTab.getTree().getLastSelectedPathComponent();
         if (bold && emitter != selectedNode) {
             text = "<html><b>" + text + "</b></html>";
         }

@@ -517,19 +512,19 @@
     /**
      * Update notification node label in MBean tree: "Notifications".
      */
     private void clearNotifications() {
         updateNotificationsNodeLabel(node,
-                Resources.getText("Notifications"));
+                Messages.NOTIFICATIONS);
     }
 
     /**
      * Update notification node label in MBean tree: "Notifications[0]".
      */
     private void clearNotifications0() {
         updateNotificationsNodeLabel(node,
-                Resources.getText("Notifications") + "[0]");
+                Messages.NOTIFICATIONS + "[0]");
     }
 
     /**
      * Update the label of the supplied MBean tree node.
      */

@@ -629,11 +624,11 @@
                 }
             }
             EventQueue.invokeLater(new ThreadDialog(
                     (Component) e.getSource(),
                     message,
-                    Resources.getText("Operation return value"),
+                    Messages.OPERATION_RETURN_VALUE,
                     JOptionPane.INFORMATION_MESSAGE));
         }
         // Got notification
         else if (e.getType().equals(
                 XMBeanNotifications.NOTIFICATION_RECEIVED_EVENT)) {

@@ -672,11 +667,11 @@
                         } catch (Throwable ex) {
                             ex = Utils.getActualException(ex);
                             EventQueue.invokeLater(new ThreadDialog(
                                     XSheet.this,
                                     ex.getMessage(),
-                                    Resources.getText("Problem adding listener"),
+                                    Messages.PROBLEM_ADDING_LISTENER,
                                     JOptionPane.ERROR_MESSAGE));
                         }
                     }
                 });
                 return;

@@ -690,11 +685,11 @@
                         } catch (Throwable ex) {
                             ex = Utils.getActualException(ex);
                             EventQueue.invokeLater(new ThreadDialog(
                                     XSheet.this,
                                     ex.getMessage(),
-                                    Resources.getText("Problem removing listener"),
+                                    Messages.PROBLEM_REMOVING_LISTENER,
                                     JOptionPane.ERROR_MESSAGE));
                         }
                     }
                 });
                 return;
< prev index next >