KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > modules > websvc > wsitconf > ui > service > subpanels > ServiceProviderSelectorPanel


1 /*
2  * The contents of this file are subject to the terms of the Common Development
3  * and Distribution License (the License). You may not use this file except in
4  * compliance with the License.
5  *
6  * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
7  * or http://www.netbeans.org/cddl.txt.
8  *
9  * When distributing Covered Code, include this CDDL Header Notice in each file
10  * and include the License file at http://www.netbeans.org/cddl.txt.
11  * If applicable, add the following below the CDDL Header, with the fields
12  * enclosed by brackets [] replaced by your own identifying information:
13  * "Portions Copyrighted [year] [name of copyright owner]"
14  *
15  * The Original Software is NetBeans. The Initial Developer of the Original
16  * Software is Sun Microsystems, Inc. Portions Copyright 2006 Sun
17  * Microsystems, Inc. All Rights Reserved.
18  */

19
20 package org.netbeans.modules.websvc.wsitconf.ui.service.subpanels;
21
22 import org.netbeans.modules.websvc.wsitconf.ui.ComboConstants;
23 import org.netbeans.modules.xml.multiview.ui.SectionVisualTheme;
24
25 /**
26  *
27  * @author Martin Grebac
28  */

29 public class ServiceProviderSelectorPanel extends javax.swing.JPanel JavaDoc {
30
31     private boolean inSync = false;
32     
33     /**
34      * Creates new form ServiceProviderSelectorPanel
35      */

36     public ServiceProviderSelectorPanel(String JavaDoc spUrl, String JavaDoc certAlias, String JavaDoc tokenType, String JavaDoc keyType) {
37         super();
38         
39         initComponents();
40
41         this.setSpUrl(spUrl);
42         this.setCertAlias(certAlias);
43         this.setTokenType(tokenType);
44         this.setKeyType(keyType);
45         
46         certAliasTextField.setBackground(SectionVisualTheme.getDocumentBackgroundColor());
47         certAliasLabel.setBackground(SectionVisualTheme.getDocumentBackgroundColor());
48         spUrlLabel.setBackground(SectionVisualTheme.getDocumentBackgroundColor());
49         spUrlTextField.setBackground(SectionVisualTheme.getDocumentBackgroundColor());
50         tokenTypeCombo.setBackground(SectionVisualTheme.getDocumentBackgroundColor());
51         tokenTypeLabel.setBackground(SectionVisualTheme.getDocumentBackgroundColor());
52         tokenTypeCombo.setBackground(SectionVisualTheme.getDocumentBackgroundColor());
53         tokenTypeLabel.setBackground(SectionVisualTheme.getDocumentBackgroundColor());
54         
55         inSync = true;
56         tokenTypeCombo.removeAllItems();
57         tokenTypeCombo.addItem(ComboConstants.ISSUED_TOKENTYPE_SAML10);
58         tokenTypeCombo.addItem(ComboConstants.ISSUED_TOKENTYPE_SAML11);
59         tokenTypeCombo.addItem(ComboConstants.ISSUED_TOKENTYPE_SAML20);
60         tokenTypeCombo.setSelectedIndex(1); //saml11
61

62         keyTypeCombo.removeAllItems();
63         keyTypeCombo.addItem(ComboConstants.ISSUED_KEYTYPE_PUBLIC);
64         keyTypeCombo.addItem(ComboConstants.ISSUED_KEYTYPE_SYMMETRIC);
65         inSync = false;
66     }
67
68     public String JavaDoc getSpUrl() {
69         return spUrlTextField.getText();
70     }
71
72     public void setSpUrl(String JavaDoc spUrl) {
73         this.spUrlTextField.setText(spUrl);
74     }
75
76     public String JavaDoc getCertAlias() {
77         return certAliasTextField.getText();
78     }
79
80     public void setCertAlias(String JavaDoc certAlias) {
81         this.certAliasTextField.setText(certAlias);
82     }
83
84     public String JavaDoc getTokenType() {
85         return (String JavaDoc)tokenTypeCombo.getSelectedItem();
86     }
87
88     public void setTokenType(String JavaDoc tokenType) {
89         if (tokenType != null) {
90             this.tokenTypeCombo.setSelectedItem(tokenType);
91         }
92     }
93
94     public String JavaDoc getKeyType() {
95         return (String JavaDoc)tokenTypeCombo.getSelectedItem();
96     }
97
98     public void setKeyType(String JavaDoc keyType) {
99         if (keyType != null) {
100             this.keyTypeCombo.setSelectedItem(keyType);
101         }
102     }
103     
104     /** This method is called from within the constructor to
105      * initialize the form.
106      * WARNING: Do NOT modify this code. The content of this method is
107      * always regenerated by the Form Editor.
108      */

109     // <editor-fold defaultstate="collapsed" desc=" Generated Code ">//GEN-BEGIN:initComponents
110
private void initComponents() {
111
112         spUrlLabel = new javax.swing.JLabel JavaDoc();
113         certAliasLabel = new javax.swing.JLabel JavaDoc();
114         tokenTypeLabel = new javax.swing.JLabel JavaDoc();
115         spUrlTextField = new javax.swing.JTextField JavaDoc();
116         certAliasTextField = new javax.swing.JTextField JavaDoc();
117         tokenTypeCombo = new javax.swing.JComboBox JavaDoc();
118         keyTypeLabel = new javax.swing.JLabel JavaDoc();
119         keyTypeCombo = new javax.swing.JComboBox JavaDoc();
120
121         spUrlLabel.setText(org.openide.util.NbBundle.getMessage(ServiceProviderSelectorPanel.class, "LBL_STSConfig_ProviderURL")); // NOI18N
122

123         certAliasLabel.setText(org.openide.util.NbBundle.getMessage(ServiceProviderSelectorPanel.class, "LBL_STSConfig_Alias")); // NOI18N
124

125         tokenTypeLabel.setText(org.openide.util.NbBundle.getMessage(ServiceProviderSelectorPanel.class, "LBL_STSConfig_TokenType")); // NOI18N
126

127         keyTypeLabel.setText(org.openide.util.NbBundle.getMessage(ServiceProviderSelectorPanel.class, "LBL_STSConfig_KeyType")); // NOI18N
128

129         org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(this);
130         this.setLayout(layout);
131         layout.setHorizontalGroup(
132             layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
133             .add(layout.createSequentialGroup()
134                 .addContainerGap()
135                 .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
136                     .add(spUrlLabel)
137                     .add(certAliasLabel)
138                     .add(tokenTypeLabel)
139                     .add(keyTypeLabel))
140                 .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
141                 .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
142                     .add(spUrlTextField, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 288, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
143                     .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING, false)
144                         .add(org.jdesktop.layout.GroupLayout.LEADING, certAliasTextField)
145                         .add(org.jdesktop.layout.GroupLayout.LEADING, tokenTypeCombo, 0, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
146                         .add(org.jdesktop.layout.GroupLayout.LEADING, keyTypeCombo, 0, 114, Short.MAX_VALUE)))
147                 .addContainerGap(org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
148         );
149
150         layout.linkSize(new java.awt.Component JavaDoc[] {certAliasTextField, keyTypeCombo, tokenTypeCombo}, org.jdesktop.layout.GroupLayout.HORIZONTAL);
151
152         layout.setVerticalGroup(
153             layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
154             .add(layout.createSequentialGroup()
155                 .addContainerGap()
156                 .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
157                     .add(spUrlLabel)
158                     .add(spUrlTextField, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
159                 .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
160                 .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
161                     .add(certAliasLabel)
162                     .add(certAliasTextField, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
163                 .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
164                 .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
165                     .add(tokenTypeLabel)
166                     .add(tokenTypeCombo, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
167                 .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
168                 .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
169                     .add(keyTypeLabel)
170                     .add(keyTypeCombo, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 22, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
171                 .addContainerGap(org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
172         );
173     }// </editor-fold>//GEN-END:initComponents
174

175     // Variables declaration - do not modify//GEN-BEGIN:variables
176
private javax.swing.JLabel JavaDoc certAliasLabel;
177     private javax.swing.JTextField JavaDoc certAliasTextField;
178     private javax.swing.JComboBox JavaDoc keyTypeCombo;
179     private javax.swing.JLabel JavaDoc keyTypeLabel;
180     private javax.swing.JLabel JavaDoc spUrlLabel;
181     private javax.swing.JTextField JavaDoc spUrlTextField;
182     private javax.swing.JComboBox JavaDoc tokenTypeCombo;
183     private javax.swing.JLabel JavaDoc tokenTypeLabel;
184     // End of variables declaration//GEN-END:variables
185

186 }
187
Popular Tags