Commit 722070f7 authored by Guillaume Chomat's avatar Guillaume Chomat
Browse files

continue the implementation of RDF parsing

parent 64973676
/**
* $Id: FCProcessFactory.java,v 1.15 2002-07-02 13:46:43 gchomat Exp $
* $Id: FCProcessFactory.java,v 1.16 2002-07-03 09:11:25 gchomat Exp $
*
* Transmorpher
*
......@@ -114,11 +114,11 @@ public class FCProcessFactory implements ProcessFactory,Observer{
for(int i =0; i < ((Process)userObject).inPorts().length();i++)
{
process.update((Process)userObject,((Process)userObject).inPorts().getPort(i));
process.update((Process)userObject,new TmActionImpl(TmActionImpl.ADD,userObject,((Process)userObject).inPorts().getPort(i),null,null));
}
for(int j =0; j < ((Process)userObject).outPorts().length();j++)
{
process.update((Process)userObject,((Process)userObject).outPorts().getPort(j));
process.update((Process)userObject,new TmActionImpl(TmActionImpl.ADD,userObject,((Process)userObject).outPorts().getPort(j),null,null));
}
}
listProcess.add(process);
......@@ -147,9 +147,22 @@ public class FCProcessFactory implements ProcessFactory,Observer{
Enumeration channels = transformation.getChannels();
while(channels.hasMoreElements())
processGraph.update(transformation,new TmActionImpl(TmActionImpl.ADD,transformation,channels.nextElement(),null,null));
processGraph.update(transformation,new TmActionImpl(TmActionImpl.ADD,transformation,channels.nextElement(),null,null));
}
public void updateCellProcess(){
Iterator it = listProcess.iterator();
while(it.hasNext())
{
ProcessGraph process = (ProcessGraph)it.next();
if(!(process.getUserObject() instanceof MainProcess) && (process.getUserObject() instanceof Process))
process.updateCellProcess();
}
}
public ProcessGraph getProcessGraph(Object userObject){
Iterator it = listProcess.iterator();
......
/**
*
*$Id: FlowComposer.java,v 1.60 2002-07-02 13:46:43 gchomat Exp $
*$Id: FlowComposer.java,v 1.61 2002-07-03 09:11:25 gchomat Exp $
*
* Transmorpher
*
......@@ -276,10 +276,10 @@ public class FlowComposer extends JPanel implements GraphModelListener,
if(filename != null)
{
init_main = false;
ProcessParser parser = new ProcessParser(2,new Object[]{processFactory});
ProcessParser parser = new ProcessParser(3,new Object[]{processFactory});
transmorpher = parser.Newparse(filename);
//transmorpher.generateXML();
processFactory.createAllChannels();
processFactory.updateCellProcess();
this.editing = true;
}
else
......@@ -560,8 +560,9 @@ public class FlowComposer extends JPanel implements GraphModelListener,
tabProcess.setSelectedComponent(sp);
//componentResized(null);
currentProcess.setPreferredSize(new Dimension(PREFERRED_WIDTH,PREFERRED_HEIGHT));
currentProcess.setBorder(loweredbevel);
currentProcess.setBackground(Color.WHITE);
currentProcess.setBackground(Color.white);
undoHandler.setProcess(currentProcess);
JButton buttonView = new JButton("VG");
sp.setCorner(JScrollPane.LOWER_RIGHT_CORNER,buttonView);
......@@ -1757,22 +1758,23 @@ public class FlowComposer extends JPanel implements GraphModelListener,
int returnVal=fc.showOpenDialog(flow);
if (returnVal == JFileChooser.APPROVE_OPTION) {
File file = fc.getSelectedFile();
if (editing)
if (editing)
{
newEditor(file.getAbsolutePath());
}
else
{
ProcessParser processParser = new ProcessParser(2,new Object[]{processFactory});
ProcessParser processParser = new ProcessParser(3,new Object[]{processFactory});
transmorpher = processParser.Newparse(file.getAbsolutePath());
processFactory.createAllChannels();
filename = file.getAbsolutePath();
setTitle(filename);
ParserRDF rdfParser = new ParserRDF(processFactory);
rdfParser.newParse(filename.substring(0,filename.lastIndexOf('.'))+".rdf");
editing = true;
}
}
ParserRDF rdfParser = new ParserRDF(processFactory);
rdfParser.newParse(filename.substring(0,filename.lastIndexOf('.'))+".rdf");
editing = true;
}
else {
......
......@@ -98,8 +98,7 @@ public class ParserRDF extends DefaultHandler {
public final void startElement(String namespaceURI, String localName, String qname, Attributes atts) {
//System.out.println(localName);
if (namespaceURI.equals("http://www.w3.org/1999/02/22-rdf-syntax-ns"))
{
{
if (localName.equals("Description")) {
String name = atts.getValue("about");
......@@ -108,19 +107,19 @@ public class ParserRDF extends DefaultHandler {
case COMPONENT :
if(currentProcess != null)
currentCall = currentProcess.getCell(name);
System.out.println("currentCall "+currentCall);
//System.out.println("currentCall "+currentCall);
break;
case PROCESS :
if(processFactory != null)
currentProcess = processFactory.getProcess(name);
System.out.println("currentProcess "+currentProcess);
//System.out.println("currentProcess "+currentProcess);
break;
case CHANNEL :
if(currentProcess != null)
currentChannel = currentProcess.getEdge(name);
System.out.println("currentChannel " + currentChannel );
//System.out.println("currentChannel " + currentChannel );
break;
}
......@@ -205,14 +204,6 @@ public class ParserRDF extends DefaultHandler {
}
}
public void print() {
System.out.println("start Print ");
for (Enumeration e = process.elements() ; e.hasMoreElements() ;) {
System.out.println(e.nextElement());
}
}
public void warning(SAXParseException exception)
throws SAXException
{
......
/**
* $Id: ProcessGraph.java,v 1.42 2002-07-02 13:46:43 gchomat Exp $
* $Id: ProcessGraph.java,v 1.43 2002-07-03 09:11:25 gchomat Exp $
*
* Transmorpher
*
......@@ -73,6 +73,7 @@ public class ProcessGraph extends JGraph implements Comparator, Observer{
protected transient Paper pageFormat = new Paper();
protected DefaultGraphCell pCell = null;
/** boundsCube define the dimension of a squared form composant such as ApplyQuery, Merge and Dispatch.
* ie: this composant are included in square boxe
*/
......@@ -85,6 +86,13 @@ public class ProcessGraph extends JGraph implements Comparator, Observer{
* ie: this composant are included in rectangle boxe
*/
static Dimension boundsRect = new Dimension(70,60);
/**Default width of the app*/
public static final int PREFERRED_WIDTH =640;
/**Default height of the app*/
public static final int PREFERRED_HEIGHT =480;
ArrayList tmp =null;
......@@ -252,6 +260,7 @@ public class ProcessGraph extends JGraph implements Comparator, Observer{
switch(action.getType())
{
case TmActionImpl.ADD :
Object target = action.getTarget();
if(target instanceof Call){
......@@ -288,51 +297,25 @@ public class ProcessGraph extends JGraph implements Comparator, Observer{
if(in != null && out!=null)
{
Point current = null;
Point start = null;
if(marquee instanceof FCMarqueeHandler && ((FCMarqueeHandler)marquee).getCurrentPoint()!= null)
current= new Point(((FCMarqueeHandler)marquee).getCurrentPoint());
if(marquee instanceof FCMarqueeHandler && ((FCMarqueeHandler)marquee).getStartPoint()!= null)
start= new Point(((FCMarqueeHandler)marquee).getStartPoint());
Point p =new Point(10,45);
Point p2 = new Point(10,45);
if(start != null)
p = fromScreen(new Point(start));
if(current!=null)
p2 = toScreen(new Point(current));
ArrayList list = new ArrayList();
list.add(p);
list.add(p2);
Map map = GraphConstants.createMap();
GraphConstants.setPoints(map, list);
Map viewMap = new Hashtable();
DefaultEdge cell = new DefaultEdge((Channel)target);
viewMap.put(cell, map);
Object[] insert = new Object[]{cell};
ConnectionSet cs = new ConnectionSet();
PortView firstPort =null;
PortView port =null;
if(current!=null || start != null)
firstPort = getPort(in);
port = getPort(out);
if(port != null && firstPort !=null)
{
firstPort =((FCMarqueeHandler) marquee).getFirstPort();
port =((FCMarqueeHandler) marquee).getSecondPort();
cs.connect(cell, firstPort.getCell(), true);
cs.connect(cell, port.getCell(), false);
getModel().insert(insert, cs, null, null);
}
else{
firstPort = getPort(in);
port = getPort(out);
}
cs.connect(cell, firstPort.getCell(), true);
cs.connect(cell, port.getCell(), false);
getModel().insert(insert, cs, null, viewMap);
//getModel().insert(insert, cs, null, viewMap);
}
}
else
......@@ -492,7 +475,7 @@ public class ProcessGraph extends JGraph implements Comparator, Observer{
while (it.hasNext())
{
DefaultGraphCell portCell = (DefaultGraphCell)it.next();
if(portCell.getUserObject().equals( userObject ))
if(portCell.getUserObject().equals(userObject ))
return (PortView)getView().getMapping(portCell,false);
}
......@@ -1063,11 +1046,21 @@ public class ProcessGraph extends JGraph implements Comparator, Observer{
}
public void updateCellProcess(){
updateCellProcess(FCConstants.PORTOUTPUT);
updateCellProcess(FCConstants.PORTINPUT);
}
public void updateCellProcess(int portLocation){
GraphView v = getView();
Rectangle rect = getBounds();
//System.out.println("update cell process "+portLocation+" bounds " +getBounds());
ArrayList cell = getCellProcess(portLocation);
Rectangle rect ;
if(getHeight() == 0)
rect = new Rectangle(new Dimension(PREFERRED_WIDTH,PREFERRED_HEIGHT));
else
rect = getBounds();
ArrayList cell = getCellProcess(portLocation);
for (int i=0;i<cell.size();i++) {
......
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