Commit 08281d38 authored by Guillaume Chomat's avatar Guillaume Chomat
Browse files

implemented observer/observable for port

parent 4c3740b3
......@@ -56,7 +56,7 @@
</section>
<section><title>Contexte materiel</title>
<section><title>Contexte matériel</title>
<para><emphasis>Définir le profil minimun de la machine nécessaire pour exécuter FlowComposer</emphasis></para>
<para></para>
</section>
......
/**
* $Id: ApplyExternalCell.java,v 1.4 2002-06-03 17:19:30 gchomat Exp $
* $Id: ApplyExternalCell.java,v 1.5 2002-06-13 12:04:50 gchomat Exp $
*
* Transmorpher
*
......@@ -29,18 +29,24 @@ import com.jgraph.graph.DefaultGraphCell;
import java.util.Observer;
import java.util.Observable;
import fr.fluxmedia.transmorpher.Graph.Call;
public class ApplyExternalCell extends DefaultGraphCell implements Observer{
public class ApplyExternalCell extends FCGraphCell {
public ApplyExternalCell() {
this(null);
this(null,null);
}
public ApplyExternalCell(Object userObject) {
super(userObject);
public ApplyExternalCell(Object userObject,ProcessGraph process) {
super(userObject,process);
if(userObject instanceof Call && ((Call)userObject).getType().equals("xslt"))
{
newPort(FCConstants.PORTOUTPUT);
newPort(FCConstants.PORTINPUT);
}
}
public void update(Observable o, Object arg){
super.update(o,arg);
}
}
/**
* $Id: ApplyProcessCell.java,v 1.3 2002-06-03 17:19:30 gchomat Exp $
* $Id: ApplyProcessCell.java,v 1.4 2002-06-13 12:04:50 gchomat Exp $
*
* Transmorpher
*
......@@ -38,14 +38,14 @@ import java.util.Observer;
import java.util.Observable;
public class ApplyProcessCell extends DefaultGraphCell implements Observer{
public class ApplyProcessCell extends FCGraphCell{
public ApplyProcessCell() {
this(null);
this(null,null);
}
public ApplyProcessCell(Object userObject) {
super(userObject);
public ApplyProcessCell(Object userObject,ProcessGraph process) {
super(userObject,process);
}
public void update(Observable o, Object arg){
......
/**
* $Id: ApplyQueryCell.java,v 1.3 2002-06-03 17:19:30 gchomat Exp $
* $Id: ApplyQueryCell.java,v 1.4 2002-06-13 12:04:50 gchomat Exp $
*
* Transmorpher
*
......@@ -37,18 +37,20 @@ import java.util.Observer;
import java.util.Observable;
public class ApplyQueryCell extends DefaultGraphCell implements Observer{
public class ApplyQueryCell extends FCGraphCell{
public ApplyQueryCell() {
this(null);
this(null,null);
}
public ApplyQueryCell(Object userObject) {
super(userObject);
public ApplyQueryCell(Object userObject, ProcessGraph process) {
super(userObject,process);
newPort(FCConstants.PORTOUTPUT);
newPort(FCConstants.PORTINPUT);
}
}
public void update(Observable o, Object arg){
super.update(o,arg);
}
}
/**
* $Id: ApplyRulesetCell.java,v 1.5 2002-06-04 08:43:18 gchomat Exp $
* $Id: ApplyRulesetCell.java,v 1.6 2002-06-13 12:04:50 gchomat Exp $
*
* Transmorpher
*
......@@ -30,17 +30,19 @@ import java.util.Observer;
import java.util.Observable;
public class ApplyRulesetCell extends DefaultGraphCell implements Observer{
public class ApplyRulesetCell extends FCGraphCell{
public ApplyRulesetCell() {
this(null);
this(null,null);
}
public ApplyRulesetCell(Object userObject) {
super(userObject);
public ApplyRulesetCell(Object userObject,ProcessGraph process) {
super(userObject,process);
newPort(FCConstants.PORTOUTPUT);
newPort(FCConstants.PORTINPUT);
}
public void update(Observable o, Object arg){
super.update(o,arg);
}
}
/**
* $Id: DispatchCell.java,v 1.4 2002-06-03 17:19:30 gchomat Exp $
* $Id: DispatchCell.java,v 1.5 2002-06-13 12:04:50 gchomat Exp $
*
* Transmorpher
*
......@@ -29,17 +29,19 @@ import com.jgraph.graph.DefaultGraphCell;
import java.util.Observer;
import java.util.Observable;
public class DispatchCell extends DefaultGraphCell implements Observer{
public class DispatchCell extends FCGraphCell{
public DispatchCell() {
this(null);
this(null,null);
}
public DispatchCell(Object userObject) {
super(userObject);
public DispatchCell(Object userObject,ProcessGraph process) {
super(userObject,process);
newPort(FCConstants.PORTINPUT);
}
public void update(Observable o, Object arg){
super.update(o,arg);
}
}
/**
* $Id: FCConstants.java,v 1.6 2002-06-10 09:47:41 gchomat Exp $
* $Id: FCConstants.java,v 1.7 2002-06-13 12:04:50 gchomat Exp $
*
* Transmorpher
*
......@@ -52,8 +52,8 @@ public class FCConstants{
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 int PORTOUTPUT = 0;
public static final int PORTINPUT = 1;
public static final Object[] MERGETYPE = new Object[]{"concat"};
public static final Object[] DISPATCHTYPE = new Object[]{"broadcast"};
......
......@@ -30,24 +30,28 @@ public class FCPortRenderer extends PortRenderer {
* to add specific painting.
*/
public void paint(Graphics g) {
Dimension d = getSize();
g.setColor(graph.getBackground());
g.setXORMode(graph.getBackground());
if (preview) {
g.setColor(getBackground());
//g.setColor(Color.red);
g.drawRect(1, 1, d.width-3, d.height-3);
g.drawRect(2, 2, d.width-5, d.height-5);
}
boolean offset = (GraphConstants.getOffset(view.getAttributes()) != null);
g.setColor(getForeground());
if (offset) {
g.drawRect(1, 1, d.width-3,d.height-3);
} else if (!preview)
// g.setColor(Color.red);
g.drawRect(2, 2, d.width-4, d.height-4);
Dimension d = getSize();
g.setColor(graph.getBackground());
//g.setXORMode(graph.getBackground());
if (preview) {
g.setColor(getBackground());
//g.setColor(Color.red);
g.drawRect(1, 1, d.width-3, d.height-3);
g.drawRect(2, 2, d.width-5, d.height-5);
}
boolean offset = (GraphConstants.getOffset(view.getAttributes()) != null);
g.setColor(getForeground());
if (offset) {
g.drawRect(1, 1, d.width-3,d.height-3);
} else if (!preview)
{
// g.setColor(Color.red);
g.drawRect(2, 2, d.width-3, d.height-3);
g.setColor(getBackground());
g.drawRect(2, 2, d.width-5, d.height-5);
}
}
}
/**
*
*$Id: FCPortView.java,v 1.3 2002-06-11 09:42:51 frederic Exp $
*$Id: FCPortView.java,v 1.4 2002-06-13 12:04:50 gchomat Exp $
*
* Transmorpher
*
......@@ -42,11 +42,11 @@ import java.awt.Rectangle;
public class FCPortView extends PortView{
/** Renderer for the class. */
/** Renderer for the class. */
public static FCPortRenderer renderer = new FCPortRenderer();
protected static int size = 10;
protected static int size = 15;
/**
......@@ -73,8 +73,8 @@ public class FCPortView extends PortView{
return bounds;
}
public CellViewRenderer getRenderer() {
return renderer;
}
public CellViewRenderer getRenderer() {
return renderer;
}
}
/**
*
*$Id: FlowComposer.java,v 1.44 2002-06-13 11:26:24 frederic Exp $
*$Id: FlowComposer.java,v 1.45 2002-06-13 12:04:50 gchomat Exp $
*
* Transmorpher
*
......@@ -943,8 +943,7 @@ public class FlowComposer extends JPanel implements GraphModelListener,
// View Observer
public void update(Observable obs, Object arg) {
//System.out.println("View " + obs + " " + arg);
update();
update();
}
......@@ -956,8 +955,6 @@ public class FlowComposer extends JPanel implements GraphModelListener,
if (inserted != null && inserted.length > 0)
currentProcess.setSelectionCells(inserted);
update();
}
......
/**
* $Id: GenerateCell.java,v 1.5 2002-06-03 17:19:30 gchomat Exp $
* $Id: GenerateCell.java,v 1.6 2002-06-13 12:04:50 gchomat Exp $
*
* Transmorpher
*
......@@ -36,17 +36,18 @@ import com.jgraph.graph.DefaultGraphCell;
import java.util.Observer;
import java.util.Observable;
public class GenerateCell extends DefaultGraphCell implements Observer{
public class GenerateCell extends FCGraphCell{
public GenerateCell() {
this(null);
this(null,null);
}
public GenerateCell(Object userObject) {
super(userObject);
public GenerateCell(Object userObject,ProcessGraph process) {
super(userObject,process);
newPort(FCConstants.PORTOUTPUT);
}
public void update(Observable o, Object arg){
super.update(o,arg);
}
}
/**
* $Id: MergeCell.java,v 1.7 2002-06-11 13:28:08 gchomat Exp $
* $Id: MergeCell.java,v 1.8 2002-06-13 12:04:50 gchomat Exp $
*
* Transmorpher
*
......@@ -30,62 +30,27 @@ import fr.fluxmedia.transmorpher.Graph.*;
import java.util.Observer;
import java.util.Observable;
public class MergeCell extends DefaultGraphCell implements Observer{
public class MergeCell extends FCGraphCell{
public MergeCell() {
this(null);
this(null,null);
}
public MergeCell(Object userObject) {
super(userObject);
public MergeCell(Object userObject,ProcessGraph process) {
super(userObject,process);
newPort(FCConstants.PORTOUTPUT);
}
public void update(Observable o, Object arg){
if(o instanceof Call)
{
if(arg instanceof Port)
{
}
}
super.update(o,arg);
}
public void newPort(int type){
if(userObject != null && userObject instanceof Merge)
{
Merge merge = (Merge)userObject;
Port port;
if(type == FCConstants.PORTOUTPUT)
{
port= new Port("",merge,FCConstants.PORTOUTPUT);
merge.addOut(port);
}
else
{
port= new Port("",merge,FCConstants.PORTINPUT);
merge.addIn(port);
}
}
}
/*public String toString(){
if(userObject instanceof Call)
{
System.out.println("id "+((Call)userObject).toString());
return ((Call)userObject).toString();
}
else
{
return "";
}
return getId();
}*/
......
/**
* $Id: SerializeCell.java,v 1.3 2002-06-03 17:19:30 gchomat Exp $
* $Id: SerializeCell.java,v 1.4 2002-06-13 12:04:50 gchomat Exp $
*
* Transmorpher
*
......@@ -36,17 +36,18 @@ import com.jgraph.graph.DefaultGraphCell;
import java.util.Observer;
import java.util.Observable;
public class SerializeCell extends DefaultGraphCell implements Observer{
public class SerializeCell extends FCGraphCell{
public SerializeCell() {
this(null);
this(null,null);
}
public SerializeCell(Object userObject) {
super(userObject);
public SerializeCell(Object userObject,ProcessGraph process) {
super(userObject,process);
newPort(FCConstants.PORTINPUT);
}
public void update(Observable o, Object arg){
public void update(Observable o, Object arg){
super.update(o,arg);
}
}
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