Commit 4b441170 authored by Ludovic Apvrille's avatar Ludovic Apvrille

Merge branch 'new-lip6' into 'master'

New lip6

See merge request !184
parents 30ac3417 fbf45f27
......@@ -91,7 +91,6 @@ public class SysCAMSSpecification{
for (SysCAMSTComponent blockGPIO2VCI : components) {
if (blockGPIO2VCI instanceof SysCAMSTBlockGPIO2VCI) {
blocksGPIO2VCI.add((SysCAMSTBlockGPIO2VCI) blockGPIO2VCI);
//System.out.println("@@@@@GPIO block found in spec");
}
}
return blocksGPIO2VCI;
......@@ -136,6 +135,17 @@ public class SysCAMSSpecification{
return portsDE;
}
public LinkedList<SysCAMSTClock> getAllClock(){
LinkedList<SysCAMSTClock> clocks = new LinkedList<SysCAMSTClock>();
for (SysCAMSTComponent clock : components) {
if (clock instanceof SysCAMSTClock) {
clocks.add((SysCAMSTClock) clock);
}
}
return clocks;
}
public LinkedList<SysCAMSTConnector> getAllConnectorCluster(){
LinkedList<SysCAMSTConnector> cons = new LinkedList<SysCAMSTConnector>();
for (SysCAMSTConnector con : connectors) {
......@@ -275,4 +285,8 @@ public class SysCAMSSpecification{
public int getNbConnectorCluster(){
return (getAllConnectorCluster()).size();
}
/* public int getNbClocks(){
return (getAllClocks()).size();
}*/
}
/* 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 syscamstranslator;
import java.util.LinkedList;
import javax.swing.DefaultListModel;
/**
* Class SysCAMSTClock
*/
public class SysCAMSTClock extends SysCAMSTComponent{
private String name;
private String frequency;
private String unit;
private String dutyCycle;
private String startTime;
private String posFirst;
public SysCAMSTClock(String _name, String _frequency, String _unit, String _dutyCycle, String _startTime, String _posFirst) {
name = _name;
frequency = _frequency;
unit = _unit;
dutyCycle = _dutyCycle;
startTime = _startTime;
posFirst = _posFirst;
}
public String getName() {
return name;
}
public String getFrequency() {
return frequency;
}
public String getUnit() {
return unit;
}
public String getDutyCycle() {
return dutyCycle;
}
public String getStartTime() {
return startTime;
}
public String getPosFirst() {
return posFirst;
}
public void setName(String _name) {
name = _name;
}
public void setFrequency(String _frequency) {
frequency = _frequency;
}
public void setUnit(String _unit) {
unit = _unit;
}
public void setDutyCycle(String _dutyCycle) {
dutyCycle = _dutyCycle;
}
public void setStartTime(String _startTime) {
startTime = _startTime;
}
public void setPosFirst(String _posFirst) {
posFirst = _posFirst;
}
}
......@@ -53,11 +53,13 @@ public class SysCAMSTCluster extends SysCAMSTComponent {
private LinkedList<SysCAMSTBlockTDF> blockTDF;
private LinkedList<SysCAMSTBlockDE> blockDE;
private LinkedList<SysCAMSTClock> clock;
public SysCAMSTCluster(String _clusterName) {
clusterName = _clusterName;
blockTDF = new LinkedList<SysCAMSTBlockTDF>();
blockDE = new LinkedList<SysCAMSTBlockDE>();
clock = new LinkedList<SysCAMSTClock>();
}
public String getClusterName() {
......@@ -79,4 +81,13 @@ public class SysCAMSTCluster extends SysCAMSTComponent {
public void addBlockDE(SysCAMSTBlockDE _blockDE){
blockDE.add(_blockDE);
}
}
\ No newline at end of file
public LinkedList<SysCAMSTClock> getClock(){
return clock;
}
public void addBlockDE(SysCAMSTClock _clock){
clock.add(_clock);
}
}
......@@ -69,7 +69,9 @@ public class ClusterCode {
LinkedList<SysCAMSTBlockTDF> tdf = cluster.getBlockTDF();
LinkedList<SysCAMSTBlockDE> de = cluster.getBlockDE();
LinkedList<SysCAMSTClock> clock = cluster.getClock();
corpsCluster = "template <typename vci_param>" + CR +
"class " +cluster.getClusterName()+ " : public sc_core::sc_module { "+ CR;
......@@ -146,7 +148,15 @@ public class ClusterCode {
} else {
names.add("gpio_sig" + nb_con);
}
}
}
//DG
for (SysCAMSTClock clk : clock) {
corpsCluster = corpsCluster + "sc_clock"+ clk.getName()+ "("+clk.getName()+", "+clk.getFrequency()+", "+clk.getUnit()+", "+clk.getDutyCycle()+", "+clk.getStartTime()+", "+clk.getUnit()+", "+clk.getPosFirst()+");" + CR;
}
//fin ajoute DG
corpsCluster = corpsCluster + CR + "\t// Instantiate cluster's modules." + CR;
for (SysCAMSTBlockTDF t : tdf) {
......
......@@ -139,7 +139,7 @@ public class TopCellGeneratorCluster {
System.err.println(path + GENERATED_PATH2 + t.getName() + "_tdf.h");
System.err.println(path + t.getName() + "_tdf.h");
if(standalone==true){
//System.out.println("@@@ TDF Cluster standalone");
fw = new FileWriter(path + "/" + t.getName() + "_tdf.h");
}
......@@ -147,8 +147,7 @@ public class TopCellGeneratorCluster {
fw = new FileWriter(path + GENERATED_PATH2 + "/" + t.getName() + "_tdf.h");
headerTDF = HeaderCluster.getPrimitiveHeaderTDF(t);
fw.write(headerTDF);
codeTDF = PrimitiveCodeCluster.getPrimitiveCodeTDF(t);
//if(standalone==false)
codeTDF = PrimitiveCodeCluster.getPrimitiveCodeTDF(t);
codeTDF = codeTDF + "#endif"+ CR;
fw.write(codeTDF);
fw.close();
......@@ -164,15 +163,14 @@ public class TopCellGeneratorCluster {
if(standalone==true)
{
//System.out.println("@@@ DE Cluster standalone");
fw = new FileWriter(path +"/" + t.getName() + "_tdf.h");}
else
fw = new FileWriter(path + GENERATED_PATH2 + "/" + t.getName() + "_tdf.h");
headerDE = HeaderCluster.getPrimitiveHeaderDE(t);
fw.write(headerDE);
codeDE = PrimitiveCodeCluster.getPrimitiveCodeDE(t);
//if(standalone==false)
codeDE = PrimitiveCodeCluster.getPrimitiveCodeDE(t);
codeDE = codeDE + "#endif "+ CR;
fw.write(codeDE);
fw.close();
......
......@@ -107,6 +107,11 @@ public class SysCAMSComponentDesignPanel extends TURTLEPanel {
return syscamsctdp.getBlockDEComponentByName(_name);
}
public SysCAMSClock getClockComponentByName(String _name) {
return syscamsctdp.getClockComponentByName(_name);
}
public java.util.List<String> getAllCompositeComponent(String _name) {
return syscamsctdp.getAllCompositeComponent(_name);
}
......@@ -171,4 +176,4 @@ public class SysCAMSComponentDesignPanel extends TURTLEPanel {
return true;
}
}
\ No newline at end of file
}
......@@ -2732,6 +2732,7 @@ public abstract class TDiagramPanel extends JPanel implements GenericTree {
|| (o instanceof TMLTaskInterface && this.checkTMLTaskInterface((TMLTaskInterface) o, name))
|| (o instanceof SysCAMSBlockTDF && this.checkSysCAMSBlockTDFComponent((SysCAMSBlockTDF) o, name))
|| (o instanceof SysCAMSBlockDE && this.checkSysCAMSBlockDEComponent((SysCAMSBlockDE) o, name))
|| (o instanceof SysCAMSClock && this.checkSysCAMSClockComponent((SysCAMSClock) o, name))
|| (o instanceof SysCAMSCompositeComponent && this.checkSysCAMSCompositeComponent((SysCAMSCompositeComponent) o, name))
|| (o instanceof ELNCluster && this.checkELNCluster((ELNCluster) o, name))
|| (o instanceof ELNModule && this.checkELNModule((ELNModule) o, name))
......@@ -2813,6 +2814,10 @@ public abstract class TDiagramPanel extends JPanel implements GenericTree {
public boolean checkSysCAMSBlockDEComponent(SysCAMSBlockDE o, String name) {
return false;
}
public boolean checkSysCAMSClockComponent(SysCAMSClock o, String name) {
return false;
}
public boolean checkSysCAMSCompositeComponent(SysCAMSCompositeComponent o, String name) {
return false;
......@@ -3101,6 +3106,10 @@ public abstract class TDiagramPanel extends JPanel implements GenericTree {
public boolean checkSysCAMSBlockDEComponent(SysCAMSBlockDE o, String name) {
return o.getValue().equals(name);
}
public boolean checkSysCAMSClockComponent(SysCAMSClock o, String name) {
return o.getValue().equals(name);
}
public boolean checkSysCAMSCompositeComponent(SysCAMSCompositeComponent o, String name) {
for (int i = 0; i < o.getNbInternalTGComponent(); i++)
......
......@@ -346,7 +346,7 @@ public class TGComponentManager {
public static final int CAMS_PORT_CONVERTER = 1606;
public static final int CAMS_CLUSTER = 1607;
public static final int CAMS_BLOCK_GPIO2VCI = 1608;
public static final int CAMS_CLOCK = 5721;
// ELN
public static final int ELN_CONNECTOR = 1610;
public static final int ELN_RESISTOR = 1611;
......@@ -558,12 +558,12 @@ public class TGComponentManager {
public static final int CONNECTOR = 1;
public static LinkedList<ADDConnector> addconnectors = new LinkedList<ADDConnector>(); //DG 21.02.
public static LinkedList<ADDConnector> addconnectors = new LinkedList<ADDConnector>();
public static LinkedList<ADDConnector> getAllADDConnectors() {
return addconnectors;
}//DG 21.02.
}
public final static TGComponent addComponent(int x, int y, int id, TDiagramPanel tdp) {
TGComponent tgc = null;
......@@ -1307,6 +1307,9 @@ public class TGComponentManager {
case CAMS_BLOCK_GPIO2VCI:
tgc = new SysCAMSBlockGPIO2VCI(x, y, tdp.getMinX(), tdp.getMaxX(), tdp.getMinY(), tdp.getMaxY(), false, null, tdp);
break;
case CAMS_CLOCK:
tgc = new SysCAMSClock(x, y, tdp.getMinX(), tdp.getMaxX(), tdp.getMinY(), tdp.getMaxY(), false, null, tdp);
break;
// ELN
case ELN_RESISTOR:
tgc = new ELNComponentResistor(x, y, tdp.getMinX(), tdp.getMaxX(), tdp.getMinY(), tdp.getMaxY(), false, null, tdp);
......@@ -1786,7 +1789,8 @@ public class TGComponentManager {
return CAMS_CLUSTER;
} else if (tgc instanceof SysCAMSBlockGPIO2VCI) {
return CAMS_BLOCK_GPIO2VCI;
} else if (tgc instanceof SysCAMSClock) {
return CAMS_CLOCK;
// ELN
} else if (tgc instanceof ELNConnector) {
return ELN_CONNECTOR;
......
......@@ -281,6 +281,7 @@ public class TGUIAction extends AbstractAction {
public static final int CAMS_CLUSTER = 480;
public static final int CAMS_GENCODE = 482;
public static final int CAMS_BLOCK_GPIO2VCI = 497;
public static final int CAMS_CLOCK = 520;
// ELN
public static final int ELN_EDIT = 483;
......@@ -673,7 +674,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 = 519;
public static final int NB_ACTION = 521;
private static final TAction [] actions = new TAction[NB_ACTION];
......@@ -1186,7 +1187,7 @@ public class TGUIAction extends AbstractAction {
actions[CAMS_CLUSTER] = new TAction("C-AMS-cluster", "Add a cluster", IconManager.imgic8003, IconManager.imgic8003, "Cluster", "Add a cluster to the currently opened SystemC-AMS Diagram", 0);
actions[CAMS_GENCODE] = new TAction("C-AMS-gencode", "SystemC-AMS code generation",IconManager.imgic94, IconManager.imgic94, "Generate SystemC-AMS code", "SystemC-AMS diagram without check syntax", 0);
actions[CAMS_BLOCK_GPIO2VCI] = new TAction("C-AMS-block-GPIO2VCI", "Add a block GPIO2VCI",IconManager.imgic8006, IconManager.imgic8006, "GPIO2VCI block", "Add a GPIO2VCI block to the currently opened SystemC-AMS Diagram", 0);
actions[CAMS_CLOCK] = new TAction("C-AMS-Clock", "Clock", IconManager.imgic999, IconManager.imgic999, "Clock", "Add a clock to the currently opened SystemC-AMS diagram", 0);
// ELN
actions[ELN_EDIT] = new TAction("add-action-eln", "Action state", IconManager.imgic100, IconManager.imgic101, "Action state", "Add an action state to the currently opened ELN diagram", 0);
actions[ELN_CONNECTOR] = new TAction("eln-connector", "Add a connection", IconManager.imgic202, IconManager.imgic202, "Connector", "Connects two block of the currently opened ELN Diagram", 0);
......
......@@ -60,8 +60,7 @@ import java.util.LinkedList;
*/
public class SysCAMSBlockDE extends TGCScalableWithInternalComponent implements SwallowTGComponent, SwallowedTGComponent {
// private int period;
// private String time;
private String nameFn;
private String code;
private DefaultListModel<String> listStruct;
......@@ -307,7 +306,7 @@ public class SysCAMSBlockDE extends TGCScalableWithInternalComponent implements
sb.append("\" listStruct=\"" + splitParameters(getListStruct()));
sb.append("\" nameTemplate=\"" + getNameTemplate());
sb.append("\" typeTemplate=\"" + getTypeTemplate());
sb.append("\" valueTemplate=\"" + getValueTemplate());
sb.append("\" valueTemplate=\"" + getValueTemplate());
sb.append("\" listTypedef=\"" + splitParameters(getListTypedef()));
sb.append("\" />\n");
sb.append("</extraparam>\n");
......@@ -524,22 +523,6 @@ public class SysCAMSBlockDE extends TGCScalableWithInternalComponent implements
return list;
}
// public int getPeriod() {
// return period;
// }
//
// public void setPeriod(int _period) {
// period = _period;
// }
//
// public String getTime() {
// return time;
// }
//
// public void setTime(String _time) {
// time = _time;
// }
public void setNameFn(String nameFn) {
this.nameFn = nameFn;
}
......
......@@ -320,11 +320,11 @@ public class SysCAMSBlockTDF extends TGCScalableWithInternalComponent implements
sb.append("<Attribute period=\"" + getPeriod());
sb.append("\" time=\"" + getTime());
sb.append("\" processCode=\"" + encode(getProcessCode()));
sb.append("\" constructorCode=\"" + encode(getConstructorCode()));
sb.append("\" constructorCode=\"" + encode(getConstructorCode()));
sb.append("\" listStruct=\"" + splitParameters(getListStruct()));
sb.append("\" nameTemplate=\"" + getNameTemplate());
sb.append("\" typeTemplate=\"" + getTypeTemplate());
sb.append("\" valueTemplate=\"" + getValueTemplate());
sb.append("\" valueTemplate=\"" + getValueTemplate());
sb.append("\" listTypedef=\"" + splitParameters(getListTypedef()));
sb.append("\" />\n");
sb.append("</extraparam>\n");
......
This diff is collapsed.
......@@ -469,6 +469,21 @@ public class SysCAMSComponentTaskDiagramPanel extends TDiagramPanel implements T
return null;
}
public SysCAMSClock getClockComponentByName(String _name) {
TGComponent tgc;
Iterator<TGComponent> iterator = componentList.listIterator();
while (iterator.hasNext()) {
tgc = iterator.next();
if (tgc instanceof SysCAMSClock) {
if (tgc.getValue().equals(_name)) {
return ((SysCAMSClock) tgc);
}
}
}
return null;
}
public void updateReferenceToSysCAMSCompositeComponent(SysCAMSCompositeComponent syscamscc) {
Iterator<TGComponent> iterator = componentList.listIterator();
TGComponent tgc;
......@@ -574,12 +589,15 @@ public class SysCAMSComponentTaskDiagramPanel extends TDiagramPanel implements T
if (tgc instanceof SysCAMSBlockDE) {
deports.addAll(((SysCAMSBlockDE) tgc).getAllInternalPortsDE());
}
if (tgc instanceof SysCAMSClock) {
deports.addAll(((SysCAMSClock) tgc).getAllInternalPortsDE());
}
if (tgc instanceof SysCAMSPortTDF) {
tdfports.add((SysCAMSPortTDF) tgc);
}
if (tgc instanceof SysCAMSPortDE) {
deports.add((SysCAMSPortDE) tgc);
}
}
}
// We take each primitive ports individually and we go thru the graph
......@@ -886,4 +904,4 @@ public class SysCAMSComponentTaskDiagramPanel extends TDiagramPanel implements T
}
return terms;
}
}
\ No newline at end of file
}
......@@ -73,6 +73,7 @@ public class SysCAMSComponentTaskDiagramToolBar extends TToolBar {
mgui.actions[TGUIAction.CAMS_GENCODE].setEnabled(b);
mgui.actions[TGUIAction.CAMS_BLOCK_GPIO2VCI].setEnabled(b);
mgui.actions[TGUIAction.CAMS_CONNECTOR].setEnabled(b);
mgui.actions[TGUIAction.CAMS_CLOCK].setEnabled(b);
mgui.actions[TGUIAction.ACT_MODEL_CHECKING].setEnabled(b);
mgui.actions[TGUIAction.ACT_ONECLICK_LOTOS_RG].setEnabled(b);
......@@ -123,9 +124,12 @@ public class SysCAMSComponentTaskDiagramToolBar extends TToolBar {
button = this.add(mgui.actions[TGUIAction.CAMS_PORT_DE]);
button.addMouseListener(mgui.mouseHandler);
button = this.add(mgui.actions[TGUIAction.CAMS_CLOCK]);
button.addMouseListener(mgui.mouseHandler);
this.addSeparator();
button = this.add(mgui.actions[TGUIAction.CAMS_GENCODE]);
button.addMouseListener(mgui.mouseHandler);
}
}
\ No newline at end of file
}
......@@ -223,6 +223,10 @@ public class SysCAMSCompositeComponent extends TGCScalableWithInternalComponent
if (tgc instanceof SysCAMSBlockDE) {
tgc.resizeWithFather();
}
if (tgc instanceof SysCAMSClock) {
tgc.resizeWithFather();
}
addInternalComponent(tgc, 0);
return true;
}
......@@ -259,6 +263,9 @@ public class SysCAMSCompositeComponent extends TGCScalableWithInternalComponent
if (tgcomponent[i] instanceof SysCAMSBlockDE) {
tgcomponent[i].resizeWithFather();
}
if (tgcomponent[i] instanceof SysCAMSClock) {
tgcomponent[i].resizeWithFather();
}
}
}
......@@ -287,6 +294,19 @@ public class SysCAMSCompositeComponent extends TGCScalableWithInternalComponent
}
return ll;
}
public java.util.List<SysCAMSClock> getAllClockComponents() {
ArrayList<SysCAMSClock> ll = new ArrayList<SysCAMSClock>();
for(int i=0; i<nbInternalTGComponent; i++) {
if (tgcomponent[i] instanceof SysCAMSCompositeComponent) {
ll.addAll(((SysCAMSCompositeComponent)tgcomponent[i]).getAllClockComponents());
}
if (tgcomponent[i] instanceof SysCAMSClock) {
ll.add(((SysCAMSClock)(tgcomponent[i])));
}
}
return ll;
}
public void getAllCompositeComponents(ArrayList<String> list, String _name) {
String s;
......@@ -407,7 +427,10 @@ public class SysCAMSCompositeComponent extends TGCScalableWithInternalComponent
return true;
} else if (tgc instanceof SysCAMSBlockDE) {
return true;
}
else if (tgc instanceof SysCAMSClock) {
return true;
}
return false;
}
}
\ No newline at end of file
}
......@@ -563,11 +563,7 @@ public class SysCAMSPrimitivePort extends TGCScalableWithInternalComponent imple
sb.append("\" time=\"" + ((SysCAMSPortConverter) this).getTime());
sb.append("\" rate=\"" + ((SysCAMSPortConverter) this).getRate());
sb.append("\" nbits=\"" + ((SysCAMSPortConverter) this).getNbits());//DG
}
if (this instanceof SysCAMSPortConverter) {
sb.append("\" period=\"" + ((SysCAMSPortConverter) this).getPeriod());
sb.append("\" time=\"" + ((SysCAMSPortConverter) this).getTime());
sb.append("\" nbits=\"" + ((SysCAMSPortConverter) this).getNbits());//DG
sb.append("\" delay=\"" + ((SysCAMSPortConverter) this).getDelay());
sb.append("\" type=\"" + encode(((SysCAMSPortConverter) this).getConvType()));
}
......
......@@ -184,7 +184,7 @@ public class IconManager {
public static ImageIcon imgic2111; //New icon created by Solange
// SystemC-AMS
public static ImageIcon imgic8000, imgic8001, imgic8002, imgic8003, imgic8004, imgic8005, imgic8006;
public static ImageIcon imgic8000, imgic8001, imgic8002, imgic8003, imgic8004, imgic8005, imgic8006, imgic999;
// ELN
public static ImageIcon imgic8010, imgic8011, imgic8012, imgic8013, imgic8014, imgic8015, imgic8016, imgic8017, imgic8018, imgic8019,
......@@ -679,7 +679,7 @@ public class IconManager {
private static String icon8004 = "camstdfblock.gif";
private static String icon8005 = "camsdeblock.gif";
private static String icon8006 = "camsgpio2vciblock.gif";
private static String icon999 = "clock.gif";
// ELN
private static String icon8010 = "elnresistor.gif";
private static String icon8011 = "elncapacitor.gif";
......
/* 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.syscams.SysCAMSClock;
import ui.util.*;
import java.awt.*;
import java.awt.event.*;
import java.util.*;
import javax.swing.*;
/**
* Class JDialogSysCAMSClock
* Dialog for managing of SystemC-AMS Clock
* Creation: 04/06/2019
* @version 1.0 04/06/2016
* @author Daniela GENIUS
*/
@SuppressWarnings("serial")
public class JDialogSysCAMSClock extends JDialog implements ActionListener {
private JTextField nameTextField;
private JTextField frequencyTextField;
private JTextField unitTextField;
private JTextField dutyCycleTextField;
private JTextField startTimeTextField;
private String listUnitString[];
private String posFirstString[];
private JComboBox<String> unitComboBoxString;
private JComboBox<String> posFirstComboBoxString;
private SysCAMSClock clock;
public JDialogSysCAMSClock(SysCAMSClock clock) {
this.setTitle("Setting Clock Attributes");
this.setLocationRelativeTo(null);
this.setVisible(true);
this.setAlwaysOnTop(true);
this.setResizable(false);
this.clock = clock;
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();
mainPanel.add(attributesMainPanel, BorderLayout.NORTH);
attributesMainPanel.setLayout(new BorderLayout());
Box attributesBox = Box.createVerticalBox();
attributesBox.setBorder(BorderFactory.createTitledBorder("Setting clock attributes"));
GridBagLayout gridBag = new GridBagLayout();
GridBagConstraints constraints = new GridBagConstraints();
JPanel attributesBoxPanel = new JPanel();
attributesBoxPanel.setFont(new Font("Helvetica", Font.PLAIN, 14));
attributesBoxPanel.setLayout(gridBag);
JLabel labelName = new JLabel("Name : ");
constraints = new GridBagConstraints(0, 0, 1, 1, 1.0, 1.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH,
new Insets(15, 10, 5, 10), 0, 0);
gridBag.setConstraints(labelName, constraints);
attributesBoxPanel.add(labelName);
if (clock.getValue().toString().equals("")) {
nameTextField = new JTextField(10);
} else {
nameTextField = new JTextField(clock.getValue().toString(), 10);
}
constraints = new GridBagConstraints(1, 0, 2, 1, 1.0, 1.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH,
new Insets(15, 10, 5, 10), 0, 0);
gridBag.setConstraints(nameTextField, constraints);
attributesBoxPanel.add(nameTextField);