public CpmPanel()

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


  public CpmPanel() {

    // The following is VERY flaky:
    // Don't 'try' this at home:
    /*
     * try { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } catch (Exception
     * e) { }
     */

    String fileChooserRootDirPath = System.getProperty("uima.file_chooser_root");
    if (fileChooserRootDirPath == null) {
      fileChooserRootDirPath = System.getProperty("user.dir");
    }
    fileChooserRootDir = new File(fileChooserRootDirPath);

    // setResizable(false);
    this.setLayout(new BorderLayout());

    mainSplitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT);
    mainSplitPane.setResizeWeight(0.25);
    JSplitPane bottomSplitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT);
    bottomSplitPane.setResizeWeight(0.5);
    mainSplitPane.setBottomComponent(bottomSplitPane);
    readerInitializerSplitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT);
    readerInitializerSplitPane.setResizeWeight(0.5);

    collectionReaderPanel = new ResetableMetaDataPanel(2);
    // Initialized in readPreferences

    Border bevelBorder = BorderFactory.createRaisedBevelBorder();
    collectionReaderTitledBorder = BorderFactory.createTitledBorder(bevelBorder,
            "Collection Reader");
    collectionReaderPanel.setBorder(collectionReaderTitledBorder);

    JScrollPane collectionReaderScrollPane = new JScrollPane(collectionReaderPanel);
    readerInitializerSplitPane.setLeftComponent(collectionReaderScrollPane);

    casInitializerPanel = new ResetableMetaDataPanel(2);

    bevelBorder = BorderFactory.createRaisedBevelBorder();
    casInitializerTitledBorder = BorderFactory.createTitledBorder(bevelBorder, "CAS Initializer");
    casInitializerPanel.setBorder(casInitializerTitledBorder);

    readerInitializerSplitPane.setRightComponent(casInitializerPanel);

    mainSplitPane.setTopComponent(readerInitializerSplitPane);

    // AE Panel
    aeMainPanel = new JPanel();
    aeMainPanel.setLayout(new BorderLayout());
    aeTitledBorder = BorderFactory.createTitledBorder(bevelBorder, "Analysis Engines");
    aeMainPanel.setBorder(aeTitledBorder);

    addAeButton = new JButton("Add...");
    addAeButton.addActionListener(this);

    moveAeLeftButton = new JButton("<<");
    moveAeLeftButton.addActionListener(this);

    moveAeRightButton = new JButton(">>");
    moveAeRightButton.addActionListener(this);

    JPanel addAePanel = new JPanel();
    addAePanel.setLayout(new FlowLayout(FlowLayout.LEFT));
    addAePanel.add(addAeButton);
    addAePanel.add(moveAeLeftButton);
    addAePanel.add(moveAeRightButton);

    aeMainPanel.add(addAePanel, BorderLayout.NORTH);

    aeTabbedPane = new JTabbedPaneWithCloseIcons();
    aeTabbedPane.addTabClosedListener(this);

    aeMainPanel.add(aeTabbedPane, BorderLayout.CENTER);

    JScrollPane aeScrollPane = new JScrollPane(aeMainPanel);
    bottomSplitPane.setTopComponent(aeScrollPane);

    // Consumers panel
    consumersPanel = new JPanel();
    consumersPanel.setLayout(new BorderLayout());
    consumerTitledBorder = BorderFactory.createTitledBorder(bevelBorder, "CAS Consumers");
    consumersPanel.setBorder(consumerTitledBorder);

    addConsumerButton = new JButton("Add...");
    addConsumerButton.addActionListener(this);

    moveConsumerLeftButton = new JButton("<<");
    moveConsumerLeftButton.addActionListener(this);

    moveConsumerRightButton = new JButton(">>");
    moveConsumerRightButton.addActionListener(this);

    JPanel addConsumerPanel = new JPanel();
    addConsumerPanel.setLayout(new FlowLayout(FlowLayout.LEFT));
    addConsumerPanel.add(addConsumerButton);
    addConsumerPanel.add(moveConsumerLeftButton);
    addConsumerPanel.add(moveConsumerRightButton);

    consumersPanel.add(addConsumerPanel, BorderLayout.NORTH);

    consumerTabbedPane = new JTabbedPaneWithCloseIcons();
    consumerTabbedPane.addTabClosedListener(this);

    consumersPanel.add(consumerTabbedPane, BorderLayout.CENTER);

    JScrollPane consumerScrollPane = new JScrollPane(consumersPanel);
    bottomSplitPane.setBottomComponent(consumerScrollPane);

    // logDialog = new LogDialog();

    this.add(mainSplitPane, BorderLayout.CENTER);

    JPanel southernPanel = new JPanel();
    southernPanel.setLayout(new BorderLayout());

    JPanel southernCentralPanel = new JPanel();
    GridBagLayout gbl = new GridBagLayout();
    GridBagConstraints gbc = new GridBagConstraints();
    gbc.gridwidth = 3;
    gbc.gridy = 0;
    gbc.insets = new Insets(4, 4, 4, 4);

    southernCentralPanel.setLayout(gbl);

    progressBar = new JProgressBar();
    gbc.gridx = 0;
    gbc.weightx = 1.0;
    gbc.anchor = GridBagConstraints.WEST;
    southernCentralPanel.add(progressBar, gbc);

    transportControlPanel = new TransportControlPanel(this);
    transportControlPanel.setButtonTooltipText(TransportControlPanel.PLAY_BUTTON,
            "Run Collection Processing");
    transportControlPanel.setButtonTooltipText(TransportControlPanel.PAUSE_BUTTON,
            "Pause Collection Processing");
    transportControlPanel.setButtonTooltipText(TransportControlPanel.STOP_BUTTON,
            "Stop Collection Processing");

    gbc.gridx = 1;
    gbc.weightx = 0.0;
    gbc.anchor = GridBagConstraints.CENTER;

    southernCentralPanel.add(transportControlPanel, gbc);
    southernPanel.add(southernCentralPanel, BorderLayout.CENTER);

    statusLabel = new JLabel("Initialized", SwingConstants.LEFT);
    southernPanel.add(statusLabel, BorderLayout.SOUTH);

    startButton = transportControlPanel.getButton(TransportControlPanel.PLAY_BUTTON);
    startButton.addActionListener(this);
    stopButton = transportControlPanel.getButton(TransportControlPanel.STOP_BUTTON);
    stopButton.addActionListener(this);

    this.add(southernPanel, BorderLayout.SOUTH);

    progressTimer = new Timer(1000, this);

    performanceQueryTimer = new Timer(2000, this);

    initFileChoosers();

    // create file selectors (used to populate CR and CI panels later)
    readerFileSelector = new FileSelector(null, "Collection Reader Descriptor",
            JFileChooser.FILES_ONLY, fileChooserRootDir, new XMLFileFilter());
    readerFileSelector.addFileSelectorListener(this, collectionReaderPanel);

    casInitializerFileSelector = new FileSelector(null, "CAS Initializer Descriptor",
            JFileChooser.FILES_ONLY, fileChooserRootDir, new XMLFileFilter());
    casInitializerFileSelector.addFileSelectorListener(this, casInitializerPanel);

    // initialize empty CollectionReader and CAS Initializer panels
    try {
      populateCollectionReaderPanel(null);
      populateCasInitializerPanel(null);
    } catch (Exception e) {
      e.printStackTrace();
    }

    // CAS initializer panel is initially hidden since it is deprecated
    setCasInitializerPanelVisible(false);

    // read preferences (loads last opened CPE descriptor)
    if (System.getProperty("uima.noprefs") == null) {
      readPreferences();
    }
  }