add db editor screen
This commit is contained in:
@@ -118,6 +118,7 @@ public class Main extends Application {
|
||||
Screeners.loadLoginStage(getUrl("login.fxml"));
|
||||
Screeners.loadHelperStage(getUrl("helper.fxml"));
|
||||
Screeners.loadVendorFilterStage(getUrl("vFilter.fxml"));
|
||||
Screeners.loadDBEditorStage(getUrl("db/dbeditor.fxml"));
|
||||
}
|
||||
|
||||
private static URL getUrl(String filename) throws MalformedURLException {
|
||||
|
||||
@@ -321,4 +321,8 @@ public class MainController {
|
||||
public void showTrack(){
|
||||
tabs.getSelectionModel().select(track);
|
||||
}
|
||||
|
||||
public void showDBEditor(){
|
||||
Screeners.showDBEditor();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,6 +14,7 @@ import org.controlsfx.dialog.Dialogs;
|
||||
import ru.trader.EMDNUpdater;
|
||||
import ru.trader.core.MarketFilter;
|
||||
import ru.trader.core.VendorFilter;
|
||||
import ru.trader.db.controllers.DBEditorController;
|
||||
import ru.trader.model.*;
|
||||
import ru.trader.view.support.CustomBuilderFactory;
|
||||
import ru.trader.view.support.Localization;
|
||||
@@ -37,6 +38,7 @@ public class Screeners {
|
||||
private static Parent loginScreen;
|
||||
private static Parent helperScreen;
|
||||
private static Parent vFilterScreen;
|
||||
private static Parent dbEditorScreen;
|
||||
|
||||
private static MainController mainController;
|
||||
private static ItemDescController itemDescController;
|
||||
@@ -51,6 +53,7 @@ public class Screeners {
|
||||
private static LoginController loginController;
|
||||
private static HelperController helperController;
|
||||
private static VendorFilterController vFilterController;
|
||||
private static DBEditorController dbEditorController;
|
||||
|
||||
private static FXMLLoader initLoader(URL url){
|
||||
FXMLLoader loader = new FXMLLoader(url, Localization.getResources());
|
||||
@@ -161,6 +164,13 @@ public class Screeners {
|
||||
vFilterController = loader.getController();
|
||||
}
|
||||
|
||||
public static void loadDBEditorStage(URL fxml) throws IOException {
|
||||
FXMLLoader loader = initLoader(fxml);
|
||||
dbEditorScreen = loader.load();
|
||||
addStylesheet(dbEditorScreen);
|
||||
dbEditorController = loader.getController();
|
||||
}
|
||||
|
||||
public static void show(Node node){
|
||||
mainController.getMainPane().setCenter(node);
|
||||
}
|
||||
@@ -219,6 +229,7 @@ public class Screeners {
|
||||
public static void closeAll() {
|
||||
itemDescController.close();
|
||||
helperController.close();
|
||||
dbEditorController.close();
|
||||
}
|
||||
|
||||
public static Optional<OrderModel> showOrders(ObservableList<OrderModel> orders) {
|
||||
@@ -277,13 +288,8 @@ public class Screeners {
|
||||
helperController.show(helperScreen, true);
|
||||
}
|
||||
|
||||
public static void reinitAll() {
|
||||
mainController.init();
|
||||
systemsEditorController.init();
|
||||
vEditorController.init();
|
||||
filterController.init();
|
||||
vFilterController.init();
|
||||
EMDNUpdater.setMarket(MainController.getMarket());
|
||||
public static void showDBEditor(){
|
||||
dbEditorController.show(dbEditorScreen, false);
|
||||
}
|
||||
|
||||
public static void showTrackTab(){
|
||||
@@ -298,4 +304,14 @@ public class Screeners {
|
||||
return vFilterController.showEditDialog(mainScreen, vFilterScreen, filter);
|
||||
}
|
||||
|
||||
public static void reinitAll() {
|
||||
mainController.init();
|
||||
systemsEditorController.init();
|
||||
vEditorController.init();
|
||||
filterController.init();
|
||||
vFilterController.init();
|
||||
dbEditorController.init();
|
||||
EMDNUpdater.setMarket(MainController.getMarket());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,38 @@
|
||||
package ru.trader.db.controllers;
|
||||
|
||||
import javafx.scene.Parent;
|
||||
import javafx.scene.Scene;
|
||||
import javafx.stage.Stage;
|
||||
import ru.trader.controllers.MainController;
|
||||
import ru.trader.model.MarketModel;
|
||||
|
||||
public class DBEditorController {
|
||||
private Stage stage;
|
||||
|
||||
public void show(Parent content, boolean toggle) {
|
||||
if (stage == null){
|
||||
stage = new Stage();
|
||||
Scene scene = new Scene(content);
|
||||
stage.setScene(scene);
|
||||
stage.show();
|
||||
} else {
|
||||
if (toggle && stage.isShowing()){
|
||||
stage.hide();
|
||||
} else {
|
||||
stage.show();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void init(){
|
||||
MarketModel market = MainController.getMarket();
|
||||
//TODO: add init all controllers
|
||||
}
|
||||
|
||||
public void close() {
|
||||
if (stage != null){
|
||||
stage.close();
|
||||
stage = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -60,6 +60,7 @@ main.menu.file.save=Save
|
||||
main.menu.file.import=Import...
|
||||
main.menu.file.export=Export...
|
||||
main.menu.edit=Edit
|
||||
main.menu.edit.dbEditor=DB Editor
|
||||
main.menu.edit.addSystem=Add System
|
||||
main.menu.edit.editSystem=Edit System
|
||||
main.menu.edit.removeSystem=Delete System
|
||||
|
||||
@@ -61,6 +61,7 @@ main.menu.file.save=\u0421\u043E\u0445\u0440\u0430\u043D\u0438\u0442\u044C
|
||||
main.menu.file.import=\u0418\u043C\u043F\u043E\u0440\u0442...
|
||||
main.menu.file.export=\u042D\u043A\u0441\u043F\u043E\u0440\u0442...
|
||||
main.menu.edit=\u041F\u0440\u0430\u0432\u043A\u0430
|
||||
main.menu.edit.dbEditor=\u0420\u0435\u0434\u0430\u043A\u0442\u043E\u0440 \u0411\u0414
|
||||
main.menu.edit.addSystem=\u0414\u043E\u0431\u0430\u0432\u0438\u0442\u044C \u0441\u0438\u0441\u0442\u0435\u043C\u0443
|
||||
main.menu.edit.editSystem=\u0420\u0435\u0434\u0430\u043A\u0442\u0438\u0440\u043E\u0432\u0430\u0442\u044C \u0441\u0438\u0441\u0442\u0435\u043C\u0443
|
||||
main.menu.edit.removeSystem=\u0423\u0434\u0430\u043B\u0438\u0442\u044C \u0441\u0438\u0441\u0442\u0435\u043C\u0443
|
||||
|
||||
13
client/src/main/resources/view/db/dbeditor.fxml
Normal file
13
client/src/main/resources/view/db/dbeditor.fxml
Normal file
@@ -0,0 +1,13 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<?import javafx.scene.control.*?>
|
||||
<?import javafx.scene.layout.BorderPane?>
|
||||
<?import javafx.scene.layout.VBox?>
|
||||
<TabPane xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1"
|
||||
fx:controller="ru.trader.db.controllers.DBEditorController"
|
||||
tabClosingPolicy="UNAVAILABLE"
|
||||
>
|
||||
<Tab text="%market.items">
|
||||
<fx:include fx:id="items" source="items.fxml"/>
|
||||
</Tab>
|
||||
</TabPane>
|
||||
@@ -23,6 +23,7 @@
|
||||
<MenuItem text="%main.menu.file.export" onAction="#exportWorld"/>
|
||||
</Menu>
|
||||
<Menu text="%main.menu.edit">
|
||||
<MenuItem text="%main.menu.edit.dbEditor" onAction="#showDBEditor"/>
|
||||
<MenuItem text="%main.menu.edit.addSystem" onAction="#addSystem"/>
|
||||
<MenuItem text="%main.menu.edit.editSystem" onAction="#editSystem"/>
|
||||
<MenuItem text="%main.menu.edit.removeSystem" onAction="#removeSystem"/>
|
||||
|
||||
Reference in New Issue
Block a user