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-2006 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: /*
043: * GeneralInfoPanel.java
044: *
045: * Created on July 25, 2005, 10:37 AM
046: */
047: package org.netbeans.modules.mobility.end2end.multiview;
048:
049: import org.netbeans.modules.xml.multiview.Error;
050: import org.netbeans.modules.xml.multiview.ui.SectionInnerPanel;
051: import org.netbeans.modules.xml.multiview.ui.SectionView;
052: import javax.swing.JComponent;
053: import org.netbeans.modules.mobility.end2end.E2EDataObject;
054: import org.netbeans.modules.mobility.end2end.client.config.ClientConfiguration;
055: import org.netbeans.modules.mobility.end2end.client.config.Configuration;
056: import org.openide.util.NbBundle;
057:
058: /**
059: *
060: * @author Michal Skvor
061: */
062: public class ClientGeneralInfoPanel extends SectionInnerPanel {
063:
064: final private transient E2EDataObject dataObject;
065:
066: /** Creates new form GeneralInfoPanel */
067: public ClientGeneralInfoPanel(SectionView sectionView,
068: E2EDataObject dataObject) {
069: super (sectionView);
070:
071: this .dataObject = dataObject;
072:
073: initComponents();
074:
075: initValues();
076: }
077:
078: private void initValues() {
079: final Configuration config = dataObject.getConfiguration();
080:
081: final ClientConfiguration cc = config.getClientConfiguration();
082: final String projectName = cc.getProjectName();
083: if ("".equals(projectName)) {
084: //System.err.println("ERR_ProjectNameIsNotValid");
085: getSectionView().getErrorPanel().setError(
086: new Error(Error.TYPE_FATAL, Error.ERROR_MESSAGE,
087: NbBundle.getMessage(
088: ClientGeneralInfoPanel.class,
089: "ERR_ProjectNameIsNotValid"),
090: textProject));
091: }
092: textProject.setText(projectName);
093: textPackage.setText(cc.getClassDescriptor().getPackageName());
094: final String clientName = cc.getClassDescriptor()
095: .getLeafClassName();
096: if ("".equals(clientName)) {
097: //System.err.println("ERR_ClientNameIsNotValid");
098: getSectionView().getErrorPanel().setError(
099: new Error(Error.TYPE_FATAL, Error.ERROR_MESSAGE,
100: NbBundle.getMessage(
101: ClientGeneralInfoPanel.class,
102: "ERR_ClientNameIsNotValid"),
103: textClientName));
104: }
105: textClientName.setText(clientName);
106: }
107:
108: public JComponent getErrorComponent(@SuppressWarnings("unused")
109: final String errorId) {
110: return null;
111: }
112:
113: public void linkButtonPressed(@SuppressWarnings("unused")
114: final Object ddBean, @SuppressWarnings("unused")
115: final String ddProperty) {
116: }
117:
118: public void setValue(@SuppressWarnings("unused")
119: final JComponent source, @SuppressWarnings("unused")
120: final Object value) {
121: }
122:
123: /** This method is called from within the constructor to
124: * initialize the form.
125: * WARNING: Do NOT modify this code. The content of this method is
126: * always regenerated by the Form Editor.
127: */
128: // <editor-fold defaultstate="collapsed" desc=" Generated Code ">//GEN-BEGIN:initComponents
129: private void initComponents() {
130: java.awt.GridBagConstraints gridBagConstraints;
131:
132: jLabel1 = new javax.swing.JLabel();
133: textPackage = new javax.swing.JTextField();
134: jLabel2 = new javax.swing.JLabel();
135: textClientName = new javax.swing.JTextField();
136: jLabel3 = new javax.swing.JLabel();
137: textProject = new javax.swing.JTextField();
138:
139: setLayout(new java.awt.GridBagLayout());
140:
141: jLabel1.setLabelFor(textPackage);
142: org.openide.awt.Mnemonics.setLocalizedText(jLabel1,
143: org.openide.util.NbBundle.getMessage(
144: ClientGeneralInfoPanel.class, "LABEL_Package")); // NOI18N
145: gridBagConstraints = new java.awt.GridBagConstraints();
146: gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
147: gridBagConstraints.insets = new java.awt.Insets(5, 10, 0, 0);
148: add(jLabel1, gridBagConstraints);
149:
150: textPackage.setEditable(false);
151: gridBagConstraints = new java.awt.GridBagConstraints();
152: gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
153: gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
154: gridBagConstraints.weightx = 1.0;
155: gridBagConstraints.insets = new java.awt.Insets(5, 6, 0, 10);
156: add(textPackage, gridBagConstraints);
157:
158: jLabel2.setLabelFor(textClientName);
159: org.openide.awt.Mnemonics.setLocalizedText(jLabel2,
160: org.openide.util.NbBundle.getMessage(
161: ClientGeneralInfoPanel.class,
162: "LABEL_Client_Name")); // NOI18N
163: gridBagConstraints = new java.awt.GridBagConstraints();
164: gridBagConstraints.gridx = 0;
165: gridBagConstraints.gridy = 1;
166: gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
167: gridBagConstraints.insets = new java.awt.Insets(5, 10, 0, 0);
168: add(jLabel2, gridBagConstraints);
169:
170: textClientName.setEditable(false);
171: gridBagConstraints = new java.awt.GridBagConstraints();
172: gridBagConstraints.gridx = 1;
173: gridBagConstraints.gridy = 1;
174: gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
175: gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
176: gridBagConstraints.weightx = 1.0;
177: gridBagConstraints.insets = new java.awt.Insets(5, 6, 0, 10);
178: add(textClientName, gridBagConstraints);
179:
180: jLabel3.setLabelFor(textProject);
181: org.openide.awt.Mnemonics.setLocalizedText(jLabel3,
182: org.openide.util.NbBundle.getMessage(
183: ClientGeneralInfoPanel.class, "LABEL_Project")); // NOI18N
184: gridBagConstraints = new java.awt.GridBagConstraints();
185: gridBagConstraints.gridx = 0;
186: gridBagConstraints.gridy = 2;
187: gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
188: gridBagConstraints.insets = new java.awt.Insets(5, 10, 5, 0);
189: add(jLabel3, gridBagConstraints);
190:
191: textProject.setEditable(false);
192: gridBagConstraints = new java.awt.GridBagConstraints();
193: gridBagConstraints.gridx = 1;
194: gridBagConstraints.gridy = 2;
195: gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
196: gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
197: gridBagConstraints.weightx = 1.0;
198: gridBagConstraints.insets = new java.awt.Insets(5, 6, 5, 10);
199: add(textProject, gridBagConstraints);
200: }// </editor-fold>//GEN-END:initComponents
201:
202: // Variables declaration - do not modify//GEN-BEGIN:variables
203: private javax.swing.JLabel jLabel1;
204: private javax.swing.JLabel jLabel2;
205: private javax.swing.JLabel jLabel3;
206: private javax.swing.JTextField textClientName;
207: private javax.swing.JTextField textPackage;
208: private javax.swing.JTextField textProject;
209: // End of variables declaration//GEN-END:variables
210:
211: }
|