1 32 33 package websphinx; 34 35 import java.net.URL ; 36 import java.net.MalformedURLException ; 37 38 45 public class FormButton extends Link { 46 47 Form form; 48 49 56 public FormButton (Tag startTag, Tag endTag, Form form) throws MalformedURLException { 57 super (startTag, endTag, null); 58 this.form = form; 59 if (form == null) 60 throw new MalformedURLException (); 61 } 62 63 67 public URL getURL () { 68 if (url == null) 69 try { 70 url = urlFromHref (getStartTag (), null); 71 } catch (MalformedURLException e) { 72 url = null; 73 } 74 75 return url; 76 } 77 78 82 public Form getForm () { 83 return form; 84 } 85 86 90 public int getMethod () { 91 return form.getMethod (); 92 } 93 94 100 protected URL urlFromHref (Tag tag, URL base) throws MalformedURLException { 101 if (parent == null || form == null) 102 return null; 105 return form.makeQuery (this); 106 } 107 108 } 109 | Popular Tags |