1 /* 2 * Licensed to the Apache Software Foundation (ASF) under one or more 3 * contributor license agreements. See the NOTICE file distributed with 4 * this work for additional information regarding copyright ownership. 5 * The ASF licenses this file to You under the Apache License, Version 2.0 6 * (the "License"); you may not use this file except in compliance with 7 * the License. You may obtain a copy of the License at 8 * 9 * http://www.apache.org/licenses/LICENSE-2.0 10 * 11 * Unless required by applicable law or agreed to in writing, software 12 * distributed under the License is distributed on an "AS IS" BASIS, 13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 * See the License for the specific language governing permissions and 15 * limitations under the License. 16 */ 17 package org.apache.geronimo.st.v11.ui.pages; 18 19 import org.apache.geronimo.st.ui.CommonMessages; 20 import org.apache.geronimo.st.ui.editors.AbstractGeronimoDeploymentPlanEditor; 21 import org.apache.geronimo.st.ui.pages.AbstractGeronimoFormPage; 22 import org.apache.geronimo.st.v11.core.GeronimoServerInfo; 23 import org.apache.geronimo.st.v11.core.jaxb.JAXBModelUtils; 24 import org.apache.geronimo.st.v11.ui.sections.AdminObjectSection; 25 import org.apache.geronimo.st.v11.ui.sections.ClassFilterSection; 26 import org.apache.geronimo.st.v11.ui.sections.DependencySection; 27 import org.apache.geronimo.st.v11.ui.sections.ExtModuleSection; 28 import org.apache.geronimo.st.v11.ui.sections.GBeanSection; 29 import org.apache.geronimo.st.v11.ui.sections.ModuleSection; 30 import org.apache.geronimo.xml.ns.j2ee.application_1.ApplicationType; 31 import org.apache.geronimo.xml.ns.j2ee.application_client_1.ApplicationClientType; 32 import org.apache.geronimo.xml.ns.j2ee.connector_1.ConnectorType; 33 import org.eclipse.swt.layout.GridLayout; 34 import org.eclipse.ui.forms.IManagedForm; 35 import org.eclipse.ui.forms.editor.FormEditor; 36 37 /* 38 * @version $Rev$ $Date$ 39 */ 40 public class DeploymentPage extends AbstractGeronimoFormPage { 41 42 public DeploymentPage(FormEditor editor, String id, String title) { 43 super(editor, id, title); 44 } 45 46 /* 47 * (non-Javadoc) 48 * 49 * @see org.apache.geronimo.ui.pages.AbstractGeronimoFormPage#fillBody(org.eclipse.ui.forms.IManagedForm) 50 */ 51 protected void fillBody(IManagedForm managedForm) { 52 managedForm.addPart(new DependencySection(getDeploymentPlan(), JAXBModelUtils.getEnvironment(getDeploymentPlan()), body, toolkit, getStyle())); 53 managedForm.addPart(new GBeanSection(getDeploymentPlan(), JAXBModelUtils.getGbeans(getDeploymentPlan()), body, toolkit, getStyle())); 54 managedForm.addPart(new ClassFilterSection(getDeploymentPlan(), JAXBModelUtils.getEnvironment(getDeploymentPlan()), body, toolkit, getStyle(), true, true)); 55 managedForm.addPart(new ClassFilterSection(getDeploymentPlan(), JAXBModelUtils.getEnvironment(getDeploymentPlan()), body, toolkit, getStyle(), true, false)); 56 57 if (ApplicationType.class.isInstance(getDeploymentPlan().getValue())) { 58 ApplicationType application = (ApplicationType)((AbstractGeronimoDeploymentPlanEditor) getEditor()).getDeploymentPlan().getValue(); 59 managedForm.addPart(new ModuleSection(getDeploymentPlan(), body, toolkit, getStyle(), application.getModule())); 60 managedForm.addPart(new ExtModuleSection(getDeploymentPlan(), body, toolkit, getStyle(), application.getExtModule())); 61 } 62 if (ConnectorType.class.isInstance(getDeploymentPlan().getValue())) { 63 ConnectorType connector = (ConnectorType)((AbstractGeronimoDeploymentPlanEditor) getEditor()).getDeploymentPlan().getValue(); 64 managedForm.addPart(new AdminObjectSection(getDeploymentPlan(), body, toolkit, getStyle(), connector.getAdminobject())); 65 } 66 if (ApplicationClientType.class.isInstance(getDeploymentPlan().getValue())) { 67 managedForm.addPart(new DependencySection(getDeploymentPlan(), JAXBModelUtils.getEnvironment(getDeploymentPlan(), false), body, toolkit, getStyle(), false)); 68 managedForm.addPart(new ClassFilterSection(getDeploymentPlan(), JAXBModelUtils.getEnvironment(getDeploymentPlan(), false), body, toolkit, getStyle(), false, true)); 69 managedForm.addPart(new ClassFilterSection(getDeploymentPlan(), JAXBModelUtils.getEnvironment(getDeploymentPlan(), false), body, toolkit, getStyle(), false, false)); 70 } 71 } 72 73 protected GridLayout getLayout() { 74 GridLayout layout = new GridLayout(); 75 layout.numColumns = 1; 76 layout.horizontalSpacing = 20; 77 return layout; 78 } 79 80 /* 81 * (non-Javadoc) 82 * 83 * @see org.apache.geronimo.ui.pages.AbstractGeronimoFormPage#getFormTitle() 84 */ 85 public String getFormTitle() { 86 return CommonMessages.deploymentPageTitle; 87 } 88 89 @Override 90 protected void triggerGeronimoServerInfoUpdate() { 91 GeronimoServerInfo.getInstance().updateInfo(); 92 } 93 94 }