1 2 24 package org.enhydra.tool.archive.wizard; 25 26 import org.enhydra.tool.archive.ArchiveException; 28 import org.enhydra.tool.archive.JarPlan; 29 import org.enhydra.tool.archive.EarPlan; 30 31 import java.awt.*; 33 import java.beans.Beans ; 34 import java.io.File ; 35 import javax.swing.*; 36 37 public class WebAppPanel extends ArchivePanel { 39 private BorderLayout layoutMain = null; 40 private WarSelector selectorPanel = null; 41 42 public WebAppPanel() { 43 try { 44 jbInit(); 45 pmInit(); 46 } catch (Exception ex) { 47 ex.printStackTrace(); 48 } 49 } 50 51 public void readPlan(JarPlan plan) throws ArchiveException { 52 selectorPanel.setSelections(plan.getLibFiles()); 53 if (plan instanceof EarPlan) { 54 EarPlan ep = (EarPlan) plan; 55 56 selectorPanel.setWebApplications(ep.getWebApplications()); 57 } 58 } 59 60 public void writePlan(JarPlan plan) throws ArchiveException { 61 if (plan instanceof EarPlan) { 62 EarPlan ep = (EarPlan) plan; 63 64 ep.setWebApplications(selectorPanel.getWebApplications()); 65 } 66 } 67 68 public void validatePlan() throws ArchiveException { 69 } 71 72 public String getPageTitle() { 73 return "Web Application Modules"; 74 } 75 76 public String getInstructions() { 77 StringBuffer buf = new StringBuffer (); 78 79 buf.append("Select web applications (.war) to include in this"); 80 buf.append(" enterprise application (.ear). You can modify the root"); 81 buf.append(" context for each web application."); 82 return buf.toString(); 83 } 84 85 protected void setWizard(ArchiveWizard wizard) { 87 super.setWizard(wizard); 88 selectorPanel.setWizard(wizard); 89 } 90 91 private void pmInit() { 92 String [] exts = { 93 "war" 94 }; 95 96 selectorPanel.setExtensions(exts); 97 selectorPanel.setTitle("Web Application"); 98 } 99 100 private void jbInit() throws Exception { 101 layoutMain = 102 (BorderLayout) Beans.instantiate(getClass().getClassLoader(), 103 BorderLayout.class.getName()); 104 selectorPanel = 105 (WarSelector) Beans.instantiate(getClass().getClassLoader(), 106 WarSelector.class.getName()); 107 this.setLayout(layoutMain); 108 this.add(selectorPanel, BorderLayout.CENTER); 109 } 110 111 } 112 | Popular Tags |