001: /*
002: * Licensed to the Apache Software Foundation (ASF) under one
003: * or more contributor license agreements. See the NOTICE file
004: * distributed with this work for additional information
005: * regarding copyright ownership. The ASF licenses this file
006: * to you under the Apache License, Version 2.0 (the
007: * "License"); you may not use this file except in compliance
008: * with the License. You may obtain a copy of the License at
009: *
010: * http://www.apache.org/licenses/LICENSE-2.0
011: *
012: * Unless required by applicable law or agreed to in writing,
013: * software distributed under the License is distributed on an
014: * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
015: * KIND, either express or implied. See the License for the
016: * specific language governing permissions and limitations
017: * under the License.
018: */
019: package org.apache.axis2.tools.java2wsdl;
020:
021: import org.apache.axis2.tools.bean.WsdlgenBean;
022: import org.apache.axis2.tools.component.WizardPanel;
023: import org.apache.axis2.tools.component.WizardComponents;
024: import org.apache.axis2.tools.wizardframe.CodegenFrame;
025:
026: import javax.swing.*;
027: import java.awt.*;
028:
029: /**
030: * this is the first panel of java2wsdl wizard
031: */
032: public class OptionPanel extends WizardPanel {
033: /**
034: * variable
035: */
036: private JTextField txtNsp;
037: private JTextField txtNspPrefix;
038: private JTextField txtSchemaTargetNsp;
039: private JTextField txtSchemaTargetNspPrefix;
040: private JTextField txtService;
041: private WsdlgenBean wsdlgenBean;
042:
043: /**
044: * Construct method
045: * @param wizardComponents
046: * @param wsdlgenBean
047: */
048: public OptionPanel(WizardComponents wizardComponents,
049: WsdlgenBean wsdlgenBean) {
050: super (wizardComponents, "Axis2 Idea Plugin Java2WSDL Wizards");
051: setPanelTopTitle("Java to WSDL Options");
052: setPanelBottomTitle("Set the Option for the generation");
053: this .wsdlgenBean = wsdlgenBean;
054: init();
055: }
056:
057: /** initaite method*/
058: public void init() {
059:
060: txtNsp = new JTextField();
061:
062: txtNspPrefix = new JTextField();
063:
064: txtSchemaTargetNsp = new JTextField();
065:
066: txtSchemaTargetNspPrefix = new JTextField();
067:
068: txtService = new JTextField();
069:
070: setBackButtonEnabled(true);
071: setNextButtonEnabled(true);
072: setFinishButtonEnabled(false);
073: this .setLayout(new GridBagLayout());
074:
075: this .add(new JLabel("Target Namespace"),
076: new GridBagConstraints(0, 0, 1, 1, 0.1, 0.0,
077: GridBagConstraints.WEST,
078: GridBagConstraints.NONE,
079: new Insets(5, 20, 0, 0), 0, 0));
080:
081: this .add(txtNsp, new GridBagConstraints(1, 0, 2, 1, 1.0, 0.0,
082: GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL,
083: new Insets(5, 5, 0, 20), 0, 0));
084:
085: this .add(new JLabel("Target Namespace Prefix"),
086: new GridBagConstraints(0, 1, 1, 1, 0.1, 0.0,
087: GridBagConstraints.WEST,
088: GridBagConstraints.NONE,
089: new Insets(5, 20, 0, 0), 0, 0));
090:
091: this .add(txtNspPrefix, new GridBagConstraints(1, 1, 2, 1, 1.0,
092: 0.0, GridBagConstraints.WEST,
093: GridBagConstraints.HORIZONTAL, new Insets(5, 5, 0, 20),
094: 0, 0));
095:
096: this .add(new JLabel("Schema Target Namespace"),
097: new GridBagConstraints(0, 2, 1, 1, 0.1, 0.0,
098: GridBagConstraints.WEST,
099: GridBagConstraints.NONE,
100: new Insets(5, 20, 0, 0), 0, 0));
101:
102: this .add(txtSchemaTargetNsp, new GridBagConstraints(1, 2, 2, 1,
103: 1.0, 0.0, GridBagConstraints.WEST,
104: GridBagConstraints.HORIZONTAL, new Insets(5, 5, 0, 20),
105: 0, 0));
106:
107: this .add(new JLabel("Schema Target Namespace Prefix"),
108: new GridBagConstraints(0, 3, 1, 1, 0.1, 0.0,
109: GridBagConstraints.WEST,
110: GridBagConstraints.NONE,
111: new Insets(5, 20, 0, 0), 0, 0));
112:
113: this .add(txtSchemaTargetNspPrefix, new GridBagConstraints(1, 3,
114: 2, 1, 1.0, 0.0, GridBagConstraints.WEST,
115: GridBagConstraints.HORIZONTAL, new Insets(5, 5, 0, 20),
116: 0, 0));
117:
118: this
119: .add(new JLabel("Service Name"),
120: new GridBagConstraints(0, 4, 1, 1, 0.1, 1.0,
121: GridBagConstraints.NORTHWEST,
122: GridBagConstraints.NONE, new Insets(5,
123: 20, 0, 0), 0, 0));
124:
125: this .add(txtService, new GridBagConstraints(1, 4, 2, 1, 1.0,
126: 1.0, GridBagConstraints.NORTHWEST,
127: GridBagConstraints.HORIZONTAL, new Insets(5, 5, 0, 20),
128: 0, 0));
129:
130: }
131:
132: //next
133: public void next() {
134: switchPanel(CodegenFrame.PANEL_LAST_B);
135: }
136:
137: //back
138: public void back() {
139: switchPanel(CodegenFrame.PANEL_FIRST_B);
140: }
141:
142: //update
143: public void update() {
144: if (wsdlgenBean.getTargetNamespace() != null)
145: txtNsp.setText(wsdlgenBean.getTargetNamespace());
146: if (wsdlgenBean.getTargetNamespacePrefix() != null)
147: txtNspPrefix
148: .setText(wsdlgenBean.getTargetNamespacePrefix());
149: if (wsdlgenBean.getSchemaTargetNamespace() != null)
150: txtSchemaTargetNsp.setText(wsdlgenBean
151: .getSchemaTargetNamespace());
152: if (wsdlgenBean.getSchemaTargetNamespacePrefix() != null)
153: txtSchemaTargetNspPrefix.setText(wsdlgenBean
154: .getSchemaTargetNamespacePrefix());
155: if (wsdlgenBean.getServiceName() != null)
156: txtService.setText(wsdlgenBean.getServiceName());
157: ((OutputPanel) getWizardComponents().getWizardPanel(
158: CodegenFrame.PANEL_LAST_B)).loadCmbCurrentProject();
159: ((OutputPanel) getWizardComponents().getWizardPanel(
160: CodegenFrame.PANEL_LAST_B)).loadcmbModuleSrcProject();
161: setBackButtonEnabled(true);
162: setNextButtonEnabled(true);
163: setFinishButtonEnabled(false);
164: setPageComplete(isComplete());
165: }
166:
167: // get page type
168: public int getPageType() {
169: return WizardPanel.JAVA_2_WSDL_TYPE;
170: }
171:
172: private boolean isComplete() {
173: if (txtNsp.getText() != null && txtNspPrefix.getText() != null
174: && txtSchemaTargetNsp.getText() != null
175: && txtSchemaTargetNspPrefix.getText() != null
176: && txtService.getText() != null) {
177: return true;
178: } else {
179: return false;
180: }
181: }
182: }
|