|
@@ -282,10 +282,14 @@ public class CreateTemplatePopUp extends JDialog {
|
|
|
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+ * create the template and add it to the category
|
|
|
+ */
|
|
|
private void createTemplate(){
|
|
|
- template.setName(textField_name.getText());
|
|
|
- template.setImage(textField_imagePath.getText());
|
|
|
try {
|
|
|
+ template.setName(textField_name.getText());
|
|
|
+ template.setImage(textField_imagePath.getText());
|
|
|
+ template.getElements().forEach(ele -> ele.setSaving(new Pair(choice.getSelectedItem(), template.getName())));
|
|
|
controller.addObject(controller.searchCategory(choice.getItem(choice.getSelectedIndex())), template.getName(), template.getElements(), template.getImage());
|
|
|
this.dispose();
|
|
|
} catch (IOException e) {
|
|
@@ -294,6 +298,10 @@ public class CreateTemplatePopUp extends JDialog {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+
|
|
|
+ * Add an Holon Element to the template
|
|
|
+ */
|
|
|
private void addElement(){
|
|
|
AddElementPopUp popUp = new AddElementPopUp(parent);
|
|
|
popUp.setActualCps(template);
|
|
@@ -302,9 +310,13 @@ public class CreateTemplatePopUp extends JDialog {
|
|
|
if(he!=null){
|
|
|
listModel.addElement(he.getEleName()+": "+he.getOverallEnergy()+"U");
|
|
|
template.addElement(he);
|
|
|
+ he.setSaving(new Pair<>(category, textField_name.getText()));
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+ * Removes the Selected Element from the template
|
|
|
+ */
|
|
|
private void removeElement(){
|
|
|
int index = list.getSelectedIndex();
|
|
|
if(index == -1)return;
|
|
@@ -312,6 +324,9 @@ public class CreateTemplatePopUp extends JDialog {
|
|
|
listModel.remove(index);
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+ * Edits the selected HolonElement
|
|
|
+ */
|
|
|
private void editElement(){
|
|
|
int index = list.getSelectedIndex();
|
|
|
if(index == -1)return;
|