1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18 package org.vectomatic.svg.edit.client.inspector;
19
20 import org.vectomatic.svg.edit.client.model.IFieldFactory;
21 import org.vectomatic.svg.edit.client.model.IMetadata;
22 import org.vectomatic.svg.edit.client.model.ModelCategory;
23
24 import com.extjs.gxt.ui.client.Style.Scroll;
25 import com.extjs.gxt.ui.client.widget.form.FormPanel;
26 import com.extjs.gxt.ui.client.widget.form.FormPanel.LabelAlign;
27 import com.extjs.gxt.ui.client.widget.layout.FormData;
28
29
30
31
32
33
34
35 public class GenericSectionFactory implements IInspectorSectionFactory {
36 public static final IInspectorSectionFactory INSTANCE = new GenericSectionFactory();
37 public IInspectorSection createSection(ModelCategory<?> category) {
38 FormPanel formPanel = new FormPanel();
39 formPanel.setLabelAlign(LabelAlign.TOP);
40 FormData formData = new FormData("95%");
41 for (IMetadata<?,?> m : category.getMetadata()) {
42 IFieldFactory fieldFactory = m.getFieldFactory();
43 if (fieldFactory != null) {
44 formPanel.add(fieldFactory.createField(m), formData);
45 }
46 }
47 formPanel.setScrollMode(Scroll.AUTOY);
48 return new FormInspectorSection(formPanel, category);
49 }
50 }