private void traceFile() {
   int count = upperTabbedPane.getComponentCount();
   for (int i = 0; i < count; ++i) {
     JScrollPane scrollPane = ((JScrollPane) upperTabbedPane.getComponent(i));
     MessagesTable table = (MessagesTable) scrollPane.getViewport().getView();
     MessagesTableModel model = (MessagesTableModel) table.getModel();
     LogFile logFile = model.getLogFile();
     if (logFile == null) continue;
     try {
       ArrayList messages = logFile.parseNewMessages(null);
       model.addMessages(messages, null);
     } catch (IOException e) {
     } catch (CancelException e) {
     }
   }
 }
  public void stateChanged(ChangeEvent e) {
    JScrollPane scrollPane = ((JScrollPane) upperTabbedPane.getSelectedComponent());
    frame.fileLoaded(scrollPane != null);
    if (scrollPane == null) return;

    currentTable = (MessagesTable) scrollPane.getViewport().getView();
    currentModel = (MessagesTableModel) currentTable.getModel();
    menuBar.setSelectedFilter(currentModel.getFilterType());
  }
  public void mouseClicked(MouseEvent e) {
    if (e.getClickCount() < 2) return;
    Integer tag = null;
    String value = null;

    if (e.getSource() == currentTable) {
      tag = currentTable.getTagFromPoint(e.getPoint());
      value = currentTable.getValueFromPoint(e.getPoint());
    }
    if (e.getSource() == messageTable) {
      tag = messageTable.getTagFromPoint(e.getPoint());
      value = messageTable.getValueFromPoint(e.getPoint());
    }
    if (e.getSource() == messageTree) {
      tag = messageTree.getTagFromPoint(e.getPoint());
      value = messageTree.getValueFromPoint(e.getPoint());
    }

    if (tag == null || value == null) return;

    menuBar.customFilter();
    applyFilter(new FieldFilter(new StringField(tag.intValue(), value), FieldFilter.EQUAL));
  }
  private void openFile() {
    FileOpenDialog dialog = new FileOpenDialog(frame);
    dialog.setVisible(true);
    final File file = dialog.getFile();
    final Date startTime = dialog.getStartTime();
    final Date endTime = dialog.getEndTime();
    dialog.dispose();

    boolean traceRunning = tracer.isRunning();
    if (traceRunning) tracer.stop();

    if (file != null) {
      try {
        LogFile logFile = new LogFile(file, dataDictionary);
        ArrayList messages = logFile.parseMessages(progressBar, startTime, endTime);
        currentModel = new MessagesTableModel(dataDictionary, logFile);
        currentTable = new MessagesTable(currentModel);
        currentTable.addListSelectionListener(this);
        currentTable.addMouseListener(this);
        JScrollPane component = new JScrollPane(currentTable);
        upperTabbedPane.add(file.getName(), component);
        upperTabbedPane.setSelectedComponent(component);
        currentModel.setMessages(messages, progressBar);
        menuBar.reset();
        menuBar.setFileOpen(true);
      } catch (CancelException e) {
        closeFile();
      } catch (FileNotFoundException e) {
        System.out.println(e);
      } catch (IOException e) {
        System.out.println(e);
      }
    }

    if (traceRunning) tracer.start();
  }
 public void valueChanged(ListSelectionEvent e) {
   message = currentModel.getMessageAt(currentTable.getSelectedRow());
   messageTable.setModel(new MessageTableModel(message, dataDictionary));
   messageTree.setModel(new MessageTreeModel(message, dataDictionary));
 }