01: package org.enhydra.kelp.ant.deployer;
02:
03: import java.awt.*; //import com.borland.jbcl.layout.*;
04: import org.enhydra.tool.swing.layout.*;
05: import javax.swing.*;
06: import org.enhydra.kelp.ant.node.AntProject;
07: import org.enhydra.kelp.common.node.OtterProject;
08:
09: /**
10: * <p>Title: </p>
11: * <p>Description: </p>
12: * <p>Copyright: Copyright (c) 2003</p>
13: * <p>Company: </p>
14: * @author unascribed
15: * @version 1.0
16: */
17:
18: public class AntDeployContentPathsPanel extends JPanel {
19: XYLayout xYLayout1 = new XYLayout();
20: JTextField jTextFieldDestDir = new JTextField();
21: JLabel jLabelDestDir = new JLabel();
22: JLabel jLabelSrcDir = new JLabel();
23: JTextField jTextFieldSrcDir = new JTextField();
24: private AntProject project = null;
25:
26: public AntDeployContentPathsPanel() {
27: try {
28: jbInit();
29: } catch (Exception ex) {
30: ex.printStackTrace();
31: }
32: }
33:
34: void jbInit() throws Exception {
35: jLabelDestDir.setText("Content destination directory");
36: this .setLayout(xYLayout1);
37: xYLayout1.setWidth(489);
38: xYLayout1.setHeight(300);
39: jTextFieldDestDir.setBackground(SystemColor.control);
40: jTextFieldDestDir.setDisabledTextColor(SystemColor.controlText);
41: jTextFieldDestDir.setEditable(false);
42: jTextFieldDestDir.setText("testText");
43: jLabelSrcDir.setText("Content source directory");
44: jTextFieldSrcDir.setText("testText");
45: jTextFieldSrcDir.setEditable(false);
46: jTextFieldSrcDir.setDisabledTextColor(SystemColor.controlText);
47: jTextFieldSrcDir.setBackground(SystemColor.control);
48: this .add(jLabelSrcDir, new XYConstraints(12, 25, 149, 18));
49: this .add(jTextFieldSrcDir, new XYConstraints(12, 49, 459, 22));
50: this .add(jLabelDestDir, new XYConstraints(12, 101, 173, 18));
51: this
52: .add(jTextFieldDestDir, new XYConstraints(12, 126, 459,
53: 22));
54: }
55:
56: public void setProject(OtterProject otterProject) {
57: if (otterProject instanceof AntProject) {
58: project = (AntProject) otterProject;
59: initOptions();
60: } else
61: System.err.println("DEBUG project must be AntProject");//FIXME throw Exception
62: }
63:
64: private void initOptions() {
65: jTextFieldSrcDir.setText(project
66: .getProperty(AntProject.RESOURCES_DIR));
67: if (project.isWebType()) { //Web application have CONTENT_DIR
68: jTextFieldDestDir.setText(project
69: .getProperty(AntProject.CONTENT_DIR));
70: } else { // Enhydra Super-servlet application copy to ${classes.dir}/${content.package.dir}
71:
72: jTextFieldDestDir
73: .setText(project
74: .getProperty(AntProject.CLASSES_DIR)
75: + "/"
76: + project
77: .getProperty(AntProject.CONTENT_PACKAGE_DIR));
78: }
79:
80: }
81: }
|