This commit is contained in:
Mystikfluu 2023-03-28 20:59:04 +02:00
commit 148713635f
7 changed files with 83 additions and 115 deletions

2
.idea/misc.xml generated
View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<project version="4"> <project version="4">
<component name="ProjectRootManager" version="2" languageLevel="JDK_17" default="true" project-jdk-name="azul-17 (2)" project-jdk-type="JavaSDK"> <component name="ProjectRootManager" version="2" languageLevel="JDK_17" project-jdk-name="azul-17 (2)" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/out" /> <output url="file://$PROJECT_DIR$/out" />
</component> </component>
</project> </project>

View File

@ -27,6 +27,7 @@ public abstract class Graphic_ATTR_Elem
protected String par2; protected String par2;
protected String par1_label; protected String par1_label;
protected String par2_label; protected String par2_label;
boolean derived = false;
public Graphic_ATTR_Elem(GraphicsContext gc, double x, double y, String name, long elementID) { public Graphic_ATTR_Elem(GraphicsContext gc, double x, double y, String name, long elementID) {
super(gc, name, elementID); super(gc, name, elementID);
@ -254,6 +255,29 @@ public abstract class Graphic_ATTR_Elem
public void setPar2_label(String par2_label) { public void setPar2_label(String par2_label) {
this.par2_label = 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;
}
} }

View File

@ -16,17 +16,16 @@ public class Graphic_ATTR_Key_Elem
} }
protected void dsfdsfds6787686(Color c) { public void dsfdsfds6787686(Color c) {
if (!this.isVisible) if (!this.isVisible)
return; return;
this.gc.beginPath(); this.gc.beginPath();
this.gc.setStroke(c); 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.strokeOval(this.xPos - this.textWidth / 2.0D, this.yPos - this.textHeight / 2.0D, this.textWidth, this.textHeight);
this.gc.setFill(C2.ERMTextColor); this.gc.setFill(C2.ERMTextColor);
this.gc.setStroke(Color.WHITE);
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.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.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.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(); this.gc.closePath();

View File

@ -10,21 +10,19 @@ public class Graphic_ATTR_Multi_Elem
extends Graphic_ATTR_Elem { extends Graphic_ATTR_Elem {
@Serial @Serial
private static final long serialVersionUID = 1L; 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) { public Graphic_ATTR_Multi_Elem(GraphicsContext gc, double x, double y, String name, boolean derived, long elementID) {
super(gc, x, y, name, elementID); super(gc, x, y, name, elementID);
this.derived = derived; super.setDerived(derived);
} }
public void dsfdsfds6787686(Color c) {
protected void dsfdsfds6787686(Color c) {
if (!this.isVisible) if (!this.isVisible)
return; return;
this.gc.beginPath(); this.gc.beginPath();
this.gc.setStroke(c); this.gc.setStroke(c);
if (this.derived) { if (super.derived) {
this.gc.setLineWidth(1.0D); this.gc.setLineWidth(1.0D);
this.gc.setLineDashes(3.0D); this.gc.setLineDashes(3.0D);
} }
@ -38,7 +36,6 @@ public class Graphic_ATTR_Multi_Elem
this.gc.closePath(); this.gc.closePath();
} }
public String safsafdsa456456456() { public String safsafdsa456456456() {
return "A-M"; return "A-M";
} }

View File

@ -1,7 +1,6 @@
package at.fos.ermodel.gui; package at.fos.ermodel.gui;
import javafx.scene.canvas.GraphicsContext; import javafx.scene.canvas.GraphicsContext;
import javafx.scene.paint.Color;
import java.io.Serial; import java.io.Serial;
@ -10,34 +9,12 @@ public class Graphic_ATTR_One_Elem
extends Graphic_ATTR_Elem { extends Graphic_ATTR_Elem {
@Serial @Serial
private static final long serialVersionUID = 1L; 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) { public Graphic_ATTR_One_Elem(GraphicsContext gc, double x, double y, String name, boolean derived, long elementID) {
super(gc, x, y, name, 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() { public String safsafdsa456456456() {
return "A"; return "A";
} }

View File

@ -16,18 +16,16 @@ public class Graphic_ATTR_Weak_Key_Elem
} }
protected void dsfdsfds6787686(Color c) { public void dsfdsfds6787686(Color c) {
if (!this.isVisible) if (!this.isVisible)
return; return;
this.gc.beginPath(); this.gc.beginPath();
this.gc.setStroke(c); 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.strokeOval(this.xPos - this.textWidth / 2.0D, this.yPos - this.textHeight / 2.0D, this.textWidth, this.textHeight);
this.gc.setFill(C2.ERMTextColor); this.gc.setFill(C2.ERMTextColor);
this.gc.setStroke(Color.WHITE);
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.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.setLineWidth(1.0D);
this.gc.setLineDashes(3.0D); this.gc.setLineDashes(3.0D);
this.gc.strokeLine(this.xPos - this.textWidth / 2.0D + 10.0D, this.gc.strokeLine(this.xPos - this.textWidth / 2.0D + 10.0D,

View File

@ -516,21 +516,7 @@ public class ZZ30 {
if (oneToOne) { if (oneToOne) {
boolean keyCorrect = true; if (handleKey(grsem)) return false;
ArrayList<Graphic_Main_Elem> 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;
}
Graphic_ES_Main_Elem es_min_1_side; Graphic_ES_Main_Elem es_min_1_side;
@ -554,52 +540,9 @@ public class ZZ30 {
T1 tableRS = this.relationalModel.getTableGivenNumber(grsem.sdfsdfsdfd()); T1 tableRS = this.relationalModel.getTableGivenNumber(grsem.sdfsdfsdfd());
T1 tableES = this.relationalModel.getTableGivenNumber(es_min_0_side.sdfsdfsdfd()); addTableC3(es_min_1_side, es_min_0_side, tableRS);
ArrayList<C3> 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) { if (bothSides_min_1) {
addTableC3(es_min_0_side, es_min_1_side, tableRS);
T1 tableES_1 = this.relationalModel.getTableGivenNumber(es_min_1_side.sdfsdfsdfd());
ArrayList<C3> 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);
}
} }
@ -609,21 +552,7 @@ public class ZZ30 {
if (oneToMany) { if (oneToMany) {
boolean keyCorrect = true; if (handleKey(grsem)) return false;
ArrayList<Graphic_Main_Elem> 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;
}
T1 tableRS = this.relationalModel.getTableGivenNumber(grsem.sdfsdfsdfd()); T1 tableRS = this.relationalModel.getTableGivenNumber(grsem.sdfsdfsdfd());
@ -784,6 +713,50 @@ public class ZZ30 {
return true; return true;
} }
private boolean handleKey(Graphic_RS_Main_Elem grsem) {
boolean keyCorrect = true;
ArrayList<Graphic_Main_Elem> 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<C3> 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<Graphic_Main_Elem> getAttributes(Graphic_Main_Elem gme) { private ArrayList<Graphic_Main_Elem> getAttributes(Graphic_Main_Elem gme) {
ArrayList<Graphic_Main_Elem> attributes = new ArrayList<>(); ArrayList<Graphic_Main_Elem> attributes = new ArrayList<>();