geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sppa...@apache.org
Subject svn commit: r326759 - /geronimo/devtools/trunk/modules/eclipse-plugin/plugins/org.apache.geronimo.ui/src/org/apache/geronimo/ui/pages/
Date Wed, 19 Oct 2005 23:41:24 GMT
Author: sppatel
Date: Wed Oct 19 16:41:19 2005
New Revision: 326759

URL: http://svn.apache.org/viewcvs?rev=326759&view=rev
Log:
refactor to absractformpart

Added:
    geronimo/devtools/trunk/modules/eclipse-plugin/plugins/org.apache.geronimo.ui/src/org/apache/geronimo/ui/pages/AbstractGeronimoFormPage.java
Modified:
    geronimo/devtools/trunk/modules/eclipse-plugin/plugins/org.apache.geronimo.ui/src/org/apache/geronimo/ui/pages/AppGeneralPage.java
    geronimo/devtools/trunk/modules/eclipse-plugin/plugins/org.apache.geronimo.ui/src/org/apache/geronimo/ui/pages/ConnectorOverviewPage.java
    geronimo/devtools/trunk/modules/eclipse-plugin/plugins/org.apache.geronimo.ui/src/org/apache/geronimo/ui/pages/EjbOverviewPage.java
    geronimo/devtools/trunk/modules/eclipse-plugin/plugins/org.apache.geronimo.ui/src/org/apache/geronimo/ui/pages/NamingFormPage.java
    geronimo/devtools/trunk/modules/eclipse-plugin/plugins/org.apache.geronimo.ui/src/org/apache/geronimo/ui/pages/SecurityPage.java
    geronimo/devtools/trunk/modules/eclipse-plugin/plugins/org.apache.geronimo.ui/src/org/apache/geronimo/ui/pages/WebGeneralPage.java

Added: geronimo/devtools/trunk/modules/eclipse-plugin/plugins/org.apache.geronimo.ui/src/org/apache/geronimo/ui/pages/AbstractGeronimoFormPage.java
URL: http://svn.apache.org/viewcvs/geronimo/devtools/trunk/modules/eclipse-plugin/plugins/org.apache.geronimo.ui/src/org/apache/geronimo/ui/pages/AbstractGeronimoFormPage.java?rev=326759&view=auto
==============================================================================
--- geronimo/devtools/trunk/modules/eclipse-plugin/plugins/org.apache.geronimo.ui/src/org/apache/geronimo/ui/pages/AbstractGeronimoFormPage.java
(added)
+++ geronimo/devtools/trunk/modules/eclipse-plugin/plugins/org.apache.geronimo.ui/src/org/apache/geronimo/ui/pages/AbstractGeronimoFormPage.java
Wed Oct 19 16:41:19 2005
@@ -0,0 +1,92 @@
+/**
+ * Copyright 2004, 2005 The Apache Software Foundation or its licensors, as applicable
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+package org.apache.geronimo.ui.pages;
+
+import org.apache.geronimo.ui.editors.AbstractGeronimoDeploymentPlanEditor;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+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.ExpandableComposite;
+import org.eclipse.ui.forms.widgets.FormToolkit;
+import org.eclipse.ui.forms.widgets.ScrolledForm;
+import org.eclipse.ui.forms.widgets.Section;
+
+public abstract class AbstractGeronimoFormPage extends FormPage {
+
+    EObject deploymentPlan;
+
+    FormToolkit toolkit;
+
+    Composite body;
+
+    /**
+     * @param editor
+     * @param id
+     * @param title
+     */
+    public AbstractGeronimoFormPage(FormEditor editor, String id, String title) {
+        super(editor, id, title);
+    }
+
+    /**
+     * @param id
+     * @param title
+     */
+    public AbstractGeronimoFormPage(String id, String title) {
+        super(id, title);
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see org.eclipse.ui.forms.editor.FormPage#createFormContent(org.eclipse.ui.forms.IManagedForm)
+     */
+    protected void createFormContent(IManagedForm managedForm) {
+        deploymentPlan = ((AbstractGeronimoDeploymentPlanEditor) getEditor())
+                .getDeploymentPlan();
+        body = managedForm.getForm().getBody();
+        toolkit = managedForm.getToolkit();
+        ScrolledForm form = managedForm.getForm();
+        form.setText(getTitle());
+        form.getBody().setLayout(getLayout());
+        fillBody(managedForm);
+        form.reflow(true);
+    }
+
+    protected GridLayout getLayout() {
+        GridLayout layout = new GridLayout();
+        layout.numColumns = 2;
+        layout.horizontalSpacing = 20;
+        layout.makeColumnsEqualWidth = true;
+        return layout;
+    }
+
+    protected int getStyle() {
+        return ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED
+                | ExpandableComposite.TITLE_BAR | Section.DESCRIPTION
+                | ExpandableComposite.FOCUS_TITLE;
+    }
+
+    abstract protected void fillBody(IManagedForm managedForm);
+
+    public EObject getDeploymentPlan() {
+        return deploymentPlan;
+    }
+
+}

Modified: geronimo/devtools/trunk/modules/eclipse-plugin/plugins/org.apache.geronimo.ui/src/org/apache/geronimo/ui/pages/AppGeneralPage.java
URL: http://svn.apache.org/viewcvs/geronimo/devtools/trunk/modules/eclipse-plugin/plugins/org.apache.geronimo.ui/src/org/apache/geronimo/ui/pages/AppGeneralPage.java?rev=326759&r1=326758&r2=326759&view=diff
==============================================================================
--- geronimo/devtools/trunk/modules/eclipse-plugin/plugins/org.apache.geronimo.ui/src/org/apache/geronimo/ui/pages/AppGeneralPage.java
(original)
+++ geronimo/devtools/trunk/modules/eclipse-plugin/plugins/org.apache.geronimo.ui/src/org/apache/geronimo/ui/pages/AppGeneralPage.java
Wed Oct 19 16:41:19 2005
@@ -15,22 +15,14 @@
  */
 package org.apache.geronimo.ui.pages;
 
-import org.apache.geronimo.ui.editors.ApplicationPlanEditor;
 import org.apache.geronimo.ui.sections.AppGeneralSection;
 import org.apache.geronimo.ui.sections.DependencySection;
 import org.apache.geronimo.ui.sections.ImportSection;
 import org.apache.geronimo.xml.ns.j2ee.application.ApplicationPackage;
-import org.apache.geronimo.xml.ns.j2ee.application.ApplicationType;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Composite;
 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.ExpandableComposite;
-import org.eclipse.ui.forms.widgets.ScrolledForm;
-import org.eclipse.ui.forms.widgets.Section;
 
-public class AppGeneralPage extends FormPage {
+public class AppGeneralPage extends AbstractGeronimoFormPage {
 
     /**
      * @param editor
@@ -52,41 +44,20 @@
     /*
      * (non-Javadoc)
      * 
-     * @see org.eclipse.ui.forms.editor.FormPage#createFormContent(org.eclipse.ui.forms.IManagedForm)
+     * @see org.apache.geronimo.ui.pages.AbstractGeronimoFormPage#fillBody(org.eclipse.ui.forms.IManagedForm)
      */
-    protected void createFormContent(IManagedForm managedForm) {
-        ScrolledForm form = managedForm.getForm();
-        form.setText(getTitle());
-        GridLayout layout = new GridLayout();
-        layout.numColumns = 2;
-        layout.horizontalSpacing = 20;
-        layout.makeColumnsEqualWidth = true;
-        form.getBody().setLayout(layout);
-        fillBody(managedForm);
-        form.reflow(true);
-    }
-
-    private void fillBody(IManagedForm managedForm) {
-
-        ApplicationType plan = (ApplicationType) ((ApplicationPlanEditor) getEditor())
-                .getDeploymentPlan();
+    protected void fillBody(IManagedForm managedForm) {
 
-        Composite body = managedForm.getForm().getBody();
+        managedForm.addPart(new AppGeneralSection(body, toolkit, getStyle(),
+                getDeploymentPlan()));
 
-        int style = ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED
-                | ExpandableComposite.TITLE_BAR | Section.DESCRIPTION
-                | ExpandableComposite.FOCUS_TITLE;
-
-        managedForm.addPart(new AppGeneralSection(body, managedForm
-                .getToolkit(), style, plan));
-
-        managedForm.addPart(new DependencySection(plan,
+        managedForm.addPart(new DependencySection(getDeploymentPlan(),
                 ApplicationPackage.eINSTANCE.getApplicationType_Dependency(),
-                body, managedForm.getToolkit(), style));
-        
-        managedForm.addPart(new ImportSection(plan,
-                ApplicationPackage.eINSTANCE.getApplicationType_Import(),
-                body, managedForm.getToolkit(), style));
+                body, toolkit, getStyle()));
+
+        managedForm.addPart(new ImportSection(getDeploymentPlan(),
+                ApplicationPackage.eINSTANCE.getApplicationType_Import(), body,
+                toolkit, getStyle()));
     }
 
 }

Modified: geronimo/devtools/trunk/modules/eclipse-plugin/plugins/org.apache.geronimo.ui/src/org/apache/geronimo/ui/pages/ConnectorOverviewPage.java
URL: http://svn.apache.org/viewcvs/geronimo/devtools/trunk/modules/eclipse-plugin/plugins/org.apache.geronimo.ui/src/org/apache/geronimo/ui/pages/ConnectorOverviewPage.java?rev=326759&r1=326758&r2=326759&view=diff
==============================================================================
--- geronimo/devtools/trunk/modules/eclipse-plugin/plugins/org.apache.geronimo.ui/src/org/apache/geronimo/ui/pages/ConnectorOverviewPage.java
(original)
+++ geronimo/devtools/trunk/modules/eclipse-plugin/plugins/org.apache.geronimo.ui/src/org/apache/geronimo/ui/pages/ConnectorOverviewPage.java
Wed Oct 19 16:41:19 2005
@@ -15,22 +15,14 @@
  */
 package org.apache.geronimo.ui.pages;
 
-import org.apache.geronimo.ui.editors.ConnectorPlanEditor;
 import org.apache.geronimo.ui.sections.ConnectorGeneralSection;
 import org.apache.geronimo.ui.sections.DependencySection;
 import org.apache.geronimo.ui.sections.ImportSection;
 import org.apache.geronimo.xml.ns.j2ee.connector.ConnectorPackage;
-import org.apache.geronimo.xml.ns.j2ee.connector.ConnectorType;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Composite;
 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.ExpandableComposite;
-import org.eclipse.ui.forms.widgets.ScrolledForm;
-import org.eclipse.ui.forms.widgets.Section;
 
-public class ConnectorOverviewPage extends FormPage {
+public class ConnectorOverviewPage extends AbstractGeronimoFormPage {
 
     /**
      * @param editor
@@ -49,44 +41,20 @@
         super(id, title);
     }
 
-    /*
-     * (non-Javadoc)
-     * 
-     * @see org.eclipse.ui.forms.editor.FormPage#createFormContent(org.eclipse.ui.forms.IManagedForm)
+    /* (non-Javadoc)
+     * @see org.apache.geronimo.ui.pages.AbstractGeronimoFormPage#fillBody(org.eclipse.ui.forms.IManagedForm)
      */
-    protected void createFormContent(IManagedForm managedForm) {
-        ScrolledForm form = managedForm.getForm();
-        form.setText(getTitle());
-        GridLayout layout = new GridLayout();
-        layout.numColumns = 2;
-        layout.horizontalSpacing = 20;
-        layout.makeColumnsEqualWidth = true;
-        form.getBody().setLayout(layout);
-        fillBody(managedForm);
-        form.reflow(true);
-    }
-
     protected void fillBody(IManagedForm managedForm) {
 
-        ConnectorType plan = (ConnectorType) ((ConnectorPlanEditor) getEditor())
-                .getDeploymentPlan();
-
-        Composite body = managedForm.getForm().getBody();
-
-        int style = ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED
-                | ExpandableComposite.TITLE_BAR | Section.DESCRIPTION
-                | ExpandableComposite.FOCUS_TITLE;
-
-        managedForm.addPart(new ConnectorGeneralSection(body, managedForm
-                .getToolkit(), style, plan));
+        managedForm.addPart(new ConnectorGeneralSection(body, toolkit, getStyle(), getDeploymentPlan()));
 
-        managedForm.addPart(new DependencySection(plan,
+        managedForm.addPart(new DependencySection(getDeploymentPlan(),
                 ConnectorPackage.eINSTANCE.getConnectorType_Dependency(), body,
-                managedForm.getToolkit(), style));
+                toolkit, getStyle()));
 
-        managedForm.addPart(new ImportSection(plan, ConnectorPackage.eINSTANCE
-                .getConnectorType_Import(), body, managedForm.getToolkit(),
-                style));
+        managedForm.addPart(new ImportSection(getDeploymentPlan(), ConnectorPackage.eINSTANCE
+                .getConnectorType_Import(), body, toolkit,
+                getStyle()));
     }
 
 }

Modified: geronimo/devtools/trunk/modules/eclipse-plugin/plugins/org.apache.geronimo.ui/src/org/apache/geronimo/ui/pages/EjbOverviewPage.java
URL: http://svn.apache.org/viewcvs/geronimo/devtools/trunk/modules/eclipse-plugin/plugins/org.apache.geronimo.ui/src/org/apache/geronimo/ui/pages/EjbOverviewPage.java?rev=326759&r1=326758&r2=326759&view=diff
==============================================================================
--- geronimo/devtools/trunk/modules/eclipse-plugin/plugins/org.apache.geronimo.ui/src/org/apache/geronimo/ui/pages/EjbOverviewPage.java
(original)
+++ geronimo/devtools/trunk/modules/eclipse-plugin/plugins/org.apache.geronimo.ui/src/org/apache/geronimo/ui/pages/EjbOverviewPage.java
Wed Oct 19 16:41:19 2005
@@ -15,22 +15,14 @@
  */
 package org.apache.geronimo.ui.pages;
 
-import org.apache.geronimo.ui.editors.OpenEjbPlanEditor;
 import org.apache.geronimo.ui.sections.DependencySection;
 import org.apache.geronimo.ui.sections.ImportSection;
 import org.apache.geronimo.ui.sections.OpenEjbJarGeneralSection;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Composite;
 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.ExpandableComposite;
-import org.eclipse.ui.forms.widgets.ScrolledForm;
-import org.eclipse.ui.forms.widgets.Section;
 import org.openejb.xml.ns.openejb.jar.JarPackage;
-import org.openejb.xml.ns.openejb.jar.OpenejbJarType;
 
-public class EjbOverviewPage extends FormPage {
+public class EjbOverviewPage extends AbstractGeronimoFormPage {
 
     /**
      * @param editor
@@ -49,42 +41,23 @@
         super(id, title);
     }
 
-    /* (non-Javadoc)
-     * @see org.eclipse.ui.forms.editor.FormPage#createFormContent(org.eclipse.ui.forms.IManagedForm)
+    /*
+     * (non-Javadoc)
+     * 
+     * @see org.apache.geronimo.ui.pages.AbstractGeronimoFormPage#fillBody(org.eclipse.ui.forms.IManagedForm)
      */
-    protected void createFormContent(IManagedForm managedForm) {
-        ScrolledForm form = managedForm.getForm();
-        form.setText(getTitle());
-        GridLayout layout = new GridLayout();
-        layout.numColumns = 2;
-        layout.horizontalSpacing = 20;
-        layout.makeColumnsEqualWidth = true;
-        form.getBody().setLayout(layout);
-        fillBody(managedForm);
-        form.reflow(true);
-    }
-
     protected void fillBody(IManagedForm managedForm) {
 
-        OpenejbJarType plan = (OpenejbJarType) ((OpenEjbPlanEditor) getEditor())
-                .getDeploymentPlan();
-
-        Composite body = managedForm.getForm().getBody();
+        managedForm.addPart(new OpenEjbJarGeneralSection(body, toolkit,
+                getStyle(), getDeploymentPlan()));
 
-        int style = ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED
-                | ExpandableComposite.TITLE_BAR | Section.DESCRIPTION
-                | ExpandableComposite.FOCUS_TITLE;
-
-        managedForm.addPart(new OpenEjbJarGeneralSection(body,
-                managedForm.getToolkit(), style, plan));
-        
-        managedForm.addPart(new DependencySection(plan,
+        managedForm.addPart(new DependencySection(getDeploymentPlan(),
                 JarPackage.eINSTANCE.getOpenejbJarType_Dependency(), body,
-                managedForm.getToolkit(), style));
+                toolkit, getStyle()));
 
-        managedForm.addPart(new ImportSection(plan, JarPackage.eINSTANCE
-                .getOpenejbJarType_Import(), body, managedForm.getToolkit(),
-                style));
+        managedForm.addPart(new ImportSection(getDeploymentPlan(),
+                JarPackage.eINSTANCE.getOpenejbJarType_Import(), body, toolkit,
+                getStyle()));
 
     }
 

Modified: geronimo/devtools/trunk/modules/eclipse-plugin/plugins/org.apache.geronimo.ui/src/org/apache/geronimo/ui/pages/NamingFormPage.java
URL: http://svn.apache.org/viewcvs/geronimo/devtools/trunk/modules/eclipse-plugin/plugins/org.apache.geronimo.ui/src/org/apache/geronimo/ui/pages/NamingFormPage.java?rev=326759&r1=326758&r2=326759&view=diff
==============================================================================
--- geronimo/devtools/trunk/modules/eclipse-plugin/plugins/org.apache.geronimo.ui/src/org/apache/geronimo/ui/pages/NamingFormPage.java
(original)
+++ geronimo/devtools/trunk/modules/eclipse-plugin/plugins/org.apache.geronimo.ui/src/org/apache/geronimo/ui/pages/NamingFormPage.java
Wed Oct 19 16:41:19 2005
@@ -15,23 +15,15 @@
  */
 package org.apache.geronimo.ui.pages;
 
-import org.apache.geronimo.ui.editors.AbstractGeronimoDeploymentPlanEditor;
 import org.apache.geronimo.ui.sections.EjbLocalRefSection;
 import org.apache.geronimo.ui.sections.EjbRefSection;
 import org.apache.geronimo.ui.sections.ResourceEnvRefSection;
 import org.apache.geronimo.ui.sections.ResourceRefSection;
-import org.eclipse.emf.ecore.EObject;
 import org.eclipse.emf.ecore.EReference;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Composite;
 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.ExpandableComposite;
-import org.eclipse.ui.forms.widgets.ScrolledForm;
-import org.eclipse.ui.forms.widgets.Section;
 
-public class NamingFormPage extends FormPage {
+public class NamingFormPage extends AbstractGeronimoFormPage {
 
     public EReference resRef;
 
@@ -49,49 +41,19 @@
         super(id, title);
     }
 
-    /*
-     * (non-Javadoc)
-     * 
-     * @see org.eclipse.ui.forms.editor.FormPage#createFormContent(org.eclipse.ui.forms.IManagedForm)
-     */
-    protected void createFormContent(IManagedForm managedForm) {
-
-        ScrolledForm form = managedForm.getForm();
-        form.setText(getTitle());
-        GridLayout layout = new GridLayout();
-        layout.numColumns = 2;
-        layout.horizontalSpacing = 20;
-
-        form.getBody().setLayout(layout);
-
-        fillBody(managedForm);
-
-        form.reflow(true);
-
-    }
-
-    private void fillBody(IManagedForm managedForm) {
-
-        EObject plan = ((AbstractGeronimoDeploymentPlanEditor) getEditor())
-                .getDeploymentPlan();
 
-        Composite body = managedForm.getForm().getBody();
-
-        int style = ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED
-                | ExpandableComposite.TITLE_BAR | Section.DESCRIPTION
-                | ExpandableComposite.FOCUS_TITLE;
-
-        managedForm.addPart(new ResourceRefSection(plan, body, managedForm
-                .getToolkit(), style, resRef));
+    /* (non-Javadoc)
+     * @see org.apache.geronimo.ui.pages.AbstractGeronimoFormPage#fillBody(org.eclipse.ui.forms.IManagedForm)
+     */
+    protected void fillBody(IManagedForm managedForm) {
+        
+        managedForm.addPart(new ResourceRefSection(getDeploymentPlan(), body, toolkit, getStyle(),
resRef));
 
-        managedForm.addPart(new ResourceEnvRefSection(plan, body, managedForm
-                .getToolkit(), style, resEnvRef));
+        managedForm.addPart(new ResourceEnvRefSection(getDeploymentPlan(), body, toolkit,
getStyle(), resEnvRef));
 
-        managedForm.addPart(new EjbRefSection(plan, body, managedForm
-                .getToolkit(), style, ejbRef));
+        managedForm.addPart(new EjbRefSection(getDeploymentPlan(), body, toolkit, getStyle(),
ejbRef));
 
-        managedForm.addPart(new EjbLocalRefSection(plan, body, managedForm
-                .getToolkit(), style, ejbLocalRef));
+        managedForm.addPart(new EjbLocalRefSection(getDeploymentPlan(), body, toolkit, getStyle(),
ejbLocalRef));
     }
 
 }

Modified: geronimo/devtools/trunk/modules/eclipse-plugin/plugins/org.apache.geronimo.ui/src/org/apache/geronimo/ui/pages/SecurityPage.java
URL: http://svn.apache.org/viewcvs/geronimo/devtools/trunk/modules/eclipse-plugin/plugins/org.apache.geronimo.ui/src/org/apache/geronimo/ui/pages/SecurityPage.java?rev=326759&r1=326758&r2=326759&view=diff
==============================================================================
--- geronimo/devtools/trunk/modules/eclipse-plugin/plugins/org.apache.geronimo.ui/src/org/apache/geronimo/ui/pages/SecurityPage.java
(original)
+++ geronimo/devtools/trunk/modules/eclipse-plugin/plugins/org.apache.geronimo.ui/src/org/apache/geronimo/ui/pages/SecurityPage.java
Wed Oct 19 16:41:19 2005
@@ -1,20 +1,13 @@
 package org.apache.geronimo.ui.pages;
 
-import org.apache.geronimo.ui.editors.AbstractGeronimoDeploymentPlanEditor;
 import org.apache.geronimo.ui.sections.SecurityRootSection;
 import org.apache.geronimo.ui.sections.SecuritySection;
-import org.eclipse.emf.ecore.EObject;
 import org.eclipse.emf.ecore.EReference;
 import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Composite;
 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.ExpandableComposite;
-import org.eclipse.ui.forms.widgets.ScrolledForm;
-import org.eclipse.ui.forms.widgets.Section;
 
-public class SecurityPage extends FormPage {
+public class SecurityPage extends AbstractGeronimoFormPage {
 
     public EReference securityERef;
 
@@ -28,43 +21,23 @@
         super(id, title);
     }
 
-    /*
-     * (non-Javadoc)
-     * 
-     * @see org.eclipse.ui.forms.editor.FormPage#createFormContent(org.eclipse.ui.forms.IManagedForm)
+    /* (non-Javadoc)
+     * @see org.apache.geronimo.ui.pages.AbstractGeronimoFormPage#fillBody(org.eclipse.ui.forms.IManagedForm)
      */
-    protected void createFormContent(IManagedForm managedForm) {
+    protected void fillBody(IManagedForm managedForm) {
 
-        ScrolledForm form = managedForm.getForm();
-        form.setText(getTitle());
-        GridLayout layout = new GridLayout();
-        layout.numColumns = 1;
-        layout.horizontalSpacing = 20;
-
-        form.getBody().setLayout(layout);
-
-        fillBody(managedForm);
-
-        form.reflow(true);
+        managedForm.addPart(new SecurityRootSection(body, toolkit, getStyle(), getDeploymentPlan(),
securityERef));
 
+        managedForm.addPart(new SecuritySection(getDeploymentPlan(), body, toolkit, getStyle(),
securityERef));
     }
-
-    private void fillBody(IManagedForm managedForm) {
-
-        EObject plan = ((AbstractGeronimoDeploymentPlanEditor) getEditor())
-                .getDeploymentPlan();
-
-        Composite body = managedForm.getForm().getBody();
-
-        int style = ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED
-                | ExpandableComposite.TITLE_BAR | Section.DESCRIPTION
-                | ExpandableComposite.FOCUS_TITLE;
-
-        managedForm.addPart(new SecurityRootSection(body, managedForm
-                .getToolkit(), style, plan, securityERef));
-
-        managedForm.addPart(new SecuritySection(plan, body, managedForm
-                .getToolkit(), style, securityERef));
+    
+    /* (non-Javadoc)
+     * @see org.apache.geronimo.ui.pages.AbstractGeronimoFormPage#getLayout()
+     */
+    protected GridLayout getLayout() {
+        GridLayout layout = super.getLayout();
+        layout.numColumns = 1;
+        return layout;
     }
 
 }

Modified: geronimo/devtools/trunk/modules/eclipse-plugin/plugins/org.apache.geronimo.ui/src/org/apache/geronimo/ui/pages/WebGeneralPage.java
URL: http://svn.apache.org/viewcvs/geronimo/devtools/trunk/modules/eclipse-plugin/plugins/org.apache.geronimo.ui/src/org/apache/geronimo/ui/pages/WebGeneralPage.java?rev=326759&r1=326758&r2=326759&view=diff
==============================================================================
--- geronimo/devtools/trunk/modules/eclipse-plugin/plugins/org.apache.geronimo.ui/src/org/apache/geronimo/ui/pages/WebGeneralPage.java
(original)
+++ geronimo/devtools/trunk/modules/eclipse-plugin/plugins/org.apache.geronimo.ui/src/org/apache/geronimo/ui/pages/WebGeneralPage.java
Wed Oct 19 16:41:19 2005
@@ -15,22 +15,14 @@
  */
 package org.apache.geronimo.ui.pages;
 
-import org.apache.geronimo.ui.editors.WebEditor;
 import org.apache.geronimo.ui.sections.DependencySection;
 import org.apache.geronimo.ui.sections.ImportSection;
 import org.apache.geronimo.ui.sections.WebGeneralSection;
-import org.apache.geronimo.xml.ns.web.WebAppType;
 import org.apache.geronimo.xml.ns.web.WebPackage;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Composite;
 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.ExpandableComposite;
-import org.eclipse.ui.forms.widgets.ScrolledForm;
-import org.eclipse.ui.forms.widgets.Section;
 
-public class WebGeneralPage extends FormPage {
+public class WebGeneralPage extends AbstractGeronimoFormPage {
 
     public WebGeneralPage(FormEditor editor, String id, String title) {
         super(editor, id, title);
@@ -40,38 +32,19 @@
         super(id, title);
     }
 
-    protected void createFormContent(IManagedForm managedForm) {
-        ScrolledForm form = managedForm.getForm();
-        form.setText(getTitle());
-        GridLayout layout = new GridLayout();
-        layout.numColumns = 2;
-        layout.horizontalSpacing = 20;
-        layout.makeColumnsEqualWidth = true;
-        form.getBody().setLayout(layout);
-        fillBody(managedForm);
-        form.reflow(true);
-    }
-
-    private void fillBody(IManagedForm managedForm) {
-
-        WebAppType plan = (WebAppType) ((WebEditor) getEditor())
-                .getDeploymentPlan();
-
-        Composite body = managedForm.getForm().getBody();
-
-        int style = ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED
-                | ExpandableComposite.TITLE_BAR | Section.DESCRIPTION
-                | ExpandableComposite.FOCUS_TITLE;
-
-        managedForm.addPart(new WebGeneralSection(body, managedForm
-                .getToolkit(), style, plan));
-
-        managedForm.addPart(new DependencySection(plan, WebPackage.eINSTANCE
-                .getWebAppType_Dependency(), body, managedForm.getToolkit(),
-                style));
+    /* (non-Javadoc)
+     * @see org.apache.geronimo.ui.pages.AbstractGeronimoFormPage#fillBody(org.eclipse.ui.forms.IManagedForm)
+     */
+    protected void fillBody(IManagedForm managedForm) {
+
+        managedForm.addPart(new WebGeneralSection(body, toolkit, getStyle(), getDeploymentPlan()));
+
+        managedForm.addPart(new DependencySection(getDeploymentPlan(), WebPackage.eINSTANCE
+                .getWebAppType_Dependency(), body, toolkit,
+                getStyle()));
         
-        managedForm.addPart(new ImportSection(plan,
+        managedForm.addPart(new ImportSection(getDeploymentPlan(),
                 WebPackage.eINSTANCE.getWebAppType_Import(), body,
-                managedForm.getToolkit(), style));
+              toolkit, getStyle()));
     }
 }



Mime
View raw message