Login | Register
My pages Projects Community openCollabNet

Discussions > issues > [Bug 270] New - constructor JGraph(GraphModel) doesn't interrogate GraphModel

gef
Discussion topic

Back to topic list

[Bug 270] New - constructor JGraph(GraphModel) doesn't interrogate GraphModel

Reply

Author bugmaster at tigris dot org
Full name bugmaster at tigris dot org
Date 2000-11-15 10:44:49 PST
Message http://www.tigris.or​g/bugs/show_bug.cgi?​id=270

*** shadow/270 Wed Nov 15 10:44:49 2000
--- shadow/270.tmp.20676 Wed Nov 15 10:44:49 2000
***************
*** 0 ****
--- 1,90 ----
+ Bug#: 270
+ Product: gef
+ Version: 0.7
+ Platform: Unspecified
+ OS/Version: All
+ Status: NEW
+ Resolution:
+ Severity: normal
+ Priority: P2
+ Component: dist
+ Area: BUILD
+ AssignedTo: bugs at gef dot tigris dot org
+ ReportedBy: auto108988 at hushmail dot com
+ URL:
+ Summary: constructor JGraph(GraphModel) doesn't interrogate GraphModel
+
+ Instantiating a JGraph using an implementation of the graph model interface
+ GraphModel is not sufficient to visualise the existing data in the model.
+
+ The graph model contains valid data, but nothing is drawn in the graph save
+ the grid layer. Using println debugging I can see that the graph never
+ interrogates the graphModel to build the visual representation of the graph.
+
+ I've also tried firing a graphChanged event to registered GraphListeners
+ (an instance of LayerPerspective), but the view does not react.
+
+ (the listener code & println debugging is not included in the test case)
+
+ ---
+
+ //: GefBug.java
+
+ import java.awt.*;
+ import java.util.*;
+ import javax.swing.*;
+
+ import org.tigris.gef.graph.*;
+ import org.tigris.gef.graph​.presentation.*;
+
+ public class GefBug {
+ public static final void main(String args[]) {
+ JFrame f = new JFrame("GefBug");
+
+ GraphModel model = new SimpleGraphModel();
+ JGraph graph = new JGraph(model);
+
+ f.getContentPane().a​dd("Center", graph);
+
+ f.pack();
+ f.setSize(new Dimension(400,400));
+ f.setVisible(true);
+ }
+ static class SimpleGraphModel implements GraphModel {
+ private String a = new String("a");
+ private String b = new String("b");
+ private String edge = new String("a->b");
+
+ // displays a simple graph: a -> b
+ // using the nodes themselves as ports
+
+ public Object getDestPort(Object edge) {
+ return b;
+ }
+ public Vector getEdges() {
+ return new Vector(Collections.s​ingleton(edge));
+ }
+ public Vector getInEdges(Object port) {
+ return port.equals(b) ? new Vector(Collections.s​ingleton(edge)) :
+ null;
+ }
+ public Vector getNodes() {
+ return new Vector(Arrays.asList(new Object[] { a,b }));
+ }
+ public Vector getOutEdges(Object port) {
+ return port.equals(a) ? new Vector(Collections.s​ingleton(edge)) :
+ null;
+ }
+ public Object getOwner(Object port) {
+ return port;
+ }
+ public Vector getPorts(Object nodeOrEdge) {
+ return new Vector(Collections.s​ingleton(nodeOrEdge)​);
+ }
+ public Object getSourcePort(Object edge) {
+ return a;
+ }
+ public void addGraphEventListene​r(GraphListener l) { }
+ public void removeGraphEventList​ener(GraphListener l) { }
+ }
+ }

« Previous message in topic | 1 of 1 | Next message in topic »

Messages

Show all messages in topic

[Bug 270] New - constructor JGraph(GraphModel) doesn't interrogate GraphModel bugmaster at tigris dot org bugmaster at tigris dot org 2000-11-15 10:44:49 PST
Messages per page: