SilverStream
Application Server 3.5

com.sssw.rt.form
Class PvHelperDialog

java.lang.Object
 |
 +--com.sssw.rt.form.PvHelperDialog

public class PvHelperDialog
extends Object

The PvHelperDialog class provides methods to display dialog boxes. SilverStream automatically creates an instance of PvHelperDialog on every form called agDialog.


Field Summary
static int FORM_FRAME
           
static int FORM_MODAL
           
static int FORM_MODELESS
           
 
Constructor Summary
PvHelperDialog()
           
 
Method Summary
 void displayError(String caption, Throwable e)
          Displays an exception in a dialog box.
 void displayError(Throwable e)
          Displays an exception in a dialog box.
 AgfForm getForm(String formspec)
          Creates and returns a pre-defined form.
 AgfForm getForm(String formspec, Hashtable params)
          Creates and returns a pre-defined form.
 AgfForm getForm(String formspec, String query, String orderby, Hashtable params)
          Creates and returns a pre-defined form.
 Object showForm(String caption, AgfForm form, int type, boolean resizable, int x, int y)
          Shows a form in a window.
 Object showForm(String caption, String formspec, String query, String orderby, Hashtable params, int type, boolean resizable, int x, int y)
          Shows a form in a window.
 Object showFormDialog(String caption, AgfForm dialog)
          Displays a form in a modal dialog box.
 Object showFormDialog(String caption, String formspec)
          Displays a form in a modal dialog box.
 Object showFormDialog(String caption, String formspec, Hashtable params)
          Displays a form in a modal dialog box.
 Object showFormDialog(String caption, String formspec, String query, String orderby, Hashtable params)
          Displays a form in a modal dialog box.
 void showMessage(String message)
          Show a message Displays a dialog box with a message and an OK button.
 void showMessage(String caption, String message)
          Displays a dialog box with a message and an OK button.
 boolean showMessageOKCancel(String caption, String message)
          Displays a dialog with an OK button and a Cancel button.
 String showMessageYesAllNoCancel(String caption, String message)
          Show an alert with a Yes button (the default button), a No button, a Yes to All button and a Cancel button.
 boolean showMessageYesNo(String caption, String message)
          Displays a dialog with a Yes button and a No button.
 Boolean showMessageYesNoCancel(String caption, String message)
          Displays a dialog with a Yes button, a No button, and a Cancel button.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

FORM_MODAL

public static final int FORM_MODAL

FORM_MODELESS

public static final int FORM_MODELESS

FORM_FRAME

public static final int FORM_FRAME
Constructor Detail

PvHelperDialog

public PvHelperDialog()
Method Detail

showMessage

public void showMessage(String message)
Show a message Displays a dialog box with a message and an OK button.
Parameters:
message - the message to display
Usage:

The dialog displays 'Note' as its title.

Example:
  agDialog.showMessage("This is the Message");
 

showMessage

public void showMessage(String caption,
                        String message)
Displays a dialog box with a message and an OK button.
Parameters:
caption - the title of the dialog box
message - the message to display
Usage:

If null is passed for the caption text, the dialog displays 'Note' as its title.

Example:
  agDialog.showMessage("Caption","This is the Message");
 

showMessageOKCancel

public boolean showMessageOKCancel(String caption,
                                   String message)
Displays a dialog with an OK button and a Cancel button.
Parameters:
caption - the title of the dialog box
message - the message to display
Returns:
true if the user clicks the OK button, false if the user clicks the Cancel button
Example:
  boolean response;
  response = agDialog.showMessageOKCancel("Title", "This is the message, OK?");
 

showMessageYesNo

public boolean showMessageYesNo(String caption,
                                String message)
Displays a dialog with a Yes button and a No button.
Parameters:
caption - the title of the dialog box
message - the message to display
Returns:
true if the user clicks the Yes button, false if the user clicks the No button
Example:
  boolean response;
  response = agDialog.showMessageYesNo("Title","Can you read this message?");
 

showMessageYesNoCancel

public Boolean showMessageYesNoCancel(String caption,
                                      String message)
Displays a dialog with a Yes button, a No button, and a Cancel button.
Parameters:
caption - the title of the dialog box.
message - the message to display.
Returns:
Boolean.TRUE if the user clicks the Yes button, Boolean.FALSE if the user clicks the No button, and null if the user clicks the Cancel button
Example:
 	Boolean result;
 	result=AgDialog.showMessageYesNoCancel("Title",
 		"Save changes to this record?");
 
 	if (result == null)
 		// Abort the quit operation...
 	else if (result.booleanValue() == true)
 		// Save changes...
 	else if (result.booleanValue() == false)
 		// Abandon changes..
 

showMessageYesAllNoCancel

public String showMessageYesAllNoCancel(String caption,
                                        String message)
Show an alert with a Yes button (the default button), a No button, a Yes to All button and a Cancel button.
Returns:
"y" if the user selected Yes, "n" if the user selected No, "a" if the user selected All, or "x" if the user selected Cancel
Example:
 	String result = agDialog.showMessageYesAllNoCancel(
 		"Title", "Delete this file?");
 

displayError

public void displayError(Throwable e)
Displays an exception in a dialog box.
Parameters:
e - the exception to display
Example:
 	try
 	{
 		// Some processing that can throw an exception
 	}
 	catch (Exception e)
 	{
 		agDialog.displayError(e);
 	}
 

displayError

public void displayError(String caption,
                         Throwable e)
Displays an exception in a dialog box.
Parameters:
caption - the title of the dialog box
e - the exception to display
Example:
 	try
 	{
 		// Some processing that can throw an exception
 	}
 	catch (Exception e)
 	{
 		agDialog.displayError("MyApplication Error", e);
 	}
 

showForm

public Object showForm(String caption,
                       String formspec,
                       String query,
                       String orderby,
                       Hashtable params,
                       int type,
                       boolean resizable,
                       int x,
                       int y)
                throws AgoUnrecoverableSystemException,
                       AgoSecurityException,
                       IOException
Shows a form in a window.
Parameters:
caption - the title of the window
formspec - the name of the form to show
query - a query to select records for the form
orderby - an orderby clause for record selection for the form
parameters - parameters to pass to the form
windowType - the type of window to show. This parameter must be one of the constants agDialog.FORM_MODAL, agDialog.FORM_MODELESS, or agDialog.FORM_FRAME
resizable - specifies whether the window is resizable or not
x - the horizontal location of the window in pixels. Specify -1 for both x and y to center the window on the screen.
y - the the vertical location of the window in pixels. Specify -1 for both x and y to center the window on the screen.
Usage:

If the windowType is FORM_MODAL, the showForm() method returns the value passed to the form's call to closeDialog(), otherwise it returns the form object.

The formspec can be:

  • a form name, if the form is in the same database as the current form, or
  • database:formname, if the form is in a different database.

A window type of agDialog.FORM_MODAL results in a modal dialog. This restricts all user input to the new window until it is dismissed.
A window type of agDialog.FORM_MODELESS results in a modeless dialog. This allows input to the new window as well as to any other windows, but the new window always remains on top of the window containing the form that created it. A window type of agDialog.FORM_FRAME results in a new frame window. This window has no restrictions on input or position.

Example:
 	Hashtable params = new Hashtable();
 	// put appropriate data into hashtable here
 
 	AgfForm f;
 	try
 	{
 		f = agDialog.showForm("Employees", "EmployeeForm",
 			"Employees.salary > 35000", "Employees.lastname asc",
 			params, agDialog.FORM_MODAL, false, -1, -1);
 	}
 	catch (Exception e)
 	{
 		agDialog.displayError(e);
 		return;
 	}
 

showFormDialog

public Object showFormDialog(String caption,
                             String formspec,
                             String query,
                             String orderby,
                             Hashtable params)
                      throws AgoUnrecoverableSystemException,
                             AgoSecurityException,
                             IOException
Displays a form in a modal dialog box.
Parameters:
caption - the title of the window
formspec - the name of the form to show
query - a query to select records for the form
orderby - an orderby clause for record selection for the form
parameters - parameters to pass to the form
Usage:

Returns the value passed to the form's call to closeDialog().

The formspec can be:

  • a form name, if the form is in the same database as the current form, or
  • database:formname, if the form is in a different database.
Example:
 	Hashtable params = new Hashtable();
 	// put appropriate data into hashtable here
 
 	Object returnValue;
 	try
 	{
 		returnValue = agDialog.showFormDialog("Employees", "EmployeeForm",
 			"Employees.salary > 35000", "Employees.lastname asc",
 			params);
 	}
 	catch (Exception e)
 	{
 		agDialog.displayError(e);
 		return;
 	}
 

showFormDialog

public Object showFormDialog(String caption,
                             String formspec,
                             Hashtable params)
                      throws AgoUnrecoverableSystemException,
                             AgoSecurityException,
                             IOException
Displays a form in a modal dialog box.
Parameters:
caption - the title of the dialog box
formspec - the name of the form to show
params - parameters to pass to the form
Usage:

Returns the value passed to the form's call to closeDialog().

The formspec can be:

  • a form name, if the form is in the same database as the current form, or
  • database:formname, if the form is in a different database.
Example:
 	Hashtable params = new Hashtable();
 	// put appropriate data into hashtable here
 
 	Object returnValue;
 	try
 	{
 		returnValue = agDialog.showFormDialog("Update", "UpdateForm", params);
 	}
 	catch (Exception e)
 	{
 		agDialog.displayError(e);
 	}
 
See Also:
PvHelperDialog.getForm(String, Hashtable), AgoUnrecoverableSystemException

showFormDialog

public Object showFormDialog(String caption,
                             String formspec)
                      throws AgoUnrecoverableSystemException,
                             AgoSecurityException,
                             IOException
Displays a form in a modal dialog box.
Parameters:
caption - the title of the window
formspec - the name of the form to show
Usage:

Returns the value passed to the form's call to closeDialog().

The formspec can be:

  • a form name, if the form is in the same database as the current form, or
  • database:formname, if the form is in a different database.
Example:
 	Object returnValue;
 	try
 	{
 		returnValue = agDialog.showFormDialog("Options", "OptionsForm");
 	}
 	catch (Exception e)
 	{
 		agDialog.displayError(e);
 		return;
 	}
 

showForm

public Object showForm(String caption,
                       AgfForm form,
                       int type,
                       boolean resizable,
                       int x,
                       int y)
Shows a form in a window.
Parameters:
caption - the title of the window
form - the form to show
windowType - the type of window to show. This parameter must be one of the constants agDialog.FORM_MODAL, agDialog.FORM_MODELESS, or agDialog.FORM_FRAME.
resizable - specifies whether the window is resizable or not
x - the horizontal location of the window in pixels. Specify -1 for both x and y to center the window on the screen.
y - the the vertical location of the window in pixels. Specify -1 for both x and y to center the window on the screen.
Returns:
the value returned by the form's call to closeDialog() for a modal dialog; otherwise, the form itself.
Usage:

Use the getForm() method to get a form object.

If the windowType is FORM_MODAL, the showForm() method returns the value passed to the form's call to closeDialog(), otherwise it returns the form object.

A window type of agDialog.FORM_MODAL results in a modal dialog. This restricts all user input to the new window until it is dismissed.
A window type of agDialog.FORM_MODELESS results in a modeless dialog. This allows input to the new window as well as to any other windows, but the new window always remains on top of the window containing the form that created it. A window type of agDialog.FORM_FRAME results in a new frame window. This window can be has no restrictions on input or position.

Example:
 	AgfForm f;
 
 	// Get a form using getForm()
 
 	agDialog.showForm("Employees", f, agDialog.FORM_MODAL, false, -1, -1);
 

showFormDialog

public Object showFormDialog(String caption,
                             AgfForm dialog)
Displays a form in a modal dialog box.
Parameters:
caption - the title of the dialog box
form - the form to display
Usage:

Use the getForm() method to get a form object.

Returns the value passed to the form's call to closeDialog().

Example:
 	AgfForm f;
 
 	// Get a form using getForm()
 
 	Object returnValue = agDialog.showForm("Title", f);
 
See Also:
AgfForm

getForm

public AgfForm getForm(String formspec,
                       String query,
                       String orderby,
                       Hashtable params)
                throws AgoUnrecoverableSystemException,
                       AgoSecurityException,
                       IOException
Creates and returns a pre-defined form. The form is fully created, to the point where its formLoaded event has been fired.
Parameters:
formspec - the name of the form. A formspec is one of:
  • formname in current database
  • database:formname
  • full URL to the form
query - a query restringing the form's set of records
orderby - an Order By clause for the form's set of records
params - parameters to pass to the form
Returns:
a form object
Usage:

Use the showFormDialog() method to display the form in a dialog box. Use the add() method to add the form to the current form as a subform.

Example:
 	Hashtable params = new Hashtable();
 	// put appropriate data into hashtable here
 
 	AgfForm f;
 	try
 	{
 		f = agDialog.getForm("EmployeeForm",
 			"Employees.salary > 35000", "Employees.lastname asc",
 			params);
 	}
 	catch (Exception e)
 	{
 		agDialog.displayError(e);
 		return;
 	}
 

getForm

public AgfForm getForm(String formspec,
                       Hashtable params)
                throws AgoUnrecoverableSystemException,
                       AgoSecurityException,
                       IOException
Creates and returns a pre-defined form.
Parameters:
formspec - the name of the form. A formspec is one of:
  • formname in current database
  • database:formname
  • full URL to the form
params - parameters to pass to the form
Usage:

Use the showFormDialog() method to display the form in a dialog box. Use the add() method to add the form to the current form as a subform.

Example:
 	Hashtable params = new Hashtable();
 	// put appropriate data into hashtable here
 
 	AgfForm f;
 	try
 	{
 		f = agDialog.getForm("PopupForm1", params);
 	}
 	catch (Exception e)
 	{
 		agDialog.displayError(e);
 		return;
 	}
 
See Also:
AgfForm

getForm

public AgfForm getForm(String formspec)
                throws AgoUnrecoverableSystemException,
                       AgoSecurityException,
                       IOException
Creates and returns a pre-defined form.
Parameters:
formspec - the name of the form. A formspec is one of:
  • formname in current database
  • database:formname
  • full URL to the form
Usage:

Use the showFormDialog() method to display the form in a dialog box. Use the add() method to add the form to the current form as a subform.

Example:
 	AgfForm f;
 	try
 	{
 		f = agDialog.getForm("PopupForm1");
 	}
 	catch (Exception e)
 	{
 		agDialog.displayError(e);
 		return;
 	}
 
See Also:
AgfForm

SilverStream
Application Server 3.5