diff --git a/src/main/java/ui/ActionPerformer.java b/src/main/java/ui/ActionPerformer.java index 075c8ca385e4a415994bc5bf3a318f3dd1e9d78e..3714467acd0159593bfe49ca38a113c2dc087e07 100755 --- a/src/main/java/ui/ActionPerformer.java +++ b/src/main/java/ui/ActionPerformer.java @@ -839,8 +839,8 @@ public class ActionPerformer { mgui.actionOnButton(TGComponentManager.COMPONENT, TGComponentManager.TMLARCHI_BRIDGENODE); } else if (command.equals(mgui.actions[TGUIAction.TMLARCHI_HWANODE].getActionCommand())) { mgui.actionOnButton(TGComponentManager.COMPONENT, TGComponentManager.TMLARCHI_HWANODE); - } else if (command.equals(mgui.actions[TGUIAction.TMLARCHI_CAMSNODE].getActionCommand())) { - mgui.actionOnButton(TGComponentManager.COMPONENT, TGComponentManager.TMLARCHI_CAMSNODE); + //} else if (command.equals(mgui.actions[TGUIAction.TMLARCHI_CAMSNODE].getActionCommand())) { + //mgui.actionOnButton(TGComponentManager.COMPONENT, TGComponentManager.TMLARCHI_CAMSNODE); } else if (command.equals(mgui.actions[TGUIAction.TMLARCHI_MEMORYNODE].getActionCommand())) { mgui.actionOnButton(TGComponentManager.COMPONENT, TGComponentManager.TMLARCHI_MEMORYNODE); } else if (command.equals(mgui.actions[TGUIAction.TMLARCHI_DMANODE].getActionCommand())) { @@ -895,12 +895,12 @@ public class ActionPerformer { mgui.actionOnButton(TGComponentManager.COMPONENT, TGComponentManager.TMLSD_ACTION_STATE); //SystemC AMS - } else if (command.equals(mgui.actions[TGUIAction.CAMS_EDIT].getActionCommand())) { + /*} else if (command.equals(mgui.actions[TGUIAction.CAMS_EDIT].getActionCommand())) { mgui.actionOnButton(TGComponentManager.EDIT, -1); } else if (command.equals(mgui.actions[TGUIAction.CAMS_BLOCK].getActionCommand())) { mgui.actionOnButton(TGComponentManager.COMPONENT, TGComponentManager.CAMS_BLOCK); } else if (command.equals(mgui.actions[TGUIAction.CAMS_CONNECTOR].getActionCommand())) { - mgui.actionOnButton(TGComponentManager.COMPONENT, TGComponentManager.CAMS_CONNECTOR); + mgui.actionOnButton(TGComponentManager.COMPONENT, TGComponentManager.CAMS_CONNECTOR);*/ // Attack Tree Diagrams } else if (command.equals(mgui.actions[TGUIAction.ATD_BLOCK].getActionCommand())) { diff --git a/src/main/java/ui/GTMLModeling.java b/src/main/java/ui/GTMLModeling.java index 942cf0cf56af1c5c599a23ce216f484f6c6608e8..f0fddf226c781dab2f7fbb51b0395382e2c79241 100755 --- a/src/main/java/ui/GTMLModeling.java +++ b/src/main/java/ui/GTMLModeling.java @@ -70,7 +70,6 @@ import ui.tmlsd.TGConnectorMessageTMLSD; import ui.tmlsd.TMLSDControllerInstance; import ui.tmlsd.TMLSDStorageInstance; import ui.tmlsd.TMLSDTransferInstance; -import ui.het.*; import java.util.*; import java.awt.Point; diff --git a/src/main/java/ui/MainGUI.java b/src/main/java/ui/MainGUI.java index 35784b5d4a112e111a14b8540f9382aecb805bf2..589793a429be8f0df2b18d583224f6d1246da655 100644 --- a/src/main/java/ui/MainGUI.java +++ b/src/main/java/ui/MainGUI.java @@ -83,7 +83,6 @@ import ui.tmlcompd.TMLCCompositeComponent; import ui.tmlcompd.TMLComponentTaskDiagramPanel; import ui.tmlcp.TMLCPPanel; import ui.tmldd.TMLArchiDiagramPanel; -import ui.tmldd.TMLArchiCAMSNode; import ui.tmlsd.TMLSDPanel; //import ui.het.*; import ui.tree.DiagramTreeModel; @@ -991,7 +990,7 @@ public class MainGUI implements ActionListener, WindowListener, KeyListener, Pe return index; } - public int addSystemCAMSPanel(String name, int index) { //ajout CD -----Mark + /*public int addSystemCAMSPanel(String name, int index) { //ajout CD -----Mark if (index == -1) { index = tabs.size(); } @@ -1019,7 +1018,7 @@ public class MainGUI implements ActionListener, WindowListener, KeyListener, Pe mainTabbedPane.setIconAt(index, IconManager.imgic60); scp.init(); return scp.getCAMSBlockDiagramPanel(); - } + }*/ //Return the list of all the TMLArchiDiagramPanels public Vector<TMLArchiPanel> getTMLArchiDiagramPanels() { @@ -1396,11 +1395,11 @@ public class MainGUI implements ActionListener, WindowListener, KeyListener, Pe return index; } - public int createSystemCAMS(String name) { //ajout CD + /*public int createSystemCAMS(String name) { //ajout CD int index = addSystemCAMSPanel(name, -1); mainTabbedPane.setSelectedIndex(index); return index; - } + }*/ public int createADD(String name) { int index = addADDPanel(name, -1); @@ -1775,14 +1774,14 @@ public class MainGUI implements ActionListener, WindowListener, KeyListener, Pe //frame.repaint(); } - public void newSystemCAMS() {//ajout CD + /*public void newSystemCAMS() {//ajout CD //TraceManager.addDev("NEW DIPLO Architecture"); addSystemCAMSPanel("SystemC-AMS", -1); tabs.elementAt(tabs.size()-1).tabbedPane.setSelectedIndex(0); mainTabbedPane.setSelectedIndex(tabs.size()-1); //paneAction(null); //frame.repaint(); - } + }*/ public void newADD() { //TraceManager.addDev("NEW Avatar deployment"); diff --git a/src/main/java/ui/SystemCAMSPanel.java b/src/main/java/ui/SystemCAMSPanel.java index 19587244f2999b9acaf9975317b845d3b20b6add..10f52e36c7eda75410824b83b864a87660c2801a 100755 --- a/src/main/java/ui/SystemCAMSPanel.java +++ b/src/main/java/ui/SystemCAMSPanel.java @@ -42,11 +42,11 @@ package ui; import myutil.GraphicLib; -import ui.het.CAMSBlockDiagramToolBar; -import ui.het.CAMSBlockDiagramPanel; +//import ui.het.CAMSBlockDiagramToolBar; +//import ui.het.CAMSBlockDiagramPanel; import ui.util.IconManager; import ui.TDiagramPanel; -import ui.window.JDialogCAMSBlocks; +//import ui.window.JDialogCAMSBlocks; import javax.swing.*; import javax.swing.event.ChangeEvent; @@ -63,8 +63,8 @@ import java.util.Vector; * @see MainGUI */ public class SystemCAMSPanel extends TURTLEPanel { - public SystemCAMSPanel scp; - public CAMSBlockDiagramPanel camsbdp; + //public SystemCAMSPanel scp; + //public CAMSBlockDiagramPanel camsbdp; public TURTLEPanel tp; public TDiagramPanel tdp; public Vector<TGComponent> validated, ignored; @@ -87,7 +87,7 @@ public class SystemCAMSPanel extends TURTLEPanel { public void init() { // Class Diagram toolbar - CAMSBlockDiagramToolBar camstoolBar = new CAMSBlockDiagramToolBar(mgui); + /*CAMSBlockDiagramToolBar camstoolBar = new CAMSBlockDiagramToolBar(mgui); toolbars.add(camstoolBar); toolBarPanel = new JPanel(); toolBarPanel.setLayout(new BorderLayout()); @@ -108,7 +108,7 @@ public class SystemCAMSPanel extends TURTLEPanel { toolBarPanel.add(jsp, BorderLayout.CENTER); tabbedPane.addTab("SystemC-AMS Diagram", IconManager.imgic60, toolBarPanel, "opens SystemC-AMS diagram"); tabbedPane.setSelectedIndex(0); - mgui.changeMade(camsbdp, TDiagramPanel.NEW_COMPONENT); + mgui.changeMade(camsbdp, TDiagramPanel.NEW_COMPONENT);*/ } @@ -134,7 +134,7 @@ public class SystemCAMSPanel extends TURTLEPanel { } } - public CAMSBlockDiagramPanel getCAMSBlockDiagramPanel(){ + /*public CAMSBlockDiagramPanel getCAMSBlockDiagramPanel(){ return camsbdp; - } + }*/ } diff --git a/src/main/java/ui/TDiagramPanel.java b/src/main/java/ui/TDiagramPanel.java index 034f24f8ece4f8d69f75e966361a8bafc3abbdea..f86123a5d68cb4f658094ce08fee90da2239c89f 100755 --- a/src/main/java/ui/TDiagramPanel.java +++ b/src/main/java/ui/TDiagramPanel.java @@ -109,7 +109,7 @@ public abstract class TDiagramPanel extends JPanel implements GenericTree { protected List<TGComponent> componentList; protected TGConnectingPoint selectedConnectingPoint; - protected CAMSConnectingPoint selectedCAMSConnectingPoints; + //protected CAMSConnectingPoint selectedCAMSConnectingPoints; protected TGComponent componentPointed; protected TGComponent componentPopup; protected TToolBar ttb; @@ -178,7 +178,7 @@ public abstract class TDiagramPanel extends JPanel implements GenericTree { protected int y2; protected Vector<Point> listPoint; protected TGConnectingPoint p1, p2; - protected CAMSConnectingPoint cp1, cp2; + //protected CAMSConnectingPoint cp1, cp2; protected int type; // For component selection @@ -475,8 +475,8 @@ public abstract class TDiagramPanel extends JPanel implements GenericTree { if (this.javaVisible && (tgc.hasPostJavaCode () || tgc.hasPreJavaCode ())) tgc.drawJavaCode (g); - if (this instanceof CAMSBlockDiagramPanel) //Connecting points should always be visible in System-C AMS panels - tgc.drawTGConnectingPoint (g, this.type); + //if (this instanceof CAMSBlockDiagramPanel) //Connecting points should always be visible in System-C AMS panels + //tgc.drawTGConnectingPoint (g, this.type); } // Draw name of component selected @@ -907,9 +907,9 @@ public abstract class TDiagramPanel extends JPanel implements GenericTree { return selectedConnectingPoint; } - public CAMSConnectingPoint getSelectedCAMSConnectingPoint(){ - return selectedCAMSConnectingPoints; - } + //public CAMSConnectingPoint getSelectedCAMSConnectingPoint(){ + //return selectedCAMSConnectingPoints; + //} // Adding component public TGComponent addComponent(int x, int y, boolean swallow) { @@ -1050,7 +1050,7 @@ public abstract class TDiagramPanel extends JPanel implements GenericTree { listPoint = null; } - public void addingCAMSConnector() { + /*public void addingCAMSConnector() { listPoint = new Vector<Point>(); cp1 = getSelectedCAMSConnectingPoint(); x1 = cp1.getX(); y1 = cp1.getY(); @@ -1086,7 +1086,7 @@ public abstract class TDiagramPanel extends JPanel implements GenericTree { stopAddingConnector(true); cp1.setFree(true); } - } + }*/ // -------------mark diff --git a/src/main/java/ui/TGComponentManager.java b/src/main/java/ui/TGComponentManager.java index af58daf8ef14df88e988e756ed3a188aa6fa8030..3dea64a7ccde88f50cf62d75d5dcf81bcbc59373 100755 --- a/src/main/java/ui/TGComponentManager.java +++ b/src/main/java/ui/TGComponentManager.java @@ -75,7 +75,7 @@ import ui.tmlcompd.*; import ui.tmlcp.*; import ui.tmldd.*; import ui.tmlsd.*; -import ui.het.*; +//import ui.het.*; import ui.ucd.*; import java.awt.*; @@ -262,7 +262,7 @@ public class TGComponentManager { public static final int TMLARCHI_BUSNODE = 1102; public static final int TMLARCHI_COMMUNICATION_ARTIFACT = 1103; public static final int TMLARCHI_HWANODE = 1104; - public static final int TMLARCHI_CAMSNODE = 1115; + //public static final int TMLARCHI_CAMSNODE = 1115; public static final int TMLARCHI_MEMORYNODE = 1105; public static final int TMLARCHI_BRIDGENODE = 1106; public static final int TMLARCHI_DMANODE = 1107; @@ -323,8 +323,8 @@ public class TGComponentManager { public static final int TMLSD_ACTION_STATE = 1524; // SystemC-AMS - public static final int CAMS_CONNECTOR = 1601; - public static final int CAMS_BLOCK = 1602 ; + //public static final int CAMS_CONNECTOR = 1601; + //public static final int CAMS_BLOCK = 1602 ; // SMD diagram public static final int PROSMD_START_STATE = 2000; @@ -1178,9 +1178,9 @@ public class TGComponentManager { case TMLARCHI_HWANODE: tgc = new TMLArchiHWANode(x, y, tdp.getMinX(), tdp.getMaxX(), tdp.getMinY(), tdp.getMaxY(), false, null, tdp); break; - case TMLARCHI_CAMSNODE: + /*case TMLARCHI_CAMSNODE: tgc = new TMLArchiCAMSNode(x, y, tdp.getMinX(), tdp.getMaxX(), tdp.getMinY(), tdp.getMaxY(), false, null, tdp); - break; + break;*/ case TMLARCHI_MEMORYNODE: tgc = new TMLArchiMemoryNode(x, y, tdp.getMinX(), tdp.getMaxX(), tdp.getMinY(), tdp.getMaxY(), false, null, tdp); break; @@ -1202,9 +1202,9 @@ public class TGComponentManager { case TMLARCHI_KEY: tgc = new TMLArchiKey(x, y, tdp.getMinX(), tdp.getMaxX(), tdp.getMinY(), tdp.getMaxY(), false, null, tdp); break; - case CAMS_BLOCK: - tgc = new CAMSBlock(x,y, tdp.getMinX(), tdp.getMaxX(), tdp.getMinY(), tdp.getMaxY(), false, null, tdp); - break; + //case CAMS_BLOCK: + //tgc = new CAMSBlock(x,y, tdp.getMinX(), tdp.getMaxX(), tdp.getMinY(), tdp.getMaxY(), false, null, tdp); + //break; // Communication patterns + SD case TMLCP_CHOICE: @@ -1588,8 +1588,8 @@ public class TGComponentManager { return AAD_ASSOCIATION_CONNECTOR; //SystemC-AMS -----mark - } else if (tgc instanceof CAMSBlockConnector) { - return CAMS_CONNECTOR; + //} else if (tgc instanceof CAMSBlockConnector) { + //return CAMS_CONNECTOR; // Others } else if (tgc instanceof TADDeterministicDelay) { @@ -1905,8 +1905,8 @@ public class TGComponentManager { // return AVATAR_FIREWALL; } else if (tgc instanceof TMLArchiHWANode) { return TMLARCHI_HWANODE; - } else if (tgc instanceof TMLArchiCAMSNode) { - return TMLARCHI_CAMSNODE; + /*} else if (tgc instanceof TMLArchiCAMSNode) { + return TMLARCHI_CAMSNODE;*// } else if (tgc instanceof TMLArchiMemoryNode) { return TMLARCHI_MEMORYNODE; } else if (tgc instanceof TMLArchiDMANode) { @@ -2312,10 +2312,10 @@ public class TGComponentManager { } - public final static CAMSBlockConnector addCAMSConnector(int x, int y, int id, TDiagramPanel tdp, CAMSConnectingPoint p1, CAMSConnectingPoint p2, Vector<Point> listPoint) { + /*public final static CAMSBlockConnector addCAMSConnector(int x, int y, int id, TDiagramPanel tdp, CAMSConnectingPoint p1, CAMSConnectingPoint p2, Vector<Point> listPoint) { CAMSBlockConnector cbc = null; cbc = new CAMSBlockConnector(x, y, tdp.getMinX(), tdp.getMaxX(), tdp.getMinY(), tdp.getMaxY(), false, null, tdp, p1, p2, listPoint); return cbc; - } + }*/ } // Class diff --git a/src/main/java/ui/tmldd/TMLArchiCAMSNode.java b/src/main/java/ui/tmldd/TMLArchiCAMSNode.java deleted file mode 100755 index f9364ed305bcfdf5b68ad4cf6bdc8be933ceb1c7..0000000000000000000000000000000000000000 --- a/src/main/java/ui/tmldd/TMLArchiCAMSNode.java +++ /dev/null @@ -1,405 +0,0 @@ -/* Copyright or (C) or Copr. GET / ENST, Telecom-Paris, Ludovic Apvrille - * - * ludovic.apvrille AT enst.fr - * - * This software is a computer program whose purpose is to allow the - * edition of TURTLE analysis, design and deployment diagrams, to - * allow the generation of RT-LOTOS or Java code from this diagram, - * and at last to allow the analysis of formal validation traces - * obtained from external tools, e.g. RTL from LAAS-CNRS and CADP - * from INRIA Rhone-Alpes. - * - * This software is governed by the CeCILL license under French law and - * abiding by the rules of distribution of free software. You can use, - * modify and/ or redistribute the software under the terms of the CeCILL - * license as circulated by CEA, CNRS and INRIA at the following URL - * "http://www.cecill.info". - * - * As a counterpart to the access to the source code and rights to copy, - * modify and redistribute granted by the license, users are provided only - * with a limited warranty and the software's author, the holder of the - * economic rights, and the successive licensors have only limited - * liability. - * - * In this respect, the user's attention is drawn to the risks associated - * with loading, using, modifying and/or developing or reproducing the - * software by the user in light of its specific status of free software, - * that may mean that it is complicated to manipulate, and that also - * therefore means that it is reserved for developers and experienced - * professionals having in-depth computer knowledge. Users are therefore - * encouraged to load and test the software's suitability as regards their - * requirements in conditions enabling the security of their systems and/or - * data to be ensured and, more generally, to use and operate it in the - * same conditions as regards security. - * - * The fact that you are presently reading this means that you have had - * knowledge of the CeCILL license and that you accept its terms. - */ - - - - -package ui.tmldd; - -import myutil.GraphicLib; -import org.w3c.dom.Element; -import org.w3c.dom.Node; -import org.w3c.dom.NodeList; -import tmltranslator.HwCPU; -import ui.*; -//import ui.het.*; -import ui.util.IconManager; - -import javax.swing.*; -import java.awt.*; -import java.util.Vector; - -/** - * Class TMLArchiCAMSNode - * System C-AMS Node. To be used in TML architecture diagrams. - * Creation: 06/09/2017 - * @version 1.0 06/09/2017 - * @author Côme DEMARIGNY - */ -public class TMLArchiCAMSNode extends TMLArchiNode implements SwallowTGComponent, WithAttributes { - private int textY1 = 15; - private int textY2 = 30; - private int derivationx = 2; - private int derivationy = 3; - private String stereotype = "CAMS"; - - private int byteDataSize = HwCPU.DEFAULT_BYTE_DATA_SIZE; - private int execiTime = HwCPU.DEFAULT_EXECI_TIME; - - private CAMSBlockDiagramPanel cbdp; - - - public TMLArchiCAMSNode(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); - - width = 200; - height = 200; - minWidth = 100; - minHeight = 100; - - nbConnectingPoint = 16; - connectingPoint = new TGConnectingPoint[16]; - - connectingPoint[0] = new TMLArchiConnectingPoint(this, 0, 0, false, true, 0.0, 0.0); - connectingPoint[1] = new TMLArchiConnectingPoint(this, 0, 0, false, true, 0.5, 0.0); - connectingPoint[2] = new TMLArchiConnectingPoint(this, 0, 0, false, true, 1.0, 0.0); - connectingPoint[3] = new TMLArchiConnectingPoint(this, 0, 0, false, true, 0.0, 0.5); - connectingPoint[4] = new TMLArchiConnectingPoint(this, 0, 0, false, true, 1.0, 0.5); - connectingPoint[5] = new TMLArchiConnectingPoint(this, 0, 0, false, true, 0.0, 1.0); - connectingPoint[6] = new TMLArchiConnectingPoint(this, 0, 0, false, true, 0.5, 1.0); - connectingPoint[7] = new TMLArchiConnectingPoint(this, 0, 0, false, true, 1.0, 1.0); - - connectingPoint[8] = new TMLArchiConnectingPoint(this, 0, 0, false, true, 0.25, 0.0); - connectingPoint[9] = new TMLArchiConnectingPoint(this, 0, 0, false, true, 0.75, 0.0); - connectingPoint[10] = new TMLArchiConnectingPoint(this, 0, 0, false, true, 0.0, 0.25); - connectingPoint[11] = new TMLArchiConnectingPoint(this, 0, 0, false, true, 1.0, 0.25); - connectingPoint[12] = new TMLArchiConnectingPoint(this, 0, 0, false, true, 0.0, 0.75); - connectingPoint[13] = new TMLArchiConnectingPoint(this, 0, 0, false, true, 1.0, 0.75); - connectingPoint[14] = new TMLArchiConnectingPoint(this, 0, 0, false, true, 0.25, 1.0); - connectingPoint[15] = new TMLArchiConnectingPoint(this, 0, 0, false, true, 0.75, 1.0); - - addTGConnectingPointsComment(); - - nbInternalTGComponent = 0; - - moveable = true; - editable = true; - removable = true; - userResizable = true; - - name = tdp.findNodeName("CAMS"); - value = "name"; - - myImageIcon = IconManager.imgic700; - } - - public void internalDrawing(Graphics g) { - Color c = g.getColor(); - g.draw3DRect(x, y, width, height, true); - - - // Top lines - g.drawLine(x, y, x + derivationx, y - derivationy); - g.drawLine(x + width, y, x + width + derivationx, y - derivationy); - g.drawLine(x + derivationx, y - derivationy, x + width + derivationx, y - derivationy); - - // Right lines - g.drawLine(x + width, y + height, x + width + derivationx, y - derivationy + height); - g.drawLine(x + derivationx + width, y - derivationy, x + width + derivationx, y - derivationy + height); - - // Filling color - g.setColor(ColorManager.HWA_BOX); - g.fill3DRect(x+1, y+1, width-1, height-1, true); - g.setColor(c); - - // Strings - String ster = "<<" + stereotype + ">>"; - int w = g.getFontMetrics().stringWidth(ster); - Font f = g.getFont(); - g.setFont(f.deriveFont(Font.BOLD)); - g.drawString(ster, x + (width - w)/2, y + textY1); - g.setFont(f); - w = g.getFontMetrics().stringWidth(name); - g.drawString(name, x + (width - w)/2, y + textY2); - - // Icon - g.drawImage(IconManager.imgic1106.getImage(), x + 4, y + 4, null); - g.drawImage(IconManager.img9, x + width - 20, y + 4, null); - } - - public TGComponent isOnOnlyMe(int x1, int y1) { - - Polygon pol = new Polygon(); - pol.addPoint(x, y); - pol.addPoint(x + derivationx, y - derivationy); - pol.addPoint(x + derivationx + width, y - derivationy); - pol.addPoint(x + derivationx + width, y + height - derivationy); - pol.addPoint(x + width, y + height); - pol.addPoint(x, y + height); - if (pol.contains(x1, y1)) { - return this; - } - - return null; - } - - public String getStereotype() { - return stereotype; - - } - - public String getNodeName() { - return name; - } - - public boolean editOndoubleClick(JFrame frame) { - if ( cbdp == null){ - MainGUI mgui = tdp.getMainGUI(); - cbdp = mgui.addSystemCAMSPanel("System C-AMS Deployment of DIPLODOCUS Node", -1, this); - cbdp.setVisible(true); - cbdp.initFromDiplodocus(); - - } - return true; - } - - // boolean error = false; - // String errors = ""; - // int tmp; - // String tmpName; - - // JDialogHwANode dialog = new JDialogHwANode(frame, "Setting HWA attributes", this); - // // dialog.setSize(500, 450); - // GraphicLib.centerOnParent(dialog, 500, 450); - // dialog.setVisible( true ); // blocked until dialog has been closed - - // if (!dialog.isRegularClose()) { - // return false; - // } - - // if (dialog.getNodeName().length() != 0) { - // tmpName = dialog.getNodeName(); - // tmpName = tmpName.trim(); - // if (!TAttribute.isAValidId(tmpName, false, false)) { - // error = true; - // errors += "Name of the node "; - // } else { - // name = tmpName; - // } - // } - - // if (dialog.getByteDataSize().length() != 0) { - // try { - // tmp = byteDataSize; - // byteDataSize = Integer.decode(dialog.getByteDataSize()).intValue(); - // if (byteDataSize <= 0) { - // byteDataSize = tmp; - // error = true; - // errors += "Data size "; - // } - // } catch (Exception e) { - // error = true; - // errors += "Data size "; - // } - // } - - // if (dialog.getExeciTime().length() != 0) { - // try { - // tmp = execiTime; - // execiTime = Integer.decode(dialog.getExeciTime()).intValue(); - // if (execiTime < 0) { - // execiTime = tmp; - // error = true; - // errors += "execi time "; - // } - // } catch (Exception e) { - // error = true; - // errors += "execi time "; - // } - // } - - // if (dialog.getClockRatio().length() != 0) { - // try { - // tmp = clockRatio; - // clockRatio = Integer.decode(dialog.getClockRatio()).intValue(); - // if (clockRatio <= 0) { - // clockRatio = tmp; - // error = true; - // errors += "Clock divider "; - // } - // } catch (Exception e) { - // error = true; - // errors += "Clock divider "; - // } - // } - - // if (error) { - // JOptionPane.showMessageDialog(frame, - // "Invalid value for the following attributes: " + errors, - // "Error", - // JOptionPane.INFORMATION_MESSAGE); - // return false; - // } - - // return true; - // } - - - public int getType() { - return TGComponentManager.TMLARCHI_CAMSNODE; - } - - public boolean acceptSwallowedTGComponent(TGComponent tgc) { - return (tgc instanceof TMLArchiArtifact) && (nbInternalTGComponent == 0); - - } - - public boolean addSwallowedTGComponent(TGComponent tgc, int x, int y) { - if ((tgc instanceof TMLArchiArtifact) && (nbInternalTGComponent == 0)){ - tgc.setFather(this); - tgc.setDrawingZone(true); - tgc.resizeWithFather(); - addInternalComponent(tgc, 0); - return true; - } - - return false; - } - - public void removeSwallowedTGComponent(TGComponent tgc) { - removeInternalComponent(tgc); - } - - - public Vector<TMLArchiArtifact> getArtifactList() { - Vector<TMLArchiArtifact> v = new Vector<TMLArchiArtifact>(); - for(int i=0; i<nbInternalTGComponent; i++) { - if (tgcomponent[i] instanceof TMLArchiArtifact) { - v.add( (TMLArchiArtifact) tgcomponent[i]); - } - } - - return v; - } - - public void hasBeenResized() { - for(int i=0; i<nbInternalTGComponent; i++) { - if (tgcomponent[i] instanceof TMLArchiArtifact) { - tgcomponent[i].resizeWithFather(); - } - } - - } - - protected String translateExtraParam() { - StringBuffer sb = new StringBuffer("<extraparam>\n"); - sb.append("<info stereotype=\"" + stereotype + "\" nodeName=\"" + name); - sb.append("\" />\n"); - sb.append("<attributes byteDataSize=\"" + byteDataSize + "\" "); - sb.append(" execiTime=\"" + execiTime + "\" "); - sb.append(" clockRatio=\"" + clockRatio + "\" "); - sb.append("/>\n"); - sb.append("</extraparam>\n"); - return new String(sb); - } - - @Override - public void loadExtraParam(NodeList nl, int decX, int decY, int decId) throws MalformedModelingException{ - //System.out.println("*** load extra synchro ***"); - try { - - NodeList nli; - Node n1, n2; - Element elt; - // int t1id; - String sstereotype = null, snodeName = null; - - for(int i=0; i<nl.getLength(); i++) { - n1 = nl.item(i); - //System.out.println(n1); - if (n1.getNodeType() == Node.ELEMENT_NODE) { - nli = n1.getChildNodes(); - for(int j=0; j<nli.getLength(); j++) { - n2 = nli.item(j); - //System.out.println(n2); - if (n2.getNodeType() == Node.ELEMENT_NODE) { - elt = (Element) n2; - if (elt.getTagName().equals("info")) { - sstereotype = elt.getAttribute("stereotype"); - snodeName = elt.getAttribute("nodeName"); - } - if (sstereotype != null) { - stereotype = sstereotype; - } - if (snodeName != null){ - name = snodeName; - } - - if (elt.getTagName().equals("attributes")) { - byteDataSize = Integer.decode(elt.getAttribute("byteDataSize")).intValue(); - execiTime = Integer.decode(elt.getAttribute("execiTime")).intValue(); - if ((elt.getAttribute("clockRatio") != null) && (elt.getAttribute("clockRatio").length() > 0)){ - clockRatio = Integer.decode(elt.getAttribute("clockRatio")).intValue(); - } - } - } - } - } - } - - } catch (Exception e) { - throw new MalformedModelingException(); - } - } - - public int getDefaultConnector() { - return TGComponentManager.CONNECTOR_NODE_TMLARCHI; - } - - public int getByteDataSize(){ - return byteDataSize; - } - - public int getExeciTime(){ - return execiTime; - } - - - public String getAttributes() { - String attr = ""; - attr += "Data size (in byte) = " + byteDataSize + "\n"; - attr += "Execi execution time (in cycle) = " + execiTime + "\n"; - attr += "Clock divider = " + clockRatio + "\n"; - return attr; - } - - public int getComponentType() { - return CONTROLLER; - } - -} diff --git a/src/main/java/ui/window/JDialogCAMSBlocks.java b/src/main/java/ui/window/JDialogCAMSBlocks.java deleted file mode 100755 index 9ae2084b9ac86042887dee4ccd06a7dcdc109d0d..0000000000000000000000000000000000000000 --- a/src/main/java/ui/window/JDialogCAMSBlocks.java +++ /dev/null @@ -1,846 +0,0 @@ -/* Copyright or (C) or Copr. GET / ENST, Telecom-Paris, Ludovic Apvrille - * - * ludovic.apvrille AT enst.fr - * - * This software is a computer program whose purpose is to allow the - * edition of TURTLE analysis, design and deployment diagrams, to - * allow the generation of RT-LOTOS or Java code from this diagram, - * and at last to allow the analysis of formal validation traces - * obtained from external tools, e.g. RTL from LAAS-CNRS and CADP - * from INRIA Rhone-Alpes. - * - * This software is governed by the CeCILL license under French law and - * abiding by the rules of distribution of free software. You can use, - * modify and/ or redistribute the software under the terms of the CeCILL - * license as circulated by CEA, CNRS and INRIA at the following URL - * "http://www.cecill.info". - * - * As a counterpart to the access to the source code and rights to copy, - * modify and redistribute granted by the license, users are provided only - * with a limited warranty and the software's author, the holder of the - * economic rights, and the successive licensors have only limited - * liability. - * - * In this respect, the user's attention is drawn to the risks associated - * with loading, using, modifying and/or developing or reproducing the - * software by the user in light of its specific status of free software, - * that may mean that it is complicated to manipulate, and that also - * therefore means that it is reserved for developers and experienced - * professionals having in-depth computer knowledge. Users are therefore - * encouraged to load and test the software's suitability as regards their - * requirements in conditions enabling the security of their systems and/or - * data to be ensured and, more generally, to use and operate it in the - * same conditions as regards security. - * - * The fact that you are presently reading this means that you have had - * knowledge of the CeCILL license and that you accept its terms. - */ - - - - -package ui.window; - -import myutil.Conversion; -import myutil.GraphicLib; -import ui.util.IconManager; -import ui.TGComponent; -import ui.het.CAMSBlock; -import heterogeneoustranslator.systemCAMStranslator.CAMSSignal; -import ui.TAttribute; -import ui.TDiagramPanel; - -import javax.swing.*; -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.util.Vector; -import java.util.LinkedList; - - -/** - * Class JDialogCAMSBlocks - * Dialog for managing nodes to be validated - * Creation: 23/06/2017 - * @version 0.1 23/06/2017 - * @author Côme DEMARIGNY - */ - -public class JDialogCAMSBlocks extends javax.swing.JDialog implements ActionListener, ListSelectionListener { - - private LinkedList<TAttribute> attributes, attributesPar, forbidden; - private LinkedList<Boolean> initValues; - private LinkedList<CAMSSignal> signals, signalsPar; - private boolean checkKeyword, checkJavaKeyword; - - private boolean cancelled = false; - private boolean regularClose; - - protected String [] processCode; - protected JTextArea jtaProcessCode; - protected boolean hasProcessCode; - - private JPanel panel1, panel2; - - private TDiagramPanel tdp; - private Frame frame; - private int tab; - private String defaultName; - private String previousName; - - private String attrib; // "Attributes", "Gates", etc. - - // Panel1 - private JComboBox<String> accessBox, typeBox; - private JTextField identifierText; - private JTextField initialValue; - private JTextField blockName; - private JButton addButton; - - //Panel2 - private JList<TAttribute> listAttribute; - private JTextField nbOfIn, nbOfOut; - private CAMSBlock block; - private JButton upButton; - private JButton downButton; - private JButton removeButton; - - - // Signals - private boolean hasSignals = true; - private JPanel panel5, panel6; - private JComboBox<String> signalInOutBox; - private JTextField signalText; - private JButton addSignalButton; - private JList<CAMSSignal> listSignal; - private JButton upSignalButton; - private JButton downSignalButton; - private JButton removeSignalButton; - - // Main Panel - private JButton closeButton; - private JButton cancelButton; - - /** Creates new form */ - public JDialogCAMSBlocks(LinkedList<TAttribute> _attributes, LinkedList<CAMSSignal> _signals, LinkedList<TAttribute> _forbidden, Frame _frame, String _title, String _attrib, CAMSBlock _block, String []_processCode, boolean _hasProcessCode) { - super(_frame, _title, true); - frame = _frame; - block = _block; - attributesPar = _attributes; - signalsPar = _signals; - processCode = _processCode; - attrib = _attrib; - - if (signalsPar == null) { - signalsPar = new LinkedList<CAMSSignal> (); - hasSignals = false; - } - - hasProcessCode = _hasProcessCode; - if (processCode == null) { - processCode = new String[1]; - processCode[0] = ""; - } - - - forbidden = _forbidden; - initValues = new LinkedList<Boolean> (); - this.attrib = attrib; - - attributes = new LinkedList<TAttribute> (); - signals = new LinkedList<CAMSSignal> (); - - for(TAttribute attr: this.attributesPar) - this.attributes.add (attr.makeClone()); - - // for(CAMSSignal sig: this.signalsPar) - // this.signals.add (sig.makeClone()); - pack(); - initComponents(); - myInitComponents(); - pack(); - } - - - private void myInitComponents() { - removeButton.setEnabled(false); - upButton.setEnabled(false); - downButton.setEnabled(false); - } - - private void initComponents() { - - // Issue #41 Ordering of tabbed panes - JTabbedPane tabbedPane = GraphicLib.createTabbedPane();//new JTabbedPane(); - Container c = getContentPane(); - - JPanel panelAttr = new JPanel(new BorderLayout()); - JPanel panelSignal = new JPanel(new BorderLayout()); - JPanel panelCode; - GridBagLayout gridbag0 = new GridBagLayout(); - GridBagLayout gridbag1 = new GridBagLayout(); - GridBagLayout gridbag2 = new GridBagLayout(); - // GridBagLayout gridbag3 = new GridBagLayout(); - // GridBagLayout gridbag4 = new GridBagLayout(); - GridBagLayout gridbag5 = new GridBagLayout(); - GridBagLayout gridbag6 = new GridBagLayout(); - GridBagLayout gridbag7 = new GridBagLayout(); - GridBagConstraints c0 = new GridBagConstraints(); - GridBagConstraints c1 = new GridBagConstraints(); - GridBagConstraints c2 = new GridBagConstraints(); - // GridBagConstraints c3 = new GridBagConstraints(); - // GridBagConstraints c4 = new GridBagConstraints(); - GridBagConstraints c5 = new GridBagConstraints(); - GridBagConstraints c6 = new GridBagConstraints(); - GridBagConstraints c7 = new GridBagConstraints(); - - setFont(new Font("Helvetica", Font.PLAIN, 14)); - c.setLayout(gridbag0); - - setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); - - panel1 = new JPanel(); - panel1.setLayout(gridbag1); - panel1.setBorder(new javax.swing.border.TitledBorder("Adding " + attrib)); - panel1.setPreferredSize(new Dimension(500, 500)); - panel1.setMinimumSize(new Dimension(500, 500)); - - panel2 = new JPanel(); - panel2.setLayout(gridbag2); - panel2.setBorder(new javax.swing.border.TitledBorder("Managing " + attrib)); - panel2.setPreferredSize(new Dimension(500, 500)); - panel2.setMinimumSize(new Dimension(500, 500)); - - // first line panel1 - c1.gridwidth = 1; - c1.gridheight = 1; - c1.weighty = 1.0; - c1.weightx = 1.0; - c1.gridwidth = GridBagConstraints.REMAINDER; //end row - c1.fill = GridBagConstraints.BOTH; - c1.gridheight = 3; - panel1.add(new JLabel("Block Name: "), c1); - blockName = new JTextField(); - blockName.setColumns(5); - blockName.setEditable(true); - panel1.add(blockName, c1); - - c1.gridwidth = 1; - c1.gridheight = 1; - c1.weighty = 1.0; - c1.weightx = 1.0; - c1.anchor = GridBagConstraints.CENTER; - panel1.add(new JLabel("access"), c1); - panel1.add(new JLabel("identifier"), c1); - if (attrib.equals("Attribute") || attrib.equals("Variable")) { - panel1.add(new JLabel(" "), c1); - panel1.add(new JLabel("initial value"), c1); - } - panel1.add(new JLabel(" "), c1); - c1.gridwidth = GridBagConstraints.REMAINDER; //end row - panel1.add(new JLabel("type"), c1); - - // second line panel1 - c1.gridwidth = 2; - c1.fill = GridBagConstraints.HORIZONTAL; - c1.anchor = GridBagConstraints.CENTER; - accessBox = new JComboBox<String>(); - panel1.add(accessBox, c1); - identifierText = new JTextField(); - identifierText.setColumns(15); - identifierText.setEditable(true); - panel1.add(identifierText, c1); - - initialValue = new JTextField(); - initialValue.setColumns(5); - initialValue.setEditable(true); - - if (attrib.equals("Attribute") || attrib.equals("Variable")) { - panel1.add(new JLabel(" = "), c1); - panel1.add(initialValue, c1); - } - - panel1.add(new JLabel(" : "), c1); - c1.gridwidth = GridBagConstraints.REMAINDER; //end row - typeBox = new JComboBox<String>(); - typeBox.addActionListener(this); - panel1.add(typeBox, c1); - - // third line panel1 - c1.gridwidth = GridBagConstraints.REMAINDER; //end row - c1.fill = GridBagConstraints.BOTH; - c1.gridheight = 3; - panel1.add(new JLabel(" "), c1); - - // fourth line panel1 - c1.gridheight = 1; - c1.fill = GridBagConstraints.HORIZONTAL; - addButton = new JButton("Add / Modify " + attrib); - addButton.addActionListener(this); - panel1.add(addButton, c1); - - // 1st line panel2 - listAttribute = new JList<TAttribute> (this.attributes.toArray (new TAttribute[0])); - listAttribute.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); - listAttribute.addListSelectionListener(this); //fixme - JScrollPane scrollPane = new JScrollPane(listAttribute); - scrollPane.setSize(500, 500); - c2.gridwidth = 2; //end row - c2.fill = GridBagConstraints.BOTH; - c2.gridheight = 5; - c2.weighty = 10.0; - c2.weightx = 10.0; - panel2.add(scrollPane, c2); - - // 2nd line panel2 - c2.weighty = 1.0; - c2.weightx = 1.0; - c2.fill = GridBagConstraints.BOTH; - c2.gridheight = 1; - panel2.add(new JLabel(""), c2); - - // third line panel2 - c2.gridwidth = GridBagConstraints.REMAINDER; //end row - c2.fill = GridBagConstraints.HORIZONTAL; - upButton = new JButton(" Up "); - upButton.addActionListener(this); - panel2.add(upButton, c2); - - downButton = new JButton("Down"); - downButton.addActionListener(this); - panel2.add(downButton, c2); - - removeButton = new JButton("Remove " + attrib); - removeButton.addActionListener(this); - panel2.add(removeButton, c2); - - // Signals - panel5 = new JPanel(); - panel5.setLayout(gridbag5); - panel5.setBorder(new javax.swing.border.TitledBorder("Adding signals")); - panel5.setPreferredSize(new Dimension(500, 500)); - - panel6 = new JPanel(); - panel6.setLayout(gridbag6); - panel6.setBorder(new javax.swing.border.TitledBorder("Managing signals")); - panel6.setPreferredSize(new Dimension(500, 500)); - - // first line panel5 - c5.gridwidth = 1; - c5.gridheight = 1; - c5.weighty = 1.0; - c5.weightx = 1.0; - c5.gridwidth = GridBagConstraints.REMAINDER; //end row - c5.fill = GridBagConstraints.BOTH; - c5.gridheight = 3; - panel5.add(new JLabel(" "), c5); - - c5.gridwidth = 1; - c5.gridheight = 1; - c5.weighty = 1.0; - c5.weightx = 1.0; - c5.anchor = GridBagConstraints.CENTER; - c5.gridwidth = GridBagConstraints.REMAINDER; //end row - panel5.add(new JLabel("signal:"), c5); - - // second line panel5 - c5.gridwidth = 1; - c5.fill = GridBagConstraints.HORIZONTAL; - String[] v = new String[4]; - v[0] = "in"; - v[1] = "out"; - v[2] = "hybrid in"; - v[3] = "hybrid out"; - signalInOutBox = new JComboBox<String>(v); - panel5.add(signalInOutBox, c5); - signalText = new JTextField(); - signalText.setColumns(50); - signalText.setEditable(true); - panel5.add(signalText, c5); - - // third line panel5 - c5.gridwidth = GridBagConstraints.REMAINDER; //end row - c5.fill = GridBagConstraints.BOTH; - c5.gridheight = 3; - panel5.add(new JLabel(" "), c5); - - // fourth line panel5 - c5.gridheight = 1; - c5.fill = GridBagConstraints.HORIZONTAL; - addSignalButton = new JButton("Add signal"); - addSignalButton.addActionListener(this); - panel5.add(addSignalButton, c5); - - // 1st line panel6 - listSignal = new JList<CAMSSignal> (this.signals.toArray (new CAMSSignal[0])); - listSignal.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); - listSignal.addListSelectionListener(this); - scrollPane = new JScrollPane(listSignal); - scrollPane.setSize(500, 500); - c6.gridwidth = GridBagConstraints.REMAINDER; //end row - c6.fill = GridBagConstraints.BOTH; - c6.gridheight = 5; - c6.weighty = 10.0; - c6.weightx = 10.0; - panel6.add(scrollPane, c6); - - // 2nd line panel4 - c6.weighty = 1.0; - c6.weightx = 1.0; - c6.fill = GridBagConstraints.BOTH; - c6.gridheight = 1; - panel6.add(new JLabel(""), c6); - - // third line panel4 - c6.gridwidth = GridBagConstraints.REMAINDER; //end row - c6.fill = GridBagConstraints.HORIZONTAL; - upSignalButton = new JButton("Up"); - upSignalButton.addActionListener(this); - panel6.add(upSignalButton, c6); - - downSignalButton = new JButton("Down"); - downSignalButton.addActionListener(this); - panel6.add(downSignalButton, c6); - - removeSignalButton = new JButton("Remove signal"); - removeSignalButton.addActionListener(this); - panel6.add(removeSignalButton, c6); - - // Prototyping - panelCode = new JPanel(); - panelCode.setLayout(gridbag7); - - panelCode.setBorder(new javax.swing.border.TitledBorder("Process code")); - // guard - c7.weighty = 1.0; - c7.weightx = 1.0; - c7.gridwidth = 1; - c7.gridheight = 1; - c7.fill = GridBagConstraints.BOTH; - c7.gridwidth = GridBagConstraints.REMAINDER; - c7.gridheight = 1; - - - panelCode.add(new JLabel("Process code of block:"), c7); - //panelCode.add(new JLabel("To implement a method m of block B: \"userImplemented_B_m(...){...}\""), c7); - jtaProcessCode = new JTextArea(); - jtaProcessCode.setEditable(true); - jtaProcessCode.setMargin(new Insets(10, 10, 10, 10)); - jtaProcessCode.setTabSize(3); - String files = ""; - if (processCode != null) { - for(int i=0; i<processCode.length; i++) { - files += processCode[i] + "\n"; - } - } - jtaProcessCode.append(files); - jtaProcessCode.setFont(new Font("times", Font.PLAIN, 12)); - JScrollPane jsp = new JScrollPane(jtaProcessCode, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS, JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS); - jsp.setPreferredSize(new Dimension(500, 500)); - panelCode.add(jsp, c7); - - - // main panel; - panelAttr.add(panel1, BorderLayout.WEST); - panelAttr.add(panel2, BorderLayout.EAST); - tabbedPane.addTab("Attributes", panelAttr); - - if (hasSignals) { - panelSignal.add(panel5, BorderLayout.WEST); - panelSignal.add(panel6, BorderLayout.EAST); - tabbedPane.addTab("Signals", panelSignal); - } - - if (hasProcessCode) { - tabbedPane.addTab("Process", panelCode); - } - - tabbedPane.setSelectedIndex(tab); - - //c.add(panel1, c0); - //c.add(panel2, c0); - - c0.gridwidth = 1; - c0.gridheight = 10; - c0.weighty = 1.0; - c0.weightx = 1.0; - c0.gridwidth = GridBagConstraints.REMAINDER; //end row - c0.fill = GridBagConstraints.HORIZONTAL; - c.add(tabbedPane, c0); - - c0.gridwidth = 1; - c0.gridheight = 1; - c0.fill = GridBagConstraints.HORIZONTAL; - closeButton = new JButton("Save and Close", IconManager.imgic25); - //closeButton.setPreferredSize(new Dimension(600, 50)); - closeButton.addActionListener(this); - c.add(closeButton, c0); - c0.gridwidth = GridBagConstraints.REMAINDER; //end row - cancelButton = new JButton("Cancel", IconManager.imgic27); - cancelButton.addActionListener(this); - c.add(cancelButton, c0); - } - - public void actionPerformed(ActionEvent evt) { - if (evt.getSource() == typeBox) { - boolean b = initValues.get (typeBox.getSelectedIndex()).booleanValue(); - initialValue.setEnabled(b); - return; - } - - - //String command = evt.getActionCommand(); - - // Compare the action command to the known actions. - if (evt.getSource() == closeButton) { - closeDialog(); - } else if (evt.getSource() == addButton) { - addAttribute(); - } else if (evt.getSource() == cancelButton) { - cancelDialog(); - } else if (evt.getSource() == removeButton) { - removeAttribute(); - } else if (evt.getSource() == downButton) { - downAttribute(); - } else if (evt.getSource() == upButton) { - upAttribute(); - } else if (evt.getSource() == downSignalButton) { - downSignal(); - } else if (evt.getSource() == upSignalButton) { - upSignal(); - } else if (evt.getSource() == removeSignalButton) { - removeSignal(); - } else if (evt.getSource() == addSignalButton) { - addSignal(); - } - } - - public void addAccess(String s) { - accessBox.addItem(s); - } - - public void addType(String s) { - initValues.add(new Boolean(true)); - typeBox.addItem(s); - } - - public void addType(String s, boolean b) { - initValues.add(new Boolean(b)); - typeBox.addItem(s); - } - - public void enableInitialValue(boolean b) { - initialValue.setEnabled(b); - } - - public void enableRTLOTOSKeyword(boolean b) { - checkKeyword = !b; - } - - public void enableJavaKeyword(boolean b) { - checkJavaKeyword = !b; - } - - - - public void addAttribute() { - Object o1 = accessBox.getSelectedItem(); - Object o2 = typeBox.getSelectedItem(); - String s = identifierText.getText(); - String value = initialValue.getText(); - TAttribute a; - - if (s.length()>0) { - if ((TAttribute.isAValidId(s, checkKeyword, checkJavaKeyword)) && (TAttribute.notIn(s, forbidden))){ - int i = TAttribute.getAccess(o1.toString()); - int j = TAttribute.getCAMSType(o2.toString()); - if ((j == TAttribute.ARRAY_NAT) && (value.length() < 1)) { - value = "2"; - } - - if ((i != -1) && (j!= -1)) { - - if ((value.length() < 1) || (initialValue.isEnabled() == false)){ - - value = ""; - } else { - if (!TAttribute.isAValidInitialValue(j, value)) { - JOptionPane.showMessageDialog(frame, - "The initial value is not valid", - "Error", - JOptionPane.INFORMATION_MESSAGE); - return; - } - } - if (j == TAttribute.OTHER) { - a = new TAttribute(i, s, value, o2.toString()); - a.isCAMS = true; - //System.out.println("New attribute: " + o2.toString()); - } else { - a = new TAttribute(i, s, value, j); - a.isCAMS = true; - } - //checks whether the same attribute already belongs to the list - int index = attributes.size(); - if (attributes.contains(a)) { - index = attributes.indexOf(a); - a = attributes.get (index); - a.setAccess(i); - if (j == TAttribute.OTHER) { - a.setTypeOther(o2.toString()); - } - a.setType(j); - a.setInitialValue(value); - } else { - attributes.add(index, a); - } - listAttribute.setListData(attributes.toArray (new TAttribute[0])); - identifierText.setText(""); - } else { - JOptionPane.showMessageDialog(frame, - "Bad access / type", - "Error", - JOptionPane.INFORMATION_MESSAGE); - return; - } - } else { - JOptionPane.showMessageDialog(frame, - "Bad identifier: identifier already in use, or invalid identifier", - "Error", - JOptionPane.INFORMATION_MESSAGE); - return; - } - } else { - JOptionPane.showMessageDialog(frame, - "Bad identifier", - "Error", - JOptionPane.INFORMATION_MESSAGE); - return; - } - } - - - public void addSignal() { - String s = signalText.getText(); - CAMSSignal cs = CAMSSignal.isAValidSignal(s, signalInOutBox.getSelectedIndex()); - CAMSSignal cstmp; - int inout; - - if (cs != null) { - // Checks whether the same signal already belongs to the list - int index = -1; - for(int i=0; i<signals.size(); i++) { - cstmp = signals.get(i); - // Same id? - if (cstmp.equals(cs)) { - index = i; - break; - } - } - if(signalInOutBox.getSelectedIndex()==0){ - inout=0; - }else if(signalInOutBox.getSelectedIndex()==1){ - inout=1; - }else if(signalInOutBox.getSelectedIndex()==2){ - inout=2; - }else if(signalInOutBox.getSelectedIndex()==3){ - inout=3; - }else{ - inout=-1; - } - cs = new CAMSSignal(s,inout); - if (index == -1) { - signals.add(cs); - } else { - signals.remove (index); - signals.add (index, cs); - } - listSignal.setListData(signals.toArray (new CAMSSignal[0])); - signalText.setText(""); - - } else { - JOptionPane.showMessageDialog(frame, - "Badly formatted signal declaration", - "Error", - JOptionPane.INFORMATION_MESSAGE); - return; - } - } - - public void removeAttribute() { - int i = listAttribute.getSelectedIndex() ; - if (i!= -1) { - TAttribute a = attributes.get (i); - a.setAccess(-1); - attributes.remove (i); - listAttribute.setListData(attributes.toArray (new TAttribute[0])); - } - } - - public void downAttribute() { - int i = listAttribute.getSelectedIndex(); - if ((i!= -1) && (i != attributes.size() - 1)) { - TAttribute o = attributes.get (i); - attributes.remove (i); - attributes.add (i+1, o); - listAttribute.setListData(attributes.toArray (new TAttribute[0])); - listAttribute.setSelectedIndex(i+1); - } - } - - public void upAttribute() { - int i = listAttribute.getSelectedIndex(); - if (i > 0) { - TAttribute o = attributes.get (i); - attributes.remove (i); - attributes.add (i-1, o); - listAttribute.setListData(attributes.toArray (new TAttribute[0])); - listAttribute.setSelectedIndex(i-1); - } - } - - public void removeSignal() { - int i = listSignal.getSelectedIndex() ; - if (i!= -1) { - signals.remove (i); - listSignal.setListData(signals.toArray (new CAMSSignal [0])); - } - } - - public void upSignal() { - int i = listSignal.getSelectedIndex(); - if (i > 0) { - CAMSSignal o = signals.get (i); - signals.remove (i); - signals.add (i-1, o); - listSignal.setListData(signals.toArray (new CAMSSignal [0])); - listSignal.setSelectedIndex(i-1); - } - } - - public void downSignal() { - int i = listSignal.getSelectedIndex(); - if ((i!= -1) && (i != signals.size() - 1)) { - CAMSSignal o = signals.get (i); - signals.remove(i); - signals.add (i+1, o); - listSignal.setListData(signals.toArray (new CAMSSignal [0])); - listSignal.setSelectedIndex(i+1); - } - } - - - public void closeDialog() { - cancelled = false; - attributesPar.clear (); - for(TAttribute attr: this.attributes) - attributesPar.add (attr); - - signalsPar.clear (); - for(CAMSSignal sig: this.signals) - signalsPar.add (sig); - - processCode = Conversion.wrapText(jtaProcessCode.getText()); - dispose(); - } - - public boolean hasBeenCancelled() { - return cancelled; - } - - public boolean isRegularClose() { - return regularClose; - } - - public void cancelDialog() { - cancelled = true; - dispose(); - } - - public void valueChanged(ListSelectionEvent e) { - int i = listAttribute.getSelectedIndex() ; - if (i == -1) { - removeButton.setEnabled(false); - upButton.setEnabled(false); - downButton.setEnabled(false); - identifierText.setText(""); - //initialValue.setText(""); - } else { - TAttribute a = attributes.get (i); - identifierText.setText(a.getId()); - initialValue.setText(a.getInitialValue()); - select(accessBox, TAttribute.getStringAccess(a.getAccess())); - if (a.getType() == TAttribute.OTHER) { - select(typeBox, a.getTypeOther()); - } else { - //select(typeBox, TAttribute.getStringCAMSType(a.getType())); //fixme - } - removeButton.setEnabled(true); - if (i > 0) { - upButton.setEnabled(true); - } else { - upButton.setEnabled(false); - } - if (i != attributes.size() - 1) { - downButton.setEnabled(true); - } else { - downButton.setEnabled(false); - } - } - - i = listSignal.getSelectedIndex() ; - if (i == -1) { - removeSignalButton.setEnabled(false); - upSignalButton.setEnabled(false); - downSignalButton.setEnabled(false); - signalText.setText(""); - //initialValue.setText(""); - } else { - CAMSSignal as = signals.get (i); - //signalText.setText(as.toBasicString()); //fixme - // signalInOutBox.setSelectedIndex(as.getInOut()); - removeSignalButton.setEnabled(true); - if (i > 0) { - upSignalButton.setEnabled(true); - } else { - upSignalButton.setEnabled(false); - } - if (i != signals.size() - 1) { - downSignalButton.setEnabled(true); - } else { - downSignalButton.setEnabled(false); - } - } - } - - public void select(JComboBox<String> jcb, String text) { - String s; - for(int i=0; i<jcb.getItemCount(); i++) { - s = jcb.getItemAt(i); - if (s.equals(text)) { - jcb.setSelectedIndex(i); - return; - } - } - } - - - public String getBlockName() { - if(blockName.getText() == null || blockName.getText() == "" || blockName.getText() == " ") { - return "Block0"; - } else { - return blockName.getText(); - } - } - - public LinkedList<CAMSSignal> getSignals(){ - return signals; - } - - public String[] getProcessCode() { - return processCode; - } - -} diff --git a/src/main/java/ui/window/JDialogCAMSConnectingPoint.java b/src/main/java/ui/window/JDialogCAMSConnectingPoint.java deleted file mode 100755 index cb85316df4063c7d07b5a9df519087f3bc304585..0000000000000000000000000000000000000000 --- a/src/main/java/ui/window/JDialogCAMSConnectingPoint.java +++ /dev/null @@ -1,211 +0,0 @@ -/* Copyright or (C) or Copr. GET / ENST, Telecom-Paris, Ludovic Apvrille - * - * ludovic.apvrille AT enst.fr - * - * This software is a computer program whose purpose is to allow the - * edition of TURTLE analysis, design and deployment diagrams, to - * allow the generation of RT-LOTOS or Java code from this diagram, - * and at last to allow the analysis of formal validation traces - * obtained from external tools, e.g. RTL from LAAS-CNRS and CADP - * from INRIA Rhone-Alpes. - * - * This software is governed by the CeCILL license under French law and - * abiding by the rules of distribution of free software. You can use, - * modify and/ or redistribute the software under the terms of the CeCILL - * license as circulated by CEA, CNRS and INRIA at the following URL - * "http://www.cecill.info". - * - * As a counterpart to the access to the source code and rights to copy, - * modify and redistribute granted by the license, users are provided only - * with a limited warranty and the software's author, the holder of the - * economic rights, and the successive licensors have only limited - * liability. - * - * In this respect, the user's attention is drawn to the risks associated - * with loading, using, modifying and/or developing or reproducing the - * software by the user in light of its specific status of free software, - * that may mean that it is complicated to manipulate, and that also - * therefore means that it is reserved for developers and experienced - * professionals having in-depth computer knowledge. Users are therefore - * encouraged to load and test the software's suitability as regards their - * requirements in conditions enabling the security of their systems and/or - * data to be ensured and, more generally, to use and operate it in the - * same conditions as regards security. - * - * The fact that you are presently reading this means that you have had - * knowledge of the CeCILL license and that you accept its terms. - */ - - - - -package ui.window; - -import ui.util.IconManager; -import ui.het.*; - -import javax.swing.*; -import java.awt.*; -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; - -//import javax.swing.event.*; -//import java.util.*; - - -/** -* Class JDialogADDCPUNode -* Dialog for managing attributes of cpu nodes in ADD -* Creation: 02/07/2014 -* @version 1.0 02/07/2014 -* @author Ludovic APVRILLE - */ -public class JDialogCAMSConnectingPoint extends javax.swing.JDialog implements ActionListener { - - private boolean regularClose; - - private JPanel panel2; - private Frame frame; - public CAMSConnectingPoint ccp; - - protected JComboBox<String> tracemode; - private static int selectedTracemode = 0; - - - // Panel1 - protected JTextField ccpName; - - // Panel2 - protected JTextField type, rate; - - // Main Panel - private JButton closeButton; - private JButton cancelButton; - - /** Creates new form */ - public JDialogCAMSConnectingPoint(Frame _frame, String _title, CAMSConnectingPoint _ccp) { - super(_frame, _title, true); - frame = _frame; - ccp = _ccp; - - initComponents(); - myInitComponents(); - pack(); - } - - private void myInitComponents() { - } - - private void initComponents() { - Container c = getContentPane(); - GridBagLayout gridbag0 = new GridBagLayout(); - GridBagLayout gridbag1 = new GridBagLayout(); - GridBagLayout gridbag2 = new GridBagLayout(); - GridBagConstraints c0 = new GridBagConstraints(); - //GridBagConstraints c1 = new GridBagConstraints(); - GridBagConstraints c2 = new GridBagConstraints(); - - setFont(new Font("Helvetica", Font.PLAIN, 14)); - c.setLayout(gridbag0); - - setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); - - - panel2 = new JPanel(); - panel2.setLayout(gridbag2); - panel2.setBorder(new javax.swing.border.TitledBorder("Connecting Point attributes")); - panel2.setPreferredSize(new Dimension(400, 300)); - - c2.gridwidth = 1; - c2.gridheight = 1; - c2.weighty = 1.0; - c2.weightx = 1.0; - c2.fill = GridBagConstraints.HORIZONTAL; - panel2.add(new JLabel("Connecting Point name:"), c2); - c2.gridwidth = GridBagConstraints.REMAINDER; //end row - ccpName = new JTextField(ccp.getccpName(), 30); - ccpName.setEditable(true); - ccpName.setFont(new Font("times", Font.PLAIN, 12)); - panel2.add(ccpName, c2); - - c2.gridwidth = 1; - c2.gridheight = 1; - c2.weighty = 1.0; - c2.weightx = 1.0; - c2.fill = GridBagConstraints.HORIZONTAL; - - - c2.gridwidth = 1; - panel2.add(new JLabel("Type :"), c2); - c2.gridwidth = GridBagConstraints.REMAINDER; //end row - type = new JTextField(""+ccp.getPointType(), 15); - panel2.add(type, c2); - - c2.gridwidth = 1; - panel2.add(new JLabel("Rate:"), c2); - c2.gridwidth = GridBagConstraints.REMAINDER; //end row - rate = new JTextField(""+ccp.getRate(), 15); - panel2.add(rate, c2); - - // main panel; - c0.gridheight = 10; - c0.weighty = 1.0; - c0.weightx = 1.0; - c0.gridwidth = GridBagConstraints.REMAINDER; //end row - c.add(panel2, c0); - - c0.gridwidth = 1; - c0.gridheight = 1; - c0.fill = GridBagConstraints.HORIZONTAL; - closeButton = new JButton("Save and Close", IconManager.imgic25); - //closeButton.setPreferredSize(new Dimension(600, 50)); - closeButton.addActionListener(this); - c.add(closeButton, c0); - c0.gridwidth = GridBagConstraints.REMAINDER; //end row - cancelButton = new JButton("Cancel", IconManager.imgic27); - cancelButton.addActionListener(this); - c.add(cancelButton, c0); - } - - public void actionPerformed(ActionEvent evt) { - - if (evt.getSource() == tracemode) { - selectedTracemode = tracemode.getSelectedIndex(); - } - - String command = evt.getActionCommand(); - - // Compare the action command to the known actions. - if (command.equals("Save and Close")) { - closeDialog(); - } else if (command.equals("Cancel")) { - cancelDialog(); - } - } - - public void closeDialog() { - regularClose = true; - dispose(); - } - - public void cancelDialog() { - dispose(); - } - - public boolean isRegularClose() { - return regularClose; - } - - public String getccpName() { - return ccpName.getText(); - } - - public String getPointType() { - return type.getText(); - } - - public String getRate() { - return rate.getText(); - } - -}//class \ No newline at end of file diff --git a/src/main/java/ui/window/JDialogSelectSystemCAMSBlock.java b/src/main/java/ui/window/JDialogSelectSystemCAMSBlock.java index 824770268fadcfb9d5eccaa3dd8a26e97e8d3b14..dc13279e3a4fcd0b9ecafd99746abfdf254a60be 100755 --- a/src/main/java/ui/window/JDialogSelectSystemCAMSBlock.java +++ b/src/main/java/ui/window/JDialogSelectSystemCAMSBlock.java @@ -45,7 +45,7 @@ package ui.window; import myutil.TraceManager; import ui.util.IconManager; import ui.TGComponent; -import ui.het.*; +//import ui.het.*; import javax.swing.*; import javax.swing.event.ListSelectionEvent; @@ -122,16 +122,16 @@ public class JDialogSelectSystemCAMSBlock extends javax.swing.JDialog implements for( int i = 0; i < list.size(); i++ ) { tgc = list.get(i); // System.out.println(tgc); - if (tgc instanceof CAMSBlock) { - v.addElement( tgc ); - } + //if (tgc instanceof CAMSBlock) { + // v.addElement( tgc ); + //} } return v; } private void checkBlock( Vector<TGComponent> tobeChecked, List<TGComponent> source ) { - CAMSBlock block; + /*CAMSBlock block; for(int i = 0; i < tobeChecked.size(); i++ ) { if( tobeChecked.elementAt(i) instanceof CAMSBlock ){ @@ -141,12 +141,12 @@ public class JDialogSelectSystemCAMSBlock extends javax.swing.JDialog implements i--; } } - } + }*/ } public void addNewBlock( Vector<TGComponent> added, List<TGComponent> source, Vector<TGComponent> notSource ) { - TGComponent tgc; + /*TGComponent tgc; for( int i = 0; i < source.size(); i++ ) { tgc = source.get(i); @@ -154,7 +154,7 @@ public class JDialogSelectSystemCAMSBlock extends javax.swing.JDialog implements added.addElement( tgc ); System.out.println("New element"); } - } + }*/ } private void myInitComponents() {