Commit 419b16e8 authored by Guillaume Chomat's avatar Guillaume Chomat
Browse files

now the editcall class is more generique

parent 24858746
......@@ -59,12 +59,11 @@
<para>Les services correspondent à toutes les fonctionnalitées permises par FlowComposer. Ces services vont s'éterndre au fil des années. Certains d'entre eux seront directement lié aux services proposées par Transmorpher. Toute modification, suppression ou ajout de service pour les nouvelles versions de Transmorpher devra être aisément répercutable sur FlowComposer et ne devra pas entrainé de disfonctionnalité majeur. A une version de FlowComposer correspondra une version de Transmorpher.</para>
<para></para>
<section><title>La barre de Menu</title>
<section id="file"><title>File</title>
<section id="load"><title>load</title>
<para>Charge une composition de transformation locale. Dans le cas où le fichier chargé est invalidé par rapport à la DTD du transmorpher, un message d'erreur devra informer à l'utilisateur du problème.</para>
<para>Ouvre une fenêtre permattant de choisir une composition de transformation à charger.Cette fenêtre est composé d'un champ texte permettant de rentrer l'URL du fichier à charger, d'un boutton ouvrant L'utilisateur charger un document localement, soit à distance Dans le cas où le fichier chargé est invalidé par rapport à la DTD du transmorpher, un message d'erreur devra informer à l'utilisateur du problème.</para>
</section>
......@@ -345,4 +344,21 @@
<para></para>
</section>
</article>
\ No newline at end of file
<!-- Keep this comment at the end of the file
Local variables:
mode: xml
sgml-omittag:nil
sgml-shorttag:nil
sgml-namecase-general:nil
sgml-general-insert-case:lower
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:2
sgml-indent-data:t
sgml-parent-document:nil
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
-->
/**
* $Id: FCConstants.java,v 1.3 2002-05-29 16:20:21 frederic Exp $
* $Id: FCConstants.java,v 1.4 2002-05-29 16:24:24 gchomat Exp $
*
* Transmorpher
*
......@@ -29,28 +29,153 @@
package fr.fluxmedia.flowcomposer;
import java.util.Hashtable;
public class FCConstants{
public static final String NMERGE = "Merge";
public static final String NGENERATE = "Generate";
public static final String NSERIALIZE = "Serialize";
public static final String NDISPATCH = "Dispatch";
public static final String NAPPLYQUERY = "ApplyQuery";
public static final String NAPPLYPROCESS = "ApplyProcess";
public static final String NAPPLYEXTERNAL= "ApplyExternal";
public static final String NAPPLYRULESET = "ApplyRuleset";
public static final int MERGE =0;
public static final int GENERATE =1;
public static final int SERIALYSE =2;
public static final int SERIALIZE =2;
public static final int DISPATCH =3;
public static final int APPLYEXTERNAL =4;
public static final int APPLYPROCESS =5;
public static final int APPLYRULESET =6;
public static final int APPLYQUERY =7;
public static final int PORTPROCESS =8;
public static final Object[] MERGETYPE = new Object[]{"concat"};
public static final Object[] DISPATCHTYPE = new Object[]{"broadcast"};
public static final Object[] SERIALIZETYPE = new Object[]{"writeFile"};
public static final Object[] GENERATETYPE = new Object[]{"readFile"};
public static final Object[] APPLYQUERYTYPE = new Object[]{"tmq"};
public static final Object[] APPLYEXTERNALTYPE= new Object[]{"xslt"};
public static final Object[] STRATEGYRULESET = new Object[]{"top-down"};
public static String getCallClass(int className){
String name;
switch(className){
case MERGE :
name = NMERGE;
break;
case GENERATE :
name = NGENERATE;
break;
case APPLYPROCESS :
name = NAPPLYPROCESS;
break;
case APPLYQUERY :
name = NAPPLYQUERY;
break;
case APPLYRULESET :
name = NAPPLYRULESET;
break;
case APPLYEXTERNAL :
name = NAPPLYEXTERNAL;
break;
case SERIALIZE :
name = NSERIALIZE;
break;
case DISPATCH :
name = NDISPATCH;
break;
default : name = "unknow Call";
}
return name;
}
public static Object[] getListType(int type){
Object[] list;
public static final Object[] mergeType = new Object[]{"concat"};
public static final Object[] dispatchType = new Object[]{"broadcast"};
switch(type){
case MERGE : list = MERGETYPE;
break;
case GENERATE : list = GENERATETYPE;
break;
case APPLYPROCESS : list = null;
break;
case APPLYQUERY : list = APPLYQUERYTYPE;
break;
case APPLYRULESET : list = null;
break;
case APPLYEXTERNAL : list = APPLYEXTERNALTYPE;
break;
case SERIALIZE : list = SERIALIZETYPE;
break;
case DISPATCH : list = DISPATCHTYPE;
break;
default : list = null;
}
return list;
}
public static Hashtable defaultAttributes(int type){
public static final Object[] serialyseType = new Object[]{"writeFile"};
public static final Object[] generateType = new Object[]{"readFile"};
Hashtable attributes = new Hashtable();
public static final Object[] applyqueryType = new Object[]{"tmq"};
public static final Object[] applyexternalType= new Object[]{"xslt"};
switch(type){
case MERGE :
attributes.put("id","Merge");
attributes.put("type",MERGETYPE[0]);
break;
case GENERATE :
attributes.put("id","Generate");
attributes.put("type",GENERATETYPE[0]);
attributes.put("file","");
break;
case APPLYPROCESS :
attributes.put("id","A-P");
attributes.put("ref","");
break;
case APPLYQUERY :
attributes.put("id","A-Q");
attributes.put("ref","");
break;
case APPLYRULESET :
attributes.put("id","A-R");
attributes.put("ref","");
attributes.put("strategy",STRATEGYRULESET[0]);
break;
case APPLYEXTERNAL :
attributes.put("id","A-E");
attributes.put("type",APPLYEXTERNALTYPE[0]);
attributes.put("file","");
break;
case SERIALIZE :
attributes.put("id","Serialize");
attributes.put("type",SERIALIZETYPE[0]);
attributes.put("file","");
break;
case DISPATCH :
attributes.put("id","Dispatch");
attributes.put("type",DISPATCHTYPE[0]);
break;
default : attributes = null;
}
return attributes;
}
}
/**
* $Id: FCMarqueeHandler.java,v 1.14 2002-05-29 16:20:21 frederic Exp $
* $Id: FCMarqueeHandler.java,v 1.15 2002-05-29 16:24:24 gchomat Exp $
*
* Transmorpher
*
......@@ -58,6 +58,7 @@ 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;
......@@ -190,63 +191,79 @@ public class FCMarqueeHandler extends BasicMarqueeHandler {
}
else if (generate.isSelected())
{
currentCall = new Generate("generate"+count,"readfile",currentTransformation,1,"/local_home/gchomat/transmorpher/samples/biblio/input/bibexmo.xml");
dialog = new EditCall((JFrame)(currentProcess.getTopLevelAncestor()),(ProcessGraph)currentProcess,null,start,FCConstants.GENERATE);
/*currentCall = new Generate("generate"+count,"readfile",currentTransformation,1,"/local_home/gchomat/transmorpher/samples/biblio/input/bibexmo.xml");
if(((ProcessGraph)currentProcess).getUserObject() instanceof Process)
((Process)(((ProcessGraph)currentProcess).getUserObject())).addCall(currentCall);
((ProcessGraph)currentProcess).addVertex(currentCall,start,FCConstants.GENERATE);
*/
}
else if (serialize.isSelected())
{
currentCall = new Serialize("serialize"+count,"writefile",currentTransformation,1,currentProcess+"serialize"+count+".xml");
if(((ProcessGraph)currentProcess).getUserObject() instanceof Process)
((Process)(((ProcessGraph)currentProcess).getUserObject())).addCall(currentCall);
((ProcessGraph)currentProcess).addVertex(currentCall,start,FCConstants.SERIALYSE);
}
dialog = new EditCall((JFrame)(currentProcess.getTopLevelAncestor()),(ProcessGraph)currentProcess,null,start,FCConstants.SERIALIZE);
/*
currentCall = new Serialize("serialize"+count,"writefile",currentTransformation,1,currentProcess+"serialize"+count+".xml");
if(((ProcessGraph)currentProcess).getUserObject() instanceof Process)
((Process)(((ProcessGraph)currentProcess).getUserObject())).addCall(currentCall);
((ProcessGraph)currentProcess).addVertex(currentCall,start,FCConstants.SERIALIZE);
*/
}
else if (dispatch.isSelected())
{
currentCall = new Dispatch("dispatch"+count,"broadcast",currentTransformation);
if(((ProcessGraph)currentProcess).getUserObject() instanceof Process)
((Process)(((ProcessGraph)currentProcess).getUserObject())).addCall(currentCall);
((ProcessGraph)currentProcess).addVertex(currentCall,start,FCConstants.DISPATCH);
dialog = new EditCall((JFrame)(currentProcess.getTopLevelAncestor()),(ProcessGraph)currentProcess,null,start,FCConstants.DISPATCH);
/*
currentCall = new Dispatch("dispatch"+count,"broadcast",currentTransformation);
if(((ProcessGraph)currentProcess).getUserObject() instanceof Process)
((Process)(((ProcessGraph)currentProcess).getUserObject())).addCall(currentCall);
((ProcessGraph)currentProcess).addVertex(currentCall,start,FCConstants.DISPATCH);
*/
}
else if (applyExternal.isSelected())
{
currentCall = new ApplyExternal("applyExternal"+count,"xslt","/local_home/gchomat/transmorpher/samples/biblio/xslt/sort-ty.xsl",currentTransformation);
dialog = new EditCall((JFrame)(currentProcess.getTopLevelAncestor()),(ProcessGraph)currentProcess,null,start,FCConstants.APPLYEXTERNAL);
/*
currentCall = new ApplyExternal("applyExternal"+count,"xslt","/local_home/gchomat/transmorpher/samples/biblio/xslt/sort-ty.xsl",currentTransformation);
if(((ProcessGraph)currentProcess).getUserObject() instanceof Process)
((Process)(((ProcessGraph)currentProcess).getUserObject())).addCall(currentCall);
((ProcessGraph)currentProcess).addVertex(currentCall,start,FCConstants.APPLYEXTERNAL);
}
*/
}
else if (applyProcess.isSelected())
{
currentCall = new ApplyProcess("applyProcess"+count,"no",currentTransformation);
if(((ProcessGraph)currentProcess).getUserObject() instanceof Process)
((Process)(((ProcessGraph)currentProcess).getUserObject())).addCall(currentCall);
((ProcessGraph)currentProcess).addVertex(currentCall,start,FCConstants.APPLYPROCESS);
{
dialog = new EditCall((JFrame)(currentProcess.getTopLevelAncestor()),(ProcessGraph)currentProcess,null,start,FCConstants.APPLYPROCESS);
/*currentCall = new ApplyProcess("applyProcess"+count,"no",currentTransformation);
if(((ProcessGraph)currentProcess).getUserObject() instanceof Process)
((Process)(((ProcessGraph)currentProcess).getUserObject())).addCall(currentCall);
((ProcessGraph)currentProcess).addVertex(currentCall,start,FCConstants.APPLYPROCESS);
*/
}
else if (applyRuleset.isSelected())
{
currentCall = new ApplyRuleset("applyRuleset"+count,"no",currentTransformation);
if(((ProcessGraph)currentProcess).getUserObject() instanceof Process)
((Process)(((ProcessGraph)currentProcess).getUserObject())).addCall(currentCall);
((ProcessGraph)currentProcess).addVertex(currentCall,start,FCConstants.APPLYRULESET);
{
dialog = new EditCall((JFrame)(currentProcess.getTopLevelAncestor()),(ProcessGraph)currentProcess,null,start,FCConstants.APPLYRULESET);
/*currentCall = new ApplyRuleset("applyRuleset"+count,"no",currentTransformation);
if(((ProcessGraph)currentProcess).getUserObject() instanceof Process)
((Process)(((ProcessGraph)currentProcess).getUserObject())).addCall(currentCall);
((ProcessGraph)currentProcess).addVertex(currentCall,start,FCConstants.APPLYRULESET);
*/
}
else if (applyQuery.isSelected())
{
currentCall = new ApplyQuery("applyQuery"+count,"tmq",currentTransformation);
if(((ProcessGraph)currentProcess).getUserObject() instanceof Process)
((Process)(((ProcessGraph)currentProcess).getUserObject())).addCall(currentCall);
((ProcessGraph)currentProcess).addVertex(currentCall,start,FCConstants.APPLYQUERY);
{
dialog = new EditCall((JFrame)(currentProcess.getTopLevelAncestor()),(ProcessGraph)currentProcess,null,start,FCConstants.APPLYQUERY);
/*currentCall = new ApplyQuery("applyQuery"+count,"tmq",currentTransformation);
if(((ProcessGraph)currentProcess).getUserObject() instanceof Process)
((Process)(((ProcessGraph)currentProcess).getUserObject())).addCall(currentCall);
((ProcessGraph)currentProcess).addVertex(currentCall,start,FCConstants.APPLYQUERY);
*/
}
else if (edgeNormal.isSelected()) {
currentProcess.getModel().insert(null,null,null,null);
......@@ -382,10 +399,10 @@ public class FCMarqueeHandler extends BasicMarqueeHandler {
class EditCall extends JDialog implements ActionListener{
protected JTextField idText ;
protected JTextField idText, fileText;
protected JComboBox strategy,typeChooser,ref;
protected JFileChooser fileChooser;
protected JButton ok,cancel;
protected JButton ok,cancel,fileChooserButton;
protected JLabel idJLabel, fileJLabel, refJLabel, strategyJLabel, typeJLabel;
final static String idLabel ="id :";
......@@ -427,190 +444,121 @@ public class FCMarqueeHandler extends BasicMarqueeHandler {
buildDialog();
}
/**
build the dialog depends on type and call
*/
public void buildDialog(){
Dimension space = new Dimension(10,10);
getContentPane().setLayout(new BoxLayout(getContentPane(),BoxLayout.Y_AXIS));
//id
JPanel idPane = new JPanel();
JPanel typePane;
JPanel propertiesPane;
JPanel labelPane;
JPanel fieldPane;
JPanel chooserPane;
Object attributes = null;
Parameters parameters = null;
if(call!=null)
{
attributes = call.getAttributes();
parameters = call.getParameters();
}
else
{
attributes = FCConstants.defaultAttributes(type);
parameters = new Parameters();
}
propertiesPane = new JPanel();
propertiesPane.setLayout( new BoxLayout(propertiesPane,BoxLayout.X_AXIS));
labelPane = new JPanel();
labelPane.setLayout( new BoxLayout(labelPane,BoxLayout.Y_AXIS));
fieldPane = new JPanel();
fieldPane.setLayout(new BoxLayout(fieldPane,BoxLayout.Y_AXIS));
idJLabel = new JLabel(idLabel);
idPane.add(idJLabel);
labelPane.add(idJLabel);
//id
if(call!=null){
// id
idText= new JTextField(call.getId(),20);
}
else{
// id
idText= new JTextField(((Hashtable)attributes).get("id")+""+start.x,20);
}
fieldPane.add(idText);
switch(type)
//list of type. if null no type must be defined for this call.
Object[] list = FCConstants.getListType(type);
if(list != null)
{
case FCConstants.MERGE :
//type
typePane = new JPanel();
typeJLabel = new JLabel(typeLabel);
typePane.add(typeJLabel);
labelPane.add(Box.createVerticalGlue());
labelPane.add(typeJLabel);
typeChooser = new JComboBox(list);
fieldPane.add(Box.createVerticalGlue());
fieldPane.add(typeChooser);
if(call!=null){
setTitle(call.getId()+" Properties");
// id
idText= new JTextField(call.getId(),20);
//type
typeChooser = new JComboBox(FCConstants.mergeType);
}
else{
setTitle("New Merge Properties");
// id
idText= new JTextField("Merge"+start.x,20);
//type
typeChooser = new JComboBox(FCConstants.mergeType);
Object value = ((Parameters)attributes).getParameter("type");
typeChooser.setSelectedItem(value);
}
}
Object file = (attributes instanceof Parameters)?((Parameters)attributes).getParameter("file"):((Hashtable)attributes).get("file");
if(file != null)
{
//label
fileJLabel = new JLabel(fileLabel);
labelPane.add(Box.createVerticalGlue());
labelPane.add(fileJLabel);
//textField
fileText = new JTextField((String)file,15);
//id
idJLabel.setLabelFor(idText);
idPane.add(idText);
getContentPane().add(idPane);
//type
typeJLabel.setLabelFor(typeChooser);
typePane.add(typeChooser);
getContentPane().add(typePane);
break;
case FCConstants.DISPATCH :
fileChooserButton = new JButton("...");
fileChooserButton.addActionListener(this);
//type
typePane = new JPanel();
typeJLabel = new JLabel(typeLabel);
typePane.add(typeJLabel);
chooserPane = new JPanel();
chooserPane.add(fileText);
chooserPane.add(fileChooserButton);
fieldPane.add(chooserPane);
if(call!=null){
setTitle(call.getId()+" Properties");
// id
idText= new JTextField(call.getId(),20);
//type
typeChooser = new JComboBox(FCConstants.dispatchType);
}
else{
setTitle("New Dispatch Properties");
// id
idText= new JTextField("Dispatch"+start.x,20);
//type
typeChooser = new JComboBox(FCConstants.dispatchType);
}
//id
idJLabel.setLabelFor(idText);
idPane.add(idText);
getContentPane().add(idPane);
//type
typeJLabel.setLabelFor(typeChooser);
typePane.add(typeChooser);
getContentPane().add(typePane);
break;
case FCConstants.SERIALYSE :
//type
typePane = new JPanel();
JPanel filePane = new JPanel();
typeJLabel = new JLabel(typeLabel);
typePane.add(typeJLabel);
}
Object strategy = (attributes instanceof Parameters)?((Parameters)attributes).getParameter("strategy"):((Hashtable)attributes).get("strategy");
if(strategy != null)
{
if(call!=null){
setTitle(call.getId()+" Properties");
// id
idText= new JTextField(call.getId(),20);
//type
typeChooser = new JComboBox(FCConstants.serialyseType);
//file
}
else{
setTitle("New Serialyse Properties");
// id
idText= new JTextField("Serialyse" + start.x ,20);
//type
typeChooser = new JComboBox(FCConstants.serialyseType);
//file
fileJLabel = new JLabel(fileLabel);
filePane.add(fileJLabel);
}
//id
idJLabel.setLabelFor(idText);
idPane.add(idText);
getContentPane().add(idPane);
//type
typeJLabel.setLabelFor(typeChooser);
typePane.add(typeChooser);
getContentPane().add(typePane);
break;
case FCConstants.APPLYEXTERNAL :
//type
typePane = new JPanel();
typeJLabel = new JLabel(typeLabel);
typePane.add(typeJLabel);
if(call!=null){
setTitle(call.getId()+" Properties");
// id
idText= new JTextField(call.getId(),20);
//type
typeChooser = new JComboBox(FCConstants.serialyseType);
//file
}
else{
}
break;
case FCConstants.APPLYPROCESS:
if(call!=null){
System.out.println("not yet implemented");
}
else{
System.out.println("not yet implemented");
}
break;
case FCConstants.APPLYQUERY: