// Path: Eru/src/main/java/org/assemblits/eru/entities/EruGroup.java
// @Entity
// @Table(name = "eru_group", schema = "public")
// @Inheritance(strategy = InheritanceType.SINGLE_TABLE)
// public class EruGroup {
// 
//     private IntegerProperty id;
//     private StringProperty name;
//     private ObjectProperty<EruType> type;
//     private ObjectProperty<EruGroup> parent;
//     private List<EruGroup> children;
// 
//     public EruGroup() {
//         this.id = new SimpleIntegerProperty();
//         this.name = new SimpleStringProperty();
//         this.type = new SimpleObjectProperty<>(EruType.UNKNOWN);
//         this.parent = new SimpleObjectProperty<>();
//         this.children = new SimpleListProperty<>(FXCollections.observableArrayList());
//     }
// 
//     @Id @GeneratedValue(strategy=GenerationType.AUTO)
//     public Integer getId() {
//         return id.get();
//     }
//     public IntegerProperty idProperty() {
//         return id;
//     }
//     public void setId(Integer id) {
//         this.id.set(id);
//     }
// 
//     public String getName() {
//         return name.get();
//     }
//     public StringProperty nameProperty() {
//         return name;
//     }
//     public void setName(String name) {
//         this.name.set(name);
//     }
// 
//     public EruType getType() {
//         return type.get();
//     }
//     public ObjectProperty<EruType> typeProperty() {
//         return type;
//     }
//     public void setType(EruType type) {
//         this.type.set(type);
//     }
// 
//     @OneToOne(cascade= CascadeType.ALL, orphanRemoval = true)
//     public EruGroup getParent() {
//         return parent.get();
//     }
//     public ObjectProperty<EruGroup> parentProperty() {
//         return parent;
//     }
//     public void setParent(EruGroup parent) {
//         this.parent.set(parent);
//     }
// 
//     @LazyCollection(LazyCollectionOption.FALSE)
//     @OneToMany(cascade= CascadeType.ALL, orphanRemoval = true)
//     public List<EruGroup> getChildren() {
//         return children;
//     }
//     public void setChildren(List<EruGroup> children) {
//         this.children = children;
//     }
// 
//     @Override
//     public String toString() {
//         return "EruGroup{" + getName() +
//                 "=" + super.toString() +
//                 ", children= <" + children +
//                 "> }";
//     }
// }
// 
// Path: Eru/src/main/java/org/assemblits/eru/entities/EruType.java
// public enum EruType {
//     DEVICE,
//     CONNECTION,
//     TAG,
//     USER,
//     DISPLAY,
//     UNKNOWN
// }


import javafx.fxml.FXML;
import javafx.scene.control.*;
import javafx.scene.image.Image;
import javafx.scene.image.ImageView;
import lombok.Getter;
import org.assemblits.eru.entities.EruGroup;
import org.assemblits.eru.entities.EruType;
import org.springframework.stereotype.Component;
import java.util.Optional;
import java.util.function.Consumer;
                }
            });
            return groupTreeCell;
        });
    }

    private TreeItem<EruGroup> createTree(EruGroup eruGroup) {
        TreeItem<EruGroup> treeItem = new TreeItem<>(eruGroup);
        for (EruGroup t : eruGroup.getChildren()) {
            treeItem.getChildren().add(createTree(t));
        }
        return treeItem;
    }

    private class GroupTreeCell extends TreeCell<EruGroup> {

        private final Image rootIcon = new Image(getClass().getResourceAsStream("/images/project-icon.png"));
        private final Image connectionIcon = new Image(getClass().getResourceAsStream("/images/connection-icon.png"));
        private final Image deviceIcon = new Image(getClass().getResourceAsStream("/images/device-icon.png"));
        private final Image tagIcon = new Image(getClass().getResourceAsStream("/images/tag-icon.png"));
        private final Image userIcon = new Image(getClass().getResourceAsStream("/images/user-icon.png"));
        private final Image displayIcon = new Image(getClass().getResourceAsStream("/images/display-icon.png"));

        private final ContextMenu connectionsMenu = new ContextMenu();
        private final ContextMenu devicesMenu = new ContextMenu();
        private final ContextMenu tagsMenu = new ContextMenu();
        private final ContextMenu usersMenu = new ContextMenu();
        private final ContextMenu displaysMenu = new ContextMenu();

        public GroupTreeCell() {
// Path: Eru/src/main/java/org/assemblits/eru/entities/EruGroup.java
// @Entity
// @Table(name = "eru_group", schema = "public")
// @Inheritance(strategy = InheritanceType.SINGLE_TABLE)
// public class EruGroup {
// 
//     private IntegerProperty id;
//     private StringProperty name;
//     private ObjectProperty<EruType> type;
//     private ObjectProperty<EruGroup> parent;
//     private List<EruGroup> children;
// 
//     public EruGroup() {
//         this.id = new SimpleIntegerProperty();
//         this.name = new SimpleStringProperty();
//         this.type = new SimpleObjectProperty<>(EruType.UNKNOWN);
//         this.parent = new SimpleObjectProperty<>();
//         this.children = new SimpleListProperty<>(FXCollections.observableArrayList());
//     }
// 
//     @Id @GeneratedValue(strategy=GenerationType.AUTO)
//     public Integer getId() {
//         return id.get();
//     }
//     public IntegerProperty idProperty() {
//         return id;
//     }
//     public void setId(Integer id) {
//         this.id.set(id);
//     }
// 
//     public String getName() {
//         return name.get();
//     }
//     public StringProperty nameProperty() {
//         return name;
//     }
//     public void setName(String name) {
//         this.name.set(name);
//     }
// 
//     public EruType getType() {
//         return type.get();
//     }
//     public ObjectProperty<EruType> typeProperty() {
//         return type;
//     }
//     public void setType(EruType type) {
//         this.type.set(type);
//     }
// 
//     @OneToOne(cascade= CascadeType.ALL, orphanRemoval = true)
//     public EruGroup getParent() {
//         return parent.get();
//     }
//     public ObjectProperty<EruGroup> parentProperty() {
//         return parent;
//     }
//     public void setParent(EruGroup parent) {
//         this.parent.set(parent);
//     }
// 
//     @LazyCollection(LazyCollectionOption.FALSE)
//     @OneToMany(cascade= CascadeType.ALL, orphanRemoval = true)
//     public List<EruGroup> getChildren() {
//         return children;
//     }
//     public void setChildren(List<EruGroup> children) {
//         this.children = children;
//     }
// 
//     @Override
//     public String toString() {
//         return "EruGroup{" + getName() +
//                 "=" + super.toString() +
//                 ", children= <" + children +
//                 "> }";
//     }
// }
// 
// Path: Eru/src/main/java/org/assemblits/eru/entities/EruType.java
// public enum EruType {
//     DEVICE,
//     CONNECTION,
//     TAG,
//     USER,
//     DISPLAY,
//     UNKNOWN
// }


// Path: Eru/src/main/java/org/assemblits/eru/gui/controller/ProjectTreeController.java
import javafx.fxml.FXML;
import javafx.scene.control.*;
import javafx.scene.image.Image;
import javafx.scene.image.ImageView;
import lombok.Getter;
import org.assemblits.eru.entities.EruGroup;
import org.assemblits.eru.entities.EruType;
import org.springframework.stereotype.Component;
import java.util.Optional;
import java.util.function.Consumer;

                }
            });
            return groupTreeCell;
        });
    }

    private TreeItem<EruGroup> createTree(EruGroup eruGroup) {
        TreeItem<EruGroup> treeItem = new TreeItem<>(eruGroup);
        for (EruGroup t : eruGroup.getChildren()) {
            treeItem.getChildren().add(createTree(t));
        }
        return treeItem;
    }

    private class GroupTreeCell extends TreeCell<EruGroup> {

        private final Image rootIcon = new Image(getClass().getResourceAsStream("/images/project-icon.png"));
        private final Image connectionIcon = new Image(getClass().getResourceAsStream("/images/connection-icon.png"));
        private final Image deviceIcon = new Image(getClass().getResourceAsStream("/images/device-icon.png"));
        private final Image tagIcon = new Image(getClass().getResourceAsStream("/images/tag-icon.png"));
        private final Image userIcon = new Image(getClass().getResourceAsStream("/images/user-icon.png"));
        private final Image displayIcon = new Image(getClass().getResourceAsStream("/images/display-icon.png"));

        private final ContextMenu connectionsMenu = new ContextMenu();
        private final ContextMenu devicesMenu = new ContextMenu();
        private final ContextMenu tagsMenu = new ContextMenu();
        private final ContextMenu usersMenu = new ContextMenu();
        private final ContextMenu displaysMenu = new ContextMenu();

        public GroupTreeCell() {
            connectionsMenu.getItems().addAll(getMenuItemToAdd(EruType.CONNECTION), getMenuItemToRename(), getMenuItemToRemove());