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

modified the properties window

parent 2e4851dc
/**
*
*$Id: FlowComposer.java,v 1.53 2002-06-25 09:50:38 frederic Exp $
*$Id: FlowComposer.java,v 1.54 2002-06-25 13:26:31 frederic Exp $
*
* Transmorpher
*
......@@ -257,7 +257,7 @@ public class FlowComposer extends JPanel implements GraphModelListener,
protected void initTransmorpher(){
processFactory = new FCProcessFactory(this);
if(filename != null)
{
init_main = false;
......@@ -278,7 +278,7 @@ public class FlowComposer extends JPanel implements GraphModelListener,
createStatusbar();
updateLookAndFeel(windows);
//updateLookAndFeel(windows);
setCursor(new Cursor(Cursor.DEFAULT_CURSOR));
this.setLayout(new BorderLayout());
......@@ -313,7 +313,7 @@ public class FlowComposer extends JPanel implements GraphModelListener,
Border etched = BorderFactory.createRaisedBevelBorder();
center.setBorder(etched);
//Add a JTabbedPane for represnting the process notion.
//tabProcess= new JTabbedPane();
tabProcess.getModel().addChangeListener(
......@@ -378,7 +378,7 @@ public class FlowComposer extends JPanel implements GraphModelListener,
FlowComposer flowComposer = createInstance(filename,model);
instances.add(flowComposer);
frame.setContentPane(flowComposer);
frame.setTitle(title +" "+ version + " -- " + flowComposer.getFileName());
frame.pack();
......@@ -390,9 +390,9 @@ public class FlowComposer extends JPanel implements GraphModelListener,
frame.setLocation(
screenSize.width/2 - frame.getSize().width/2 + instances.size()*10,
screenSize.height/2 - frame.getSize().height/2+ instances.size()*10);
frame.show();
return flowComposer;
}
......@@ -417,7 +417,7 @@ public class FlowComposer extends JPanel implements GraphModelListener,
//return new FlowComposer("Untitled-"+ Integer.toString(instances.size()+1), model);
return new FlowComposer(filename, model);
}
/**
* Find the hosting frame, for the file-chooser dialog.
*/
......@@ -465,7 +465,7 @@ public class FlowComposer extends JPanel implements GraphModelListener,
transmorpher.addTransformation(name,process);
break;
}
}
......@@ -481,20 +481,20 @@ public class FlowComposer extends JPanel implements GraphModelListener,
marqueeHandler = new FCMarqueeHandler(this);
currentProcess.setMarqueeHandler(marqueeHandler);
undoHandler = new UndoHandler();
registerListeners(currentProcess);
currentProcess.getModel().addUndoableEditListener(undoHandler);
sp = new JScrollPane(currentProcess,JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);
sp = (JScrollPane)(tabProcess.add(currentProcess.getName(),sp));
tabProcess.setSelectedComponent(sp);
currentProcess = (ProcessGraph)(sp.getViewport().getView());
undoHandler.setProcess(currentProcess);
}
else
{
System.out.println("The process is not added. Mode multi fentre not yet implemented");
......@@ -707,9 +707,9 @@ public class FlowComposer extends JPanel implements GraphModelListener,
public JPopupMenu createPopupMenu(String popup){
popupMenu = new JPopupMenu();
String[] tool = tokenize(getResourceString(popup));
for (int i = 0; i < tool.length; i++) {
if (tool[i].equals("-")) {
popupMenu.addSeparator();
......@@ -717,7 +717,7 @@ public class FlowComposer extends JPanel implements GraphModelListener,
popupMenu.add(createMenuItem(tool[i]));
}
}
return popupMenu;
}
......@@ -1122,7 +1122,7 @@ public class FlowComposer extends JPanel implements GraphModelListener,
popupMenu = createPopupMenu("popup1");
popupMenu.show(e.getComponent(),e.getX(),e.getY());
}
/**
* Ask to user to enter the name of the new process.
......@@ -1186,7 +1186,7 @@ public class FlowComposer extends JPanel implements GraphModelListener,
protected void makeComponent(Object[] component) {
JPanel panel = new JPanel();
panel.setLayout(new FlowLayout(FlowLayout.LEFT,5,5));
panel.setLayout(new FlowLayout(FlowLayout.LEFT,20,5));
for (int i=0;i<component.length;i++) {
panel.add((Container)component[i]);
}
......@@ -1215,7 +1215,7 @@ public class FlowComposer extends JPanel implements GraphModelListener,
idText= new JTextField(call.getId());}
else{
idText= new JTextField(((Hashtable)attributes).get("id")+""+location.x);}
idText.setPreferredSize(new Dimension(150,20));
idText.setPreferredSize(new Dimension(165,20));
Object[] compId = new Object[]{idJLabel,idText};
makeComponent(compId);
......@@ -1227,7 +1227,7 @@ public class FlowComposer extends JPanel implements GraphModelListener,
typeJLabel = new JLabel(resource.getString("typeLabel"));
typeJLabel.setPreferredSize(new Dimension(30,20));
typeChooser = new JComboBox(list);
typeChooser.setPreferredSize(new Dimension(150,20));
typeChooser.setPreferredSize(new Dimension(165,20));
if(editMode){
Object value = ((Parameters)attributes).getParameter("type");
typeChooser.setSelectedItem(value);
......@@ -1245,12 +1245,12 @@ public class FlowComposer extends JPanel implements GraphModelListener,
fileChooserButton = new JButton("...");
fileChooserButton.addActionListener(this);
fileJLabel.setPreferredSize(new Dimension(30,20));
fileText.setPreferredSize(new Dimension(115,20));
fileChooserButton.setPreferredSize(new Dimension(30,20));
fileText.setPreferredSize(new Dimension(120,20));
fileChooserButton.setPreferredSize(new Dimension(25,20));
Object[] compFile = new Object[]{fileJLabel,fileText,fileChooserButton};
makeComponent(compFile);
}
Object strategy = (attributes instanceof Parameters)?((Parameters)attributes).getParameter("strategy"):((Hashtable)attributes).get("strategy");
//strategy construction
......@@ -1260,7 +1260,7 @@ public class FlowComposer extends JPanel implements GraphModelListener,
strategyChooser.setSelectedItem(strategy);
}
Object ref = (attributes instanceof Parameters)?((Parameters)attributes).getParameter("ref"):((Hashtable)attributes).get("ref");
//ref construction
......@@ -1268,7 +1268,7 @@ public class FlowComposer extends JPanel implements GraphModelListener,
refJLabel= new JLabel(resource.getString("refLabel"));
refJLabel.setPreferredSize(new Dimension(30,20));
refChooser = new JComboBox();
refChooser.setPreferredSize(new Dimension(150,20));
refChooser.setPreferredSize(new Dimension(165,20));
refChooser.setEditable(true);
if(call instanceof ApplyProcess){
......@@ -1284,12 +1284,12 @@ public class FlowComposer extends JPanel implements GraphModelListener,
ok = new JButton(resource.getString("okTitle"));
ok.addActionListener(this);
ok.setPreferredSize(new Dimension(75,20));
ok.setPreferredSize(new Dimension(80,20));
cancel = new JButton(resource.getString("cancelTitle"));
cancel.addActionListener(this);
cancel.setPreferredSize(new Dimension(75,20));
cancel.setPreferredSize(new Dimension(80,20));
JPanel pane = new JPanel();
pane.setLayout(new FlowLayout(FlowLayout.CENTER));
pane.setLayout(new FlowLayout(FlowLayout.RIGHT));
pane.add(ok);
pane.add(cancel);
contentPane.add(pane);
......@@ -1301,7 +1301,7 @@ public class FlowComposer extends JPanel implements GraphModelListener,
this.setTitle(resource.getString("dialogTitle"));
this.setVisible(true);
}
public Point computeLocation(Point location){
Point graphLocation = getGraphLocationOnscreen();
Point dialogLocation =null;
......@@ -1313,29 +1313,29 @@ public class FlowComposer extends JPanel implements GraphModelListener,
//ACTION LISTENER
public void actionPerformed(ActionEvent event){
String id = idText.getText();
Point location = new Point(1,1);
if(event.getSource() == ok )
{
//ok action.
//for each component we must test if the id is single.
if(!(id.equals(""))){
//id != ""
if(currentProcess != null && (id.equals(call.getId()) || currentProcess.isSingleId(id)))
{
//id is single
switch(type){
case FCConstants.MERGE:
if(call==null){
//(currentProcess).createCall(FCConstants.MERGE,parameters);
}
else{
//call.setId(id);
......@@ -1348,7 +1348,7 @@ public class FlowComposer extends JPanel implements GraphModelListener,
/*call = new Dispatch(id,typeChooser.getSelectedItem().toString(),currentTransformation);
currentTransformation.addCall(call);
(currentProcess).addVertex(call,location,FCConstants.DISPATCH);*/
}
else{
call.setId(id);
......@@ -1362,8 +1362,8 @@ public class FlowComposer extends JPanel implements GraphModelListener,
/*call = new Serialize(id,typeChooser.getSelectedItem().toString(),fileText.getText(),currentTransformation);
currentTransformation.addCall(call);
(currentProcess).addVertex(call,location,FCConstants.SERIALIZE);*/
}
else{
call.setId(id);
......@@ -1382,13 +1382,13 @@ public class FlowComposer extends JPanel implements GraphModelListener,
}
else
alertJLabel.setText("alert !! file is empty!!");
fileJLabel.setForeground(Color.red);
this.pack();
}
break;
case FCConstants.APPLYEXTERNAL :
if(!(fileText.getText().equals(""))){
if(call==null){
......@@ -1396,7 +1396,7 @@ public class FlowComposer extends JPanel implements GraphModelListener,
currentTransformation.addCall(call);
(currentProcess).addVertex(call,location,FCConstants.APPLYEXTERNAL);*/
this.dispose();
}
else{
call.setId(id);
......@@ -1415,11 +1415,11 @@ public class FlowComposer extends JPanel implements GraphModelListener,
}
else
alertJLabel.setText("alert !! file is empty!!");
fileJLabel.setForeground(Color.red);
this.pack();
}
break;
case FCConstants.APPLYPROCESS:
if(!(refChooser.getSelectedItem().toString().equals("")))
......@@ -1433,7 +1433,7 @@ public class FlowComposer extends JPanel implements GraphModelListener,
else{
call.setId(id);
((ApplyProcess)call).setRef(refChooser.getSelectedItem().toString());
}
this.dispose();
}
......@@ -1447,19 +1447,19 @@ public class FlowComposer extends JPanel implements GraphModelListener,
}
else
alertJLabel.setText("alert !! ref is empty!!");
refJLabel.setForeground(Color.red);
this.pack();
}
break;
case FCConstants.APPLYQUERY:
if(call==null){
System.out.println("not yet implemented");
}
else{
}
this.dispose();
break;
......@@ -1468,24 +1468,24 @@ public class FlowComposer extends JPanel implements GraphModelListener,
System.out.println("not yet implemented");
}
else{
}
this.dispose();
break;
case FCConstants.GENERATE:
if(!(fileText.getText().equals(""))){
if(call==null)
{
/*call = new Generate(id,typeChooser.getSelectedItem().toString(),fileText.getText(),currentTransformation);
currentTransformation.addCall(call);
(currentProcess).addVertex(call,location,FCConstants.GENERATE);*/
}
else
{
call.setId(id);
call.setType(typeChooser.getSelectedItem().toString());
((Generate)call).setFile(fileText.getText());
......@@ -1501,22 +1501,22 @@ public class FlowComposer extends JPanel implements GraphModelListener,
}
else
alertJLabel.setText("alert !! file is empty!!");
fileJLabel.setForeground(Color.red);
this.pack();
}
break;
default :
System.out.println("not yet implemented");
break;
}
//createCall();
}
else
{
......@@ -1542,8 +1542,8 @@ public class FlowComposer extends JPanel implements GraphModelListener,
}
else
alertJLabel.setText("alert !! id musn't be an empty string");
idJLabel.setForeground(Color.red);
this.pack();
}
......@@ -1553,10 +1553,10 @@ public class FlowComposer extends JPanel implements GraphModelListener,
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());
......@@ -1566,11 +1566,11 @@ public class FlowComposer extends JPanel implements GraphModelListener,
//log.append("Open command cancelled by user." + newline);
}
}
}
}
/*
* Return true if the user really wants to close. Gives chance to save work.
*/
......@@ -1582,11 +1582,11 @@ public class FlowComposer extends JPanel implements GraphModelListener,
if (r == JOptionPane.YES_OPTION)
saveGraph.actionPerformed(null);
if (r != JOptionPane.CANCEL_OPTION) {
*/
*/
getFrame().dispose();
return true;
/*}
return false;
}
......@@ -1596,12 +1596,12 @@ public class FlowComposer extends JPanel implements GraphModelListener,
protected WindowAdapter createCloser() {
return new FCWindowListener();
}
protected final class FCWindowListener extends WindowAdapter{
public FCWindowListener(){
}
public void windowClosing(WindowEvent e){
new CloseAction().actionPerformed(null);
}
......@@ -1610,13 +1610,13 @@ public class FlowComposer extends JPanel implements GraphModelListener,
}
class CloseAction extends AbstractAction {
CloseAction() {
super("close"+actionSuffix);
}
public void actionPerformed(ActionEvent e) {
close();
}
......@@ -1925,18 +1925,18 @@ public class FlowComposer extends JPanel implements GraphModelListener,
public void actionPerformed(ActionEvent e) {
PrintStream out = System.out;;
try{
out = new PrintStream(new BufferedOutputStream(new FileOutputStream(filename)));
}
catch(FileNotFoundException ex)
{
}
System.setOut(out);
System.setErr(out);
transmorpher.generateXML();
out.close();
......@@ -1968,7 +1968,7 @@ public class FlowComposer extends JPanel implements GraphModelListener,
}
public void actionPerformed(ActionEvent e) {
/*Iterator it = instances.iterator();
while (it.hasNext()) {
FlowComposer flow = (FlowComposer) it.next();
......@@ -2152,28 +2152,28 @@ public class FlowComposer extends JPanel implements GraphModelListener,
}
class PropertiesCAction extends AbstractAction {
PropertiesCAction() {
super("propertiesC"+actionSuffix);
}
public void actionPerformed(ActionEvent e) {
if(currentProcess.getSelectionCell()!= null)
{
new EditCall((Call)((FCGraphCell)currentProcess.getSelectionCell()).getUserObject() , marqueeHandler.getCurrentPoint(),FCConstants.getType((Call)((FCGraphCell)currentProcess.getSelectionCell()).getUserObject()));
}
}
}
protected void update(){
if(currentProcess != null && currentProcess.getSelectionCount()==1 && (currentProcess.getSelectionCell() instanceof FCGraphCell))
setEnabled(true);
else
else
setEnabled(false);
}
}
class NewCHAction extends AbstractAction {
......
/**
* $Id: ProcessGraph.java,v 1.37 2002-06-25 09:50:38 frederic Exp $
* $Id: ProcessGraph.java,v 1.38 2002-06-25 13:26:31 frederic Exp $
*
* Transmorpher
*
......@@ -74,7 +74,7 @@ public class ProcessGraph extends JGraph implements Comparator, Observer{
/** boundsCube define the dimension of a squared form composant such as ApplyQuery, Merge and Dispatch.
* ie: this composant are included in square boxe
*/
static Dimension boundsCube = new Dimension(70,70);
static Dimension boundsCube = new Dimension(60,60);
static Dimension boundsPort = new Dimension(10,10);
......@@ -82,7 +82,7 @@ public class ProcessGraph extends JGraph implements Comparator, Observer{
/** boundsRect define the dimension of a rectangle form composant such as ApplyProcess, Serialize,...
* ie: this composant are included in rectangle boxe
*/
static Dimension boundsRect = new Dimension(80,70);
static Dimension boundsRect = new Dimension(70,60);
ArrayList tmp =null;
......@@ -232,7 +232,7 @@ public class ProcessGraph extends JGraph implements Comparator, Observer{
/** interface Observer*/
public void update(Observable observable, Object arg){
if(observable instanceof Process)
{
if(arg instanceof Call)
......@@ -459,19 +459,19 @@ public class ProcessGraph extends JGraph implements Comparator, Observer{
}
public PortView getPort(Object userObject){
Object[] roots = getAll();
for (int i = 0 ; i <roots.length ;i++)
{
java.util.List port = ((DefaultGraphCell)roots[i]).getChildren();
Iterator it = port.iterator();
while (it.hasNext())
while (it.hasNext())
{
DefaultGraphCell portCell = (DefaultGraphCell)it.next();
if(portCell.getUserObject().equals( userObject ))
return (PortView)getView().getMapping(portCell,false);
}
}
return null;
}
......
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