01: package org.romaframework.aspect.view.echo2.form;
02:
03: import nextapp.echo2.app.Column;
04: import nextapp.echo2.app.Component;
05: import nextapp.echo2.extras.app.layout.AccordionPaneLayoutData;
06:
07: import org.romaframework.aspect.view.ViewAspect;
08: import org.romaframework.aspect.view.echo2.component.ComponentFactory;
09: import org.romaframework.aspect.view.echo2.look.LookAndFeelManager;
10: import org.romaframework.aspect.view.feature.ViewBaseFeatures;
11: import org.romaframework.aspect.view.form.ContentComponent;
12: import org.romaframework.core.config.RomaApplicationContext;
13: import org.romaframework.core.flow.ObjectContext;
14: import org.romaframework.core.schema.SchemaField;
15: import org.romaframework.core.schema.SchemaObject;
16: import org.romaframework.core.validation.MultiValidationException;
17: import org.romaframework.core.validation.ValidationException;
18:
19: public class AccordionForm extends EntityForm {
20:
21: private Component container;
22:
23: public AccordionForm(ContentComponent iParent, SchemaField iField) {
24: super (iParent);
25:
26: if (!(iParent instanceof AccordionForm)) {
27: // ADD AS ACCORDIONPANE
28: container = ObjectContext.getInstance().getComponent(
29: ComponentFactory.class)
30: .createAccordionContainerComponent(this );
31: } else {
32: container = new Column();
33:
34: AccordionPaneLayoutData layout = new AccordionPaneLayoutData();
35: layout.setTitle((String) iField.getFeature(
36: ViewAspect.ASPECT_NAME, ViewBaseFeatures.LABEL));
37: this .setLayoutData(layout);
38: }
39: add(container);
40: }
41:
42: public void activate() {
43: }
44:
45: public void passivate() {
46: }
47:
48: @Override
49: public void validateValues() throws ValidationException,
50: MultiValidationException {
51: }
52:
53: @Override
54: public void bind(SchemaField iSchemaField, Object iValue) {
55: }
56:
57: public void render(ContentComponent iFormToRender) {
58: RomaApplicationContext
59: .getInstance()
60: .getBean(LookAndFeelManager.class)
61: .assignStyle(
62: this ,
63: getSchemaInstance().getSchemaClass().getClazz(),
64: (String) getSchemaInstance().getFeature(
65: ViewAspect.ASPECT_NAME,
66: ViewBaseFeatures.STYLE));
67:
68: RomaApplicationContext
69: .getInstance()
70: .getBean(LookAndFeelManager.class)
71: .assignStyle(
72: container,
73: getSchemaInstance().getSchemaClass().getClazz(),
74: (String) getSchemaInstance().getFeature(
75: ViewAspect.ASPECT_NAME,
76: ViewBaseFeatures.STYLE));
77:
78: SchemaObject obj = iFormToRender.getSchemaInstance();
79:
80: renderFormFields(obj, iFormToRender);
81: renderFormActions(obj, iFormToRender);
82: }
83:
84: public Component getContainer() {
85: return container;
86: }
87:
88: @Override
89: public void placeComponentInForm(String area, Component component) {
90: }
91: }
|