From 82bc8f70ab26af7cc9060b58aa353e6d6ae1974a Mon Sep 17 00:00:00 2001 From: Code002Lover Arch Laptop Date: Wed, 15 Feb 2023 10:29:17 +0100 Subject: [PATCH 1/3] optimize a bit --- .idea/misc.xml | 2 +- .idea/vcs.xml | 6 + at/fos/ermodel/gui/A1.java | 8 +- at/fos/ermodel/gui/A2.java | 489 ++- at/fos/ermodel/gui/A3.java | 744 +---- at/fos/ermodel/gui/A4.java | 331 +-- at/fos/ermodel/gui/A5.java | 208 +- at/fos/ermodel/gui/A6.java | 367 ++- at/fos/ermodel/gui/A7.java | 272 +- at/fos/ermodel/gui/A8.java | 1386 ++++----- at/fos/ermodel/gui/A9.java | 447 ++- at/fos/ermodel/gui/B1.java | 607 ++-- at/fos/ermodel/gui/B3.java | 2616 ++++++++--------- at/fos/ermodel/gui/C1.java | 284 +- at/fos/ermodel/gui/C2.java | 304 +- at/fos/ermodel/gui/C3.java | 235 +- at/fos/ermodel/gui/C4.java | 1654 +++++------ at/fos/ermodel/gui/Graphic_ATTR_Elem.java | 469 ++- at/fos/ermodel/gui/Graphic_ATTR_Key_Elem.java | 63 +- .../ermodel/gui/Graphic_ATTR_Multi_Elem.java | 72 +- at/fos/ermodel/gui/Graphic_ATTR_One_Elem.java | 65 +- .../gui/Graphic_ATTR_Weak_Key_Elem.java | 68 +- at/fos/ermodel/gui/Graphic_ES_Assoc_Elem.java | 101 +- at/fos/ermodel/gui/Graphic_ES_Elem.java | 74 +- at/fos/ermodel/gui/Graphic_ES_Main_Elem.java | 138 +- at/fos/ermodel/gui/Graphic_ES_Weak_Elem.java | 81 +- at/fos/ermodel/gui/Graphic_Figure_Elem.java | 297 +- .../gui/Graphic_LINE_Attr_Attr_Elem.java | 23 +- .../gui/Graphic_LINE_Attr_ES_Elem.java | 23 +- .../gui/Graphic_LINE_Attr_RS_Elem.java | 23 +- at/fos/ermodel/gui/Graphic_LINE_Elem.java | 587 ++-- .../gui/Graphic_LINE_RSID_ESWEAK_Elem.java | 23 +- .../gui/Graphic_LINE_RSID_ES_Elem.java | 49 +- .../gui/Graphic_LINE_RSISAG_ES_Elem.java | 23 +- .../gui/Graphic_LINE_RSISAS_ES_Elem.java | 23 +- .../ermodel/gui/Graphic_LINE_RS_ES_Elem.java | 23 +- at/fos/ermodel/gui/Graphic_Main_Elem.java | 282 +- at/fos/ermodel/gui/Graphic_RS_Elem.java | 107 +- at/fos/ermodel/gui/Graphic_RS_ISA_Elem.java | 205 +- .../gui/Graphic_RS_Identifying_Elem.java | 129 +- at/fos/ermodel/gui/Graphic_RS_Main_Elem.java | 131 +- at/fos/ermodel/gui/Graphic_Text_Elem.java | 196 +- at/fos/ermodel/gui/T1.java | 254 +- at/fos/ermodel/gui/T2.java | 6 +- at/fos/ermodel/gui/T3.java | 424 ++- at/fos/ermodel/gui/U1.java | 149 +- at/fos/ermodel/gui/U2.java | 126 +- at/fos/ermodel/gui/U3.java | 38 +- at/fos/ermodel/gui/U4.java | 5 +- at/fos/ermodel/gui/V1.java | 119 +- at/fos/ermodel/gui/ZZ20.java | 9 +- at/fos/ermodel/gui/ZZ30.java | 2405 +++++++-------- 52 files changed, 7301 insertions(+), 9469 deletions(-) create mode 100644 .idea/vcs.xml diff --git a/.idea/misc.xml b/.idea/misc.xml index 02dc7e1..49e5921 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -1,6 +1,6 @@ - + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..35eb1dd --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/at/fos/ermodel/gui/A1.java b/at/fos/ermodel/gui/A1.java index 01dab45..0c0fbdd 100644 --- a/at/fos/ermodel/gui/A1.java +++ b/at/fos/ermodel/gui/A1.java @@ -7,12 +7,12 @@ public class A1 extends Application { public A1() { } - public void start(Stage stage) { - new B3(); - } - public static void main(String[] args) { launch(args); } + + public void start(Stage stage) { + new B3(); + } } diff --git a/at/fos/ermodel/gui/A2.java b/at/fos/ermodel/gui/A2.java index 6b9bd93..dd65425 100644 --- a/at/fos/ermodel/gui/A2.java +++ b/at/fos/ermodel/gui/A2.java @@ -1,268 +1,235 @@ - package at.fos.ermodel.gui; +package at.fos.ermodel.gui; - import javafx.event.ActionEvent; - import javafx.event.EventHandler; - import javafx.scene.control.RadioButton; +import javafx.event.ActionEvent; +import javafx.event.EventHandler; +import javafx.scene.control.RadioButton; - public class A2 - implements EventHandler - { - private final B3 view; - - public A2(B3 simpleFrame) { - this.view = simpleFrame; - } - - - - - - - - public void handle(ActionEvent arg0) { - Object source = arg0.getSource(); - - if (source instanceof RadioButton && source == this.view.selectModeBTN) { - this.view.selectModeBTN.setStyle("-fx-text-fill:red"); - this.view.creationModelabel.setStyle("-fx-text-fill:white"); - this.view.menuVisibility.setDisable(false); - } - if (source instanceof RadioButton && source != this.view.selectModeBTN) { - - - this.view.menuVisibilityAllRMI.setSelected(true); - this.view.menuVisibilityTEXTRMI.setSelected(true); - (this.view.getCurrentTab()).canvas.modelVisibility(); - (this.view.getCurrentTab()).canvas.sdfsdfds3465er(true); - this.view.menuVisibility.setDisable(true); - - - - this.view.showAttributeCB.setSelected(false); - this.view.graphicElemLV.getItems().clear(); - this.view.graphicElemLV.getItems().addAll((this.view.getCurrentTab()).canvas.sddsfsfsdf45645645()); - - this.view.selectModeBTN.setStyle("-fx-text-fill:white"); - this.view.creationModelabel.setStyle("-fx-text-fill:red"); - this.view.lastCreationSelected = (RadioButton)source; - if (this.view.getCurrentTab() == null) { - this.view.selectModeBTN.setSelected(true); - - - - - - - return; - } - - - - - - - if (this.view.generateRelationalModelCB.isSelected()) { - this.view.selectModeBTN.setStyle("-fx-text-fill:red"); - this.view.creationModelabel.setStyle("-fx-text-fill:white"); - this.view.selectModeBTN.setSelected(true); - - - - - - - - - - return; - } - } - - - - - - - - - if (source == this.view.menuExitMI) { - this.view.close(); - } - - - - - if (source == this.view.menuNewMI) { - this.view.setCurrentTab(this.view.addNewTab(null)); - (this.view.getCurrentTab()).canvas.requestFocus(); - this.view.tabPane.getSelectionModel().select(this.view.getCurrentTab()); - } +public class A2 + implements EventHandler { + private final B3 view; + + public A2(B3 simpleFrame) { + this.view = simpleFrame; + } - if (source == this.view.menuRedrawMI) { - (this.view.getCurrentTab()).canvas.sdfsdfds3465er(true); - } - - if (source == this.view.menuExportMI) { - this.view.exportModel(); - } - - if (source == this.view.menuSaveMI) { - this.view.saveModel(); - } + public void handle(ActionEvent arg0) { + Object source = arg0.getSource(); - if (source == this.view.menuSaveAsMI) { - this.view.saveModelAs(); - } - - if (source == this.view.menuReadMI) { - this.view.readModel(); - } - - - if (source == this.view.creation_selection_group.getSelectedToggle()) { - (this.view.getCurrentTab()).canvas.sdfdsfdsdf43543ref(); - } - - - if (source == this.view.selectModeBTN) { - (this.view.getCurrentTab()).canvas.sdfsdfds3465er(true); - (this.view.getCurrentTab()).canvas.sdfsdfds435634terf(); - this.view.statusInformation.setText("Selection mode: move mouse over element or use mouse to draw a rectangle - ESC -> deselect - DEL -> delete selected elements - pressed left mouse key -> move selected elements - right mouse over selected element -> open context menu"); - } - - - - - if (source == this.view.textElemBTN) { - (this.view.getCurrentTab()).canvas.sdfsdfds3465er(true); - this.view.statusInformation.setText("Creation Mode: text-element-with-border -> press left mouse button on working area -> enter text (ALT-Enter for linefeed) -> press enter key"); - } - if (source == this.view.textWithoutBorderElemBTN) { - (this.view.getCurrentTab()).canvas.sdfsdfds3465er(true); - this.view.statusInformation.setText("Creation Mode: text-element-without-border -> press left mouse button on working area -> enter text (ALT-Enter for linefeed) -> press enter key"); - } - - if (source == this.view.esBTN) { - (this.view.getCurrentTab()).canvas.sdfsdfds3465er(true); - this.view.statusInformation.setText("Creation Mode: entity-set -> press left mouse button on working area -> enter name of entity-set -> press enter key"); - } - if (source == this.view.esWeakBTN) { - (this.view.getCurrentTab()).canvas.sdfsdfds3465er(true); - this.view.statusInformation.setText("Creation Mode: weak-entity-set -> press left mouse button on working area -> enter name of weak-entity-set -> press enter key"); - } - if (source == this.view.esAssociativeBTN) { - (this.view.getCurrentTab()).canvas.sdfsdfds3465er(true); - this.view.statusInformation.setText("Creation Mode: associative-entity-set -> press left mouse button on working area -> enter name of assoc.-entity-set -> press enter key"); - } - if (source == this.view.rsBTN) { - (this.view.getCurrentTab()).canvas.sdfsdfds3465er(true); - this.view.statusInformation.setText("Creation Mode: relationship-type -> press left mouse button on working area -> enter name of relationship-type -> press enter key"); - } - if (source == this.view.rsIDBTN) { - (this.view.getCurrentTab()).canvas.sdfsdfds3465er(true); - this.view.statusInformation.setText("Creation Mode: identifying-relationship-type -> press left mouse button on working area -> enter name of entity-set -> press enter key"); - } - if (source == this.view.rsISABTN) { - (this.view.getCurrentTab()).canvas.sdfsdfds3465er(true); - this.view.statusInformation.setText("Creation Mode: isa relationship-type -> press left mouse button on working area -> enter type (p/t/d/nd) -> press enter key"); - } - if (source == this.view.attrKeyBTN) { - (this.view.getCurrentTab()).canvas.sdfsdfds3465er(true); - this.view.statusInformation.setText("Creation Mode: key-attribute"); - } - if (source == this.view.attrWeakKeyBTN) { - (this.view.getCurrentTab()).canvas.sdfsdfds3465er(true); - this.view.statusInformation.setText("Creation Mode: weak-key-attribute"); - } - if (source == this.view.attrOneBTN) { - (this.view.getCurrentTab()).canvas.sdfsdfds3465er(true); - - this.view.statusInformation.setText("Creation Mode: one-value-attribute"); - } - if (source == this.view.attrMultiBTN) { - (this.view.getCurrentTab()).canvas.sdfsdfds3465er(true); - - this.view.statusInformation.setText("Creation Mode: multi-value-attribute"); - } - if (source == this.view.attrDerivedOneBTN) { - (this.view.getCurrentTab()).canvas.sdfsdfds3465er(true); - - this.view.statusInformation.setText("Creation Mode: derived-one-value-attribute"); - } - if (source == this.view.attrDerivedMultiBTN) { - (this.view.getCurrentTab()).canvas.sdfsdfds3465er(true); - this.view.statusInformation.setText("Creation Mode: derived-multi-value-attribute"); - } - - - (this.view.getCurrentTab()).canvas.setConnectionModeSet(false); - if (source == this.view.attrToAttrBTN) { - (this.view.getCurrentTab()).canvas.setConnectionModeSet(true); - (this.view.getCurrentTab()).canvas.sdfdsfdsdf34543erretwre(); - this.view.statusInformation.setText("Creation Mode: connect attribute to a composite-attribute - select element->click left mouse button->move mouse to second element->click left mouse button"); - } - - if (source == this.view.attrToESBTN) { - (this.view.getCurrentTab()).canvas.setConnectionModeSet(true); - (this.view.getCurrentTab()).canvas.sdfdsfdsdf34543erretwre(); - this.view.statusInformation.setText("Creation Mode: connect attribute with an entity-set - select element->click left mouse button->move mouse to second element->click left mouse button"); - } - - if (source == this.view.attrToRSBTN) { - (this.view.getCurrentTab()).canvas.setConnectionModeSet(true); - (this.view.getCurrentTab()).canvas.sdfdsfdsdf34543erretwre(); - this.view.statusInformation.setText("Creation Mode: connect attribute with a relationship-type - select element->click left mouse button->move mouse to second element->click left mouse button"); - } - - if (source == this.view.attrToRSBTN) { - (this.view.getCurrentTab()).canvas.setConnectionModeSet(true); - (this.view.getCurrentTab()).canvas.sdfdsfdsdf34543erretwre(); - this.view.statusInformation.setText("Creation Mode: connect attribute with a relationship-type - select element->click left mouse button->move mouse to second element->click left mouse button"); - } - - if (source == this.view.rsToESBTN) { - (this.view.getCurrentTab()).canvas.setConnectionModeSet(true); - (this.view.getCurrentTab()).canvas.sdfdsfdsdf34543erretwre(); - this.view.statusInformation.setText("Creation Mode: connect relationship-type with (associative-)entity-set or entity-set with associative-entity-set - select element->click left mouse button->move mouse to second element->click left mouse button"); - } - - if (source == this.view.rsidToESBTN) { - (this.view.getCurrentTab()).canvas.setConnectionModeSet(true); - (this.view.getCurrentTab()).canvas.sdfdsfdsdf34543erretwre(); - this.view.statusInformation.setText("Creation Mode: connect identifying-relationship-type with entity-set - select element->click left mouse button->move mouse to second element->click left mouse button"); - } - - if (source == this.view.rsidToESWeakBTN) { - (this.view.getCurrentTab()).canvas.setConnectionModeSet(true); - (this.view.getCurrentTab()).canvas.sdfdsfdsdf34543erretwre(); - this.view.statusInformation.setText("Creation Mode: connect identifying-relationship-type with weak-entity-set - select element->click left mouse button->move mouse to second element->click left mouse button"); - } - - if (source == this.view.rsisaGeToESBTN) { - (this.view.getCurrentTab()).canvas.setConnectionModeSet(true); - (this.view.getCurrentTab()).canvas.sdfdsfdsdf34543erretwre(); - this.view.statusInformation.setText("Creation Mode: connect isa-relationship-type with generalized entity-set - select element->click left mouse button->move mouse to second element->click left mouse button"); - } - - if (source == this.view.rsisaSpToESBTN) { - (this.view.getCurrentTab()).canvas.setConnectionModeSet(true); - (this.view.getCurrentTab()).canvas.sdfdsfdsdf34543erretwre(); - this.view.statusInformation.setText("Creation Mode: connect isa-relationship-type with specialized entity-set - select element->click left mouse button->move mouse to second element->click left mouse button"); - } - - - - if (this.view.getCurrentTab() != null) { - (this.view.getCurrentTab()).canvas.dsfdsdfssdf45645re(); - } - - if (source == this.view.menuVisibilityTEXTRMI || source == this.view.menuVisibilityAllRMI || source == this.view.menuVisibilityES_RS_KEYRMI || - source == this.view.menuVisibilityES_RSRMI) { - (this.view.getCurrentTab()).canvas.modelVisibility(); - (this.view.getCurrentTab()).canvas.sdfsdfds3465er(true); - } - } - } + if (source instanceof RadioButton && source == this.view.selectModeBTN) { + this.view.selectModeBTN.setStyle("-fx-text-fill:red"); + this.view.creationModelabel.setStyle("-fx-text-fill:white"); + this.view.menuVisibility.setDisable(false); + } + if (source instanceof RadioButton && source != this.view.selectModeBTN) { + + + this.view.menuVisibilityAllRMI.setSelected(true); + this.view.menuVisibilityTEXTRMI.setSelected(true); + (this.view.getCurrentTab()).canvas.modelVisibility(); + (this.view.getCurrentTab()).canvas.sdfsdfds3465er(true); + this.view.menuVisibility.setDisable(true); + + + this.view.showAttributeCB.setSelected(false); + this.view.graphicElemLV.getItems().clear(); + this.view.graphicElemLV.getItems().addAll((this.view.getCurrentTab()).canvas.sddsfsfsdf45645645()); + + this.view.selectModeBTN.setStyle("-fx-text-fill:white"); + this.view.creationModelabel.setStyle("-fx-text-fill:red"); + this.view.lastCreationSelected = (RadioButton) source; + if (this.view.getCurrentTab() == null) { + this.view.selectModeBTN.setSelected(true); + + + return; + } + + + if (this.view.generateRelationalModelCB.isSelected()) { + this.view.selectModeBTN.setStyle("-fx-text-fill:red"); + this.view.creationModelabel.setStyle("-fx-text-fill:white"); + this.view.selectModeBTN.setSelected(true); + + + return; + } + } + + + if (source == this.view.menuExitMI) { + this.view.close(); + } + + + if (source == this.view.menuNewMI) { + this.view.setCurrentTab(this.view.addNewTab(null)); + (this.view.getCurrentTab()).canvas.requestFocus(); + this.view.tabPane.getSelectionModel().select(this.view.getCurrentTab()); + } + + + if (source == this.view.menuRedrawMI) { + (this.view.getCurrentTab()).canvas.sdfsdfds3465er(true); + } + + if (source == this.view.menuExportMI) { + this.view.exportModel(); + } + + if (source == this.view.menuSaveMI) { + this.view.saveModel(); + } + + if (source == this.view.menuSaveAsMI) { + this.view.saveModelAs(); + } + + if (source == this.view.menuReadMI) { + this.view.readModel(); + } + + + if (source == this.view.creation_selection_group.getSelectedToggle()) { + (this.view.getCurrentTab()).canvas.sdfdsfdsdf43543ref(); + } + + + if (source == this.view.selectModeBTN) { + (this.view.getCurrentTab()).canvas.sdfsdfds3465er(true); + (this.view.getCurrentTab()).canvas.sdfsdfds435634terf(); + this.view.statusInformation.setText("Selection mode: move mouse over element or use mouse to draw a rectangle - ESC -> deselect - DEL -> delete selected elements - pressed left mouse key -> move selected elements - right mouse over selected element -> open context menu"); + } + + + if (source == this.view.textElemBTN) { + (this.view.getCurrentTab()).canvas.sdfsdfds3465er(true); + this.view.statusInformation.setText("Creation Mode: text-element-with-border -> press left mouse button on working area -> enter text (ALT-Enter for linefeed) -> press enter key"); + } + if (source == this.view.textWithoutBorderElemBTN) { + (this.view.getCurrentTab()).canvas.sdfsdfds3465er(true); + this.view.statusInformation.setText("Creation Mode: text-element-without-border -> press left mouse button on working area -> enter text (ALT-Enter for linefeed) -> press enter key"); + } + + if (source == this.view.esBTN) { + (this.view.getCurrentTab()).canvas.sdfsdfds3465er(true); + this.view.statusInformation.setText("Creation Mode: entity-set -> press left mouse button on working area -> enter name of entity-set -> press enter key"); + } + if (source == this.view.esWeakBTN) { + (this.view.getCurrentTab()).canvas.sdfsdfds3465er(true); + this.view.statusInformation.setText("Creation Mode: weak-entity-set -> press left mouse button on working area -> enter name of weak-entity-set -> press enter key"); + } + if (source == this.view.esAssociativeBTN) { + (this.view.getCurrentTab()).canvas.sdfsdfds3465er(true); + this.view.statusInformation.setText("Creation Mode: associative-entity-set -> press left mouse button on working area -> enter name of assoc.-entity-set -> press enter key"); + } + if (source == this.view.rsBTN) { + (this.view.getCurrentTab()).canvas.sdfsdfds3465er(true); + this.view.statusInformation.setText("Creation Mode: relationship-type -> press left mouse button on working area -> enter name of relationship-type -> press enter key"); + } + if (source == this.view.rsIDBTN) { + (this.view.getCurrentTab()).canvas.sdfsdfds3465er(true); + this.view.statusInformation.setText("Creation Mode: identifying-relationship-type -> press left mouse button on working area -> enter name of entity-set -> press enter key"); + } + if (source == this.view.rsISABTN) { + (this.view.getCurrentTab()).canvas.sdfsdfds3465er(true); + this.view.statusInformation.setText("Creation Mode: isa relationship-type -> press left mouse button on working area -> enter type (p/t/d/nd) -> press enter key"); + } + if (source == this.view.attrKeyBTN) { + (this.view.getCurrentTab()).canvas.sdfsdfds3465er(true); + this.view.statusInformation.setText("Creation Mode: key-attribute"); + } + if (source == this.view.attrWeakKeyBTN) { + (this.view.getCurrentTab()).canvas.sdfsdfds3465er(true); + this.view.statusInformation.setText("Creation Mode: weak-key-attribute"); + } + if (source == this.view.attrOneBTN) { + (this.view.getCurrentTab()).canvas.sdfsdfds3465er(true); + + this.view.statusInformation.setText("Creation Mode: one-value-attribute"); + } + if (source == this.view.attrMultiBTN) { + (this.view.getCurrentTab()).canvas.sdfsdfds3465er(true); + + this.view.statusInformation.setText("Creation Mode: multi-value-attribute"); + } + if (source == this.view.attrDerivedOneBTN) { + (this.view.getCurrentTab()).canvas.sdfsdfds3465er(true); + + this.view.statusInformation.setText("Creation Mode: derived-one-value-attribute"); + } + if (source == this.view.attrDerivedMultiBTN) { + (this.view.getCurrentTab()).canvas.sdfsdfds3465er(true); + this.view.statusInformation.setText("Creation Mode: derived-multi-value-attribute"); + } + + + (this.view.getCurrentTab()).canvas.setConnectionModeSet(false); + if (source == this.view.attrToAttrBTN) { + (this.view.getCurrentTab()).canvas.setConnectionModeSet(true); + (this.view.getCurrentTab()).canvas.sdfdsfdsdf34543erretwre(); + this.view.statusInformation.setText("Creation Mode: connect attribute to a composite-attribute - select element->click left mouse button->move mouse to second element->click left mouse button"); + } + + if (source == this.view.attrToESBTN) { + (this.view.getCurrentTab()).canvas.setConnectionModeSet(true); + (this.view.getCurrentTab()).canvas.sdfdsfdsdf34543erretwre(); + this.view.statusInformation.setText("Creation Mode: connect attribute with an entity-set - select element->click left mouse button->move mouse to second element->click left mouse button"); + } + + if (source == this.view.attrToRSBTN) { + (this.view.getCurrentTab()).canvas.setConnectionModeSet(true); + (this.view.getCurrentTab()).canvas.sdfdsfdsdf34543erretwre(); + this.view.statusInformation.setText("Creation Mode: connect attribute with a relationship-type - select element->click left mouse button->move mouse to second element->click left mouse button"); + } + + if (source == this.view.attrToRSBTN) { + (this.view.getCurrentTab()).canvas.setConnectionModeSet(true); + (this.view.getCurrentTab()).canvas.sdfdsfdsdf34543erretwre(); + this.view.statusInformation.setText("Creation Mode: connect attribute with a relationship-type - select element->click left mouse button->move mouse to second element->click left mouse button"); + } + + if (source == this.view.rsToESBTN) { + (this.view.getCurrentTab()).canvas.setConnectionModeSet(true); + (this.view.getCurrentTab()).canvas.sdfdsfdsdf34543erretwre(); + this.view.statusInformation.setText("Creation Mode: connect relationship-type with (associative-)entity-set or entity-set with associative-entity-set - select element->click left mouse button->move mouse to second element->click left mouse button"); + } + + if (source == this.view.rsidToESBTN) { + (this.view.getCurrentTab()).canvas.setConnectionModeSet(true); + (this.view.getCurrentTab()).canvas.sdfdsfdsdf34543erretwre(); + this.view.statusInformation.setText("Creation Mode: connect identifying-relationship-type with entity-set - select element->click left mouse button->move mouse to second element->click left mouse button"); + } + + if (source == this.view.rsidToESWeakBTN) { + (this.view.getCurrentTab()).canvas.setConnectionModeSet(true); + (this.view.getCurrentTab()).canvas.sdfdsfdsdf34543erretwre(); + this.view.statusInformation.setText("Creation Mode: connect identifying-relationship-type with weak-entity-set - select element->click left mouse button->move mouse to second element->click left mouse button"); + } + + if (source == this.view.rsisaGeToESBTN) { + (this.view.getCurrentTab()).canvas.setConnectionModeSet(true); + (this.view.getCurrentTab()).canvas.sdfdsfdsdf34543erretwre(); + this.view.statusInformation.setText("Creation Mode: connect isa-relationship-type with generalized entity-set - select element->click left mouse button->move mouse to second element->click left mouse button"); + } + + if (source == this.view.rsisaSpToESBTN) { + (this.view.getCurrentTab()).canvas.setConnectionModeSet(true); + (this.view.getCurrentTab()).canvas.sdfdsfdsdf34543erretwre(); + this.view.statusInformation.setText("Creation Mode: connect isa-relationship-type with specialized entity-set - select element->click left mouse button->move mouse to second element->click left mouse button"); + } + + + if (this.view.getCurrentTab() != null) { + (this.view.getCurrentTab()).canvas.dsfdsdfssdf45645re(); + } + + if (source == this.view.menuVisibilityTEXTRMI || source == this.view.menuVisibilityAllRMI || source == this.view.menuVisibilityES_RS_KEYRMI || + source == this.view.menuVisibilityES_RSRMI) { + (this.view.getCurrentTab()).canvas.modelVisibility(); + (this.view.getCurrentTab()).canvas.sdfsdfds3465er(true); + } + } +} diff --git a/at/fos/ermodel/gui/A3.java b/at/fos/ermodel/gui/A3.java index 3708b13..0b7f013 100644 --- a/at/fos/ermodel/gui/A3.java +++ b/at/fos/ermodel/gui/A3.java @@ -18,69 +18,57 @@ import java.util.*; public class A3 - extends Canvas -{ + extends Canvas { + final KeyCombination sdfsdfds4564556 = new KeyCodeCombination(KeyCode.DIGIT0, KeyCombination.CONTROL_DOWN); + final KeyCombination keyCombinationCTRL_R = new KeyCodeCombination(KeyCode.R, KeyCombination.CONTROL_DOWN); + final KeyCombination keyCombinationCTRL_O = new KeyCodeCombination(KeyCode.O, KeyCombination.CONTROL_DOWN); + final KeyCombination keyCombinationCTRL_E = new KeyCodeCombination(KeyCode.E, KeyCombination.CONTROL_DOWN); + final KeyCombination keyCombinationCTRL_N = new KeyCodeCombination(KeyCode.N, KeyCombination.CONTROL_DOWN); + final KeyCombination dsfsdfdsf56456 = new KeyCodeCombination(KeyCode.S, KeyCombination.CONTROL_DOWN); + final KeyCombination sadsdsadsad213213 = new KeyCodeCombination(KeyCode.C, KeyCombination.CONTROL_DOWN); + final KeyCombination dsfsfdsfd456456 = new KeyCodeCombination(KeyCode.X, KeyCombination.CONTROL_DOWN); + final KeyCombination dfgsdd456456 = new KeyCodeCombination(KeyCode.V, KeyCombination.CONTROL_DOWN); + final KeyCombination asdadsa324324 = new KeyCodeCombination(KeyCode.A, KeyCombination.CONTROL_DOWN); + final KeyCombination keyCombinationCTRL_Z = new KeyCodeCombination(KeyCode.Z, KeyCombination.CONTROL_DOWN); + final KeyCombination dsfsdfds67678768 = new KeyCodeCombination(KeyCode.Y, KeyCombination.CONTROL_DOWN); private final A3 thisERMDrawCanvas; private final U1 u1; private final double canvasWidth = 2000.0D; private final double canvasHeight = 2000.0D; - private final B3 view; - private final GraphicsContext gc; - private boolean elementIsSelected = false; - private Graphic_Main_Elem sdadasd34535trertertret = null; - - private double xOffset; - - private double yOffset; - private boolean connectionModeSet; - private Graphic_Main_Elem anyElem1; - private Graphic_Main_Elem anyElem2; + private final ArrayList graphicElements; + private final ArrayList attributeElements; + private final ObservableList graphicElementsObservable; + private final ArrayList zooming = new ArrayList<>(); + private final ArrayList pastActions; + private final ArrayList futureActions; double dockXAnyElem1 = 0.0D; double dockYAnyElem1 = 0.0D; double dockXAnyElem2 = 0.0D; double dockYAnyElem2 = 0.0D; byte dockAtPointAnyElem1 = 0; byte asdasdsad435435etertret = 0; - - + private boolean elementIsSelected = false; + private Graphic_Main_Elem sdadasd34535trertertret = null; + private double xOffset; + private double yOffset; + private boolean connectionModeSet; + private Graphic_Main_Elem anyElem1; + private Graphic_Main_Elem anyElem2; private int selectCounterConnection = 0; - - - private final ArrayList graphicElements; - - - private final ArrayList attributeElements; - - - private final ObservableList graphicElementsObservable; - - private C4 relationalModel; - private long elementID; - private ContextMenu contextMenu = new ContextMenu(); - private MenuItem addText; - private MenuItem addName; - private MenuItem addMinMax; - private MenuItem addISASpec; - private MenuItem sadsadas4353453retretret; - private MenuItem sdfsdfsdfsdfdsf324324; - private double dialogXPos; - private double dialogYPos; - private boolean dsasadasd345435fghgfh; - private boolean changeDockingPoint; private MenuItem changeDockingPointAtFigure1; private MenuItem changeDockingPointAtFigure2; @@ -95,41 +83,6 @@ public class A3 private ArrayList selectedElements; private File modelSavedInFile; private String initialDirectory; - private final ArrayList zooming = new ArrayList<>(); - final KeyCombination sdfsdfds4564556 = new KeyCodeCombination(KeyCode.DIGIT0, KeyCombination.CONTROL_DOWN); - - - - final KeyCombination keyCombinationCTRL_R = new KeyCodeCombination(KeyCode.R, KeyCombination.CONTROL_DOWN); - - final KeyCombination keyCombinationCTRL_O = new KeyCodeCombination(KeyCode.O, KeyCombination.CONTROL_DOWN); - - final KeyCombination keyCombinationCTRL_E = new KeyCodeCombination(KeyCode.E, KeyCombination.CONTROL_DOWN); - - final KeyCombination keyCombinationCTRL_N = new KeyCodeCombination(KeyCode.N, KeyCombination.CONTROL_DOWN); - - final KeyCombination dsfsdfdsf56456 = new KeyCodeCombination(KeyCode.S, KeyCombination.CONTROL_DOWN); - - final KeyCombination sadsdsadsad213213 = new KeyCodeCombination(KeyCode.C, KeyCombination.CONTROL_DOWN); - - final KeyCombination dsfsfdsfd456456 = new KeyCodeCombination(KeyCode.X, KeyCombination.CONTROL_DOWN); - - final KeyCombination dfgsdd456456 = new KeyCodeCombination(KeyCode.V, KeyCombination.CONTROL_DOWN); - - final KeyCombination asdadsa324324 = new KeyCodeCombination(KeyCode.A, KeyCombination.CONTROL_DOWN); - - final KeyCombination keyCombinationCTRL_Z = new KeyCodeCombination(KeyCode.Z, KeyCombination.CONTROL_DOWN); - - final KeyCombination dsfsdfds67678768 = new KeyCodeCombination(KeyCode.Y, KeyCombination.CONTROL_DOWN); - - - - private final ArrayList pastActions; - - - - private final ArrayList futureActions; - public A3(final B3 view, File modelSavedInFile, final U1 u1) { @@ -220,8 +173,6 @@ public class A3 } - - private void setHandler() { this.thisERMDrawCanvas.setOnScroll(event -> { if (event.isControlDown()) { @@ -233,8 +184,7 @@ public class A3 if (zoomFactor == 1.05D) { A3.this.zooming.add(0.95D); - } - else { + } else { A3.this.zooming.add(1.05D); } @@ -262,7 +212,6 @@ public class A3 event.consume(); - for (Graphic_Main_Elem geh : A3.this.selectedElements) { newX = geh.xPos; newY = geh.yPos; @@ -272,8 +221,8 @@ public class A3 for (Graphic_LINE_Elem gle : gleListStart) { gle.dsfsdfsfd(); - gle.setxPos(((Graphic_Figure_Elem)geh).getXYForGivenPoint(gle.getLineConnectedWithPointAtStart())[0]); - gle.setyPos(((Graphic_Figure_Elem)geh).getXYForGivenPoint(gle.getLineConnectedWithPointAtStart())[1]); + gle.setxPos(((Graphic_Figure_Elem) geh).getXYForGivenPoint(gle.getLineConnectedWithPointAtStart())[0]); + gle.setyPos(((Graphic_Figure_Elem) geh).getXYForGivenPoint(gle.getLineConnectedWithPointAtStart())[1]); gle.safdsadasds32432456456(); } } @@ -281,8 +230,8 @@ public class A3 if (gleListEnd.size() > 0) { for (Graphic_LINE_Elem gle : gleListEnd) { gle.dsfsdfsfd(); - gle.setxEnd(((Graphic_Figure_Elem)geh).getXYForGivenPoint(gle.getLineConnectedWithPointAtEnd())[0]); - gle.setyEnd(((Graphic_Figure_Elem)geh).getXYForGivenPoint(gle.getLineConnectedWithPointAtEnd())[1]); + gle.setxEnd(((Graphic_Figure_Elem) geh).getXYForGivenPoint(gle.getLineConnectedWithPointAtEnd())[0]); + gle.setyEnd(((Graphic_Figure_Elem) geh).getXYForGivenPoint(gle.getLineConnectedWithPointAtEnd())[1]); gle.safdsadasds32432456456(); } } @@ -303,8 +252,8 @@ public class A3 for (Graphic_LINE_Elem gle : gleListStart) { gle.dsfsdfsfd(); - gle.setxPos(((Graphic_Figure_Elem)ge).getXYForGivenPoint(gle.getLineConnectedWithPointAtStart())[0] + event.getX() - A3.this.xOffset); - gle.setyPos(((Graphic_Figure_Elem)ge).getXYForGivenPoint(gle.getLineConnectedWithPointAtStart())[1] + event.getY() - A3.this.yOffset); + gle.setxPos(((Graphic_Figure_Elem) ge).getXYForGivenPoint(gle.getLineConnectedWithPointAtStart())[0] + event.getX() - A3.this.xOffset); + gle.setyPos(((Graphic_Figure_Elem) ge).getXYForGivenPoint(gle.getLineConnectedWithPointAtStart())[1] + event.getY() - A3.this.yOffset); gle.safdsadasds32432456456(); } } @@ -312,8 +261,8 @@ public class A3 if (gleListEnd.size() > 0) { for (Graphic_LINE_Elem gle : gleListEnd) { gle.dsfsdfsfd(); - gle.setxEnd(((Graphic_Figure_Elem)ge).getXYForGivenPoint(gle.getLineConnectedWithPointAtEnd())[0] + event.getX() - A3.this.xOffset); - gle.setyEnd(((Graphic_Figure_Elem)ge).getXYForGivenPoint(gle.getLineConnectedWithPointAtEnd())[1] + event.getY() - A3.this.yOffset); + gle.setxEnd(((Graphic_Figure_Elem) ge).getXYForGivenPoint(gle.getLineConnectedWithPointAtEnd())[0] + event.getX() - A3.this.xOffset); + gle.setyEnd(((Graphic_Figure_Elem) ge).getXYForGivenPoint(gle.getLineConnectedWithPointAtEnd())[1] + event.getY() - A3.this.yOffset); gle.safdsadasds32432456456(); } } @@ -350,8 +299,8 @@ public class A3 if (gleListStart.size() > 0) { for (Graphic_LINE_Elem gle : gleListStart) { gle.dsfsdfsfd(); - gle.setxPos(((Graphic_Figure_Elem)A3.this.sdadasd34535trertertret).getXYForGivenPoint(gle.getLineConnectedWithPointAtStart())[0] + event.getX() - A3.this.xOffset); - gle.setyPos(((Graphic_Figure_Elem)A3.this.sdadasd34535trertertret).getXYForGivenPoint(gle.getLineConnectedWithPointAtStart())[1] + event.getY() - A3.this.yOffset); + gle.setxPos(((Graphic_Figure_Elem) A3.this.sdadasd34535trertertret).getXYForGivenPoint(gle.getLineConnectedWithPointAtStart())[0] + event.getX() - A3.this.xOffset); + gle.setyPos(((Graphic_Figure_Elem) A3.this.sdadasd34535trertertret).getXYForGivenPoint(gle.getLineConnectedWithPointAtStart())[1] + event.getY() - A3.this.yOffset); gle.safdsadasds32432456456(); @@ -361,8 +310,8 @@ public class A3 if (gleListEnd.size() > 0) { for (Graphic_LINE_Elem gle : gleListEnd) { gle.dsfsdfsfd(); - gle.setxEnd(((Graphic_Figure_Elem)A3.this.sdadasd34535trertertret).getXYForGivenPoint(gle.getLineConnectedWithPointAtEnd())[0] + event.getX() - A3.this.xOffset); - gle.setyEnd(((Graphic_Figure_Elem)A3.this.sdadasd34535trertertret).getXYForGivenPoint(gle.getLineConnectedWithPointAtEnd())[1] + event.getY() - A3.this.yOffset); + gle.setxEnd(((Graphic_Figure_Elem) A3.this.sdadasd34535trertertret).getXYForGivenPoint(gle.getLineConnectedWithPointAtEnd())[0] + event.getX() - A3.this.xOffset); + gle.setyEnd(((Graphic_Figure_Elem) A3.this.sdadasd34535trertertret).getXYForGivenPoint(gle.getLineConnectedWithPointAtEnd())[1] + event.getY() - A3.this.yOffset); gle.safdsadasds32432456456(); @@ -396,7 +345,6 @@ public class A3 }); - setOnMouseReleased(event -> { if (A3.this.thisERMDrawCanvas.dsasadasd345435fghgfh) { return; @@ -451,12 +399,11 @@ public class A3 !(gme instanceof Graphic_Figure_Elem)) continue; if (gme.dsfsfds45645456(event.getX(), event.getY())) { - double[] dockablePoints = ((Graphic_Figure_Elem)gme).getDockablePoint(event.getX(), event.getY()); + double[] dockablePoints = ((Graphic_Figure_Elem) gme).getDockablePoint(event.getX(), event.getY()); - if (dockablePoints != null) - { + if (dockablePoints != null) { if (gme.isConnectable) { - ((Graphic_Figure_Elem)gme).drawDockablePoint(C2.TEMPLINEColor, (int)dockablePoints[2]); + ((Graphic_Figure_Elem) gme).drawDockablePoint(C2.TEMPLINEColor, (int) dockablePoints[2]); } } } @@ -470,11 +417,11 @@ public class A3 if (!(gme instanceof Graphic_Figure_Elem)) continue; if (gme.dsfsfds45645456(event.getX(), event.getY())) { - double[] dockablePoints = ((Graphic_Figure_Elem)gme).getDockablePoint(event.getX(), event.getY()); + double[] dockablePoints = ((Graphic_Figure_Elem) gme).getDockablePoint(event.getX(), event.getY()); if (dockablePoints != null && gme.isConnectable) { - ((Graphic_Figure_Elem)gme).drawDockablePoint(C2.TEMPLINEColor, (int)dockablePoints[2]); + ((Graphic_Figure_Elem) gme).drawDockablePoint(C2.TEMPLINEColor, (int) dockablePoints[2]); } } } @@ -493,8 +440,6 @@ public class A3 A3.this.view.graphicElemLV.scrollTo(A3.this.view.graphicElemLV.getSelectionModel().getSelectedIndex()); - - if (A3.this.view.generateRelationalModelCB.isSelected()) { T1 tableExists = A3.this.relationalModel.getTableGivenNumber(gme.sdfsdfsdfd()); @@ -526,8 +471,8 @@ public class A3 } - - if (A3.this.sdadasd34535trertertret != null && gme != A3.this.sdadasd34535trertertret) A3.this.sdadasd34535trertertret.dfsdfssdf456456(); + if (A3.this.sdadasd34535trertertret != null && gme != A3.this.sdadasd34535trertertret) + A3.this.sdadasd34535trertertret.dfsdfssdf456456(); A3.this.sdadasd34535trertertret = gme; A3.this.elementIsSelected = true; A3.this.thisERMDrawCanvas.requestFocus(); @@ -583,18 +528,6 @@ public class A3 if (event.getButton() == MouseButton.SECONDARY && A3.this.elementIsSelected) { - - - - - - - - - - - - A3.this.thisERMDrawCanvas.dsasadasd345435fghgfh = true; if (!A3.this.thisERMDrawCanvas.contextMenu.isShowing()) { @@ -672,8 +605,7 @@ public class A3 for (Graphic_Main_Elem gme : A3.this.graphicElements) { - if (gme.dsfsfds45645456(event.getX(), event.getY())) - { + if (gme.dsfsfds45645456(event.getX(), event.getY())) { if (gme instanceof Graphic_RS_Identifying_Elem || gme instanceof Graphic_ES_Weak_Elem) { @@ -692,8 +624,7 @@ public class A3 for (Graphic_Main_Elem gme : A3.this.graphicElements) { - if (gme.dsfsfds45645456(event.getX(), event.getY())) - { + if (gme.dsfsfds45645456(event.getX(), event.getY())) { if (gme instanceof Graphic_ES_Weak_Elem || gme instanceof Graphic_ES_Elem || gme instanceof Graphic_RS_ISA_Elem) { @@ -712,8 +643,7 @@ public class A3 for (Graphic_Main_Elem gme : A3.this.graphicElements) { - if (gme.dsfsfds45645456(event.getX(), event.getY())) - { + if (gme.dsfsfds45645456(event.getX(), event.getY())) { if (gme instanceof Graphic_ES_Elem || gme instanceof Graphic_RS_ISA_Elem) { @@ -732,8 +662,7 @@ public class A3 for (Graphic_Main_Elem gme : A3.this.graphicElements) { - if (gme.dsfsfds45645456(event.getX(), event.getY())) - { + if (gme.dsfsfds45645456(event.getX(), event.getY())) { if (gme instanceof Graphic_Figure_Elem && !(gme instanceof Graphic_RS_ISA_Elem)) { @@ -752,8 +681,7 @@ public class A3 for (Graphic_Main_Elem gme : A3.this.graphicElements) { - if (gme.dsfsfds45645456(event.getX(), event.getY())) - { + if (gme.dsfsfds45645456(event.getX(), event.getY())) { if (gme instanceof Graphic_RS_Identifying_Elem || gme instanceof Graphic_ES_Elem || gme instanceof Graphic_ES_Weak_Elem || @@ -778,7 +706,8 @@ public class A3 A5 ermend = new A5(A3.this.thisERMDrawCanvas, event.getScreenX(), event.getScreenY(), null); if (ermend.isDoNothing()) - return; name = ermend.getNameTF().getText(); + return; + name = ermend.getNameTF().getText(); } @@ -812,8 +741,8 @@ public class A3 if (ermend.isDoNothing()) return; gese = new Graphic_RS_ISA_Elem(A3.this.gc, event.getX(), event.getY(), "ISA", A3.this.thisERMDrawCanvas.sdfsddf345ersdf()); - ((Graphic_RS_ISA_Elem)gese).setPartial_or_total(ermend.getP_tTF().getText()); - ((Graphic_RS_ISA_Elem)gese).setDisjunct_or_notdisjunct(ermend.getD_ndTF().getText()); + ((Graphic_RS_ISA_Elem) gese).setPartial_or_total(ermend.getP_tTF().getText()); + ((Graphic_RS_ISA_Elem) gese).setDisjunct_or_notdisjunct(ermend.getD_ndTF().getText()); } if (A3.this.view.attrOneBTN.isSelected()) { gese = new Graphic_ATTR_One_Elem(A3.this.gc, event.getX(), event.getY(), name, false, A3.this.thisERMDrawCanvas.sdfsddf345ersdf()); @@ -841,17 +770,14 @@ public class A3 A3.this.graphicElementsObservable.add(gese); - - - - String operatingSystem = System.getProperty("os.name"); if (!operatingSystem.toLowerCase().contains("linux")) { try { (new Robot()).keyPress(9); - } catch (AWTException ignored) {} + } catch (AWTException ignored) { + } } @@ -865,23 +791,6 @@ public class A3 } - - - - - - - - - - - - - - - - - private boolean sfsdfsdf4354353(int connectionType, Graphic_Main_Elem anyElem1, Graphic_Main_Elem anyElem2) { boolean connectionAllowed = true; @@ -973,30 +882,10 @@ public class A3 } - - - - - - - - - - - - return connectionAllowed; } - - - - - - - - private boolean connectionExists(Graphic_Main_Elem anyElem1, Graphic_Main_Elem anyElem2) { for (Graphic_Main_Elem gme : this.graphicElements) { if (gme instanceof Graphic_LINE_Elem gmeline) { @@ -1010,65 +899,16 @@ public class A3 } - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - public void setConnectivityForFigures() { Graphic_Main_Elem gme; Iterator var2; - for(var2 = this.graphicElements.iterator(); var2.hasNext(); gme.isConnectable = false) { + for (var2 = this.graphicElements.iterator(); var2.hasNext(); gme.isConnectable = false) { gme = var2.next(); } var2 = this.graphicElements.iterator(); - while(true) { + while (true) { do { do { do { @@ -1077,9 +917,9 @@ public class A3 } gme = var2.next(); - } while(!(gme instanceof Graphic_Figure_Elem)); + } while (!(gme instanceof Graphic_Figure_Elem)); - if (this.view.attrToAttrBTN.isSelected() && gme instanceof Graphic_ATTR_Elem && !((Graphic_ATTR_Elem)gme).isKey()) { + if (this.view.attrToAttrBTN.isSelected() && gme instanceof Graphic_ATTR_Elem && !((Graphic_ATTR_Elem) gme).isKey()) { gme.isConnectable = true; } @@ -1106,68 +946,20 @@ public class A3 if (this.view.rsisaGeToESBTN.isSelected() && (gme instanceof Graphic_ES_Elem || gme instanceof Graphic_RS_ISA_Elem)) { gme.isConnectable = true; } - } while(!this.view.rsisaSpToESBTN.isSelected()); - } while(!(gme instanceof Graphic_ES_Elem) && !(gme instanceof Graphic_RS_ISA_Elem)); + } while (!this.view.rsisaSpToESBTN.isSelected()); + } while (!(gme instanceof Graphic_ES_Elem) && !(gme instanceof Graphic_RS_ISA_Elem)); gme.isConnectable = true; } } - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - private boolean attributeHasESRSConnection(Graphic_ATTR_Elem gmeAttribute) { boolean found = false; for (Graphic_Main_Elem gme : this.graphicElements) { if (gme instanceof Graphic_LINE_Attr_ES_Elem || gme instanceof Graphic_LINE_Attr_RS_Elem) { - Graphic_LINE_Elem gmeline = (Graphic_LINE_Elem)gme; + Graphic_LINE_Elem gmeline = (Graphic_LINE_Elem) gme; if (gmeline.getConnectedWithEnd() == gmeAttribute || gmeline.getConnectedWithStart() == gmeAttribute) return false; } @@ -1181,7 +973,7 @@ public class A3 return; } - double[] dockablePoints = ((Graphic_Figure_Elem)gme).getDockablePoint(mouseX, mouseY); + double[] dockablePoints = ((Graphic_Figure_Elem) gme).getDockablePoint(mouseX, mouseY); if (dockablePoints == null) { return; } @@ -1218,17 +1010,6 @@ public class A3 this.view.buttonPane.setDisable(false); - - - - - - - - - - - Graphic_LINE_Elem gese = null; switch (connectionType) { case 0 -> gese = new Graphic_LINE_Attr_Attr_Elem(this.gc, @@ -1319,21 +1100,20 @@ public class A3 } - - this.graphicElementsObservable.add(gese); - - - - this.selectCounterConnection = 0; this.anyElem1.dfsdfssdf456456(); this.anyElem2.dfsdfssdf456456(); this.anyElem1 = null; this.anyElem2 = null; - this.dockXAnyElem1 = 0.0D; this.dockYAnyElem1 = 0.0D; this.dockXAnyElem2 = 0.0D; this.dockYAnyElem2 = 0.0D; this.dockAtPointAnyElem1 = 0; this.asdasdsad435435etertret = 0; + this.dockXAnyElem1 = 0.0D; + this.dockYAnyElem1 = 0.0D; + this.dockXAnyElem2 = 0.0D; + this.dockYAnyElem2 = 0.0D; + this.dockAtPointAnyElem1 = 0; + this.asdasdsad435435etertret = 0; sdfsdfds3465er(true); @@ -1351,12 +1131,6 @@ public class A3 } - - - - - - public void clearERMDrawCanvas() { this.gc.clearRect(0.0D, 0.0D, getWidth(), getHeight()); @@ -1379,9 +1153,6 @@ public class A3 } - - - public void sdfsdfds3465er(boolean clearCanvas) { if (clearCanvas) sfdsfsd43543(); @@ -1390,21 +1161,12 @@ public class A3 } - - - - - public void dsfsdfd456456rezrez(ArrayList without) { dsfsdf12312456dgret(without); sdfdsf456456fghgf(without); } - - - - private void dsfsdf12312456dgret(ArrayList without) { for (Graphic_Main_Elem gme : this.graphicElements) { if ((gme instanceof Graphic_Figure_Elem || gme instanceof Graphic_Text_Elem) && ( @@ -1414,10 +1176,6 @@ public class A3 } - - - - private void sdfdsf456456fghgf(ArrayList without) { for (Graphic_Main_Elem gme : this.graphicElements) { if (gme instanceof Graphic_LINE_Elem && ( @@ -1438,8 +1196,8 @@ public class A3 ArrayList gle = new ArrayList<>(); for (Graphic_Main_Elem gme : this.graphicElements) { if (gme instanceof Graphic_LINE_Elem && ( - (Graphic_LINE_Elem)gme).getConnectedWithStart().sdfsdfsdfd() == elementSelected.sdfsdfsdfd()) { - gle.add((Graphic_LINE_Elem)gme); + (Graphic_LINE_Elem) gme).getConnectedWithStart().sdfsdfsdfd() == elementSelected.sdfsdfsdfd()) { + gle.add((Graphic_LINE_Elem) gme); } } @@ -1447,17 +1205,12 @@ public class A3 } - - - - - public ArrayList sdfsdfds23432rwefsd(Graphic_Main_Elem elementSelected) { ArrayList gle = new ArrayList<>(); for (Graphic_Main_Elem gme : this.graphicElements) { if (gme instanceof Graphic_LINE_Elem && ( - (Graphic_LINE_Elem)gme).getConnectedWithEnd().sdfsdfsdfd() == elementSelected.sdfsdfsdfd()) { - gle.add((Graphic_LINE_Elem)gme); + (Graphic_LINE_Elem) gme).getConnectedWithEnd().sdfsdfsdfd() == elementSelected.sdfsdfsdfd()) { + gle.add((Graphic_LINE_Elem) gme); } } @@ -1465,12 +1218,6 @@ public class A3 } - - - - - - public void sdfdsfd567657rrt(KeyEvent event) { if (this.thisERMDrawCanvas.contextMenu.isShowing()) { return; @@ -1529,7 +1276,7 @@ public class A3 if (this.selectedElements != null) { this.view.setToCopyElements(new ArrayList<>()); for (Graphic_Main_Elem gme : this.selectedElements) { - Graphic_Main_Elem gmeCopy = (Graphic_Main_Elem)T3.copyObject(gme); + Graphic_Main_Elem gmeCopy = (Graphic_Main_Elem) T3.copyObject(gme); this.view.getToCopyElements().add(gmeCopy); } @@ -1549,7 +1296,7 @@ public class A3 if (this.selectedElements != null) { this.view.setToCopyElements(new ArrayList<>()); for (Graphic_Main_Elem gme : this.selectedElements) { - Graphic_Main_Elem gmeCopy = (Graphic_Main_Elem)T3.copyObject(gme); + Graphic_Main_Elem gmeCopy = (Graphic_Main_Elem) T3.copyObject(gme); this.view.getToCopyElements().add(gmeCopy); } } @@ -1564,7 +1311,7 @@ public class A3 ArrayList elementsPrepared = new ArrayList<>(); for (Graphic_Main_Elem gme : this.view.getToCopyElements()) { - Graphic_Main_Elem gmeCopy = (Graphic_Main_Elem)T3.copyObject(gme); + Graphic_Main_Elem gmeCopy = (Graphic_Main_Elem) T3.copyObject(gme); elementsPrepared.add(gmeCopy); } @@ -1574,11 +1321,11 @@ public class A3 if (gme instanceof Graphic_LINE_Elem) { for (Graphic_Main_Elem gmeLinePoint : elementsPrepared) { if (gmeLinePoint instanceof Graphic_Figure_Elem) { - if (((Graphic_LINE_Elem)gme).getConnectedWithEnd().sdfsdfsdfd() == gmeLinePoint.sdfsdfsdfd()) { - ((Graphic_LINE_Elem)gme).setConnectedWithEnd((Graphic_Figure_Elem)gmeLinePoint); + if (((Graphic_LINE_Elem) gme).getConnectedWithEnd().sdfsdfsdfd() == gmeLinePoint.sdfsdfsdfd()) { + ((Graphic_LINE_Elem) gme).setConnectedWithEnd((Graphic_Figure_Elem) gmeLinePoint); } - if (((Graphic_LINE_Elem)gme).getConnectedWithStart().sdfsdfsdfd() == gmeLinePoint.sdfsdfsdfd()) { - ((Graphic_LINE_Elem)gme).setConnectedWithStart((Graphic_Figure_Elem)gmeLinePoint); + if (((Graphic_LINE_Elem) gme).getConnectedWithStart().sdfsdfsdfd() == gmeLinePoint.sdfsdfsdfd()) { + ((Graphic_LINE_Elem) gme).setConnectedWithStart((Graphic_Figure_Elem) gmeLinePoint); } } } @@ -1597,10 +1344,6 @@ public class A3 this.graphicElementsObservable.addAll(elementsPrepared); - - - - sdfsdfds3465er(true); this.elementID = sdfsddf345ersdf(); @@ -1639,10 +1382,6 @@ public class A3 } - - - - } sdfsdfds3465er(true); if (this.view.generateRelationalModelCB.isSelected() && @@ -1663,7 +1402,8 @@ public class A3 if (this.futureActions.size() > 0) { Graphic_Main_Elem redoElem = this.futureActions.remove(this.futureActions.size() - 1); - if (this.graphicElements.size() > 0) this.pastActions.add(this.graphicElements.get(this.graphicElements.size() - 1)); + if (this.graphicElements.size() > 0) + this.pastActions.add(this.graphicElements.get(this.graphicElements.size() - 1)); if (Objects.requireNonNull(redoElem.adsadadsa4354353()) == U4.REMOVE) { this.graphicElements.add(redoElem); redoElem.sfdsfsfsddf123234435(U4.ADD); @@ -1673,9 +1413,6 @@ public class A3 } - - - } sdfsdfds3465er(true); if (this.view.generateRelationalModelCB.isSelected() && @@ -1695,7 +1432,7 @@ public class A3 switch (event.getCode()) { - case F1,S -> { + case F1, S -> { sdfsdfds3465er(true); if (this.view.selectModeBTN.isSelected()) { this.selectedElements = null; @@ -1747,10 +1484,6 @@ public class A3 this.graphicElementsObservable.remove(this.sdadasd34535trertertret); - - - - this.elementIsSelected = false; this.sdadasd34535trertertret = null; @@ -1759,13 +1492,11 @@ public class A3 } - case ESCAPE -> { if (this.thisERMDrawCanvas.dsasadasd345435fghgfh) this.thisERMDrawCanvas.dsasadasd345435fghgfh = false; - if (this.rectangleSelection) { this.rectangleSelection = false; @@ -1802,11 +1533,6 @@ public class A3 } - - - - - case UP -> { if (dsfdsfds4354354fdhf(0.0D, -5.0D)) { @@ -1859,19 +1585,13 @@ public class A3 } - - - - - public void createContextMenu() { this.contextMenu = new ContextMenu(); - - this.contextMenu.setOnHiding(event -> { - if (A3.this.thisERMDrawCanvas.dsasadasd345435fghgfh) A3.this.thisERMDrawCanvas.dsasadasd345435fghgfh = false; + if (A3.this.thisERMDrawCanvas.dsasadasd345435fghgfh) + A3.this.thisERMDrawCanvas.dsasadasd345435fghgfh = false; }); @@ -1882,7 +1602,7 @@ public class A3 A7 ermend = new A7(A3.this.thisERMDrawCanvas, A3.this.dialogXPos, A3.this.dialogYPos, A3.this.sdadasd34535trertertret.name); if (A3.this.sdadasd34535trertertret instanceof Graphic_Text_Elem) { - ((Graphic_Text_Elem)A3.this.sdadasd34535trertertret).changeName(ermend.getTextTA().getText()); + ((Graphic_Text_Elem) A3.this.sdadasd34535trertertret).changeName(ermend.getTextTA().getText()); A3.this.view.graphicElemLV.refresh(); if (A3.this.view.generateRelationalModelCB.isSelected() && @@ -1902,18 +1622,16 @@ public class A3 ArrayList gleListStart = A3.this.dsfdsfdsjhkj456456(A3.this.sdadasd34535trertertret); - ((Graphic_Figure_Elem)A3.this.sdadasd34535trertertret).changeName(ermend.getNameTF().getText()); + ((Graphic_Figure_Elem) A3.this.sdadasd34535trertertret).changeName(ermend.getNameTF().getText()); A3.this.view.graphicElemLV.refresh(); - - if (gleListStart.size() > 0) { for (Graphic_LINE_Elem gle : gleListStart) { gle.dsfsdfsfd(); - gle.setxPos(((Graphic_Figure_Elem)A3.this.sdadasd34535trertertret).getXYForGivenPoint(gle.getLineConnectedWithPointAtStart())[0]); - gle.setyPos(((Graphic_Figure_Elem)A3.this.sdadasd34535trertertret).getXYForGivenPoint(gle.getLineConnectedWithPointAtStart())[1]); + gle.setxPos(((Graphic_Figure_Elem) A3.this.sdadasd34535trertertret).getXYForGivenPoint(gle.getLineConnectedWithPointAtStart())[0]); + gle.setyPos(((Graphic_Figure_Elem) A3.this.sdadasd34535trertertret).getXYForGivenPoint(gle.getLineConnectedWithPointAtStart())[1]); gle.safdsadasds32432456456(); } } @@ -1921,8 +1639,8 @@ public class A3 if (gleListEnd.size() > 0) { for (Graphic_LINE_Elem gle : gleListEnd) { gle.dsfsdfsfd(); - gle.setxEnd(((Graphic_Figure_Elem)A3.this.sdadasd34535trertertret).getXYForGivenPoint(gle.getLineConnectedWithPointAtEnd())[0]); - gle.setyEnd(((Graphic_Figure_Elem)A3.this.sdadasd34535trertertret).getXYForGivenPoint(gle.getLineConnectedWithPointAtEnd())[1]); + gle.setxEnd(((Graphic_Figure_Elem) A3.this.sdadasd34535trertertret).getXYForGivenPoint(gle.getLineConnectedWithPointAtEnd())[0]); + gle.setyEnd(((Graphic_Figure_Elem) A3.this.sdadasd34535trertertret).getXYForGivenPoint(gle.getLineConnectedWithPointAtEnd())[1]); gle.safdsadasds32432456456(); } } @@ -1939,7 +1657,7 @@ public class A3 this.addMinMax = new MenuItem("Change Min/Max"); this.addMinMax.setOnAction(event -> { event.consume(); - Graphic_LINE_Elem gle = (Graphic_LINE_Elem)A3.this.sdadasd34535trertertret; + Graphic_LINE_Elem gle = (Graphic_LINE_Elem) A3.this.sdadasd34535trertertret; A4 ermend = new A4(A3.this.thisERMDrawCanvas, A3.this.dialogXPos, A3.this.dialogYPos, gle.getMinimum(), gle.getMaximum()); gle.changeMinMax(ermend.getMinTF().getText(), ermend.getMaxTF().getText()); A3.this.view.graphicElemLV.refresh(); @@ -1955,7 +1673,7 @@ public class A3 this.addISASpec = new MenuItem("Change T-P/D-ND"); this.addISASpec.setOnAction(event -> { event.consume(); - Graphic_RS_ISA_Elem gle = (Graphic_RS_ISA_Elem)A3.this.sdadasd34535trertertret; + Graphic_RS_ISA_Elem gle = (Graphic_RS_ISA_Elem) A3.this.sdadasd34535trertertret; A6 ermend = new A6(A3.this.thisERMDrawCanvas, A3.this.dialogXPos, A3.this.dialogYPos, gle.getPartial_or_total(), gle.getDisjunct_or_notdisjunct()); gle.changeP_T_D_ND(ermend.getP_tTF().getText(), ermend.getD_ndTF().getText()); A3.this.view.graphicElemLV.refresh(); @@ -1970,7 +1688,7 @@ public class A3 this.sadsadas4353453retretret = new MenuItem("ES/RS Transformation"); this.sadsadas4353453retretret.setOnAction(event -> { event.consume(); - U3 tir = (U3)A3.this.sdadasd34535trertertret; + U3 tir = (U3) A3.this.sdadasd34535trertertret; A9 ermend = new A9(A3.this.thisERMDrawCanvas, A3.this.dialogXPos, A3.this.dialogYPos, A3.this.sdadasd34535trertertret.name, @@ -1995,11 +1713,10 @@ public class A3 }); - this.sdfsdfsdfsdfdsf324324 = new MenuItem("Attribute Transformation"); this.sdfsdfsdfsdfdsf324324.setOnAction(event -> { event.consume(); - U2 tir = (U2)A3.this.sdadasd34535trertertret; + U2 tir = (U2) A3.this.sdadasd34535trertertret; if (A3.this.sdadasd34535trertertret instanceof Graphic_ATTR_Multi_Elem) { B1 ermend = new B1(A3.this.thisERMDrawCanvas, A3.this.dialogXPos, A3.this.dialogYPos, A3.this.sdadasd34535trertertret.name, @@ -2023,8 +1740,7 @@ public class A3 tir.setIsKey(ermend.getIsKeyCB().isSelected()); tir.setIsNullable(ermend.getIsNullableCB().isSelected()); tir.setIsUnique(ermend.getIsUniqueCB().isSelected()); - } - else { + } else { A8 ermend = new A8(A3.this.thisERMDrawCanvas, A3.this.dialogXPos, A3.this.dialogYPos, A3.this.sdadasd34535trertertret.name, @@ -2085,24 +1801,21 @@ public class A3 } - - - - - - - private void prepareForDockingChange(Graphic_Figure_Elem figureHold, double x, double y, byte pointAt) { this.sdadasd34535trertertret.dsfsdfsfd(); this.graphicElementsObservable.remove(this.sdadasd34535trertertret); this.connectionModeSet = true; - if (this.sdadasd34535trertertret instanceof Graphic_LINE_RSISAG_ES_Elem) this.view.rsisaGeToESBTN.setSelected(true); - if (this.sdadasd34535trertertret instanceof Graphic_LINE_RSISAS_ES_Elem) this.view.rsisaSpToESBTN.setSelected(true); - if (this.sdadasd34535trertertret instanceof Graphic_LINE_Attr_Attr_Elem) this.view.attrToAttrBTN.setSelected(true); + if (this.sdadasd34535trertertret instanceof Graphic_LINE_RSISAG_ES_Elem) + this.view.rsisaGeToESBTN.setSelected(true); + if (this.sdadasd34535trertertret instanceof Graphic_LINE_RSISAS_ES_Elem) + this.view.rsisaSpToESBTN.setSelected(true); + if (this.sdadasd34535trertertret instanceof Graphic_LINE_Attr_Attr_Elem) + this.view.attrToAttrBTN.setSelected(true); if (this.sdadasd34535trertertret instanceof Graphic_LINE_Attr_ES_Elem) this.view.attrToESBTN.setSelected(true); if (this.sdadasd34535trertertret instanceof Graphic_LINE_Attr_RS_Elem) this.view.attrToRSBTN.setSelected(true); - if (this.sdadasd34535trertertret instanceof Graphic_LINE_RSID_ESWEAK_Elem) this.view.rsidToESWeakBTN.setSelected(true); + if (this.sdadasd34535trertertret instanceof Graphic_LINE_RSID_ESWEAK_Elem) + this.view.rsidToESWeakBTN.setSelected(true); if (this.sdadasd34535trertertret instanceof Graphic_LINE_RSID_ES_Elem) this.view.rsidToESBTN.setSelected(true); if (this.sdadasd34535trertertret instanceof Graphic_LINE_RS_ES_Elem) this.view.rsToESBTN.setSelected(true); @@ -2120,9 +1833,6 @@ public class A3 } - - - private void setContextMenuItems(double xPos, double yPos) { this.dialogXPos = xPos; this.dialogYPos = yPos; @@ -2138,7 +1848,6 @@ public class A3 this.changeDockingPointAtFigure2.setVisible(false); - if (this.sdadasd34535trertertret instanceof Graphic_Text_Elem) { this.addText.setVisible(true); this.addName.setVisible(false); @@ -2221,7 +1930,7 @@ public class A3 this.addISASpec.setVisible(false); this.sadsadas4353453retretret.setVisible(false); this.sdfsdfsdfsdfdsf324324.setVisible(false); - this.connectionToChange = (Graphic_LINE_Elem)this.sdadasd34535trertertret; + this.connectionToChange = (Graphic_LINE_Elem) this.sdadasd34535trertertret; this.figureToChange1 = this.connectionToChange.getConnectedWithEnd(); this.figureToChange2 = this.connectionToChange.getConnectedWithStart(); this.changeDockingPointAtFigure1.setVisible(true); @@ -2246,7 +1955,7 @@ public class A3 this.addISASpec.setVisible(false); this.sadsadas4353453retretret.setVisible(false); this.sdfsdfsdfsdfdsf324324.setVisible(false); - this.connectionToChange = (Graphic_LINE_Elem)this.sdadasd34535trertertret; + this.connectionToChange = (Graphic_LINE_Elem) this.sdadasd34535trertertret; this.figureToChange1 = this.connectionToChange.getConnectedWithEnd(); this.figureToChange2 = this.connectionToChange.getConnectedWithStart(); this.changeDockingPointAtFigure1.setVisible(true); @@ -2259,15 +1968,6 @@ public class A3 } - - - - - - - - - private ArrayList sdfsdf21321456456(double xStart, double yStart, double xEnd, double yEnd) { ArrayList selEl = new ArrayList<>(); for (Graphic_Main_Elem gme : this.graphicElements) { @@ -2284,11 +1984,6 @@ public class A3 } - - - - - public void sfsdfsfds4343(long elementID) { for (int i = 0; i < this.graphicElements.size(); i++) { if (this.graphicElements.get(i).sdfsdfsdfd() == elementID) { @@ -2299,13 +1994,6 @@ public class A3 } - - - - - - - public void sdfdsfdsdf43543ref() { if (this.rectangleSelection) { this.rectangleSelection = false; @@ -2317,23 +2005,11 @@ public class A3 } - - - public void sfdsfsd43543() { this.gc.clearRect(0.0D, 0.0D, this.canvasWidth, this.canvasHeight); } - - - - - - - - - private boolean dsfsdfds435345esfsfd(double newX, double newY, ArrayList selectedElements) { for (Graphic_Main_Elem gme : selectedElements) { if (dsfdsf43534dfdfhg(newX, newY, gme)) return false; @@ -2342,9 +2018,6 @@ public class A3 } - - - private boolean dsfdsfds4354354fdhf(double newXd, double newYd) { for (Graphic_Main_Elem gme : this.graphicElements) { if (dsfdsf43534dfdfhg(gme.getxPos() + newXd, gme.getyPos() + newYd, gme)) return false; @@ -2353,26 +2026,13 @@ public class A3 } - - - - - - - private boolean dsfdsf43534dfdfhg(double newX, double newY, Graphic_Main_Elem gme) { - if (gme instanceof Graphic_Figure_Elem || gme instanceof Graphic_Text_Elem) - { + if (gme instanceof Graphic_Figure_Elem || gme instanceof Graphic_Text_Elem) { return !(newX - gme.dsfsfsd456457657() / 2.0D >= 0.0D) || !(newY - gme.getHeight() / 2.0D >= 0.0D); - } - - else return !(newX >= 0.0D) || !(newY >= 0.0D); + } else return !(newX >= 0.0D) || !(newY >= 0.0D); } - - - public double[] dssfsdfd43643634() { double[] widthHeight = new double[2]; double maxHeight = 0.0D; @@ -2394,60 +2054,36 @@ public class A3 } - - public ArrayList sddsfsfsdf45645645() { return this.graphicElements; } - - public void safdsadsa65765ewthjk(ArrayList graphicElements) { this.graphicElementsObservable.addAll(graphicElements); } - - public File getSaveFile() { return this.modelSavedInFile; } - - public void setSaveFile(File modelSavedInFile) { this.modelSavedInFile = modelSavedInFile; } - - - - - - - - - - - - - - public void sdfdsfdsdf34543erretwre() { setConnectivityForFigures(); for (Graphic_Main_Elem gme : this.graphicElements) { if (gme instanceof Graphic_Figure_Elem) { - ((Graphic_Figure_Elem)gme).dockablePointsAtElem(); + ((Graphic_Figure_Elem) gme).dockablePointsAtElem(); } } } - - public void sdfsdfds435634terf() { this.rectangleSelection = false; this.selectedElements = null; @@ -2456,15 +2092,10 @@ public class A3 } - - - - - - public void modelVisibility() { if (this.view.menuVisibilityAllRMI == null) - return; if (this.view.menuVisibilityAllRMI.isSelected() && this.view.menuVisibilityTEXTRMI.isSelected()) { + return; + if (this.view.menuVisibilityAllRMI.isSelected() && this.view.menuVisibilityTEXTRMI.isSelected()) { for (Graphic_Main_Elem gme : this.graphicElements) { gme.isVisible = true; } @@ -2491,7 +2122,6 @@ public class A3 } - if ((this.view.menuVisibilityES_RSRMI.isSelected() || this.view.menuVisibilityES_RS_KEYRMI.isSelected()) && ( gme instanceof Graphic_ES_Main_Elem || gme instanceof Graphic_RS_Main_Elem)) { gme.isVisible = true; @@ -2515,7 +2145,6 @@ public class A3 } - if (this.view.menuVisibilityES_RS_KEYRMI.isSelected()) { for (Graphic_Main_Elem attributes : getKeyAttributesForVisibility(gme)) { @@ -2544,25 +2173,16 @@ public class A3 } - - - - public long getElementID() { return this.elementID; } - - public void dsfds124332(long elementID) { this.elementID = elementID; } - - - public long sdfsddf345ersdf() { long lastId = 0L; for (Graphic_Main_Elem gme : this.graphicElements) { @@ -2587,16 +2207,8 @@ public class A3 } - - - - - - private void sdfdsfsfds() {} - - - - + private void sdfdsfsfds() { + } public double getCanvasWidth() { @@ -2604,27 +2216,22 @@ public class A3 } - - public double getCanvasHeight() { return this.canvasHeight; } - - - - - - private void sfdsfsfdss324243wer(T1 table) { this.view.rootColumnNode = new TreeItem<>(null); this.view.treeColumnView = new TreeView<>(this.view.rootColumnNode); this.view.treeColumnView.setShowRoot(false); - if (this.view.verticalBox.getChildren().size() > 1) { this.view.verticalBox.getChildren().set(1, this.view.treeColumnView); } - else { this.view.verticalBox.getChildren().add(this.view.treeColumnView); } + if (this.view.verticalBox.getChildren().size() > 1) { + this.view.verticalBox.getChildren().set(1, this.view.treeColumnView); + } else { + this.view.verticalBox.getChildren().add(this.view.treeColumnView); + } this.view.treeColumnView.setCellFactory(p -> new TreeCell<>() { protected void updateItem(C3 item, boolean empty) { @@ -2662,13 +2269,6 @@ public class A3 } - - - - - - - public boolean dsfdsdfssdf45645re() { if (!this.view.generateRelationalModelCB.isSelected()) { return false; @@ -2681,16 +2281,6 @@ public class A3 } catch (StackOverflowError sofe) { - - - - - - - - - - this.view.verticalBox.getChildren().clear(); @@ -2699,8 +2289,6 @@ public class A3 } - - ImageView treeviewImg = new ImageView(C2.esImage); treeviewImg.setFitHeight(20.0D); treeviewImg.setFitWidth(20.0D); @@ -2712,7 +2300,7 @@ public class A3 this.view.treeTableView.setShowRoot(false); this.view.treeTableView.setOnKeyReleased(event -> { - @SuppressWarnings("unchecked") TreeView tv = (TreeView)event.getSource(); + @SuppressWarnings("unchecked") TreeView tv = (TreeView) event.getSource(); TreeItem selectedItem = tv.getSelectionModel().getSelectedItem(); T1 selectedRelation = selectedItem.getValue(); A3.this.view.selectModeBTN.setSelected(true); @@ -2724,7 +2312,7 @@ public class A3 this.view.treeTableView.setOnMouseClicked(event -> { - @SuppressWarnings("unchecked") TreeView tv = (TreeView)event.getSource(); + @SuppressWarnings("unchecked") TreeView tv = (TreeView) event.getSource(); TreeItem selectedItem = tv.getSelectionModel().getSelectedItem(); if (selectedItem != null) { T1 selectedRelation = selectedItem.getValue(); @@ -2738,10 +2326,11 @@ public class A3 }); - - - if (this.view.verticalBox.getChildren().size() > 0) { this.view.verticalBox.getChildren().set(0, this.view.treeTableView); } - else { this.view.verticalBox.getChildren().add(this.view.treeTableView); } + if (this.view.verticalBox.getChildren().size() > 0) { + this.view.verticalBox.getChildren().set(0, this.view.treeTableView); + } else { + this.view.verticalBox.getChildren().add(this.view.treeTableView); + } this.view.treeTableView.setCellFactory(p -> new TreeCell<>() { protected void updateItem(T1 item, boolean empty) { super.updateItem(item, empty); @@ -2776,7 +2365,7 @@ public class A3 } if (this.view.rootTableNode.getChildren().size() > 0) { this.view.treeTableView.getSelectionModel().select(0); - T1 selectedRelation = (T1)((TreeItem)this.view.treeTableView.getSelectionModel().getSelectedItem()).getValue(); + T1 selectedRelation = (T1) ((TreeItem) this.view.treeTableView.getSelectionModel().getSelectedItem()).getValue(); this.view.selectModeBTN.setSelected(true); this.thisERMDrawCanvas.sdfsdfds3465er(true); this.thisERMDrawCanvas.dsfdsfsdf43543refds(selectedRelation.getReferstoGraphicalElement()); @@ -2792,19 +2381,11 @@ public class A3 } - - public C4 dsfdsfd45645zr() { return this.relationalModel; } - - - - - - private ArrayList getAttributesForVisibility(Graphic_Main_Elem gme) { ArrayList attributes = new ArrayList<>(); for (Graphic_Main_Elem gmLooking : this.graphicElements) { @@ -2813,10 +2394,10 @@ public class A3 if (gmLooking instanceof Graphic_LINE_Elem) { - if (((Graphic_LINE_Elem)gmLooking).getConnectedWithEnd().sdfsdfsdfd() == gme.sdfsdfsdfd() && ((Graphic_LINE_Elem) gmLooking).getConnectedWithStart() instanceof Graphic_ATTR_Elem gae) { + if (((Graphic_LINE_Elem) gmLooking).getConnectedWithEnd().sdfsdfsdfd() == gme.sdfsdfsdfd() && ((Graphic_LINE_Elem) gmLooking).getConnectedWithStart() instanceof Graphic_ATTR_Elem gae) { attributes.add(gae); } - if (((Graphic_LINE_Elem)gmLooking).getConnectedWithStart().sdfsdfsdfd() == gme.sdfsdfsdfd() && ((Graphic_LINE_Elem) gmLooking).getConnectedWithEnd() instanceof Graphic_ATTR_Elem gae) { + if (((Graphic_LINE_Elem) gmLooking).getConnectedWithStart().sdfsdfsdfd() == gme.sdfsdfsdfd() && ((Graphic_LINE_Elem) gmLooking).getConnectedWithEnd() instanceof Graphic_ATTR_Elem gae) { attributes.add(gae); } } @@ -2825,11 +2406,6 @@ public class A3 } - - - - - private ArrayList getKeyAttributesForVisibility(Graphic_Main_Elem gme) { ArrayList attributes = new ArrayList<>(); for (Graphic_Main_Elem gmLooking : this.graphicElements) { @@ -2838,15 +2414,15 @@ public class A3 if (gmLooking instanceof Graphic_LINE_Elem) { - if (((Graphic_LINE_Elem)gmLooking).getConnectedWithEnd().sdfsdfsdfd() == gme.sdfsdfsdfd() && ( - (Graphic_LINE_Elem)gmLooking).getConnectedWithStart() instanceof Graphic_ATTR_Key_Elem) { - Graphic_ATTR_Elem gae = (Graphic_ATTR_Elem)((Graphic_LINE_Elem)gmLooking).getConnectedWithStart(); + if (((Graphic_LINE_Elem) gmLooking).getConnectedWithEnd().sdfsdfsdfd() == gme.sdfsdfsdfd() && ( + (Graphic_LINE_Elem) gmLooking).getConnectedWithStart() instanceof Graphic_ATTR_Key_Elem) { + Graphic_ATTR_Elem gae = (Graphic_ATTR_Elem) ((Graphic_LINE_Elem) gmLooking).getConnectedWithStart(); attributes.add(gae); } - if (((Graphic_LINE_Elem)gmLooking).getConnectedWithStart().sdfsdfsdfd() == gme.sdfsdfsdfd() && ( - (Graphic_LINE_Elem)gmLooking).getConnectedWithEnd() instanceof Graphic_ATTR_Key_Elem) { - Graphic_ATTR_Elem gae = (Graphic_ATTR_Elem)((Graphic_LINE_Elem)gmLooking).getConnectedWithEnd(); + if (((Graphic_LINE_Elem) gmLooking).getConnectedWithStart().sdfsdfsdfd() == gme.sdfsdfsdfd() && ( + (Graphic_LINE_Elem) gmLooking).getConnectedWithEnd() instanceof Graphic_ATTR_Key_Elem) { + Graphic_ATTR_Elem gae = (Graphic_ATTR_Elem) ((Graphic_LINE_Elem) gmLooking).getConnectedWithEnd(); attributes.add(gae); } @@ -2856,11 +2432,6 @@ public class A3 } - - - - - private ArrayList getWeakKeyAttributesForVisibility(Graphic_Main_Elem gme) { ArrayList attributes = new ArrayList<>(); for (Graphic_Main_Elem gmLooking : this.graphicElements) { @@ -2869,15 +2440,15 @@ public class A3 if (gmLooking instanceof Graphic_LINE_Elem) { - if (((Graphic_LINE_Elem)gmLooking).getConnectedWithEnd().sdfsdfsdfd() == gme.sdfsdfsdfd() && ( - (Graphic_LINE_Elem)gmLooking).getConnectedWithStart() instanceof Graphic_ATTR_Weak_Key_Elem) { - Graphic_ATTR_Elem gae = (Graphic_ATTR_Elem)((Graphic_LINE_Elem)gmLooking).getConnectedWithStart(); + if (((Graphic_LINE_Elem) gmLooking).getConnectedWithEnd().sdfsdfsdfd() == gme.sdfsdfsdfd() && ( + (Graphic_LINE_Elem) gmLooking).getConnectedWithStart() instanceof Graphic_ATTR_Weak_Key_Elem) { + Graphic_ATTR_Elem gae = (Graphic_ATTR_Elem) ((Graphic_LINE_Elem) gmLooking).getConnectedWithStart(); attributes.add(gae); } - if (((Graphic_LINE_Elem)gmLooking).getConnectedWithStart().sdfsdfsdfd() == gme.sdfsdfsdfd() && ( - (Graphic_LINE_Elem)gmLooking).getConnectedWithEnd() instanceof Graphic_ATTR_Weak_Key_Elem) { - Graphic_ATTR_Elem gae = (Graphic_ATTR_Elem)((Graphic_LINE_Elem)gmLooking).getConnectedWithEnd(); + if (((Graphic_LINE_Elem) gmLooking).getConnectedWithStart().sdfsdfsdfd() == gme.sdfsdfsdfd() && ( + (Graphic_LINE_Elem) gmLooking).getConnectedWithEnd() instanceof Graphic_ATTR_Weak_Key_Elem) { + Graphic_ATTR_Elem gae = (Graphic_ATTR_Elem) ((Graphic_LINE_Elem) gmLooking).getConnectedWithEnd(); attributes.add(gae); } @@ -2887,11 +2458,6 @@ public class A3 } - - - - - public void dsfdsfsdf43543refds(long refersToElement) { for (Graphic_Main_Elem gme : this.graphicElements) { if (gme.sdfsdfsdfd() == refersToElement) { @@ -2902,18 +2468,11 @@ public class A3 } - - public B3 getView() { return this.view; } - - - - - private void dsfsdfds7687683rew(TreeItem item) { if (item != null && !item.isLeaf()) { item.setExpanded(false); @@ -2924,65 +2483,46 @@ public class A3 } - - public String getInitialDirectory() { return this.initialDirectory; } - - public void setInitialDirectory(String initialDirectory) { this.initialDirectory = initialDirectory; } - - public ObservableList fsdfdsfds1231278() { return this.graphicElementsObservable; } - - public void asdadsa32432rweewr() { Collections.sort(this.graphicElements); } - - public void sortGraphicElementsByName() { this.attributeElements.sort(Comparator.comparing(arg0 -> arg0.sdfsdfsd32234243().toLowerCase())); } - - - public ArrayList getAttributeElements() { return this.attributeElements; } - - public boolean isConnectionModeSet() { return this.connectionModeSet; } - - public void setConnectionModeSet(boolean connectionModeSet) { this.connectionModeSet = connectionModeSet; } - - public U1 getTabWithCanvas() { return this.u1; } diff --git a/at/fos/ermodel/gui/A4.java b/at/fos/ermodel/gui/A4.java index 2f25a94..3460ea6 100644 --- a/at/fos/ermodel/gui/A4.java +++ b/at/fos/ermodel/gui/A4.java @@ -1,180 +1,163 @@ - package at.fos.ermodel.gui; +package at.fos.ermodel.gui; - import javafx.geometry.Insets; - import javafx.scene.Scene; - import javafx.scene.control.Label; - import javafx.scene.control.TextField; - import javafx.scene.layout.GridPane; - import javafx.stage.Modality; - import javafx.stage.Stage; - import javafx.stage.StageStyle; - - public class A4 - extends Stage - { - private final A4 thisActionMessageDialog; - private final TextField minTF; - private final TextField maxTF; - private boolean doNothing; - private final String holdminimum; - private final String holdmaximum; - - public A4(final A3 canvas, double xPos, double yPos, String minimum, String maximum) { +import javafx.geometry.Insets; +import javafx.scene.Scene; +import javafx.scene.control.Label; +import javafx.scene.control.TextField; +import javafx.scene.layout.GridPane; +import javafx.stage.Modality; +import javafx.stage.Stage; +import javafx.stage.StageStyle; - String title = "Enter Min-Max"; - - this.holdminimum = minimum; - this.holdmaximum = maximum; - - this.doNothing = false; - - this.thisActionMessageDialog = this; - setTitle(title); - initModality(Modality.APPLICATION_MODAL); - - - - - - this.minTF = new TextField(minimum); - this.minTF.textProperty().addListener((observable, oldValue, newValue) -> { - if (newValue.length() > 1 && newValue.charAt(0) == '0') { - newValue = newValue.replaceAll("^0*", ""); - if (newValue.length() == 0) - newValue = "0"; - this.minTF.setText(newValue); - } - if (!newValue.matches("\\d*")) - this.minTF.setText(newValue.replaceAll("[^\\d]", "")); - }); - this.minTF.setPrefWidth(50.0D); - this.minTF.setOnMouseEntered(event -> T3.fdssdf4354(A4.this.minTF, C2.MouseSelectedColor)); - this.minTF.setOnMouseExited(event -> A4.this.minTF.setEffect(null)); - - this.minTF.setOnKeyPressed(event -> { - switch (event.getCode()) { - case ENTER -> A4.this.maxTF.requestFocus(); - case ESCAPE -> A4.this.setNothingAndLeave(); - } +public class A4 + extends Stage { + private final A4 thisActionMessageDialog; + private final TextField minTF; + private final TextField maxTF; + private final String holdminimum; + private final String holdmaximum; + private boolean doNothing; - }); - this.maxTF = new TextField(maximum); - this.maxTF.setPrefWidth(50.0D); - this.maxTF.textProperty().addListener((observable, oldValue, newValue) -> { - if (newValue.length() == 1 && newValue.charAt(0) == '0') { - newValue = "n"; - this.maxTF.setText(newValue); - return; - } - if (newValue.length() > 1 && !newValue.matches("\\d*")) { - newValue = "n"; - this.maxTF.setText(newValue); - return; - } - if (newValue.length() == 1 && newValue.charAt(0) == 'n') { - newValue = "n"; - this.maxTF.setText(newValue); - return; - } - if (newValue.length() > 1 && newValue.charAt(0) == '0') { - newValue = newValue.replaceAll("^0*", ""); - if (newValue.length() == 0) - newValue = "0"; - this.maxTF.setText(newValue); - return; - } - if (!newValue.matches("\\d*")) - this.maxTF.setText(newValue.replaceAll("[^\\d]", "")); - }); - this.maxTF.setOnMouseEntered(event -> T3.fdssdf4354(A4.this.maxTF, C2.MouseSelectedColor)); - this.maxTF.setOnMouseExited(event -> A4.this.maxTF.setEffect(null)); - this.maxTF.setOnKeyPressed(event -> { - switch (event.getCode()) { - case ENTER -> { - A4.this.setDataAndLeave(); - if (!canvas.getTabWithCanvas().getText().contains("*")) - canvas.getTabWithCanvas().setText(canvas.getTabWithCanvas().getText() + "*"); - } - case ESCAPE -> A4.this.setNothingAndLeave(); - } + public A4(final A3 canvas, double xPos, double yPos, String minimum, String maximum) { - }); - GridPane gPane = new GridPane(); - gPane.setPadding(new Insets(10.0D, 10.0D, 10.0D, 10.0D)); - - gPane.setHgap(4.0D); - - gPane.add(new Label("ESC->Cancel"), 0, 0, 2, 1); - gPane.add(new Label("Minimum:"), 0, 1); - gPane.add(this.minTF, 1, 1); - gPane.add(new Label("Maximum:"), 0, 2); - gPane.add(this.maxTF, 1, 2); - - - - - initStyle(StageStyle.UNDECORATED); - Scene scene = new Scene(gPane, 130.0D, 90.0D); - - setScene(scene); - - setX(xPos); - setY(yPos); - if (yPos + scene.getHeight() > canvas.getView().getHeight() - 5.0D) { - setY(yPos - scene.getHeight() - 20.0D); - } - if (xPos + scene.getWidth() > canvas.getView().getWidth() - 5.0D) { - setX(xPos - scene.getWidth() - 20.0D); - } - - this.minTF.requestFocus(); - this.minTF.selectPositionCaret(0); - this.minTF.selectEndOfNextWord(); - sizeToScene(); - showAndWait(); - } - - - - - private void setDataAndLeave() { - if (this.minTF.getText() == null || this.minTF.getText().length() == 0) this.minTF.setText("m"); - if (this.maxTF.getText() == null || this.maxTF.getText().length() == 0) this.maxTF.setText("n"); - this.thisActionMessageDialog.close(); - } - - - - - - private void setNothingAndLeave() { - this.minTF.setText(this.holdminimum); - this.maxTF.setText(this.holdmaximum); - this.doNothing = true; - - this.thisActionMessageDialog.close(); - } - - - - - public TextField getMinTF() { - return this.minTF; - } - - - - - public TextField getMaxTF() { - return this.maxTF; - } - - - - - public boolean isDoNothing() { - return this.doNothing; - } - } + String title = "Enter Min-Max"; + + this.holdminimum = minimum; + this.holdmaximum = maximum; + + this.doNothing = false; + + this.thisActionMessageDialog = this; + setTitle(title); + initModality(Modality.APPLICATION_MODAL); + + + this.minTF = new TextField(minimum); + this.minTF.textProperty().addListener((observable, oldValue, newValue) -> { + if (newValue.length() > 1 && newValue.charAt(0) == '0') { + newValue = newValue.replaceAll("^0*", ""); + if (newValue.length() == 0) + newValue = "0"; + this.minTF.setText(newValue); + } + if (!newValue.matches("\\d*")) + this.minTF.setText(newValue.replaceAll("[^\\d]", "")); + }); + this.minTF.setPrefWidth(50.0D); + this.minTF.setOnMouseEntered(event -> T3.fdssdf4354(A4.this.minTF, C2.MouseSelectedColor)); + this.minTF.setOnMouseExited(event -> A4.this.minTF.setEffect(null)); + + this.minTF.setOnKeyPressed(event -> { + switch (event.getCode()) { + case ENTER -> A4.this.maxTF.requestFocus(); + case ESCAPE -> A4.this.setNothingAndLeave(); + } + + }); + this.maxTF = new TextField(maximum); + this.maxTF.setPrefWidth(50.0D); + this.maxTF.textProperty().addListener((observable, oldValue, newValue) -> { + if (newValue.length() == 1 && newValue.charAt(0) == '0') { + newValue = "n"; + this.maxTF.setText(newValue); + return; + } + if (newValue.length() > 1 && !newValue.matches("\\d*")) { + newValue = "n"; + this.maxTF.setText(newValue); + return; + } + if (newValue.length() == 1 && newValue.charAt(0) == 'n') { + newValue = "n"; + this.maxTF.setText(newValue); + return; + } + if (newValue.length() > 1 && newValue.charAt(0) == '0') { + newValue = newValue.replaceAll("^0*", ""); + if (newValue.length() == 0) + newValue = "0"; + this.maxTF.setText(newValue); + return; + } + if (!newValue.matches("\\d*")) + this.maxTF.setText(newValue.replaceAll("[^\\d]", "")); + }); + this.maxTF.setOnMouseEntered(event -> T3.fdssdf4354(A4.this.maxTF, C2.MouseSelectedColor)); + this.maxTF.setOnMouseExited(event -> A4.this.maxTF.setEffect(null)); + this.maxTF.setOnKeyPressed(event -> { + switch (event.getCode()) { + case ENTER -> { + A4.this.setDataAndLeave(); + if (!canvas.getTabWithCanvas().getText().contains("*")) + canvas.getTabWithCanvas().setText(canvas.getTabWithCanvas().getText() + "*"); + } + case ESCAPE -> A4.this.setNothingAndLeave(); + } + + }); + GridPane gPane = new GridPane(); + gPane.setPadding(new Insets(10.0D, 10.0D, 10.0D, 10.0D)); + + gPane.setHgap(4.0D); + + gPane.add(new Label("ESC->Cancel"), 0, 0, 2, 1); + gPane.add(new Label("Minimum:"), 0, 1); + gPane.add(this.minTF, 1, 1); + gPane.add(new Label("Maximum:"), 0, 2); + gPane.add(this.maxTF, 1, 2); + + + initStyle(StageStyle.UNDECORATED); + Scene scene = new Scene(gPane, 130.0D, 90.0D); + + setScene(scene); + + setX(xPos); + setY(yPos); + if (yPos + scene.getHeight() > canvas.getView().getHeight() - 5.0D) { + setY(yPos - scene.getHeight() - 20.0D); + } + if (xPos + scene.getWidth() > canvas.getView().getWidth() - 5.0D) { + setX(xPos - scene.getWidth() - 20.0D); + } + + this.minTF.requestFocus(); + this.minTF.selectPositionCaret(0); + this.minTF.selectEndOfNextWord(); + sizeToScene(); + showAndWait(); + } + + + private void setDataAndLeave() { + if (this.minTF.getText() == null || this.minTF.getText().length() == 0) this.minTF.setText("m"); + if (this.maxTF.getText() == null || this.maxTF.getText().length() == 0) this.maxTF.setText("n"); + this.thisActionMessageDialog.close(); + } + + + private void setNothingAndLeave() { + this.minTF.setText(this.holdminimum); + this.maxTF.setText(this.holdmaximum); + this.doNothing = true; + + this.thisActionMessageDialog.close(); + } + + + public TextField getMinTF() { + return this.minTF; + } + + + public TextField getMaxTF() { + return this.maxTF; + } + + + public boolean isDoNothing() { + return this.doNothing; + } +} diff --git a/at/fos/ermodel/gui/A5.java b/at/fos/ermodel/gui/A5.java index 9b1dc41..66be864 100644 --- a/at/fos/ermodel/gui/A5.java +++ b/at/fos/ermodel/gui/A5.java @@ -1,117 +1,103 @@ - package at.fos.ermodel.gui; +package at.fos.ermodel.gui; - import javafx.geometry.Insets; - import javafx.scene.Scene; - import javafx.scene.control.Label; - import javafx.scene.control.TextField; - import javafx.scene.layout.GridPane; - import javafx.stage.Modality; - import javafx.stage.Stage; - import javafx.stage.StageStyle; +import javafx.geometry.Insets; +import javafx.scene.Scene; +import javafx.scene.control.Label; +import javafx.scene.control.TextField; +import javafx.scene.layout.GridPane; +import javafx.stage.Modality; +import javafx.stage.Stage; +import javafx.stage.StageStyle; - public class A5 - extends Stage - { - private final A5 thisActionMessageDialog; - private final TextField nameTF; - private boolean doNothing; - private final String holdName; - - public A5(final A3 canvas, double xPos, double yPos, String name) { +public class A5 + extends Stage { + private final A5 thisActionMessageDialog; + private final TextField nameTF; + private final String holdName; + private boolean doNothing; - String title = "Enter Name"; - - - this.holdName = name; - this.doNothing = false; - - this.thisActionMessageDialog = this; - setTitle(title); - initModality(Modality.APPLICATION_MODAL); - - - - - - this.nameTF = new TextField(name); - this.nameTF.setOnMouseEntered(event -> T3.fdssdf4354(A5.this.nameTF, C2.MouseSelectedColor)); - this.nameTF.setOnMouseExited(event -> A5.this.nameTF.setEffect(null)); - this.nameTF.setOnKeyPressed(event -> { - switch (event.getCode()) { - case ENTER -> { - A5.this.setDataAndLeave(); - if (!canvas.getTabWithCanvas().getText().contains("*")) - canvas.getTabWithCanvas().setText(canvas.getTabWithCanvas().getText() + "*"); - } - case ESCAPE -> A5.this.setNothingAndLeave(); - } + public A5(final A3 canvas, double xPos, double yPos, String name) { - }); - GridPane fPane = new GridPane(); - fPane.setPadding(new Insets(5.0D, 5.0D, 5.0D, 5.0D)); - - fPane.setVgap(2.0D); - fPane.setHgap(2.0D); - - fPane.add(new Label("ESC->Cancel"), 0, 0, 2, 1); - fPane.add(new Label("Name:"), 0, 1); - fPane.add(this.nameTF, 1, 1); - - - - - - Scene scene = new Scene(fPane, 220.0D, 75.0D); - - setX(xPos); - setY(yPos); - if (yPos + scene.getHeight() > canvas.getView().getHeight() - 5.0D) { - setY(yPos - scene.getHeight() - 20.0D); - } - if (xPos + scene.getWidth() > canvas.getView().getWidth() - 5.0D) { - setX(xPos - scene.getWidth() - 20.0D); - } - - this.nameTF.requestFocus(); - this.nameTF.selectPositionCaret(0); - this.nameTF.selectEndOfNextWord(); - initStyle(StageStyle.UNDECORATED); - - setScene(scene); - sizeToScene(); - showAndWait(); - } - - - - - private void setDataAndLeave() { - if (this.nameTF.getText() == null || this.nameTF.getText().length() == 0) - return; this.thisActionMessageDialog.close(); - } - - - - - private void setNothingAndLeave() { - this.nameTF.setText(this.holdName); - this.doNothing = true; - this.thisActionMessageDialog.close(); - } - - - - - public TextField getNameTF() { - return this.nameTF; - } - - - - - public boolean isDoNothing() { - return this.doNothing; - } - } + String title = "Enter Name"; + + + this.holdName = name; + this.doNothing = false; + + this.thisActionMessageDialog = this; + setTitle(title); + initModality(Modality.APPLICATION_MODAL); + + + this.nameTF = new TextField(name); + this.nameTF.setOnMouseEntered(event -> T3.fdssdf4354(A5.this.nameTF, C2.MouseSelectedColor)); + this.nameTF.setOnMouseExited(event -> A5.this.nameTF.setEffect(null)); + this.nameTF.setOnKeyPressed(event -> { + switch (event.getCode()) { + case ENTER -> { + A5.this.setDataAndLeave(); + if (!canvas.getTabWithCanvas().getText().contains("*")) + canvas.getTabWithCanvas().setText(canvas.getTabWithCanvas().getText() + "*"); + } + case ESCAPE -> A5.this.setNothingAndLeave(); + } + + }); + GridPane fPane = new GridPane(); + fPane.setPadding(new Insets(5.0D, 5.0D, 5.0D, 5.0D)); + + fPane.setVgap(2.0D); + fPane.setHgap(2.0D); + + fPane.add(new Label("ESC->Cancel"), 0, 0, 2, 1); + fPane.add(new Label("Name:"), 0, 1); + fPane.add(this.nameTF, 1, 1); + + + Scene scene = new Scene(fPane, 220.0D, 75.0D); + + setX(xPos); + setY(yPos); + if (yPos + scene.getHeight() > canvas.getView().getHeight() - 5.0D) { + setY(yPos - scene.getHeight() - 20.0D); + } + if (xPos + scene.getWidth() > canvas.getView().getWidth() - 5.0D) { + setX(xPos - scene.getWidth() - 20.0D); + } + + this.nameTF.requestFocus(); + this.nameTF.selectPositionCaret(0); + this.nameTF.selectEndOfNextWord(); + initStyle(StageStyle.UNDECORATED); + + setScene(scene); + sizeToScene(); + showAndWait(); + } + + + private void setDataAndLeave() { + if (this.nameTF.getText() == null || this.nameTF.getText().length() == 0) + return; + this.thisActionMessageDialog.close(); + } + + + private void setNothingAndLeave() { + this.nameTF.setText(this.holdName); + this.doNothing = true; + this.thisActionMessageDialog.close(); + } + + + public TextField getNameTF() { + return this.nameTF; + } + + + public boolean isDoNothing() { + return this.doNothing; + } +} diff --git a/at/fos/ermodel/gui/A6.java b/at/fos/ermodel/gui/A6.java index 4f711aa..7dc84b9 100644 --- a/at/fos/ermodel/gui/A6.java +++ b/at/fos/ermodel/gui/A6.java @@ -1,206 +1,171 @@ - package at.fos.ermodel.gui; +package at.fos.ermodel.gui; - import javafx.event.EventHandler; - import javafx.geometry.Insets; - import javafx.scene.Scene; - import javafx.scene.control.Label; - import javafx.scene.control.TextField; - import javafx.scene.input.KeyEvent; - import javafx.scene.layout.GridPane; - import javafx.stage.Modality; - import javafx.stage.Stage; - import javafx.stage.StageStyle; - - - - - - - - - - - - - - - - - - - - - - public class A6 - extends Stage - { - private final A6 thisActionMessageDialog; - private final TextField p_tTF; - private final TextField d_ndTF; - private boolean doNothing; - private final String holdpartial_or_total; - private final String holddisjunct_or_notdisjunct; - - public A6(final A3 canvas, double xPos, double yPos, String partial_or_total, String disjunct_or_notdisjunct) { +import javafx.event.EventHandler; +import javafx.geometry.Insets; +import javafx.scene.Scene; +import javafx.scene.control.Label; +import javafx.scene.control.TextField; +import javafx.scene.input.KeyEvent; +import javafx.scene.layout.GridPane; +import javafx.stage.Modality; +import javafx.stage.Stage; +import javafx.stage.StageStyle; - String title = "Enter P-T-D-ND"; - - this.doNothing = false; - - if (partial_or_total == null) partial_or_total = "p"; - if (disjunct_or_notdisjunct == null) disjunct_or_notdisjunct = "nd"; - this.holdpartial_or_total = partial_or_total; - this.holddisjunct_or_notdisjunct = disjunct_or_notdisjunct; - - this.thisActionMessageDialog = this; - setTitle(title); - initModality(Modality.APPLICATION_MODAL); - - - - - - this.p_tTF = new TextField(partial_or_total); - this.p_tTF.setPrefWidth(50.0D); - this.p_tTF.textProperty().addListener((observable, oldValue, newValue) -> { - if (newValue.length() == 1 && newValue.charAt(0) != 'p' && newValue.charAt(0) != 't') { - newValue = "p"; - - this.p_tTF.setText(newValue); - - return; - } - if (newValue.length() > 1) { - newValue = oldValue; - this.p_tTF.setText(newValue); - return; - } - if (newValue.length() == 1 && (newValue.charAt(0) == 'p' || newValue.charAt(0) == 't')) { - this.p_tTF.setText(newValue); - } - }); - this.p_tTF.setOnMouseEntered(event -> T3.fdssdf4354(A6.this.p_tTF, C2.MouseSelectedColor)); - this.p_tTF.setOnMouseExited(event -> A6.this.p_tTF.setEffect(null)); - this.p_tTF.setOnKeyPressed(new EventHandler<>() { - public void handle(KeyEvent event) { - switch (event.getCode()) { - case ENTER -> A6.this.d_ndTF.requestFocus(); - case ESCAPE -> A6.this.setNothingAndLeave(); - } +public class A6 + extends Stage { + private final A6 thisActionMessageDialog; + private final TextField p_tTF; + private final TextField d_ndTF; + private final String holdpartial_or_total; + private final String holddisjunct_or_notdisjunct; + private boolean doNothing; - } - }); - this.d_ndTF = new TextField(disjunct_or_notdisjunct); - this.d_ndTF.setPrefWidth(50.0D); - this.d_ndTF.textProperty().addListener((observable, oldValue, newValue) -> { - if (newValue.length() == 1 && newValue.charAt(0) != 'd') { - newValue = "d"; - - this.d_ndTF.setText(newValue); - return; - } - if (newValue.length() == 2 && !newValue.equals("nd")) { - newValue = "nd"; - this.d_ndTF.setText(newValue); - return; - } - if (newValue.length() > 2) { - newValue = oldValue; - this.d_ndTF.setText(newValue); - return; - } - if (newValue.length() == 1 && newValue.charAt(0) == 'd') { - this.d_ndTF.setText(newValue); - } - }); - this.d_ndTF.setOnMouseEntered(event -> T3.fdssdf4354(A6.this.d_ndTF, C2.MouseSelectedColor)); - this.d_ndTF.setOnMouseExited(event -> A6.this.d_ndTF.setEffect(null)); - this.d_ndTF.setOnKeyPressed(event -> { - switch (event.getCode()) { - case ENTER -> { - A6.this.setDataAndLeave(); - if (!canvas.getTabWithCanvas().getText().contains("*")) - canvas.getTabWithCanvas().setText(canvas.getTabWithCanvas().getText() + "*"); - } - case ESCAPE -> A6.this.setNothingAndLeave(); - } + public A6(final A3 canvas, double xPos, double yPos, String partial_or_total, String disjunct_or_notdisjunct) { - }); - GridPane gPane = new GridPane(); - gPane.setPadding(new Insets(10.0D, 10.0D, 10.0D, 10.0D)); - - gPane.setHgap(4.0D); - - gPane.add(new Label("ESC->Cancel"), 0, 0); - gPane.add(new Label("Partial[p]/Total[t]:"), 0, 1); - gPane.add(this.p_tTF, 1, 1); - gPane.add(new Label("Disjunct[d]/Not disjunct[nd]:"), 0, 2); - gPane.add(this.d_ndTF, 1, 2); - - - - - initStyle(StageStyle.UNDECORATED); - Scene scene = new Scene(gPane, 230.0D, 90.0D); - - setScene(scene); - - setX(xPos); - setY(yPos); - if (yPos + scene.getHeight() > canvas.getView().getHeight() - 5.0D) { - setY(yPos - scene.getHeight() - 20.0D); - } - if (xPos + scene.getWidth() > canvas.getView().getWidth() - 5.0D) { - setX(xPos - scene.getWidth() - 20.0D); - } - - this.p_tTF.requestFocus(); - this.p_tTF.selectPositionCaret(0); - this.p_tTF.selectEndOfNextWord(); - - sizeToScene(); - showAndWait(); - } - - - - - private void setDataAndLeave() { - if (this.p_tTF.getText() == null || this.p_tTF.getText().length() == 0) this.p_tTF.setText("p"); - if (this.d_ndTF.getText() == null || this.d_ndTF.getText().length() == 0) this.d_ndTF.setText("nd"); - this.thisActionMessageDialog.close(); - } - - - - - private void setNothingAndLeave() { - this.p_tTF.setText(this.holdpartial_or_total); - this.d_ndTF.setText(this.holddisjunct_or_notdisjunct); - this.doNothing = true; - - this.thisActionMessageDialog.close(); - } - - - - - public TextField getP_tTF() { - return this.p_tTF; - } - - - - - public TextField getD_ndTF() { - return this.d_ndTF; - } - - - - - public boolean isDoNothing() { - return this.doNothing; - } - } \ No newline at end of file + String title = "Enter P-T-D-ND"; + + this.doNothing = false; + + if (partial_or_total == null) partial_or_total = "p"; + if (disjunct_or_notdisjunct == null) disjunct_or_notdisjunct = "nd"; + this.holdpartial_or_total = partial_or_total; + this.holddisjunct_or_notdisjunct = disjunct_or_notdisjunct; + + this.thisActionMessageDialog = this; + setTitle(title); + initModality(Modality.APPLICATION_MODAL); + + + this.p_tTF = new TextField(partial_or_total); + this.p_tTF.setPrefWidth(50.0D); + this.p_tTF.textProperty().addListener((observable, oldValue, newValue) -> { + if (newValue.length() == 1 && newValue.charAt(0) != 'p' && newValue.charAt(0) != 't') { + newValue = "p"; + + this.p_tTF.setText(newValue); + + return; + } + if (newValue.length() > 1) { + newValue = oldValue; + this.p_tTF.setText(newValue); + return; + } + if (newValue.length() == 1 && (newValue.charAt(0) == 'p' || newValue.charAt(0) == 't')) { + this.p_tTF.setText(newValue); + } + }); + this.p_tTF.setOnMouseEntered(event -> T3.fdssdf4354(A6.this.p_tTF, C2.MouseSelectedColor)); + this.p_tTF.setOnMouseExited(event -> A6.this.p_tTF.setEffect(null)); + this.p_tTF.setOnKeyPressed(new EventHandler<>() { + + public void handle(KeyEvent event) { + switch (event.getCode()) { + case ENTER -> A6.this.d_ndTF.requestFocus(); + case ESCAPE -> A6.this.setNothingAndLeave(); + } + + } + }); + this.d_ndTF = new TextField(disjunct_or_notdisjunct); + this.d_ndTF.setPrefWidth(50.0D); + this.d_ndTF.textProperty().addListener((observable, oldValue, newValue) -> { + if (newValue.length() == 1 && newValue.charAt(0) != 'd') { + newValue = "d"; + + this.d_ndTF.setText(newValue); + return; + } + if (newValue.length() == 2 && !newValue.equals("nd")) { + newValue = "nd"; + this.d_ndTF.setText(newValue); + return; + } + if (newValue.length() > 2) { + newValue = oldValue; + this.d_ndTF.setText(newValue); + return; + } + if (newValue.length() == 1 && newValue.charAt(0) == 'd') { + this.d_ndTF.setText(newValue); + } + }); + this.d_ndTF.setOnMouseEntered(event -> T3.fdssdf4354(A6.this.d_ndTF, C2.MouseSelectedColor)); + this.d_ndTF.setOnMouseExited(event -> A6.this.d_ndTF.setEffect(null)); + this.d_ndTF.setOnKeyPressed(event -> { + switch (event.getCode()) { + case ENTER -> { + A6.this.setDataAndLeave(); + if (!canvas.getTabWithCanvas().getText().contains("*")) + canvas.getTabWithCanvas().setText(canvas.getTabWithCanvas().getText() + "*"); + } + case ESCAPE -> A6.this.setNothingAndLeave(); + } + + }); + GridPane gPane = new GridPane(); + gPane.setPadding(new Insets(10.0D, 10.0D, 10.0D, 10.0D)); + + gPane.setHgap(4.0D); + + gPane.add(new Label("ESC->Cancel"), 0, 0); + gPane.add(new Label("Partial[p]/Total[t]:"), 0, 1); + gPane.add(this.p_tTF, 1, 1); + gPane.add(new Label("Disjunct[d]/Not disjunct[nd]:"), 0, 2); + gPane.add(this.d_ndTF, 1, 2); + + + initStyle(StageStyle.UNDECORATED); + Scene scene = new Scene(gPane, 230.0D, 90.0D); + + setScene(scene); + + setX(xPos); + setY(yPos); + if (yPos + scene.getHeight() > canvas.getView().getHeight() - 5.0D) { + setY(yPos - scene.getHeight() - 20.0D); + } + if (xPos + scene.getWidth() > canvas.getView().getWidth() - 5.0D) { + setX(xPos - scene.getWidth() - 20.0D); + } + + this.p_tTF.requestFocus(); + this.p_tTF.selectPositionCaret(0); + this.p_tTF.selectEndOfNextWord(); + + sizeToScene(); + showAndWait(); + } + + + private void setDataAndLeave() { + if (this.p_tTF.getText() == null || this.p_tTF.getText().length() == 0) this.p_tTF.setText("p"); + if (this.d_ndTF.getText() == null || this.d_ndTF.getText().length() == 0) this.d_ndTF.setText("nd"); + this.thisActionMessageDialog.close(); + } + + + private void setNothingAndLeave() { + this.p_tTF.setText(this.holdpartial_or_total); + this.d_ndTF.setText(this.holddisjunct_or_notdisjunct); + this.doNothing = true; + + this.thisActionMessageDialog.close(); + } + + + public TextField getP_tTF() { + return this.p_tTF; + } + + + public TextField getD_ndTF() { + return this.d_ndTF; + } + + + public boolean isDoNothing() { + return this.doNothing; + } +} \ No newline at end of file diff --git a/at/fos/ermodel/gui/A7.java b/at/fos/ermodel/gui/A7.java index c52339c..249f62d 100644 --- a/at/fos/ermodel/gui/A7.java +++ b/at/fos/ermodel/gui/A7.java @@ -1,160 +1,122 @@ - package at.fos.ermodel.gui; +package at.fos.ermodel.gui; - import javafx.geometry.Insets; - import javafx.scene.Scene; - import javafx.scene.control.Label; - import javafx.scene.control.TextArea; - import javafx.scene.input.KeyCode; - import javafx.scene.input.KeyCodeCombination; - import javafx.scene.input.KeyCombination; - import javafx.scene.layout.GridPane; - import javafx.stage.Modality; - import javafx.stage.Stage; - import javafx.stage.StageStyle; - - - - - - - - - - - - - - - - - - - - - - - public class A7 - extends Stage - { - private final A7 thisActionMessageDialog; - private final TextArea textTA; - private boolean doNothing; - private final String holdName; - final KeyCombination keyCombinationALT_ENTER = new KeyCodeCombination(KeyCode.ENTER, KeyCombination.ALT_DOWN); - - - - - - - - public A7(final A3 canvas, double xPos, double yPos, String name) { - - String title = "Enter Name"; - - - this.holdName = name; - - this.doNothing = false; - - this.thisActionMessageDialog = this; - setTitle(title); - initModality(Modality.APPLICATION_MODAL); - - - - - this.textTA = new TextArea(name); - this.textTA.setPrefWidth(350.0D); - this.textTA.setPrefHeight(100.0D); - this.textTA.setOnMouseEntered(event -> T3.fdssdf4354(A7.this.textTA, C2.MouseSelectedColor)); - this.textTA.setOnMouseExited(event -> A7.this.textTA.setEffect(null)); - this.textTA.setOnKeyPressed(event -> { - if (A7.this.keyCombinationALT_ENTER.match(event)) { - A7.this.textTA.appendText("\n"); - event.consume(); - return; - } - switch (event.getCode()) { - case ENTER -> { - event.consume(); - A7.this.setDataAndLeave(); - if (!canvas.getTabWithCanvas().getText().contains("*")) - canvas.getTabWithCanvas().setText(canvas.getTabWithCanvas().getText() + "*"); - } - case ESCAPE -> A7.this.setNothingAndLeave(); - } +import javafx.geometry.Insets; +import javafx.scene.Scene; +import javafx.scene.control.Label; +import javafx.scene.control.TextArea; +import javafx.scene.input.KeyCode; +import javafx.scene.input.KeyCodeCombination; +import javafx.scene.input.KeyCombination; +import javafx.scene.layout.GridPane; +import javafx.stage.Modality; +import javafx.stage.Stage; +import javafx.stage.StageStyle; - }); - GridPane fPane = new GridPane(); - fPane.setPadding(new Insets(10.0D, 10.0D, 10.0D, 10.0D)); - - fPane.setHgap(4.0D); - - fPane.add(new Label("ESC->Cancel, Alt-Enter->Linefeed"), 0, 0, 2, 1); - fPane.add(this.textTA, 0, 1); - - - - initStyle(StageStyle.UNDECORATED); - Scene scene = new Scene(fPane, 370.0D, 150.0D); - - setScene(scene); - - setX(xPos); - setY(yPos); - if (yPos + scene.getHeight() > canvas.getView().getHeight() - 5.0D) { - setY(yPos - scene.getHeight() - 20.0D); - } - if (xPos + scene.getWidth() > canvas.getView().getWidth() - 5.0D) { - setX(xPos - scene.getWidth() - 20.0D); - } - - this.textTA.requestFocus(); - - - sizeToScene(); - showAndWait(); - } - - - - - - private void setDataAndLeave() { - if (this.textTA.getText() == null || this.textTA.getText().length() == 0) { - this.textTA.setText(""); - - - return; - } - - this.thisActionMessageDialog.close(); - } - - - - - private void setNothingAndLeave() { - this.textTA.setText(this.holdName); - this.doNothing = true; - this.thisActionMessageDialog.close(); - } - - - - - public TextArea getTextTA() { - return this.textTA; - } - - - - - public boolean isDoNothing() { - return this.doNothing; - } - } +public class A7 + extends Stage { + final KeyCombination keyCombinationALT_ENTER = new KeyCodeCombination(KeyCode.ENTER, KeyCombination.ALT_DOWN); + private final A7 thisActionMessageDialog; + private final TextArea textTA; + private final String holdName; + private boolean doNothing; + + + public A7(final A3 canvas, double xPos, double yPos, String name) { + + String title = "Enter Name"; + + + this.holdName = name; + + this.doNothing = false; + + this.thisActionMessageDialog = this; + setTitle(title); + initModality(Modality.APPLICATION_MODAL); + + + this.textTA = new TextArea(name); + this.textTA.setPrefWidth(350.0D); + this.textTA.setPrefHeight(100.0D); + this.textTA.setOnMouseEntered(event -> T3.fdssdf4354(A7.this.textTA, C2.MouseSelectedColor)); + this.textTA.setOnMouseExited(event -> A7.this.textTA.setEffect(null)); + this.textTA.setOnKeyPressed(event -> { + if (A7.this.keyCombinationALT_ENTER.match(event)) { + A7.this.textTA.appendText("\n"); + event.consume(); + return; + } + switch (event.getCode()) { + case ENTER -> { + event.consume(); + A7.this.setDataAndLeave(); + if (!canvas.getTabWithCanvas().getText().contains("*")) + canvas.getTabWithCanvas().setText(canvas.getTabWithCanvas().getText() + "*"); + } + case ESCAPE -> A7.this.setNothingAndLeave(); + } + + + }); + GridPane fPane = new GridPane(); + fPane.setPadding(new Insets(10.0D, 10.0D, 10.0D, 10.0D)); + + fPane.setHgap(4.0D); + + fPane.add(new Label("ESC->Cancel, Alt-Enter->Linefeed"), 0, 0, 2, 1); + fPane.add(this.textTA, 0, 1); + + + initStyle(StageStyle.UNDECORATED); + Scene scene = new Scene(fPane, 370.0D, 150.0D); + + setScene(scene); + + setX(xPos); + setY(yPos); + if (yPos + scene.getHeight() > canvas.getView().getHeight() - 5.0D) { + setY(yPos - scene.getHeight() - 20.0D); + } + if (xPos + scene.getWidth() > canvas.getView().getWidth() - 5.0D) { + setX(xPos - scene.getWidth() - 20.0D); + } + + this.textTA.requestFocus(); + + + sizeToScene(); + showAndWait(); + } + + + private void setDataAndLeave() { + if (this.textTA.getText() == null || this.textTA.getText().length() == 0) { + this.textTA.setText(""); + + + return; + } + + this.thisActionMessageDialog.close(); + } + + + private void setNothingAndLeave() { + this.textTA.setText(this.holdName); + this.doNothing = true; + this.thisActionMessageDialog.close(); + } + + + public TextArea getTextTA() { + return this.textTA; + } + + + public boolean isDoNothing() { + return this.doNothing; + } +} diff --git a/at/fos/ermodel/gui/A8.java b/at/fos/ermodel/gui/A8.java index b3b6564..d9515e5 100644 --- a/at/fos/ermodel/gui/A8.java +++ b/at/fos/ermodel/gui/A8.java @@ -19,812 +19,710 @@ import java.util.Objects; import java.util.Optional; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - public class A8 - extends Stage -{ - private final A8 thisActionMessageDialog; - private final TextField nameTF; - private final CheckBox createColumnCB; - private final TextField columnNameTF; - private final TextField columnPostfixTF; - private final TextField datatypeTF; - private final CheckBox isAutoincrementCB; - private final TextField autoincrementStartAtTF; - private final CheckBox isKeyCB; - private final CheckBox isNullableCB; - private final CheckBox isUniqueCB; - private final ComboBox dataGenerationTypeCoB; - private final Label par1LBL; - private final TextField par1TF; - private final Label par2LBL; - private final TextField par2TF; - private final Button okBTN; - private Button cancelBTN; - private final String holdName; - private final boolean holdcreateColumn; - private final String holdcolumnName; - private final String holdcolumnPostfix; - private final String holddatatype; - private final boolean holdisAutoincrement; - private final long holdAutoincrementStartAt; - private final boolean holdisKey; - private final boolean holdisNullable; - private final boolean holdisUnique; - private final String holddatagenerationtype; - private final String holdpar1_label; - private final String holdpar1; - private final String holdpar2_label; - private final String holdpar2; - - public A8(final A3 canvas, double xPos, double yPos, String name, boolean createColumn, String columnName, String columnPostfix, String datatype, boolean isWeakKey, boolean isAutoincrement, long autoincrementStartAt, boolean isKey, boolean isNullable, boolean isUnique, String dataGenerationType, String par1, String par1_label, String par2, String par2_label) { - String title = "Attribute Transformation"; + extends Stage { + private final A8 thisActionMessageDialog; + private final TextField nameTF; + private final CheckBox createColumnCB; + private final TextField columnNameTF; + private final TextField columnPostfixTF; + private final TextField datatypeTF; + private final CheckBox isAutoincrementCB; + private final TextField autoincrementStartAtTF; + private final CheckBox isKeyCB; + private final CheckBox isNullableCB; + private final CheckBox isUniqueCB; + private final ComboBox dataGenerationTypeCoB; + private final Label par1LBL; + private final TextField par1TF; + private final Label par2LBL; + private final TextField par2TF; + private final Button okBTN; + private final String holdName; + private final boolean holdcreateColumn; + private final String holdcolumnName; + private final String holdcolumnPostfix; + private final String holddatatype; + private final boolean holdisAutoincrement; + private final long holdAutoincrementStartAt; + private final boolean holdisKey; + private final boolean holdisNullable; + private final boolean holdisUnique; + private final String holddatagenerationtype; + private final String holdpar1_label; + private final String holdpar1; + private final String holdpar2_label; + private final String holdpar2; + private Button cancelBTN; - - this.holdName = name; - this.holdcreateColumn = createColumn; - this.holdcolumnName = columnName; - this.holdcolumnPostfix = columnPostfix; - this.holddatatype = datatype; - this.holdisAutoincrement = isAutoincrement; - this.holdAutoincrementStartAt = autoincrementStartAt; - this.holdisKey = isKey; - this.holdisNullable = isNullable; - this.holdisUnique = isUnique; - this.holddatagenerationtype = dataGenerationType; - this.holdpar1_label = par1_label; - this.holdpar1 = par1; - this.holdpar2_label = par2_label; - this.holdpar2 = par2; - - - this.thisActionMessageDialog = this; - setTitle(title); - initModality(Modality.APPLICATION_MODAL); + public A8(final A3 canvas, double xPos, double yPos, String name, boolean createColumn, String columnName, String columnPostfix, String datatype, boolean isWeakKey, boolean isAutoincrement, long autoincrementStartAt, boolean isKey, boolean isNullable, boolean isUnique, String dataGenerationType, String par1, String par1_label, String par2, String par2_label) { + String title = "Attribute Transformation"; + this.holdName = name; + this.holdcreateColumn = createColumn; + this.holdcolumnName = columnName; + this.holdcolumnPostfix = columnPostfix; + this.holddatatype = datatype; + this.holdisAutoincrement = isAutoincrement; + this.holdAutoincrementStartAt = autoincrementStartAt; + this.holdisKey = isKey; + this.holdisNullable = isNullable; + this.holdisUnique = isUnique; + this.holddatagenerationtype = dataGenerationType; + this.holdpar1_label = par1_label; + this.holdpar1 = par1; + this.holdpar2_label = par2_label; + this.holdpar2 = par2; - - - this.nameTF = new TextField(name); - this.nameTF.setPrefWidth(150.0D); - this.nameTF.setMaxWidth(150.0D); - this.nameTF.setDisable(true); + this.thisActionMessageDialog = this; + setTitle(title); + initModality(Modality.APPLICATION_MODAL); - - this.createColumnCB = new CheckBox(); - this.createColumnCB.setSelected(false); - if (createColumn) this.createColumnCB.setSelected(true); - this.createColumnCB.setOnMouseEntered(event -> T3.fdssdf4354(A8.this.createColumnCB, C2.MouseSelectedColor)); - this.createColumnCB.setOnMouseExited(event -> A8.this.createColumnCB.setEffect(null)); - - this.columnPostfixTF = new TextField(columnPostfix); - this.columnPostfixTF.setPrefWidth(150.0D); - this.columnPostfixTF.setMaxWidth(150.0D); - this.columnPostfixTF.setOnMouseEntered(event -> T3.fdssdf4354(A8.this.columnPostfixTF, C2.MouseSelectedColor)); - this.columnPostfixTF.setOnMouseExited(event -> A8.this.columnPostfixTF.setEffect(null)); - - this.columnNameTF = new TextField(columnName); - this.columnNameTF.setPrefWidth(150.0D); - this.columnNameTF.setMaxWidth(150.0D); - this.columnNameTF.setOnMouseEntered(event -> T3.fdssdf4354(A8.this.columnNameTF, C2.MouseSelectedColor)); - this.columnNameTF.setOnMouseExited(event -> A8.this.columnNameTF.setEffect(null)); - - this.datatypeTF = new TextField(datatype); - this.datatypeTF.setPrefWidth(150.0D); - this.datatypeTF.setMaxWidth(150.0D); - this.datatypeTF.setOnMouseEntered(event -> T3.fdssdf4354(A8.this.datatypeTF, C2.MouseSelectedColor)); - this.datatypeTF.setOnMouseExited(event -> A8.this.datatypeTF.setEffect(null)); - - this.isAutoincrementCB = new CheckBox(); - this.isAutoincrementCB.setSelected(false); - if (isAutoincrement) this.isAutoincrementCB.setSelected(true); - this.isAutoincrementCB.setDisable(true); - - if (isKey && !isWeakKey) this.isAutoincrementCB.setDisable(false); - this.isAutoincrementCB.setOnMouseEntered(event -> T3.fdssdf4354(A8.this.isAutoincrementCB, C2.MouseSelectedColor)); - this.isAutoincrementCB.setOnMouseExited(event -> A8.this.isAutoincrementCB.setEffect(null)); - this.isAutoincrementCB.setOnAction(event -> { - if (A8.this.isAutoincrementCB.isSelected()) { - A8.this.datatypeTF.setText("bigint"); - A8.this.autoincrementStartAtTF.setDisable(false); - A8.this.autoincrementStartAtTF.setText("1"); - A8.this.datatypeTF.setDisable(true); - A8.this.dataGenerationTypeCoB.setDisable(true); - A8.this.par1TF.setDisable(true); - A8.this.par2TF.setDisable(true); - } else { - - A8.this.datatypeTF.setDisable(false); - A8.this.autoincrementStartAtTF.setDisable(true); - A8.this.dataGenerationTypeCoB.setDisable(false); - A8.this.par1TF.setDisable(false); - A8.this.par2TF.setDisable(false); - } - }); - - if (!isAutoincrement) autoincrementStartAt = 1L; - this.autoincrementStartAtTF = new TextField(String.valueOf(autoincrementStartAt)); - this.autoincrementStartAtTF.setPrefWidth(100.0D); - this.autoincrementStartAtTF.setMaxWidth(100.0D); - this.autoincrementStartAtTF.setDisable(true); - if (isAutoincrement) this.autoincrementStartAtTF.setDisable(false); - this.autoincrementStartAtTF.setOnMouseEntered(event -> T3.fdssdf4354(A8.this.autoincrementStartAtTF, C2.MouseSelectedColor)); - this.autoincrementStartAtTF.setOnMouseExited(event -> A8.this.autoincrementStartAtTF.setEffect(null)); - - this.isKeyCB = new CheckBox(); - this.isKeyCB.setSelected(false); - if (isKey) this.isKeyCB.setSelected(true); - this.isKeyCB.setOnMouseEntered(event -> T3.fdssdf4354(A8.this.isKeyCB, C2.MouseSelectedColor)); - this.isKeyCB.setOnMouseExited(event -> A8.this.isKeyCB.setEffect(null)); - - this.isNullableCB = new CheckBox(); - this.isNullableCB.setSelected(false); - if (isNullable) this.isNullableCB.setSelected(true); - this.isNullableCB.setOnMouseEntered(event -> T3.fdssdf4354(A8.this.isNullableCB, C2.MouseSelectedColor)); - this.isNullableCB.setOnMouseExited(event -> A8.this.isNullableCB.setEffect(null)); - - this.isUniqueCB = new CheckBox(); - this.isUniqueCB.setSelected(false); - if (isUnique) this.isUniqueCB.setSelected(true); - this.isUniqueCB.setOnMouseEntered(event -> T3.fdssdf4354(A8.this.isUniqueCB, C2.MouseSelectedColor)); - this.isUniqueCB.setOnMouseExited(event -> A8.this.isUniqueCB.setEffect(null)); + this.nameTF = new TextField(name); + this.nameTF.setPrefWidth(150.0D); + this.nameTF.setMaxWidth(150.0D); + this.nameTF.setDisable(true); + this.createColumnCB = new CheckBox(); + this.createColumnCB.setSelected(false); + if (createColumn) this.createColumnCB.setSelected(true); + this.createColumnCB.setOnMouseEntered(event -> T3.fdssdf4354(A8.this.createColumnCB, C2.MouseSelectedColor)); + this.createColumnCB.setOnMouseExited(event -> A8.this.createColumnCB.setEffect(null)); - - ObservableList possibleGenerations = - FXCollections.observableArrayList(T3.dsfsdfsdf4353534); - this.dataGenerationTypeCoB = new ComboBox<>(possibleGenerations); + this.columnPostfixTF = new TextField(columnPostfix); + this.columnPostfixTF.setPrefWidth(150.0D); + this.columnPostfixTF.setMaxWidth(150.0D); + this.columnPostfixTF.setOnMouseEntered(event -> T3.fdssdf4354(A8.this.columnPostfixTF, C2.MouseSelectedColor)); + this.columnPostfixTF.setOnMouseExited(event -> A8.this.columnPostfixTF.setEffect(null)); - - if (dataGenerationType == null) { - this.dataGenerationTypeCoB.getSelectionModel().select(0); - this.par1TF = new TextField(""); this.par1TF.setDisable(true); - this.par1LBL = new Label(""); - this.par2TF = new TextField(""); this.par2TF.setDisable(true); - this.par2LBL = new Label(""); - } else { - - this.dataGenerationTypeCoB.getSelectionModel().select(dataGenerationType); - this.par1TF = new TextField(par1); this.par1TF.setDisable(true); - this.par1LBL = new Label(par1_label); - this.par2TF = new TextField(par2); this.par2TF.setDisable(true); - this.par2LBL = new Label(par2_label); - setVisibilityForGenerationtype(); - } - - this.par2TF.setOnMousePressed(event -> { - if (!A8.this.dataGenerationTypeCoB.getSelectionModel().getSelectedItem().equals("Extern")) - return; if (event.getButton() == MouseButton.SECONDARY) { - event.consume(); - FileChooser fc = new FileChooser(); - fc.setInitialDirectory(new File(System.getProperty("user.home"))); - fc.getExtensionFilters().add(new FileChooser.ExtensionFilter("*.txt", "*.TXT")); - File file = fc.showOpenDialog(A8.this.thisActionMessageDialog); - if (file != null) { - A8.this.par2TF.setText(file.getAbsolutePath()); - } - } - A8.this.getScene().getRoot().setCursor(Cursor.HAND); - T3.fdssdf4354(A8.this.okBTN, C2.MouseSelectedColor); - }); - - this.dataGenerationTypeCoB.setOnAction(event -> A8.this.setSelectionForGenerationtype()); + this.columnNameTF = new TextField(columnName); + this.columnNameTF.setPrefWidth(150.0D); + this.columnNameTF.setMaxWidth(150.0D); + this.columnNameTF.setOnMouseEntered(event -> T3.fdssdf4354(A8.this.columnNameTF, C2.MouseSelectedColor)); + this.columnNameTF.setOnMouseExited(event -> A8.this.columnNameTF.setEffect(null)); - - this.okBTN = new Button("Ok"); - this.okBTN.setBackground(new Background(new BackgroundFill(C2.ButtonBackgroundColor, new CornerRadii(5.0D), Insets.EMPTY))); - this.okBTN.setOnMouseEntered(event -> { - A8.this.getScene().getRoot().setCursor(Cursor.HAND); - T3.fdssdf4354(A8.this.okBTN, C2.MouseSelectedColor); - }); - this.okBTN.setOnMouseExited(event -> { - A8.this.getScene().getRoot().setCursor(Cursor.DEFAULT); - A8.this.okBTN.setEffect(null); - if (A8.this.okBTN.isFocused()) T3.fdssdf4354(A8.this.okBTN, C2.FocusOnComponentColor); - }); - this.okBTN.focusedProperty().addListener((obs, oldVal, newVal) -> { - if (this.okBTN.isFocused()) { - T3.fdssdf4354(this.okBTN, C2.FocusOnComponentColor); - - this.columnPostfixTF.setEffect(null); - - this.cancelBTN.setEffect(null); - } else { - this.okBTN.setEffect(null); - } + this.datatypeTF = new TextField(datatype); + this.datatypeTF.setPrefWidth(150.0D); + this.datatypeTF.setMaxWidth(150.0D); + this.datatypeTF.setOnMouseEntered(event -> T3.fdssdf4354(A8.this.datatypeTF, C2.MouseSelectedColor)); + this.datatypeTF.setOnMouseExited(event -> A8.this.datatypeTF.setEffect(null)); + + this.isAutoincrementCB = new CheckBox(); + this.isAutoincrementCB.setSelected(false); + if (isAutoincrement) this.isAutoincrementCB.setSelected(true); + this.isAutoincrementCB.setDisable(true); + + if (isKey && !isWeakKey) this.isAutoincrementCB.setDisable(false); + this.isAutoincrementCB.setOnMouseEntered(event -> T3.fdssdf4354(A8.this.isAutoincrementCB, C2.MouseSelectedColor)); + this.isAutoincrementCB.setOnMouseExited(event -> A8.this.isAutoincrementCB.setEffect(null)); + this.isAutoincrementCB.setOnAction(event -> { + if (A8.this.isAutoincrementCB.isSelected()) { + A8.this.datatypeTF.setText("bigint"); + A8.this.autoincrementStartAtTF.setDisable(false); + A8.this.autoincrementStartAtTF.setText("1"); + A8.this.datatypeTF.setDisable(true); + A8.this.dataGenerationTypeCoB.setDisable(true); + A8.this.par1TF.setDisable(true); + A8.this.par2TF.setDisable(true); + } else { + + A8.this.datatypeTF.setDisable(false); + A8.this.autoincrementStartAtTF.setDisable(true); + A8.this.dataGenerationTypeCoB.setDisable(false); + A8.this.par1TF.setDisable(false); + A8.this.par2TF.setDisable(false); + } }); - this.okBTN.setOnAction(event -> { - A8.this.setDataAndLeave(); - if (!canvas.getTabWithCanvas().getText().contains("*")) canvas.getTabWithCanvas().setText(canvas.getTabWithCanvas().getText() + "*"); - }); - this.okBTN.setOnKeyPressed(event -> { - if (Objects.requireNonNull(event.getCode()) == KeyCode.ENTER) { + if (!isAutoincrement) autoincrementStartAt = 1L; + this.autoincrementStartAtTF = new TextField(String.valueOf(autoincrementStartAt)); + this.autoincrementStartAtTF.setPrefWidth(100.0D); + this.autoincrementStartAtTF.setMaxWidth(100.0D); + this.autoincrementStartAtTF.setDisable(true); + if (isAutoincrement) this.autoincrementStartAtTF.setDisable(false); + this.autoincrementStartAtTF.setOnMouseEntered(event -> T3.fdssdf4354(A8.this.autoincrementStartAtTF, C2.MouseSelectedColor)); + this.autoincrementStartAtTF.setOnMouseExited(event -> A8.this.autoincrementStartAtTF.setEffect(null)); + + this.isKeyCB = new CheckBox(); + this.isKeyCB.setSelected(false); + if (isKey) this.isKeyCB.setSelected(true); + this.isKeyCB.setOnMouseEntered(event -> T3.fdssdf4354(A8.this.isKeyCB, C2.MouseSelectedColor)); + this.isKeyCB.setOnMouseExited(event -> A8.this.isKeyCB.setEffect(null)); + + this.isNullableCB = new CheckBox(); + this.isNullableCB.setSelected(false); + if (isNullable) this.isNullableCB.setSelected(true); + this.isNullableCB.setOnMouseEntered(event -> T3.fdssdf4354(A8.this.isNullableCB, C2.MouseSelectedColor)); + this.isNullableCB.setOnMouseExited(event -> A8.this.isNullableCB.setEffect(null)); + + this.isUniqueCB = new CheckBox(); + this.isUniqueCB.setSelected(false); + if (isUnique) this.isUniqueCB.setSelected(true); + this.isUniqueCB.setOnMouseEntered(event -> T3.fdssdf4354(A8.this.isUniqueCB, C2.MouseSelectedColor)); + this.isUniqueCB.setOnMouseExited(event -> A8.this.isUniqueCB.setEffect(null)); + + + ObservableList possibleGenerations = + FXCollections.observableArrayList(T3.dsfsdfsdf4353534); + this.dataGenerationTypeCoB = new ComboBox<>(possibleGenerations); + + + if (dataGenerationType == null) { + this.dataGenerationTypeCoB.getSelectionModel().select(0); + this.par1TF = new TextField(""); + this.par1TF.setDisable(true); + this.par1LBL = new Label(""); + this.par2TF = new TextField(""); + this.par2TF.setDisable(true); + this.par2LBL = new Label(""); + } else { + + this.dataGenerationTypeCoB.getSelectionModel().select(dataGenerationType); + this.par1TF = new TextField(par1); + this.par1TF.setDisable(true); + this.par1LBL = new Label(par1_label); + this.par2TF = new TextField(par2); + this.par2TF.setDisable(true); + this.par2LBL = new Label(par2_label); + setVisibilityForGenerationtype(); + } + + this.par2TF.setOnMousePressed(event -> { + if (!A8.this.dataGenerationTypeCoB.getSelectionModel().getSelectedItem().equals("Extern")) + return; + if (event.getButton() == MouseButton.SECONDARY) { + event.consume(); + FileChooser fc = new FileChooser(); + fc.setInitialDirectory(new File(System.getProperty("user.home"))); + fc.getExtensionFilters().add(new FileChooser.ExtensionFilter("*.txt", "*.TXT")); + File file = fc.showOpenDialog(A8.this.thisActionMessageDialog); + if (file != null) { + A8.this.par2TF.setText(file.getAbsolutePath()); + } + } + A8.this.getScene().getRoot().setCursor(Cursor.HAND); + T3.fdssdf4354(A8.this.okBTN, C2.MouseSelectedColor); + }); + + this.dataGenerationTypeCoB.setOnAction(event -> A8.this.setSelectionForGenerationtype()); + + + this.okBTN = new Button("Ok"); + this.okBTN.setBackground(new Background(new BackgroundFill(C2.ButtonBackgroundColor, new CornerRadii(5.0D), Insets.EMPTY))); + this.okBTN.setOnMouseEntered(event -> { + A8.this.getScene().getRoot().setCursor(Cursor.HAND); + T3.fdssdf4354(A8.this.okBTN, C2.MouseSelectedColor); + }); + this.okBTN.setOnMouseExited(event -> { + A8.this.getScene().getRoot().setCursor(Cursor.DEFAULT); + A8.this.okBTN.setEffect(null); + if (A8.this.okBTN.isFocused()) T3.fdssdf4354(A8.this.okBTN, C2.FocusOnComponentColor); + }); + this.okBTN.focusedProperty().addListener((obs, oldVal, newVal) -> { + if (this.okBTN.isFocused()) { + T3.fdssdf4354(this.okBTN, C2.FocusOnComponentColor); + + this.columnPostfixTF.setEffect(null); + + this.cancelBTN.setEffect(null); + } else { + this.okBTN.setEffect(null); + } + }); + this.okBTN.setOnAction(event -> { A8.this.setDataAndLeave(); + if (!canvas.getTabWithCanvas().getText().contains("*")) canvas.getTabWithCanvas().setText(canvas.getTabWithCanvas().getText() + "*"); - } - - - - }); - this.cancelBTN = new Button("Cancel"); - this.cancelBTN.setBackground(new Background(new BackgroundFill(C2.ButtonBackgroundColor, new CornerRadii(5.0D), Insets.EMPTY))); - this.cancelBTN.setOnMouseEntered(event -> { - A8.this.getScene().getRoot().setCursor(Cursor.HAND); - T3.fdssdf4354(A8.this.cancelBTN, C2.MouseSelectedColor); - }); - this.cancelBTN.setOnMouseExited(event -> { - A8.this.getScene().getRoot().setCursor(Cursor.DEFAULT); - A8.this.cancelBTN.setEffect(null); - if (A8.this.cancelBTN.isFocused()) T3.fdssdf4354(A8.this.cancelBTN, C2.FocusOnComponentColor); - - }); - this.cancelBTN.focusedProperty().addListener((obs, oldVal, newVal) -> { - if (this.cancelBTN.isFocused()) { - T3.fdssdf4354(this.cancelBTN, C2.FocusOnComponentColor); - - this.columnPostfixTF.setEffect(null); - this.okBTN.setEffect(null); - } else { - this.cancelBTN.setEffect(null); - } }); - this.cancelBTN.setOnAction(event -> A8.this.setNothingAndLeave()); - this.cancelBTN.setOnKeyPressed(event -> { - if (Objects.requireNonNull(event.getCode()) == KeyCode.ENTER) { - A8.this.setNothingAndLeave(); + this.okBTN.setOnKeyPressed(event -> { + if (Objects.requireNonNull(event.getCode()) == KeyCode.ENTER) { + A8.this.setDataAndLeave(); + if (!canvas.getTabWithCanvas().getText().contains("*")) + canvas.getTabWithCanvas().setText(canvas.getTabWithCanvas().getText() + "*"); + } + + + }); + this.cancelBTN = new Button("Cancel"); + this.cancelBTN.setBackground(new Background(new BackgroundFill(C2.ButtonBackgroundColor, new CornerRadii(5.0D), Insets.EMPTY))); + this.cancelBTN.setOnMouseEntered(event -> { + A8.this.getScene().getRoot().setCursor(Cursor.HAND); + T3.fdssdf4354(A8.this.cancelBTN, C2.MouseSelectedColor); + }); + this.cancelBTN.setOnMouseExited(event -> { + A8.this.getScene().getRoot().setCursor(Cursor.DEFAULT); + A8.this.cancelBTN.setEffect(null); + if (A8.this.cancelBTN.isFocused()) T3.fdssdf4354(A8.this.cancelBTN, C2.FocusOnComponentColor); + + }); + this.cancelBTN.focusedProperty().addListener((obs, oldVal, newVal) -> { + if (this.cancelBTN.isFocused()) { + T3.fdssdf4354(this.cancelBTN, C2.FocusOnComponentColor); + + this.columnPostfixTF.setEffect(null); + this.okBTN.setEffect(null); + } else { + this.cancelBTN.setEffect(null); + } + }); + this.cancelBTN.setOnAction(event -> A8.this.setNothingAndLeave()); + this.cancelBTN.setOnKeyPressed(event -> { + if (Objects.requireNonNull(event.getCode()) == KeyCode.ENTER) { + A8.this.setNothingAndLeave(); + } + + + }); + if (isKey) { + this.isKeyCB.setDisable(true); + this.isUniqueCB.setDisable(true); + this.createColumnCB.setDisable(true); + this.isNullableCB.setDisable(true); + } else { + + this.isKeyCB.setDisable(true); } - }); - if (isKey) { - this.isKeyCB.setDisable(true); - this.isUniqueCB.setDisable(true); - this.createColumnCB.setDisable(true); - this.isNullableCB.setDisable(true); - } else { - - this.isKeyCB.setDisable(true); - } + GridPane gridPane = new GridPane(); + + gridPane.setPadding(new Insets(10.0D, 10.0D, 10.0D, 10.0D)); + gridPane.setVgap(4.0D); + gridPane.setHgap(4.0D); + + Label lbl = new Label("Name:"); + lbl.setPrefWidth(100.0D); + lbl.setMinWidth(100.0D); + gridPane.add(lbl, 0, 0); + gridPane.add(this.nameTF, 1, 0); + lbl = new Label("Create column:"); + lbl.setPrefWidth(100.0D); + lbl.setMinWidth(100.0D); + gridPane.add(lbl, 0, 1); + gridPane.add(this.createColumnCB, 1, 1); + lbl = new Label("Column name:"); + lbl.setPrefWidth(100.0D); + lbl.setMinWidth(100.0D); + gridPane.add(lbl, 0, 2); + gridPane.add(this.columnNameTF, 1, 2); + lbl = new Label("Column postfix:"); + lbl.setPrefWidth(100.0D); + lbl.setMinWidth(100.0D); + gridPane.add(lbl, 0, 3); + gridPane.add(this.columnPostfixTF, 1, 3); + lbl = new Label("Column datatype:"); + lbl.setPrefWidth(100.0D); + lbl.setMinWidth(100.0D); + gridPane.add(lbl, 0, 4); + gridPane.add(this.datatypeTF, 1, 4); + lbl = new Label("Key:"); + lbl.setPrefWidth(100.0D); + lbl.setMinWidth(100.0D); + gridPane.add(lbl, 0, 5); + gridPane.add(this.isKeyCB, 1, 5); + lbl = new Label("Autoincrement:"); + lbl.setPrefWidth(100.0D); + lbl.setMinWidth(100.0D); + gridPane.add(lbl, 0, 6); + FlowPane fp = new FlowPane(); + fp.getChildren().add(this.isAutoincrementCB); + fp.getChildren().add(this.autoincrementStartAtTF); + gridPane.add(fp, 1, 6); + lbl = new Label("Nullable:"); + lbl.setPrefWidth(100.0D); + lbl.setMinWidth(100.0D); + gridPane.add(lbl, 0, 7); + gridPane.add(this.isNullableCB, 1, 7); + lbl = new Label("Unique:"); + lbl.setPrefWidth(100.0D); + lbl.setMinWidth(100.0D); + gridPane.add(lbl, 0, 8); + gridPane.add(this.isUniqueCB, 1, 8); + lbl = new Label("Data generation:"); + lbl.setPrefWidth(100.0D); + lbl.setMinWidth(100.0D); + gridPane.add(lbl, 0, 9); + gridPane.add(this.dataGenerationTypeCoB, 1, 9); + + GridPane parameterGP = new GridPane(); + this.par1LBL.setPrefWidth(150.0D); + this.par2LBL.setMaxWidth(150.0D); + this.par1TF.setPrefWidth(150.0D); + this.par2TF.setMaxWidth(150.0D); + parameterGP.add(this.par1LBL, 0, 0); + parameterGP.add(this.par2LBL, 1, 0); + parameterGP.add(this.par1TF, 0, 1); + parameterGP.add(this.par2TF, 1, 1); + + gridPane.add(parameterGP, 0, 10, 2, 1); - - GridPane gridPane = new GridPane(); - - gridPane.setPadding(new Insets(10.0D, 10.0D, 10.0D, 10.0D)); - gridPane.setVgap(4.0D); - gridPane.setHgap(4.0D); - - Label lbl = new Label("Name:"); - lbl.setPrefWidth(100.0D); - lbl.setMinWidth(100.0D); - gridPane.add(lbl, 0, 0); - gridPane.add(this.nameTF, 1, 0); - lbl = new Label("Create column:"); - lbl.setPrefWidth(100.0D); - lbl.setMinWidth(100.0D); - gridPane.add(lbl, 0, 1); - gridPane.add(this.createColumnCB, 1, 1); - lbl = new Label("Column name:"); - lbl.setPrefWidth(100.0D); - lbl.setMinWidth(100.0D); - gridPane.add(lbl, 0, 2); - gridPane.add(this.columnNameTF, 1, 2); - lbl = new Label("Column postfix:"); - lbl.setPrefWidth(100.0D); - lbl.setMinWidth(100.0D); - gridPane.add(lbl, 0, 3); - gridPane.add(this.columnPostfixTF, 1, 3); - lbl = new Label("Column datatype:"); - lbl.setPrefWidth(100.0D); - lbl.setMinWidth(100.0D); - gridPane.add(lbl, 0, 4); - gridPane.add(this.datatypeTF, 1, 4); - lbl = new Label("Key:"); - lbl.setPrefWidth(100.0D); - lbl.setMinWidth(100.0D); - gridPane.add(lbl, 0, 5); - gridPane.add(this.isKeyCB, 1, 5); - lbl = new Label("Autoincrement:"); - lbl.setPrefWidth(100.0D); - lbl.setMinWidth(100.0D); - gridPane.add(lbl, 0, 6); - FlowPane fp = new FlowPane(); - fp.getChildren().add(this.isAutoincrementCB); - fp.getChildren().add(this.autoincrementStartAtTF); - gridPane.add(fp, 1, 6); - lbl = new Label("Nullable:"); - lbl.setPrefWidth(100.0D); - lbl.setMinWidth(100.0D); - gridPane.add(lbl, 0, 7); - gridPane.add(this.isNullableCB, 1, 7); - lbl = new Label("Unique:"); - lbl.setPrefWidth(100.0D); - lbl.setMinWidth(100.0D); - gridPane.add(lbl, 0, 8); - gridPane.add(this.isUniqueCB, 1, 8); - lbl = new Label("Data generation:"); - lbl.setPrefWidth(100.0D); - lbl.setMinWidth(100.0D); - gridPane.add(lbl, 0, 9); - gridPane.add(this.dataGenerationTypeCoB, 1, 9); - - GridPane parameterGP = new GridPane(); - this.par1LBL.setPrefWidth(150.0D); - this.par2LBL.setMaxWidth(150.0D); - this.par1TF.setPrefWidth(150.0D); - this.par2TF.setMaxWidth(150.0D); - parameterGP.add(this.par1LBL, 0, 0); - parameterGP.add(this.par2LBL, 1, 0); - parameterGP.add(this.par1TF, 0, 1); - parameterGP.add(this.par2TF, 1, 1); - - gridPane.add(parameterGP, 0, 10, 2, 1); - - - fp = new FlowPane(); - fp.setHgap(10.0D); - fp.getChildren().addAll(this.okBTN, this.cancelBTN); - gridPane.add(fp, 0, 11, 2, 1); + fp = new FlowPane(); + fp.setHgap(10.0D); + fp.getChildren().addAll(this.okBTN, this.cancelBTN); + gridPane.add(fp, 0, 11, 2, 1); + Scene scene = new Scene(gridPane, 280.0D, 355.0D); + setScene(scene); - - - Scene scene = new Scene(gridPane, 280.0D, 355.0D); - setScene(scene); - - setX(xPos); - setY(yPos); - if (yPos + scene.getHeight() > canvas.getView().getHeight() - 5.0D) { - setY(yPos - scene.getHeight() - 20.0D); - } - if (xPos + scene.getWidth() > canvas.getView().getWidth() - 5.0D) { - setX(xPos - scene.getWidth() - 20.0D); - } - sizeToScene(); - - this.columnNameTF.requestFocus(); - - - - - if (isAutoincrement) { - this.dataGenerationTypeCoB.setDisable(true); - this.par1TF.setDisable(true); - this.par2TF.setDisable(true); - } - showAndWait(); - } - - - - - private void setDataAndLeave() { - if (this.createColumnCB.isSelected()) { - if (this.columnNameTF.getText() == null || this.columnNameTF.getText().length() == 0) { - return; - } - - - - - - - - - - - - - if (this.datatypeTF.getText() == null || this.datatypeTF.getText().length() == 0) { - return; - } - } - - - - - - - - - - - - - - - if (this.dataGenerationTypeCoB.getSelectionModel().getSelectedItem().equals("Extern")) { - BufferedReader br = C2.randomDataFilesExtern.get(this.par1TF.getText()); - - if (br == null) - { - try { - BufferedReader fr = new BufferedReader(new InputStreamReader(new FileInputStream(this.par2TF.getText()), StandardCharsets.UTF_8)); - - C2.randomDataFilesExtern.put(this.par1TF.getText(), fr); - this.thisActionMessageDialog.close(); - } catch (FileNotFoundException ignored) {} - - - - - - - - - } - else - { - - - - - - - - C1 alert = new C1(null, - Alert.AlertType.CONFIRMATION, - "Input Transformation Data", - "", - "Key exists: " + this.par1TF.getText(), - Boolean.TRUE, - C2.applicationImageIconAsICO, - "OK", - "Cancel", - C2.ButtonBackgroundColor, - C2.MouseSelectedColor, - C2.FocusOnComponentColor); - - Optional result = alert.getResult(); - - - if (result.isPresent() && result.get() == ButtonType.OK) - { - this.thisActionMessageDialog.close(); + setX(xPos); + setY(yPos); + if (yPos + scene.getHeight() > canvas.getView().getHeight() - 5.0D) { + setY(yPos - scene.getHeight() - 20.0D); } - } - - } else { - - this.thisActionMessageDialog.close(); - } - } + if (xPos + scene.getWidth() > canvas.getView().getWidth() - 5.0D) { + setX(xPos - scene.getWidth() - 20.0D); + } + sizeToScene(); + + this.columnNameTF.requestFocus(); - - private void setNothingAndLeave() { - this.nameTF.setText(this.holdName); - this.createColumnCB.setSelected(this.holdcreateColumn); - this.columnNameTF.setText(this.holdcolumnName); - this.columnPostfixTF.setText(this.holdcolumnPostfix); - this.datatypeTF.setText(this.holddatatype); - this.isAutoincrementCB.setSelected(this.holdisAutoincrement); - this.autoincrementStartAtTF.setText(String.valueOf(this.holdAutoincrementStartAt)); - this.isKeyCB.setSelected(this.holdisKey); - this.isNullableCB.setSelected(this.holdisNullable); - this.isUniqueCB.setSelected(this.holdisUnique); - - this.dataGenerationTypeCoB.getSelectionModel().select(this.holddatagenerationtype); - this.par1LBL.setText(this.holdpar1_label); - this.par1TF.setText(this.holdpar1); - this.par2LBL.setText(this.holdpar2_label); - this.par2TF.setText(this.holdpar2); - - this.thisActionMessageDialog.close(); - } + if (isAutoincrement) { + this.dataGenerationTypeCoB.setDisable(true); + this.par1TF.setDisable(true); + this.par2TF.setDisable(true); + } + showAndWait(); + } - public CheckBox getCreateColumnCB() { - return this.createColumnCB; - } + private void setDataAndLeave() { + if (this.createColumnCB.isSelected()) { + if (this.columnNameTF.getText() == null || this.columnNameTF.getText().length() == 0) { + return; + } - - - public TextField getColumnNameTF() { - return this.columnNameTF; - } + if (this.datatypeTF.getText() == null || this.datatypeTF.getText().length() == 0) { + return; + } + } + if (this.dataGenerationTypeCoB.getSelectionModel().getSelectedItem().equals("Extern")) { + BufferedReader br = C2.randomDataFilesExtern.get(this.par1TF.getText()); - - public TextField getColumnPostfixTF() { - return this.columnPostfixTF; - } + if (br == null) { + try { + BufferedReader fr = new BufferedReader(new InputStreamReader(new FileInputStream(this.par2TF.getText()), StandardCharsets.UTF_8)); + + C2.randomDataFilesExtern.put(this.par1TF.getText(), fr); + this.thisActionMessageDialog.close(); + } catch (FileNotFoundException ignored) { + } - - - public TextField getDatatypeTF() { - return this.datatypeTF; - } + } else { + C1 alert = new C1(null, + Alert.AlertType.CONFIRMATION, + "Input Transformation Data", + "", + "Key exists: " + this.par1TF.getText(), + Boolean.TRUE, + C2.applicationImageIconAsICO, + "OK", + "Cancel", + C2.ButtonBackgroundColor, + C2.MouseSelectedColor, + C2.FocusOnComponentColor); - - public CheckBox getIsAutoincrementCB() { - return this.isAutoincrementCB; - } + Optional result = alert.getResult(); + if (result.isPresent() && result.get() == ButtonType.OK) { + this.thisActionMessageDialog.close(); + } + } - - public CheckBox getIsKeyCB() { - return this.isKeyCB; - } + } else { + + this.thisActionMessageDialog.close(); + } + } + private void setNothingAndLeave() { + this.nameTF.setText(this.holdName); + this.createColumnCB.setSelected(this.holdcreateColumn); + this.columnNameTF.setText(this.holdcolumnName); + this.columnPostfixTF.setText(this.holdcolumnPostfix); + this.datatypeTF.setText(this.holddatatype); + this.isAutoincrementCB.setSelected(this.holdisAutoincrement); + this.autoincrementStartAtTF.setText(String.valueOf(this.holdAutoincrementStartAt)); + this.isKeyCB.setSelected(this.holdisKey); + this.isNullableCB.setSelected(this.holdisNullable); + this.isUniqueCB.setSelected(this.holdisUnique); - - public CheckBox getIsNullableCB() { - return this.isNullableCB; - } + this.dataGenerationTypeCoB.getSelectionModel().select(this.holddatagenerationtype); + this.par1LBL.setText(this.holdpar1_label); + this.par1TF.setText(this.holdpar1); + this.par2LBL.setText(this.holdpar2_label); + this.par2TF.setText(this.holdpar2); + + this.thisActionMessageDialog.close(); + } - - - public CheckBox getIsUniqueCB() { - return this.isUniqueCB; - } + public CheckBox getCreateColumnCB() { + return this.createColumnCB; + } - - - public ComboBox getDataGenerationTypeCoB() { - return this.dataGenerationTypeCoB; - } + public TextField getColumnNameTF() { + return this.columnNameTF; + } - - - public Label getPar1LBL() { - return this.par1LBL; - } + public TextField getColumnPostfixTF() { + return this.columnPostfixTF; + } - - - public TextField getPar1TF() { - return this.par1TF; - } + public TextField getDatatypeTF() { + return this.datatypeTF; + } - - - public Label getPar2LBL() { - return this.par2LBL; - } + public CheckBox getIsAutoincrementCB() { + return this.isAutoincrementCB; + } - - - public TextField getPar2TF() { - return this.par2TF; - } + public CheckBox getIsKeyCB() { + return this.isKeyCB; + } - public TextField getAutoincrementStartAtTF() { - return this.autoincrementStartAtTF; - } - - private void setSelectionForGenerationtype() { - if (this.dataGenerationTypeCoB.getSelectionModel().getSelectedItem() == null) - return; String str; - switch ((str = this.dataGenerationTypeCoB.getSelectionModel().getSelectedItem()).hashCode()) { - case -1601184309 -> { - if (!str.equals("Random Boolean")) { - break; - } - this.par1TF.setText(""); - this.par1LBL.setText(""); - this.par1TF.setDisable(true); - this.par2TF.setText(""); - this.par2LBL.setText(""); - this.par2TF.setDisable(true); - this.datatypeTF.setText("boolean"); - return; - } - case -123632396 -> { - if (!str.equals("Random Decimal")) - break; - this.par1TF.setText("5"); - this.par1LBL.setText("Before[.]"); - this.par1TF.setDisable(false); - this.par2TF.setText("2"); - this.par2LBL.setText("After[.]"); - this.par2TF.setDisable(false); - this.datatypeTF.setText("decimal(7,2)"); - return; - } - case 2529 -> { - if (!str.equals("No")) - break; - this.par1TF.setText(""); - this.par1LBL.setText(""); - this.par1TF.setDisable(true); - this.par2TF.setText(""); - this.par2LBL.setText(""); - this.par2TF.setDisable(true); - return; - } - case 292156129 -> { - if (!str.equals("Random Integer")) - break; - this.par1TF.setText("0"); - this.par1LBL.setText("From"); - this.par1TF.setDisable(false); - this.par2TF.setText("1000"); - this.par2LBL.setText("Till"); - this.par2TF.setDisable(false); - this.datatypeTF.setText("int"); - return; - } - case 908695787 -> { - if (!str.equals("Random Date")) - break; - this.par1TF.setText("1.1.1940"); - this.par1LBL.setText("From"); - this.par1TF.setDisable(false); - this.par2TF.setText("31.12.2020"); - this.par2LBL.setText("Till"); - this.par2TF.setDisable(false); - this.datatypeTF.setText("date"); - return; - } - case 909176426 -> { - if (!str.equals("Random Text")) - break; - this.par1TF.setText("100"); - this.par1LBL.setText("Text length"); - this.par1TF.setDisable(false); - this.par2TF.setText(""); - this.par2LBL.setText(""); - this.par2TF.setDisable(true); - this.datatypeTF.setText("varchar(100)"); - return; - } - case 1599784748 -> { - if (!str.equals("Incremented Integer")) - break; - this.par1TF.setText("0"); - this.par1LBL.setText("From"); - this.par1TF.setDisable(false); - this.par2TF.setText(""); - this.par2LBL.setText(""); - this.par2TF.setDisable(true); - this.datatypeTF.setText("int"); - return; - } - case 2089790400 -> { - if (!str.equals("Extern")) - break; - this.par1TF.setText(""); - this.par1LBL.setText("Key"); - this.par1TF.setDisable(false); - this.par2TF.setText(""); - this.par2LBL.setText("Path/File"); - this.par2TF.setDisable(false); - return; - } - } - this.par1TF.setText(""); this.par1LBL.setText(""); this.par1TF.setDisable(true); - this.par2TF.setText(""); this.par2LBL.setText(""); this.par2TF.setDisable(true); - } - - private void setVisibilityForGenerationtype() { - String str; - switch ((str = this.dataGenerationTypeCoB.getSelectionModel().getSelectedItem()).hashCode()) { - case -123632396 -> { - if (!str.equals("Random Decimal")) { - break; - } - this.par1LBL.setText("Before[.]"); - this.par1TF.setDisable(false); - this.par2LBL.setText("After[.]"); - this.par2TF.setDisable(false); - return; - } - case 2529 -> { - if (!str.equals("No")) - break; - this.par1TF.setDisable(true); - this.par2TF.setDisable(true); - return; - } - case 292156129 -> { - if (!str.equals("Random Integer")) - break; - this.par1LBL.setText("From"); - this.par1TF.setDisable(false); - this.par2LBL.setText("Till"); - this.par2TF.setDisable(false); - return; - } - case 908695787 -> { - if (!str.equals("Random Date")) - break; - this.par1LBL.setText("From"); - this.par1TF.setDisable(false); - this.par2LBL.setText("Till"); - this.par2TF.setDisable(false); - return; - } - case 909176426 -> { - if (!str.equals("Random Text")) - break; - this.par1LBL.setText("Text length"); - this.par1TF.setDisable(false); - this.par2LBL.setText(""); - this.par2TF.setDisable(true); - return; - } - case 1599784748 -> { - if (!str.equals("Incremented Integer")) - break; - this.par1LBL.setText("From"); - this.par1TF.setDisable(false); - this.par2LBL.setText(""); - this.par2TF.setDisable(true); - return; - } - case 2089790400 -> { - if (!str.equals("Extern")) - break; - this.par1LBL.setText("Key"); - this.par1TF.setDisable(false); - this.par2LBL.setText("Path/File"); - this.par2TF.setDisable(false); - return; - } - } - this.par1TF.setText(""); this.par1LBL.setText(""); this.par1TF.setDisable(true); - this.par2TF.setText(""); this.par2LBL.setText(""); this.par2TF.setDisable(true); - } + public CheckBox getIsNullableCB() { + return this.isNullableCB; + } + + + public CheckBox getIsUniqueCB() { + return this.isUniqueCB; + } + + + public ComboBox getDataGenerationTypeCoB() { + return this.dataGenerationTypeCoB; + } + + + public Label getPar1LBL() { + return this.par1LBL; + } + + + public TextField getPar1TF() { + return this.par1TF; + } + + + public Label getPar2LBL() { + return this.par2LBL; + } + + + public TextField getPar2TF() { + return this.par2TF; + } + + + public TextField getAutoincrementStartAtTF() { + return this.autoincrementStartAtTF; + } + + private void setSelectionForGenerationtype() { + if (this.dataGenerationTypeCoB.getSelectionModel().getSelectedItem() == null) + return; + String str; + switch ((str = this.dataGenerationTypeCoB.getSelectionModel().getSelectedItem()).hashCode()) { + case -1601184309 -> { + if (!str.equals("Random Boolean")) { + break; + } + this.par1TF.setText(""); + this.par1LBL.setText(""); + this.par1TF.setDisable(true); + this.par2TF.setText(""); + this.par2LBL.setText(""); + this.par2TF.setDisable(true); + this.datatypeTF.setText("boolean"); + return; + } + case -123632396 -> { + if (!str.equals("Random Decimal")) + break; + this.par1TF.setText("5"); + this.par1LBL.setText("Before[.]"); + this.par1TF.setDisable(false); + this.par2TF.setText("2"); + this.par2LBL.setText("After[.]"); + this.par2TF.setDisable(false); + this.datatypeTF.setText("decimal(7,2)"); + return; + } + case 2529 -> { + if (!str.equals("No")) + break; + this.par1TF.setText(""); + this.par1LBL.setText(""); + this.par1TF.setDisable(true); + this.par2TF.setText(""); + this.par2LBL.setText(""); + this.par2TF.setDisable(true); + return; + } + case 292156129 -> { + if (!str.equals("Random Integer")) + break; + this.par1TF.setText("0"); + this.par1LBL.setText("From"); + this.par1TF.setDisable(false); + this.par2TF.setText("1000"); + this.par2LBL.setText("Till"); + this.par2TF.setDisable(false); + this.datatypeTF.setText("int"); + return; + } + case 908695787 -> { + if (!str.equals("Random Date")) + break; + this.par1TF.setText("1.1.1940"); + this.par1LBL.setText("From"); + this.par1TF.setDisable(false); + this.par2TF.setText("31.12.2020"); + this.par2LBL.setText("Till"); + this.par2TF.setDisable(false); + this.datatypeTF.setText("date"); + return; + } + case 909176426 -> { + if (!str.equals("Random Text")) + break; + this.par1TF.setText("100"); + this.par1LBL.setText("Text length"); + this.par1TF.setDisable(false); + this.par2TF.setText(""); + this.par2LBL.setText(""); + this.par2TF.setDisable(true); + this.datatypeTF.setText("varchar(100)"); + return; + } + case 1599784748 -> { + if (!str.equals("Incremented Integer")) + break; + this.par1TF.setText("0"); + this.par1LBL.setText("From"); + this.par1TF.setDisable(false); + this.par2TF.setText(""); + this.par2LBL.setText(""); + this.par2TF.setDisable(true); + this.datatypeTF.setText("int"); + return; + } + case 2089790400 -> { + if (!str.equals("Extern")) + break; + this.par1TF.setText(""); + this.par1LBL.setText("Key"); + this.par1TF.setDisable(false); + this.par2TF.setText(""); + this.par2LBL.setText("Path/File"); + this.par2TF.setDisable(false); + return; + } + } + this.par1TF.setText(""); + this.par1LBL.setText(""); + this.par1TF.setDisable(true); + this.par2TF.setText(""); + this.par2LBL.setText(""); + this.par2TF.setDisable(true); + } + + private void setVisibilityForGenerationtype() { + String str; + switch ((str = this.dataGenerationTypeCoB.getSelectionModel().getSelectedItem()).hashCode()) { + case -123632396 -> { + if (!str.equals("Random Decimal")) { + break; + } + this.par1LBL.setText("Before[.]"); + this.par1TF.setDisable(false); + this.par2LBL.setText("After[.]"); + this.par2TF.setDisable(false); + return; + } + case 2529 -> { + if (!str.equals("No")) + break; + this.par1TF.setDisable(true); + this.par2TF.setDisable(true); + return; + } + case 292156129 -> { + if (!str.equals("Random Integer")) + break; + this.par1LBL.setText("From"); + this.par1TF.setDisable(false); + this.par2LBL.setText("Till"); + this.par2TF.setDisable(false); + return; + } + case 908695787 -> { + if (!str.equals("Random Date")) + break; + this.par1LBL.setText("From"); + this.par1TF.setDisable(false); + this.par2LBL.setText("Till"); + this.par2TF.setDisable(false); + return; + } + case 909176426 -> { + if (!str.equals("Random Text")) + break; + this.par1LBL.setText("Text length"); + this.par1TF.setDisable(false); + this.par2LBL.setText(""); + this.par2TF.setDisable(true); + return; + } + case 1599784748 -> { + if (!str.equals("Incremented Integer")) + break; + this.par1LBL.setText("From"); + this.par1TF.setDisable(false); + this.par2LBL.setText(""); + this.par2TF.setDisable(true); + return; + } + case 2089790400 -> { + if (!str.equals("Extern")) + break; + this.par1LBL.setText("Key"); + this.par1TF.setDisable(false); + this.par2LBL.setText("Path/File"); + this.par2TF.setDisable(false); + return; + } + } + this.par1TF.setText(""); + this.par1LBL.setText(""); + this.par1TF.setDisable(true); + this.par2TF.setText(""); + this.par2LBL.setText(""); + this.par2TF.setDisable(true); + } } diff --git a/at/fos/ermodel/gui/A9.java b/at/fos/ermodel/gui/A9.java index a16b24c..243729c 100644 --- a/at/fos/ermodel/gui/A9.java +++ b/at/fos/ermodel/gui/A9.java @@ -1,248 +1,229 @@ - package at.fos.ermodel.gui; +package at.fos.ermodel.gui; - import javafx.event.ActionEvent; - import javafx.event.EventHandler; - import javafx.geometry.Insets; - import javafx.scene.Cursor; - import javafx.scene.Scene; - import javafx.scene.control.Button; - import javafx.scene.control.CheckBox; - import javafx.scene.control.Label; - import javafx.scene.control.TextField; - import javafx.scene.input.KeyCode; - import javafx.scene.layout.*; - import javafx.stage.Modality; - import javafx.stage.Stage; +import javafx.event.ActionEvent; +import javafx.event.EventHandler; +import javafx.geometry.Insets; +import javafx.scene.Cursor; +import javafx.scene.Scene; +import javafx.scene.control.Button; +import javafx.scene.control.CheckBox; +import javafx.scene.control.Label; +import javafx.scene.control.TextField; +import javafx.scene.input.KeyCode; +import javafx.scene.layout.*; +import javafx.stage.Modality; +import javafx.stage.Stage; - import java.util.Objects; +import java.util.Objects; - public class A9 - extends Stage - { - private final A9 thisActionMessageDialog; - private final TextField nameTF; - private final CheckBox createRelationCB; - private final TextField relationNameTF; - private final TextField relationPraefixTF; - private final CheckBox createInsertStatementsCB; - private final TextField numberRowsToInsertTF; - private final Button okBTN; - private Button cancelBTN; - private final String holdName; - - public A9(final A3 canvas, double xPos, double yPos, String name, boolean createRelation, String relationName, String relationPraefix, boolean createInsertStatements, long numberRowsToInsert, boolean setCreationRelationChangeable) { +public class A9 + extends Stage { + private final A9 thisActionMessageDialog; + private final TextField nameTF; + private final CheckBox createRelationCB; + private final TextField relationNameTF; + private final TextField relationPraefixTF; + private final CheckBox createInsertStatementsCB; + private final TextField numberRowsToInsertTF; + private final Button okBTN; + private final String holdName; + private Button cancelBTN; - String title = "ES/RS Transformation"; - - - this.holdName = name; - - this.thisActionMessageDialog = this; - setTitle(title); - initModality(Modality.APPLICATION_MODAL); - - - - - - this.nameTF = new TextField(name); - this.nameTF.setDisable(true); - - - this.createRelationCB = new CheckBox(); - this.createRelationCB.setSelected(false); - - if (!setCreationRelationChangeable) this.createRelationCB.setDisable(true); - if (createRelation) this.createRelationCB.setSelected(true); - - this.relationPraefixTF = new TextField(relationPraefix); - this.relationPraefixTF.setOnMouseEntered(event -> T3.fdssdf4354(A9.this.relationPraefixTF, C2.MouseSelectedColor)); - this.relationPraefixTF.setOnMouseExited(event -> A9.this.relationPraefixTF.setEffect(null)); - this.relationNameTF = new TextField(relationName); - this.relationNameTF.setOnMouseEntered(event -> T3.fdssdf4354(A9.this.relationNameTF, C2.MouseSelectedColor)); - this.relationNameTF.setOnMouseExited(event -> A9.this.relationNameTF.setEffect(null)); - - - this.createInsertStatementsCB = new CheckBox(); - this.createInsertStatementsCB.setSelected(true); - this.createInsertStatementsCB.setDisable(true); - if (createInsertStatements) this.createInsertStatementsCB.setSelected(true); - this.createInsertStatementsCB.setOnAction(new EventHandler<>() { - public void handle(ActionEvent event) { - A9.this.numberRowsToInsertTF.setDisable(!A9.this.createInsertStatementsCB.isSelected()); - } - }); - this.numberRowsToInsertTF = new TextField(String.valueOf(numberRowsToInsert)); - this.numberRowsToInsertTF.setDisable(true); - if (createInsertStatements) this.numberRowsToInsertTF.setDisable(false); - - this.okBTN = new Button("Ok"); - this.okBTN.setBackground(new Background(new BackgroundFill(C2.ButtonBackgroundColor, new CornerRadii(5.0D), Insets.EMPTY))); - this.okBTN.setOnMouseEntered(event -> { - A9.this.getScene().getRoot().setCursor(Cursor.HAND); - T3.fdssdf4354(A9.this.okBTN, C2.MouseSelectedColor); - }); - this.okBTN.setOnMouseExited(event -> { - A9.this.getScene().getRoot().setCursor(Cursor.DEFAULT); - A9.this.okBTN.setEffect(null); - if (A9.this.okBTN.isFocused()) T3.fdssdf4354(A9.this.okBTN, C2.FocusOnComponentColor); - }); - this.okBTN.focusedProperty().addListener((obs, oldVal, newVal) -> { - if (this.okBTN.isFocused()) { - T3.fdssdf4354(this.okBTN, C2.FocusOnComponentColor); - - this.relationPraefixTF.setEffect(null); - - this.cancelBTN.setEffect(null); - } else { - this.okBTN.setEffect(null); - } - }); - this.okBTN.setOnAction(event -> { - A9.this.setDataAndLeave(); + public A9(final A3 canvas, double xPos, double yPos, String name, boolean createRelation, String relationName, String relationPraefix, boolean createInsertStatements, long numberRowsToInsert, boolean setCreationRelationChangeable) { - if (!canvas.getTabWithCanvas().getText().contains("*")) canvas.getTabWithCanvas().setText(canvas.getTabWithCanvas().getText() + "*"); - }); - this.okBTN.setOnKeyPressed(event -> { - if (Objects.requireNonNull(event.getCode()) == KeyCode.ENTER) { - A9.this.setDataAndLeave(); - - if (!canvas.getTabWithCanvas().getText().contains("*")) - canvas.getTabWithCanvas().setText(canvas.getTabWithCanvas().getText() + "*"); - } + String title = "ES/RS Transformation"; + this.holdName = name; - }); - this.cancelBTN = new Button("Cancel"); - this.cancelBTN.setBackground(new Background(new BackgroundFill(C2.ButtonBackgroundColor, new CornerRadii(5.0D), Insets.EMPTY))); - this.cancelBTN.setOnMouseEntered(event -> { - A9.this.getScene().getRoot().setCursor(Cursor.HAND); - T3.fdssdf4354(A9.this.cancelBTN, C2.MouseSelectedColor); - }); - this.cancelBTN.setOnMouseExited(event -> { - A9.this.getScene().getRoot().setCursor(Cursor.DEFAULT); - A9.this.cancelBTN.setEffect(null); - if (A9.this.cancelBTN.isFocused()) T3.fdssdf4354(A9.this.cancelBTN, C2.FocusOnComponentColor); - - }); - this.cancelBTN.focusedProperty().addListener((obs, oldVal, newVal) -> { - if (this.cancelBTN.isFocused()) { - T3.fdssdf4354(this.cancelBTN, C2.FocusOnComponentColor); - - this.relationPraefixTF.setEffect(null); - this.okBTN.setEffect(null); - } else { - this.cancelBTN.setEffect(null); - } - }); - this.cancelBTN.setOnAction(event -> A9.this.setNothingAndLeave()); - this.cancelBTN.setOnKeyPressed(event -> { - if (Objects.requireNonNull(event.getCode()) == KeyCode.ENTER) { - A9.this.setNothingAndLeave(); - } + this.thisActionMessageDialog = this; + setTitle(title); + initModality(Modality.APPLICATION_MODAL); - }); - GridPane gridPane = new GridPane(); - gridPane.setPadding(new Insets(10.0D, 10.0D, 10.0D, 10.0D)); - gridPane.setVgap(4.0D); - gridPane.setHgap(4.0D); - - gridPane.add(new Label("Name:"), 0, 0); - gridPane.add(this.nameTF, 1, 0); - gridPane.add(new Label("Create relation:"), 0, 1); - gridPane.add(this.createRelationCB, 1, 1); - gridPane.add(new Label("Relation name:"), 0, 2); - gridPane.add(this.relationNameTF, 1, 2); - gridPane.add(new Label("Relation praefix:"), 0, 3); - gridPane.add(this.relationPraefixTF, 1, 3); - gridPane.add(new Label("Create inserts:"), 0, 4); - gridPane.add(this.createInsertStatementsCB, 1, 4); - gridPane.add(new Label("Number rows:"), 0, 5); - gridPane.add(this.numberRowsToInsertTF, 1, 5); - FlowPane fp = new FlowPane(); - fp.setHgap(10.0D); - - - fp.getChildren().addAll(this.okBTN, this.cancelBTN); - gridPane.add(fp, 0, 6, 2, 1); - - - - - - Scene scene = new Scene(gridPane, 300.0D, 205.0D); - - setScene(scene); - sizeToScene(); - - setX(xPos); - setY(yPos); - if (yPos + scene.getHeight() > canvas.getView().getHeight() - 5.0D) { - setY(yPos - scene.getHeight() - 20.0D); - } - if (xPos + scene.getWidth() > canvas.getView().getWidth() - 5.0D) { - setX(xPos - scene.getWidth() - 20.0D); - } - - this.relationNameTF.requestFocus(); - - - - sizeToScene(); - showAndWait(); - } - - - - - private void setDataAndLeave() { - if (this.nameTF.getText() == null || this.nameTF.getText().length() == 0) - return; this.thisActionMessageDialog.close(); - } - - - - - private void setNothingAndLeave() { - this.nameTF.setText(this.holdName); - this.thisActionMessageDialog.close(); - } + this.nameTF = new TextField(name); + this.nameTF.setDisable(true); - public CheckBox getCreateRelationCB() { - return this.createRelationCB; - } - - - - - public TextField getRelationNameTF() { - return this.relationNameTF; - } - - - - - public TextField getRelationPraefixTF() { - return this.relationPraefixTF; - } - - - - - public CheckBox getCreateInsertStatementsCB() { - return this.createInsertStatementsCB; - } - - - - - public TextField getNumberRowsToInsertTF() { - return this.numberRowsToInsertTF; - } - } + this.createRelationCB = new CheckBox(); + this.createRelationCB.setSelected(false); + + if (!setCreationRelationChangeable) this.createRelationCB.setDisable(true); + if (createRelation) this.createRelationCB.setSelected(true); + + this.relationPraefixTF = new TextField(relationPraefix); + this.relationPraefixTF.setOnMouseEntered(event -> T3.fdssdf4354(A9.this.relationPraefixTF, C2.MouseSelectedColor)); + this.relationPraefixTF.setOnMouseExited(event -> A9.this.relationPraefixTF.setEffect(null)); + this.relationNameTF = new TextField(relationName); + this.relationNameTF.setOnMouseEntered(event -> T3.fdssdf4354(A9.this.relationNameTF, C2.MouseSelectedColor)); + this.relationNameTF.setOnMouseExited(event -> A9.this.relationNameTF.setEffect(null)); + + + this.createInsertStatementsCB = new CheckBox(); + this.createInsertStatementsCB.setSelected(true); + this.createInsertStatementsCB.setDisable(true); + if (createInsertStatements) this.createInsertStatementsCB.setSelected(true); + this.createInsertStatementsCB.setOnAction(new EventHandler<>() { + public void handle(ActionEvent event) { + A9.this.numberRowsToInsertTF.setDisable(!A9.this.createInsertStatementsCB.isSelected()); + } + }); + this.numberRowsToInsertTF = new TextField(String.valueOf(numberRowsToInsert)); + this.numberRowsToInsertTF.setDisable(true); + if (createInsertStatements) this.numberRowsToInsertTF.setDisable(false); + + this.okBTN = new Button("Ok"); + this.okBTN.setBackground(new Background(new BackgroundFill(C2.ButtonBackgroundColor, new CornerRadii(5.0D), Insets.EMPTY))); + this.okBTN.setOnMouseEntered(event -> { + A9.this.getScene().getRoot().setCursor(Cursor.HAND); + T3.fdssdf4354(A9.this.okBTN, C2.MouseSelectedColor); + }); + this.okBTN.setOnMouseExited(event -> { + A9.this.getScene().getRoot().setCursor(Cursor.DEFAULT); + A9.this.okBTN.setEffect(null); + if (A9.this.okBTN.isFocused()) T3.fdssdf4354(A9.this.okBTN, C2.FocusOnComponentColor); + }); + this.okBTN.focusedProperty().addListener((obs, oldVal, newVal) -> { + if (this.okBTN.isFocused()) { + T3.fdssdf4354(this.okBTN, C2.FocusOnComponentColor); + + this.relationPraefixTF.setEffect(null); + + this.cancelBTN.setEffect(null); + } else { + this.okBTN.setEffect(null); + } + }); + this.okBTN.setOnAction(event -> { + A9.this.setDataAndLeave(); + + if (!canvas.getTabWithCanvas().getText().contains("*")) + canvas.getTabWithCanvas().setText(canvas.getTabWithCanvas().getText() + "*"); + }); + this.okBTN.setOnKeyPressed(event -> { + if (Objects.requireNonNull(event.getCode()) == KeyCode.ENTER) { + A9.this.setDataAndLeave(); + + if (!canvas.getTabWithCanvas().getText().contains("*")) + canvas.getTabWithCanvas().setText(canvas.getTabWithCanvas().getText() + "*"); + } + + + }); + this.cancelBTN = new Button("Cancel"); + this.cancelBTN.setBackground(new Background(new BackgroundFill(C2.ButtonBackgroundColor, new CornerRadii(5.0D), Insets.EMPTY))); + this.cancelBTN.setOnMouseEntered(event -> { + A9.this.getScene().getRoot().setCursor(Cursor.HAND); + T3.fdssdf4354(A9.this.cancelBTN, C2.MouseSelectedColor); + }); + this.cancelBTN.setOnMouseExited(event -> { + A9.this.getScene().getRoot().setCursor(Cursor.DEFAULT); + A9.this.cancelBTN.setEffect(null); + if (A9.this.cancelBTN.isFocused()) T3.fdssdf4354(A9.this.cancelBTN, C2.FocusOnComponentColor); + + }); + this.cancelBTN.focusedProperty().addListener((obs, oldVal, newVal) -> { + if (this.cancelBTN.isFocused()) { + T3.fdssdf4354(this.cancelBTN, C2.FocusOnComponentColor); + + this.relationPraefixTF.setEffect(null); + this.okBTN.setEffect(null); + } else { + this.cancelBTN.setEffect(null); + } + }); + this.cancelBTN.setOnAction(event -> A9.this.setNothingAndLeave()); + this.cancelBTN.setOnKeyPressed(event -> { + if (Objects.requireNonNull(event.getCode()) == KeyCode.ENTER) { + A9.this.setNothingAndLeave(); + } + + + }); + GridPane gridPane = new GridPane(); + gridPane.setPadding(new Insets(10.0D, 10.0D, 10.0D, 10.0D)); + gridPane.setVgap(4.0D); + gridPane.setHgap(4.0D); + + gridPane.add(new Label("Name:"), 0, 0); + gridPane.add(this.nameTF, 1, 0); + gridPane.add(new Label("Create relation:"), 0, 1); + gridPane.add(this.createRelationCB, 1, 1); + gridPane.add(new Label("Relation name:"), 0, 2); + gridPane.add(this.relationNameTF, 1, 2); + gridPane.add(new Label("Relation praefix:"), 0, 3); + gridPane.add(this.relationPraefixTF, 1, 3); + gridPane.add(new Label("Create inserts:"), 0, 4); + gridPane.add(this.createInsertStatementsCB, 1, 4); + gridPane.add(new Label("Number rows:"), 0, 5); + gridPane.add(this.numberRowsToInsertTF, 1, 5); + FlowPane fp = new FlowPane(); + fp.setHgap(10.0D); + + + fp.getChildren().addAll(this.okBTN, this.cancelBTN); + gridPane.add(fp, 0, 6, 2, 1); + + + Scene scene = new Scene(gridPane, 300.0D, 205.0D); + + setScene(scene); + sizeToScene(); + + setX(xPos); + setY(yPos); + if (yPos + scene.getHeight() > canvas.getView().getHeight() - 5.0D) { + setY(yPos - scene.getHeight() - 20.0D); + } + if (xPos + scene.getWidth() > canvas.getView().getWidth() - 5.0D) { + setX(xPos - scene.getWidth() - 20.0D); + } + + this.relationNameTF.requestFocus(); + + + sizeToScene(); + showAndWait(); + } + + + private void setDataAndLeave() { + if (this.nameTF.getText() == null || this.nameTF.getText().length() == 0) + return; + this.thisActionMessageDialog.close(); + } + + + private void setNothingAndLeave() { + this.nameTF.setText(this.holdName); + this.thisActionMessageDialog.close(); + } + + + public CheckBox getCreateRelationCB() { + return this.createRelationCB; + } + + + public TextField getRelationNameTF() { + return this.relationNameTF; + } + + + public TextField getRelationPraefixTF() { + return this.relationPraefixTF; + } + + + public CheckBox getCreateInsertStatementsCB() { + return this.createInsertStatementsCB; + } + + + public TextField getNumberRowsToInsertTF() { + return this.numberRowsToInsertTF; + } +} diff --git a/at/fos/ermodel/gui/B1.java b/at/fos/ermodel/gui/B1.java index 83ad1e1..e99b10f 100644 --- a/at/fos/ermodel/gui/B1.java +++ b/at/fos/ermodel/gui/B1.java @@ -1,334 +1,301 @@ - package at.fos.ermodel.gui; +package at.fos.ermodel.gui; - import javafx.geometry.Insets; - import javafx.scene.Cursor; - import javafx.scene.Scene; - import javafx.scene.control.Button; - import javafx.scene.control.CheckBox; - import javafx.scene.control.Label; - import javafx.scene.control.TextField; - import javafx.scene.input.KeyCode; - import javafx.scene.layout.*; - import javafx.stage.Modality; - import javafx.stage.Stage; +import javafx.geometry.Insets; +import javafx.scene.Cursor; +import javafx.scene.Scene; +import javafx.scene.control.Button; +import javafx.scene.control.CheckBox; +import javafx.scene.control.Label; +import javafx.scene.control.TextField; +import javafx.scene.input.KeyCode; +import javafx.scene.layout.*; +import javafx.stage.Modality; +import javafx.stage.Stage; - import java.util.Objects; +import java.util.Objects; - public class B1 - extends Stage - { - private final B1 thisActionMessageDialog; - private final TextField nameTF; - private final CheckBox createColumnCB; - private final TextField columnNameTF; - private final TextField relationNameTF; - private final TextField relationNamePraefixTF; - private final TextField columnPostfixTF; - private final TextField datatypeTF; - private final CheckBox isAutoincrementCB; - private final CheckBox isKeyCB; - private final CheckBox isNullableCB; - private final CheckBox isUniqueCB; - private final Button okBTN; - private Button cancelBTN; - private final String holdName; - - public B1(final A3 canvas, double xPos, double yPos, String name, boolean createColumn, String columnName, String relationName, String relationNamePraefix, String columnPostfix, String datatype, boolean isAutoincrement, boolean isKey, boolean isNullable, boolean isUnique) { - String title = "Multivalue Attribute Transformation"; - - - this.holdName = name; - - this.thisActionMessageDialog = this; - setTitle(title); - initModality(Modality.APPLICATION_MODAL); - - - - - - - this.nameTF = new TextField(name); - this.nameTF.setDisable(true); - - - - this.createColumnCB = new CheckBox(); - this.createColumnCB.setSelected(false); - - this.createColumnCB.setDisable(true); - if (createColumn) this.createColumnCB.setSelected(true); - this.createColumnCB.setOnMouseEntered(event -> T3.fdssdf4354(B1.this.createColumnCB, C2.MouseSelectedColor)); - this.createColumnCB.setOnMouseExited(event -> B1.this.createColumnCB.setEffect(null)); - - this.columnPostfixTF = new TextField(columnPostfix); - this.columnPostfixTF.setOnMouseEntered(event -> T3.fdssdf4354(B1.this.columnPostfixTF, C2.MouseSelectedColor)); - this.columnPostfixTF.setOnMouseExited(event -> B1.this.columnPostfixTF.setEffect(null)); - - this.columnNameTF = new TextField(columnName); - this.columnNameTF.setOnMouseEntered(event -> T3.fdssdf4354(B1.this.columnNameTF, C2.MouseSelectedColor)); - this.columnNameTF.setOnMouseExited(event -> B1.this.columnNameTF.setEffect(null)); - - this.relationNameTF = new TextField(relationName); - this.relationNameTF.setOnMouseEntered(event -> T3.fdssdf4354(B1.this.relationNameTF, C2.MouseSelectedColor)); - this.relationNameTF.setOnMouseExited(event -> B1.this.relationNameTF.setEffect(null)); - - this.relationNamePraefixTF = new TextField(relationNamePraefix); - this.relationNamePraefixTF.setOnMouseEntered(event -> T3.fdssdf4354(B1.this.relationNamePraefixTF, C2.MouseSelectedColor)); - this.relationNamePraefixTF.setOnMouseExited(event -> B1.this.relationNamePraefixTF.setEffect(null)); - - this.datatypeTF = new TextField(datatype); - this.datatypeTF.setOnMouseEntered(event -> T3.fdssdf4354(B1.this.datatypeTF, C2.MouseSelectedColor)); - this.datatypeTF.setOnMouseExited(event -> B1.this.datatypeTF.setEffect(null)); - - this.isAutoincrementCB = new CheckBox(); - this.isAutoincrementCB.setSelected(false); - if (isAutoincrement) this.isAutoincrementCB.setSelected(true); - this.isAutoincrementCB.setOnMouseEntered(event -> T3.fdssdf4354(B1.this.isAutoincrementCB, C2.MouseSelectedColor)); - this.isAutoincrementCB.setOnMouseExited(event -> B1.this.isAutoincrementCB.setEffect(null)); - - this.isKeyCB = new CheckBox(); - this.isKeyCB.setSelected(false); - if (isKey) this.isKeyCB.setSelected(true); - this.isKeyCB.setOnMouseEntered(event -> T3.fdssdf4354(B1.this.isKeyCB, C2.MouseSelectedColor)); - this.isKeyCB.setOnMouseExited(event -> B1.this.isKeyCB.setEffect(null)); - - this.isNullableCB = new CheckBox(); - this.isNullableCB.setSelected(false); - if (isNullable) this.isNullableCB.setSelected(true); - this.isNullableCB.setOnMouseEntered(event -> T3.fdssdf4354(B1.this.isNullableCB, C2.MouseSelectedColor)); - this.isNullableCB.setOnMouseExited(event -> B1.this.isNullableCB.setEffect(null)); - - this.isUniqueCB = new CheckBox(); - this.isUniqueCB.setSelected(false); - if (isUnique) this.isUniqueCB.setSelected(true); - this.isUniqueCB.setOnMouseEntered(event -> T3.fdssdf4354(B1.this.isUniqueCB, C2.MouseSelectedColor)); - this.isUniqueCB.setOnMouseExited(event -> B1.this.isUniqueCB.setEffect(null)); - - this.okBTN = new Button("Ok"); - this.okBTN.setBackground(new Background(new BackgroundFill(C2.ButtonBackgroundColor, new CornerRadii(5.0D), Insets.EMPTY))); - this.okBTN.setOnMouseEntered(event -> { - B1.this.getScene().getRoot().setCursor(Cursor.HAND); - T3.fdssdf4354(B1.this.okBTN, C2.MouseSelectedColor); - }); - this.okBTN.setOnMouseExited(event -> { - B1.this.getScene().getRoot().setCursor(Cursor.DEFAULT); - B1.this.okBTN.setEffect(null); - if (B1.this.okBTN.isFocused()) T3.fdssdf4354(B1.this.okBTN, C2.FocusOnComponentColor); - }); - this.okBTN.focusedProperty().addListener((obs, oldVal, newVal) -> { - if (this.okBTN.isFocused()) { - T3.fdssdf4354(this.okBTN, C2.FocusOnComponentColor); - - this.columnPostfixTF.setEffect(null); - - this.cancelBTN.setEffect(null); - } else { - this.okBTN.setEffect(null); - } - }); - this.okBTN.setOnAction(event -> { - if (!canvas.getTabWithCanvas().getText().contains("*")) canvas.getTabWithCanvas().setText(canvas.getTabWithCanvas().getText() + "*"); +public class B1 + extends Stage { + private final B1 thisActionMessageDialog; + private final TextField nameTF; + private final CheckBox createColumnCB; + private final TextField columnNameTF; + private final TextField relationNameTF; + private final TextField relationNamePraefixTF; + private final TextField columnPostfixTF; + private final TextField datatypeTF; + private final CheckBox isAutoincrementCB; + private final CheckBox isKeyCB; + private final CheckBox isNullableCB; + private final CheckBox isUniqueCB; + private final Button okBTN; + private final String holdName; + private Button cancelBTN; - B1.this.setDataAndLeave(); - }); - this.okBTN.setOnKeyPressed(event -> { - if (Objects.requireNonNull(event.getCode()) == KeyCode.ENTER) { - B1.this.setDataAndLeave(); - - if (!canvas.getTabWithCanvas().getText().contains("*")) - canvas.getTabWithCanvas().setText(canvas.getTabWithCanvas().getText() + "*"); - } + public B1(final A3 canvas, double xPos, double yPos, String name, boolean createColumn, String columnName, String relationName, String relationNamePraefix, String columnPostfix, String datatype, boolean isAutoincrement, boolean isKey, boolean isNullable, boolean isUnique) { + String title = "Multivalue Attribute Transformation"; + this.holdName = name; - }); - this.cancelBTN = new Button("Cancel"); - this.cancelBTN.setBackground(new Background(new BackgroundFill(C2.ButtonBackgroundColor, new CornerRadii(5.0D), Insets.EMPTY))); - this.cancelBTN.setOnMouseEntered(event -> { - B1.this.getScene().getRoot().setCursor(Cursor.HAND); - T3.fdssdf4354(B1.this.cancelBTN, C2.MouseSelectedColor); - }); - this.cancelBTN.setOnMouseExited(event -> { - B1.this.getScene().getRoot().setCursor(Cursor.DEFAULT); - B1.this.cancelBTN.setEffect(null); - if (B1.this.cancelBTN.isFocused()) T3.fdssdf4354(B1.this.cancelBTN, C2.FocusOnComponentColor); - - }); - this.cancelBTN.focusedProperty().addListener((obs, oldVal, newVal) -> { - if (this.cancelBTN.isFocused()) { - T3.fdssdf4354(this.cancelBTN, C2.FocusOnComponentColor); - - this.columnPostfixTF.setEffect(null); - this.okBTN.setEffect(null); - } else { - this.cancelBTN.setEffect(null); - } - }); - this.cancelBTN.setOnAction(event -> B1.this.setNothingAndLeave()); - this.cancelBTN.setOnKeyPressed(event -> { - if (Objects.requireNonNull(event.getCode()) == KeyCode.ENTER) { - B1.this.setNothingAndLeave(); - } + this.thisActionMessageDialog = this; + setTitle(title); + initModality(Modality.APPLICATION_MODAL); - }); - if (isKey) { - this.isKeyCB.setDisable(true); - this.isUniqueCB.setDisable(true); - this.createColumnCB.setDisable(true); - this.isNullableCB.setDisable(true); - } else { - - this.isKeyCB.setDisable(true); - } - - - - GridPane gridPane = new GridPane(); - gridPane.setPadding(new Insets(10.0D, 10.0D, 10.0D, 10.0D)); - gridPane.setVgap(4.0D); - gridPane.setHgap(4.0D); - - gridPane.add(new Label("Name:"), 0, 0); - gridPane.add(this.nameTF, 1, 0); - gridPane.add(new Label("Create column:"), 0, 1); - gridPane.add(this.createColumnCB, 1, 1); - gridPane.add(new Label("Column name:"), 0, 2); - gridPane.add(this.columnNameTF, 1, 2); - gridPane.add(new Label("Relation name:"), 0, 3); - gridPane.add(this.relationNameTF, 1, 3); - gridPane.add(new Label("Relation name praefix:"), 0, 4); - gridPane.add(this.relationNamePraefixTF, 1, 4); - gridPane.add(new Label("Column postfix:"), 0, 5); - gridPane.add(this.columnPostfixTF, 1, 5); - gridPane.add(new Label("Column datatype:"), 0, 6); - gridPane.add(this.datatypeTF, 1, 6); - gridPane.add(new Label("Key:"), 0, 7); - gridPane.add(this.isKeyCB, 1, 7); - gridPane.add(new Label("Autoincrement:"), 0, 8); - gridPane.add(this.isAutoincrementCB, 1, 8); - gridPane.add(new Label("Nullable:"), 0, 9); - gridPane.add(this.isNullableCB, 1, 9); - gridPane.add(new Label("Unique:"), 0, 10); - gridPane.add(this.isUniqueCB, 1, 10); - - - - FlowPane fp = new FlowPane(); - fp.setHgap(10.0D); - fp.getChildren().addAll(this.okBTN, this.cancelBTN); - gridPane.add(fp, 0, 11, 2, 1); - - - - - - Scene scene = new Scene(gridPane, 300.0D, 325.0D); - setScene(scene); - - setX(xPos); - setY(yPos); - if (yPos + scene.getHeight() > canvas.getView().getHeight() - 5.0D) { - setY(yPos - scene.getHeight() - 20.0D); - } - if (xPos + scene.getWidth() > canvas.getView().getWidth() - 5.0D) { - setX(xPos - scene.getWidth() - 20.0D); - } - - this.columnNameTF.requestFocus(); - - - - sizeToScene(); - - showAndWait(); - } - - - - - private void setDataAndLeave() { - if (this.nameTF.getText() == null || this.nameTF.getText().length() == 0) - return; this.thisActionMessageDialog.close(); - } - - - - - private void setNothingAndLeave() { - this.nameTF.setText(this.holdName); - this.thisActionMessageDialog.close(); - } + this.nameTF = new TextField(name); + this.nameTF.setDisable(true); - public CheckBox getCreateColumnCB() { - return this.createColumnCB; - } - - - - - public TextField getColumnNameTF() { - return this.columnNameTF; - } - - - - - public TextField getColumnPostfixTF() { - return this.columnPostfixTF; - } - - - - - public TextField getDatatypeTF() { - return this.datatypeTF; - } - - - - - public CheckBox getIsAutoincrementCB() { - return this.isAutoincrementCB; - } - - - - - public CheckBox getIsKeyCB() { - return this.isKeyCB; - } - - - - - public CheckBox getIsNullableCB() { - return this.isNullableCB; - } - - - - - public CheckBox getIsUniqueCB() { - return this.isUniqueCB; - } - - - - - public TextField getRelationNameTF() { - return this.relationNameTF; - } - - - - - public TextField getRelationNamePraefixTF() { - return this.relationNamePraefixTF; - } - } + this.createColumnCB = new CheckBox(); + this.createColumnCB.setSelected(false); + + this.createColumnCB.setDisable(true); + if (createColumn) this.createColumnCB.setSelected(true); + this.createColumnCB.setOnMouseEntered(event -> T3.fdssdf4354(B1.this.createColumnCB, C2.MouseSelectedColor)); + this.createColumnCB.setOnMouseExited(event -> B1.this.createColumnCB.setEffect(null)); + + this.columnPostfixTF = new TextField(columnPostfix); + this.columnPostfixTF.setOnMouseEntered(event -> T3.fdssdf4354(B1.this.columnPostfixTF, C2.MouseSelectedColor)); + this.columnPostfixTF.setOnMouseExited(event -> B1.this.columnPostfixTF.setEffect(null)); + + this.columnNameTF = new TextField(columnName); + this.columnNameTF.setOnMouseEntered(event -> T3.fdssdf4354(B1.this.columnNameTF, C2.MouseSelectedColor)); + this.columnNameTF.setOnMouseExited(event -> B1.this.columnNameTF.setEffect(null)); + + this.relationNameTF = new TextField(relationName); + this.relationNameTF.setOnMouseEntered(event -> T3.fdssdf4354(B1.this.relationNameTF, C2.MouseSelectedColor)); + this.relationNameTF.setOnMouseExited(event -> B1.this.relationNameTF.setEffect(null)); + + this.relationNamePraefixTF = new TextField(relationNamePraefix); + this.relationNamePraefixTF.setOnMouseEntered(event -> T3.fdssdf4354(B1.this.relationNamePraefixTF, C2.MouseSelectedColor)); + this.relationNamePraefixTF.setOnMouseExited(event -> B1.this.relationNamePraefixTF.setEffect(null)); + + this.datatypeTF = new TextField(datatype); + this.datatypeTF.setOnMouseEntered(event -> T3.fdssdf4354(B1.this.datatypeTF, C2.MouseSelectedColor)); + this.datatypeTF.setOnMouseExited(event -> B1.this.datatypeTF.setEffect(null)); + + this.isAutoincrementCB = new CheckBox(); + this.isAutoincrementCB.setSelected(false); + if (isAutoincrement) this.isAutoincrementCB.setSelected(true); + this.isAutoincrementCB.setOnMouseEntered(event -> T3.fdssdf4354(B1.this.isAutoincrementCB, C2.MouseSelectedColor)); + this.isAutoincrementCB.setOnMouseExited(event -> B1.this.isAutoincrementCB.setEffect(null)); + + this.isKeyCB = new CheckBox(); + this.isKeyCB.setSelected(false); + if (isKey) this.isKeyCB.setSelected(true); + this.isKeyCB.setOnMouseEntered(event -> T3.fdssdf4354(B1.this.isKeyCB, C2.MouseSelectedColor)); + this.isKeyCB.setOnMouseExited(event -> B1.this.isKeyCB.setEffect(null)); + + this.isNullableCB = new CheckBox(); + this.isNullableCB.setSelected(false); + if (isNullable) this.isNullableCB.setSelected(true); + this.isNullableCB.setOnMouseEntered(event -> T3.fdssdf4354(B1.this.isNullableCB, C2.MouseSelectedColor)); + this.isNullableCB.setOnMouseExited(event -> B1.this.isNullableCB.setEffect(null)); + + this.isUniqueCB = new CheckBox(); + this.isUniqueCB.setSelected(false); + if (isUnique) this.isUniqueCB.setSelected(true); + this.isUniqueCB.setOnMouseEntered(event -> T3.fdssdf4354(B1.this.isUniqueCB, C2.MouseSelectedColor)); + this.isUniqueCB.setOnMouseExited(event -> B1.this.isUniqueCB.setEffect(null)); + + this.okBTN = new Button("Ok"); + this.okBTN.setBackground(new Background(new BackgroundFill(C2.ButtonBackgroundColor, new CornerRadii(5.0D), Insets.EMPTY))); + this.okBTN.setOnMouseEntered(event -> { + B1.this.getScene().getRoot().setCursor(Cursor.HAND); + T3.fdssdf4354(B1.this.okBTN, C2.MouseSelectedColor); + }); + this.okBTN.setOnMouseExited(event -> { + B1.this.getScene().getRoot().setCursor(Cursor.DEFAULT); + B1.this.okBTN.setEffect(null); + if (B1.this.okBTN.isFocused()) T3.fdssdf4354(B1.this.okBTN, C2.FocusOnComponentColor); + }); + this.okBTN.focusedProperty().addListener((obs, oldVal, newVal) -> { + if (this.okBTN.isFocused()) { + T3.fdssdf4354(this.okBTN, C2.FocusOnComponentColor); + + this.columnPostfixTF.setEffect(null); + + this.cancelBTN.setEffect(null); + } else { + this.okBTN.setEffect(null); + } + }); + this.okBTN.setOnAction(event -> { + if (!canvas.getTabWithCanvas().getText().contains("*")) + canvas.getTabWithCanvas().setText(canvas.getTabWithCanvas().getText() + "*"); + + B1.this.setDataAndLeave(); + }); + this.okBTN.setOnKeyPressed(event -> { + if (Objects.requireNonNull(event.getCode()) == KeyCode.ENTER) { + B1.this.setDataAndLeave(); + + if (!canvas.getTabWithCanvas().getText().contains("*")) + canvas.getTabWithCanvas().setText(canvas.getTabWithCanvas().getText() + "*"); + } + + + }); + this.cancelBTN = new Button("Cancel"); + this.cancelBTN.setBackground(new Background(new BackgroundFill(C2.ButtonBackgroundColor, new CornerRadii(5.0D), Insets.EMPTY))); + this.cancelBTN.setOnMouseEntered(event -> { + B1.this.getScene().getRoot().setCursor(Cursor.HAND); + T3.fdssdf4354(B1.this.cancelBTN, C2.MouseSelectedColor); + }); + this.cancelBTN.setOnMouseExited(event -> { + B1.this.getScene().getRoot().setCursor(Cursor.DEFAULT); + B1.this.cancelBTN.setEffect(null); + if (B1.this.cancelBTN.isFocused()) T3.fdssdf4354(B1.this.cancelBTN, C2.FocusOnComponentColor); + + }); + this.cancelBTN.focusedProperty().addListener((obs, oldVal, newVal) -> { + if (this.cancelBTN.isFocused()) { + T3.fdssdf4354(this.cancelBTN, C2.FocusOnComponentColor); + + this.columnPostfixTF.setEffect(null); + this.okBTN.setEffect(null); + } else { + this.cancelBTN.setEffect(null); + } + }); + this.cancelBTN.setOnAction(event -> B1.this.setNothingAndLeave()); + this.cancelBTN.setOnKeyPressed(event -> { + if (Objects.requireNonNull(event.getCode()) == KeyCode.ENTER) { + B1.this.setNothingAndLeave(); + } + + + }); + if (isKey) { + this.isKeyCB.setDisable(true); + this.isUniqueCB.setDisable(true); + this.createColumnCB.setDisable(true); + this.isNullableCB.setDisable(true); + } else { + + this.isKeyCB.setDisable(true); + } + + + GridPane gridPane = new GridPane(); + gridPane.setPadding(new Insets(10.0D, 10.0D, 10.0D, 10.0D)); + gridPane.setVgap(4.0D); + gridPane.setHgap(4.0D); + + gridPane.add(new Label("Name:"), 0, 0); + gridPane.add(this.nameTF, 1, 0); + gridPane.add(new Label("Create column:"), 0, 1); + gridPane.add(this.createColumnCB, 1, 1); + gridPane.add(new Label("Column name:"), 0, 2); + gridPane.add(this.columnNameTF, 1, 2); + gridPane.add(new Label("Relation name:"), 0, 3); + gridPane.add(this.relationNameTF, 1, 3); + gridPane.add(new Label("Relation name praefix:"), 0, 4); + gridPane.add(this.relationNamePraefixTF, 1, 4); + gridPane.add(new Label("Column postfix:"), 0, 5); + gridPane.add(this.columnPostfixTF, 1, 5); + gridPane.add(new Label("Column datatype:"), 0, 6); + gridPane.add(this.datatypeTF, 1, 6); + gridPane.add(new Label("Key:"), 0, 7); + gridPane.add(this.isKeyCB, 1, 7); + gridPane.add(new Label("Autoincrement:"), 0, 8); + gridPane.add(this.isAutoincrementCB, 1, 8); + gridPane.add(new Label("Nullable:"), 0, 9); + gridPane.add(this.isNullableCB, 1, 9); + gridPane.add(new Label("Unique:"), 0, 10); + gridPane.add(this.isUniqueCB, 1, 10); + + + FlowPane fp = new FlowPane(); + fp.setHgap(10.0D); + fp.getChildren().addAll(this.okBTN, this.cancelBTN); + gridPane.add(fp, 0, 11, 2, 1); + + + Scene scene = new Scene(gridPane, 300.0D, 325.0D); + setScene(scene); + + setX(xPos); + setY(yPos); + if (yPos + scene.getHeight() > canvas.getView().getHeight() - 5.0D) { + setY(yPos - scene.getHeight() - 20.0D); + } + if (xPos + scene.getWidth() > canvas.getView().getWidth() - 5.0D) { + setX(xPos - scene.getWidth() - 20.0D); + } + + this.columnNameTF.requestFocus(); + + + sizeToScene(); + + showAndWait(); + } + + + private void setDataAndLeave() { + if (this.nameTF.getText() == null || this.nameTF.getText().length() == 0) + return; + this.thisActionMessageDialog.close(); + } + + + private void setNothingAndLeave() { + this.nameTF.setText(this.holdName); + this.thisActionMessageDialog.close(); + } + + + public CheckBox getCreateColumnCB() { + return this.createColumnCB; + } + + + public TextField getColumnNameTF() { + return this.columnNameTF; + } + + + public TextField getColumnPostfixTF() { + return this.columnPostfixTF; + } + + + public TextField getDatatypeTF() { + return this.datatypeTF; + } + + + public CheckBox getIsAutoincrementCB() { + return this.isAutoincrementCB; + } + + + public CheckBox getIsKeyCB() { + return this.isKeyCB; + } + + + public CheckBox getIsNullableCB() { + return this.isNullableCB; + } + + + public CheckBox getIsUniqueCB() { + return this.isUniqueCB; + } + + + public TextField getRelationNameTF() { + return this.relationNameTF; + } + + + public TextField getRelationNamePraefixTF() { + return this.relationNamePraefixTF; + } +} diff --git a/at/fos/ermodel/gui/B3.java b/at/fos/ermodel/gui/B3.java index 474064a..6d4e442 100644 --- a/at/fos/ermodel/gui/B3.java +++ b/at/fos/ermodel/gui/B3.java @@ -42,1459 +42,1325 @@ import java.util.ArrayList; import java.util.Objects; public class B3 - extends Stage -{ - B3 thisERMViewFX; - BorderPane borderPane; - public final TabPane tabPane; - public final TabPane infoTabPane; - public final CheckBox showAttributeCB; - public final ToggleButton treeOpenBTN; - public final FlowPane fptree; - public final Label creationModelabel; - public final ToggleGroup creation_selection_group; - public final RadioButton selectModeBTN; - public final GridPane buttonPane; - public final RadioButton textElemBTN; - public final RadioButton textWithoutBorderElemBTN; - public final RadioButton esBTN; - public final RadioButton esWeakBTN; - public final RadioButton esAssociativeBTN; - public final RadioButton rsBTN; - public final RadioButton rsIDBTN; - public final RadioButton rsISABTN; - public final RadioButton attrOneBTN; - public final RadioButton attrDerivedOneBTN; - public final RadioButton attrMultiBTN; - public final RadioButton attrDerivedMultiBTN; - public final RadioButton attrKeyBTN; - public final RadioButton attrWeakKeyBTN; - public final RadioButton attrToAttrBTN; - public final RadioButton attrToESBTN; - public final RadioButton attrToRSBTN; - public final RadioButton rsToESBTN; - public final RadioButton rsidToESWeakBTN; - public final RadioButton rsidToESBTN; - public final RadioButton rsisaGeToESBTN; - public final RadioButton rsisaSpToESBTN; - public RadioButton lastCreationSelected; - public final ToggleGroup sqlStyleGroup; - public final RadioButton mySqlStyle; - public final RadioButton msSqlStyle; - public final CheckBox generateRelationalModelCB; - public final Button saveSQLScriptBTN; - public final CheckBox generateInsertsCB; - public final CheckBox singleInsertStatementCB; - public final CheckBox addCurrentDateToDatabaseNameCB; - public BorderPane treeBorderPane; - public TreeItem rootTableNode; - public TreeView treeTableView; - public TreeItem rootColumnNode; - public TreeView treeColumnView; - public VBox verticalBox; - public ListView graphicElemLV; - public final TextField statusInformation; - public final MenuItem menuCutMI; - public final MenuItem menuCopyMI; - public final MenuItem menuPasteMI; - public final MenuItem menuUndoMI; - public final MenuItem menuSelectAllMI; - public final MenuItem menuReadMI; - public final MenuItem menuSaveMI; - public final MenuItem menuSaveAsMI; - public final MenuItem menuExportMI; - public final MenuItem menuExitMI; - public final MenuItem menuNewMI; - public final MenuItem menuRedrawMI; - public final MenuItem menuVersionMI; - public final MenuItem menuDownloadMI; - public final Menu menuVisibility; - public final RadioMenuItem menuVisibilityAllRMI; - public final RadioMenuItem menuVisibilityES_RSRMI; - public final RadioMenuItem menuVisibilityES_RS_KEYRMI; - public final RadioMenuItem menuVisibilityTEXTRMI; - public final MenuItem mergeModelsMI; - public final A2 controller; - public final C2 properties; - private U1 currentTab; - private ArrayList toCopyElements; - private V1 progress; + extends Stage { + public final TabPane tabPane; + public final TabPane infoTabPane; + public final CheckBox showAttributeCB; + public final ToggleButton treeOpenBTN; + public final FlowPane fptree; + public final Label creationModelabel; + public final ToggleGroup creation_selection_group; + public final RadioButton selectModeBTN; + public final GridPane buttonPane; + public final RadioButton textElemBTN; + public final RadioButton textWithoutBorderElemBTN; + public final RadioButton esBTN; + public final RadioButton esWeakBTN; + public final RadioButton esAssociativeBTN; + public final RadioButton rsBTN; + public final RadioButton rsIDBTN; + public final RadioButton rsISABTN; + public final RadioButton attrOneBTN; + public final RadioButton attrDerivedOneBTN; + public final RadioButton attrMultiBTN; + public final RadioButton attrDerivedMultiBTN; + public final RadioButton attrKeyBTN; + public final RadioButton attrWeakKeyBTN; + public final RadioButton attrToAttrBTN; + public final RadioButton attrToESBTN; + public final RadioButton attrToRSBTN; + public final RadioButton rsToESBTN; + public final RadioButton rsidToESWeakBTN; + public final RadioButton rsidToESBTN; + public final RadioButton rsisaGeToESBTN; + public final RadioButton rsisaSpToESBTN; + public final ToggleGroup sqlStyleGroup; + public final RadioButton mySqlStyle; + public final RadioButton msSqlStyle; + public final CheckBox generateRelationalModelCB; + public final Button saveSQLScriptBTN; + public final CheckBox generateInsertsCB; + public final CheckBox singleInsertStatementCB; + public final CheckBox addCurrentDateToDatabaseNameCB; + public final TextField statusInformation; + public final MenuItem menuCutMI; + public final MenuItem menuCopyMI; + public final MenuItem menuPasteMI; + public final MenuItem menuUndoMI; + public final MenuItem menuSelectAllMI; + public final MenuItem menuReadMI; + public final MenuItem menuSaveMI; + public final MenuItem menuSaveAsMI; + public final MenuItem menuExportMI; + public final MenuItem menuExitMI; + public final MenuItem menuNewMI; + public final MenuItem menuRedrawMI; + public final MenuItem menuVersionMI; + public final MenuItem menuDownloadMI; + public final Menu menuVisibility; + public final RadioMenuItem menuVisibilityAllRMI; + public final RadioMenuItem menuVisibilityES_RSRMI; + public final RadioMenuItem menuVisibilityES_RS_KEYRMI; + public final RadioMenuItem menuVisibilityTEXTRMI; + public final MenuItem mergeModelsMI; + public final A2 controller; + public final C2 properties; + public RadioButton lastCreationSelected; + public BorderPane treeBorderPane; + public TreeItem rootTableNode; + public TreeView treeTableView; + public TreeItem rootColumnNode; + public TreeView treeColumnView; + public VBox verticalBox; + public ListView graphicElemLV; + B3 thisERMViewFX; + BorderPane borderPane; + private U1 currentTab; + private ArrayList toCopyElements; + private V1 progress; public B3() { - this.thisERMViewFX = this; - - - this.properties = new C2(); - - this.treeBorderPane = new BorderPane(); - - treeBorderPane.setBackground(C2.AppBackground); + this.thisERMViewFX = this; - - this.verticalBox = new VBox(); + this.properties = new C2(); - verticalBox.setBackground(C2.AppBackground); + this.treeBorderPane = new BorderPane(); + + treeBorderPane.setBackground(C2.AppBackground); + this.verticalBox = new VBox(); - - this.controller = new A2(this); + verticalBox.setBackground(C2.AppBackground); - - this.tabPane = new TabPane(); - - tabPane.setBackground(C2.AppBackground); - - this.tabPane.setSide(Side.TOP); - this.tabPane.setTabClosingPolicy(TabPane.TabClosingPolicy.SELECTED_TAB); - - - this.infoTabPane = new TabPane(); - - infoTabPane.setBackground(C2.AppBackground); - - this.infoTabPane.setSide(Side.TOP); - this.infoTabPane.setTabClosingPolicy(TabPane.TabClosingPolicy.UNAVAILABLE); - - - this.showAttributeCB = new CheckBox("Check data generation"); - this.showAttributeCB.setTooltip(new Tooltip("Check data generation")); - this.showAttributeCB.setPrefWidth(40.0D); - this.showAttributeCB.setMinWidth(40.0D); - this.showAttributeCB.setOnAction(new EventHandler<>() { - public void handle(ActionEvent event) { - if (B3.this.showAttributeCB.isSelected()) { - if (!B3.this.selectModeBTN.isSelected()) { - B3.this.showAttributeCB.setSelected(false); - return; - } - B3.this.currentTab.canvas.sortGraphicElementsByName(); - B3.this.graphicElemLV.getItems().clear(); - B3.this.graphicElemLV.getItems().addAll(B3.this.currentTab.canvas.getAttributeElements()); - } else { - B3.this.graphicElemLV.getItems().clear(); - B3.this.graphicElemLV.getItems().addAll(B3.this.currentTab.canvas.sddsfsfsdf45645645()); - } - } - }); + this.controller = new A2(this); - - this.infoTabPane.setOnMouseClicked(arg0 -> B3.this.showAttributeCB.setDisable(B3.this.infoTabPane.getSelectionModel().getSelectedIndex() != 0)); + this.tabPane = new TabPane(); - - this.tabPane.getSelectionModel().selectedItemProperty().addListener( - new ChangeListener<>() { + tabPane.setBackground(C2.AppBackground); - public void changed(ObservableValue ov, Tab t, Tab t1) { - B3.this.currentTab = (U1) B3.this.tabPane.getSelectionModel().getSelectedItem(); - - if (B3.this.currentTab != null && B3.this.currentTab.canvas != null) { - B3.this.graphicElemLV.getItems().clear(); - - if (B3.this.showAttributeCB.isSelected()) { - B3.this.graphicElemLV.getItems().addAll(B3.this.currentTab.canvas.getAttributeElements()); - } else { - B3.this.graphicElemLV.getItems().addAll(B3.this.currentTab.canvas.sddsfsfsdf45645645()); - } - if (B3.this.generateRelationalModelCB.isSelected()) { - B3.this.currentTab.canvas.dsfdsdfssdf45645re(); - } - B3.this.currentTab.canvas.modelVisibility(); - B3.this.currentTab.canvas.sdfsdfds3465er(true); - } else { - - B3.this.verticalBox.getChildren().clear(); - B3.this.graphicElemLV.getItems().clear(); - } - } - }); + this.tabPane.setSide(Side.TOP); + this.tabPane.setTabClosingPolicy(TabPane.TabClosingPolicy.SELECTED_TAB); - - VBox vBox = new VBox(); - - this.creation_selection_group = new ToggleGroup(); + this.infoTabPane = new TabPane(); - - this.buttonPane = new GridPane(); - this.buttonPane.setPadding(new Insets(5.0D, 5.0D, 5.0D, 5.0D)); - this.buttonPane.setVgap(5.0D); - this.buttonPane.setHgap(5.0D); - buttonPane.setBackground(new Background(new BackgroundFill(C2.ERMForegroundColor, CornerRadii.EMPTY, Insets.EMPTY))); + infoTabPane.setBackground(C2.AppBackground); - - ImageView imageView = new ImageView(C2.treeOpenImage); - imageView.setFitHeight(10.0D); - imageView.setFitWidth(8.0D); - this.treeOpenBTN = new ToggleButton(); - this.treeOpenBTN.setTooltip(new Tooltip("Click to expand info area")); - this.treeOpenBTN.setOnMouseEntered(event -> { - B3.this.getScene().getRoot().setCursor(Cursor.HAND); - T3.asdasda345435ertretr(B3.this.treeOpenBTN.getGraphic(), 1.3D, 1.3D, 0.3D, 0.2D, 0.4D, -0.2D); - }); - this.treeOpenBTN.setOnMouseExited(event -> { - B3.this.getScene().getRoot().setCursor(Cursor.DEFAULT); - T3.buttonMouseExited(B3.this.treeOpenBTN.getGraphic()); - }); - this.treeOpenBTN.setOnAction(new EventHandler<>() { - public void handle(ActionEvent event) { - if (B3.this.treeOpenBTN.isSelected()) { - ImageView imageView = new ImageView(C2.treeCloseImage); - imageView.setFitHeight(10.0D); - imageView.setFitWidth(8.0D); - B3.this.treeOpenBTN.setGraphic(imageView); - B3.this.treeBorderPane.setPrefWidth(200.0D); - B3.this.showAttributeCB.setVisible(true); - B3.this.fptree.setPrefWidth(50.0D); - B3.this.showAttributeCB.setMinWidth(150.0D); - B3.this.showAttributeCB.setMaxWidth(150.0D); - B3.this.showAttributeCB.setPrefWidth(150.0D); - B3.this.treeOpenBTN.setTooltip(new Tooltip("Click to close")); - } else { - - ImageView imageView = new ImageView(C2.treeOpenImage); - imageView.setFitHeight(10.0D); - imageView.setFitWidth(8.0D); - B3.this.treeOpenBTN.setGraphic(imageView); - B3.this.treeBorderPane.setPrefWidth(8.0D); - B3.this.showAttributeCB.setVisible(false); - B3.this.showAttributeCB.setPrefWidth(0.0D); - B3.this.treeOpenBTN.setTooltip(new Tooltip("Click to expand")); - } - } - }); + this.infoTabPane.setSide(Side.TOP); + this.infoTabPane.setTabClosingPolicy(TabPane.TabClosingPolicy.UNAVAILABLE); - - this.treeOpenBTN.setBackground(new Background(new BackgroundFill(Color.LIGHTGRAY, CornerRadii.EMPTY, Insets.EMPTY))); - - - this.treeOpenBTN.setGraphic(imageView); - this.treeBorderPane.setBackground(new Background(new BackgroundFill(Color.LIGHTGRAY, CornerRadii.EMPTY, Insets.EMPTY))); - this.treeBorderPane.setPrefWidth(10.0D); - - - this.fptree = new FlowPane(); - this.fptree.getChildren().add(this.treeOpenBTN); - this.fptree.getChildren().add(this.showAttributeCB); - this.showAttributeCB.setPrefWidth(0.0D); - this.showAttributeCB.setVisible(false); - this.treeBorderPane.setTop(this.fptree); - - - - this.graphicElemLV = new ListView<>(); - graphicElemLV.setBackground(C2.AppBackground); - this.graphicElemLV.setPrefHeight(300.0D); - this.graphicElemLV.setTooltip(new Tooltip("To delete an element press DEL-Key")); - this.graphicElemLV.setCellFactory(p -> new ListCell<>() { - protected void updateItem(Graphic_Main_Elem item, boolean empty) { - super.updateItem(item, empty); - if (!empty && item != null) { + this.showAttributeCB = new CheckBox("Check data generation"); + this.showAttributeCB.setTooltip(new Tooltip("Check data generation")); + this.showAttributeCB.setPrefWidth(40.0D); + this.showAttributeCB.setMinWidth(40.0D); + this.showAttributeCB.setOnAction(new EventHandler<>() { + public void handle(ActionEvent event) { if (B3.this.showAttributeCB.isSelected()) { + if (!B3.this.selectModeBTN.isSelected()) { + B3.this.showAttributeCB.setSelected(false); + return; + } + B3.this.currentTab.canvas.sortGraphicElementsByName(); + B3.this.graphicElemLV.getItems().clear(); + B3.this.graphicElemLV.getItems().addAll(B3.this.currentTab.canvas.getAttributeElements()); + } else { + B3.this.graphicElemLV.getItems().clear(); + B3.this.graphicElemLV.getItems().addAll(B3.this.currentTab.canvas.sddsfsfsdf45645645()); + } + } + }); - setStyle("-fx-text-fill: red;"); - String doneString = ""; - if (item instanceof Graphic_RS_ISA_Elem || - item instanceof Graphic_ES_Weak_Elem) { - doneString = "... ok"; - setStyle("-fx-text-fill: green;"); - } else { - if (item instanceof Graphic_ATTR_Elem) { - if (((Graphic_ATTR_Elem) item).dataGenerationType == null) - ((Graphic_ATTR_Elem) item).dataGenerationType = "No"; - if (!((Graphic_ATTR_Elem) item).dataGenerationType.equals("No")) { - doneString = "... ok"; - setStyle("-fx-text-fill: green;"); + this.infoTabPane.setOnMouseClicked(arg0 -> B3.this.showAttributeCB.setDisable(B3.this.infoTabPane.getSelectionModel().getSelectedIndex() != 0)); + + + this.tabPane.getSelectionModel().selectedItemProperty().addListener( + new ChangeListener<>() { + + public void changed(ObservableValue ov, Tab t, Tab t1) { + B3.this.currentTab = (U1) B3.this.tabPane.getSelectionModel().getSelectedItem(); + + if (B3.this.currentTab != null && B3.this.currentTab.canvas != null) { + B3.this.graphicElemLV.getItems().clear(); + + if (B3.this.showAttributeCB.isSelected()) { + B3.this.graphicElemLV.getItems().addAll(B3.this.currentTab.canvas.getAttributeElements()); + } else { + B3.this.graphicElemLV.getItems().addAll(B3.this.currentTab.canvas.sddsfsfsdf45645645()); } - if (!((Graphic_ATTR_Elem) item).createColumn || ((Graphic_ATTR_Elem) item).isAutoincrement) { - doneString = "... ok"; - setStyle("-fx-text-fill: green;"); + if (B3.this.generateRelationalModelCB.isSelected()) { + B3.this.currentTab.canvas.dsfdsdfssdf45645re(); } + B3.this.currentTab.canvas.modelVisibility(); + B3.this.currentTab.canvas.sdfsdfds3465er(true); + } else { - if (((Graphic_ATTR_Elem) item).isNullable) { - doneString = "... ok"; - setStyle("-fx-text-fill: green;"); - } - } - - if (item instanceof Graphic_ES_Main_Elem && - ((Graphic_ES_Main_Elem) item).createInserts && ((Graphic_ES_Main_Elem) item).numberRowsToInsert > 0L) { - doneString = "... ok"; - setStyle("-fx-text-fill: green;"); - } - - if (item instanceof Graphic_RS_Main_Elem && - ((Graphic_RS_Main_Elem) item).createInserts && ((Graphic_RS_Main_Elem) item).numberRowsToInsert > 0L) { - doneString = "... ok"; - setStyle("-fx-text-fill: green;"); + B3.this.verticalBox.getChildren().clear(); + B3.this.graphicElemLV.getItems().clear(); } } + }); - setText(item.sdfsdfsd32234243() + " " + doneString); - return; + + VBox vBox = new VBox(); + + this.creation_selection_group = new ToggleGroup(); + + + this.buttonPane = new GridPane(); + this.buttonPane.setPadding(new Insets(5.0D, 5.0D, 5.0D, 5.0D)); + this.buttonPane.setVgap(5.0D); + this.buttonPane.setHgap(5.0D); + buttonPane.setBackground(new Background(new BackgroundFill(C2.ERMForegroundColor, CornerRadii.EMPTY, Insets.EMPTY))); + + + ImageView imageView = new ImageView(C2.treeOpenImage); + imageView.setFitHeight(10.0D); + imageView.setFitWidth(8.0D); + this.treeOpenBTN = new ToggleButton(); + this.treeOpenBTN.setTooltip(new Tooltip("Click to expand info area")); + this.treeOpenBTN.setOnMouseEntered(event -> { + B3.this.getScene().getRoot().setCursor(Cursor.HAND); + T3.asdasda345435ertretr(B3.this.treeOpenBTN.getGraphic(), 1.3D, 1.3D, 0.3D, 0.2D, 0.4D, -0.2D); + }); + this.treeOpenBTN.setOnMouseExited(event -> { + B3.this.getScene().getRoot().setCursor(Cursor.DEFAULT); + T3.buttonMouseExited(B3.this.treeOpenBTN.getGraphic()); + }); + this.treeOpenBTN.setOnAction(new EventHandler<>() { + public void handle(ActionEvent event) { + if (B3.this.treeOpenBTN.isSelected()) { + ImageView imageView = new ImageView(C2.treeCloseImage); + imageView.setFitHeight(10.0D); + imageView.setFitWidth(8.0D); + B3.this.treeOpenBTN.setGraphic(imageView); + B3.this.treeBorderPane.setPrefWidth(200.0D); + B3.this.showAttributeCB.setVisible(true); + B3.this.fptree.setPrefWidth(50.0D); + B3.this.showAttributeCB.setMinWidth(150.0D); + B3.this.showAttributeCB.setMaxWidth(150.0D); + B3.this.showAttributeCB.setPrefWidth(150.0D); + B3.this.treeOpenBTN.setTooltip(new Tooltip("Click to close")); + } else { + + ImageView imageView = new ImageView(C2.treeOpenImage); + imageView.setFitHeight(10.0D); + imageView.setFitWidth(8.0D); + B3.this.treeOpenBTN.setGraphic(imageView); + B3.this.treeBorderPane.setPrefWidth(8.0D); + B3.this.showAttributeCB.setVisible(false); + B3.this.showAttributeCB.setPrefWidth(0.0D); + B3.this.treeOpenBTN.setTooltip(new Tooltip("Click to expand")); } - setText("[" + item.sdfsdfsdfd() + "]" + item.sdfsdfsd32234243()); + } + }); - if (!isSelected()) { + this.treeOpenBTN.setBackground(new Background(new BackgroundFill(Color.LIGHTGRAY, CornerRadii.EMPTY, Insets.EMPTY))); + + this.treeOpenBTN.setGraphic(imageView); + this.treeBorderPane.setBackground(new Background(new BackgroundFill(Color.LIGHTGRAY, CornerRadii.EMPTY, Insets.EMPTY))); + this.treeBorderPane.setPrefWidth(10.0D); + + + this.fptree = new FlowPane(); + this.fptree.getChildren().add(this.treeOpenBTN); + this.fptree.getChildren().add(this.showAttributeCB); + this.showAttributeCB.setPrefWidth(0.0D); + this.showAttributeCB.setVisible(false); + this.treeBorderPane.setTop(this.fptree); + + + this.graphicElemLV = new ListView<>(); + graphicElemLV.setBackground(C2.AppBackground); + this.graphicElemLV.setPrefHeight(300.0D); + this.graphicElemLV.setTooltip(new Tooltip("To delete an element press DEL-Key")); + this.graphicElemLV.setCellFactory(p -> new ListCell<>() { + protected void updateItem(Graphic_Main_Elem item, boolean empty) { + super.updateItem(item, empty); + if (!empty && item != null) { + if (B3.this.showAttributeCB.isSelected()) { + + setStyle("-fx-text-fill: red;"); + String doneString = ""; + if (item instanceof Graphic_RS_ISA_Elem || + item instanceof Graphic_ES_Weak_Elem) { + doneString = "... ok"; + setStyle("-fx-text-fill: green;"); + } else { + + if (item instanceof Graphic_ATTR_Elem) { + if (((Graphic_ATTR_Elem) item).dataGenerationType == null) + ((Graphic_ATTR_Elem) item).dataGenerationType = "No"; + if (!((Graphic_ATTR_Elem) item).dataGenerationType.equals("No")) { + doneString = "... ok"; + setStyle("-fx-text-fill: green;"); + } + if (!((Graphic_ATTR_Elem) item).createColumn || ((Graphic_ATTR_Elem) item).isAutoincrement) { + doneString = "... ok"; + setStyle("-fx-text-fill: green;"); + } + + if (((Graphic_ATTR_Elem) item).isNullable) { + doneString = "... ok"; + setStyle("-fx-text-fill: green;"); + } + } + + if (item instanceof Graphic_ES_Main_Elem && + ((Graphic_ES_Main_Elem) item).createInserts && ((Graphic_ES_Main_Elem) item).numberRowsToInsert > 0L) { + doneString = "... ok"; + setStyle("-fx-text-fill: green;"); + } + + if (item instanceof Graphic_RS_Main_Elem && + ((Graphic_RS_Main_Elem) item).createInserts && ((Graphic_RS_Main_Elem) item).numberRowsToInsert > 0L) { + doneString = "... ok"; + setStyle("-fx-text-fill: green;"); + } + } + + setText(item.sdfsdfsd32234243() + " " + doneString); + return; + } + setText("[" + item.sdfsdfsdfd() + "]" + item.sdfsdfsd32234243()); + + + if (!isSelected()) { + + setStyle(null); + } + } else { + setText(null); setStyle(null); } - } else { - setText(null); - setStyle(null); } - } - }); - - this.graphicElemLV.setOnMouseClicked(event -> { - Graphic_Main_Elem selectedItem = B3.this.graphicElemLV.getSelectionModel().getSelectedItem(); - if (selectedItem != null) { - B3.this.currentTab.canvas.sdfsdfds3465er(true); - B3.this.currentTab.canvas.dsfdsfsdf43543refds(selectedItem.graphicMainElemID); - } - }); + }); - - this.graphicElemLV.setOnKeyPressed(new EventHandler<>() { - public void handle(KeyEvent event) { - Graphic_Main_Elem selectedItem; - if (Objects.requireNonNull(event.getCode()) == KeyCode.DELETE) { - if (!B3.this.selectModeBTN.isSelected()) { - return; - } + this.graphicElemLV.setOnMouseClicked(event -> { + Graphic_Main_Elem selectedItem = B3.this.graphicElemLV.getSelectionModel().getSelectedItem(); + if (selectedItem != null) { + B3.this.currentTab.canvas.sdfsdfds3465er(true); + B3.this.currentTab.canvas.dsfdsfsdf43543refds(selectedItem.graphicMainElemID); + } + }); - selectedItem = B3.this.graphicElemLV.getSelectionModel().getSelectedItem(); - if (selectedItem != null) { - B3.this.graphicElemLV.getItems().remove(selectedItem); - selectedItem.dsfsdfsfd(); - - if (selectedItem instanceof Graphic_Figure_Elem) { - ArrayList linesAsEnd = B3.this.currentTab.canvas.sdfsdfds23432rwefsd(selectedItem); - ArrayList linesAsStart = B3.this.currentTab.canvas.dsfdsfdsjhkj456456(selectedItem); - - for (Graphic_LINE_Elem gle : linesAsEnd) { - gle.dsfsdfsfd(); - B3.this.currentTab.canvas.fsdfdsfds1231278().remove(gle); - } - for (Graphic_LINE_Elem gle : linesAsStart) { - gle.dsfsdfsfd(); - B3.this.currentTab.canvas.fsdfdsfds1231278().remove(gle); - } + this.graphicElemLV.setOnKeyPressed(new EventHandler<>() { + public void handle(KeyEvent event) { + Graphic_Main_Elem selectedItem; + if (Objects.requireNonNull(event.getCode()) == KeyCode.DELETE) { + if (!B3.this.selectModeBTN.isSelected()) { + return; } - B3.this.currentTab.canvas.fsdfdsfds1231278().remove(selectedItem); + + selectedItem = B3.this.graphicElemLV.getSelectionModel().getSelectedItem(); + if (selectedItem != null) { + B3.this.graphicElemLV.getItems().remove(selectedItem); + selectedItem.dsfsdfsfd(); + + if (selectedItem instanceof Graphic_Figure_Elem) { + ArrayList linesAsEnd = B3.this.currentTab.canvas.sdfsdfds23432rwefsd(selectedItem); + ArrayList linesAsStart = B3.this.currentTab.canvas.dsfdsfdsjhkj456456(selectedItem); + + for (Graphic_LINE_Elem gle : linesAsEnd) { + gle.dsfsdfsfd(); + B3.this.currentTab.canvas.fsdfdsfds1231278().remove(gle); + } + for (Graphic_LINE_Elem gle : linesAsStart) { + gle.dsfsdfsfd(); + B3.this.currentTab.canvas.fsdfdsfds1231278().remove(gle); + } + } + + B3.this.currentTab.canvas.fsdfdsfds1231278().remove(selectedItem); + } + } + + + } + }); + this.graphicElemLV.setOnKeyReleased(event -> { + Graphic_Main_Elem selectedItem = B3.this.graphicElemLV.getSelectionModel().getSelectedItem(); + if (selectedItem != null) { + B3.this.currentTab.canvas.sdfsdfds3465er(true); + B3.this.currentTab.canvas.dsfdsfsdf43543refds(selectedItem.graphicMainElemID); + } + }); + + + this.infoTabPane.getTabs().add(new Tab("Elem", this.graphicElemLV)); + this.infoTabPane.getTabs().add(new Tab("R-Model", this.verticalBox)); + + + this.treeBorderPane.setCenter(this.infoTabPane); + + + this.selectModeBTN = new RadioButton("Selection Mode"); + this.selectModeBTN.setFont(Font.font(null, FontWeight.BOLD, 11.0D)); + this.selectModeBTN.setStyle("-fx-text-fill:white"); + this.selectModeBTN.addEventHandler(ActionEvent.ACTION, this.controller); + this.selectModeBTN.setSelected(true); + this.selectModeBTN.setToggleGroup(this.creation_selection_group); + this.selectModeBTN.setTooltip(new Tooltip("Selection Mode - F1-Key Selection mode <-> Creation Mode")); + setMouseHandler(this.selectModeBTN); + + + imageView = new ImageView(C2.textImage); + imageView.setFitHeight(C2.imageHeight); + imageView.setFitWidth(C2.imageWidth); + this.textElemBTN = new RadioButton(); + this.textElemBTN.setPrefWidth(30.0D); + this.textElemBTN.setGraphic(imageView); + + this.textElemBTN.addEventHandler(ActionEvent.ACTION, this.controller); + this.textElemBTN.setSelected(false); + this.textElemBTN.setToggleGroup(this.creation_selection_group); + this.textElemBTN.setTooltip(new Tooltip("Text with border")); + setMouseHandler(this.textElemBTN); + + + imageView = new ImageView(C2.textWithoutBorderImage); + imageView.setFitHeight(C2.imageHeight); + imageView.setFitWidth(C2.imageWidth); + this.textWithoutBorderElemBTN = new RadioButton(); + this.textWithoutBorderElemBTN.setPrefWidth(30.0D); + this.textWithoutBorderElemBTN.setGraphic(imageView); + + this.textWithoutBorderElemBTN.addEventHandler(ActionEvent.ACTION, this.controller); + this.textWithoutBorderElemBTN.setSelected(false); + this.textWithoutBorderElemBTN.setToggleGroup(this.creation_selection_group); + this.textWithoutBorderElemBTN.setTooltip(new Tooltip("Text without border")); + setMouseHandler(this.textWithoutBorderElemBTN); + + + imageView = new ImageView(C2.esImage); + imageView.setFitHeight(C2.imageHeight); + imageView.setFitWidth(C2.imageWidth); + this.esBTN = new RadioButton(); + this.esBTN.setPrefWidth(30.0D); + this.esBTN.setGraphic(imageView); + setMouseHandler(this.esBTN); + + this.esBTN.addEventHandler(ActionEvent.ACTION, this.controller); + this.esBTN.setSelected(true); + this.lastCreationSelected = this.esBTN; + this.esBTN.setToggleGroup(this.creation_selection_group); + this.esBTN.setTooltip(new Tooltip("Entity set")); + + + imageView = new ImageView(C2.es_weakImage); + imageView.setFitHeight(C2.imageHeight); + imageView.setFitWidth(C2.imageWidth); + this.esWeakBTN = new RadioButton(); + this.esWeakBTN.setPrefWidth(30.0D); + this.esWeakBTN.setGraphic(imageView); + setMouseHandler(this.esWeakBTN); + + this.esWeakBTN.addEventHandler(ActionEvent.ACTION, this.controller); + this.esWeakBTN.setToggleGroup(this.creation_selection_group); + this.esWeakBTN.setTooltip(new Tooltip("Weak entity set")); + + + imageView = new ImageView(C2.es_associativeImage); + imageView.setFitHeight(C2.imageHeight); + imageView.setFitWidth(C2.imageWidth); + this.esAssociativeBTN = new RadioButton(); + this.esAssociativeBTN.setPrefWidth(30.0D); + this.esAssociativeBTN.setGraphic(imageView); + setMouseHandler(this.esAssociativeBTN); + + this.esAssociativeBTN.addEventHandler(ActionEvent.ACTION, this.controller); + this.esAssociativeBTN.setToggleGroup(this.creation_selection_group); + this.esAssociativeBTN.setTooltip(new Tooltip("Associative entity set")); + + + imageView = new ImageView(C2.rsImage); + imageView.setFitHeight(C2.imageHeight); + imageView.setFitWidth(C2.imageWidth); + this.rsBTN = new RadioButton(); + this.rsBTN.setPrefWidth(30.0D); + this.rsBTN.setGraphic(imageView); + setMouseHandler(this.rsBTN); + + this.rsBTN.addEventHandler(ActionEvent.ACTION, this.controller); + this.rsBTN.setToggleGroup(this.creation_selection_group); + this.rsBTN.setTooltip(new Tooltip("Relationship")); + + + imageView = new ImageView(C2.rs_idImage); + imageView.setFitHeight(C2.imageHeight); + imageView.setFitWidth(C2.imageWidth); + this.rsIDBTN = new RadioButton(); + this.rsIDBTN.setPrefWidth(30.0D); + this.rsIDBTN.setGraphic(imageView); + setMouseHandler(this.rsIDBTN); + + this.rsIDBTN.addEventHandler(ActionEvent.ACTION, this.controller); + this.rsIDBTN.setToggleGroup(this.creation_selection_group); + this.rsIDBTN.setTooltip(new Tooltip("Identifying-relationship: used together with a weak-entity-set")); + + + imageView = new ImageView(C2.rs_isaImage); + imageView.setFitHeight(C2.imageHeight); + imageView.setFitWidth(C2.imageWidth); + this.rsISABTN = new RadioButton(); + this.rsISABTN.setPrefWidth(30.0D); + this.rsISABTN.setGraphic(imageView); + setMouseHandler(this.rsISABTN); + + this.rsISABTN.addEventHandler(ActionEvent.ACTION, this.controller); + this.rsISABTN.setToggleGroup(this.creation_selection_group); + this.rsISABTN.setTooltip(new Tooltip("ISA relationship - generalization/specialization")); + + + imageView = new ImageView(C2.attr_one_valueImage); + imageView.setFitHeight(C2.imageHeight); + imageView.setFitWidth(C2.imageWidth); + this.attrOneBTN = new RadioButton(); + this.attrOneBTN.setPrefWidth(30.0D); + this.attrOneBTN.setGraphic(imageView); + setMouseHandler(this.attrOneBTN); + + this.attrOneBTN.addEventHandler(ActionEvent.ACTION, this.controller); + this.attrOneBTN.setToggleGroup(this.creation_selection_group); + this.attrOneBTN.setTooltip(new Tooltip("One value attribute")); + + + imageView = new ImageView(C2.attr_multi_valueImage); + imageView.setFitHeight(C2.imageHeight); + imageView.setFitWidth(C2.imageWidth); + this.attrMultiBTN = new RadioButton(); + this.attrMultiBTN.setPrefWidth(30.0D); + this.attrMultiBTN.setGraphic(imageView); + setMouseHandler(this.attrMultiBTN); + + this.attrMultiBTN.addEventHandler(ActionEvent.ACTION, this.controller); + this.attrMultiBTN.setToggleGroup(this.creation_selection_group); + this.attrMultiBTN.setTooltip(new Tooltip("Multivalue attribute")); + + + imageView = new ImageView(C2.attr_key_valueImage); + imageView.setFitHeight(C2.imageHeight); + imageView.setFitWidth(C2.imageWidth); + this.attrKeyBTN = new RadioButton(); + this.attrKeyBTN.setPrefWidth(30.0D); + this.attrKeyBTN.setGraphic(imageView); + setMouseHandler(this.attrKeyBTN); + + this.attrKeyBTN.addEventHandler(ActionEvent.ACTION, this.controller); + this.attrKeyBTN.setToggleGroup(this.creation_selection_group); + this.attrKeyBTN.setTooltip(new Tooltip("Primary key attribute")); + + + imageView = new ImageView(C2.attr_weak_key_valueImage); + imageView.setFitHeight(C2.imageHeight); + imageView.setFitWidth(C2.imageWidth); + this.attrWeakKeyBTN = new RadioButton(); + this.attrWeakKeyBTN.setPrefWidth(30.0D); + this.attrWeakKeyBTN.setGraphic(imageView); + setMouseHandler(this.attrWeakKeyBTN); + + this.attrWeakKeyBTN.addEventHandler(ActionEvent.ACTION, this.controller); + this.attrWeakKeyBTN.setToggleGroup(this.creation_selection_group); + this.attrWeakKeyBTN.setTooltip(new Tooltip("Weak key attribute")); + + + imageView = new ImageView(C2.attr_derived_one_valueImage); + imageView.setFitHeight(C2.imageHeight); + imageView.setFitWidth(C2.imageWidth); + this.attrDerivedOneBTN = new RadioButton(); + this.attrDerivedOneBTN.setPrefWidth(30.0D); + this.attrDerivedOneBTN.setGraphic(imageView); + setMouseHandler(this.attrDerivedOneBTN); + + this.attrDerivedOneBTN.addEventHandler(ActionEvent.ACTION, this.controller); + this.attrDerivedOneBTN.setToggleGroup(this.creation_selection_group); + this.attrDerivedOneBTN.setTooltip(new Tooltip("Derived one-value-attribute")); + + + imageView = new ImageView(C2.attr_derived_multi_valueImage); + imageView.setFitHeight(C2.imageHeight); + imageView.setFitWidth(C2.imageWidth); + this.attrDerivedMultiBTN = new RadioButton(); + this.attrDerivedMultiBTN.setPrefWidth(30.0D); + this.attrDerivedMultiBTN.setGraphic(imageView); + setMouseHandler(this.attrDerivedMultiBTN); + + this.attrDerivedMultiBTN.addEventHandler(ActionEvent.ACTION, this.controller); + this.attrDerivedMultiBTN.setToggleGroup(this.creation_selection_group); + this.attrDerivedMultiBTN.setTooltip(new Tooltip("Derived multi-value-attribute")); + + + imageView = new ImageView(C2.attr_conn_attrImage); + imageView.setFitHeight(C2.imageHeight); + imageView.setFitWidth(C2.imageWidth); + this.attrToAttrBTN = new RadioButton(); + this.attrToAttrBTN.setPrefWidth(30.0D); + this.attrToAttrBTN.setGraphic(imageView); + setMouseHandler(this.attrToAttrBTN); + + this.attrToAttrBTN.addEventHandler(ActionEvent.ACTION, this.controller); + this.attrToAttrBTN.setToggleGroup(this.creation_selection_group); + this.attrToAttrBTN.setTooltip(new Tooltip("Connect attribute with attribute (to create composite-attribute)")); + + + imageView = new ImageView(C2.attr_conn_esImage); + imageView.setFitHeight(C2.imageHeight); + imageView.setFitWidth(C2.imageWidth); + this.attrToESBTN = new RadioButton(); + this.attrToESBTN.setPrefWidth(30.0D); + this.attrToESBTN.setGraphic(imageView); + setMouseHandler(this.attrToESBTN); + + this.attrToESBTN.addEventHandler(ActionEvent.ACTION, this.controller); + this.attrToESBTN.setToggleGroup(this.creation_selection_group); + this.attrToESBTN.setTooltip(new Tooltip("Connect attribute with entity-set")); + + + imageView = new ImageView(C2.attr_conn_rsImage); + imageView.setFitHeight(C2.imageHeight); + imageView.setFitWidth(C2.imageWidth); + this.attrToRSBTN = new RadioButton(); + this.attrToRSBTN.setPrefWidth(30.0D); + this.attrToRSBTN.setGraphic(imageView); + setMouseHandler(this.attrToRSBTN); + + this.attrToRSBTN.addEventHandler(ActionEvent.ACTION, this.controller); + this.attrToRSBTN.setToggleGroup(this.creation_selection_group); + this.attrToRSBTN.setTooltip(new Tooltip("Connect attribute with relationship")); + + + imageView = new ImageView(C2.rs_conn_esImage); + imageView.setFitHeight(C2.imageHeight); + imageView.setFitWidth(C2.imageWidth); + this.rsToESBTN = new RadioButton(); + this.rsToESBTN.setPrefWidth(30.0D); + this.rsToESBTN.setGraphic(imageView); + setMouseHandler(this.rsToESBTN); + + this.rsToESBTN.addEventHandler(ActionEvent.ACTION, this.controller); + this.rsToESBTN.setToggleGroup(this.creation_selection_group); + this.rsToESBTN.setTooltip(new Tooltip("Connect entity-set with relationship")); + + + imageView = new ImageView(C2.rs_id_conn_es_weakImage); + imageView.setFitHeight(C2.imageHeight); + imageView.setFitWidth(C2.imageWidth); + this.rsidToESWeakBTN = new RadioButton(); + this.rsidToESWeakBTN.setPrefWidth(30.0D); + this.rsidToESWeakBTN.setGraphic(imageView); + setMouseHandler(this.rsidToESWeakBTN); + + this.rsidToESWeakBTN.addEventHandler(ActionEvent.ACTION, this.controller); + this.rsidToESWeakBTN.setToggleGroup(this.creation_selection_group); + this.rsidToESWeakBTN.setTooltip(new Tooltip("Connect weak-entity-set with identifying-relationship")); + + + imageView = new ImageView(C2.rs_id_conn_esImage); + imageView.setFitHeight(C2.imageHeight); + imageView.setFitWidth(C2.imageWidth); + this.rsidToESBTN = new RadioButton(); + this.rsidToESBTN.setPrefWidth(30.0D); + this.rsidToESBTN.setGraphic(imageView); + setMouseHandler(this.rsidToESBTN); + + this.rsidToESBTN.addEventHandler(ActionEvent.ACTION, this.controller); + this.rsidToESBTN.setToggleGroup(this.creation_selection_group); + this.rsidToESBTN.setTooltip(new Tooltip("Connect entity-set with identifying-relationship")); + + + imageView = new ImageView(C2.rs_isa_conn_general_esImage); + imageView.setFitHeight(C2.imageHeight); + imageView.setFitWidth(C2.imageWidth); + this.rsisaGeToESBTN = new RadioButton(); + this.rsisaGeToESBTN.setPrefWidth(30.0D); + this.rsisaGeToESBTN.setGraphic(imageView); + setMouseHandler(this.rsisaGeToESBTN); + + this.rsisaGeToESBTN.addEventHandler(ActionEvent.ACTION, this.controller); + this.rsisaGeToESBTN.setToggleGroup(this.creation_selection_group); + this.rsisaGeToESBTN.setTooltip(new Tooltip("Connect isa-relationship with entity-set (generalization)")); + + + imageView = new ImageView(C2.rs_isa_conn_special_esImage); + imageView.setFitHeight(C2.imageHeight); + imageView.setFitWidth(C2.imageWidth); + this.rsisaSpToESBTN = new RadioButton(); + this.rsisaSpToESBTN.setPrefWidth(30.0D); + this.rsisaSpToESBTN.setGraphic(imageView); + setMouseHandler(this.rsisaSpToESBTN); + + this.rsisaSpToESBTN.addEventHandler(ActionEvent.ACTION, this.controller); + this.rsisaSpToESBTN.setToggleGroup(this.creation_selection_group); + this.rsisaSpToESBTN.setTooltip(new Tooltip("Connect isa-relationship with entity-set (specialization)")); + + + this.generateRelationalModelCB = new CheckBox("Generate Relational Model"); + this.generateRelationalModelCB.setTooltip(new Tooltip("To check the relational model open the area right to the working area")); + this.generateRelationalModelCB.setSelected(false); + setMouseHandler(this.generateRelationalModelCB); + this.generateRelationalModelCB.setOnAction(arg0 -> { + if (B3.this.generateRelationalModelCB.isSelected()) { + if (!B3.this.selectModeBTN.isSelected()) { + B3.this.generateRelationalModelCB.setSelected(false); + return; + } + if (B3.this.currentTab != null && B3.this.currentTab.canvas != null) + B3.this.currentTab.canvas.dsfdsdfssdf45645re(); + + } else { + + B3.this.verticalBox.getChildren().clear(); + } + }); + + + this.saveSQLScriptBTN = new Button("Generate/Save DDL script"); + this.saveSQLScriptBTN.setTooltip(new Tooltip("The ddl-script will be generated and saved into a file")); + this.saveSQLScriptBTN.setMaxWidth(Double.MAX_VALUE); + setMouseHandler(this.saveSQLScriptBTN); + GridPane.setFillWidth(this.saveSQLScriptBTN, Boolean.TRUE); + this.saveSQLScriptBTN.setBackground(new Background(new BackgroundFill(C2.ButtonBackgroundColor, CornerRadii.EMPTY, Insets.EMPTY))); + + this.saveSQLScriptBTN.setOnAction(arg0 -> { + if (B3.this.generateRelationalModelCB.isSelected()) { + try { + B3.this.saveSQLScript(); + } catch (ZZ20 ignored) { + } + } + }); + + + this.generateInsertsCB = new CheckBox("Generate insert statement"); + this.generateInsertsCB.setTooltip(new Tooltip("If selected, insert statements are generated in the ddl-script")); + setMouseHandler(this.generateInsertsCB); + this.generateInsertsCB.setFont(Font.font(null, FontWeight.NORMAL, 11.0D)); + this.generateInsertsCB.setSelected(false); + this.singleInsertStatementCB = new CheckBox("-> as single insert statement"); + this.singleInsertStatementCB.setTooltip(new Tooltip("If selected, all inserts are seperated statements")); + setMouseHandler(this.singleInsertStatementCB); + this.singleInsertStatementCB.setFont(Font.font(null, FontWeight.NORMAL, 11.0D)); + this.singleInsertStatementCB.setSelected(false); + + this.addCurrentDateToDatabaseNameCB = new CheckBox("Add current date to db-name"); + this.addCurrentDateToDatabaseNameCB.setTooltip(new Tooltip("If selected, the current date will be added to the db-name")); + setMouseHandler(this.addCurrentDateToDatabaseNameCB); + this.addCurrentDateToDatabaseNameCB.setFont(Font.font(null, FontWeight.NORMAL, 11.0D)); + this.addCurrentDateToDatabaseNameCB.setSelected(false); + + + this.sqlStyleGroup = new ToggleGroup(); + this.mySqlStyle = new RadioButton("MySQL"); + this.mySqlStyle.setTooltip(new Tooltip("Creates a MySQL style script")); + this.mySqlStyle.setToggleGroup(this.sqlStyleGroup); + this.mySqlStyle.setSelected(true); + setMouseHandler(this.mySqlStyle); + this.msSqlStyle = new RadioButton("MSSQL"); + this.msSqlStyle.setTooltip(new Tooltip("Creates a Microsoft-SQL-Server style script")); + this.msSqlStyle.setToggleGroup(this.sqlStyleGroup); + setMouseHandler(this.msSqlStyle); + FlowPane sqlStylePane = new FlowPane(); + sqlStylePane.setPrefWidth(40.0D); + sqlStylePane.getChildren().add(this.mySqlStyle); + sqlStylePane.getChildren().add(this.msSqlStyle); + + + int ci = 0, ri = 0; + + + this.buttonPane.add(this.selectModeBTN, ci, ri++, 2, 1); + + + Label crLBL = new Label("Creation Mode"); + crLBL.setFont(Font.font(null, FontWeight.BOLD, 11.0D)); + + HBox labeledSeparator = new HBox(); + this.creationModelabel = new Label(" Creation mode "); + this.creationModelabel.setStyle("-fx-text-fill:red"); + this.creationModelabel.setFont(Font.font(null, FontWeight.BOLD, 11.0D)); + Separator leftSeparator = new Separator(); + leftSeparator.setPrefWidth(42.0D); + Separator rightSeparator = new Separator(); + rightSeparator.setPrefWidth(42.0D); + labeledSeparator.getChildren().add(leftSeparator); + labeledSeparator.getChildren().add(this.creationModelabel); + labeledSeparator.getChildren().add(rightSeparator); + labeledSeparator.setAlignment(Pos.CENTER); + + FlowPane fp = new FlowPane(crLBL); + fp.setPrefWidth(40.0D); + fp.setAlignment(Pos.CENTER); + this.buttonPane.add(labeledSeparator, 0, ri++, 2, 1); + + + VBox vbox0 = new VBox(10.0D); + HBox hbox0 = new HBox(10.0D); + hbox0.getChildren().addAll(this.textElemBTN, this.textWithoutBorderElemBTN); + vbox0.getChildren().addAll(hbox0); + TitledPane textElement = new TitledPane("Text element", vbox0); + Accordion accorTextelement = new Accordion(); + accorTextelement.getPanes().add(textElement); + this.buttonPane.add(accorTextelement, 0, ri++, 2, 1); + + vbox0 = new VBox(10.0D); + hbox0 = new HBox(10.0D); + hbox0.getChildren().addAll(this.esBTN, this.esWeakBTN); + HBox hbox1 = new HBox(10.0D); + hbox1.getChildren().addAll(this.esAssociativeBTN); + vbox0.getChildren().addAll(hbox0, hbox1); + TitledPane entitysetType = new TitledPane("Entity-set type", vbox0); + this.buttonPane.add(entitysetType, 0, ri++, 2, 1); + entitysetType.setBackground(C2.AppForeground); + + vbox0 = new VBox(10.0D); + hbox0 = new HBox(10.0D); + hbox0.getChildren().addAll(this.rsBTN, this.rsIDBTN); + hbox1 = new HBox(10.0D); + hbox1.getChildren().addAll(this.rsISABTN); + vbox0.getChildren().addAll(hbox0, hbox1); + TitledPane relationshipType = new TitledPane("Relationship type", vbox0); + this.buttonPane.add(relationshipType, 0, ri++, 2, 1); + relationshipType.setBackground(C2.AppForeground); + + vbox0 = new VBox(10.0D); + hbox0 = new HBox(10.0D); + hbox0.getChildren().addAll(this.rsToESBTN); + hbox1 = new HBox(10.0D); + hbox1.getChildren().addAll(this.rsidToESBTN, this.rsidToESWeakBTN); + HBox hbox2 = new HBox(10.0D); + hbox2.getChildren().addAll(this.rsisaGeToESBTN, this.rsisaSpToESBTN); + vbox0.getChildren().addAll(hbox0, hbox1, hbox2); + TitledPane connectESRS = new TitledPane("Connect ES-RS", vbox0); + + this.buttonPane.add(connectESRS, 0, ri++, 2, 1); + connectESRS.setBackground(C2.AppForeground); + + vbox0 = new VBox(10.0D); + hbox0 = new HBox(10.0D); + hbox0.getChildren().addAll(this.attrKeyBTN, this.attrWeakKeyBTN); + hbox1 = new HBox(10.0D); + hbox1.getChildren().addAll(this.attrOneBTN, this.attrMultiBTN); + hbox2 = new HBox(10.0D); + hbox2.getChildren().addAll(this.attrDerivedOneBTN, this.attrDerivedMultiBTN); + vbox0.getChildren().addAll(hbox0, hbox1, hbox2); + TitledPane attributeTypes = new TitledPane("Attribute type", vbox0); + attributeTypes.setExpanded(false); + this.buttonPane.add(attributeTypes, 0, ri++, 2, 1); + attributeTypes.setBackground(C2.AppForeground); + + vbox0 = new VBox(10.0D); + hbox0 = new HBox(10.0D); + hbox0.getChildren().addAll(this.attrToESBTN, this.attrToRSBTN); + hbox1 = new HBox(10.0D); + hbox1.getChildren().addAll(this.attrToAttrBTN); + vbox0.getChildren().addAll(hbox0, hbox1); + TitledPane connectAttribute = new TitledPane("Connect Attribute", vbox0); + connectAttribute.setExpanded(false); + this.buttonPane.add(connectAttribute, 0, ri++, 2, 1); + connectAttribute.setBackground(C2.AppForeground); + this.buttonPane.add(this.generateRelationalModelCB, 0, ri++, 2, 1); + + + VBox box = new VBox(10.0D); + box.getChildren().addAll(this.addCurrentDateToDatabaseNameCB, this.generateInsertsCB, this.singleInsertStatementCB, this.saveSQLScriptBTN); + TitledPane createddl = new TitledPane("Create DDL", box); + createddl.setExpanded(false); + this.buttonPane.add(createddl, 0, ri++, 2, 1); + + this.statusInformation = new TextField("Creation Mode: entity-set -> press left mouse button on working area -> enter name of entity-set -> press enter key"); + this.statusInformation.setEditable(false); + this.statusInformation.setFocusTraversable(false); + + this.currentTab = addNewTab(null); + + this.borderPane = new BorderPane(); + this.borderPane.setLeft(this.buttonPane); + this.borderPane.setCenter(this.tabPane); + this.borderPane.setRight(this.treeBorderPane); + this.borderPane.setBottom(this.statusInformation); + + this.borderPane.setOnKeyPressed(arg0 -> { + if (B3.this.currentTab != null && B3.this.currentTab.canvas != null) { + B3.this.currentTab.canvas.sdfdsfd567657rrt(arg0); + } + }); + + setTitle("ER-Modeling-Chen++ -> Relational Model -> Database Creation + Data Generation ~ [jre-" + + System.getProperty("java.version") + " - " + System.getProperty("java.class.path") + "]"); + + setResizable(true); + centerOnScreen(); + + + MenuBar menuBar = new MenuBar(); + + + Menu menuFile = new Menu("_File"); + + menuFile.setMnemonicParsing(true); + + + this.menuNewMI = new MenuItem("_New model"); + this.menuNewMI.setMnemonicParsing(true); + + this.menuNewMI.addEventHandler(ActionEvent.ACTION, this.controller); + this.menuNewMI.setAccelerator( + KeyCombination.keyCombination("SHORTCUT+N")); + + this.menuRedrawMI = new MenuItem("_Redraw model"); + this.menuRedrawMI.setMnemonicParsing(true); + + this.menuRedrawMI.addEventHandler(ActionEvent.ACTION, this.controller); + this.menuRedrawMI.setAccelerator( + KeyCombination.keyCombination("SHORTCUT+R")); + + this.menuReadMI = new MenuItem("_Open model"); + + this.menuReadMI.addEventHandler(ActionEvent.ACTION, this.controller); + this.menuReadMI.setAccelerator( + KeyCombination.keyCombination("SHORTCUT+O")); + + this.menuSaveMI = new MenuItem("_Save model"); + this.menuSaveMI.addEventHandler(ActionEvent.ACTION, this.controller); + this.menuSaveMI.setAccelerator( + KeyCombination.keyCombination("SHORTCUT+S")); + + + this.menuSaveAsMI = new MenuItem("Save model as"); + + this.menuSaveAsMI.addEventHandler(ActionEvent.ACTION, this.controller); + + this.menuExportMI = new MenuItem("_Export model (png)"); + this.menuExportMI.setMnemonicParsing(true); + + this.menuExportMI.addEventHandler(ActionEvent.ACTION, this.controller); + + this.menuExitMI = new MenuItem("_Exit"); + + this.menuExitMI.addEventHandler(ActionEvent.ACTION, this.controller); + this.menuExitMI.setMnemonicParsing(true); + this.menuExitMI.setAccelerator( + KeyCombination.keyCombination("SHORTCUT+E")); + + menuFile.getItems().addAll(this.menuNewMI, new SeparatorMenuItem(), + this.menuRedrawMI, new SeparatorMenuItem(), + this.menuReadMI, this.menuSaveMI, this.menuSaveAsMI, this.menuExportMI, new SeparatorMenuItem(), + this.menuExitMI); + + Menu menuEdit = new Menu("_Edit"); + + this.menuCutMI = new MenuItem("Cut"); + this.menuCutMI.setMnemonicParsing(true); + this.menuCutMI.setAccelerator( + KeyCombination.keyCombination("SHORTCUT+X")); + + this.menuCopyMI = new MenuItem("_Copy"); + this.menuCopyMI.setMnemonicParsing(true); + this.menuCopyMI.setAccelerator( + KeyCombination.keyCombination("SHORTCUT+C")); + + this.menuCopyMI.addEventHandler(ActionEvent.ACTION, this.controller); + + this.menuPasteMI = new MenuItem("Paste"); + this.menuPasteMI.setMnemonicParsing(true); + this.menuPasteMI.setAccelerator( + KeyCombination.keyCombination("SHORTCUT+V")); + + this.menuPasteMI.addEventHandler(ActionEvent.ACTION, this.controller); + + this.menuSelectAllMI = new MenuItem("Select all"); + this.menuSelectAllMI.setMnemonicParsing(true); + this.menuSelectAllMI.setAccelerator( + KeyCombination.keyCombination("SHORTCUT+A")); + + this.menuSelectAllMI.addEventHandler(ActionEvent.ACTION, this.controller); + + this.menuUndoMI = new MenuItem("Undo"); + this.menuUndoMI.setMnemonicParsing(true); + this.menuUndoMI.setAccelerator( + KeyCombination.keyCombination("SHORTCUT+Z")); + + this.menuUndoMI.addEventHandler(ActionEvent.ACTION, this.controller); + + menuEdit.getItems().addAll(this.menuUndoMI, new SeparatorMenuItem(), this.menuCutMI, this.menuCopyMI, this.menuPasteMI, new SeparatorMenuItem(), this.menuSelectAllMI); + + Menu menuModel = new Menu("_Model"); + this.mergeModelsMI = new MenuItem("Merge models"); + this.mergeModelsMI.setOnAction(arg0 -> { + if (B3.this.generateRelationalModelCB.isSelected()) { + return; + } + + + for (Tab tab : B3.this.tabPane.getTabs()) { + U1 runningTab = (U1) tab; + if (runningTab.getText().contains("*")) { + return; } } + ZZ30 mergedModel = new ZZ30(B3.this.thisERMViewFX); + try { + boolean merged = mergedModel.mergeAllModelsInPanes(); + if (!merged) { + return; + + + } + + + } catch (ClassNotFoundException | IOException e) { + return; + } + + + B3.this.currentTab = B3.this.addNewTab(null); + + for (Graphic_Main_Elem gme : mergedModel.getGraphicElements()) { + gme.setGc(B3.this.currentTab.canvas.getGraphicsContext2D()); + + gme.isVisible = true; + } + + B3.this.currentTab.canvas.dsfds124332(B3.this.currentTab.canvas.sdfsddf345ersdf()); + + B3.this.currentTab.canvas.clearERMDrawCanvas(); + B3.this.currentTab.canvas.safdsadsa65765ewthjk(mergedModel.getGraphicElements()); + B3.this.currentTab.canvas.sdfsdfds3465er(true); + + B3.this.tabPane.getSelectionModel().select(B3.this.currentTab); + + + B3.this.currentTab.canvas.dsfdsdfssdf45645re(); + }); + + + this.menuVisibility = new Menu("_Visibility"); + this.menuVisibility.setDisable(true); + this.menuVisibilityAllRMI = new RadioMenuItem("All"); + this.menuVisibilityAllRMI.setSelected(true); + this.menuVisibilityAllRMI.addEventHandler(ActionEvent.ACTION, this.controller); + this.menuVisibilityES_RSRMI = new RadioMenuItem("ES + RS"); + this.menuVisibilityES_RSRMI.addEventHandler(ActionEvent.ACTION, this.controller); + this.menuVisibilityES_RS_KEYRMI = new RadioMenuItem("ES + RS + KEYS"); + this.menuVisibilityES_RS_KEYRMI.addEventHandler(ActionEvent.ACTION, this.controller); + this.menuVisibilityTEXTRMI = new RadioMenuItem("Text"); + this.menuVisibilityTEXTRMI.addEventHandler(ActionEvent.ACTION, this.controller); + this.menuVisibilityTEXTRMI.setSelected(true); + + + menuModel.getItems().addAll(this.menuVisibility, this.mergeModelsMI); + this.menuVisibility.getItems().addAll(this.menuVisibilityAllRMI, this.menuVisibilityES_RSRMI, this.menuVisibilityES_RS_KEYRMI, this.menuVisibilityTEXTRMI); + ToggleGroup tggroup = new ToggleGroup(); + tggroup.getToggles().addAll(this.menuVisibilityAllRMI, this.menuVisibilityES_RSRMI, this.menuVisibilityES_RS_KEYRMI); + + + Menu menuHelp = new Menu("_Help"); + this.menuVersionMI = new MenuItem("Version"); + this.menuVersionMI.addEventHandler(ActionEvent.ACTION, this.controller); + this.menuVersionMI.setOnAction(e -> { + //TODO: version popup + }); + + this.menuDownloadMI = new MenuItem("_Download"); + this.menuDownloadMI.setOnAction(e -> { + try { + URL url = new URL("https://www.actionobject.eu/"); + Desktop.getDesktop().browse(url.toURI()); + } catch (IOException | URISyntaxException e2) { + + e2.printStackTrace(); + } + }); + menuHelp.getItems().addAll(this.menuDownloadMI, this.menuVersionMI); + + + menuBar.getMenus().addAll(menuFile, menuEdit, menuModel, menuHelp); + + + vBox.getChildren().addAll(menuBar, this.borderPane); + + + Scene scene = new Scene(vBox, 1300.0D, 870.0D); + setScene(scene); + sizeToScene(); + + + getIcons().add(C2.applicationImageIconAsICO); + + + show(); + } + + + public void exportModel() { + FileChooser fc = new FileChooser(); + fc.setInitialDirectory(new File("/")); + fc.getExtensionFilters().add(new FileChooser.ExtensionFilter("PNG", "*.png")); + fc.setTitle("Export Map to png"); + File file = fc.showSaveDialog(this); + if (file != null) { + double[] size = this.currentTab.canvas.dssfsdfd43643634(); + WritableImage wi = new WritableImage((int) size[0], (int) size[1]); + try { + SnapshotParameters sp = new SnapshotParameters(); + sp.setFill(Paint.valueOf("rgb(27, 27, 30)")); + ImageIO.write(SwingFXUtils.fromFXImage(this.currentTab.canvas.snapshot(sp, wi), null), "png", file); + } catch (IOException e) { + e.printStackTrace(); + } } - }); - this.graphicElemLV.setOnKeyReleased(event -> { - Graphic_Main_Elem selectedItem = B3.this.graphicElemLV.getSelectionModel().getSelectedItem(); - if (selectedItem != null) { - B3.this.currentTab.canvas.sdfsdfds3465er(true); - B3.this.currentTab.canvas.dsfdsfsdf43543refds(selectedItem.graphicMainElemID); - } - }); + } + public boolean saveModelAs() { + if (this.currentTab == null || this.currentTab.canvas == null) return false; - - this.infoTabPane.getTabs().add(new Tab("Elem", this.graphicElemLV)); - this.infoTabPane.getTabs().add(new Tab("R-Model", this.verticalBox)); + FileChooser fc = new FileChooser(); + fc.setInitialDirectory(new File(System.getProperty("user.home"))); - - - this.treeBorderPane.setCenter(this.infoTabPane); - - - - this.selectModeBTN = new RadioButton("Selection Mode"); - this.selectModeBTN.setFont(Font.font(null, FontWeight.BOLD, 11.0D)); - this.selectModeBTN.setStyle("-fx-text-fill:white"); - this.selectModeBTN.addEventHandler(ActionEvent.ACTION, this.controller); - this.selectModeBTN.setSelected(true); - this.selectModeBTN.setToggleGroup(this.creation_selection_group); - this.selectModeBTN.setTooltip(new Tooltip("Selection Mode - F1-Key Selection mode <-> Creation Mode")); - setMouseHandler(this.selectModeBTN); - - - imageView = new ImageView(C2.textImage); - imageView.setFitHeight(C2.imageHeight); - imageView.setFitWidth(C2.imageWidth); - this.textElemBTN = new RadioButton(); - this.textElemBTN.setPrefWidth(30.0D); - this.textElemBTN.setGraphic(imageView); - - this.textElemBTN.addEventHandler(ActionEvent.ACTION, this.controller); - this.textElemBTN.setSelected(false); - this.textElemBTN.setToggleGroup(this.creation_selection_group); - this.textElemBTN.setTooltip(new Tooltip("Text with border")); - setMouseHandler(this.textElemBTN); - - - imageView = new ImageView(C2.textWithoutBorderImage); - imageView.setFitHeight(C2.imageHeight); - imageView.setFitWidth(C2.imageWidth); - this.textWithoutBorderElemBTN = new RadioButton(); - this.textWithoutBorderElemBTN.setPrefWidth(30.0D); - this.textWithoutBorderElemBTN.setGraphic(imageView); - - this.textWithoutBorderElemBTN.addEventHandler(ActionEvent.ACTION, this.controller); - this.textWithoutBorderElemBTN.setSelected(false); - this.textWithoutBorderElemBTN.setToggleGroup(this.creation_selection_group); - this.textWithoutBorderElemBTN.setTooltip(new Tooltip("Text without border")); - setMouseHandler(this.textWithoutBorderElemBTN); - - - - imageView = new ImageView(C2.esImage); - imageView.setFitHeight(C2.imageHeight); - imageView.setFitWidth(C2.imageWidth); - this.esBTN = new RadioButton(); - this.esBTN.setPrefWidth(30.0D); - this.esBTN.setGraphic(imageView); - setMouseHandler(this.esBTN); - - this.esBTN.addEventHandler(ActionEvent.ACTION, this.controller); - this.esBTN.setSelected(true); - this.lastCreationSelected = this.esBTN; - this.esBTN.setToggleGroup(this.creation_selection_group); - this.esBTN.setTooltip(new Tooltip("Entity set")); - - - - imageView = new ImageView(C2.es_weakImage); - imageView.setFitHeight(C2.imageHeight); - imageView.setFitWidth(C2.imageWidth); - this.esWeakBTN = new RadioButton(); - this.esWeakBTN.setPrefWidth(30.0D); - this.esWeakBTN.setGraphic(imageView); - setMouseHandler(this.esWeakBTN); - - this.esWeakBTN.addEventHandler(ActionEvent.ACTION, this.controller); - this.esWeakBTN.setToggleGroup(this.creation_selection_group); - this.esWeakBTN.setTooltip(new Tooltip("Weak entity set")); - - - imageView = new ImageView(C2.es_associativeImage); - imageView.setFitHeight(C2.imageHeight); - imageView.setFitWidth(C2.imageWidth); - this.esAssociativeBTN = new RadioButton(); - this.esAssociativeBTN.setPrefWidth(30.0D); - this.esAssociativeBTN.setGraphic(imageView); - setMouseHandler(this.esAssociativeBTN); - - this.esAssociativeBTN.addEventHandler(ActionEvent.ACTION, this.controller); - this.esAssociativeBTN.setToggleGroup(this.creation_selection_group); - this.esAssociativeBTN.setTooltip(new Tooltip("Associative entity set")); - - - imageView = new ImageView(C2.rsImage); - imageView.setFitHeight(C2.imageHeight); - imageView.setFitWidth(C2.imageWidth); - this.rsBTN = new RadioButton(); - this.rsBTN.setPrefWidth(30.0D); - this.rsBTN.setGraphic(imageView); - setMouseHandler(this.rsBTN); - - this.rsBTN.addEventHandler(ActionEvent.ACTION, this.controller); - this.rsBTN.setToggleGroup(this.creation_selection_group); - this.rsBTN.setTooltip(new Tooltip("Relationship")); - - - - imageView = new ImageView(C2.rs_idImage); - imageView.setFitHeight(C2.imageHeight); - imageView.setFitWidth(C2.imageWidth); - this.rsIDBTN = new RadioButton(); - this.rsIDBTN.setPrefWidth(30.0D); - this.rsIDBTN.setGraphic(imageView); - setMouseHandler(this.rsIDBTN); - - this.rsIDBTN.addEventHandler(ActionEvent.ACTION, this.controller); - this.rsIDBTN.setToggleGroup(this.creation_selection_group); - this.rsIDBTN.setTooltip(new Tooltip("Identifying-relationship: used together with a weak-entity-set")); - - - imageView = new ImageView(C2.rs_isaImage); - imageView.setFitHeight(C2.imageHeight); - imageView.setFitWidth(C2.imageWidth); - this.rsISABTN = new RadioButton(); - this.rsISABTN.setPrefWidth(30.0D); - this.rsISABTN.setGraphic(imageView); - setMouseHandler(this.rsISABTN); - - this.rsISABTN.addEventHandler(ActionEvent.ACTION, this.controller); - this.rsISABTN.setToggleGroup(this.creation_selection_group); - this.rsISABTN.setTooltip(new Tooltip("ISA relationship - generalization/specialization")); - - - imageView = new ImageView(C2.attr_one_valueImage); - imageView.setFitHeight(C2.imageHeight); - imageView.setFitWidth(C2.imageWidth); - this.attrOneBTN = new RadioButton(); - this.attrOneBTN.setPrefWidth(30.0D); - this.attrOneBTN.setGraphic(imageView); - setMouseHandler(this.attrOneBTN); - - this.attrOneBTN.addEventHandler(ActionEvent.ACTION, this.controller); - this.attrOneBTN.setToggleGroup(this.creation_selection_group); - this.attrOneBTN.setTooltip(new Tooltip("One value attribute")); - - - imageView = new ImageView(C2.attr_multi_valueImage); - imageView.setFitHeight(C2.imageHeight); - imageView.setFitWidth(C2.imageWidth); - this.attrMultiBTN = new RadioButton(); - this.attrMultiBTN.setPrefWidth(30.0D); - this.attrMultiBTN.setGraphic(imageView); - setMouseHandler(this.attrMultiBTN); - - this.attrMultiBTN.addEventHandler(ActionEvent.ACTION, this.controller); - this.attrMultiBTN.setToggleGroup(this.creation_selection_group); - this.attrMultiBTN.setTooltip(new Tooltip("Multivalue attribute")); - - - imageView = new ImageView(C2.attr_key_valueImage); - imageView.setFitHeight(C2.imageHeight); - imageView.setFitWidth(C2.imageWidth); - this.attrKeyBTN = new RadioButton(); - this.attrKeyBTN.setPrefWidth(30.0D); - this.attrKeyBTN.setGraphic(imageView); - setMouseHandler(this.attrKeyBTN); - - this.attrKeyBTN.addEventHandler(ActionEvent.ACTION, this.controller); - this.attrKeyBTN.setToggleGroup(this.creation_selection_group); - this.attrKeyBTN.setTooltip(new Tooltip("Primary key attribute")); - - - imageView = new ImageView(C2.attr_weak_key_valueImage); - imageView.setFitHeight(C2.imageHeight); - imageView.setFitWidth(C2.imageWidth); - this.attrWeakKeyBTN = new RadioButton(); - this.attrWeakKeyBTN.setPrefWidth(30.0D); - this.attrWeakKeyBTN.setGraphic(imageView); - setMouseHandler(this.attrWeakKeyBTN); - - this.attrWeakKeyBTN.addEventHandler(ActionEvent.ACTION, this.controller); - this.attrWeakKeyBTN.setToggleGroup(this.creation_selection_group); - this.attrWeakKeyBTN.setTooltip(new Tooltip("Weak key attribute")); - - - imageView = new ImageView(C2.attr_derived_one_valueImage); - imageView.setFitHeight(C2.imageHeight); - imageView.setFitWidth(C2.imageWidth); - this.attrDerivedOneBTN = new RadioButton(); - this.attrDerivedOneBTN.setPrefWidth(30.0D); - this.attrDerivedOneBTN.setGraphic(imageView); - setMouseHandler(this.attrDerivedOneBTN); - - this.attrDerivedOneBTN.addEventHandler(ActionEvent.ACTION, this.controller); - this.attrDerivedOneBTN.setToggleGroup(this.creation_selection_group); - this.attrDerivedOneBTN.setTooltip(new Tooltip("Derived one-value-attribute")); - - - imageView = new ImageView(C2.attr_derived_multi_valueImage); - imageView.setFitHeight(C2.imageHeight); - imageView.setFitWidth(C2.imageWidth); - this.attrDerivedMultiBTN = new RadioButton(); - this.attrDerivedMultiBTN.setPrefWidth(30.0D); - this.attrDerivedMultiBTN.setGraphic(imageView); - setMouseHandler(this.attrDerivedMultiBTN); - - this.attrDerivedMultiBTN.addEventHandler(ActionEvent.ACTION, this.controller); - this.attrDerivedMultiBTN.setToggleGroup(this.creation_selection_group); - this.attrDerivedMultiBTN.setTooltip(new Tooltip("Derived multi-value-attribute")); - - - - imageView = new ImageView(C2.attr_conn_attrImage); - imageView.setFitHeight(C2.imageHeight); - imageView.setFitWidth(C2.imageWidth); - this.attrToAttrBTN = new RadioButton(); - this.attrToAttrBTN.setPrefWidth(30.0D); - this.attrToAttrBTN.setGraphic(imageView); - setMouseHandler(this.attrToAttrBTN); - - this.attrToAttrBTN.addEventHandler(ActionEvent.ACTION, this.controller); - this.attrToAttrBTN.setToggleGroup(this.creation_selection_group); - this.attrToAttrBTN.setTooltip(new Tooltip("Connect attribute with attribute (to create composite-attribute)")); - - - imageView = new ImageView(C2.attr_conn_esImage); - imageView.setFitHeight(C2.imageHeight); - imageView.setFitWidth(C2.imageWidth); - this.attrToESBTN = new RadioButton(); - this.attrToESBTN.setPrefWidth(30.0D); - this.attrToESBTN.setGraphic(imageView); - setMouseHandler(this.attrToESBTN); - - this.attrToESBTN.addEventHandler(ActionEvent.ACTION, this.controller); - this.attrToESBTN.setToggleGroup(this.creation_selection_group); - this.attrToESBTN.setTooltip(new Tooltip("Connect attribute with entity-set")); - - - imageView = new ImageView(C2.attr_conn_rsImage); - imageView.setFitHeight(C2.imageHeight); - imageView.setFitWidth(C2.imageWidth); - this.attrToRSBTN = new RadioButton(); - this.attrToRSBTN.setPrefWidth(30.0D); - this.attrToRSBTN.setGraphic(imageView); - setMouseHandler(this.attrToRSBTN); - - this.attrToRSBTN.addEventHandler(ActionEvent.ACTION, this.controller); - this.attrToRSBTN.setToggleGroup(this.creation_selection_group); - this.attrToRSBTN.setTooltip(new Tooltip("Connect attribute with relationship")); - - - imageView = new ImageView(C2.rs_conn_esImage); - imageView.setFitHeight(C2.imageHeight); - imageView.setFitWidth(C2.imageWidth); - this.rsToESBTN = new RadioButton(); - this.rsToESBTN.setPrefWidth(30.0D); - this.rsToESBTN.setGraphic(imageView); - setMouseHandler(this.rsToESBTN); - - this.rsToESBTN.addEventHandler(ActionEvent.ACTION, this.controller); - this.rsToESBTN.setToggleGroup(this.creation_selection_group); - this.rsToESBTN.setTooltip(new Tooltip("Connect entity-set with relationship")); - - - imageView = new ImageView(C2.rs_id_conn_es_weakImage); - imageView.setFitHeight(C2.imageHeight); - imageView.setFitWidth(C2.imageWidth); - this.rsidToESWeakBTN = new RadioButton(); - this.rsidToESWeakBTN.setPrefWidth(30.0D); - this.rsidToESWeakBTN.setGraphic(imageView); - setMouseHandler(this.rsidToESWeakBTN); - - this.rsidToESWeakBTN.addEventHandler(ActionEvent.ACTION, this.controller); - this.rsidToESWeakBTN.setToggleGroup(this.creation_selection_group); - this.rsidToESWeakBTN.setTooltip(new Tooltip("Connect weak-entity-set with identifying-relationship")); - - - imageView = new ImageView(C2.rs_id_conn_esImage); - imageView.setFitHeight(C2.imageHeight); - imageView.setFitWidth(C2.imageWidth); - this.rsidToESBTN = new RadioButton(); - this.rsidToESBTN.setPrefWidth(30.0D); - this.rsidToESBTN.setGraphic(imageView); - setMouseHandler(this.rsidToESBTN); - - this.rsidToESBTN.addEventHandler(ActionEvent.ACTION, this.controller); - this.rsidToESBTN.setToggleGroup(this.creation_selection_group); - this.rsidToESBTN.setTooltip(new Tooltip("Connect entity-set with identifying-relationship")); - - - imageView = new ImageView(C2.rs_isa_conn_general_esImage); - imageView.setFitHeight(C2.imageHeight); - imageView.setFitWidth(C2.imageWidth); - this.rsisaGeToESBTN = new RadioButton(); - this.rsisaGeToESBTN.setPrefWidth(30.0D); - this.rsisaGeToESBTN.setGraphic(imageView); - setMouseHandler(this.rsisaGeToESBTN); - - this.rsisaGeToESBTN.addEventHandler(ActionEvent.ACTION, this.controller); - this.rsisaGeToESBTN.setToggleGroup(this.creation_selection_group); - this.rsisaGeToESBTN.setTooltip(new Tooltip("Connect isa-relationship with entity-set (generalization)")); - - - imageView = new ImageView(C2.rs_isa_conn_special_esImage); - imageView.setFitHeight(C2.imageHeight); - imageView.setFitWidth(C2.imageWidth); - this.rsisaSpToESBTN = new RadioButton(); - this.rsisaSpToESBTN.setPrefWidth(30.0D); - this.rsisaSpToESBTN.setGraphic(imageView); - setMouseHandler(this.rsisaSpToESBTN); - - this.rsisaSpToESBTN.addEventHandler(ActionEvent.ACTION, this.controller); - this.rsisaSpToESBTN.setToggleGroup(this.creation_selection_group); - this.rsisaSpToESBTN.setTooltip(new Tooltip("Connect isa-relationship with entity-set (specialization)")); - - - this.generateRelationalModelCB = new CheckBox("Generate Relational Model"); - this.generateRelationalModelCB.setTooltip(new Tooltip("To check the relational model open the area right to the working area")); - this.generateRelationalModelCB.setSelected(false); - setMouseHandler(this.generateRelationalModelCB); - this.generateRelationalModelCB.setOnAction(arg0 -> { - if (B3.this.generateRelationalModelCB.isSelected()) { - if (!B3.this.selectModeBTN.isSelected()) { - B3.this.generateRelationalModelCB.setSelected(false); - return; - } - if (B3.this.currentTab != null && B3.this.currentTab.canvas != null) B3.this.currentTab.canvas.dsfdsdfssdf45645re(); - - } else { - - B3.this.verticalBox.getChildren().clear(); - } - }); - - - this.saveSQLScriptBTN = new Button("Generate/Save DDL script"); - this.saveSQLScriptBTN.setTooltip(new Tooltip("The ddl-script will be generated and saved into a file")); - this.saveSQLScriptBTN.setMaxWidth(Double.MAX_VALUE); - setMouseHandler(this.saveSQLScriptBTN); - GridPane.setFillWidth(this.saveSQLScriptBTN, Boolean.TRUE); - this.saveSQLScriptBTN.setBackground(new Background(new BackgroundFill(C2.ButtonBackgroundColor, CornerRadii.EMPTY, Insets.EMPTY))); - - this.saveSQLScriptBTN.setOnAction(arg0 -> { - if (B3.this.generateRelationalModelCB.isSelected()) { - try { - B3.this.saveSQLScript(); - } catch (ZZ20 ignored) { - } - } - }); - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - this.generateInsertsCB = new CheckBox("Generate insert statement"); - this.generateInsertsCB.setTooltip(new Tooltip("If selected, insert statements are generated in the ddl-script")); - setMouseHandler(this.generateInsertsCB); - this.generateInsertsCB.setFont(Font.font(null, FontWeight.NORMAL, 11.0D)); - this.generateInsertsCB.setSelected(false); - this.singleInsertStatementCB = new CheckBox("-> as single insert statement"); - this.singleInsertStatementCB.setTooltip(new Tooltip("If selected, all inserts are seperated statements")); - setMouseHandler(this.singleInsertStatementCB); - this.singleInsertStatementCB.setFont(Font.font(null, FontWeight.NORMAL, 11.0D)); - this.singleInsertStatementCB.setSelected(false); - - this.addCurrentDateToDatabaseNameCB = new CheckBox("Add current date to db-name"); - this.addCurrentDateToDatabaseNameCB.setTooltip(new Tooltip("If selected, the current date will be added to the db-name")); - setMouseHandler(this.addCurrentDateToDatabaseNameCB); - this.addCurrentDateToDatabaseNameCB.setFont(Font.font(null, FontWeight.NORMAL, 11.0D)); - this.addCurrentDateToDatabaseNameCB.setSelected(false); - - - - this.sqlStyleGroup = new ToggleGroup(); - this.mySqlStyle = new RadioButton("MySQL"); - this.mySqlStyle.setTooltip(new Tooltip("Creates a MySQL style script")); - this.mySqlStyle.setToggleGroup(this.sqlStyleGroup); - this.mySqlStyle.setSelected(true); - setMouseHandler(this.mySqlStyle); - this.msSqlStyle = new RadioButton("MSSQL"); - this.msSqlStyle.setTooltip(new Tooltip("Creates a Microsoft-SQL-Server style script")); - this.msSqlStyle.setToggleGroup(this.sqlStyleGroup); - setMouseHandler(this.msSqlStyle); - FlowPane sqlStylePane = new FlowPane(); - sqlStylePane.setPrefWidth(40.0D); - sqlStylePane.getChildren().add(this.mySqlStyle); - sqlStylePane.getChildren().add(this.msSqlStyle); - - - int ci = 0, ri = 0; - - - - this.buttonPane.add(this.selectModeBTN, ci, ri++, 2, 1); - - - Label crLBL = new Label("Creation Mode"); - crLBL.setFont(Font.font(null, FontWeight.BOLD, 11.0D)); - - HBox labeledSeparator = new HBox(); - this.creationModelabel = new Label(" Creation mode "); - this.creationModelabel.setStyle("-fx-text-fill:red"); - this.creationModelabel.setFont(Font.font(null, FontWeight.BOLD, 11.0D)); - Separator leftSeparator = new Separator(); - leftSeparator.setPrefWidth(42.0D); - Separator rightSeparator = new Separator(); - rightSeparator.setPrefWidth(42.0D); - labeledSeparator.getChildren().add(leftSeparator); - labeledSeparator.getChildren().add(this.creationModelabel); - labeledSeparator.getChildren().add(rightSeparator); - labeledSeparator.setAlignment(Pos.CENTER); - - FlowPane fp = new FlowPane(crLBL); - fp.setPrefWidth(40.0D); - fp.setAlignment(Pos.CENTER); - this.buttonPane.add(labeledSeparator, 0, ri++, 2, 1); - - - - - - - - - - - - - - - - - - - - VBox vbox0 = new VBox(10.0D); - HBox hbox0 = new HBox(10.0D); - hbox0.getChildren().addAll(this.textElemBTN, this.textWithoutBorderElemBTN); - vbox0.getChildren().addAll(hbox0); - TitledPane textElement = new TitledPane("Text element", vbox0); - Accordion accorTextelement = new Accordion(); - accorTextelement.getPanes().add(textElement); - this.buttonPane.add(accorTextelement, 0, ri++, 2, 1); - - vbox0 = new VBox(10.0D); - hbox0 = new HBox(10.0D); - hbox0.getChildren().addAll(this.esBTN, this.esWeakBTN); - HBox hbox1 = new HBox(10.0D); - hbox1.getChildren().addAll(this.esAssociativeBTN); - vbox0.getChildren().addAll(hbox0, hbox1); - TitledPane entitysetType = new TitledPane("Entity-set type", vbox0); - this.buttonPane.add(entitysetType, 0, ri++, 2, 1); - entitysetType.setBackground(C2.AppForeground); - - vbox0 = new VBox(10.0D); - hbox0 = new HBox(10.0D); - hbox0.getChildren().addAll(this.rsBTN, this.rsIDBTN); - hbox1 = new HBox(10.0D); - hbox1.getChildren().addAll(this.rsISABTN); - vbox0.getChildren().addAll(hbox0, hbox1); - TitledPane relationshipType = new TitledPane("Relationship type", vbox0); - this.buttonPane.add(relationshipType, 0, ri++, 2, 1); - relationshipType.setBackground(C2.AppForeground); - - vbox0 = new VBox(10.0D); - hbox0 = new HBox(10.0D); - hbox0.getChildren().addAll(this.rsToESBTN); - hbox1 = new HBox(10.0D); - hbox1.getChildren().addAll(this.rsidToESBTN, this.rsidToESWeakBTN); - HBox hbox2 = new HBox(10.0D); - hbox2.getChildren().addAll(this.rsisaGeToESBTN, this.rsisaSpToESBTN); - vbox0.getChildren().addAll(hbox0, hbox1, hbox2); - TitledPane connectESRS = new TitledPane("Connect ES-RS", vbox0); - - this.buttonPane.add(connectESRS, 0, ri++, 2, 1); - connectESRS.setBackground(C2.AppForeground); - - vbox0 = new VBox(10.0D); - hbox0 = new HBox(10.0D); - hbox0.getChildren().addAll(this.attrKeyBTN, this.attrWeakKeyBTN); - hbox1 = new HBox(10.0D); - hbox1.getChildren().addAll(this.attrOneBTN, this.attrMultiBTN); - hbox2 = new HBox(10.0D); - hbox2.getChildren().addAll(this.attrDerivedOneBTN, this.attrDerivedMultiBTN); - vbox0.getChildren().addAll(hbox0, hbox1, hbox2); - TitledPane attributeTypes = new TitledPane("Attribute type", vbox0); - attributeTypes.setExpanded(false); - this.buttonPane.add(attributeTypes, 0, ri++, 2, 1); - attributeTypes.setBackground(C2.AppForeground); - - vbox0 = new VBox(10.0D); - hbox0 = new HBox(10.0D); - hbox0.getChildren().addAll(this.attrToESBTN, this.attrToRSBTN); - hbox1 = new HBox(10.0D); - hbox1.getChildren().addAll(this.attrToAttrBTN); - vbox0.getChildren().addAll(hbox0, hbox1); - TitledPane connectAttribute = new TitledPane("Connect Attribute", vbox0); - connectAttribute.setExpanded(false); - this.buttonPane.add(connectAttribute, 0, ri++, 2, 1); - connectAttribute.setBackground(C2.AppForeground); - this.buttonPane.add(this.generateRelationalModelCB, 0, ri++, 2, 1); - - - - - VBox box = new VBox(10.0D); - box.getChildren().addAll(this.addCurrentDateToDatabaseNameCB, this.generateInsertsCB, this.singleInsertStatementCB, this.saveSQLScriptBTN); - TitledPane createddl = new TitledPane("Create DDL", box); - createddl.setExpanded(false); - this.buttonPane.add(createddl, 0, ri++, 2, 1); - - this.statusInformation = new TextField("Creation Mode: entity-set -> press left mouse button on working area -> enter name of entity-set -> press enter key"); - this.statusInformation.setEditable(false); - this.statusInformation.setFocusTraversable(false); - - this.currentTab = addNewTab(null); - - this.borderPane = new BorderPane(); - this.borderPane.setLeft(this.buttonPane); - this.borderPane.setCenter(this.tabPane); - this.borderPane.setRight(this.treeBorderPane); - this.borderPane.setBottom(this.statusInformation); - - this.borderPane.setOnKeyPressed(arg0 -> { - if (B3.this.currentTab != null && B3.this.currentTab.canvas != null) { - B3.this.currentTab.canvas.sdfdsfd567657rrt(arg0); - } - }); - - setTitle("ER-Modeling-Chen++ -> Relational Model -> Database Creation + Data Generation ~ [jre-" + - System.getProperty("java.version") + " - " + System.getProperty("java.class.path") + "]"); - - setResizable(true); - centerOnScreen(); - - - MenuBar menuBar = new MenuBar(); - - - Menu menuFile = new Menu("_File"); - - menuFile.setMnemonicParsing(true); - - - this.menuNewMI = new MenuItem("_New model"); - this.menuNewMI.setMnemonicParsing(true); - - this.menuNewMI.addEventHandler(ActionEvent.ACTION, this.controller); - this.menuNewMI.setAccelerator( - KeyCombination.keyCombination("SHORTCUT+N")); - - this.menuRedrawMI = new MenuItem("_Redraw model"); - this.menuRedrawMI.setMnemonicParsing(true); - - this.menuRedrawMI.addEventHandler(ActionEvent.ACTION, this.controller); - this.menuRedrawMI.setAccelerator( - KeyCombination.keyCombination("SHORTCUT+R")); - - this.menuReadMI = new MenuItem("_Open model"); - - this.menuReadMI.addEventHandler(ActionEvent.ACTION, this.controller); - this.menuReadMI.setAccelerator( - KeyCombination.keyCombination("SHORTCUT+O")); - - this.menuSaveMI = new MenuItem("_Save model"); - this.menuSaveMI.addEventHandler(ActionEvent.ACTION, this.controller); - this.menuSaveMI.setAccelerator( - KeyCombination.keyCombination("SHORTCUT+S")); - - - this.menuSaveAsMI = new MenuItem("Save model as"); - - this.menuSaveAsMI.addEventHandler(ActionEvent.ACTION, this.controller); - - this.menuExportMI = new MenuItem("_Export model (png)"); - this.menuExportMI.setMnemonicParsing(true); - - this.menuExportMI.addEventHandler(ActionEvent.ACTION, this.controller); - - this.menuExitMI = new MenuItem("_Exit"); - - this.menuExitMI.addEventHandler(ActionEvent.ACTION, this.controller); - this.menuExitMI.setMnemonicParsing(true); - this.menuExitMI.setAccelerator( - KeyCombination.keyCombination("SHORTCUT+E")); - - menuFile.getItems().addAll(this.menuNewMI, new SeparatorMenuItem(), - this.menuRedrawMI, new SeparatorMenuItem(), - this.menuReadMI, this.menuSaveMI, this.menuSaveAsMI, this.menuExportMI, new SeparatorMenuItem(), - this.menuExitMI); - - Menu menuEdit = new Menu("_Edit"); - - this.menuCutMI = new MenuItem("Cut"); - this.menuCutMI.setMnemonicParsing(true); - this.menuCutMI.setAccelerator( - KeyCombination.keyCombination("SHORTCUT+X")); - - this.menuCopyMI = new MenuItem("_Copy"); - this.menuCopyMI.setMnemonicParsing(true); - this.menuCopyMI.setAccelerator( - KeyCombination.keyCombination("SHORTCUT+C")); - - this.menuCopyMI.addEventHandler(ActionEvent.ACTION, this.controller); - - this.menuPasteMI = new MenuItem("Paste"); - this.menuPasteMI.setMnemonicParsing(true); - this.menuPasteMI.setAccelerator( - KeyCombination.keyCombination("SHORTCUT+V")); - - this.menuPasteMI.addEventHandler(ActionEvent.ACTION, this.controller); - - this.menuSelectAllMI = new MenuItem("Select all"); - this.menuSelectAllMI.setMnemonicParsing(true); - this.menuSelectAllMI.setAccelerator( - KeyCombination.keyCombination("SHORTCUT+A")); - - this.menuSelectAllMI.addEventHandler(ActionEvent.ACTION, this.controller); - - this.menuUndoMI = new MenuItem("Undo"); - this.menuUndoMI.setMnemonicParsing(true); - this.menuUndoMI.setAccelerator( - KeyCombination.keyCombination("SHORTCUT+Z")); - - this.menuUndoMI.addEventHandler(ActionEvent.ACTION, this.controller); - - menuEdit.getItems().addAll(this.menuUndoMI, new SeparatorMenuItem(), this.menuCutMI, this.menuCopyMI, this.menuPasteMI, new SeparatorMenuItem(), this.menuSelectAllMI); - - Menu menuModel = new Menu("_Model"); - this.mergeModelsMI = new MenuItem("Merge models"); - this.mergeModelsMI.setOnAction(arg0 -> { - if (B3.this.generateRelationalModelCB.isSelected()) { - return; - } - - - - - - - - - - - - - - - - for (Tab tab : B3.this.tabPane.getTabs()) { - U1 runningTab = (U1)tab; - if (runningTab.getText().contains("*")) { - return; - } - } - - - - - - - - - - - - - - - ZZ30 mergedModel = new ZZ30(B3.this.thisERMViewFX); - try { - boolean merged = mergedModel.mergeAllModelsInPanes(); - if (!merged) - { - return; - - - - - - } - - - - - - } - catch (ClassNotFoundException|IOException e) { - return; - } - - - - - - - - - - - - - - - - - B3.this.currentTab = B3.this.addNewTab(null); - - for (Graphic_Main_Elem gme : mergedModel.getGraphicElements()) { - gme.setGc(B3.this.currentTab.canvas.getGraphicsContext2D()); - - gme.isVisible = true; - } - - B3.this.currentTab.canvas.dsfds124332(B3.this.currentTab.canvas.sdfsddf345ersdf()); - - B3.this.currentTab.canvas.clearERMDrawCanvas(); - B3.this.currentTab.canvas.safdsadsa65765ewthjk(mergedModel.getGraphicElements()); - B3.this.currentTab.canvas.sdfsdfds3465er(true); - - B3.this.tabPane.getSelectionModel().select(B3.this.currentTab); - - - B3.this.currentTab.canvas.dsfdsdfssdf45645re(); - }); - - - - - - this.menuVisibility = new Menu("_Visibility"); - this.menuVisibility.setDisable(true); - this.menuVisibilityAllRMI = new RadioMenuItem("All"); - this.menuVisibilityAllRMI.setSelected(true); - this.menuVisibilityAllRMI.addEventHandler(ActionEvent.ACTION, this.controller); - this.menuVisibilityES_RSRMI = new RadioMenuItem("ES + RS"); - this.menuVisibilityES_RSRMI.addEventHandler(ActionEvent.ACTION, this.controller); - this.menuVisibilityES_RS_KEYRMI = new RadioMenuItem("ES + RS + KEYS"); - this.menuVisibilityES_RS_KEYRMI.addEventHandler(ActionEvent.ACTION, this.controller); - this.menuVisibilityTEXTRMI = new RadioMenuItem("Text"); - this.menuVisibilityTEXTRMI.addEventHandler(ActionEvent.ACTION, this.controller); - this.menuVisibilityTEXTRMI.setSelected(true); - - - menuModel.getItems().addAll(this.menuVisibility, this.mergeModelsMI); - this.menuVisibility.getItems().addAll(this.menuVisibilityAllRMI, this.menuVisibilityES_RSRMI, this.menuVisibilityES_RS_KEYRMI, this.menuVisibilityTEXTRMI); - ToggleGroup tggroup = new ToggleGroup(); - tggroup.getToggles().addAll(this.menuVisibilityAllRMI, this.menuVisibilityES_RSRMI, this.menuVisibilityES_RS_KEYRMI); - - - - - Menu menuHelp = new Menu("_Help"); - this.menuVersionMI = new MenuItem("Version"); - this.menuVersionMI.addEventHandler(ActionEvent.ACTION, this.controller); - this.menuVersionMI.setOnAction(e -> { - //TODO: version popup - }); - - this.menuDownloadMI = new MenuItem("_Download"); - this.menuDownloadMI.setOnAction(e -> { - try { - URL url = new URL("https://www.actionobject.eu/"); - Desktop.getDesktop().browse(url.toURI()); - } catch (IOException | URISyntaxException e2) { - - e2.printStackTrace(); - } - }); - menuHelp.getItems().addAll(this.menuDownloadMI, this.menuVersionMI); - - - menuBar.getMenus().addAll(menuFile, menuEdit, menuModel, menuHelp); - - - vBox.getChildren().addAll(menuBar, this.borderPane); - - - Scene scene = new Scene(vBox, 1300.0D, 870.0D); - setScene(scene); - sizeToScene(); - - - getIcons().add(C2.applicationImageIconAsICO); - - - show(); - } - - - - - public void exportModel() { - FileChooser fc = new FileChooser(); - fc.setInitialDirectory(new File("/")); - fc.getExtensionFilters().add(new FileChooser.ExtensionFilter("PNG", "*.png")); - fc.setTitle("Export Map to png"); - File file = fc.showSaveDialog(this); - if (file != null) { - double[] size = this.currentTab.canvas.dssfsdfd43643634(); - WritableImage wi = new WritableImage((int)size[0], (int)size[1]); try { - SnapshotParameters sp = new SnapshotParameters(); - sp.setFill(Paint.valueOf("rgb(27, 27, 30)")); - ImageIO.write(SwingFXUtils.fromFXImage(this.currentTab.canvas.snapshot(sp, wi), null), "png", file); - } catch (IOException e) { - e.printStackTrace(); - } - } - } - - - - - public boolean saveModelAs() { - if (this.currentTab == null || this.currentTab.canvas == null) return false; - - FileChooser fc = new FileChooser(); - fc.setInitialDirectory(new File(System.getProperty("user.home"))); - - String tabname = this.currentTab.getText(); - tabname = tabname.replace("*", ""); - fc.setInitialFileName(tabname); - fc.getExtensionFilters().add(new FileChooser.ExtensionFilter("ERM", "*.erm")); - fc.setTitle("Save model as ..."); - File file = fc.showSaveDialog(this); - if (file != null) { - this.currentTab.canvas.setInitialDirectory(file.getParentFile().getAbsolutePath()); - try { - ObjectOutputStream wo = new ObjectOutputStream(new FileOutputStream(file)); - wo.writeObject(this.currentTab.canvas.sddsfsfsdf45645645()); - wo.close(); - - this.currentTab.canvas.setSaveFile(file); - - String databaseName = file.getName().replace(".erm", "") + "db"; - this.currentTab.canvas.dsfdsfd45645zr().setDatabaseName(databaseName); - this.currentTab.setText(file.getName()); - return true; - } catch (IOException e) { - - - return false; - } - } - return false; - } - - - - - - - public void saveSQLScript() throws ZZ20 { - if (this.currentTab == null || this.currentTab.canvas == null) - return; - FileChooser fc = new FileChooser(); - fc.setInitialDirectory(new File(System.getProperty("user.home"))); - - LocalDate today = LocalDate.now(); - String currentDate = ""; - if (this.addCurrentDateToDatabaseNameCB.isSelected()) - { - currentDate = today.getYear() + ((today.getMonthValue() < 10) ? ("0" + today.getMonthValue()) : ""+ today.getMonthValue()) + ((today.getDayOfMonth() < 10) ? ("0" + today.getDayOfMonth()) : ""+ today.getDayOfMonth()); } - fc.setInitialFileName(currentDate + this.currentTab.canvas.dsfdsfd45645zr().getDatabaseName()); - fc.getExtensionFilters().add(new FileChooser.ExtensionFilter("*.SQL", "*.sql")); - fc.setTitle("Save sql script as ..."); - final File file = fc.showSaveDialog(this); - - if (file != null) { - - this.progress = new V1(this); - - Thread t = new Thread(() -> { - FileWriter fw = null; - try { - B3.this.borderPane.setDisable(true); - - fw = new FileWriter(file); - - StringBuffer sb = null; - - - if (B3.this.mySqlStyle.isSelected()) { sb = B3.this.currentTab.canvas.dsfdsfd45645zr().create_MySQL_Script(B3.this.generateInsertsCB.isSelected(), - B3.this.addCurrentDateToDatabaseNameCB.isSelected(), - B3.this.singleInsertStatementCB.isSelected()); } - - else if (B3.this.msSqlStyle.isSelected()) { sb = B3.this.currentTab.canvas.dsfdsfd45645zr().create_MS_SQL_Script(B3.this.generateInsertsCB.isSelected(), - B3.this.addCurrentDateToDatabaseNameCB.isSelected(), - B3.this.singleInsertStatementCB.isSelected()); } - - assert sb != null; - fw.write(sb.toString()); - fw.close(); - - Thread.sleep(2000L); - } - catch (IOException|ZZ20|InterruptedException ex) { - - try { if (fw != null) fw.close(); } catch (IOException ignored) {} - } - - Platform.runLater(() -> { - B3.this.progress.close(); - B3.this.progress = null; - }); - }); - this.progress.setThread(t); - try { t.join(); } catch (InterruptedException ignored) {} - - this.borderPane.setDisable(false); - } - - - - String databaseName = this.currentTab.getText().replace(".erm", "") + "db"; - this.currentTab.canvas.dsfdsfd45645zr().setDatabaseName(databaseName); - } - - public void saveModel() { - if (this.currentTab == null || this.currentTab.canvas == null) - return; - if (this.currentTab.canvas.getSaveFile() == null) { - boolean done = saveModelAs(); - if (done) { - String tabname = this.currentTab.getText(); tabname = tabname.replace("*", ""); - this.currentTab.setText(tabname); - } - return; - } - try { - this.currentTab.canvas.setInitialDirectory(this.currentTab.canvas.getSaveFile().getParentFile().getAbsolutePath()); - ObjectOutputStream wo = new ObjectOutputStream(new FileOutputStream(this.currentTab.canvas.getSaveFile())); - wo.writeObject(this.currentTab.canvas.sddsfsfsdf45645645()); - wo.close(); - - String tabname = this.currentTab.getText(); - tabname = tabname.replace("*", ""); - this.currentTab.setText(tabname); - } catch (IOException e) { - - e.printStackTrace(); - } - } + fc.setInitialFileName(tabname); + fc.getExtensionFilters().add(new FileChooser.ExtensionFilter("ERM", "*.erm")); + fc.setTitle("Save model as ..."); + File file = fc.showSaveDialog(this); + if (file != null) { + this.currentTab.canvas.setInitialDirectory(file.getParentFile().getAbsolutePath()); + try { + ObjectOutputStream wo = new ObjectOutputStream(new FileOutputStream(file)); + wo.writeObject(this.currentTab.canvas.sddsfsfsdf45645645()); + wo.close(); + + this.currentTab.canvas.setSaveFile(file); + + String databaseName = file.getName().replace(".erm", "") + "db"; + this.currentTab.canvas.dsfdsfd45645zr().setDatabaseName(databaseName); + this.currentTab.setText(file.getName()); + return true; + } catch (IOException e) { + return false; + } + } + return false; + } + public void saveSQLScript() throws ZZ20 { + if (this.currentTab == null || this.currentTab.canvas == null) + return; + FileChooser fc = new FileChooser(); + fc.setInitialDirectory(new File(System.getProperty("user.home"))); - - public void readModel() { - FileChooser fc = new FileChooser(); - - if (this.currentTab != null && this.currentTab.canvas != null && this.currentTab.canvas.getInitialDirectory() != null) { fc.setInitialDirectory(new File(this.currentTab.canvas.getSaveFile().getParentFile().getAbsolutePath())); } - else { fc.setInitialDirectory(new File("/")); } - fc.getExtensionFilters().add(new FileChooser.ExtensionFilter("ERM", "*.erm")); - fc.setTitle("Open model"); - File file = fc.showOpenDialog(this); - if (file != null) { - - this.graphicElemLV.getItems().clear(); - - this.currentTab = addNewTab(file); - this.currentTab.canvas.setInitialDirectory(file.getParentFile().getAbsolutePath()); - try { - ObjectInputStream ro = new ObjectInputStream(new FileInputStream(file)); - @SuppressWarnings("unchecked") ArrayList readModel = (ArrayList)ro.readObject(); + LocalDate today = LocalDate.now(); + String currentDate = ""; + if (this.addCurrentDateToDatabaseNameCB.isSelected()) { + currentDate = today.getYear() + ((today.getMonthValue() < 10) ? ("0" + today.getMonthValue()) : "" + today.getMonthValue()) + ((today.getDayOfMonth() < 10) ? ("0" + today.getDayOfMonth()) : "" + today.getDayOfMonth()); + } + fc.setInitialFileName(currentDate + this.currentTab.canvas.dsfdsfd45645zr().getDatabaseName()); + fc.getExtensionFilters().add(new FileChooser.ExtensionFilter("*.SQL", "*.sql")); + fc.setTitle("Save sql script as ..."); + final File file = fc.showSaveDialog(this); - - for (Graphic_Main_Elem gme : readModel) { - gme.setGc(this.currentTab.canvas.getGraphicsContext2D()); - - gme.isVisible = true; - } - - this.currentTab.canvas.dsfds124332(this.currentTab.canvas.sdfsddf345ersdf()); - - this.currentTab.canvas.clearERMDrawCanvas(); - this.currentTab.canvas.safdsadsa65765ewthjk(readModel); - this.currentTab.canvas.sdfsdfds3465er(true); + if (file != null) { + + this.progress = new V1(this); + + Thread t = new Thread(() -> { + FileWriter fw = null; + try { + B3.this.borderPane.setDisable(true); + + fw = new FileWriter(file); + + StringBuffer sb = null; + if (B3.this.mySqlStyle.isSelected()) { + sb = B3.this.currentTab.canvas.dsfdsfd45645zr().create_MySQL_Script(B3.this.generateInsertsCB.isSelected(), + B3.this.addCurrentDateToDatabaseNameCB.isSelected(), + B3.this.singleInsertStatementCB.isSelected()); + } else if (B3.this.msSqlStyle.isSelected()) { + sb = B3.this.currentTab.canvas.dsfdsfd45645zr().create_MS_SQL_Script(B3.this.generateInsertsCB.isSelected(), + B3.this.addCurrentDateToDatabaseNameCB.isSelected(), + B3.this.singleInsertStatementCB.isSelected()); + } - - this.currentTab.canvas.setSaveFile(file); - this.currentTab.setText(file.getName()); - this.tabPane.getSelectionModel().select(this.currentTab); + assert sb != null; + fw.write(sb.toString()); + fw.close(); - - this.currentTab.canvas.dsfdsdfssdf45645re(); - - ro.close(); - } catch (IOException | ClassNotFoundException e) { - - e.printStackTrace(); - } - } + Thread.sleep(2000L); + } catch (IOException | ZZ20 | InterruptedException ex) { - - this.selectModeBTN.setSelected(true); - this.creationModelabel.setStyle("-fx-text-fill:white"); - this.selectModeBTN.setStyle("-fx-text-fill:red"); - - this.menuVisibility.setDisable(false); - } + try { + if (fw != null) fw.close(); + } catch (IOException ignored) { + } + } + + Platform.runLater(() -> { + B3.this.progress.close(); + B3.this.progress = null; + }); + }); + this.progress.setThread(t); + try { + t.join(); + } catch (InterruptedException ignored) { + } + + this.borderPane.setDisable(false); + } + + + String databaseName = this.currentTab.getText().replace(".erm", "") + "db"; + this.currentTab.canvas.dsfdsfd45645zr().setDatabaseName(databaseName); + } + + public void saveModel() { + if (this.currentTab == null || this.currentTab.canvas == null) + return; + if (this.currentTab.canvas.getSaveFile() == null) { + boolean done = saveModelAs(); + if (done) { + + String tabname = this.currentTab.getText(); + tabname = tabname.replace("*", ""); + this.currentTab.setText(tabname); + } + return; + } + try { + this.currentTab.canvas.setInitialDirectory(this.currentTab.canvas.getSaveFile().getParentFile().getAbsolutePath()); + ObjectOutputStream wo = new ObjectOutputStream(new FileOutputStream(this.currentTab.canvas.getSaveFile())); + wo.writeObject(this.currentTab.canvas.sddsfsfsdf45645645()); + wo.close(); + + String tabname = this.currentTab.getText(); + tabname = tabname.replace("*", ""); + this.currentTab.setText(tabname); + } catch (IOException e) { + + e.printStackTrace(); + } + } + + + public void readModel() { + FileChooser fc = new FileChooser(); + + if (this.currentTab != null && this.currentTab.canvas != null && this.currentTab.canvas.getInitialDirectory() != null) { + fc.setInitialDirectory(new File(this.currentTab.canvas.getSaveFile().getParentFile().getAbsolutePath())); + } else { + fc.setInitialDirectory(new File("/")); + } + fc.getExtensionFilters().add(new FileChooser.ExtensionFilter("ERM", "*.erm")); + fc.setTitle("Open model"); + File file = fc.showOpenDialog(this); + if (file != null) { + + this.graphicElemLV.getItems().clear(); + + this.currentTab = addNewTab(file); + this.currentTab.canvas.setInitialDirectory(file.getParentFile().getAbsolutePath()); + try { + ObjectInputStream ro = new ObjectInputStream(new FileInputStream(file)); + @SuppressWarnings("unchecked") ArrayList readModel = (ArrayList) ro.readObject(); + + + for (Graphic_Main_Elem gme : readModel) { + gme.setGc(this.currentTab.canvas.getGraphicsContext2D()); + + gme.isVisible = true; + } + + this.currentTab.canvas.dsfds124332(this.currentTab.canvas.sdfsddf345ersdf()); + + this.currentTab.canvas.clearERMDrawCanvas(); + this.currentTab.canvas.safdsadsa65765ewthjk(readModel); + this.currentTab.canvas.sdfsdfds3465er(true); + + + this.currentTab.canvas.setSaveFile(file); + this.currentTab.setText(file.getName()); + this.tabPane.getSelectionModel().select(this.currentTab); + + + this.currentTab.canvas.dsfdsdfssdf45645re(); + + ro.close(); + } catch (IOException | ClassNotFoundException e) { + + e.printStackTrace(); + } + } + + + this.selectModeBTN.setSelected(true); + this.creationModelabel.setStyle("-fx-text-fill:white"); + this.selectModeBTN.setStyle("-fx-text-fill:red"); + + this.menuVisibility.setDisable(false); + } public U1 getCurrentTab() { - return this.currentTab; - } + return this.currentTab; + } - - - public void setCurrentTab(U1 currentTab) { - this.currentTab = currentTab; - } + public void setCurrentTab(U1 currentTab) { + this.currentTab = currentTab; + } + public U1 addNewTab(File modelFromFile) { + int number = this.tabPane.getTabs().size(); + + U1 currentTab = new U1(this, "erm" + number + ".erm", modelFromFile); + this.tabPane.getTabs().add(currentTab); + return currentTab; + } - - public U1 addNewTab(File modelFromFile) { - int number = this.tabPane.getTabs().size(); - - U1 currentTab = new U1(this, "erm" + number + ".erm", modelFromFile); - this.tabPane.getTabs().add(currentTab); - return currentTab; - } + public ArrayList getToCopyElements() { + return this.toCopyElements; + } - - - public ArrayList getToCopyElements() { - return this.toCopyElements; - } + public void setToCopyElements(ArrayList toCopyElements) { + this.toCopyElements = toCopyElements; + } - - - public void setToCopyElements(ArrayList toCopyElements) { - this.toCopyElements = toCopyElements; - } - - - - - - - private void setMouseHandler(final Labeled node) { + private void setMouseHandler(final Labeled node) { node.setOnMouseEntered(event -> { - B3.this.getScene().getRoot().setCursor(Cursor.HAND); - if (node.getGraphic() != null) - T3.asdasda345435ertretr(node.getGraphic(), 1.4D, 1.1D, 0.4D, 0.3D, 0.4D, -0.2D); - T3.fdssdf4354(node, C2.MouseSelectedColor); - }); - + B3.this.getScene().getRoot().setCursor(Cursor.HAND); + if (node.getGraphic() != null) + T3.asdasda345435ertretr(node.getGraphic(), 1.4D, 1.1D, 0.4D, 0.3D, 0.4D, -0.2D); + T3.fdssdf4354(node, C2.MouseSelectedColor); + }); + node.setOnMouseExited(event -> { - B3.this.getScene().getRoot().setCursor(Cursor.DEFAULT); - if (node.getGraphic() != null) - T3.buttonMouseExited(node.getGraphic()); - node.setEffect(null); - }); - } + B3.this.getScene().getRoot().setCursor(Cursor.DEFAULT); + if (node.getGraphic() != null) + T3.buttonMouseExited(node.getGraphic()); + node.setEffect(null); + }); + } } diff --git a/at/fos/ermodel/gui/C1.java b/at/fos/ermodel/gui/C1.java index 1b42129..0487cb1 100644 --- a/at/fos/ermodel/gui/C1.java +++ b/at/fos/ermodel/gui/C1.java @@ -1,157 +1,141 @@ - package at.fos.ermodel.gui; +package at.fos.ermodel.gui; - import javafx.event.Event; - import javafx.geometry.Insets; - import javafx.scene.Cursor; - import javafx.scene.control.Alert; - import javafx.scene.control.Button; - import javafx.scene.control.ButtonType; - import javafx.scene.control.Label; - import javafx.scene.image.Image; - import javafx.scene.layout.Background; - import javafx.scene.layout.BackgroundFill; - import javafx.scene.layout.CornerRadii; - import javafx.scene.layout.StackPane; - import javafx.scene.paint.Color; - import javafx.stage.Stage; - import javafx.stage.StageStyle; - import javafx.stage.Window; - import java.util.Optional; - - public class C1 - { - private Optional result; +import javafx.event.Event; +import javafx.geometry.Insets; +import javafx.scene.Cursor; +import javafx.scene.control.Alert; +import javafx.scene.control.Button; +import javafx.scene.control.ButtonType; +import javafx.scene.control.Label; +import javafx.scene.image.Image; +import javafx.scene.layout.Background; +import javafx.scene.layout.BackgroundFill; +import javafx.scene.layout.CornerRadii; +import javafx.scene.layout.StackPane; +import javafx.scene.paint.Color; +import javafx.stage.Stage; +import javafx.stage.StageStyle; +import javafx.stage.Window; - public C1(Window window, Alert.AlertType alertType, String title, String header, String contentText, Boolean showAndWait, Image image, String okBtnText, String cancelBtnText, Color btnBackgroundColor, Color btnSelectedColor, Color btnFocusColor) { - Alert alert = setAlert(window, alertType, title, header, contentText, image); +import java.util.Optional; - Button button = (Button)alert.getDialogPane().lookupButton(ButtonType.OK); - if (button != null) { - setButtonLookAndFeel(button, okBtnText, btnBackgroundColor, btnSelectedColor, btnFocusColor); - } - - button = (Button)alert.getDialogPane().lookupButton(ButtonType.CANCEL); - if (button != null) setButtonLookAndFeel(button, cancelBtnText, btnBackgroundColor, btnSelectedColor, btnFocusColor); - - button = (Button)alert.getDialogPane().lookupButton(ButtonType.APPLY); - if (button != null) setButtonLookAndFeel(button, null, btnBackgroundColor, btnSelectedColor, btnFocusColor); - - button = (Button)alert.getDialogPane().lookupButton(ButtonType.CLOSE); - if (button != null) setButtonLookAndFeel(button, null, btnBackgroundColor, btnSelectedColor, btnFocusColor); - - button = (Button)alert.getDialogPane().lookupButton(ButtonType.FINISH); - if (button != null) setButtonLookAndFeel(button, null, btnBackgroundColor, btnSelectedColor, btnFocusColor); - - button = (Button)alert.getDialogPane().lookupButton(ButtonType.NEXT); - if (button != null) setButtonLookAndFeel(button, null, btnBackgroundColor, btnSelectedColor, btnFocusColor); - - button = (Button)alert.getDialogPane().lookupButton(ButtonType.NO); - if (button != null) setButtonLookAndFeel(button, null, btnBackgroundColor, btnSelectedColor, btnFocusColor); - - button = (Button)alert.getDialogPane().lookupButton(ButtonType.PREVIOUS); - if (button != null) setButtonLookAndFeel(button, null, btnBackgroundColor, btnSelectedColor, btnFocusColor); - - button = (Button)alert.getDialogPane().lookupButton(ButtonType.YES); - if (button != null) setButtonLookAndFeel(button, null, btnBackgroundColor, btnSelectedColor, btnFocusColor); - - if (showAndWait) { - this.result = alert.showAndWait(); - } else { - alert.show(); - } - } +public class C1 { + private Optional result; - private void setButtonLookAndFeel(final Button button, String buttonText, Color btnBackgroundColor, final Color btnSelectedColor, final Color btnFocusColor) { - button.setBackground(new Background(new BackgroundFill(btnBackgroundColor, new CornerRadii(5.0D), Insets.EMPTY))); - button.setOnMouseEntered(event -> { - button.getScene().getRoot().setCursor(Cursor.HAND); - T3.fdssdf4354(button, btnSelectedColor); - }); - button.setOnMouseExited(event -> { - button.getScene().getRoot().setCursor(Cursor.DEFAULT); - button.setEffect(null); - if (button.isFocused()) { - T3.fdssdf4354(button, btnFocusColor); - } else { + public C1(Window window, Alert.AlertType alertType, String title, String header, String contentText, Boolean showAndWait, Image image, String okBtnText, String cancelBtnText, Color btnBackgroundColor, Color btnSelectedColor, Color btnFocusColor) { + Alert alert = setAlert(window, alertType, title, header, contentText, image); - button.setEffect(null); - } - }); - button.focusedProperty().addListener((obs, oldVal, newVal) -> { - if (button.isFocused()) { - T3.fdssdf4354(button, btnSelectedColor); - } else { - button.setEffect(null); - } - }); - - - if (buttonText != null) button.setText(buttonText); - - } - - - - - - - - - - - - - - - private Alert setAlert(Window window, Alert.AlertType alertType, String title, String header, String contentText, Image image) { - Alert alert = new Alert(alertType); - alert.setTitle(title); - alert.setHeaderText(header); - alert.setContentText(contentText); - alert.initOwner(window); - alert.initStyle(StageStyle.DECORATED); - - - StackPane iv = switch (alertType) { - case ERROR -> - C2.alerterror; - case INFORMATION -> - C2.alertinformation; - default -> - C2.alertconfirmation; - }; - alert.setGraphic(iv); - - alert.getDialogPane().getChildren().stream().filter(node -> node instanceof Label).forEach(node -> ((Label)node).setMinHeight(Double.NEGATIVE_INFINITY)); - alert.getDialogPane().getChildren().stream().filter(node -> node instanceof Label).forEach(node -> ((Label)node).setMinWidth(Double.NEGATIVE_INFINITY)); - alert.getDialogPane().getChildren().stream().filter(node -> node instanceof Label).forEach(node -> ((Label)node).setMaxWidth(Double.NEGATIVE_INFINITY)); - - alert.getDialogPane().setBackground(new Background(new BackgroundFill(Color.GAINSBORO, CornerRadii.EMPTY, Insets.EMPTY))); - - Stage stage = (Stage)alert.getDialogPane().getScene().getWindow(); - - - if (image != null) { - stage.getIcons().add(image); - } - - - stage.setOnCloseRequest(Event::consume); - - - stage.centerOnScreen(); - - stage.setAlwaysOnTop(true); - - return alert; - } - - - - - public Optional getResult() { - return this.result; - } - } + Button button = (Button) alert.getDialogPane().lookupButton(ButtonType.OK); + if (button != null) { + setButtonLookAndFeel(button, okBtnText, btnBackgroundColor, btnSelectedColor, btnFocusColor); + } + + button = (Button) alert.getDialogPane().lookupButton(ButtonType.CANCEL); + if (button != null) + setButtonLookAndFeel(button, cancelBtnText, btnBackgroundColor, btnSelectedColor, btnFocusColor); + + button = (Button) alert.getDialogPane().lookupButton(ButtonType.APPLY); + if (button != null) setButtonLookAndFeel(button, null, btnBackgroundColor, btnSelectedColor, btnFocusColor); + + button = (Button) alert.getDialogPane().lookupButton(ButtonType.CLOSE); + if (button != null) setButtonLookAndFeel(button, null, btnBackgroundColor, btnSelectedColor, btnFocusColor); + + button = (Button) alert.getDialogPane().lookupButton(ButtonType.FINISH); + if (button != null) setButtonLookAndFeel(button, null, btnBackgroundColor, btnSelectedColor, btnFocusColor); + + button = (Button) alert.getDialogPane().lookupButton(ButtonType.NEXT); + if (button != null) setButtonLookAndFeel(button, null, btnBackgroundColor, btnSelectedColor, btnFocusColor); + + button = (Button) alert.getDialogPane().lookupButton(ButtonType.NO); + if (button != null) setButtonLookAndFeel(button, null, btnBackgroundColor, btnSelectedColor, btnFocusColor); + + button = (Button) alert.getDialogPane().lookupButton(ButtonType.PREVIOUS); + if (button != null) setButtonLookAndFeel(button, null, btnBackgroundColor, btnSelectedColor, btnFocusColor); + + button = (Button) alert.getDialogPane().lookupButton(ButtonType.YES); + if (button != null) setButtonLookAndFeel(button, null, btnBackgroundColor, btnSelectedColor, btnFocusColor); + + if (showAndWait) { + this.result = alert.showAndWait(); + } else { + alert.show(); + } + } + + private void setButtonLookAndFeel(final Button button, String buttonText, Color btnBackgroundColor, final Color btnSelectedColor, final Color btnFocusColor) { + button.setBackground(new Background(new BackgroundFill(btnBackgroundColor, new CornerRadii(5.0D), Insets.EMPTY))); + button.setOnMouseEntered(event -> { + button.getScene().getRoot().setCursor(Cursor.HAND); + T3.fdssdf4354(button, btnSelectedColor); + }); + button.setOnMouseExited(event -> { + button.getScene().getRoot().setCursor(Cursor.DEFAULT); + button.setEffect(null); + if (button.isFocused()) { + T3.fdssdf4354(button, btnFocusColor); + } else { + + button.setEffect(null); + } + }); + button.focusedProperty().addListener((obs, oldVal, newVal) -> { + if (button.isFocused()) { + T3.fdssdf4354(button, btnSelectedColor); + } else { + button.setEffect(null); + } + }); + + + if (buttonText != null) button.setText(buttonText); + + } + + + private Alert setAlert(Window window, Alert.AlertType alertType, String title, String header, String contentText, Image image) { + Alert alert = new Alert(alertType); + alert.setTitle(title); + alert.setHeaderText(header); + alert.setContentText(contentText); + alert.initOwner(window); + alert.initStyle(StageStyle.DECORATED); + + + StackPane iv = switch (alertType) { + case ERROR -> C2.alerterror; + case INFORMATION -> C2.alertinformation; + default -> C2.alertconfirmation; + }; + alert.setGraphic(iv); + + alert.getDialogPane().getChildren().stream().filter(node -> node instanceof Label).forEach(node -> ((Label) node).setMinHeight(Double.NEGATIVE_INFINITY)); + alert.getDialogPane().getChildren().stream().filter(node -> node instanceof Label).forEach(node -> ((Label) node).setMinWidth(Double.NEGATIVE_INFINITY)); + alert.getDialogPane().getChildren().stream().filter(node -> node instanceof Label).forEach(node -> ((Label) node).setMaxWidth(Double.NEGATIVE_INFINITY)); + + alert.getDialogPane().setBackground(new Background(new BackgroundFill(Color.GAINSBORO, CornerRadii.EMPTY, Insets.EMPTY))); + + Stage stage = (Stage) alert.getDialogPane().getScene().getWindow(); + + + if (image != null) { + stage.getIcons().add(image); + } + + + stage.setOnCloseRequest(Event::consume); + + + stage.centerOnScreen(); + + stage.setAlwaysOnTop(true); + + return alert; + } + + + public Optional getResult() { + return this.result; + } +} diff --git a/at/fos/ermodel/gui/C2.java b/at/fos/ermodel/gui/C2.java index e6ee184..72ac99c 100644 --- a/at/fos/ermodel/gui/C2.java +++ b/at/fos/ermodel/gui/C2.java @@ -1,170 +1,166 @@ - package at.fos.ermodel.gui; - - import java.io.BufferedReader; - import java.io.InputStream; - import java.util.HashMap; - import java.util.Objects; +package at.fos.ermodel.gui; - import javafx.geometry.Insets; - import javafx.scene.image.Image; - import javafx.scene.layout.Background; - import javafx.scene.layout.BackgroundFill; - import javafx.scene.layout.CornerRadii; - import javafx.scene.layout.StackPane; - import javafx.scene.paint.Color; - import javafx.scene.text.Font; - import javafx.scene.text.FontWeight; - import javafx.scene.text.Text; - - public class C2 - { - public static final Color MouseSelectedColor = Color.RED; - public static final Color FocusOnComponentColor = Color.BLUE; - public static final Color ButtonBackgroundColor = Color.rgb(179,179,179); - - public static final Color ERMDockablePointColor = Color.rgb(236, 234, 241); - public static final Color ERMTextBorderColor = Color.GREY; - - public static Font ERMFont = Font.font(null, FontWeight.BOLD, 12.0D); - public static Color ERMBackgroundColor = Color.rgb(27, 27, 30); - public static Color ERMForegroundColor = Color.rgb(48, 48, 52); +import javafx.geometry.Insets; +import javafx.scene.image.Image; +import javafx.scene.layout.Background; +import javafx.scene.layout.BackgroundFill; +import javafx.scene.layout.CornerRadii; +import javafx.scene.layout.StackPane; +import javafx.scene.paint.Color; +import javafx.scene.text.Font; +import javafx.scene.text.FontWeight; +import javafx.scene.text.Text; - public static Color ERMTextColor = Color.rgb(236, 234, 241); +import java.io.BufferedReader; +import java.io.InputStream; +import java.util.HashMap; +import java.util.Objects; - public static Background AppBackground = new Background(new BackgroundFill(C2.ERMBackgroundColor, CornerRadii.EMPTY, Insets.EMPTY)); - public static Background AppForeground = new Background(new BackgroundFill(C2.ERMForegroundColor, CornerRadii.EMPTY, Insets.EMPTY)); +public class C2 { + public static final Color MouseSelectedColor = Color.RED; + public static final Color FocusOnComponentColor = Color.BLUE; + public static final Color ButtonBackgroundColor = Color.rgb(179, 179, 179); + + public static final Color ERMDockablePointColor = Color.rgb(236, 234, 241); + public static final Color ERMTextBorderColor = Color.GREY; + + public static Font ERMFont = Font.font(null, FontWeight.BOLD, 12.0D); + public static Color ERMBackgroundColor = Color.rgb(27, 27, 30); + public static Color ERMForegroundColor = Color.rgb(48, 48, 52); + + public static Color ERMTextColor = Color.rgb(236, 234, 241); + + public static Background AppBackground = new Background(new BackgroundFill(C2.ERMBackgroundColor, CornerRadii.EMPTY, Insets.EMPTY)); + public static Background AppForeground = new Background(new BackgroundFill(C2.ERMForegroundColor, CornerRadii.EMPTY, Insets.EMPTY)); - public static StackPane alerterror = new StackPane(); - public static StackPane alertconfirmation = new StackPane(); - public static StackPane alertinformation = new StackPane(); + public static StackPane alerterror = new StackPane(); + public static StackPane alertconfirmation = new StackPane(); + public static StackPane alertinformation = new StackPane(); - public static Color ERMSelectedColor = Color.RED; - - public static Color ERMESColor = Color.rgb(0,255,0); + public static Color ERMSelectedColor = Color.RED; - public static Color ERMRSColor = Color.AQUA; - public static Color ERMRSConnColor = Color.AQUA; - - public static Color ERMRSISAColor = Color.BLUEVIOLET; - public static Color ERMISAConnGENERAL = Color.BLUEVIOLET; - public static Color ERMISAConnSPEC = Color.AQUA; + public static Color ERMESColor = Color.rgb(0, 255, 0); - public static Color ERMATTRColor = Color.GREENYELLOW; + public static Color ERMRSColor = Color.AQUA; + public static Color ERMRSConnColor = Color.AQUA; - public static Color ERMLINEColor = Color.CHARTREUSE; - - public static Color TEMPLINEColor = Color.PALEGREEN; - - - public static Image applicationImageIconAsICO; - - - public static int imageWidth = 55; - public static int imageHeight = 32; - - public static Image treeCloseImage; - - public static Image treeOpenImage; - - public static Image attr_conn_attrImage; - public static Image attr_conn_esImage; - public static Image attr_conn_rsImage; - public static Image attr_derived_multi_valueImage; - public static Image attr_derived_one_valueImage; - public static Image attr_key_valueImage; - public static Image attr_multi_valueImage; - public static Image attr_one_valueImage; - public static Image attr_weak_key_valueImage; - public static Image es_associativeImage; - public static Image es_weakImage; - public static Image esImage; - public static Image rs_conn_esImage; - public static Image rs_id_conn_es_weakImage; - public static Image rs_id_conn_esImage; - public static Image rs_idImage; - public static Image rs_isa_conn_general_esImage; - public static Image rs_isa_conn_special_esImage; - public static Image rs_isaImage; - public static Image rsImage; - public static Image textImage; - public static Image textWithoutBorderImage; - public static HashMap randomDataFiles = new HashMap<>(); - public static HashMap randomDataFilesExtern = new HashMap<>(); - - - - - - public C2() { + public static Color ERMRSISAColor = Color.BLUEVIOLET; + public static Color ERMISAConnGENERAL = Color.BLUEVIOLET; + public static Color ERMISAConnSPEC = Color.AQUA; - alerterror.getStyleClass().add("alert.error.dialog-pane"); - alertinformation.getStyleClass().add("alert.error.dialog-pane"); - alertconfirmation.getStyleClass().add("alert.error.dialog-pane"); + public static Color ERMATTRColor = Color.GREENYELLOW; + + public static Color ERMLINEColor = Color.CHARTREUSE; + + public static Color TEMPLINEColor = Color.PALEGREEN; - String appImages = "/applicationimages/"; - String appData = "/data/"; + public static Image applicationImageIconAsICO; - randomDataFiles.put("Random Color", getClass().getResourceAsStream(appData+"colors.txt")); - randomDataFiles.put("Random Company", getClass().getResourceAsStream(appData+"companies.txt")); - randomDataFiles.put("Random Country", getClass().getResourceAsStream(appData+"countries.txt")); - randomDataFiles.put("Random Departmentname", getClass().getResourceAsStream(appData+"departmentnames.txt")); - randomDataFiles.put("Random Firstname", getClass().getResourceAsStream(appData+"firstnames.txt")); - randomDataFiles.put("Random Jobname", getClass().getResourceAsStream(appData+"jobnames.txt")); - randomDataFiles.put("Random Language", getClass().getResourceAsStream(appData+"languages.txt")); - randomDataFiles.put("Random Lastname", getClass().getResourceAsStream(appData+"lastnames.txt")); - randomDataFiles.put("Random Mediacategory", getClass().getResourceAsStream(appData+"mediacategories.txt")); - randomDataFiles.put("Random Mediapublisher", getClass().getResourceAsStream(appData+"mediapublishers.txt")); - randomDataFiles.put("Random Mediatitle", getClass().getResourceAsStream(appData+"mediatitles.txt")); - randomDataFiles.put("Random Mediatype", getClass().getResourceAsStream(appData+"mediatypes.txt")); - randomDataFiles.put("Random Place", getClass().getResourceAsStream(appData+"places.txt")); - randomDataFiles.put("Random Profession", getClass().getResourceAsStream(appData+"professions.txt")); - randomDataFiles.put("Random Rentalequipment", getClass().getResourceAsStream(appData+"rentalequipment.txt")); - randomDataFiles.put("Random Street", getClass().getResourceAsStream(appData+"streets.txt")); - - applicationImageIconAsICO = new Image(Objects.requireNonNull(getClass().getResourceAsStream(appImages+"erdlogo.png"))); - attr_conn_attrImage = new Image(Objects.requireNonNull(getClass().getResourceAsStream(appImages+"attr_conn_attr.png"))); - attr_conn_esImage = new Image(Objects.requireNonNull(getClass().getResourceAsStream(appImages+"attr_conn_es.png"))); - attr_conn_rsImage = new Image(Objects.requireNonNull(getClass().getResourceAsStream(appImages+"attr_conn_rs.png"))); - attr_derived_multi_valueImage = new Image(Objects.requireNonNull(getClass().getResourceAsStream(appImages+"attr_derived_multi_value.png"))); - attr_derived_one_valueImage = new Image(Objects.requireNonNull(getClass().getResourceAsStream(appImages+"attr_derived_one_value.png"))); - attr_key_valueImage = new Image(Objects.requireNonNull(getClass().getResourceAsStream(appImages+"attr_key_value.png"))); - attr_multi_valueImage = new Image(Objects.requireNonNull(getClass().getResourceAsStream(appImages+"attr_multi_value.png"))); - attr_one_valueImage = new Image(Objects.requireNonNull(getClass().getResourceAsStream(appImages+"attr_one_value.png"))); - attr_weak_key_valueImage = new Image(Objects.requireNonNull(getClass().getResourceAsStream(appImages+"attr_weak_key_value.png"))); - es_associativeImage = new Image(Objects.requireNonNull(getClass().getResourceAsStream(appImages+"es_associative.png"))); - es_weakImage = new Image(Objects.requireNonNull(getClass().getResourceAsStream(appImages+"es_weak.png"))); - esImage = new Image(Objects.requireNonNull(getClass().getResourceAsStream(appImages+"es.png"))); - rs_conn_esImage = new Image(Objects.requireNonNull(getClass().getResourceAsStream(appImages+"rs_conn_es.png"))); - rs_id_conn_es_weakImage = new Image(Objects.requireNonNull(getClass().getResourceAsStream(appImages+"rs_id_conn_es_weak.png"))); - rs_id_conn_esImage = new Image(Objects.requireNonNull(getClass().getResourceAsStream(appImages+"rs_id_conn_es.png"))); - rs_idImage = new Image(Objects.requireNonNull(getClass().getResourceAsStream(appImages+"rs_id.png"))); - rs_isa_conn_general_esImage = new Image(Objects.requireNonNull(getClass().getResourceAsStream(appImages+"rs_isa_conn_general_es.png"))); - rs_isa_conn_special_esImage = new Image(Objects.requireNonNull(getClass().getResourceAsStream(appImages+"rs_isa_conn_special_es.png"))); - rs_isaImage = new Image(Objects.requireNonNull(getClass().getResourceAsStream(appImages+"rs_isa.png"))); - rsImage = new Image(Objects.requireNonNull(getClass().getResourceAsStream(appImages+"rs.png"))); - textImage = new Image(Objects.requireNonNull(getClass().getResourceAsStream(appImages+"text.png"))); - textWithoutBorderImage = new Image(Objects.requireNonNull(getClass().getResourceAsStream(appImages+"text_without_border.png"))); - treeOpenImage = new Image(Objects.requireNonNull(getClass().getResourceAsStream(appImages+"tree_open.png"))); - treeCloseImage = new Image(Objects.requireNonNull(getClass().getResourceAsStream(appImages+"tree_close.png"))); - } + public static int imageWidth = 55; + public static int imageHeight = 32; - public static double computeTextWidth(String text, double wrappingWidth) { - Text helper = new Text(); - helper.setFont(ERMFont); - helper.setText(text); - - helper.setWrappingWidth(0.0D); - helper.setLineSpacing(0.0D); - double w = Math.min(helper.prefWidth(-1.0D), wrappingWidth); - helper.setWrappingWidth(Math.ceil(w)); - return Math.ceil(helper.getLayoutBounds().getWidth()); - } - - public static double computeTextHeight() { - return ERMFont.getSize(); - } - } \ No newline at end of file + public static Image treeCloseImage; + + public static Image treeOpenImage; + + public static Image attr_conn_attrImage; + public static Image attr_conn_esImage; + public static Image attr_conn_rsImage; + public static Image attr_derived_multi_valueImage; + public static Image attr_derived_one_valueImage; + public static Image attr_key_valueImage; + public static Image attr_multi_valueImage; + public static Image attr_one_valueImage; + public static Image attr_weak_key_valueImage; + public static Image es_associativeImage; + public static Image es_weakImage; + public static Image esImage; + public static Image rs_conn_esImage; + public static Image rs_id_conn_es_weakImage; + public static Image rs_id_conn_esImage; + public static Image rs_idImage; + public static Image rs_isa_conn_general_esImage; + public static Image rs_isa_conn_special_esImage; + public static Image rs_isaImage; + public static Image rsImage; + public static Image textImage; + public static Image textWithoutBorderImage; + public static HashMap randomDataFiles = new HashMap<>(); + public static HashMap randomDataFilesExtern = new HashMap<>(); + + + public C2() { + + alerterror.getStyleClass().add("alert.error.dialog-pane"); + alertinformation.getStyleClass().add("alert.error.dialog-pane"); + alertconfirmation.getStyleClass().add("alert.error.dialog-pane"); + + + String appImages = "/applicationimages/"; + String appData = "/data/"; + + + randomDataFiles.put("Random Color", getClass().getResourceAsStream(appData + "colors.txt")); + randomDataFiles.put("Random Company", getClass().getResourceAsStream(appData + "companies.txt")); + randomDataFiles.put("Random Country", getClass().getResourceAsStream(appData + "countries.txt")); + randomDataFiles.put("Random Departmentname", getClass().getResourceAsStream(appData + "departmentnames.txt")); + randomDataFiles.put("Random Firstname", getClass().getResourceAsStream(appData + "firstnames.txt")); + randomDataFiles.put("Random Jobname", getClass().getResourceAsStream(appData + "jobnames.txt")); + randomDataFiles.put("Random Language", getClass().getResourceAsStream(appData + "languages.txt")); + randomDataFiles.put("Random Lastname", getClass().getResourceAsStream(appData + "lastnames.txt")); + randomDataFiles.put("Random Mediacategory", getClass().getResourceAsStream(appData + "mediacategories.txt")); + randomDataFiles.put("Random Mediapublisher", getClass().getResourceAsStream(appData + "mediapublishers.txt")); + randomDataFiles.put("Random Mediatitle", getClass().getResourceAsStream(appData + "mediatitles.txt")); + randomDataFiles.put("Random Mediatype", getClass().getResourceAsStream(appData + "mediatypes.txt")); + randomDataFiles.put("Random Place", getClass().getResourceAsStream(appData + "places.txt")); + randomDataFiles.put("Random Profession", getClass().getResourceAsStream(appData + "professions.txt")); + randomDataFiles.put("Random Rentalequipment", getClass().getResourceAsStream(appData + "rentalequipment.txt")); + randomDataFiles.put("Random Street", getClass().getResourceAsStream(appData + "streets.txt")); + + applicationImageIconAsICO = new Image(Objects.requireNonNull(getClass().getResourceAsStream(appImages + "erdlogo.png"))); + attr_conn_attrImage = new Image(Objects.requireNonNull(getClass().getResourceAsStream(appImages + "attr_conn_attr.png"))); + attr_conn_esImage = new Image(Objects.requireNonNull(getClass().getResourceAsStream(appImages + "attr_conn_es.png"))); + attr_conn_rsImage = new Image(Objects.requireNonNull(getClass().getResourceAsStream(appImages + "attr_conn_rs.png"))); + attr_derived_multi_valueImage = new Image(Objects.requireNonNull(getClass().getResourceAsStream(appImages + "attr_derived_multi_value.png"))); + attr_derived_one_valueImage = new Image(Objects.requireNonNull(getClass().getResourceAsStream(appImages + "attr_derived_one_value.png"))); + attr_key_valueImage = new Image(Objects.requireNonNull(getClass().getResourceAsStream(appImages + "attr_key_value.png"))); + attr_multi_valueImage = new Image(Objects.requireNonNull(getClass().getResourceAsStream(appImages + "attr_multi_value.png"))); + attr_one_valueImage = new Image(Objects.requireNonNull(getClass().getResourceAsStream(appImages + "attr_one_value.png"))); + attr_weak_key_valueImage = new Image(Objects.requireNonNull(getClass().getResourceAsStream(appImages + "attr_weak_key_value.png"))); + es_associativeImage = new Image(Objects.requireNonNull(getClass().getResourceAsStream(appImages + "es_associative.png"))); + es_weakImage = new Image(Objects.requireNonNull(getClass().getResourceAsStream(appImages + "es_weak.png"))); + esImage = new Image(Objects.requireNonNull(getClass().getResourceAsStream(appImages + "es.png"))); + rs_conn_esImage = new Image(Objects.requireNonNull(getClass().getResourceAsStream(appImages + "rs_conn_es.png"))); + rs_id_conn_es_weakImage = new Image(Objects.requireNonNull(getClass().getResourceAsStream(appImages + "rs_id_conn_es_weak.png"))); + rs_id_conn_esImage = new Image(Objects.requireNonNull(getClass().getResourceAsStream(appImages + "rs_id_conn_es.png"))); + rs_idImage = new Image(Objects.requireNonNull(getClass().getResourceAsStream(appImages + "rs_id.png"))); + rs_isa_conn_general_esImage = new Image(Objects.requireNonNull(getClass().getResourceAsStream(appImages + "rs_isa_conn_general_es.png"))); + rs_isa_conn_special_esImage = new Image(Objects.requireNonNull(getClass().getResourceAsStream(appImages + "rs_isa_conn_special_es.png"))); + rs_isaImage = new Image(Objects.requireNonNull(getClass().getResourceAsStream(appImages + "rs_isa.png"))); + rsImage = new Image(Objects.requireNonNull(getClass().getResourceAsStream(appImages + "rs.png"))); + textImage = new Image(Objects.requireNonNull(getClass().getResourceAsStream(appImages + "text.png"))); + textWithoutBorderImage = new Image(Objects.requireNonNull(getClass().getResourceAsStream(appImages + "text_without_border.png"))); + treeOpenImage = new Image(Objects.requireNonNull(getClass().getResourceAsStream(appImages + "tree_open.png"))); + treeCloseImage = new Image(Objects.requireNonNull(getClass().getResourceAsStream(appImages + "tree_close.png"))); + } + + public static double computeTextWidth(String text, double wrappingWidth) { + Text helper = new Text(); + helper.setFont(ERMFont); + helper.setText(text); + + helper.setWrappingWidth(0.0D); + helper.setLineSpacing(0.0D); + double w = Math.min(helper.prefWidth(-1.0D), wrappingWidth); + helper.setWrappingWidth(Math.ceil(w)); + return Math.ceil(helper.getLayoutBounds().getWidth()); + } + + public static double computeTextHeight() { + return ERMFont.getSize(); + } +} \ No newline at end of file diff --git a/at/fos/ermodel/gui/C3.java b/at/fos/ermodel/gui/C3.java index e895fa1..f1b6ed1 100644 --- a/at/fos/ermodel/gui/C3.java +++ b/at/fos/ermodel/gui/C3.java @@ -1,151 +1,120 @@ - package at.fos.ermodel.gui; - public class C3 - implements Comparable - { - private final String columnName; - private String datatype; - private boolean isKey; - private boolean isNullable; - private boolean isUnique; - private boolean isAutoincrement; - private long autoincrementStartAt; - private T2 referencesTo; - private long referstoGraphicalElement; - protected String dataGenerationType; - protected String par1; - protected String par2; - - public C3(String columnName, String datatype, boolean isKey, boolean isNullable, boolean isUnique, boolean isAutoincrement, long autoincrementStartAt, T2 referencesTo, long referstoGraphicalElement, String dataGenerationType, String par1, String par2) { - this.columnName = columnName; - this.datatype = datatype; - this.isKey = isKey; - this.isNullable = isNullable; - this.isUnique = isUnique; - this.isAutoincrement = isAutoincrement; - this.autoincrementStartAt = autoincrementStartAt; - this.referencesTo = referencesTo; - this.referstoGraphicalElement = referstoGraphicalElement; - this.dataGenerationType = dataGenerationType; - this.par1 = par1; - this.par2 = par2; - } - - - - - - - - - - - - - - - - - - - - - - public C3(String columnName) { - this.columnName = columnName; - } - - - - - - public String getColumnName() { - return this.columnName; - } +package at.fos.ermodel.gui; + +public class C3 + implements Comparable { + private final String columnName; + protected String dataGenerationType; + protected String par1; + protected String par2; + private String datatype; + private boolean isKey; + private boolean isNullable; + private boolean isUnique; + private boolean isAutoincrement; + private long autoincrementStartAt; + private T2 referencesTo; + private long referstoGraphicalElement; + + public C3(String columnName, String datatype, boolean isKey, boolean isNullable, boolean isUnique, boolean isAutoincrement, long autoincrementStartAt, T2 referencesTo, long referstoGraphicalElement, String dataGenerationType, String par1, String par2) { + this.columnName = columnName; + this.datatype = datatype; + this.isKey = isKey; + this.isNullable = isNullable; + this.isUnique = isUnique; + this.isAutoincrement = isAutoincrement; + this.autoincrementStartAt = autoincrementStartAt; + this.referencesTo = referencesTo; + this.referstoGraphicalElement = referstoGraphicalElement; + this.dataGenerationType = dataGenerationType; + this.par1 = par1; + this.par2 = par2; + } - public String getDatatype() { - return this.datatype; - } + public C3(String columnName) { + this.columnName = columnName; + } - public boolean isKey() { - return this.isKey; - } + public String getColumnName() { + return this.columnName; + } - public boolean isNullable() { - return this.isNullable; - } + public String getDatatype() { + return this.datatype; + } - public boolean isUnique() { - return this.isUnique; - } + public boolean isKey() { + return this.isKey; + } - public boolean isAutoincrement() { - return this.isAutoincrement; - } + public boolean isNullable() { + return this.isNullable; + } - public long getAutoincrementStartAt() { - return this.autoincrementStartAt; - } + public boolean isUnique() { + return this.isUnique; + } - public T2 getReferencesTo() { - return this.referencesTo; - } + public boolean isAutoincrement() { + return this.isAutoincrement; + } - public int hashCode() { - int result = 1; - result = 31 * result + ((this.columnName == null) ? 0 : this.columnName.hashCode()); - return result; - } - - - - - public boolean equals(Object obj) { - if (this == obj) - return true; - if (obj == null) - return false; - if (getClass() != obj.getClass()) - return false; - C3 other = (C3)obj; - if (this.columnName == null) { - return other.columnName == null; - } else return this.columnName.equals(other.columnName); - } - - - - - public String toString() { - return "RM_Column [columnName=" + this.columnName + ", datatype=" + this.datatype + ", isKey=" + this.isKey + ", isNullable=" + - this.isNullable + ", isUnique=" + this.isUnique + ", isAutoincrement=" + this.isAutoincrement + ", referencesTo=" + - this.referencesTo + ", referstoGraphicalElement=" + this.referstoGraphicalElement + ", dataGenerationType=" + - this.dataGenerationType + ", par1=" + this.par1 + ", par2=" + this.par2 + "]"; - } - - - - - public int compareTo(C3 o) { - if (this.isKey && !o.isKey) return -1; - if (!this.isKey && o.isKey) return 1; - return 0; - } - - - - - - public long getReferstoGraphicalElement() { - return this.referstoGraphicalElement; - } - } + public long getAutoincrementStartAt() { + return this.autoincrementStartAt; + } + + + public T2 getReferencesTo() { + return this.referencesTo; + } + + + public int hashCode() { + int result = 1; + result = 31 * result + ((this.columnName == null) ? 0 : this.columnName.hashCode()); + return result; + } + + + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (getClass() != obj.getClass()) + return false; + C3 other = (C3) obj; + if (this.columnName == null) { + return other.columnName == null; + } else return this.columnName.equals(other.columnName); + } + + + public String toString() { + return "RM_Column [columnName=" + this.columnName + ", datatype=" + this.datatype + ", isKey=" + this.isKey + ", isNullable=" + + this.isNullable + ", isUnique=" + this.isUnique + ", isAutoincrement=" + this.isAutoincrement + ", referencesTo=" + + this.referencesTo + ", referstoGraphicalElement=" + this.referstoGraphicalElement + ", dataGenerationType=" + + this.dataGenerationType + ", par1=" + this.par1 + ", par2=" + this.par2 + "]"; + } + + + public int compareTo(C3 o) { + if (this.isKey && !o.isKey) return -1; + if (!this.isKey && o.isKey) return 1; + return 0; + } + + + public long getReferstoGraphicalElement() { + return this.referstoGraphicalElement; + } +} diff --git a/at/fos/ermodel/gui/C4.java b/at/fos/ermodel/gui/C4.java index bfb86a8..a802e9c 100644 --- a/at/fos/ermodel/gui/C4.java +++ b/at/fos/ermodel/gui/C4.java @@ -1,917 +1,779 @@ - package at.fos.ermodel.gui; - - import java.io.BufferedReader; - import java.io.FileInputStream; - import java.io.FileNotFoundException; - import java.io.InputStreamReader; - import java.nio.charset.StandardCharsets; - import java.time.LocalDate; - import java.util.ArrayList; - import java.util.Collections; - import java.util.HashMap; - import java.util.HashSet; - import javafx.application.Platform; - - - - - - - - - - - - - - - - - - - - - public class C4 - { - private String databaseName; - private ArrayList tables; - private StringBuffer sqlScript; - - public C4(String databaseName) { - this.databaseName = databaseName; - this.tables = new ArrayList<>(); - } - - - - - - - public boolean addTable(T1 table) { - if (this.tables.contains(table)) return true; - return !this.tables.add(table); - } - - - - - - - public void removeTable(T1 table) { - this.tables.remove(table); - } - - - - - public String getDatabaseName() { - return this.databaseName; - } - - - - public void setDatabaseName(String databaseName) { - this.databaseName = databaseName; - } - - - - - - public String toString() { - return "RM_Database [databaseName=" + this.databaseName + ", tables=" + this.tables + "]"; - } - - - - - public ArrayList getTables() { - return this.tables; - } - - - - - public void setTables(ArrayList tables) { - this.tables = tables; - } - - - - - public void sortByTableName() { - Collections.sort(this.tables); - } - - - - - - - - private String addChars() { - return String.valueOf(' ').repeat(5); - } - - - - - - - - - - - - - - - - public StringBuffer create_MS_SQL_Script(boolean createInsertStatements, boolean addCDToDBName, boolean singeInserts) throws ZZ20 { - LocalDate today = LocalDate.now(); - String currentDate = today.getYear() + ( - (today.getMonthValue() < 10) ? ("0" + today.getMonthValue()) : ""+ today.getMonthValue()) + ( - (today.getDayOfMonth() < 10) ? ("0" + today.getDayOfMonth()) : ""+ today.getDayOfMonth()); - - - if (addCDToDBName) this.databaseName = this.databaseName + currentDate; - - - this.databaseName = T3.replaceSpecialChars(this.databaseName); - - - this.databaseName = this.databaseName.toLowerCase(); - - - this.sqlScript = new StringBuffer(); +package at.fos.ermodel.gui; - this.sqlScript.append("-- #######################################################\n"); - this.sqlScript.append("-- auto generated ddl-script ###########################\n"); - this.sqlScript.append("-- generated sql creation script for ER model\n"); - this.sqlScript.append("-- switch autocommit off\n"); - this.sqlScript.append("set implicit_transactions off;\n"); - this.sqlScript.append("-- database-#############################################\n"); - this.sqlScript.append("use master;\n"); - this.sqlScript.append("drop database if exists ").append(this.databaseName).append(";").append("\n"); - this.sqlScript.append("create database ").append(this.databaseName).append(";").append("\n"); - this.sqlScript.append("go \n"); - this.sqlScript.append("use ").append(this.databaseName).append(";").append("\n"); +import javafx.application.Platform; - this.sqlScript.append("-- tables-#################################################\n"); - for (T1 table : this.tables) { - this.sqlScript = this.sqlScript.append("-- table ").append(table.getTablename()).append("\n"); - this.sqlScript = this.sqlScript.append("create table ").append(table.getTablename()).append("(").append("\n"); - StringBuilder keypart = new StringBuilder("primary key("); - - int autoincrementCounter = 0; - for (C3 column : table.getSkjdfhgdskjf674534()) { - keypart.append(column.isKey() ? (column.getColumnName() + ",") : ""); - this.sqlScript = this.sqlScript.append(addChars()).append(column.getColumnName()).append(" ").append(column.getDatatype()).append(column.isKey() ? " not null" : "").append(( - !column.isKey() && !column.isNullable()) ? " not null" : "").append(column.isAutoincrement() ? (" identity (" + column.getAutoincrementStartAt() + ",1) ") : "").append(column.isUnique() ? " unique" : "").append(",").append("\n"); - if (column.isAutoincrement()) { - autoincrementCounter++; - } - } - - - keypart = new StringBuilder(keypart.substring(0, keypart.length() - 1)); - keypart.append(")").append("\n"); - this.sqlScript = this.sqlScript.append(addChars()).append(keypart).append(")"); - this.sqlScript.append(";\n\n"); - if (autoincrementCounter != 1) - { - - if (autoincrementCounter > 1) { - throw new ZZ20("There is only one autoincrement value allowed, and it must be the key. Table: " + table.getTablename()); - } - } - } - - if (createInsertStatements) { - try { - allTablesSetForGeneration(); - allColumnsSetForGeneration(); - } catch (ZZ20 ex) { - throw new ZZ20(ex.getMessage()); - } - createInsertStatements(this.sqlScript, singeInserts, false); - } +import java.io.BufferedReader; +import java.io.FileInputStream; +import java.io.FileNotFoundException; +import java.io.InputStreamReader; +import java.nio.charset.StandardCharsets; +import java.time.LocalDate; +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashMap; +import java.util.HashSet; - this.sqlScript.append("\n-- foreign keys-#################################################\n"); - for (T1 table : this.tables) { - - ArrayList fkColumns = new ArrayList<>(); - for (C3 column : table.getSkjdfhgdskjf674534()) { - if (column.getReferencesTo() != null) fkColumns.add(column); - } - if (fkColumns.size() == 0) { - continue; - } - - HashSet tableNamesInfkColumns = new HashSet<>(); - for (C3 fksamecol : fkColumns) { - tableNamesInfkColumns.add(fksamecol.getReferencesTo().tablename()); - } - - - - - ArrayList equalColumnsBecauseRecursive = new ArrayList<>(); - for (int i = 0; i < fkColumns.size(); i++) { - for (int j = i + 1; j < fkColumns.size(); j++) { - if (fkColumns.get(i).getReferencesTo().tablename().equals(fkColumns.get(j).getReferencesTo().tablename()) && fkColumns.get(i).getReferencesTo().columnname().equals(fkColumns.get(j).getReferencesTo().columnname())) { - equalColumnsBecauseRecursive.add(fkColumns.get(i)); - equalColumnsBecauseRecursive.add(fkColumns.get(j)); - } - } - } - for (C3 col : equalColumnsBecauseRecursive) { - this.sqlScript = this.sqlScript.append("alter table ").append(table.getTablename()).append("\n"); - this.sqlScript.append("add foreign key ("); - this.sqlScript = this.sqlScript.append(col.getColumnName()).append(")").append(" references ").append(col.getReferencesTo().tablename()).append("(").append(col.getReferencesTo().columnname()).append(")").append(" on delete no action on update no action;\n"); - - tableNamesInfkColumns.remove(col.getReferencesTo().tablename()); - } - - - for (String tableName : tableNamesInfkColumns) { - - this.sqlScript = this.sqlScript.append("alter table ").append(table.getTablename()).append("\n"); - this.sqlScript.append("add foreign key ("); - StringBuilder columnsOrig = new StringBuilder(); - StringBuilder refColumns = new StringBuilder(" references " + tableName + "("); - for (C3 fkcolumn : fkColumns) { - if (tableName.equals(fkcolumn.getReferencesTo().tablename())) { - columnsOrig.append(fkcolumn.getColumnName()).append(","); - refColumns.append(fkcolumn.getReferencesTo().columnname()).append(","); - } - } - columnsOrig = new StringBuilder(columnsOrig.substring(0, columnsOrig.length() - 1)); - columnsOrig.append(")"); - refColumns = new StringBuilder(refColumns.substring(0, refColumns.length() - 1)); - refColumns.append(")"); - this.sqlScript.append(columnsOrig).append(refColumns).append(" on delete no action on update no action;\n"); - } - this.sqlScript.replace(this.sqlScript.length() - 2, this.sqlScript.length(), ";\n"); - } +public class C4 { + private String databaseName; + private ArrayList tables; + private StringBuffer sqlScript; - this.sqlScript.append("-- commit all changes\n"); - this.sqlScript.append("commit;"); - - return this.sqlScript; - } - - - - - - - - - - - - - - - - - - - public StringBuffer create_MySQL_Script(boolean createInsertStatements, boolean addCDToDBName, boolean singeInserts) throws ZZ20 { - LocalDate today = LocalDate.now(); - String currentDate = today.getYear() + ( - (today.getMonthValue() < 10) ? ("0" + today.getMonthValue()) : ""+ today.getMonthValue()) + ( - (today.getDayOfMonth() < 10) ? ("0" + today.getDayOfMonth()) : ""+ today.getDayOfMonth()); - - - if (addCDToDBName) this.databaseName = currentDate + this.databaseName; - - - this.databaseName = T3.replaceSpecialChars(this.databaseName); - - - this.databaseName = this.databaseName.toLowerCase(); - - this.sqlScript = new StringBuffer(); - - this.sqlScript.append("-- #######################################################\n"); - this.sqlScript.append("-- auto generated ddl-script ###########################\n"); - this.sqlScript.append("-- generated sql creation script for ER model\n"); - this.sqlScript.append("-- database-#############################################\n"); - this.sqlScript.append("drop database if exists ").append(this.databaseName).append(";").append("\n"); - this.sqlScript.append("create database ").append(this.databaseName).append(";").append("\n"); - this.sqlScript.append("use ").append(this.databaseName).append(";").append("\n"); - this.sqlScript.append("-- switch autocommit off\n"); - this.sqlScript.append("set autocommit=0;\n"); - - this.sqlScript.append("-- tables-#################################################\n"); - for (T1 table : this.tables) { - this.sqlScript = this.sqlScript.append("-- table ").append(table.getTablename()).append("\n"); - this.sqlScript = this.sqlScript.append("create table ").append(table.getTablename()).append("(").append("\n"); - StringBuilder keypart = new StringBuilder("primary key("); - - int autoincrementCounter = 0; - long holdAutoincrementStartAt = 1L; - for (C3 column : table.getSkjdfhgdskjf674534()) { - keypart.append(column.isKey() ? (column.getColumnName() + ",") : ""); - this.sqlScript = this.sqlScript.append(addChars()).append(column.getColumnName()).append(" ").append(column.getDatatype()).append(column.isKey() ? " not null" : "").append(( - !column.isKey() && !column.isNullable()) ? " not null" : "").append(column.isAutoincrement() ? " auto_increment " : "").append(column.isUnique() ? " unique" : "").append(",").append("\n"); - if (column.isAutoincrement()) { - autoincrementCounter++; - holdAutoincrementStartAt = column.getAutoincrementStartAt(); - } - } - - keypart = new StringBuilder(keypart.substring(0, keypart.length() - 1)); - keypart.append(")").append("\n"); - this.sqlScript = this.sqlScript.append(addChars()).append(keypart).append(")"); - if (autoincrementCounter == 1) { - this.sqlScript.append("auto_increment=").append(holdAutoincrementStartAt); - } - else if (autoincrementCounter > 1) { - throw new ZZ20("There is only one autoincrement value allowed, and it must be the key. Table: " + table.getTablename()); - } - this.sqlScript.append(";\n\n"); - } - - - if (createInsertStatements) { - try { - allTablesSetForGeneration(); - allColumnsSetForGeneration(); - } catch (ZZ20 ex) { - throw new ZZ20(ex.getMessage()); - } - - createInsertStatements(this.sqlScript, singeInserts, true); - } + public C4(String databaseName) { + this.databaseName = databaseName; + this.tables = new ArrayList<>(); + } - this.sqlScript.append("\n-- foreign keys-#################################################\n"); - for (T1 table : this.tables) { - - ArrayList fkColumns = new ArrayList<>(); - for (C3 column : table.getSkjdfhgdskjf674534()) { - if (column.getReferencesTo() != null) fkColumns.add(column); - } - if (fkColumns.size() == 0) - continue; this.sqlScript = this.sqlScript.append("alter table ").append(table.getTablename()).append("\n"); - - - HashSet tableNamesInfkColumns = new HashSet<>(); - for (C3 fksamecol : fkColumns) { - tableNamesInfkColumns.add(fksamecol.getReferencesTo().tablename()); - } - - - - - ArrayList equalColumnsBecauseRecursive = new ArrayList<>(); - for (int i = 0; i < fkColumns.size(); i++) { - for (int j = i + 1; j < fkColumns.size(); j++) { - if (fkColumns.get(i).getReferencesTo().tablename().equals(fkColumns.get(j).getReferencesTo().tablename()) && fkColumns.get(i).getReferencesTo().columnname().equals(fkColumns.get(j).getReferencesTo().columnname())) { - equalColumnsBecauseRecursive.add(fkColumns.get(i)); - equalColumnsBecauseRecursive.add(fkColumns.get(j)); - } - } - } - for (C3 col : equalColumnsBecauseRecursive) { - this.sqlScript.append("add foreign key ("); - this.sqlScript = this.sqlScript.append(col.getColumnName()).append(")").append(" references ").append(col.getReferencesTo().tablename()).append("(").append(col.getReferencesTo().columnname()).append(")").append(" on delete restrict on update restrict,\n"); - - tableNamesInfkColumns.remove(col.getReferencesTo().tablename()); - } - - - for (String tableName : tableNamesInfkColumns) { - - this.sqlScript.append("add foreign key ("); - StringBuilder columnsOrig = new StringBuilder(); - StringBuilder refColumns = new StringBuilder(" references " + tableName + "("); - for (C3 fkcolumn : fkColumns) { - if (tableName.equals(fkcolumn.getReferencesTo().tablename())) { - columnsOrig.append(fkcolumn.getColumnName()).append(","); - refColumns.append(fkcolumn.getReferencesTo().columnname()).append(","); - } - } - columnsOrig = new StringBuilder(columnsOrig.substring(0, columnsOrig.length() - 1)); - columnsOrig.append(")"); - refColumns = new StringBuilder(refColumns.substring(0, refColumns.length() - 1)); - refColumns.append(")"); - this.sqlScript.append(columnsOrig).append(refColumns).append(" on delete restrict on update restrict,\n"); - } - this.sqlScript.replace(this.sqlScript.length() - 2, this.sqlScript.length(), ";\n"); - } - - this.sqlScript.append("-- commit all changes\n"); - this.sqlScript.append("commit;"); - - return this.sqlScript; - } - - - - - - - - - private void allColumnsSetForGeneration() throws ZZ20 { - for (T1 table : this.tables) { - for (C3 column : table.getSkjdfhgdskjf674534()) { - - if (!column.isNullable() && - !column.isAutoincrement() && column.getReferencesTo() == null && ( - column.dataGenerationType == null || column.dataGenerationType.equals("No"))) { - throw new ZZ20("There are unset columns for insert statement generation:" + column.getColumnName()); - } - } - } - } - - - - - - - private void allTablesSetForGeneration() throws ZZ20 { - for (T1 table : this.tables) { - if (!table.isCreateInserts()) { - throw new ZZ20("Table is not set for generating inserts:" + table.getTablename()); - } - } - } - - - - - - - - - private String generateRandomValue(C3 column) throws ZZ20 { - String randomValue; - try { String[] datumteil; LocalDate from, till; String str; - switch ((str = column.dataGenerationType).hashCode()) { - case -1601184309 -> { - if (!str.equals("Random Boolean")) { - break; - } - randomValue = T3.getRandomBoolean(); - return randomValue; - } - case -123632396 -> { - if (!str.equals("Random Decimal")) break; - randomValue = T3.getRandomDecimal(Integer.parseInt(column.par1), Integer.parseInt(column.par2)); - return randomValue; - } - case 292156129 -> { - if (!str.equals("Random Integer")) break; - if (Integer.parseInt(column.par1) >= Integer.parseInt(column.par2)) - throw new ZZ20("Column: " + column.getColumnName() + "\n" + "For Random Integer generation: from < till"); - randomValue = T3.getRandomInteger(Integer.parseInt(column.par1), Integer.parseInt(column.par2)); - return randomValue; - } - case 908695787 -> { - if (!str.equals("Random Date")) break; - datumteil = column.par1.split("\\."); - from = LocalDate.of(Integer.parseInt(datumteil[2]), Integer.parseInt(datumteil[1]), Integer.parseInt(datumteil[0])); - datumteil = column.par2.split("\\."); - till = LocalDate.of(Integer.parseInt(datumteil[2]), Integer.parseInt(datumteil[1]), Integer.parseInt(datumteil[0])); - randomValue = T3.getRandomDate(from, till); - return randomValue; - } - case 909176426 -> { - if (!str.equals("Random Text")) break; - randomValue = T3.getRandomTextGivenLength(Integer.parseInt(column.par1)); - return randomValue; - } - case 2089790400 -> { - if (!str.equals("Extern")) break; - randomValue = T3.getRandomData(column.dataGenerationType, column.par1); - return randomValue; - } - } - randomValue = T3.getRandomData(column.dataGenerationType, null); } catch (NumberFormatException nfe) { throw new ZZ20("Column: " + column.getColumnName() + "\n" + "There is a data conversion problem: " + column.par1 + "/" + column.par2); } return randomValue; - } - - - - - - - private int getNumberValuesOfRandomData(C3 column) { - ArrayList randomDataAsList; - if (column.dataGenerationType.equals("Extern")) { - randomDataAsList = T3.randomData.get(column.par1); - if (randomDataAsList == null) { - T3.readRandomData("Extern", column.par1); - randomDataAsList = T3.randomData.get(column.par1); - } - } else { - randomDataAsList = T3.randomData.get(column.dataGenerationType); - } if (randomDataAsList != null) return randomDataAsList.size(); - return -1; - } - - - - - private void createFilehandleForExternalDataSources() throws ZZ20 { - for (T1 table : this.tables) { - for (C3 column : table.getSkjdfhgdskjf674534()) { - if (column.dataGenerationType == null || - !column.dataGenerationType.equals("Extern")) - continue; BufferedReader br = C2.randomDataFilesExtern.get(column.par1); - if (br == null) { - - BufferedReader fr; - try { - fr = new BufferedReader(new InputStreamReader(new FileInputStream(column.par2), StandardCharsets.UTF_8)); - - C2.randomDataFilesExtern.put(column.par1, fr); - } catch (FileNotFoundException e) { - - throw new ZZ20("There is a problem with an external datasource:" + column.getColumnName()); - } - } - } - } - } - - - - - - - - - public void createDependency() { - for (T1 table : this.tables) { - for (C3 column : table.getSkjdfhgdskjf674534()) { - if (column.getReferencesTo() != null) { - String tablename = column.getReferencesTo().tablename(); - T1 dependsOn = getTableGivenTablename(tablename); - table.addTableDepdendentOn(dependsOn); - - assert dependsOn != null; - ArrayList keyColumns = dependsOn.getKeyColumns(); - - table.getColumnsOfDependentOnTable().put(dependsOn, keyColumns); - } - } - } - - } - - - - - - private HashMap> initializeColumns() { - HashMap> holdValues = new HashMap<>(); - for (T1 table : this.tables) { - - if (!table.isCreateInserts()) - continue; for (C3 column : table.getSkjdfhgdskjf674534()) { - - - if (column.dataGenerationType != null && column.dataGenerationType.equals("No") && column.isNullable()) - continue; holdValues.put(table.getTablename() + "." + column.getColumnName(), null); - } - } - return holdValues; - } - - - - - - - - - private T1 getTableGivenTablename(String tablename) { - for (T1 table : this.tables) { - if (table.getTablename().equals(tablename)) return table; - } - return null; - } - - - - - - - - private boolean allColumnValuesCreated(HashMap> columnValues) { - int counter = 0; - for (T1 table : this.tables) { - - if (!table.isCreateInserts()) - continue; for (C3 column : table.getSkjdfhgdskjf674534()) { - ArrayList values = columnValues.get(table.getTablename() + "." + column.getColumnName()); - if (values != null && values.size() > 0) counter++; - } - } - return counter >= columnValues.size(); - } - - - - - - - - - - private void allDependentCreated(T1 table, HashMap> createdColumns) { - for (T1 dependsOn : table.getDependsOnTable()) { - for (C3 column : dependsOn.getSkjdfhgdskjf674534()) { - if (column.isKey()) { - ArrayList values = createdColumns.get(dependsOn.getTablename() + "." + column.getColumnName()); - if (values == null) return; - } - } - } - } - - - - - - - - private HashMap> createColumnValues() throws ZZ20 { - Platform.runLater(() -> V1.thisActionMessageDialog.getShowFilename().setText("create column values")); - - - - HashMap> columnValues = initializeColumns(); - - createFilehandleForExternalDataSources(); - - - boolean done = false; - - - createDependency(); - - - - - - - - - - - - - - while (!done) { - for (T1 table : this.tables) { - for (C3 column : table.getSkjdfhgdskjf674534()) { - - if (column.isNullable() && column.dataGenerationType != null && column.dataGenerationType.equals("No")) - continue; - ArrayList values = new ArrayList<>(); - - boolean valuesExist = true; - ArrayList checkValues = columnValues.get(table.getTablename() + "." + column.getColumnName()); - if (checkValues == null) valuesExist = false; - - if (column.isKey() && column.isAutoincrement() && !valuesExist) { - long autoincrementStartAt = column.getAutoincrementStartAt(); - for (int i = 0; i < table.getJdshfalkajsd677676(); i++) { - values.add(String.valueOf(autoincrementStartAt++)); - - } - } - else if (column.isKey() && column.getReferencesTo() == null && !valuesExist) { - for (int i = 0; i < table.getJdshfalkajsd677676(); i++) { - String randomValue = generateRandomValue(column); - - values.add(String.valueOf(randomValue)); - } - - } - else if (column.isKey() && column.getReferencesTo() != null && !valuesExist) { - - HashMap> x = getStringArrayListHashMap(columnValues, table, column, values); - if (x != null) return x; - - } - else if (column.getReferencesTo() != null && !valuesExist) { - - getStringArrayListHashMap(columnValues, table, column, values); - - } - else if (!valuesExist) { - - if (column.isUnique()) { - - int numberPossibleValues = getNumberValuesOfRandomData(column); - if (numberPossibleValues != -1) - { - - if (numberPossibleValues < table.getJdshfalkajsd677676()) { - throw new ZZ20("Column " + column.getColumnName() + " is defined as unique. \nNot enough values for generation mode\n" + - "Max numbers allowed: " + numberPossibleValues + "\n" + - column.dataGenerationType + "/" + column.par1 + "/" + column.par2); - } - } - } - - for (int i = 0; i < table.getJdshfalkajsd677676(); i++) { - String randomValue = generateRandomValue(column); - - - while (column.isUnique() && values.contains(randomValue)) { - randomValue = generateRandomValue(column); - } - values.add(String.valueOf(randomValue)); - } - } - - if (values.size() > 0) { - columnValues.put(table.getTablename() + "." + column.getColumnName(), values); - } - } - } - - - if (allColumnValuesCreated(columnValues)) done = true; - - } - return columnValues; - } - - private HashMap> getStringArrayListHashMap(HashMap> columnValues, T1 table, C3 column, ArrayList values) { - allDependentCreated(table, columnValues); - for (int i = 0; i < table.getJdshfalkajsd677676(); i++) - { - ArrayList valuesPK = columnValues.get(column.getReferencesTo().tablename() + "." + column.getReferencesTo().columnname()); - if (valuesPK == null) - break; String randomValue = valuesPK.get(i % valuesPK.size()); - - values.add(String.valueOf(randomValue)); - } - return null; - } + public boolean addTable(T1 table) { + if (this.tables.contains(table)) return true; + return !this.tables.add(table); + } - private void createInsertStatements(StringBuffer sqlScript, boolean singleInserts, boolean mysql) throws ZZ20 { - //System.out.println("Generating insert statement"); - HashMap> holdPKValuesForFK = createColumnValues(); - - - - for (T1 table : this.tables) { - - ArrayList keyColumns = new ArrayList<>(); - for (C3 column : table.getSkjdfhgdskjf674534()) { - if (column.isKey()) { - keyColumns.add(table.getTablename() + "." + column.getColumnName()); - } - } - StringBuilder concatKeyValue; - ArrayList concatKeyValues = new ArrayList<>(); - int deleted = 0; - - try { - for (int i = 0; i < table.getJdshfalkajsd677676(); i++) { - concatKeyValue = new StringBuilder(); - for (String key : keyColumns) { - ArrayList valuesPK = holdPKValuesForFK.get(key); - concatKeyValue.append(valuesPK.get(i)); - } - - if (!concatKeyValues.contains(concatKeyValue.toString())) { concatKeyValues.add(concatKeyValue.toString()); } - else - - { for (C3 column : table.getSkjdfhgdskjf674534()) { - ArrayList valuesPK = holdPKValuesForFK.get(table.getTablename() + "." + column.getColumnName()); - valuesPK.remove(i); - holdPKValuesForFK.put(table.getTablename() + "." + column.getColumnName(), valuesPK); - } - i--; - deleted++; } - - - } - } catch (IndexOutOfBoundsException ignored) {} - - - - - table.setJdshfalkajsd677676(table.getJdshfalkajsd677676() - deleted); - } + public void removeTable(T1 table) { + this.tables.remove(table); + } - sqlScript.append("-- insert-#################################################\n"); - if (!mysql) { - sqlScript.append("begin transaction;\n"); - } - for (T1 table : this.tables) { - if (table.isCreateInserts()) { - Platform.runLater(() -> V1.thisActionMessageDialog.getShowFilename().setText(table.getTablename() + " ... create")); + public String getDatabaseName() { + return this.databaseName; + } - sqlScript.append("\n-- table ").append(table.getTablename()); - - if (table.hasAutoincrement() && !mysql) { - sqlScript.append("\nset identity_insert ").append(table.getTablename()).append(" on;\n"); - } - for (int i = 0; i < table.getJdshfalkajsd677676(); i++) { - - if (!singleInserts) { - if (i == 0) { - addInsertTable(sqlScript, table); - } - sqlScript.append("\t\t("); - StringBuilder valuespart = new StringBuilder(); - - for (C3 column : table.getSkjdfhgdskjf674534()) { - - if (!column.isNullable() || column.dataGenerationType == null || !column.dataGenerationType.equals("No")) { - ArrayList values = holdPKValuesForFK.get(table.getTablename() + "." + column.getColumnName()); - valuespart.append("'").append(values.get(i)).append("'").append(","); - } - } - valuespart = new StringBuilder(valuespart.substring(0, valuespart.length() - 1)); - valuespart.append(")"); - sqlScript.append(valuespart).append((i < table.getJdshfalkajsd677676() - 1L) ? "," : ";").append("\n"); - } - else { - - addInsertTable(sqlScript, table); - sqlScript.append("\t\t("); - StringBuilder valuespart = new StringBuilder(); - - for (C3 column : table.getSkjdfhgdskjf674534()) { - - if (!column.isNullable() || column.dataGenerationType == null || !column.dataGenerationType.equals("No")) { - ArrayList values = holdPKValuesForFK.get(table.getTablename() + "." + column.getColumnName()); - valuespart.append("'").append(values.get(i)).append("'").append(","); - } - } - valuespart = new StringBuilder(valuespart.substring(0, valuespart.length() - 1)); - valuespart.append(");"); - sqlScript.append(valuespart); - } - } - - if (table.hasAutoincrement() && !mysql) { - sqlScript.append("\nset identity_insert ").append(table.getTablename()).append(" off;\n"); - } - } - Platform.runLater(() -> V1.thisActionMessageDialog.getShowFilename().setText(table.getTablename() + " ... done")); - } + public void setDatabaseName(String databaseName) { + this.databaseName = databaseName; + } - } - - private void addInsertTable(StringBuffer sqlScript, T1 table) { - sqlScript.append("\ninsert into ").append(table.getTablename()).append("("); - - StringBuilder columnspart = new StringBuilder(); - for (C3 column : table.getSkjdfhgdskjf674534()) { - - if (!column.isNullable() || column.dataGenerationType == null || !column.dataGenerationType.equals("No")) - columnspart.append(column.getColumnName()).append(","); - } - columnspart = new StringBuilder(columnspart.substring(0, columnspart.length() - 1)); - columnspart.append(")"); - sqlScript.append(columnspart).append(" values\n"); - } + public String toString() { + return "RM_Database [databaseName=" + this.databaseName + ", tables=" + this.tables + "]"; + } - public ArrayList getKeyColumnsGivenRelation(long referstoGraphicalElement) { - for (T1 table : this.tables) { - if (table.getReferstoGraphicalElement() == referstoGraphicalElement) return table.getKeyColumns(); - } - return null; - } + public ArrayList getTables() { + return this.tables; + } - public T1 getTableGivenNumber(long referstoGraphicalElement) { - for (T1 table : this.tables) { - if (table.getReferstoGraphicalElement() == referstoGraphicalElement) return table; - } - return null; - } - - - public T1 getColumnGivenNumber(long referstoGraphicalElement) { - for (T1 table : this.tables) { - for (C3 column : table.getSkjdfhgdskjf674534()) { - if (column.getReferstoGraphicalElement() == referstoGraphicalElement) return table; - } - } - return null; - } + public void setTables(ArrayList tables) { + this.tables = tables; + } - } \ No newline at end of file + public void sortByTableName() { + Collections.sort(this.tables); + } + + + private String addChars() { + return String.valueOf(' ').repeat(5); + } + + + public StringBuffer create_MS_SQL_Script(boolean createInsertStatements, boolean addCDToDBName, boolean singeInserts) throws ZZ20 { + LocalDate today = LocalDate.now(); + String currentDate = today.getYear() + ( + (today.getMonthValue() < 10) ? ("0" + today.getMonthValue()) : "" + today.getMonthValue()) + ( + (today.getDayOfMonth() < 10) ? ("0" + today.getDayOfMonth()) : "" + today.getDayOfMonth()); + + + if (addCDToDBName) this.databaseName = this.databaseName + currentDate; + + + this.databaseName = T3.replaceSpecialChars(this.databaseName); + + + this.databaseName = this.databaseName.toLowerCase(); + + + this.sqlScript = new StringBuffer(); + + this.sqlScript.append("-- #######################################################\n"); + this.sqlScript.append("-- auto generated ddl-script ###########################\n"); + this.sqlScript.append("-- generated sql creation script for ER model\n"); + this.sqlScript.append("-- switch autocommit off\n"); + this.sqlScript.append("set implicit_transactions off;\n"); + this.sqlScript.append("-- database-#############################################\n"); + this.sqlScript.append("use master;\n"); + this.sqlScript.append("drop database if exists ").append(this.databaseName).append(";").append("\n"); + this.sqlScript.append("create database ").append(this.databaseName).append(";").append("\n"); + this.sqlScript.append("go \n"); + this.sqlScript.append("use ").append(this.databaseName).append(";").append("\n"); + + this.sqlScript.append("-- tables-#################################################\n"); + for (T1 table : this.tables) { + this.sqlScript = this.sqlScript.append("-- table ").append(table.getTablename()).append("\n"); + this.sqlScript = this.sqlScript.append("create table ").append(table.getTablename()).append("(").append("\n"); + StringBuilder keypart = new StringBuilder("primary key("); + + int autoincrementCounter = 0; + for (C3 column : table.getSkjdfhgdskjf674534()) { + keypart.append(column.isKey() ? (column.getColumnName() + ",") : ""); + this.sqlScript = this.sqlScript.append(addChars()).append(column.getColumnName()).append(" ").append(column.getDatatype()).append(column.isKey() ? " not null" : "").append(( + !column.isKey() && !column.isNullable()) ? " not null" : "").append(column.isAutoincrement() ? (" identity (" + column.getAutoincrementStartAt() + ",1) ") : "").append(column.isUnique() ? " unique" : "").append(",").append("\n"); + if (column.isAutoincrement()) { + autoincrementCounter++; + } + } + + + keypart = new StringBuilder(keypart.substring(0, keypart.length() - 1)); + keypart.append(")").append("\n"); + this.sqlScript = this.sqlScript.append(addChars()).append(keypart).append(")"); + this.sqlScript.append(";\n\n"); + if (autoincrementCounter != 1) { + + if (autoincrementCounter > 1) { + throw new ZZ20("There is only one autoincrement value allowed, and it must be the key. Table: " + table.getTablename()); + } + } + } + + if (createInsertStatements) { + try { + allTablesSetForGeneration(); + allColumnsSetForGeneration(); + } catch (ZZ20 ex) { + throw new ZZ20(ex.getMessage()); + } + createInsertStatements(this.sqlScript, singeInserts, false); + } + + + this.sqlScript.append("\n-- foreign keys-#################################################\n"); + for (T1 table : this.tables) { + + ArrayList fkColumns = new ArrayList<>(); + for (C3 column : table.getSkjdfhgdskjf674534()) { + if (column.getReferencesTo() != null) fkColumns.add(column); + } + if (fkColumns.size() == 0) { + continue; + } + + HashSet tableNamesInfkColumns = new HashSet<>(); + for (C3 fksamecol : fkColumns) { + tableNamesInfkColumns.add(fksamecol.getReferencesTo().tablename()); + } + + + ArrayList equalColumnsBecauseRecursive = new ArrayList<>(); + for (int i = 0; i < fkColumns.size(); i++) { + for (int j = i + 1; j < fkColumns.size(); j++) { + if (fkColumns.get(i).getReferencesTo().tablename().equals(fkColumns.get(j).getReferencesTo().tablename()) && fkColumns.get(i).getReferencesTo().columnname().equals(fkColumns.get(j).getReferencesTo().columnname())) { + equalColumnsBecauseRecursive.add(fkColumns.get(i)); + equalColumnsBecauseRecursive.add(fkColumns.get(j)); + } + } + } + for (C3 col : equalColumnsBecauseRecursive) { + this.sqlScript = this.sqlScript.append("alter table ").append(table.getTablename()).append("\n"); + this.sqlScript.append("add foreign key ("); + this.sqlScript = this.sqlScript.append(col.getColumnName()).append(")").append(" references ").append(col.getReferencesTo().tablename()).append("(").append(col.getReferencesTo().columnname()).append(")").append(" on delete no action on update no action;\n"); + + tableNamesInfkColumns.remove(col.getReferencesTo().tablename()); + } + + + for (String tableName : tableNamesInfkColumns) { + + this.sqlScript = this.sqlScript.append("alter table ").append(table.getTablename()).append("\n"); + this.sqlScript.append("add foreign key ("); + StringBuilder columnsOrig = new StringBuilder(); + StringBuilder refColumns = new StringBuilder(" references " + tableName + "("); + for (C3 fkcolumn : fkColumns) { + if (tableName.equals(fkcolumn.getReferencesTo().tablename())) { + columnsOrig.append(fkcolumn.getColumnName()).append(","); + refColumns.append(fkcolumn.getReferencesTo().columnname()).append(","); + } + } + columnsOrig = new StringBuilder(columnsOrig.substring(0, columnsOrig.length() - 1)); + columnsOrig.append(")"); + refColumns = new StringBuilder(refColumns.substring(0, refColumns.length() - 1)); + refColumns.append(")"); + this.sqlScript.append(columnsOrig).append(refColumns).append(" on delete no action on update no action;\n"); + } + this.sqlScript.replace(this.sqlScript.length() - 2, this.sqlScript.length(), ";\n"); + } + + this.sqlScript.append("-- commit all changes\n"); + this.sqlScript.append("commit;"); + + return this.sqlScript; + } + + + public StringBuffer create_MySQL_Script(boolean createInsertStatements, boolean addCDToDBName, boolean singeInserts) throws ZZ20 { + LocalDate today = LocalDate.now(); + String currentDate = today.getYear() + ( + (today.getMonthValue() < 10) ? ("0" + today.getMonthValue()) : "" + today.getMonthValue()) + ( + (today.getDayOfMonth() < 10) ? ("0" + today.getDayOfMonth()) : "" + today.getDayOfMonth()); + + + if (addCDToDBName) this.databaseName = currentDate + this.databaseName; + + + this.databaseName = T3.replaceSpecialChars(this.databaseName); + + + this.databaseName = this.databaseName.toLowerCase(); + + this.sqlScript = new StringBuffer(); + + this.sqlScript.append("-- #######################################################\n"); + this.sqlScript.append("-- auto generated ddl-script ###########################\n"); + this.sqlScript.append("-- generated sql creation script for ER model\n"); + this.sqlScript.append("-- database-#############################################\n"); + this.sqlScript.append("drop database if exists ").append(this.databaseName).append(";").append("\n"); + this.sqlScript.append("create database ").append(this.databaseName).append(";").append("\n"); + this.sqlScript.append("use ").append(this.databaseName).append(";").append("\n"); + this.sqlScript.append("-- switch autocommit off\n"); + this.sqlScript.append("set autocommit=0;\n"); + + this.sqlScript.append("-- tables-#################################################\n"); + for (T1 table : this.tables) { + this.sqlScript = this.sqlScript.append("-- table ").append(table.getTablename()).append("\n"); + this.sqlScript = this.sqlScript.append("create table ").append(table.getTablename()).append("(").append("\n"); + StringBuilder keypart = new StringBuilder("primary key("); + + int autoincrementCounter = 0; + long holdAutoincrementStartAt = 1L; + for (C3 column : table.getSkjdfhgdskjf674534()) { + keypart.append(column.isKey() ? (column.getColumnName() + ",") : ""); + this.sqlScript = this.sqlScript.append(addChars()).append(column.getColumnName()).append(" ").append(column.getDatatype()).append(column.isKey() ? " not null" : "").append(( + !column.isKey() && !column.isNullable()) ? " not null" : "").append(column.isAutoincrement() ? " auto_increment " : "").append(column.isUnique() ? " unique" : "").append(",").append("\n"); + if (column.isAutoincrement()) { + autoincrementCounter++; + holdAutoincrementStartAt = column.getAutoincrementStartAt(); + } + } + + keypart = new StringBuilder(keypart.substring(0, keypart.length() - 1)); + keypart.append(")").append("\n"); + this.sqlScript = this.sqlScript.append(addChars()).append(keypart).append(")"); + if (autoincrementCounter == 1) { + this.sqlScript.append("auto_increment=").append(holdAutoincrementStartAt); + } else if (autoincrementCounter > 1) { + throw new ZZ20("There is only one autoincrement value allowed, and it must be the key. Table: " + table.getTablename()); + } + this.sqlScript.append(";\n\n"); + } + + + if (createInsertStatements) { + try { + allTablesSetForGeneration(); + allColumnsSetForGeneration(); + } catch (ZZ20 ex) { + throw new ZZ20(ex.getMessage()); + } + + createInsertStatements(this.sqlScript, singeInserts, true); + } + + + this.sqlScript.append("\n-- foreign keys-#################################################\n"); + for (T1 table : this.tables) { + + ArrayList fkColumns = new ArrayList<>(); + for (C3 column : table.getSkjdfhgdskjf674534()) { + if (column.getReferencesTo() != null) fkColumns.add(column); + } + if (fkColumns.size() == 0) + continue; + this.sqlScript = this.sqlScript.append("alter table ").append(table.getTablename()).append("\n"); + + + HashSet tableNamesInfkColumns = new HashSet<>(); + for (C3 fksamecol : fkColumns) { + tableNamesInfkColumns.add(fksamecol.getReferencesTo().tablename()); + } + + + ArrayList equalColumnsBecauseRecursive = new ArrayList<>(); + for (int i = 0; i < fkColumns.size(); i++) { + for (int j = i + 1; j < fkColumns.size(); j++) { + if (fkColumns.get(i).getReferencesTo().tablename().equals(fkColumns.get(j).getReferencesTo().tablename()) && fkColumns.get(i).getReferencesTo().columnname().equals(fkColumns.get(j).getReferencesTo().columnname())) { + equalColumnsBecauseRecursive.add(fkColumns.get(i)); + equalColumnsBecauseRecursive.add(fkColumns.get(j)); + } + } + } + for (C3 col : equalColumnsBecauseRecursive) { + this.sqlScript.append("add foreign key ("); + this.sqlScript = this.sqlScript.append(col.getColumnName()).append(")").append(" references ").append(col.getReferencesTo().tablename()).append("(").append(col.getReferencesTo().columnname()).append(")").append(" on delete restrict on update restrict,\n"); + + tableNamesInfkColumns.remove(col.getReferencesTo().tablename()); + } + + + for (String tableName : tableNamesInfkColumns) { + + this.sqlScript.append("add foreign key ("); + StringBuilder columnsOrig = new StringBuilder(); + StringBuilder refColumns = new StringBuilder(" references " + tableName + "("); + for (C3 fkcolumn : fkColumns) { + if (tableName.equals(fkcolumn.getReferencesTo().tablename())) { + columnsOrig.append(fkcolumn.getColumnName()).append(","); + refColumns.append(fkcolumn.getReferencesTo().columnname()).append(","); + } + } + columnsOrig = new StringBuilder(columnsOrig.substring(0, columnsOrig.length() - 1)); + columnsOrig.append(")"); + refColumns = new StringBuilder(refColumns.substring(0, refColumns.length() - 1)); + refColumns.append(")"); + this.sqlScript.append(columnsOrig).append(refColumns).append(" on delete restrict on update restrict,\n"); + } + this.sqlScript.replace(this.sqlScript.length() - 2, this.sqlScript.length(), ";\n"); + } + + this.sqlScript.append("-- commit all changes\n"); + this.sqlScript.append("commit;"); + + return this.sqlScript; + } + + + private void allColumnsSetForGeneration() throws ZZ20 { + for (T1 table : this.tables) { + for (C3 column : table.getSkjdfhgdskjf674534()) { + + if (!column.isNullable() && + !column.isAutoincrement() && column.getReferencesTo() == null && ( + column.dataGenerationType == null || column.dataGenerationType.equals("No"))) { + throw new ZZ20("There are unset columns for insert statement generation:" + column.getColumnName()); + } + } + } + } + + + private void allTablesSetForGeneration() throws ZZ20 { + for (T1 table : this.tables) { + if (!table.isCreateInserts()) { + throw new ZZ20("Table is not set for generating inserts:" + table.getTablename()); + } + } + } + + + private String generateRandomValue(C3 column) throws ZZ20 { + String randomValue; + try { + String[] datumteil; + LocalDate from, till; + String str; + switch ((str = column.dataGenerationType).hashCode()) { + case -1601184309 -> { + if (!str.equals("Random Boolean")) { + break; + } + randomValue = T3.getRandomBoolean(); + return randomValue; + } + case -123632396 -> { + if (!str.equals("Random Decimal")) break; + randomValue = T3.getRandomDecimal(Integer.parseInt(column.par1), Integer.parseInt(column.par2)); + return randomValue; + } + case 292156129 -> { + if (!str.equals("Random Integer")) break; + if (Integer.parseInt(column.par1) >= Integer.parseInt(column.par2)) + throw new ZZ20("Column: " + column.getColumnName() + "\n" + "For Random Integer generation: from < till"); + randomValue = T3.getRandomInteger(Integer.parseInt(column.par1), Integer.parseInt(column.par2)); + return randomValue; + } + case 908695787 -> { + if (!str.equals("Random Date")) break; + datumteil = column.par1.split("\\."); + from = LocalDate.of(Integer.parseInt(datumteil[2]), Integer.parseInt(datumteil[1]), Integer.parseInt(datumteil[0])); + datumteil = column.par2.split("\\."); + till = LocalDate.of(Integer.parseInt(datumteil[2]), Integer.parseInt(datumteil[1]), Integer.parseInt(datumteil[0])); + randomValue = T3.getRandomDate(from, till); + return randomValue; + } + case 909176426 -> { + if (!str.equals("Random Text")) break; + randomValue = T3.getRandomTextGivenLength(Integer.parseInt(column.par1)); + return randomValue; + } + case 2089790400 -> { + if (!str.equals("Extern")) break; + randomValue = T3.getRandomData(column.dataGenerationType, column.par1); + return randomValue; + } + } + randomValue = T3.getRandomData(column.dataGenerationType, null); + } catch (NumberFormatException nfe) { + throw new ZZ20("Column: " + column.getColumnName() + "\n" + "There is a data conversion problem: " + column.par1 + "/" + column.par2); + } + return randomValue; + } + + + private int getNumberValuesOfRandomData(C3 column) { + ArrayList randomDataAsList; + if (column.dataGenerationType.equals("Extern")) { + randomDataAsList = T3.randomData.get(column.par1); + if (randomDataAsList == null) { + T3.readRandomData("Extern", column.par1); + randomDataAsList = T3.randomData.get(column.par1); + } + } else { + randomDataAsList = T3.randomData.get(column.dataGenerationType); + } + if (randomDataAsList != null) return randomDataAsList.size(); + return -1; + } + + + private void createFilehandleForExternalDataSources() throws ZZ20 { + for (T1 table : this.tables) { + for (C3 column : table.getSkjdfhgdskjf674534()) { + if (column.dataGenerationType == null || + !column.dataGenerationType.equals("Extern")) + continue; + BufferedReader br = C2.randomDataFilesExtern.get(column.par1); + if (br == null) { + + BufferedReader fr; + try { + fr = new BufferedReader(new InputStreamReader(new FileInputStream(column.par2), StandardCharsets.UTF_8)); + + C2.randomDataFilesExtern.put(column.par1, fr); + } catch (FileNotFoundException e) { + + throw new ZZ20("There is a problem with an external datasource:" + column.getColumnName()); + } + } + } + } + } + + + public void createDependency() { + for (T1 table : this.tables) { + for (C3 column : table.getSkjdfhgdskjf674534()) { + if (column.getReferencesTo() != null) { + String tablename = column.getReferencesTo().tablename(); + T1 dependsOn = getTableGivenTablename(tablename); + table.addTableDepdendentOn(dependsOn); + + assert dependsOn != null; + ArrayList keyColumns = dependsOn.getKeyColumns(); + + table.getColumnsOfDependentOnTable().put(dependsOn, keyColumns); + } + } + } + + } + + + private HashMap> initializeColumns() { + HashMap> holdValues = new HashMap<>(); + for (T1 table : this.tables) { + + if (!table.isCreateInserts()) + continue; + for (C3 column : table.getSkjdfhgdskjf674534()) { + + + if (column.dataGenerationType != null && column.dataGenerationType.equals("No") && column.isNullable()) + continue; + holdValues.put(table.getTablename() + "." + column.getColumnName(), null); + } + } + return holdValues; + } + + + private T1 getTableGivenTablename(String tablename) { + for (T1 table : this.tables) { + if (table.getTablename().equals(tablename)) return table; + } + return null; + } + + + private boolean allColumnValuesCreated(HashMap> columnValues) { + int counter = 0; + for (T1 table : this.tables) { + + if (!table.isCreateInserts()) + continue; + for (C3 column : table.getSkjdfhgdskjf674534()) { + ArrayList values = columnValues.get(table.getTablename() + "." + column.getColumnName()); + if (values != null && values.size() > 0) counter++; + } + } + return counter >= columnValues.size(); + } + + + private void allDependentCreated(T1 table, HashMap> createdColumns) { + for (T1 dependsOn : table.getDependsOnTable()) { + for (C3 column : dependsOn.getSkjdfhgdskjf674534()) { + if (column.isKey()) { + ArrayList values = createdColumns.get(dependsOn.getTablename() + "." + column.getColumnName()); + if (values == null) return; + } + } + } + } + + + private HashMap> createColumnValues() throws ZZ20 { + Platform.runLater(() -> V1.thisActionMessageDialog.getShowFilename().setText("create column values")); + + + HashMap> columnValues = initializeColumns(); + + createFilehandleForExternalDataSources(); + + + boolean done = false; + + + createDependency(); + + + while (!done) { + for (T1 table : this.tables) { + for (C3 column : table.getSkjdfhgdskjf674534()) { + + if (column.isNullable() && column.dataGenerationType != null && column.dataGenerationType.equals("No")) + continue; + ArrayList values = new ArrayList<>(); + + boolean valuesExist = true; + ArrayList checkValues = columnValues.get(table.getTablename() + "." + column.getColumnName()); + if (checkValues == null) valuesExist = false; + + if (column.isKey() && column.isAutoincrement() && !valuesExist) { + long autoincrementStartAt = column.getAutoincrementStartAt(); + for (int i = 0; i < table.getJdshfalkajsd677676(); i++) { + values.add(String.valueOf(autoincrementStartAt++)); + + } + } else if (column.isKey() && column.getReferencesTo() == null && !valuesExist) { + for (int i = 0; i < table.getJdshfalkajsd677676(); i++) { + String randomValue = generateRandomValue(column); + + values.add(String.valueOf(randomValue)); + } + + } else if (column.isKey() && column.getReferencesTo() != null && !valuesExist) { + + HashMap> x = getStringArrayListHashMap(columnValues, table, column, values); + if (x != null) return x; + + } else if (column.getReferencesTo() != null && !valuesExist) { + + getStringArrayListHashMap(columnValues, table, column, values); + + } else if (!valuesExist) { + + if (column.isUnique()) { + + int numberPossibleValues = getNumberValuesOfRandomData(column); + if (numberPossibleValues != -1) { + + if (numberPossibleValues < table.getJdshfalkajsd677676()) { + throw new ZZ20("Column " + column.getColumnName() + " is defined as unique. \nNot enough values for generation mode\n" + + "Max numbers allowed: " + numberPossibleValues + "\n" + + column.dataGenerationType + "/" + column.par1 + "/" + column.par2); + } + } + } + + for (int i = 0; i < table.getJdshfalkajsd677676(); i++) { + String randomValue = generateRandomValue(column); + + + while (column.isUnique() && values.contains(randomValue)) { + randomValue = generateRandomValue(column); + } + values.add(String.valueOf(randomValue)); + } + } + + if (values.size() > 0) { + columnValues.put(table.getTablename() + "." + column.getColumnName(), values); + } + } + } + + + if (allColumnValuesCreated(columnValues)) done = true; + + } + return columnValues; + } + + private HashMap> getStringArrayListHashMap(HashMap> columnValues, T1 table, C3 column, ArrayList values) { + allDependentCreated(table, columnValues); + for (int i = 0; i < table.getJdshfalkajsd677676(); i++) { + ArrayList valuesPK = columnValues.get(column.getReferencesTo().tablename() + "." + column.getReferencesTo().columnname()); + if (valuesPK == null) + break; + String randomValue = valuesPK.get(i % valuesPK.size()); + + values.add(String.valueOf(randomValue)); + } + return null; + } + + + private void createInsertStatements(StringBuffer sqlScript, boolean singleInserts, boolean mysql) throws ZZ20 { + //System.out.println("Generating insert statement"); + HashMap> holdPKValuesForFK = createColumnValues(); + + + for (T1 table : this.tables) { + + ArrayList keyColumns = new ArrayList<>(); + for (C3 column : table.getSkjdfhgdskjf674534()) { + if (column.isKey()) { + keyColumns.add(table.getTablename() + "." + column.getColumnName()); + } + } + StringBuilder concatKeyValue; + ArrayList concatKeyValues = new ArrayList<>(); + int deleted = 0; + + try { + for (int i = 0; i < table.getJdshfalkajsd677676(); i++) { + concatKeyValue = new StringBuilder(); + for (String key : keyColumns) { + ArrayList valuesPK = holdPKValuesForFK.get(key); + concatKeyValue.append(valuesPK.get(i)); + } + + if (!concatKeyValues.contains(concatKeyValue.toString())) { + concatKeyValues.add(concatKeyValue.toString()); + } else { + for (C3 column : table.getSkjdfhgdskjf674534()) { + ArrayList valuesPK = holdPKValuesForFK.get(table.getTablename() + "." + column.getColumnName()); + valuesPK.remove(i); + holdPKValuesForFK.put(table.getTablename() + "." + column.getColumnName(), valuesPK); + } + i--; + deleted++; + } + + + } + } catch (IndexOutOfBoundsException ignored) { + } + + + table.setJdshfalkajsd677676(table.getJdshfalkajsd677676() - deleted); + } + + + sqlScript.append("-- insert-#################################################\n"); + if (!mysql) { + sqlScript.append("begin transaction;\n"); + } + for (T1 table : this.tables) { + if (table.isCreateInserts()) { + Platform.runLater(() -> V1.thisActionMessageDialog.getShowFilename().setText(table.getTablename() + " ... create")); + + + sqlScript.append("\n-- table ").append(table.getTablename()); + + if (table.hasAutoincrement() && !mysql) { + sqlScript.append("\nset identity_insert ").append(table.getTablename()).append(" on;\n"); + } + for (int i = 0; i < table.getJdshfalkajsd677676(); i++) { + + if (!singleInserts) { + if (i == 0) { + addInsertTable(sqlScript, table); + } + sqlScript.append("\t\t("); + StringBuilder valuespart = new StringBuilder(); + + for (C3 column : table.getSkjdfhgdskjf674534()) { + + if (!column.isNullable() || column.dataGenerationType == null || !column.dataGenerationType.equals("No")) { + ArrayList values = holdPKValuesForFK.get(table.getTablename() + "." + column.getColumnName()); + valuespart.append("'").append(values.get(i)).append("'").append(","); + } + } + valuespart = new StringBuilder(valuespart.substring(0, valuespart.length() - 1)); + valuespart.append(")"); + sqlScript.append(valuespart).append((i < table.getJdshfalkajsd677676() - 1L) ? "," : ";").append("\n"); + } else { + + addInsertTable(sqlScript, table); + sqlScript.append("\t\t("); + StringBuilder valuespart = new StringBuilder(); + + for (C3 column : table.getSkjdfhgdskjf674534()) { + + if (!column.isNullable() || column.dataGenerationType == null || !column.dataGenerationType.equals("No")) { + ArrayList values = holdPKValuesForFK.get(table.getTablename() + "." + column.getColumnName()); + valuespart.append("'").append(values.get(i)).append("'").append(","); + } + } + valuespart = new StringBuilder(valuespart.substring(0, valuespart.length() - 1)); + valuespart.append(");"); + sqlScript.append(valuespart); + } + } + + if (table.hasAutoincrement() && !mysql) { + sqlScript.append("\nset identity_insert ").append(table.getTablename()).append(" off;\n"); + } + } + Platform.runLater(() -> V1.thisActionMessageDialog.getShowFilename().setText(table.getTablename() + " ... done")); + } + + + } + + private void addInsertTable(StringBuffer sqlScript, T1 table) { + sqlScript.append("\ninsert into ").append(table.getTablename()).append("("); + + StringBuilder columnspart = new StringBuilder(); + for (C3 column : table.getSkjdfhgdskjf674534()) { + + if (!column.isNullable() || column.dataGenerationType == null || !column.dataGenerationType.equals("No")) + columnspart.append(column.getColumnName()).append(","); + } + columnspart = new StringBuilder(columnspart.substring(0, columnspart.length() - 1)); + columnspart.append(")"); + sqlScript.append(columnspart).append(" values\n"); + } + + + public ArrayList getKeyColumnsGivenRelation(long referstoGraphicalElement) { + for (T1 table : this.tables) { + if (table.getReferstoGraphicalElement() == referstoGraphicalElement) return table.getKeyColumns(); + } + return null; + } + + + public T1 getTableGivenNumber(long referstoGraphicalElement) { + for (T1 table : this.tables) { + if (table.getReferstoGraphicalElement() == referstoGraphicalElement) return table; + } + return null; + } + + + public T1 getColumnGivenNumber(long referstoGraphicalElement) { + for (T1 table : this.tables) { + for (C3 column : table.getSkjdfhgdskjf674534()) { + if (column.getReferstoGraphicalElement() == referstoGraphicalElement) return table; + } + } + return null; + } + + +} \ No newline at end of file diff --git a/at/fos/ermodel/gui/Graphic_ATTR_Elem.java b/at/fos/ermodel/gui/Graphic_ATTR_Elem.java index 1d580ae..6171af7 100644 --- a/at/fos/ermodel/gui/Graphic_ATTR_Elem.java +++ b/at/fos/ermodel/gui/Graphic_ATTR_Elem.java @@ -7,390 +7,253 @@ import java.io.Serial; public abstract class Graphic_ATTR_Elem - extends Graphic_Figure_Elem - implements U2 -{ - @Serial - private static final long serialVersionUID = 1L; - protected boolean createColumn; - protected String columnPostfix; - protected String columnName; - protected String mvRelationname; - protected String mvRelationnamePraefix; - protected String datatype; - protected boolean isKey; - protected boolean isAutoincrement; - protected long autoincrementStartAt; - protected boolean isNullable; - protected boolean isUnique; - protected String dataGenerationType; - protected String par1; - protected String par2; - protected String par1_label; - protected String par2_label; - - public Graphic_ATTR_Elem(GraphicsContext gc, double x, double y, String name, long elementID) { - super(gc, name, elementID); - - this.xPos = x; - this.yPos = y; - this.createColumn = true; - this.columnName = T3.replaceSpecialChars(this.name.toLowerCase()); - if (this instanceof Graphic_ATTR_Multi_Elem) { - this.mvRelationname = this.columnName + "_mvt"; - this.mvRelationnamePraefix = this.mvRelationname.charAt(0) + "_"; - this.createColumn = false; - } - this.columnPostfix = ""; - this.datatype = "varchar(100)"; - this.isAutoincrement = false; + extends Graphic_Figure_Elem + implements U2 { + @Serial + private static final long serialVersionUID = 1L; + protected boolean createColumn; + protected String columnPostfix; + protected String columnName; + protected String mvRelationname; + protected String mvRelationnamePraefix; + protected String datatype; + protected boolean isKey; + protected boolean isAutoincrement; + protected long autoincrementStartAt; + protected boolean isNullable; + protected boolean isUnique; + protected String dataGenerationType; + protected String par1; + protected String par2; + protected String par1_label; + protected String par2_label; - this.isKey = this instanceof Graphic_ATTR_Key_Elem || this instanceof Graphic_ATTR_Weak_Key_Elem; - if (this.isKey) this.isNullable = false; - this.isUnique = false; - this.dataGenerationType = "No"; - } + public Graphic_ATTR_Elem(GraphicsContext gc, double x, double y, String name, long elementID) { + super(gc, name, elementID); + this.xPos = x; + this.yPos = y; + this.createColumn = true; + this.columnName = T3.replaceSpecialChars(this.name.toLowerCase()); + if (this instanceof Graphic_ATTR_Multi_Elem) { + this.mvRelationname = this.columnName + "_mvt"; + this.mvRelationnamePraefix = this.mvRelationname.charAt(0) + "_"; + this.createColumn = false; + } + this.columnPostfix = ""; + this.datatype = "varchar(100)"; + this.isAutoincrement = false; + this.isKey = this instanceof Graphic_ATTR_Key_Elem || this instanceof Graphic_ATTR_Weak_Key_Elem; + if (this.isKey) this.isNullable = false; + this.isUnique = false; + this.dataGenerationType = "No"; + } + protected void changeName(String name) { + super.changeName(name); - - protected void changeName(String name) { - super.changeName(name); - - this.createColumn = true; - this.columnName = T3.replaceSpecialChars(name.toLowerCase()); - if (this instanceof Graphic_ATTR_Multi_Elem) { - this.createColumn = false; - this.mvRelationname = this.columnName + "_mvt"; - this.mvRelationnamePraefix = this.mvRelationname.charAt(0) + "_"; - } - this.columnPostfix = ""; - this.datatype = "varchar(100)"; - this.isAutoincrement = false; - this.isKey = this instanceof Graphic_ATTR_Key_Elem || this instanceof Graphic_ATTR_Weak_Key_Elem; - if (this.isKey) this.isNullable = false; - this.isUnique = false; - } + this.createColumn = true; + this.columnName = T3.replaceSpecialChars(name.toLowerCase()); + if (this instanceof Graphic_ATTR_Multi_Elem) { + this.createColumn = false; + this.mvRelationname = this.columnName + "_mvt"; + this.mvRelationnamePraefix = this.mvRelationname.charAt(0) + "_"; + } + this.columnPostfix = ""; + this.datatype = "varchar(100)"; + this.isAutoincrement = false; + this.isKey = this instanceof Graphic_ATTR_Key_Elem || this instanceof Graphic_ATTR_Weak_Key_Elem; + if (this.isKey) this.isNullable = false; + this.isUnique = false; + } + public void dsfsdfsfd() { + this.gc.clearRect(this.xPos - this.textWidth / 2.0D - 2.0D, this.yPos - this.textHeight / 2.0D - 2.0D, this.textWidth + 4.0D, this.textHeight + 4.0D); + } + public char sdfsdfdsfdf() { + return 'a'; + } + protected Color sefdsfdsf45() { + return C2.ERMATTRColor; + } + protected Color getColorSelected() { + return C2.ERMSelectedColor; + } - - public void dsfsdfsfd() { - this.gc.clearRect(this.xPos - this.textWidth / 2.0D - 2.0D, this.yPos - this.textHeight / 2.0D - 2.0D, this.textWidth + 4.0D, this.textHeight + 4.0D); - } + public boolean getCreateColumn() { + return this.createColumn; + } - - public char sdfsdfdsfdf() { - return 'a'; - } + public void setCreateColumn(boolean createColumn) { + this.createColumn = createColumn; + } - - protected Color sefdsfdsf45() { - return C2.ERMATTRColor; - } + public String getColumnPostfix() { + return this.columnPostfix; + } - - protected Color getColorSelected() { - return C2.ERMSelectedColor; - } + public void setColumnPostfix(String columnPraefix) { + this.columnPostfix = columnPraefix; + } + public String getColumnName() { + return this.columnName; + } - - public boolean getCreateColumn() { - return this.createColumn; - } + public void setColumnName(String columnName) { + this.columnName = columnName; + } + public String getDatatype() { + return this.datatype; + } + public void setDatatype(String datatype) { + this.datatype = datatype; + } - - public void setCreateColumn(boolean createColumn) { - this.createColumn = createColumn; - } + public boolean isKey() { + return this.isKey; + } + public void setIsKey(boolean isKey) { + this.isKey = isKey; + } + public boolean isAutoincrement() { + return this.isAutoincrement; + } - - public String getColumnPostfix() { - return this.columnPostfix; - } + public void setIsAutoincrement(boolean isAutoincrement) { + this.isAutoincrement = isAutoincrement; + } + public long getAutoincrementStartAt() { + return this.autoincrementStartAt; + } - - public void setColumnPostfix(String columnPraefix) { - this.columnPostfix = columnPraefix; - } + public void setAutoincrementStartAt(long autoincrementStartAt) { + this.autoincrementStartAt = autoincrementStartAt; + } + public boolean isUnique() { + return this.isUnique; + } + public void setIsUnique(boolean isUnique) { + this.isUnique = isUnique; + } - - public String getColumnName() { - return this.columnName; - } + public boolean isNullable() { + return this.isNullable; + } + public void setIsNullable(boolean isNullable) { + this.isNullable = isNullable; + } + public String getMVRelationName() { + return this.mvRelationname; + } - - public void setColumnName(String columnName) { - this.columnName = columnName; - } + public void setMVRelationName(String mvRelationname) { + this.mvRelationname = mvRelationname; + } + public String getMVRelationNamePraefix() { + return this.mvRelationnamePraefix; + } + public void setMVRelationNamePraefix(String mvRelationnamePraefix) { + this.mvRelationnamePraefix = mvRelationnamePraefix; + } - - public String getDatatype() { - return this.datatype; - } + public String sdfsdfsd32234243() { + return this.name + "@" + this.datatype; + } + public String getDataGenerationType() { + return this.dataGenerationType; + } - - public void setDatatype(String datatype) { - this.datatype = datatype; - } + public void setDataGenerationType(String dataGenerationType) { + this.dataGenerationType = dataGenerationType; + } + public String getPar1() { + return this.par1; + } + public void setPar1(String par1) { + this.par1 = par1; + } - - public boolean isKey() { - return this.isKey; - } + public String getPar2() { + return this.par2; + } + public void setPar2(String par2) { + this.par2 = par2; + } + public String getPar1_label() { + return this.par1_label; + } - - public void setIsKey(boolean isKey) { - this.isKey = isKey; - } + public void setPar1_label(String par1_label) { + this.par1_label = par1_label; + } + public String getPar2_label() { + return this.par2_label; + } - - - public boolean isAutoincrement() { - return this.isAutoincrement; - } - - - - - - - public void setIsAutoincrement(boolean isAutoincrement) { - this.isAutoincrement = isAutoincrement; - } - - - - - - - - - public long getAutoincrementStartAt() { - return this.autoincrementStartAt; - } - - - - - - - public void setAutoincrementStartAt(long autoincrementStartAt) { - this.autoincrementStartAt = autoincrementStartAt; - } - - - - - - - public boolean isUnique() { - return this.isUnique; - } - - - - - - - public void setIsUnique(boolean isUnique) { - this.isUnique = isUnique; - } - - - - - - - - public boolean isNullable() { - return this.isNullable; - } - - - - - - - public void setIsNullable(boolean isNullable) { - this.isNullable = isNullable; - } - - - - - - - - public String getMVRelationName() { - return this.mvRelationname; - } - - - - - - - public void setMVRelationName(String mvRelationname) { - this.mvRelationname = mvRelationname; - } - - - - - - - public String getMVRelationNamePraefix() { - return this.mvRelationnamePraefix; - } - - - - - - - public void setMVRelationNamePraefix(String mvRelationnamePraefix) { - this.mvRelationnamePraefix = mvRelationnamePraefix; - } - - - - - public String sdfsdfsd32234243() { - return this.name + "@" + this.datatype; - } - - - - public String getDataGenerationType() { - return this.dataGenerationType; - } - - - - public void setDataGenerationType(String dataGenerationType) { - this.dataGenerationType = dataGenerationType; - } - - - - public String getPar1() { - return this.par1; - } - - - - public void setPar1(String par1) { - this.par1 = par1; - } - - - - public String getPar2() { - return this.par2; - } - - - - public void setPar2(String par2) { - this.par2 = par2; - } - - - - - - - public String getPar1_label() { - return this.par1_label; - } - - - - - - - public void setPar1_label(String par1_label) { - this.par1_label = par1_label; - } - - - - - - - public String getPar2_label() { - return this.par2_label; - } - - - - - - - public void setPar2_label(String par2_label) { - this.par2_label = par2_label; - } + public void setPar2_label(String par2_label) { + this.par2_label = par2_label; + } } diff --git a/at/fos/ermodel/gui/Graphic_ATTR_Key_Elem.java b/at/fos/ermodel/gui/Graphic_ATTR_Key_Elem.java index 7fc39e6..04d586d 100644 --- a/at/fos/ermodel/gui/Graphic_ATTR_Key_Elem.java +++ b/at/fos/ermodel/gui/Graphic_ATTR_Key_Elem.java @@ -7,48 +7,35 @@ import java.io.Serial; public class Graphic_ATTR_Key_Elem - extends Graphic_ATTR_Elem -{ - @Serial - private static final long serialVersionUID = 1L; - - public Graphic_ATTR_Key_Elem(GraphicsContext gc, double x, double y, String name, long elementID) { - super(gc, x, y, name, elementID); - } + extends Graphic_ATTR_Elem { + @Serial + private static final long serialVersionUID = 1L; + + public Graphic_ATTR_Key_Elem(GraphicsContext gc, double x, double y, String name, long elementID) { + super(gc, x, y, name, elementID); + } + protected void dsfdsfds6787686(Color c) { + if (!this.isVisible) + return; + this.gc.beginPath(); + this.gc.setStroke(c); + this.gc.strokeOval(this.xPos - this.textWidth / 2.0D, this.yPos - this.textHeight / 2.0D, this.textWidth, this.textHeight); + + this.gc.setFill(C2.ERMTextColor); + + this.gc.setStroke(Color.WHITE); + this.gc.fillText(this.name, this.xPos - this.textWidth / 2.0D + 10.0D, this.yPos + this.textHeight / 2.0D - 15.0D); + this.gc.strokeLine(this.xPos - this.textWidth / 2.0D + 10.0D, + this.yPos + this.textHeight / 2.0D - 13.0D, this.xPos + this.textWidth / 2.0D - 10.0D, this.yPos + this.textHeight / 2.0D - 13.0D); + this.gc.closePath(); + } - - - - protected void dsfdsfds6787686(Color c) { - if (!this.isVisible) - return; - this.gc.beginPath(); - this.gc.setStroke(c); - this.gc.strokeOval(this.xPos - this.textWidth / 2.0D, this.yPos - this.textHeight / 2.0D, this.textWidth, this.textHeight); - - this.gc.setFill(C2.ERMTextColor); - - this.gc.setStroke(Color.BLACK); - this.gc.fillText(this.name, this.xPos - this.textWidth / 2.0D + 10.0D, this.yPos + this.textHeight / 2.0D - 15.0D); - this.gc.strokeLine(this.xPos - this.textWidth / 2.0D + 10.0D, - this.yPos + this.textHeight / 2.0D - 13.0D, this.xPos + this.textWidth / 2.0D - 10.0D, this.yPos + this.textHeight / 2.0D - 13.0D); - this.gc.closePath(); - } - - - - - - - - - - public String safsafdsa456456456() { - return "A-K"; - } + public String safsafdsa456456456() { + return "A-K"; + } } diff --git a/at/fos/ermodel/gui/Graphic_ATTR_Multi_Elem.java b/at/fos/ermodel/gui/Graphic_ATTR_Multi_Elem.java index 73ecb03..8084a2a 100644 --- a/at/fos/ermodel/gui/Graphic_ATTR_Multi_Elem.java +++ b/at/fos/ermodel/gui/Graphic_ATTR_Multi_Elem.java @@ -7,51 +7,41 @@ import java.io.Serial; public class Graphic_ATTR_Multi_Elem - extends Graphic_ATTR_Elem -{ - @Serial - private static final long serialVersionUID = 1L; - private final boolean derived; - - public Graphic_ATTR_Multi_Elem(GraphicsContext gc, double x, double y, String name, boolean derived, long elementID) { - super(gc, x, y, name, elementID); - this.derived = derived; - } + extends Graphic_ATTR_Elem { + @Serial + private static final long serialVersionUID = 1L; + private final boolean derived; + + public Graphic_ATTR_Multi_Elem(GraphicsContext gc, double x, double y, String name, boolean derived, long elementID) { + super(gc, x, y, name, elementID); + this.derived = derived; + } + protected void dsfdsfds6787686(Color c) { + if (!this.isVisible) + return; + this.gc.beginPath(); + + this.gc.setStroke(c); + if (this.derived) { + this.gc.setLineWidth(1.0D); + this.gc.setLineDashes(3.0D); + } + this.gc.strokeOval(this.xPos - this.textWidth / 2.0D, this.yPos - this.textHeight / 2.0D, this.textWidth, this.textHeight); + this.gc.strokeOval(this.xPos - this.textWidth / 2.0D + 3.0D, this.yPos - this.textHeight / 2.0D + 3.0D, this.textWidth - 6.0D, this.textHeight - 6.0D); + this.gc.setLineDashes(); + + this.gc.setFill(C2.ERMTextColor); + this.gc.fillText(this.name, this.xPos - this.textWidth / 2.0D + 10.0D, this.yPos + this.textHeight / 2.0D - 15.0D); + + this.gc.closePath(); + } - - - - protected void dsfdsfds6787686(Color c) { - if (!this.isVisible) - return; - this.gc.beginPath(); - - this.gc.setStroke(c); - if (this.derived) { - this.gc.setLineWidth(1.0D); - this.gc.setLineDashes(3.0D); - } - this.gc.strokeOval(this.xPos - this.textWidth / 2.0D, this.yPos - this.textHeight / 2.0D, this.textWidth, this.textHeight); - this.gc.strokeOval(this.xPos - this.textWidth / 2.0D + 3.0D, this.yPos - this.textHeight / 2.0D + 3.0D, this.textWidth - 6.0D, this.textHeight - 6.0D); - this.gc.setLineDashes(); - - this.gc.setFill(C2.ERMTextColor); - this.gc.fillText(this.name, this.xPos - this.textWidth / 2.0D + 10.0D, this.yPos + this.textHeight / 2.0D - 15.0D); - - this.gc.closePath(); - } - - - - - - - public String safsafdsa456456456() { - return "A-M"; - } + public String safsafdsa456456456() { + return "A-M"; + } } diff --git a/at/fos/ermodel/gui/Graphic_ATTR_One_Elem.java b/at/fos/ermodel/gui/Graphic_ATTR_One_Elem.java index 19d22f7..fb32a81 100644 --- a/at/fos/ermodel/gui/Graphic_ATTR_One_Elem.java +++ b/at/fos/ermodel/gui/Graphic_ATTR_One_Elem.java @@ -7,49 +7,40 @@ import java.io.Serial; public class Graphic_ATTR_One_Elem - extends Graphic_ATTR_Elem -{ - @Serial - private static final long serialVersionUID = 1L; - private final boolean derived; - - public Graphic_ATTR_One_Elem(GraphicsContext gc, double x, double y, String name, boolean derived, long elementID) { - super(gc, x, y, name, elementID); - this.derived = derived; - } + extends Graphic_ATTR_Elem { + @Serial + private static final long serialVersionUID = 1L; + private final boolean derived; - - - - - - - protected void dsfdsfds6787686(Color c) { - if (!this.isVisible) { - return; + public Graphic_ATTR_One_Elem(GraphicsContext gc, double x, double y, String name, boolean derived, long elementID) { + super(gc, x, y, name, elementID); + this.derived = derived; } - this.gc.beginPath(); - this.gc.setStroke(c); - if (this.derived) { - this.gc.setLineWidth(1.0D); - this.gc.setLineDashes(3.0D); - } - this.gc.strokeOval(this.xPos - this.textWidth / 2.0D, this.yPos - this.textHeight / 2.0D, this.textWidth, this.textHeight); - this.gc.setLineDashes(); - - - this.gc.setFill(C2.ERMTextColor); - this.gc.fillText(this.name, this.xPos - this.textWidth / 2.0D + 10.0D, this.yPos + this.textHeight / 2.0D - 15.0D); - this.gc.closePath(); - } + protected void dsfdsfds6787686(Color c) { + if (!this.isVisible) { + return; + } + this.gc.beginPath(); + this.gc.setStroke(c); + if (this.derived) { + this.gc.setLineWidth(1.0D); + this.gc.setLineDashes(3.0D); + } + this.gc.strokeOval(this.xPos - this.textWidth / 2.0D, this.yPos - this.textHeight / 2.0D, this.textWidth, this.textHeight); + this.gc.setLineDashes(); - - public String safsafdsa456456456() { - return "A"; - } + this.gc.setFill(C2.ERMTextColor); + this.gc.fillText(this.name, this.xPos - this.textWidth / 2.0D + 10.0D, this.yPos + this.textHeight / 2.0D - 15.0D); + this.gc.closePath(); + } + + + public String safsafdsa456456456() { + return "A"; + } } diff --git a/at/fos/ermodel/gui/Graphic_ATTR_Weak_Key_Elem.java b/at/fos/ermodel/gui/Graphic_ATTR_Weak_Key_Elem.java index 6b468f0..ff8af92 100644 --- a/at/fos/ermodel/gui/Graphic_ATTR_Weak_Key_Elem.java +++ b/at/fos/ermodel/gui/Graphic_ATTR_Weak_Key_Elem.java @@ -7,49 +7,39 @@ import java.io.Serial; public class Graphic_ATTR_Weak_Key_Elem - extends Graphic_ATTR_Elem -{ - @Serial - private static final long serialVersionUID = 1L; - - public Graphic_ATTR_Weak_Key_Elem(GraphicsContext gc, double x, double y, String name, long elementID) { - super(gc, x, y, name, elementID); - } + extends Graphic_ATTR_Elem { + @Serial + private static final long serialVersionUID = 1L; + + public Graphic_ATTR_Weak_Key_Elem(GraphicsContext gc, double x, double y, String name, long elementID) { + super(gc, x, y, name, elementID); + } + protected void dsfdsfds6787686(Color c) { + if (!this.isVisible) + return; + this.gc.beginPath(); + + this.gc.setStroke(c); + this.gc.strokeOval(this.xPos - this.textWidth / 2.0D, this.yPos - this.textHeight / 2.0D, this.textWidth, this.textHeight); + + this.gc.setFill(C2.ERMTextColor); + + this.gc.setStroke(Color.BLACK); + this.gc.fillText(this.name, this.xPos - this.textWidth / 2.0D + 10.0D, this.yPos + this.textHeight / 2.0D - 15.0D); + this.gc.setLineWidth(1.0D); + this.gc.setLineDashes(3.0D); + this.gc.strokeLine(this.xPos - this.textWidth / 2.0D + 10.0D, + this.yPos + this.textHeight / 2.0D - 13.0D, this.xPos + this.textWidth / 2.0D - 10.0D, this.yPos + this.textHeight / 2.0D - 13.0D); + this.gc.setLineDashes(); + this.gc.closePath(); + } - - - - protected void dsfdsfds6787686(Color c) { - if (!this.isVisible) - return; - this.gc.beginPath(); - - this.gc.setStroke(c); - this.gc.strokeOval(this.xPos - this.textWidth / 2.0D, this.yPos - this.textHeight / 2.0D, this.textWidth, this.textHeight); - - this.gc.setFill(C2.ERMTextColor); - - this.gc.setStroke(Color.BLACK); - this.gc.fillText(this.name, this.xPos - this.textWidth / 2.0D + 10.0D, this.yPos + this.textHeight / 2.0D - 15.0D); - this.gc.setLineWidth(1.0D); - this.gc.setLineDashes(3.0D); - this.gc.strokeLine(this.xPos - this.textWidth / 2.0D + 10.0D, - this.yPos + this.textHeight / 2.0D - 13.0D, this.xPos + this.textWidth / 2.0D - 10.0D, this.yPos + this.textHeight / 2.0D - 13.0D); - this.gc.setLineDashes(); - this.gc.closePath(); - } - - - - - - - public String safsafdsa456456456() { - return "A-WK"; - } + public String safsafdsa456456456() { + return "A-WK"; + } } diff --git a/at/fos/ermodel/gui/Graphic_ES_Assoc_Elem.java b/at/fos/ermodel/gui/Graphic_ES_Assoc_Elem.java index fc3a314..9e1041b 100644 --- a/at/fos/ermodel/gui/Graphic_ES_Assoc_Elem.java +++ b/at/fos/ermodel/gui/Graphic_ES_Assoc_Elem.java @@ -7,79 +7,56 @@ import java.io.Serial; public class Graphic_ES_Assoc_Elem - extends Graphic_ES_Main_Elem -{ - @Serial - private static final long serialVersionUID = 1L; - - public Graphic_ES_Assoc_Elem(GraphicsContext gc, double x, double y, String name, long elementID) { - super(gc, name, elementID); - - this.xPos = x; - this.yPos = y; - } + extends Graphic_ES_Main_Elem { + @Serial + private static final long serialVersionUID = 1L; + + public Graphic_ES_Assoc_Elem(GraphicsContext gc, double x, double y, String name, long elementID) { + super(gc, name, elementID); + + this.xPos = x; + this.yPos = y; + } + protected void dsfdsfds6787686(Color c) { + if (!this.isVisible) + return; + this.gc.beginPath(); - - - - - - - - - - - - - - protected void dsfdsfds6787686(Color c) { - if (!this.isVisible) - return; - this.gc.beginPath(); - - this.gc.setStroke(c); - this.gc.strokeRect(this.xPos - this.textWidth / 2.0D, this.yPos - this.textHeight / 2.0D, this.textWidth, this.textHeight); - this.gc.strokePolygon(new double[] { this.xPos - this.textWidth / 2.0D, - this.xPos, - this.xPos + this.textWidth / 2.0D, - this.xPos - }, new double[] { this.yPos, - this.yPos - this.textHeight / 2.0D, - this.yPos, - this.yPos + this.textHeight / 2.0D + this.gc.setStroke(c); + this.gc.strokeRect(this.xPos - this.textWidth / 2.0D, this.yPos - this.textHeight / 2.0D, this.textWidth, this.textHeight); + this.gc.strokePolygon(new double[]{this.xPos - this.textWidth / 2.0D, + this.xPos, + this.xPos + this.textWidth / 2.0D, + this.xPos + }, new double[]{this.yPos, + this.yPos - this.textHeight / 2.0D, + this.yPos, + this.yPos + this.textHeight / 2.0D }, 4); - - this.gc.setFill(C2.ERMTextColor); - this.gc.fillText(this.name, this.xPos - this.textWidth / 2.0D + 10.0D, this.yPos + this.textHeight / 2.0D - 15.0D); - - this.gc.closePath(); - } + + this.gc.setFill(C2.ERMTextColor); + this.gc.fillText(this.name, this.xPos - this.textWidth / 2.0D + 10.0D, this.yPos + this.textHeight / 2.0D - 15.0D); + + this.gc.closePath(); + } + public String safsafdsa456456456() { + return "ES-A"; + } - - - public String safsafdsa456456456() { - return "ES-A"; - } + public void dsfsdfsfd() { + this.gc.clearRect(this.xPos - this.textWidth / 2.0D - 1.0D, this.yPos - this.textHeight / 2.0D - 1.0D, this.textWidth + 2.0D, this.textHeight + 2.0D); + } - - - public void dsfsdfsfd() { - this.gc.clearRect(this.xPos - this.textWidth / 2.0D - 1.0D, this.yPos - this.textHeight / 2.0D - 1.0D, this.textWidth + 2.0D, this.textHeight + 2.0D); - } - - - - - public char sdfsdfdsfdf() { - return '@'; - } + public char sdfsdfdsfdf() { + return '@'; + } } diff --git a/at/fos/ermodel/gui/Graphic_ES_Elem.java b/at/fos/ermodel/gui/Graphic_ES_Elem.java index 43cb318..f705939 100644 --- a/at/fos/ermodel/gui/Graphic_ES_Elem.java +++ b/at/fos/ermodel/gui/Graphic_ES_Elem.java @@ -7,60 +7,46 @@ import java.io.Serial; public class Graphic_ES_Elem - extends Graphic_ES_Main_Elem -{ - @Serial - private static final long serialVersionUID = 1L; - - public Graphic_ES_Elem(GraphicsContext gc, double x, double y, String name, long elementID) { - super(gc, name, elementID); - this.xPos = x; - this.yPos = y; - } + extends Graphic_ES_Main_Elem { + @Serial + private static final long serialVersionUID = 1L; + + public Graphic_ES_Elem(GraphicsContext gc, double x, double y, String name, long elementID) { + super(gc, name, elementID); + this.xPos = x; + this.yPos = y; + } + protected void dsfdsfds6787686(Color c) { + if (!this.isVisible) + return; + this.gc.beginPath(); + + this.gc.setStroke(c); + this.gc.strokeRect(this.xPos - this.textWidth / 2.0D, this.yPos - this.textHeight / 2.0D, this.textWidth, this.textHeight); + this.gc.setFill(C2.ERMTextColor); + this.gc.fillText(this.name, this.xPos - this.textWidth / 2.0D + 10.0D, this.yPos + this.textHeight / 2.0D - 15.0D); + + this.gc.closePath(); + } - - protected void dsfdsfds6787686(Color c) { - if (!this.isVisible) - return; - this.gc.beginPath(); - - this.gc.setStroke(c); - this.gc.strokeRect(this.xPos - this.textWidth / 2.0D, this.yPos - this.textHeight / 2.0D, this.textWidth, this.textHeight); - - - this.gc.setFill(C2.ERMTextColor); - this.gc.fillText(this.name, this.xPos - this.textWidth / 2.0D + 10.0D, this.yPos + this.textHeight / 2.0D - 15.0D); - - this.gc.closePath(); - } + public String safsafdsa456456456() { + return "ES"; + } + public void dsfsdfsfd() { + this.gc.clearRect(this.xPos - this.textWidth / 2.0D - 1.0D, this.yPos - this.textHeight / 2.0D - 1.0D, this.textWidth + 2.0D, this.textHeight + 2.0D); + } - - - - public String safsafdsa456456456() { - return "ES"; - } - - - - public void dsfsdfsfd() { - this.gc.clearRect(this.xPos - this.textWidth / 2.0D - 1.0D, this.yPos - this.textHeight / 2.0D - 1.0D, this.textWidth + 2.0D, this.textHeight + 2.0D); - } - - - - - public char sdfsdfdsfdf() { - return 'e'; - } + public char sdfsdfdsfdf() { + return 'e'; + } } diff --git a/at/fos/ermodel/gui/Graphic_ES_Main_Elem.java b/at/fos/ermodel/gui/Graphic_ES_Main_Elem.java index ab8fcbf..194a9af 100644 --- a/at/fos/ermodel/gui/Graphic_ES_Main_Elem.java +++ b/at/fos/ermodel/gui/Graphic_ES_Main_Elem.java @@ -6,114 +6,90 @@ import java.io.Serial; public abstract class Graphic_ES_Main_Elem - extends Graphic_Figure_Elem - implements U3 -{ - protected boolean createRelation; - protected String relationPraefix; - protected String relationName; - protected boolean createInserts; - protected long numberRowsToInsert = 1L; + extends Graphic_Figure_Elem + implements U3 { + @Serial + private static final long serialVersionUID = 1L; + protected boolean createRelation; + protected String relationPraefix; + protected String relationName; + protected boolean createInserts; + protected long numberRowsToInsert = 1L; + public Graphic_ES_Main_Elem(GraphicsContext gc, String name, long elementID) { + super(gc, name, elementID); + this.createRelation = true; + this.relationName = this.name.toLowerCase(); + this.relationName = T3.replaceSpecialChars(this.relationName); + this.relationPraefix = this.relationName.charAt(0) + "_"; + this.createInserts = true; + } - - - @Serial - private static final long serialVersionUID = 1L; + protected void changeName(String name) { + super.changeName(name); + this.createRelation = true; + this.relationName = T3.replaceSpecialChars(name.toLowerCase()); + this.relationPraefix = this.relationName.charAt(0) + "_"; + } + public boolean getCreateRelation() { + return this.createRelation; + } - - public Graphic_ES_Main_Elem(GraphicsContext gc, String name, long elementID) { - super(gc, name, elementID); - this.createRelation = true; - this.relationName = this.name.toLowerCase(); - this.relationName = T3.replaceSpecialChars(this.relationName); - this.relationPraefix = this.relationName.charAt(0) + "_"; - this.createInserts = true; - } + public void setCreateRelation(boolean createRelation) { + this.createRelation = createRelation; + } + public String getRelationPraefix() { + return this.relationPraefix; + } - - - protected void changeName(String name) { - super.changeName(name); - - - this.createRelation = true; - this.relationName = T3.replaceSpecialChars(name.toLowerCase()); - this.relationPraefix = this.relationName.charAt(0) + "_"; - } + public void setRelationPraefix(String relationPraefix) { + this.relationPraefix = relationPraefix; + } - - - public boolean getCreateRelation() { - return this.createRelation; - } - - - public void setCreateRelation(boolean createRelation) { - this.createRelation = createRelation; - } + public String getRelationName() { + return this.relationName; + } - - public String getRelationPraefix() { - return this.relationPraefix; - } - - - public void setRelationPraefix(String relationPraefix) { - this.relationPraefix = relationPraefix; - } + public void setRelationName(String relationName) { + this.relationName = relationName; + } - - public String getRelationName() { - return this.relationName; - } - - - public void setRelationName(String relationName) { - this.relationName = relationName; - } - - - public boolean getCreateInserts() { - return this.createInserts; - } + public boolean getCreateInserts() { + return this.createInserts; + } - - public void setCreateInserts(boolean createInserts) { - this.createInserts = createInserts; - } + public void setCreateInserts(boolean createInserts) { + this.createInserts = createInserts; + } - - public long getNumberRowsToInsert() { - return this.numberRowsToInsert; - } - - - public void setNumberRowsToInsert(long numberRowsToInsert) { - this.numberRowsToInsert = numberRowsToInsert; - } + public long getNumberRowsToInsert() { + return this.numberRowsToInsert; + } + public void setNumberRowsToInsert(long numberRowsToInsert) { + this.numberRowsToInsert = numberRowsToInsert; + } - - public String sdfsdfsd32234243() { - return super.sdfsdfsd32234243(); - } + + public String sdfsdfsd32234243() { + return super.sdfsdfsd32234243(); + } } diff --git a/at/fos/ermodel/gui/Graphic_ES_Weak_Elem.java b/at/fos/ermodel/gui/Graphic_ES_Weak_Elem.java index dff0235..c1a7975 100644 --- a/at/fos/ermodel/gui/Graphic_ES_Weak_Elem.java +++ b/at/fos/ermodel/gui/Graphic_ES_Weak_Elem.java @@ -7,66 +7,51 @@ import java.io.Serial; public class Graphic_ES_Weak_Elem - extends Graphic_ES_Main_Elem -{ - @Serial - private static final long serialVersionUID = 1L; - - public Graphic_ES_Weak_Elem(GraphicsContext gc, double x, double y, String name, long elementID) { - super(gc, name, elementID); - - this.xPos = x; - this.yPos = y; - } + extends Graphic_ES_Main_Elem { + @Serial + private static final long serialVersionUID = 1L; + + public Graphic_ES_Weak_Elem(GraphicsContext gc, double x, double y, String name, long elementID) { + super(gc, name, elementID); + + this.xPos = x; + this.yPos = y; + } + protected void dsfdsfds6787686(Color c) { + if (!this.isVisible) + return; + this.gc.beginPath(); + this.gc.setStroke(c); + this.gc.strokeRect(this.xPos - this.textWidth / 2.0D, this.yPos - this.textHeight / 2.0D, this.textWidth, this.textHeight); + this.gc.strokeRect(this.xPos - this.textWidth / 2.0D + 3.0D, this.yPos - this.textHeight / 2.0D + 3.0D, this.textWidth - 6.0D, this.textHeight - 6.0D); + this.gc.setFill(C2.ERMTextColor); + this.gc.fillText(this.name, this.xPos - this.textWidth / 2.0D + 10.0D, this.yPos + this.textHeight / 2.0D - 15.0D); + this.gc.closePath(); + } - - - protected void dsfdsfds6787686(Color c) { - if (!this.isVisible) - return; - this.gc.beginPath(); - this.gc.setStroke(c); - this.gc.strokeRect(this.xPos - this.textWidth / 2.0D, this.yPos - this.textHeight / 2.0D, this.textWidth, this.textHeight); - this.gc.strokeRect(this.xPos - this.textWidth / 2.0D + 3.0D, this.yPos - this.textHeight / 2.0D + 3.0D, this.textWidth - 6.0D, this.textHeight - 6.0D); - - - this.gc.setFill(C2.ERMTextColor); - this.gc.fillText(this.name, this.xPos - this.textWidth / 2.0D + 10.0D, this.yPos + this.textHeight / 2.0D - 15.0D); - this.gc.closePath(); - } + public String safsafdsa456456456() { + return "ES-W"; + } + public void dsfsdfsfd() { + this.gc.clearRect(this.xPos - this.textWidth / 2.0D - 1.0D, this.yPos - this.textHeight / 2.0D - 1.0D, this.textWidth + 2.0D, this.textHeight + 2.0D); + } - - - public String safsafdsa456456456() { - return "ES-W"; - } + public char sdfsdfdsfdf() { + return 'e'; + } - - public void dsfsdfsfd() { - this.gc.clearRect(this.xPos - this.textWidth / 2.0D - 1.0D, this.yPos - this.textHeight / 2.0D - 1.0D, this.textWidth + 2.0D, this.textHeight + 2.0D); - } - - - - - public char sdfsdfdsfdf() { - return 'e'; - } - - - - protected Color sefdsfdsf45() { - return C2.ERMESColor; - } + protected Color sefdsfdsf45() { + return C2.ERMESColor; + } } diff --git a/at/fos/ermodel/gui/Graphic_Figure_Elem.java b/at/fos/ermodel/gui/Graphic_Figure_Elem.java index 0b08a23..9b44786 100644 --- a/at/fos/ermodel/gui/Graphic_Figure_Elem.java +++ b/at/fos/ermodel/gui/Graphic_Figure_Elem.java @@ -8,200 +8,163 @@ import java.io.Serial; public abstract class Graphic_Figure_Elem - extends Graphic_Main_Elem -{ - @Serial - private static final long serialVersionUID = 1L; - protected double textWidth; - protected double textHeight; - - public abstract String safsafdsa456456456(); - - public double dsfsfsd456457657() { - return this.textWidth; } public double getHeight() { - return this.textHeight; - } protected void dockablePointsAtElem() { - drawDockablePoints(getColorDockable()); - } + extends Graphic_Main_Elem { + @Serial + private static final long serialVersionUID = 1L; + protected double textWidth; + protected double textHeight; + + public Graphic_Figure_Elem(GraphicsContext gc, String name, long elementID) { + super(gc, elementID); + this.name = name; + if (name == null) this.name = safsafdsa456456456(); + calculateTextWidthHeight(); + } + + public abstract String safsafdsa456456456(); + + public double dsfsfsd456457657() { + return this.textWidth; + } + + public double getHeight() { + return this.textHeight; + } + + protected void dockablePointsAtElem() { + drawDockablePoints(getColorDockable()); + } + + protected void changeName(String name) { + this.name = name; + if (name == null) this.name = safsafdsa456456456(); + + dsfsdfsfd(); + + calculateTextWidthHeight(); + safdsadasds32432456456(); + } - - - public Graphic_Figure_Elem(GraphicsContext gc, String name, long elementID) { - super(gc, elementID); - this.name = name; - if (name == null) this.name = safsafdsa456456456(); - calculateTextWidthHeight(); - } + public boolean dsfsfds45645456(double mouseX, double mouseY) { + return mouseX >= this.xPos - dsfsfsd456457657() / 2.0D && mouseX <= this.xPos + dsfsfsd456457657() / 2.0D && + mouseY >= this.yPos - getHeight() / 2.0D && mouseY <= this.yPos + getHeight() / 2.0D; + } + public void calculateTextWidthHeight() { + this.textWidth = C2.computeTextWidth(this.name, 2000.0D); + this.textWidth += 20.0D; + this.gc.setFont(C2.ERMFont); + Font f = this.gc.getFont(); + this.textHeight = f.getSize(); + this.textHeight += 30.0D; + } + public String toString() { + return "Graphic_Figure_Elem [textWidth=" + this.textWidth + ", textHeight=" + this.textHeight + ", toString()=" + + super.toString() + "]"; + } - - - protected void changeName(String name) { - this.name = name; - if (name == null) this.name = safsafdsa456456456(); - - dsfsdfsfd(); - - calculateTextWidthHeight(); - safdsadasds32432456456(); - } + protected void drawDockablePoints(Color c) { + if (!this.isConnectable) + return; + this.gc.setFill(c); + this.gc.fillOval(this.xPos - this.textWidth / 2.0D, this.yPos - 3.0D, 6.0D, 6.0D); - - public boolean dsfsfds45645456(double mouseX, double mouseY) { - return mouseX >= this.xPos - dsfsfsd456457657() / 2.0D && mouseX <= this.xPos + dsfsfsd456457657() / 2.0D && - mouseY >= this.yPos - getHeight() / 2.0D && mouseY <= this.yPos + getHeight() / 2.0D; - } + this.gc.fillOval(this.xPos - 3.0D, this.yPos - this.textHeight / 2.0D, 6.0D, 6.0D); + this.gc.fillOval(this.xPos + this.textWidth / 2.0D - 6.0D, this.yPos - 3.0D, 6.0D, 6.0D); - - public void calculateTextWidthHeight() { - this.textWidth = C2.computeTextWidth(this.name, 2000.0D); - this.textWidth += 20.0D; - this.gc.setFont(C2.ERMFont); - Font f = this.gc.getFont(); - this.textHeight = f.getSize(); - this.textHeight += 30.0D; - } + this.gc.fillOval(this.xPos - 3.0D, this.yPos + this.textHeight / 2.0D - 6.0D, 6.0D, 6.0D); + } + protected void drawDockablePoint(Color c, int point) { + this.gc.setFill(c); + switch (point) { + case 1 -> this.gc.fillOval(this.xPos - this.textWidth / 2.0D, this.yPos - 3.0D, 6.0D, 6.0D); + case 2 -> this.gc.fillOval(this.xPos - 3.0D, this.yPos - this.textHeight / 2.0D, 6.0D, 6.0D); + case 3 -> this.gc.fillOval(this.xPos + this.textWidth / 2.0D - 6.0D, this.yPos - 3.0D, 6.0D, 6.0D); + case 4 -> this.gc.fillOval(this.xPos - 3.0D, this.yPos + this.textHeight / 2.0D - 6.0D, 6.0D, 6.0D); + } + } - - - public String toString() { - return "Graphic_Figure_Elem [textWidth=" + this.textWidth + ", textHeight=" + this.textHeight + ", toString()=" + - super.toString() + "]"; - } + public double[] getDockablePoint(double mouseX, double mouseY) { + double[] selected = null; + if (mouseX >= this.xPos - this.textWidth / 2.0D - 5.0D && mouseX <= this.xPos - this.textWidth / 2.0D + 5.0D && mouseY >= this.yPos - 5.0D && mouseY <= this.yPos + 5.0D) { + selected = new double[3]; + selected[0] = this.xPos - this.textWidth / 2.0D; + selected[1] = this.yPos; + selected[2] = 1.0D; + } + + if (mouseX >= this.xPos - 5.0D && mouseX <= this.xPos + 5.0D && mouseY >= this.yPos - this.textHeight / 2.0D - 5.0D && mouseY <= this.yPos - this.textHeight / 2.0D + 5.0D) { + selected = new double[3]; + selected[0] = this.xPos; + selected[1] = this.yPos - this.textHeight / 2.0D; + selected[2] = 2.0D; + } + + if (mouseX >= this.xPos + this.textWidth / 2.0D - 5.0D && mouseX <= this.xPos + this.textWidth / 2.0D + 5.0D && mouseY >= this.yPos - 5.0D && mouseY <= this.yPos + 5.0D) { + selected = new double[3]; + selected[0] = this.xPos + this.textWidth / 2.0D; + selected[1] = this.yPos; + selected[2] = 3.0D; + } + + if (mouseX >= this.xPos - 5.0D && mouseX <= this.xPos + 5.0D && mouseY >= this.yPos + this.textHeight / 2.0D - 5.0D && mouseY <= this.yPos + this.textHeight / 2.0D + 5.0D) { + selected = new double[3]; + selected[0] = this.xPos; + selected[1] = this.yPos + this.textHeight / 2.0D; + selected[2] = 4.0D; + } + return selected; + } + public double[] getXYForGivenPoint(byte dockedAt) { + double[] xyAtPoint = new double[2]; + switch (dockedAt) { + case 0 -> { + xyAtPoint[0] = this.xPos; + xyAtPoint[1] = this.yPos; + } + case 1 -> { + xyAtPoint[0] = this.xPos - this.textWidth / 2.0D; + xyAtPoint[1] = this.yPos; + } + case 2 -> { + xyAtPoint[0] = this.xPos; + xyAtPoint[1] = this.yPos - this.textHeight / 2.0D; + } + case 3 -> { + xyAtPoint[0] = this.xPos + this.textWidth / 2.0D; + xyAtPoint[1] = this.yPos; + } + case 4 -> { + xyAtPoint[0] = this.xPos; + xyAtPoint[1] = this.yPos + this.textHeight / 2.0D; + } + } - - protected void drawDockablePoints(Color c) { - if (!this.isConnectable) - return; - this.gc.setFill(c); - - - this.gc.fillOval(this.xPos - this.textWidth / 2.0D, this.yPos - 3.0D, 6.0D, 6.0D); - - - this.gc.fillOval(this.xPos - 3.0D, this.yPos - this.textHeight / 2.0D, 6.0D, 6.0D); - - - this.gc.fillOval(this.xPos + this.textWidth / 2.0D - 6.0D, this.yPos - 3.0D, 6.0D, 6.0D); - - - this.gc.fillOval(this.xPos - 3.0D, this.yPos + this.textHeight / 2.0D - 6.0D, 6.0D, 6.0D); - } - - - protected void drawDockablePoint(Color c, int point) { - this.gc.setFill(c); - switch (point) { - case 1 -> this.gc.fillOval(this.xPos - this.textWidth / 2.0D, this.yPos - 3.0D, 6.0D, 6.0D); - case 2 -> this.gc.fillOval(this.xPos - 3.0D, this.yPos - this.textHeight / 2.0D, 6.0D, 6.0D); - case 3 -> this.gc.fillOval(this.xPos + this.textWidth / 2.0D - 6.0D, this.yPos - 3.0D, 6.0D, 6.0D); - case 4 -> this.gc.fillOval(this.xPos - 3.0D, this.yPos + this.textHeight / 2.0D - 6.0D, 6.0D, 6.0D); - } - } + return xyAtPoint; + } - - - - - - - - - public double[] getDockablePoint(double mouseX, double mouseY) { - double[] selected = null; - - - - - - - if (mouseX >= this.xPos - this.textWidth / 2.0D - 5.0D && mouseX <= this.xPos - this.textWidth / 2.0D + 5.0D && mouseY >= this.yPos - 5.0D && mouseY <= this.yPos + 5.0D) { - selected = new double[3]; - selected[0] = this.xPos - this.textWidth / 2.0D; - selected[1] = this.yPos; - selected[2] = 1.0D; - } - - if (mouseX >= this.xPos - 5.0D && mouseX <= this.xPos + 5.0D && mouseY >= this.yPos - this.textHeight / 2.0D - 5.0D && mouseY <= this.yPos - this.textHeight / 2.0D + 5.0D) { - selected = new double[3]; - selected[0] = this.xPos; - selected[1] = this.yPos - this.textHeight / 2.0D; - selected[2] = 2.0D; - } - - if (mouseX >= this.xPos + this.textWidth / 2.0D - 5.0D && mouseX <= this.xPos + this.textWidth / 2.0D + 5.0D && mouseY >= this.yPos - 5.0D && mouseY <= this.yPos + 5.0D) { - selected = new double[3]; - selected[0] = this.xPos + this.textWidth / 2.0D; - selected[1] = this.yPos; - selected[2] = 3.0D; - } - - if (mouseX >= this.xPos - 5.0D && mouseX <= this.xPos + 5.0D && mouseY >= this.yPos + this.textHeight / 2.0D - 5.0D && mouseY <= this.yPos + this.textHeight / 2.0D + 5.0D) { - selected = new double[3]; - selected[0] = this.xPos; - selected[1] = this.yPos + this.textHeight / 2.0D; - selected[2] = 4.0D; - } - return selected; - } - - - - - - - public double[] getXYForGivenPoint(byte dockedAt) { - double[] xyAtPoint = new double[2]; - switch (dockedAt) { - case 0 -> { - xyAtPoint[0] = this.xPos; - xyAtPoint[1] = this.yPos; - } - case 1 -> { - xyAtPoint[0] = this.xPos - this.textWidth / 2.0D; - xyAtPoint[1] = this.yPos; - } - case 2 -> { - xyAtPoint[0] = this.xPos; - xyAtPoint[1] = this.yPos - this.textHeight / 2.0D; - } - case 3 -> { - xyAtPoint[0] = this.xPos + this.textWidth / 2.0D; - xyAtPoint[1] = this.yPos; - } - case 4 -> { - xyAtPoint[0] = this.xPos; - xyAtPoint[1] = this.yPos + this.textHeight / 2.0D; - } - } - - return xyAtPoint; - } - - - - protected Color sefdsfdsf45() { - return C2.ERMESColor; - } + protected Color sefdsfdsf45() { + return C2.ERMESColor; + } } diff --git a/at/fos/ermodel/gui/Graphic_LINE_Attr_Attr_Elem.java b/at/fos/ermodel/gui/Graphic_LINE_Attr_Attr_Elem.java index 086ec80..d96e0de 100644 --- a/at/fos/ermodel/gui/Graphic_LINE_Attr_Attr_Elem.java +++ b/at/fos/ermodel/gui/Graphic_LINE_Attr_Attr_Elem.java @@ -7,21 +7,18 @@ import java.io.Serial; public class Graphic_LINE_Attr_Attr_Elem - extends Graphic_LINE_Elem -{ - @Serial - private static final long serialVersionUID = 1L; - - public Graphic_LINE_Attr_Attr_Elem(GraphicsContext gc, double x, double y, double xEnd, double yEnd, byte lineConnectedWithPointAtStart, byte lineConnectedWithPointAtEnd, Graphic_Figure_Elem elemStart, Graphic_Figure_Elem elemEnd, long elementID) { - super(gc, x, y, xEnd, yEnd, lineConnectedWithPointAtStart, lineConnectedWithPointAtEnd, elemStart, elemEnd, elementID); - } + extends Graphic_LINE_Elem { + @Serial + private static final long serialVersionUID = 1L; + + public Graphic_LINE_Attr_Attr_Elem(GraphicsContext gc, double x, double y, double xEnd, double yEnd, byte lineConnectedWithPointAtStart, byte lineConnectedWithPointAtEnd, Graphic_Figure_Elem elemStart, Graphic_Figure_Elem elemEnd, long elementID) { + super(gc, x, y, xEnd, yEnd, lineConnectedWithPointAtStart, lineConnectedWithPointAtEnd, elemStart, elemEnd, elementID); + } - - - protected Color sefdsfdsf45() { - return C2.ERMLINEColor; - } + protected Color sefdsfdsf45() { + return C2.ERMLINEColor; + } } diff --git a/at/fos/ermodel/gui/Graphic_LINE_Attr_ES_Elem.java b/at/fos/ermodel/gui/Graphic_LINE_Attr_ES_Elem.java index 253500f..fa829a2 100644 --- a/at/fos/ermodel/gui/Graphic_LINE_Attr_ES_Elem.java +++ b/at/fos/ermodel/gui/Graphic_LINE_Attr_ES_Elem.java @@ -7,21 +7,18 @@ import java.io.Serial; public class Graphic_LINE_Attr_ES_Elem - extends Graphic_LINE_Elem -{ - @Serial - private static final long serialVersionUID = 1L; - - public Graphic_LINE_Attr_ES_Elem(GraphicsContext gc, double x, double y, double xEnd, double yEnd, byte lineConnectedWithPointAtStart, byte lineConnectedWithPointAtEnd, Graphic_Figure_Elem elemStart, Graphic_Figure_Elem elemEnd, long elementID) { - super(gc, x, y, xEnd, yEnd, lineConnectedWithPointAtStart, lineConnectedWithPointAtEnd, elemStart, elemEnd, elementID); - } + extends Graphic_LINE_Elem { + @Serial + private static final long serialVersionUID = 1L; + + public Graphic_LINE_Attr_ES_Elem(GraphicsContext gc, double x, double y, double xEnd, double yEnd, byte lineConnectedWithPointAtStart, byte lineConnectedWithPointAtEnd, Graphic_Figure_Elem elemStart, Graphic_Figure_Elem elemEnd, long elementID) { + super(gc, x, y, xEnd, yEnd, lineConnectedWithPointAtStart, lineConnectedWithPointAtEnd, elemStart, elemEnd, elementID); + } - - - protected Color sefdsfdsf45() { - return C2.ERMLINEColor; - } + protected Color sefdsfdsf45() { + return C2.ERMLINEColor; + } } diff --git a/at/fos/ermodel/gui/Graphic_LINE_Attr_RS_Elem.java b/at/fos/ermodel/gui/Graphic_LINE_Attr_RS_Elem.java index f176188..c5cbc69 100644 --- a/at/fos/ermodel/gui/Graphic_LINE_Attr_RS_Elem.java +++ b/at/fos/ermodel/gui/Graphic_LINE_Attr_RS_Elem.java @@ -7,21 +7,18 @@ import java.io.Serial; public class Graphic_LINE_Attr_RS_Elem - extends Graphic_LINE_Elem -{ - @Serial - private static final long serialVersionUID = 1L; - - public Graphic_LINE_Attr_RS_Elem(GraphicsContext gc, double x, double y, double xEnd, double yEnd, byte lineConnectedWithPointAtStart, byte lineConnectedWithPointAtEnd, Graphic_Figure_Elem elemStart, Graphic_Figure_Elem elemEnd, long elementID) { - super(gc, x, y, xEnd, yEnd, lineConnectedWithPointAtStart, lineConnectedWithPointAtEnd, elemStart, elemEnd, elementID); - } + extends Graphic_LINE_Elem { + @Serial + private static final long serialVersionUID = 1L; + + public Graphic_LINE_Attr_RS_Elem(GraphicsContext gc, double x, double y, double xEnd, double yEnd, byte lineConnectedWithPointAtStart, byte lineConnectedWithPointAtEnd, Graphic_Figure_Elem elemStart, Graphic_Figure_Elem elemEnd, long elementID) { + super(gc, x, y, xEnd, yEnd, lineConnectedWithPointAtStart, lineConnectedWithPointAtEnd, elemStart, elemEnd, elementID); + } - - - protected Color sefdsfdsf45() { - return C2.ERMLINEColor; - } + protected Color sefdsfdsf45() { + return C2.ERMLINEColor; + } } diff --git a/at/fos/ermodel/gui/Graphic_LINE_Elem.java b/at/fos/ermodel/gui/Graphic_LINE_Elem.java index 8f2d5be..8a123c3 100644 --- a/at/fos/ermodel/gui/Graphic_LINE_Elem.java +++ b/at/fos/ermodel/gui/Graphic_LINE_Elem.java @@ -9,420 +9,345 @@ import javafx.scene.transform.Translate; import java.io.Serial; public abstract class Graphic_LINE_Elem - extends Graphic_Main_Elem -{ - @Serial -private static final long serialVersionUID = 1L; - + extends Graphic_Main_Elem { + @Serial + private static final long serialVersionUID = 1L; + private final byte lineConnectedWithPointAtStart; + private final byte lineConnectedWithPointAtEnd; + protected String minimum = "0"; + protected String maximum = "n"; private double xEnd; - - private double yEnd; - protected String minimum = "0"; - protected String maximum = "n"; + private double yEnd; + private Graphic_Figure_Elem connectedWithStart; + private Graphic_Figure_Elem connectedWithEnd; + public Graphic_LINE_Elem(GraphicsContext gc, double x, double y, double xEnd, double yEnd, byte lineConnectedWithPointAtStart, byte lineConnectedWithPointAtEnd, Graphic_Figure_Elem elemStart, Graphic_Figure_Elem elemEnd, long elementID) { + super(gc, elementID); - - private Graphic_Figure_Elem connectedWithStart; + this.xPos = x; + this.yPos = y; + this.lineConnectedWithPointAtStart = lineConnectedWithPointAtStart; + this.connectedWithStart = elemStart; + this.xEnd = xEnd; + this.yEnd = yEnd; + this.lineConnectedWithPointAtEnd = lineConnectedWithPointAtEnd; + this.connectedWithEnd = elemEnd; + this.name = ""; + + if (this instanceof Graphic_LINE_RSID_ESWEAK_Elem) { + this.minimum = "1"; + this.maximum = "1"; + } + } - - - private final byte lineConnectedWithPointAtStart; + protected void changeMinMax(String minimum, String maximum) { + this.minimum = minimum; + this.maximum = maximum; + if (minimum == null) this.minimum = getDefaultMinimum(); + if (maximum == null) this.minimum = getDefaultMaximum(); + dsfsdfsfd(); + safdsadasds32432456456(); + } + private void drawArrow(Color c, double x1, double y1, double x2, double y2) { + this.gc.setStroke(c); - - private Graphic_Figure_Elem connectedWithEnd; + double dx = x2 - x1, dy = y2 - y1; + double angle = Math.atan2(dy, dx); + double len = Math.sqrt(dx * dx + dy * dy); - - private final byte lineConnectedWithPointAtEnd; + Affine oldTransform = this.gc.getTransform(); + + Translate translate = Transform.translate(x1, y1); + Transform transform = translate.createConcatenation(Transform.rotate(Math.toDegrees(angle), 0.0D, 0.0D)); + this.gc.setTransform(new Affine(transform)); - - - public Graphic_LINE_Elem(GraphicsContext gc, double x, double y, double xEnd, double yEnd, byte lineConnectedWithPointAtStart, byte lineConnectedWithPointAtEnd, Graphic_Figure_Elem elemStart, Graphic_Figure_Elem elemEnd, long elementID) { - super(gc, elementID); - - this.xPos = x; - this.yPos = y; - this.lineConnectedWithPointAtStart = lineConnectedWithPointAtStart; - this.connectedWithStart = elemStart; - this.xEnd = xEnd; - this.yEnd = yEnd; - this.lineConnectedWithPointAtEnd = lineConnectedWithPointAtEnd; - this.connectedWithEnd = elemEnd; - this.name = ""; - - if (this instanceof Graphic_LINE_RSID_ESWEAK_Elem) { - this.minimum = "1"; - this.maximum = "1"; - } - } + this.gc.setFill(C2.ERMBackgroundColor); - - - - - - protected void changeMinMax(String minimum, String maximum) { - this.minimum = minimum; - this.maximum = maximum; - if (minimum == null) this.minimum = getDefaultMinimum(); - if (maximum == null) this.minimum = getDefaultMaximum(); - dsfsdfsfd(); - safdsadasds32432456456(); - } - - - - - - - - - - private void drawArrow(Color c, double x1, double y1, double x2, double y2) { - this.gc.setStroke(c); - - double dx = x2 - x1, dy = y2 - y1; - double angle = Math.atan2(dy, dx); - double len = Math.sqrt(dx * dx + dy * dy); - - - Affine oldTransform = this.gc.getTransform(); - - Translate translate = Transform.translate(x1, y1); - Transform transform = translate.createConcatenation(Transform.rotate(Math.toDegrees(angle), 0.0D, 0.0D)); - this.gc.setTransform(new Affine(transform)); - - - this.gc.setFill(C2.ERMBackgroundColor); - - - - - - this.gc.strokePolygon(new double[] { len, len - 8.0D, len - 8.0D - }, new double[] { 0.0D, -8.0D, 8.0D + this.gc.strokePolygon(new double[]{len, len - 8.0D, len - 8.0D + }, new double[]{0.0D, -8.0D, 8.0D }, 3); - - this.gc.setTransform(oldTransform); - } - - - - - - - - protected void dsfdsfds6787686(Color c) { - if (!this.isVisible) - return; - if (this.name == null) this.name = ""; - - this.gc.beginPath(); - this.gc.setStroke(c); - this.gc.strokeLine(this.xPos, this.yPos, this.xEnd, this.yEnd); - - if (this instanceof Graphic_LINE_RSISAG_ES_Elem) { - - if (this.connectedWithStart instanceof Graphic_ES_Elem) { - drawArrow(c, this.xEnd, this.yEnd, this.xPos, this.yPos); - } - if (this.connectedWithEnd instanceof Graphic_ES_Elem) { - drawArrow(c, this.xPos, this.yPos, this.xEnd, this.yEnd); - } - return; - } - if (this instanceof Graphic_LINE_RSISAS_ES_Elem) - return; if (this instanceof Graphic_LINE_Attr_Attr_Elem) - return; if (this instanceof Graphic_LINE_Attr_ES_Elem) - return; if (this instanceof Graphic_LINE_Attr_RS_Elem) { - return; + this.gc.setTransform(oldTransform); } - double helpXStart = this.xPos; - double helpXEnd = this.xEnd; - double helpYStart = this.yPos; - double helpYEnd = this.yEnd; - this.gc.setFill(C2.ERMTextColor); - if (this.xEnd < this.xPos) { helpXStart = this.xEnd; helpXEnd = this.xPos; } - if (this.yEnd < this.yPos) { helpYStart = this.yEnd; helpYEnd = this.yPos; } - this.gc.fillText("(" + this.minimum + "," + this.maximum + ")", helpXStart + (helpXEnd - helpXStart) / 2.0D, helpYStart + (helpYEnd - helpYStart) / 2.0D - 5.0D); - this.gc.closePath(); - } + protected void dsfdsfds6787686(Color c) { + if (!this.isVisible) + return; + if (this.name == null) this.name = ""; + this.gc.beginPath(); + this.gc.setStroke(c); + this.gc.strokeLine(this.xPos, this.yPos, this.xEnd, this.yEnd); - - public void dsfsdfsfd() { - this.gc.beginPath(); - this.gc.setStroke(C2.ERMBackgroundColor); - this.gc.setLineWidth(3.0D); - this.gc.strokeLine(this.xPos, this.yPos, this.xEnd, this.yEnd); - this.gc.setLineWidth(1.0D); + if (this instanceof Graphic_LINE_RSISAG_ES_Elem) { - - if (this instanceof Graphic_LINE_RSISAG_ES_Elem) { - - - double d1 = 0.0D, d2 = 0.0D, helpWidth = 0.0D, helpHeight = 0.0D; - Graphic_ES_Elem helpElem = null; - byte helpConnectedWithPoint = 0; - if (this.connectedWithStart instanceof Graphic_ES_Elem) { - helpElem = (Graphic_ES_Elem)this.connectedWithStart; - helpConnectedWithPoint = this.lineConnectedWithPointAtStart; - } - if (this.connectedWithEnd instanceof Graphic_ES_Elem) { - helpElem = (Graphic_ES_Elem)this.connectedWithEnd; - helpConnectedWithPoint = this.lineConnectedWithPointAtEnd; - } - - assert helpElem != null; - double[] dockedPoints = helpElem.getXYForGivenPoint(helpConnectedWithPoint); - switch (helpConnectedWithPoint) { - case 1, 2 -> { - d1 = dockedPoints[0] - 16.0D; - d2 = dockedPoints[1] - 16.0D; - helpWidth = 29.0D; - helpHeight = 29.0D; + if (this.connectedWithStart instanceof Graphic_ES_Elem) { + drawArrow(c, this.xEnd, this.yEnd, this.xPos, this.yPos); } - case 3 -> { - d1 = dockedPoints[0]; - d2 = dockedPoints[1] - 8.0D - 5.0D; - helpWidth = 28.0D; - helpHeight = 28.0D; - } - case 4 -> { - d1 = dockedPoints[0] - 8.0D - 5.0D; - d2 = dockedPoints[1] + 1.0D; - helpWidth = 28.0D; - helpHeight = 28.0D; + if (this.connectedWithEnd instanceof Graphic_ES_Elem) { + drawArrow(c, this.xPos, this.yPos, this.xEnd, this.yEnd); } + return; } - - this.gc.clearRect(d1, d2, helpWidth, helpHeight); - return; - } - if (this instanceof Graphic_LINE_RSISAS_ES_Elem) - return; if (this instanceof Graphic_LINE_Attr_Attr_Elem) - return; if (this instanceof Graphic_LINE_Attr_ES_Elem) - return; if (this instanceof Graphic_LINE_Attr_RS_Elem) { - return; + if (this instanceof Graphic_LINE_RSISAS_ES_Elem) + return; + if (this instanceof Graphic_LINE_Attr_Attr_Elem) + return; + if (this instanceof Graphic_LINE_Attr_ES_Elem) + return; + if (this instanceof Graphic_LINE_Attr_RS_Elem) { + return; + } + double helpXStart = this.xPos; + double helpXEnd = this.xEnd; + double helpYStart = this.yPos; + double helpYEnd = this.yEnd; + this.gc.setFill(C2.ERMTextColor); + if (this.xEnd < this.xPos) { + helpXStart = this.xEnd; + helpXEnd = this.xPos; + } + if (this.yEnd < this.yPos) { + helpYStart = this.yEnd; + helpYEnd = this.yPos; + } + this.gc.fillText("(" + this.minimum + "," + this.maximum + ")", helpXStart + (helpXEnd - helpXStart) / 2.0D, helpYStart + (helpYEnd - helpYStart) / 2.0D - 5.0D); + this.gc.closePath(); } - - double helpXStart = this.xPos; - double helpXEnd = this.xEnd; - double helpYStart = this.yPos; - double helpYEnd = this.yEnd; - if (this.xEnd < this.xPos) { helpXStart = this.xEnd; helpXEnd = this.xPos; } - if (this.yEnd < this.yPos) { helpYStart = this.yEnd; helpYEnd = this.yPos; } - this.gc.clearRect(helpXStart + (helpXEnd - helpXStart) / 2.0D - 6.0D, - helpYStart + (helpYEnd - helpYStart) / 2.0D - 5.0D - 10.0D, - C2.computeTextWidth("(" + this.minimum + "," + this.maximum + ")", 2000.0D) + 12.0D, - C2.computeTextHeight() + 12.0D); - this.gc.closePath(); - } + public void dsfsdfsfd() { + this.gc.beginPath(); + this.gc.setStroke(C2.ERMBackgroundColor); + this.gc.setLineWidth(3.0D); + this.gc.strokeLine(this.xPos, this.yPos, this.xEnd, this.yEnd); + this.gc.setLineWidth(1.0D); + + + if (this instanceof Graphic_LINE_RSISAG_ES_Elem) { + + + double d1 = 0.0D, d2 = 0.0D, helpWidth = 0.0D, helpHeight = 0.0D; + Graphic_ES_Elem helpElem = null; + byte helpConnectedWithPoint = 0; + if (this.connectedWithStart instanceof Graphic_ES_Elem) { + helpElem = (Graphic_ES_Elem) this.connectedWithStart; + helpConnectedWithPoint = this.lineConnectedWithPointAtStart; + } + if (this.connectedWithEnd instanceof Graphic_ES_Elem) { + helpElem = (Graphic_ES_Elem) this.connectedWithEnd; + helpConnectedWithPoint = this.lineConnectedWithPointAtEnd; + } + + assert helpElem != null; + double[] dockedPoints = helpElem.getXYForGivenPoint(helpConnectedWithPoint); + switch (helpConnectedWithPoint) { + case 1, 2 -> { + d1 = dockedPoints[0] - 16.0D; + d2 = dockedPoints[1] - 16.0D; + helpWidth = 29.0D; + helpHeight = 29.0D; + } + case 3 -> { + d1 = dockedPoints[0]; + d2 = dockedPoints[1] - 8.0D - 5.0D; + helpWidth = 28.0D; + helpHeight = 28.0D; + } + case 4 -> { + d1 = dockedPoints[0] - 8.0D - 5.0D; + d2 = dockedPoints[1] + 1.0D; + helpWidth = 28.0D; + helpHeight = 28.0D; + } + } - - public double dsfsfsd456457657() { - return this.xEnd; - } + this.gc.clearRect(d1, d2, helpWidth, helpHeight); + return; + } + if (this instanceof Graphic_LINE_RSISAS_ES_Elem) + return; + if (this instanceof Graphic_LINE_Attr_Attr_Elem) + return; + if (this instanceof Graphic_LINE_Attr_ES_Elem) + return; + if (this instanceof Graphic_LINE_Attr_RS_Elem) { + return; + } + double helpXStart = this.xPos; + double helpXEnd = this.xEnd; + double helpYStart = this.yPos; + double helpYEnd = this.yEnd; + if (this.xEnd < this.xPos) { + helpXStart = this.xEnd; + helpXEnd = this.xPos; + } + if (this.yEnd < this.yPos) { + helpYStart = this.yEnd; + helpYEnd = this.yPos; + } + this.gc.clearRect(helpXStart + (helpXEnd - helpXStart) / 2.0D - 6.0D, + helpYStart + (helpYEnd - helpYStart) / 2.0D - 5.0D - 10.0D, + C2.computeTextWidth("(" + this.minimum + "," + this.maximum + ")", 2000.0D) + 12.0D, + C2.computeTextHeight() + 12.0D); + this.gc.closePath(); + } - - public double getHeight() { - return this.yEnd; - } + public double dsfsfsd456457657() { + return this.xEnd; + } + public double getHeight() { + return this.yEnd; + } + public boolean dsfsfds45645456(double mouseX, double mouseY) { + Graphic_Figure_Elem aHelp = getConnectedWithStart(); + double[] dockablePointsAHelp = aHelp.getXYForGivenPoint(getLineConnectedWithPointAtStart()); + Graphic_Figure_Elem bHelp = getConnectedWithEnd(); + double[] dockablePointsBHelp = bHelp.getXYForGivenPoint(getLineConnectedWithPointAtEnd()); + double distStartToMouse = distP1_P2(dockablePointsAHelp[0], dockablePointsAHelp[1], mouseX, mouseY); + double distMouseToEnd = distP1_P2(mouseX, mouseY, dockablePointsBHelp[0], dockablePointsBHelp[1]); + double distStartToEnd = distP1_P2(dockablePointsAHelp[0], dockablePointsAHelp[1], dockablePointsBHelp[0], dockablePointsBHelp[1]); + return Math.abs(distStartToMouse + distMouseToEnd - distStartToEnd) <= 0.3D; + } + public Graphic_Figure_Elem getConnectedWithStart() { + return this.connectedWithStart; + } - - public boolean dsfsfds45645456(double mouseX, double mouseY) { - Graphic_Figure_Elem aHelp = getConnectedWithStart(); - double[] dockablePointsAHelp = aHelp.getXYForGivenPoint(getLineConnectedWithPointAtStart()); - Graphic_Figure_Elem bHelp = getConnectedWithEnd(); - double[] dockablePointsBHelp = bHelp.getXYForGivenPoint(getLineConnectedWithPointAtEnd()); - - double distStartToMouse = distP1_P2(dockablePointsAHelp[0], dockablePointsAHelp[1], mouseX, mouseY); - double distMouseToEnd = distP1_P2(mouseX, mouseY, dockablePointsBHelp[0], dockablePointsBHelp[1]); - double distStartToEnd = distP1_P2(dockablePointsAHelp[0], dockablePointsAHelp[1], dockablePointsBHelp[0], dockablePointsBHelp[1]); + public void setConnectedWithStart(Graphic_Figure_Elem connectedWithStart) { + this.connectedWithStart = connectedWithStart; + } - return Math.abs(distStartToMouse + distMouseToEnd - distStartToEnd) <= 0.3D; - } + public Graphic_Figure_Elem getConnectedWithEnd() { + return this.connectedWithEnd; + } + public void setConnectedWithEnd(Graphic_Figure_Elem connectedWithEnd) { + this.connectedWithEnd = connectedWithEnd; + } - - public Graphic_Figure_Elem getConnectedWithStart() { - return this.connectedWithStart; - } + public double getxEnd() { + return this.xEnd; + } - - public void setConnectedWithStart(Graphic_Figure_Elem connectedWithStart) { - this.connectedWithStart = connectedWithStart; - } + public void setxEnd(double xEnd) { + this.xEnd = xEnd; + } + public double getyEnd() { + return this.yEnd; + } - - public Graphic_Figure_Elem getConnectedWithEnd() { - return this.connectedWithEnd; - } + public void setyEnd(double yEnd) { + this.yEnd = yEnd; + } - - public void setConnectedWithEnd(Graphic_Figure_Elem connectedWithEnd) { - this.connectedWithEnd = connectedWithEnd; - } + public char sdfsdfdsfdf() { + return 'l'; + } + public double distP1_P2(double xP1, double yP1, double xP2, double yP2) { + double dist; + dist = Math.sqrt((xP1 - xP2) * (xP1 - xP2) + (yP1 - yP2) * (yP1 - yP2)); + return dist; + } - - public double getxEnd() { - return this.xEnd; - } + public String getMinimum() { + return this.minimum; + } - - public void setxEnd(double xEnd) { - this.xEnd = xEnd; - } + public void setMinimum(String minimum) { + this.minimum = minimum; + } + public String getMaximum() { + return this.maximum; + } - - public double getyEnd() { - return this.yEnd; - } + public void setMaximum(String maximum) { + this.maximum = maximum; + } + private String getDefaultMinimum() { + return "0"; + } - - public void setyEnd(double yEnd) { - this.yEnd = yEnd; - } + private String getDefaultMaximum() { + return "n"; + } - - public char sdfsdfdsfdf() { - return 'l'; - } + public String toString() { + return "Graphic_LINE_Elem [xEnd=" + this.xEnd + ", yEnd=" + this.yEnd + ", minimum=" + this.minimum + ", maximum=" + this.maximum + + ", connectedWithStart=" + this.connectedWithStart + ", connectedWithEnd=" + this.connectedWithEnd + + ", toString()=" + super.toString() + "]"; + } - - - - - - public double distP1_P2(double xP1, double yP1, double xP2, double yP2) { - double dist; - dist = Math.sqrt((xP1 - xP2) * (xP1 - xP2) + (yP1 - yP2) * (yP1 - yP2)); - return dist; - } - - - - - public String getMinimum() { - return this.minimum; - } - - - - - public void setMinimum(String minimum) { - this.minimum = minimum; - } - - - - - public String getMaximum() { - return this.maximum; - } - - - - - public void setMaximum(String maximum) { - this.maximum = maximum; - } - - private String getDefaultMinimum() { - return "0"; - } - - private String getDefaultMaximum() { - return "n"; - } - - - - - - public String toString() { - return "Graphic_LINE_Elem [xEnd=" + this.xEnd + ", yEnd=" + this.yEnd + ", minimum=" + this.minimum + ", maximum=" + this.maximum + - ", connectedWithStart=" + this.connectedWithStart + ", connectedWithEnd=" + this.connectedWithEnd + - ", toString()=" + super.toString() + "]"; - } - - - - - public byte getLineConnectedWithPointAtStart() { - return this.lineConnectedWithPointAtStart; - } + public byte getLineConnectedWithPointAtStart() { + return this.lineConnectedWithPointAtStart; + } public byte getLineConnectedWithPointAtEnd() { - return this.lineConnectedWithPointAtEnd; - } + return this.lineConnectedWithPointAtEnd; + } public String sdfsdfsd32234243() { - if (this instanceof Graphic_LINE_RSISAG_ES_Elem) { - return this.connectedWithStart.sdfsdfsd32234243() + "[G]" + this.connectedWithEnd.sdfsdfsd32234243(); + if (this instanceof Graphic_LINE_RSISAG_ES_Elem) { + return this.connectedWithStart.sdfsdfsd32234243() + "[G]" + this.connectedWithEnd.sdfsdfsd32234243(); + } + if (this instanceof Graphic_LINE_RSISAS_ES_Elem) { + return this.connectedWithStart.sdfsdfsd32234243() + "[Sp]" + this.connectedWithEnd.sdfsdfsd32234243(); + } + if (this instanceof Graphic_LINE_Attr_ES_Elem || + this instanceof Graphic_LINE_Attr_Attr_Elem || this instanceof Graphic_LINE_Attr_RS_Elem) { + String usedStartName = this.connectedWithStart.sdfsdfsd32234243(); + if (this.connectedWithStart instanceof Graphic_ATTR_Elem) { + usedStartName = usedStartName.substring(0, usedStartName.indexOf('@')); + } + String usedEndName = this.connectedWithEnd.sdfsdfsd32234243(); + if (this.connectedWithEnd instanceof Graphic_ATTR_Elem) { + usedEndName = usedEndName.substring(0, usedEndName.indexOf('@')); + } + return usedStartName + "[-]" + usedEndName; + } + return this.connectedWithStart.sdfsdfsd32234243() + "(" + this.minimum + "," + this.maximum + ")" + this.connectedWithEnd.sdfsdfsd32234243(); } - if (this instanceof Graphic_LINE_RSISAS_ES_Elem) { - return this.connectedWithStart.sdfsdfsd32234243() + "[Sp]" + this.connectedWithEnd.sdfsdfsd32234243(); - } - if (this instanceof Graphic_LINE_Attr_ES_Elem || - this instanceof Graphic_LINE_Attr_Attr_Elem || this instanceof Graphic_LINE_Attr_RS_Elem) { - String usedStartName = this.connectedWithStart.sdfsdfsd32234243(); - if (this.connectedWithStart instanceof Graphic_ATTR_Elem) { - usedStartName = usedStartName.substring(0, usedStartName.indexOf('@')); - } - String usedEndName = this.connectedWithEnd.sdfsdfsd32234243(); - if (this.connectedWithEnd instanceof Graphic_ATTR_Elem) { - usedEndName = usedEndName.substring(0, usedEndName.indexOf('@')); - } - return usedStartName + "[-]" + usedEndName; - } - return this.connectedWithStart.sdfsdfsd32234243() + "(" + this.minimum + "," + this.maximum + ")" + this.connectedWithEnd.sdfsdfsd32234243(); - } } diff --git a/at/fos/ermodel/gui/Graphic_LINE_RSID_ESWEAK_Elem.java b/at/fos/ermodel/gui/Graphic_LINE_RSID_ESWEAK_Elem.java index fb8b5a9..25d91db 100644 --- a/at/fos/ermodel/gui/Graphic_LINE_RSID_ESWEAK_Elem.java +++ b/at/fos/ermodel/gui/Graphic_LINE_RSID_ESWEAK_Elem.java @@ -7,21 +7,18 @@ import java.io.Serial; public class Graphic_LINE_RSID_ESWEAK_Elem - extends Graphic_LINE_Elem -{ - @Serial - private static final long serialVersionUID = 1L; - - public Graphic_LINE_RSID_ESWEAK_Elem(GraphicsContext gc, double x, double y, double xEnd, double yEnd, byte lineConnectedWithPointAtStart, byte lineConnectedWithPointAtEnd, Graphic_Figure_Elem elemStart, Graphic_Figure_Elem elemEnd, long elementID) { - super(gc, x, y, xEnd, yEnd, lineConnectedWithPointAtStart, lineConnectedWithPointAtEnd, elemStart, elemEnd, elementID); - } + extends Graphic_LINE_Elem { + @Serial + private static final long serialVersionUID = 1L; + + public Graphic_LINE_RSID_ESWEAK_Elem(GraphicsContext gc, double x, double y, double xEnd, double yEnd, byte lineConnectedWithPointAtStart, byte lineConnectedWithPointAtEnd, Graphic_Figure_Elem elemStart, Graphic_Figure_Elem elemEnd, long elementID) { + super(gc, x, y, xEnd, yEnd, lineConnectedWithPointAtStart, lineConnectedWithPointAtEnd, elemStart, elemEnd, elementID); + } - - - protected Color sefdsfdsf45() { - return C2.ERMRSConnColor; - } + protected Color sefdsfdsf45() { + return C2.ERMRSConnColor; + } } diff --git a/at/fos/ermodel/gui/Graphic_LINE_RSID_ES_Elem.java b/at/fos/ermodel/gui/Graphic_LINE_RSID_ES_Elem.java index 392dbb2..4ce5d10 100644 --- a/at/fos/ermodel/gui/Graphic_LINE_RSID_ES_Elem.java +++ b/at/fos/ermodel/gui/Graphic_LINE_RSID_ES_Elem.java @@ -6,48 +6,19 @@ import javafx.scene.paint.Color; import java.io.Serial; - - - - - - - - - - - - - - - - - - - - - - - - - - public class Graphic_LINE_RSID_ES_Elem - extends Graphic_LINE_Elem -{ - @Serial -private static final long serialVersionUID = 1L; - - public Graphic_LINE_RSID_ES_Elem(GraphicsContext gc, double x, double y, double xEnd, double yEnd, byte lineConnectedWithPointAtStart, byte lineConnectedWithPointAtEnd, Graphic_Figure_Elem elemStart, Graphic_Figure_Elem elemEnd, long elementID) { - super(gc, x, y, xEnd, yEnd, lineConnectedWithPointAtStart, lineConnectedWithPointAtEnd, elemStart, elemEnd, elementID); - } + extends Graphic_LINE_Elem { + @Serial + private static final long serialVersionUID = 1L; + + public Graphic_LINE_RSID_ES_Elem(GraphicsContext gc, double x, double y, double xEnd, double yEnd, byte lineConnectedWithPointAtStart, byte lineConnectedWithPointAtEnd, Graphic_Figure_Elem elemStart, Graphic_Figure_Elem elemEnd, long elementID) { + super(gc, x, y, xEnd, yEnd, lineConnectedWithPointAtStart, lineConnectedWithPointAtEnd, elemStart, elemEnd, elementID); + } - - - protected Color sefdsfdsf45() { - return C2.ERMRSConnColor; - } + protected Color sefdsfdsf45() { + return C2.ERMRSConnColor; + } } diff --git a/at/fos/ermodel/gui/Graphic_LINE_RSISAG_ES_Elem.java b/at/fos/ermodel/gui/Graphic_LINE_RSISAG_ES_Elem.java index 77adbb0..dc35a80 100644 --- a/at/fos/ermodel/gui/Graphic_LINE_RSISAG_ES_Elem.java +++ b/at/fos/ermodel/gui/Graphic_LINE_RSISAG_ES_Elem.java @@ -7,21 +7,18 @@ import java.io.Serial; public class Graphic_LINE_RSISAG_ES_Elem - extends Graphic_LINE_Elem -{ - @Serial - private static final long serialVersionUID = 1L; - - public Graphic_LINE_RSISAG_ES_Elem(GraphicsContext gc, double x, double y, double xEnd, double yEnd, byte lineConnectedWithPointAtStart, byte lineConnectedWithPointAtEnd, Graphic_Figure_Elem elemStart, Graphic_Figure_Elem elemEnd, long elementID) { - super(gc, x, y, xEnd, yEnd, lineConnectedWithPointAtStart, lineConnectedWithPointAtEnd, elemStart, elemEnd, elementID); - } + extends Graphic_LINE_Elem { + @Serial + private static final long serialVersionUID = 1L; + + public Graphic_LINE_RSISAG_ES_Elem(GraphicsContext gc, double x, double y, double xEnd, double yEnd, byte lineConnectedWithPointAtStart, byte lineConnectedWithPointAtEnd, Graphic_Figure_Elem elemStart, Graphic_Figure_Elem elemEnd, long elementID) { + super(gc, x, y, xEnd, yEnd, lineConnectedWithPointAtStart, lineConnectedWithPointAtEnd, elemStart, elemEnd, elementID); + } - - - protected Color sefdsfdsf45() { - return C2.ERMISAConnGENERAL; - } + protected Color sefdsfdsf45() { + return C2.ERMISAConnGENERAL; + } } diff --git a/at/fos/ermodel/gui/Graphic_LINE_RSISAS_ES_Elem.java b/at/fos/ermodel/gui/Graphic_LINE_RSISAS_ES_Elem.java index 34b02c4..5eb6c90 100644 --- a/at/fos/ermodel/gui/Graphic_LINE_RSISAS_ES_Elem.java +++ b/at/fos/ermodel/gui/Graphic_LINE_RSISAS_ES_Elem.java @@ -7,21 +7,18 @@ import java.io.Serial; public class Graphic_LINE_RSISAS_ES_Elem - extends Graphic_LINE_Elem -{ - @Serial - private static final long serialVersionUID = 1L; - - public Graphic_LINE_RSISAS_ES_Elem(GraphicsContext gc, double x, double y, double xEnd, double yEnd, byte lineConnectedWithPointAtStart, byte lineConnectedWithPointAtEnd, Graphic_Figure_Elem elemStart, Graphic_Figure_Elem elemEnd, long elementID) { - super(gc, x, y, xEnd, yEnd, lineConnectedWithPointAtStart, lineConnectedWithPointAtEnd, elemStart, elemEnd, elementID); - } + extends Graphic_LINE_Elem { + @Serial + private static final long serialVersionUID = 1L; + + public Graphic_LINE_RSISAS_ES_Elem(GraphicsContext gc, double x, double y, double xEnd, double yEnd, byte lineConnectedWithPointAtStart, byte lineConnectedWithPointAtEnd, Graphic_Figure_Elem elemStart, Graphic_Figure_Elem elemEnd, long elementID) { + super(gc, x, y, xEnd, yEnd, lineConnectedWithPointAtStart, lineConnectedWithPointAtEnd, elemStart, elemEnd, elementID); + } - - - protected Color sefdsfdsf45() { - return C2.ERMISAConnSPEC; - } + protected Color sefdsfdsf45() { + return C2.ERMISAConnSPEC; + } } diff --git a/at/fos/ermodel/gui/Graphic_LINE_RS_ES_Elem.java b/at/fos/ermodel/gui/Graphic_LINE_RS_ES_Elem.java index e5d9a0e..7287662 100644 --- a/at/fos/ermodel/gui/Graphic_LINE_RS_ES_Elem.java +++ b/at/fos/ermodel/gui/Graphic_LINE_RS_ES_Elem.java @@ -7,21 +7,18 @@ import java.io.Serial; public class Graphic_LINE_RS_ES_Elem - extends Graphic_LINE_Elem -{ - @Serial - private static final long serialVersionUID = 1L; - - public Graphic_LINE_RS_ES_Elem(GraphicsContext gc, double x, double y, double xEnd, double yEnd, byte lineConnectedWithPointAtStart, byte lineConnectedWithPointAtEnd, Graphic_Figure_Elem elemStart, Graphic_Figure_Elem elemEnd, long elementID) { - super(gc, x, y, xEnd, yEnd, lineConnectedWithPointAtStart, lineConnectedWithPointAtEnd, elemStart, elemEnd, elementID); - } + extends Graphic_LINE_Elem { + @Serial + private static final long serialVersionUID = 1L; + + public Graphic_LINE_RS_ES_Elem(GraphicsContext gc, double x, double y, double xEnd, double yEnd, byte lineConnectedWithPointAtStart, byte lineConnectedWithPointAtEnd, Graphic_Figure_Elem elemStart, Graphic_Figure_Elem elemEnd, long elementID) { + super(gc, x, y, xEnd, yEnd, lineConnectedWithPointAtStart, lineConnectedWithPointAtEnd, elemStart, elemEnd, elementID); + } - - - protected Color sefdsfdsf45() { - return C2.ERMRSConnColor; - } + protected Color sefdsfdsf45() { + return C2.ERMRSConnColor; + } } diff --git a/at/fos/ermodel/gui/Graphic_Main_Elem.java b/at/fos/ermodel/gui/Graphic_Main_Elem.java index adee06d..3e10125 100644 --- a/at/fos/ermodel/gui/Graphic_Main_Elem.java +++ b/at/fos/ermodel/gui/Graphic_Main_Elem.java @@ -1,214 +1,158 @@ package at.fos.ermodel.gui; -import java.io.Serial; -import java.io.Serializable; import javafx.scene.canvas.GraphicsContext; import javafx.scene.paint.Color; +import java.io.Serial; +import java.io.Serializable; + public abstract class Graphic_Main_Elem - implements Serializable, Comparable -{ - @Serial - private static final long serialVersionUID = 1L; - protected long graphicMainElemID; - protected double xPos; - protected double yPos; - protected String name; - protected transient GraphicsContext gc; - protected transient boolean isVisible; - protected transient boolean isConnectable; - transient U4 undoRedoAction; - - public Graphic_Main_Elem(GraphicsContext gc, long elementID) { - this.graphicMainElemID = elementID; - this.gc = gc; - this.isVisible = true; - } + implements Serializable, Comparable { + @Serial + private static final long serialVersionUID = 1L; + protected long graphicMainElemID; + protected double xPos; + protected double yPos; + protected String name; + protected transient GraphicsContext gc; + protected transient boolean isVisible; + protected transient boolean isConnectable; + transient U4 undoRedoAction; + + public Graphic_Main_Elem(GraphicsContext gc, long elementID) { + this.graphicMainElemID = elementID; + this.gc = gc; + this.isVisible = true; + } - - - public GraphicsContext getGc() { - return this.gc; - } + public GraphicsContext getGc() { + return this.gc; + } - - public void setGc(GraphicsContext gc) { - this.gc = gc; - } - - - - - public void setxPos(double xPos) { - this.xPos = xPos; - } - - - - public void setyPos(double yPos) { - this.yPos = yPos; - } - - public void safdsadasds32432456456() { - dsfdsfds6787686(sefdsfdsf45()); } + public void setGc(GraphicsContext gc) { + this.gc = gc; + } + public void safdsadasds32432456456() { + dsfdsfds6787686(sefdsfdsf45()); + } protected Color getColorSelected() { - return C2.ERMSelectedColor; - } + return C2.ERMSelectedColor; + } + + protected Color getColorDockable() { + return C2.ERMDockablePointColor; + } + + public void dfsdfssdf456456() { + dsfsdfsfd(); + dsfdsfds6787686(sefdsfdsf45()); + } + + public double getxPos() { + return this.xPos; + } + + public void setxPos(double xPos) { + this.xPos = xPos; + } + + public double getyPos() { + return this.yPos; + } + + public void setyPos(double yPos) { + this.yPos = yPos; + } + + public void dgfdsfdssfd43534456() { + selectElem(); + } + public void sdffdsfsdf4354357656(double newX, double newY) { + dsfsdfsfd(); + this.xPos = newX; + this.yPos = newY; + dsfdsfds6787686(getColorSelected()); + } - - protected Color getColorDockable() { - return C2.ERMDockablePointColor; - } + public void selectElem() { + dsfdsfds6787686(getColorSelected()); + } + public int hashCode() { + int result = 1; + result = 31 * result + (int) (this.graphicMainElemID ^ this.graphicMainElemID >>> 32L); + return result; + } - - public void dfsdfssdf456456() { - dsfsdfsfd(); dsfdsfds6787686(sefdsfdsf45()); - } + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (getClass() != obj.getClass()) + return false; + Graphic_Main_Elem other = (Graphic_Main_Elem) obj; + return this.graphicMainElemID == other.graphicMainElemID; + } + public String toString() { + return "Graphic_Main_Elem [graphicMainElemID=" + this.graphicMainElemID + ", xPos=" + this.xPos + ", yPos=" + this.yPos + + ", name=" + this.name + "]"; + } + public long sdfsdfsdfd() { + return this.graphicMainElemID; + } + public void dsdasadsasd32423432(long graphicMainElemID) { + this.graphicMainElemID = graphicMainElemID; + } - - public double getxPos() { - return this.xPos; - } + public String sdfsdfsd32234243() { + return this.name; + } - - public double getyPos() { - return this.yPos; - } + public U4 adsadadsa4354353() { + return this.undoRedoAction; + } - - public void dgfdsfdssfd43534456() { - selectElem(); - } + public void sfdsfsfsddf123234435(U4 undoRedoAction) { + this.undoRedoAction = undoRedoAction; + } + public int compareTo(Graphic_Main_Elem arg0) { + return Long.compare(this.graphicMainElemID, arg0.graphicMainElemID); + } + public abstract double dsfsfsd456457657(); + public abstract double getHeight(); - - public void sdffdsfsdf4354357656(double newX, double newY) { - dsfsdfsfd(); - this.xPos = newX; - this.yPos = newY; - dsfdsfds6787686(getColorSelected()); - } + protected abstract Color sefdsfdsf45(); + public abstract void dsfsdfsfd(); + protected abstract void dsfdsfds6787686(Color paramColor); - - public void selectElem() { - dsfdsfds6787686(getColorSelected()); - } + public abstract boolean dsfsfds45645456(double paramDouble1, double paramDouble2); - - - - - - public int hashCode() { - int result = 1; - result = 31 * result + (int)(this.graphicMainElemID ^ this.graphicMainElemID >>> 32L); - return result; - } - - - - - public boolean equals(Object obj) { - if (this == obj) - return true; - if (obj == null) - return false; - if (getClass() != obj.getClass()) - return false; - Graphic_Main_Elem other = (Graphic_Main_Elem)obj; - return this.graphicMainElemID == other.graphicMainElemID; - } - - - - - - - - - - - - public String toString() { - return "Graphic_Main_Elem [graphicMainElemID=" + this.graphicMainElemID + ", xPos=" + this.xPos + ", yPos=" + this.yPos + - ", name=" + this.name + "]"; - } - - - - public long sdfsdfsdfd() { - return this.graphicMainElemID; - } - - - - public void dsdasadsasd32423432(long graphicMainElemID) { - this.graphicMainElemID = graphicMainElemID; - } - - - - public String sdfsdfsd32234243() { - return this.name; - } - - - - public U4 adsadadsa4354353() { - return this.undoRedoAction; - } - - - - public void sfdsfsfsddf123234435(U4 undoRedoAction) { - this.undoRedoAction = undoRedoAction; - } - - - - - - public int compareTo(Graphic_Main_Elem arg0) { - return Long.compare(this.graphicMainElemID, arg0.graphicMainElemID); - } - - public abstract double dsfsfsd456457657(); - - public abstract double getHeight(); - - protected abstract Color sefdsfdsf45(); - - public abstract void dsfsdfsfd(); - - protected abstract void dsfdsfds6787686(Color paramColor); - - public abstract boolean dsfsfds45645456(double paramDouble1, double paramDouble2); - - public abstract char sdfsdfdsfdf(); + public abstract char sdfsdfdsfdf(); } diff --git a/at/fos/ermodel/gui/Graphic_RS_Elem.java b/at/fos/ermodel/gui/Graphic_RS_Elem.java index d57aafb..f5ec75c 100644 --- a/at/fos/ermodel/gui/Graphic_RS_Elem.java +++ b/at/fos/ermodel/gui/Graphic_RS_Elem.java @@ -6,82 +6,67 @@ import javafx.scene.paint.Color; import java.io.Serial; public class Graphic_RS_Elem - extends Graphic_RS_Main_Elem -{ - @Serial -private static final long serialVersionUID = 1L; - - public Graphic_RS_Elem(GraphicsContext gc, double x, double y, String name, long elementID) { - super(gc, name, elementID); - - this.xPos = x; - this.yPos = y; - this.createRelation = true; - } + extends Graphic_RS_Main_Elem { + @Serial + private static final long serialVersionUID = 1L; + + public Graphic_RS_Elem(GraphicsContext gc, double x, double y, String name, long elementID) { + super(gc, name, elementID); + + this.xPos = x; + this.yPos = y; + this.createRelation = true; + } - - - - - - - protected void dsfdsfds6787686(Color c) { - if (!this.isVisible) - return; - this.gc.beginPath(); - this.gc.setStroke(c); - this.gc.strokePolygon(new double[] { this.xPos - this.textWidth / 2.0D, - this.xPos, - this.xPos + this.textWidth / 2.0D, - this.xPos - }, new double[] { this.yPos, - this.yPos - this.textHeight / 2.0D, - this.yPos, - this.yPos + this.textHeight / 2.0D + protected void dsfdsfds6787686(Color c) { + if (!this.isVisible) + return; + this.gc.beginPath(); + this.gc.setStroke(c); + this.gc.strokePolygon(new double[]{this.xPos - this.textWidth / 2.0D, + this.xPos, + this.xPos + this.textWidth / 2.0D, + this.xPos + }, new double[]{this.yPos, + this.yPos - this.textHeight / 2.0D, + this.yPos, + this.yPos + this.textHeight / 2.0D }, 4); - this.gc.setFill(C2.ERMTextColor); - this.gc.fillText(this.name, this.xPos - this.textWidth / 2.0D + 10.0D, this.yPos + this.textHeight / 2.0D - 18.0D); - this.gc.closePath(); - } + this.gc.setFill(C2.ERMTextColor); + this.gc.fillText(this.name, this.xPos - this.textWidth / 2.0D + 10.0D, this.yPos + this.textHeight / 2.0D - 18.0D); + this.gc.closePath(); + } + public String safsafdsa456456456() { + return "RS"; + } - - public String safsafdsa456456456() { - return "RS"; - } + public void dsfsdfsfd() { + this.gc.clearRect(this.xPos - this.textWidth / 2.0D - 2.0D, this.yPos - this.textHeight / 2.0D - 2.0D, this.textWidth + 4.0D, this.textHeight + 4.0D); + } - - public void dsfsdfsfd() { - this.gc.clearRect(this.xPos - this.textWidth / 2.0D - 2.0D, this.yPos - this.textHeight / 2.0D - 2.0D, this.textWidth + 4.0D, this.textHeight + 4.0D); - } + public double dsfsfsd456457657() { + return this.textWidth; + } - - public double dsfsfsd456457657() { - return this.textWidth; - } + public double getHeight() { + return this.textHeight; + } - - public double getHeight() { - return this.textHeight; - } + public char sdfsdfdsfdf() { + return 'r'; + } - - public char sdfsdfdsfdf() { - return 'r'; - } - - - - protected Color sefdsfdsf45() { - return C2.ERMRSColor; - } + protected Color sefdsfdsf45() { + return C2.ERMRSColor; + } } diff --git a/at/fos/ermodel/gui/Graphic_RS_ISA_Elem.java b/at/fos/ermodel/gui/Graphic_RS_ISA_Elem.java index 5094e3f..b9901c7 100644 --- a/at/fos/ermodel/gui/Graphic_RS_ISA_Elem.java +++ b/at/fos/ermodel/gui/Graphic_RS_ISA_Elem.java @@ -7,152 +7,123 @@ import java.io.Serial; public class Graphic_RS_ISA_Elem - extends Graphic_RS_Main_Elem -{ - @Serial - private static final long serialVersionUID = 1L; - private String partial_or_total; - private String disjunct_or_notdisjunct; - - public Graphic_RS_ISA_Elem(GraphicsContext gc, double x, double y, String name, long elementID) { - super(gc, null, elementID); - - this.xPos = x; - this.yPos = y; - this.createRelation = false; - this.createInserts = true; - this.numberRowsToInsert = 1L; - } + extends Graphic_RS_Main_Elem { + @Serial + private static final long serialVersionUID = 1L; + private String partial_or_total; + private String disjunct_or_notdisjunct; + + public Graphic_RS_ISA_Elem(GraphicsContext gc, double x, double y, String name, long elementID) { + super(gc, null, elementID); + + this.xPos = x; + this.yPos = y; + this.createRelation = false; + this.createInserts = true; + this.numberRowsToInsert = 1L; + } - - - - - - protected void dsfdsfds6787686(Color c) { - if (!this.isVisible) - return; - this.gc.beginPath(); - this.gc.setStroke(c); - this.gc.strokePolygon(new double[] { this.xPos - this.textWidth / 2.0D, - this.xPos, - this.xPos + this.textWidth / 2.0D, - this.xPos - }, new double[] { this.yPos, - this.yPos - this.textHeight / 2.0D, - this.yPos, - this.yPos + this.textHeight / 2.0D + protected void dsfdsfds6787686(Color c) { + if (!this.isVisible) + return; + this.gc.beginPath(); + this.gc.setStroke(c); + this.gc.strokePolygon(new double[]{this.xPos - this.textWidth / 2.0D, + this.xPos, + this.xPos + this.textWidth / 2.0D, + this.xPos + }, new double[]{this.yPos, + this.yPos - this.textHeight / 2.0D, + this.yPos, + this.yPos + this.textHeight / 2.0D }, 4); - this.gc.setFill(C2.ERMTextColor); - this.gc.fillText(this.name, this.xPos - this.textWidth / 2.0D + 10.0D, this.yPos + this.textHeight / 2.0D - 17.0D); - - - this.gc.fillText("(" + this.partial_or_total + "," + this.disjunct_or_notdisjunct + ")", this.xPos + this.textWidth / 2.0D + 5.0D, this.yPos - 5.0D); - - this.gc.closePath(); - } + this.gc.setFill(C2.ERMTextColor); + this.gc.fillText(this.name, this.xPos - this.textWidth / 2.0D + 10.0D, this.yPos + this.textHeight / 2.0D - 17.0D); + this.gc.fillText("(" + this.partial_or_total + "," + this.disjunct_or_notdisjunct + ")", this.xPos + this.textWidth / 2.0D + 5.0D, this.yPos - 5.0D); + + this.gc.closePath(); + } - - public String safsafdsa456456456() { - return "ISA"; - } + public String safsafdsa456456456() { + return "ISA"; + } - - public void dsfsdfsfd() { - this.gc.clearRect(this.xPos - this.textWidth / 2.0D - 1.0D, this.yPos - this.textHeight / 2.0D - 1.0D, this.textWidth + 2.0D, this.textHeight + 2.0D); - - this.gc.clearRect(this.xPos + this.textWidth / 2.0D + 5.0D - 3.0D, - this.yPos - 15.0D, - C2.computeTextWidth("(" + this.partial_or_total + "," + this.disjunct_or_notdisjunct + ")", 2000.0D) + 10.0D, - C2.computeTextHeight() + 12.0D); - } + public void dsfsdfsfd() { + this.gc.clearRect(this.xPos - this.textWidth / 2.0D - 1.0D, this.yPos - this.textHeight / 2.0D - 1.0D, this.textWidth + 2.0D, this.textHeight + 2.0D); + + this.gc.clearRect(this.xPos + this.textWidth / 2.0D + 5.0D - 3.0D, + this.yPos - 15.0D, + C2.computeTextWidth("(" + this.partial_or_total + "," + this.disjunct_or_notdisjunct + ")", 2000.0D) + 10.0D, + C2.computeTextHeight() + 12.0D); + } - - public double dsfsfsd456457657() { - return this.textWidth; - } + public double dsfsfsd456457657() { + return this.textWidth; + } - - public double getHeight() { - return this.textHeight; - } + public double getHeight() { + return this.textHeight; + } - - public char sdfsdfdsfdf() { - return 'r'; - } + public char sdfsdfdsfdf() { + return 'r'; + } - - protected Color sefdsfdsf45() { - return C2.ERMRSISAColor; - } + protected Color sefdsfdsf45() { + return C2.ERMRSISAColor; + } - - - public String getPartial_or_total() { - return this.partial_or_total; - } + public String getPartial_or_total() { + return this.partial_or_total; + } - - - public void setPartial_or_total(String partial_or_total) { - this.partial_or_total = partial_or_total; - } + public void setPartial_or_total(String partial_or_total) { + this.partial_or_total = partial_or_total; + } - - - public String getDisjunct_or_notdisjunct() { - return this.disjunct_or_notdisjunct; - } + public String getDisjunct_or_notdisjunct() { + return this.disjunct_or_notdisjunct; + } - - - public void setDisjunct_or_notdisjunct(String disjunct_or_notdisjunct) { - this.disjunct_or_notdisjunct = disjunct_or_notdisjunct; - } + public void setDisjunct_or_notdisjunct(String disjunct_or_notdisjunct) { + this.disjunct_or_notdisjunct = disjunct_or_notdisjunct; + } + protected void changeP_T_D_ND(String partial_or_total, String disjunct_or_notdisjunct) { + this.partial_or_total = partial_or_total; + this.disjunct_or_notdisjunct = disjunct_or_notdisjunct; + if (partial_or_total == null) this.partial_or_total = getDefaultPartial_or_total(); + if (disjunct_or_notdisjunct == null) this.disjunct_or_notdisjunct = getDefaultDisjunct_or_notdisjunct(); + dsfsdfsfd(); + safdsadasds32432456456(); + } + + private String getDefaultPartial_or_total() { + return "p"; + } + + private String getDefaultDisjunct_or_notdisjunct() { + return "nd"; + } - - - - protected void changeP_T_D_ND(String partial_or_total, String disjunct_or_notdisjunct) { - this.partial_or_total = partial_or_total; - this.disjunct_or_notdisjunct = disjunct_or_notdisjunct; - if (partial_or_total == null) this.partial_or_total = getDefaultPartial_or_total(); - if (disjunct_or_notdisjunct == null) this.disjunct_or_notdisjunct = getDefaultDisjunct_or_notdisjunct(); - dsfsdfsfd(); - safdsadasds32432456456(); - } - - private String getDefaultPartial_or_total() { - return "p"; - } - - private String getDefaultDisjunct_or_notdisjunct() { - return "nd"; - } - - - - - public String sdfsdfsd32234243() { - return safsafdsa456456456() + "(" + this.partial_or_total + "," + this.disjunct_or_notdisjunct + ")"; - } + public String sdfsdfsd32234243() { + return safsafdsa456456456() + "(" + this.partial_or_total + "," + this.disjunct_or_notdisjunct + ")"; + } } diff --git a/at/fos/ermodel/gui/Graphic_RS_Identifying_Elem.java b/at/fos/ermodel/gui/Graphic_RS_Identifying_Elem.java index dbf5823..e65159c 100644 --- a/at/fos/ermodel/gui/Graphic_RS_Identifying_Elem.java +++ b/at/fos/ermodel/gui/Graphic_RS_Identifying_Elem.java @@ -7,95 +7,78 @@ import java.io.Serial; public class Graphic_RS_Identifying_Elem - extends Graphic_RS_Main_Elem -{ - @Serial - private static final long serialVersionUID = 1L; - - public Graphic_RS_Identifying_Elem(GraphicsContext gc, double x, double y, String name, long elementID) { - super(gc, name, elementID); - - this.xPos = x; - this.yPos = y; - this.createRelation = false; - this.createInserts = true; - this.numberRowsToInsert = 1L; - } + extends Graphic_RS_Main_Elem { + @Serial + private static final long serialVersionUID = 1L; + + public Graphic_RS_Identifying_Elem(GraphicsContext gc, double x, double y, String name, long elementID) { + super(gc, name, elementID); + + this.xPos = x; + this.yPos = y; + this.createRelation = false; + this.createInserts = true; + this.numberRowsToInsert = 1L; + } - - - - - - - protected void dsfdsfds6787686(Color c) { - if (!this.isVisible) - return; - this.gc.beginPath(); - this.gc.setStroke(c); - this.gc.strokePolygon(new double[] { this.xPos - this.textWidth / 2.0D, - this.xPos, - this.xPos + this.textWidth / 2.0D, - this.xPos - }, new double[] { this.yPos, - this.yPos - this.textHeight / 2.0D, - this.yPos, - this.yPos + this.textHeight / 2.0D + protected void dsfdsfds6787686(Color c) { + if (!this.isVisible) + return; + this.gc.beginPath(); + this.gc.setStroke(c); + this.gc.strokePolygon(new double[]{this.xPos - this.textWidth / 2.0D, + this.xPos, + this.xPos + this.textWidth / 2.0D, + this.xPos + }, new double[]{this.yPos, + this.yPos - this.textHeight / 2.0D, + this.yPos, + this.yPos + this.textHeight / 2.0D }, 4); - this.gc.strokePolygon(new double[] { this.xPos - this.textWidth / 2.0D + 3.0D, - this.xPos, - this.xPos + this.textWidth / 2.0D - 3.0D, - this.xPos - }, new double[] { this.yPos, - this.yPos - this.textHeight / 2.0D + 3.0D, - this.yPos, - this.yPos + this.textHeight / 2.0D - 3.0D + this.gc.strokePolygon(new double[]{this.xPos - this.textWidth / 2.0D + 3.0D, + this.xPos, + this.xPos + this.textWidth / 2.0D - 3.0D, + this.xPos + }, new double[]{this.yPos, + this.yPos - this.textHeight / 2.0D + 3.0D, + this.yPos, + this.yPos + this.textHeight / 2.0D - 3.0D }, 4); - this.gc.setFill(C2.ERMTextColor); - this.gc.fillText(this.name, this.xPos - this.textWidth / 2.0D + 10.0D, this.yPos + this.textHeight / 2.0D - 17.0D); - this.gc.closePath(); - } + this.gc.setFill(C2.ERMTextColor); + this.gc.fillText(this.name, this.xPos - this.textWidth / 2.0D + 10.0D, this.yPos + this.textHeight / 2.0D - 17.0D); + this.gc.closePath(); + } + public String safsafdsa456456456() { + return "RS-ID"; + } + public void dsfsdfsfd() { + this.gc.clearRect(this.xPos - this.textWidth / 2.0D - 1.0D, this.yPos - this.textHeight / 2.0D - 1.0D, this.textWidth + 2.0D, this.textHeight + 2.0D); + } - - public String safsafdsa456456456() { - return "RS-ID"; - } + public double dsfsfsd456457657() { + return this.textWidth; + } - - public void dsfsdfsfd() { - this.gc.clearRect(this.xPos - this.textWidth / 2.0D - 1.0D, this.yPos - this.textHeight / 2.0D - 1.0D, this.textWidth + 2.0D, this.textHeight + 2.0D); - } + public double getHeight() { + return this.textHeight; + } - - public double dsfsfsd456457657() { - return this.textWidth; - } + public char sdfsdfdsfdf() { + return 'r'; + } - - public double getHeight() { - return this.textHeight; - } - - - - public char sdfsdfdsfdf() { - return 'r'; - } - - - - protected Color sefdsfdsf45() { - return C2.ERMRSColor; - } + protected Color sefdsfdsf45() { + return C2.ERMRSColor; + } } diff --git a/at/fos/ermodel/gui/Graphic_RS_Main_Elem.java b/at/fos/ermodel/gui/Graphic_RS_Main_Elem.java index 38c83fc..7f54f9e 100644 --- a/at/fos/ermodel/gui/Graphic_RS_Main_Elem.java +++ b/at/fos/ermodel/gui/Graphic_RS_Main_Elem.java @@ -6,108 +6,87 @@ import java.io.Serial; public abstract class Graphic_RS_Main_Elem - extends Graphic_Figure_Elem - implements U3 -{ - @Serial - private static final long serialVersionUID = 1L; - protected boolean createRelation; - protected String relationPraefix; - protected String relationName; - protected boolean createInserts; - protected long numberRowsToInsert = 1L; + extends Graphic_Figure_Elem + implements U3 { + @Serial + private static final long serialVersionUID = 1L; + protected boolean createRelation; + protected String relationPraefix; + protected String relationName; + protected boolean createInserts; + protected long numberRowsToInsert = 1L; + public Graphic_RS_Main_Elem(GraphicsContext gc, String name, long elementID) { + super(gc, name, elementID); + this.relationName = this.name.toLowerCase(); + this.relationName = T3.replaceSpecialChars(this.relationName); + this.relationPraefix = this.relationName.charAt(0) + "_"; + this.createInserts = true; + } + protected void changeName(String name) { + super.changeName(name); + + this.relationName = T3.replaceSpecialChars(name.toLowerCase()); + this.relationPraefix = this.relationName.charAt(0) + "_"; + } + public boolean getCreateRelation() { + return this.createRelation; + } - - public Graphic_RS_Main_Elem(GraphicsContext gc, String name, long elementID) { - super(gc, name, elementID); - this.relationName = this.name.toLowerCase(); - this.relationName = T3.replaceSpecialChars(this.relationName); - this.relationPraefix = this.relationName.charAt(0) + "_"; - this.createInserts = true; - } + public void setCreateRelation(boolean createRelation) { + this.createRelation = createRelation; + } + public String getRelationPraefix() { + return this.relationPraefix; + } - - - protected void changeName(String name) { - super.changeName(name); - - this.relationName = T3.replaceSpecialChars(name.toLowerCase()); - this.relationPraefix = this.relationName.charAt(0) + "_"; - } + public void setRelationPraefix(String relationPraefix) { + this.relationPraefix = relationPraefix; + } - - public boolean getCreateRelation() { - return this.createRelation; - } - - - public void setCreateRelation(boolean createRelation) { - this.createRelation = createRelation; - } + public String getRelationName() { + return this.relationName; + } - - public String getRelationPraefix() { - return this.relationPraefix; - } - - - public void setRelationPraefix(String relationPraefix) { - this.relationPraefix = relationPraefix; - } + public void setRelationName(String relationName) { + this.relationName = relationName; + } - - public String getRelationName() { - return this.relationName; - } - - - public void setRelationName(String relationName) { - this.relationName = relationName; - } + public boolean getCreateInserts() { + return this.createInserts; + } - - public boolean getCreateInserts() { - return this.createInserts; - } + public void setCreateInserts(boolean createInserts) { + this.createInserts = createInserts; + } - - public void setCreateInserts(boolean createInserts) { - this.createInserts = createInserts; - } + public long getNumberRowsToInsert() { + return this.numberRowsToInsert; + } - - public long getNumberRowsToInsert() { - return this.numberRowsToInsert; - } + public void setNumberRowsToInsert(long numberRowsToInsert) { + this.numberRowsToInsert = numberRowsToInsert; + } - - public void setNumberRowsToInsert(long numberRowsToInsert) { - this.numberRowsToInsert = numberRowsToInsert; - } - - - - - public String sdfsdfsd32234243() { - return super.sdfsdfsd32234243(); - } + public String sdfsdfsd32234243() { + return super.sdfsdfsd32234243(); + } } diff --git a/at/fos/ermodel/gui/Graphic_Text_Elem.java b/at/fos/ermodel/gui/Graphic_Text_Elem.java index 9dc93fb..74d7131 100644 --- a/at/fos/ermodel/gui/Graphic_Text_Elem.java +++ b/at/fos/ermodel/gui/Graphic_Text_Elem.java @@ -8,130 +8,110 @@ import java.io.Serial; public class Graphic_Text_Elem - extends Graphic_Main_Elem -{ - @Serial - private static final long serialVersionUID = 1L; - protected double textWidth; - protected double textHeight; - protected boolean hasBorder; - private int numberLines; - - public double dsfsfsd456457657() { - return this.textWidth; } public double getHeight() { - return this.textHeight; - } + extends Graphic_Main_Elem { + @Serial + private static final long serialVersionUID = 1L; + protected double textWidth; + protected double textHeight; + protected boolean hasBorder; + private int numberLines; + + public Graphic_Text_Elem(GraphicsContext gc, double x, double y, String name, boolean hasBorder, long elementID) { + super(gc, elementID); + this.name = name; + if (name == null) this.name = getDefaultName(); + this.hasBorder = hasBorder; + this.xPos = x; + this.yPos = y; + String[] lines = this.name.split("\n"); + this.numberLines = lines.length; + calculateTextWidthHeight(); + } + + public double dsfsfsd456457657() { + return this.textWidth; + } + + public double getHeight() { + return this.textHeight; + } + + protected void changeName(String name) { + this.name = name; + if (name == null) this.name = getDefaultName(); + dsfsdfsfd(); + + String[] lines = this.name.split("\n"); + this.numberLines = lines.length; + calculateTextWidthHeight(); + safdsadasds32432456456(); + } - - public Graphic_Text_Elem(GraphicsContext gc, double x, double y, String name, boolean hasBorder, long elementID) { - super(gc, elementID); - this.name = name; - if (name == null) this.name = getDefaultName(); - this.hasBorder = hasBorder; - this.xPos = x; - this.yPos = y; - String[] lines = this.name.split("\n"); - this.numberLines = lines.length; - calculateTextWidthHeight(); - } + public boolean dsfsfds45645456(double mouseX, double mouseY) { + return mouseX >= this.xPos - dsfsfsd456457657() / 2.0D && mouseX <= this.xPos + dsfsfsd456457657() / 2.0D && + mouseY >= this.yPos - getHeight() / 2.0D && mouseY <= this.yPos + getHeight() / 2.0D; + } + public void calculateTextWidthHeight() { + this.textWidth = C2.computeTextWidth(this.name, 2000.0D); + this.textWidth += 20.0D; + this.gc.setFont(C2.ERMFont); + Font f = this.gc.getFont(); + this.textHeight = f.getSize(); + this.textHeight = this.numberLines * this.textHeight + 30.0D; + } - - - - protected void changeName(String name) { - this.name = name; - if (name == null) this.name = getDefaultName(); - dsfsdfsfd(); - - String[] lines = this.name.split("\n"); - this.numberLines = lines.length; - calculateTextWidthHeight(); - safdsadasds32432456456(); - } - - - - - - public boolean dsfsfds45645456(double mouseX, double mouseY) { - return mouseX >= this.xPos - dsfsfsd456457657() / 2.0D && mouseX <= this.xPos + dsfsfsd456457657() / 2.0D && - mouseY >= this.yPos - getHeight() / 2.0D && mouseY <= this.yPos + getHeight() / 2.0D; - } - - - - - - public void calculateTextWidthHeight() { - this.textWidth = C2.computeTextWidth(this.name, 2000.0D); - this.textWidth += 20.0D; - this.gc.setFont(C2.ERMFont); - Font f = this.gc.getFont(); - this.textHeight = f.getSize(); - this.textHeight = this.numberLines * this.textHeight + 30.0D; - } - - - - - - - public String toString() { - return "Graphic_Figure_Elem [textWidth=" + this.textWidth + ", textHeight=" + this.textHeight + ", toString()=" + - super.toString() + "]"; - } + public String toString() { + return "Graphic_Figure_Elem [textWidth=" + this.textWidth + ", textHeight=" + this.textHeight + ", toString()=" + + super.toString() + "]"; + } protected Color sefdsfdsf45() { - return C2.ERMTextBorderColor; - } - - - - public void dsfsdfsfd() { - this.gc.clearRect(this.xPos - this.textWidth / 2.0D - 1.0D, this.yPos - this.textHeight / 2.0D - 1.0D, this.textWidth + 2.0D, this.textHeight + 2.0D); - } - - - - - protected void dsfdsfds6787686(Color c) { - if (!this.isVisible) { - return; + return C2.ERMTextBorderColor; } - this.gc.beginPath(); - - - if (this.hasBorder || c.equals(C2.ERMSelectedColor)) { - this.gc.setStroke(c); - this.gc.strokeRect(this.xPos - this.textWidth / 2.0D, this.yPos - this.textHeight / 2.0D, this.textWidth, this.textHeight); - } - - - this.gc.setFill(C2.ERMTextColor); - if (this.numberLines == 1) { this.gc.fillText(this.name, this.xPos - this.textWidth / 2.0D + 10.0D, this.yPos + this.textHeight / 2.0D - 15.0D); } - else { this.gc.fillText(this.name, this.xPos - this.textWidth / 2.0D + 10.0D, this.yPos - this.textHeight / 2.0D + this.textHeight / this.numberLines); } - - this.gc.closePath(); - } - - public char sdfsdfdsfdf() { - return 't'; - } + public void dsfsdfsfd() { + this.gc.clearRect(this.xPos - this.textWidth / 2.0D - 1.0D, this.yPos - this.textHeight / 2.0D - 1.0D, this.textWidth + 2.0D, this.textHeight + 2.0D); + } + protected void dsfdsfds6787686(Color c) { + if (!this.isVisible) { + return; + } + this.gc.beginPath(); - - public String getDefaultName() { - return "Text"; - } + if (this.hasBorder || c.equals(C2.ERMSelectedColor)) { + this.gc.setStroke(c); + this.gc.strokeRect(this.xPos - this.textWidth / 2.0D, this.yPos - this.textHeight / 2.0D, this.textWidth, this.textHeight); + } + + + this.gc.setFill(C2.ERMTextColor); + if (this.numberLines == 1) { + this.gc.fillText(this.name, this.xPos - this.textWidth / 2.0D + 10.0D, this.yPos + this.textHeight / 2.0D - 15.0D); + } else { + this.gc.fillText(this.name, this.xPos - this.textWidth / 2.0D + 10.0D, this.yPos - this.textHeight / 2.0D + this.textHeight / this.numberLines); + } + + this.gc.closePath(); + } + + + public char sdfsdfdsfdf() { + return 't'; + } + + + public String getDefaultName() { + return "Text"; + } } diff --git a/at/fos/ermodel/gui/T1.java b/at/fos/ermodel/gui/T1.java index 467470e..d410be2 100644 --- a/at/fos/ermodel/gui/T1.java +++ b/at/fos/ermodel/gui/T1.java @@ -5,203 +5,147 @@ import java.util.Collections; import java.util.HashMap; - - - - - - - - - - - - - - - - public class T1 - implements Comparable -{ - private String tablename; - private final String tablenamePraefix; - private final long referstoGraphicalElement; - private final ArrayList skjdfhgdskjf674534; - private final ArrayList dependsOnTable; - private final HashMap> columnsOfDependentOnTable; - private final boolean createInserts; - private long jdshfalkajsd677676; - - public T1(String tablename, String tablenamePraefix, long referstoGraphicalElement, boolean createInserts, long numberValues) { - this.tablename = tablename; - this.tablenamePraefix = tablenamePraefix; - this.referstoGraphicalElement = referstoGraphicalElement; - this.createInserts = createInserts; - this.jdshfalkajsd677676 = numberValues; - this.skjdfhgdskjf674534 = new ArrayList<>(); - this.dependsOnTable = new ArrayList<>(); - this.columnsOfDependentOnTable = new HashMap<>(); - } + implements Comparable { + private final String tablenamePraefix; + private final long referstoGraphicalElement; + private final ArrayList skjdfhgdskjf674534; + private final ArrayList dependsOnTable; + private final HashMap> columnsOfDependentOnTable; + private final boolean createInserts; + private String tablename; + private long jdshfalkajsd677676; + + public T1(String tablename, String tablenamePraefix, long referstoGraphicalElement, boolean createInserts, long numberValues) { + this.tablename = tablename; + this.tablenamePraefix = tablenamePraefix; + this.referstoGraphicalElement = referstoGraphicalElement; + this.createInserts = createInserts; + this.jdshfalkajsd677676 = numberValues; + this.skjdfhgdskjf674534 = new ArrayList<>(); + this.dependsOnTable = new ArrayList<>(); + this.columnsOfDependentOnTable = new HashMap<>(); + } + public void addColumn(C3 column) { + this.skjdfhgdskjf674534.add(column); + + Collections.sort(this.skjdfhgdskjf674534); + } - - - public void addColumn(C3 column) { - this.skjdfhgdskjf674534.add(column); - - Collections.sort(this.skjdfhgdskjf674534); - } - - - - - - - public void addTableDepdendentOn(T1 table) { - this.dependsOnTable.add(table); - } + public void addTableDepdendentOn(T1 table) { + this.dependsOnTable.add(table); + } public String getTablename() { - return this.tablename; - } + return this.tablename; + } - - public void setTablename(String tablename) { - this.tablename = tablename; - } + public void setTablename(String tablename) { + this.tablename = tablename; + } - - public ArrayList getSkjdfhgdskjf674534() { - return this.skjdfhgdskjf674534; - } + public ArrayList getSkjdfhgdskjf674534() { + return this.skjdfhgdskjf674534; + } + public int hashCode() { + int result = 1; + result = 31 * result + ((this.tablename == null) ? 0 : this.tablename.hashCode()); + return result; + } - - public int hashCode() { - int result = 1; - result = 31 * result + ((this.tablename == null) ? 0 : this.tablename.hashCode()); - return result; - } + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (getClass() != obj.getClass()) + return false; + T1 other = (T1) obj; + if (this.tablename == null) { + return other.tablename == null; + } else return this.tablename.equals(other.tablename); + } + public String toString() { + return "RM_Table [tablename=" + this.tablename + ", tablenamePraefix=" + this.tablenamePraefix + + ", referstoGraphicalElement=" + this.referstoGraphicalElement + ", columns=" + this.skjdfhgdskjf674534 + "]"; + } - - public boolean equals(Object obj) { - if (this == obj) - return true; - if (obj == null) - return false; - if (getClass() != obj.getClass()) - return false; - T1 other = (T1)obj; - if (this.tablename == null) { - return other.tablename == null; - } else return this.tablename.equals(other.tablename); - } - - - - - - - public String toString() { - return "RM_Table [tablename=" + this.tablename + ", tablenamePraefix=" + this.tablenamePraefix + - ", referstoGraphicalElement=" + this.referstoGraphicalElement + ", columns=" + this.skjdfhgdskjf674534 + "]"; - } - - - - - public String getTablenamePraefix() { - return this.tablenamePraefix; - } + public String getTablenamePraefix() { + return this.tablenamePraefix; + } public int compareTo(T1 arg0) { - return getTablename().compareTo(arg0.getTablename()); - } + return getTablename().compareTo(arg0.getTablename()); + } - - - public long getReferstoGraphicalElement() { - return this.referstoGraphicalElement; - } + public long getReferstoGraphicalElement() { + return this.referstoGraphicalElement; + } public ArrayList getKeyColumns() { - ArrayList keyColumns = new ArrayList<>(); - for (C3 column : this.skjdfhgdskjf674534) { - if (column.isKey()) { - keyColumns.add(column); - } - } - return keyColumns; - } + ArrayList keyColumns = new ArrayList<>(); + for (C3 column : this.skjdfhgdskjf674534) { + if (column.isKey()) { + keyColumns.add(column); + } + } + return keyColumns; + } - public boolean hasAutoincrement() { - for (C3 column : this.skjdfhgdskjf674534) { - if (column.isAutoincrement()) { - return true; - } - } - return false; - } + public boolean hasAutoincrement() { + for (C3 column : this.skjdfhgdskjf674534) { + if (column.isAutoincrement()) { + return true; + } + } + return false; + } + public boolean columnExist(String colName) { + return this.skjdfhgdskjf674534.contains(new C3(colName)); + } + public boolean isCreateInserts() { + return this.createInserts; + } - - public boolean columnExist(String colName) { - return this.skjdfhgdskjf674534.contains(new C3(colName)); - } + public long getJdshfalkajsd677676() { + return this.jdshfalkajsd677676; + } - - - public boolean isCreateInserts() { - return this.createInserts; - } + public void setJdshfalkajsd677676(long numberValues) { + this.jdshfalkajsd677676 = numberValues; + } - - - public long getJdshfalkajsd677676() { - return this.jdshfalkajsd677676; - } + public ArrayList getDependsOnTable() { + return this.dependsOnTable; + } - - - public void setJdshfalkajsd677676(long numberValues) { - this.jdshfalkajsd677676 = numberValues; - } - - - - - public ArrayList getDependsOnTable() { - return this.dependsOnTable; - } - - - - - public HashMap> getColumnsOfDependentOnTable() { - return this.columnsOfDependentOnTable; - } + public HashMap> getColumnsOfDependentOnTable() { + return this.columnsOfDependentOnTable; + } } diff --git a/at/fos/ermodel/gui/T2.java b/at/fos/ermodel/gui/T2.java index 2562203..c71208f 100644 --- a/at/fos/ermodel/gui/T2.java +++ b/at/fos/ermodel/gui/T2.java @@ -4,9 +4,9 @@ package at.fos.ermodel.gui; public record T2(String tablename, String columnname) { - public String toString() { - return "RM_ForeignKeyType [tablename=" + this.tablename + ", columnname=" + this.columnname + "]"; - } + public String toString() { + return "RM_ForeignKeyType [tablename=" + this.tablename + ", columnname=" + this.columnname + "]"; + } } diff --git a/at/fos/ermodel/gui/T3.java b/at/fos/ermodel/gui/T3.java index b6630f3..c234317 100644 --- a/at/fos/ermodel/gui/T3.java +++ b/at/fos/ermodel/gui/T3.java @@ -14,263 +14,213 @@ import java.util.HashMap; import java.util.Random; -public class T3 -{ - public static HashMap> randomData = new HashMap<>(); +public class T3 { + public static HashMap> randomData = new HashMap<>(); - - public static String[] dsfsdfsdf4353534 = new String[] { - "No", - "Extern", - "Random Integer", - "Random Decimal", - "Random Text", - "Random Date", - "Random Boolean", - "Random Color", - "Random Company", - "Random Country", - "Random Departmentname", - "Random Firstname", - "Random Jobname", - "Random Language", - "Random Lastname", - "Random Mediacategory", - "Random Mediapublisher", - "Random Mediatitle", - "Random Mediatype", - "Random Place", - "Random Profession", - "Random Rentalequipment", - "Random Street" }; + + public static String[] dsfsdfsdf4353534 = new String[]{ + "No", + "Extern", + "Random Integer", + "Random Decimal", + "Random Text", + "Random Date", + "Random Boolean", + "Random Color", + "Random Company", + "Random Country", + "Random Departmentname", + "Random Firstname", + "Random Jobname", + "Random Language", + "Random Lastname", + "Random Mediacategory", + "Random Mediapublisher", + "Random Mediatitle", + "Random Mediatype", + "Random Place", + "Random Profession", + "Random Rentalequipment", + "Random Street"}; public static Object copyObject(Object objSource) { - Object objDest = null; - try { - ByteArrayOutputStream bos = new ByteArrayOutputStream(); - ObjectOutputStream oos = new ObjectOutputStream(bos); - oos.writeObject(objSource); - oos.flush(); - oos.close(); - bos.close(); - byte[] byteData = bos.toByteArray(); - ByteArrayInputStream bais = new ByteArrayInputStream(byteData); - try { - objDest = (new ObjectInputStream(bais)).readObject(); - } catch (ClassNotFoundException e) { - e.printStackTrace(); - } - } catch (IOException e) { - e.printStackTrace(); - } - return objDest; - } + Object objDest = null; + try { + ByteArrayOutputStream bos = new ByteArrayOutputStream(); + ObjectOutputStream oos = new ObjectOutputStream(bos); + oos.writeObject(objSource); + oos.flush(); + oos.close(); + bos.close(); + byte[] byteData = bos.toByteArray(); + ByteArrayInputStream bais = new ByteArrayInputStream(byteData); + try { + objDest = (new ObjectInputStream(bais)).readObject(); + } catch (ClassNotFoundException e) { + e.printStackTrace(); + } + } catch (IOException e) { + e.printStackTrace(); + } + return objDest; + } + public static void asdasda345435ertretr(Node node, double yScale, double xScale, double contrast, double hue, double brightness, double saturation) { + ImageView iv = (ImageView) node; + + iv.setScaleY(yScale); + iv.setScaleX(xScale); + ColorAdjust colorAdjust = new ColorAdjust(); + colorAdjust.setContrast(contrast); + colorAdjust.setHue(hue); + colorAdjust.setBrightness(brightness); + colorAdjust.setSaturation(saturation); + iv.setEffect(colorAdjust); + } + public static void buttonMouseExited(Node node) { + ImageView iv = (ImageView) node; - - public static void asdasda345435ertretr(Node node, double yScale, double xScale, double contrast, double hue, double brightness, double saturation) { - ImageView iv = (ImageView)node; - - iv.setScaleY(yScale); - iv.setScaleX(xScale); - ColorAdjust colorAdjust = new ColorAdjust(); - colorAdjust.setContrast(contrast); - colorAdjust.setHue(hue); - colorAdjust.setBrightness(brightness); - colorAdjust.setSaturation(saturation); - iv.setEffect(colorAdjust); - } - - - - - - - public static void buttonMouseExited(Node node) { - ImageView iv = (ImageView)node; - - iv.setScaleX(1.0D); - iv.setScaleY(1.0D); - iv.setEffect(null); - } + iv.setScaleX(1.0D); + iv.setScaleY(1.0D); + iv.setEffect(null); + } public static void fdssdf4354(Node node, Color color) { - DropShadow borderGlow = new DropShadow(); - borderGlow.setOffsetY(0.0D); - borderGlow.setOffsetX(0.0D); - borderGlow.setColor(color); - borderGlow.setWidth(10.0D); - borderGlow.setHeight(10.0D); - node.setEffect(borderGlow); - } - - - - - - - - public static String replaceSpecialChars(String text) { - text = text.replaceAll("ä", "ae"); - text = text.replaceAll("ö", "oe"); - text = text.replaceAll("ü", "ue"); - text = text.replaceAll("ß", "ss"); - text = text.replaceAll("[^\\w\\_]", ""); - return text; - } - - - - - - - - - - - public static String getRandomInteger(int valuesVon, int valuesBis) { - int randomValue = valuesVon + (new Random()).nextInt(valuesBis - valuesVon) + 1; - return String.valueOf(randomValue); - } - - - - - - - public static String getRandomBoolean() { - boolean randomValue = (new Random()).nextBoolean(); - String booleanAsString; - booleanAsString = "0"; - if (randomValue) booleanAsString = "1"; - return booleanAsString; - } - - - - - - - - - - - - - - - - public static String getRandomDecimal(int digitsBeforeComma, int digitsAfterComma) { - StringBuilder digitsAfterCommaAsString = new StringBuilder(); - - StringBuilder digitsBeforeCommaAsString = new StringBuilder(); - int i; - for (i = 0; i < digitsAfterComma; i++) { - digitsAfterCommaAsString.append("9"); + DropShadow borderGlow = new DropShadow(); + borderGlow.setOffsetY(0.0D); + borderGlow.setOffsetX(0.0D); + borderGlow.setColor(color); + borderGlow.setWidth(10.0D); + borderGlow.setHeight(10.0D); + node.setEffect(borderGlow); } - int digitsAfterCommaRange = Integer.parseInt((digitsAfterCommaAsString.length() == 0) ? "0" : digitsAfterCommaAsString.toString()); - for (i = 0; i < digitsBeforeComma; i++) { - digitsBeforeCommaAsString.append("9"); + + + public static String replaceSpecialChars(String text) { + text = text.replaceAll("ä", "ae"); + text = text.replaceAll("ö", "oe"); + text = text.replaceAll("ü", "ue"); + text = text.replaceAll("ß", "ss"); + text = text.replaceAll("[^\\w\\_]", ""); + return text; } - int digitsBeforeCommaRange = Integer.parseInt(digitsBeforeCommaAsString.toString()); - - return (new Random()).nextInt(digitsBeforeCommaRange + 1) + "." + (new Random()).nextInt(digitsAfterCommaRange + 1); - } - - - - - - - - public static String getRandomTextGivenLength(int textLength) { - String str = "abcdefghijklmnopqrstuvwxyz"; - StringBuilder randomText = new StringBuilder(); - ArrayList charactersAsList = new ArrayList<>(); - for (int j = 0; j < textLength; j++) { - charactersAsList.add(str.charAt((new Random()).nextInt(26))); + public static String getRandomInteger(int valuesVon, int valuesBis) { + int randomValue = valuesVon + (new Random()).nextInt(valuesBis - valuesVon) + 1; + return String.valueOf(randomValue); } - for (int k = 0; k < charactersAsList.size(); ) { randomText.append(charactersAsList.get(k)); k++; } - return randomText.toString(); - } - - - - - - - - - public static String getRandomDate(LocalDate from, LocalDate till) { - Random random = new Random(); - int minDay = (int)LocalDate.of(from.getYear(), from.getMonth(), from.getDayOfMonth()).toEpochDay(); - int maxDay = (int)LocalDate.of(till.getYear(), till.getMonth(), till.getDayOfMonth()).toEpochDay(); - long randomDay = (minDay + random.nextInt(maxDay - minDay)); - LocalDate randomDate = LocalDate.ofEpochDay(randomDay); - String datesAsString; - - datesAsString = randomDate.getYear() + "-" + randomDate.getMonthValue() + "-" + randomDate.getDayOfMonth(); - return datesAsString; - } - - - - - - - - public static void readRandomData(String which, String keyExtern) { - ArrayList randomDataAsList; - try { - BufferedReader fr; - - if (which.equals("Extern")) { fr = C2.randomDataFilesExtern.get(keyExtern); } - else { fr = new BufferedReader(new InputStreamReader(C2.randomDataFiles.get(which))); } - randomDataAsList = new ArrayList<>(); - String next = fr.readLine(); - while (next != null) { - randomDataAsList.add(next); - next = fr.readLine(); - } - fr.close(); - if (which.equals("Extern")) { randomData.put(keyExtern, randomDataAsList); } - else { randomData.put(which, randomDataAsList); } - } catch (IOException e) { - - e.printStackTrace(); - } - } - - - - - - - - - public static String getRandomData(String which, String keyExtern) { - ArrayList randomDataAsList; - if (which.equals("Extern")) { randomDataAsList = randomData.get(keyExtern); } - else { randomDataAsList = randomData.get(which); } - - if (randomDataAsList == null) { - readRandomData(which, keyExtern); + public static String getRandomBoolean() { + boolean randomValue = (new Random()).nextBoolean(); + String booleanAsString; + booleanAsString = "0"; + if (randomValue) booleanAsString = "1"; + return booleanAsString; + } + + + public static String getRandomDecimal(int digitsBeforeComma, int digitsAfterComma) { + StringBuilder digitsAfterCommaAsString = new StringBuilder(); + + StringBuilder digitsBeforeCommaAsString = new StringBuilder(); + int i; + for (i = 0; i < digitsAfterComma; i++) { + digitsAfterCommaAsString.append("9"); + } + int digitsAfterCommaRange = Integer.parseInt((digitsAfterCommaAsString.length() == 0) ? "0" : digitsAfterCommaAsString.toString()); + for (i = 0; i < digitsBeforeComma; i++) { + digitsBeforeCommaAsString.append("9"); + } + int digitsBeforeCommaRange = Integer.parseInt(digitsBeforeCommaAsString.toString()); + + return (new Random()).nextInt(digitsBeforeCommaRange + 1) + "." + (new Random()).nextInt(digitsAfterCommaRange + 1); + } + + + public static String getRandomTextGivenLength(int textLength) { + String str = "abcdefghijklmnopqrstuvwxyz"; + StringBuilder randomText = new StringBuilder(); + ArrayList charactersAsList = new ArrayList<>(); + for (int j = 0; j < textLength; j++) { + charactersAsList.add(str.charAt((new Random()).nextInt(26))); + } + for (int k = 0; k < charactersAsList.size(); ) { + randomText.append(charactersAsList.get(k)); + k++; + } + return randomText.toString(); + } + + + public static String getRandomDate(LocalDate from, LocalDate till) { + Random random = new Random(); + int minDay = (int) LocalDate.of(from.getYear(), from.getMonth(), from.getDayOfMonth()).toEpochDay(); + int maxDay = (int) LocalDate.of(till.getYear(), till.getMonth(), till.getDayOfMonth()).toEpochDay(); + long randomDay = (minDay + random.nextInt(maxDay - minDay)); + LocalDate randomDate = LocalDate.ofEpochDay(randomDay); + String datesAsString; + + datesAsString = randomDate.getYear() + "-" + randomDate.getMonthValue() + "-" + randomDate.getDayOfMonth(); + return datesAsString; + } + + + public static void readRandomData(String which, String keyExtern) { + ArrayList randomDataAsList; + try { + BufferedReader fr; + + if (which.equals("Extern")) { + fr = C2.randomDataFilesExtern.get(keyExtern); + } else { + fr = new BufferedReader(new InputStreamReader(C2.randomDataFiles.get(which))); + } + randomDataAsList = new ArrayList<>(); + String next = fr.readLine(); + while (next != null) { + randomDataAsList.add(next); + next = fr.readLine(); + } + fr.close(); + if (which.equals("Extern")) { + randomData.put(keyExtern, randomDataAsList); + } else { + randomData.put(which, randomDataAsList); + } + } catch (IOException e) { + + e.printStackTrace(); + } + } + + + public static String getRandomData(String which, String keyExtern) { + ArrayList randomDataAsList; + if (which.equals("Extern")) { + randomDataAsList = randomData.get(keyExtern); + } else { + randomDataAsList = randomData.get(which); + } + + if (randomDataAsList == null) { + readRandomData(which, keyExtern); + } + + if (which.equals("Extern")) { + randomDataAsList = randomData.get(keyExtern); + } else { + randomDataAsList = randomData.get(which); + } + + return randomDataAsList.get((new Random()).nextInt(randomDataAsList.size())); } - - if (which.equals("Extern")) { randomDataAsList = randomData.get(keyExtern); } - else { randomDataAsList = randomData.get(which); } - - return randomDataAsList.get((new Random()).nextInt(randomDataAsList.size())); - } } diff --git a/at/fos/ermodel/gui/U1.java b/at/fos/ermodel/gui/U1.java index 4de608c..93974b8 100644 --- a/at/fos/ermodel/gui/U1.java +++ b/at/fos/ermodel/gui/U1.java @@ -1,87 +1,68 @@ - package at.fos.ermodel.gui; +package at.fos.ermodel.gui; - import javafx.scene.control.Alert; - import javafx.scene.control.ButtonType; - import javafx.scene.control.ScrollPane; - import javafx.scene.control.Tab; - import javafx.scene.input.KeyEvent; - import javafx.scene.layout.StackPane; +import javafx.scene.control.Alert; +import javafx.scene.control.ButtonType; +import javafx.scene.control.ScrollPane; +import javafx.scene.control.Tab; +import javafx.scene.input.KeyEvent; +import javafx.scene.layout.StackPane; - import java.io.File; - import java.util.Optional; +import java.io.File; +import java.util.Optional; - - - - - - - - - - - - - - - - - - public class U1 - extends Tab - { - public final A3 canvas; - public final StackPane stackpane; - public final ScrollPane scrollpane; - - public U1(B3 view, String name, File modelInFile) { - this.stackpane = new StackPane(); - this.stackpane.setBackground(C2.AppBackground); - this.canvas = new A3(view, modelInFile, this); - - this.stackpane.getChildren().add(this.canvas); - - this.scrollpane = new ScrollPane(this.stackpane); - this.stackpane.setFocusTraversable(true); - this.scrollpane.setFocusTraversable(true); - - this.scrollpane.setVmin(0.0D); - this.scrollpane.setVmax(this.canvas.getCanvasHeight()); - this.scrollpane.setHmin(0.0D); - this.scrollpane.setHmax(this.canvas.getCanvasWidth()); - - this.stackpane.addEventFilter(KeyEvent.ANY, e -> this.scrollpane.requestFocus()); - this.scrollpane.addEventFilter(KeyEvent.ANY, e -> this.scrollpane.requestFocus()); - - setOnCloseRequest(e -> { - if (getTabPane().getTabs().size() <= 1) { - e.consume(); - return; - } - C1 alert = new C1(null, Alert.AlertType.CONFIRMATION, "Close Tab", "", "Do you really want to close", Boolean.TRUE, C2.applicationImageIconAsICO, "OK", "Cancel", C2.ButtonBackgroundColor, C2.MouseSelectedColor, C2.FocusOnComponentColor); - Optional result = alert.getResult(); - if (result.isPresent() && result.get() == ButtonType.OK) { - view.selectModeBTN.setSelected(true); - } else { - e.consume(); - } - }); - - - - - this.scrollpane.setOnKeyPressed(U1.this.canvas::sdfdsfd567657rrt); - this.stackpane.setOnKeyPressed(U1.this.canvas::sdfdsfd567657rrt); - - this.canvas.setOnKeyPressed(U1.this.canvas::sdfdsfd567657rrt); - - setContent(this.scrollpane); - if (modelInFile == null) { - setText(name); - } else { - - setText(modelInFile.getName()); - } - this.canvas.requestFocus(); - } - } \ No newline at end of file + +public class U1 + extends Tab { + public final A3 canvas; + public final StackPane stackpane; + public final ScrollPane scrollpane; + + public U1(B3 view, String name, File modelInFile) { + this.stackpane = new StackPane(); + this.stackpane.setBackground(C2.AppBackground); + this.canvas = new A3(view, modelInFile, this); + + this.stackpane.getChildren().add(this.canvas); + + this.scrollpane = new ScrollPane(this.stackpane); + this.stackpane.setFocusTraversable(true); + this.scrollpane.setFocusTraversable(true); + + this.scrollpane.setVmin(0.0D); + this.scrollpane.setVmax(this.canvas.getCanvasHeight()); + this.scrollpane.setHmin(0.0D); + this.scrollpane.setHmax(this.canvas.getCanvasWidth()); + + this.stackpane.addEventFilter(KeyEvent.ANY, e -> this.scrollpane.requestFocus()); + this.scrollpane.addEventFilter(KeyEvent.ANY, e -> this.scrollpane.requestFocus()); + + setOnCloseRequest(e -> { + if (getTabPane().getTabs().size() <= 1) { + e.consume(); + return; + } + C1 alert = new C1(null, Alert.AlertType.CONFIRMATION, "Close Tab", "", "Do you really want to close", Boolean.TRUE, C2.applicationImageIconAsICO, "OK", "Cancel", C2.ButtonBackgroundColor, C2.MouseSelectedColor, C2.FocusOnComponentColor); + Optional result = alert.getResult(); + if (result.isPresent() && result.get() == ButtonType.OK) { + view.selectModeBTN.setSelected(true); + } else { + e.consume(); + } + }); + + + this.scrollpane.setOnKeyPressed(U1.this.canvas::sdfdsfd567657rrt); + this.stackpane.setOnKeyPressed(U1.this.canvas::sdfdsfd567657rrt); + + this.canvas.setOnKeyPressed(U1.this.canvas::sdfdsfd567657rrt); + + setContent(this.scrollpane); + if (modelInFile == null) { + setText(name); + } else { + + setText(modelInFile.getName()); + } + this.canvas.requestFocus(); + } +} \ No newline at end of file diff --git a/at/fos/ermodel/gui/U2.java b/at/fos/ermodel/gui/U2.java index 9c901af..9d093b2 100644 --- a/at/fos/ermodel/gui/U2.java +++ b/at/fos/ermodel/gui/U2.java @@ -1,69 +1,69 @@ package at.fos.ermodel.gui; public interface U2 { - boolean getCreateColumn(); - - void setCreateColumn(boolean paramBoolean); - - String getColumnPostfix(); - - void setColumnPostfix(String paramString); - - String getColumnName(); - - void setColumnName(String paramString); - - String getMVRelationName(); - - void setMVRelationName(String paramString); - - String getMVRelationNamePraefix(); - - void setMVRelationNamePraefix(String paramString); - - String getDatatype(); - - void setDatatype(String paramString); - - boolean isKey(); - - void setIsKey(boolean paramBoolean); - - boolean isAutoincrement(); - - void setIsAutoincrement(boolean paramBoolean); - - long getAutoincrementStartAt(); - - void setAutoincrementStartAt(long paramLong); - - boolean isUnique(); - - void setIsUnique(boolean paramBoolean); - - boolean isNullable(); - - void setIsNullable(boolean paramBoolean); - - String getDataGenerationType(); - - void setDataGenerationType(String paramString); - - String getPar1(); - - void setPar1(String paramString); - - String getPar2(); - - void setPar2(String paramString); - - String getPar1_label(); - - void setPar1_label(String paramString); - - String getPar2_label(); - - void setPar2_label(String paramString); + boolean getCreateColumn(); + + void setCreateColumn(boolean paramBoolean); + + String getColumnPostfix(); + + void setColumnPostfix(String paramString); + + String getColumnName(); + + void setColumnName(String paramString); + + String getMVRelationName(); + + void setMVRelationName(String paramString); + + String getMVRelationNamePraefix(); + + void setMVRelationNamePraefix(String paramString); + + String getDatatype(); + + void setDatatype(String paramString); + + boolean isKey(); + + void setIsKey(boolean paramBoolean); + + boolean isAutoincrement(); + + void setIsAutoincrement(boolean paramBoolean); + + long getAutoincrementStartAt(); + + void setAutoincrementStartAt(long paramLong); + + boolean isUnique(); + + void setIsUnique(boolean paramBoolean); + + boolean isNullable(); + + void setIsNullable(boolean paramBoolean); + + String getDataGenerationType(); + + void setDataGenerationType(String paramString); + + String getPar1(); + + void setPar1(String paramString); + + String getPar2(); + + void setPar2(String paramString); + + String getPar1_label(); + + void setPar1_label(String paramString); + + String getPar2_label(); + + void setPar2_label(String paramString); } diff --git a/at/fos/ermodel/gui/U3.java b/at/fos/ermodel/gui/U3.java index a5cc32c..45b496b 100644 --- a/at/fos/ermodel/gui/U3.java +++ b/at/fos/ermodel/gui/U3.java @@ -1,25 +1,25 @@ package at.fos.ermodel.gui; public interface U3 { - boolean getCreateRelation(); - - void setCreateRelation(boolean paramBoolean); - - String getRelationPraefix(); - - void setRelationPraefix(String paramString); - - String getRelationName(); - - void setRelationName(String paramString); - - boolean getCreateInserts(); - - void setCreateInserts(boolean paramBoolean); - - long getNumberRowsToInsert(); - - void setNumberRowsToInsert(long paramLong); + boolean getCreateRelation(); + + void setCreateRelation(boolean paramBoolean); + + String getRelationPraefix(); + + void setRelationPraefix(String paramString); + + String getRelationName(); + + void setRelationName(String paramString); + + boolean getCreateInserts(); + + void setCreateInserts(boolean paramBoolean); + + long getNumberRowsToInsert(); + + void setNumberRowsToInsert(long paramLong); } diff --git a/at/fos/ermodel/gui/U4.java b/at/fos/ermodel/gui/U4.java index 9708615..c2abb45 100644 --- a/at/fos/ermodel/gui/U4.java +++ b/at/fos/ermodel/gui/U4.java @@ -1,8 +1,7 @@ package at.fos.ermodel.gui; -public enum U4 -{ - ADD, REMOVE +public enum U4 { + ADD, REMOVE } diff --git a/at/fos/ermodel/gui/V1.java b/at/fos/ermodel/gui/V1.java index 6148b6f..e1f8f41 100644 --- a/at/fos/ermodel/gui/V1.java +++ b/at/fos/ermodel/gui/V1.java @@ -12,98 +12,57 @@ import javafx.scene.layout.VBox; import javafx.stage.Stage; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - public class V1 - extends Stage -{ - public static V1 thisActionMessageDialog; + extends Stage { + public static V1 thisActionMessageDialog; private final Label showFilename; - private Thread th; - - public V1(B3 siteCommanderFrame) { - thisActionMessageDialog = this; - setTitle("Generate/Save SQL-Script"); + private Thread th; + + public V1(B3 siteCommanderFrame) { + thisActionMessageDialog = this; + setTitle("Generate/Save SQL-Script"); - - getIcons().add(C2.applicationImageIconAsICO); - ProgressBar progress = new ProgressBar(); - progress.setPrefWidth(200.0D); - progress.setProgress(-1.0D); - VBox root = new VBox(); - progress.setBackground(new Background(new BackgroundFill(C2.ButtonBackgroundColor, CornerRadii.EMPTY, Insets.EMPTY))); - this.showFilename = new Label(""); - this.showFilename.setAlignment(Pos.CENTER); - - Scene scene = new Scene(root, 200.0D, 40.0D); - root.getChildren().add(progress); - root.getChildren().add(this.showFilename); - setScene(scene); - - if (siteCommanderFrame != null) { - initOwner(siteCommanderFrame); + getIcons().add(C2.applicationImageIconAsICO); + ProgressBar progress = new ProgressBar(); + progress.setPrefWidth(200.0D); + progress.setProgress(-1.0D); + VBox root = new VBox(); + progress.setBackground(new Background(new BackgroundFill(C2.ButtonBackgroundColor, CornerRadii.EMPTY, Insets.EMPTY))); + this.showFilename = new Label(""); + this.showFilename.setAlignment(Pos.CENTER); + + Scene scene = new Scene(root, 200.0D, 40.0D); + root.getChildren().add(progress); + root.getChildren().add(this.showFilename); + setScene(scene); + + if (siteCommanderFrame != null) { + initOwner(siteCommanderFrame); + } + + + sizeToScene(); + setResizable(false); } - - - - - sizeToScene(); - setResizable(false); - } - - private void startTimer() { - this.th.setDaemon(true); - this.th.start(); - } + this.th.setDaemon(true); + this.th.start(); + } + public void setThread(Thread th) { + this.th = th; + startTimer(); + showAndWait(); + } - - public void setThread(Thread th) { - this.th = th; - startTimer(); - showAndWait(); - } - - - - - - public Label getShowFilename() { - return this.showFilename; - } + public Label getShowFilename() { + return this.showFilename; + } } diff --git a/at/fos/ermodel/gui/ZZ20.java b/at/fos/ermodel/gui/ZZ20.java index 7181f73..def637b 100644 --- a/at/fos/ermodel/gui/ZZ20.java +++ b/at/fos/ermodel/gui/ZZ20.java @@ -2,10 +2,9 @@ package at.fos.ermodel.gui; public class ZZ20 - extends Exception -{ - public ZZ20(String arg0) { - super(arg0); - } + extends Exception { + public ZZ20(String arg0) { + super(arg0); + } } diff --git a/at/fos/ermodel/gui/ZZ30.java b/at/fos/ermodel/gui/ZZ30.java index 7a3f10a..c84cd60 100644 --- a/at/fos/ermodel/gui/ZZ30.java +++ b/at/fos/ermodel/gui/ZZ30.java @@ -1,1521 +1,1164 @@ package at.fos.ermodel.gui; +import javafx.scene.control.Tab; + import java.io.FileInputStream; import java.io.IOException; import java.io.ObjectInputStream; import java.util.ArrayList; -import javafx.scene.control.Tab; -public class ZZ30 -{ - private final B3 view; - private ArrayList graphicElements; - private C4 relationalModel; +public class ZZ30 { + private final B3 view; + private ArrayList graphicElements; + private C4 relationalModel; private Graphic_ES_Elem topES; - - public ZZ30(B3 view, ArrayList graphicElements, C4 relationalModel) { - this(view); - this.graphicElements.addAll(graphicElements); - this.relationalModel = relationalModel; - } + + public ZZ30(B3 view, ArrayList graphicElements, C4 relationalModel) { + this(view); + this.graphicElements.addAll(graphicElements); + this.relationalModel = relationalModel; + } - - - - - - public ZZ30(B3 view) { - this.view = view; - this.graphicElements = new ArrayList<>(); - } + public ZZ30(B3 view) { + this.view = view; + this.graphicElements = new ArrayList<>(); + } public boolean lkshjdskjhsdlkjhds() { - this.relationalModel.setTables(new ArrayList<>()); + this.relationalModel.setTables(new ArrayList<>()); - ArrayList esTraversed = new ArrayList<>(); + ArrayList esTraversed = new ArrayList<>(); + for (Graphic_Main_Elem gme : this.graphicElements) { + T1 table = null; + String relationName; - - for (Graphic_Main_Elem gme : this.graphicElements) { - - T1 table = null; - String relationName; + Graphic_ES_Main_Elem entitySet = null; + if (gme instanceof Graphic_ES_Main_Elem) { + entitySet = (Graphic_ES_Main_Elem) gme; - - Graphic_ES_Main_Elem entitySet = null; - if (gme instanceof Graphic_ES_Main_Elem) { - entitySet = (Graphic_ES_Main_Elem)gme; - - if (entitySet.getCreateRelation()) { - relationName = entitySet.getRelationName(); - if (entitySet.getRelationPraefix().length() > 0) relationName = entitySet.getRelationPraefix() + entitySet.getRelationName(); - table = new T1(relationName, entitySet.getRelationPraefix(), gme.sdfsdfsdfd(), - entitySet.getCreateInserts(), entitySet.getNumberRowsToInsert()); - - ArrayList keyAttributes = getKeyAttributes(gme); - if (keyAttributes.size() > 1) { + if (entitySet.getCreateRelation()) { + relationName = entitySet.getRelationName(); + if (entitySet.getRelationPraefix().length() > 0) + relationName = entitySet.getRelationPraefix() + entitySet.getRelationName(); + table = new T1(relationName, entitySet.getRelationPraefix(), gme.sdfsdfsdfd(), + entitySet.getCreateInserts(), entitySet.getNumberRowsToInsert()); + ArrayList keyAttributes = getKeyAttributes(gme); + if (keyAttributes.size() > 1) { + this.view.verticalBox.getChildren().clear(); + this.view.generateRelationalModelCB.setSelected(false); + return false; + } + ArrayList weakkeyAttributes = getWeakKeyAttributes(gme); + if (!(gme instanceof Graphic_ES_Weak_Elem) && !(gme instanceof Graphic_ES_Assoc_Elem) && weakkeyAttributes.size() == 1) { + this.view.verticalBox.getChildren().clear(); + this.view.generateRelationalModelCB.setSelected(false); + return false; + } + if (weakkeyAttributes.size() > 0 && keyAttributes.size() > 0) { + this.view.verticalBox.getChildren().clear(); + this.view.generateRelationalModelCB.setSelected(false); + return false; + } - - - this.view.verticalBox.getChildren().clear(); - this.view.generateRelationalModelCB.setSelected(false); - return false; - } - ArrayList weakkeyAttributes = getWeakKeyAttributes(gme); - - if (!(gme instanceof Graphic_ES_Weak_Elem) && !(gme instanceof Graphic_ES_Assoc_Elem) && weakkeyAttributes.size() == 1) { - - - - - - - - - - - - - - this.view.verticalBox.getChildren().clear(); - this.view.generateRelationalModelCB.setSelected(false); - return false; - } - - if (weakkeyAttributes.size() > 0 && keyAttributes.size() > 0) { - - - - - - - - - - - - - this.view.verticalBox.getChildren().clear(); - this.view.generateRelationalModelCB.setSelected(false); - return false; - } - - - ArrayList attributes = getAttributes(gme); - addColumnsToTable(table, attributes); - } - } - if (table != null) { - boolean tableAdded = false; - while (!tableAdded) { - if (this.relationalModel.addTable(table)) { - entitySet.setRelationName(entitySet.getRelationName() + "_1"); - relationName = entitySet.getRelationPraefix() + entitySet.getRelationName(); - table.setTablename(relationName); continue; - } - tableAdded = true; - } - } - } - - - - - - - - ArrayList topESets = new ArrayList<>(); - for (Graphic_Main_Elem gme : this.graphicElements) { - - - - - - if (gme instanceof Graphic_RS_ISA_Elem grsisae) { - - - this.topES = null; - try { - this.topES = getTopES(grsisae); - if (!esTraversed.contains(this.topES.sdfsdfsdfd())) { - - esTraversed.add(this.topES.sdfsdfsdfd()); - - topESets.add(this.topES); - } - } catch (StackOverflowError ignored) {} - } - } - - - - for (Graphic_ES_Elem gme : topESets) - { - traverseThroughISA(gme); - } - - - - - - for (Graphic_Main_Elem gme : this.graphicElements) { - T1 table = null; - String relationName; - - - Graphic_RS_Main_Elem relationshipType = null; - if (gme instanceof Graphic_RS_Main_Elem) { - relationshipType = (Graphic_RS_Main_Elem)gme; - - if (relationshipType.getCreateRelation()) { - relationName = relationshipType.getRelationName(); - if (relationshipType.getRelationPraefix().length() > 0) relationName = relationshipType.getRelationPraefix() + relationshipType.getRelationName(); - table = new T1(relationName, relationshipType.getRelationPraefix(), gme.sdfsdfsdfd(), - relationshipType.getCreateInserts(), relationshipType.getNumberRowsToInsert()); - ArrayList attributes = getAttributes(gme); - addColumnsToTable(table, attributes); - } - } - if (table != null) { - boolean tableAdded = false; - while (!tableAdded) { - if (this.relationalModel.addTable(table)) { - - - - - - - - - - - - - - relationshipType.setRelationName(relationshipType.getRelationName() + "_1"); - relationName = relationshipType.getRelationPraefix() + relationshipType.getRelationName(); - table.setTablename(relationName); continue; - } - tableAdded = true; - } - } - } - - - - - - - for (Graphic_Main_Elem gme : this.graphicElements) { - T1 table = null; - String relationName; - - - - Graphic_ATTR_Multi_Elem mvAttribute = null; - if (gme instanceof Graphic_ATTR_Multi_Elem) { - mvAttribute = (Graphic_ATTR_Multi_Elem)gme; - relationName = mvAttribute.getMVRelationName(); - if (mvAttribute.getMVRelationNamePraefix().length() > 0) relationName = mvAttribute.getMVRelationNamePraefix() + mvAttribute.getMVRelationName(); - - table = new T1(relationName, mvAttribute.getMVRelationNamePraefix(), gme.sdfsdfsdfd(), false, 0L); - C3 column = new C3(mvAttribute.getMVRelationNamePraefix() + mvAttribute.getColumnName() + (( - mvAttribute.getColumnPostfix() != null && mvAttribute.getColumnPostfix().length() > 0) ? mvAttribute.getColumnPostfix() : ""), - mvAttribute.getDatatype(), - true, - false, - false, - false, - mvAttribute.getAutoincrementStartAt(), - null, - table.getReferstoGraphicalElement(), - null, null, null); - table.addColumn(column); - - Graphic_ES_Main_Elem gesme = getESGivenNumber(gme.sdfsdfsdfd()); - - T1 tableForgemse = this.relationalModel.getTableGivenNumber(gesme.sdfsdfsdfd()); - ArrayList keyColumns = this.relationalModel.getKeyColumnsGivenRelation(gesme.sdfsdfsdfd()); - for (C3 refcolumn : keyColumns) { - column = new C3(mvAttribute.getMVRelationNamePraefix() + refcolumn.getColumnName(), - refcolumn.getDatatype(), false, false, false, false, - refcolumn.getAutoincrementStartAt(), - new T2(tableForgemse.getTablename(), refcolumn.getColumnName()), - gme.sdfsdfsdfd(), - null, null, null); - table.addColumn(column); - } - } - if (table != null) { - boolean tableAdded = false; - while (!tableAdded) { - if (this.relationalModel.addTable(table)) { - - - - - - - - - - - - - - mvAttribute.setMVRelationName(mvAttribute.getMVRelationName() + "_1"); - relationName = mvAttribute.getMVRelationNamePraefix() + mvAttribute.getMVRelationName(); - table.setTablename(relationName); continue; - } - tableAdded = true; - } - } - } - - - - - - for (Graphic_Main_Elem gme : this.graphicElements) { - if (gme instanceof Graphic_ES_Assoc_Elem grsem) { - - ArrayList gesme = getConnectedESToAssociativeESGivenElemNumber(grsem.sdfsdfsdfd()); - - - boolean partPrimary = true; - - ArrayList keys = getKeyAttributes(grsem); - if (keys.size() > 0) partPrimary = false; - keys = getWeakKeyAttributes(grsem); - if (!partPrimary && keys.size() > 0) { - - - - - - - - - - - - - - this.view.verticalBox.getChildren().clear(); - this.view.generateRelationalModelCB.setSelected(false); - return false; - } - - - for (Graphic_ES_Main_Elem gesme_conn : gesme) { - T1 tableES = this.relationalModel.getTableGivenNumber(gesme_conn.sdfsdfsdfd()); - - - ArrayList keyColumns = this.relationalModel.getKeyColumnsGivenRelation(gesme_conn.sdfsdfsdfd()); - - T1 tableRS = this.relationalModel.getTableGivenNumber(grsem.sdfsdfsdfd()); - for (C3 refcolumn : keyColumns) { - - boolean colExists = tableRS.columnExist(tableRS.getTablenamePraefix() + refcolumn.getColumnName()); - C3 column = new C3(tableRS.getTablenamePraefix() + refcolumn.getColumnName() + (colExists ? "_1" : ""), - refcolumn.getDatatype(), - partPrimary, - false, - false, - false, - refcolumn.getAutoincrementStartAt(), - new T2(tableES.getTablename(), refcolumn.getColumnName()), - tableRS.getReferstoGraphicalElement(), - - null, - null, - null); - - tableRS.addColumn(column); - } - } - } - } - - - - - - - ArrayList doneWeakElements = new ArrayList<>(); - for (Graphic_Main_Elem gme : this.graphicElements) { - - if (gme instanceof Graphic_RS_Main_Elem grsem) { - - - if (grsem instanceof Graphic_RS_Identifying_Elem grsie) { - - ArrayList connectedES = getConnectedESToRelationshipGivenElemNumber(grsie.sdfsdfsdfd()); - - if (connectedES.size() != 2) { - - - - - - - - - - - - - this.view.verticalBox.getChildren().clear(); - this.view.generateRelationalModelCB.setSelected(false); - return false; - } - - Graphic_ES_Main_Elem gw_es = null; - Graphic_ES_Main_Elem ges = null; - - - if (connectedES.get(0) instanceof Graphic_ES_Weak_Elem && connectedES.get(1) instanceof Graphic_ES_Weak_Elem) { - continue; - } - - if (connectedES.get(0) instanceof Graphic_ES_Weak_Elem && - connectedES.get(1) instanceof Graphic_ES_Elem) { - gw_es = connectedES.get(0); - ges = connectedES.get(1); - } - if (connectedES.get(1) instanceof Graphic_ES_Weak_Elem && - connectedES.get(0) instanceof Graphic_ES_Elem) { - gw_es = connectedES.get(1); - ges = connectedES.get(0); - } - - if (connectedES.get(0) instanceof Graphic_ES_Weak_Elem && - connectedES.get(1) instanceof Graphic_ES_Assoc_Elem) { - gw_es = connectedES.get(0); - ges = connectedES.get(1); - } - if (connectedES.get(1) instanceof Graphic_ES_Weak_Elem && - connectedES.get(0) instanceof Graphic_ES_Assoc_Elem) { - gw_es = connectedES.get(1); - ges = connectedES.get(0); - } - - - doneWeakElements.add(gw_es); - - - - boolean partPrimary = true; - - ArrayList keys = getKeyAttributes(gw_es); - if (keys.size() > 0) partPrimary = false; - keys = getWeakKeyAttributes(gw_es); - if (!partPrimary && keys.size() > 0) { - - - - - - - - - - - - - this.view.verticalBox.getChildren().clear(); - this.view.generateRelationalModelCB.setSelected(false); - return false; - } - - - assert ges != null; - T1 tableForges = this.relationalModel.getTableGivenNumber(ges.sdfsdfsdfd()); - ArrayList keyColumns = this.relationalModel.getKeyColumnsGivenRelation(ges.sdfsdfsdfd()); - T1 tableForgwes = this.relationalModel.getTableGivenNumber(gw_es.sdfsdfsdfd()); - for (C3 refcolumn : keyColumns) { - C3 column = new C3(tableForgwes.getTablenamePraefix() + refcolumn.getColumnName(), - refcolumn.getDatatype(), - partPrimary, - !partPrimary, - false, - false, - refcolumn.getAutoincrementStartAt(), - new T2(tableForges.getTablename(), refcolumn.getColumnName()), - tableForgwes.getReferstoGraphicalElement(), - - null, - null, - null); - tableForgwes.addColumn(column); - } - } - } - } - - - - - - - int countNotTransformedWeakES = 0; - for (Graphic_Main_Elem gme : this.graphicElements) { - - if (gme instanceof Graphic_RS_Main_Elem grsem) { - - - if (grsem instanceof Graphic_RS_Identifying_Elem grsie) { - - ArrayList connectedES = getConnectedESToRelationshipGivenElemNumber(grsie.sdfsdfsdfd()); - - if (connectedES.size() != 2) { - - - - - - - - - - - - - this.view.verticalBox.getChildren().clear(); - this.view.generateRelationalModelCB.setSelected(false); - return false; - } - - - if (connectedES.get(0) instanceof Graphic_ES_Weak_Elem && connectedES.get(1) instanceof Graphic_ES_Weak_Elem) { - countNotTransformedWeakES++; - } - } - } - } - while (countNotTransformedWeakES > 0) { - for (Graphic_Main_Elem gme : this.graphicElements) { - - if (gme instanceof Graphic_RS_Main_Elem grsem) { - - - if (grsem instanceof Graphic_RS_Identifying_Elem grsie) { - - ArrayList connectedES = getConnectedESToRelationshipGivenElemNumber(grsie.sdfsdfsdfd()); - - if (connectedES.size() != 2) { - - - - - - - - - - - - - this.view.verticalBox.getChildren().clear(); - this.view.generateRelationalModelCB.setSelected(false); - return false; - } - - Graphic_ES_Weak_Elem gw_es = null; - Graphic_ES_Weak_Elem ges = null; - - - if (connectedES.get(0) instanceof Graphic_ES_Weak_Elem && connectedES.get(1) instanceof Graphic_ES_Weak_Elem) { - if (doneWeakElements.contains(connectedES.get(0))) { - ges = (Graphic_ES_Weak_Elem)connectedES.get(0); - gw_es = (Graphic_ES_Weak_Elem)connectedES.get(1); - } - else if (doneWeakElements.contains(connectedES.get(1))) { - gw_es = (Graphic_ES_Weak_Elem)connectedES.get(0); - ges = (Graphic_ES_Weak_Elem)connectedES.get(1); - } - - - - countNotTransformedWeakES--; - - doneWeakElements.add(gw_es); - - boolean partPrimary = true; - - ArrayList keys = getKeyAttributes(gw_es); - if (keys.size() > 0) partPrimary = false; - keys = getWeakKeyAttributes(gw_es); - if (!partPrimary && keys.size() > 0) { - - - - - - - - - - - - - this.view.verticalBox.getChildren().clear(); - this.view.generateRelationalModelCB.setSelected(false); - return false; - } - - - assert ges != null; - T1 tableForges = this.relationalModel.getTableGivenNumber(ges.sdfsdfsdfd()); - ArrayList keyColumns = this.relationalModel.getKeyColumnsGivenRelation(ges.sdfsdfsdfd()); - T1 tableForgwes = this.relationalModel.getTableGivenNumber(gw_es.sdfsdfsdfd()); - for (C3 refcolumn : keyColumns) { - C3 column = new C3(tableForgwes.getTablenamePraefix() + refcolumn.getColumnName(), - refcolumn.getDatatype(), - partPrimary, - !partPrimary, - false, - false, - refcolumn.getAutoincrementStartAt(), - new T2(tableForges.getTablename(), refcolumn.getColumnName()), - tableForgwes.getReferstoGraphicalElement(), - - null, - null, - null); - tableForgwes.addColumn(column); - } - } - } - } - } - } - - - - - - - - - - - for (Graphic_Main_Elem gme : this.graphicElements) { - - if (gme instanceof Graphic_RS_Main_Elem grsem) { - - - if (grsem instanceof Graphic_RS_Elem) { - - ArrayList gesme = getConnectedESToRelationshipGivenElemNumber(grsem.sdfsdfsdfd()); - - - if (gesme.size() < 2) { - - - - - - - - - - - - - this.view.verticalBox.getChildren().clear(); - this.view.generateRelationalModelCB.setSelected(false); - return false; - } - - - if (gesme.size() == 2) { - - - String[] minMax0; - String[] minMax1; - - String max0; - String max1; - String min0; - String min1; - - - if (gesme.get(0).equals(gesme.get(1))) { - String[] minMaxRecursive = getMinMaxForGivenESRSIfRecursive(grsem.sdfsdfsdfd(), gesme.get(0).sdfsdfsdfd()); - min0 = minMaxRecursive[0]; - max0 = minMaxRecursive[1]; - min1 = minMaxRecursive[2]; - max1 = minMaxRecursive[3]; + ArrayList attributes = getAttributes(gme); + addColumnsToTable(table, attributes); + } } - else { - - minMax0 = getMinMaxForGivenESRS(grsem.sdfsdfsdfd(), gesme.get(0).sdfsdfsdfd()); - minMax1 = getMinMaxForGivenESRS(grsem.sdfsdfsdfd(), gesme.get(1).sdfsdfsdfd()); - max0 = minMax0[1]; - max1 = minMax1[1]; - min0 = minMax0[0]; - min1 = minMax1[0]; - } - - - boolean manyToMany = !max0.equals("1") && !max1.equals("1"); - boolean oneToMany = (max0.equals("1") && !max1.equals("1")) || ( - !max0.equals("1") && max1.equals("1")); - boolean oneToOne = max0.equals("1") && max1.equals("1"); + if (table != null) { + boolean tableAdded = false; + while (!tableAdded) { + if (this.relationalModel.addTable(table)) { + entitySet.setRelationName(entitySet.getRelationName() + "_1"); + relationName = entitySet.getRelationPraefix() + entitySet.getRelationName(); + table.setTablename(relationName); + continue; + } + tableAdded = true; + } + } + } - if (oneToOne) { - - boolean keyCorrect = true; - ArrayList keys = getKeyAttributes(grsem); - if (keys.size() > 0) keyCorrect = false; - if (keyCorrect) { + ArrayList topESets = new ArrayList<>(); + for (Graphic_Main_Elem gme : this.graphicElements) { + + + if (gme instanceof Graphic_RS_ISA_Elem grsisae) { + + + this.topES = null; + try { + this.topES = getTopES(grsisae); + if (!esTraversed.contains(this.topES.sdfsdfsdfd())) { + + esTraversed.add(this.topES.sdfsdfsdfd()); + + topESets.add(this.topES); + } + } catch (StackOverflowError ignored) { + } + } + } + + + for (Graphic_ES_Elem gme : topESets) { + traverseThroughISA(gme); + } + + + for (Graphic_Main_Elem gme : this.graphicElements) { + T1 table = null; + String relationName; + + + Graphic_RS_Main_Elem relationshipType = null; + if (gme instanceof Graphic_RS_Main_Elem) { + relationshipType = (Graphic_RS_Main_Elem) gme; + + if (relationshipType.getCreateRelation()) { + relationName = relationshipType.getRelationName(); + if (relationshipType.getRelationPraefix().length() > 0) + relationName = relationshipType.getRelationPraefix() + relationshipType.getRelationName(); + table = new T1(relationName, relationshipType.getRelationPraefix(), gme.sdfsdfsdfd(), + relationshipType.getCreateInserts(), relationshipType.getNumberRowsToInsert()); + ArrayList attributes = getAttributes(gme); + addColumnsToTable(table, attributes); + } + } + if (table != null) { + boolean tableAdded = false; + while (!tableAdded) { + if (this.relationalModel.addTable(table)) { + + + relationshipType.setRelationName(relationshipType.getRelationName() + "_1"); + relationName = relationshipType.getRelationPraefix() + relationshipType.getRelationName(); + table.setTablename(relationName); + continue; + } + tableAdded = true; + } + } + } + + + for (Graphic_Main_Elem gme : this.graphicElements) { + T1 table = null; + String relationName; + + + Graphic_ATTR_Multi_Elem mvAttribute = null; + if (gme instanceof Graphic_ATTR_Multi_Elem) { + mvAttribute = (Graphic_ATTR_Multi_Elem) gme; + relationName = mvAttribute.getMVRelationName(); + if (mvAttribute.getMVRelationNamePraefix().length() > 0) + relationName = mvAttribute.getMVRelationNamePraefix() + mvAttribute.getMVRelationName(); + + table = new T1(relationName, mvAttribute.getMVRelationNamePraefix(), gme.sdfsdfsdfd(), false, 0L); + C3 column = new C3(mvAttribute.getMVRelationNamePraefix() + mvAttribute.getColumnName() + (( + mvAttribute.getColumnPostfix() != null && mvAttribute.getColumnPostfix().length() > 0) ? mvAttribute.getColumnPostfix() : ""), + mvAttribute.getDatatype(), + true, + false, + false, + false, + mvAttribute.getAutoincrementStartAt(), + null, + table.getReferstoGraphicalElement(), + null, null, null); + table.addColumn(column); + + Graphic_ES_Main_Elem gesme = getESGivenNumber(gme.sdfsdfsdfd()); + + T1 tableForgemse = this.relationalModel.getTableGivenNumber(gesme.sdfsdfsdfd()); + ArrayList keyColumns = this.relationalModel.getKeyColumnsGivenRelation(gesme.sdfsdfsdfd()); + for (C3 refcolumn : keyColumns) { + column = new C3(mvAttribute.getMVRelationNamePraefix() + refcolumn.getColumnName(), + refcolumn.getDatatype(), false, false, false, false, + refcolumn.getAutoincrementStartAt(), + new T2(tableForgemse.getTablename(), refcolumn.getColumnName()), + gme.sdfsdfsdfd(), + null, null, null); + table.addColumn(column); + } + } + if (table != null) { + boolean tableAdded = false; + while (!tableAdded) { + if (this.relationalModel.addTable(table)) { + + + mvAttribute.setMVRelationName(mvAttribute.getMVRelationName() + "_1"); + relationName = mvAttribute.getMVRelationNamePraefix() + mvAttribute.getMVRelationName(); + table.setTablename(relationName); + continue; + } + tableAdded = true; + } + } + } + + + for (Graphic_Main_Elem gme : this.graphicElements) { + if (gme instanceof Graphic_ES_Assoc_Elem grsem) { + + ArrayList gesme = getConnectedESToAssociativeESGivenElemNumber(grsem.sdfsdfsdfd()); + + + boolean partPrimary = true; + + ArrayList keys = getKeyAttributes(grsem); + if (keys.size() > 0) partPrimary = false; keys = getWeakKeyAttributes(grsem); - if (keys.size() > 0) keyCorrect = false; - - } - if (!keyCorrect) { + if (!partPrimary && keys.size() > 0) { + this.view.verticalBox.getChildren().clear(); + this.view.generateRelationalModelCB.setSelected(false); + return false; + } + for (Graphic_ES_Main_Elem gesme_conn : gesme) { + T1 tableES = this.relationalModel.getTableGivenNumber(gesme_conn.sdfsdfsdfd()); + ArrayList keyColumns = this.relationalModel.getKeyColumnsGivenRelation(gesme_conn.sdfsdfsdfd()); + + T1 tableRS = this.relationalModel.getTableGivenNumber(grsem.sdfsdfsdfd()); + for (C3 refcolumn : keyColumns) { + + boolean colExists = tableRS.columnExist(tableRS.getTablenamePraefix() + refcolumn.getColumnName()); + C3 column = new C3(tableRS.getTablenamePraefix() + refcolumn.getColumnName() + (colExists ? "_1" : ""), + refcolumn.getDatatype(), + partPrimary, + false, + false, + false, + refcolumn.getAutoincrementStartAt(), + new T2(tableES.getTablename(), refcolumn.getColumnName()), + tableRS.getReferstoGraphicalElement(), + + null, + null, + null); + + tableRS.addColumn(column); + } + } + } + } + ArrayList doneWeakElements = new ArrayList<>(); + for (Graphic_Main_Elem gme : this.graphicElements) { + + if (gme instanceof Graphic_RS_Main_Elem grsem) { + if (grsem instanceof Graphic_RS_Identifying_Elem grsie) { - - this.view.verticalBox.getChildren().clear(); - this.view.generateRelationalModelCB.setSelected(false); - return false; - } + ArrayList connectedES = getConnectedESToRelationshipGivenElemNumber(grsie.sdfsdfsdfd()); + + if (connectedES.size() != 2) { - - Graphic_ES_Main_Elem es_min_1_side; - Graphic_ES_Main_Elem es_min_0_side; - boolean bothSides_min_1 = false; - if (min0.equals("1") && min1.equals("0")) { es_min_1_side = gesme.get(0); es_min_0_side = gesme.get(1); } - else if (min1.equals("1") && min0.equals("0")) { es_min_1_side = gesme.get(1); es_min_0_side = gesme.get(0); } - - else if (min1.equals("1") && min0.equals("1")) - { es_min_1_side = gesme.get(1); es_min_0_side = gesme.get(0); bothSides_min_1 = true; } - - else - - { es_min_1_side = gesme.get(0); es_min_0_side = gesme.get(1); } + this.view.verticalBox.getChildren().clear(); + this.view.generateRelationalModelCB.setSelected(false); + return false; + } + + Graphic_ES_Main_Elem gw_es = null; + Graphic_ES_Main_Elem ges = null; - - T1 tableRS = this.relationalModel.getTableGivenNumber(grsem.sdfsdfsdfd()); - - T1 tableES = this.relationalModel.getTableGivenNumber(es_min_0_side.sdfsdfsdfd()); - ArrayList keyColumns = this.relationalModel.getKeyColumnsGivenRelation(es_min_0_side.sdfsdfsdfd()); - T1 table_1_side = this.relationalModel.getTableGivenNumber(es_min_1_side.sdfsdfsdfd()); - - for (C3 refcolumn : keyColumns) { - C3 column = new C3(table_1_side.getTablenamePraefix() + ( - (tableRS.getTablename().length() > 0) ? (tableRS.getTablename() + "_") : "") + - refcolumn.getColumnName(), - refcolumn.getDatatype(), - false, - true, - true, - false, - refcolumn.getAutoincrementStartAt(), - new T2(tableES.getTablename(), refcolumn.getColumnName()), - table_1_side.getReferstoGraphicalElement(), - - null, - null, - null); - table_1_side.addColumn(column); - } - if (bothSides_min_1) { - - T1 tableES_1 = this.relationalModel.getTableGivenNumber(es_min_1_side.sdfsdfsdfd()); - ArrayList keyColumns_1 = this.relationalModel.getKeyColumnsGivenRelation(es_min_1_side.sdfsdfsdfd()); - T1 table_0_side = this.relationalModel.getTableGivenNumber(es_min_0_side.sdfsdfsdfd()); - - for (C3 refcolumn : keyColumns_1) { - C3 column = new C3(table_0_side.getTablenamePraefix() + ( - (tableRS.getTablename().length() > 0) ? (tableRS.getTablename() + "_") : "") + - refcolumn.getColumnName(), - refcolumn.getDatatype(), - false, - true, - true, - false, - refcolumn.getAutoincrementStartAt(), - new T2(tableES_1.getTablename(), refcolumn.getColumnName()), - table_0_side.getReferstoGraphicalElement(), - - null, - null, - null); - table_0_side.addColumn(column); - } - } + if (connectedES.get(0) instanceof Graphic_ES_Weak_Elem && connectedES.get(1) instanceof Graphic_ES_Weak_Elem) { + continue; + } + + if (connectedES.get(0) instanceof Graphic_ES_Weak_Elem && + connectedES.get(1) instanceof Graphic_ES_Elem) { + gw_es = connectedES.get(0); + ges = connectedES.get(1); + } + if (connectedES.get(1) instanceof Graphic_ES_Weak_Elem && + connectedES.get(0) instanceof Graphic_ES_Elem) { + gw_es = connectedES.get(1); + ges = connectedES.get(0); + } + + if (connectedES.get(0) instanceof Graphic_ES_Weak_Elem && + connectedES.get(1) instanceof Graphic_ES_Assoc_Elem) { + gw_es = connectedES.get(0); + ges = connectedES.get(1); + } + if (connectedES.get(1) instanceof Graphic_ES_Weak_Elem && + connectedES.get(0) instanceof Graphic_ES_Assoc_Elem) { + gw_es = connectedES.get(1); + ges = connectedES.get(0); + } - this.relationalModel.removeTable(tableRS); - } + doneWeakElements.add(gw_es); - - if (oneToMany) { - - boolean keyCorrect = true; - ArrayList keys = getKeyAttributes(grsem); - if (keys.size() > 0) keyCorrect = false; - if (keyCorrect) { - keys = getWeakKeyAttributes(grsem); - if (keys.size() > 0) keyCorrect = false; - - } - if (!keyCorrect) { + boolean partPrimary = true; + + ArrayList keys = getKeyAttributes(gw_es); + if (keys.size() > 0) partPrimary = false; + keys = getWeakKeyAttributes(gw_es); + if (!partPrimary && keys.size() > 0) { + this.view.verticalBox.getChildren().clear(); + this.view.generateRelationalModelCB.setSelected(false); + return false; + } + assert ges != null; + T1 tableForges = this.relationalModel.getTableGivenNumber(ges.sdfsdfsdfd()); + ArrayList keyColumns = this.relationalModel.getKeyColumnsGivenRelation(ges.sdfsdfsdfd()); + T1 tableForgwes = this.relationalModel.getTableGivenNumber(gw_es.sdfsdfsdfd()); + for (C3 refcolumn : keyColumns) { + C3 column = new C3(tableForgwes.getTablenamePraefix() + refcolumn.getColumnName(), + refcolumn.getDatatype(), + partPrimary, + !partPrimary, + false, + false, + refcolumn.getAutoincrementStartAt(), + new T2(tableForges.getTablename(), refcolumn.getColumnName()), + tableForgwes.getReferstoGraphicalElement(), + + null, + null, + null); + tableForgwes.addColumn(column); + } + } + } + } + int countNotTransformedWeakES = 0; + for (Graphic_Main_Elem gme : this.graphicElements) { + + if (gme instanceof Graphic_RS_Main_Elem grsem) { + if (grsem instanceof Graphic_RS_Identifying_Elem grsie) { + + ArrayList connectedES = getConnectedESToRelationshipGivenElemNumber(grsie.sdfsdfsdfd()); + + if (connectedES.size() != 2) { - - - this.view.verticalBox.getChildren().clear(); - this.view.generateRelationalModelCB.setSelected(false); - return false; - } + this.view.verticalBox.getChildren().clear(); + this.view.generateRelationalModelCB.setSelected(false); + return false; + } + if (connectedES.get(0) instanceof Graphic_ES_Weak_Elem && connectedES.get(1) instanceof Graphic_ES_Weak_Elem) { + countNotTransformedWeakES++; + } + } + } + } + while (countNotTransformedWeakES > 0) { + for (Graphic_Main_Elem gme : this.graphicElements) { - - T1 tableRS = this.relationalModel.getTableGivenNumber(grsem.sdfsdfsdfd()); - Graphic_ES_Main_Elem es_n_side; - Graphic_ES_Main_Elem es_1_side; - if (max0.equals("1")) { es_n_side = gesme.get(1); es_1_side = gesme.get(0); } - else { es_n_side = gesme.get(0); es_1_side = gesme.get(1); } - - T1 tableES = this.relationalModel.getTableGivenNumber(es_n_side.sdfsdfsdfd()); - ArrayList keyColumns = this.relationalModel.getKeyColumnsGivenRelation(es_n_side.sdfsdfsdfd()); - T1 table_1_side = this.relationalModel.getTableGivenNumber(es_1_side.sdfsdfsdfd()); - for (C3 refcolumn : keyColumns) { - - C3 column = new C3(table_1_side.getTablenamePraefix() + (( - tableRS != null && tableRS.getTablename().length() > 0) ? (tableRS.getTablename() + "_") : "") + - refcolumn.getColumnName(), - refcolumn.getDatatype(), - false, - true, - false, - false, - refcolumn.getAutoincrementStartAt(), - new T2(tableES.getTablename(), refcolumn.getColumnName()), - table_1_side.getReferstoGraphicalElement(), - - null, - null, - null); - table_1_side.addColumn(column); - } + if (gme instanceof Graphic_RS_Main_Elem grsem) { - this.relationalModel.removeTable(tableRS); - } + if (grsem instanceof Graphic_RS_Identifying_Elem grsie) { + + ArrayList connectedES = getConnectedESToRelationshipGivenElemNumber(grsie.sdfsdfsdfd()); + + if (connectedES.size() != 2) { + this.view.verticalBox.getChildren().clear(); + this.view.generateRelationalModelCB.setSelected(false); + return false; + } + + Graphic_ES_Weak_Elem gw_es = null; + Graphic_ES_Weak_Elem ges = null; - - if (manyToMany) { - - - boolean partPrimary = true; - - ArrayList keys = getKeyAttributes(grsem); - if (keys.size() > 0) partPrimary = false; - keys = getWeakKeyAttributes(grsem); - if (!partPrimary && keys.size() > 0) { + if (connectedES.get(0) instanceof Graphic_ES_Weak_Elem && connectedES.get(1) instanceof Graphic_ES_Weak_Elem) { + if (doneWeakElements.contains(connectedES.get(0))) { + ges = (Graphic_ES_Weak_Elem) connectedES.get(0); + gw_es = (Graphic_ES_Weak_Elem) connectedES.get(1); + } else if (doneWeakElements.contains(connectedES.get(1))) { + gw_es = (Graphic_ES_Weak_Elem) connectedES.get(0); + ges = (Graphic_ES_Weak_Elem) connectedES.get(1); + } + countNotTransformedWeakES--; + + doneWeakElements.add(gw_es); + + boolean partPrimary = true; + + ArrayList keys = getKeyAttributes(gw_es); + if (keys.size() > 0) partPrimary = false; + keys = getWeakKeyAttributes(gw_es); + if (!partPrimary && keys.size() > 0) { + this.view.verticalBox.getChildren().clear(); + this.view.generateRelationalModelCB.setSelected(false); + return false; + } + assert ges != null; + T1 tableForges = this.relationalModel.getTableGivenNumber(ges.sdfsdfsdfd()); + ArrayList keyColumns = this.relationalModel.getKeyColumnsGivenRelation(ges.sdfsdfsdfd()); + T1 tableForgwes = this.relationalModel.getTableGivenNumber(gw_es.sdfsdfsdfd()); + for (C3 refcolumn : keyColumns) { + C3 column = new C3(tableForgwes.getTablenamePraefix() + refcolumn.getColumnName(), + refcolumn.getDatatype(), + partPrimary, + !partPrimary, + false, + false, + refcolumn.getAutoincrementStartAt(), + new T2(tableForges.getTablename(), refcolumn.getColumnName()), + tableForgwes.getReferstoGraphicalElement(), + + null, + null, + null); + tableForgwes.addColumn(column); + } + } + } + } + } + } + for (Graphic_Main_Elem gme : this.graphicElements) { + + if (gme instanceof Graphic_RS_Main_Elem grsem) { + if (grsem instanceof Graphic_RS_Elem) { + + ArrayList gesme = getConnectedESToRelationshipGivenElemNumber(grsem.sdfsdfsdfd()); - - this.view.verticalBox.getChildren().clear(); - this.view.generateRelationalModelCB.setSelected(false); - return false; - } + if (gesme.size() < 2) { - boolean recursiveRelationship = (gesme.get(0).sdfsdfsdfd() == gesme.get(1).sdfsdfsdfd()); - T1 tableES = this.relationalModel.getTableGivenNumber(gesme.get(0).sdfsdfsdfd()); - ArrayList keyColumns = this.relationalModel.getKeyColumnsGivenRelation(gesme.get(0).sdfsdfsdfd()); - T1 tableRS = this.relationalModel.getTableGivenNumber(grsem.sdfsdfsdfd()); - for (C3 refcolumn : keyColumns) { - - C3 column = new C3(tableRS.getTablenamePraefix() + refcolumn.getColumnName() + (recursiveRelationship ? "_1" : ""), - refcolumn.getDatatype(), - partPrimary, - !partPrimary, - false, - false, - refcolumn.getAutoincrementStartAt(), - new T2(tableES.getTablename(), refcolumn.getColumnName()), - tableRS.getReferstoGraphicalElement(), - - null, - null, - null); - tableRS.addColumn(column); - } - - tableES = this.relationalModel.getTableGivenNumber(gesme.get(1).sdfsdfsdfd()); - keyColumns = this.relationalModel.getKeyColumnsGivenRelation(gesme.get(1).sdfsdfsdfd()); - tableRS = this.relationalModel.getTableGivenNumber(grsem.sdfsdfsdfd()); - for (C3 refcolumn : keyColumns) { - - C3 column = new C3(tableRS.getTablenamePraefix() + refcolumn.getColumnName() + (recursiveRelationship ? "_2" : ""), - refcolumn.getDatatype(), - partPrimary, - !partPrimary, - false, - false, - refcolumn.getAutoincrementStartAt(), - new T2(tableES.getTablename(), refcolumn.getColumnName()), - tableRS.getReferstoGraphicalElement(), - - null, - null, - null); - tableRS.addColumn(column); - } - } - } + this.view.verticalBox.getChildren().clear(); + this.view.generateRelationalModelCB.setSelected(false); + return false; + } + if (gesme.size() == 2) { + String[] minMax0; + String[] minMax1; + + String max0; + String max1; + String min0; + String min1; - - if (gesme.size() > 2) { - - boolean partPrimary = true; - - ArrayList keys = getKeyAttributes(grsem); - if (keys.size() > 0) partPrimary = false; + if (gesme.get(0).equals(gesme.get(1))) { + String[] minMaxRecursive = getMinMaxForGivenESRSIfRecursive(grsem.sdfsdfsdfd(), gesme.get(0).sdfsdfsdfd()); + min0 = minMaxRecursive[0]; + max0 = minMaxRecursive[1]; + min1 = minMaxRecursive[2]; + max1 = minMaxRecursive[3]; + } else { + + minMax0 = getMinMaxForGivenESRS(grsem.sdfsdfsdfd(), gesme.get(0).sdfsdfsdfd()); + minMax1 = getMinMaxForGivenESRS(grsem.sdfsdfsdfd(), gesme.get(1).sdfsdfsdfd()); + max0 = minMax0[1]; + max1 = minMax1[1]; + min0 = minMax0[0]; + min1 = minMax1[0]; + } + + + boolean manyToMany = !max0.equals("1") && !max1.equals("1"); + boolean oneToMany = (max0.equals("1") && !max1.equals("1")) || ( + !max0.equals("1") && max1.equals("1")); + boolean oneToOne = max0.equals("1") && max1.equals("1"); + + + if (oneToOne) { + + if (handleKey(grsem)) return false; + + + Graphic_ES_Main_Elem es_min_1_side; + Graphic_ES_Main_Elem es_min_0_side; + boolean bothSides_min_1 = false; + if (min0.equals("1") && min1.equals("0")) { + es_min_1_side = gesme.get(0); + es_min_0_side = gesme.get(1); + } else if (min1.equals("1") && min0.equals("0")) { + es_min_1_side = gesme.get(1); + es_min_0_side = gesme.get(0); + } else if (min1.equals("1") && min0.equals("1")) { + es_min_1_side = gesme.get(1); + es_min_0_side = gesme.get(0); + bothSides_min_1 = true; + } else { + es_min_1_side = gesme.get(0); + es_min_0_side = gesme.get(1); + } + + + T1 tableRS = this.relationalModel.getTableGivenNumber(grsem.sdfsdfsdfd()); + + addTableC3(es_min_1_side, es_min_0_side, tableRS); + if (bothSides_min_1) { + addTableC3(es_min_0_side, es_min_1_side, tableRS); + } + + + this.relationalModel.removeTable(tableRS); + } + + + if (oneToMany) { + + if (handleKey(grsem)) return false; + + + T1 tableRS = this.relationalModel.getTableGivenNumber(grsem.sdfsdfsdfd()); + Graphic_ES_Main_Elem es_n_side; + Graphic_ES_Main_Elem es_1_side; + if (max0.equals("1")) { + es_n_side = gesme.get(1); + es_1_side = gesme.get(0); + } else { + es_n_side = gesme.get(0); + es_1_side = gesme.get(1); + } + + T1 tableES = this.relationalModel.getTableGivenNumber(es_n_side.sdfsdfsdfd()); + ArrayList keyColumns = this.relationalModel.getKeyColumnsGivenRelation(es_n_side.sdfsdfsdfd()); + T1 table_1_side = this.relationalModel.getTableGivenNumber(es_1_side.sdfsdfsdfd()); + for (C3 refcolumn : keyColumns) { + + C3 column = new C3(table_1_side.getTablenamePraefix() + (( + tableRS != null && tableRS.getTablename().length() > 0) ? (tableRS.getTablename() + "_") : "") + + refcolumn.getColumnName(), + refcolumn.getDatatype(), + false, + true, + false, + false, + refcolumn.getAutoincrementStartAt(), + new T2(tableES.getTablename(), refcolumn.getColumnName()), + table_1_side.getReferstoGraphicalElement(), + + null, + null, + null); + table_1_side.addColumn(column); + } + + + this.relationalModel.removeTable(tableRS); + } + + + if (manyToMany) { + + + boolean partPrimary = true; + + ArrayList keys = getKeyAttributes(grsem); + if (keys.size() > 0) partPrimary = false; + keys = getWeakKeyAttributes(grsem); + if (!partPrimary && keys.size() > 0) { + + + this.view.verticalBox.getChildren().clear(); + this.view.generateRelationalModelCB.setSelected(false); + return false; + } + + + boolean recursiveRelationship = (gesme.get(0).sdfsdfsdfd() == gesme.get(1).sdfsdfsdfd()); + T1 tableES = this.relationalModel.getTableGivenNumber(gesme.get(0).sdfsdfsdfd()); + ArrayList keyColumns = this.relationalModel.getKeyColumnsGivenRelation(gesme.get(0).sdfsdfsdfd()); + T1 tableRS = this.relationalModel.getTableGivenNumber(grsem.sdfsdfsdfd()); + for (C3 refcolumn : keyColumns) { + + C3 column = new C3(tableRS.getTablenamePraefix() + refcolumn.getColumnName() + (recursiveRelationship ? "_1" : ""), + refcolumn.getDatatype(), + partPrimary, + !partPrimary, + false, + false, + refcolumn.getAutoincrementStartAt(), + new T2(tableES.getTablename(), refcolumn.getColumnName()), + tableRS.getReferstoGraphicalElement(), + + null, + null, + null); + tableRS.addColumn(column); + } + + tableES = this.relationalModel.getTableGivenNumber(gesme.get(1).sdfsdfsdfd()); + keyColumns = this.relationalModel.getKeyColumnsGivenRelation(gesme.get(1).sdfsdfsdfd()); + tableRS = this.relationalModel.getTableGivenNumber(grsem.sdfsdfsdfd()); + for (C3 refcolumn : keyColumns) { + + C3 column = new C3(tableRS.getTablenamePraefix() + refcolumn.getColumnName() + (recursiveRelationship ? "_2" : ""), + refcolumn.getDatatype(), + partPrimary, + !partPrimary, + false, + false, + refcolumn.getAutoincrementStartAt(), + new T2(tableES.getTablename(), refcolumn.getColumnName()), + tableRS.getReferstoGraphicalElement(), + + null, + null, + null); + tableRS.addColumn(column); + } + } + } + + + if (gesme.size() > 2) { + + boolean partPrimary = true; + + ArrayList keys = getKeyAttributes(grsem); + if (keys.size() > 0) partPrimary = false; + keys = getWeakKeyAttributes(grsem); + if (!partPrimary && keys.size() > 0) { + + + this.view.verticalBox.getChildren().clear(); + this.view.generateRelationalModelCB.setSelected(false); + return false; + } + + + for (Graphic_ES_Main_Elem gesme_conn : gesme) { + T1 tableES = this.relationalModel.getTableGivenNumber(gesme_conn.sdfsdfsdfd()); + + ArrayList keyColumns = this.relationalModel.getKeyColumnsGivenRelation(gesme_conn.sdfsdfsdfd()); + + T1 tableRS = this.relationalModel.getTableGivenNumber(grsem.sdfsdfsdfd()); + + String[] minMax = getMinMaxForGivenESRS(grsem.sdfsdfsdfd(), gesme_conn.sdfsdfsdfd()); + for (C3 refcolumn : keyColumns) { + + boolean colExists = tableRS.columnExist(tableRS.getTablenamePraefix() + refcolumn.getColumnName()); + + C3 column = new C3(tableRS.getTablenamePraefix() + refcolumn.getColumnName() + (colExists ? "_1" : ""), + refcolumn.getDatatype(), + partPrimary, + !partPrimary, + minMax[1].equals("1"), + false, + refcolumn.getAutoincrementStartAt(), + new T2(tableES.getTablename(), refcolumn.getColumnName()), + tableRS.getReferstoGraphicalElement(), + + null, + null, + null); + + tableRS.addColumn(column); + } + } + } + } + } + } + + + this.relationalModel.sortByTableName(); + + return true; + } + + private boolean handleKey(Graphic_RS_Main_Elem grsem) { + boolean keyCorrect = true; + ArrayList keys = getKeyAttributes(grsem); + if (keys.size() > 0) keyCorrect = false; + if (keyCorrect) { keys = getWeakKeyAttributes(grsem); - if (!partPrimary && keys.size() > 0) { + if (keys.size() > 0) keyCorrect = false; + + } + if (!keyCorrect) { + this.view.verticalBox.getChildren().clear(); + this.view.generateRelationalModelCB.setSelected(false); + return true; + } + return false; + } + private void addTableC3(Graphic_ES_Main_Elem es_min_1_side, Graphic_ES_Main_Elem es_min_0_side, T1 tableRS) { + T1 tableES = this.relationalModel.getTableGivenNumber(es_min_0_side.sdfsdfsdfd()); + ArrayList keyColumns = this.relationalModel.getKeyColumnsGivenRelation(es_min_0_side.sdfsdfsdfd()); + T1 table_1_side = this.relationalModel.getTableGivenNumber(es_min_1_side.sdfsdfsdfd()); + for (C3 refcolumn : keyColumns) { + C3 column = new C3(table_1_side.getTablenamePraefix() + ( + (tableRS.getTablename().length() > 0) ? (tableRS.getTablename() + "_") : "") + + refcolumn.getColumnName(), + refcolumn.getDatatype(), + false, + true, + true, + false, + refcolumn.getAutoincrementStartAt(), + new T2(tableES.getTablename(), refcolumn.getColumnName()), + table_1_side.getReferstoGraphicalElement(), - - - - - - - - - this.view.verticalBox.getChildren().clear(); - this.view.generateRelationalModelCB.setSelected(false); - return false; - } - - - for (Graphic_ES_Main_Elem gesme_conn : gesme) { - T1 tableES = this.relationalModel.getTableGivenNumber(gesme_conn.sdfsdfsdfd()); - - ArrayList keyColumns = this.relationalModel.getKeyColumnsGivenRelation(gesme_conn.sdfsdfsdfd()); - - T1 tableRS = this.relationalModel.getTableGivenNumber(grsem.sdfsdfsdfd()); - - String[] minMax = getMinMaxForGivenESRS(grsem.sdfsdfsdfd(), gesme_conn.sdfsdfsdfd()); - for (C3 refcolumn : keyColumns) { - - boolean colExists = tableRS.columnExist(tableRS.getTablenamePraefix() + refcolumn.getColumnName()); - - C3 column = new C3(tableRS.getTablenamePraefix() + refcolumn.getColumnName() + (colExists ? "_1" : ""), - refcolumn.getDatatype(), - partPrimary, - !partPrimary, - minMax[1].equals("1"), - false, - refcolumn.getAutoincrementStartAt(), - new T2(tableES.getTablename(), refcolumn.getColumnName()), - tableRS.getReferstoGraphicalElement(), - - null, - null, + null, + null, null); - + table_1_side.addColumn(column); + } + } + + + private ArrayList getAttributes(Graphic_Main_Elem gme) { + ArrayList attributes = new ArrayList<>(); + for (Graphic_Main_Elem gmLooking : this.graphicElements) { + + + if (gmLooking instanceof Graphic_LINE_Elem) { + + + if (((Graphic_LINE_Elem) gmLooking).getConnectedWithEnd().sdfsdfsdfd() == gme.sdfsdfsdfd() && ( + (Graphic_LINE_Elem) gmLooking).getConnectedWithStart() instanceof Graphic_ATTR_Elem gae) { + + if (gae.getCreateColumn()) { + attributes.add(gae); + } else { + attributes.addAll(getAttributes(gae)); + } + + } + + if (((Graphic_LINE_Elem) gmLooking).getConnectedWithStart().sdfsdfsdfd() == gme.sdfsdfsdfd() && ( + (Graphic_LINE_Elem) gmLooking).getConnectedWithEnd() instanceof Graphic_ATTR_Elem gae) { + + if (gae.getCreateColumn()) { + attributes.add(gae); + + continue; + } + + attributes.addAll(getAttributes(gae)); + } + } + } + + return attributes; + } + + + private void addColumnsToTable(T1 table, ArrayList attributes) { + for (Graphic_Main_Elem gme : attributes) { + Graphic_ATTR_Elem gae = (Graphic_ATTR_Elem) gme; + C3 column = new C3(table.getTablenamePraefix() + + gae.getColumnName() + (( + gae.getColumnPostfix() != null && gae.getColumnPostfix().length() > 0) ? gae.getColumnPostfix() : ""), + gae.getDatatype(), + gae.isKey(), + gae.isNullable(), + gae.isUnique(), + gae.isAutoincrement(), + gae.getAutoincrementStartAt(), + null, + table.getReferstoGraphicalElement(), + gae.getDataGenerationType(), + gae.getPar1(), + gae.getPar2()); + table.addColumn(column); + } + } + + + private Graphic_ES_Elem getTopES(Graphic_RS_ISA_Elem grsisae) { + for (Graphic_Main_Elem gme : this.graphicElements) { + + if (gme instanceof Graphic_LINE_RSISAG_ES_Elem) { + if (((Graphic_LINE_RSISAG_ES_Elem) gme).getConnectedWithStart().sdfsdfsdfd() == grsisae.sdfsdfsdfd()) { + this.topES = (Graphic_ES_Elem) ((Graphic_LINE_RSISAG_ES_Elem) gme).getConnectedWithEnd(); + } + + if (((Graphic_LINE_RSISAG_ES_Elem) gme).getConnectedWithEnd().sdfsdfsdfd() == grsisae.sdfsdfsdfd()) { + this.topES = (Graphic_ES_Elem) ((Graphic_LINE_RSISAG_ES_Elem) gme).getConnectedWithStart(); + } + } + } + + + for (Graphic_Main_Elem gme : this.graphicElements) { + if (gme instanceof Graphic_LINE_RSISAS_ES_Elem) { + if (((Graphic_LINE_RSISAS_ES_Elem) gme).getConnectedWithStart().sdfsdfsdfd() == this.topES.sdfsdfsdfd()) { + getTopES((Graphic_RS_ISA_Elem) ((Graphic_LINE_RSISAS_ES_Elem) gme).getConnectedWithEnd()); + } + if (((Graphic_LINE_RSISAS_ES_Elem) gme).getConnectedWithEnd().sdfsdfsdfd() == this.topES.sdfsdfsdfd()) { + getTopES((Graphic_RS_ISA_Elem) ((Graphic_LINE_RSISAS_ES_Elem) gme).getConnectedWithStart()); + } + } + } + + return this.topES; + } + + + private void traverseThroughISA(Graphic_ES_Elem topES) { + Graphic_RS_ISA_Elem topESConnectedWithISA = getISAOfTop(topES); + + if (topESConnectedWithISA == null) + return; + ArrayList specializationsOfTopES; + specializationsOfTopES = getSpecializationsOfTopES(topESConnectedWithISA); + if (specializationsOfTopES.size() == 0) { + return; + } + + + for (Graphic_ES_Elem specialization : specializationsOfTopES) { + boolean partPrimary = true; + ArrayList keys = getKeyAttributes(specialization); + if (keys.size() > 0) partPrimary = false; + + ArrayList weakKeys = getWeakKeyAttributes(specialization); + + if (weakKeys.size() == 1) { + return; + } + + + if (weakKeys.size() > 1) partPrimary = false; + + T1 tableES = this.relationalModel.getTableGivenNumber(topES.sdfsdfsdfd()); + ArrayList keyColumns = this.relationalModel.getKeyColumnsGivenRelation(topES.sdfsdfsdfd()); + T1 tableRS = this.relationalModel.getTableGivenNumber(specialization.sdfsdfsdfd()); + for (C3 refcolumn : keyColumns) { + + Graphic_ATTR_Elem gattre = getAttrElemGivenColumnName(tableRS.getTablenamePraefix() + refcolumn.getColumnName()); + + C3 column = new C3(tableRS.getTablenamePraefix() + refcolumn.getColumnName(), + refcolumn.getDatatype(), + partPrimary, + false, + !partPrimary, + false, + refcolumn.getAutoincrementStartAt(), + new T2(tableES.getTablename(), refcolumn.getColumnName()), + tableRS.getReferstoGraphicalElement(), + + gattre.getDataGenerationType(), + gattre.getPar1(), + gattre.getPar2()); tableRS.addColumn(column); - } - } - } - } - } - } + } - - - - - - - this.relationalModel.sortByTableName(); - - return true; - } - - - - - - - - - - - - - private ArrayList getAttributes(Graphic_Main_Elem gme) { - ArrayList attributes = new ArrayList<>(); - for (Graphic_Main_Elem gmLooking : this.graphicElements) { - - - if (gmLooking instanceof Graphic_LINE_Elem) { - - - if (((Graphic_LINE_Elem)gmLooking).getConnectedWithEnd().sdfsdfsdfd() == gme.sdfsdfsdfd() && ( - (Graphic_LINE_Elem) gmLooking).getConnectedWithStart() instanceof Graphic_ATTR_Elem gae) { - - if (gae.getCreateColumn()) { attributes.add(gae); } - - else - - { attributes.addAll(getAttributes(gae)); } - - } - - if (((Graphic_LINE_Elem)gmLooking).getConnectedWithStart().sdfsdfsdfd() == gme.sdfsdfsdfd() && ( - (Graphic_LINE_Elem) gmLooking).getConnectedWithEnd() instanceof Graphic_ATTR_Elem gae) { - - if (gae.getCreateColumn()) { attributes.add(gae); - - continue; } - - attributes.addAll(getAttributes(gae)); - } - } - } - - return attributes; - } - - - - - - - - - - private void addColumnsToTable(T1 table, ArrayList attributes) { - for (Graphic_Main_Elem gme : attributes) { - Graphic_ATTR_Elem gae = (Graphic_ATTR_Elem)gme; - C3 column = new C3(table.getTablenamePraefix() + - gae.getColumnName() + (( - gae.getColumnPostfix() != null && gae.getColumnPostfix().length() > 0) ? gae.getColumnPostfix() : ""), - gae.getDatatype(), - gae.isKey(), - gae.isNullable(), - gae.isUnique(), - gae.isAutoincrement(), - gae.getAutoincrementStartAt(), - null, - table.getReferstoGraphicalElement(), - gae.getDataGenerationType(), - gae.getPar1(), - gae.getPar2()); - table.addColumn(column); - } - } - - - - - - - - private Graphic_ES_Elem getTopES(Graphic_RS_ISA_Elem grsisae) { - for (Graphic_Main_Elem gme : this.graphicElements) { - - if (gme instanceof Graphic_LINE_RSISAG_ES_Elem) { - if (((Graphic_LINE_RSISAG_ES_Elem)gme).getConnectedWithStart().sdfsdfsdfd() == grsisae.sdfsdfsdfd()) { - this.topES = (Graphic_ES_Elem)((Graphic_LINE_RSISAG_ES_Elem)gme).getConnectedWithEnd(); + traverseThroughISA(specialization); } - - if (((Graphic_LINE_RSISAG_ES_Elem)gme).getConnectedWithEnd().sdfsdfsdfd() == grsisae.sdfsdfsdfd()) { - this.topES = (Graphic_ES_Elem)((Graphic_LINE_RSISAG_ES_Elem)gme).getConnectedWithStart(); - } - } - } - - - for (Graphic_Main_Elem gme : this.graphicElements) { - if (gme instanceof Graphic_LINE_RSISAS_ES_Elem) { - if (((Graphic_LINE_RSISAS_ES_Elem)gme).getConnectedWithStart().sdfsdfsdfd() == this.topES.sdfsdfsdfd()) { - getTopES((Graphic_RS_ISA_Elem)((Graphic_LINE_RSISAS_ES_Elem)gme).getConnectedWithEnd()); - } - if (((Graphic_LINE_RSISAS_ES_Elem)gme).getConnectedWithEnd().sdfsdfsdfd() == this.topES.sdfsdfsdfd()) { - getTopES((Graphic_RS_ISA_Elem)((Graphic_LINE_RSISAS_ES_Elem)gme).getConnectedWithStart()); - } - } - } - - return this.topES; - } - - - - - - - private void traverseThroughISA(Graphic_ES_Elem topES) { - Graphic_RS_ISA_Elem topESConnectedWithISA = getISAOfTop(topES); - - if (topESConnectedWithISA == null) - return; - ArrayList specializationsOfTopES; - specializationsOfTopES = getSpecializationsOfTopES(topESConnectedWithISA); - if (specializationsOfTopES.size() == 0) { - return; } + public Graphic_ES_Main_Elem getESGivenNumber(long elementNr) { + for (Graphic_Main_Elem gme : this.graphicElements) { - - - - - - - - - - - for (Graphic_ES_Elem specialization : specializationsOfTopES) { - boolean partPrimary = true; - ArrayList keys = getKeyAttributes(specialization); - if (keys.size() > 0) partPrimary = false; - - ArrayList weakKeys = getWeakKeyAttributes(specialization); - - if (weakKeys.size() == 1) { - return; - } - - - - - - - - - - - - - - if (weakKeys.size() > 1) partPrimary = false; - - T1 tableES = this.relationalModel.getTableGivenNumber(topES.sdfsdfsdfd()); - ArrayList keyColumns = this.relationalModel.getKeyColumnsGivenRelation(topES.sdfsdfsdfd()); - T1 tableRS = this.relationalModel.getTableGivenNumber(specialization.sdfsdfsdfd()); - for (C3 refcolumn : keyColumns) { - - Graphic_ATTR_Elem gattre = getAttrElemGivenColumnName(tableRS.getTablenamePraefix() + refcolumn.getColumnName()); - - C3 column = new C3(tableRS.getTablenamePraefix() + refcolumn.getColumnName(), - refcolumn.getDatatype(), - partPrimary, - false, - !partPrimary, - false, - refcolumn.getAutoincrementStartAt(), - new T2(tableES.getTablename(), refcolumn.getColumnName()), - tableRS.getReferstoGraphicalElement(), - - gattre.getDataGenerationType(), - gattre.getPar1(), - gattre.getPar2()); - tableRS.addColumn(column); - } - - traverseThroughISA(specialization); - } - } - - - - - - - - - public Graphic_ES_Main_Elem getESGivenNumber(long elementNr) { - - for (Graphic_Main_Elem gme : this.graphicElements) { - - if (gme instanceof Graphic_LINE_Attr_ES_Elem glaese) { - if (glaese.getConnectedWithEnd().sdfsdfsdfd() == elementNr) return (Graphic_ES_Main_Elem)glaese.getConnectedWithStart(); - if (glaese.getConnectedWithStart().sdfsdfsdfd() == elementNr) return (Graphic_ES_Main_Elem)glaese.getConnectedWithEnd(); - } - } - return null; - } - - - - - - - private ArrayList getConnectedESToRelationshipGivenElemNumber(long elementNr) { - ArrayList connections = new ArrayList<>(); - for (Graphic_Main_Elem gme : this.graphicElements) { - if (gme instanceof Graphic_LINE_Attr_Attr_Elem || gme instanceof Graphic_LINE_Attr_ES_Elem || gme instanceof Graphic_LINE_Attr_RS_Elem) - continue; - if (gme instanceof Graphic_LINE_Elem gle) { - if (gle.getConnectedWithEnd().sdfsdfsdfd() == elementNr) connections.add((Graphic_ES_Main_Elem)gle.getConnectedWithStart()); - if (gle.getConnectedWithStart().sdfsdfsdfd() == elementNr) connections.add((Graphic_ES_Main_Elem)gle.getConnectedWithEnd()); - } - } - return connections; - } - - - - - - - - - private ArrayList getWeakKeyAttributes(Graphic_Main_Elem gme) { - ArrayList attributes = new ArrayList<>(); - for (Graphic_Main_Elem gmLooking : this.graphicElements) { - - - if (gmLooking instanceof Graphic_LINE_Elem) { - - - if (((Graphic_LINE_Elem)gmLooking).getConnectedWithEnd().sdfsdfsdfd() == gme.sdfsdfsdfd() && ( - (Graphic_LINE_Elem)gmLooking).getConnectedWithStart() instanceof Graphic_ATTR_Weak_Key_Elem) { - Graphic_ATTR_Elem gae = (Graphic_ATTR_Elem)((Graphic_LINE_Elem)gmLooking).getConnectedWithStart(); - - if (gae.getCreateColumn()) attributes.add(gae); - } - if (((Graphic_LINE_Elem)gmLooking).getConnectedWithStart().sdfsdfsdfd() == gme.sdfsdfsdfd() && ( - (Graphic_LINE_Elem)gmLooking).getConnectedWithEnd() instanceof Graphic_ATTR_Weak_Key_Elem) { - Graphic_ATTR_Elem gae = (Graphic_ATTR_Elem)((Graphic_LINE_Elem)gmLooking).getConnectedWithEnd(); - - if (gae.getCreateColumn()) attributes.add(gae); - } - } - } - return attributes; - } - - - - - - - - - private ArrayList getKeyAttributes(Graphic_Main_Elem gme) { - ArrayList attributes = new ArrayList<>(); - for (Graphic_Main_Elem gmLooking : this.graphicElements) { - - - if (gmLooking instanceof Graphic_LINE_Elem) { - - - if (((Graphic_LINE_Elem)gmLooking).getConnectedWithEnd().sdfsdfsdfd() == gme.sdfsdfsdfd() && ( - (Graphic_LINE_Elem)gmLooking).getConnectedWithStart() instanceof Graphic_ATTR_Key_Elem) { - Graphic_ATTR_Elem gae = (Graphic_ATTR_Elem)((Graphic_LINE_Elem)gmLooking).getConnectedWithStart(); - - if (gae.getCreateColumn()) attributes.add(gae); - } - if (((Graphic_LINE_Elem)gmLooking).getConnectedWithStart().sdfsdfsdfd() == gme.sdfsdfsdfd() && ( - (Graphic_LINE_Elem)gmLooking).getConnectedWithEnd() instanceof Graphic_ATTR_Key_Elem) { - Graphic_ATTR_Elem gae = (Graphic_ATTR_Elem)((Graphic_LINE_Elem)gmLooking).getConnectedWithEnd(); - - if (gae.getCreateColumn()) attributes.add(gae); - } - } - } - return attributes; - } - - - - - - - private ArrayList getConnectedESToAssociativeESGivenElemNumber(long elementNr) { - ArrayList connections = new ArrayList<>(); - for (Graphic_Main_Elem gme : this.graphicElements) { - if (gme instanceof Graphic_LINE_Attr_Attr_Elem || gme instanceof Graphic_LINE_Attr_ES_Elem || gme instanceof Graphic_LINE_Attr_RS_Elem) - continue; - if (gme instanceof Graphic_LINE_Elem gle) { - if (gle.getConnectedWithEnd().sdfsdfsdfd() == elementNr && - gle.getConnectedWithStart() instanceof Graphic_ES_Main_Elem) { - connections.add((Graphic_ES_Main_Elem)gle.getConnectedWithStart()); + if (gme instanceof Graphic_LINE_Attr_ES_Elem glaese) { + if (glaese.getConnectedWithEnd().sdfsdfsdfd() == elementNr) + return (Graphic_ES_Main_Elem) glaese.getConnectedWithStart(); + if (glaese.getConnectedWithStart().sdfsdfsdfd() == elementNr) + return (Graphic_ES_Main_Elem) glaese.getConnectedWithEnd(); + } } - if (gle.getConnectedWithStart().sdfsdfsdfd() == elementNr && - gle.getConnectedWithEnd() instanceof Graphic_ES_Main_Elem) { - connections.add((Graphic_ES_Main_Elem)gle.getConnectedWithEnd()); + return null; + } + + + private ArrayList getConnectedESToRelationshipGivenElemNumber(long elementNr) { + ArrayList connections = new ArrayList<>(); + for (Graphic_Main_Elem gme : this.graphicElements) { + if (gme instanceof Graphic_LINE_Attr_Attr_Elem || gme instanceof Graphic_LINE_Attr_ES_Elem || gme instanceof Graphic_LINE_Attr_RS_Elem) + continue; + if (gme instanceof Graphic_LINE_Elem gle) { + if (gle.getConnectedWithEnd().sdfsdfsdfd() == elementNr) + connections.add((Graphic_ES_Main_Elem) gle.getConnectedWithStart()); + if (gle.getConnectedWithStart().sdfsdfsdfd() == elementNr) + connections.add((Graphic_ES_Main_Elem) gle.getConnectedWithEnd()); + } } - } - } - return connections; - } + return connections; + } + private ArrayList getWeakKeyAttributes(Graphic_Main_Elem gme) { + ArrayList attributes = new ArrayList<>(); + for (Graphic_Main_Elem gmLooking : this.graphicElements) { + if (gmLooking instanceof Graphic_LINE_Elem) { + if (((Graphic_LINE_Elem) gmLooking).getConnectedWithEnd().sdfsdfsdfd() == gme.sdfsdfsdfd() && ( + (Graphic_LINE_Elem) gmLooking).getConnectedWithStart() instanceof Graphic_ATTR_Weak_Key_Elem) { + Graphic_ATTR_Elem gae = (Graphic_ATTR_Elem) ((Graphic_LINE_Elem) gmLooking).getConnectedWithStart(); + + if (gae.getCreateColumn()) attributes.add(gae); + } + if (((Graphic_LINE_Elem) gmLooking).getConnectedWithStart().sdfsdfsdfd() == gme.sdfsdfsdfd() && ( + (Graphic_LINE_Elem) gmLooking).getConnectedWithEnd() instanceof Graphic_ATTR_Weak_Key_Elem) { + Graphic_ATTR_Elem gae = (Graphic_ATTR_Elem) ((Graphic_LINE_Elem) gmLooking).getConnectedWithEnd(); + + if (gae.getCreateColumn()) attributes.add(gae); + } + } + } + return attributes; + } - - private String[] getMinMaxForGivenESRSIfRecursive(long rs, long es) { - String[] minMax = new String[100]; - int counter = 0; - for (Graphic_Main_Elem gme : this.graphicElements) { - if (gme instanceof Graphic_LINE_RS_ES_Elem glrsese) { - - if ((glrsese.getConnectedWithEnd().sdfsdfsdfd() == rs && glrsese.getConnectedWithStart().sdfsdfsdfd() == es) || ( - glrsese.getConnectedWithStart().sdfsdfsdfd() == rs && glrsese.getConnectedWithEnd().sdfsdfsdfd() == es)) { - minMax[counter++] = glrsese.getMinimum(); - minMax[counter++] = glrsese.getMaximum(); - } - } - } - return minMax; - } + private ArrayList getKeyAttributes(Graphic_Main_Elem gme) { + ArrayList attributes = new ArrayList<>(); + for (Graphic_Main_Elem gmLooking : this.graphicElements) { + if (gmLooking instanceof Graphic_LINE_Elem) { + if (((Graphic_LINE_Elem) gmLooking).getConnectedWithEnd().sdfsdfsdfd() == gme.sdfsdfsdfd() && ( + (Graphic_LINE_Elem) gmLooking).getConnectedWithStart() instanceof Graphic_ATTR_Key_Elem) { + Graphic_ATTR_Elem gae = (Graphic_ATTR_Elem) ((Graphic_LINE_Elem) gmLooking).getConnectedWithStart(); + + if (gae.getCreateColumn()) attributes.add(gae); + } + if (((Graphic_LINE_Elem) gmLooking).getConnectedWithStart().sdfsdfsdfd() == gme.sdfsdfsdfd() && ( + (Graphic_LINE_Elem) gmLooking).getConnectedWithEnd() instanceof Graphic_ATTR_Key_Elem) { + Graphic_ATTR_Elem gae = (Graphic_ATTR_Elem) ((Graphic_LINE_Elem) gmLooking).getConnectedWithEnd(); + + if (gae.getCreateColumn()) attributes.add(gae); + } + } + } + return attributes; + } + private ArrayList getConnectedESToAssociativeESGivenElemNumber(long elementNr) { + ArrayList connections = new ArrayList<>(); + for (Graphic_Main_Elem gme : this.graphicElements) { + if (gme instanceof Graphic_LINE_Attr_Attr_Elem || gme instanceof Graphic_LINE_Attr_ES_Elem || gme instanceof Graphic_LINE_Attr_RS_Elem) + continue; + if (gme instanceof Graphic_LINE_Elem gle) { + if (gle.getConnectedWithEnd().sdfsdfsdfd() == elementNr && + gle.getConnectedWithStart() instanceof Graphic_ES_Main_Elem) { + connections.add((Graphic_ES_Main_Elem) gle.getConnectedWithStart()); + } + if (gle.getConnectedWithStart().sdfsdfsdfd() == elementNr && + gle.getConnectedWithEnd() instanceof Graphic_ES_Main_Elem) { + connections.add((Graphic_ES_Main_Elem) gle.getConnectedWithEnd()); + } + } + } + return connections; + } - - private String[] getMinMaxForGivenESRS(long rs, long es) { - String[] minMax = null; - for (Graphic_Main_Elem gme : this.graphicElements) { - if (gme instanceof Graphic_LINE_RS_ES_Elem glrsese) { - if ((glrsese.getConnectedWithEnd().sdfsdfsdfd() == rs && glrsese.getConnectedWithStart().sdfsdfsdfd() == es) || ( - glrsese.getConnectedWithStart().sdfsdfsdfd() == rs && glrsese.getConnectedWithEnd().sdfsdfsdfd() == es)) { - minMax = new String[2]; - minMax[0] = glrsese.getMinimum(); - minMax[1] = glrsese.getMaximum(); - } - } - } - return minMax; - } + private String[] getMinMaxForGivenESRSIfRecursive(long rs, long es) { + String[] minMax = new String[100]; + int counter = 0; + for (Graphic_Main_Elem gme : this.graphicElements) { + if (gme instanceof Graphic_LINE_RS_ES_Elem glrsese) { + + if ((glrsese.getConnectedWithEnd().sdfsdfsdfd() == rs && glrsese.getConnectedWithStart().sdfsdfsdfd() == es) || ( + glrsese.getConnectedWithStart().sdfsdfsdfd() == rs && glrsese.getConnectedWithEnd().sdfsdfsdfd() == es)) { + minMax[counter++] = glrsese.getMinimum(); + minMax[counter++] = glrsese.getMaximum(); + } + } + } + return minMax; + } + + + private String[] getMinMaxForGivenESRS(long rs, long es) { + String[] minMax = null; + for (Graphic_Main_Elem gme : this.graphicElements) { + if (gme instanceof Graphic_LINE_RS_ES_Elem glrsese) { + + if ((glrsese.getConnectedWithEnd().sdfsdfsdfd() == rs && glrsese.getConnectedWithStart().sdfsdfsdfd() == es) || ( + glrsese.getConnectedWithStart().sdfsdfsdfd() == rs && glrsese.getConnectedWithEnd().sdfsdfsdfd() == es)) { + minMax = new String[2]; + minMax[0] = glrsese.getMinimum(); + minMax[1] = glrsese.getMaximum(); + } + } + } + return minMax; + } private Graphic_RS_ISA_Elem getISAOfTop(Graphic_ES_Elem topES) { - for (Graphic_Main_Elem gme : this.graphicElements) { - if (gme instanceof Graphic_LINE_RSISAG_ES_Elem) { - if (((Graphic_LINE_RSISAG_ES_Elem)gme).getConnectedWithEnd().sdfsdfsdfd() == topES.sdfsdfsdfd()) { - return (Graphic_RS_ISA_Elem)((Graphic_LINE_RSISAG_ES_Elem)gme).getConnectedWithStart(); + for (Graphic_Main_Elem gme : this.graphicElements) { + if (gme instanceof Graphic_LINE_RSISAG_ES_Elem) { + if (((Graphic_LINE_RSISAG_ES_Elem) gme).getConnectedWithEnd().sdfsdfsdfd() == topES.sdfsdfsdfd()) { + return (Graphic_RS_ISA_Elem) ((Graphic_LINE_RSISAG_ES_Elem) gme).getConnectedWithStart(); + } + if (((Graphic_LINE_RSISAG_ES_Elem) gme).getConnectedWithStart().sdfsdfsdfd() == topES.sdfsdfsdfd()) { + return (Graphic_RS_ISA_Elem) ((Graphic_LINE_RSISAG_ES_Elem) gme).getConnectedWithEnd(); + } + } } - if (((Graphic_LINE_RSISAG_ES_Elem)gme).getConnectedWithStart().sdfsdfsdfd() == topES.sdfsdfsdfd()) { - return (Graphic_RS_ISA_Elem)((Graphic_LINE_RSISAG_ES_Elem)gme).getConnectedWithEnd(); - } - } - } - return null; - } - - - - - - - - - private ArrayList getSpecializationsOfTopES(Graphic_RS_ISA_Elem topESISA) { - ArrayList connectedES = new ArrayList<>(); - for (Graphic_Main_Elem gme : this.graphicElements) { - if (gme instanceof Graphic_LINE_RSISAS_ES_Elem connectionToSpecialization) { - if (connectionToSpecialization.getConnectedWithEnd().sdfsdfsdfd() == topESISA.sdfsdfsdfd()) { - connectedES.add((Graphic_ES_Elem)connectionToSpecialization.getConnectedWithStart()); - } - if (connectionToSpecialization.getConnectedWithStart().sdfsdfsdfd() == topESISA.sdfsdfsdfd()) { - connectedES.add((Graphic_ES_Elem)connectionToSpecialization.getConnectedWithEnd()); - } - } - } - return connectedES; - } - - - - - - - - private Graphic_ATTR_Elem getAttrElemGivenColumnName(String columnName) { - Graphic_ATTR_Elem gattre = null; - for (Graphic_Main_Elem gme : this.graphicElements) { - if (gme instanceof Graphic_ATTR_Elem) { - gattre = (Graphic_ATTR_Elem)gme; - if (gattre.getColumnName().equals(columnName)) return gattre; - } - } - return gattre; - } - - - - - public C4 getRelationalModel() { - return this.relationalModel; - } - - - - - - - - - - - - - - - - public boolean mergeAllModelsInPanes() throws IOException, ClassNotFoundException { - ArrayList graphicElements = new ArrayList<>(); - - for (Tab tab : this.view.tabPane.getTabs()) { - U1 currentTab = (U1)tab; - A3 canvas = currentTab.canvas; - - - - if (canvas.sddsfsfsdf45645645().size() == 0 || canvas.getSaveFile() == null) - continue; ObjectInputStream ro = new ObjectInputStream(new FileInputStream(canvas.getSaveFile())); - @SuppressWarnings("unchecked") ArrayList readModel = (ArrayList)ro.readObject(); - - - for (Graphic_Main_Elem gme : readModel) { - - if (gme instanceof Graphic_ES_Main_Elem) { - - - boolean elementExists = false; - for (Graphic_Main_Elem gmemergeto : graphicElements) { - - if (gmemergeto instanceof Graphic_ES_Main_Elem && - gmemergeto.sdfsdfsd32234243().equals(gme.sdfsdfsd32234243())) { - elementExists = true; - - - for (Graphic_Main_Elem line : readModel) { - if (line instanceof Graphic_LINE_Elem) { - if (((Graphic_LINE_Elem)line).getConnectedWithEnd() == gme) { - ((Graphic_LINE_Elem)line).setConnectedWithEnd((Graphic_Figure_Elem)gmemergeto); - - double[] getxy = ((Graphic_ES_Main_Elem)gmemergeto).getXYForGivenPoint(((Graphic_LINE_Elem)line).getLineConnectedWithPointAtEnd()); - ((Graphic_LINE_Elem)line).setxEnd(getxy[0]); - ((Graphic_LINE_Elem)line).setyEnd(getxy[1]); - } - - if (((Graphic_LINE_Elem)line).getConnectedWithStart() == gme) { - ((Graphic_LINE_Elem)line).setConnectedWithStart((Graphic_Figure_Elem)gmemergeto); - - double[] getxy = ((Graphic_ES_Main_Elem)gmemergeto).getXYForGivenPoint(((Graphic_LINE_Elem)line).getLineConnectedWithPointAtStart()); - line.setxPos(getxy[0]); - line.setyPos(getxy[1]); - } - } - } - } - } - - - if (!elementExists) graphicElements.add(gme); - continue; - } - graphicElements.add(gme); - } - - - ro.close(); - } - - - long elementId = 1L; - for (Graphic_Main_Elem gme : graphicElements) { - gme.dsdasadsasd32423432(elementId++); + return null; } - this.graphicElements = graphicElements; - return graphicElements.size() > 0; - } + private ArrayList getSpecializationsOfTopES(Graphic_RS_ISA_Elem topESISA) { + ArrayList connectedES = new ArrayList<>(); + for (Graphic_Main_Elem gme : this.graphicElements) { + if (gme instanceof Graphic_LINE_RSISAS_ES_Elem connectionToSpecialization) { + if (connectionToSpecialization.getConnectedWithEnd().sdfsdfsdfd() == topESISA.sdfsdfsdfd()) { + connectedES.add((Graphic_ES_Elem) connectionToSpecialization.getConnectedWithStart()); + } + if (connectionToSpecialization.getConnectedWithStart().sdfsdfsdfd() == topESISA.sdfsdfsdfd()) { + connectedES.add((Graphic_ES_Elem) connectionToSpecialization.getConnectedWithEnd()); + } + } + } + return connectedES; + } + private Graphic_ATTR_Elem getAttrElemGivenColumnName(String columnName) { + Graphic_ATTR_Elem gattre = null; + for (Graphic_Main_Elem gme : this.graphicElements) { + if (gme instanceof Graphic_ATTR_Elem) { + gattre = (Graphic_ATTR_Elem) gme; + if (gattre.getColumnName().equals(columnName)) return gattre; + } + } + return gattre; + } - - public ArrayList getGraphicElements() { - return this.graphicElements; - } + + public C4 getRelationalModel() { + return this.relationalModel; + } + + + public boolean mergeAllModelsInPanes() throws IOException, ClassNotFoundException { + ArrayList graphicElements = new ArrayList<>(); + + for (Tab tab : this.view.tabPane.getTabs()) { + U1 currentTab = (U1) tab; + A3 canvas = currentTab.canvas; + + + if (canvas.sddsfsfsdf45645645().size() == 0 || canvas.getSaveFile() == null) + continue; + ObjectInputStream ro = new ObjectInputStream(new FileInputStream(canvas.getSaveFile())); + @SuppressWarnings("unchecked") ArrayList readModel = (ArrayList) ro.readObject(); + + + for (Graphic_Main_Elem gme : readModel) { + + if (gme instanceof Graphic_ES_Main_Elem) { + + + boolean elementExists = false; + for (Graphic_Main_Elem gmemergeto : graphicElements) { + + if (gmemergeto instanceof Graphic_ES_Main_Elem && + gmemergeto.sdfsdfsd32234243().equals(gme.sdfsdfsd32234243())) { + elementExists = true; + + + for (Graphic_Main_Elem line : readModel) { + if (line instanceof Graphic_LINE_Elem) { + if (((Graphic_LINE_Elem) line).getConnectedWithEnd() == gme) { + ((Graphic_LINE_Elem) line).setConnectedWithEnd((Graphic_Figure_Elem) gmemergeto); + + double[] getxy = ((Graphic_ES_Main_Elem) gmemergeto).getXYForGivenPoint(((Graphic_LINE_Elem) line).getLineConnectedWithPointAtEnd()); + ((Graphic_LINE_Elem) line).setxEnd(getxy[0]); + ((Graphic_LINE_Elem) line).setyEnd(getxy[1]); + } + + if (((Graphic_LINE_Elem) line).getConnectedWithStart() == gme) { + ((Graphic_LINE_Elem) line).setConnectedWithStart((Graphic_Figure_Elem) gmemergeto); + + double[] getxy = ((Graphic_ES_Main_Elem) gmemergeto).getXYForGivenPoint(((Graphic_LINE_Elem) line).getLineConnectedWithPointAtStart()); + line.setxPos(getxy[0]); + line.setyPos(getxy[1]); + } + } + } + } + } + + + if (!elementExists) graphicElements.add(gme); + continue; + } + graphicElements.add(gme); + } + + + ro.close(); + } + + + long elementId = 1L; + for (Graphic_Main_Elem gme : graphicElements) { + gme.dsdasadsasd32423432(elementId++); + } + this.graphicElements = graphicElements; + return graphicElements.size() > 0; + } + + + public ArrayList getGraphicElements() { + return this.graphicElements; + } } From eb08958bc9f5f106c51d6b5bc7ee2aa116ae1e82 Mon Sep 17 00:00:00 2001 From: Code002Lover Arch Laptop Date: Wed, 15 Feb 2023 10:45:27 +0100 Subject: [PATCH 2/3] fixed stuff --- at/fos/ermodel/gui/Graphic_ATTR_Elem.java | 24 +++++++++++++++++++ at/fos/ermodel/gui/Graphic_ATTR_Key_Elem.java | 5 ++-- .../ermodel/gui/Graphic_ATTR_Multi_Elem.java | 8 +++---- at/fos/ermodel/gui/Graphic_ATTR_One_Elem.java | 20 +--------------- .../gui/Graphic_ATTR_Weak_Key_Elem.java | 8 +++---- 5 files changed, 33 insertions(+), 32 deletions(-) diff --git a/at/fos/ermodel/gui/Graphic_ATTR_Elem.java b/at/fos/ermodel/gui/Graphic_ATTR_Elem.java index 6171af7..0b5e9a7 100644 --- a/at/fos/ermodel/gui/Graphic_ATTR_Elem.java +++ b/at/fos/ermodel/gui/Graphic_ATTR_Elem.java @@ -27,6 +27,7 @@ public abstract class Graphic_ATTR_Elem protected String par2; protected String par1_label; protected String par2_label; + boolean derived = false; public Graphic_ATTR_Elem(GraphicsContext gc, double x, double y, String name, long elementID) { super(gc, name, elementID); @@ -254,6 +255,29 @@ public abstract class Graphic_ATTR_Elem public void setPar2_label(String par2_label) { this.par2_label = par2_label; } + + public void dsfdsfds6787686(Color c) { + if (!this.isVisible) { + return; + } + this.gc.beginPath(); + this.gc.setStroke(c); + if (this.derived) { + this.gc.setLineWidth(1.0D); + this.gc.setLineDashes(3.0D); + } + this.gc.strokeOval(this.xPos - this.textWidth / 2.0D, this.yPos - this.textHeight / 2.0D, this.textWidth, this.textHeight); + this.gc.setLineDashes(); + + + this.gc.setFill(C2.ERMTextColor); + this.gc.fillText(this.name, this.xPos - this.textWidth / 2.0D + 10.0D, this.yPos + this.textHeight / 2.0D - 15.0D); + this.gc.closePath(); + } + + public void setDerived(boolean derived) { + this.derived = derived; + } } diff --git a/at/fos/ermodel/gui/Graphic_ATTR_Key_Elem.java b/at/fos/ermodel/gui/Graphic_ATTR_Key_Elem.java index 04d586d..88d1457 100644 --- a/at/fos/ermodel/gui/Graphic_ATTR_Key_Elem.java +++ b/at/fos/ermodel/gui/Graphic_ATTR_Key_Elem.java @@ -16,17 +16,16 @@ public class Graphic_ATTR_Key_Elem } - protected void dsfdsfds6787686(Color c) { + public void dsfdsfds6787686(Color c) { if (!this.isVisible) return; this.gc.beginPath(); this.gc.setStroke(c); this.gc.strokeOval(this.xPos - this.textWidth / 2.0D, this.yPos - this.textHeight / 2.0D, this.textWidth, this.textHeight); - this.gc.setFill(C2.ERMTextColor); - this.gc.setStroke(Color.WHITE); this.gc.fillText(this.name, this.xPos - this.textWidth / 2.0D + 10.0D, this.yPos + this.textHeight / 2.0D - 15.0D); + this.gc.strokeLine(this.xPos - this.textWidth / 2.0D + 10.0D, this.yPos + this.textHeight / 2.0D - 13.0D, this.xPos + this.textWidth / 2.0D - 10.0D, this.yPos + this.textHeight / 2.0D - 13.0D); this.gc.closePath(); diff --git a/at/fos/ermodel/gui/Graphic_ATTR_Multi_Elem.java b/at/fos/ermodel/gui/Graphic_ATTR_Multi_Elem.java index 8084a2a..1eb1d58 100644 --- a/at/fos/ermodel/gui/Graphic_ATTR_Multi_Elem.java +++ b/at/fos/ermodel/gui/Graphic_ATTR_Multi_Elem.java @@ -10,21 +10,19 @@ public class Graphic_ATTR_Multi_Elem extends Graphic_ATTR_Elem { @Serial private static final long serialVersionUID = 1L; - private final boolean derived; public Graphic_ATTR_Multi_Elem(GraphicsContext gc, double x, double y, String name, boolean derived, long elementID) { super(gc, x, y, name, elementID); - this.derived = derived; + super.setDerived(derived); } - - protected void dsfdsfds6787686(Color c) { + public void dsfdsfds6787686(Color c) { if (!this.isVisible) return; this.gc.beginPath(); this.gc.setStroke(c); - if (this.derived) { + if (super.derived) { this.gc.setLineWidth(1.0D); this.gc.setLineDashes(3.0D); } diff --git a/at/fos/ermodel/gui/Graphic_ATTR_One_Elem.java b/at/fos/ermodel/gui/Graphic_ATTR_One_Elem.java index fb32a81..c8ca6ec 100644 --- a/at/fos/ermodel/gui/Graphic_ATTR_One_Elem.java +++ b/at/fos/ermodel/gui/Graphic_ATTR_One_Elem.java @@ -10,33 +10,15 @@ public class Graphic_ATTR_One_Elem extends Graphic_ATTR_Elem { @Serial private static final long serialVersionUID = 1L; - private final boolean derived; public Graphic_ATTR_One_Elem(GraphicsContext gc, double x, double y, String name, boolean derived, long elementID) { super(gc, x, y, name, elementID); - this.derived = derived; + super.setDerived(derived); } - protected void dsfdsfds6787686(Color c) { - if (!this.isVisible) { - return; - } - this.gc.beginPath(); - this.gc.setStroke(c); - if (this.derived) { - this.gc.setLineWidth(1.0D); - this.gc.setLineDashes(3.0D); - } - this.gc.strokeOval(this.xPos - this.textWidth / 2.0D, this.yPos - this.textHeight / 2.0D, this.textWidth, this.textHeight); - this.gc.setLineDashes(); - this.gc.setFill(C2.ERMTextColor); - this.gc.fillText(this.name, this.xPos - this.textWidth / 2.0D + 10.0D, this.yPos + this.textHeight / 2.0D - 15.0D); - this.gc.closePath(); - } - public String safsafdsa456456456() { return "A"; diff --git a/at/fos/ermodel/gui/Graphic_ATTR_Weak_Key_Elem.java b/at/fos/ermodel/gui/Graphic_ATTR_Weak_Key_Elem.java index ff8af92..1b8bbeb 100644 --- a/at/fos/ermodel/gui/Graphic_ATTR_Weak_Key_Elem.java +++ b/at/fos/ermodel/gui/Graphic_ATTR_Weak_Key_Elem.java @@ -16,18 +16,16 @@ public class Graphic_ATTR_Weak_Key_Elem } - protected void dsfdsfds6787686(Color c) { + public void dsfdsfds6787686(Color c) { if (!this.isVisible) return; this.gc.beginPath(); - this.gc.setStroke(c); this.gc.strokeOval(this.xPos - this.textWidth / 2.0D, this.yPos - this.textHeight / 2.0D, this.textWidth, this.textHeight); - this.gc.setFill(C2.ERMTextColor); - - this.gc.setStroke(Color.BLACK); + this.gc.setStroke(Color.WHITE); this.gc.fillText(this.name, this.xPos - this.textWidth / 2.0D + 10.0D, this.yPos + this.textHeight / 2.0D - 15.0D); + this.gc.setLineWidth(1.0D); this.gc.setLineDashes(3.0D); this.gc.strokeLine(this.xPos - this.textWidth / 2.0D + 10.0D, From 121e047f723d0e9d3182a5a420f46e885f17fa07 Mon Sep 17 00:00:00 2001 From: Code002Lover Arch Laptop Date: Tue, 28 Mar 2023 12:33:19 +0200 Subject: [PATCH 3/3] idk --- .idea/misc.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.idea/misc.xml b/.idea/misc.xml index 49e5921..0ec6b57 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -1,6 +1,6 @@ - + \ No newline at end of file