Some improvements to the designer
This commit is contained in:
parent
9e107c849f
commit
df651e7016
8 changed files with 146 additions and 27 deletions
|
@ -68,5 +68,6 @@ public class ManualDesigner extends Application {
|
||||||
controller.image.setFitHeight(1000);
|
controller.image.setFitHeight(1000);
|
||||||
controller.image.setFitWidth(1000);
|
controller.image.setFitWidth(1000);
|
||||||
controller.image.fitWidthProperty().bind(controller.renderPane.widthProperty());
|
controller.image.fitWidthProperty().bind(controller.renderPane.widthProperty());
|
||||||
|
controller.image.fitHeightProperty().bind(controller.renderPane.heightProperty());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,14 +0,0 @@
|
||||||
package techreborn.manual.designer.exporter;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Created by Mark on 05/04/2016.
|
|
||||||
*/
|
|
||||||
public class Exporter {
|
|
||||||
|
|
||||||
public static void export(){
|
|
||||||
|
|
||||||
//TODO things
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
|
@ -0,0 +1,12 @@
|
||||||
|
package techreborn.manual.designer.fileUtils;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by Mark on 05/04/2016.
|
||||||
|
*/
|
||||||
|
public class LoadSystem {
|
||||||
|
|
||||||
|
public static void load(){}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,36 @@
|
||||||
|
package techreborn.manual.designer.fileUtils;
|
||||||
|
|
||||||
|
import javafx.scene.control.TreeItem;
|
||||||
|
import techreborn.lib.ModInfo;
|
||||||
|
import techreborn.manual.saveFormat.Entry;
|
||||||
|
import techreborn.manual.saveFormat.ManualFormat;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by Mark on 05/04/2016.
|
||||||
|
*/
|
||||||
|
public class SaveSystem {
|
||||||
|
|
||||||
|
public static HashMap<TreeItem, Entry> entries = new HashMap<>();
|
||||||
|
|
||||||
|
public static ManualFormat master;
|
||||||
|
|
||||||
|
public static void export(){
|
||||||
|
|
||||||
|
List<Entry> entrieList = new ArrayList<>();
|
||||||
|
for(Object object : entries.entrySet().toArray()){
|
||||||
|
Entry entry = (Entry) object;
|
||||||
|
entrieList.add(entry);
|
||||||
|
}
|
||||||
|
System.out.println(entrieList);
|
||||||
|
if(master == null){
|
||||||
|
master = new ManualFormat("TechReborn", ModInfo.MOD_ID, entrieList);
|
||||||
|
}
|
||||||
|
//TODO things
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -1,14 +1,25 @@
|
||||||
package techreborn.manual.designer.windows;
|
package techreborn.manual.designer.windows;
|
||||||
|
|
||||||
|
import javafx.event.ActionEvent;
|
||||||
import javafx.event.Event;
|
import javafx.event.Event;
|
||||||
import javafx.scene.control.Button;
|
import javafx.scene.control.Button;
|
||||||
|
import javafx.scene.control.ChoiceDialog;
|
||||||
import javafx.scene.control.MenuBar;
|
import javafx.scene.control.MenuBar;
|
||||||
import javafx.scene.control.SplitPane;
|
import javafx.scene.control.SplitPane;
|
||||||
import javafx.scene.control.TextArea;
|
import javafx.scene.control.TextArea;
|
||||||
|
import javafx.scene.control.TextInputDialog;
|
||||||
import javafx.scene.control.TreeItem;
|
import javafx.scene.control.TreeItem;
|
||||||
import javafx.scene.control.TreeView;
|
import javafx.scene.control.TreeView;
|
||||||
import javafx.scene.image.ImageView;
|
import javafx.scene.image.ImageView;
|
||||||
import javafx.scene.layout.AnchorPane;
|
import javafx.scene.layout.AnchorPane;
|
||||||
|
import techreborn.manual.designer.ManualCatergories;
|
||||||
|
import techreborn.manual.designer.fileUtils.LoadSystem;
|
||||||
|
import techreborn.manual.designer.fileUtils.SaveSystem;
|
||||||
|
import techreborn.manual.saveFormat.Entry;
|
||||||
|
|
||||||
|
import java.awt.*;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Optional;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by Mark on 05/04/2016.
|
* Created by Mark on 05/04/2016.
|
||||||
|
@ -21,13 +32,71 @@ public class MainWindowController {
|
||||||
public AnchorPane renderPane;
|
public AnchorPane renderPane;
|
||||||
public Button buttonNew;
|
public Button buttonNew;
|
||||||
public TextArea textInput;
|
public TextArea textInput;
|
||||||
|
public Button buttonDelete;
|
||||||
|
|
||||||
public void newItem(Event event) {
|
public void newItem(Event event) {
|
||||||
if(treeList.getSelectionModel().getSelectedItem() instanceof TreeItem){
|
if(treeList.getSelectionModel().getSelectedItem() instanceof TreeItem){
|
||||||
TreeItem item = (TreeItem) treeList.getSelectionModel().getSelectedItem();
|
TreeItem item = (TreeItem) treeList.getSelectionModel().getSelectedItem();
|
||||||
item.getChildren().add(new TreeItem<String>("hi"));
|
if(item == ManualCatergories.blocks || item == ManualCatergories.items){
|
||||||
item.setExpanded(true);
|
TextInputDialog dialog = new TextInputDialog("");
|
||||||
}
|
dialog.setTitle("Name?");
|
||||||
|
dialog.setContentText("Name of item:");
|
||||||
|
Optional<String> result = dialog.showAndWait();
|
||||||
|
if(result.isPresent()){
|
||||||
|
TreeItem<String> newItem = new TreeItem<>(result.get());
|
||||||
|
Entry entry = new Entry();
|
||||||
|
entry.name = result.get();
|
||||||
|
ArrayList<String> choices = new ArrayList<>();
|
||||||
|
choices.add("Text");
|
||||||
|
choices.add("Image");
|
||||||
|
choices.add("Recipe");
|
||||||
|
|
||||||
|
ChoiceDialog<String> choiceDialog = new ChoiceDialog<>("Text", choices);
|
||||||
|
choiceDialog.setTitle("Type?");
|
||||||
|
Optional<String> choiceResult = choiceDialog.showAndWait();
|
||||||
|
if(choiceResult.isPresent()){
|
||||||
|
System.out.println(choiceResult.get());
|
||||||
|
entry.type = choiceResult.get();
|
||||||
|
} else {
|
||||||
|
Toolkit.getDefaultToolkit().beep();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
item.getChildren().add(newItem);
|
||||||
|
SaveSystem.entries.put(newItem, entry);
|
||||||
|
} else {
|
||||||
|
Toolkit.getDefaultToolkit().beep();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
Toolkit.getDefaultToolkit().beep();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void deleteItem(Event event) {
|
||||||
|
if(treeList.getSelectionModel().getSelectedItem() instanceof TreeItem){
|
||||||
|
TreeItem item = (TreeItem) treeList.getSelectionModel().getSelectedItem();
|
||||||
|
TreeItem parent = item.getParent();
|
||||||
|
if(parent != null){
|
||||||
|
if(parent == ManualCatergories.blocks || parent == ManualCatergories.items){
|
||||||
|
parent.getChildren().remove(item);
|
||||||
|
} else {
|
||||||
|
Toolkit.getDefaultToolkit().beep();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void save(ActionEvent actionEvent) {
|
||||||
|
SaveSystem.export();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void open(ActionEvent actionEvent) {
|
||||||
|
LoadSystem.load();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void close(ActionEvent actionEvent) {
|
||||||
|
//TODO checks to make sure its being saved
|
||||||
|
System.exit(0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,16 +5,18 @@ package techreborn.manual.saveFormat;
|
||||||
*/
|
*/
|
||||||
public class Entry {
|
public class Entry {
|
||||||
|
|
||||||
String registryName;
|
public String name;
|
||||||
|
|
||||||
MetaData meta;
|
public String registryName;
|
||||||
|
|
||||||
|
public MetaData meta;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This says what type of page it is, crafting, image, ect
|
* This says what type of page it is, crafting, image, ect
|
||||||
*
|
*
|
||||||
* //TODO use class name?
|
* //TODO use class name?
|
||||||
*/
|
*/
|
||||||
String type;
|
public String type;
|
||||||
|
|
||||||
EntryData data;
|
public EntryData data;
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,7 +11,14 @@ public class ManualFormat {
|
||||||
|
|
||||||
String modId;
|
String modId;
|
||||||
|
|
||||||
List<Entry> blocks;
|
List<Entry> entries;
|
||||||
|
|
||||||
List<Entry> items;
|
public ManualFormat(String name, String modId, List<Entry> entries) {
|
||||||
|
this.name = name;
|
||||||
|
this.modId = modId;
|
||||||
|
this.entries = entries;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ManualFormat() {
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,19 +7,21 @@
|
||||||
<?import javafx.scene.control.MenuItem?>
|
<?import javafx.scene.control.MenuItem?>
|
||||||
<?import javafx.scene.control.SplitPane?>
|
<?import javafx.scene.control.SplitPane?>
|
||||||
<?import javafx.scene.control.TextArea?>
|
<?import javafx.scene.control.TextArea?>
|
||||||
|
<?import javafx.scene.control.TextField?>
|
||||||
<?import javafx.scene.control.TreeView?>
|
<?import javafx.scene.control.TreeView?>
|
||||||
<?import javafx.scene.image.ImageView?>
|
<?import javafx.scene.image.ImageView?>
|
||||||
<?import javafx.scene.layout.AnchorPane?>
|
<?import javafx.scene.layout.AnchorPane?>
|
||||||
<?import javafx.scene.layout.VBox?>
|
<?import javafx.scene.layout.VBox?>
|
||||||
|
|
||||||
<VBox maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="400.0" prefWidth="600.0" xmlns="http://javafx.com/javafx/8.0.65" xmlns:fx="http://javafx.com/fxml/1" fx:controller="techreborn.manual.designer.windows.MainWindowController">
|
<VBox maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="550.0" prefWidth="900.0" xmlns="http://javafx.com/javafx/8.0.65" xmlns:fx="http://javafx.com/fxml/1" fx:controller="techreborn.manual.designer.windows.MainWindowController">
|
||||||
<children>
|
<children>
|
||||||
<MenuBar fx:id="menuBar">
|
<MenuBar fx:id="menuBar">
|
||||||
<menus>
|
<menus>
|
||||||
<Menu mnemonicParsing="false" text="File">
|
<Menu mnemonicParsing="false" text="File">
|
||||||
<items>
|
<items>
|
||||||
<MenuItem mnemonicParsing="false" text="Save" />
|
<MenuItem mnemonicParsing="false" onAction="#save" text="Save" />
|
||||||
<MenuItem mnemonicParsing="false" text="Close" />
|
<MenuItem mnemonicParsing="false" onAction="#open" text="Open" />
|
||||||
|
<MenuItem mnemonicParsing="false" onAction="#close" text="Close" />
|
||||||
</items>
|
</items>
|
||||||
</Menu>
|
</Menu>
|
||||||
<Menu mnemonicParsing="false" text="Edit">
|
<Menu mnemonicParsing="false" text="Edit">
|
||||||
|
@ -40,6 +42,7 @@
|
||||||
<AnchorPane prefHeight="49.0" prefWidth="175.0">
|
<AnchorPane prefHeight="49.0" prefWidth="175.0">
|
||||||
<children>
|
<children>
|
||||||
<Button fx:id="buttonNew" layoutX="8.0" layoutY="12.0" mnemonicParsing="false" onMouseClicked="#newItem" text="New" />
|
<Button fx:id="buttonNew" layoutX="8.0" layoutY="12.0" mnemonicParsing="false" onMouseClicked="#newItem" text="New" />
|
||||||
|
<Button fx:id="buttonDelete" layoutX="54.0" layoutY="12.0" mnemonicParsing="false" onMouseClicked="#deleteItem" text="Delete" />
|
||||||
</children>
|
</children>
|
||||||
</AnchorPane>
|
</AnchorPane>
|
||||||
</children>
|
</children>
|
||||||
|
@ -49,10 +52,13 @@
|
||||||
<AnchorPane fx:id="renderPane" minHeight="0.0" minWidth="0.0" prefHeight="358.0" prefWidth="417.0">
|
<AnchorPane fx:id="renderPane" minHeight="0.0" minWidth="0.0" prefHeight="358.0" prefWidth="417.0">
|
||||||
<children>
|
<children>
|
||||||
<ImageView fx:id="image" fitHeight="298.0" fitWidth="417.0" pickOnBounds="true" preserveRatio="true" AnchorPane.bottomAnchor="75.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0" />
|
<ImageView fx:id="image" fitHeight="298.0" fitWidth="417.0" pickOnBounds="true" preserveRatio="true" AnchorPane.bottomAnchor="75.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0" />
|
||||||
<AnchorPane prefHeight="75.0" prefWidth="417.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0">
|
<AnchorPane prefHeight="98.0" prefWidth="627.0" style="-fx-background-color: lightgrey;" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0">
|
||||||
<children>
|
<children>
|
||||||
<Label layoutY="6.0" text="Settings" />
|
<Label layoutY="6.0" text="Settings" />
|
||||||
<TextArea fx:id="textInput" layoutX="43.0" layoutY="8.0" maxWidth="250.0" prefHeight="59.0" prefWidth="250.0" AnchorPane.bottomAnchor="8.0" AnchorPane.rightAnchor="8.0" AnchorPane.topAnchor="8.0" />
|
<TextArea fx:id="textInput" layoutX="43.0" layoutY="8.0" maxWidth="250.0" prefHeight="59.0" prefWidth="250.0" AnchorPane.bottomAnchor="8.0" AnchorPane.rightAnchor="8.0" AnchorPane.topAnchor="8.0" />
|
||||||
|
<TextField layoutX="88.0" layoutY="25.0" />
|
||||||
|
<Label layoutX="6.0" layoutY="29.0" text="Registry Name" />
|
||||||
|
<Button layoutX="19.0" layoutY="59.0" mnemonicParsing="false" text="Set meta" />
|
||||||
</children>
|
</children>
|
||||||
</AnchorPane>
|
</AnchorPane>
|
||||||
</children>
|
</children>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue