From ebe718df2bbec85495d78fe28ce646dff0d86ab4 Mon Sep 17 00:00:00 2001 From: Lee <irina.lee@etu.upmc.fr> Date: Thu, 12 Jul 2018 22:43:24 +0200 Subject: [PATCH] added new component : module (eln) --- src/main/java/ui/ActionPerformer.java | 2 + src/main/java/ui/TGComponentManager.java | 6 + src/main/java/ui/TGUIAction.java | 4 +- src/main/java/ui/eln/ELNDiagramToolBar.java | 11 +- src/main/java/ui/eln/ELNModule.java | 199 ++++++++++++++++++ .../ui/eln/sca_eln/ELNComponentCapacitor.java | 20 ++ .../sca_eln/ELNComponentIdealTransformer.java | 20 ++ .../ELNComponentIndependentCurrentSource.java | 20 ++ .../ELNComponentIndependentVoltageSource.java | 20 ++ .../ui/eln/sca_eln/ELNComponentInductor.java | 20 ++ .../ui/eln/sca_eln/ELNComponentNodeRef.java | 21 ++ .../ui/eln/sca_eln/ELNComponentResistor.java | 20 ++ .../sca_eln/ELNComponentTransmissionLine.java | 20 ++ ...mponentVoltageControlledCurrentSource.java | 20 ++ ...mponentVoltageControlledVoltageSource.java | 20 ++ 15 files changed, 419 insertions(+), 4 deletions(-) create mode 100644 src/main/java/ui/eln/ELNModule.java diff --git a/src/main/java/ui/ActionPerformer.java b/src/main/java/ui/ActionPerformer.java index eee1f68aad..0705e6e0cd 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 2a8d21ad72..d3152b2a23 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 ed8ef25afa..3a12f21a0b 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 612a161b2c..e4654add84 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 0000000000..7a1a6b9986 --- /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 8853d09a3c..ea2504effe 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 d9fe04d95b..ece4f8dc60 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 33d64694b3..f6da94c2c7 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 7f711a6ead..fb73a46a4b 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 470383016b..64780a38de 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 dcc644de94..ce80540ea2 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 068cb7a988..f6693bacd9 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 c41ef05d45..08fe7876aa 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 76b1306958..b53dc02644 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 86acccca36..3f2f0d9dbb 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 -- GitLab