diff --git a/src/main/java/tmltranslator/TMLMapping.java b/src/main/java/tmltranslator/TMLMapping.java index e96fca700da4014c440e7d8fe4a90014c38b17f7..d854be403df607cc744bfb9b7405973b9b095182 100755 --- a/src/main/java/tmltranslator/TMLMapping.java +++ b/src/main/java/tmltranslator/TMLMapping.java @@ -70,7 +70,7 @@ public class TMLMapping<E> { // Mapping of communications private List<HwCommunicationNode> oncommnodes; private List<TMLElement> mappedcommelts; - + public CorrespondanceElement<E> listE; // Security @@ -83,18 +83,18 @@ public class TMLMapping<E> { // For plugins private ArrayList<String> customValues; - + private boolean optimized = false; private int hashCode; private boolean hashCodeComputed = false; - + // REFERENCES TO BE REMOVED!!!! private TMLComponentDesignPanel tmldp; public TMLArchiPanel tmlap; - + public TMLMapping(TMLModeling<E> _tmlm, TMLArchitecture _tmla, boolean reset) { tmlm = _tmlm; @@ -150,9 +150,9 @@ public class TMLMapping<E> { } public void addCustomValue(String custom) { - customValues.add(custom); + customValues.add(custom); } - + public void makeMinimumMapping() { HwCPU cpu; // HwMemory mem; @@ -308,7 +308,7 @@ public class TMLMapping<E> { // mappedCPs = new ArrayList<TMLCP>(); // commEltsMappedOnCPs = new ArrayList<TMLElement>(); mappedCPLibs = new ArrayList<TMLCPLib>(); - customValues = new ArrayList<String>(); + customValues = new ArrayList<String>(); } public TMLTask getTMLTaskByCommandID(int id) { @@ -1502,24 +1502,27 @@ public class TMLMapping<E> { public String toXML() { - String s = "<TMLMAPPING>\n"; - s += tmlm.toXML(); - s += tmla.toXML(); - for(int i=0; i<onnodes.size(); i++) { - HwExecutionNode node = onnodes.get(i); - TMLTask task = mappedtasks.get(i); - s += "<TASKMAP node=\"" + node.getName() + "\" task=\"" + task.getName() + "\" />\n"; - } - for(int i=0; i<oncommnodes.size(); i++) { - HwCommunicationNode node = oncommnodes.get(i); - TMLElement elt = mappedcommelts.get(i); - s += "<COMMMAP node=\"" + node.getName() + "\" elt=\"" + elt.getName() + "\" />\n"; - } - for(TMLCPLib cplib: mappedCPLibs) { - s += cplib.toXML(); - } - s += "</TMLMAPPING>\n"; - //s = myutil.Conversion.transformToXMLString(s); - return s; + String s = "<TMLMAPPING>\n"; + s += tmlm.toXML(); + s += tmla.toXML(); + for(int i=0; i<onnodes.size(); i++) { + HwExecutionNode node = onnodes.get(i); + TMLTask task = mappedtasks.get(i); + s += "<TASKMAP node=\"" + node.getName() + "\" task=\"" + task.getName() + "\" />\n"; + } + for(int i=0; i<oncommnodes.size(); i++) { + HwCommunicationNode node = oncommnodes.get(i); + TMLElement elt = mappedcommelts.get(i); + s += "<COMMMAP node=\"" + node.getName() + "\" elt=\"" + elt.getName() + "\" />\n"; + } + for(TMLCPLib cplib: mappedCPLibs) { + s += cplib.toXML(); + } + for(String val: customValues) { + s += "<CUSTOMVALUE value=\"" + val + "\" />\n"; + } + s += "</TMLMAPPING>\n"; + //s = myutil.Conversion.transformToXMLString(s); + return s; } } diff --git a/src/main/java/ui/GTMLModeling.java b/src/main/java/ui/GTMLModeling.java index d17d31ef682e07827e71a142ebd86312e45e0b32..2fe8294258692cf8b87c6522fc97b5dc7704b25f 100755 --- a/src/main/java/ui/GTMLModeling.java +++ b/src/main/java/ui/GTMLModeling.java @@ -3460,12 +3460,14 @@ public class GTMLModeling { while(iterator.hasNext()) { tgc = iterator.next(); + //TraceManager.addDev(" is custom component?" + tgc + " class=" + tgc.getClass()); // Custom values (for plugin) if (tgc instanceof TGComponentPlugin) { + //TraceManager.addDev("custom component found:" + tgc); String val = ((TGComponentPlugin)(tgc)).getCustomValue(); if (val != null) { - TraceManager.addDev("Adding custom value:" + val); + //TraceManager.addDev("Adding custom value:" + val); map.addCustomValue(val); } } diff --git a/src/main/java/ui/TMLArchiPanel.java b/src/main/java/ui/TMLArchiPanel.java index 5f125c107b53dc42e123bc1cf04e0ae7d38599f0..2883f09900a61f32b46b15dd52491e1da18c8b34 100755 --- a/src/main/java/ui/TMLArchiPanel.java +++ b/src/main/java/ui/TMLArchiPanel.java @@ -1,26 +1,26 @@ /* 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, @@ -31,14 +31,14 @@ * 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; import myutil.GraphicLib; @@ -61,48 +61,47 @@ import java.util.Vector; * @see MainGUI */ public class TMLArchiPanel extends TURTLEPanel { - public TMLArchiDiagramPanel tmlap; + public TMLArchiDiagramPanel tmlap; public Vector<TGComponent> validated, ignored; - + public TMLArchiPanel(MainGUI _mgui) { super(_mgui); - - // Issue #41 Ordering of tabbed panes + + // Issue #41 Ordering of tabbed panes tabbedPane = GraphicLib.createTabbedPane();//new JTabbedPane(); - + cl = new ChangeListener() { - - @Override - public void stateChanged(ChangeEvent e){ - mgui.paneDesignAction(e); - } - }; - + @Override + public void stateChanged(ChangeEvent e){ + mgui.paneDesignAction(e); + } + }; + tabbedPane.addChangeListener(cl); tabbedPane.addMouseListener(new TURTLEPanelPopupListener(this, mgui)); } - + @Override public void init() { - + // Class Diagram toolbar TMLArchiDiagramToolBar toolBarTML = new TMLArchiDiagramToolBar(mgui); toolbars.add(toolBarTML); - + toolBarPanel = new JPanel(); toolBarPanel.setLayout(new BorderLayout()); - - //Class diagram + + //Class diagram tmlap = new TMLArchiDiagramPanel(mgui, toolBarTML); tmlap.setName("DIPLODOCUS architecture and mapping Diagram"); toolBarTML.setPanel(tmlap); - // Diagram toolbar - + // Diagram toolbar + tmlap.tp = this; tdp = tmlap; panels.add(tmlap); // Always first in list - JScrollDiagramPanel jsp = new JScrollDiagramPanel(tmlap); + JScrollDiagramPanel jsp = new JScrollDiagramPanel(tmlap); tmlap.jsp = jsp; jsp.setWheelScrollingEnabled(true); jsp.getVerticalScrollBar().setUnitIncrement( MainGUI.INCREMENT ); @@ -111,29 +110,29 @@ public class TMLArchiPanel extends TURTLEPanel { tabbedPane.addTab("DIPLODOCUS architecture and mapping Diagram", IconManager.imgic60, toolBarPanel, "Opens DIPLODOCUS architecture diagram"); tabbedPane.setSelectedIndex(0); mgui.changeMade(tmlap, TDiagramPanel.NEW_COMPONENT); - + //jsp.setVisible(true); - + } - + public String saveHeaderInXml(String extensionToName) { - if (extensionToName == null) { - return "<Modeling type=\"TML Architecture\" nameTab=\"" + mgui.getTabName(this) + "\" >\n"; - } - return "<Modeling type=\"TML Architecture\" nameTab=\"" + mgui.getTabName(this) + extensionToName +"\" >\n"; + if (extensionToName == null) { + return "<Modeling type=\"TML Architecture\" nameTab=\"" + mgui.getTabName(this) + "\" >\n"; + } + return "<Modeling type=\"TML Architecture\" nameTab=\"" + mgui.getTabName(this) + extensionToName +"\" >\n"; } - + public String saveTailInXml() { return "</Modeling>\n\n\n"; } - + public String toString() { return mgui.getTitleAt(this) + " (DIPLODOCUS Mapping View)"; } - + public void renameMapping(String oldName, String newName) { - if (tmlap != null) { - tmlap.renameMapping(oldName, newName); - } + if (tmlap != null) { + tmlap.renameMapping(oldName, newName); + } } } diff --git a/src/main/java/ui/tmldd/TMLArchiDiagramPanel.java b/src/main/java/ui/tmldd/TMLArchiDiagramPanel.java index 42eaa0b11ab87087a9e24d9ba1bb676760311e73..b038b5d36c17bf57bde14f7b3a70ded6582f0daa 100755 --- a/src/main/java/ui/tmldd/TMLArchiDiagramPanel.java +++ b/src/main/java/ui/tmldd/TMLArchiDiagramPanel.java @@ -217,8 +217,8 @@ public class TMLArchiDiagramPanel extends TDiagramPanel implements TDPWithAttrib return true; }*/ - public List<TMLArchiNode> getListOfNodes() { - List<TMLArchiNode> ll = new LinkedList<TMLArchiNode>(); + public List<TGComponent> getListOfNodes() { + List<TGComponent> ll = new LinkedList<TGComponent>(); TGComponent tgc; Iterator<TGComponent> iterator = componentList.listIterator(); @@ -236,6 +236,10 @@ public class TMLArchiDiagramPanel extends TDiagramPanel implements TDPWithAttrib if (tgc instanceof TMLArchiCommunicationNode) { ll.add( (TMLArchiCommunicationNode) tgc ); } + + if (tgc instanceof TGComponentPlugin) { + ll.add(tgc); + } } return ll; @@ -258,8 +262,8 @@ public class TMLArchiDiagramPanel extends TDiagramPanel implements TDPWithAttrib } public boolean isMapped(String _ref, String _name) { - Iterator<TMLArchiNode> iterator = getListOfNodes().listIterator(); - TMLArchiNode node; + Iterator<TGComponent> iterator = getListOfNodes().listIterator(); + TGComponent node; Vector<TMLArchiArtifact> v; TMLArchiArtifact artifact; int i; @@ -285,8 +289,8 @@ public class TMLArchiDiagramPanel extends TDiagramPanel implements TDPWithAttrib } public void renameMapping(String oldName, String newName) { - Iterator<TMLArchiNode> iterator = getListOfNodes().listIterator(); - TMLArchiNode node; + Iterator<TGComponent> iterator = getListOfNodes().listIterator(); + TGComponent node; Vector<TMLArchiArtifact> v; TMLArchiArtifact artifact; List<TMLArchiCommunicationArtifact> ChannelList; @@ -334,8 +338,8 @@ public class TMLArchiDiagramPanel extends TDiagramPanel implements TDPWithAttrib } public void setPriority( String _name, int _priority ) { - Iterator<TMLArchiNode> iterator = getListOfNodes().iterator(); - TMLArchiNode node; + Iterator<TGComponent> iterator = getListOfNodes().iterator(); + TGComponent node; //Vector v; // TMLArchiArtifact artifact; List<TMLArchiCommunicationArtifact> ChannelList; @@ -367,8 +371,8 @@ public class TMLArchiDiagramPanel extends TDiagramPanel implements TDPWithAttrib public int getMaxPriority( String _name ) { - Iterator<TMLArchiNode> iterator = getListOfNodes().iterator(); - TMLArchiNode node; + Iterator<TGComponent> iterator = getListOfNodes().iterator(); + TGComponent node; // Vector v; //TMLArchiArtifact artifact; List<TMLArchiCommunicationArtifact> ChannelList; diff --git a/src/main/java/ui/window/JDialogSelectTMLNodes.java b/src/main/java/ui/window/JDialogSelectTMLNodes.java index c062527b12d8e0c134d4516fe19e6a1364d82f14..9f138ee89c77c1996afa449448d1b508257233ce 100755 --- a/src/main/java/ui/window/JDialogSelectTMLNodes.java +++ b/src/main/java/ui/window/JDialogSelectTMLNodes.java @@ -41,8 +41,8 @@ package ui.window; +import ui.*; import ui.util.IconManager; -import ui.TGComponent; import ui.tmldd.TMLArchiNode; import javax.swing.*; @@ -118,6 +118,9 @@ public class JDialogSelectTMLNodes extends javax.swing.JDialog implements Action if (tgc instanceof TMLArchiNode) { v.addElement(tgc); } + if (tgc instanceof TGComponentPlugin) { + v.addElement(tgc); + } } return v; @@ -142,7 +145,7 @@ public class JDialogSelectTMLNodes extends javax.swing.JDialog implements Action for(int i=0; i<source.size(); i++) { tgc = source.get(i); - if ((tgc instanceof TMLArchiNode) && (!added.contains(tgc)) && (!notSource.contains(tgc))){ + if (((tgc instanceof TMLArchiNode) || (tgc instanceof TGComponentPlugin)) && (!added.contains(tgc)) && (!notSource.contains(tgc))){ added.addElement(tgc); //System.out.println("New element"); }