1 package org.enhydra.kelp.ant.deployer; 2 3 import java.awt.*; 4 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 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 ex) { 32 ex.printStackTrace(); 33 } 34 } 35 void jbInit() throws Exception { 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"); } 63 64 private void initOptions(){ 65 jTextFieldSrcDir.setText(project.getProperty(AntProject.RESOURCES_DIR)); 66 if(project.isWebType()){ jTextFieldDestDir.setText(project.getProperty(AntProject.CONTENT_DIR)); 68 }else{ 70 jTextFieldDestDir.setText( 71 project.getProperty(AntProject.CLASSES_DIR)+"/"+ 72 project.getProperty(AntProject.CONTENT_PACKAGE_DIR) 73 ); 74 } 75 76 } 77 } | Popular Tags |