Skip to content

Commit

Permalink
Changed all default editor to the treeView version
Browse files Browse the repository at this point in the history
Users should now be able to edit all existing data
  • Loading branch information
rexc159 committed Mar 8, 2018
1 parent 1fac3b3 commit 6975b34
Show file tree
Hide file tree
Showing 8 changed files with 14 additions and 36 deletions.
7 changes: 1 addition & 6 deletions src/StellarisDK/FileClasses/Component/Component.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,6 @@ public Component() {
ui = new CompUI(this);
}

public Component(int type) {
super();
ui = new CompUI(this);
}

public Component(String input) {
super(input);
ui = new CompUI(this);
Expand Down Expand Up @@ -48,7 +43,7 @@ public void setType(int type){

@Override
public Component createNew() {
return new Component(0);
return new Component();
}

public String getGroup() {
Expand Down
1 change: 1 addition & 0 deletions src/StellarisDK/FileClasses/Event.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ public class Event extends GenericData {

public Event() {
super();
this.type = "event";
ui = new EventUI(this);
}

Expand Down
2 changes: 1 addition & 1 deletion src/StellarisDK/GUI/CompUI.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public class CompUI extends AbstractUI {
TreeView treeView;

public CompUI(Component obj) {
init("FXML/treeUI.fxml");
init("FXML/default.fxml");
window.setText("Component Editor");
// loadCompSize();
this.obj = obj;
Expand Down
8 changes: 6 additions & 2 deletions src/StellarisDK/GUI/FXML/default.fxml
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>

<?import javafx.scene.control.Button?>
<?import javafx.scene.control.Label?>
<?import javafx.scene.layout.AnchorPane?>
<?import javafx.scene.control.TreeView?>
<?import javafx.scene.layout.*?>
<AnchorPane fx:id="main" xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1">
<children>
<Label text="Editor Under Construction :(" />
<Label layoutY="4.0" text="Editor Under Construction :(" />
<TreeView fx:id="treeView" layoutY="25.0" maxWidth="1.7976931348623157E308" prefHeight="400.0" prefWidth="350.0" AnchorPane.bottomAnchor="40.0" AnchorPane.leftAnchor="0.0" AnchorPane.topAnchor="25.0" />
<Button id="btn_save" fx:id="btn_save" layoutX="197.0" layoutY="425.0" mnemonicParsing="false" text="Save" AnchorPane.bottomAnchor="5.0" AnchorPane.rightAnchor="5.0" />
</children>
</AnchorPane>
11 changes: 0 additions & 11 deletions src/StellarisDK/GUI/FXML/eventFX.fxml

This file was deleted.

11 changes: 0 additions & 11 deletions src/StellarisDK/GUI/FXML/treeUI.fxml

This file was deleted.

2 changes: 1 addition & 1 deletion src/StellarisDK/GUI/ModDescUI.java
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public void handle(ListView.EditEvent event) {
if (event.getClickCount() == 2) {
Node cell = event.getPickResult().getIntersectedNode();
if (cell instanceof ListView || ((ListCell) cell).getItem() == null) {
((ListView) node).getItems().add(((ListView) node).getItems().size(), new String());
((ListView) node).getItems().add(((ListView) node).getItems().size());
}
}
});
Expand Down
8 changes: 4 additions & 4 deletions src/StellarisDK/GUI/guiController.java
Original file line number Diff line number Diff line change
Expand Up @@ -189,9 +189,7 @@ private ContextMenu createCM(TreeCell cell) {
});
MenuItem delete = new MenuItem("Delete");
delete.setOnAction(event -> {
if (cell.getTreeItem().getValue() instanceof GenericData) {
cell.getTreeItem().getParent().getChildren().remove(cell.getTreeItem());
} else if (cell.getTreeItem().getValue().toString().contains(".txt")) {
if(cell.getItem().toString().contains(".txt") || cell.getTreeItem().getParent().getValue().toString().contains(".txt")){
cell.getTreeItem().getParent().getChildren().remove(cell.getTreeItem());
}
});
Expand Down Expand Up @@ -226,7 +224,7 @@ private TreeItem createNew(String type) {
case "component_sets":
return new TreeItem<>(new CompSet());
case "component_templates":
return new TreeItem<>(new Component(0));
return new TreeItem<>(new Component());
case "country_types":
case "defines":
case "deposits":
Expand Down Expand Up @@ -289,7 +287,9 @@ private TreeItem createNew(String type) {
case "tradition_categories":
case "traditions":
case "traits":
break;
case "events":
return new TreeItem<>(new Event());
case "localisation":
}
return new TreeItem<>("Not Implemented");
Expand Down

0 comments on commit 6975b34

Please sign in to comment.