private static AttachingConnector getAttachingConnectorFor(String transport) {
   List acs = Bootstrap.virtualMachineManager().attachingConnectors();
   AttachingConnector ac;
   int i, k = acs.size();
   for (i = 0; i < k; i++)
     if ((ac = (AttachingConnector) acs.get(i)).transport().name().equals(transport)) return ac;
   return null;
 }
  public void initComponents() {
    /** ******************** The main container *************************** */
    Container container = this.getContentPane();
    container.setLayout(new BorderLayout());
    container.setBackground(Color.black);
    this.setSize(650, 600);
    this.addWindowListener(
        new WindowAdapter() {
          @Override
          public void windowClosing(WindowEvent e) {}
        });

    /** ************************* MAIN PANEL ******************************* */
    mainPanel = new JPanel();
    // If put to False: we see the container's background
    mainPanel.setOpaque(false);
    mainPanel.setLayout(new BorderLayout());
    container.add(mainPanel, BorderLayout.CENTER);

    allmessagesTextArea = new TextArea();
    allmessagesTextArea.setEditable(false);
    allmessagesTextArea.setFont(new Font("Dialog", 1, 12));
    allmessagesTextArea.setForeground(Color.black);
    allmessagesTextArea.append("Select a session in the list to view its messages");
    mainPanel.add(allmessagesTextArea, BorderLayout.CENTER);

    sessionsList = new List();
    sessionsList.addItemListener(
        new ItemListener() {
          @Override
          public void itemStateChanged(ItemEvent e) {
            showMessages(e);
          }
        });
    sessionsList.setForeground(Color.black);
    sessionsList.setFont(new Font("Dialog", 1, 14));
    mainPanel.add(sessionsList, BorderLayout.WEST);

    okButton = new JButton("  OK  ");
    okButton.setToolTipText("Returns to the main frame");
    okButton.setFont(new Font("Dialog", 1, 16));
    okButton.setFocusPainted(false);
    okButton.setBackground(Color.lightGray);
    okButton.setBorder(new BevelBorder(BevelBorder.RAISED));
    okButton.setVerticalAlignment(SwingConstants.CENTER);
    okButton.setHorizontalAlignment(SwingConstants.CENTER);
    container.add(okButton, BorderLayout.SOUTH);
    okButton.addActionListener(
        new ActionListener() {
          @Override
          public void actionPerformed(ActionEvent evt) {
            setVisible(false);
          }
        });
  }
 public void setTracesSessions(TracesSessions tracesSessions) {
   sessionsList.removeAll();
   this.tracesSessions = tracesSessions;
   for (int i = 0; i < tracesSessions.size(); i++) {
     TracesSession tracesSession = tracesSessions.elementAt(i);
     String name = tracesSession.getName();
     // System.out.println("name:"+name);
     if (name.equals("No available session yet, click on refresh")) sessionsList.add(name);
     else {
       String trueName = getTrueName(name);
       sessionsList.add("Trace " + (i + 1) + " from " + trueName);
     }
   }
   if (tracesSessions.size() != 0) sessionsList.select(0);
 }
示例#4
0
  private List<Node> getSelectedNodes() {
    List<Node> selectedNodes = new Vector<Node>();
    NodeStatusTableModel myTableModel = (NodeStatusTableModel) getModel();

    ListSelectionModel lsm = getSelectionModel();
    int minIndex = lsm.getMinSelectionIndex();
    int maxIndex = lsm.getMaxSelectionIndex();

    for (int i = minIndex; i <= maxIndex; i++) {
      if (lsm.isSelectedIndex(i)) {
        // System.out.println("row " + i + " is selected");
        Node currNode = myTableModel.getNode(i);
        if (currNode != null) selectedNodes.add(currNode);
      }
    }

    return selectedNodes;
  }