@Override
  public void initialize(URL location, ResourceBundle resources) {
    model = new RNAXDModel();
    setFileDependingButtonBindings();
    bindMenuItemsToButtons();

    model.setFileLoaded(false);
    reloadItem.setSelected(false);
    selectionFocusItem.setSelected(false);

    initFileChooser();
    setFileOpenedBinding();
  }
  private void selectionFocusBinding() {
    if (selectionFocusItem.isSelected()) {
      selectionModel.getSelectedItems().addListener(selectionFocusListener);
    }

    selectionFocusItem
        .selectedProperty()
        .addListener(
            (observable, oldValue, newValue) -> {
              if (newValue == oldValue) return;
              if (newValue && !oldValue) {
                selectionModel.getSelectedItems().addListener(selectionFocusListener);
              } else {
                selectionModel.getSelectedItems().removeListener(selectionFocusListener);
              }
            });
  }
  private void setFileDependingButtonBindings() {
    // MenuItems
    pyrpurItem.disableProperty().bind(model.fileLoadedProperty().not());
    augcItem.disableProperty().bind(model.fileLoadedProperty().not());
    meshItem.disableProperty().bind(model.fileLoadedProperty().not());
    stickItem.disableProperty().bind(model.fileLoadedProperty().not());
    ballItem.disableProperty().bind(model.fileLoadedProperty().not());

    // Buttons on the side
    colorPyrpur.disableProperty().bind(model.fileLoadedProperty().not());
    colorAugc.disableProperty().bind(model.fileLoadedProperty().not());
    structureMesh.disableProperty().bind(model.fileLoadedProperty().not());
    structureStick.disableProperty().bind(model.fileLoadedProperty().not());
    structureBall.disableProperty().bind(model.fileLoadedProperty().not());
    playRotate.disableProperty().bind(model.fileLoadedProperty().not());
    rotateLeft.disableProperty().bind(model.fileLoadedProperty().not());
    rotateRight.disableProperty().bind(model.fileLoadedProperty().not());
    zoomIn.disableProperty().bind(model.fileLoadedProperty().not());
    zoomOut.disableProperty().bind(model.fileLoadedProperty().not());
    centerObject.disableProperty().bind(model.fileLoadedProperty().not());
  }
  /** initialize tertiary structure view */
  private void initTertiaryView() {
    Group models3D = new Group();
    rnaSequence3D = new RNASequence(model.getPdbfile());

    if (tertiaryRoom == null) {
      tertiaryRoom = new Room(models3D, 50, 50);
      tertiaryRoom.rotateCamera(tertiaryRoom);
      tertiaryRoom.scaleCamera(scene);
      tertiaryRoom.alignToParent(pane3D);
      tertiaryRoom.setPickOnBounds(false);
      pane3D.getChildren().add(tertiaryRoom);
    } else {
      tertiaryRoom.setObject(rnaSequence3D);
    }

    if (reloadItem.isSelected()) loadOneModel(0);
    if (!reloadItem.isSelected()) loadAllmodels();
    ((MeshModel) rnaSequence3D.getModels().get(1)).colorPyrPur();

    rnaSequence3D.setSelectionModel(selectionModel);
    tertiaryRoom.setCameraCenter(rnaSequence3D.computeCenter());

    activateRightSideButtons();
  }
 private void bindMenuItemsToButtons() {
   pyrpurItem.selectedProperty().bindBidirectional(colorPyrpur.selectedProperty());
   augcItem.selectedProperty().bindBidirectional(colorAugc.selectedProperty());
   meshItem.selectedProperty().bindBidirectional(structureMesh.selectedProperty());
   stickItem.selectedProperty().bindBidirectional(structureStick.selectedProperty());
 }