2 * Copyright (C) 2007-2012 Mathieu Baudier
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
16 package org
.argeo
.demo
.i18n
.editors
;
18 import org
.argeo
.demo
.i18n
.I18nDemoMessages
;
19 import org
.eclipse
.swt
.layout
.GridLayout
;
20 import org
.eclipse
.swt
.widgets
.Composite
;
21 import org
.eclipse
.ui
.forms
.AbstractFormPart
;
22 import org
.eclipse
.ui
.forms
.IManagedForm
;
23 import org
.eclipse
.ui
.forms
.editor
.FormEditor
;
24 import org
.eclipse
.ui
.forms
.editor
.FormPage
;
25 import org
.eclipse
.ui
.forms
.widgets
.FormToolkit
;
26 import org
.eclipse
.ui
.forms
.widgets
.ScrolledForm
;
29 * Main node editor page. Lists all properties of the current node and enable
30 * access and editing for some of them.
33 public class SimplePage
extends FormPage
{
34 // private final static Log log = LogFactory.getLog(SimplePage.class);
37 // protected DateFormat timeFormatter = new
38 // SimpleDateFormat(DATE_TIME_FORMAT);
41 private FormToolkit tk
;
43 // private List<Control> modifyableProperties = new ArrayList<Control>();
45 public SimplePage(FormEditor editor
, String title
) {
46 super(editor
, "id", title
);
49 protected void createFormContent(IManagedForm managedForm
) {
50 tk
= managedForm
.getToolkit();
51 ScrolledForm form
= managedForm
.getForm();
52 GridLayout twt
= new GridLayout(3, false);
53 twt
.marginWidth
= twt
.marginHeight
= 5;
55 form
.getBody().setLayout(twt
);
56 createPropertiesPart(form
.getBody());
59 private void createPropertiesPart(Composite parent
) {
60 // Initializes form part
61 tk
.createLabel(parent
, I18nDemoMessages
.get().SimplePage_DescriptionTxt
);
62 AbstractFormPart part
= new AbstractFormPart() {
63 public void commit(boolean onSave
) {
66 // We only commit when onSave = true,
67 // thus it is still possible to save after a tab
74 getManagedForm().addPart(part
);
82 * UNUSED FOR THE TIME BEING private class ModifiedFieldListener implements
85 * private AbstractFormPart formPart;
87 * public ModifiedFieldListener(AbstractFormPart generalPart) {
88 * this.formPart = generalPart; }
90 * public void modifyText(ModifyEvent e) { formPart.markDirty(); } }