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.setFitWidth(1000);
|
||||
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;
|
||||
|
||||
import javafx.event.ActionEvent;
|
||||
import javafx.event.Event;
|
||||
import javafx.scene.control.Button;
|
||||
import javafx.scene.control.ChoiceDialog;
|
||||
import javafx.scene.control.MenuBar;
|
||||
import javafx.scene.control.SplitPane;
|
||||
import javafx.scene.control.TextArea;
|
||||
import javafx.scene.control.TextInputDialog;
|
||||
import javafx.scene.control.TreeItem;
|
||||
import javafx.scene.control.TreeView;
|
||||
import javafx.scene.image.ImageView;
|
||||
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.
|
||||
|
@ -21,13 +32,71 @@ public class MainWindowController {
|
|||
public AnchorPane renderPane;
|
||||
public Button buttonNew;
|
||||
public TextArea textInput;
|
||||
public Button buttonDelete;
|
||||
|
||||
public void newItem(Event event) {
|
||||
if(treeList.getSelectionModel().getSelectedItem() instanceof TreeItem){
|
||||
TreeItem item = (TreeItem) treeList.getSelectionModel().getSelectedItem();
|
||||
item.getChildren().add(new TreeItem<String>("hi"));
|
||||
item.setExpanded(true);
|
||||
}
|
||||
if(item == ManualCatergories.blocks || item == ManualCatergories.items){
|
||||
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 {
|
||||
|
||||
String registryName;
|
||||
public String name;
|
||||
|
||||
MetaData meta;
|
||||
public String registryName;
|
||||
|
||||
public MetaData meta;
|
||||
|
||||
/**
|
||||
* This says what type of page it is, crafting, image, ect
|
||||
*
|
||||
* //TODO use class name?
|
||||
*/
|
||||
String type;
|
||||
public String type;
|
||||
|
||||
EntryData data;
|
||||
public EntryData data;
|
||||
}
|
||||
|
|
|
@ -11,7 +11,14 @@ public class ManualFormat {
|
|||
|
||||
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() {
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue