MAJ terminée. Nous sommes passés en version 14.6.2 . Pour consulter les "releases notes" associées c'est ici :

https://about.gitlab.com/releases/2022/01/11/security-release-gitlab-14-6-2-released/
https://about.gitlab.com/releases/2022/01/04/gitlab-14-6-1-released/

Commit a2d4b38f authored by Guillaume Chomat's avatar Guillaume Chomat
Browse files

implements Observer for all Cell

parent 211c7925
This diff is collapsed.
/**
* $Id: ApplyExternalCell.java,v 1.3 2002-04-30 13:12:29 gchomat Exp $
* $Id: ApplyExternalCell.java,v 1.4 2002-06-03 17:19:30 gchomat Exp $
*
* Transmorpher
*
......@@ -26,8 +26,11 @@
package fr.fluxmedia.flowcomposer;
import com.jgraph.graph.DefaultGraphCell;
import java.util.Observer;
import java.util.Observable;
public class ApplyExternalCell extends DefaultGraphCell {
public class ApplyExternalCell extends DefaultGraphCell implements Observer{
public ApplyExternalCell() {
this(null);
......@@ -37,4 +40,7 @@ public class ApplyExternalCell extends DefaultGraphCell {
super(userObject);
}
public void update(Observable o, Object arg){
}
}
/**
* $Id: ApplyProcessCell.java,v 1.2 2002-04-15 06:42:04 serge Exp $
* $Id: ApplyProcessCell.java,v 1.3 2002-06-03 17:19:30 gchomat Exp $
*
* Transmorpher
*
......@@ -34,7 +34,11 @@ package fr.fluxmedia.flowcomposer;
import com.jgraph.graph.DefaultGraphCell;
public class ApplyProcessCell extends DefaultGraphCell {
import java.util.Observer;
import java.util.Observable;
public class ApplyProcessCell extends DefaultGraphCell implements Observer{
public ApplyProcessCell() {
this(null);
......@@ -44,4 +48,8 @@ public class ApplyProcessCell extends DefaultGraphCell {
super(userObject);
}
public void update(Observable o, Object arg){
}
}
/**
* $Id: ApplyQueryCell.java,v 1.2 2002-04-15 06:42:04 serge Exp $
* $Id: ApplyQueryCell.java,v 1.3 2002-06-03 17:19:30 gchomat Exp $
*
* Transmorpher
*
......@@ -33,8 +33,11 @@
package fr.fluxmedia.flowcomposer;
import com.jgraph.graph.DefaultGraphCell;
import java.util.Observer;
import java.util.Observable;
public class ApplyQueryCell extends DefaultGraphCell {
public class ApplyQueryCell extends DefaultGraphCell implements Observer{
public ApplyQueryCell() {
this(null);
......@@ -42,6 +45,10 @@ public class ApplyQueryCell extends DefaultGraphCell {
public ApplyQueryCell(Object userObject) {
super(userObject);
}
public void update(Observable o, Object arg){
}
}
/**
* $Id: ApplyRulesetCell.java,v 1.3 2002-04-30 13:12:29 gchomat Exp $
* $Id: ApplyRulesetCell.java,v 1.4 2002-06-03 17:19:30 gchomat Exp $
*
* Transmorpher
*
......@@ -26,8 +26,11 @@
package fr.fluxmedia.flowcomposer;
import com.jgraph.graph.DefaultGraphCell;
import java.util.Observer;
import java.util.Observable;
public class ApplyRulesetCell extends DefaultGraphCell {
public class ApplyRulesetCell extends DefaultGraphCell implements Observer{
public ApplyRulesetCell() {
this(null);
......@@ -37,4 +40,7 @@ public class ApplyRulesetCell extends DefaultGraphCell {
super(userObject);
}
public void update(Observable o, Object arg){
}
}
/**
* $Id: DispatchCell.java,v 1.3 2002-04-30 13:12:29 gchomat Exp $
* $Id: DispatchCell.java,v 1.4 2002-06-03 17:19:30 gchomat Exp $
*
* Transmorpher
*
......@@ -26,8 +26,10 @@
package fr.fluxmedia.flowcomposer;
import com.jgraph.graph.DefaultGraphCell;
import java.util.Observer;
import java.util.Observable;
public class DispatchCell extends DefaultGraphCell {
public class DispatchCell extends DefaultGraphCell implements Observer{
public DispatchCell() {
this(null);
......@@ -37,4 +39,7 @@ public class DispatchCell extends DefaultGraphCell {
super(userObject);
}
public void update(Observable o, Object arg){
}
}
/**
* $Id: FCConstants.java,v 1.4 2002-05-29 16:24:24 gchomat Exp $
* $Id: FCConstants.java,v 1.5 2002-06-03 17:19:30 gchomat Exp $
*
* Transmorpher
*
......@@ -51,7 +51,9 @@ public class FCConstants{
public static final int APPLYRULESET =6;
public static final int APPLYQUERY =7;
public static final int PORTPROCESS =8;
public static final int PORTOUTPUT =1;
public static final int PORTINPUT =0;
public static final Object[] MERGETYPE = new Object[]{"concat"};
public static final Object[] DISPATCHTYPE = new Object[]{"broadcast"};
......
/*
* Created by IntelliJ IDEA.
* User: administrateur
* Date: 15 mai 2002
* Time: 16:27:44
* To change template for new class use
* Code Style | Class Templates options (Tools | IDE Options).
/**
*
*$Id: FCException.java,v 1.2 2002-06-03 17:19:30 gchomat Exp $
*
* Transmorpher
*
* Copyright (C) 2002 Fluxmedia and INRIA Rhône-Alpes.
*
* http://www.fluxmedia.fr - http://transmorpher.inrialpes.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.
*/
/**
*
*
* @version 1.0 29/01/01
* @author Chomat/Saint-Marcel
*/
package fr.fluxmedia.flowcomposer;
public class FCException extends Exception {
private Integer level;
private String category;
public FCException(String message,String category,Integer level) {
super(message);
this.level=level;
......
/**
* $Id: FCMarqueeHandler.java,v 1.16 2002-05-30 13:05:37 gchomat Exp $
* $Id: FCMarqueeHandler.java,v 1.17 2002-06-03 17:19:30 gchomat Exp $
*
* Transmorpher
*
......@@ -98,7 +98,7 @@ public class FCMarqueeHandler extends BasicMarqueeHandler {
public transient JToggleButton edgeNormal = new JToggleButton();
//public transient JToggleButton edgeIterator = new JToggleButton();
//public transient JToggleButton edgeNull = new JToggleButton();
protected Point start, current;
protected Object beginCell, endCell;
......@@ -116,7 +116,6 @@ public class FCMarqueeHandler extends BasicMarqueeHandler {
if(((ProcessGraph)currentProcess).getUserObject()!=null && ((ProcessGraph)currentProcess).getUserObject() instanceof Process){
currentTransformation = (Process)(((ProcessGraph)currentProcess).getUserObject());
}
System.out.println("currentTransformation "+currentTransformation);
}
}
......@@ -134,7 +133,7 @@ public class FCMarqueeHandler extends BasicMarqueeHandler {
//System.out.println("MousePressed Start...");
if(currentProcess != null)
{
if (!e.isConsumed() && !marquee.isSelected()) {
start = currentProcess.snap(e.getPoint());
beginCell = currentProcess.getFirstCellForLocation(e.getX(), e.getY());
......@@ -352,8 +351,9 @@ public class FCMarqueeHandler extends BasicMarqueeHandler {
portOut.setChannel( channel );
((ProcessGraph)currentProcess).addPort("output",(DefaultGraphCell)cell);
((ProcessGraph)currentProcess).addPort("input",(DefaultGraphCell)cell2);
p= new Point(rect.x+rect.width/2,rect.y+rect.height/2);
((ProcessGraph)currentProcess).addPort("input",(DefaultGraphCell)cell2);
p= new Point(rect.x+rect.width/2,rect.y+rect.height/2);
p2= new Point(rect2.x+rect2.width/2,rect2.y+rect2.height/2);
Point p3 = currentProcess.fromScreen(new Point(p));
......@@ -579,10 +579,19 @@ public class FCMarqueeHandler extends BasicMarqueeHandler {
getContentPane().add(panelButton);
this.pack();
this.setLocation(start);
this.setLocation(computeLocation(start));
this.setVisible(true);
}
public Point computeLocation(Point start){
Point graphLocation = flowcomposer.getGraphLocationOnscreen();
Point dialogLocation = new Point(graphLocation.x+start.x,graphLocation.y+start.y);
return dialogLocation;
}
//ACTION LISTENER
public void actionPerformed(ActionEvent event){
......@@ -825,7 +834,12 @@ public class FCMarqueeHandler extends BasicMarqueeHandler {
}
public void alert(int type){
}
......
/**
* $Id: FCProcessFactory.java,v 1.6 2002-05-29 16:24:24 gchomat Exp $
* $Id: FCProcessFactory.java,v 1.7 2002-06-03 17:19:30 gchomat Exp $
*
* Transmorpher
*
......@@ -31,8 +31,6 @@
package fr.fluxmedia.flowcomposer;
import java.util.Hashtable;
import java.util.Iterator;
import java.util.*;
......@@ -46,42 +44,51 @@ import fr.fluxmedia.transmorpher.Graph.Process;
public class FCProcessFactory implements ProcessFactory{
// The list of all process create with this factory
protected Hashtable listProcess ;
protected ArrayList listProcess ;
// The MainProcess
protected ProcessGraph mainProcess = null;
//The list of class coresponding of type.
protected static Hashtable listType;
public FCProcessFactory(){
listProcess = new Hashtable();
listProcess = new ArrayList();
listType = new Hashtable();
initFactory();
}
public void initFactory(){
listType.put("broadcast", (Object)"fr.fluxmedia.transmorpher.Graph.Dispatch");
listType.put("concat", (Object)"fr.fluxmedia.transmorpher.Graph.Merge");
listType.put("xslt", (Object)"fr.fluxmedia.transmorpher.Graph.ApplyExternal");
listType.put("tmq", (Object)"fr.fluxmedia.transmorpher.Graph.ApplyQuery");
listType.put("readfile", (Object)"fr.fluxmedia.transmorpher.Graph.Generate");
listType.put("writefile", (Object)"fr.fluxmedia.transmorpher.Graph.Serialize");
// These two should be replaced by two different classes...
listType.put("standardInput", (Object)"fr.fluxmedia.transmorpher.Graph.Generate");
listType.put("standardOutput", (Object)"fr.fluxmedia.transmorpher.Graph.Serialize");
//listType.put("", (Object)"fr.fluxmedia.transmorpher.Graph.");
}
public JGraph createProcess(Object userObject){
public JGraph createProcess(Object userObject) throws FCException{
if(userObject != null)
{
GraphModel model = new ProcessGraphModel();
JGraph process = new ProcessGraph(model,null,userObject);
listProcess.put(((Process)userObject).getName(),process);
if(userObject instanceof MainProcess)
{
if( mainProcess != null)
{
throw new SingleMainProcessException("single main");
}
else
mainProcess = (ProcessGraph)process;
}
listProcess.add(process);
return process;
}
else return null;
......@@ -92,15 +99,24 @@ public class FCProcessFactory implements ProcessFactory{
return true;
}
public JGraph getProcess(Object index){
public JGraph getProcess(String index){
if(listProcess.containsKey(index))
return (JGraph)(listProcess.get(index));
else
return null;
}
Iterator it = getAllProcess().iterator();
String processName;
while (it.hasNext()) {
Object process = it.next();
processName = ((Process)(((ProcessGraph)process).getUserObject())).getName();
if(index.equals(processName));
{
return (ProcessGraph)process;
}
}
return null;
}
public Map getAllProcess(){
public List getAllProcess(){
return listProcess;
}
......@@ -109,7 +125,7 @@ public class FCProcessFactory implements ProcessFactory{
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\">");
Iterator it = ((getAllProcess()).values()).iterator();
Iterator it = getAllProcess().iterator();
while (it.hasNext()) {
Object process = it.next();
((ProcessGraph)process).generateRDF(file);
......
/**
*
*$Id: FlowComposer.java,v 1.33 2002-06-03 13:54:43 frederic Exp $
*$Id: FlowComposer.java,v 1.34 2002-06-03 17:19:30 gchomat Exp $
*
* Transmorpher
*
......@@ -12,7 +12,6 @@
* 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
......@@ -124,15 +123,12 @@ public class FlowComposer extends JPanel implements GraphModelListener,
//HastTable contains IHM element
protected Hashtable commands;
protected Hashtable buttons;
protected Hashtable menuItems;
protected Hashtable items;
protected JLabel message,scale;
protected JComponent status;
protected Rule colrule, rowrule;
protected JComboBox zoom;
protected static boolean isMetric = true;
/**Default width of the app*/
......@@ -249,8 +245,7 @@ public class FlowComposer extends JPanel implements GraphModelListener,
menuItems = new Hashtable();
items= new Hashtable();
// install the command table
// install the command table
commands = new Hashtable();
for (int i = 0; i < actions.length; i++) {
Action a = actions[i];
......@@ -261,23 +256,23 @@ public class FlowComposer extends JPanel implements GraphModelListener,
marqueeHandler = new FCMarqueeHandler(this);
processFactory = new FCProcessFactory();
buttons = createButtons();
createSpecialButtons();
buttons = createButtons();
// Add a ToolBar
JPanel center = new JPanel();
center.setLayout(new BorderLayout());
panel.add(createToolBar("toolbar1"),BorderLayout.NORTH);
center.add(createToolBar("toolbar2"),BorderLayout.NORTH);
Border etched = BorderFactory.createRaisedBevelBorder();
center.setBorder(etched);
//Add a JTabbedPane for represnting the process notion.
tabProcess= new JTabbedPane();
tabProcess.getModel().addChangeListener(
new ChangeListener() {
JPanel center = new JPanel();
center.setLayout(new BorderLayout());
panel.add(createToolBar("toolbar1"),BorderLayout.NORTH);
center.add(createToolBar("toolbar2"),BorderLayout.NORTH);
Border etched = BorderFactory.createRaisedBevelBorder();
center.setBorder(etched);
//Add a JTabbedPane for represnting the process notion.
tabProcess= new JTabbedPane();
tabProcess.getModel().addChangeListener(
new ChangeListener() {
public void stateChanged(ChangeEvent e) {
SingleSelectionModel model = (SingleSelectionModel) e.getSource();
if(model.getSelectedIndex() != -1) {
......@@ -302,12 +297,11 @@ public class FlowComposer extends JPanel implements GraphModelListener,
addProcess(new String("main"),MAIN);
// Add the Graph as Center Component
center.add(tabProcess, BorderLayout.CENTER);
panel.add(center,BorderLayout.CENTER);
this.add(createMenubar(),BorderLayout.NORTH);
this.add(panel,BorderLayout.CENTER);
this.add(status,BorderLayout.SOUTH);
this.add(status,BorderLayout.SOUTH);
}
public static void init() {
......@@ -379,6 +373,19 @@ public class FlowComposer extends JPanel implements GraphModelListener,
return new FlowComposer(filename, model);
}
public Point getGraphLocationOnscreen(){
Point result = null;
if(tabProcess!=null)
result = tabProcess.getLocationOnScreen();
return result;
}
public void addProcess(String name, int type){
UndoHandler undoHandler;
......@@ -395,25 +402,35 @@ public class FlowComposer extends JPanel implements GraphModelListener,
break;
case PROCESS:
process = new fr.fluxmedia.transmorpher.Graph.Process(name,transmorpher);
transmorpher.addTransformation(name,process);
//transmorpher.addTransformation(name,process);
break;
}
if(tabProcess != null )
{
currentProcess = processFactory.createProcess(process);
try{
currentProcess = processFactory.createProcess(process);
}
catch(SingleMainProcessException e)
{
Alert.show(null,e.getMessage(),resource.getString("WARNING"),JOptionPane.WARNING_MESSAGE);
return;
}
catch(FCException e)
{
return;
}
((ProcessGraph)currentProcess).setMarqueeHandler(marqueeHandler);
//marqueeHandler.setCurrentProcess(currentProcess);
undoHandler = new UndoHandler();
registerListeners(currentProcess);
currentProcess.getModel().addUndoableEditListener(undoHandler);
sp = new JScrollPane(currentProcess);
sp = (JScrollPane)(tabProcess.add(process.getName(),sp));
sp = (JScrollPane)(tabProcess.add(process.getName(),sp));
tabProcess.setSelectedComponent(sp);
currentProcess = (ProcessGraph)(sp.getViewport().getView());
//marqueeHandler.setCurrentProcess(currentProcess);
undoHandler.setProcess(currentProcess);
}
else
......@@ -579,20 +596,16 @@ public class FlowComposer extends JPanel implements GraphModelListener,
public Component createToolButton(String key) {
System.out.println(key);
AbstractButton b = null;
URL url;
Object button = buttons.get(key);
System.out.println(button);
url = getResource(key + imageSuffix);
if (button instanceof JComponent &&
!(button instanceof AbstractButton)&&(button!=null)) {
return (JComponent) button; }
else {
Object button;
AbstractButton b = null;
URL url;
url = getResource(key + imageSuffix);
button= buttons.get(key);
if (button instanceof AbstractButton) {
if (button instanceof AbstractButton) {
b = (AbstractButton) button;
b.setIcon(new ImageIcon(url));
} else {
......@@ -626,7 +639,6 @@ public class FlowComposer extends JPanel implements GraphModelListener,
}
return b;
}
}
......@@ -665,30 +677,28 @@ public class FlowComposer extends JPanel implements GraphModelListener,
***************************************************************************************************/
/**
* Stores the current L&F
*/