001: package org.enhydra.kelp.ant.deployer;
002:
003: import java.awt.*; //import com.borland.jbcl.layout.*;
004: import org.enhydra.tool.swing.layout.*;
005: import javax.swing.*;
006: import javax.swing.border.*;
007: import java.util.ResourceBundle;
008: import org.enhydra.kelp.ant.node.AntProject;
009: import org.enhydra.kelp.common.node.OtterProject;
010: import java.awt.event.*;
011:
012: /**
013: * <p>Title: </p>
014: * <p>Description: </p>
015: * <p>Copyright: Copyright (c) 2003</p>
016: * <p>Company: </p>
017: * @author unascribed
018: * @version 1.0
019: */
020:
021: public class AntDeployContentPanel extends JPanel {
022:
023: static ResourceBundle res = ResourceBundle
024: .getBundle("org.enhydra.kelp.common.Res");
025:
026: XYLayout xYLayout1 = new XYLayout();
027: JLabel jLabelHeading = new JLabel();
028: JTextArea jTextAreaDescription = new JTextArea();
029: JCheckBox jCheckEnable = new JCheckBox();
030: TitledBorder titledBorder1;
031: JTabbedPane tab = new JTabbedPane();
032: AntDeployContentPathsPanel pathsPanel = new AntDeployContentPathsPanel();
033: AntDeployContentTypesPanel typesPanel = new AntDeployContentTypesPanel();
034: AntProject project = null;
035:
036: public AntDeployContentPanel() {
037: try {
038: jbInit();
039: pmInit();
040: } catch (Exception ex) {
041: ex.printStackTrace();
042: }
043: }
044:
045: private void pmInit() {
046: tab.add(res.getString("Paths"), pathsPanel);
047: tab.add(res.getString("Types"), typesPanel);
048: }
049:
050: void jbInit() throws Exception {
051: jLabelHeading.setFont(new java.awt.Font("Dialog", 1, 12));
052: jLabelHeading.setText(res.getString("Web_content"));
053: this .setLayout(xYLayout1);
054: jTextAreaDescription.setBackground(SystemColor.control);
055: jTextAreaDescription.setEnabled(false);
056: jTextAreaDescription.setFont(new java.awt.Font("SansSerif", 0,
057: 12));
058: jTextAreaDescription
059: .setDisabledTextColor(SystemColor.controlText);
060: jTextAreaDescription.setEditable(false);
061: jTextAreaDescription.setText(res
062: .getString("Content_description"));
063: jTextAreaDescription.setLineWrap(true);
064: jTextAreaDescription.setWrapStyleWord(true);
065: jCheckEnable.setText(res.getString("Content_enable"));
066: jCheckEnable
067: .addActionListener(new java.awt.event.ActionListener() {
068: public void actionPerformed(ActionEvent e) {
069: jCheckEnable_actionPerformed(e);
070: }
071: });
072: xYLayout1.setWidth(547);
073: xYLayout1.setHeight(329);
074: this .add(jLabelHeading, new XYConstraints(12, 11, 189, 22));
075: this .add(jTextAreaDescription, new XYConstraints(12, 40, 520,
076: 38));
077: this .add(jCheckEnable, new XYConstraints(10, 84, 193, 22));
078: this .add(tab, new XYConstraints(10, 120, 523, 229));
079: }
080:
081: public void setProject(OtterProject otterProject) {
082: //Paths init
083: pathsPanel.setProject(otterProject);
084: typesPanel.setProject(otterProject);
085:
086: if (otterProject instanceof AntProject) {
087: project = (AntProject) otterProject;
088: initOptions();
089: } else
090: System.err.println("DEBUG project must be AntProject");//FIXME throw Exception
091: }
092:
093: //Fill dialogs from project properties
094: private void initOptions() {
095: if (project.getProperty(AntProject.DEPLOY_CONTENT_ENABLED)
096: .equalsIgnoreCase("true"))
097: jCheckEnable.setSelected(true);
098: else
099: jCheckEnable.setSelected(false);
100: }
101:
102: void jCheckEnable_actionPerformed(ActionEvent e) {
103: if (jCheckEnable.isSelected()) {
104: project.setProperty(AntProject.DEPLOY_CONTENT_ENABLED,
105: "true");
106: } else {
107: project.setProperty(AntProject.DEPLOY_CONTENT_ENABLED,
108: "false");
109: }
110: }
111: }
|