001: /*
002: * Enhydra Java Application Server Project
003: *
004: * The contents of this file are subject to the Enhydra Public License
005: * Version 1.1 (the "License"); you may not use this file except in
006: * compliance with the License. You may obtain a copy of the License on
007: * the Enhydra web site ( http://www.enhydra.org/ ).
008: *
009: * Software distributed under the License is distributed on an "AS IS"
010: * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
011: * the License for the specific terms governing rights and limitations
012: * under the License.
013: *
014: * The Initial Developer of the Enhydra Application Server is Lutris
015: * Technologies, Inc. The Enhydra Application Server and portions created
016: * by Lutris Technologies, Inc. are Copyright Lutris Technologies, Inc.
017: * All Rights Reserved.
018: *
019: * Contributor(s):
020: * Paul Mahar
021: *
022: */
023: package org.enhydra.tool.archive.wizard;
024:
025: //
026: import org.enhydra.tool.archive.ArchiveException;
027: import org.enhydra.tool.archive.JarPlan;
028:
029: //
030: import java.awt.*;
031: import java.io.File;
032: import javax.swing.*;
033: import java.beans.*;
034: import java.lang.ref.WeakReference;
035: import javax.swing.border.*;
036:
037: //
038: public class E3FilePanel extends ArchivePanel {
039: private FilePanel filePanel = null;
040: private GridBagLayout layoutMain = null;
041: private JPanel panelApp = null;
042: private GridBagLayout layoutApp = null;
043: private JTextArea textNote = null;
044:
045: public E3FilePanel() {
046: try {
047: jbInit();
048: pmInit();
049: } catch (Exception ex) {
050: ex.printStackTrace();
051: }
052: }
053:
054: public void readPlan(JarPlan plan) throws ArchiveException {
055: filePanel.setArchivePath(plan.getArchivePath());
056: filePanel.getDDTableModel().clear();
057: filePanel.getDDTable().setVisible(false);
058: }
059:
060: public void writePlan(JarPlan plan) throws ArchiveException {
061: validatePlan();
062: plan.setArchivePath(filePanel.getArchivePath());
063: }
064:
065: public void validatePlan() throws ArchiveException {
066: filePanel.validatePlan();
067: }
068:
069: public String getPageTitle() {
070: return "Enhydra Application";
071: }
072:
073: public String getInstructions() {
074: StringBuffer buf = new StringBuffer();
075:
076: buf
077: .append("Enter archive name for your Enhydra super servlet.");
078: return buf.toString();
079: }
080:
081: // override ArchivePanel
082: protected void setWizardRef(ArchiveWizard wizard) {
083: super .setWizard(wizard);
084: filePanel.setWizard(wizard);
085: }
086:
087: protected void preparePanel() {
088: String[] defaultDD = new String[0];
089: StringBuffer buf = new StringBuffer();
090:
091: filePanel.setDefaultDD(defaultDD);
092: filePanel.preparePanel();
093: }
094:
095: private void pmInit() {
096: filePanel.setExtension("jar");
097: }
098:
099: private void jbInit() throws Exception {
100: filePanel = (FilePanel) Beans.instantiate(getClass()
101: .getClassLoader(), FilePanel.class.getName());
102: layoutMain = (GridBagLayout) Beans.instantiate(getClass()
103: .getClassLoader(), GridBagLayout.class.getName());
104: panelApp = (JPanel) Beans.instantiate(getClass()
105: .getClassLoader(), JPanel.class.getName());
106: layoutApp = (GridBagLayout) Beans.instantiate(getClass()
107: .getClassLoader(), GridBagLayout.class.getName());
108: textNote = (JTextArea) Beans.instantiate(getClass()
109: .getClassLoader(), JTextArea.class.getName());
110:
111: textNote.setWrapStyleWord(true);
112: textNote.setLineWrap(true);
113: textNote.setEnabled(false);
114: textNote
115: .setText("Super servlet archives do not support deployment descriptors. You "
116: + "will need to deploy a seperate configuration file with the super "
117: + "servlet archive.");
118: textNote.setAutoscrolls(false);
119: textNote.setDisabledTextColor(UIManager
120: .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
126: .createEtchedBorder(new Color(187, 218, 252),
127: new Color(91, 107, 123)), "Deployment"));
128: panelApp.add(textNote, new GridBagConstraints(0, 0, 1, 3, 0.4,
129: 0.4, GridBagConstraints.CENTER,
130: GridBagConstraints.BOTH, new Insets(10, 10, 10, 10),
131: 10, 10));
132: this .setLayout(layoutMain);
133: this .add(filePanel, new GridBagConstraints(0, 0, 1, 1, 0.1,
134: 0.1, GridBagConstraints.CENTER,
135: GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0));
136: this .add(panelApp, new GridBagConstraints(0, 1, 1, 1, 0.1, 0.1,
137: GridBagConstraints.CENTER, GridBagConstraints.BOTH,
138: new Insets(5, 5, 5, 5), 0, 0));
139: }
140:
141: }
|