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 30 import java.awt.*; 32 import java.io.File ; 33 import javax.swing.*; 34 import java.beans.*; 35 import java.lang.ref.WeakReference ; 36 import javax.swing.border.*; 37 38 public class E3FilePanel extends ArchivePanel { 40 private FilePanel filePanel = null; 41 private GridBagLayout layoutMain = null; 42 private JPanel panelApp = null; 43 private GridBagLayout layoutApp = null; 44 private JTextArea textNote = null; 45 46 public E3FilePanel() { 47 try { 48 jbInit(); 49 pmInit(); 50 } catch (Exception ex) { 51 ex.printStackTrace(); 52 } 53 } 54 55 public void readPlan(JarPlan plan) throws ArchiveException { 56 filePanel.setArchivePath(plan.getArchivePath()); 57 filePanel.getDDTableModel().clear(); 58 filePanel.getDDTable().setVisible(false); 59 } 60 61 public void writePlan(JarPlan plan) throws ArchiveException { 62 validatePlan(); 63 plan.setArchivePath(filePanel.getArchivePath()); 64 } 65 66 public void validatePlan() throws ArchiveException { 67 filePanel.validatePlan(); 68 } 69 70 public String getPageTitle() { 71 return "Enhydra Application"; 72 } 73 74 public String getInstructions() { 75 StringBuffer buf = new StringBuffer (); 76 77 buf.append("Enter archive name for your Enhydra super servlet."); 78 return buf.toString(); 79 } 80 81 protected void setWizardRef(ArchiveWizard wizard) { 83 super.setWizard(wizard); 84 filePanel.setWizard(wizard); 85 } 86 87 protected void preparePanel() { 88 String [] defaultDD = new String [0]; 89 StringBuffer buf = new StringBuffer (); 90 91 filePanel.setDefaultDD(defaultDD); 92 filePanel.preparePanel(); 93 } 94 95 private void pmInit() { 96 filePanel.setExtension("jar"); 97 } 98 99 private void jbInit() throws Exception { 100 filePanel = (FilePanel) Beans.instantiate(getClass().getClassLoader(), 101 FilePanel.class.getName()); 102 layoutMain = 103 (GridBagLayout) Beans.instantiate(getClass().getClassLoader(), 104 GridBagLayout.class.getName()); 105 panelApp = (JPanel) Beans.instantiate(getClass().getClassLoader(), 106 JPanel.class.getName()); 107 layoutApp = 108 (GridBagLayout) Beans.instantiate(getClass().getClassLoader(), 109 GridBagLayout.class.getName()); 110 textNote = (JTextArea) Beans.instantiate(getClass().getClassLoader(), 111 JTextArea.class.getName()); 112 113 textNote.setWrapStyleWord(true); 114 textNote.setLineWrap(true); 115 textNote.setEnabled(false); 116 textNote.setText("Super servlet archives do not support deployment descriptors. You " 117 + "will need to deploy a seperate configuration file with the super " 118 + "servlet archive."); 119 textNote.setAutoscrolls(false); 120 textNote.setDisabledTextColor(UIManager.getColor("Label.foreground")); 121 textNote.setBackground(UIManager.getColor("Label.background")); 122 textNote.setEditable(false); 123 textNote.setFont(new java.awt.Font ("SansSerif", 0, 12)); 124 panelApp.setLayout(layoutApp); 125 panelApp.setBorder(new TitledBorder(BorderFactory.createEtchedBorder(new Color(187, 218, 252), new Color(91, 107, 123)), 126 "Deployment")); 127 panelApp.add(textNote, 128 new GridBagConstraints(0, 0, 1, 3, 0.4, 0.4, 129 GridBagConstraints.CENTER, 130 GridBagConstraints.BOTH, 131 new Insets(10, 10, 10, 10), 10, 132 10)); 133 this.setLayout(layoutMain); 134 this.add(filePanel, 135 new GridBagConstraints(0, 0, 1, 1, 0.1, 0.1, 136 GridBagConstraints.CENTER, 137 GridBagConstraints.BOTH, 138 new Insets(0, 0, 0, 0), 0, 0)); 139 this.add(panelApp, 140 new GridBagConstraints(0, 1, 1, 1, 0.1, 0.1, 141 GridBagConstraints.CENTER, 142 GridBagConstraints.BOTH, 143 new Insets(5, 5, 5, 5), 0, 0)); 144 } 145 146 } 147 | Popular Tags |