Attention une mise à jour du service Gitlab va être effectuée le mardi 18 janvier (et non lundi 17 comme annoncé précédemment) entre 18h00 et 18h30. Cette mise à jour va générer une interruption du service dont nous ne maîtrisons pas complètement la durée mais qui ne devrait pas excéder quelques minutes.

Commit c051f129 authored by SAINT-MARCEL Frederic's avatar SAINT-MARCEL Frederic
Browse files

begin the port gestion modification

parent 52316ea5
/**
* $Id: FCMarqueeHandler.java,v 1.18 2002-06-04 15:22:30 frederic Exp $
* $Id: FCMarqueeHandler.java,v 1.19 2002-06-05 13:18:48 frederic Exp $
*
* Transmorpher
*
......@@ -99,7 +99,7 @@ public class FCMarqueeHandler extends BasicMarqueeHandler {
//public transient JToggleButton edgeNull = new JToggleButton();
protected Point start, current;
//protected Object beginCell, endCell;
protected Object beginCell, endCell;
public FCMarqueeHandler(FlowComposer flowcomposer){
......@@ -131,7 +131,7 @@ public class FCMarqueeHandler extends BasicMarqueeHandler {
if (!e.isConsumed() && !marquee.isSelected()) {
start = currentProcess.snap(e.getPoint());
firstPort = port;
// beginCell = currentProcess.getFirstCellForLocation(e.getX(), e.getY());
//beginCell = currentProcess.getFirstCellForLocation(e.getX(), e.getY());
e.consume();
}
}
......@@ -166,6 +166,7 @@ public class FCMarqueeHandler extends BasicMarqueeHandler {
public void mouseReleased(MouseEvent event) {
EditCall dialog;
Channel channel;
//count++;
if(currentProcess != null){
//endCell= currentProcess.getFirstCellForLocation(event.getX(), event.getY());
......@@ -187,7 +188,19 @@ public class FCMarqueeHandler extends BasicMarqueeHandler {
else if (applyQuery.isSelected())
{dialog = new EditCall((JFrame)(currentProcess.getTopLevelAncestor()),(ProcessGraph)currentProcess,null,start,FCConstants.APPLYQUERY);}
else if (edgeNormal.isSelected()){
//currentProcess.getModel().insert(null,null,null,null);
//currentProcess.getModel().insert(null,null,null,null);
DefaultGraphCell c = (DefaultGraphCell)(port.getParentView()).getCell();
Call call = (Call)(c.getUserObject());
String name = "C"+call.getId();
channel = new Channel( name, (fr.fluxmedia.transmorpher.Graph.Process)currentTransformation );
((Process)currentTransformation).addChannel(channel);
DefaultGraphCell portOut = (DefaultGraphCell)firstPort.getCell();
DefaultGraphCell portIn = (DefaultGraphCell)port.getCell();
channel.setOut((Port)portOut.getUserObject());
channel.setIn((Port)portIn.getUserObject());
((Port)portIn.getUserObject()).setChannel(channel);
((Port)portOut.getUserObject()).setChannel(channel);
//if ((beginCell!=null)&&(endCell!=null)&&(!beginCell.equals(endCell))) {
//doConnectionSet(beginCell,endCell);}
Point p = currentProcess.fromScreen(new Point(start));
......@@ -198,7 +211,7 @@ public class FCMarqueeHandler extends BasicMarqueeHandler {
Map map = GraphConstants.createMap();
GraphConstants.setPoints(map, list);
Map viewMap = new Hashtable();
DefaultEdge cell = new DefaultEdge("");
DefaultEdge cell = new DefaultEdge(channel);
viewMap.put(cell, map);
Object[] insert = new Object[]{cell};
ConnectionSet cs = new ConnectionSet();
......
/**
* $Id: PortCell.java,v 1.1 2002-06-04 09:06:44 gchomat Exp $
* $Id: PortCell.java,v 1.2 2002-06-05 13:18:48 frederic Exp $
*
* Transmorpher
*
......@@ -68,7 +68,7 @@ public class PortCell extends DefaultPort{
this.type = type;
}
public int geType(){
public int getType(){
return type;
}
......
/**
* $Id: ProcessGraph.java,v 1.15 2002-06-04 15:22:30 frederic Exp $
* $Id: ProcessGraph.java,v 1.16 2002-06-05 13:18:48 frederic Exp $
*
* Transmorpher
*
......@@ -56,7 +56,7 @@ public class ProcessGraph extends JGraph implements Comparator, Observer{
*/
static Dimension boundsCube = new Dimension(70,70);
static Dimension boundsPort = new Dimension(5,5);
static Dimension boundsPort = new Dimension(15,15);
/** boundsRect define the dimension of a rectangle form composant such as ApplyProcess, Serialize,...
* ie: this composant are included in rectangle boxe
*/
......@@ -149,6 +149,11 @@ public class ProcessGraph extends JGraph implements Comparator, Observer{
return super.createVertexView(v, cm);
}
/*protected PortView createPortView(Port p, CellMapper cm) {
PortView view = new PortView(p, this, cm);
view.setBounds(new Rectangle(10,10));
return view;
} */
/** interface comparator*/
......@@ -415,15 +420,15 @@ public class ProcessGraph extends JGraph implements Comparator, Observer{
*
*
*/
public ArrayList getPorts(Object vertex1,Object userObject) {
public ArrayList getPorts(Object vertex1,int type) {
ArrayList result = new ArrayList();
if (!((DefaultGraphCell)vertex1).isLeaf()) {
java.util.List children = ((DefaultGraphCell)vertex1).getChildren();
Iterator it = children.iterator();
while (it.hasNext()) {
Object port = it.next();
//System.out.println(((DefaultPort)port).getUserObject());
if (userObject.equals(((DefaultPort)port).getUserObject()))
System.out.println(port);
if (type==((PortCell)port).getType())
result.add(port);
}
}
......@@ -496,33 +501,37 @@ public class ProcessGraph extends JGraph implements Comparator, Observer{
public void addVertex(Object userObject,Point point,int number) {
int u = GraphConstants.PERCENT;
Rectangle bounds;
Rectangle boundsPort_ = new Rectangle(point,boundsPort);
DefaultGraphCell cell = null;
Map viewMap = new Hashtable();
// Create Vertex
switch (number) {
case FCConstants.MERGE :
cell = new MergeCell(userObject);
bounds = new Rectangle(point,boundsCube);
addCell(cell,viewMap,bounds);
addPort(cell,viewMap,FCConstants.PORTOUTPUT);
addPort(cell,viewMap, boundsPort_,FCConstants.PORTOUTPUT);
// updatePorts(FCConstants.PORTOUTPUT,cell);
break;
case FCConstants.GENERATE :
cell = new GenerateCell(userObject);
bounds = new Rectangle(point,boundsRect);
addCell(cell,viewMap,bounds);
addPort(cell,viewMap,FCConstants.PORTOUTPUT);
addPort(cell,viewMap, boundsPort_,FCConstants.PORTOUTPUT);
//updatePorts(FCConstants.PORTOUTPUT,cell);
break;
case FCConstants.SERIALIZE :
cell = new SerializeCell(userObject);
bounds = new Rectangle(point,boundsRect);
addCell(cell,viewMap,bounds);
addPort(cell,viewMap,FCConstants.PORTINPUT);
addPort(cell,viewMap, boundsPort_,FCConstants.PORTINPUT);
break;
case FCConstants.DISPATCH :
cell = new DispatchCell(userObject);
bounds = new Rectangle(point,boundsCube);
addCell(cell,viewMap,bounds);
addPort(cell,viewMap,FCConstants.PORTINPUT);
addPort(cell,viewMap, boundsPort_,FCConstants.PORTINPUT);
break;
case FCConstants.APPLYEXTERNAL :
cell = new ApplyExternalCell(userObject);
......@@ -546,15 +555,15 @@ public class ProcessGraph extends JGraph implements Comparator, Observer{
cell = new ApplyRulesetCell(userObject);
bounds = new Rectangle(point,boundsRect);
addCell(cell,viewMap,bounds);
addPort(cell,viewMap,FCConstants.PORTINPUT);
addPort(cell,viewMap,FCConstants.PORTOUTPUT);
addPort(cell,viewMap, boundsPort_,FCConstants.PORTINPUT);
addPort(cell,viewMap, boundsPort_,FCConstants.PORTOUTPUT);
break;
case FCConstants.APPLYQUERY :
cell = new ApplyQueryCell(userObject);
bounds = new Rectangle(point,boundsCube);
addCell(cell,viewMap,bounds);
addPort(cell,viewMap,FCConstants.PORTINPUT);
addPort(cell,viewMap,FCConstants.PORTOUTPUT);
addPort(cell,viewMap, boundsPort_,FCConstants.PORTINPUT);
addPort(cell,viewMap, boundsPort_,FCConstants.PORTOUTPUT);
break;
case FCConstants.PORTPROCESS :
cell = new PortProcessCell(userObject);
......@@ -578,47 +587,61 @@ public class ProcessGraph extends JGraph implements Comparator, Observer{
viewMap.put(cell, map);
}
public void addPort(DefaultGraphCell cell,Map viewMap,int type) {
public void addPort(DefaultGraphCell cell,Map viewMap,Rectangle bounds, int type) {
int index;
fr.fluxmedia.transmorpher.Graph.Port port=null;
int u = GraphConstants.PERCENT;
Map map = GraphConstants.createMap();
/*Call call = (Call)cell.getUserObject();
int indexIn = (call.inPorts().length()==0)?0:call.inPorts().length()-1;
String name = "C"+call.getId();
fr.fluxmedia.transmorpher.Graph.Port tPort = new fr.fluxmedia.transmorpher.Graph.Port(name,call,indexIn);*/
if (type==FCConstants.PORTOUTPUT){
//call.outPorts().addPort(tPort);
GraphConstants.setOffset(map, new Point(0,(int) (u/2)));}
else {
//call.inPorts().addPort(tPort);
GraphConstants.setOffset(map, new Point(u,(int) (u/2)));
GraphConstants.setSize(map, boundsPort);
GraphConstants.setOpaque(map, false);
Call call = (Call)cell.getUserObject();
switch (type) {
case FCConstants.PORTINPUT :
GraphConstants.setOffset(map, new Point(0,(int) (u/2)));
index = (call.inPorts().length()==0)?0:call.inPorts().length()-1;
port = new fr.fluxmedia.transmorpher.Graph.Port(null,call,index);
call.inPorts().addPort(port);
break;
case FCConstants.PORTOUTPUT :
GraphConstants.setOffset(map, new Point(u,(int) (u/2)));
index = (call.outPorts().length()==0)?0:call.outPorts().length()-1;
port = new fr.fluxmedia.transmorpher.Graph.Port(null,call,index);
call.outPorts().addPort(port);
break;
default : System.out.println("type de port inconnu : meth addPort");
}
PortCell port = new PortCell("");
cell.add(port);
viewMap.put(port, map);
PortCell pc = new PortCell(port,type);
viewMap.put(pc, map);
cell.add(pc);
}
/*
public void updatePorts(int type,DefaultGraphCell cell){
GraphView v = getView();
ArrayList children = getPorts(cell,type);
for (int i=0;i<children.size();i++) {
Map map = GraphConstants.createMap();
int u = GraphConstants.PERCENT;
Map attributes = new Hashtable();
if (type==FCConstants.PORTINPUT){
GraphConstants.setOffset(map,new Point(0,(int)(u*(i+1))/(children.size()+1)));
System.out.println(children.get(i));
CellView cellView = v.getMapping(children.get(i),true);
/* public void updatePorts(Object userObject,DefaultGraphCell cell){
GraphView v = getView();
ArrayList children = getPorts(cell,userObject);
attributes.put(cellView,map);
}
else {
GraphConstants.setOffset(map,new Point(u,(int)(u*(i+1))/(children.size()+1)));
System.out.println(children.get(i));
CellView cellView = v.getMapping(children.get(i),false);
for (int i=0;i<children.size();i++) {
Map map = GraphConstants.createMap();
int u = GraphConstants.PERCENT;
Map attributes = new Hashtable();
if (userObject.equals("input")){
GraphConstants.setOffset(map,new Point(0,(int)(u*(i+1))/(children.size()+1)));
CellView cellView = v.getMapping(children.get(i),false);
attributes.put(cellView,map);
}
else {
GraphConstants.setOffset(map,new Point(u,(int)(u*(i+1))/(children.size()+1)));
CellView cellView = v.getMapping(children.get(i),false);
attributes.put(cellView,map);
}
v.edit(attributes);
}
} */
attributes.put(cellView,map);
}
v.edit(attributes);
}
} */
/** add a Port to the Cell
*
......
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