View Javadoc

1   /**
2    * .
3    */
4   package org.sirius.client.web.classes;
5   
6   import java.rmi.RemoteException;
7   
8   import org.sirius.client.web.WebClient;
9   
10  /**
11   * @author Myk Kolisnyk
12   * .
13   */
14  public class Form extends Frame {
15  
16      /**
17       * Initializes new instance of the Web Form object.
18       * @param client the reference to org.sirius.client.web.WebClient object.
19       * @param locator the string representing the search criteria for the current object.
20       */
21      public Form(final WebClient client, final String locator) {
22          super(client, locator);
23      }
24  
25      /**
26       * Retrieves the URL or script name which should be executed when Submit button is clicked.
27       * @return the value of the form <b>action</b> attribute.
28       * @throws RemoteException thrown when there's no connection with the server or some other connectivity problems.
29       */
30      public final String action() throws RemoteException {
31          return this.getClient()
32                  .core()
33                  .getAttribute(null, getLocator(), "action");
34      }
35  
36      /**
37       * Returns the name of the method which should be used to transfer the data. Notmally it's something like <b>GET</b> or <b>POST</b>.
38       * @return the value of the <b>method</b> form attribute.
39       * @throws Exception .
40       */
41      public final String method() throws Exception {
42          return this.getClient()
43                  .core()
44                  .getAttribute(null, getLocator(), "method");
45      }
46  
47      /**
48       * Returns the form name.
49       * @return the value of the form <b>name</b> attribute.
50       * @throws RemoteException thrown when there's no connection with the server or some other connectivity problems.
51       */
52      public final String name() throws RemoteException {
53          return this.getClient()
54                  .core()
55                  .getAttribute(null, getLocator(), "name");
56      }
57  
58      /**
59       * Submits current form by clicking the button which is defined as the type <b>submit</b> and belongs to current form.
60       * @throws RemoteException thrown when there's no connection with the server or some other connectivity problems.
61       */
62      public final void submit() throws RemoteException {
63          this.getClient().core().submit(null, getLocator());
64      }
65  }