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 javax.swing.border.*; 8 import java.util.ResourceBundle ; 9 import org.enhydra.kelp.ant.node.AntProject; 10 import org.enhydra.kelp.common.node.OtterProject; 11 import java.awt.event.*; 12 13 21 22 public class AntDeployContentPanel extends JPanel { 23 24 static ResourceBundle res = ResourceBundle.getBundle( 25 "org.enhydra.kelp.common.Res"); 26 27 XYLayout xYLayout1 = new XYLayout(); 28 JLabel jLabelHeading = new JLabel(); 29 JTextArea jTextAreaDescription = new JTextArea(); 30 JCheckBox jCheckEnable = new JCheckBox(); 31 TitledBorder titledBorder1; 32 JTabbedPane tab = new JTabbedPane(); 33 AntDeployContentPathsPanel pathsPanel = new AntDeployContentPathsPanel(); 34 AntDeployContentTypesPanel typesPanel = new AntDeployContentTypesPanel(); 35 AntProject project = null; 36 37 public AntDeployContentPanel() { 38 try { 39 jbInit(); 40 pmInit(); 41 } 42 catch(Exception ex) { 43 ex.printStackTrace(); 44 } 45 } 46 47 private void pmInit() { 48 tab.add(res.getString("Paths"), pathsPanel); 49 tab.add(res.getString("Types"), typesPanel); 50 } 51 void jbInit() throws Exception { 52 jLabelHeading.setFont(new java.awt.Font ("Dialog", 1, 12)); 53 jLabelHeading.setText(res.getString("Web_content")); 54 this.setLayout(xYLayout1); 55 jTextAreaDescription.setBackground(SystemColor.control); 56 jTextAreaDescription.setEnabled(false); 57 jTextAreaDescription.setFont(new java.awt.Font ("SansSerif", 0, 12)); 58 jTextAreaDescription.setDisabledTextColor(SystemColor.controlText); 59 jTextAreaDescription.setEditable(false); 60 jTextAreaDescription.setText(res.getString("Content_description")); 61 jTextAreaDescription.setLineWrap(true); 62 jTextAreaDescription.setWrapStyleWord(true); 63 jCheckEnable.setText(res.getString("Content_enable")); 64 jCheckEnable.addActionListener(new java.awt.event.ActionListener () { 65 public void actionPerformed(ActionEvent e) { 66 jCheckEnable_actionPerformed(e); 67 } 68 }); 69 xYLayout1.setWidth(547); 70 xYLayout1.setHeight(329); 71 this.add(jLabelHeading, new XYConstraints(12, 11, 189, 22)); 72 this.add(jTextAreaDescription, new XYConstraints(12, 40, 520, 38)); 73 this.add(jCheckEnable, new XYConstraints(10, 84, 193, 22)); 74 this.add(tab, new XYConstraints(10, 120, 523, 229)); 75 } 76 77 public void setProject(OtterProject otterProject){ 78 pathsPanel.setProject(otterProject); 80 typesPanel.setProject(otterProject); 81 82 if(otterProject instanceof AntProject) { 83 project = (AntProject) otterProject; 84 initOptions(); 85 } 86 else 87 System.err.println("DEBUG project must be AntProject"); } 89 private void initOptions(){ 91 if(project.getProperty(AntProject.DEPLOY_CONTENT_ENABLED).equalsIgnoreCase("true")) 92 jCheckEnable.setSelected(true); 93 else 94 jCheckEnable.setSelected(false); 95 } 96 97 void jCheckEnable_actionPerformed(ActionEvent e) { 98 if (jCheckEnable.isSelected()) { 99 project.setProperty(AntProject.DEPLOY_CONTENT_ENABLED, "true"); 100 } 101 else { 102 project.setProperty(AntProject.DEPLOY_CONTENT_ENABLED, "false"); 103 } 104 } 105 } | Popular Tags |