<commit_before>package org.peerbox.presenter;


import java.io.IOException;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import javafx.collections.FXCollections;
import javafx.collections.ObservableList;
import javafx.fxml.FXMLLoader;
import javafx.scene.Node;

public class MainNavigator {
	
	private static final Logger logger = LoggerFactory.getLogger(MainNavigator.class);
	private static MainController mainController;
	private static ObservableList<Node> pages = FXCollections.observableArrayList();
	
	public static void setMainController(MainController controller) {
		mainController = controller;
	}
	
	public static void navigate(String fxmlFile) {
		Node content = null;
		try {
			content = FXMLLoader.load(MainController.class.getResource(fxmlFile));
			mainController.setContent(content);
			pages.add(content);
		} catch(IOException e) {
			System.err.println(String.format("Could not load fxml file: %s", e.getMessage()));
		}
	}
	
	
	public static boolean canGoBack() {
		return pages.size() >= 2;
	}
	
	public static void goBack() {
		if(canGoBack()) {
			int previous = pages.size()-2;
			pages.remove(pages.size()-1);
			mainController.setContent(pages.get(previous));
		} else {
			// TODO: what should we do here? Throw exception, do nothgin, log, ... :)
			logger.warn("Cannot go back (number of pages: {})", pages.size());
		}
	}
}<commit_msg>+ Main Navigator: wrap the page (pane) into a DecorationPane (allows to decorate and e.g. validate forms) Note: may need to adapt this and only use it when we really need it. <commit_after>package org.peerbox.presenter;


import java.io.IOException;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import javafx.collections.FXCollections;
import javafx.collections.ObservableList;
import javafx.fxml.FXMLLoader;
import javafx.scene.Node;
import javafx.scene.layout.Pane;
import jidefx.scene.control.decoration.DecorationPane;

public class MainNavigator {
	
	private static final Logger logger = LoggerFactory.getLogger(MainNavigator.class);
	private static MainController mainController;
	private static ObservableList<Node> pages = FXCollections.observableArrayList();
	
	public static void setMainController(MainController controller) {
		mainController = controller;
	}
	
	public static void navigate(String fxmlFile) {
		Pane content = null;
		try {
			content = FXMLLoader.load(MainController.class.getResource(fxmlFile));
			mainController.setContent(new DecorationPane(content));
			pages.add(content);
		} catch(IOException e) {
			System.err.println(String.format("Could not load fxml file: %s", e.getMessage()));
		}
	}
	
	
	public static boolean canGoBack() {
		return pages.size() >= 2;
	}
	
	public static void goBack() {
		if(canGoBack()) {
			int previous = pages.size()-2;
			pages.remove(pages.size()-1);
			mainController.setContent(pages.get(previous));
		} else {
			// TODO: what should we do here? Throw exception, do nothgin, log, ... :)
			logger.warn("Cannot go back (number of pages: {})", pages.size());
		}
	}
}
{'fraction_non_alphanumeric': 0.11510554089709762, 'fraction_numerical': 0.0032981530343007917, 'mean_word_length': 4.679775280898877, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 8}, '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': '7319894', 'n_tokens_mistral': 995, 'n_tokens_neox': 921, 'n_words': 235}