From 435cf7fca2787e944b78baea9555063ed0d03443 Mon Sep 17 00:00:00 2001 From: Daniela Genius <genius@debussy.soc.lip6.fr> Date: Mon, 8 Jul 2019 17:14:34 +0200 Subject: [PATCH] adding specific clock ports --- src/main/java/ui/ActionPerformer.java | 5 +- src/main/java/ui/TGComponentManager.java | 16 +- src/main/java/ui/TGUIAction.java | 4 +- .../SysCAMSComponentTaskDiagramToolBar.java | 4 + ...sCAMSComponentTaskDiagramToolBar.java-orig | 135 ++++++ .../java/ui/syscams/SysCAMSPortClock.java | 103 ++--- src/main/java/ui/syscams/SysCAMSPortDE.java | 37 +- .../java/ui/syscams/SysCAMSPrimitivePort.java | 41 +- .../java/ui/window/JDialogSysCAMSClock.java | 437 +----------------- .../ui/window/JDialogSysCAMSPortClock.java | 305 +----------- 10 files changed, 243 insertions(+), 844 deletions(-) create mode 100644 src/main/java/ui/syscams/SysCAMSComponentTaskDiagramToolBar.java-orig diff --git a/src/main/java/ui/ActionPerformer.java b/src/main/java/ui/ActionPerformer.java index 6508e5c84d..6441b893df 100644 --- a/src/main/java/ui/ActionPerformer.java +++ b/src/main/java/ui/ActionPerformer.java @@ -938,7 +938,10 @@ public class ActionPerformer { mgui.actionOnButton(TGComponentManager.COMPONENT, TGComponentManager.CAMS_PORT_TDF); } else if (command.equals(mgui.actions[TGUIAction.CAMS_PORT_DE].getActionCommand())) { mgui.actionOnButton(TGComponentManager.COMPONENT, TGComponentManager.CAMS_PORT_DE); - } else if (command.equals(mgui.actions[TGUIAction.CAMS_PORT_CONVERTER].getActionCommand())) { + } else if (command.equals(mgui.actions[TGUIAction.CAMS_PORT_CLOCK].getActionCommand())) { + mgui.actionOnButton(TGComponentManager.COMPONENT, TGComponentManager.CAMS_PORT_CLOCK); + } + else if (command.equals(mgui.actions[TGUIAction.CAMS_PORT_CONVERTER].getActionCommand())) { mgui.actionOnButton(TGComponentManager.COMPONENT, TGComponentManager.CAMS_PORT_CONVERTER); } else if (command.equals(mgui.actions[TGUIAction.CAMS_CLUSTER].getActionCommand())) { mgui.actionOnButton(TGComponentManager.COMPONENT, TGComponentManager.CAMS_CLUSTER); diff --git a/src/main/java/ui/TGComponentManager.java b/src/main/java/ui/TGComponentManager.java index 1e72d9e3b0..af884cca0e 100644 --- a/src/main/java/ui/TGComponentManager.java +++ b/src/main/java/ui/TGComponentManager.java @@ -343,6 +343,7 @@ public class TGComponentManager { public static final int CAMS_BLOCK_DE = 1603; public static final int CAMS_PORT_TDF = 1604; public static final int CAMS_PORT_DE = 1605; + public static final int CAMS_PORT_CLOCK = 5722; public static final int CAMS_PORT_CONVERTER = 1606; public static final int CAMS_CLUSTER = 1607; public static final int CAMS_BLOCK_GPIO2VCI = 1608; @@ -1295,12 +1296,18 @@ public class TGComponentManager { case CAMS_BLOCK_DE: tgc = new SysCAMSBlockDE(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; case CAMS_PORT_TDF: tgc = new SysCAMSPortTDF(x, y, tdp.getMinX(), tdp.getMaxX(), tdp.getMinY(), tdp.getMaxY(), false, null, tdp); break; case CAMS_PORT_DE: tgc = new SysCAMSPortDE(x, y, tdp.getMinX(), tdp.getMaxX(), tdp.getMinY(), tdp.getMaxY(), false, null, tdp); break; + case CAMS_PORT_CLOCK: + tgc = new SysCAMSPortClock(x, y, tdp.getMinX(), tdp.getMaxX(), tdp.getMinY(), tdp.getMaxY(), false, null, tdp); + break; case CAMS_PORT_CONVERTER: tgc = new SysCAMSPortConverter(x, y, tdp.getMinX(), tdp.getMaxX(), tdp.getMinY(), tdp.getMaxY(), false, null, tdp); break; @@ -1310,9 +1317,6 @@ 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); @@ -1782,18 +1786,20 @@ public class TGComponentManager { return CAMS_BLOCK_TDF; } else if (tgc instanceof SysCAMSBlockDE) { return CAMS_BLOCK_DE; + } else if (tgc instanceof SysCAMSClock) { + return CAMS_CLOCK; } else if (tgc instanceof SysCAMSPortTDF) { return CAMS_PORT_TDF; } else if (tgc instanceof SysCAMSPortDE) { return CAMS_PORT_DE; + } else if (tgc instanceof SysCAMSPortClock) { + return CAMS_PORT_CLOCK; } else if (tgc instanceof SysCAMSPortConverter) { return CAMS_PORT_CONVERTER; } else if (tgc instanceof SysCAMSCompositeComponent) { 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; diff --git a/src/main/java/ui/TGUIAction.java b/src/main/java/ui/TGUIAction.java index 24943ebdfd..dc7d6ca74f 100644 --- a/src/main/java/ui/TGUIAction.java +++ b/src/main/java/ui/TGUIAction.java @@ -282,6 +282,7 @@ public class TGUIAction extends AbstractAction { public static final int CAMS_GENCODE = 482; public static final int CAMS_BLOCK_GPIO2VCI = 497; public static final int CAMS_CLOCK = 520; + public static final int CAMS_PORT_CLOCK = 521; // ELN public static final int ELN_EDIT = 483; @@ -674,7 +675,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 = 521; + public static final int NB_ACTION = 522; private static final TAction [] actions = new TAction[NB_ACTION]; @@ -1183,6 +1184,7 @@ public class TGUIAction extends AbstractAction { actions[CAMS_CONNECTOR] = new TAction("C-AMS-connector", "Add a connection", IconManager.imgic202, IconManager.imgic202, "Connector", "Connects two block of the currently opened SystemC-AMS Diagram", 0); actions[CAMS_PORT_TDF] = new TAction("C-AMS-port-TDF", "Add a TDF port", IconManager.imgic8000, IconManager.imgic8000, "TDF port", "Add a TDF port to the currently opened SystemC-AMS Diagram", 0); actions[CAMS_PORT_DE] = new TAction("C-AMS-port-DE", "Add a DE port", IconManager.imgic8001, IconManager.imgic8001, "DE port", "Add a DE port to the currently opened SystemC-AMS Diagram", 0); + actions[CAMS_PORT_CLOCK] = new TAction("C-AMS-port-Clock", "Add a Clock port", IconManager.imgic8001, IconManager.imgic8001, "Clock port", "Add a Clock port to the currently opened SystemC-AMS Diagram", 0); actions[CAMS_PORT_CONVERTER] = new TAction("C-AMS-port-converter", "Add a converter port", IconManager.imgic8002, IconManager.imgic8002, "Converter port", "Add a converter port to the currently opened SystemC-AMS Diagram", 0); 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); diff --git a/src/main/java/ui/syscams/SysCAMSComponentTaskDiagramToolBar.java b/src/main/java/ui/syscams/SysCAMSComponentTaskDiagramToolBar.java index dbda02b22e..ceb608b8f0 100644 --- a/src/main/java/ui/syscams/SysCAMSComponentTaskDiagramToolBar.java +++ b/src/main/java/ui/syscams/SysCAMSComponentTaskDiagramToolBar.java @@ -68,6 +68,7 @@ public class SysCAMSComponentTaskDiagramToolBar extends TToolBar { mgui.actions[TGUIAction.CAMS_BLOCK_DE].setEnabled(b); mgui.actions[TGUIAction.CAMS_PORT_TDF].setEnabled(b); mgui.actions[TGUIAction.CAMS_PORT_DE].setEnabled(b); + mgui.actions[TGUIAction.CAMS_PORT_CLOCK].setEnabled(b); mgui.actions[TGUIAction.CAMS_PORT_CONVERTER].setEnabled(b); mgui.actions[TGUIAction.CAMS_CLUSTER].setEnabled(b); mgui.actions[TGUIAction.CAMS_GENCODE].setEnabled(b); @@ -124,6 +125,9 @@ 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_PORT_CLOCK]); + button.addMouseListener(mgui.mouseHandler); + button = this.add(mgui.actions[TGUIAction.CAMS_CLOCK]); button.addMouseListener(mgui.mouseHandler); diff --git a/src/main/java/ui/syscams/SysCAMSComponentTaskDiagramToolBar.java-orig b/src/main/java/ui/syscams/SysCAMSComponentTaskDiagramToolBar.java-orig new file mode 100644 index 0000000000..dbda02b22e --- /dev/null +++ b/src/main/java/ui/syscams/SysCAMSComponentTaskDiagramToolBar.java-orig @@ -0,0 +1,135 @@ +/* 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.syscams; + +import ui.*; +import javax.swing.*; + +/** + * Class SysCAMSComponentTaskDiagramToolBar + * Implements the toolbar to be used in conjunction with the panel of a SystemC-AMS diagram + * Creation: 22/04/2018 + * @version 1.0 22/04/2018 + * @author Irina Kit Yan LEE + * @see SysCAMSComponentTaskDiagramPanel + */ + +@SuppressWarnings("serial") + +public class SysCAMSComponentTaskDiagramToolBar extends TToolBar { + + public SysCAMSComponentTaskDiagramToolBar(MainGUI _mgui) { + super(_mgui); + } + + protected void setActive(boolean b) { + mgui.actions[TGUIAction.ACT_ZOOM_MORE].setEnabled(b); + mgui.actions[TGUIAction.ACT_ZOOM_LESS].setEnabled(b); + + mgui.actions[TGUIAction.CAMS_EDIT].setEnabled(b); + mgui.actions[TGUIAction.UML_NOTE].setEnabled(b); + mgui.actions[TGUIAction.CAMS_BLOCK_TDF].setEnabled(b); + mgui.actions[TGUIAction.CAMS_BLOCK_DE].setEnabled(b); + mgui.actions[TGUIAction.CAMS_PORT_TDF].setEnabled(b); + mgui.actions[TGUIAction.CAMS_PORT_DE].setEnabled(b); + mgui.actions[TGUIAction.CAMS_PORT_CONVERTER].setEnabled(b); + mgui.actions[TGUIAction.CAMS_CLUSTER].setEnabled(b); + 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); + mgui.actions[TGUIAction.ACT_SIMU_SYSTEMC].setEnabled(b); + + mgui.actions[TGUIAction.ACT_SHOW_ZOOM].setEnabled(b); + mgui.updateZoomInfo(); + } + + protected void setButtons() { + JButton button; + + button = this.add(mgui.actions[TGUIAction.CAMS_EDIT]); + button.addMouseListener(mgui.mouseHandler); + + button = this.add(mgui.actions[TGUIAction.UML_NOTE]); + button.addMouseListener(mgui.mouseHandler); + + this.addSeparator(); + + button = this.add(mgui.actions[TGUIAction.CAMS_CONNECTOR]); + button.addMouseListener(mgui.mouseHandler); + + this.addSeparator(); + + button = this.add(mgui.actions[TGUIAction.CAMS_CLUSTER]); + button.addMouseListener(mgui.mouseHandler); + + this.addSeparator(); + + button = this.add(mgui.actions[TGUIAction.CAMS_BLOCK_TDF]); + button.addMouseListener(mgui.mouseHandler); + + button = this.add(mgui.actions[TGUIAction.CAMS_PORT_TDF]); + button.addMouseListener(mgui.mouseHandler); + + button = this.add(mgui.actions[TGUIAction.CAMS_PORT_CONVERTER]); + button.addMouseListener(mgui.mouseHandler); + + this.addSeparator(); + + button = this.add(mgui.actions[TGUIAction.CAMS_BLOCK_DE]); + button.addMouseListener(mgui.mouseHandler); + + button = this.add(mgui.actions[TGUIAction.CAMS_BLOCK_GPIO2VCI]); + button.addMouseListener(mgui.mouseHandler); + + 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); + } +} diff --git a/src/main/java/ui/syscams/SysCAMSPortClock.java b/src/main/java/ui/syscams/SysCAMSPortClock.java index 646d895759..b564a6e178 100644 --- a/src/main/java/ui/syscams/SysCAMSPortClock.java +++ b/src/main/java/ui/syscams/SysCAMSPortClock.java @@ -46,85 +46,66 @@ import ui.TGComponent; /** * Class SysCAMSPortClock * Primitive port. To be used in SystemC-AMS diagrams - * Creation: 14/05/2018 - * @version 1.0 14/05/2018 - * @author Irina Kit Yan LEE + * Creation: 08/07/2019 + * @version 1.0 08/07/2019 + * @author Daniela Genius */ public class SysCAMSPortClock extends SysCAMSPrimitivePort { -// private int period; -// private String time; -// private int rate; -// private int delay; - private int nbits;//DG - private String ClockType; - private boolean sensitive; - private String sensitiveMethod; + private double frequency; + private String unit; + private double startTime; + private double dutyCycle; + private boolean posFirst; public SysCAMSPortClock(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); } -// public int getPeriod() { -// return period; -// } -// -// public void setPeriod(int period) { -// this.period = period; -// } -// -// public String getTime() { -// return time; -// } -// -// public void setTime(String time) { -// this.time = time; -// } -// -// public int getRate() { -// return rate; -// } -// -// public void setRate(int rate) { -// this.rate = rate; -// } -// -// public int getDelay() { -// return delay; -// } -// -// public void setDelay(int delay) { -// this.delay = delay; -// } - - public void drawParticularity(Graphics g) { + /* public double getFrequency() { + return frequency; } - public String getClockType() { - return ClockType; + public void setFrequency(double frequency) { + this.frequency = frequency; } - public void setClockType(String _ClockType) { - ClockType = _ClockType; + public String getUnit() { + return unit; } - - public boolean getSensitive() { - return sensitive; + + public void setUnit(String unit) { + this.unit = unit ; } - public int getNbits() { - return nbits; + public double getStartTime() { + return startTime; } - - public void setSensitive(boolean _sensitive) { - sensitive = _sensitive; + + public void setStartTime(String startTime) { + this.startTime = startTime; } - public String getSensitiveMethod() { - return sensitiveMethod; + public double getDutyCycle() { + return dutyCycle; } - public void setSensitiveMethod(String _sensitiveMethod) { - sensitiveMethod = _sensitiveMethod; - } + public void setDutyCycle() { + this.dutyCycle = dutyCycle; + } + + public boolean getPosFirst() { + return posFirst; + } + + public void setPosFirst(boolean posFirst) { + this.posFirst = posFirst; + } + + public void setSensitive(boolean posFirst) { + this.posFirst = posFirst; + }*/ + + public void drawParticularity(Graphics g) { + } } diff --git a/src/main/java/ui/syscams/SysCAMSPortDE.java b/src/main/java/ui/syscams/SysCAMSPortDE.java index 5c2478ae45..64c1a7e4e6 100644 --- a/src/main/java/ui/syscams/SysCAMSPortDE.java +++ b/src/main/java/ui/syscams/SysCAMSPortDE.java @@ -49,13 +49,10 @@ import ui.TGComponent; * Creation: 14/05/2018 * @version 1.0 14/05/2018 * @author Irina Kit Yan LEE + * @revision 8/7/2019 Daniela Genius */ public class SysCAMSPortDE extends SysCAMSPrimitivePort { -// private int period; -// private String time; -// private int rate; -// private int delay; private int nbits;//DG private String DEType; private boolean sensitive; @@ -65,38 +62,6 @@ public class SysCAMSPortDE extends SysCAMSPrimitivePort { super(_x, _y, _minX, _maxX, _minY, _maxY, _pos, _father, _tdp); } -// public int getPeriod() { -// return period; -// } -// -// public void setPeriod(int period) { -// this.period = period; -// } -// -// public String getTime() { -// return time; -// } -// -// public void setTime(String time) { -// this.time = time; -// } -// -// public int getRate() { -// return rate; -// } -// -// public void setRate(int rate) { -// this.rate = rate; -// } -// -// public int getDelay() { -// return delay; -// } -// -// public void setDelay(int delay) { -// this.delay = delay; -// } - public void drawParticularity(Graphics g) { } diff --git a/src/main/java/ui/syscams/SysCAMSPrimitivePort.java b/src/main/java/ui/syscams/SysCAMSPrimitivePort.java index 80f14a1992..009f916e25 100644 --- a/src/main/java/ui/syscams/SysCAMSPrimitivePort.java +++ b/src/main/java/ui/syscams/SysCAMSPrimitivePort.java @@ -120,6 +120,13 @@ public class SysCAMSPrimitivePort extends TGCScalableWithInternalComponent imple ((SysCAMSPortDE) this).setOrigin(0); ((SysCAMSPortDE) this).setSensitive(false); ((SysCAMSPortDE) this).setSensitiveMethod(""); + } else if (this instanceof SysCAMSPortClock) { + //((SysCAMSPortClock) this).setFrequency(-1); + // ((SysCAMSPortClock) this).setUnit(""); + // ((SysCAMSPortClock) this).setStartTime(-1); + // ((SysCAMSPortClock) this).setDutyCycle(-1); + // ((SysCAMSPortClock) this).setPosFirst(true); + ((SysCAMSPortClock) this).setOrigin(1); } else if (this instanceof SysCAMSPortConverter) { ((SysCAMSPortConverter) this).setPeriod(-1); ((SysCAMSPortConverter) this).setTime(""); @@ -549,20 +556,24 @@ public class SysCAMSPrimitivePort extends TGCScalableWithInternalComponent imple sb.append("\" type=\"" + encode(((SysCAMSPortTDF) this).getTDFType())); } if (this instanceof SysCAMSPortDE) { -// sb.append("\" period=\"" + ((SysCAMSPortDE) this).getPeriod()); -// sb.append("\" time=\"" + ((SysCAMSPortDE) this).getTime()); -// sb.append("\" rate=\"" + ((SysCAMSPortDE) this).getRate()); -// sb.append("\" delay=\"" + ((SysCAMSPortDE) this).getDelay()); sb.append("\" type=\"" + encode(((SysCAMSPortDE) this).getDEType())); sb.append("\" sensitive=\"" + ((SysCAMSPortDE) this).getSensitive()); sb.append("\" sensitive_method=\"" + ((SysCAMSPortDE) this).getSensitiveMethod()); sb.append("\" nbits=\"" + ((SysCAMSPortDE) this).getNbits());//DG } + if (this instanceof SysCAMSPortClock) { + /* sb.append("\" =\"" + encode(((SysCAMSPortClock) this).getFrequency())); + sb.append("\" =\"" + ((SysCAMSPortClock) this).getUnit()); + sb.append("\" =\"" + ((SysCAMSPortClock) this).getDutyCycle()); + sb.append("\" =\"" + ((SysCAMSPortClock) this).getStartTime()); + sb.append("\" \"" + ((SysCAMSPortClock) this).getPosFirst());*/ + } + if (this instanceof SysCAMSPortConverter) { sb.append("\" period=\"" + ((SysCAMSPortConverter) this).getPeriod()); sb.append("\" time=\"" + ((SysCAMSPortConverter) this).getTime()); sb.append("\" rate=\"" + ((SysCAMSPortConverter) this).getRate()); - sb.append("\" nbits=\"" + ((SysCAMSPortConverter) this).getNbits());//DG + sb.append("\" nbits=\"" + ((SysCAMSPortConverter) this).getNbits()); sb.append("\" delay=\"" + ((SysCAMSPortConverter) this).getDelay()); sb.append("\" type=\"" + encode(((SysCAMSPortConverter) this).getConvType())); @@ -578,10 +589,10 @@ public class SysCAMSPrimitivePort extends TGCScalableWithInternalComponent imple Node n1, n2; Element elt; - double period; + double period, frequency, dutyCycle, startTime; int rate, delay; String type, time, sensitiveMethod; - Boolean sensitive; + Boolean sensitive, posFirst; for(int i=0; i<nl.getLength(); i++) { n1 = nl.item(i); @@ -608,16 +619,19 @@ public class SysCAMSPrimitivePort extends TGCScalableWithInternalComponent imple ((SysCAMSPortTDF) this).setDelay(delay); ((SysCAMSPortTDF) this).setTDFType(type); } else if (this instanceof SysCAMSPortDE) { - // ((SysCAMSPortDE)this).setPeriod(period); - // ((SysCAMSPortDE)this).setTime(time); - // ((SysCAMSPortDE)this).setRate(rate); - // ((SysCAMSPortDE)this).setDelay(delay); - type = elt.getAttribute("type"); + type = elt.getAttribute("type"); sensitive = Boolean.parseBoolean(elt.getAttribute("sensitive")); sensitiveMethod = elt.getAttribute("sensitive_method"); ((SysCAMSPortDE) this).setDEType(type); ((SysCAMSPortDE) this).setSensitive(sensitive); ((SysCAMSPortDE) this).setSensitiveMethod(sensitiveMethod); + } else if (this instanceof SysCAMSPortClock) { + type = elt.getAttribute("type"); + /* ((SysCAMSPortClock) this).setFrequency(frequency); + ((SysCAMSPortClock) this).setUnit(unit); + ((SysCAMSPortClock) this).setStartTime(startTime); + ((SysCAMSPortClock) this).setDutyCycle(dutyCycle); + ((SysCAMSPortClock) this).setPosFirst(posFirst);*/ } else if (this instanceof SysCAMSPortConverter) { period = Double.valueOf(elt.getAttribute("period")).doubleValue(); time = elt.getAttribute("time"); @@ -664,6 +678,9 @@ public class SysCAMSPrimitivePort extends TGCScalableWithInternalComponent imple return "Port DE"; } else if (this instanceof SysCAMSPortConverter) { return "Port Converter"; + } + else if (this instanceof SysCAMSPortClock) { + return "Port Clock"; } return ""; } diff --git a/src/main/java/ui/window/JDialogSysCAMSClock.java b/src/main/java/ui/window/JDialogSysCAMSClock.java index 2bba9765c0..2d2525dae5 100644 --- a/src/main/java/ui/window/JDialogSysCAMSClock.java +++ b/src/main/java/ui/window/JDialogSysCAMSClock.java @@ -64,7 +64,7 @@ public class JDialogSysCAMSClock extends JDialog implements ActionListener, List // private String listPeriodString[]; // private JComboBox<String> periodComboBoxString; - private JTextField frequencyTextField; + private JTextField frequencyTextField; private JTextField unitTextField; private JTextField dutyCycleTextField; @@ -319,439 +319,10 @@ public class JDialogSysCAMSClock extends JDialog implements ActionListener, List new Insets(5, 10, 5, 10), 0, 0); gridBag.setConstraints(posFirstComboBoxString, constraints); attributesBoxPanel.add(posFirstComboBoxString); - -// JLabel periodLabel = new JLabel("Period Tm : "); -// constraints = new GridBagConstraints(0, 1, 1, 1, 1.0, 1.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, -// new Insets(5, 10, 15, 10), 0, 0); -// gridBag.setConstraints(periodLabel, constraints); -// attributesBoxPanel.add(periodLabel); -// -// if (clock.getPeriod() == -1) { -// periodTextField = new JTextField(10); -// } else { -// periodTextField = new JTextField("" + clock.getPeriod(), 10); -// } -// constraints = new GridBagConstraints(1, 1, 1, 1, 1.0, 1.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, -// new Insets(5, 10, 15, 10), 0, 0); -// gridBag.setConstraints(periodTextField, constraints); -// attributesBoxPanel.add(periodTextField); -// -// listPeriodString = new String[3]; -// listPeriodString[0] = "us"; -// listPeriodString[1] = "ms"; -// listPeriodString[2] = "s"; -// periodComboBoxString = new JComboBox<String>(listPeriodString); -// if (clock.getTime().equals("") || clock.getTime().equals("us")) { -// periodComboBoxString.setSelectedIndex(0); -// } else if (clock.getTime().equals("ms")) { -// periodComboBoxString.setSelectedIndex(1); -// } else if (clock.getTime().equals("s")) { -// periodComboBoxString.setSelectedIndex(2); -// } -// periodComboBoxString.setActionCommand("time"); -// periodComboBoxString.addActionListener(this); -// constraints = new GridBagConstraints(2, 1, 1, 1, 1.0, 1.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, -// new Insets(5, 10, 15, 10), 0, 0); -// gridBag.setConstraints(periodComboBoxString, constraints); -// attributesBoxPanel.add(periodComboBoxString); - + attributesBox.add(attributesBoxPanel); attributesMainPanel.add(attributesBox, BorderLayout.NORTH); - /* if (clock.getFather() != null) { - // --- Parameters ---// - parametersMainPanel.setLayout(new BorderLayout()); - - Box parametersBox = Box.createVerticalBox(); - parametersBox.setBorder(BorderFactory.createTitledBorder("Setting TDF clock parameters")); - - JPanel clockPanel = new JPanel(new GridLayout(3, 1)); - - // Struct - JPanel structPanel = new JPanel(); - structPanel.setFont(new Font("Helvetica", Font.PLAIN, 14)); - GridBagLayout gridBagParameter = new GridBagLayout(); - GridBagConstraints constraintParameter = new GridBagConstraints(); - structPanel.setLayout(gridBagParameter); - TitledBorder border = new TitledBorder("Struct :"); - border.setTitleJustification(TitledBorder.CENTER); - border.setTitlePosition(TitledBorder.TOP); - structPanel.setBorder(border); - - JLabel nameParameterLabel = new JLabel("identifier"); - constraintParameter = new GridBagConstraints(0, 0, 1, 1, 1.0, 1.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, - new Insets(5, 10, 5, 10), 0, 0); - gridBagParameter.setConstraints(nameParameterLabel, constraintParameter); - structPanel.add(nameParameterLabel); - - nameStructTextField = new JTextField(); - constraintParameter = new GridBagConstraints(0, 1, 1, 1, 1.0, 1.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, - new Insets(5, 10, 5, 10), 0, 0); - gridBagParameter.setConstraints(nameStructTextField, constraintParameter); - structPanel.add(nameStructTextField); - - JLabel egalLabel = new JLabel("="); - constraintParameter = new GridBagConstraints(1, 1, 1, 1, 1.0, 1.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, - new Insets(5, 10, 5, 10), 0, 0); - gridBagParameter.setConstraints(egalLabel, constraintParameter); - structPanel.add(egalLabel); - - JLabel valueParameterLabel = new JLabel("value"); - constraintParameter = new GridBagConstraints(2, 0, 1, 1, 1.0, 1.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, - new Insets(5, 10, 5, 10), 0, 0); - gridBagParameter.setConstraints(valueParameterLabel, constraintParameter); - structPanel.add(valueParameterLabel); - - valueStructTextField = new JTextField(); - constraintParameter = new GridBagConstraints(2, 1, 1, 1, 1.0, 1.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, - new Insets(5, 10, 5, 10), 0, 0); - gridBagParameter.setConstraints(valueStructTextField, constraintParameter); - structPanel.add(valueStructTextField); - - JLabel pointsLabel = new JLabel(":"); - constraintParameter = new GridBagConstraints(3, 1, 1, 1, 1.0, 1.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, - new Insets(5, 10, 5, 10), 0, 0); - gridBagParameter.setConstraints(pointsLabel, constraintParameter); - structPanel.add(pointsLabel); - - JLabel constantLabel = new JLabel("const"); - constraintParameter = new GridBagConstraints(4, 0, 1, 1, 1.0, 1.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, - new Insets(5, 10, 5, 10), 0, 0); - gridBagParameter.setConstraints(constantLabel, constraintParameter); - structPanel.add(constantLabel); - - constantStructRadioButton = new JRadioButton(); - constantStructRadioButton.setActionCommand("Const"); - constantStructRadioButton.setSelected(false); - constantStructRadioButton.addActionListener(this); - constraintParameter = new GridBagConstraints(4, 1, 1, 1, 1.0, 1.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, - new Insets(5, 10, 5, 10), 0, 0); - gridBagParameter.setConstraints(constantStructRadioButton, constraintParameter); - structPanel.add(constantStructRadioButton); - - JLabel typeParameterLabel = new JLabel("type"); - constraintParameter = new GridBagConstraints(5, 0, 1, 1, 1.0, 1.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, - new Insets(5, 10, 5, 10), 0, 0); - gridBagParameter.setConstraints(typeParameterLabel, constraintParameter); - structPanel.add(typeParameterLabel); - - listTypeStructString = new String[6]; - listTypeStructString[0] = "bool"; - listTypeStructString[1] = "double"; - listTypeStructString[2] = "float"; - listTypeStructString[3] = "int"; - listTypeStructString[4] = "long"; - listTypeStructString[5] = "short"; - typeStructComboBoxString = new JComboBox<String>(listTypeStructString); - typeStructComboBoxString.setSelectedIndex(0); - typeStructComboBoxString.addActionListener(this); - constraintParameter = new GridBagConstraints(5, 1, 1, 1, 1.0, 1.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, - new Insets(5, 10, 5, 10), 0, 0); - gridBagParameter.setConstraints(typeStructComboBoxString, constraintParameter); - structPanel.add(typeStructComboBoxString); - - JButton addModifyButton = new JButton("Add / Modify parameter"); - addModifyButton.setActionCommand("Add_Modify_Struct"); - addModifyButton.addActionListener(this); - constraintParameter = new GridBagConstraints(0, 2, 6, 1, 1.0, 1.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, - new Insets(5, 10, 5, 10), 0, 0); - gridBagParameter.setConstraints(addModifyButton, constraintParameter); - structPanel.add(addModifyButton); - - clockPanel.add(structPanel); - - // Template - JPanel templatePanel = new JPanel(); - templatePanel.setFont(new Font("Helvetica", Font.PLAIN, 14)); - GridBagLayout templateGridBag = new GridBagLayout(); - GridBagConstraints templateConstraint = new GridBagConstraints(); - templatePanel.setLayout(templateGridBag); - TitledBorder templateBorder = new TitledBorder("Template :"); - templateBorder.setTitleJustification(TitledBorder.CENTER); - templateBorder.setTitlePosition(TitledBorder.TOP); - templatePanel.setBorder(templateBorder); - - JLabel nameTemplateLabel = new JLabel("identifier"); - templateConstraint = new GridBagConstraints(0, 0, 1, 1, 1.0, 1.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, - new Insets(5, 10, 5, 10), 0, 0); - templateGridBag.setConstraints(nameTemplateLabel, templateConstraint); - templatePanel.add(nameTemplateLabel); - - nameTemplateTextField = new JTextField(clock.getNameTemplate()); - templateConstraint = new GridBagConstraints(0, 1, 1, 1, 1.0, 1.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, - new Insets(5, 10, 5, 10), 0, 0); - templateGridBag.setConstraints(nameTemplateTextField, templateConstraint); - templatePanel.add(nameTemplateTextField); - - //CHANGES - JLabel egalTemplateLabel = new JLabel("="); - templateConstraint = new GridBagConstraints(1, 1, 1, 1, 1.0, 1.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, - new Insets(5, 10, 5, 10), 0, 0); - templateGridBag.setConstraints(egalTemplateLabel, templateConstraint); - templatePanel.add(egalTemplateLabel); - - JLabel valueTemplateLabel = new JLabel("value"); - templateConstraint = new GridBagConstraints(2, 0, 1, 1, 1.0, 1.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, - new Insets(5, 10, 5, 10), 0, 0); - templateGridBag.setConstraints(valueTemplateLabel, templateConstraint); - templatePanel.add(valueTemplateLabel); - - valueTemplateTextField = new JTextField(clock.getValueTemplate()); - templateConstraint = new GridBagConstraints(2, 1, 1, 1, 1.0, 1.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, - new Insets(5, 10, 5, 10), 0, 0); - templateGridBag.setConstraints(valueTemplateTextField, templateConstraint); - templatePanel.add(valueTemplateTextField); - //CHANGES - - JLabel pointsTemplateLabel = new JLabel(":"); - templateConstraint = new GridBagConstraints(3, 1, 1, 1, 1.0, 1.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, - new Insets(5, 10, 5, 10), 0, 0); - templateGridBag.setConstraints(pointsTemplateLabel, templateConstraint); - templatePanel.add(pointsTemplateLabel); - - JLabel typeTemplateLabel = new JLabel("type"); - templateConstraint = new GridBagConstraints(4, 0, 1, 1, 1.0, 1.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, - new Insets(5, 10, 5, 10), 0, 0); - templateGridBag.setConstraints(typeTemplateLabel, templateConstraint); - templatePanel.add(typeTemplateLabel); - - listTypeTemplateString = new String[1]; - listTypeTemplateString[0] = "int"; - typeTemplateComboBoxString = new JComboBox<String>(listTypeTemplateString); - if (clock.getTypeTemplate().equals("int") || clock.getTypeTemplate().equals("")) { - typeTemplateComboBoxString.setSelectedIndex(0); - } - typeTemplateComboBoxString.addActionListener(this); - templateConstraint = new GridBagConstraints(4, 1, 1, 1, 1.0, 1.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, - new Insets(5, 10, 5, 10), 0, 0); - templateGridBag.setConstraints(typeTemplateComboBoxString, templateConstraint); - templatePanel.add(typeTemplateComboBoxString); - - JButton OKButton = new JButton("OK"); - OKButton.setActionCommand("OK"); - OKButton.addActionListener(this); - templateConstraint = new GridBagConstraints(0, 2, 3, 1, 1.0, 1.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, - new Insets(5, 10, 5, 10), 0, 0); - templateGridBag.setConstraints(OKButton, templateConstraint); - templatePanel.add(OKButton); - - clockPanel.add(templatePanel); - - // Typedef - JPanel typedefPanel = new JPanel(); - typedefPanel.setFont(new Font("Helvetica", Font.PLAIN, 14)); - GridBagLayout typedefGridBag = new GridBagLayout(); - GridBagConstraints typedefConstraint = new GridBagConstraints(); - typedefPanel.setLayout(typedefGridBag); - TitledBorder typedefBorder = new TitledBorder("Typedef :"); - typedefBorder.setTitleJustification(TitledBorder.CENTER); - typedefBorder.setTitlePosition(TitledBorder.TOP); - typedefPanel.setBorder(typedefBorder); - - JLabel nameTypedefLabel = new JLabel("identifier"); - typedefConstraint = new GridBagConstraints(0, 0, 1, 1, 1.0, 1.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, - new Insets(5, 10, 5, 10), 0, 0); - typedefGridBag.setConstraints(nameTypedefLabel, typedefConstraint); - typedefPanel.add(nameTypedefLabel); - - nameTypedefTextField = new JTextField(); - if (clock.getListTypedef().isEmpty()) { - nameTypedefTextField.setEditable(false); - } else { - nameTypedefTextField.setEditable(true); - } - typedefConstraint = new GridBagConstraints(0, 1, 1, 1, 1.0, 1.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, - new Insets(5, 10, 5, 10), 0, 0); - typedefGridBag.setConstraints(nameTypedefTextField, typedefConstraint); - typedefPanel.add(nameTypedefTextField); - - JLabel pointsTypedefLabel = new JLabel(":"); - typedefConstraint = new GridBagConstraints(1, 1, 1, 1, 1.0, 1.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, - new Insets(5, 10, 5, 10), 0, 0); - typedefGridBag.setConstraints(pointsTypedefLabel, typedefConstraint); - typedefPanel.add(pointsTypedefLabel); - - JLabel typeTypedefLabel = new JLabel("type"); - typedefConstraint = new GridBagConstraints(2, 0, 1, 1, 1.0, 1.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, - new Insets(5, 10, 5, 10), 0, 0); - typedefGridBag.setConstraints(typeTypedefLabel, typedefConstraint); - typedefPanel.add(typeTypedefLabel); - - listTypeTypedefString = new String[1]; - listTypeTypedefString[0] = "sc_dt::sc_int"; - typeTypedefComboBoxString = new JComboBox<String>(listTypeTypedefString); - typeTypedefComboBoxString.setSelectedIndex(0); - if (clock.getListTypedef().isEmpty()) { - typeTypedefComboBoxString.setEnabled(false); - } else { - typeTypedefComboBoxString.setEnabled(true); - } - typeTypedefComboBoxString.addActionListener(this); - typedefConstraint = new GridBagConstraints(2, 1, 1, 1, 1.0, 1.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, - new Insets(5, 10, 5, 10), 0, 0); - typedefGridBag.setConstraints(typeTypedefComboBoxString, typedefConstraint); - typedefPanel.add(typeTypedefComboBoxString); - - addModifyTypedefButton = new JButton("Add / Modify typedef"); - addModifyTypedefButton.setActionCommand("Add_Modify_Typedef"); - addModifyTypedefButton.addActionListener(this); - if (clock.getListTypedef().isEmpty()) { - addModifyTypedefButton.setEnabled(false); - } else { - addModifyTypedefButton.setEnabled(true); - } - typedefConstraint = new GridBagConstraints(0, 2, 3, 1, 1.0, 1.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, - new Insets(5, 10, 5, 10), 0, 0); - typedefGridBag.setConstraints(addModifyTypedefButton, typedefConstraint); - typedefPanel.add(addModifyTypedefButton); - - clockPanel.add(typedefPanel); - - parametersBox.add(clockPanel); - parametersMainPanel.add(parametersBox, BorderLayout.WEST); - - Box managingParametersBox = Box.createVerticalBox(); - - JPanel managingParameterBoxPanel = new JPanel(new GridLayout(3, 1)); - managingParameterBoxPanel.setFont(new Font("Helvetica", Font.PLAIN, 14)); - - JPanel listStructPanel = new JPanel(); - TitledBorder listStructBorder = new TitledBorder("Managing struct :"); - listStructBorder.setTitleJustification(TitledBorder.CENTER); - listStructBorder.setTitlePosition(TitledBorder.TOP); - listStructPanel.setBorder(listStructBorder); - - structListModel = clock.getListStruct(); - structList = new JList<String>(structListModel); - structList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); - structList.setLayoutOrientation(JList.VERTICAL); - structList.setSelectedIndex(-1); - structList.setVisibleRowCount(5); - structList.addListSelectionListener(this); - JScrollPane scrollPane = new JScrollPane(structList); - scrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS); - scrollPane.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS); - scrollPane.setPreferredSize(new Dimension(300, 100)); - listStructPanel.add(scrollPane); - managingParameterBoxPanel.add(listStructPanel); - - JPanel listTypedefPanel = new JPanel(); - TitledBorder listTypedefBorder = new TitledBorder("Managing typedef :"); - listTypedefBorder.setTitleJustification(TitledBorder.CENTER); - listTypedefBorder.setTitlePosition(TitledBorder.TOP); - listTypedefPanel.setBorder(listTypedefBorder); - - typedefListModel = clock.getListTypedef(); - typedefList = new JList<String>(typedefListModel); - typedefList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); - typedefList.setLayoutOrientation(JList.VERTICAL); - typedefList.setSelectedIndex(-1); - typedefList.setVisibleRowCount(5); - typedefList.addListSelectionListener(this); - JScrollPane typedefScrollPane = new JScrollPane(typedefList); - typedefScrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS); - typedefScrollPane.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS); - typedefScrollPane.setPreferredSize(new Dimension(300, 100)); - listTypedefPanel.add(typedefScrollPane); - managingParameterBoxPanel.add(listTypedefPanel); - - GridBagLayout buttonGridBag = new GridBagLayout(); - GridBagConstraints buttonconstraints = new GridBagConstraints(); - JPanel buttonPanel = new JPanel(); - buttonPanel.setFont(new Font("Helvetica", Font.PLAIN, 14)); - buttonPanel.setLayout(buttonGridBag); - - upButton = new JButton("Up"); - upButton.setActionCommand("Up"); - upButton.setEnabled(false); - upButton.addActionListener(this); - buttonconstraints = new GridBagConstraints(0, 0, 1, 1, 1.0, 1.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, - new Insets(5, 10, 5, 10), 0, 0); - buttonGridBag.setConstraints(upButton, buttonconstraints); - buttonPanel.add(upButton); - - downButton = new JButton("Down"); - downButton.setActionCommand("Down"); - downButton.setEnabled(false); - downButton.addActionListener(this); - buttonconstraints = new GridBagConstraints(0, 1, 1, 1, 1.0, 1.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, - new Insets(5, 10, 5, 10), 0, 0); - buttonGridBag.setConstraints(downButton, buttonconstraints); - buttonPanel.add(downButton); - - removeButton = new JButton("Remove parameter"); - removeButton.setActionCommand("Remove"); - removeButton.setEnabled(false); - removeButton.addActionListener(this); - buttonconstraints = new GridBagConstraints(0, 2, 1, 1, 1.0, 1.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, - new Insets(5, 10, 15, 10), 0, 0); - buttonGridBag.setConstraints(removeButton, buttonconstraints); - buttonPanel.add(removeButton); - - managingParameterBoxPanel.add(buttonPanel); - - managingParametersBox.add(managingParameterBoxPanel); - parametersMainPanel.add(managingParametersBox, BorderLayout.EAST); - */ - // --- ProcessCode ---// - /* codeMainPanel.setLayout(new BorderLayout()); - - Box codeBox = Box.createVerticalBox(); - codeBox.setBorder(BorderFactory.createTitledBorder("Behavior function of DE clock")); - - JPanel codeBoxPanel = new JPanel(new BorderLayout()); - - GridBagLayout nameGridBag = new GridBagLayout(); - GridBagConstraints nameConstraints = new GridBagConstraints(); - JPanel namePanel = new JPanel(); - namePanel.setFont(new Font("Helvetica", Font.PLAIN, 14)); - namePanel.setLayout(nameGridBag); - - JLabel nameFnLabel = new JLabel("Name of the method :"); - nameConstraints = new GridBagConstraints(0, 0, 1, 1, 1.0, 1.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, - new Insets(5, 10, 5, 10), 0, 0); - nameGridBag.setConstraints(nameFnLabel, nameConstraints); - namePanel.add(nameFnLabel); - - nameFnTextField = new JTextField(clock.getNameFn(), 20); - nameConstraints = new GridBagConstraints(1, 0, 1, 1, 1.0, 1.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, - new Insets(5, 10, 5, 10), 0, 0); - nameGridBag.setConstraints(nameFnTextField, nameConstraints); - namePanel.add(nameFnTextField); - - nameFnButton = new JButton("OK"); - nameFnButton.setActionCommand("Name_OK"); - nameFnButton.addActionListener(this); - nameConstraints = new GridBagConstraints(2, 0, 1, 1, 1.0, 1.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, - new Insets(5, 10, 5, 10), 0, 0); - nameGridBag.setConstraints(nameFnButton, nameConstraints); - namePanel.add(nameFnButton); - - codeBoxPanel.add(namePanel, BorderLayout.NORTH); - - StringBuffer stringbuf = encode(clock.getCode()); - String beginString = stringbuf.toString(); - finalString = beginString.replaceAll("\t}", "}"); - - codeTextArea = new JTextArea(finalString); - codeTextArea.setSize(100, 100); - codeTextArea.setTabSize(2); - - codeTextArea.setFont(new Font("Arial", Font.PLAIN, 16)); - codeTextArea.setLineWrap(true); - codeTextArea.setWrapStyleWord(true); - - JScrollPane codeScrollPane = new JScrollPane(codeTextArea); - codeScrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS); - codeScrollPane.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS); - codeScrollPane.setPreferredSize(new Dimension(200, 300)); - codeScrollPane.setBorder(new EmptyBorder(15, 10, 15, 10)); - - codeBoxPanel.add(codeScrollPane, BorderLayout.SOUTH); - - codeBox.add(codeBoxPanel); - codeMainPanel.add(codeBox, BorderLayout.PAGE_START); - }*/ // -- Button -- / JPanel downPanel = new JPanel(new FlowLayout()); @@ -777,13 +348,13 @@ public class JDialogSysCAMSClock extends JDialog implements ActionListener, List public void actionPerformed(ActionEvent e) { - clock.setName(nameTextField.getText()); + /* clock.setName(nameTextField.getText()); clock.setFrequency(frequencyTextField.getText()); clock.setDutyCycle(dutyCycleTextField.getText()); clock.setStartTime(startTimeTextField.getText()); clock.setPosFirst((String) posFirstComboBoxString.getSelectedItem()); clock.setUnit((String) unitComboBoxString.getSelectedItem()); - + */ if ("Name_OK".equals(e.getActionCommand())) { if (!nameFnTextField.getText().equals("")) { codeTextArea.setText("void " + nameFnTextField.getText() + "() {\n\n}"); diff --git a/src/main/java/ui/window/JDialogSysCAMSPortClock.java b/src/main/java/ui/window/JDialogSysCAMSPortClock.java index 0052a88aa2..2ce2b4af6a 100644 --- a/src/main/java/ui/window/JDialogSysCAMSPortClock.java +++ b/src/main/java/ui/window/JDialogSysCAMSPortClock.java @@ -59,21 +59,6 @@ import javax.swing.*; public class JDialogSysCAMSPortClock extends JDialog implements ActionListener { private JTextField nameTextField; - - // private JTextField periodTextField; - // private String listPeriodString[]; - // private JComboBox<String> periodComboBoxString; - // private JTextField rateTextField; - // private JTextField delayTextField; - private JTextField nbitsTextField; - private ArrayList<String> listArrayTypeString; - private JComboBox<String> typeComboBoxString; - private String listOriginString[]; - private JComboBox<String> originComboBoxString; - private JRadioButton sensitiveRadioButton; - private String listSensitiveString[]; - private JComboBox<String> sensitiveComboBoxString; - private SysCAMSPortClock port; public JDialogSysCAMSPortClock(SysCAMSPortClock port) { @@ -127,194 +112,7 @@ public class JDialogSysCAMSPortClock extends JDialog implements ActionListener { gridBag.setConstraints(nameTextField, constraints); boxPanel.add(nameTextField); - JLabel nbitsLabel = new JLabel("Nbits : "); - 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(nbitsLabel, constraints); - boxPanel.add(nbitsLabel); - - if (port.getNbits() == -1) { - nbitsTextField = new JTextField(10); - } else { - nbitsTextField = new JTextField("" + port.getNbits(), 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(nbitsTextField, constraints); - boxPanel.add(nbitsTextField); - - // - // listPeriodString = new String[3]; - // listPeriodString[0] = "us"; - // listPeriodString[1] = "ms"; - // listPeriodString[2] = "s"; - // periodComboBoxString = new JComboBox<String>(listPeriodString); - // if (port.getTime().equals("") || port.getTime().equals("us")) { - // periodComboBoxString.setSelectedIndex(0); - // } else if (port.getTime().equals("ms")){ - // periodComboBoxString.setSelectedIndex(1); - // } else { - // periodComboBoxString.setSelectedIndex(2); - // } - // periodComboBoxString.setActionCommand("time"); - // periodComboBoxString.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(periodComboBoxString, constraints); - // boxPanel.add(periodComboBoxString); - // - // JLabel rateLabel = new JLabel("Rate : "); - // constraints = new GridBagConstraints(0, 2, 1, 1, 1.0, 1.0, - // GridBagConstraints.CENTER, - // GridBagConstraints.BOTH, - // new Insets(5, 10, 5, 10), 0, 0); - // gridBag.setConstraints(rateLabel, constraints); - // boxPanel.add(rateLabel); - // - // if (port.getRate() == -1) { - // rateTextField = new JTextField(10); - // } else { - // rateTextField = new JTextField("" + port.getRate(), 10); - // } - // constraints = new GridBagConstraints(1, 2, 2, 1, 1.0, 1.0, - // GridBagConstraints.CENTER, - // GridBagConstraints.BOTH, - // new Insets(5, 10, 5, 10), 0, 0); - // gridBag.setConstraints(rateTextField, constraints); - // boxPanel.add(rateTextField); - // - // JLabel delayLabel = new JLabel("Delay : "); - // constraints = new GridBagConstraints(0, 3, 1, 1, 1.0, 1.0, - // GridBagConstraints.CENTER, - // GridBagConstraints.BOTH, - // new Insets(5, 10, 5, 10), 0, 0); - // gridBag.setConstraints(delayLabel, constraints); - // boxPanel.add(delayLabel); - // - // if (port.getDelay() == -1) { - // delayTextField = new JTextField(10); - // } else { - // delayTextField = new JTextField("" + port.getDelay(), 10); - // } - // constraints = new GridBagConstraints(1, 3, 2, 1, 1.0, 1.0, - // GridBagConstraints.CENTER, - // GridBagConstraints.BOTH, - // new Insets(5, 10, 5, 10), 0, 0); - // gridBag.setConstraints(delayTextField, constraints); - // boxPanel.add(delayTextField); - - JLabel typeLabel = new JLabel("Type : "); - constraints = new GridBagConstraints(0, 2, 1, 1, 1.0, 1.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, - new Insets(5, 10, 5, 10), 0, 0); - gridBag.setConstraints(typeLabel, constraints); - boxPanel.add(typeLabel); - - listArrayTypeString = new ArrayList<String>(); - listArrayTypeString.add("int"); - listArrayTypeString.add("bool"); - listArrayTypeString.add("double"); - listArrayTypeString.add("sc_uint<N>"); - if (port.getFather() != null) { - if (port.getFather() instanceof SysCAMSClock) { - if (!((SysCAMSClock) port.getFather()).getListTypedef().isEmpty()) { - for (int i = 0; i < ((SysCAMSClock) port.getFather()).getListTypedef().getSize(); i++) { - String select = ((SysCAMSClock) port.getFather()).getListTypedef().get(i); - String[] split = select.split(" : "); - listArrayTypeString.add(split[0]); - } - } - if ((!((SysCAMSClock) port.getFather()).getNameTemplate().equals("")) && (!((SysCAMSClock) port.getFather()).getTypeTemplate().equals("")) - && ((SysCAMSClock) port.getFather()).getListTypedef().isEmpty()) { - listArrayTypeString.add("sc_dt::sc_int<"+((SysCAMSClock) port.getFather()).getNameTemplate()+">"); - } - } - } - typeComboBoxString = new JComboBox<String>(); - for (int i = 0; i < listArrayTypeString.size(); i++) { - typeComboBoxString.addItem(listArrayTypeString.get(i)); - } - for (int i = 0; i < listArrayTypeString.size(); i++) { - if (port.getClockType().equals("")) { - typeComboBoxString.setSelectedIndex(0); - } - if (port.getClockType().equals(listArrayTypeString.get(i))) { - typeComboBoxString.setSelectedIndex(i); - } - } - typeComboBoxString.addActionListener(this); - constraints = new GridBagConstraints(1, 2, 2, 1, 1.0, 1.0, - GridBagConstraints.CENTER, - GridBagConstraints.BOTH, - new Insets(5, 10, 5, 10), 0, 0); - gridBag.setConstraints(typeComboBoxString, constraints); - boxPanel.add(typeComboBoxString); - JLabel orginLabel = new JLabel("Origin : "); - constraints = new GridBagConstraints(0, 3, 1, 1, 1.0, 1.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, - new Insets(5, 10, 15, 10), 0, 0); - gridBag.setConstraints(orginLabel, constraints); - boxPanel.add(orginLabel); - - listOriginString = new String[2]; - listOriginString[0] = "Input"; - listOriginString[1] = "Output"; - originComboBoxString = new JComboBox<String>(listOriginString); - if (port.getOrigin() == 0 || port.getOrigin() == -1) { - originComboBoxString.setSelectedIndex(0); - } else { - originComboBoxString.setSelectedIndex(1); - } - originComboBoxString.setActionCommand("origin"); - originComboBoxString.addActionListener(this); - constraints = new GridBagConstraints(1, 3, 1, 1, 1.0, 1.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, - new Insets(5, 10, 15, 10), 0, 0); - gridBag.setConstraints(originComboBoxString, constraints); - boxPanel.add(originComboBoxString); - - box.add(boxPanel); - attributesMainPanel.add(box); - - JPanel sensitivePanel = new JPanel(new FlowLayout()); - - sensitiveRadioButton = new JRadioButton(); - sensitiveRadioButton.setActionCommand("Sensitive"); - sensitiveRadioButton.setSelected(port.getSensitive()); - sensitiveRadioButton.addActionListener(this); - sensitivePanel.add(sensitiveRadioButton); - - JLabel sensitiveLabel = new JLabel("Sensitive"); - sensitivePanel.add(sensitiveLabel); - - constraints = new GridBagConstraints(0, 4, 1, 1, 1.0, 1.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, - new Insets(15, 10, 5, 10), 0, 0); - gridBag.setConstraints(sensitivePanel, constraints); - boxPanel.add(sensitivePanel); - - listSensitiveString = new String[3]; - listSensitiveString[0] = ""; - listSensitiveString[1] = "positive"; - listSensitiveString[2] = "negative"; - sensitiveComboBoxString = new JComboBox<String>(listSensitiveString); - if (port.getSensitiveMethod().equals("")) { - sensitiveComboBoxString.setSelectedIndex(0); - } else if (port.getSensitiveMethod().equals("positive")) { - sensitiveComboBoxString.setSelectedIndex(1); - } else if (port.getSensitiveMethod().equals("negative")) { - sensitiveComboBoxString.setSelectedIndex(2); - } - sensitiveComboBoxString.setActionCommand("Sensitive_method"); - sensitiveComboBoxString.setEnabled(port.getSensitive()); - sensitiveComboBoxString.addActionListener(this); - constraints = new GridBagConstraints(1, 4, 1, 1, 1.0, 1.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, - new Insets(15, 10, 5, 10), 0, 0); - gridBag.setConstraints(sensitiveComboBoxString, constraints); - boxPanel.add(sensitiveComboBoxString); // -- Button -- // JPanel downPanel = new JPanel(new FlowLayout()); @@ -339,107 +137,24 @@ public class JDialogSysCAMSPortClock extends JDialog implements ActionListener { } public void actionPerformed(ActionEvent e) { - if ("Sensitive".equals(e.getActionCommand())) { + + // block.setFrequency(Double.parseDouble(periodTextField.getText())); + // block.setTime((String) frequencyComboBoxString.getSelectedItem()); + + + + /* if ("Sensitive".equals(e.getActionCommand())) { if (sensitiveRadioButton.isSelected() == true) { sensitiveComboBoxString.setEnabled(true); } else { sensitiveComboBoxString.setEnabled(false); } - } + }*/ if ("Save_Close".equals(e.getActionCommand())) { port.setPortName(new String(nameTextField.getText())); - - if (!(nbitsTextField.getText().isEmpty())) { - Boolean nbitsValueInteger = false; - try { - Integer.parseInt(nbitsTextField.getText()); - } catch (NumberFormatException e1) { - JDialog msg = new JDialog(this); - msg.setLocationRelativeTo(null); - JOptionPane.showMessageDialog(msg, "Nbits is not a Integer", "Warning !", - JOptionPane.WARNING_MESSAGE); - nbitsValueInteger = true; - } - /* if (nbitsValueInteger == false) { - port.setNbits(Integer.parseInt(nbitsTextField.getText())); - } - } else { - port.setNbits(-1); - }*/ - - } - // if (!(periodTextField.getText().isEmpty())) { - // Boolean periodValueInteger = false; - // try { - // Integer.parseInt(periodTextField.getText()); - // } catch (NumberFormatException e1) { - // JDialog msg = new JDialog(this); - // msg.setLocationRelativeTo(null); - // JOptionPane.showMessageDialog(msg, "Period is not a Integer", "Warning !", - // JOptionPane.WARNING_MESSAGE); - // periodValueInteger = true; - // } - // if (periodValueInteger == false) { - // port.setPeriod(Integer.parseInt(periodTextField.getText())); - // } - // } else { - // port.setPeriod(-1); - // } - // - // if (!(rateTextField.getText().isEmpty())) { - // Boolean rateValueInteger = false; - // try { - // Integer.parseInt(rateTextField.getText()); - // } catch (NumberFormatException e1) { - // JDialog msg = new JDialog(this); - // msg.setLocationRelativeTo(null); - // JOptionPane.showMessageDialog(msg, "Rate is not a Integer", "Warning !", - // JOptionPane.WARNING_MESSAGE); - // rateValueInteger = true; - // } - // if (rateValueInteger == false) { - // port.setRate(Integer.parseInt(rateTextField.getText())); - // } - // } else { - // port.setRate(-1); - // } - // - // if (!(delayTextField.getText().isEmpty())) { - // Boolean delayValueInteger = false; - // try { - // Integer.parseInt(delayTextField.getText()); - // } catch (NumberFormatException e1) { - // JDialog msg = new JDialog(this); - // msg.setLocationRelativeTo(null); - // JOptionPane.showMessageDialog(msg, "Delay is not a Integer", "Warning !", - // JOptionPane.WARNING_MESSAGE); - // delayValueInteger = true; - // } - // if (delayValueInteger == false) { - // port.setDelay(Integer.parseInt(delayTextField.getText())); - // } - // } else { - // port.setDelay(-1); - // } - - + + port.setOrigin(0); - if(typeComboBoxString.getSelectedItem()=="sc_uint"){ - port.setClockType("sc_uint<"+nbitsTextField.getText()+">"); - } - else{ - port.setClockType((String) typeComboBoxString.getSelectedItem()); - // port.setTime((String) periodComboBoxString.getSelectedItem()); - } - - if ((String) originComboBoxString.getSelectedItem() == "Output") { - port.setOrigin(1); - } else { - port.setOrigin(0); - } - - port.setSensitive(sensitiveRadioButton.isSelected()); - port.setSensitiveMethod((String) sensitiveComboBoxString.getSelectedItem()); this.dispose(); } -- GitLab