diff --git a/src/main/java/tmltranslator/TMLMapping.java b/src/main/java/tmltranslator/TMLMapping.java index f73721d7b64a2057045e128ea065a8c016349f6a..6de053f010d854c4b7b2ed27cd793a07e4d0d799 100755 --- a/src/main/java/tmltranslator/TMLMapping.java +++ b/src/main/java/tmltranslator/TMLMapping.java @@ -1802,7 +1802,7 @@ public class TMLMapping<E> { // Routers / NoC / Network public void removeAllRouters() { - TMAP2Network translator = new TMAP2Network(this); - translator.removeAllRouters(); + TMAP2Network translator = new TMAP2Network(this, 2); + translator.removeAllRouterNodes(); } } diff --git a/src/main/java/tmltranslator/tonetwork/TMAP2Network.java b/src/main/java/tmltranslator/tonetwork/TMAP2Network.java index e7db7dc1f0affb081f2439dfe7b07b87c5d71689..dcb3f2933a2b92c3af86972a41d8a95b29d3adf4 100644 --- a/src/main/java/tmltranslator/tonetwork/TMAP2Network.java +++ b/src/main/java/tmltranslator/tonetwork/TMAP2Network.java @@ -64,21 +64,23 @@ public class TMAP2Network { private boolean optimize; private int nbOfVCs = 2; + private int nocSize = 2; private TranslatedRouter[][] routers; - public TMAP2Network(TMLMapping<?> _tmlmapping) { + public TMAP2Network(TMLMapping<?> _tmlmapping, int nocSize) { tmlmapping = _tmlmapping; routers = new TranslatedRouter[nbOfVCs][nbOfVCs]; + this.nocSize = nocSize; } /* List of assumptions: - Only one router set (i.e. no router, then bus, then router) between two tasks - Channels must be mapped on at least one route to be taken into account */ - public void removeAllRouters() { + public void removeAllRouterNodes() { // Make all routers - for(int i=0; i<nbOfVCs; i++) { - for(int j=0; j<nbOfVCs; j++) { + for(int i=0; i<nocSize; i++) { + for(int j=0; j<nocSize; j++) { TranslatedRouter tr = new TranslatedRouter(nbOfVCs, i, j); routers[i][j] = tr; tr.makeRouter(); diff --git a/src/main/java/tmltranslator/tonetwork/TranslatedRouter.java b/src/main/java/tmltranslator/tonetwork/TranslatedRouter.java index e0acb0b3f618fa19838c806f5d3166927bfdd33d..93adb18d8339cf288ac2accb7eb7eb008264b423 100644 --- a/src/main/java/tmltranslator/tonetwork/TranslatedRouter.java +++ b/src/main/java/tmltranslator/tonetwork/TranslatedRouter.java @@ -61,6 +61,8 @@ public class TranslatedRouter<E> { private TMLMapping<E> map; private Vector<TMLEvent> pktins; + private Vector<TMLTask> dispatchers; + public TranslatedRouter(int nbOfVCs, int xPos, int yPos) { @@ -82,6 +84,16 @@ public class TranslatedRouter<E> { TMLArchitecture tmla = new TMLArchitecture(); map = new TMLMapping<E>(tmlm, tmla, false); + // TASKS + + // One dispatcher per port + // A dispatcher outputs to VCs tasks + dispatchers = new Vector<>(); + for(i=0; i<NB_OF_PORTS; i++) { + + } + + // Create all channels // For each input VC, we have to create a channel for (i=0; i<NB_OF_PORTS*nbOfVCs; i++) { diff --git a/src/main/java/ui/ActionPerformer.java b/src/main/java/ui/ActionPerformer.java index 28bb9705c00b458e1cc11704bc19044df6d05901..e627e5106654f9deff67692052bb737f8d8fd236 100644 --- a/src/main/java/ui/ActionPerformer.java +++ b/src/main/java/ui/ActionPerformer.java @@ -177,6 +177,8 @@ public class ActionPerformer { mgui.dseZ3(); } else if (command.equals(mgui.actions[TGUIAction.ACT_DSE].getActionCommand())) { mgui.dse(); + } else if (command.equals(mgui.actions[TGUIAction.ACT_REMOVENOC].getActionCommand())) { + mgui.removeNoC(); } else if (command.equals(mgui.actions[TGUIAction.ACT_AVATAR_MODEL_CHECKER].getActionCommand())) { mgui.avatarModelChecker(); } else if (command.equals(mgui.actions[TGUIAction.ACT_GEN_JAVA].getActionCommand())) { diff --git a/src/main/java/ui/JToolBarMainTurtle.java b/src/main/java/ui/JToolBarMainTurtle.java index 01c2f4b82be28de4fd507f02afed4d5321232b9e..01c09022724bb567de40a363e5989e38af2e5633 100644 --- a/src/main/java/ui/JToolBarMainTurtle.java +++ b/src/main/java/ui/JToolBarMainTurtle.java @@ -64,7 +64,7 @@ public class JToolBarMainTurtle extends JToolBar implements ActionListener JButton avatarSimu, avatarFVUPPAAL, avatarFVProVerif, avatarFVStaticAnalysis, avatarCodeGeneration, avatarMC; // Other - JButton genrtlotos, genlotos, genuppaal, gendesign, dse, dseZ3; + JButton genrtlotos, genlotos, genuppaal, gendesign, dse, dseZ3, noc; JButton checkcode, simulation, validation; JButton oneClickrtlotos, onclicklotos, gensystemc, simusystemc, gentml, genC, genjava, nc,externalSearch, internalSearch; @@ -259,6 +259,11 @@ public class JToolBarMainTurtle extends JToolBar implements ActionListener addSeparator(); + if (MainGUI.experimentalOn) { + noc = add(mgui.actions[TGUIAction.ACT_REMOVENOC]); + noc.addMouseListener(mgui.mouseHandler); + } + if (MainGUI.ncOn) { nc = add(mgui.actions[TGUIAction.ACT_NC]); nc.addMouseListener(mgui.mouseHandler); @@ -327,6 +332,10 @@ public class JToolBarMainTurtle extends JToolBar implements ActionListener dseZ3.setVisible(!b); } + if (noc != null) { + noc.setVisible(!b); + } + avatarSimu.setVisible(b); avatarFVUPPAAL.setVisible(b); if (avatarFVProVerif != null) { @@ -406,6 +415,11 @@ public class JToolBarMainTurtle extends JToolBar implements ActionListener if (dseZ3 != null) { dseZ3.setVisible(b); } + + if (noc != null) { + noc.setVisible(b); + } + avatarSimu.setVisible(!b); avatarFVUPPAAL.setVisible(!b); avatarFVStaticAnalysis.setVisible(!b); diff --git a/src/main/java/ui/MainGUI.java b/src/main/java/ui/MainGUI.java index 43e36797bafd71f85506e6c487231d7bc0c7e686..bd71d87beda5a38c0198e80826baf54a20611a5e 100644 --- a/src/main/java/ui/MainGUI.java +++ b/src/main/java/ui/MainGUI.java @@ -4847,6 +4847,26 @@ public class MainGUI implements ActionListener, WindowListener, KeyListener, Per dtree.toBeUpdated(); } + + public void removeNoC() { + //TraceManager.addDev("Design space exploration with Z3"); + if (gtm == null) { + return; + } + + TMLMapping map = gtm.getTMLMapping(); + + if (map == null) { + return; + } + + JDialogNoCManagement jdsenm = new JDialogNoCManagement(frame, this, "Removing NoC", map); + // jdsez3.setSize(600,800); + GraphicLib.centerOnParent(jdsenm, 700, 800); + jdsenm.setVisible(true); + dtree.toBeUpdated(); + } + public void avatarStaticAnalysis() { TraceManager.addDev("Avatar static analysis invariants"); JDialogInvariantAnalysis jgen = new JDialogInvariantAnalysis(frame, this, "Static analysis: invariants computation"); diff --git a/src/main/java/ui/ModeManager.java b/src/main/java/ui/ModeManager.java index 37712ad69d103a0ecdd2a500864568d96d4df278..ba3f925aa0970635fde9f9189979c5816ed5d0d5 100644 --- a/src/main/java/ui/ModeManager.java +++ b/src/main/java/ui/ModeManager.java @@ -145,6 +145,7 @@ public class ModeManager { actions[TGUIAction.ACT_GEN_LOTOS].setEnabled(true); actions[TGUIAction.ACT_DSE].setEnabled(true); actions[TGUIAction.ACT_DSE_Z3].setEnabled(true); + actions[TGUIAction.ACT_REMOVENOC].setEnabled(true); if (mgui.getCurrentTURTLEPanel() instanceof TMLComponentDesignPanel) { actions[TGUIAction.ACT_GEN_UPPAAL].setEnabled(true); } else { @@ -230,6 +231,7 @@ public class ModeManager { actions[TGUIAction.ACT_GEN_LOTOS].setEnabled(false); actions[TGUIAction.ACT_DSE].setEnabled(false); actions[TGUIAction.ACT_DSE_Z3].setEnabled(false); + actions[TGUIAction.ACT_REMOVENOC].setEnabled(false); actions[TGUIAction.ACT_GEN_JAVA].setEnabled(false); actions[TGUIAction.ACT_SIMU_JAVA].setEnabled(false); actions[TGUIAction.ACT_GEN_DESIGN].setEnabled(false); @@ -255,6 +257,7 @@ public class ModeManager { actions[TGUIAction.ACT_GEN_LOTOS].setEnabled(false); actions[TGUIAction.ACT_DSE].setEnabled(false); actions[TGUIAction.ACT_DSE_Z3].setEnabled(false); + actions[TGUIAction.ACT_REMOVENOC].setEnabled(false); actions[TGUIAction.ACT_CHECKCODE].setEnabled(false); actions[TGUIAction.ACT_SIMULATION].setEnabled(false); actions[TGUIAction.ACT_VALIDATION].setEnabled(false); @@ -276,6 +279,7 @@ public class ModeManager { actions[TGUIAction.ACT_GEN_LOTOS].setEnabled(false); actions[TGUIAction.ACT_DSE].setEnabled(false); actions[TGUIAction.ACT_DSE_Z3].setEnabled(false); + actions[TGUIAction.ACT_REMOVENOC].setEnabled(false); actions[TGUIAction.ACT_GEN_JAVA].setEnabled(false); actions[TGUIAction.ACT_SIMU_JAVA].setEnabled(false); actions[TGUIAction.ACT_GEN_DESIGN].setEnabled(false); diff --git a/src/main/java/ui/TGUIAction.java b/src/main/java/ui/TGUIAction.java index 6defdce51bbd17189e592a6bfd472366d62dbde9..76353ac81354fe8dcb3f9c1af9ba29f508652d87 100644 --- a/src/main/java/ui/TGUIAction.java +++ b/src/main/java/ui/TGUIAction.java @@ -648,9 +648,13 @@ public class TGUIAction extends AbstractAction { public static final int ACT_AVATAR_FV_STATICANALYSIS = 365; public static final int ACT_AVATAR_EXECUTABLE_GENERATION = 340; + // DSE public static final int ACT_DSE = 434; public static final int ACT_DSE_Z3 = 516; + // NoC and routers + public static final int ACT_REMOVENOC = 517; + // Ontologies public static final int ACT_GENERATE_ONTOLOGIES_CURRENT_DIAGRAM = 367; public static final int ACT_GENERATE_ONTOLOGIES_CURRENT_SET_OF_DIAGRAMS = 369; @@ -668,7 +672,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 = 517; + public static final int NB_ACTION = 518; private static final TAction [] actions = new TAction[NB_ACTION]; @@ -1138,7 +1142,7 @@ public class TGUIAction extends AbstractAction { actions[TMLARCHI_PORT_ARTIFACT] = new TAction("add-tmlarchi-port-artifact", "Map a port", IconManager.imgic702, IconManager.imgic702, "Map a port", "Map a port onto a node in the currently opened DIPLODOCUS architecture diagram", 0); actions[TMLARCHI_EVENT_ARTIFACT] = new TAction("add-tmlarchi-event-artifact", "Map an event / request", IconManager.imgic702, IconManager.imgic702, "Map an event/request", "Map an event or a request onto a node in the currently opened DIPLODOCUS architecture diagram", 0); actions[TMLARCHI_BRIDGENODE] = new TAction("add-tmlarchi-bridgenode", "Add a Bridge node", IconManager.imgic1104, IconManager.imgic1104, "Bridge node", "Add a bridge node to the currently opened DIPLODOCUS architecture diagram", 0); - actions[TMLARCHI_ROUTERNODE] = new TAction("add-tmlarchi-routernode", "Add a Router node", IconManager.imgic1104, IconManager.imgic1104, "Router node", "Add a router node to the currently opened DIPLODOCUS architecture diagram", 0); + actions[TMLARCHI_ROUTERNODE] = new TAction("add-tmlarchi-nocnode", "Add a NoC node", IconManager.imgic1104, IconManager.imgic1104, "NoC node", "Add a NoC node to the currently opened DIPLODOCUS architecture diagram", 0); actions[TMLARCHI_HWANODE] = new TAction("add-tmlarchi-hwanode", "Add a hardware accelerator node", IconManager.imgic1106, IconManager.imgic1106, "Hardware accelerator node", "Add a hardware accelerator node to the currently opened DIPLODOCUS architecture diagram", 0); actions[TMLARCHI_CAMSNODE] = new TAction("add-tmlarchi-camsnode", "Add a System C-AMS node", IconManager.imgic1106, IconManager.imgic1106, "System C-AMS node", "Add a System C-AMS node to the currently open DIPLODOCUS architecture diagram", 0); actions[TMLARCHI_MEMORYNODE] = new TAction("add-tmlarchi-memorynode", "Add a memory node", IconManager.imgic1108, IconManager.imgic1108, "Memory node", "Add a memory node to the currently opened DIPLODOCUS architecture diagram", 0); @@ -1146,6 +1150,8 @@ public class TGUIAction extends AbstractAction { actions[TMLARCHI_KEY] = new TAction("add-tmlarchi-key", "Map a key", IconManager.imgic1118, IconManager.imgic1118, "Map a key", "Map a key onto a node in the currently opened DIPLODOCUS architecture diagram", 0); actions[TMLARCHI_FIREWALL] = new TAction("add-tmlarchi-firewall", "Add a Firewall", IconManager.imgic7001, IconManager.imgic7001, "Add a Firewall", "Add a Firewall in the currently opened DIPLODOCUS architecture diagram",0); + actions[ACT_REMOVENOC] = new TAction("remove-nocnode", "Remove NoC nodes", IconManager.imgic1104, IconManager.imgic1104, "Remove NoC node", "Replaces NoC nodes with similar tasks and nodes", 0); + actions[TMLCP_EDIT] = new TAction("edit-tmlcp-diagram", "Edit communication pattern diagram", IconManager.imgic100, IconManager.imgic101, "Edit communication pattern diagram", "Make it possible to edit the currently opened communication pattern diagram", 0); actions[TMLCP_CONNECTOR] = new TAction("add-tmlcp-connector", "Add CP Connector", IconManager.imgic202, IconManager.imgic202, "Connector", "Add a Connector between two components of the currently opened communication pattern diagram", 0); actions[TMLCP_REF_SD] = new TAction("add-ref-sd-tmlcp", "Add reference to a SD", IconManager.imgic400, IconManager.imgic400, "Reference to a SD", "Add a reference to a sequence diagram in the the currently opened communication pattern diagram", 0); diff --git a/src/main/java/ui/tmldd/TMLArchiRouterNode.java b/src/main/java/ui/tmldd/TMLArchiRouterNode.java index 551fc75ec6c3d0cae52a33e23336b9def4cea2c5..bb72795bb8b4eb72ebfa0ec6904e979d11df8d4c 100755 --- a/src/main/java/ui/tmldd/TMLArchiRouterNode.java +++ b/src/main/java/ui/tmldd/TMLArchiRouterNode.java @@ -65,7 +65,7 @@ public class TMLArchiRouterNode extends TMLArchiCommunicationNode implements Swa private int textY2 = 30; private int derivationx = 2; private int derivationy = 3; - private String stereotype = "ROUTER"; + private String stereotype = "NoC"; private int size = 2; // 2x2 NoC by default private int bufferByteDataSize = HwBridge.DEFAULT_BUFFER_BYTE_DATA_SIZE; @@ -178,7 +178,7 @@ public class TMLArchiRouterNode extends TMLArchiCommunicationNode implements Swa int tmp; String tmpName; - JDialogRouterNode dialog = new JDialogRouterNode(frame, "Setting router attributes", this); + JDialogRouterNode dialog = new JDialogRouterNode(frame, "Setting NoC attributes", this); // dialog.setSize(350, 350); GraphicLib.centerOnParent(dialog, 350, 350); dialog.setVisible( true ); // blocked until dialog has been closed diff --git a/src/main/java/ui/window/JDialogNoCManagement.java b/src/main/java/ui/window/JDialogNoCManagement.java new file mode 100644 index 0000000000000000000000000000000000000000..9fd0d22c5251de777268b1d090a973a8df2178ad --- /dev/null +++ b/src/main/java/ui/window/JDialogNoCManagement.java @@ -0,0 +1,371 @@ +/* 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 common.ConfigurationTTool; +import common.SpecConfigTTool; +import dseengine.DSEConfiguration; +import launcher.LauncherException; +import launcher.RshClient; +import myutil.GraphicLib; +import myutil.ScrolledJTextArea; +import myutil.TraceManager; +import tmltranslator.TMLMapping; +import tmltranslator.TMLModeling; +import tmltranslator.dsez3engine.InputInstance; +import tmltranslator.dsez3engine.OptimizationModel; +import tmltranslator.dsez3engine.OptimizationResult; +import tmltranslator.tonetwork.TMAP2Network; +import ui.util.IconManager; +import ui.MainGUI; + +import javax.swing.*; +import javax.swing.event.DocumentListener; +import javax.swing.event.DocumentEvent; +import javax.swing.event.ListSelectionEvent; +import javax.swing.event.ListSelectionListener; +import java.awt.*; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.io.File; +import java.util.*; + + +import com.microsoft.z3.*; +import tmltranslator.*; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import myutil.TraceManager; + + +/** + * Class JDialogNoCManagement + * Dialog for managing NoCs in DIPLODOCUS diagrams + * Creation: 05/03/2019 + * + * @author Ludovic APVRILLE + * @version 1.0 05/03/2019 + */ +public class JDialogNoCManagement extends JDialog implements ActionListener, ListSelectionListener, Runnable { + + protected MainGUI mgui; + + + protected final static int NOT_SELECTED = 0; + protected final static int NOT_STARTED = 1; + protected final static int STARTED = 2; + protected final static int STOPPED = 3; + int mode; + + + + protected JButton start; + protected JButton stop; + protected JButton close; + + protected JTextArea outputText; + protected String output = ""; + + + + private Thread t; + private boolean go = false; + + + protected RshClient rshc; + + private TMLMapping map; + private InputInstance inputInstance; + private OptimizationModel optimizationModel; + + + /* + * Creates new form + */ + public JDialogNoCManagement(Frame f, MainGUI _mgui, String title, TMLMapping map) { + super(f, title, true); + + mgui = _mgui; + + this.map = map; + + initComponents(); + myInitComponents(); + + pack(); + + + //getGlassPane().addMouseListener( new MouseAdapter() {}); + getGlassPane().setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); + } + + protected void myInitComponents() { + mode = NOT_STARTED; + setButtons(); + handleStartButton(); + } + + protected void initComponents() { + + Container c = getContentPane(); + setFont(new Font("Helvetica", Font.PLAIN, 14)); + c.setLayout(new BorderLayout()); + + + + JPanel jp03 = new JPanel(); + GridBagLayout gridbag03 = new GridBagLayout(); + GridBagConstraints c03 = new GridBagConstraints(); + jp03.setLayout(gridbag03); + jp03.setBorder(new javax.swing.border.TitledBorder("DSE Options")); + c03.weighty = 1.0; + c03.weightx = 1.0; + c03.gridwidth = GridBagConstraints.REMAINDER; //end row + c03.fill = GridBagConstraints.BOTH; + c03.gridheight = 1; + + + + + JPanel jp04 = new JPanel(); + + GridBagLayout gridbag04 = new GridBagLayout(); + GridBagConstraints c04 = new GridBagConstraints(); + jp04.setLayout(gridbag04); + + c04.weighty = 1.0; + c04.weightx = 1.0; + c04.gridwidth = GridBagConstraints.REMAINDER; //end row + c04.fill = GridBagConstraints.BOTH; + c04.gridheight = 1; + + //jp04.setBorder(new javax.swing.border.TitledBorder("DSE Output")); + //jp04.add(new JLabel("Design Space Exploration Output"), c04); + + + outputText = new ScrolledJTextArea(); + outputText.setEditable(false); + outputText.setMargin(new Insets(10, 10, 10, 10)); + outputText.setTabSize(3); + outputText.append("How to start?" + + "\n - Simply click on start ^^\n"); + JScrollPane jsp = new JScrollPane(outputText, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS, + JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS); + jsp.setPreferredSize(new Dimension(300, 300)); + Font f = new Font("Courrier", Font.BOLD, 12); + outputText.setFont(f); + jp04.add(jsp, c04); + //jp1.add("Results", jp04); + + c.add(jp03, BorderLayout.NORTH); + c.add(jp04, BorderLayout.CENTER); + + start = new JButton("Start", IconManager.imgic53); + stop = new JButton("Stop", IconManager.imgic55); + close = new JButton("Close", IconManager.imgic27); + + + start.setPreferredSize(new Dimension(100, 30)); + stop.setPreferredSize(new Dimension(100, 30)); + close.setPreferredSize(new Dimension(120, 30)); + + + start.addActionListener(this); + stop.addActionListener(this); + close.addActionListener(this); + + JPanel jp2 = new JPanel(); + + jp2.add(start); + jp2.add(stop); + jp2.add(close); + + + c.add(jp2, BorderLayout.SOUTH); + + + } + + + + private void handleStartButton() { + //TraceManager.addDev("Handle start button"); + + /*boolean b = dseButton.isSelected() || dseButtonFromFile.isSelected(); + nbOfMappings.setEnabled(b); + infoNbOfMappings.setEnabled(b); + randomMappingBox.setEnabled(b); + randomMappingNb.setEnabled(b); + outputTML.setEnabled(b); + outputGUI.setEnabled(b);*/ + //dseOptions.repaint(); + + if (mode != NOT_STARTED && mode != NOT_SELECTED) { + return; + } + + + setButtons(); + + } + + public void valueChanged(ListSelectionEvent e) { + } + + + public void actionPerformed(ActionEvent evt) { + + if (evt.getSource() == start) { + startProcess(); + } else if (evt.getSource() == stop) { + stopProcess(); + } else if (evt.getSource() == close) { + closeDialog(); + } + } + + + + + public void closeDialog() { + if (mode == STARTED) { + stopProcess(); + } + dispose(); + } + + public void stopProcess() { + mode = STOPPED; + setButtons(); + go = false; + + } + + + public void startProcess() { + t = new Thread(this); + mode = STARTED; + setButtons(); + go = true; + t.start(); + } + // + // private void testGo() throws InterruptedException { + // if (go == false) { + // throw new InterruptedException("Stopped by user"); + // } + // } + + public void run() { + // String cmd; + // String list, data; + // int cycle = 0; + output = ""; + + // hasError = false; + //try { + + + TraceManager.addDev("Thread started"); + outputText.append("\nPreparing model\n"); + + TMAP2Network t2n = new TMAP2Network(map, 2); + t2n.removeAllRouterNodes(); + + outputText.append("\nAll done\n"); + + stopProcess(); + + } + + + + + + protected void checkMode() { + mode = NOT_SELECTED; + } + + protected void setButtons() { + switch (mode) { + case NOT_SELECTED: + start.setEnabled(false); + stop.setEnabled(false); + close.setEnabled(true); + //setCursor(CursoretPredefinedCursor(Cursor.DEFAULT_CURSOR)); + getGlassPane().setVisible(false); + break; + case NOT_STARTED: + start.setEnabled(true); + stop.setEnabled(false); + close.setEnabled(true); + //setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); + getGlassPane().setVisible(false); + break; + case STARTED: + start.setEnabled(false); + stop.setEnabled(true); + close.setEnabled(false); + getGlassPane().setVisible(true); + //setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); + break; + case STOPPED: + default: + start.setEnabled(false); + stop.setEnabled(false); + close.setEnabled(true); + getGlassPane().setVisible(false); + break; + } + } + + + + public boolean hasToContinue() { + return (go == true); + } + // + // public void setError() { + // hasError = true; + // } + // +} diff --git a/src/main/java/ui/window/JDialogRouterNode.java b/src/main/java/ui/window/JDialogRouterNode.java index 5cb5eb06d58e558250df87de727b3375d3bf5a53..dfe5d5915fc5dbd8371800a7a023e76433004cc8 100644 --- a/src/main/java/ui/window/JDialogRouterNode.java +++ b/src/main/java/ui/window/JDialogRouterNode.java @@ -106,7 +106,7 @@ public class JDialogRouterNode extends JDialogBase implements ActionListener { panel2 = new JPanel(); panel2.setLayout(gridbag2); - panel2.setBorder(new javax.swing.border.TitledBorder("Bridge attributes")); + panel2.setBorder(new javax.swing.border.TitledBorder("Attributes")); panel2.setPreferredSize(new Dimension(300, 200)); c1.gridwidth = 1; @@ -114,7 +114,7 @@ public class JDialogRouterNode extends JDialogBase implements ActionListener { c1.weighty = 1.0; c1.weightx = 1.0; c1.fill = GridBagConstraints.HORIZONTAL; - panel2.add(new JLabel("Bridge name:"), c2); + panel2.add(new JLabel("NoC name:"), c2); c1.gridwidth = GridBagConstraints.REMAINDER; //end row nodeName = new JTextField(node.getNodeName(), 30); nodeName.setEditable(true);