]> git.argeo.org Git - gpl/argeo-slc.git/blobdiff - plugins/org.argeo.slc.akb.ui/src/main/java/org/argeo/slc/akb/ui/editors/AkbItemTemplateEditor.java
Add AKB icons
[gpl/argeo-slc.git] / plugins / org.argeo.slc.akb.ui / src / main / java / org / argeo / slc / akb / ui / editors / AkbItemTemplateEditor.java
index 272a88f457f14504fa42e31a30ec1c8dcf5d7717..dbe0b684c2fcb4a0e0fae46095dd661174373f14 100644 (file)
@@ -7,9 +7,13 @@ import org.eclipse.swt.layout.GridData;
 import org.eclipse.swt.widgets.Composite;
 import org.eclipse.ui.PartInitException;
 import org.eclipse.ui.forms.IManagedForm;
+import org.eclipse.ui.forms.editor.FormEditor;
+import org.eclipse.ui.forms.editor.FormPage;
+import org.eclipse.ui.forms.widgets.ScrolledForm;
 
 /**
- * Display and edit a connector Alias
+ * Parent class for most akb items editor. Factorizes UI parts that are common
+ * in various item types.
  */
 public abstract class AkbItemTemplateEditor extends AbstractAkbNodeEditor {
 
@@ -27,14 +31,42 @@ public abstract class AkbItemTemplateEditor extends AbstractAkbNodeEditor {
                Composite bottomCmp = getToolkit().createComposite(parent);
                gd = new GridData(SWT.FILL, SWT.FILL, true, true);
                bottomCmp.setLayoutData(gd);
-               populateBottomPart(bottomCmp);
+               populateBottomPart(bottomCmp, managedForm);
        }
 
        @Override
        protected void addOtherPages() throws PartInitException {
-               // TODO implement addition of the test page
+               addPage(new TestPage(this, "testPage", "Test"));
        }
 
        /** Overwrite to add specific bottom part depending on the item type */
-       abstract protected void populateBottomPart(Composite parent);
+       abstract protected void populateBottomPart(Composite parent,
+                       IManagedForm managedForm);
+
+       /**
+        * Display history
+        */
+       private class TestPage extends FormPage {
+
+               public TestPage(FormEditor editor, String id, String title) {
+                       super(editor, id, title);
+               }
+
+               protected void createFormContent(IManagedForm managedForm) {
+                       super.createFormContent(managedForm);
+                       ScrolledForm form = managedForm.getForm();
+                       form.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
+                       Composite parent = form.getBody();
+                       populateTestPage(parent);
+               }
+       }
+
+       protected void populateTestPage(Composite parent) {
+               parent.setLayout(AkbUiUtils.gridLayoutNoBorder());
+               getToolkit().createLabel(
+                               parent,
+                               "This page will display a test page "
+                                               + "using default connection for the chosen alias");
+       }
+
 }
\ No newline at end of file