package controller;

import javafx.beans.binding.Bindings;
import javafx.beans.property.DoubleProperty;
import javafx.beans.property.ObjectProperty;
import javafx.event.ActionEvent;
import javafx.fxml.FXML;
import javafx.scene.control.Button;
import javafx.scene.control.ListView;
import javafx.scene.control.TextArea;
import javafx.scene.layout.AnchorPane;
import javafx.stage.FileChooser;
import javafx.stage.Stage;
import model.FileModel;

import java.io.File;
import java.util.ArrayList;

/**
 * Created by SH on 2016-05-11.
 */
public class EditorSceneController {

    @FXML private TextArea textArea;
    @FXML private Button btnFileOpen;

    @FXML
    private void initialize(){

        // ListView와 TextArea의 스크롤을 동기화시킨다.
        DoubleProperty textAreaScrollTo = textArea.scrollTopProperty();

    }

    @FXML // 불러오기 버튼을 클릭했을 때의 동작
    private void onTBBtnLoadClicked(ActionEvent event) {
        //File chooser code
        Stage s = (Stage)btnFileOpen.getScene().getWindow();

        FileChooser fileChooser = new FileChooser();
        fileChooser.setTitle("Open Resource File");
        fileChooser.getExtensionFilters().addAll(
                new FileChooser.ExtensionFilter("Text Files", "*.txt"),
                new FileChooser.ExtensionFilter("Image Files", "*.png", "*.jpg", "*.gif"),
                new FileChooser.ExtensionFilter("Audio Files", "*.wav", "*.mp3", "*.aac"),
                new FileChooser.ExtensionFilter("All Files", "*.*"));

        File selectedFile = fileChooser.showOpenDialog(s);

        //Show text in Edit panel

        FileModel.getModel().readFile(selectedFile.getPath());

        ArrayList<String> strings = FileModel.getModel().getStringArrayList();

        for(String temp : strings) textArea.appendText(temp);
    }

}

@@ -411,16 +411,42 @@
 .Stage;%0A
+import model.FileManager;%0A
 import m
@@ -1600,29 +1600,53 @@
    FileM
-odel.get
+anager.getFileManager().GetFile
 Model
+L
 ().readF
@@ -1720,21 +1720,45 @@
 ileM
-odel.get
+anager.getFileManager().GetFile
 Model
+L
 ().g

modify what is about FileModel to what is for FileManager