]> git.argeo.org Git - lgpl/argeo-commons.git/blob - SimplePage.java
087efec00c029d66dcd3c296ef3bc7fa5f5b043e
[lgpl/argeo-commons.git] / SimplePage.java
1 package org.argeo.demo.i18n.editors;
2
3 import org.argeo.demo.i18n.I18nDemoMessages;
4 import org.eclipse.swt.layout.GridLayout;
5 import org.eclipse.swt.widgets.Composite;
6 import org.eclipse.ui.forms.AbstractFormPart;
7 import org.eclipse.ui.forms.IManagedForm;
8 import org.eclipse.ui.forms.editor.FormEditor;
9 import org.eclipse.ui.forms.editor.FormPage;
10 import org.eclipse.ui.forms.widgets.FormToolkit;
11 import org.eclipse.ui.forms.widgets.ScrolledForm;
12
13 /**
14 * Main node editor page. Lists all properties of the current node and enable
15 * access and editing for some of them.
16 */
17
18 public class SimplePage extends FormPage {
19 // private final static Log log = LogFactory.getLog(SimplePage.class);
20
21 // Utils
22 // protected DateFormat timeFormatter = new
23 // SimpleDateFormat(DATE_TIME_FORMAT);
24
25 // This page widgets
26 private FormToolkit tk;
27
28 // private List<Control> modifyableProperties = new ArrayList<Control>();
29
30 public SimplePage(FormEditor editor, String title) {
31 super(editor, "id", title);
32 }
33
34 protected void createFormContent(IManagedForm managedForm) {
35 tk = managedForm.getToolkit();
36 ScrolledForm form = managedForm.getForm();
37 GridLayout twt = new GridLayout(3, false);
38 twt.marginWidth = twt.marginHeight = 5;
39
40 form.getBody().setLayout(twt);
41 createPropertiesPart(form.getBody());
42 }
43
44 private void createPropertiesPart(Composite parent) {
45 // Initializes form part
46 tk.createLabel(parent, I18nDemoMessages.get().SimplePage_DescriptionTxt);
47 AbstractFormPart part = new AbstractFormPart() {
48 public void commit(boolean onSave) {
49 if (onSave) {
50
51 // We only commit when onSave = true,
52 // thus it is still possible to save after a tab
53 // change.
54 super.commit(onSave);
55 }
56 }
57 };
58
59 getManagedForm().addPart(part);
60
61 }
62
63 //
64 // LISTENERS
65 //
66 /*
67 * UNUSED FOR THE TIME BEING private class ModifiedFieldListener implements
68 * ModifyListener {
69 *
70 * private AbstractFormPart formPart;
71 *
72 * public ModifiedFieldListener(AbstractFormPart generalPart) {
73 * this.formPart = generalPart; }
74 *
75 * public void modifyText(ModifyEvent e) { formPart.markDirty(); } }
76 */
77 }