KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > enhydra > kelp > ant > deployer > AntDeployContentPathsPanel


1 package org.enhydra.kelp.ant.deployer;
2
3 import java.awt.*;
4 //import com.borland.jbcl.layout.*;
5
import org.enhydra.tool.swing.layout.*;
6 import javax.swing.*;
7 import org.enhydra.kelp.ant.node.AntProject;
8 import org.enhydra.kelp.common.node.OtterProject;
9
10 /**
11  * <p>Title: </p>
12  * <p>Description: </p>
13  * <p>Copyright: Copyright (c) 2003</p>
14  * <p>Company: </p>
15  * @author unascribed
16  * @version 1.0
17  */

18
19 public class AntDeployContentPathsPanel extends JPanel {
20     XYLayout xYLayout1 = new XYLayout();
21     JTextField jTextFieldDestDir = new JTextField();
22     JLabel jLabelDestDir = new JLabel();
23     JLabel jLabelSrcDir = new JLabel();
24     JTextField jTextFieldSrcDir = new JTextField();
25     private AntProject project = null;
26
27     public AntDeployContentPathsPanel() {
28         try {
29             jbInit();
30         }
31         catch(Exception JavaDoc ex) {
32             ex.printStackTrace();
33         }
34     }
35     void jbInit() throws Exception JavaDoc {
36         jLabelDestDir.setText("Content destination directory");
37         this.setLayout(xYLayout1);
38         xYLayout1.setWidth(489);
39         xYLayout1.setHeight(300);
40         jTextFieldDestDir.setBackground(SystemColor.control);
41         jTextFieldDestDir.setDisabledTextColor(SystemColor.controlText);
42         jTextFieldDestDir.setEditable(false);
43         jTextFieldDestDir.setText("testText");
44         jLabelSrcDir.setText("Content source directory");
45         jTextFieldSrcDir.setText("testText");
46         jTextFieldSrcDir.setEditable(false);
47         jTextFieldSrcDir.setDisabledTextColor(SystemColor.controlText);
48         jTextFieldSrcDir.setBackground(SystemColor.control);
49         this.add(jLabelSrcDir, new XYConstraints(12, 25, 149, 18));
50         this.add(jTextFieldSrcDir, new XYConstraints(12, 49, 459, 22));
51         this.add(jLabelDestDir, new XYConstraints(12, 101, 173, 18));
52         this.add(jTextFieldDestDir, new XYConstraints(12, 126, 459, 22));
53     }
54
55     public void setProject(OtterProject otterProject){
56         if(otterProject instanceof AntProject) {
57             project = (AntProject) otterProject;
58             initOptions();
59         }
60         else
61             System.err.println("DEBUG project must be AntProject");//FIXME throw Exception
62
}
63
64     private void initOptions(){
65         jTextFieldSrcDir.setText(project.getProperty(AntProject.RESOURCES_DIR));
66         if(project.isWebType()){ //Web application have CONTENT_DIR
67
jTextFieldDestDir.setText(project.getProperty(AntProject.CONTENT_DIR));
68         }else{ // Enhydra Super-servlet application copy to ${classes.dir}/${content.package.dir}
69

70             jTextFieldDestDir.setText(
71                         project.getProperty(AntProject.CLASSES_DIR)+"/"+
72                         project.getProperty(AntProject.CONTENT_PACKAGE_DIR)
73                     );
74         }
75
76     }
77 }
Popular Tags