1 package net.wotonomy.test;
2
3
4 import javax.swing.JDialog;
5
6 import net.wotonomy.ui.EOAssociation;
7 import net.wotonomy.ui.EODisplayGroup;
8 import net.wotonomy.ui.swing.TreeAssociation;
9 import net.wotonomy.ui.swing.util.WindowUtilities;
10
11 /***
12 * A simple editor panel with a few textfields.
13 */
14 public class BindingController
15 {
16 public BindingController( EODisplayGroup titlesGroup, EODisplayGroup childGroup )
17 {
18 BindingPanel bindingPanel = new BindingPanel();
19
20 EOAssociation ta;
21 ta = new TreeAssociation( bindingPanel.treeChooser, "People" );
22 ta.bindAspect( EOAssociation.TitlesAspect, titlesGroup, "lastName" );
23 ta.bindAspect( EOAssociation.ChildrenAspect, childGroup, "children" );
24 ta.bindAspect( EOAssociation.IsLeafAspect, titlesGroup, "childCount" );
25 ta.establishConnection();
26
27 JDialog d = new JDialog();
28 d.getContentPane().add( bindingPanel );
29 d.setTitle( "Chooser Panel" );
30 d.pack();
31 WindowUtilities.cascade( d );
32 d.show();
33 }
34
35 }