diff --git a/src/main/java/ui/ActionPerformer.java b/src/main/java/ui/ActionPerformer.java index 4cdf8a16a3eb2bd4f424d1eb89c66440fd13ca8c..070fc05e09fb67734fe159356aa5bf5418782609 100644 --- a/src/main/java/ui/ActionPerformer.java +++ b/src/main/java/ui/ActionPerformer.java @@ -969,6 +969,10 @@ public class ActionPerformer { mgui.actionOnButton(TGComponentManager.COMPONENT, TGComponentManager.ELN_MODULE_TERMINAL); } else if (command.equals(mgui.actions[TGUIAction.ELN_TOGGLE_ATTR].getActionCommand())){ mgui.toggleELN(); + } else if (command.equals(mgui.actions[TGUIAction.ELN_TDF_VOLTAGE_SOURCE].getActionCommand())){ + mgui.actionOnButton(TGComponentManager.COMPONENT, TGComponentManager.ELN_TDF_VOLTAGE_SOURCE); + } else if (command.equals(mgui.actions[TGUIAction.ELN_TDF_CURRENT_SOURCE].getActionCommand())){ + mgui.actionOnButton(TGComponentManager.COMPONENT, TGComponentManager.ELN_TDF_CURRENT_SOURCE); // 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 7c4de6ed5986dc00ad617420034b95204049e7ff..18642e4074253a8cb6e748cfe3b95d604e32b53e 100644 --- a/src/main/java/ui/TGComponentManager.java +++ b/src/main/java/ui/TGComponentManager.java @@ -363,6 +363,8 @@ public class TGComponentManager { public static final int ELN_MODULE = 1623; public static final int ELN_MODULE_TERMINAL = 1624; public static final int ELN_MID_PORT_TERMINAL = 1625; + public static final int ELN_TDF_VOLTAGE_SOURCE = 1626; + public static final int ELN_TDF_CURRENT_SOURCE = 1627; // SMD diagram public static final int PROSMD_START_STATE = 2000; @@ -1335,6 +1337,12 @@ public class TGComponentManager { case ELN_MID_PORT_TERMINAL: tgc = new ELNMidPortTerminal(x, y, tdp.getMinX(), tdp.getMaxX(), tdp.getMinY(), tdp.getMaxY(), false, null, tdp); break; + case ELN_TDF_VOLTAGE_SOURCE: + tgc = new ELNComponentVoltageSourceTDF(x, y, tdp.getMinX(), tdp.getMaxX(), tdp.getMinY(), tdp.getMaxY(), false, null, tdp); + break; + case ELN_TDF_CURRENT_SOURCE: + tgc = new ELNComponentCurrentSourceTDF(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); @@ -1769,6 +1777,10 @@ public class TGComponentManager { return ELN_MODULE_TERMINAL; } else if (tgc instanceof ELNMidPortTerminal) { return ELN_MID_PORT_TERMINAL; + } else if (tgc instanceof ELNComponentVoltageSourceTDF) { + return ELN_TDF_VOLTAGE_SOURCE; + } else if (tgc instanceof ELNComponentCurrentSourceTDF) { + return ELN_TDF_CURRENT_SOURCE; // Others } else if (tgc instanceof TADDeterministicDelay) { diff --git a/src/main/java/ui/TGUIAction.java b/src/main/java/ui/TGUIAction.java index 9f5f95850158f15301df04e6a991bbf8112a1ffa..f554a7f5aa4bd64301a1ec03447c15cb1cf482cd 100644 --- a/src/main/java/ui/TGUIAction.java +++ b/src/main/java/ui/TGUIAction.java @@ -304,6 +304,8 @@ public class TGUIAction extends AbstractAction { public static final int ELN_MODULE = 499; public static final int ELN_MODULE_TERMINAL = 500; public static final int ELN_TOGGLE_ATTR = 501; + public static final int ELN_TDF_VOLTAGE_SOURCE = 502; + public static final int ELN_TDF_CURRENT_SOURCE = 503; public static final int EBRDD_EDIT = 271; public static final int EBRDD_CONNECTOR = 272; @@ -659,7 +661,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 = 502; + public static final int NB_ACTION = 504; private static final TAction [] actions = new TAction[NB_ACTION]; @@ -1183,7 +1185,9 @@ public class TGUIAction extends AbstractAction { 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); actions[ELN_MODULE_TERMINAL] = new TAction("eln-module-terminal", "Add a module terminal", IconManager.imgic8032, IconManager.imgic8032, "Module terminal", "Add a module terminal to the currently opened ELN Diagram", 0); actions[ELN_TOGGLE_ATTR] = new TAction("eln-toggle-attr-command", "Show / hide attributes in ELN", IconManager.imgic138, IconManager.imgic138, "Show / hide element attributes in ELN", "Show / hide attributes to the currently opened ELN Diagram", 0); - + actions[ELN_TDF_VOLTAGE_SOURCE] = new TAction("eln-tdf-vsource", "Add a voltage source driven by a TDF input signal", IconManager.imgic8033, IconManager.imgic8033, "Voltage source driven by a TDF input signal", "Add a voltage source driven by a TDF input signal to the currently opened ELN Diagram", 0); + actions[ELN_TDF_CURRENT_SOURCE] = new TAction("eln-tdf-isource", "Add a current source driven by a TDF input signal", IconManager.imgic8034, IconManager.imgic8034, "Current source driven by a TDF input signal", "Add a current source driven by a TDF input signal 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); actions[PROSMD_START] = new TAction("add-prosmd-start", "Add Start state", IconManager.imgic222, IconManager.imgic222, "Start", "Add a start state to 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 d7ddfe3b6df88bc733a988c6aee8c6b979b4167f..69ed3db8bc1b83d259e2b7a5c8fd7e9d6007eea2 100644 --- a/src/main/java/ui/eln/ELNDiagramToolBar.java +++ b/src/main/java/ui/eln/ELNDiagramToolBar.java @@ -82,6 +82,8 @@ public class ELNDiagramToolBar extends TToolBar { mgui.actions[TGUIAction.ELN_MODULE].setEnabled(b); mgui.actions[TGUIAction.ELN_MODULE_TERMINAL].setEnabled(b); mgui.actions[TGUIAction.ELN_TOGGLE_ATTR].setEnabled(b); + mgui.actions[TGUIAction.ELN_TDF_VOLTAGE_SOURCE].setEnabled(b); + mgui.actions[TGUIAction.ELN_TDF_CURRENT_SOURCE].setEnabled(b); mgui.actions[TGUIAction.ACT_MODEL_CHECKING].setEnabled(b); mgui.actions[TGUIAction.ACT_ONECLICK_LOTOS_RG].setEnabled(b); @@ -142,6 +144,12 @@ public class ELNDiagramToolBar extends TToolBar { this.addSeparator(); + button = this.add(mgui.actions[TGUIAction.ELN_TDF_VOLTAGE_SOURCE]); + button.addMouseListener(mgui.mouseHandler); + + button = this.add(mgui.actions[TGUIAction.ELN_TDF_CURRENT_SOURCE]); + button.addMouseListener(mgui.mouseHandler); + button = this.add(mgui.actions[TGUIAction.ELN_TDF_VOLTAGE_SINK]); button.addMouseListener(mgui.mouseHandler); diff --git a/src/main/java/ui/util/IconManager.java b/src/main/java/ui/util/IconManager.java index 60638edfe9c20ec64f958d111763e7cad1c1b338..b54bb121219ad0ed343b1f21a3ccd9a7f951c15d 100755 --- a/src/main/java/ui/util/IconManager.java +++ b/src/main/java/ui/util/IconManager.java @@ -187,7 +187,7 @@ public class IconManager { // ELN public static ImageIcon imgic8020, imgic8021, imgic8022, imgic8023, imgic8024, imgic8025, imgic8026, imgic8027, imgic8028, imgic8029, - imgic8030, imgic8031, imgic8032; + imgic8030, imgic8031, imgic8032, imgic8033, imgic8034; //private static String icon7 = "turtle_large.gif"; private static String ttoolStringIcon = "starting_logo.gif"; @@ -692,6 +692,8 @@ public class IconManager { private static String icon8030 = "elntdfvsink.gif"; private static String icon8031 = "elntdfisink.gif"; private static String icon8032 = "elnportterminal.gif"; + private static String icon8033 = "elntdfvsource.gif"; + private static String icon8034 = "elntdfisource.gif"; public IconManager() { @@ -1206,6 +1208,8 @@ public class IconManager { imgic8030 = getIcon(icon8030); imgic8031 = getIcon(icon8031); imgic8032 = getIcon(icon8032); + imgic8033 = getIcon(icon8033); + imgic8034 = getIcon(icon8034); } } // Class diff --git a/src/main/java/ui/window/JDialogELNComponentCurrentSourceTDF.java b/src/main/java/ui/window/JDialogELNComponentCurrentSourceTDF.java new file mode 100644 index 0000000000000000000000000000000000000000..4c2c8c814e7091675422fbf8dea54692faf2a5d4 --- /dev/null +++ b/src/main/java/ui/window/JDialogELNComponentCurrentSourceTDF.java @@ -0,0 +1,203 @@ +/* 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.sca_eln_sca_tdf.ELNComponentCurrentSourceTDF; +import ui.util.IconManager; + +import java.awt.BorderLayout; +import java.awt.Dimension; +import java.awt.FlowLayout; +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.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 JDialogELNComponentCurrentSourceTDF + * Dialog for managing the ELN current driven by a TDF input signal + * Creation: 19/07/2018 + * @version 1.0 19/07/2018 + * @author Irina Kit Yan LEE +*/ + +@SuppressWarnings("serial") + +public class JDialogELNComponentCurrentSourceTDF extends JDialog implements ActionListener { + private JTextField nameTextField; + private JTextField valueTextField; + + private ELNComponentCurrentSourceTDF isource; + + public JDialogELNComponentCurrentSourceTDF(ELNComponentCurrentSourceTDF _isource) { + setTitle("Setting the current driven by a TDF output signal"); + setLocationRelativeTo(null); + setVisible(true); + setAlwaysOnTop(true); + setResizable(false); + + isource = _isource; + + 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 mainPanel = new JPanel(new BorderLayout()); + this.add(mainPanel); + + JPanel attributesMainPanel = new JPanel(new GridLayout()); + mainPanel.add(attributesMainPanel, BorderLayout.NORTH); + + Box box = Box.createVerticalBox(); + box.setBorder(BorderFactory.createTitledBorder("Setting eln_tdf_isource 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("nm : "); + 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); + + nameTextField = new JTextField(isource.getValue().toString(), 10); + 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("scale : "); + 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); + + valueTextField = new JTextField("" + isource.getScale(), 10); + 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); + + box.add(boxPanel); + attributesMainPanel.add(box); + + JPanel downPanel = new JPanel(new FlowLayout()); + + JButton saveCloseButton = new JButton("Save and close"); + 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); + pack(); + this.getRootPane().setDefaultButton(saveCloseButton); + } + + public void actionPerformed(ActionEvent e) { + if ("Save_Close".equals(e.getActionCommand())) { + isource.setValue(new String(nameTextField.getText())); + + if (!(valueTextField.getText().isEmpty())) { + Boolean valValueDouble = false; + try { + Double.parseDouble(valueTextField.getText()); + } catch (NumberFormatException e1) { + JDialog msg = new JDialog(this); + msg.setLocationRelativeTo(null); + JOptionPane.showMessageDialog(msg, "The scale coefficient is not a Double", "Warning !", + JOptionPane.WARNING_MESSAGE); + valValueDouble = true; + } + if (valValueDouble == false) { + isource.setScale(Double.parseDouble(valueTextField.getText())); + } + } else { + isource.setScale(1.0); + } + + this.dispose(); + } + + if ("Cancel".equals(e.getActionCommand())) { + this.dispose(); + } + } +} \ No newline at end of file diff --git a/src/main/java/ui/window/JDialogELNComponentVoltageSourceTDF.java b/src/main/java/ui/window/JDialogELNComponentVoltageSourceTDF.java new file mode 100644 index 0000000000000000000000000000000000000000..0e86355231187fada793fe8fb03feec16843b86d --- /dev/null +++ b/src/main/java/ui/window/JDialogELNComponentVoltageSourceTDF.java @@ -0,0 +1,203 @@ +/* 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.sca_eln_sca_tdf.ELNComponentVoltageSourceTDF; +import ui.util.IconManager; + +import java.awt.BorderLayout; +import java.awt.Dimension; +import java.awt.FlowLayout; +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.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 JDialogELNComponentVoltageSourceTDF + * Dialog for managing the ELN voltage driven by a TDF input signal + * Creation: 19/07/2018 + * @version 1.0 19/07/2018 + * @author Irina Kit Yan LEE +*/ + +@SuppressWarnings("serial") + +public class JDialogELNComponentVoltageSourceTDF extends JDialog implements ActionListener { + private JTextField nameTextField; + private JTextField valueTextField; + + private ELNComponentVoltageSourceTDF vsource; + + public JDialogELNComponentVoltageSourceTDF(ELNComponentVoltageSourceTDF _vsource) { + setTitle("Setting the voltage driven by a TDF output signal"); + setLocationRelativeTo(null); + setVisible(true); + setAlwaysOnTop(true); + setResizable(false); + + vsource = _vsource; + + 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 mainPanel = new JPanel(new BorderLayout()); + this.add(mainPanel); + + JPanel attributesMainPanel = new JPanel(new GridLayout()); + mainPanel.add(attributesMainPanel, BorderLayout.NORTH); + + Box box = Box.createVerticalBox(); + box.setBorder(BorderFactory.createTitledBorder("Setting eln_tdf_vsource 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("nm : "); + 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); + + nameTextField = new JTextField(vsource.getValue().toString(), 10); + 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("scale : "); + 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); + + valueTextField = new JTextField("" + vsource.getScale(), 10); + 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); + + box.add(boxPanel); + attributesMainPanel.add(box); + + JPanel downPanel = new JPanel(new FlowLayout()); + + JButton saveCloseButton = new JButton("Save and close"); + 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); + pack(); + this.getRootPane().setDefaultButton(saveCloseButton); + } + + public void actionPerformed(ActionEvent e) { + if ("Save_Close".equals(e.getActionCommand())) { + vsource.setValue(new String(nameTextField.getText())); + + if (!(valueTextField.getText().isEmpty())) { + Boolean valValueDouble = false; + try { + Double.parseDouble(valueTextField.getText()); + } catch (NumberFormatException e1) { + JDialog msg = new JDialog(this); + msg.setLocationRelativeTo(null); + JOptionPane.showMessageDialog(msg, "The scale coefficient is not a Double", "Warning !", + JOptionPane.WARNING_MESSAGE); + valValueDouble = true; + } + if (valValueDouble == false) { + vsource.setScale(Double.parseDouble(valueTextField.getText())); + } + } else { + vsource.setScale(1.0); + } + + this.dispose(); + } + + if ("Cancel".equals(e.getActionCommand())) { + this.dispose(); + } + } +} \ No newline at end of file diff --git a/src/main/resources/ui/util/elntdfisource.gif b/src/main/resources/ui/util/elntdfisource.gif new file mode 100644 index 0000000000000000000000000000000000000000..a21f0ec320d9004845b7dce508cf43f15835dbae Binary files /dev/null and b/src/main/resources/ui/util/elntdfisource.gif differ diff --git a/src/main/resources/ui/util/elntdfvsource.gif b/src/main/resources/ui/util/elntdfvsource.gif new file mode 100644 index 0000000000000000000000000000000000000000..3d24958f33002f9c6e847c9e2064be07da2d2a0d Binary files /dev/null and b/src/main/resources/ui/util/elntdfvsource.gif differ