01: package org.osbl.orga.gui;
02:
03: import org.osbl.client.wings.form.GenericObjectForm;
04: import org.osbl.client.wings.form.ComponentProvider;
05: import org.osbl.client.wings.form.format.BusinessObjectFormat;
06: import org.osbl.client.wings.form.editor.OneToManyCompositionEditor;
07: import org.osbl.client.wings.form.layouter.*;
08: import org.osbl.client.wings.shell.Client;
09: import org.osbl.identity.model.Identity;
10: import org.osbl.orga.model.Member;
11: import org.conform.BeanMeta;
12: import org.conform.VariationBeanMetaProvider;
13: import org.conform.wings.editor.DefaultEditor;
14: import org.conform.modifier.InlineModifier;
15:
16: public class MemberForm extends GenericObjectForm {
17: public MemberForm() {
18: }
19:
20: protected Instruction createLayoutInstruction() {
21: return new PageSet(new Page(Member.class.getName(),
22: new Division(new Column(new Title(Member.class
23: .getName()), new LabelAndEditor(
24: ComponentProvider.ROOT, "identity"),
25: new LabelAndEditor(ComponentProvider.ROOT,
26: "relationships")))));
27: }
28:
29: protected Object getObject(String path) {
30: return object;
31: }
32:
33: protected void setObject(String path, Object object) {
34: this .object = object;
35: }
36:
37: public void setObject(Object object) {
38: context.putObject("member", object);
39: if (object != null && context.getObject("organisation") == null)
40: context.putObject("organisation", ((Member) object)
41: .getOrganisation());
42: super .setObject(object);
43: }
44:
45: protected BeanMeta createBeanMeta(String path) {
46: VariationBeanMetaProvider provider = new VariationBeanMetaProvider(
47: Client.getInstance().getBeanMetaProvider());
48: provider.addModifier(new InlineModifier() {
49: protected void configure() {
50: property("identity").setAttribute(
51: org.conform.wings.Editor.CUSTOM_EDITOR,
52: new DefaultEditor());
53: property("identity").setFormat(
54: new BusinessObjectFormat());
55:
56: property("relationships").setAttribute(
57: org.conform.wings.Editor.CUSTOM_EDITOR,
58: new OneToManyCompositionEditor());
59: RelationshipEditor relationshipEditor = new RelationshipEditor();
60: relationshipEditor.setContext(getContext());
61: property("relationships").setAttribute("objectEditor",
62: relationshipEditor);
63: }
64: });
65: return provider.getBeanMeta(Member.class);
66: }
67: }
|