Commit 72833b7f authored by Ludovic Apvrille's avatar Ludovic Apvrille

DIPLODOCUS Component design: bug on adding internal ports resolved when doing...

DIPLODOCUS Component design: bug on adding internal ports resolved when doing this for a primitive component insite a composite component
parent 6fcc36e4
......@@ -71,6 +71,8 @@ RELEASE_STD_FILES_LIB = TClock1.lib TTimerv01.lib
RELEASE_STD_FILES_BIN = $(TTOOL_CONFIG) $(LAUNCHER_BINARY) $(TTOOL_BINARY) $(TIFTRANSLATOR_BINARY) $(TMLTRANSLATOR_BINARY) $(REMOTESIMULATOR_BINARY)
RELEASE_STD_FILES_LICENSES = LICENSE LICENSE_CECILL_ENG LICENSE_CECILL_FR
all:
date
svn update build.txt src/ui/DefaultText.java
......@@ -78,6 +80,13 @@ all:
svn commit build.txt src/ui/DefaultText.java -m 'update on build version: builder.txt'
$(JAVAC) $(CLASSPATH) $(TTOOL_SRC) $(TTOOL_SRC)/*.java
basicsvnapvrille:
date
svn --username apvrille update build.txt src/ui/DefaultText.java
$(JAVA) -jar $(BUILDER) $(BUILD_INFO) $(BUILD_TO_MODIFY)
svn --username apvrille commit build.txt src/ui/DefaultText.java -m 'update on build version: builder.txt'
$(JAVAC) $(CLASSPATH) $(TTOOL_SRC) $(TTOOL_SRC)/*.java
myrelease: basic launcher ttooljar_std
basic:
......
......@@ -446,7 +446,7 @@ public class GTMLModeling {
if (request != null) {
if (request.getName().compareTo(tmlro.getRequestName()) != 0) {
String msg = "Two requests declared with the different names have the same destination task: " + tmlro.getRequestName();
String msg = "Two requests declared with different names have the same destination task: " + tmlro.getRequestName();
CheckingError ce = new CheckingError(CheckingError.STRUCTURE_ERROR, msg);
ce.setTDiagramPanel(tmldp.tmltdp);
ce.setTGComponent(tgc);
......@@ -531,12 +531,16 @@ public class GTMLModeling {
// Request attributes
//TraceManager.addDev("Requests attributes");
String attname;
for(int j=0; j<request.getNbOfParams(); j++) {
tmltt = new TMLType(request.getType(j).getType());
tmlattr = new TMLAttribute("arg" + (j + 1) + "__req", tmltt);
tmlattr.initialValue = tmlattr.getDefaultInitialValue();
TraceManager.addDev("Adding " + tmlattr.getName() + " to " + task.getName() + "with value =" + tmlattr.initialValue);
task.addAttribute(tmlattr);
attname = "arg" + (j + 1) + "__req";
if (task.getAttributeByName(attname) == null) {
tmltt = new TMLType(request.getType(j).getType());
tmlattr = new TMLAttribute(attname, tmltt);
tmlattr.initialValue = tmlattr.getDefaultInitialValue();
TraceManager.addDev("Adding " + tmlattr.getName() + " to " + task.getName() + "with value =" + tmlattr.initialValue);
task.addAttribute(tmlattr);
}
}
......@@ -904,12 +908,16 @@ public class GTMLModeling {
// Request attributes
//TraceManager.addDev("Requests attributes");
String attname;
for(int j=0; j<request.getNbOfParams(); j++) {
tmltt = new TMLType(request.getType(j).getType());
tmlattr = new TMLAttribute("arg" + (j + 1) + "__req", tmltt);
tmlattr.initialValue = tmlattr.getDefaultInitialValue();
TraceManager.addDev("Adding " + tmlattr.getName() + " to " + tt1.getName() + "with value =" + tmlattr.initialValue);
tt1.addAttribute(tmlattr);
attname = "arg" + (j + 1) + "__req";
if (tt1.getAttributeByName(attname) == null) {
tmltt = new TMLType(request.getType(j).getType());
tmlattr = new TMLAttribute(attname, tmltt);
tmlattr.initialValue = tmlattr.getDefaultInitialValue();
TraceManager.addDev("Adding " + tmlattr.getName() + " to " + tt1.getName() + "with value =" + tmlattr.initialValue);
tt1.addAttribute(tmlattr);
}
}
for(i=0; i<portstome.size(); i++) {
......@@ -918,6 +926,19 @@ public class GTMLModeling {
request.addOriginTask(tt2);
}
// Check whether there is another request having a different name but with the same destination task
TMLRequest request1 = tmlm.getRequestByDestinationTask(request.getDestinationTask());
if (request1 != null) {
if (request1.getName().compareTo(name) != 0) {
String msg = "Two requests port declared on the same destination task have different names: " + name;
CheckingError ce = new CheckingError(CheckingError.STRUCTURE_ERROR, msg);
ce.setTDiagramPanel(tmlcdp.tmlctdp);
ce.setTGComponent(tgc);
checkingErrors.add(ce);
throw new MalformedTMLDesignException(msg);
}
}
if (tmlm.hasSameRequestName(request)) {
TMLRequest otherReq = tmlm.hasSimilarRequest(request);
......
......@@ -51,6 +51,6 @@ package ui;
public interface SwallowTGComponent {
public boolean acceptSwallowedTGComponent(TGComponent tgc);
public void addSwallowedTGComponent(TGComponent tgc, int x, int y);
public boolean addSwallowedTGComponent(TGComponent tgc, int x, int y);
public void removeSwallowedTGComponent(TGComponent tgc);
}
\ No newline at end of file
......@@ -877,9 +877,14 @@ public abstract class TDiagramPanel extends JPanel implements GenericTree {
//TraceManager.addDev("Swallowed component !");
SwallowTGComponent stgc = findSwallowTGComponent(x, y, tgc);
if (stgc != null) {
stgc.addSwallowedTGComponent(tgc, x, y);
tgc.wasSwallowed();
ret = true;
if (stgc.addSwallowedTGComponent(tgc, x, y)) {
tgc.wasSwallowed();
ret = true;
} else {
if (addToList) {
componentList.add(0, tgc);
}
}
} else {
if (addToList) {
componentList.add(0, tgc);
......@@ -910,9 +915,10 @@ public abstract class TDiagramPanel extends JPanel implements GenericTree {
while(iterator.hasNext()) {
tgc = (TGComponent)(iterator.next());
if ((tgc instanceof SwallowTGComponent) && (tgc.isOnMeHL(x, y) != null) && (tgc != tgcdiff)) {
if (((SwallowTGComponent)tgc).acceptSwallowedTGComponent(tgcdiff)) {
return ((SwallowTGComponent)tgc);
}
return ((SwallowTGComponent)tgc);
/*if (((SwallowTGComponent)tgc).acceptSwallowedTGComponent(tgcdiff)) {
}*/
}
}
return null;
......
......@@ -280,28 +280,15 @@ public class ATDBlock extends TGCScalableWithInternalComponent implements Swallo
return false;
}
public void addSwallowedTGComponent(TGComponent tgc, int x, int y) {
//System.out.println("Add swallow component");
// Choose its position
// Make it an internal component
// It's one of my son
tgc.setFather(this);
tgc.setDrawingZone(true);
//Set its coordinates
public boolean addSwallowedTGComponent(TGComponent tgc, int x, int y) {
if (tgc instanceof ATDAttack) {
//tgc.setCdRectangle((width/2) - tgc.getWidth(), (width/2), spacePt, height-spacePt);
//System.out.println("cdRect comp swallow");
tgc.setFather(this);
tgc.setDrawingZone(true);
((ATDAttack)tgc).resizeWithFather();
//tgc.setCdRectangle(0, width - tgc.getWidth(), 0, height - tgc.getHeight());
//tgc.setCd(x, y);
addInternalComponent(tgc, 0);
return true;
}
// else unknown*/
//add it
addInternalComponent(tgc, 0);
return false;
}
public void removeSwallowedTGComponent(TGComponent tgc) {
......
......@@ -526,7 +526,7 @@ public class AvatarBDBlock extends TGCScalableWithInternalComponent implements S
return false;
}
public void addSwallowedTGComponent(TGComponent tgc, int x, int y) {
public boolean addSwallowedTGComponent(TGComponent tgc, int x, int y) {
boolean swallowed = false;
for(int i=0; i<nbInternalTGComponent; i++) {
......@@ -540,7 +540,11 @@ public class AvatarBDBlock extends TGCScalableWithInternalComponent implements S
}
if (swallowed) {
return;
return true;
}
if (!acceptSwallowedTGComponent(tgc)) {
return false;
}
//System.out.println("Add swallow component");
......@@ -564,6 +568,8 @@ public class AvatarBDBlock extends TGCScalableWithInternalComponent implements S
//add it
addInternalComponent(tgc, 0);
return true;
}
public void removeSwallowedTGComponent(TGComponent tgc) {
......
......@@ -471,7 +471,7 @@ public class AvatarPDBlock extends TGCScalableWithInternalComponent implements S
return TGComponentManager.APD_BLOCK;
}
public void addSwallowedTGComponent(TGComponent tgc, int x, int y) {
public boolean addSwallowedTGComponent(TGComponent tgc, int x, int y) {
boolean swallowed = false;
for(int i=0; i<nbInternalTGComponent; i++) {
......@@ -485,7 +485,11 @@ public class AvatarPDBlock extends TGCScalableWithInternalComponent implements S
}
if (swallowed) {
return;
return true;
}
if (!acceptSwallowedTGComponent(tgc)) {
return false;
}
//System.out.println("Add swallow component");
......@@ -525,6 +529,8 @@ public class AvatarPDBlock extends TGCScalableWithInternalComponent implements S
//add it
addInternalComponent(tgc, 0);
return true;
}
public void removeSwallowedTGComponent(TGComponent tgc) {
......
......@@ -282,7 +282,7 @@ public class AvatarSMDState extends TGCScalableWithInternalComponent implements
return false;
}
public void addSwallowedTGComponent(TGComponent tgc, int x, int y) {
public boolean addSwallowedTGComponent(TGComponent tgc, int x, int y) {
boolean swallowed = false;
for(int i=0; i<nbInternalTGComponent; i++) {
......@@ -296,7 +296,11 @@ public class AvatarSMDState extends TGCScalableWithInternalComponent implements
}
if (swallowed) {
return;
return true;
}
if (!acceptSwallowedTGComponent(tgc)) {
return false;
}
//System.out.println("Add swallow component");
......@@ -320,6 +324,8 @@ public class AvatarSMDState extends TGCScalableWithInternalComponent implements
//add it
addInternalComponent(tgc, 0);
return true;
}
public void removeSwallowedTGComponent(TGComponent tgc) {
......
......@@ -195,28 +195,20 @@ public class TDDNode extends TGCWithInternalComponent implements SwallowTGCompon
return false;
}
public void addSwallowedTGComponent(TGComponent tgc, int x, int y) {
//System.out.println("Add swallow component");
// Choose its position
// Make it an internal component
// It's one of my son
tgc.setFather(this);
tgc.setDrawingZone(true);
//Set its coordinates
public boolean addSwallowedTGComponent(TGComponent tgc, int x, int y) {
if (tgc instanceof TDDArtifact) {
//tgc.setCdRectangle((width/2) - tgc.getWidth(), (width/2), spacePt, height-spacePt);
//System.out.println("cdRect comp swallow");
tgc.setFather(this);
tgc.setDrawingZone(true);
((TDDArtifact)tgc).resizeWithFather();
//tgc.setCdRectangle(0, width - tgc.getWidth(), 0, height - tgc.getHeight());
//tgc.setCd(x, y);
addInternalComponent(tgc, 0);
return true;
}
// else unknown*/
//add it
addInternalComponent(tgc, 0);
return false;
}
public void removeSwallowedTGComponent(TGComponent tgc) {
......
......@@ -173,7 +173,11 @@ public class EBRDDERC extends TGCWithInternalComponent implements SwallowTGCompo
}
public void addSwallowedTGComponent(TGComponent tgc, int x, int y) {
public boolean addSwallowedTGComponent(TGComponent tgc, int x, int y) {
if (!acceptSwallowedTGComponent(tgc)) {
return false;
}
//System.out.println("Add swallow component");
// Choose its position
......@@ -203,6 +207,8 @@ public class EBRDDERC extends TGCWithInternalComponent implements SwallowTGCompo
//add it
addInternalComponent(tgc, 0);
return true;
}
public void removeSwallowedTGComponent(TGComponent tgc) {
......
......@@ -236,28 +236,20 @@ public class NCEqNode extends TGCWithInternalComponent implements SwallowTGCompo
return false;
}
public void addSwallowedTGComponent(TGComponent tgc, int x, int y) {
//System.out.println("Add swallow component");
// Choose its position
// Make it an internal component
// It's one of my son
tgc.setFather(this);
tgc.setDrawingZone(true);
//Set its coordinates
public boolean addSwallowedTGComponent(TGComponent tgc, int x, int y) {
if (tgc instanceof NCTrafficArtifact) {
//tgc.setCdRectangle((width/2) - tgc.getWidth(), (width/2), spacePt, height-spacePt);
//System.out.println("cdRect comp swallow");
//Set its coordinates
tgc.setFather(this);
tgc.setDrawingZone(true);
((NCTrafficArtifact)tgc).resizeWithFather();
//tgc.setCdRectangle(0, width - tgc.getWidth(), 0, height - tgc.getHeight());
//tgc.setCd(x, y);
addInternalComponent(tgc, 0);
return true;
}
// else unknown*/
//add it
addInternalComponent(tgc, 0);
return false;
}
public void removeSwallowedTGComponent(TGComponent tgc) {
......
......@@ -270,28 +270,18 @@ public class NCSwitchNode extends TGCWithInternalComponent implements SwallowTGC
return false;
}
public void addSwallowedTGComponent(TGComponent tgc, int x, int y) {
//System.out.println("Add swallow component");
// Choose its position
// Make it an internal component
// It's one of my son
tgc.setFather(this);
tgc.setDrawingZone(true);
//Set its coordinates
public boolean addSwallowedTGComponent(TGComponent tgc, int x, int y) {
if (tgc instanceof NCRouteArtifact) {
//tgc.setCdRectangle((width/2) - tgc.getWidth(), (width/2), spacePt, height-spacePt);
//System.out.println("cdRect comp swallow");
//Set its coordinates
tgc.setFather(this);
tgc.setDrawingZone(true);
((NCRouteArtifact)tgc).resizeWithFather();
//tgc.setCdRectangle(0, width - tgc.getWidth(), 0, height - tgc.getHeight());
//tgc.setCd(x, y);
//add it
addInternalComponent(tgc, 0);
return true;
}
// else unknown*/
//add it
addInternalComponent(tgc, 0);
return false;
}
public void removeSwallowedTGComponent(TGComponent tgc) {
......
......@@ -271,24 +271,19 @@ public class ProCSDComponent extends TGCWithInternalComponent implements
return false;
}
public void addSwallowedTGComponent(TGComponent tgc, int x, int y) {
// System.out.println("Add swallow component");
// Choose its position
// Make it an internal component
// It's one of my son
tgc.setFather(this);
tgc.setDrawingZone(true);
// Set its coordinates
public boolean addSwallowedTGComponent(TGComponent tgc, int x, int y) {
if (tgc instanceof ProCSDComponent) {
// Set its coordinates
tgc.setFather(this);
tgc.setDrawingZone(true);
((ProCSDComponent) tgc).resizeWithFather();
addInternalComponent(tgc, 0);
return true;
}
// else unknown*/
// add it
addInternalComponent(tgc, 0);
return false;
}
public void removeSwallowedTGComponent(TGComponent tgc) {
......
......@@ -237,7 +237,12 @@ public class SDInstance extends TGCWithInternalComponent implements SwallowTGCom
return false;
}
public void addSwallowedTGComponent(TGComponent tgc, int x, int y) {
public boolean addSwallowedTGComponent(TGComponent tgc, int x, int y) {
if (!acceptSwallowedTGComponent(tgc)) {
return false;
}
//System.out.println("Add swallow component");
// Choose its position
int realY = Math.max(y, getY() + spacePt);
......@@ -290,6 +295,8 @@ public class SDInstance extends TGCWithInternalComponent implements SwallowTGCom
//add it
addInternalComponent(tgc, 0);
return true;
}
public void removeSwallowedTGComponent(TGComponent tgc) {
......
......@@ -267,7 +267,7 @@ public class TMLCCompositeComponent extends TGCScalableWithInternalComponent imp
return false;
}
public void addSwallowedTGComponent(TGComponent tgc, int x, int y) {
public boolean addSwallowedTGComponent(TGComponent tgc, int x, int y) {
boolean swallowed = false;
for(int i=0; i<nbInternalTGComponent; i++) {
......@@ -283,7 +283,11 @@ public class TMLCCompositeComponent extends TGCScalableWithInternalComponent imp
}
if (swallowed) {
return;
return true;
}
if (!acceptSwallowedTGComponent(tgc)) {
return false;
}
//System.out.println("Add swallow component");
......@@ -320,6 +324,8 @@ public class TMLCCompositeComponent extends TGCScalableWithInternalComponent imp
//add it
addInternalComponent(tgc, 0);
return true;
}
public void removeSwallowedTGComponent(TGComponent tgc) {
......
......@@ -356,7 +356,7 @@ public class TMLCPrimitiveComponent extends TGCScalableWithInternalComponent imp
return false;
}
public void addSwallowedTGComponent(TGComponent tgc, int x, int y) {
public boolean addSwallowedTGComponent(TGComponent tgc, int x, int y) {
//boolean swallowed = false;
//TraceManager.addDev("Add swallow component");
......@@ -370,9 +370,10 @@ public class TMLCPrimitiveComponent extends TGCScalableWithInternalComponent imp
tgc.setDrawingZone(true);
((TMLCPrimitivePort)tgc).resizeWithFather();
addInternalComponent(tgc, 0);
return true;
}
return false;
}
public void removeSwallowedTGComponent(TGComponent tgc) {
......
......@@ -404,28 +404,19 @@ public class TMLArchiCPUNode extends TMLArchiNode implements SwallowTGComponent,
return false;
}
public void addSwallowedTGComponent(TGComponent tgc, int x, int y) {
//System.out.println("Add swallow component");
// Choose its position
// Make it an internal component
// It's one of my son
tgc.setFather(this);
tgc.setDrawingZone(true);
public boolean addSwallowedTGComponent(TGComponent tgc, int x, int y) {
//Set its coordinates
if (tgc instanceof TMLArchiArtifact) {
//tgc.setCdRectangle((width/2) - tgc.getWidth(), (width/2), spacePt, height-spacePt);
//System.out.println("cdRect comp swallow");
tgc.setFather(this);
tgc.setDrawingZone(true);
((TMLArchiArtifact)tgc).resizeWithFather();
//tgc.setCdRectangle(0, width - tgc.getWidth(), 0, height - tgc.getHeight());
//tgc.setCd(x, y);
addInternalComponent(tgc, 0);
return true;
}
// else unknown*/
return false;
//add it
addInternalComponent(tgc, 0);
}
public void removeSwallowedTGComponent(TGComponent tgc) {
......
......@@ -73,7 +73,7 @@ public abstract class TMLArchiCommunicationNode extends TMLArchiNode implements
return false;
}
public void addSwallowedTGComponent(TGComponent tgc, int x, int y) {
public boolean addSwallowedTGComponent(TGComponent tgc, int x, int y) {
if (tgc instanceof TMLArchiCommunicationArtifact) {
// Make it an internal component
......@@ -89,7 +89,10 @@ public abstract class TMLArchiCommunicationNode extends TMLArchiNode implements
//tgc.setCd(x, y);
//add it
addInternalComponent(tgc, 0);
return true;
}
return false;
}
......
......@@ -266,27 +266,16 @@ public class TMLArchiHWANode extends TMLArchiNode implements SwallowTGComponent,
return false;
}
public void addSwallowedTGComponent(TGComponent tgc, int x, int y) {
//System.out.println("Add swallow component");
// Choose its position
// Make it an internal component
// It's one of my son
tgc.setFather(this);
tgc.setDrawingZone(true);
//Set its coordinates
public boolean addSwallowedTGComponent(TGComponent tgc, int x, int y) {
if ((tgc instanceof TMLArchiArtifact) && (nbInternalTGComponent == 0)){
//tgc.setCdRectangle((width/2) - tgc.getWidth(), (width/2), spacePt, height-spacePt);
//System.out.println("cdRect comp swallow");
tgc.setFather(this);
tgc.setDrawingZone(true);
((TMLArchiArtifact)tgc).resizeWithFather();
//tgc.setCdRectangle(0, width - tgc.getWidth(), 0, height - tgc.getHeight());
//tgc.setCd(x, y);
addInternalComponent(tgc, 0);
return true;
}
// else unknown*/
return false;
}
public void removeSwallowedTGComponent(TGComponent tgc) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment