コード例 #1
0
  /** Initializes and returns the Packet View Table. */
  private JTable getJPacketViewTable() {
    if (jPacketViewTable == null) {
      jPacketViewTable = new DataTable<PacketInfo>(jPacketViewTableModel);
      jPacketViewTable.setAutoCreateRowSorter(true);
      jPacketViewTable.setGridColor(Color.LIGHT_GRAY);
      jPacketViewTable
          .getSelectionModel()
          .addListSelectionListener(
              new ListSelectionListener() {
                PacketInfo packetInfo;

                @Override
                public synchronized void valueChanged(ListSelectionEvent arg0) {
                  PacketInfo packetInfo = jPacketViewTable.getSelectedItem();
                  if (packetInfo != null && packetInfo != this.packetInfo) {
                    double crossHairValue = packetInfo.getTimeStamp();
                    boolean centerGraph =
                        !(crossHairValue <= graphPanel.getViewportUpperBound()
                            && crossHairValue >= graphPanel.getViewportLowerBound());
                    graphPanel.setGraphView(crossHairValue, centerGraph);
                    getJHttpReqResPanel().select(packetInfo.getRequestResponseInfo());
                    if (aroVideoPlayer != null) {
                      aroVideoPlayer.setMediaDisplayTime(graphPanel.getCrosshair());
                    }
                  }
                  this.packetInfo = packetInfo;
                }
              });
    }
    return jPacketViewTable;
  }
コード例 #2
0
  /**
   * Initializes and returns the the DataTable that contains Http request and response informations.
   */
  private DataTable<HttpRequestResponseInfo> getJRequestResponseTable() {
    if (jRequestResponseTable == null) {
      jRequestResponseTable = new DataTable<HttpRequestResponseInfo>(jRequestResponseTableModel);
      jRequestResponseTable.setAutoCreateRowSorter(true);
      jRequestResponseTable.setGridColor(Color.LIGHT_GRAY);
      jRequestResponseTable
          .getSelectionModel()
          .addListSelectionListener(
              new ListSelectionListener() {

                @Override
                public void valueChanged(ListSelectionEvent e) {
                  // Enable view and save as buttons appropriately
                  HttpRequestResponseInfo httpRRInfo = jRequestResponseTable.getSelectedItem();
                  boolean enabled =
                      httpRRInfo != null
                          && httpRRInfo.getContentLength() > 0
                          && httpRRInfo.getDirection() == Direction.RESPONSE
                          && httpRRInfo.getStatusCode() != 0;
                  getViewBtn().setEnabled(enabled);
                  getSaveBtn().setEnabled(enabled);
                }
              });
      jRequestResponseTable.addMouseListener(
          new MouseAdapter() {
            public void mouseClicked(MouseEvent e) {
              if (e.getClickCount() == 2 && getViewBtn().isEnabled()) {
                try {
                  viewContent(jRequestResponseTable.getSelectedItem());
                } catch (IOException ex) {
                  MessageDialogFactory.showUnexpectedExceptionDialog(
                      RequestResponseDetailsPanel.this.getTopLevelAncestor(), ex);
                }
              }
            }
          });
    }
    return jRequestResponseTable;
  }
コード例 #3
0
  /** Initializes and returns the Scroll Pane for the TCP flows table. */
  private DataTable<TCPSession> getJTCPFlowsTable() {
    if (jTCPFlowsTable == null) {
      jTCPFlowsTable = new DataTable<TCPSession>(jTCPFlowsTableModel);
      jTCPFlowsTable.setAutoCreateRowSorter(true);
      jTCPFlowsTable.setGridColor(Color.LIGHT_GRAY);
      jTCPFlowsTable
          .getSelectionModel()
          .addListSelectionListener(
              new ListSelectionListener() {
                private TCPSession tcp;

                @Override
                public synchronized void valueChanged(ListSelectionEvent arg0) {
                  TCPSession tcp = jTCPFlowsTable.getSelectedItem();
                  if (tcp != this.tcp) {
                    if (tcp != null) {
                      jPacketViewTableModel.setData(tcp.getPackets());
                      jPacketViewTable.setGridColor(Color.LIGHT_GRAY);
                      if (!tcp.getPackets().isEmpty()) {
                        jPacketViewTable.getSelectionModel().setSelectionInterval(0, 0);
                      }
                      if (jTCPFlowsContentTabbedPane.getSelectedComponent()
                          == getJContentViewScrollPane()) {
                        jContentTextArea.setText(tcp.getDataText());
                      }
                      jContentTextArea.setCaretPosition(0);
                      getJHttpReqResPanel().setData(tcp.getRequestResponseInfo());
                    } else {
                      jPacketViewTableModel.removeAllRows();
                      getJHttpReqResPanel().setData(null);
                      jContentTextArea.setText(null);
                    }
                    this.tcp = tcp;
                  }
                }
              });
    }
    return jTCPFlowsTable;
  }