001: /*
002: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
003: *
004: * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
005: *
006: * The contents of this file are subject to the terms of either the GNU
007: * General Public License Version 2 only ("GPL") or the Common
008: * Development and Distribution License("CDDL") (collectively, the
009: * "License"). You may not use this file except in compliance with the
010: * License. You can obtain a copy of the License at
011: * http://www.netbeans.org/cddl-gplv2.html
012: * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
013: * specific language governing permissions and limitations under the
014: * License. When distributing the software, include this License Header
015: * Notice in each file and include the License file at
016: * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
017: * particular file as subject to the "Classpath" exception as provided
018: * by Sun in the GPL Version 2 section of the License file that
019: * accompanied this code. If applicable, add the following below the
020: * License Header, with the fields enclosed by brackets [] replaced by
021: * your own identifying information:
022: * "Portions Copyrighted [year] [name of copyright owner]"
023: *
024: * Contributor(s):
025: *
026: * The Original Software is NetBeans. The Initial Developer of the Original
027: * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
028: * Microsystems, Inc. All Rights Reserved.
029: *
030: * If you wish your version of this file to be governed by only the CDDL
031: * or only the GPL Version 2, indicate your decision by adding
032: * "[Contributor] elects to include this software in this distribution
033: * under the [CDDL or GPL Version 2] license." If you do not indicate a
034: * single choice of license, a recipient has the option to distribute
035: * your version of this file under either the CDDL, the GPL Version 2 or
036: * to extend the choice of license to its licensees as provided above.
037: * However, if you add GPL Version 2 code and therefore, elected the GPL
038: * Version 2 license, then the option applies only if the new code is
039: * made subject to such option by the copyright holder.
040: */
041:
042: package org.netbeans.modules.visualweb.dataconnectivity.ui;
043:
044: import javax.swing.JPanel;
045:
046: /**
047: * Panel for specifying JNDI Name
048: * @author Jim Davidson
049: */
050: public class DataSourceNamePanel extends JPanel {
051:
052: /** Creates new form DataSourceReferencePanel */
053: public DataSourceNamePanel() {
054: initComponents();
055: }
056:
057: /** Creates new form DataSourceReferencePanel */
058: public DataSourceNamePanel(String dataSourceName) {
059: initComponents();
060: dataSourceiText.setText(dataSourceName);
061: }
062:
063: /**
064: * Get the JNDI name of the data source.
065: * @return the JNDI name.
066: */
067: public String getDataSourceName() {
068: return dataSourceiText.getText().trim();
069: }
070:
071: /** This method is called from within the constructor to
072: * initialize the form.
073: * WARNING: Do NOT modify this code. The content of this method is
074: * always regenerated by the Form Editor.
075: */
076: // <editor-fold defaultstate="collapsed" desc=" Generated Code ">//GEN-BEGIN:initComponents
077: private void initComponents() {
078:
079: dsGroup = new javax.swing.ButtonGroup();
080: dataSourceiLabel = new javax.swing.JLabel();
081: dataSourceiText = new javax.swing.JTextField();
082: jPanel1 = new javax.swing.JPanel();
083: jLabel1 = new javax.swing.JLabel();
084:
085: dataSourceiLabel.setLabelFor(dataSourceiText);
086: org.openide.awt.Mnemonics.setLocalizedText(dataSourceiLabel,
087: org.openide.util.NbBundle
088: .getMessage(DataSourceNamePanel.class,
089: "LBL_DataSourceName")); // NOI18N
090:
091: jLabel1.setForeground(java.awt.Color.red);
092:
093: org.jdesktop.layout.GroupLayout jPanel1Layout = new org.jdesktop.layout.GroupLayout(
094: jPanel1);
095: jPanel1.setLayout(jPanel1Layout);
096: jPanel1Layout.setHorizontalGroup(jPanel1Layout
097: .createParallelGroup(
098: org.jdesktop.layout.GroupLayout.LEADING).add(
099: jPanel1Layout.createSequentialGroup().add(
100: jLabel1).addContainerGap(287,
101: Short.MAX_VALUE)));
102: jPanel1Layout
103: .setVerticalGroup(jPanel1Layout
104: .createParallelGroup(
105: org.jdesktop.layout.GroupLayout.LEADING)
106: .add(
107: jPanel1Layout
108: .createSequentialGroup()
109: .add(
110: jLabel1,
111: org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
112: 5, Short.MAX_VALUE)
113: .addContainerGap()));
114:
115: jLabel1.getAccessibleContext().setAccessibleName(
116: org.openide.util.NbBundle.getMessage(
117: DataSourceNamePanel.class,
118: "DataSourceNameAlreadyUsed")); // NOI18N
119: jLabel1.getAccessibleContext().setAccessibleDescription(
120: org.openide.util.NbBundle.getMessage(
121: DataSourceNamePanel.class,
122: "DataSourceNameAlreadyUsed")); // NOI18N
123:
124: org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(
125: this );
126: this .setLayout(layout);
127: layout
128: .setHorizontalGroup(layout
129: .createParallelGroup(
130: org.jdesktop.layout.GroupLayout.LEADING)
131: .add(
132: layout
133: .createSequentialGroup()
134: .addContainerGap()
135: .add(
136: layout
137: .createParallelGroup(
138: org.jdesktop.layout.GroupLayout.LEADING)
139: .add(
140: layout
141: .createSequentialGroup()
142: .add(
143: dataSourceiLabel)
144: .addPreferredGap(
145: org.jdesktop.layout.LayoutStyle.RELATED)
146: .add(
147: dataSourceiText,
148: org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
149: 219,
150: Short.MAX_VALUE))
151: .add(
152: jPanel1,
153: org.jdesktop.layout.GroupLayout.PREFERRED_SIZE,
154: org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
155: org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
156: .addContainerGap()));
157: layout
158: .setVerticalGroup(layout
159: .createParallelGroup(
160: org.jdesktop.layout.GroupLayout.LEADING)
161: .add(
162: layout
163: .createSequentialGroup()
164: .add(15, 15, 15)
165: .add(
166: layout
167: .createParallelGroup(
168: org.jdesktop.layout.GroupLayout.BASELINE)
169: .add(
170: dataSourceiLabel)
171: .add(
172: dataSourceiText,
173: org.jdesktop.layout.GroupLayout.PREFERRED_SIZE,
174: 18,
175: org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
176: .add(18, 18, 18)
177: .add(
178: jPanel1,
179: org.jdesktop.layout.GroupLayout.PREFERRED_SIZE,
180: org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
181: org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
182: .addContainerGap(13,
183: Short.MAX_VALUE)));
184:
185: dataSourceiLabel.getAccessibleContext().setAccessibleName(
186: org.openide.util.NbBundle.getMessage(
187: DataSourceNamePanel.class,
188: "ASCN_DataSourceNaming")); // NOI18N
189: dataSourceiLabel.getAccessibleContext()
190: .setAccessibleDescription(
191: org.openide.util.NbBundle.getMessage(
192: DataSourceNamePanel.class,
193: "LBL_SpecifyDataSourceName")); // NOI18N
194: }// </editor-fold>//GEN-END:initComponents
195:
196: // Variables declaration - do not modify//GEN-BEGIN:variables
197: private javax.swing.JLabel dataSourceiLabel;
198: private javax.swing.JTextField dataSourceiText;
199: private javax.swing.ButtonGroup dsGroup;
200: private javax.swing.JLabel jLabel1;
201: private javax.swing.JPanel jPanel1;
202: // End of variables declaration//GEN-END:variables
203:
204: }
|