1 2 24 package org.enhydra.tool.archive.wizard; 25 26 import org.enhydra.tool.archive.ArchiveException; 28 import org.enhydra.tool.archive.Descriptor; 29 import org.enhydra.tool.archive.JarPlan; 30 import org.enhydra.tool.archive.EjbPlan; 31 32 import java.awt.*; 34 import java.io.File ; 35 import javax.swing.*; 36 import java.lang.ref.WeakReference ; 37 import java.beans.*; 38 39 public class ServiceFilePanel extends ArchivePanel { 41 private FilePanel filePanel = null; 42 private GridBagLayout layoutMain = null; 43 44 public ServiceFilePanel() { 45 try { 46 jbInit(); 47 pmInit(); 48 } catch (Exception ex) { 49 ex.printStackTrace(); 50 } 51 } 52 53 public void readPlan(JarPlan plan) throws ArchiveException { 54 Descriptor[] rows = new Descriptor[0]; 55 filePanel.setArchivePath(plan.getArchivePath()); 56 rows = plan.getDescriptors(); 57 filePanel.getDDTableModel().clear(); 58 for (int i = 0 ; i < rows.length ; i++ ) { 59 filePanel.getDDTableModel().addDescriptor(rows[i]); 60 } 61 if (rows.length > 0) { 62 filePanel.getDDTable().setRowSelectionInterval(0, 0); 63 } 64 } 65 66 public void writePlan(JarPlan plan) throws ArchiveException { 67 int count = 0; 68 validatePlan(); 69 count = filePanel.getDDTableModel().getRowCount(); 70 plan.setArchivePath(filePanel.getArchivePath()); 71 plan.setDescriptors(filePanel.getDDTableModel().getDescriptors()); 72 } 73 74 public void validatePlan() throws ArchiveException { 75 filePanel.validatePlan(); 76 } 77 78 public String getPageTitle() { 79 return "Enhydra Service"; 80 } 81 82 public String getInstructions() { 83 StringBuffer buf = new StringBuffer (); 84 85 buf.append("Enter details for the Enhydra service archive."); 86 return buf.toString(); 87 } 88 89 protected void preparePanel() { 90 String [] defaultDD = new String [1]; 91 StringBuffer buf = new StringBuffer (); 92 93 buf.append(getWorkingRoot()); 94 buf.append(File.separator); 95 buf.append("src"); 96 buf.append(File.separator); 97 buf.append("META-INF"); 98 buf.append(File.separator); 99 buf.append("enhydra-service.xml"); 100 defaultDD[0] = buf.toString(); 101 filePanel.setDefaultDD(defaultDD); 102 filePanel.preparePanel(); 103 } 104 105 private void pmInit() { 106 filePanel.setExtension("jar"); 107 } 108 109 protected void setWizard(ArchiveWizard wizard) { 111 super.setWizard(wizard); 112 filePanel.setWizard(wizard); 113 } 114 115 private void jbInit() throws Exception { 116 filePanel = (FilePanel) Beans.instantiate(getClass().getClassLoader(), 117 FilePanel.class.getName()); 118 layoutMain = 119 (GridBagLayout) Beans.instantiate(getClass().getClassLoader(), 120 GridBagLayout.class.getName()); 121 this.setLayout(layoutMain); 122 this.add(filePanel, 123 new GridBagConstraints(0, 0, 1, 1, 0.1, 0.1, 124 GridBagConstraints.CENTER, 125 GridBagConstraints.BOTH, 126 new Insets(0, 0, 0, 0), 0, 0)); 127 } 128 129 } 130 | Popular Tags |