Skip to content
Snippets Groups Projects
Commit 4ce36798 authored by Ludovic Apvrille's avatar Ludovic Apvrille
Browse files

Update on TMLCPLib management

parent 2d87841d
No related branches found
No related tags found
No related merge requests found
/**Copyright or (C) or Copr. GET / ENST, Telecom-Paris, Ludovic Apvrille, Andrea Enrici
ludovic.apvrille AT telecom-paristech.fr
andrea.enrici AT telecom-paristech.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.
/**
* Class TMLCPLib: data structure for librairies of TMLCP
* Creation: 16/02/2015
* @version 1.0 16/01/2015
* @author Ludovic APVRILLE
* @see
*/
package tmltranslator;
import java.util.*;
import myutil.*;
public class TMLCPLib extends TMLElement {
private ArrayList<TMLCPLibArtifact> artifacts;
private Vector<String> mappedUnits = new Vector<String>();
public TMLCPLib( String _name, Object _referenceObject ) {
super( _name, _referenceObject );
init();
}
public TMLCPLib() {
super( "DefaultCP", null ); //no reference to any object in the default constructor
init();
}
private void setMappedUnits(Vector<String> _mappedUnits) {
mappedUnits = _mappedUnits;
}
private void init() {
artifacts = new ArrayList<TMLCPLibArtifact>();
}
public void addArtifact(TMLCPLibArtifact _arti) {
artifacts.add(_arti);
}
public ArrayList<TMLCPLibArtifact> getArtifacts() {
return artifacts;
}
public Vector<String> getMappedUnits() {
return mappedUnits;
}
} //End of the class
/**Copyright or (C) or Copr. GET / ENST, Telecom-Paris, Ludovic Apvrille, Andrea Enrici
ludovic.apvrille AT telecom-paristech.fr
andrea.enrici AT telecom-paristech.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.
/**
* Class TMLCPLibArtifact: Artifact mapped on a TMLCPLib
* Creation: 16/02/2015
* @version 1.0 16/02/2015
* @author Ludovic APVRILLE
* @see
*/
package tmltranslator;
import java.util.*;
import tmltranslator.tmlcp.*;
import myutil.*;
public class TMLCPLibArtifact extends TMLElement {
public String taskName;
public String portName;
public String memoryName;
public TMLCPLibArtifact(String _name, Object _referenceObject, String _taskName, String _portName, String _memoryName) {
super( _name, _referenceObject );
taskName = _taskName;
portName = _portName;
memoryName = _memoryName;
}
public TMLCPLibArtifact() {
super( "DefaultCP", null ); //no reference to any object in the default constructor
}
} //End of the class
This diff is collapsed.
/**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.
/**
* Class TMLArchiPortArtifact
* Communication Artifact of a deployment diagram
* Creation: 22/11/2007
* @version 1.0 22/11/2007
* @author Ludovic APVRILLE
* @see
*/
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.
/**
* Class TMLArchiPortArtifact
* Communication Artifact of a deployment diagram
* Creation: 22/11/2007
* @version 1.0 22/11/2007
* @author Ludovic APVRILLE
* @see
*/
package ui.tmldd;
......@@ -65,57 +65,57 @@ public class TMLArchiPortArtifact extends TGCWithoutInternalComponent implements
protected int fileX = 20;
protected int fileY = 25;
protected int cran = 5;
protected String mappedMemory = "VOID";
protected String mappedMemory = "VOID";
protected String oldValue = "";
protected String referenceCommunicationName = "TMLCommunication";
protected String portName = "name";
protected String typeName = "port";
protected String startAddress = "";
protected String endAddress = "";
protected int priority = 5; // Between 0 and 10
protected String portName = "name";
protected String typeName = "port";
protected String startAddress = "";
protected String endAddress = "";
protected int priority = 5; // Between 0 and 10
public TMLArchiPortArtifact(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 = 75;
height = 40;
minWidth = 75;
nbConnectingPoint = 0;
addTGConnectingPointsComment();
moveable = true;
editable = true;
removable = true;
value = "";
portName = "name";
referenceCommunicationName = "TMLCommunication";
referenceCommunicationName = "TMLCommunication";
makeFullValue();
//setPriority(((TMLArchiDiagramPanel)tdp).getPriority(getFullValue(), priority);
//setPriority(((TMLArchiDiagramPanel)tdp).getPriority(getFullValue(), priority);
myImageIcon = IconManager.imgic702;
}
public int getPriority() {
return priority;
}
public void setPriority(int _priority) {
priority = _priority;
}
public int getPriority() {
return priority;
}
public void setPriority(int _priority) {
priority = _priority;
}
public void internalDrawing(Graphics g) {
if (oldValue.compareTo(value) != 0) {
setValue(value, g);
}
g.drawRect(x, y, width, height);
//g.drawRoundRect(x, y, width, height, arc, arc);
g.drawLine(x+width-space-fileX, y + space, x+width-space-fileX, y+space+fileY);
g.drawLine(x+width-space-fileX, y + space, x+width-space-cran, y+space);
......@@ -124,31 +124,31 @@ public class TMLArchiPortArtifact extends TGCWithoutInternalComponent implements
g.drawLine(x+width-space, y+space+fileY, x+width-space-fileX, y+space+fileY);
g.drawLine(x+width-space-cran, y+space, x+width-space-cran, y+space+cran);
g.drawLine(x+width-space-cran, y+space+cran, x + width-space, y+space+cran);
g.drawImage(IconManager.img9, x+width-space-fileX + 3, y + space + 7, null);
g.drawImage(IconManager.img9, x+width-space-fileX + 3, y + space + 7, null);
g.drawString(value, x + textX , y + textY);
Font f = g.getFont();
g.setFont(f.deriveFont(Font.ITALIC));
g.drawString(typeName, x + textX , y + textY + 20);
g.setFont(f);
Font f = g.getFont();
g.setFont(f.deriveFont(Font.ITALIC));
g.drawString(typeName, x + textX , y + textY + 20);
g.setFont(f);
}
public void setValue(String val, Graphics g) {
oldValue = value;
int w = g.getFontMetrics().stringWidth(value);
int w1 = Math.max(minWidth, w + 2 * textX + fileX + space);
int w1 = Math.max(minWidth, w + 2 * textX + fileX + space);
//System.out.println("width=" + width + " w1=" + w1 + " w2=" + w2 + " value=" + value);
if (w1 != width) {
if (w1 != width) {
width = w1;
resizeWithFather();
}
//System.out.println("width=" + width + " w1=" + w1 + " value=" + value);
}
public void resizeWithFather() {
if ((father != null) && (father instanceof TMLArchiCommunicationNode)) {
//System.out.println("cdRect comp");
......@@ -157,107 +157,107 @@ public class TMLArchiPortArtifact extends TGCWithoutInternalComponent implements
setMoveCd(x, y);
}
}
public boolean editOndoubleClick(JFrame frame) {
String tmp;
boolean error = false;
JDialogPortArtifact dialog = new JDialogPortArtifact(frame, "Setting port artifact attributes", this, mappedMemory, startAddress, endAddress, value );
dialog.setSize(700, 600);
public boolean editOndoubleClick(JFrame frame) {
String tmp;
boolean error = false;
JDialogPortArtifact dialog = new JDialogPortArtifact(frame, "Setting port artifact attributes", this, mappedMemory, startAddress, endAddress, value );
dialog.setSize(700, 600);
GraphicLib.centerOnParent(dialog);
dialog.show(); // blocked until dialog has been closed
mappedMemory = dialog.getMappedMemory();
startAddress = dialog.getStartAddress();
endAddress = dialog.getEndAddress();
if (!dialog.isRegularClose()) {
return false;
}
if (dialog.getReferenceCommunicationName() == null) {
return false;
}
if (dialog.getReferenceCommunicationName().length() != 0) {
tmp = dialog.getReferenceCommunicationName();
referenceCommunicationName = tmp;
}
if (dialog.getCommunicationName().length() != 0) {
tmp = dialog.getCommunicationName();
if (!TAttribute.isAValidId(tmp, false, false)) {
error = true;
mappedMemory = dialog.getMappedMemory();
startAddress = dialog.getStartAddress();
endAddress = dialog.getEndAddress();
if (!dialog.isRegularClose()) {
return false;
}
if (dialog.getReferenceCommunicationName() == null) {
return false;
}
if (dialog.getReferenceCommunicationName().length() != 0) {
tmp = dialog.getReferenceCommunicationName();
referenceCommunicationName = tmp;
}
if (dialog.getCommunicationName().length() != 0) {
tmp = dialog.getCommunicationName();
if (!TAttribute.isAValidId(tmp, false, false)) {
error = true;
} else {
portName = tmp;
}
}
if (dialog.getTypeName().length() != 0) {
typeName = dialog.getTypeName();
}
priority = dialog.getPriority();
((TMLArchiDiagramPanel)tdp).setPriority(getFullValue(), priority);
if (error) {
JOptionPane.showMessageDialog(frame,
"Name is non-valid",
"Error",
JOptionPane.INFORMATION_MESSAGE);
}
makeFullValue();
return !error;
portName = tmp;
}
}
if (dialog.getTypeName().length() != 0) {
typeName = dialog.getTypeName();
}
priority = dialog.getPriority();
((TMLArchiDiagramPanel)tdp).setPriority(getFullValue(), priority);
if (error) {
JOptionPane.showMessageDialog(frame,
"Name is non-valid",
"Error",
JOptionPane.INFORMATION_MESSAGE);
}
makeFullValue();
return !error;
}
private void makeFullValue() {
value = referenceCommunicationName + "::" + portName;
}
public TGComponent isOnMe(int _x, int _y) {
if (GraphicLib.isInRectangle(_x, _y, x, y, width, height)) {
return this;
}
return null;
}
public int getType() {
return TGComponentManager.TMLARCHI_PORT_ARTIFACT;
}
protected String translateExtraParam() {
StringBuffer sb = new StringBuffer("<extraparam>\n");
sb.append("<info value=\"" + value + "\" portName=\"" + portName + "\" referenceCommunicationName=\"");
sb.append(referenceCommunicationName);
/*sb.append("\" priority=\"");
sb.append(priority);*/
sb.append("\" typeName=\"" + typeName);
sb.append("\" mappedMemory=\"" + mappedMemory );
sb.append("\" startAddress=\"" + startAddress );
sb.append("\" endAddress=\"" + endAddress );
/*sb.append("\" priority=\"");
sb.append(priority);*/
sb.append("\" typeName=\"" + typeName);
sb.append("\" mappedMemory=\"" + mappedMemory );
sb.append("\" startAddress=\"" + startAddress );
sb.append("\" endAddress=\"" + endAddress );
sb.append("\" />\n");
sb.append("</extraparam>\n");
return new String(sb);
}
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 svalue = null, sname = null, sreferenceCommunication = null, stype = null;
//String prio = null;
//String prio = null;
for(int i=0; i<nl.getLength(); i++) {
n1 = nl.item(i);
//System.out.println(n1);
......@@ -272,70 +272,70 @@ public class TMLArchiPortArtifact extends TGCWithoutInternalComponent implements
svalue = elt.getAttribute("value");
sname = elt.getAttribute("portName");
sreferenceCommunication = elt.getAttribute("referenceCommunicationName");
stype = elt.getAttribute("typeName");
mappedMemory = elt.getAttribute("mappedMemory");
startAddress = elt.getAttribute("startAddress");
endAddress = elt.getAttribute("endAddress");
//prio = elt.getAttribute("priority");
stype = elt.getAttribute("typeName");
mappedMemory = elt.getAttribute("mappedMemory");
startAddress = elt.getAttribute("startAddress");
endAddress = elt.getAttribute("endAddress");
//prio = elt.getAttribute("priority");
}
if (svalue != null) {
value = svalue;
}
}
if (sname != null){
portName = sname;
}
if (sreferenceCommunication != null) {
referenceCommunicationName = sreferenceCommunication;
}
if (stype != null){
if (stype != null){
typeName = stype;
}
/*if ((prio != null) && (prio.trim().length() > 0)) {
priority = Integer.decode(prio).intValue();
}*/
/*if ((prio != null) && (prio.trim().length() > 0)) {
priority = Integer.decode(prio).intValue();
}*/
}
}
}
}
} catch (Exception e) {
System.out.println("Channel artifact");
System.out.println("Channel artifact");
throw new MalformedModelingException();
}
makeFullValue();
}
public DesignPanel getDesignPanel() {
return tdp.getGUI().getDesignPanel(value);
}
public String getReferenceCommunicationName() {
public String getReferenceCommunicationName() {
return referenceCommunicationName;
}
public void setReferenceCommunicationName(String _referenceCommunicationName) {
public void setReferenceCommunicationName(String _referenceCommunicationName) {
referenceCommunicationName = _referenceCommunicationName;
makeFullValue();
makeFullValue();
}
public String getPortName() {
return portName;
}
public String getFullValue() {
String tmp = getValue();
tmp += " (" + getTypeName() + ")";
return tmp;
}
public String getTypeName() {
public String getFullValue() {
String tmp = getValue();
tmp += " (" + getTypeName() + ")";
return tmp;
}
public String getTypeName() {
return typeName;
}
public String getAttributes() {
return "Priority = " + priority;
}
public String getAttributes() {
return "Priority = " + priority;
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment