summaryrefslogtreecommitdiff
path: root/projects/net.wotonomy.test/src/main/java/net/wotonomy/test/BindingController.java
blob: c7f9c9bde3b298807de754dd10c4e9a1f65fee47 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
package net.wotonomy.test;

//import net.wotonomy.foundation.*;
import javax.swing.JDialog;

import net.wotonomy.ui.EOAssociation;
import net.wotonomy.ui.EODisplayGroup;
import net.wotonomy.ui.swing.TreeAssociation;
import net.wotonomy.ui.swing.util.WindowUtilities;

/**
 * A simple editor panel with a few textfields.
 */
public class BindingController {
	public BindingController(EODisplayGroup titlesGroup, EODisplayGroup childGroup) {
		BindingPanel bindingPanel = new BindingPanel();

		EOAssociation ta;
		ta = new TreeAssociation(bindingPanel.treeChooser, "People");
		ta.bindAspect(EOAssociation.TitlesAspect, titlesGroup, "lastName");
		ta.bindAspect(EOAssociation.ChildrenAspect, childGroup, "children");
		ta.bindAspect(EOAssociation.IsLeafAspect, titlesGroup, "childCount");
		ta.establishConnection();

		JDialog d = new JDialog();
		d.getContentPane().add(bindingPanel);
		d.setTitle("Chooser Panel");
		d.pack();
		WindowUtilities.cascade(d);
		d.show();
	}

}