1 package org.apache.axis.tool.service.swing.ui; 2 3 import java.awt.event.ActionEvent ; 4 import java.awt.event.ActionListener ; 5 import java.awt.event.KeyEvent ; 6 import java.awt.event.KeyListener ; 7 8 import javax.swing.JButton ; 9 import javax.swing.JFrame ; 10 import javax.swing.JLabel ; 11 import javax.swing.JTextField ; 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 32 public class WizardPane1 extends WizardPane{ 33 34 private Page1Bean myBean = null; 35 36 private JLabel classFileLocationLabel; 37 private JTextField classFileLocationTextBox; 38 private JButton browseButton; 39 40 public WizardPane1(WizardBean wizardBean, JFrame 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 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 ("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 (); 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 (){ 79 public void actionPerformed(ActionEvent e) { 80 handleTextBoxChange(); 81 } 82 }); 83 this.classFileLocationTextBox.addKeyListener(new KeyListener (){ 84 public void keyTyped(KeyEvent e) { } 85 public void keyPressed(KeyEvent e) { } 86 public void keyReleased(KeyEvent e) { handleTextBoxChange();} 87 }); 88 89 this.browseButton = new JButton ("."); 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 (){ 93 public void actionPerformed(ActionEvent e) { 94 classFileLocationTextBox.setText(browseForAFolder()); 95 handleTextBoxChange(); 96 } 97 }); 98 } 99 100 101 private void handleTextBoxChange() { 102 String text = classFileLocationTextBox.getText(); 103 if (text!=null){ 104 this.myBean.setFileLocation(text); 105 } 106 } 107 108 109 } | Popular Tags |