diff --git a/src/main/java/ui/ActionPerformer.java b/src/main/java/ui/ActionPerformer.java index eee1f68aadd85ff932b6fc0cb8ffa37739d985bb..0705e6e0cdaf4528a332a2c85b0785c5cb2c1000 100644 --- a/src/main/java/ui/ActionPerformer.java +++ b/src/main/java/ui/ActionPerformer.java @@ -961,6 +961,8 @@ public class ActionPerformer { mgui.actionOnButton(TGComponentManager.COMPONENT, TGComponentManager.ELN_TDF_VOLTAGE_SINK); } else if (command.equals(mgui.actions[TGUIAction.ELN_TDF_CURRENT_SINK].getActionCommand())){ mgui.actionOnButton(TGComponentManager.COMPONENT, TGComponentManager.ELN_TDF_CURRENT_SINK); + } else if (command.equals(mgui.actions[TGUIAction.ELN_MODULE].getActionCommand())){ + mgui.actionOnButton(TGComponentManager.COMPONENT, TGComponentManager.ELN_MODULE); // Attack Tree Diagrams } else if (command.equals(mgui.actions[TGUIAction.ATD_BLOCK].getActionCommand())) { diff --git a/src/main/java/ui/TGComponentManager.java b/src/main/java/ui/TGComponentManager.java index 2a8d21ad7224fb715ec5878c5f9f385a75a5852f..d3152b2a23df791e8f5b59a645fd0d41815d4e4b 100644 --- a/src/main/java/ui/TGComponentManager.java +++ b/src/main/java/ui/TGComponentManager.java @@ -361,6 +361,7 @@ public class TGComponentManager { public static final int ELN_NODE_REF = 1621; public static final int ELN_TDF_VOLTAGE_SINK = 1622; public static final int ELN_TDF_CURRENT_SINK = 1623; + public static final int ELN_MODULE = 1624; // SMD diagram public static final int PROSMD_START_STATE = 2000; @@ -1322,6 +1323,9 @@ public class TGComponentManager { case ELN_TDF_CURRENT_SINK: tgc = new ELNComponentCurrentSinkTDF(x, y, tdp.getMinX(), tdp.getMaxX(), tdp.getMinY(), tdp.getMaxY(), false, null, tdp); break; + case ELN_MODULE: + tgc = new ELNModule(x, y, tdp.getMinX(), tdp.getMaxX(), tdp.getMinY(), tdp.getMaxY(), false, null, tdp); + break; // Communication patterns + SD case TMLCP_CHOICE: tgc = new TMLCPChoice(x, y, tdp.getMinX(), tdp.getMaxX(), tdp.getMinY(), tdp.getMaxY(), false, null, tdp); @@ -1750,6 +1754,8 @@ public class TGComponentManager { return ELN_TDF_VOLTAGE_SINK; } else if (tgc instanceof ELNComponentCurrentSinkTDF) { return ELN_TDF_CURRENT_SINK; + } else if (tgc instanceof ELNModule) { + return ELN_MODULE; // Others } else if (tgc instanceof TADDeterministicDelay) { diff --git a/src/main/java/ui/TGUIAction.java b/src/main/java/ui/TGUIAction.java index ed8ef25afa2792514da9938b90dd5c1e979d4d13..3a12f21a0ba93e67a666f173a850d0de6e72f473 100644 --- a/src/main/java/ui/TGUIAction.java +++ b/src/main/java/ui/TGUIAction.java @@ -301,6 +301,7 @@ public class TGUIAction extends AbstractAction { public static final int ELN_NODE_REF = 494; public static final int ELN_TDF_VOLTAGE_SINK = 495; public static final int ELN_TDF_CURRENT_SINK = 496; + public static final int ELN_MODULE = 498; public static final int EBRDD_EDIT = 271; public static final int EBRDD_CONNECTOR = 272; @@ -655,7 +656,7 @@ public class TGUIAction extends AbstractAction { public static final int MOVE_ENABLED = 463; public static final int FIRST_DIAGRAM = 464; - public static final int NB_ACTION = 498; + public static final int NB_ACTION = 499; private static final TAction [] actions = new TAction[NB_ACTION]; @@ -1175,6 +1176,7 @@ public class TGUIAction extends AbstractAction { actions[ELN_NODE_REF] = new TAction("eln-node-ref", "Add a reference node", IconManager.imgic8029, IconManager.imgic8029, "Reference node", "Add a reference node to the currently opened ELN Diagram", 0); actions[ELN_TDF_VOLTAGE_SINK] = new TAction("eln-tdf-vsink", "Add a conversion voltage to a TDF output signal", IconManager.imgic8030, IconManager.imgic8030, "Converts voltage to a TDF output signal", "Add a converts voltage to a TDF output signal to the currently opened ELN Diagram", 0); actions[ELN_TDF_CURRENT_SINK] = new TAction("eln-tdf-isink", "Add a conversion current to a TDF output signal", IconManager.imgic8031, IconManager.imgic8031, "Converts current to a TDF output signal", "Add a converts current to a TDF output signal to the currently opened ELN Diagram", 0); + actions[ELN_MODULE] = new TAction("eln-module", "Add a SystemC module", IconManager.imgic8006, IconManager.imgic8006, "SystemC module", "Add a SystemC module to the currently opened ELN Diagram", 0); //ProActive State Machine Diagram actions[PROSMD_EDIT] = new TAction("edit-prosmd-diagram", "Edit ProActive state machine diagram", IconManager.imgic100, IconManager.imgic101, "Edit ProActive state machine diagram", "Make it possible to edit the currently opened ProActive state machine diagram", 0); diff --git a/src/main/java/ui/eln/ELNDiagramToolBar.java b/src/main/java/ui/eln/ELNDiagramToolBar.java index 612a161b2ca220459f039b49edc3733b3bf9188a..e4654add8463c0afda3a2051aafa49056893ae2c 100644 --- a/src/main/java/ui/eln/ELNDiagramToolBar.java +++ b/src/main/java/ui/eln/ELNDiagramToolBar.java @@ -80,7 +80,8 @@ public class ELNDiagramToolBar extends TToolBar { mgui.actions[TGUIAction.ELN_NODE_REF].setEnabled(b); mgui.actions[TGUIAction.ELN_TDF_VOLTAGE_SINK].setEnabled(b); mgui.actions[TGUIAction.ELN_TDF_CURRENT_SINK].setEnabled(b); - + mgui.actions[TGUIAction.ELN_MODULE].setEnabled(b); + mgui.actions[TGUIAction.ACT_MODEL_CHECKING].setEnabled(b); mgui.actions[TGUIAction.ACT_ONECLICK_LOTOS_RG].setEnabled(b); mgui.actions[TGUIAction.ACT_SIMU_SYSTEMC].setEnabled(b); @@ -100,6 +101,11 @@ public class ELNDiagramToolBar extends TToolBar { this.addSeparator(); + button = this.add(mgui.actions[TGUIAction.ELN_MODULE]); + button.addMouseListener(mgui.mouseHandler); + + this.addSeparator(); + button = this.add(mgui.actions[TGUIAction.ELN_RESISTOR]); button.addMouseListener(mgui.mouseHandler); @@ -143,5 +149,4 @@ public class ELNDiagramToolBar extends TToolBar { button = this.add(mgui.actions[TGUIAction.ELN_CONNECTOR]); button.addMouseListener(mgui.mouseHandler); } -} - +} \ No newline at end of file diff --git a/src/main/java/ui/eln/ELNModule.java b/src/main/java/ui/eln/ELNModule.java new file mode 100644 index 0000000000000000000000000000000000000000..7a1a6b998656c66bee6baeb6b02c8f50d75e2a1c --- /dev/null +++ b/src/main/java/ui/eln/ELNModule.java @@ -0,0 +1,199 @@ +/* Copyright or (C) or Copr. GET / ENST, Telecom-Paris, Ludovic Apvrille + * + * ludovic.apvrille AT enst.fr + * + * This software is a computer program whose purpose is to allow the + * edition of TURTLE analysis, design and deployment diagrams, to + * allow the generation of RT-LOTOS or Java code from this diagram, + * and at last to allow the analysis of formal validation traces + * obtained from external tools, e.g. RTL from LAAS-CNRS and CADP + * from INRIA Rhone-Alpes. + * + * This software is governed by the CeCILL license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL license and that you accept its terms. + */ + +package ui.eln; + +import myutil.GraphicLib; +import ui.*; +import ui.eln.sca_eln.ELNComponentNodeRef; + +import java.awt.*; + +/** + * Class ELNComponentCapacitor + * Capacitor to be used in ELN diagrams + * Creation: 12/06/2018 + * @version 1.0 12/06/2018 + * @author Irina Kit Yan LEE + */ + +public class ELNModule extends TGCScalableWithInternalComponent implements SwallowTGComponent { + protected Color myColor; + protected int orientation; + private int maxFontSize = 14; + private int minFontSize = 4; + private int currentFontSize = -1; + + private int textX = 15; + private double dtextX = 0.0; + protected int decPoint = 3; + + public ELNModule(int _x, int _y, int _minX, int _maxX, int _minY, int _maxY, boolean _pos, TGComponent _father, TDiagramPanel _tdp) { + super(_x, _y, _minX, _maxX, _minY, _maxY, _pos, _father, _tdp); + + initScaling(250, 200); + + dtextX = textX * oldScaleFactor; + textX = (int) dtextX; + dtextX = dtextX - textX; + + minWidth = 1; + minHeight = 1; + + addTGConnectingPointsComment(); + + moveable = true; + editable = true; + removable = true; + userResizable = false; + value = tdp.findELNComponentName("Module_"); + } + + public Color getMyColor() { + return myColor; + } + + public void internalDrawing(Graphics g) { + int w; + Font f = g.getFont(); + Font fold = f; + + if (myColor == null) { + myColor = Color.white; + } + + if (this.rescaled && !this.tdp.isScaled()) { + this.rescaled = false; + int maxCurrentFontSize = Math.max(0, Math.min(this.height, (int) (this.maxFontSize * this.tdp.getZoom()))); + f = f.deriveFont((float) maxCurrentFontSize); + + while (maxCurrentFontSize > (this.minFontSize * this.tdp.getZoom() - 1)) { + if (g.getFontMetrics().stringWidth(value) < (width - (2 * textX))) { + break; + } + maxCurrentFontSize--; + f = f.deriveFont((float) maxCurrentFontSize); + } + + if (this.currentFontSize < this.minFontSize * this.tdp.getZoom()) { + maxCurrentFontSize++; + f = f.deriveFont((float) maxCurrentFontSize); + } + g.setFont(f); + this.currentFontSize = maxCurrentFontSize; + } else { + f = f.deriveFont(this.currentFontSize); + } + + Color col = g.getColor(); + g.drawRect(x, y, width, height); + if ((width > 2) && (height > 2)) { + g.setColor(myColor); + g.fillRect(x+1, y+1, width-1, height-1); + g.setColor(col); + } + + int attributeFontSize = this.currentFontSize * 5 / 6; + g.setFont(f.deriveFont((float) attributeFontSize)); + g.setFont(f); + w = g.getFontMetrics().stringWidth(value); + if (!(w < (width - 2 * textX))) { + g.drawString(value, x + textX + 1, y + currentFontSize + textX); + } else { + g.drawString(value, x + (width - w)/2, y + currentFontSize + textX); + } + + g.setFont(fold); + } + + public TGComponent isOnOnlyMe(int _x, int _y) { + if (GraphicLib.isInRectangle(_x, _y, x, y, width, height)) { + return this; + } + return null; + } + + public int getType() { + return TGComponentManager.ELN_MODULE; + } + + public int getDefaultConnector() { + return TGComponentManager.ELN_CONNECTOR; + } + + public boolean acceptSwallowedTGComponent(TGComponent tgc) { + if (tgc instanceof ELNComponent) { + return true; + } + if (tgc instanceof ELNComponentNodeRef) { + return true; + } + return false; + } + + public boolean addSwallowedTGComponent(TGComponent tgc, int x, int y) { + if (tgc instanceof ELNComponent) { + tgc.setFather(this); + tgc.setDrawingZone(true); + tgc.resizeWithFather(); + addInternalComponent(tgc, 0); + return true; + } + if (tgc instanceof ELNComponentNodeRef) { + tgc.setFather(this); + tgc.setDrawingZone(true); + tgc.resizeWithFather(); + addInternalComponent(tgc, 0); + return true; + } + return false; + } + + public void removeSwallowedTGComponent(TGComponent tgc) { + removeInternalComponent(tgc); + } + + public void hasBeenResized() { + rescaled = true; + for (int i = 0; i < nbInternalTGComponent; i++) { + if (tgcomponent[i] instanceof ELNComponent) { + tgcomponent[i].resizeWithFather(); + } + } + } +} \ No newline at end of file diff --git a/src/main/java/ui/eln/sca_eln/ELNComponentCapacitor.java b/src/main/java/ui/eln/sca_eln/ELNComponentCapacitor.java index 8853d09a3ce4c4476cba37770829c0b0f6fe8cf1..ea2504effe090d3b96f9b83c04e3eccaf8dfb129 100644 --- a/src/main/java/ui/eln/sca_eln/ELNComponentCapacitor.java +++ b/src/main/java/ui/eln/sca_eln/ELNComponentCapacitor.java @@ -756,4 +756,24 @@ public class ELNComponentCapacitor extends TGCScalableWithInternalComponent impl } } } + + public void resizeWithFather() { + if ((father != null) && (father instanceof ELNModule)) { + resizeToFatherSize(); + + setCdRectangle(0, father.getWidth() - getWidth(), 0, father.getHeight() - getHeight()); + setMoveCd(x, y); + } + } + + public void wasSwallowed() { + myColor = null; + } + + public void wasUnswallowed() { + myColor = null; + setFather(null); + TDiagramPanel tdp = getTDiagramPanel(); + setCdRectangle(tdp.getMinX(), tdp.getMaxX(), tdp.getMinY(), tdp.getMaxY()); + } } \ No newline at end of file diff --git a/src/main/java/ui/eln/sca_eln/ELNComponentIdealTransformer.java b/src/main/java/ui/eln/sca_eln/ELNComponentIdealTransformer.java index d9fe04d95b87667baa2754538beb052d6028e24f..ece4f8dc6007276079d5344a7cd49c3f5fe4587d 100644 --- a/src/main/java/ui/eln/sca_eln/ELNComponentIdealTransformer.java +++ b/src/main/java/ui/eln/sca_eln/ELNComponentIdealTransformer.java @@ -1020,4 +1020,24 @@ public class ELNComponentIdealTransformer extends TGCScalableWithInternalCompone } } } + + public void resizeWithFather() { + if ((father != null) && (father instanceof ELNModule)) { + resizeToFatherSize(); + + setCdRectangle(0, father.getWidth() - getWidth(), 0, father.getHeight() - getHeight()); + setMoveCd(x, y); + } + } + + public void wasSwallowed() { + myColor = null; + } + + public void wasUnswallowed() { + myColor = null; + setFather(null); + TDiagramPanel tdp = getTDiagramPanel(); + setCdRectangle(tdp.getMinX(), tdp.getMaxX(), tdp.getMinY(), tdp.getMaxY()); + } } \ No newline at end of file diff --git a/src/main/java/ui/eln/sca_eln/ELNComponentIndependentCurrentSource.java b/src/main/java/ui/eln/sca_eln/ELNComponentIndependentCurrentSource.java index 33d64694b318fdb6054db9d360ec7c5598aea29c..f6da94c2c7335d5750f6726cc2dd85924a2bb3d1 100644 --- a/src/main/java/ui/eln/sca_eln/ELNComponentIndependentCurrentSource.java +++ b/src/main/java/ui/eln/sca_eln/ELNComponentIndependentCurrentSource.java @@ -976,4 +976,24 @@ public class ELNComponentIndependentCurrentSource extends TGCScalableWithInterna } } } + + public void resizeWithFather() { + if ((father != null) && (father instanceof ELNModule)) { + resizeToFatherSize(); + + setCdRectangle(0, father.getWidth() - getWidth(), 0, father.getHeight() - getHeight()); + setMoveCd(x, y); + } + } + + public void wasSwallowed() { + myColor = null; + } + + public void wasUnswallowed() { + myColor = null; + setFather(null); + TDiagramPanel tdp = getTDiagramPanel(); + setCdRectangle(tdp.getMinX(), tdp.getMaxX(), tdp.getMinY(), tdp.getMaxY()); + } } \ No newline at end of file diff --git a/src/main/java/ui/eln/sca_eln/ELNComponentIndependentVoltageSource.java b/src/main/java/ui/eln/sca_eln/ELNComponentIndependentVoltageSource.java index 7f711a6eadcc12750b46ab0e75bc8c2a75b5fd14..fb73a46a4ba9fa9ed80d41989c9dfefd38bcbec3 100644 --- a/src/main/java/ui/eln/sca_eln/ELNComponentIndependentVoltageSource.java +++ b/src/main/java/ui/eln/sca_eln/ELNComponentIndependentVoltageSource.java @@ -948,4 +948,24 @@ public class ELNComponentIndependentVoltageSource extends TGCScalableWithInterna } } } + + public void resizeWithFather() { + if ((father != null) && (father instanceof ELNModule)) { + resizeToFatherSize(); + + setCdRectangle(0, father.getWidth() - getWidth(), 0, father.getHeight() - getHeight()); + setMoveCd(x, y); + } + } + + public void wasSwallowed() { + myColor = null; + } + + public void wasUnswallowed() { + myColor = null; + setFather(null); + TDiagramPanel tdp = getTDiagramPanel(); + setCdRectangle(tdp.getMinX(), tdp.getMaxX(), tdp.getMinY(), tdp.getMaxY()); + } } \ No newline at end of file diff --git a/src/main/java/ui/eln/sca_eln/ELNComponentInductor.java b/src/main/java/ui/eln/sca_eln/ELNComponentInductor.java index 470383016b6234054edb49426df6ebf42a5245d0..64780a38de25aafbadef96ca842f3a1da920c2ff 100644 --- a/src/main/java/ui/eln/sca_eln/ELNComponentInductor.java +++ b/src/main/java/ui/eln/sca_eln/ELNComponentInductor.java @@ -780,4 +780,24 @@ public class ELNComponentInductor extends TGCScalableWithInternalComponent imple } } } + + public void resizeWithFather() { + if ((father != null) && (father instanceof ELNModule)) { + resizeToFatherSize(); + + setCdRectangle(0, father.getWidth() - getWidth(), 0, father.getHeight() - getHeight()); + setMoveCd(x, y); + } + } + + public void wasSwallowed() { + myColor = null; + } + + public void wasUnswallowed() { + myColor = null; + setFather(null); + TDiagramPanel tdp = getTDiagramPanel(); + setCdRectangle(tdp.getMinX(), tdp.getMaxX(), tdp.getMinY(), tdp.getMaxY()); + } } \ No newline at end of file diff --git a/src/main/java/ui/eln/sca_eln/ELNComponentNodeRef.java b/src/main/java/ui/eln/sca_eln/ELNComponentNodeRef.java index dcc644de94b42241920ae8767a13138e35c4e480..ce80540ea297eeeda3c631331dcc75e7ff58fe61 100644 --- a/src/main/java/ui/eln/sca_eln/ELNComponentNodeRef.java +++ b/src/main/java/ui/eln/sca_eln/ELNComponentNodeRef.java @@ -45,6 +45,7 @@ import org.w3c.dom.Node; import org.w3c.dom.NodeList; import ui.*; import ui.eln.ELNConnectingPoint; +import ui.eln.ELNModule; import ui.window.JDialogELNComponentNodeRef; import javax.swing.*; import java.awt.*; @@ -562,4 +563,24 @@ public class ELNComponentNodeRef extends TGCScalableWithInternalComponent implem public void setFirst(boolean _first) { first = _first; } + + public void resizeWithFather() { + if ((father != null) && (father instanceof ELNModule)) { + resizeToFatherSize(); + + setCdRectangle(0, father.getWidth() - getWidth(), 0, father.getHeight() - getHeight()); + setMoveCd(x, y); + } + } + + public void wasSwallowed() { + myColor = null; + } + + public void wasUnswallowed() { + myColor = null; + setFather(null); + TDiagramPanel tdp = getTDiagramPanel(); + setCdRectangle(tdp.getMinX(), tdp.getMaxX(), tdp.getMinY(), tdp.getMaxY()); + } } \ No newline at end of file diff --git a/src/main/java/ui/eln/sca_eln/ELNComponentResistor.java b/src/main/java/ui/eln/sca_eln/ELNComponentResistor.java index 068cb7a9885cc1334b1ce6fa4073a8b36e9cbb8e..f6693bacd9cd74270553946b8dc381ff7ea51769 100644 --- a/src/main/java/ui/eln/sca_eln/ELNComponentResistor.java +++ b/src/main/java/ui/eln/sca_eln/ELNComponentResistor.java @@ -733,4 +733,24 @@ public class ELNComponentResistor extends TGCScalableWithInternalComponent imple } } } + + public void resizeWithFather() { + if ((father != null) && (father instanceof ELNModule)) { + resizeToFatherSize(); + + setCdRectangle(0, father.getWidth() - getWidth(), 0, father.getHeight() - getHeight()); + setMoveCd(x, y); + } + } + + public void wasSwallowed() { + myColor = null; + } + + public void wasUnswallowed() { + myColor = null; + setFather(null); + TDiagramPanel tdp = getTDiagramPanel(); + setCdRectangle(tdp.getMinX(), tdp.getMaxX(), tdp.getMinY(), tdp.getMaxY()); + } } \ No newline at end of file diff --git a/src/main/java/ui/eln/sca_eln/ELNComponentTransmissionLine.java b/src/main/java/ui/eln/sca_eln/ELNComponentTransmissionLine.java index c41ef05d454137e6751590f89332b41e570dcddc..08fe7876aae5322d11b1b262cf20253b3a43f7b4 100644 --- a/src/main/java/ui/eln/sca_eln/ELNComponentTransmissionLine.java +++ b/src/main/java/ui/eln/sca_eln/ELNComponentTransmissionLine.java @@ -936,4 +936,24 @@ public class ELNComponentTransmissionLine extends TGCScalableWithInternalCompone } } } + + public void resizeWithFather() { + if ((father != null) && (father instanceof ELNModule)) { + resizeToFatherSize(); + + setCdRectangle(0, father.getWidth() - getWidth(), 0, father.getHeight() - getHeight()); + setMoveCd(x, y); + } + } + + public void wasSwallowed() { + myColor = null; + } + + public void wasUnswallowed() { + myColor = null; + setFather(null); + TDiagramPanel tdp = getTDiagramPanel(); + setCdRectangle(tdp.getMinX(), tdp.getMaxX(), tdp.getMinY(), tdp.getMaxY()); + } } \ No newline at end of file diff --git a/src/main/java/ui/eln/sca_eln/ELNComponentVoltageControlledCurrentSource.java b/src/main/java/ui/eln/sca_eln/ELNComponentVoltageControlledCurrentSource.java index 76b13069584ab5a6faa2770c58145555be498fe4..b53dc0264466ac14a20a6205dbe3944a5d733360 100644 --- a/src/main/java/ui/eln/sca_eln/ELNComponentVoltageControlledCurrentSource.java +++ b/src/main/java/ui/eln/sca_eln/ELNComponentVoltageControlledCurrentSource.java @@ -1138,4 +1138,24 @@ public class ELNComponentVoltageControlledCurrentSource extends TGCScalableWithI } } } + + public void resizeWithFather() { + if ((father != null) && (father instanceof ELNModule)) { + resizeToFatherSize(); + + setCdRectangle(0, father.getWidth() - getWidth(), 0, father.getHeight() - getHeight()); + setMoveCd(x, y); + } + } + + public void wasSwallowed() { + myColor = null; + } + + public void wasUnswallowed() { + myColor = null; + setFather(null); + TDiagramPanel tdp = getTDiagramPanel(); + setCdRectangle(tdp.getMinX(), tdp.getMaxX(), tdp.getMinY(), tdp.getMaxY()); + } } \ No newline at end of file diff --git a/src/main/java/ui/eln/sca_eln/ELNComponentVoltageControlledVoltageSource.java b/src/main/java/ui/eln/sca_eln/ELNComponentVoltageControlledVoltageSource.java index 86acccca36c86bba5d81cb72ecfc27ffaef99544..3f2f0d9dbb1743b286fba1042f7c8e02371232a1 100644 --- a/src/main/java/ui/eln/sca_eln/ELNComponentVoltageControlledVoltageSource.java +++ b/src/main/java/ui/eln/sca_eln/ELNComponentVoltageControlledVoltageSource.java @@ -1121,4 +1121,24 @@ public class ELNComponentVoltageControlledVoltageSource extends TGCScalableWithI } } } + + public void resizeWithFather() { + if ((father != null) && (father instanceof ELNModule)) { + resizeToFatherSize(); + + setCdRectangle(0, father.getWidth() - getWidth(), 0, father.getHeight() - getHeight()); + setMoveCd(x, y); + } + } + + public void wasSwallowed() { + myColor = null; + } + + public void wasUnswallowed() { + myColor = null; + setFather(null); + TDiagramPanel tdp = getTDiagramPanel(); + setCdRectangle(tdp.getMinX(), tdp.getMaxX(), tdp.getMinY(), tdp.getMaxY()); + } } \ No newline at end of file