private MButton createHeapDumpButton() {
   final MButton heapDumpButton = new MButton(getString("heap_dump"), HEAP_DUMP_ICON);
   heapDumpButton.addActionListener(
       new ActionListener() {
         @Override
         public void actionPerformed(ActionEvent e) {
           if (confirm(getString("confirm_heap_dump"))) {
             executeAction(Action.HEAP_DUMP);
           }
         }
       });
   return heapDumpButton;
 }
 private MButton createGcButton() {
   final MButton gcButton = new MButton(getString("ramasse_miette"), GC_ICON);
   gcButton.addActionListener(
       new ActionListener() {
         @Override
         public void actionPerformed(ActionEvent e) {
           if (confirm(getString("confirm_ramasse_miette"))) {
             executeAction(Action.GC);
           }
         }
       });
   return gcButton;
 }
 private MButton createInvalidateSessionsButton() {
   final MButton invalidateSessionsButton =
       new MButton(getString("invalidate_sessions"), INVALIDATE_SESSION_ICON);
   invalidateSessionsButton.addActionListener(
       new ActionListener() {
         @Override
         public void actionPerformed(ActionEvent e) {
           if (confirm(getString("confirm_invalidate_sessions"))) {
             executeAction(Action.INVALIDATE_SESSIONS);
           }
         }
       });
   return invalidateSessionsButton;
 }
 private MButton createDatabaseButton() {
   final MButton databaseButton = new MButton(getString("database"), DATABASE_ICON);
   databaseButton.addActionListener(
       new ActionListener() {
         @Override
         public void actionPerformed(ActionEvent e) {
           try {
             addOnglet(new DatabaseInformationsPanel(getRemoteCollector()));
           } catch (final IOException ex) {
             showException(ex);
           }
         }
       });
   return databaseButton;
 }
 private MButton createJndiButton() {
   final MButton jndiButton = new MButton(getString("Arbre_JNDI"), JNDI_ICON);
   jndiButton.addActionListener(
       new ActionListener() {
         @Override
         public void actionPerformed(ActionEvent e) {
           try {
             addOnglet(new JndiBindingsPanel(getRemoteCollector()));
           } catch (final IOException ex) {
             showException(ex);
           }
         }
       });
   return jndiButton;
 }
 private MButton createProcessesButton() {
   final MButton processesButton = new MButton(getString("processes"), PROCESSES_ICON);
   processesButton.addActionListener(
       new ActionListener() {
         @Override
         public void actionPerformed(ActionEvent e) {
           try {
             addOnglet(new ProcessInformationsPanel(getRemoteCollector()));
           } catch (final IOException ex) {
             showException(ex);
           }
         }
       });
   return processesButton;
 }
 private MButton createMBeansButton() {
   final MButton mbeansButton = new MButton(getString("MBeans"), MBEANS_ICON);
   mbeansButton.addActionListener(
       new ActionListener() {
         @Override
         public void actionPerformed(ActionEvent e) {
           try {
             addOnglet(new MBeansPanel(getRemoteCollector()));
           } catch (final IOException ex) {
             showException(ex);
           }
         }
       });
   return mbeansButton;
 }
 private MButton createHotspotsButton() {
   final MButton hotspotsButton = new MButton(getString("hotspots"), HOTSPOTS_ICON);
   hotspotsButton.addActionListener(
       new ActionListener() {
         @Override
         public void actionPerformed(ActionEvent e) {
           try {
             addOnglet(new HotspotsPanel(getRemoteCollector()));
           } catch (final IOException ex) {
             showException(ex);
           }
         }
       });
   return hotspotsButton;
 }
 private MButton createHeapHistoButton() {
   final MButton heapHistoButton = new MButton(getString("heaphisto"), HEAP_HISTO_ICON);
   heapHistoButton.addActionListener(
       new ActionListener() {
         @Override
         public void actionPerformed(ActionEvent e) {
           try {
             addOnglet(new HeapInformationsPanel(getRemoteCollector()));
           } catch (final IOException ex) {
             showException(ex);
           }
         }
       });
   return heapHistoButton;
 }
 private MButton createConnectionsButton() {
   final MButton connectionsButton =
       new MButton(getString("Connexions_jdbc_ouvertes"), DATABASE_ICON);
   connectionsButton.addActionListener(
       new ActionListener() {
         @Override
         public void actionPerformed(ActionEvent e) {
           try {
             addOnglet(new ConnectionInformationsPanel(getRemoteCollector()));
           } catch (final IOException ex) {
             showException(ex);
           }
         }
       });
   return connectionsButton;
 }
 private MButton createWebXmlButton() {
   final MButton webXmlButton = new MButton(getString("web.xml"), XML_ICON);
   webXmlButton.addActionListener(
       new ActionListener() {
         @Override
         public void actionPerformed(ActionEvent e) {
           try {
             Desktop.getDesktop()
                 .browse(new URI(getMonitoringUrl().toExternalForm() + "?part=web.xml"));
           } catch (final Exception ex) {
             showException(ex);
           }
         }
       });
   return webXmlButton;
 }
 private MButton createCurrentRequestsButton() {
   final MButton currentRequestsButton =
       new MButton(getString("Requetes_en_cours"), CURRENT_REQUESTS_ICON);
   currentRequestsButton.addActionListener(
       new ActionListener() {
         @Override
         public void actionPerformed(ActionEvent e) {
           try {
             final CurrentRequestsForCollectorServerPanel panel =
                 new CurrentRequestsForCollectorServerPanel(getRemoteCollector());
             addOnglet(panel);
           } catch (final IOException e1) {
             showException(e1);
           }
         }
       });
   return currentRequestsButton;
 }
Exemplo n.º 13
0
  private MButton createOnlineHelpButton() {
    final MButton onlineHelpButton =
        new MButton(getString("Aide_en_ligne"), ImageIconCache.getImageIcon("action_help.png"));
    onlineHelpButton.setToolTipText(getString("Afficher_aide_en_ligne") + " (F1)");
    onlineHelpButton.setActionCommand("help");
    onlineHelpButton
        .getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW)
        .put(KeyStroke.getKeyStroke("F1"), "doHelp");
    onlineHelpButton
        .getActionMap()
        .put(
            "doHelp",
            new AbstractAction() {
              private static final long serialVersionUID = 1L;

              @Override
              public void actionPerformed(ActionEvent e) {
                onlineHelpButton.doClick();
              }
            });
    return onlineHelpButton;
  }
Exemplo n.º 14
0
  private void addPeriodButtons(JPanel centerPanel, final CustomPeriodPanel customPeriodPanel) {
    centerPanel.add(new JLabel("        " + getString("Choix_periode") + " : "));
    for (final Period myPeriod : Period.values()) {
      final String linkLabel = myPeriod.getLinkLabel();
      final MButton myPeriodButton =
          new MButton(linkLabel, ImageIconCache.getImageIcon(myPeriod.getIconName()));
      myPeriodButton.setToolTipText(
          getFormattedString("Choisir_periode", linkLabel) + " (Alt-" + linkLabel.charAt(0) + ')');
      myPeriodButton.setMnemonic(linkLabel.charAt(0));
      centerPanel.add(myPeriodButton);
      myPeriodButton.addActionListener(
          new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
              actionChangePeriod(myPeriod.getRange());
            }
          });
    }

    final String customPeriodLinkLabel = getString("personnalisee");
    final MButton customPeriodButton =
        new MButton(customPeriodLinkLabel, ImageIconCache.getImageIcon("calendar.png"));
    customPeriodButton.setToolTipText(
        getFormattedString("Choisir_periode", customPeriodLinkLabel)
            + " (Alt-"
            + customPeriodLinkLabel.charAt(0)
            + ')');
    customPeriodButton.setMnemonic(customPeriodLinkLabel.charAt(0));
    centerPanel.add(customPeriodButton);

    customPeriodPanel.setVisible(false);
    customPeriodButton.addActionListener(
        new ActionListener() {
          @Override
          public void actionPerformed(ActionEvent e) {
            customPeriodPanel.setVisible(!customPeriodPanel.isVisible());
            if (customPeriodPanel.isVisible()) {
              customPeriodPanel.requestFocusInStartField();
            }
            validate();
          }
        });
  }
Exemplo n.º 15
0
  MainButtonsPanel(
      RemoteCollector remoteCollector,
      Range selectedRange,
      final URL monitoringUrl,
      boolean collectorServer) {
    super(remoteCollector, new BorderLayout());
    this.collectorServer = collectorServer;
    setOpaque(true);
    setBackground(BACKGROUND);

    final JPanel centerPanel = new JPanel(new FlowLayout(FlowLayout.CENTER));
    centerPanel.setOpaque(false);
    add(centerPanel, BorderLayout.CENTER);
    final CustomPeriodPanel customPeriodPanel =
        new CustomPeriodPanel(remoteCollector, selectedRange);
    add(customPeriodPanel, BorderLayout.SOUTH);
    final MButton refreshButton = createRefreshButton();
    final MButton pdfButton = createPdfButton();
    // on ne peut pas instancier defaultSerializable ici car sinon,
    // les données ne seraient plus à jour après une actualisation, donc on passe la valeur spéciale
    // null
    final MButton xmlJsonButton = createXmlJsonButton(null);
    final MButton onlineHelpButton = createOnlineHelpButton();

    final MButton monitoringButton = new MButton(getString("Monitoring"), MONITORING_ICON);
    monitoringButton.setToolTipText(
        getFormattedString("Monitoring_sur", remoteCollector.getApplication()));
    centerPanel.add(refreshButton);
    centerPanel.add(pdfButton);
    centerPanel.add(xmlJsonButton);
    centerPanel.add(onlineHelpButton);
    centerPanel.add(monitoringButton);

    addPeriodButtons(centerPanel, customPeriodPanel);

    refreshButton.addActionListener(
        new ActionListener() {
          @Override
          public void actionPerformed(ActionEvent e) {
            actionRefresh();
          }
        });

    pdfButton.addActionListener(
        new ActionListener() {
          @Override
          public void actionPerformed(ActionEvent e) {
            try {
              actionPdf();
            } catch (final Exception ex) {
              showException(ex);
            }
          }
        });

    monitoringButton.addActionListener(
        new ActionListener() {
          @Override
          public void actionPerformed(ActionEvent e) {
            try {
              Desktop.getDesktop().browse(new URI(monitoringUrl.toExternalForm()));
            } catch (final Exception ex) {
              showException(ex);
            }
          }
        });

    onlineHelpButton.addActionListener(
        new ActionListener() {
          @Override
          public void actionPerformed(ActionEvent e) {
            try {
              Desktop.getDesktop()
                  .browse(
                      new URI(
                          monitoringUrl.toExternalForm() + "?resource=" + getString("help_url")));
            } catch (final Exception ex) {
              showException(ex);
            }
          }
        });
  }