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 import org.enhydra.tool.common.PathHandle; 31 32 import java.awt.*; 34 import java.beans.Beans ; 35 import java.io.File ; 36 import java.util.ArrayList ; 37 import java.util.Arrays ; 38 import javax.swing.*; 39 40 public class EnterpriseModulePanel extends ArchivePanel { 42 private BorderLayout layoutMain = null; 43 private OneColumnFileSelector selectorPanel = null; 44 45 public EnterpriseModulePanel() { 46 try { 47 jbInit(); 48 pmInit(); 49 } catch (Exception ex) { 50 ex.printStackTrace(); 51 } 52 } 53 54 public void readPlan(JarPlan plan) throws ArchiveException { 55 selectorPanel.setSelections(plan.getLibFiles()); 56 if (plan instanceof EarPlan) { 57 EarPlan ep = (EarPlan) plan; 58 selectorPanel.setSelections(ep.getEnterpriseModules()); 59 } 60 } 61 62 public void writePlan(JarPlan plan) throws ArchiveException { 63 ArrayList listEar = new ArrayList (); 64 ArrayList listEjb = new ArrayList (); 65 66 if (plan instanceof EarPlan) { 67 EarPlan ep = (EarPlan) plan; 68 ep.setEnterpriseModules(selectorPanel.getSelections()); 69 } 70 listEar.clear(); 71 listEjb.clear(); 72 } 73 74 public void validatePlan() throws ArchiveException { 75 76 } 78 79 public String getPageTitle() { 80 return "Enterprise Modules"; 81 } 82 83 public String getInstructions() { 84 StringBuffer buf = new StringBuffer (); 85 86 buf.append("Select the enterprise JavaBeans (.jar)"); 87 buf.append(" and enterprise applications (.ear) to include in"); 88 buf.append(" this enterprise application."); 89 return buf.toString(); 90 } 91 92 protected void setWizard(ArchiveWizard wizard) { 94 super.setWizard(wizard); 95 selectorPanel.setWizard(wizard); 96 } 97 98 private void pmInit() { 99 String [] exts = { 100 "jar", "ear" 101 }; 102 103 selectorPanel.setExtensions(exts); 104 selectorPanel.setTitle("Enterprise Module"); 105 } 106 107 private void jbInit() throws Exception { 108 layoutMain = 109 (BorderLayout) Beans.instantiate(getClass().getClassLoader(), 110 BorderLayout.class.getName()); 111 selectorPanel = 112 (OneColumnFileSelector) Beans.instantiate(getClass().getClassLoader(), 113 OneColumnFileSelector.class.getName()); 114 this.setLayout(layoutMain); 115 this.add(selectorPanel, BorderLayout.CENTER); 116 } 117 118 } 119 | Popular Tags |