2018-06-19 07:15:37 +00:00
|
|
|
package gui;
|
|
|
|
|
|
|
|
import java.io.IOException;
|
|
|
|
|
2018-11-20 08:52:16 +00:00
|
|
|
import javafx.scene.layout.AnchorPane;
|
2018-06-19 07:15:37 +00:00
|
|
|
import org.apache.logging.log4j.LogManager;
|
|
|
|
import org.apache.logging.log4j.Logger;
|
|
|
|
import org.kordamp.ikonli.fontawesome.FontAwesome;
|
|
|
|
import org.kordamp.ikonli.javafx.FontIcon;
|
|
|
|
|
|
|
|
import data.Corpus;
|
|
|
|
import javafx.application.Application;
|
|
|
|
import javafx.fxml.FXML;
|
|
|
|
import javafx.fxml.FXMLLoader;
|
|
|
|
import javafx.scene.Parent;
|
|
|
|
import javafx.scene.Scene;
|
|
|
|
import javafx.scene.control.Alert;
|
|
|
|
import javafx.scene.control.Tab;
|
|
|
|
import javafx.scene.control.TabPane;
|
|
|
|
import javafx.stage.Stage;
|
|
|
|
|
|
|
|
public class GUIController extends Application {
|
|
|
|
public final static Logger logger = LogManager.getLogger(GUIController.class);
|
|
|
|
|
2018-11-20 08:52:16 +00:00
|
|
|
@FXML
|
|
|
|
public AnchorPane gui;
|
2018-06-19 07:15:37 +00:00
|
|
|
@FXML
|
|
|
|
public Tab StringLevelTabNew2;
|
|
|
|
@FXML
|
|
|
|
public Tab OneWordAnalysisTab;
|
|
|
|
@FXML
|
|
|
|
public Tab CharacterLevelTabNew;
|
|
|
|
@FXML
|
|
|
|
public Tab corpusTab;
|
|
|
|
public TabPane tabPane;
|
|
|
|
@FXML
|
|
|
|
private CharacterAnalysisTab catController;
|
|
|
|
@FXML
|
|
|
|
private static Parent sat;
|
|
|
|
@FXML
|
|
|
|
private StringAnalysisTabNew2 satNew2Controller;
|
|
|
|
@FXML
|
|
|
|
private static Parent satNew2;
|
|
|
|
@FXML
|
|
|
|
private OneWordAnalysisTab oneWordTabController;
|
|
|
|
@FXML
|
|
|
|
private static Parent oneWordTab;
|
|
|
|
@FXML
|
|
|
|
private CorpusTab ctController;
|
|
|
|
@FXML
|
|
|
|
private Parent ct;
|
|
|
|
//@FXML
|
|
|
|
//private WordFormationTab wfController;
|
|
|
|
@FXML
|
|
|
|
private Parent wf;
|
|
|
|
@FXML
|
|
|
|
private WordLevelTab wlController;
|
|
|
|
@FXML
|
|
|
|
private Parent wl;
|
|
|
|
@FXML
|
|
|
|
private FiltersForSolar ffsController;
|
|
|
|
@FXML
|
|
|
|
private Parent ffs;
|
|
|
|
@FXML
|
|
|
|
private SelectedFiltersPane sfpController;
|
|
|
|
@FXML
|
|
|
|
private Parent sfp;
|
|
|
|
@FXML
|
|
|
|
public Tab stringLevelTab;
|
|
|
|
@FXML
|
|
|
|
public Tab wordLevelTab;
|
|
|
|
/*@FXML
|
|
|
|
public Tab wordFormationTab;*/
|
|
|
|
|
|
|
|
|
|
|
|
@FXML
|
|
|
|
public Tab filterTab;
|
|
|
|
public Stage stage;
|
|
|
|
|
|
|
|
private Corpus corpus;
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void start(Stage primaryStage) throws IOException {
|
|
|
|
Parent root = FXMLLoader.load(getClass().getResource("/GUI.fxml"));
|
2018-07-31 06:58:17 +00:00
|
|
|
// Parent root = FXMLLoader.load(ResourceLookup.resources.url("GUI.fxml"));
|
2018-06-19 07:15:37 +00:00
|
|
|
primaryStage.setTitle("GUI");
|
|
|
|
Scene scene = new Scene(root, 800, 600);
|
|
|
|
// https://github.com/dicolar/jbootx
|
|
|
|
// scene.getStylesheets().add(GUIController.class.getResource("bootstrap3.css").toExternalForm())
|
|
|
|
primaryStage.setScene(scene);
|
|
|
|
stage = primaryStage;
|
|
|
|
primaryStage.show();
|
|
|
|
}
|
|
|
|
|
|
|
|
public static void main(String[] args) {
|
|
|
|
launch(args);
|
|
|
|
}
|
|
|
|
|
|
|
|
public void initialize() {
|
2018-11-20 08:52:16 +00:00
|
|
|
// add CSS style
|
|
|
|
gui.getStylesheets().add("style.css");
|
|
|
|
gui.getStyleClass().add("root");
|
|
|
|
|
2018-06-19 07:15:37 +00:00
|
|
|
corpus = new Corpus();
|
|
|
|
ctController.setCorpus(corpus);
|
|
|
|
ctController.setFilterTab(filterTab);
|
|
|
|
ctController.setStringLevelTabNew2(StringLevelTabNew2);
|
|
|
|
ctController.setOneWordAnalysisTab(OneWordAnalysisTab);
|
|
|
|
ctController.setCharacterLevelTab(CharacterLevelTabNew);
|
|
|
|
ctController.setSatNew2Controller(satNew2Controller);
|
|
|
|
ctController.setOneWordTabController(oneWordTabController);
|
|
|
|
ctController.setCatController(catController);
|
|
|
|
//ctController.setWfController(wfController);
|
|
|
|
ctController.setWlController(wlController);
|
|
|
|
ctController.setTabPane(tabPane);
|
|
|
|
ctController.setFfsController(ffsController);
|
|
|
|
//ctController.setWordFormationTab(wordFormationTab);
|
|
|
|
ctController.setWordLevelTab(wordLevelTab);
|
2018-06-27 08:14:40 +00:00
|
|
|
//System.out.println(com.sun.javafx.runtime.VersionInfo.getRuntimeVersion());
|
|
|
|
|
2018-06-19 07:15:37 +00:00
|
|
|
ctController.setHostServices(getHostServices());
|
|
|
|
|
|
|
|
satNew2Controller.setCorpus(corpus);
|
|
|
|
satNew2Controller.setHostServices(getHostServices());
|
|
|
|
oneWordTabController.setCorpus(corpus);
|
|
|
|
oneWordTabController.setHostServices(getHostServices());
|
|
|
|
catController.setCorpus(corpus);
|
|
|
|
catController.setHostServices(getHostServices());
|
|
|
|
//wfController.setCorpus(corpus);
|
|
|
|
//wfController.setHostServices(getHostServices());
|
|
|
|
wlController.setCorpus(corpus);
|
|
|
|
wlController.setHostServices(getHostServices());
|
|
|
|
ffsController.setSatNew2Controller(satNew2Controller);
|
|
|
|
ffsController.setOneWordTabController(oneWordTabController);
|
|
|
|
ffsController.setCatController(catController);
|
|
|
|
//ffsController.setWfController(wfController);
|
|
|
|
ffsController.setWlController(wlController);
|
|
|
|
ffsController.setHostServices(getHostServices());
|
|
|
|
|
|
|
|
// set tab icons
|
|
|
|
corpusTab.setGraphic(new FontIcon(FontAwesome.COG));
|
|
|
|
filterTab.setGraphic(new FontIcon(FontAwesome.FILTER));
|
|
|
|
|
|
|
|
// hide filter tab
|
|
|
|
tabPane.getTabs().removeAll(filterTab);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void showAlert(Alert.AlertType alertType, String headerText, String contentText) {
|
|
|
|
Alert alert = new Alert(alertType);
|
|
|
|
alert.setTitle(Messages.windowTitles.get(alertType));
|
|
|
|
alert.setHeaderText(headerText != null ? headerText : "");
|
|
|
|
alert.setContentText(contentText != null ? contentText : "");
|
|
|
|
alert.showAndWait();
|
|
|
|
}
|
|
|
|
|
|
|
|
static void showAlert(Alert.AlertType alertType, String headerText) {
|
|
|
|
showAlert(alertType, headerText, null);
|
|
|
|
}
|
|
|
|
}
|