Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,25 @@
import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.io.Serializable;

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

/**
* Every instance of this class represents the Model component in the Model-View-Presenter
* architectural pattern.
* <p>
* It is responsible for reading and loading the contents of a given file.
*/
public class FileLoader {
public class FileLoader implements Serializable{

/**
* Generated serial version UID
*/
private static final long serialVersionUID = -4745803872902019069L;

private static final Logger LOGGER = LoggerFactory.getLogger(FileLoader.class);

/**
* Indicates if the file is loaded or not.
Expand All @@ -48,7 +59,8 @@ public class FileLoader {
* Loads the data of the file specified.
*/
public String loadData() {
try (BufferedReader br = new BufferedReader(new FileReader(new File(this.fileName)))) {
String dataFileName = this.fileName;
try (BufferedReader br = new BufferedReader(new FileReader(new File(dataFileName)))) {
StringBuilder sb = new StringBuilder();
String line;

Expand All @@ -60,7 +72,7 @@ public String loadData() {

return sb.toString();
} catch (Exception e) {
e.printStackTrace();
LOGGER.error("File {} does not exist", dataFileName);
}

return null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,20 @@
*/
package com.iluwatar.model.view.presenter;

import java.io.Serializable;

/**
* Every instance of this class represents the Presenter component in the Model-View-Presenter
* architectural pattern.
* <p>
* It is responsible for reacting to the user's actions and update the View component.
*/
public class FileSelectorPresenter {
public class FileSelectorPresenter implements Serializable{

/**
* Generated serial version UID
*/
private static final long serialVersionUID = 1210314339075855074L;

/**
* The View component that the presenter interacts with.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,13 @@
*/
package com.iluwatar.model.view.presenter;

import java.io.Serializable;

/**
* This interface represents the View component in the Model-View-Presenter pattern. It can be
* implemented by either the GUI components, or by the Stub.
*/
public interface FileSelectorView {
public interface FileSelectorView extends Serializable{

/**
* Opens the view.
Expand Down