[UP]
Wd_types
 Wd_types.application_type
 Wd_types.dialog_decl_type
 Wd_types.dialog_type
 Wd_types.session_manager_type
 Wd_types.session_type
 Wd_types.syntax_tree_type
 Wd_types.template_type
 Wd_types.universe_type
   
WDialog API for Objective Caml: Wd_types.dialog_type

Class type virtual Wd_types.dialog_type


class type virtual dialog_type = object .. end
This class contains the dialog instance

method copy : dialog_type
return a copy of the dialog

The copy is not attached to a session, even if the original object is.

method name : string
return the name of the dialog
method page_name : string
return the name of the current page
method page_names : string list
returns the names of all defined pages of this dialog
method variable : string -> dialog_type poly_var_value
variable n: Get the variable with name n, or raise No_such_variable. The name n cannot only refer to variables declared in this dialog, but also to variables of subdialogs using the dot notation: "name1.name2...nameN". Here, name1 must be a dialog variable, and name2 a variable of this subdialog, and so on, until the final variable nameN is reached, whose value is returned. - The dot notation is accepted by the following methods, too.
method variable_decl : string -> dialog_type poly_var_decl
method string_variable : string -> string
string_variable n: Get the contents of the string variable n. Raise No_such_variable if the variable does not exist. Runtime_error if the variable is not a string.
method enum_variable : string -> string list
enum_variable n: Get the contents of the enumerator variable n. The enumerator must have been declared. The returned list contains only the internal values. Raise No_such_variable if the variable does not exist. Runtime_error if the variable is not a declared enumerator.
method dyn_enum_variable : string -> (string * string) list
dyn_enum_variable n: Get the contents of the enumerator variable n. The enumerator may be dynamic or may be declared. The returned list contains both the internal and the external values. Raise No_such_variable if the variable does not exist. Runtime_error if the variable is not an enumerator.
method dialog_variable : string -> dialog_type option
dialog_variable n: Get the contents of the dialog variable n. Raise No_such_variable if the variable does not exist. Runtime_error if the variable is not a dialog.
method alist_variable : string -> (string * dialog_type poly_var_value) list
alist_variable n: Get the contents of the associative variable n. Raise No_such_variable if the variable does not exist. Runtime_error if the variable is not an alist.
method lookup_string_variable : string -> string -> string
method lookup_enum_variable : string -> string -> string list
method lookup_dyn_enum_variable : string -> string -> (string * string) list
method lookup_dialog_variable : string -> string -> dialog_type option
lookup_*_variable n x: Get the contents of the associative variable n at index x. No_such_variable if the variable does not exist. Not_found if the variable is undefined at x. Runtime_error if the variable has the wrong type.
method set_variable : string -> dialog_type poly_var_value -> unit
set_variable n v: Sets the variable n to the value v. The value v must be compatible to the declared type of the variable. No_such_variable if the variable does not exist. Runtime_error if the variable is not compatible.
method unset_variable : string -> unit
unset_variable n: Sets the variable n to the declared default value. If the default is not declared, the following default values apply: For strings: the default is the empty string. For enumerators: the default is the empty list. For dialogs: the default is that the value does not exist.
method lookup_uploaded_file : string -> Netcgi_types.cgi_argument option
lookup_uploaded_file name: Checks whether the file upload box name was used. If so, Some arg, where arg is the transporting CGI argument is returned. If the box was not used, but the box exists, None is returned. Raises a Runtime_error if the named box does not exist.

Important note: Uploaded files are not persistent. This means that they are only existent in the handle phase, not during initialization nor the prepare_page phase. You get a failure "Upload.get: not initialized" if you try to access uploaded files in the wrong moment.

method dump : Format.formatter -> unit
dump f output a textual description of the current state into formatter f. (A debugging aid.)
method next_page : string
Returns the name of the designated next page.
method set_next_page : string -> unit
Sets the name of the designated next page
method event : event
returns the event that just has happened
method is_server_popup_request : bool
Returns whether someone invoked set_server_popup_request before. This is usually done if an dialog is restored for a server-driven popup window (tag ui:server-popup).
method serialize : (dialog_type, unit) Hashtbl.t -> Buffer.t -> unit
Writes the state of this dialog into the buffer. The hashtable is used in the recursive descent into the object hierarchy to remember which dialogs have already been serialized. Call the method initially with an empty hash table.
method unserialize : (universe_type, dialog_type, environment)
poly_ds_buf -> unit
Sets the state of this dialog from the deserialization buffer which must contain previously serialized dialog.
method enter_session_scope : session_type -> unit
Tells the dialog the current session
method leave_session_scope : unit -> unit
Tells the dialog that it is no longer under control of this session
method session : session_type
Returns the current session. Fails when there is no session
method environment : environment
Return the environment of the current CGI activation
method declaration : dialog_decl_type
Return the declaration of this dialog
method application : application_type
Return the application
method universe : universe_type
Return the universe
The following methods must be defined in subclasses:
method virtual prepare_page : unit -> unit
This method is invoked just before a new output page is generated.

Preconditions:

The method page_name returns the name of this page. The method event still returns the action last happened, but the name of the page where this action happened is lost. It may be interesting whether the last event was No_event because this indicates that the page is the initial page of the dialog.

This method should set any variables which are necessary to generate the new page (mostly variable containing HTML fragments). Furthermore, any state that needs to be saved should be put into variables, too.

method virtual handle : unit -> unit
This method is invoked just after the user triggered an event (e.g. pressed a button).

Preconditions: The method page_name returns the name of the page that was visible while the event was triggered. The method event returns the description of the event.

Postconditions: The method may set the next page to display by invoking set_next_page; if it does not then the default will be used. The default is either specified by the XML element describing the interactor that triggered the event, or the default is otherwise this page again.

This method should modify the variables according to the event that happened, and optionally set the next page to display.

There is also an alternate way to go to another page: raising the exception Change_page.

By raising the exception Change_dialog this method may force to go to another dialog.