filtre
This commit is contained in:
@@ -1,18 +1,69 @@
|
||||
package app.controllers;
|
||||
|
||||
import java.io.File;
|
||||
import java.net.URL;
|
||||
import java.util.ResourceBundle;
|
||||
|
||||
import com.google.common.eventbus.EventBus;
|
||||
|
||||
import app.model.Model;
|
||||
import javafx.fxml.FXML;
|
||||
import javafx.fxml.Initializable;
|
||||
import javafx.scene.control.MenuBar;
|
||||
import javafx.stage.DirectoryChooser;
|
||||
import javafx.stage.FileChooser;
|
||||
import javafx.stage.Stage;
|
||||
|
||||
public class MenubarController implements Initializable, Controller {
|
||||
|
||||
|
||||
private EventBus eventBus;
|
||||
private Model model;
|
||||
|
||||
@FXML
|
||||
private MenuBar menubar;
|
||||
|
||||
@FXML
|
||||
public String handleOpenFile() {
|
||||
FileChooser fc = new FileChooser();
|
||||
fc.setTitle("Open File");
|
||||
Stage stage = (Stage) menubar.getScene().getWindow();
|
||||
|
||||
File chosenFile = fc.showOpenDialog(stage);
|
||||
String corFormat = chosenFile.getAbsolutePath().replace("\\", "\\\\");
|
||||
System.out.println(chosenFile.getAbsolutePath());
|
||||
System.out.println(corFormat);
|
||||
|
||||
return corFormat;
|
||||
}
|
||||
|
||||
@FXML
|
||||
public String handleOpenProject() {
|
||||
DirectoryChooser dc = new DirectoryChooser();
|
||||
dc.setTitle("Open Project");
|
||||
Stage stage = (Stage) menubar.getScene().getWindow();
|
||||
|
||||
File chosenDir = dc.showDialog(stage);
|
||||
String corFormat = chosenDir.getAbsolutePath().replace("\\", "\\\\");
|
||||
System.out.println(chosenDir.getAbsolutePath());
|
||||
System.out.println(corFormat);
|
||||
|
||||
return corFormat;
|
||||
}
|
||||
|
||||
// @FXML
|
||||
// public void handleSaveFile() {
|
||||
// FileChooser fc = new FileChooser();
|
||||
// fc.setTitle("Save File");
|
||||
// Stage stage = (Stage) menubar.getScene().getWindow();
|
||||
|
||||
// FileChooser.ExtensionFilter extentionjava = new
|
||||
// FileChooser.ExtensionFilter(".java");
|
||||
// FileChooser.ExtensionFilter extentionmd = new
|
||||
// FileChooser.ExtensionFilter(".md");
|
||||
// fc.getExtensionFilters().addAll(extentionjava, extentionmd);
|
||||
// fc.showOpenDialog(stage);
|
||||
// }
|
||||
|
||||
@Override
|
||||
public void initialize(URL url, ResourceBundle resourceBundle) {
|
||||
// TODO: implement
|
||||
@@ -26,11 +77,11 @@ public class MenubarController implements Initializable, Controller {
|
||||
|
||||
/**
|
||||
* Links the controller to the global model
|
||||
*
|
||||
* @param model The model to be linked
|
||||
*/
|
||||
public void setModel(Model model) {
|
||||
this.model = model;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user