Difference between revisions of "GEF Zest Visualization"

From Eclipsepedia

Jump to: navigation, search
(Getting Started)
(Changed this into a redirect to GEF, as the zest documentation has been moved to the org.eclipse.zest.doc.isv plug-in.)
 
(22 intermediate revisions by 9 users not shown)
Line 1: Line 1:
[[Category:Mylar]]  
+
#REDIRECT [[Graphical_Editing_Framework]]
 
+
Zest is visualization toolkit for Eclipse.  The primary goal of Zest is to make graph based programming easy.  Using Zest, Graphs are considered SWT Components which have been wrapped using standard JFace viewers.  This allows developers to use Zest the same way they use JFace Tables, Trees and Lists.  Please visit our main page at http://www.eclipse.org/mylar/zest.php.
+
 
+
== Getting Started ==
+
The following code snippet shows how to get a simple graph up and running using an SWT style interface. In this example, a graph is created with 3 nodes and 3 edges.  The nodes are labeled rock, paper scissors.  To use this example you need to download zest core, zest layouts and draw2D.
+
 
+
/*******************************************************************************
+
  * Copyright 2005-2007, CHISEL Group, University of Victoria, Victoria, BC,
+
  * Canada. All rights reserved. This program and the accompanying materials are
+
  * made available under the terms of the Eclipse Public License v1.0 which
+
  * accompanies this distribution, and is available at
+
  * http://www.eclipse.org/legal/epl-v10.html
+
  *
+
  * Contributors: The Chisel Group, University of Victoria
+
  ******************************************************************************/
+
package org.eclipse.mylar.zest.examples.swt;
+
 
+
import org.eclipse.mylar.zest.core.widgets.Graph;
+
import org.eclipse.mylar.zest.core.widgets.GraphConnection;
+
import org.eclipse.mylar.zest.core.widgets.GraphNode;
+
import org.eclipse.mylar.zest.layouts.LayoutStyles;
+
import org.eclipse.mylar.zest.layouts.algorithms.SpringLayoutAlgorithm;
+
import org.eclipse.swt.SWT;
+
import org.eclipse.swt.layout.FillLayout;
+
import org.eclipse.swt.widgets.Display;
+
import org.eclipse.swt.widgets.Shell;
+
 
+
/**
+
  * This snippet creates a very simpl graph where Rock is connected to Paper
+
  * which is connected to scissors which is connected to rock.
+
  *
+
  * The nodes a layed out using a SpringLayout Algorithm, and they can be moved
+
  * around.
+
  *
+
  *
+
  * @author Ian Bull
+
  *
+
  */
+
public class GraphSnippet1 {
+
/**
+
* @param args
+
*/
+
public static void main(String[] args) {
+
// Create the shell
+
Display d = new Display();
+
Shell shell = new Shell(d);
+
shell.setText("GraphSnippet1");
+
shell.setLayout(new FillLayout());
+
shell.setSize(400, 400);
+
+
Graph g = new Graph(shell, SWT.NONE);
+
GraphNode n = new GraphNode(g, SWT.NONE, "Paper");
+
GraphNode n2 = new GraphNode(g, SWT.NONE, "Rock");
+
GraphNode n3 = new GraphNode(g, SWT.NONE, "Scissors");
+
new GraphConnection(g, SWT.NONE, n, n2);
+
new GraphConnection(g, SWT.NONE, n2, n3);
+
new GraphConnection(g, SWT.NONE, n3, n);
+
g.setLayoutAlgorithm(new SpringLayoutAlgorithm(LayoutStyles.NO_LAYOUT_NODE_RESIZING), true);
+
+
shell.open();
+
while (!shell.isDisposed()) {
+
while (!d.readAndDispatch()) {
+
d.sleep();
+
}
+
}
+
}
+
}
+
 
+
== Layout Algorithms ==
+
 
+
== Zest Viewers ==
+

Latest revision as of 11:32, 17 October 2013

  1. REDIRECT Graphical_Editing_Framework