public void actionPerformed()

in uimaj-tools/src/main/java/org/apache/uima/tools/cpm/CpmPanel.java [789:956]


  public void actionPerformed(ActionEvent ev) {
    Object source = ev.getSource();

    if (source == progressTimer) {
      elapsedTime++;
      // menuBarLabel.setText(ElapsedTimeFormatter.format(elapsedTime));

      displayProgress();
    } else if (source == performanceQueryTimer && mCPE != null) {
      // printStats();
    } else if (source == startButton) {
      statusLabel.setText("Initializing");
      // logDialog.clear();
      progressBar.setValue(0);

      final Thread worker = new Thread() {
        @Override
        public void run() {
          startProcessing();
        }
      };
      worker.start();
    } else if (source == addAeButton) {
      int rv = aeFileChooser.showOpenDialog(addAeButton);

      if (rv == JFileChooser.APPROVE_OPTION) {
        setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));

        File file = aeFileChooser.getSelectedFile();

        // Create AE panel on the tabbed pane for this AE specifier file

        try {
          addAE(file.getPath());
        } catch (Exception e) {
          displayError(e);
        }

        int lastTabIndex = aeTabbedPane.getTabCount() - 1;
        aeTabbedPane.setSelectedIndex(lastTabIndex);

        setCursor(Cursor.getDefaultCursor());
      }
    } else if (source == moveAeLeftButton) {
      int index = aeTabbedPane.getSelectedIndex();
      if (index > 0) {
        // update CPE descriptor
        try {
          CpeCasProcessor casProcToMove = currentCpeDesc.getCpeCasProcessors()
                  .getCpeCasProcessor(index);
          currentCpeDesc.getCpeCasProcessors().removeCpeCasProcessor(index);
          currentCpeDesc.getCpeCasProcessors().addCpeCasProcessor(casProcToMove, index - 1);
        } catch (CpeDescriptorException e) {
          displayError(e);
          return;
        }
        // update GUI
        aeTabbedPane.moveTab(index, index - 1);
        aeTabbedPane.setSelectedIndex(index - 1);
        Object specifierToMove = aeSpecifiers.remove(index);
        aeSpecifiers.add(index - 1, specifierToMove);
      }
    } else if (source == moveAeRightButton) {
      int index = aeTabbedPane.getSelectedIndex();
      if (index > -1 && index < aeTabbedPane.getTabCount() - 1) {
        // update CPE descriptor
        try {
          CpeCasProcessor casProcToMove = currentCpeDesc.getCpeCasProcessors()
                  .getCpeCasProcessor(index);
          currentCpeDesc.getCpeCasProcessors().removeCpeCasProcessor(index);
          currentCpeDesc.getCpeCasProcessors().addCpeCasProcessor(casProcToMove, index + 1);
        } catch (CpeDescriptorException e) {
          displayError(e);
          return;
        }
        // update GUI
        aeTabbedPane.moveTab(index, index + 1);
        aeTabbedPane.setSelectedIndex(index + 1);
        Object specifierToMove = aeSpecifiers.remove(index);
        aeSpecifiers.add(index + 1, specifierToMove);
      }
    } else if (source == addConsumerButton) {
      int rv = consumerFileChooser.showOpenDialog(addConsumerButton);

      if (rv == JFileChooser.APPROVE_OPTION) {
        setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));

        File file = consumerFileChooser.getSelectedFile();

        // Create consumer panel on the tabbed pane
        // for this consumer specifier file:

        try {
          addConsumer(file.getPath());
        } catch (Exception e) {
          displayError(e);
        }

        int lastTabIndex = consumerTabbedPane.getTabCount() - 1;
        consumerTabbedPane.setSelectedIndex(lastTabIndex);

        setCursor(Cursor.getDefaultCursor());
      }
    } else if (source == moveConsumerLeftButton) {
      int index = consumerTabbedPane.getSelectedIndex();
      if (index > 0) {
        // update CPE descriptor
        try {
          int absIndex = aeSpecifiers.size() + index;
          CpeCasProcessor casProcToMove = currentCpeDesc.getCpeCasProcessors()
                  .getCpeCasProcessor(absIndex);
          currentCpeDesc.getCpeCasProcessors().removeCpeCasProcessor(absIndex);
          currentCpeDesc.getCpeCasProcessors().addCpeCasProcessor(casProcToMove, absIndex - 1);
        } catch (CpeDescriptorException e) {
          displayError(e);
          return;
        }
        // update GUI
        consumerTabbedPane.moveTab(index, index - 1);
        consumerTabbedPane.setSelectedIndex(index - 1);
        Object specifierToMove = consumerSpecifiers.remove(index);
        consumerSpecifiers.add(index - 1, specifierToMove);
      }
    } else if (source == moveConsumerRightButton) {
      int index = consumerTabbedPane.getSelectedIndex();
      if (index > -1 && index < consumerTabbedPane.getTabCount() - 1) {
        // update CPE descriptor
        try {
          int absIndex = aeSpecifiers.size() + index;
          CpeCasProcessor casProcToMove = currentCpeDesc.getCpeCasProcessors()
                  .getCpeCasProcessor(absIndex);
          currentCpeDesc.getCpeCasProcessors().removeCpeCasProcessor(absIndex);
          currentCpeDesc.getCpeCasProcessors().addCpeCasProcessor(casProcToMove, absIndex + 1);
        } catch (CpeDescriptorException e) {
          displayError(e);
          return;
        }
        // update GUI
        consumerTabbedPane.moveTab(index, index + 1);
        consumerTabbedPane.setSelectedIndex(index + 1);
        Object specifierToMove = consumerSpecifiers.remove(index);
        consumerSpecifiers.add(index + 1, specifierToMove);
      }
    } else if (source == saveCpeDescMenuItem) {
      saveCpeDescriptor();
    } else if (source == openCpeDescMenuItem) {
      int returnVal = this.openSaveFileChooser.showOpenDialog(this);
      if (returnVal == JFileChooser.APPROVE_OPTION) {
        File f = this.openSaveFileChooser.getSelectedFile();
        setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
        try {
          openCpeDescriptor(f);
        } catch (Exception e) {
          displayError(e);
        } finally {
          setCursor(Cursor.getDefaultCursor());
        }
      }
    } else if (source == refreshMenuItem) {
      refreshOutOfSyncFiles();
    } else if (source == clearAllMenuItem) {
      clearAll();
    } else if (source == viewCasInitializerPanelMenuItem) {
      setCasInitializerPanelVisible(!casInitializerPanel.isVisible());
    } else if (source == saveUsingImportMenuItem) {
      setSaveUsingImports(!saveUsingImports);
    }
  }