Commit 809a0a7e authored by Guillaume Chomat's avatar Guillaume Chomat
Browse files

minor modification

parent 498b6b0b
/**
* $Id: FCMarqueeHandler.java,v 1.32 2002-06-14 09:26:48 gchomat Exp $
* $Id: FCMarqueeHandler.java,v 1.33 2002-06-14 10:12:20 gchomat Exp $
*
* Transmorpher
*
......@@ -126,19 +126,32 @@ public class FCMarqueeHandler extends BasicMarqueeHandler {
public void mousePressed(MouseEvent e) {
//System.out.println("MousePressed Start...");
if(currentProcess != null){
if (!e.isConsumed() && !marquee.isSelected()) {
start = currentProcess.snap(e.getPoint());
firstPort = port;
if ((edgeNormal.isSelected())&&(firstPort != null)) {
double scale = currentProcess.getScale();
start = firstPort.getLocation(null);
start = new Point((int)(start.x*scale),(int)(start.y*scale));
}
e.consume();
}
}
if(e.getButton() == MouseEvent.BUTTON3)
{
if (!e.isConsumed() && marquee.isSelected()) {
System.out.println("MousePressed Start...");
e.consume();
}
}
else{
if(currentProcess != null){
if (!e.isConsumed() && !marquee.isSelected()) {
start = currentProcess.snap(e.getPoint());
firstPort = port;
if ((edgeNormal.isSelected())&&(firstPort != null)) {
double scale = currentProcess.getScale();
start = firstPort.getLocation(null);
start = new Point((int)(start.x*scale),(int)(start.y*scale));
}
e.consume();
}
}
}
super.mousePressed(e);
//System.out.println("MousePressed End...");
}
......@@ -178,9 +191,7 @@ public class FCMarqueeHandler extends BasicMarqueeHandler {
public void mouseReleased(MouseEvent event) {
Call call;
Channel channel;
current = currentProcess.snap(event.getPoint());
if(currentProcess != null){
......@@ -341,103 +352,6 @@ public class FCMarqueeHandler extends BasicMarqueeHandler {
}
/*
public void doConnectionSet(Object cell,Object cell2) {
Point p,p2 = null;
Rectangle rect,rect2;
Port portIn,portOut;
Call tCallOut;
Call tCallIn;
Channel channel;
String name;
rect=currentProcess.getCellBounds(cell);
rect2=currentProcess.getCellBounds(cell2);
int port = ((currentProcess).getPorts(cell,"output")).size();
int port2 = ((currentProcess).getPorts(cell2,"input")).size();
//System.out.println(port+"premier");
//System.out.println(port2+"deuxieme");
if ((cell instanceof SerializeCell)||(cell2 instanceof GenerateCell))
System.out.println("pas de port en entre (resp. sortie)");
else if ((port==1)&&((cell instanceof MergeCell)||(cell instanceof ApplyRulesetCell)
||(cell instanceof ApplyQueryCell)||(cell instanceof GenerateCell)))
System.out.println("1 seul port d'entre pour la connection");
else if ((port2==1)&&((cell2 instanceof DispatchCell)||(cell2 instanceof ApplyRulesetCell)
||(cell2 instanceof ApplyQueryCell)||(cell2 instanceof SerializeCell)))
System.out.println("1 seul port de sortie pour la connection");
else {
tCallOut = (Call)(((DefaultGraphCell)cell).getUserObject());
tCallIn = (Call)(((DefaultGraphCell)cell2).getUserObject());
//System.out.println("tCallIn "+tCallIn);
//System.out.println("tCallOut "+tCallOut);
int indexIn = (tCallIn.inPorts().length()==0)?0:tCallIn.inPorts().length()-1;
int indexOut = (tCallOut.outPorts().length()==0)?0:tCallOut.outPorts().length()-1;
name = "C"+tCallIn.getId();
portIn = new Port(name,tCallIn,indexIn);
portOut = new Port(name,tCallOut,indexOut);
tCallIn.inPorts().addPort(portIn);
tCallOut.outPorts().addPort(portOut);
channel = new Channel( name, (fr.fluxmedia.transmorpher.Graph.Process)currentTransformation );
((Process)currentTransformation).addChannel( channel );
channel.setOut( portOut );
channel.setIn( portIn );
portIn.setChannel( channel );
portOut.setChannel( channel );
(currentProcess).addPort("output",(DefaultGraphCell)cell);
(currentProcess).addPort("input",(DefaultGraphCell)cell2);
p= new Point(rect.x+rect.width/2,rect.y+rect.height/2);
p2= new Point(rect2.x+rect2.width/2,rect2.y+rect2.height/2);
Point p3 = currentProcess.fromScreen(new Point(p));
Point p4 = currentProcess.fromScreen(new Point(p2));
ArrayList list = new ArrayList();
list.add(p3);
list.add(p4);
Map map = GraphConstants.createMap();
GraphConstants.setPoints(map, list);
Map viewMap = new Hashtable();
NormalEdge edge = new NormalEdge(channel);
viewMap.put(edge, map);
Object[] insert = new Object[]{edge};
ConnectionSet cs = new ConnectionSet();
//System.out.println("point p "+p);
//System.out.println("point p2 "+p2);
cs.connect(edge,currentProcess.getPortForLocation(p.x,p.y), true);
cs.connect(edge,currentProcess.getPortForLocation(p2.x,p2.y), false);
currentProcess.getModel().insert(insert, cs, null, viewMap);
(currentProcess).updatePorts("output",(DefaultGraphCell)cell);
(currentProcess).updatePorts("input",(DefaultGraphCell)cell2);
//(currentProcess).layoutPorts(cell,"output");
//(currentProcess).layoutPorts(cell2,"input");
(currentProcess).layoutPorts(cell,"output");
(currentProcess).layoutPorts(cell2,"input");
}
}
} */
public void overlay(Graphics g) {
super.overlay(g);
paintPort(currentProcess.getGraphics());
......
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