mkristofic@1583
|
1 |
/*
|
mkristofic@1583
|
2 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
|
mkristofic@1583
|
3 |
*
|
mkristofic@1583
|
4 |
* Copyright 2009-2017 Oracle and/or its affiliates. All rights reserved.
|
mkristofic@1583
|
5 |
*
|
mkristofic@1583
|
6 |
* Oracle and Java are registered trademarks of Oracle and/or its affiliates.
|
mkristofic@1583
|
7 |
* Other names may be trademarks of their respective owners.
|
mkristofic@1583
|
8 |
*
|
mkristofic@1583
|
9 |
* The contents of this file are subject to the terms of either the GNU
|
mkristofic@1583
|
10 |
* General Public License Version 2 only ("GPL") or the Common
|
mkristofic@1583
|
11 |
* Development and Distribution License("CDDL") (collectively, the
|
mkristofic@1583
|
12 |
* "License"). You may not use this file except in compliance with the
|
mkristofic@1583
|
13 |
* License. You can obtain a copy of the License at
|
mkristofic@1583
|
14 |
* http://www.netbeans.org/cddl-gplv2.html
|
mkristofic@1583
|
15 |
* or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
|
mkristofic@1583
|
16 |
* specific language governing permissions and limitations under the
|
mkristofic@1583
|
17 |
* License. When distributing the software, include this License Header
|
mkristofic@1583
|
18 |
* Notice in each file and include the License file at
|
mkristofic@1583
|
19 |
* nbbuild/licenses/CDDL-GPL-2-CP. Oracle designates this
|
mkristofic@1583
|
20 |
* particular file as subject to the "Classpath" exception as provided
|
mkristofic@1583
|
21 |
* by Oracle in the GPL Version 2 section of the License file that
|
mkristofic@1583
|
22 |
* accompanied this code. If applicable, add the following below the
|
mkristofic@1583
|
23 |
* License Header, with the fields enclosed by brackets [] replaced by
|
mkristofic@1583
|
24 |
* your own identifying information:
|
mkristofic@1583
|
25 |
* "Portions Copyrighted [year] [name of copyright owner]"
|
mkristofic@1583
|
26 |
*
|
mkristofic@1583
|
27 |
* Contributor(s):
|
mkristofic@1583
|
28 |
*
|
mkristofic@1583
|
29 |
* The Original Software is NetBeans. The Initial Developer of the Original
|
mkristofic@1583
|
30 |
* Software is Sun Microsystems, Inc. Portions Copyright 2009-2010 Sun
|
mkristofic@1583
|
31 |
* Microsystems, Inc. All Rights Reserved.
|
mkristofic@1583
|
32 |
*
|
mkristofic@1583
|
33 |
* If you wish your version of this file to be governed by only the CDDL
|
mkristofic@1583
|
34 |
* or only the GPL Version 2, indicate your decision by adding
|
mkristofic@1583
|
35 |
* "[Contributor] elects to include this software in this distribution
|
mkristofic@1583
|
36 |
* under the [CDDL or GPL Version 2] license." If you do not indicate a
|
mkristofic@1583
|
37 |
* single choice of license, a recipient has the option to distribute
|
mkristofic@1583
|
38 |
* your version of this file under either the CDDL, the GPL Version 2 or
|
mkristofic@1583
|
39 |
* to extend the choice of license to its licensees as provided above.
|
mkristofic@1583
|
40 |
* However, if you add GPL Version 2 code and therefore, elected the GPL
|
mkristofic@1583
|
41 |
* Version 2 license, then the option applies only if the new code is
|
mkristofic@1583
|
42 |
* made subject to such option by the copyright holder.
|
mkristofic@1583
|
43 |
*/
|
skini@1208
|
44 |
/*
|
skini@1208
|
45 |
* ConfigurationEditorPanel.java
|
skini@1208
|
46 |
*
|
skini@1208
|
47 |
* Created on May 27, 2008, 12:21 PM
|
skini@1208
|
48 |
*/
|
skini@1208
|
49 |
|
skini@1208
|
50 |
package org.netbeans.modules.xml.wsdl.ui.actions;
|
skini@1208
|
51 |
|
skini@1208
|
52 |
import java.beans.PropertyChangeEvent;
|
skini@1208
|
53 |
import java.beans.PropertyChangeListener;
|
skini@1208
|
54 |
import javax.swing.JComponent;
|
skini@1208
|
55 |
import org.netbeans.modules.xml.wsdl.bindingsupport.spi.ExtensibilityElementConfigurationEditorComponent;
|
supernikita@1305
|
56 |
import org.netbeans.modules.xml.wsdl.bindingsupport.common.CommonMessagePanel;
|
skini@1208
|
57 |
import org.openide.DialogDescriptor;
|
skini@1208
|
58 |
|
skini@1208
|
59 |
/**
|
skini@1208
|
60 |
*
|
skini@1208
|
61 |
* @author skini
|
skini@1208
|
62 |
*/
|
skini@1208
|
63 |
public class ConfigurationEditorPanel extends javax.swing.JPanel implements PropertyChangeListener {
|
skini@1208
|
64 |
private CommonMessagePanel messagePanel;
|
skini@1208
|
65 |
private DialogDescriptor descriptor;
|
skini@1208
|
66 |
|
skini@1208
|
67 |
/** Creates new form ConfigurationEditorPanel */
|
skini@1208
|
68 |
public ConfigurationEditorPanel() {
|
skini@1208
|
69 |
initComponents();
|
skini@1208
|
70 |
messagePanel = new CommonMessagePanel();
|
skini@1208
|
71 |
jPanel2.add(messagePanel);
|
skini@1208
|
72 |
}
|
skini@1208
|
73 |
|
skini@1208
|
74 |
public void setInnerPanel(JComponent innerPane) {
|
skini@1208
|
75 |
if (jPanel1 != null) {
|
skini@1208
|
76 |
jPanel1.add(innerPane);
|
skini@1208
|
77 |
}
|
skini@1208
|
78 |
}
|
skini@1208
|
79 |
|
skini@1208
|
80 |
void setDialogDescriptor(DialogDescriptor descriptor) {
|
skini@1208
|
81 |
this.descriptor = descriptor;
|
skini@1208
|
82 |
}
|
skini@1208
|
83 |
|
skini@1208
|
84 |
/** This method is called from within the constructor to
|
skini@1208
|
85 |
* initialize the form.
|
skini@1208
|
86 |
* WARNING: Do NOT modify this code. The content of this method is
|
skini@1208
|
87 |
* always regenerated by the Form Editor.
|
skini@1208
|
88 |
*/
|
skini@1208
|
89 |
@SuppressWarnings("unchecked")
|
skini@1208
|
90 |
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
|
skini@1208
|
91 |
private void initComponents() {
|
skini@1208
|
92 |
|
skini@1208
|
93 |
jPanel1 = new javax.swing.JPanel();
|
skini@1208
|
94 |
jPanel2 = new javax.swing.JPanel();
|
skini@1208
|
95 |
|
skini@1208
|
96 |
jPanel1.setLayout(new javax.swing.BoxLayout(jPanel1, javax.swing.BoxLayout.LINE_AXIS));
|
skini@1208
|
97 |
|
skini@1208
|
98 |
jPanel2.setLayout(new javax.swing.BoxLayout(jPanel2, javax.swing.BoxLayout.LINE_AXIS));
|
skini@1208
|
99 |
|
skini@1208
|
100 |
org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(this);
|
skini@1208
|
101 |
this.setLayout(layout);
|
skini@1208
|
102 |
layout.setHorizontalGroup(
|
skini@1208
|
103 |
layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
|
skini@1208
|
104 |
.add(jPanel2, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 349, Short.MAX_VALUE)
|
skini@1208
|
105 |
.add(jPanel1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 349, Short.MAX_VALUE)
|
skini@1208
|
106 |
);
|
skini@1208
|
107 |
layout.setVerticalGroup(
|
skini@1208
|
108 |
layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
|
skini@1208
|
109 |
.add(org.jdesktop.layout.GroupLayout.TRAILING, layout.createSequentialGroup()
|
skini@1208
|
110 |
.add(jPanel1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 278, Short.MAX_VALUE)
|
skini@1208
|
111 |
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
|
skini@1208
|
112 |
.add(jPanel2, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
|
skini@1208
|
113 |
);
|
skini@1208
|
114 |
}// </editor-fold>//GEN-END:initComponents
|
skini@1208
|
115 |
|
skini@1208
|
116 |
|
skini@1208
|
117 |
// Variables declaration - do not modify//GEN-BEGIN:variables
|
skini@1208
|
118 |
private javax.swing.JPanel jPanel1;
|
skini@1208
|
119 |
private javax.swing.JPanel jPanel2;
|
skini@1208
|
120 |
// End of variables declaration//GEN-END:variables
|
skini@1208
|
121 |
|
skini@1208
|
122 |
public void propertyChange(PropertyChangeEvent evt) {
|
skini@1208
|
123 |
if (evt == null) return;
|
skini@1208
|
124 |
if (evt.getNewValue() instanceof String) {
|
skini@1208
|
125 |
String message = (String) evt.getNewValue();
|
skini@1208
|
126 |
boolean valid = true;
|
skini@1208
|
127 |
if (evt.getPropertyName().equals(ExtensibilityElementConfigurationEditorComponent.PROPERTY_ERROR_EVT)) {
|
skini@1208
|
128 |
messagePanel.setErrorMessage(message);
|
skini@1208
|
129 |
valid = false;
|
skini@1208
|
130 |
} else if (evt.getPropertyName().equals(ExtensibilityElementConfigurationEditorComponent.PROPERTY_WARNING_EVT)) {
|
skini@1208
|
131 |
messagePanel.setWarningMessage(message);
|
skini@1208
|
132 |
} else if (evt.getPropertyName().equals(ExtensibilityElementConfigurationEditorComponent.PROPERTY_CLEAR_MESSAGES_EVT)) {
|
skini@1208
|
133 |
messagePanel.setMessage("");
|
skini@1208
|
134 |
} else if (evt.getPropertyName().equals(ExtensibilityElementConfigurationEditorComponent.PROPERTY_NORMAL_MESSAGE_EVT)) {
|
skini@1208
|
135 |
messagePanel.setMessage(message);
|
skini@1208
|
136 |
}
|
skini@1208
|
137 |
descriptor.setValid(valid);
|
skini@1208
|
138 |
}
|
skini@1208
|
139 |
}
|
skini@1208
|
140 |
|
skini@1208
|
141 |
}
|