Commit 184c822a authored by Guillaume Chomat's avatar Guillaume Chomat
Browse files

now the compoenent properties can be editable

parent 433a703f
/**
* $Id: FCMarqueeHandler.java,v 1.15 2002-05-29 16:24:24 gchomat Exp $
* $Id: FCMarqueeHandler.java,v 1.16 2002-05-30 13:05:37 gchomat Exp $
*
* Transmorpher
*
......@@ -400,11 +400,13 @@ public class FCMarqueeHandler extends BasicMarqueeHandler {
class EditCall extends JDialog implements ActionListener{
protected JTextField idText, fileText;
protected JComboBox strategy,typeChooser,ref;
protected JComboBox strategyChooser,typeChooser,refChooser;
protected JFileChooser fileChooser;
protected JButton ok,cancel,fileChooserButton;
protected JLabel idJLabel, fileJLabel, refJLabel, strategyJLabel, typeJLabel;
protected JLabel idJLabel, fileJLabel, refJLabel, strategyJLabel, typeJLabel, alertJLabel;
final static String idLabel ="id :";
final static String fileLabel ="file :";
final static String refLabel ="ref :";
......@@ -437,7 +439,7 @@ public class FCMarqueeHandler extends BasicMarqueeHandler {
this.type = type;
this.currentProcess = currentProcess;
editMode = (call == null);
editMode = (call != null);
this.setResizable(false);
......@@ -449,7 +451,7 @@ public class FCMarqueeHandler extends BasicMarqueeHandler {
*/
public void buildDialog(){
Dimension space = new Dimension(10,10);
// Dimension space = new Dimension(10,10);
getContentPane().setLayout(new BoxLayout(getContentPane(),BoxLayout.Y_AXIS));
JPanel propertiesPane;
......@@ -461,7 +463,7 @@ public class FCMarqueeHandler extends BasicMarqueeHandler {
Parameters parameters = null;
if(call!=null)
if(editMode)
{
attributes = call.getAttributes();
parameters = call.getParameters();
......@@ -485,7 +487,7 @@ public class FCMarqueeHandler extends BasicMarqueeHandler {
labelPane.add(idJLabel);
//id
if(call!=null){
if(editMode){
// id
idText= new JTextField(call.getId(),20);
......@@ -503,14 +505,14 @@ public class FCMarqueeHandler extends BasicMarqueeHandler {
if(list != null)
{
typeJLabel = new JLabel(typeLabel);
labelPane.add(Box.createVerticalGlue());
//labelPane.add(Box.createVerticalGlue());
labelPane.add(typeJLabel);
typeChooser = new JComboBox(list);
fieldPane.add(Box.createVerticalGlue());
//fieldPane.add(Box.createVerticalGlue());
fieldPane.add(typeChooser);
if(call!=null){
if(editMode){
Object value = ((Parameters)attributes).getParameter("type");
typeChooser.setSelectedItem(value);
}
......@@ -541,17 +543,22 @@ public class FCMarqueeHandler extends BasicMarqueeHandler {
if(strategy != null)
{
strategyJLabel = new JLabel(strategyLabel);
strategyChooser = new JComboBox(FCConstants.STRATEGYRULESET);
strategyChooser.setSelectedItem(strategy);
labelPane.add( strategyJLabel);
fieldPane.add( strategyChooser);
}
Object ref = (attributes instanceof Parameters)?((Parameters)attributes).getParameter("ref"):((Hashtable)attributes).get("ref");
if(ref != null)
{
refJLabel= new JLabel( refLabel );
refChooser = new JComboBox();
refChooser.setEditable(true);
labelPane.add( refJLabel );
fieldPane.add( refChooser );
}
propertiesPane.add(labelPane);
......@@ -572,7 +579,7 @@ public class FCMarqueeHandler extends BasicMarqueeHandler {
getContentPane().add(panelButton);
this.pack();
this.setLocationRelativeTo(frame);
this.setLocation(start);
this.setVisible(true);
}
......@@ -585,69 +592,128 @@ public class FCMarqueeHandler extends BasicMarqueeHandler {
if(event.getSource() == ok )
{
//ok action.
if(!(id.equals(""))){
//id != ""
if(currentProcess.isSingleId(id))
//for each component we must test if the id is single.
if(!(id.equals(""))){
//id != ""
if(currentProcess.isSingleId(id))
{
//id is single
switch(type)
{
case FCConstants.MERGE :
if(call==null){
call = new Merge(id,typeChooser.getSelectedItem().toString(),null);
call = new Merge(id,typeChooser.getSelectedItem().toString());
((ProcessGraph)currentProcess).addVertex(call,start,FCConstants.MERGE);
this.dispose();
}
else{
}
break;
case FCConstants.DISPATCH :
if(call!=null){
System.out.println("not yet implemented");
if(call==null){
call = new Dispatch(id,typeChooser.getSelectedItem().toString());
((ProcessGraph)currentProcess).addVertex(call,start,FCConstants.DISPATCH);
this.dispose();
}
else{
System.out.println("not yet implemented");
}
break;
case FCConstants.SERIALIZE :
if(call!=null){
System.out.println("not yet implemented");
}
else{
System.out.println("not yet implemented");
if(!(fileText.getText().equals(""))){
if(call==null){
call = new Serialize(id,typeChooser.getSelectedItem().toString(),fileText.getText());
((ProcessGraph)currentProcess).addVertex(call,start,FCConstants.SERIALIZE);
this.dispose();
}
else{
}
}
else
{
//System.out.println("not single");
if (alertJLabel == null)
{
alertJLabel = new JLabel("alert !! id must be single!!");
getContentPane().add(alertJLabel);
}
else
alertJLabel.setText("alert !! file is empty!!");
fileJLabel.setForeground(Color.red);
this.pack();
}
break;
case FCConstants.APPLYEXTERNAL :
if(call!=null){
System.out.println("not yet implemented");
}
else{
System.out.println("not yet implemented");
if(!(fileText.getText().equals(""))){
if(call==null){
call = new ApplyExternal(id,typeChooser.getSelectedItem().toString(),fileText.getText());
((ProcessGraph)currentProcess).addVertex(call,start,FCConstants.APPLYEXTERNAL);
this.dispose();
}
else{
}
}
else
{
//System.out.println("not single");
if (alertJLabel == null)
{
alertJLabel = new JLabel("alert !! id must be single!!");
getContentPane().add(alertJLabel);
}
else
alertJLabel.setText("alert !! file is empty!!");
fileJLabel.setForeground(Color.red);
this.pack();
}
break;
case FCConstants.APPLYPROCESS:
if(call!=null){
System.out.println("not yet implemented");
}
else{
System.out.println("not yet implemented");
}
if(!(refChooser.getSelectedItem().toString().equals("")))
{
if(call==null){
call = new ApplyProcess(id,"",refChooser.getSelectedItem().toString());
((ProcessGraph)currentProcess).addVertex(call,start,FCConstants.APPLYPROCESS);
this.dispose();
}
else{
}
}
else
{
//System.out.println("not single");
if (alertJLabel == null)
{
alertJLabel = new JLabel("alert !! ref is empty!!");
getContentPane().add(alertJLabel);
}
else
alertJLabel.setText("alert !! ref is empty!!");
refJLabel.setForeground(Color.red);
this.pack();
}
break;
case FCConstants.APPLYQUERY:
if(call!=null){
if(call==null){
System.out.println("not yet implemented");
}
else{
......@@ -657,7 +723,7 @@ public class FCMarqueeHandler extends BasicMarqueeHandler {
break;
case FCConstants.APPLYRULESET:
if(call!=null){
if(call==null){
System.out.println("not yet implemented");
}
else{
......@@ -667,41 +733,101 @@ public class FCMarqueeHandler extends BasicMarqueeHandler {
break;
case FCConstants.GENERATE:
if(call!=null){
System.out.println("not yet implemented");
}
else{
System.out.println("not yet implemented");
if(!(fileText.getText().equals(""))){
if(call==null)
{
call = new Generate(id,typeChooser.getSelectedItem().toString(),fileText.getText());
((ProcessGraph)currentProcess).addVertex(call,start,FCConstants.GENERATE);
this.dispose();
}
else
{
}
}
else
{
if (alertJLabel == null)
{
alertJLabel = new JLabel("alert !! file is empty!!");
getContentPane().add(alertJLabel);
}
else
alertJLabel.setText("alert !! file is empty!!");
fileJLabel.setForeground(Color.red);
this.pack();
}
break;
default :
System.out.println("not yet implemented");
break;
}
createCall();
//createCall();
}
else
{
getContentPane().add(new JLabel("alert !! id must be single!!"));
}
}
else{
//id = ""
}
else
{
//System.out.println("not single");
if (alertJLabel == null)
{
alertJLabel = new JLabel("alert !! id must be single!!");
getContentPane().add(alertJLabel);
}
else
alertJLabel.setText("alert !! id must be single!!");
idJLabel.setForeground(Color.red);
this.pack();
}
}
else{
//id = ""
if (alertJLabel == null)
{
alertJLabel = new JLabel("alert !! id musn't be an empty string");
getContentPane().add(alertJLabel);
}
else
alertJLabel.setText("alert !! id musn't be an empty string");
idJLabel.setForeground(Color.red);
this.pack();
}
}
else if(event.getSource() == cancel)
{
this.dispose();
}
else if(event.getSource() == fileChooserButton ){
fileChooser = new JFileChooser();
int returnVal = fileChooser.showOpenDialog(this);
if (returnVal == JFileChooser.APPROVE_OPTION) {
File file = fileChooser.getSelectedFile();
fileText.setText(file.getAbsolutePath());
//this is where a real application would open the file.
//log.append("Opening: " + file.getName() + "." + newline);
} else {
//log.append("Open command cancelled by user." + newline);
}
}
}
public void createCall(){
......
/**
*
*$Id: FlowComposer.java,v 1.28 2002-05-30 09:59:51 frederic Exp $
*$Id: FlowComposer.java,v 1.29 2002-05-30 13:05:37 gchomat Exp $
*
* Transmorpher
*
......@@ -250,17 +250,14 @@ public class FlowComposer extends JPanel implements GraphModelListener,
// Add a ToolBar
//JPanel tool = new JPanel();
//tool.setLayout(new GridLayout(2,0));
//tool.add(createToolBar("toolbar1"));
//tool.add(createToolBar("toolbar2"));
panel.add(createToolBar("toolbar1"),BorderLayout.NORTH);
JPanel center = new JPanel();
center.setLayout(new BorderLayout());
center.add(createToolBar("toolbar2"),BorderLayout.NORTH);
tool.add(createToolBar("toolbar1"));
tool.add(createToolBar("toolbar2"));
panel.add(tool,BorderLayout.NORTH);
//Add a JTabbedPane for represnting the process notion.
tabProcess= new JTabbedPane();
tabProcess.getModel().addChangeListener(
tabProcess= new JTabbedPane();
tabProcess.getModel().addChangeListener(
new ChangeListener() {
public void stateChanged(ChangeEvent e) {
SingleSelectionModel model = (SingleSelectionModel) e.getSource();
......
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