01: package org.osbl.orga.gui;
02:
03: import org.osbl.client.wings.form.*;
04: import org.osbl.client.wings.form.editor.ManyToOneAssociationEditor;
05: import org.osbl.client.wings.form.layouter.*;
06: import org.osbl.client.wings.shell.Client;
07: import org.osbl.ServiceProvider;
08: import org.osbl.persistence.*;
09: import org.osbl.orga.model.*;
10: import org.conform.AbstractDomainProvider;
11: import org.osbl.identity.model.Identity;
12: import org.osbl.identity.model.Department;
13: import org.osbl.identity.gui.*;
14: import org.conform.*;
15: import org.conform.modifier.InlineModifier;
16:
17: import java.util.List;
18: import java.util.ArrayList;
19:
20: public class GroupForm extends GenericObjectForm implements
21: HierarchicalContextAware {
22: private IdentityConcreteDomainProvider departmentDomain = new IdentityConcreteDomainProvider(
23: "identity") {
24: protected List createValues() {
25: Organisation organisation = (Organisation) context
26: .getObject("organisation");
27: setConcrete(organisation.getGroupType());
28: return super .createValues();
29: }
30: };
31:
32: public void setContext(ObjectContext context) {
33: super .setContext(context);
34: departmentDomain.refresh();
35: }
36:
37: @Override
38: protected Object getObject(String path) {
39: if (ComponentProvider.ROOT.equals(path))
40: return object;
41:
42: return null;
43: }
44:
45: @Override
46: protected void setObject(String path, Object object) {
47: if (ComponentProvider.ROOT.equals(path))
48: this .object = object;
49: }
50:
51: @Override
52: protected Instruction createLayoutInstruction() {
53: return new Page(Group.class.getName(), new Division(Group.class
54: .getName(), new Column(new LabelAndEditor(
55: ComponentProvider.ROOT, "key"), new LabelAndEditor(
56: ComponentProvider.ROOT, "name"), new LabelAndEditor(
57: ComponentProvider.ROOT, "identity")),
58: new Column(
59: new LabelAndEditors("businessobject.created",
60: new Editor(ComponentProvider.ROOT,
61: "created"), new Editor(
62: ComponentProvider.ROOT,
63: "createdBy")))));
64: }
65:
66: @Override
67: protected BeanMeta createBeanMeta(String path) {
68: return new VariationBeanMetaProvider(Client.getInstance()
69: .getBeanMetaProvider()).addModifier(
70: new InlineModifier() {
71: protected void configure() {
72: property("key").setWritable(true);
73: property("identity").setDomainProvider(
74: departmentDomain);
75: property("identity").setFormat(
76: Client.getInstance()
77: .getBeanMetaProvider()
78: .getBeanMeta(Identity.class)
79: .getFormat());
80: property("identity").setAttribute(
81: org.conform.wings.Editor.CUSTOM_EDITOR,
82: new ManyToOneAssociationEditor());
83: property("identity").setAttribute(
84: "objectEditor", new IdentityEditor());
85: property("path").setApplicable(false);
86: property("tree").setApplicable(false);
87: }
88: }).getBeanMeta(Group.class);
89: }
90:
91: public void setNode(GenericObjectTreeNode node) {
92: }
93: }
|