Satelite view support added graph2_milestone1
authordkaspar@netbeans.org
Sun, 02 Jul 2006 07:38:48 +0000
changeset 7293ff28529e6c51
parent 7292 745d7ad1bf65
child 7294 9780bc043454
Satelite view support added
visual.examples/src/org/netbeans/modules/visual/examples/RunDialog.java
visual.examples/src/test/multiview/MultiViewTest.java
visual.examples/src/test/object/ObjectTest.java
     1.1 --- a/visual.examples/src/org/netbeans/modules/visual/examples/RunDialog.java	Sun Jul 02 05:18:28 2006 +0000
     1.2 +++ b/visual.examples/src/org/netbeans/modules/visual/examples/RunDialog.java	Sun Jul 02 07:38:48 2006 +0000
     1.3 @@ -25,7 +25,7 @@
     1.4      public RunDialog() {
     1.5          initComponents();
     1.6          list.setModel(new javax.swing.AbstractListModel() {
     1.7 -            String[] strings = { "javaone.demo1.IconNodeWidget", "javaone.demo2.ActionDemo", "javaone.demo3.ConnectionDemo", "javaone.demo4.GraphDemo", "javaone.demo5.ManyObjectsDemo", "javaone.demo6.LODDemo", "test.general.GraphSceneTest", "test.huge.HugeTest", "test.lod.LevelOfDetailsTest", "test.vmd.VMDTest", "test.animator.AnimatorTest", "test.object.ObjectTest", "test.connect.ConnectScene", "test.connectionlabels.ConnectionLabelsTest", "test.devolve.DevolveTest", "test.swingborder.SwingBorderTest" };
     1.8 +            String[] strings = { "javaone.demo1.IconNodeWidget", "javaone.demo2.ActionDemo", "javaone.demo3.ConnectionDemo", "javaone.demo4.GraphDemo", "javaone.demo5.ManyObjectsDemo", "javaone.demo6.LODDemo", "test.general.GraphSceneTest", "test.huge.HugeTest", "test.lod.LevelOfDetailsTest", "test.vmd.VMDTest", "test.animator.AnimatorTest", "test.object.ObjectTest", "test.connect.ConnectScene", "test.connectionlabels.ConnectionLabelsTest", "test.devolve.DevolveTest", "test.swingborder.SwingBorderTest", "test.multiview.MultiViewTest" };
     1.9              public int getSize() { return strings.length; }
    1.10              public Object getElementAt(int i) { return strings[i]; }
    1.11          });
     2.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.2 +++ b/visual.examples/src/test/multiview/MultiViewTest.java	Sun Jul 02 07:38:48 2006 +0000
     2.3 @@ -0,0 +1,73 @@
     2.4 +/*
     2.5 + *                 Sun Public License Notice
     2.6 + *
     2.7 + * The contents of this file are subject to the Sun Public License
     2.8 + * Version 1.0 (the "License"). You may not use this file except in
     2.9 + * compliance with the License. A copy of the License is available at
    2.10 + * http://www.sun.com/
    2.11 + *
    2.12 + * The Original Code is NetBeans. The Initial Developer of the Original
    2.13 + * Code is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
    2.14 + * Microsystems, Inc. All Rights Reserved.
    2.15 + */
    2.16 +package test.multiview;
    2.17 +
    2.18 +import test.object.ObjectTest;
    2.19 +
    2.20 +import javax.swing.*;
    2.21 +import java.awt.*;
    2.22 +import java.awt.event.ActionEvent;
    2.23 +import java.awt.event.ActionListener;
    2.24 +
    2.25 +/**
    2.26 + * @author David Kaspar
    2.27 + */
    2.28 +public class MultiViewTest {
    2.29 +
    2.30 +    public static void main (String[] args) {
    2.31 +        final ObjectTest scene = new ObjectTest ();
    2.32 +        scene.addNode ("form [Form]");
    2.33 +        scene.addNode ("list [List]");
    2.34 +        scene.addNode ("canvas [Canvas]");
    2.35 +        scene.addNode ("alert [Alert]");
    2.36 +        scene.moveTo (null);
    2.37 +
    2.38 +        int width = 800, height = 600;
    2.39 +        JFrame frame = new JFrame ();//new JDialog (), true);
    2.40 +        Container contentPane = frame.getContentPane ();
    2.41 +        contentPane.setLayout (new BorderLayout ());
    2.42 +
    2.43 +        JComponent sceneView = scene.createView ();
    2.44 +
    2.45 +        JScrollPane panel = new JScrollPane (sceneView);
    2.46 +        panel.getHorizontalScrollBar ().setUnitIncrement (32);
    2.47 +        panel.getHorizontalScrollBar ().setBlockIncrement (256);
    2.48 +        panel.getVerticalScrollBar ().setUnitIncrement (32);
    2.49 +        panel.getVerticalScrollBar ().setBlockIncrement (256);
    2.50 +        contentPane.add (panel, BorderLayout.CENTER);
    2.51 +
    2.52 +//        contentPane.add (scene.createSateliteView (), BorderLayout.NORTH);
    2.53 +//        contentPane.add (scene.createSateliteView (), BorderLayout.SOUTH);
    2.54 +        contentPane.add (scene.createSateliteView (), BorderLayout.WEST);
    2.55 +//        contentPane.add (scene.createSateliteView (), BorderLayout.EAST);
    2.56 +
    2.57 +        final JButton button = new JButton ("Preview");
    2.58 +        button.addActionListener (new ActionListener() {
    2.59 +            public void actionPerformed (ActionEvent e) {
    2.60 +                JPopupMenu popup = new JPopupMenu ();
    2.61 +                popup.setLayout (new BorderLayout ());
    2.62 +                JComponent sateliteView = scene.createSateliteView ();
    2.63 +                popup.add (sateliteView, BorderLayout.CENTER);
    2.64 +                popup.show (button, (button.getSize ().width - sateliteView.getPreferredSize ().width) / 2, button.getSize ().height);
    2.65 +            }
    2.66 +        });
    2.67 +        contentPane.add (button, BorderLayout.NORTH);
    2.68 +
    2.69 +
    2.70 +        frame.setDefaultCloseOperation (JFrame.DISPOSE_ON_CLOSE);
    2.71 +        java.awt.Dimension screenSize = java.awt.Toolkit.getDefaultToolkit ().getScreenSize ();
    2.72 +        frame.setBounds ((screenSize.width - width) / 2, (screenSize.height - height) / 2, width, height);
    2.73 +        frame.setVisible (true);
    2.74 +    }
    2.75 +
    2.76 +}
     3.1 --- a/visual.examples/src/test/object/ObjectTest.java	Sun Jul 02 05:18:28 2006 +0000
     3.2 +++ b/visual.examples/src/test/object/ObjectTest.java	Sun Jul 02 07:38:48 2006 +0000
     3.3 @@ -86,7 +86,7 @@
     3.4  
     3.5      }
     3.6  
     3.7 -    private void moveTo (Point point) {
     3.8 +    public void moveTo (Point point) {
     3.9          Collection<NodeController.StringNode> nodes = getNodes ();
    3.10          int index = 0;
    3.11          for (NodeController.StringNode node : nodes)