Copyright (c) 2001, Junzo Sato. All rights reserved.

yFiles with J/Link

The yFiles is a Java package produced by the company yWorks.
This notebook shows a brief demonstration of yFiles using J/Link based on demo files in yFiles distribution.

July 30th 2001

Junzo SATO

Department Of Medical Information Technology,
Kumamoto University Hospital,
University Of Kumamoto

Email <jsato@fc.kuh.kumamoto-u.ac.jp>
URL <http://fc.kuh.kumamoto-u.ac.jp/~jsato/>

Initialization

J/Link environment is loaded.

[Graphics:Images/Math-yFiles_gr_1.gif]
[Graphics:Images/Math-yFiles_gr_2.gif]
[Graphics:Images/Math-yFiles_gr_3.gif]
[Graphics:Images/Math-yFiles_gr_4.gif]
[Graphics:Images/Math-yFiles_gr_5.gif]

YList from ListDemo.java

[Graphics:Images/Math-yFiles_gr_6.gif]

A simple YList object is created.

[Graphics:Images/Math-yFiles_gr_7.gif]
[Graphics:Images/Math-yFiles_gr_8.gif]

Integers are added to the list.

[Graphics:Images/Math-yFiles_gr_9.gif]
[Graphics:Images/Math-yFiles_gr_10.gif]

Contents of the list are printed out.

[Graphics:Images/Math-yFiles_gr_11.gif]
[Graphics:Images/Math-yFiles_gr_12.gif]
[Graphics:Images/Math-yFiles_gr_13.gif]
[Graphics:Images/Math-yFiles_gr_14.gif]
[Graphics:Images/Math-yFiles_gr_15.gif]
[Graphics:Images/Math-yFiles_gr_16.gif]
[Graphics:Images/Math-yFiles_gr_17.gif]
[Graphics:Images/Math-yFiles_gr_18.gif]
[Graphics:Images/Math-yFiles_gr_19.gif]
[Graphics:Images/Math-yFiles_gr_20.gif]
[Graphics:Images/Math-yFiles_gr_21.gif]

The order of elements in the list is reversed.

[Graphics:Images/Math-yFiles_gr_22.gif]

Now we can show numbers in reversed order.

[Graphics:Images/Math-yFiles_gr_23.gif]
[Graphics:Images/Math-yFiles_gr_24.gif]
[Graphics:Images/Math-yFiles_gr_25.gif]
[Graphics:Images/Math-yFiles_gr_26.gif]
[Graphics:Images/Math-yFiles_gr_27.gif]
[Graphics:Images/Math-yFiles_gr_28.gif]
[Graphics:Images/Math-yFiles_gr_29.gif]
[Graphics:Images/Math-yFiles_gr_30.gif]
[Graphics:Images/Math-yFiles_gr_31.gif]
[Graphics:Images/Math-yFiles_gr_32.gif]
[Graphics:Images/Math-yFiles_gr_33.gif]
[Graphics:Images/Math-yFiles_gr_34.gif]

Instead of using cursor object for an iterator, cell is adopted.

[Graphics:Images/Math-yFiles_gr_35.gif]
[Graphics:Images/Math-yFiles_gr_36.gif]
[Graphics:Images/Math-yFiles_gr_37.gif]
[Graphics:Images/Math-yFiles_gr_38.gif]
[Graphics:Images/Math-yFiles_gr_39.gif]
[Graphics:Images/Math-yFiles_gr_40.gif]
[Graphics:Images/Math-yFiles_gr_41.gif]
[Graphics:Images/Math-yFiles_gr_42.gif]
[Graphics:Images/Math-yFiles_gr_43.gif]
[Graphics:Images/Math-yFiles_gr_44.gif]
[Graphics:Images/Math-yFiles_gr_45.gif]
[Graphics:Images/Math-yFiles_gr_46.gif]
[Graphics:Images/Math-yFiles_gr_47.gif]
[Graphics:Images/Math-yFiles_gr_48.gif]
[Graphics:Images/Math-yFiles_gr_49.gif]
[Graphics:Images/Math-yFiles_gr_50.gif]
[Graphics:Images/Math-yFiles_gr_51.gif]
[Graphics:Images/Math-yFiles_gr_52.gif]
[Graphics:Images/Math-yFiles_gr_53.gif]
[Graphics:Images/Math-yFiles_gr_54.gif]
[Graphics:Images/Math-yFiles_gr_55.gif]
[Graphics:Images/Math-yFiles_gr_56.gif]
[Graphics:Images/Math-yFiles_gr_57.gif]
[Graphics:Images/Math-yFiles_gr_58.gif]

Graph from GraphDemo.java

The following is the example of the graph which has some nodes and edges.

[Graphics:Images/Math-yFiles_gr_59.gif]
[Graphics:Images/Math-yFiles_gr_60.gif]
[Graphics:Images/Math-yFiles_gr_61.gif]
[Graphics:Images/Math-yFiles_gr_62.gif]
[Graphics:Images/Math-yFiles_gr_63.gif]
[Graphics:Images/Math-yFiles_gr_64.gif]
[Graphics:Images/Math-yFiles_gr_65.gif]
[Graphics:Images/Math-yFiles_gr_66.gif]
[Graphics:Images/Math-yFiles_gr_67.gif]
[Graphics:Images/Math-yFiles_gr_68.gif]
[Graphics:Images/Math-yFiles_gr_69.gif]
[Graphics:Images/Math-yFiles_gr_70.gif]
[Graphics:Images/Math-yFiles_gr_71.gif]
[Graphics:Images/Math-yFiles_gr_72.gif]
[Graphics:Images/Math-yFiles_gr_73.gif]
[Graphics:Images/Math-yFiles_gr_74.gif]
[Graphics:Images/Math-yFiles_gr_75.gif]
[Graphics:Images/Math-yFiles_gr_76.gif]
[Graphics:Images/Math-yFiles_gr_77.gif]
[Graphics:Images/Math-yFiles_gr_78.gif]
[Graphics:Images/Math-yFiles_gr_79.gif]
[Graphics:Images/Math-yFiles_gr_80.gif]
[Graphics:Images/Math-yFiles_gr_81.gif]
[Graphics:Images/Math-yFiles_gr_82.gif]
[Graphics:Images/Math-yFiles_gr_83.gif]
[Graphics:Images/Math-yFiles_gr_84.gif]
[Graphics:Images/Math-yFiles_gr_85.gif]
[Graphics:Images/Math-yFiles_gr_86.gif]
[Graphics:Images/Math-yFiles_gr_87.gif]
[Graphics:Images/Math-yFiles_gr_88.gif]
[Graphics:Images/Math-yFiles_gr_89.gif]
[Graphics:Images/Math-yFiles_gr_90.gif]
[Graphics:Images/Math-yFiles_gr_91.gif]
[Graphics:Images/Math-yFiles_gr_92.gif]
[Graphics:Images/Math-yFiles_gr_93.gif]
[Graphics:Images/Math-yFiles_gr_94.gif]
[Graphics:Images/Math-yFiles_gr_95.gif]
[Graphics:Images/Math-yFiles_gr_96.gif]
[Graphics:Images/Math-yFiles_gr_97.gif]
[Graphics:Images/Math-yFiles_gr_98.gif]
[Graphics:Images/Math-yFiles_gr_99.gif]
[Graphics:Images/Math-yFiles_gr_100.gif]
[Graphics:Images/Math-yFiles_gr_101.gif]
[Graphics:Images/Math-yFiles_gr_102.gif]
[Graphics:Images/Math-yFiles_gr_103.gif]
[Graphics:Images/Math-yFiles_gr_104.gif]
[Graphics:Images/Math-yFiles_gr_105.gif]
[Graphics:Images/Math-yFiles_gr_106.gif]
[Graphics:Images/Math-yFiles_gr_107.gif]
[Graphics:Images/Math-yFiles_gr_108.gif]
[Graphics:Images/Math-yFiles_gr_109.gif]
[Graphics:Images/Math-yFiles_gr_110.gif]
[Graphics:Images/Math-yFiles_gr_111.gif]
[Graphics:Images/Math-yFiles_gr_112.gif]
[Graphics:Images/Math-yFiles_gr_113.gif]
[Graphics:Images/Math-yFiles_gr_114.gif]
[Graphics:Images/Math-yFiles_gr_115.gif]

Graph2DView from SimpleDemo.java

[Graphics:Images/Math-yFiles_gr_116.gif]

Graph2DView and EditMode are created.

[Graphics:Images/Math-yFiles_gr_117.gif]
[Graphics:Images/Math-yFiles_gr_118.gif]
[Graphics:Images/Math-yFiles_gr_119.gif]
[Graphics:Images/Math-yFiles_gr_120.gif]
[Graphics:Images/Math-yFiles_gr_121.gif]

Java Swing's JPanel are created. The view is added to this panel.

[Graphics:Images/Math-yFiles_gr_122.gif]
[Graphics:Images/Math-yFiles_gr_123.gif]
[Graphics:Images/Math-yFiles_gr_124.gif]
[Graphics:Images/Math-yFiles_gr_125.gif]

The panel is attached to the MathJFrame so that we can see the visible view.

[Graphics:Images/Math-yFiles_gr_126.gif]
[Graphics:Images/Math-yFiles_gr_127.gif]
[Graphics:Images/Math-yFiles_gr_128.gif]
[Graphics:Images/Math-yFiles_gr_129.gif]
[Graphics:Images/Math-yFiles_gr_130.gif]

A simple editable view is shown. Creating nodes and edges are done by using mouse operations.

[Graphics:Images/Math-yFiles_gr_131.gif]

Components on the view are listed.

[Graphics:Images/Math-yFiles_gr_132.gif]
[Graphics:Images/Math-yFiles_gr_133.gif]
[Graphics:Images/Math-yFiles_gr_134.gif]
[Graphics:Images/Math-yFiles_gr_135.gif]

The mode of Graph2DCanvas is changed from 'free' to 'grid'.

[Graphics:Images/Math-yFiles_gr_136.gif]
[Graphics:Images/Math-yFiles_gr_137.gif]
[Graphics:Images/Math-yFiles_gr_138.gif]
[Graphics:Images/Math-yFiles_gr_139.gif]

Grid mode has been changed. Nodes are centerized their positions on grid points by dragging with mouse.

[Graphics:Images/Math-yFiles_gr_140.gif]

[Graphics:Images/Math-yFiles_gr_141.gif]
[Graphics:Images/Math-yFiles_gr_142.gif]

Finalization

[Graphics:Images/Math-yFiles_gr_143.gif]
[Graphics:Images/Math-yFiles_gr_144.gif]
[Graphics:Images/Math-yFiles_gr_145.gif]

Afterwords

Though examples shown above are very simple, I hope users would be able to understand how to load yFiles from Mathematica. Further informations about yFiles are available from the company's website.
The author thanks to Mr. Kazuo Ozawa at Sumisho Electronics Co. Ltd.  for giving an opportunity to evaluate yFiles package.


Converted by Mathematica      August 10, 2001