1 19 20 package org.netbeans.modules.websvc.jaxrpc.client.ui; 21 22 import org.openide.DialogDescriptor; 23 import org.openide.util.NbBundle; 24 import org.netbeans.modules.websvc.core.WsdlRetriever; 25 26 30 public class DownloadWsdlPanel extends javax.swing.JPanel implements WsdlRetriever.MessageReceiver { 31 32 private DialogDescriptor descriptor; 33 private WsdlRetriever retriever; 34 private String newWsdlUrl; 35 private String downloadMsg; 36 private boolean downloadOk; 37 38 public DownloadWsdlPanel(String newWsdlUrl) { 39 this.newWsdlUrl = newWsdlUrl; 40 this.retriever = null; 41 this.downloadMsg = " "; this.downloadOk = false; 43 44 initComponents(); 45 } 46 47 52 private void initComponents() { java.awt.GridBagConstraints gridBagConstraints; 54 55 jLblStatusLabel = new javax.swing.JLabel (); 56 jTxtStatus = new javax.swing.JLabel (); 57 58 setLayout(new java.awt.GridBagLayout ()); 59 60 jLblStatusLabel.setText(NbBundle.getMessage(DownloadWsdlPanel.class, "LBL_Status")); 61 gridBagConstraints = new java.awt.GridBagConstraints (); 62 gridBagConstraints.insets = new java.awt.Insets (11, 11, 11, 4); 63 add(jLblStatusLabel, gridBagConstraints); 64 65 gridBagConstraints = new java.awt.GridBagConstraints (); 66 gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER; 67 gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; 68 gridBagConstraints.weightx = 1.0; 69 gridBagConstraints.insets = new java.awt.Insets (11, 0, 11, 11); 70 add(jTxtStatus, gridBagConstraints); 71 72 } 74 75 private javax.swing.JLabel jLblStatusLabel; 77 private javax.swing.JLabel jTxtStatus; 78 80 public void addNotify() { 81 super.addNotify(); 82 83 retriever = new WsdlRetriever(this, newWsdlUrl); 84 new Thread (retriever).start(); 85 } 86 87 public void setDescriptor(DialogDescriptor descriptor) { 88 this.descriptor = descriptor; 89 descriptor.setValid(downloadOk); 90 } 91 92 public byte [] getWsdl() { 93 byte [] result = null; 94 95 if(retriever.getState() == WsdlRetriever.STATUS_COMPLETE) { 96 result = retriever.getWsdl(); 97 } 98 99 return result; 100 } 101 102 public void setWsdlDownloadMessage(String m) { 103 downloadMsg = m; 104 jTxtStatus.setText(downloadMsg); 105 106 if(retriever.getState() == WsdlRetriever.STATUS_COMPLETE) { 107 downloadOk = true; 108 109 } 111 112 descriptor.setValid(downloadOk); 113 } 114 115 public java.awt.Dimension getPreferredSize() { 116 java.awt.Dimension result = super.getPreferredSize(); 117 if(result.width < 240) { 118 result.width = 240; 119 } 120 return result; 121 } 122 } 123 | Popular Tags |