01: package org.osbl.identity.gui;
02:
03: import org.osbl.client.wings.form.layouter.*;
04: import org.osbl.client.wings.shell.Client;
05: import org.osbl.client.wings.form.*;
06: import org.osbl.client.ClientServiceProvider;
07: import org.osbl.identity.model.*;
08: import org.osbl.persistence.model.General;
09: import org.osbl.plugin.*;
10: import org.conform.*;
11: import org.conform.modifier.InlineModifier;
12:
13: import java.util.List;
14:
15: public class IdentityForm extends ExtendableGenericObjectForm {
16: public IdentityForm() {
17: addSubForm(new QualificationsSubForm());
18:
19: final PluginManager pluginManager = (PluginManager) ClientServiceProvider
20: .getInstance().getService("ClientPluginManager");
21: final ExtensionPoint extensionPoint = new ExtensionPoint(
22: "org.osbl.identity.subForm", ObjectSubForm.class);
23: final List<Extension> list = pluginManager
24: .getExtensions(extensionPoint);
25: for (Extension extension : list) {
26: Class<GenericObjectSubForm> subFormClass = (Class<GenericObjectSubForm>) extension
27: .getImplementation();
28: try {
29: GenericObjectSubForm subForm = subFormClass
30: .newInstance();
31: addSubForm(subForm);
32: } catch (Exception e) {
33: throw new RuntimeException(e);
34: }
35: }
36: }
37:
38: protected Instruction createLayoutInstruction() {
39: return new PageSet(new Page(Identity.class.getName(),
40: new Division(new Column(new Title(General.class
41: .getName()
42: + ".concretes")), new Column(new Title(
43: Identity.class.getName()), new LabelAndEditor(
44: ComponentProvider.ROOT, "key"),
45: new LabelAndEditors("businessobject.created",
46: new Editor(ComponentProvider.ROOT,
47: "created"), new Editor(
48: ComponentProvider.ROOT,
49: "createdBy"))))));
50: }
51:
52: protected Object getObject(String path) {
53: if (ComponentProvider.ROOT.equals(path))
54: return object;
55: else
56: return super .getObject(path);
57: }
58:
59: protected void setObject(String path, Object object) {
60: if (ComponentProvider.ROOT.equals(path))
61: this .object = object;
62: else
63: super .setObject(path, object);
64: }
65:
66: protected BeanMeta createBeanMeta(String path) {
67: if (ComponentProvider.ROOT == path) {
68: VariationBeanMetaProvider provider = new VariationBeanMetaProvider(
69: Client.getInstance().getBeanMetaProvider());
70: provider.addModifier(new InlineModifier() {
71: protected void configure() {
72: property("key").setWritable(true);
73: property("key").setMandatory(true);
74: }
75: });
76: return provider.getBeanMeta(Identity.class);
77: }
78: return super.createBeanMeta(path);
79: }
80: }
|