diff --git a/src/main/java/ui/eln/ELNComponentDiode.java b/src/main/java/ui/eln/ELNComponentDiode.java deleted file mode 100644 index d5ad9a1de331fe12b70afff8a35c8ead966d6e6d..0000000000000000000000000000000000000000 --- a/src/main/java/ui/eln/ELNComponentDiode.java +++ /dev/null @@ -1,305 +0,0 @@ -/* 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 org.w3c.dom.Element; -import org.w3c.dom.Node; -import org.w3c.dom.NodeList; -import ui.*; -import ui.util.IconManager; -import ui.window.JDialogELNComponentDiode; - -import javax.swing.*; -import java.awt.*; - -/** - * Class ELNComponentDiode - * Diode to be used in ELN diagrams - * Creation: 12/06/2018 - * @version 1.0 12/06/2018 - * @author Irina Kit Yan LEE - */ - -public class ELNComponentDiode extends TGCScalableWithInternalComponent { - protected Color myColor; - protected int orientation; - private int maxFontSize = 14; - private int minFontSize = 4; - private int currentFontSize = -1; -// protected int oldx, oldy; -// protected int currentOrientation = GraphicLib.NORTH; - - private int textX = 15; // border for ports - private double dtextX = 0.0; - protected int decPoint = 3; - - private int fact = 2; - - // Parameters - private int val; - private String unit; - - public ELNComponentDiode(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(40*fact, 20*fact); - - dtextX = textX * oldScaleFactor; - textX = (int)dtextX; - dtextX = dtextX - textX; - - minWidth = 1; - minHeight = 1; - - initConnectingPoint(true, true, 2); - - addTGConnectingPointsComment(); - - moveable = true; - editable = true; - removable = true; - userResizable = false; - value = tdp.findELNComponentName("Diode_"); - - myImageIcon = IconManager.imgic1206; - - // Initialization of diode attributes - setVal(0); - setUnit("V"); - } - - public void initConnectingPoint(boolean in, boolean out, int nb) { - nbConnectingPoint = nb; - connectingPoint = new TGConnectingPoint[nb]; - connectingPoint[0] = new ELNConnectingPoint(this, 0, 0, in, out, 0.0, 0.5); - connectingPoint[1] = new ELNConnectingPoint(this, 0, 0, in, out, 1.0, 0.5); - } - - public Color getMyColor() { - return myColor; - } - - public void internalDrawing(Graphics g) { - Font f = g.getFont(); - Font fold = f; - -// if ((x != oldx) | (oldy != y)) { -// // Component has moved! -// manageMove(); -// oldx = x; -// oldy = y; -// } - - if (this.rescaled && !this.tdp.isScaled()) { - this.rescaled = false; - // Must set the font size... - // Incrementally find the biggest font not greater than max_font size - // If font is less than min_font, no text is displayed - - 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); - } - - // Zoom is assumed to be computed - Color c = g.getColor(); - int [] ptx = {x, x+width/4, x+width/4, x+3*width/4, x+3*width/4, x+3*width/4, x+3*width/4, x+width, x+3*width/4, x+width/4, x+width/4}; - int [] pty = {y+height/2, y+height/2, y, y+height/2, y, y+height, y+height/2, y+height/2, y+height/2, y+height, y+height/2}; - g.drawPolygon(ptx, pty, 11); - g.setColor(c); - - // Set font size - int attributeFontSize = this.currentFontSize * 5 / 6; - int w = g.getFontMetrics().stringWidth(value); - g.setFont(f.deriveFont((float) attributeFontSize)); - g.setFont(f); - g.setFont(f.deriveFont(Font.BOLD)); - g.drawString(value, x + (width - w)/2, y-10); - - g.setFont(fold); - } - -// public void manageMove() { -// if (father != null) { -// Point p = GraphicLib.putPointOnRectangle(x+(width/2), y+(height/2), father.getX(), father.getY(), father.getWidth(), father.getHeight()); -// -// x = p.x - width/2; -// y = p.y - height/2; -// -// setMoveCd(x, y); -// -// int orientation = GraphicLib.getCloserOrientation(x+(width/2), y+(height/2), father.getX(), father.getY(), father.getWidth(), father.getHeight()); -// if (orientation != currentOrientation) { -//// setOrientation(orientation); -// } -// } -// } - - // TGConnecting points .. - // TODO : change the orientation of the component -// public void setOrientation(int orientation) { -// currentOrientation = orientation; -// double w0, h0, w1, h1; -// -//// switch(orientation) { -////// case GraphicLib.NORTH: -////// w0 = 0.5; -////// h0 = 0.0; -////// break; -//// case GraphicLib.WEST: -//// w0 = 0.0; -//// h0 = 0.5; -//// break; -////// case GraphicLib.SOUTH: -////// w0 = 0.5; -////// h0 = 1.0; -////// break; -//// case GraphicLib.EAST: -//// default: -//// w0 = 1.0; -//// h0 = 0.5; -//// } -// -// w0 = 0.0; -// h0 = 0.5; -// w1 = 1.0; -// h1 = 0.5; -// System.out.println(connectingPoint.length); -// ((ELNConnectingPoint) connectingPoint[0]).setW(w0); -// ((ELNConnectingPoint) connectingPoint[0]).setH(h0); -// ((ELNConnectingPoint) connectingPoint[1]).setW(w1); -// ((ELNConnectingPoint) connectingPoint[1]).setH(h1); -// } - - 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_DIODE; - } - - public boolean editOndoubleClick(JFrame frame) { - JDialogELNComponentDiode jde = new JDialogELNComponentDiode(this); - jde.setVisible(true); - return true; - } - - protected String translateExtraParam() { - StringBuffer sb = new StringBuffer("<extraparam>\n"); - sb.append("<attributes value=\"" + val); - sb.append("\" unity=\"" + unit + "\""); - sb.append("/>\n"); - sb.append("</extraparam>\n"); - return new String(sb); - } - - public void loadExtraParam(NodeList nl, int decX, int decY, int decId) throws MalformedModelingException{ - try { - NodeList nli; - Node n1, n2; - Element elt; - - int value; - String unity; - - for(int i=0; i<nl.getLength(); i++) { - n1 = nl.item(i); - if (n1.getNodeType() == Node.ELEMENT_NODE) { - nli = n1.getChildNodes(); - for(int j=0; j<nli.getLength(); j++) { - n2 = nli.item(j); - if (n2.getNodeType() == Node.ELEMENT_NODE) { - elt = (Element) n2; - if (elt.getTagName().equals("Prop")) { - value =Integer.decode(elt.getAttribute("value")).intValue(); - unity = elt.getAttribute("unity"); - setVal(value); - setUnit(unity); - } - } - } - } - } - } catch (Exception e) { - throw new MalformedModelingException(); - } - } - - public int getDefaultConnector() { - return TGComponentManager.ELN_CONNECTOR; - } - - public int getVal() { - return val; - } - - public void setVal(int _val) { - val = _val; - } - - public String getUnit() { - return unit; - } - - public void setUnit(String _unit) { - unit = _unit; - } -} \ No newline at end of file diff --git a/src/main/java/ui/eln/ELNComponentNMOS.java b/src/main/java/ui/eln/ELNComponentNMOS.java deleted file mode 100644 index 3057f100f1b71e05c46ad1361b7b31a1972987dc..0000000000000000000000000000000000000000 --- a/src/main/java/ui/eln/ELNComponentNMOS.java +++ /dev/null @@ -1,312 +0,0 @@ -/* 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 org.w3c.dom.Element; -import org.w3c.dom.Node; -import org.w3c.dom.NodeList; -import ui.*; -import ui.util.IconManager; -import ui.window.JDialogELNComponentNMOS; - -import javax.swing.*; -import java.awt.*; - -/** - * Class ELNComponentNMOS - * NMOS to be used in ELN diagrams - * Creation: 12/06/2018 - * @version 1.0 12/06/2018 - * @author Irina Kit Yan LEE - */ - -public class ELNComponentNMOS extends TGCScalableWithInternalComponent { - protected Color myColor; - protected int orientation; - private int maxFontSize = 14; - private int minFontSize = 4; - private int currentFontSize = -1; -// protected int oldx, oldy; -// protected int currentOrientation = GraphicLib.NORTH; - - private int textX = 15; // border for ports - private double dtextX = 0.0; - protected int decPoint = 3; - - private int fact = 2; - - // TODO Parameters - private int val; - private String unit; - - public ELNComponentNMOS(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(30*fact, 40*fact); - - dtextX = textX * oldScaleFactor; - textX = (int)dtextX; - dtextX = dtextX - textX; - - minWidth = 1; - minHeight = 1; - - initConnectingPoint(true, true, 3); - - addTGConnectingPointsComment(); - - moveable = true; - editable = true; - removable = true; - userResizable = false; - value = tdp.findELNComponentName("NMOS_"); - - myImageIcon = IconManager.imgic1206; - - // TODO Initialization of NMOS attributes - setVal(0); - setUnit("V"); - } - - public void initConnectingPoint(boolean in, boolean out, int nb) { - nbConnectingPoint = nb; - connectingPoint = new TGConnectingPoint[nb]; - connectingPoint[0] = new ELNConnectingPoint(this, 0, 0, in, out, 0.0, 0.5); - connectingPoint[1] = new ELNConnectingPoint(this, 0, 0, in, out, 1.0, 0.0); - connectingPoint[2] = new ELNConnectingPoint(this, 0, 0, in, out, 1.0, 1.0); - } - - public Color getMyColor() { - return myColor; - } - - public void internalDrawing(Graphics g) { - Font f = g.getFont(); - Font fold = f; - -// if ((x != oldx) | (oldy != y)) { -// // Component has moved! -// manageMove(); -// oldx = x; -// oldy = y; -// } - - if (this.rescaled && !this.tdp.isScaled()) { - this.rescaled = false; - // Must set the font size... - // Incrementally find the biggest font not greater than max_font size - // If font is less than min_font, no text is displayed - - 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); - } - - // Zoom is assumed to be computed - Color c = g.getColor(); - int [] ptx0 = {x, x+width/3, x+width/3, x+width/3, x+width/3}; - int [] pty0 = {y+height/2, y+height/2, y+height/4, y+3*height/4, y+height/2}; - g.drawPolygon(ptx0, pty0, 5); - int [] ptx1 = {x+width, x+width, x+2*width/3, x+2*width/3, x+width, x+width, x+width, x+2*width/3, x+2*width/3, x+width}; - int [] pty1 = {y, y+height/4, y+height/4, y+3*height/4, y+3*height/4, y+height, y+3*height/4, y+3*height/4, y+height/4, y+height/4}; - g.drawPolygon(ptx1, pty1, 10); - g.setColor(c); - - // Set font size - int attributeFontSize = this.currentFontSize * 5 / 6; - int w = g.getFontMetrics().stringWidth(value); - g.setFont(f.deriveFont((float) attributeFontSize)); - g.setFont(f); - g.setFont(f.deriveFont(Font.BOLD)); - g.drawString(value, x + (width - w)/2, y-10); - - g.setFont(fold); - } - -// public void manageMove() { -// if (father != null) { -// Point p = GraphicLib.putPointOnRectangle(x+(width/2), y+(height/2), father.getX(), father.getY(), father.getWidth(), father.getHeight()); -// -// x = p.x - width/2; -// y = p.y - height/2; -// -// setMoveCd(x, y); -// -// int orientation = GraphicLib.getCloserOrientation(x+(width/2), y+(height/2), father.getX(), father.getY(), father.getWidth(), father.getHeight()); -// if (orientation != currentOrientation) { -//// setOrientation(orientation); -// } -// } -// } - - // TGConnecting points .. - // TODO : change the orientation of the component -// public void setOrientation(int orientation) { -// currentOrientation = orientation; -// double w0, h0, w1, h1; -// -//// switch(orientation) { -////// case GraphicLib.NORTH: -////// w0 = 0.5; -////// h0 = 0.0; -////// break; -//// case GraphicLib.WEST: -//// w0 = 0.0; -//// h0 = 0.5; -//// break; -////// case GraphicLib.SOUTH: -////// w0 = 0.5; -////// h0 = 1.0; -////// break; -//// case GraphicLib.EAST: -//// default: -//// w0 = 1.0; -//// h0 = 0.5; -//// } -// -// w0 = 0.0; -// h0 = 0.5; -// w1 = 1.0; -// h1 = 0.5; -// System.out.println(connectingPoint.length); -// ((ELNConnectingPoint) connectingPoint[0]).setW(w0); -// ((ELNConnectingPoint) connectingPoint[0]).setH(h0); -// ((ELNConnectingPoint) connectingPoint[1]).setW(w1); -// ((ELNConnectingPoint) connectingPoint[1]).setH(h1); -// } - - 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_NMOS; - } - - public boolean editOndoubleClick(JFrame frame) { -// JDialogELNComponentNMOS jde = new JDialogELNComponentNMOS(this); -// jde.setVisible(true); - return true; - } - - // TODO - protected String translateExtraParam() { - StringBuffer sb = new StringBuffer("<extraparam>\n"); - sb.append("<attributes value=\"" + val); - sb.append("\" unity=\"" + unit + "\""); - sb.append("/>\n"); - sb.append("</extraparam>\n"); - return new String(sb); - } - - // TODO - public void loadExtraParam(NodeList nl, int decX, int decY, int decId) throws MalformedModelingException{ - try { - NodeList nli; - Node n1, n2; - Element elt; - - int value; - String unity; - - for(int i=0; i<nl.getLength(); i++) { - n1 = nl.item(i); - if (n1.getNodeType() == Node.ELEMENT_NODE) { - nli = n1.getChildNodes(); - for(int j=0; j<nli.getLength(); j++) { - n2 = nli.item(j); - if (n2.getNodeType() == Node.ELEMENT_NODE) { - elt = (Element) n2; - if (elt.getTagName().equals("Prop")) { - value =Integer.decode(elt.getAttribute("value")).intValue(); - unity = elt.getAttribute("unity"); - setVal(value); - setUnit(unity); - } - } - } - } - } - } catch (Exception e) { - throw new MalformedModelingException(); - } - } - - public int getDefaultConnector() { - return TGComponentManager.ELN_CONNECTOR; - } - - // TODO ... - public int getVal() { - return val; - } - - public void setVal(int _val) { - val = _val; - } - - public String getUnit() { - return unit; - } - - public void setUnit(String _unit) { - unit = _unit; - } -} \ No newline at end of file diff --git a/src/main/java/ui/eln/ELNComponentPMOS.java b/src/main/java/ui/eln/ELNComponentPMOS.java deleted file mode 100644 index 94460bfb454ade89a73b7536cfb73393da3b1df7..0000000000000000000000000000000000000000 --- a/src/main/java/ui/eln/ELNComponentPMOS.java +++ /dev/null @@ -1,316 +0,0 @@ -/* 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 org.w3c.dom.Element; -import org.w3c.dom.Node; -import org.w3c.dom.NodeList; -import ui.*; -import ui.util.IconManager; -import ui.window.JDialogELNComponentResistor; - -import javax.swing.*; -import java.awt.*; - -/** - * Class ELNComponentPMOS - * NMOS to be used in ELN diagrams - * Creation: 12/06/2018 - * @version 1.0 12/06/2018 - * @author Irina Kit Yan LEE - */ - -public class ELNComponentPMOS extends TGCScalableWithInternalComponent { - protected Color myColor; - protected int orientation; - private int maxFontSize = 14; - private int minFontSize = 4; - private int currentFontSize = -1; -// protected int oldx, oldy; -// protected int currentOrientation = GraphicLib.NORTH; - - private int textX = 15; // border for ports - private double dtextX = 0.0; - protected int decPoint = 3; - - private int fact = 2; - - // TODO Parameters - private int val; - private String unit; - - public ELNComponentPMOS(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(30*fact, 40*fact); - - dtextX = textX * oldScaleFactor; - textX = (int)dtextX; - dtextX = dtextX - textX; - - minWidth = 1; - minHeight = 1; - - initConnectingPoint(true, true, 3); - - addTGConnectingPointsComment(); - - moveable = true; - editable = true; - removable = true; - userResizable = false; - value = tdp.findELNComponentName("PMOS_"); - - myImageIcon = IconManager.imgic1206; - - // TODO Initialization of NMOS attributes - setVal(0); - setUnit("V"); - } - - public void initConnectingPoint(boolean in, boolean out, int nb) { - nbConnectingPoint = nb; - connectingPoint = new TGConnectingPoint[nb]; - connectingPoint[0] = new ELNConnectingPoint(this, 0, 0, in, out, 0.0, 0.5); - connectingPoint[1] = new ELNConnectingPoint(this, 0, 0, in, out, 1.0, 0.0); - connectingPoint[2] = new ELNConnectingPoint(this, 0, 0, in, out, 1.0, 1.0); - } - - public Color getMyColor() { - return myColor; - } - - public void internalDrawing(Graphics g) { - Font f = g.getFont(); - Font fold = f; - -// if ((x != oldx) | (oldy != y)) { -// // Component has moved! -// manageMove(); -// oldx = x; -// oldy = y; -// } - - if (this.rescaled && !this.tdp.isScaled()) { - this.rescaled = false; - // Must set the font size... - // Incrementally find the biggest font not greater than max_font size - // If font is less than min_font, no text is displayed - - 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); - } - - // Zoom is assumed to be computed - Color c = g.getColor(); - int [] ptx0 = {x, x+width/3-6}; - int [] pty0 = {y+height/2, y+height/2}; - g.drawPolygon(ptx0, pty0, 2); - int [] ptx1 = {x+width/3, x+width/3}; - int [] pty1 = {y+height/4, y+3*height/4}; - g.drawPolygon(ptx1, pty1, 2); - int [] ptx2 = {x+width, x+width, x+2*width/3, x+2*width/3, x+width, x+width, x+width, x+2*width/3, x+2*width/3, x+width}; - int [] pty2 = {y, y+height/4, y+height/4, y+3*height/4, y+3*height/4, y+height, y+3*height/4, y+3*height/4, y+height/4, y+height/4}; - g.drawPolygon(ptx2, pty2, 10); - g.drawOval(x+width/3-6, y+height/2-3, 6, 6); - g.setColor(c); - - // Set font size - int attributeFontSize = this.currentFontSize * 5 / 6; - int w = g.getFontMetrics().stringWidth(value); - g.setFont(f.deriveFont((float) attributeFontSize)); - g.setFont(f); - g.setFont(f.deriveFont(Font.BOLD)); - g.drawString(value, x + (width - w)/2, y-10); - - g.setFont(fold); - } - -// public void manageMove() { -// if (father != null) { -// Point p = GraphicLib.putPointOnRectangle(x+(width/2), y+(height/2), father.getX(), father.getY(), father.getWidth(), father.getHeight()); -// -// x = p.x - width/2; -// y = p.y - height/2; -// -// setMoveCd(x, y); -// -// int orientation = GraphicLib.getCloserOrientation(x+(width/2), y+(height/2), father.getX(), father.getY(), father.getWidth(), father.getHeight()); -// if (orientation != currentOrientation) { -//// setOrientation(orientation); -// } -// } -// } - - // TGConnecting points .. - // TODO : change the orientation of the component -// public void setOrientation(int orientation) { -// currentOrientation = orientation; -// double w0, h0, w1, h1; -// -//// switch(orientation) { -////// case GraphicLib.NORTH: -////// w0 = 0.5; -////// h0 = 0.0; -////// break; -//// case GraphicLib.WEST: -//// w0 = 0.0; -//// h0 = 0.5; -//// break; -////// case GraphicLib.SOUTH: -////// w0 = 0.5; -////// h0 = 1.0; -////// break; -//// case GraphicLib.EAST: -//// default: -//// w0 = 1.0; -//// h0 = 0.5; -//// } -// -// w0 = 0.0; -// h0 = 0.5; -// w1 = 1.0; -// h1 = 0.5; -// System.out.println(connectingPoint.length); -// ((ELNConnectingPoint) connectingPoint[0]).setW(w0); -// ((ELNConnectingPoint) connectingPoint[0]).setH(h0); -// ((ELNConnectingPoint) connectingPoint[1]).setW(w1); -// ((ELNConnectingPoint) connectingPoint[1]).setH(h1); -// } - - 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_PMOS; - } - - public boolean editOndoubleClick(JFrame frame) { -// JDialogELNComponentPMOS jde = new JDialogELNComponentPMOS(this); -// jde.setVisible(true); - return true; - } - - // TODO - protected String translateExtraParam() { - StringBuffer sb = new StringBuffer("<extraparam>\n"); - sb.append("<attributes value=\"" + val); - sb.append("\" unity=\"" + unit + "\""); - sb.append("/>\n"); - sb.append("</extraparam>\n"); - return new String(sb); - } - - // TODO - public void loadExtraParam(NodeList nl, int decX, int decY, int decId) throws MalformedModelingException{ - try { - NodeList nli; - Node n1, n2; - Element elt; - - int value; - String unity; - - for(int i=0; i<nl.getLength(); i++) { - n1 = nl.item(i); - if (n1.getNodeType() == Node.ELEMENT_NODE) { - nli = n1.getChildNodes(); - for(int j=0; j<nli.getLength(); j++) { - n2 = nli.item(j); - if (n2.getNodeType() == Node.ELEMENT_NODE) { - elt = (Element) n2; - if (elt.getTagName().equals("Prop")) { - value =Integer.decode(elt.getAttribute("value")).intValue(); - unity = elt.getAttribute("unity"); - setVal(value); - setUnit(unity); - } - } - } - } - } - } catch (Exception e) { - throw new MalformedModelingException(); - } - } - - public int getDefaultConnector() { - return TGComponentManager.ELN_CONNECTOR; - } - - // TODO ... - public int getVal() { - return val; - } - - public void setVal(int _val) { - val = _val; - } - - public String getUnit() { - return unit; - } - - public void setUnit(String _unit) { - unit = _unit; - } -} \ No newline at end of file diff --git a/src/main/java/ui/eln/ELNConnector.java b/src/main/java/ui/eln/ELNConnector.java index 62407ec598d427f267966783b6cab792d3914443..51c09b570b45071e4f5955d619cdabeb23f74fa1 100644 --- a/src/main/java/ui/eln/ELNConnector.java +++ b/src/main/java/ui/eln/ELNConnector.java @@ -53,7 +53,9 @@ import java.util.Vector; */ public class ELNConnector extends TGConnector implements ScalableTGComponent { - protected double oldScaleFactor; + + protected double oldScaleFactor; + protected int c = 10; //square length public ELNConnector(int _x, int _y, int _minX, int _minY, int _maxX, int _maxY, boolean _pos, TGComponent _father, TDiagramPanel _tdp, TGConnectingPoint _p1, TGConnectingPoint _p2, Vector<Point> _listPoint) { super(_x, _y, _minX, _minY, _maxX, _maxY, _pos, _father, _tdp, _p1, _p2, _listPoint); @@ -73,7 +75,10 @@ public class ELNConnector extends TGConnector implements ScalableTGComponent { return p2; } - protected void drawLastSegment(Graphics g, int x1, int y1, int x2, int y2){ + protected void drawLastSegment(Graphics g, int x1, int y1, int x2, int y2) { + int cz = (int) (tdp.getZoom() * c); + g.fillOval(x2 - (cz / 2), y2 - (cz / 2), cz, cz); + g.fillOval(x1 - (cz / 2), y1 - (cz / 2), cz, cz); g.drawLine(x1, y1, x2, y2); } diff --git a/src/main/java/ui/eln/sca_eln/ELNComponentCapacitor.java b/src/main/java/ui/eln/sca_eln/ELNComponentCapacitor.java index 0256cadfa493a6e8c44d42c4b3758c56fcccc85f..9a1a8180f890bb734372c9946e9a34d2d75ad3f7 100644 --- a/src/main/java/ui/eln/sca_eln/ELNComponentCapacitor.java +++ b/src/main/java/ui/eln/sca_eln/ELNComponentCapacitor.java @@ -113,8 +113,8 @@ public class ELNComponentCapacitor extends TGCScalableWithInternalComponent { public void initConnectingPoint(int nb) { nbConnectingPoint = nb; connectingPoint = new TGConnectingPoint[nb]; - connectingPoint[0] = new ELNConnectingPoint(this, 0, 0, true, false, 0.0, 0.5); - connectingPoint[1] = new ELNConnectingPoint(this, 0, 0, false, true, 1.0, 0.5); + connectingPoint[0] = new ELNConnectingPoint(this, 0, 0, true, true, 0.0, 0.5); + connectingPoint[1] = new ELNConnectingPoint(this, 0, 0, true, true, 1.0, 0.5); } public Color getMyColor() { diff --git a/src/main/java/ui/eln/sca_eln/ELNComponentCurrentControlledCurrentSource.java b/src/main/java/ui/eln/sca_eln/ELNComponentCurrentControlledCurrentSource.java index 82701b9a70ae446d418fcef77afdae23d1950c39..fe2f6ff9c35fe1f784f7781cb94c520bda860b18 100644 --- a/src/main/java/ui/eln/sca_eln/ELNComponentCurrentControlledCurrentSource.java +++ b/src/main/java/ui/eln/sca_eln/ELNComponentCurrentControlledCurrentSource.java @@ -108,10 +108,10 @@ public class ELNComponentCurrentControlledCurrentSource extends TGCScalableWithI public void initConnectingPoint(int nb) { nbConnectingPoint = nb; connectingPoint = new TGConnectingPoint[nb]; - connectingPoint[0] = new ELNConnectingPoint(this, 0, 0, true, false, 0.0, 0.0); - connectingPoint[1] = new ELNConnectingPoint(this, 0, 0, false, true, 1.0, 0.0); - connectingPoint[2] = new ELNConnectingPoint(this, 0, 0, true, false, 0.0, 1.0); - connectingPoint[3] = new ELNConnectingPoint(this, 0, 0, false, true, 1.0, 1.0); + connectingPoint[0] = new ELNConnectingPoint(this, 0, 0, true, true, 0.0, 0.0); + connectingPoint[1] = new ELNConnectingPoint(this, 0, 0, true, true, 1.0, 0.0); + connectingPoint[2] = new ELNConnectingPoint(this, 0, 0, true, true, 0.0, 1.0); + connectingPoint[3] = new ELNConnectingPoint(this, 0, 0, true, true, 1.0, 1.0); } public Color getMyColor() { diff --git a/src/main/java/ui/eln/sca_eln/ELNComponentCurrentControlledVoltageSource.java b/src/main/java/ui/eln/sca_eln/ELNComponentCurrentControlledVoltageSource.java index 6154f4907dd1dc73a8897eb680fc3d0eac0fa90d..9ae63cc3ba92315f4ff9319b40749fb7681a2215 100644 --- a/src/main/java/ui/eln/sca_eln/ELNComponentCurrentControlledVoltageSource.java +++ b/src/main/java/ui/eln/sca_eln/ELNComponentCurrentControlledVoltageSource.java @@ -110,10 +110,10 @@ public class ELNComponentCurrentControlledVoltageSource extends TGCScalableWithI public void initConnectingPoint(int nb) { nbConnectingPoint = nb; connectingPoint = new TGConnectingPoint[nb]; - connectingPoint[0] = new ELNConnectingPoint(this, 0, 0, true, false, 0.0, 0.0); - connectingPoint[1] = new ELNConnectingPoint(this, 0, 0, false, true, 1.0, 0.0); - connectingPoint[2] = new ELNConnectingPoint(this, 0, 0, true, false, 0.0, 1.0); - connectingPoint[3] = new ELNConnectingPoint(this, 0, 0, false, true, 1.0, 1.0); + connectingPoint[0] = new ELNConnectingPoint(this, 0, 0, true, true, 0.0, 0.0); + connectingPoint[1] = new ELNConnectingPoint(this, 0, 0, true, true, 1.0, 0.0); + connectingPoint[2] = new ELNConnectingPoint(this, 0, 0, true, true, 0.0, 1.0); + connectingPoint[3] = new ELNConnectingPoint(this, 0, 0, true, true, 1.0, 1.0); } public Color getMyColor() { diff --git a/src/main/java/ui/eln/sca_eln/ELNComponentGyrator.java b/src/main/java/ui/eln/sca_eln/ELNComponentGyrator.java index 7107f8095369b8552b176e8c2fd18f9f6e0ef942..cd8437af5fb35d327a37c856117e64d70d6ead6f 100644 --- a/src/main/java/ui/eln/sca_eln/ELNComponentGyrator.java +++ b/src/main/java/ui/eln/sca_eln/ELNComponentGyrator.java @@ -112,10 +112,10 @@ public class ELNComponentGyrator extends TGCScalableWithInternalComponent { public void initConnectingPoint(int nb) { nbConnectingPoint = nb; connectingPoint = new TGConnectingPoint[nb]; - connectingPoint[0] = new ELNConnectingPoint(this, 0, 0, true, false, 0.0, 0.0); - connectingPoint[1] = new ELNConnectingPoint(this, 0, 0, false, true, 1.0, 0.0); - connectingPoint[2] = new ELNConnectingPoint(this, 0, 0, true, false, 0.0, 1.0); - connectingPoint[3] = new ELNConnectingPoint(this, 0, 0, false, true, 1.0, 1.0); + connectingPoint[0] = new ELNConnectingPoint(this, 0, 0, true, true, 0.0, 0.0); + connectingPoint[1] = new ELNConnectingPoint(this, 0, 0, true, true, 1.0, 0.0); + connectingPoint[2] = new ELNConnectingPoint(this, 0, 0, true, true, 0.0, 1.0); + connectingPoint[3] = new ELNConnectingPoint(this, 0, 0, true, true, 1.0, 1.0); } public Color getMyColor() { diff --git a/src/main/java/ui/eln/sca_eln/ELNComponentIdealTransformer.java b/src/main/java/ui/eln/sca_eln/ELNComponentIdealTransformer.java index a0853b3aba0ffb63805f43899ade7a702689f5dc..fa5ec31c390025cbd24e01bf4c5d959f6b950bc5 100644 --- a/src/main/java/ui/eln/sca_eln/ELNComponentIdealTransformer.java +++ b/src/main/java/ui/eln/sca_eln/ELNComponentIdealTransformer.java @@ -108,10 +108,10 @@ public class ELNComponentIdealTransformer extends TGCScalableWithInternalCompone public void initConnectingPoint(int nb) { nbConnectingPoint = nb; connectingPoint = new TGConnectingPoint[nb]; - connectingPoint[0] = new ELNConnectingPoint(this, 0, 0, true, false, 0.0, 0.0); - connectingPoint[1] = new ELNConnectingPoint(this, 0, 0, false, true, 1.0, 0.0); - connectingPoint[2] = new ELNConnectingPoint(this, 0, 0, true, false, 0.0, 1.0); - connectingPoint[3] = new ELNConnectingPoint(this, 0, 0, false, true, 1.0, 1.0); + connectingPoint[0] = new ELNConnectingPoint(this, 0, 0, true, true, 0.0, 0.0); + connectingPoint[1] = new ELNConnectingPoint(this, 0, 0, true, true, 1.0, 0.0); + connectingPoint[2] = new ELNConnectingPoint(this, 0, 0, true, true, 0.0, 1.0); + connectingPoint[3] = new ELNConnectingPoint(this, 0, 0, true, true, 1.0, 1.0); } public Color getMyColor() { diff --git a/src/main/java/ui/eln/sca_eln/ELNComponentIndependentCurrentSource.java b/src/main/java/ui/eln/sca_eln/ELNComponentIndependentCurrentSource.java index ee3f3a49f7237f1ca5c251016f3a01b1cf9e310a..a343b23e8f9d70b29d2760a4e0eb350786e9e15a 100644 --- a/src/main/java/ui/eln/sca_eln/ELNComponentIndependentCurrentSource.java +++ b/src/main/java/ui/eln/sca_eln/ELNComponentIndependentCurrentSource.java @@ -119,8 +119,8 @@ public class ELNComponentIndependentCurrentSource extends TGCScalableWithInterna public void initConnectingPoint(int nb) { nbConnectingPoint = nb; connectingPoint = new TGConnectingPoint[nb]; - connectingPoint[0] = new ELNConnectingPoint(this, 0, 0, true, false, 1.0/3.0, 0.0); - connectingPoint[1] = new ELNConnectingPoint(this, 0, 0, false, true, 1.0/3.0, 1.0); + connectingPoint[0] = new ELNConnectingPoint(this, 0, 0, true, true, 1.0/3.0, 0.0); + connectingPoint[1] = new ELNConnectingPoint(this, 0, 0, true, true, 1.0/3.0, 1.0); } public Color getMyColor() { diff --git a/src/main/java/ui/eln/sca_eln/ELNComponentIndependentVoltageSource.java b/src/main/java/ui/eln/sca_eln/ELNComponentIndependentVoltageSource.java index 9486ca4ab852734d4288941ed1a96023c01d1fca..5d5f39ef6775206ae224162ac8ee0aff567675de 100644 --- a/src/main/java/ui/eln/sca_eln/ELNComponentIndependentVoltageSource.java +++ b/src/main/java/ui/eln/sca_eln/ELNComponentIndependentVoltageSource.java @@ -119,8 +119,8 @@ public class ELNComponentIndependentVoltageSource extends TGCScalableWithInterna public void initConnectingPoint(boolean in, boolean out, int nb) { nbConnectingPoint = nb; connectingPoint = new TGConnectingPoint[nb]; - connectingPoint[0] = new ELNConnectingPoint(this, 0, 0, true, false, 0.5, 0.0); - connectingPoint[1] = new ELNConnectingPoint(this, 0, 0, false, true, 0.5, 1.0); + connectingPoint[0] = new ELNConnectingPoint(this, 0, 0, true, true, 0.5, 0.0); + connectingPoint[1] = new ELNConnectingPoint(this, 0, 0, true, true, 0.5, 1.0); } public Color getMyColor() { diff --git a/src/main/java/ui/eln/sca_eln/ELNComponentInductor.java b/src/main/java/ui/eln/sca_eln/ELNComponentInductor.java index be2fc1c37d4ac564b48e7a02577711a4c2f11f01..efa1cff74b4a75313bca799f2ed090cb5d2df572 100644 --- a/src/main/java/ui/eln/sca_eln/ELNComponentInductor.java +++ b/src/main/java/ui/eln/sca_eln/ELNComponentInductor.java @@ -112,8 +112,8 @@ public class ELNComponentInductor extends TGCScalableWithInternalComponent { public void initConnectingPoint(int nb) { nbConnectingPoint = nb; connectingPoint = new TGConnectingPoint[nb]; - connectingPoint[0] = new ELNConnectingPoint(this, 0, 0, true, false, 0.0, 0.5); - connectingPoint[1] = new ELNConnectingPoint(this, 0, 0, false, true, 1.0, 0.5); + connectingPoint[0] = new ELNConnectingPoint(this, 0, 0, true, true, 0.0, 0.5); + connectingPoint[1] = new ELNConnectingPoint(this, 0, 0, true, true, 1.0, 0.5); } public Color getMyColor() { diff --git a/src/main/java/ui/eln/sca_eln/ELNComponentNullor.java b/src/main/java/ui/eln/sca_eln/ELNComponentNullor.java index 480f3351e793e8ad9c68c677fb49c3130edbaf03..07cdfc52430d761f025882e0196bc91cc67a0d71 100644 --- a/src/main/java/ui/eln/sca_eln/ELNComponentNullor.java +++ b/src/main/java/ui/eln/sca_eln/ELNComponentNullor.java @@ -99,10 +99,10 @@ public class ELNComponentNullor extends TGCScalableWithInternalComponent { public void initConnectingPoint(int nb) { nbConnectingPoint = nb; connectingPoint = new TGConnectingPoint[nb]; - connectingPoint[0] = new ELNConnectingPoint(this, 0, 0, true, false, 0.0, 0.0); - connectingPoint[1] = new ELNConnectingPoint(this, 0, 0, false, true, 1.0, 0.0); - connectingPoint[2] = new ELNConnectingPoint(this, 0, 0, true, false, 0.0, 1.0); - connectingPoint[3] = new ELNConnectingPoint(this, 0, 0, false, true, 1.0, 1.0); + connectingPoint[0] = new ELNConnectingPoint(this, 0, 0, true, true, 0.0, 0.0); + connectingPoint[1] = new ELNConnectingPoint(this, 0, 0, true, true, 1.0, 0.0); + connectingPoint[2] = new ELNConnectingPoint(this, 0, 0, true, true, 0.0, 1.0); + connectingPoint[3] = new ELNConnectingPoint(this, 0, 0, true, true, 1.0, 1.0); } public Color getMyColor() { diff --git a/src/main/java/ui/eln/sca_eln/ELNComponentResistor.java b/src/main/java/ui/eln/sca_eln/ELNComponentResistor.java index 67fca22089ce8e12fd9adcf3073855ad48acb23f..85b415bc9b337e42c52badda2f20a77ea3acf783 100644 --- a/src/main/java/ui/eln/sca_eln/ELNComponentResistor.java +++ b/src/main/java/ui/eln/sca_eln/ELNComponentResistor.java @@ -110,8 +110,8 @@ public class ELNComponentResistor extends TGCScalableWithInternalComponent { public void initConnectingPoint(int nb) { nbConnectingPoint = nb; connectingPoint = new TGConnectingPoint[nb]; - connectingPoint[0] = new ELNConnectingPoint(this, 0, 0, true, false, 0.0, 0.5); - connectingPoint[1] = new ELNConnectingPoint(this, 0, 0, false, true, 1.0, 0.5); + connectingPoint[0] = new ELNConnectingPoint(this, 0, 0, true, true, 0.0, 0.5); + connectingPoint[1] = new ELNConnectingPoint(this, 0, 0, true, true, 1.0, 0.5); } public Color getMyColor() { diff --git a/src/main/java/ui/eln/sca_eln/ELNComponentTransmissionLine.java b/src/main/java/ui/eln/sca_eln/ELNComponentTransmissionLine.java index d3babc0dc782b3d2af9012019d9dd7f6f7b21a61..fd5f07ed4d438b269b7d2e88e3cacf89bab5dd80 100644 --- a/src/main/java/ui/eln/sca_eln/ELNComponentTransmissionLine.java +++ b/src/main/java/ui/eln/sca_eln/ELNComponentTransmissionLine.java @@ -114,10 +114,10 @@ public class ELNComponentTransmissionLine extends TGCScalableWithInternalCompone public void initConnectingPoint(int nb) { nbConnectingPoint = nb; connectingPoint = new TGConnectingPoint[nb]; - connectingPoint[0] = new ELNConnectingPoint(this, 0, 0, true, false, 0.0, 0.0); - connectingPoint[1] = new ELNConnectingPoint(this, 0, 0, false, true, 1.0, 0.0); - connectingPoint[2] = new ELNConnectingPoint(this, 0, 0, true, false, 0.0, 1.0); - connectingPoint[3] = new ELNConnectingPoint(this, 0, 0, false, true, 1.0, 1.0); + connectingPoint[0] = new ELNConnectingPoint(this, 0, 0, true, true, 0.0, 0.0); + connectingPoint[1] = new ELNConnectingPoint(this, 0, 0, true, true, 1.0, 0.0); + connectingPoint[2] = new ELNConnectingPoint(this, 0, 0, true, true, 0.0, 1.0); + connectingPoint[3] = new ELNConnectingPoint(this, 0, 0, true, true, 1.0, 1.0); } public Color getMyColor() { diff --git a/src/main/java/ui/eln/sca_eln/ELNComponentVoltageControlledCurrentSource.java b/src/main/java/ui/eln/sca_eln/ELNComponentVoltageControlledCurrentSource.java index 94e4455467ca4d79e801c5496cb91abd54f72851..405b00c06afb776bbc1c421bba2ba2de005aee3d 100644 --- a/src/main/java/ui/eln/sca_eln/ELNComponentVoltageControlledCurrentSource.java +++ b/src/main/java/ui/eln/sca_eln/ELNComponentVoltageControlledCurrentSource.java @@ -110,10 +110,10 @@ public class ELNComponentVoltageControlledCurrentSource extends TGCScalableWithI public void initConnectingPoint(int nb) { nbConnectingPoint = nb; connectingPoint = new TGConnectingPoint[nb]; - connectingPoint[0] = new ELNConnectingPoint(this, 0, 0, true, false, 0.0, 0.0); - connectingPoint[1] = new ELNConnectingPoint(this, 0, 0, false, true, 1.0, 0.0); - connectingPoint[2] = new ELNConnectingPoint(this, 0, 0, true, false, 0.0, 1.0); - connectingPoint[3] = new ELNConnectingPoint(this, 0, 0, false, true, 1.0, 1.0); + connectingPoint[0] = new ELNConnectingPoint(this, 0, 0, true, true, 0.0, 0.0); + connectingPoint[1] = new ELNConnectingPoint(this, 0, 0, true, true, 1.0, 0.0); + connectingPoint[2] = new ELNConnectingPoint(this, 0, 0, true, true, 0.0, 1.0); + connectingPoint[3] = new ELNConnectingPoint(this, 0, 0, true, true, 1.0, 1.0); } public Color getMyColor() { diff --git a/src/main/java/ui/eln/sca_eln/ELNComponentVoltageControlledVoltageSource.java b/src/main/java/ui/eln/sca_eln/ELNComponentVoltageControlledVoltageSource.java index c44a83b7156d1e487579684ae675f8ad59188f89..1a63930fdd5a3d6a1a25bbb26cb42df95f64fbcb 100644 --- a/src/main/java/ui/eln/sca_eln/ELNComponentVoltageControlledVoltageSource.java +++ b/src/main/java/ui/eln/sca_eln/ELNComponentVoltageControlledVoltageSource.java @@ -108,10 +108,10 @@ public class ELNComponentVoltageControlledVoltageSource extends TGCScalableWithI public void initConnectingPoint(int nb) { nbConnectingPoint = nb; connectingPoint = new TGConnectingPoint[nb]; - connectingPoint[0] = new ELNConnectingPoint(this, 0, 0, true, false, 0.0, 0.0); - connectingPoint[1] = new ELNConnectingPoint(this, 0, 0, false, true, 1.0, 0.0); - connectingPoint[2] = new ELNConnectingPoint(this, 0, 0, true, false, 0.0, 1.0); - connectingPoint[3] = new ELNConnectingPoint(this, 0, 0, false, true, 1.0, 1.0); + connectingPoint[0] = new ELNConnectingPoint(this, 0, 0, true, true, 0.0, 0.0); + connectingPoint[1] = new ELNConnectingPoint(this, 0, 0, true, true, 1.0, 0.0); + connectingPoint[2] = new ELNConnectingPoint(this, 0, 0, true, true, 0.0, 1.0); + connectingPoint[3] = new ELNConnectingPoint(this, 0, 0, true, true, 1.0, 1.0); } public Color getMyColor() { diff --git a/src/main/java/ui/window/JDialogELNComponentCapacitor.java b/src/main/java/ui/window/JDialogELNComponentCapacitor.java index 2f9945aba4d757b7de69f2e3d177ee32a75b04e8..b94cc4bff66d2a1fa524faa66b42499648a6916d 100644 --- a/src/main/java/ui/window/JDialogELNComponentCapacitor.java +++ b/src/main/java/ui/window/JDialogELNComponentCapacitor.java @@ -38,11 +38,11 @@ package ui.window; -import ui.eln.*; import ui.eln.sca_eln.ELNComponentCapacitor; import ui.util.IconManager; import java.awt.BorderLayout; +import java.awt.Dimension; import java.awt.Font; import java.awt.GridBagConstraints; import java.awt.GridBagLayout; @@ -263,12 +263,14 @@ public class JDialogELNComponentCapacitor extends JDialog implements ActionListe saveCloseButton.setIcon(IconManager.imgic25); saveCloseButton.setActionCommand("Save_Close"); saveCloseButton.addActionListener(this); + saveCloseButton.setPreferredSize(new Dimension(200, 30)); downPanel.add(saveCloseButton); JButton cancelButton = new JButton("Cancel"); cancelButton.setIcon(IconManager.imgic27); cancelButton.setActionCommand("Cancel"); cancelButton.addActionListener(this); + cancelButton.setPreferredSize(new Dimension(200, 30)); downPanel.add(cancelButton); mainPanel.add(downPanel, BorderLayout.CENTER); diff --git a/src/main/java/ui/window/JDialogELNComponentCurrentControlledCurrentSource.java b/src/main/java/ui/window/JDialogELNComponentCurrentControlledCurrentSource.java index 3b2a9c0fe9351b7e41443d8e47c359079b97ac76..80f83f692816ed2b9afa2615cd63c8370f4536c6 100644 --- a/src/main/java/ui/window/JDialogELNComponentCurrentControlledCurrentSource.java +++ b/src/main/java/ui/window/JDialogELNComponentCurrentControlledCurrentSource.java @@ -38,11 +38,11 @@ package ui.window; -import ui.eln.*; import ui.eln.sca_eln.ELNComponentCurrentControlledCurrentSource; import ui.util.IconManager; import java.awt.BorderLayout; +import java.awt.Dimension; import java.awt.Font; import java.awt.GridBagConstraints; import java.awt.GridBagLayout; @@ -165,12 +165,14 @@ public class JDialogELNComponentCurrentControlledCurrentSource extends JDialog i saveCloseButton.setIcon(IconManager.imgic25); saveCloseButton.setActionCommand("Save_Close"); saveCloseButton.addActionListener(this); + saveCloseButton.setPreferredSize(new Dimension(200, 30)); downPanel.add(saveCloseButton); JButton cancelButton = new JButton("Cancel"); cancelButton.setIcon(IconManager.imgic27); cancelButton.setActionCommand("Cancel"); cancelButton.addActionListener(this); + cancelButton.setPreferredSize(new Dimension(200, 30)); downPanel.add(cancelButton); mainPanel.add(downPanel, BorderLayout.CENTER); diff --git a/src/main/java/ui/window/JDialogELNComponentCurrentControlledVoltageSource.java b/src/main/java/ui/window/JDialogELNComponentCurrentControlledVoltageSource.java index 85906b4926fc4f9a7e6107cdf2e1fef92da325b8..d62691b765e3e94600f3ad0edb1864642598a877 100644 --- a/src/main/java/ui/window/JDialogELNComponentCurrentControlledVoltageSource.java +++ b/src/main/java/ui/window/JDialogELNComponentCurrentControlledVoltageSource.java @@ -38,11 +38,11 @@ package ui.window; -import ui.eln.*; import ui.eln.sca_eln.ELNComponentCurrentControlledVoltageSource; import ui.util.IconManager; import java.awt.BorderLayout; +import java.awt.Dimension; import java.awt.Font; import java.awt.GridBagConstraints; import java.awt.GridBagLayout; @@ -206,12 +206,14 @@ public class JDialogELNComponentCurrentControlledVoltageSource extends JDialog i saveCloseButton.setIcon(IconManager.imgic25); saveCloseButton.setActionCommand("Save_Close"); saveCloseButton.addActionListener(this); + saveCloseButton.setPreferredSize(new Dimension(200, 30)); downPanel.add(saveCloseButton); JButton cancelButton = new JButton("Cancel"); cancelButton.setIcon(IconManager.imgic27); cancelButton.setActionCommand("Cancel"); cancelButton.addActionListener(this); + cancelButton.setPreferredSize(new Dimension(200, 30)); downPanel.add(cancelButton); mainPanel.add(downPanel, BorderLayout.CENTER); diff --git a/src/main/java/ui/window/JDialogELNComponentDiode.java b/src/main/java/ui/window/JDialogELNComponentDiode.java deleted file mode 100644 index 983a3fef840a62afd09b49dd8ff576ea0fb21e4a..0000000000000000000000000000000000000000 --- a/src/main/java/ui/window/JDialogELNComponentDiode.java +++ /dev/null @@ -1,236 +0,0 @@ -/* 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.window; - -import ui.eln.*; -import ui.util.IconManager; - -import java.awt.BorderLayout; -import java.awt.Font; -import java.awt.GridBagConstraints; -import java.awt.GridBagLayout; -import java.awt.GridLayout; -import java.awt.Insets; -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; - -import javax.swing.AbstractAction; -import javax.swing.BorderFactory; -import javax.swing.Box; -import javax.swing.JButton; -import javax.swing.JComboBox; -import javax.swing.JComponent; -import javax.swing.JDialog; -import javax.swing.JLabel; -import javax.swing.JOptionPane; -import javax.swing.JPanel; -import javax.swing.JTextField; -import javax.swing.KeyStroke; - -/** - * Class JDialogELNComponentDiode - * Dialog for managing of ELN diode - * Creation: 12/06/2018 - * @version 1.0 12/06/2018 - * @author Irina Kit Yan LEE -*/ - -@SuppressWarnings("serial") - -public class JDialogELNComponentDiode extends JDialog implements ActionListener { - - /** Access to ActionPerformed **/ - private JTextField nameTextField; - private JTextField valueTextField; - private String listValueString[]; - private JComboBox<String> valueComboBoxString; - - /** Parameters **/ - private ELNComponentDiode diode; - - /** Constructor **/ - public JDialogELNComponentDiode(ELNComponentDiode _diode) { - /** Set JDialog **/ - setTitle("Setting the diode"); - setSize(500, 185); - setLocationRelativeTo(null); - setVisible(true); - setAlwaysOnTop(true); - setResizable(false); - - /** Parameters **/ - diode = _diode; - - getRootPane().getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(KeyStroke.getKeyStroke("ESCAPE"), "close"); - getRootPane().getActionMap().put("close", new AbstractAction() { - public void actionPerformed(ActionEvent e) { - dispose(); - } - }); - - dialog(); - } - - public void dialog() { - /** JPanel **/ - JPanel mainPanel = new JPanel(new BorderLayout()); - this.add(mainPanel); - - JPanel attributesMainPanel = new JPanel(new GridLayout()); - mainPanel.add(attributesMainPanel, BorderLayout.NORTH); - - // Left Side - Box box = Box.createVerticalBox(); - box.setBorder(BorderFactory.createTitledBorder("Setting diode attributes")); - - GridBagLayout gridBag = new GridBagLayout(); - GridBagConstraints constraints = new GridBagConstraints(); - JPanel boxPanel = new JPanel(); - boxPanel.setFont(new Font("Helvetica", Font.PLAIN, 14)); - boxPanel.setLayout(gridBag); - - JLabel labelName = new JLabel("Name : "); - constraints = new GridBagConstraints(0, 0, 1, 1, 1.0, 1.0, - GridBagConstraints.CENTER, - GridBagConstraints.BOTH, - new Insets(5, 10, 5, 10), 0, 0); - gridBag.setConstraints(labelName, constraints); - boxPanel.add(labelName); - - if (diode.getValue().toString().equals("")) { // name empty - nameTextField = new JTextField(10); - } else { - nameTextField = new JTextField(diode.getValue().toString(), 10); // name not empty - } - constraints = new GridBagConstraints(1, 0, 2, 1, 1.0, 1.0, - GridBagConstraints.CENTER, - GridBagConstraints.BOTH, - new Insets(5, 10, 5, 10), 0, 0); - gridBag.setConstraints(nameTextField, constraints); - boxPanel.add(nameTextField); - - JLabel valueLabel = new JLabel("Value : "); - constraints = new GridBagConstraints(0, 1, 1, 1, 1.0, 1.0, - GridBagConstraints.CENTER, - GridBagConstraints.BOTH, - new Insets(5, 10, 5, 10), 0, 0); - gridBag.setConstraints(valueLabel, constraints); - boxPanel.add(valueLabel); - - if (diode.getVal() == 0) { // name empty - valueTextField = new JTextField(10); - } else { - valueTextField = new JTextField("" + diode.getVal(), 10); // name not empty - } - constraints = new GridBagConstraints(1, 1, 1, 1, 1.0, 1.0, - GridBagConstraints.CENTER, - GridBagConstraints.BOTH, - new Insets(5, 10, 5, 10), 0, 0); - gridBag.setConstraints(valueTextField, constraints); - boxPanel.add(valueTextField); - - listValueString = new String[1]; - listValueString[0] = "V"; - valueComboBoxString = new JComboBox<String>(listValueString); - if (diode.getUnit().equals("V")) { - valueComboBoxString.setSelectedIndex(0); - } - valueComboBoxString.setActionCommand("unity"); - valueComboBoxString.addActionListener(this); - constraints = new GridBagConstraints(2, 1, 1, 1, 1.0, 1.0, - GridBagConstraints.CENTER, - GridBagConstraints.BOTH, - new Insets(5, 10, 5, 10), 0, 0); - gridBag.setConstraints(valueComboBoxString, constraints); - boxPanel.add(valueComboBoxString); - - box.add(boxPanel); // add border to box - attributesMainPanel.add(box); // add grid to grid - - // Down Side - JPanel downPanel = new JPanel(new GridLayout(1, 2)); - - JButton saveCloseButton = new JButton("Save and close"); - saveCloseButton.setIcon(IconManager.imgic25); - saveCloseButton.setActionCommand("Save_Close"); - saveCloseButton.addActionListener(this); - downPanel.add(saveCloseButton); - - JButton cancelButton = new JButton("Cancel"); - cancelButton.setIcon(IconManager.imgic27); - cancelButton.setActionCommand("Cancel"); - cancelButton.addActionListener(this); - downPanel.add(cancelButton); - - mainPanel.add(downPanel, BorderLayout.CENTER); - - this.getRootPane().setDefaultButton(saveCloseButton); - } - - public void actionPerformed(ActionEvent e) { - if ("Save_Close".equals(e.getActionCommand())) { - diode.setValue(new String(nameTextField.getText())); - - if (!(valueTextField.getText().isEmpty())) { - Boolean valValueInteger = false; - try { - Integer.parseInt(valueTextField.getText()); - } catch (NumberFormatException e1) { - JDialog msg = new JDialog(this); - msg.setLocationRelativeTo(null); - JOptionPane.showMessageDialog(msg, "The value of the diode is not a Integer", "Warning !", - JOptionPane.WARNING_MESSAGE); - valValueInteger = true; - } - if (valValueInteger == false) { - diode.setVal(Integer.parseInt(valueTextField.getText())); - } - } else { - diode.setVal(0); - } - diode.setUnit((String) valueComboBoxString.getSelectedItem()); - - this.dispose(); - } - - if ("Cancel".equals(e.getActionCommand())) { - this.dispose(); - } - } -} \ No newline at end of file diff --git a/src/main/java/ui/window/JDialogELNComponentGyrator.java b/src/main/java/ui/window/JDialogELNComponentGyrator.java index eba77ee3c39cbddd2582912e1f2a7c7fbd0a13e3..d8f4da99f0a2042387274ee4ca294a298fb7c24a 100644 --- a/src/main/java/ui/window/JDialogELNComponentGyrator.java +++ b/src/main/java/ui/window/JDialogELNComponentGyrator.java @@ -38,11 +38,11 @@ package ui.window; -import ui.eln.*; import ui.eln.sca_eln.ELNComponentGyrator; import ui.util.IconManager; import java.awt.BorderLayout; +import java.awt.Dimension; import java.awt.Font; import java.awt.GridBagConstraints; import java.awt.GridBagLayout; @@ -263,12 +263,14 @@ public class JDialogELNComponentGyrator extends JDialog implements ActionListene saveCloseButton.setIcon(IconManager.imgic25); saveCloseButton.setActionCommand("Save_Close"); saveCloseButton.addActionListener(this); + saveCloseButton.setPreferredSize(new Dimension(200, 30)); downPanel.add(saveCloseButton); JButton cancelButton = new JButton("Cancel"); cancelButton.setIcon(IconManager.imgic27); cancelButton.setActionCommand("Cancel"); cancelButton.addActionListener(this); + cancelButton.setPreferredSize(new Dimension(200, 30)); downPanel.add(cancelButton); mainPanel.add(downPanel, BorderLayout.CENTER); diff --git a/src/main/java/ui/window/JDialogELNComponentIdealTransformer.java b/src/main/java/ui/window/JDialogELNComponentIdealTransformer.java index c1981f2f7179d60816a4bd0a7065930a0ebdb24a..2ae72f577bfb77bb3c77acfbadc1f81071341893 100644 --- a/src/main/java/ui/window/JDialogELNComponentIdealTransformer.java +++ b/src/main/java/ui/window/JDialogELNComponentIdealTransformer.java @@ -38,11 +38,11 @@ package ui.window; -import ui.eln.*; import ui.eln.sca_eln.ELNComponentIdealTransformer; import ui.util.IconManager; import java.awt.BorderLayout; +import java.awt.Dimension; import java.awt.Font; import java.awt.GridBagConstraints; import java.awt.GridBagLayout; @@ -165,12 +165,14 @@ public class JDialogELNComponentIdealTransformer extends JDialog implements Acti saveCloseButton.setIcon(IconManager.imgic25); saveCloseButton.setActionCommand("Save_Close"); saveCloseButton.addActionListener(this); + saveCloseButton.setPreferredSize(new Dimension(200, 30)); downPanel.add(saveCloseButton); JButton cancelButton = new JButton("Cancel"); cancelButton.setIcon(IconManager.imgic27); cancelButton.setActionCommand("Cancel"); cancelButton.addActionListener(this); + cancelButton.setPreferredSize(new Dimension(200, 30)); downPanel.add(cancelButton); mainPanel.add(downPanel, BorderLayout.CENTER); diff --git a/src/main/java/ui/window/JDialogELNComponentIndependentCurrentSource.java b/src/main/java/ui/window/JDialogELNComponentIndependentCurrentSource.java index c2dd2ba20157dc141a8daa926cced774378cdc3e..f40ec646d748aa5439dde4a44ea6fa0d1f5748b5 100644 --- a/src/main/java/ui/window/JDialogELNComponentIndependentCurrentSource.java +++ b/src/main/java/ui/window/JDialogELNComponentIndependentCurrentSource.java @@ -38,11 +38,11 @@ package ui.window; -import ui.eln.*; import ui.eln.sca_eln.ELNComponentIndependentCurrentSource; import ui.util.IconManager; import java.awt.BorderLayout; +import java.awt.Dimension; import java.awt.Font; import java.awt.GridBagConstraints; import java.awt.GridBagLayout; @@ -151,7 +151,6 @@ public class JDialogELNComponentIndependentCurrentSource extends JDialog impleme gridBag.setConstraints(nameTextField, constraints); boxPanel.add(nameTextField); - //1 JLabel initValLabel = new JLabel("init_value : "); constraints = new GridBagConstraints(0, 1, 1, 1, 1.0, 1.0, GridBagConstraints.CENTER, @@ -168,7 +167,6 @@ public class JDialogELNComponentIndependentCurrentSource extends JDialog impleme gridBag.setConstraints(initValueTextField, constraints); boxPanel.add(initValueTextField); - //2 JLabel offsetLabel = new JLabel("offset : "); constraints = new GridBagConstraints(0, 2, 1, 1, 1.0, 1.0, GridBagConstraints.CENTER, @@ -185,7 +183,6 @@ public class JDialogELNComponentIndependentCurrentSource extends JDialog impleme gridBag.setConstraints(offsetTextField, constraints); boxPanel.add(offsetTextField); - //3 JLabel amplitudeLabel = new JLabel("amplitude : "); constraints = new GridBagConstraints(0, 3, 1, 1, 1.0, 1.0, GridBagConstraints.CENTER, @@ -202,7 +199,6 @@ public class JDialogELNComponentIndependentCurrentSource extends JDialog impleme gridBag.setConstraints(amplitudeTextField, constraints); boxPanel.add(amplitudeTextField); - //4 JLabel frequencyLabel = new JLabel("frequency : "); constraints = new GridBagConstraints(0, 4, 1, 1, 1.0, 1.0, GridBagConstraints.CENTER, @@ -257,7 +253,6 @@ public class JDialogELNComponentIndependentCurrentSource extends JDialog impleme gridBag.setConstraints(frequencyComboBoxString, constraints); boxPanel.add(frequencyComboBoxString); - //5 JLabel phaseLabel = new JLabel("phase : "); constraints = new GridBagConstraints(0, 5, 1, 1, 1.0, 1.0, GridBagConstraints.CENTER, @@ -282,7 +277,6 @@ public class JDialogELNComponentIndependentCurrentSource extends JDialog impleme gridBag.setConstraints(phaseRadLabel, constraints); boxPanel.add(phaseRadLabel); - //6 JLabel delayLabel = new JLabel("delay : "); constraints = new GridBagConstraints(0, 6, 1, 1, 1.0, 1.0, GridBagConstraints.CENTER, @@ -299,7 +293,6 @@ public class JDialogELNComponentIndependentCurrentSource extends JDialog impleme gridBag.setConstraints(delayTextField, constraints); boxPanel.add(delayTextField); - //7 JLabel acAmplitudeLabel = new JLabel("ac_amplitude : "); constraints = new GridBagConstraints(0, 7, 1, 1, 1.0, 1.0, GridBagConstraints.CENTER, @@ -316,7 +309,6 @@ public class JDialogELNComponentIndependentCurrentSource extends JDialog impleme gridBag.setConstraints(acAmplitudeTextField, constraints); boxPanel.add(acAmplitudeTextField); - //8 JLabel acPhaseLabel = new JLabel("ac_phase : "); constraints = new GridBagConstraints(0, 8, 1, 1, 1.0, 1.0, GridBagConstraints.CENTER, @@ -341,7 +333,6 @@ public class JDialogELNComponentIndependentCurrentSource extends JDialog impleme gridBag.setConstraints(acPhaseRadLabel, constraints); boxPanel.add(acPhaseRadLabel); - //9 JLabel acNoiseAmplitudeLabel = new JLabel("ac_noise_amplitude : "); constraints = new GridBagConstraints(0, 9, 1, 1, 1.0, 1.0, GridBagConstraints.CENTER, @@ -369,12 +360,14 @@ public class JDialogELNComponentIndependentCurrentSource extends JDialog impleme saveCloseButton.setIcon(IconManager.imgic25); saveCloseButton.setActionCommand("Save_Close"); saveCloseButton.addActionListener(this); + saveCloseButton.setPreferredSize(new Dimension(200, 30)); downPanel.add(saveCloseButton); JButton cancelButton = new JButton("Cancel"); cancelButton.setIcon(IconManager.imgic27); cancelButton.setActionCommand("Cancel"); cancelButton.addActionListener(this); + cancelButton.setPreferredSize(new Dimension(200, 30)); downPanel.add(cancelButton); mainPanel.add(downPanel, BorderLayout.CENTER); @@ -386,7 +379,6 @@ public class JDialogELNComponentIndependentCurrentSource extends JDialog impleme if ("Save_Close".equals(e.getActionCommand())) { isource.setValue(new String(nameTextField.getText())); - //1 if (!(initValueTextField.getText().isEmpty())) { Boolean initValValueDouble = false; try { @@ -405,7 +397,6 @@ public class JDialogELNComponentIndependentCurrentSource extends JDialog impleme isource.setInitValue(0.0); } - //2 if (!(offsetTextField.getText().isEmpty())) { Boolean offsetValueDouble = false; try { @@ -424,7 +415,6 @@ public class JDialogELNComponentIndependentCurrentSource extends JDialog impleme isource.setOffset(0.0); } - //3 if (!(amplitudeTextField.getText().isEmpty())) { Boolean amplitudeValueDouble = false; try { @@ -443,7 +433,6 @@ public class JDialogELNComponentIndependentCurrentSource extends JDialog impleme isource.setAmplitude(0.0); } - //4 if (!(frequencyTextField.getText().isEmpty())) { Boolean frequencyValueDouble = false; try { @@ -464,7 +453,6 @@ public class JDialogELNComponentIndependentCurrentSource extends JDialog impleme isource.setUnit0((String) frequencyComboBoxString.getSelectedItem()); - //5 if (!(phaseTextField.getText().isEmpty())) { Boolean phaseValueDouble = false; try { @@ -483,7 +471,6 @@ public class JDialogELNComponentIndependentCurrentSource extends JDialog impleme isource.setPhase(0.0); } - //6 String a = delayTextField.getText().split(Pattern.quote("("))[1].split(",")[0]; String b = delayTextField.getText().split(Pattern.quote("("))[1].split(",")[1].split(Pattern.quote(")"))[0].split(" ")[1]; @@ -491,7 +478,6 @@ public class JDialogELNComponentIndependentCurrentSource extends JDialog impleme isource.setDelay(delayTextField.getText()); } - //7 if (!(acAmplitudeTextField.getText().isEmpty())) { Boolean acAmplitudeValueDouble = false; try { @@ -510,7 +496,6 @@ public class JDialogELNComponentIndependentCurrentSource extends JDialog impleme isource.setAcAmplitude(0.0); } - //8 if (!(acPhaseTextField.getText().isEmpty())) { Boolean acPhaseValueDouble = false; try { @@ -529,7 +514,6 @@ public class JDialogELNComponentIndependentCurrentSource extends JDialog impleme isource.setAcPhase(0.0); } - //9 if (!(acNoiseAmplitudeTextField.getText().isEmpty())) { Boolean acNoiseAmplitudeValueDouble = false; try { diff --git a/src/main/java/ui/window/JDialogELNComponentIndependentVoltageSource.java b/src/main/java/ui/window/JDialogELNComponentIndependentVoltageSource.java index 2ba0f2de37884e38018799d6928fa849284d4947..ea1296913df05556c012a170e5710d1760dcca11 100644 --- a/src/main/java/ui/window/JDialogELNComponentIndependentVoltageSource.java +++ b/src/main/java/ui/window/JDialogELNComponentIndependentVoltageSource.java @@ -38,11 +38,11 @@ package ui.window; -import ui.eln.*; import ui.eln.sca_eln.ELNComponentIndependentVoltageSource; import ui.util.IconManager; import java.awt.BorderLayout; +import java.awt.Dimension; import java.awt.Font; import java.awt.GridBagConstraints; import java.awt.GridBagLayout; @@ -151,7 +151,6 @@ public class JDialogELNComponentIndependentVoltageSource extends JDialog impleme gridBag.setConstraints(nameTextField, constraints); boxPanel.add(nameTextField); - //1 JLabel initValLabel = new JLabel("init_value : "); constraints = new GridBagConstraints(0, 1, 1, 1, 1.0, 1.0, GridBagConstraints.CENTER, @@ -168,7 +167,6 @@ public class JDialogELNComponentIndependentVoltageSource extends JDialog impleme gridBag.setConstraints(initValueTextField, constraints); boxPanel.add(initValueTextField); - //2 JLabel offsetLabel = new JLabel("offset : "); constraints = new GridBagConstraints(0, 2, 1, 1, 1.0, 1.0, GridBagConstraints.CENTER, @@ -185,7 +183,6 @@ public class JDialogELNComponentIndependentVoltageSource extends JDialog impleme gridBag.setConstraints(offsetTextField, constraints); boxPanel.add(offsetTextField); - //3 JLabel amplitudeLabel = new JLabel("amplitude : "); constraints = new GridBagConstraints(0, 3, 1, 1, 1.0, 1.0, GridBagConstraints.CENTER, @@ -202,7 +199,6 @@ public class JDialogELNComponentIndependentVoltageSource extends JDialog impleme gridBag.setConstraints(amplitudeTextField, constraints); boxPanel.add(amplitudeTextField); - //4 JLabel frequencyLabel = new JLabel("frequency : "); constraints = new GridBagConstraints(0, 4, 1, 1, 1.0, 1.0, GridBagConstraints.CENTER, @@ -257,7 +253,6 @@ public class JDialogELNComponentIndependentVoltageSource extends JDialog impleme gridBag.setConstraints(frequencyComboBoxString, constraints); boxPanel.add(frequencyComboBoxString); - //5 JLabel phaseLabel = new JLabel("phase : "); constraints = new GridBagConstraints(0, 5, 1, 1, 1.0, 1.0, GridBagConstraints.CENTER, @@ -282,7 +277,6 @@ public class JDialogELNComponentIndependentVoltageSource extends JDialog impleme gridBag.setConstraints(phaseRadLabel, constraints); boxPanel.add(phaseRadLabel); - //6 JLabel delayLabel = new JLabel("delay : "); constraints = new GridBagConstraints(0, 6, 1, 1, 1.0, 1.0, GridBagConstraints.CENTER, @@ -299,7 +293,6 @@ public class JDialogELNComponentIndependentVoltageSource extends JDialog impleme gridBag.setConstraints(delayTextField, constraints); boxPanel.add(delayTextField); - //7 JLabel acAmplitudeLabel = new JLabel("ac_amplitude : "); constraints = new GridBagConstraints(0, 7, 1, 1, 1.0, 1.0, GridBagConstraints.CENTER, @@ -316,7 +309,6 @@ public class JDialogELNComponentIndependentVoltageSource extends JDialog impleme gridBag.setConstraints(acAmplitudeTextField, constraints); boxPanel.add(acAmplitudeTextField); - //8 JLabel acPhaseLabel = new JLabel("ac_phase : "); constraints = new GridBagConstraints(0, 8, 1, 1, 1.0, 1.0, GridBagConstraints.CENTER, @@ -341,7 +333,6 @@ public class JDialogELNComponentIndependentVoltageSource extends JDialog impleme gridBag.setConstraints(acPhaseRadLabel, constraints); boxPanel.add(acPhaseRadLabel); - //9 JLabel acNoiseAmplitudeLabel = new JLabel("ac_noise_amplitude : "); constraints = new GridBagConstraints(0, 9, 1, 1, 1.0, 1.0, GridBagConstraints.CENTER, @@ -369,12 +360,14 @@ public class JDialogELNComponentIndependentVoltageSource extends JDialog impleme saveCloseButton.setIcon(IconManager.imgic25); saveCloseButton.setActionCommand("Save_Close"); saveCloseButton.addActionListener(this); + saveCloseButton.setPreferredSize(new Dimension(200, 30)); downPanel.add(saveCloseButton); JButton cancelButton = new JButton("Cancel"); cancelButton.setIcon(IconManager.imgic27); cancelButton.setActionCommand("Cancel"); cancelButton.addActionListener(this); + cancelButton.setPreferredSize(new Dimension(200, 30)); downPanel.add(cancelButton); mainPanel.add(downPanel, BorderLayout.CENTER); @@ -386,7 +379,6 @@ public class JDialogELNComponentIndependentVoltageSource extends JDialog impleme if ("Save_Close".equals(e.getActionCommand())) { vsource.setValue(new String(nameTextField.getText())); - //1 if (!(initValueTextField.getText().isEmpty())) { Boolean initValValueDouble = false; try { @@ -405,7 +397,6 @@ public class JDialogELNComponentIndependentVoltageSource extends JDialog impleme vsource.setInitValue(0.0); } - //2 if (!(offsetTextField.getText().isEmpty())) { Boolean offsetValueDouble = false; try { @@ -424,7 +415,6 @@ public class JDialogELNComponentIndependentVoltageSource extends JDialog impleme vsource.setOffset(0.0); } - //3 if (!(amplitudeTextField.getText().isEmpty())) { Boolean amplitudeValueDouble = false; try { @@ -442,8 +432,7 @@ public class JDialogELNComponentIndependentVoltageSource extends JDialog impleme } else { vsource.setAmplitude(0.0); } - - //4 + if (!(frequencyTextField.getText().isEmpty())) { Boolean frequencyValueDouble = false; try { @@ -464,7 +453,6 @@ public class JDialogELNComponentIndependentVoltageSource extends JDialog impleme vsource.setUnit0((String) frequencyComboBoxString.getSelectedItem()); - //5 if (!(phaseTextField.getText().isEmpty())) { Boolean phaseValueDouble = false; try { @@ -483,7 +471,6 @@ public class JDialogELNComponentIndependentVoltageSource extends JDialog impleme vsource.setPhase(0.0); } - //6 String a = delayTextField.getText().split(Pattern.quote("("))[1].split(",")[0]; String b = delayTextField.getText().split(Pattern.quote("("))[1].split(",")[1].split(Pattern.quote(")"))[0].split(" ")[1]; @@ -491,7 +478,6 @@ public class JDialogELNComponentIndependentVoltageSource extends JDialog impleme vsource.setDelay(delayTextField.getText()); } - //7 if (!(acAmplitudeTextField.getText().isEmpty())) { Boolean acAmplitudeValueDouble = false; try { @@ -510,7 +496,6 @@ public class JDialogELNComponentIndependentVoltageSource extends JDialog impleme vsource.setAcAmplitude(0.0); } - //8 if (!(acPhaseTextField.getText().isEmpty())) { Boolean acPhaseValueDouble = false; try { @@ -529,7 +514,6 @@ public class JDialogELNComponentIndependentVoltageSource extends JDialog impleme vsource.setAcPhase(0.0); } - //9 if (!(acNoiseAmplitudeTextField.getText().isEmpty())) { Boolean acNoiseAmplitudeValueDouble = false; try { diff --git a/src/main/java/ui/window/JDialogELNComponentInductor.java b/src/main/java/ui/window/JDialogELNComponentInductor.java index b29a7299d069f331a5e0e7718aa0614f932d72c7..4d042966c3e4d41f79a874b56423e0e1ae6d3bf7 100644 --- a/src/main/java/ui/window/JDialogELNComponentInductor.java +++ b/src/main/java/ui/window/JDialogELNComponentInductor.java @@ -38,11 +38,11 @@ package ui.window; -import ui.eln.*; import ui.eln.sca_eln.ELNComponentInductor; import ui.util.IconManager; import java.awt.BorderLayout; +import java.awt.Dimension; import java.awt.Font; import java.awt.GridBagConstraints; import java.awt.GridBagLayout; @@ -263,12 +263,14 @@ public class JDialogELNComponentInductor extends JDialog implements ActionListen saveCloseButton.setIcon(IconManager.imgic25); saveCloseButton.setActionCommand("Save_Close"); saveCloseButton.addActionListener(this); + saveCloseButton.setPreferredSize(new Dimension(200, 30)); downPanel.add(saveCloseButton); JButton cancelButton = new JButton("Cancel"); cancelButton.setIcon(IconManager.imgic27); cancelButton.setActionCommand("Cancel"); cancelButton.addActionListener(this); + cancelButton.setPreferredSize(new Dimension(200, 30)); downPanel.add(cancelButton); mainPanel.add(downPanel, BorderLayout.CENTER); diff --git a/src/main/java/ui/window/JDialogELNComponentNMOS.java b/src/main/java/ui/window/JDialogELNComponentNMOS.java deleted file mode 100644 index 1f15e7670e8357b5779885b5e36b1b57c4eac38e..0000000000000000000000000000000000000000 --- a/src/main/java/ui/window/JDialogELNComponentNMOS.java +++ /dev/null @@ -1,5 +0,0 @@ -package ui.window; - -public class JDialogELNComponentNMOS { - -} diff --git a/src/main/java/ui/window/JDialogELNComponentNullor.java b/src/main/java/ui/window/JDialogELNComponentNullor.java index cbf6ad26dd153b6a2b576932d03c2754c7b2a92d..681ebd5356a1e574c10a738cfc68c0424551c2af 100644 --- a/src/main/java/ui/window/JDialogELNComponentNullor.java +++ b/src/main/java/ui/window/JDialogELNComponentNullor.java @@ -38,11 +38,11 @@ package ui.window; -import ui.eln.*; import ui.eln.sca_eln.ELNComponentNullor; import ui.util.IconManager; import java.awt.BorderLayout; +import java.awt.Dimension; import java.awt.Font; import java.awt.GridBagConstraints; import java.awt.GridBagLayout; @@ -147,12 +147,14 @@ public class JDialogELNComponentNullor extends JDialog implements ActionListener saveCloseButton.setIcon(IconManager.imgic25); saveCloseButton.setActionCommand("Save_Close"); saveCloseButton.addActionListener(this); + saveCloseButton.setPreferredSize(new Dimension(200, 30)); downPanel.add(saveCloseButton); JButton cancelButton = new JButton("Cancel"); cancelButton.setIcon(IconManager.imgic27); cancelButton.setActionCommand("Cancel"); cancelButton.addActionListener(this); + cancelButton.setPreferredSize(new Dimension(200, 30)); downPanel.add(cancelButton); mainPanel.add(downPanel, BorderLayout.CENTER); diff --git a/src/main/java/ui/window/JDialogELNComponentPMOS.java b/src/main/java/ui/window/JDialogELNComponentPMOS.java deleted file mode 100644 index 7644e99265cb17471b3c538e83337032736110f0..0000000000000000000000000000000000000000 --- a/src/main/java/ui/window/JDialogELNComponentPMOS.java +++ /dev/null @@ -1,5 +0,0 @@ -package ui.window; - -public class JDialogELNComponentPMOS { - -} diff --git a/src/main/java/ui/window/JDialogELNComponentResistor.java b/src/main/java/ui/window/JDialogELNComponentResistor.java index b1f7e24b0a1cbd90c47d9904b2e98b8f24070b48..e4688ee51dbdd94ce811a1139b2ca028e993c4d8 100644 --- a/src/main/java/ui/window/JDialogELNComponentResistor.java +++ b/src/main/java/ui/window/JDialogELNComponentResistor.java @@ -38,11 +38,11 @@ package ui.window; -import ui.eln.*; import ui.eln.sca_eln.ELNComponentResistor; import ui.util.IconManager; import java.awt.BorderLayout; +import java.awt.Dimension; import java.awt.Font; import java.awt.GridBagConstraints; import java.awt.GridBagLayout; @@ -206,12 +206,14 @@ public class JDialogELNComponentResistor extends JDialog implements ActionListen saveCloseButton.setIcon(IconManager.imgic25); saveCloseButton.setActionCommand("Save_Close"); saveCloseButton.addActionListener(this); + saveCloseButton.setPreferredSize(new Dimension(200, 30)); downPanel.add(saveCloseButton); JButton cancelButton = new JButton("Cancel"); cancelButton.setIcon(IconManager.imgic27); cancelButton.setActionCommand("Cancel"); cancelButton.addActionListener(this); + cancelButton.setPreferredSize(new Dimension(200, 30)); downPanel.add(cancelButton); mainPanel.add(downPanel, BorderLayout.CENTER); diff --git a/src/main/java/ui/window/JDialogELNComponentResistorDE.java b/src/main/java/ui/window/JDialogELNComponentResistorDE.java new file mode 100644 index 0000000000000000000000000000000000000000..008798e4523ad700218117f9d123d86edb584a83 --- /dev/null +++ b/src/main/java/ui/window/JDialogELNComponentResistorDE.java @@ -0,0 +1,5 @@ +package ui.window; + +public class JDialogELNComponentResistorDE { + +} diff --git a/src/main/java/ui/window/JDialogELNComponentResistorTDf.java b/src/main/java/ui/window/JDialogELNComponentResistorTDf.java new file mode 100644 index 0000000000000000000000000000000000000000..4dac30f615db91adc249d2d49c3832fa9ad91d04 --- /dev/null +++ b/src/main/java/ui/window/JDialogELNComponentResistorTDf.java @@ -0,0 +1,5 @@ +package ui.window; + +public class JDialogELNComponentResistorTDf { + +} diff --git a/src/main/java/ui/window/JDialogELNComponentTransmissionLine.java b/src/main/java/ui/window/JDialogELNComponentTransmissionLine.java index 0a8b87f1637780e3c3571054f6ff5b01320e4ddb..3fce9e7bdaa2be0d184bf3590c446c309a42e40d 100644 --- a/src/main/java/ui/window/JDialogELNComponentTransmissionLine.java +++ b/src/main/java/ui/window/JDialogELNComponentTransmissionLine.java @@ -38,11 +38,11 @@ package ui.window; -import ui.eln.*; import ui.eln.sca_eln.ELNComponentTransmissionLine; import ui.util.IconManager; import java.awt.BorderLayout; +import java.awt.Dimension; import java.awt.Font; import java.awt.GridBagConstraints; import java.awt.GridBagLayout; @@ -281,12 +281,14 @@ public class JDialogELNComponentTransmissionLine extends JDialog implements Acti saveCloseButton.setIcon(IconManager.imgic25); saveCloseButton.setActionCommand("Save_Close"); saveCloseButton.addActionListener(this); + saveCloseButton.setPreferredSize(new Dimension(200, 30)); downPanel.add(saveCloseButton); JButton cancelButton = new JButton("Cancel"); cancelButton.setIcon(IconManager.imgic27); cancelButton.setActionCommand("Cancel"); cancelButton.addActionListener(this); + cancelButton.setPreferredSize(new Dimension(200, 30)); downPanel.add(cancelButton); mainPanel.add(downPanel, BorderLayout.CENTER); diff --git a/src/main/java/ui/window/JDialogELNComponentVoltageControlledCurrentSource.java b/src/main/java/ui/window/JDialogELNComponentVoltageControlledCurrentSource.java index d589cc3376fde12582b1b0015739259afbf8ae72..bc68cc65460ed8031b69ff773d6f7aadac82034d 100644 --- a/src/main/java/ui/window/JDialogELNComponentVoltageControlledCurrentSource.java +++ b/src/main/java/ui/window/JDialogELNComponentVoltageControlledCurrentSource.java @@ -38,11 +38,11 @@ package ui.window; -import ui.eln.*; import ui.eln.sca_eln.ELNComponentVoltageControlledCurrentSource; import ui.util.IconManager; import java.awt.BorderLayout; +import java.awt.Dimension; import java.awt.Font; import java.awt.GridBagConstraints; import java.awt.GridBagLayout; @@ -206,12 +206,14 @@ public class JDialogELNComponentVoltageControlledCurrentSource extends JDialog i saveCloseButton.setIcon(IconManager.imgic25); saveCloseButton.setActionCommand("Save_Close"); saveCloseButton.addActionListener(this); + saveCloseButton.setPreferredSize(new Dimension(200, 30)); downPanel.add(saveCloseButton); JButton cancelButton = new JButton("Cancel"); cancelButton.setIcon(IconManager.imgic27); cancelButton.setActionCommand("Cancel"); cancelButton.addActionListener(this); + cancelButton.setPreferredSize(new Dimension(200, 30)); downPanel.add(cancelButton); mainPanel.add(downPanel, BorderLayout.CENTER); diff --git a/src/main/java/ui/window/JDialogELNComponentVoltageControlledVoltageSource.java b/src/main/java/ui/window/JDialogELNComponentVoltageControlledVoltageSource.java index a1260732be1e7db85c1a2bfcde83740b76a3cfa5..931e87179db700df0b5c7da3885fd5d4b984d346 100644 --- a/src/main/java/ui/window/JDialogELNComponentVoltageControlledVoltageSource.java +++ b/src/main/java/ui/window/JDialogELNComponentVoltageControlledVoltageSource.java @@ -43,6 +43,7 @@ import ui.eln.sca_eln.ELNComponentVoltageControlledVoltageSource; import ui.util.IconManager; import java.awt.BorderLayout; +import java.awt.Dimension; import java.awt.Font; import java.awt.GridBagConstraints; import java.awt.GridBagLayout; @@ -165,12 +166,14 @@ public class JDialogELNComponentVoltageControlledVoltageSource extends JDialog i saveCloseButton.setIcon(IconManager.imgic25); saveCloseButton.setActionCommand("Save_Close"); saveCloseButton.addActionListener(this); + saveCloseButton.setPreferredSize(new Dimension(200, 30)); downPanel.add(saveCloseButton); JButton cancelButton = new JButton("Cancel"); cancelButton.setIcon(IconManager.imgic27); cancelButton.setActionCommand("Cancel"); cancelButton.addActionListener(this); + cancelButton.setPreferredSize(new Dimension(200, 30)); downPanel.add(cancelButton); mainPanel.add(downPanel, BorderLayout.CENTER);