diff --git a/.idea/misc.xml b/.idea/misc.xml index d3d7b97..604d27e 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -1,6 +1,6 @@ - + \ 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 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 3ba55ac..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.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.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..80f033f 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); } @@ -38,7 +36,6 @@ public class Graphic_ATTR_Multi_Elem this.gc.closePath(); } - 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 fb32a81..73fa455 100644 --- a/at/fos/ermodel/gui/Graphic_ATTR_One_Elem.java +++ b/at/fos/ermodel/gui/Graphic_ATTR_One_Elem.java @@ -1,7 +1,6 @@ package at.fos.ermodel.gui; import javafx.scene.canvas.GraphicsContext; -import javafx.scene.paint.Color; import java.io.Serial; @@ -10,34 +9,12 @@ 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, diff --git a/at/fos/ermodel/gui/ZZ30.java b/at/fos/ermodel/gui/ZZ30.java index 13fa1ff..c84cd60 100644 --- a/at/fos/ermodel/gui/ZZ30.java +++ b/at/fos/ermodel/gui/ZZ30.java @@ -516,21 +516,7 @@ public class ZZ30 { if (oneToOne) { - 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) { - - - this.view.verticalBox.getChildren().clear(); - this.view.generateRelationalModelCB.setSelected(false); - return false; - } + if (handleKey(grsem)) return false; Graphic_ES_Main_Elem es_min_1_side; @@ -554,52 +540,9 @@ public class ZZ30 { 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); - } + addTableC3(es_min_1_side, es_min_0_side, tableRS); 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); - } + addTableC3(es_min_0_side, es_min_1_side, tableRS); } @@ -609,21 +552,7 @@ public class ZZ30 { 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) { - - - this.view.verticalBox.getChildren().clear(); - this.view.generateRelationalModelCB.setSelected(false); - return false; - } + if (handleKey(grsem)) return false; T1 tableRS = this.relationalModel.getTableGivenNumber(grsem.sdfsdfsdfd()); @@ -784,6 +713,50 @@ public class ZZ30 { 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 (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(), + + null, + null, + null); + table_1_side.addColumn(column); + } + } + private ArrayList getAttributes(Graphic_Main_Elem gme) { ArrayList attributes = new ArrayList<>();