public void setOptions(BeautiOptions options) {

    this.options = options;

    resetPanel();

    settingOptions = true;

    int selRow = partitionTable.getSelectedRow();
    partitionTableModel.fireTableDataChanged();
    if (options.getDataPartitions().size() > 0) {
      if (selRow < 0) {
        selRow = 0;
      }
      partitionTable.getSelectionModel().setSelectionInterval(selRow, selRow);

      setCurrentPartition(options.getDataPartitions().get(selRow));
    }

    AncestralStatesOptionsPanel panel = optionsPanels.get(currentPartition);
    if (panel != null) {
      panel.setupPanel();
    }

    settingOptions = false;

    validate();
    repaint();
  }
  /**
   * Sets the current partition that this panel is displaying
   *
   * @param partition the new partition to display
   */
  private void setCurrentPartition(AbstractPartitionData partition) {
    if (partition != null) {
      if (currentPartition != null) optionsPanelParent.removeAll();

      AncestralStatesOptionsPanel panel = optionsPanels.get(partition);
      if (panel == null) {
        panel = new AncestralStatesOptionsPanel(this, options, partition);
        optionsPanels.put(partition, panel);
      }

      currentPartition = partition;

      panel.setupPanel();

      optionsPanelParent.add(panel);

      updateBorder();
    }
  }