Skip to content

Commit

Permalink
Added a way to choose the frame size of the viewer.
Browse files Browse the repository at this point in the history
View.resizeFrame(int, int) is now avaiable.
Also changed the name of the view created by Graph.display() so that
the default view is created.
  • Loading branch information
Ant01n3 committed May 5, 2011
1 parent f044834 commit 7a8ee31
Show file tree
Hide file tree
Showing 6 changed files with 38 additions and 18 deletions.
24 changes: 11 additions & 13 deletions Roadmap
Expand Up @@ -4,7 +4,6 @@ Reorganisation
- Remove the old elasticBox package in ui.layout. - Remove the old elasticBox package in ui.layout.
- Where to put the ToolBox ? Is this the right name ? - Where to put the ToolBox ? Is this the right name ?



GraphStream Roadmap GraphStream Roadmap
=================== ===================


Expand All @@ -15,7 +14,6 @@ Legend:
- To do. - To do.
~ To figure out. ~ To figure out.



- Future: - Future:
--------- ---------
~ Add organisation/community detection methods (in tools ?). ~ Add organisation/community detection methods (in tools ?).
Expand Down Expand Up @@ -43,7 +41,7 @@ Legend:
- Add more metrics in tools: - Add more metrics in tools:
* Maintain the number of connected components (for static and dynamic graphs). * Maintain the number of connected components (for static and dynamic graphs).
* Modularity. * Modularity.
- diameter * diameter
* The APSP subproblem (all-pair shortest paths) needed to compute the * The APSP subproblem (all-pair shortest paths) needed to compute the
diameter. diameter.
* Use the APSP to store the paths (is there an efficient way to * Use the APSP to store the paths (is there an efficient way to
Expand All @@ -62,32 +60,32 @@ Legend:
iteratively in another thread with the GraphListenerProxy, etc.) iteratively in another thread with the GraphListenerProxy, etc.)


I/O I/O
- Add more features in the DGS format : * Add more features in the DGS format :
- Allow to remove attributes. * Allow to remove attributes.
- Allow to change attributes for the graph. * Allow to change attributes for the graph.
- Allow to change the direction of directed edges. / Allow to change the direction of directed edges.
~ Related : It is not possible to delete attributes from elements with the * Related : It is not possible to delete attributes from elements with the
GraphReader/GraphWriter interfaces. GraphReader/GraphWriter interfaces.
- Add more algorithms: - Add more algorithms:
~ Design a dynamic version of the dot file format ?. ~ Design a dynamic version of the dot file format ?.
~ It is not possible to change the orientation of an edge with the ~ It is not possible to change the orientation of an edge with the
GraphReader interface. GraphReader interface.
- Add a GraphWriterGML that can write "objects" (deserialisation). - Add a GraphWriterGML that can write "objects" (deserialisation).


~ How do GraphReader and GraphWriters should act: * How do GraphReader and GraphWriters should act:
- for the attributes when a change occur: add the attributes ? in this * for the attributes when a change occur: add the attributes ? in this
case how to delete attributes ? Replace the existing set of attributes case how to delete attributes ? Replace the existing set of attributes
by another ? In this case we have to specify the new set each time a by another ? In this case we have to specify the new set each time a
small change occurs. => a solution would be to propose a new API to small change occurs. => a solution would be to propose a new API to
treat attribute events separately. It would impose to remove all treat attribute events separately. It would impose to remove all
change node and edge events... change node and edge events...
- for the edge orientation changes. Actually the Graph API allows to * for the edge orientation changes. Actually the Graph API allows to
switch an edge direction, but the reader and writers cannot read or switch an edge direction, but the reader and writers cannot read or
output theses changes in dynamic graphs. output theses changes in dynamic graphs.
- Add a reader for the Chaco format (already in Go2). - Add a reader for the Chaco format (already in Go2).


Viewer Viewer
- Allow the SettingsWindow of the GraphPanel to be also embeddable in GUIs / Allow the SettingsWindow of the GraphPanel to be also embeddable in GUIs
as a panel. as a panel.
- Could be as a panel or - Could be as a panel or
- as a tool bar. - as a tool bar.
Expand All @@ -98,7 +96,7 @@ Legend:
* Add more metrics in tools: * Add more metrics in tools:
* Maintain the number of connected components (for static and dynamic graphs). * Maintain the number of connected components (for static and dynamic graphs).
* Modularity. * Modularity.
- diameter * diameter
* The APSP subproblem (all-pair shortest paths) needed to compute the * The APSP subproblem (all-pair shortest paths) needed to compute the
diameter. diameter.
* Use the APSP to store the paths (is there an efficient way to * Use the APSP to store the paths (is there an efficient way to
Expand Down
Expand Up @@ -848,11 +848,13 @@ public Viewer display(boolean autoLayout) {
Viewer viewer = new Viewer(this, Viewer viewer = new Viewer(this,
Viewer.ThreadingModel.GRAPH_IN_ANOTHER_THREAD); Viewer.ThreadingModel.GRAPH_IN_ANOTHER_THREAD);
GraphRenderer renderer = Viewer.newGraphRenderer(); GraphRenderer renderer = Viewer.newGraphRenderer();


viewer.addView(Viewer.DEFAULT_VIEW_ID, renderer);
/*
viewer.addView( viewer.addView(
String.format("defaultView_%d", (long) (Math.random() * 10000)), String.format("defaultView_%d", (long) (Math.random() * 10000)),
renderer); renderer);

*/
if (autoLayout) { if (autoLayout) {
Layout layout = Layouts.newLayoutAlgorithm(); Layout layout = Layouts.newLayoutAlgorithm();
viewer.enableAutoLayout(layout); viewer.enableAutoLayout(layout);
Expand Down
Expand Up @@ -832,10 +832,12 @@ public Viewer display(boolean autoLayout) {
Viewer.ThreadingModel.GRAPH_IN_ANOTHER_THREAD); Viewer.ThreadingModel.GRAPH_IN_ANOTHER_THREAD);
GraphRenderer renderer = Viewer.newGraphRenderer(); GraphRenderer renderer = Viewer.newGraphRenderer();


viewer.addView(Viewer.DEFAULT_VIEW_ID, renderer);
/*
viewer.addView( viewer.addView(
String.format("defaultView_%d", (long) (Math.random() * 10000)), String.format("defaultView_%d", (long) (Math.random() * 10000)),
renderer); renderer);

*/
if (autoLayout) { if (autoLayout) {
Layout layout = newLayoutAlgorithm(); Layout layout = newLayoutAlgorithm();
viewer.enableAutoLayout(layout); viewer.enableAutoLayout(layout);
Expand Down
6 changes: 4 additions & 2 deletions src/org/graphstream/graph/implementations/DefaultGraph.java
Expand Up @@ -817,10 +817,12 @@ public Viewer display(boolean autoLayout) {
Viewer.ThreadingModel.GRAPH_IN_ANOTHER_THREAD); Viewer.ThreadingModel.GRAPH_IN_ANOTHER_THREAD);
GraphRenderer renderer = Viewer.newGraphRenderer(); GraphRenderer renderer = Viewer.newGraphRenderer();


viewer.addView( viewer.addView(Viewer.DEFAULT_VIEW_ID, renderer);

/* viewer.addView(
String.format("defaultView_%d", (long) (Math.random() * 10000)), String.format("defaultView_%d", (long) (Math.random() * 10000)),
renderer); renderer);

*/
if (autoLayout) { if (autoLayout) {
Layout layout = Layouts.newLayoutAlgorithm(); Layout layout = Layouts.newLayoutAlgorithm();
viewer.enableAutoLayout(layout); viewer.enableAutoLayout(layout);
Expand Down
7 changes: 7 additions & 0 deletions src/org/graphstream/ui/swingViewer/DefaultView.java
Expand Up @@ -221,6 +221,13 @@ public void close(GraphicGraph graph) {
removeMouseMotionListener(mouseClicks); removeMouseMotionListener(mouseClicks);
openInAFrame(false); openInAFrame(false);
} }

@Override
public void resizeFrame(int width, int height) {
if(frame != null) {
frame.setSize(width, height);
}
}


@Override @Override
public void openInAFrame(boolean on) { public void openInAFrame(boolean on) {
Expand Down
9 changes: 9 additions & 0 deletions src/org/graphstream/ui/swingViewer/View.java
Expand Up @@ -185,6 +185,15 @@ public abstract void setBounds(double minx, double miny, double minz,
*/ */
public abstract void openInAFrame(boolean on); public abstract void openInAFrame(boolean on);


/**
* Set the size of the view frame, if any. If this view has been open in a frame, this changes
* the size of the frame containing it.
*
* @param width The new width.
* @param height The new height.
*/
public abstract void resizeFrame(int width, int height);

/** /**
* Reset the view to the automatic mode. * Reset the view to the automatic mode.
*/ */
Expand Down

0 comments on commit 7a8ee31

Please sign in to comment.