001: /*
002: * Copyright 2003 Sun Microsystems, Inc. All rights reserved.
003: * PROPRIETARY/CONFIDENTIAL. Use of this product is subject to license terms.
004: */
005:
006: package com.sun.portal.ffj.wizards;
007:
008: import javax.swing.JFileChooser;
009:
010: import org.openide.WizardDescriptor;
011:
012: import org.openide.util.NbBundle;
013:
014: import com.sun.portal.ffj.util.PSConstants;
015:
016: public class PortletAppPanel extends javax.swing.JPanel implements
017: WizardDescriptor.FinishPanel, PSConstants {
018:
019: /** Creates new form PortletAppPanel */
020: public PortletAppPanel(PortletAppWizardData dat) {
021: initComponents();
022: m_WizDat = dat;
023: m_DirField.setText(m_WizDat.getDirectory());
024: m_DirLab.setDisplayedMnemonic(NbBundle.getMessage(
025: PortletAppPanel.class,
026: "PortletAppPanel.DLabel.mnemonic").charAt(0)); // NOI18N
027: getAccessibleContext().setAccessibleDescription(
028: m_Prompt.getText());
029: m_BrowseButton.getAccessibleContext().setAccessibleDescription(
030: NbBundle.getMessage(PortletAppPanel.class,
031: "ACSD_CTL_PortletAppPanel.DirField")); // NOI18N
032: m_DirField.getAccessibleContext().setAccessibleDescription(
033: NbBundle.getMessage(PortletAppPanel.class,
034: "ACSD_CTL_PortletAppPanel.BrowseButton")); // NOI18N
035: }
036:
037: // FinishPanel implementation - note - we ignore listeners because we never change our
038: // validity. Perhaps we should, but let's see if we can get away with being
039: // simplistic for now.
040:
041: public void addChangeListener(
042: javax.swing.event.ChangeListener changeListener) {
043: }
044:
045: public java.awt.Component getComponent() {
046: return this ;
047: }
048:
049: public org.openide.util.HelpCtx getHelp() {
050: return null;
051: }
052:
053: public void readSettings(Object obj) {
054: m_DirField.setText(m_WizDat.getDirectory());
055: }
056:
057: public void removeChangeListener(
058: javax.swing.event.ChangeListener changeListener) {
059: }
060:
061: public void storeSettings(Object obj) {
062: m_WizDat.setDirectory(m_DirField.getText());
063: }
064:
065: // See netbeans documentation - this conflicts with Component.isValid(), and
066: // they tell you to be sure to implement this if your object itself is the component,
067: // as we are doing here.
068:
069: public boolean isValid() {
070: return true;
071: }
072:
073: /** This method is called from within the constructor to
074: * initialize the form.
075: * WARNING: Do NOT modify this code. The content of this method is
076: * always regenerated by the Form Editor.
077: */
078: private void initComponents() {//GEN-BEGIN:initComponents
079: m_Prompt = new javax.swing.JTextArea();
080: m_SubPanel = new javax.swing.JPanel();
081: m_FieldPanel = new javax.swing.JPanel();
082: m_DirField = new javax.swing.JTextField();
083: m_BrowseButton = new javax.swing.JButton();
084: m_DirLab = new javax.swing.JLabel();
085: m_Expl = new javax.swing.JTextArea();
086:
087: setLayout(new java.awt.BorderLayout(0, 10));
088:
089: setBorder(new javax.swing.border.EmptyBorder(
090: new java.awt.Insets(10, 10, 0, 10)));
091: m_Prompt.setBackground(new java.awt.Color(204, 204, 204));
092: m_Prompt.setLineWrap(true);
093: m_Prompt.setText(java.util.ResourceBundle.getBundle(
094: "com/sun/portal/ffj/wizards/Bundle").getString(
095: "PortletAppPanel.Prompt"));
096: m_Prompt.setWrapStyleWord(true);
097: m_Prompt.setDisabledTextColor(new java.awt.Color(0, 0, 0));
098: m_Prompt.setEnabled(false);
099: add(m_Prompt, java.awt.BorderLayout.NORTH);
100:
101: m_SubPanel.setLayout(new java.awt.BorderLayout(0, 10));
102:
103: m_FieldPanel.setLayout(new java.awt.BorderLayout(5, 0));
104:
105: m_DirField.setText("jTextField1");
106: m_FieldPanel.add(m_DirField, java.awt.BorderLayout.CENTER);
107:
108: m_BrowseButton.setText(java.util.ResourceBundle.getBundle(
109: "com/sun/portal/ffj/wizards/Bundle").getString(
110: "PortletAppPanel.BrowseButton"));
111: m_BrowseButton
112: .addActionListener(new java.awt.event.ActionListener() {
113: public void actionPerformed(
114: java.awt.event.ActionEvent evt) {
115: m_BrowseButtonActionPerformed(evt);
116: }
117: });
118:
119: m_FieldPanel.add(m_BrowseButton, java.awt.BorderLayout.EAST);
120:
121: m_DirLab.setLabelFor(m_DirField);
122: m_DirLab.setText(java.util.ResourceBundle.getBundle(
123: "com/sun/portal/ffj/wizards/Bundle").getString(
124: "PortletAppPanel.DLabel"));
125: m_FieldPanel.add(m_DirLab, java.awt.BorderLayout.WEST);
126:
127: m_SubPanel.add(m_FieldPanel, java.awt.BorderLayout.NORTH);
128:
129: m_Expl.setBackground(new java.awt.Color(204, 204, 204));
130: m_Expl.setLineWrap(true);
131: m_Expl.setText(java.util.ResourceBundle.getBundle(
132: "com/sun/portal/ffj/wizards/Bundle").getString(
133: "PortletAppPanel.Expl"));
134: m_Expl.setWrapStyleWord(true);
135: m_Expl.setDisabledTextColor(new java.awt.Color(0, 0, 0));
136: m_Expl.setEnabled(false);
137: m_SubPanel.add(m_Expl, java.awt.BorderLayout.CENTER);
138:
139: add(m_SubPanel, java.awt.BorderLayout.CENTER);
140:
141: }//GEN-END:initComponents
142:
143: private void m_BrowseButtonActionPerformed(
144: java.awt.event.ActionEvent evt) {//GEN-FIRST:event_m_BrowseButtonActionPerformed
145: JFileChooser fc = new JFileChooser(m_DirField.getText());
146: fc.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
147: if (fc.showOpenDialog(this ) == JFileChooser.APPROVE_OPTION) {
148: m_DirField.setText(fc.getSelectedFile().getPath());
149: }
150: }//GEN-LAST:event_m_BrowseButtonActionPerformed
151:
152: // Variables declaration - do not modify//GEN-BEGIN:variables
153: private javax.swing.JButton m_BrowseButton;
154: private javax.swing.JTextField m_DirField;
155: private javax.swing.JLabel m_DirLab;
156: private javax.swing.JTextArea m_Expl;
157: private javax.swing.JPanel m_FieldPanel;
158: private javax.swing.JTextArea m_Prompt;
159: private javax.swing.JPanel m_SubPanel;
160: // End of variables declaration//GEN-END:variables
161:
162: private PortletAppWizardData m_WizDat;
163: }
|