KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > axis > tool > service > swing > ui > WizardPane1


1 package org.apache.axis.tool.service.swing.ui;
2
3 import java.awt.event.ActionEvent JavaDoc;
4 import java.awt.event.ActionListener JavaDoc;
5 import java.awt.event.KeyEvent JavaDoc;
6 import java.awt.event.KeyListener JavaDoc;
7
8 import javax.swing.JButton JavaDoc;
9 import javax.swing.JFrame JavaDoc;
10 import javax.swing.JLabel JavaDoc;
11 import javax.swing.JTextField JavaDoc;
12
13 import org.apache.axis.tool.service.bean.Page1Bean;
14 import org.apache.axis.tool.service.bean.WizardBean;
15 import org.apache.axis.tool.util.Constants;
16
17 /*
18  * Copyright 2004,2005 The Apache Software Foundation.
19  *
20  * Licensed under the Apache License, Version 2.0 (the "License");
21  * you may not use this file except in compliance with the License.
22  * You may obtain a copy of the License at
23  *
24  * http://www.apache.org/licenses/LICENSE-2.0
25  *
26  * Unless required by applicable law or agreed to in writing, software
27  * distributed under the License is distributed on an "AS IS" BASIS,
28  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
29  * See the License for the specific language governing permissions and
30  * limitations under the License.
31  */

32 public class WizardPane1 extends WizardPane{
33
34     private Page1Bean myBean = null;
35
36     private JLabel JavaDoc classFileLocationLabel;
37     private JTextField JavaDoc classFileLocationTextBox;
38     private JButton JavaDoc browseButton;
39
40     public WizardPane1(WizardBean wizardBean, JFrame JavaDoc ownerFrame) {
41
42         super(ownerFrame);
43
44         init();
45
46         if (wizardBean.getPage1bean()!= null){
47             myBean = wizardBean.getPage1bean();
48             this.classFileLocationTextBox.setText(myBean.getFileLocation());
49         }else{
50             myBean = new Page1Bean();
51             wizardBean.setPage1bean(myBean);
52         }
53
54
55     }
56
57     public boolean validateValues() {
58         String JavaDoc text = myBean.getFileLocation();
59         return (text!=null && text.trim().length()>0);
60     }
61
62     private void init(){
63         this.setLayout(null);
64         this.setSize(width,height);
65
66         initDescription("Welcome to the new AXIS Service packager Wizard Interface.\n\n " +
67                         "Insert the location for the class files here.This should be a folder with \n" +
68                         " the compiled classes");
69
70
71         this.classFileLocationLabel = new JLabel JavaDoc("class file location");
72         this.add(this.classFileLocationLabel);
73         this.classFileLocationLabel.setBounds(hgap,descHeight,Constants.UIConstants.LABEL_WIDTH,Constants.UIConstants.GENERAL_COMP_HEIGHT);
74
75         this.classFileLocationTextBox = new JTextField JavaDoc();
76         this.add(this.classFileLocationTextBox);
77         this.classFileLocationTextBox.setBounds(Constants.UIConstants.LABEL_WIDTH + 2*hgap ,descHeight,Constants.UIConstants.TEXT_BOX_WIDTH,Constants.UIConstants.GENERAL_COMP_HEIGHT);
78         this.classFileLocationTextBox.addActionListener(new ActionListener JavaDoc(){
79             public void actionPerformed(ActionEvent JavaDoc e) {
80                 handleTextBoxChange();
81             }
82         });
83         this.classFileLocationTextBox.addKeyListener(new KeyListener JavaDoc(){
84             public void keyTyped(KeyEvent JavaDoc e) { }
85             public void keyPressed(KeyEvent JavaDoc e) { }
86             public void keyReleased(KeyEvent JavaDoc e) { handleTextBoxChange();}
87         });
88
89         this.browseButton = new JButton JavaDoc(".");
90         this.add(this.browseButton);
91         this.browseButton.setBounds(Constants.UIConstants.LABEL_WIDTH + 2*hgap +Constants.UIConstants.TEXT_BOX_WIDTH,descHeight,Constants.UIConstants.BROWSE_BUTTON_WIDTH,Constants.UIConstants.GENERAL_COMP_HEIGHT);
92         this.browseButton.addActionListener(new ActionListener JavaDoc(){
93             public void actionPerformed(ActionEvent JavaDoc e) {
94                 classFileLocationTextBox.setText(browseForAFolder());
95                 handleTextBoxChange();
96             }
97         });
98     }
99
100
101     private void handleTextBoxChange() {
102         String JavaDoc text = classFileLocationTextBox.getText();
103         if (text!=null){
104             this.myBean.setFileLocation(text);
105         }
106     }
107
108
109 }
Popular Tags