Commit 30e76304 authored by Fabien Triolet's avatar Fabien Triolet
Browse files

Updated flowcomposer to allow it working with last version of Transmorpher

parent 21374435
/**
* $Id: ApplyExternalCell.java,v 1.3 2002-09-13 17:53:56 serge Exp $
* $Id: ApplyExternalCell.java,v 1.4 2002-12-12 10:25:58 triolet Exp $
*
* Transmorpher
*
......@@ -29,7 +29,7 @@ import com.jgraph.graph.DefaultGraphCell;
import java.util.Observer;
import java.util.Observable;
import fr.fluxmedia.transmorpher.Graph.Call;
import fr.fluxmedia.transmorpher.graph.Call;
/**
* The component ApplyExternal is represented by the <code>ApplyExternalCell</code>
......
/**
* $Id: FCGraphCell.java,v 1.4 2002-09-13 17:53:56 serge Exp $
* $Id: FCGraphCell.java,v 1.5 2002-12-12 10:25:58 triolet Exp $
*
* Transmorpher
*
......@@ -37,9 +37,9 @@ import com.jgraph.graph.ParentMap;
import com.jgraph.graph.GraphConstants;
import com.jgraph.graph.*;
import fr.fluxmedia.transmorpher.Graph.Call;
import fr.fluxmedia.transmorpher.Graph.CallImpl;
import fr.fluxmedia.transmorpher.Graph.Port;
import fr.fluxmedia.transmorpher.graph.Call;
import fr.fluxmedia.transmorpher.graph.CallImpl;
import fr.fluxmedia.transmorpher.graph.Port;
import fr.fluxmedia.transmorpher.action.TmAction;
import fr.fluxmedia.flowcomposer.utils.FCConstants;
......
/**
*
*$Id: FCGraphUI.java,v 1.5 2002-09-13 17:53:56 serge Exp $
*$Id: FCGraphUI.java,v 1.6 2002-12-12 10:25:58 triolet Exp $
*
* Transmorpher
*
......@@ -57,7 +57,7 @@ import com.jgraph.plaf.GraphUI;
import java.io.Serializable;
import com.jgraph.plaf.basic.BasicGraphUI;
import fr.fluxmedia.transmorpher.Graph.Call;
import fr.fluxmedia.transmorpher.graph.Call;
/**
* The <code>FCGraphUI</code> constitute JGraphs UI-delegate.Aside from the event
......@@ -312,7 +312,7 @@ public class FCGraphUI extends BasicGraphUI{
* The BasicGraphUI class maintains a reference to a RootHandle, which
* is used to react to mouse events. We overrides it for controlling the
* moving of cells with the workSurface . The user can't move the cells
* with (x<0||y<0) and we include the management for updating the size of
* with (x&lt;0||y&lt;0) and we include the management for updating the size of
* workSurface for other mouse events.
*/
class FCRootHandle extends BasicGraphUI.RootHandle{
......
/**
*
*$Id: FCPortView.java,v 1.4 2002-12-01 22:40:50 serge Exp $
*$Id: FCPortView.java,v 1.5 2002-12-12 10:25:58 triolet Exp $
*
* Transmorpher
*
......@@ -98,7 +98,7 @@ public class FCPortView extends PortView{
public void paint(Graphics g){
Dimension d = getSize();
Dimension d = this.getSize();
g.setClip(0, 0, d.width + 1, d.height + 1);
if (preview)
//The preview flag is interpreted differently in the PortRenderer than in all the other renderers.
......
/**
* $Id: FCProcessFactory.java,v 1.8 2002-09-16 16:11:35 gchomat Exp $
* $Id: FCProcessFactory.java,v 1.9 2002-12-12 10:25:58 triolet Exp $
*
* Transmorpher
*
......@@ -30,11 +30,10 @@ import java.util.*;
import com.jgraph.graph.*;
//import Transmorpher
import fr.fluxmedia.transmorpher.Graph.Process;
import fr.fluxmedia.transmorpher.Graph.*;
import fr.fluxmedia.transmorpher.Utils.*;
import fr.fluxmedia.transmorpher.Files.*;
import fr.fluxmedia.transmorpher.Parser.ProcessParser;
import fr.fluxmedia.transmorpher.graph.Process;
import fr.fluxmedia.transmorpher.graph.*;
import fr.fluxmedia.transmorpher.utils.*;
import fr.fluxmedia.transmorpher.parser.ProcessParser;
import fr.fluxmedia.transmorpher.action.*;
import fr.fluxmedia.flowcomposer.gui.FlowComposer;
......@@ -200,7 +199,7 @@ public class FCProcessFactory implements Observer,Serializable{
}
else
{
process = new fr.fluxmedia.transmorpher.Graph.Main(FCConstants.DEFAULT_MAIN_NAME,transmorpher);
process = new fr.fluxmedia.transmorpher.graph.Main(FCConstants.DEFAULT_MAIN_NAME,transmorpher);
transmorpher.setMain((MainProcess)process);
transmorpher.addTransformation(FCConstants.DEFAULT_MAIN_NAME,process);
}
......@@ -208,7 +207,7 @@ public class FCProcessFactory implements Observer,Serializable{
case FCConstants.PROCESS:
String name = getDefaultProcessName(0);
process = new fr.fluxmedia.transmorpher.Graph.Process(name,transmorpher);
process = new fr.fluxmedia.transmorpher.graph.Process(name,transmorpher);
transmorpher.addTransformation(name,process);
break;
......@@ -452,15 +451,15 @@ public class FCProcessFactory implements Observer,Serializable{
}
/** Generate the chart graphical file for all the process*/
public void generateFileRDF(String filename) {
public void generateFileRDF(String filename) throws java.io.IOException{
ReadWrite file = new ReadWrite(filename,ReadWrite.WRITE);
fr.fluxmedia.transmorpher.utils.Writer file = new fr.fluxmedia.transmorpher.utils.Writer(filename);
file.Writeln("<?xml version=\"1.0\" standalone=\"yes\"?>");
file.Writeln("<rdf:RDF");
file.Writeln(4,"xmlns:rdf=\"http://www.w3.org/1999/02/22-rdf-syntax-ns\"");
file.Writeln(4,"xmlns:s=\"http://www.w3.org/2000/01/rdf-schema\">");
file.Writeln(6,"<rdf:Description about=\""+transmorpher.getName()+"\">");
file.writeln("<?xml version=\"1.0\" standalone=\"yes\"?>");
file.writeln("<rdf:RDF");
file.writeln(4,"xmlns:rdf=\"http://www.w3.org/1999/02/22-rdf-syntax-ns\"");
file.writeln(4,"xmlns:s=\"http://www.w3.org/2000/01/rdf-schema\">");
file.writeln(6,"<rdf:Description about=\""+transmorpher.getName()+"\">");
Iterator it = getAllProcess().iterator();
while (it.hasNext()) {
......@@ -468,9 +467,9 @@ public class FCProcessFactory implements Observer,Serializable{
((ProcessGraph)process).generateRDF(file);
}
file.Writeln(6,"</rdf:Description>");
file.Writeln(4,"</rdf:RDF>");
file.Close();
file.writeln(6,"</rdf:Description>");
file.writeln(4,"</rdf:RDF>");
file.close();
}
......
/**
* $Id: MergeCell.java,v 1.3 2002-09-13 17:53:56 serge Exp $
* $Id: MergeCell.java,v 1.4 2002-12-12 10:25:58 triolet Exp $
*
* Transmorpher
*
......@@ -26,7 +26,7 @@ package fr.fluxmedia.flowcomposer.graph;
import com.jgraph.graph.DefaultGraphCell;
import fr.fluxmedia.transmorpher.Graph.*;
import fr.fluxmedia.transmorpher.graph.*;
import java.util.Observer;
import java.util.Observable;
......
/**
* $Id: NormalEdge.java,v 1.4 2002-09-13 17:53:56 serge Exp $
* $Id: NormalEdge.java,v 1.5 2002-12-12 10:25:58 triolet Exp $
*
* Transmorpher
*
......@@ -25,8 +25,8 @@ package fr.fluxmedia.flowcomposer.graph;
import com.jgraph.graph.DefaultEdge;
import com.jgraph.graph.DefaultPort;
import fr.fluxmedia.transmorpher.Graph.Channel;
import fr.fluxmedia.transmorpher.Graph.Port;
import fr.fluxmedia.transmorpher.graph.Channel;
import fr.fluxmedia.transmorpher.graph.Port;
/**
......
/**
* $Id: NormalEdgeView.java,v 1.6 2002-09-13 17:53:56 serge Exp $
* $Id: NormalEdgeView.java,v 1.7 2002-12-12 10:25:58 triolet Exp $
*
* Transmorpher
*
......@@ -38,7 +38,7 @@ import com.jgraph.graph.DefaultPort;
import com.jgraph.graph.CellViewRenderer;
import com.jgraph.graph.*;
import fr.fluxmedia.transmorpher.Graph.Channel;
import fr.fluxmedia.transmorpher.graph.Channel;
import java.awt.*;
import java.awt.event.*;
......@@ -100,11 +100,11 @@ public class NormalEdgeView extends EdgeView{
* Sets the <code>sourceView</code> of the edge.
*/
public void setSource(PortView sourceView) {
fr.fluxmedia.transmorpher.Graph.Port oldPort = null;
fr.fluxmedia.transmorpher.graph.Port oldPort = null;
if(source != null)
{
DefaultGraphCell cell = (DefaultGraphCell)source.getCell();
oldPort = (fr.fluxmedia.transmorpher.Graph.Port)cell.getUserObject();
oldPort = (fr.fluxmedia.transmorpher.graph.Port)cell.getUserObject();
}
else if(oldPort != null)
......@@ -121,11 +121,11 @@ public class NormalEdgeView extends EdgeView{
* Sets the <code>targetView</code> of the edge.
*/
public void setTarget(PortView targetView) {
fr.fluxmedia.transmorpher.Graph.Port oldPort = null;
fr.fluxmedia.transmorpher.graph.Port oldPort = null;
if(target != null)
{
DefaultGraphCell cell = (DefaultGraphCell)target.getCell();
oldPort = (fr.fluxmedia.transmorpher.Graph.Port)cell.getUserObject();
oldPort = (fr.fluxmedia.transmorpher.graph.Port)cell.getUserObject();
}
else if(oldPort != null)
oldPort.setChannel(null);
......@@ -200,7 +200,7 @@ public class NormalEdgeView extends EdgeView{
{
Channel tChannel = (Channel)((DefaultGraphCell)channel).getUserObject();
DefaultPort portSource = (DefaultPort)channel.getSource();
fr.fluxmedia.transmorpher.Graph.Port tPort = (fr.fluxmedia.transmorpher.Graph.Port)((DefaultGraphCell)port).getUserObject();
fr.fluxmedia.transmorpher.graph.Port tPort = (fr.fluxmedia.transmorpher.graph.Port)((DefaultGraphCell)port).getUserObject();
tChannel.setIn(tPort);
}
}
......@@ -212,7 +212,7 @@ public class NormalEdgeView extends EdgeView{
if(channel instanceof DefaultGraphCell && port instanceof DefaultGraphCell){
Channel tChannel = (Channel)((DefaultGraphCell)channel).getUserObject();
DefaultPort portTarget = (DefaultPort)channel.getTarget();
fr.fluxmedia.transmorpher.Graph.Port tPort = (fr.fluxmedia.transmorpher.Graph.Port)((DefaultGraphCell)port).getUserObject();
fr.fluxmedia.transmorpher.graph.Port tPort = (fr.fluxmedia.transmorpher.graph.Port)((DefaultGraphCell)port).getUserObject();
tChannel.setOut(tPort);
}
}
......
/**
* $Id: ProcessGraph.java,v 1.12 2002-09-13 17:53:56 serge Exp $
* $Id: ProcessGraph.java,v 1.13 2002-12-12 10:25:58 triolet Exp $
*
* Transmorpher
*
* Copyright (C) 2002 Fluxmedia.
* Copyright (C) 2002 Fluxmedia.
*
* http://www.fluxmedia.fr
* http://www.fluxmedia.fr
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
......@@ -39,22 +39,21 @@ import java.io.*;
import javax.swing.*;
import javax.swing.undo.UndoManager;
import fr.fluxmedia.transmorpher.Graph.*;
import fr.fluxmedia.transmorpher.Graph.Process;
import fr.fluxmedia.transmorpher.Graph.Call;
import fr.fluxmedia.transmorpher.Graph.Merge;
import fr.fluxmedia.transmorpher.Graph.Dispatch;
import fr.fluxmedia.transmorpher.Graph.Serialize;
import fr.fluxmedia.transmorpher.Graph.Generate;
import fr.fluxmedia.transmorpher.Graph.ApplyProcess;
import fr.fluxmedia.transmorpher.Graph.ApplyRuleset;
import fr.fluxmedia.transmorpher.Graph.ApplyExternal;
import fr.fluxmedia.transmorpher.Graph.ApplyQuery;
import fr.fluxmedia.transmorpher.Graph.CallImpl;
import fr.fluxmedia.transmorpher.Graph.Port;
import fr.fluxmedia.transmorpher.Graph.TransformationImpl;
import fr.fluxmedia.transmorpher.Graph.Channel;
import fr.fluxmedia.transmorpher.Files.*;
import fr.fluxmedia.transmorpher.graph.*;
import fr.fluxmedia.transmorpher.graph.Process;
import fr.fluxmedia.transmorpher.graph.Call;
import fr.fluxmedia.transmorpher.graph.Merge;
import fr.fluxmedia.transmorpher.graph.Dispatch;
import fr.fluxmedia.transmorpher.graph.Serialize;
import fr.fluxmedia.transmorpher.graph.Generate;
import fr.fluxmedia.transmorpher.graph.ApplyProcess;
import fr.fluxmedia.transmorpher.graph.ApplyRuleset;
import fr.fluxmedia.transmorpher.graph.ApplyExternal;
import fr.fluxmedia.transmorpher.graph.ApplyQuery;
import fr.fluxmedia.transmorpher.graph.CallImpl;
import fr.fluxmedia.transmorpher.graph.Port;
import fr.fluxmedia.transmorpher.graph.TransformationImpl;
import fr.fluxmedia.transmorpher.graph.Channel;
import fr.fluxmedia.transmorpher.action.TmActionImpl;
import fr.fluxmedia.flowcomposer.utils.*;
......@@ -1534,24 +1533,24 @@ public class ProcessGraph extends JGraph implements Comparator, Observer{
/**
* write a RDF file which is the graphical chart of a process
*/
public void generateRDF(ReadWrite file) {
public void generateRDF(fr.fluxmedia.transmorpher.utils.Writer file) throws java.io.IOException{
Object[] cells = getAll();
file.Writeln(6,"<hasProcess>");
file.Writeln(8,"<rdf:Description about=\""+((Process)userObject).getName()+"\">");
file.writeln(6,"<hasProcess>");
file.writeln(8,"<rdf:Description about=\""+((Process)userObject).getName()+"\">");
for (int i = 0; i < cells.length; i++){
if (cells[i] instanceof DefaultEdge)
ChannelRDF(cells[i],file);
else if (!(cells[i] instanceof PortProcessCell)&&(!(cells[i] instanceof PortCell)))
CellRDF(cells[i],file);
}
file.Writeln(8,"</rdf:Description>");
file.Writeln(6,"</hasProcess>");
file.writeln(8,"</rdf:Description>");
file.writeln(6,"</hasProcess>");
}
/**
* RDF representation of a cell
*/
public void CellRDF(Object cell,ReadWrite file) {
public void CellRDF(Object cell,fr.fluxmedia.transmorpher.utils.Writer file) throws java.io.IOException{
Rectangle rect = getCellBounds(cell);
String x = (new Integer(rect.x)).toString();
String y = (new Integer(rect.y)).toString();
......@@ -1560,38 +1559,38 @@ public class ProcessGraph extends JGraph implements Comparator, Observer{
CellView cellview = v.getMapping(cell,false);
Map map = cellview.getAttributes();
Color color = GraphConstants.getBorderColor(map);
file.Writeln(10,"<hasComponent>");
file.Writeln(12,"<rdf:Description about=\""+call.toString()+"\">");
//file.Writeln(14,"<s:color>"+color.toString()+"</s:color>");
file.Writeln(14,"<s:x>"+x+"</s:x>");
file.Writeln(14,"<s:y>"+y+"</s:y>");
file.Writeln(12,"</rdf:Description>");
file.Writeln(10,"</hasComponent>");
file.writeln(10,"<hasComponent>");
file.writeln(12,"<rdf:Description about=\""+call.toString()+"\">");
//file.writeln(14,"<s:color>"+color.toString()+"</s:color>");
file.writeln(14,"<s:x>"+x+"</s:x>");
file.writeln(14,"<s:y>"+y+"</s:y>");
file.writeln(12,"</rdf:Description>");
file.writeln(10,"</hasComponent>");
}
/**
* RDF represenattion of a channel
*/
public void ChannelRDF(Object cell,ReadWrite file) {
public void ChannelRDF(Object cell,fr.fluxmedia.transmorpher.utils.Writer file) throws java.io.IOException{
Object userObject = ((DefaultGraphCell)cell).getUserObject();
GraphView v = getView();
CellView cellview = v.getMapping(cell,false);
Map map = cellview.getAttributes();
file.Writeln(10,"<hasChannel>");
file.Writeln(12,"<rdf:Description about=\""+userObject.toString()+"\">");
file.Writeln(14,"<s:points>");
file.writeln(10,"<hasChannel>");
file.writeln(12,"<rdf:Description about=\""+userObject.toString()+"\">");
file.writeln(14,"<s:points>");
if(cellview instanceof EdgeView){
int nbPoint = ((EdgeView)cellview).getPointCount();
Point point ;
for(int i=0;i < nbPoint;i++){
point =((EdgeView)cellview).getPoint(i);
file.Writeln(17,"<s:point x=\""+point.x +"\" y=\""+point.y +"\"/>");
file.writeln(17,"<s:point x=\""+point.x +"\" y=\""+point.y +"\"/>");
}
point = null;
}
file.Writeln(14,"</s:points>");
file.Writeln(12,"</rdf:Description>");
file.Writeln(10,"</hasChannel>");
file.writeln(14,"</s:points>");
file.writeln(12,"</rdf:Description>");
file.writeln(10,"</hasChannel>");
}
......
/**
*
*$Id: CallProperties.java,v 1.9 2002-09-13 17:53:56 serge Exp $
*$Id: CallProperties.java,v 1.10 2002-12-12 10:25:58 triolet Exp $
*
* Transmorpher
*
......@@ -31,11 +31,10 @@ import com.jgraph.JGraph;
import com.jgraph.graph.*;
//import Transmorpher
import fr.fluxmedia.transmorpher.Graph.Process;
import fr.fluxmedia.transmorpher.Graph.*;
import fr.fluxmedia.transmorpher.Utils.*;
import fr.fluxmedia.transmorpher.Files.*;
import fr.fluxmedia.transmorpher.Parser.ProcessParser;
import fr.fluxmedia.transmorpher.graph.Process;
import fr.fluxmedia.transmorpher.graph.*;
import fr.fluxmedia.transmorpher.utils.*;
import fr.fluxmedia.transmorpher.parser.ProcessParser;
import javax.swing.*;
import javax.swing.table.DefaultTableModel;
......
/**
*
*$Id: ExternalDialog.java,v 1.1 2002-12-12 10:25:58 triolet Exp $
*
* Transmorpher
*
* Copyright (C) 2002 Fluxmedia.
*
* http://www.fluxmedia.fr
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
package fr.fluxmedia.flowcomposer.gui;
import javax.swing.*;
import java.awt.event.*;
import java.awt.*;
import javax.swing.border.*;
import fr.fluxmedia.flowcomposer.gui.guitools.*;
import fr.fluxmedia.transmorpher.utils.LinearIndexedStruct;
import javax.swing.table.DefaultTableModel;
import fr.fluxmedia.flowcomposer.graph.*;
public class ExternalDialog extends JDialog implements ActionListener{
protected Container contentPane;
protected JButton ok;
protected JButton cancel;
protected JButton newExtern;
protected JButton deleteExtern;
protected DefaultTableModel tableModel;
protected JTable externTable;
protected FCProcessFactory processFactory;
public ExternalDialog(FlowComposer flow,LinearIndexedStruct externs){
super(flow.getFrame(),"External type",true);
this.setLocationRelativeTo(flow.getFrame());
processFactory=flow.getProcessFactory();
contentPane = getContentPane();
contentPane.setLayout(new BorderLayout());
ok = new JButton("OK");
ok.addActionListener(this);
cancel = new JButton("CANCEL");
JPanel externalPanel = new JPanel();
externalPanel.setPreferredSize(new Dimension(300,300));
Border titleParam=BorderFactory.createEtchedBorder();
externTable = new ExternTable(externs);
tableModel = (DefaultTableModel)externTable.getModel();
JScrollPane scrollTable = new JScrollPane(externTable);
scrollTable.setPreferredSize(new Dimension(250,200));
newExtern = new JButton("Add");
newExtern.addActionListener(this);
deleteExtern = new JButton("Delete");
deleteExtern.addActionListener(this);
JPanel externPanel = new JPanel();
externPanel.setLayout(new GridLayout(0,1,0,5));
externPanel.add(newExtern);
externPanel.add(deleteExtern);
JPanel pane = new JPanel();
pane.setLayout(new FlowLayout(FlowLayout.LEFT,20,5));
pane.add(scrollTable);
pane.add(externPanel);
pane.setBorder(BorderFactory.createTitledBorder(titleParam,"test"));
JPanel buttonPanel = new JPanel();
buttonPanel.setLayout(new FlowLayout(FlowLayout.RIGHT));
buttonPanel.add(ok);
buttonPanel.add(cancel);
contentPane.add(pane,BorderLayout.CENTER);
contentPane.add(buttonPanel,BorderLayout.SOUTH);
this.pack();
this.setVisible(true);
}
public void actionPerformed(ActionEvent event){
if(event.getSource() == newExtern){
String[] stringNull= {"",""};
tableModel.addRow(stringNull);
}
if(event.getSource() == deleteExtern){
int[] index = externTable.getSelectedRows();
int nb = 0;
if(externTable.getCellEditor() != null)
externTable.getCellEditor().stopCellEditing();
for (int i = 0; i < index.length ; i++) {
String name = (String)tableModel.getValueAt(index[i]-nb,0);
tableModel.removeRow(index[i]-nb);
if(processFactory.getTransmorpher().getExtern(name)!=null)
processFactory.getTransmorpher().removeExtern(name);
nb++;
}
}
if(event.getSource() == ok ) {
for (int i=0;i<tableModel.getRowCount();i++) {
String name = (String)tableModel.getValueAt(i,0);
String value = (String)tableModel.getValueAt(i,1);
if (name != null && ! (name.equals("")) )
if(processFactory.getTransmorpher().getExtern(name)==null)
processFactory.getTransmorpher().addExtern(name,value,"",false);
}
this.dispose();
}
}
}
/**
* $Id: FCMarqueeHandler.java,v 1.13 2002-09-13 17:53:56 serge Exp $
* $Id: FCMarqueeHandler.java,v 1.14 2002-12-12 10:25:58 triolet Exp $
*
* Transmorpher
*
......@@ -24,16 +24,16 @@
package fr.fluxmedia.flowcomposer.gui;
import fr.fluxmedia.transmorpher.Graph.Call;
import fr.fluxmedia.transmorpher.graph.Call;
import com.jgraph.JGraph;
import com.jgraph.graph.*;
import fr.fluxmedia.transmorpher.Graph.Process;
import fr.fluxmedia.transmorpher.Graph.Port;
import fr.fluxmedia.transmorpher.Graph.Channel;
import fr.fluxmedia.transmorpher.Graph.*;
import fr.fluxmedia.transmorpher.Utils.*;
import fr.fluxmedia.transmorpher.graph.Process;
import fr.fluxmedia.transmorpher.graph.Port;
import fr.fluxmedia.transmorpher.graph.Channel;
import fr.fluxmedia.transmorpher.graph.*;
import fr.fluxmedia.transmorpher.utils.*;
import javax.swing.*;
import com.jgraph.JGraph;
......