<commit_before>package hu.davidp.beadando.player.controller;

import java.io.File;
import java.io.IOException;
import java.net.URL;
import java.util.ArrayList;
import java.util.LinkedList;
import java.util.List;
import java.util.ResourceBundle;

import javax.xml.bind.JAXBException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.xml.sax.SAXException;

import com.sun.javafx.scene.control.skin.TableHeaderRow;

import hu.davidp.beadando.player.model.Model;
import hu.davidp.beadando.player.model.PlaylistElement;
import javafx.beans.value.ChangeListener;
import javafx.beans.value.ObservableValue;
import javafx.collections.FXCollections;
import javafx.collections.ObservableList;
import javafx.event.ActionEvent;
import javafx.fxml.FXML;
import javafx.fxml.Initializable;
import javafx.scene.control.Button;
import javafx.scene.control.Menu;
import javafx.scene.control.MenuBar;
import javafx.scene.control.MenuItem;
import javafx.scene.control.Tab;
import javafx.scene.control.TabPane;
import javafx.scene.control.TableColumn;
import javafx.scene.control.TableRow;
import javafx.scene.control.TableView;
import javafx.scene.control.TableView.ResizeFeatures;
import javafx.scene.control.cell.PropertyValueFactory;
import javafx.stage.FileChooser;

//sajnos kell még a TableHeaderRowhoz (mikor letiltom, hogy felcserélhetők legyenek)
@SuppressWarnings("restriction")
public class FXMLController implements Initializable {

	/**
	 * Logger objektum naplózáshoz.
	 */
	private static Logger logger = LoggerFactory.getLogger(FXMLController.class);

	private static Model model;
	private static PlayListMethods plm;

	private TableView<PlaylistElement> playListTable;

	// menü
	@FXML
	private MenuBar menuBar;

	@FXML
	private Menu fileMenu;

	@FXML
	private MenuItem fileMenuNewPlist;

	@FXML
	private MenuItem fileMenuOpenMp3;

	@FXML
	private MenuItem fileMenuSavePlist;

	@FXML
	private MenuItem fileMenuOpenPlist;

	@FXML
	private MenuItem fileMenuClosePlist;

	@FXML
	private MenuItem fileMenuExit;

	@FXML
	private Button prevButton;
	@FXML
	private Button playButton;
	@FXML
	private Button nextButton;
	@FXML
	private Button stopButton;

	@FXML
	private TabPane playListTabPane;

	private ObservableList<PlaylistElement> allItemsInTable;

	private static File lastFolder;

	/*
	 * (non-Javadoc) beállítja a gombok láthatóságát, az a alapértelmezett
	 * megjelenést: nincs playlist, nem kattinthatók a gombok, csak azok a
	 * menüitemek, melyek kezdetben eddig is használhatók voltak.
	 * 
	 * @see javafx.fxml.Initializable#initialize(java.net.URL,
	 * java.util.ResourceBundle)
	 */
	@Override
	public void initialize(URL location, ResourceBundle resources) {
		setAvailability();
	}

	public void setAvailability() {
		boolean fileMenuNewPlistEnabled = model.getPlaylist() == null;
		fileMenuNewPlist.setDisable(!fileMenuNewPlistEnabled);

		boolean fileMenuSavePlistEnabled = (model.getPlaylist() != null) && (!model.getPlaylist().isEmpty());
		fileMenuSavePlist.setDisable(!fileMenuSavePlistEnabled);

		boolean fileMenuClosePlistEnabled = model.getPlaylist() != null;
		fileMenuClosePlist.setDisable(!fileMenuClosePlistEnabled);

		boolean prevButtonEnabled = (model.getPlaylist() != null)
				&& (model.getPlaylist().size() > 1) && (PlayerFX.getInstance().getActualElementinPlaylist() > 0);
		prevButton.setDisable(!prevButtonEnabled);

		boolean nextButtonEnabled = (model.getPlaylist() != null)
				&& (model.getPlaylist().size() > 1)
				&& (PlayerFX.getInstance().getActualElementinPlaylist() < PlayerFX.getInstance().getActualPlaylistSize()
						- 1);
		nextButton.setDisable(!nextButtonEnabled);

		boolean playButtonEnabled = (model.getPlaylist() != null)
				&& (PlayerFX.getInstance().getActualPlaylistSize() != 0);
		playButton.setDisable(!playButtonEnabled);

		boolean stopButtonEnabled = (model.getPlaylist() != null)
				&& (PlayerFX.getInstance().getActualPlaylistSize() != 0);
		stopButton.setDisable(!stopButtonEnabled);

		if (PlayerFX.getInstance().isPlayButtonSaysPlay()) {
			playButton.setText("Play");<commit_msg>nullpointerexception fixe<commit_after>package hu.davidp.beadando.player.controller;

import java.io.File;
import java.io.IOException;
import java.net.URL;
import java.util.ArrayList;
import java.util.LinkedList;
import java.util.List;
import java.util.ResourceBundle;

import javax.xml.bind.JAXBException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.xml.sax.SAXException;

import com.sun.javafx.scene.control.skin.TableHeaderRow;

import hu.davidp.beadando.player.model.Model;
import hu.davidp.beadando.player.model.PlaylistElement;
import javafx.beans.value.ChangeListener;
import javafx.beans.value.ObservableValue;
import javafx.collections.FXCollections;
import javafx.collections.ObservableList;
import javafx.event.ActionEvent;
import javafx.fxml.FXML;
import javafx.fxml.Initializable;
import javafx.scene.control.Button;
import javafx.scene.control.Menu;
import javafx.scene.control.MenuBar;
import javafx.scene.control.MenuItem;
import javafx.scene.control.Tab;
import javafx.scene.control.TabPane;
import javafx.scene.control.TableColumn;
import javafx.scene.control.TableRow;
import javafx.scene.control.TableView;
import javafx.scene.control.TableView.ResizeFeatures;
import javafx.scene.control.cell.PropertyValueFactory;
import javafx.stage.FileChooser;

//sajnos kell még a TableHeaderRowhoz (mikor letiltom, hogy felcserélhetők legyenek)
@SuppressWarnings("restriction")
public class FXMLController implements Initializable {

	/**
	 * Logger objektum naplózáshoz.
	 */
	private static Logger logger = LoggerFactory.getLogger(FXMLController.class);

	private static Model model;
	private static PlayListMethods plm;

	private TableView<PlaylistElement> playListTable;

	// menü
	@FXML
	private MenuBar menuBar;

	@FXML
	private Menu fileMenu;

	@FXML
	private MenuItem fileMenuNewPlist;

	@FXML
	private MenuItem fileMenuOpenMp3;

	@FXML
	private MenuItem fileMenuSavePlist;

	@FXML
	private MenuItem fileMenuOpenPlist;

	@FXML
	private MenuItem fileMenuClosePlist;

	@FXML
	private MenuItem fileMenuExit;

	@FXML
	private Button prevButton;
	@FXML
	private Button playButton;
	@FXML
	private Button nextButton;
	@FXML
	private Button stopButton;

	@FXML
	private TabPane playListTabPane;

	private ObservableList<PlaylistElement> allItemsInTable;

	private static File lastFolder;

	/*
	 * (non-Javadoc) beállítja a gombok láthatóságát, az a alapértelmezett
	 * megjelenést: nincs playlist, nem kattinthatók a gombok, csak azok a
	 * menüitemek, melyek kezdetben eddig is használhatók voltak.
	 * 
	 * @see javafx.fxml.Initializable#initialize(java.net.URL,
	 * java.util.ResourceBundle)
	 */
	@Override
	public void initialize(URL location, ResourceBundle resources) {
		setAvailability();
	}

	public void setAvailability() {
		boolean fileMenuNewPlistEnabled = model.getPlaylist() == null;
		fileMenuNewPlist.setDisable(!fileMenuNewPlistEnabled);

		boolean fileMenuSavePlistEnabled = (model.getPlaylist() != null) && (!model.getPlaylist().isEmpty());
		fileMenuSavePlist.setDisable(!fileMenuSavePlistEnabled);

		boolean fileMenuClosePlistEnabled = model.getPlaylist() != null;
		fileMenuClosePlist.setDisable(!fileMenuClosePlistEnabled);

		boolean prevButtonEnabled = (model.getPlaylist() != null)
				&& (model.getPlaylist().size() > 1) && (PlayerFX.getInstance().getActualElementinPlaylist() > 0)
				 && (PlayerFX.getInstance().hasMedia());
		prevButton.setDisable(!prevButtonEnabled) ;

		boolean nextButtonEnabled = (model.getPlaylist() != null)
				&& (model.getPlaylist().size() > 1)
				&& (PlayerFX.getInstance().getActualElementinPlaylist() < PlayerFX.getInstance().getActualPlaylistSize()
						- 1)  && (PlayerFX.getInstance().hasMedia());
		nextButton.setDisable(!nextButtonEnabled);

		boolean playButtonEnabled = (model.getPlaylist() != null)
				&& (PlayerFX.getInstance().getActualPlaylistSize() != 0) && (PlayerFX.getInstance().hasMedia());
		playButton.setDisable(!playButtonEnabled);

		boolean stopButtonEnabled = (model.getPlaylist() != null)
				&& (PlayerFX.getInstance().getActualPlaylistSize() != 0) && (PlayerFX.getInstance().hasMedia());
		stopButton.setDisable(!stopButtonEnabled);

		if (PlayerFX.getInstance().isPlayButtonSaysPlay()) {
			playButton.setText("Play");
{'fraction_non_alphanumeric': 0.10871918220084185, 'fraction_numerical': 0.002164762477450391, 'mean_word_length': 5.821985233798196, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 10}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7251062', 'n_tokens_mistral': 2816, 'n_tokens_neox': 2653, 'n_words': 512}