/**
   * Sets up transcriptComboBox (pulldown list) with transcript and its parent gene's other
   * transcripts, with transcript selected
   */
  private void setupTranscriptComboBox(AnnotatedFeatureI annot) {
    // could also check for gene change before doing a removeAll
    if (transcriptComboBox.getSelectedItem() == annot) return;
    // adding and removing items causes item events to fire so need to remove
    // listener here - is there any other way to supress firing?
    transcriptComboBox.removeItemListener(transItemListener);
    transcriptComboBox.removeAllItems();
    if (annot == null) {
      transcriptComboBox.addItem("<no feature selected>");
      return;
    }

    // 1 LEVEL ANNOT
    if (annot.isAnnotTop()) {
      transcriptComboBox.addItem(annot);
      return;
    }

    // TRANSCRIPT
    SeqFeatureI gene = annot.getRefFeature();
    Vector transcripts = gene.getFeatures();
    for (int i = 0; i < transcripts.size(); i++)
      transcriptComboBox.addItem(transcripts.elementAt(i));
    transcriptComboBox.setSelectedItem(annot); // transcript
    transcriptComboBox.addItemListener(transItemListener);
  }
 /**
  * AssemblyFeature is the only GAI at the moment that has no relation to // a transcript. Dont
  * think they can end up in ede (??). // Would be nice to have an interface that was solely for
  * the exon // trans gene heirarchy? Should we actively make sure AssemblyFeatures dont // get
  * into ede? (filter in AnnotationMenu?) returns null if no transcript can be found.
  */
 private AnnotatedFeatureI getTransOrOneLevelAnn(AnnotatedFeatureI af) {
   if (af != null) {
     if (af.isTranscript()) return af;
     if (af.isExon()) return af.getRefFeature().getAnnotatedFeature();
     if (af.isAnnotTop()) {
       if (af.hasKids()) return af.getFeatureAt(0).getAnnotatedFeature(); // transcript
       else // 1 level annot
       return af;
     }
   }
   return null;
 }
  private void initGui(AnnotatedFeatureI annot) {
    translationViewer = new TranslationViewer(editorPanel);
    translationViewer.setBackground(Color.black);
    transcriptComboBox = new JComboBox();
    lengthLabel = new JLabel("Translation length: <no feature selected>");
    lengthLabel.setForeground(Color.black);
    findButton = new JButton("Find sequence...");
    clearFindsButton = new JButton("Clear search hits");
    // Disable until we actually get search results
    clearFindsButton.setEnabled(false);

    goToButton = new JButton("GoTo...");
    showIntronBox = new JCheckBox("Show introns in translation viewer", true);
    showIntronBox.setBackground(Color.white);
    followSelectionCheckBox = new JCheckBox("Follow external selection", false);
    followSelectionCheckBox.setBackground(Color.white);
    upstream_button = new JButton();
    downstream_button = new JButton();

    colorSwatch = new JPanel();

    setSize(824, 500);
    JScrollPane pane = new JScrollPane(editorPanel);
    pane.setHorizontalScrollBarPolicy(
        JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); // RAY: SET SCROLL POLICY HERE! WAS
    // HORIZONTAL_SCROLLBAR_NEVER

    // pane.setColumnHeaderView(new BaseFineEditorRowHeader(editorPanel)); // RAY: setRowHeader need
    // to create column header
    pane.setColumnHeaderView(new BaseFineEditorHorizontalColHeader(editorPanel));
    viewport = pane.getViewport();
    colorSwatch.setPreferredSize(new Dimension(10, 10));

    getContentPane().setBackground(Color.white);
    getContentPane().setLayout(new BorderLayout());
    getContentPane().add(colorSwatch, "North");
    getContentPane().add(pane, "Center");

    Box transcriptListBox = new Box(BoxLayout.X_AXIS);
    JLabel tranLabel;
    // 1 LEVEL ANNOT
    if (annot.isAnnotTop()) tranLabel = new JLabel("Annotation: ");
    else // 3-level
    tranLabel = new JLabel("Transcript: ");
    tranLabel.setForeground(Color.black);
    transcriptListBox.add(Box.createHorizontalStrut(5));
    transcriptListBox.add(tranLabel);
    transcriptListBox.setBackground(Color.white);
    transcriptComboBox.setMaximumSize(new Dimension(300, 30));
    transcriptListBox.add(transcriptComboBox);
    transcriptListBox.add(Box.createHorizontalGlue());
    transcriptListBox.add(Box.createHorizontalStrut(5));
    transcriptListBox.add(lengthLabel);
    transcriptListBox.add(Box.createHorizontalGlue());

    Box checkboxesTop = new Box(BoxLayout.X_AXIS);
    checkboxesTop.setBackground(Color.white);
    checkboxesTop.add(Box.createHorizontalStrut(5));
    checkboxesTop.add(findButton);
    checkboxesTop.add(Box.createHorizontalStrut(10));
    checkboxesTop.add(clearFindsButton);
    checkboxesTop.add(Box.createHorizontalStrut(15));
    checkboxesTop.add(goToButton);
    checkboxesTop.add(Box.createHorizontalGlue());
    Box checkboxesBottom = new Box(BoxLayout.X_AXIS);
    checkboxesBottom.add(showIntronBox);
    checkboxesBottom.add(Box.createHorizontalGlue());
    checkboxesBottom.add(Box.createHorizontalStrut(10));
    checkboxesBottom.add(followSelectionCheckBox);
    Box checkboxes = new Box(BoxLayout.Y_AXIS);
    checkboxes.add(checkboxesTop);
    checkboxes.add(checkboxesBottom);

    Box labelPanel = new Box(BoxLayout.Y_AXIS);
    labelPanel.setBackground(Color.white);
    labelPanel.add(transcriptListBox);
    labelPanel.add(Box.createVerticalStrut(5));
    labelPanel.add(checkboxes);

    Box navPanel = new Box(BoxLayout.Y_AXIS);
    navPanel.setBackground(Color.white);
    navPanel.add(upstream_button);
    navPanel.add(Box.createVerticalStrut(10));
    navPanel.add(downstream_button);
    navPanel.add(Box.createVerticalGlue());

    Box textBoxes = new Box(BoxLayout.X_AXIS);
    textBoxes.setBackground(Color.white);
    textBoxes.add(labelPanel);
    textBoxes.add(navPanel);

    Box detailPanel = new Box(BoxLayout.Y_AXIS);
    detailPanel.setBackground(Color.white);
    detailPanel.add(translationViewer);
    detailPanel.add(textBoxes);
    getContentPane().add(detailPanel, "South");

    validateTree();
    scrollListener = new FineEditorScrollListener();
    viewport.addChangeListener(scrollListener);

    transcriptComboBox.addKeyListener(
        new KeyAdapter() {
          public void keyPressed(KeyEvent e) {
            if (e.getKeyCode() == KeyEvent.VK_U && (e.getModifiers() & KeyEvent.CTRL_MASK) != 0) {
              CurationManager.getActiveCurationState().getTransactionManager().undo(this);
            }
          }
        });
  }